Skip to content

Commit b6a4ac9

Browse files
authored
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.
1 parent cfb3111 commit b6a4ac9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/vm/evm.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,9 @@ func (evm *EVM) initNewContract(contract *Contract, address common.Address) ([]b
601601
}
602602
}
603603

604-
evm.StateDB.SetCode(address, ret, tracing.CodeChangeContractCreation)
604+
if len(ret) > 0 {
605+
evm.StateDB.SetCode(address, ret, tracing.CodeChangeContractCreation)
606+
}
605607
return ret, nil
606608
}
607609

0 commit comments

Comments
 (0)