core/vm: don't call SetCode after contract creation if initcode didn't return anything (#32916)

The code change is a noop here, and the tracing hook shouldn't be
invoked if the account code doesn't actually change.
This commit is contained in:
jwasinger 2025-10-20 17:51:29 +08:00 committed by Alvarez
parent e79261da40
commit 56f4f2b2b0

View file

@ -601,7 +601,9 @@ func (evm *EVM) initNewContract(contract *Contract, address common.Address) ([]b
}
}
evm.StateDB.SetCode(address, ret, tracing.CodeChangeContractCreation)
if len(ret) > 0 {
evm.StateDB.SetCode(address, ret, tracing.CodeChangeContractCreation)
}
return ret, nil
}