File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -385,6 +385,27 @@ func newTestAction(addr common.Address, r *rand.Rand) testAction {
385385 }
386386 },
387387 },
388+ {
389+ name : "CreateContract" ,
390+ fn : func (a testAction , s * StateDB ) {
391+ if ! s .Exist (addr ) {
392+ s .CreateAccount (addr )
393+ }
394+ contractHash := s .GetCodeHash (addr )
395+ emptyCode := contractHash == (common.Hash {}) || contractHash == types .EmptyCodeHash
396+ storageRoot := s .GetStorageRoot (addr )
397+ emptyStorage := storageRoot == (common.Hash {}) || storageRoot == types .EmptyRootHash
398+ if s .GetNonce (addr ) == 0 && emptyCode && emptyStorage {
399+ s .CreateContract (addr )
400+ // We also set some code here, to prevent the
401+ // CreateContract action from being performed twice in a row,
402+ // which would cause a difference in state when unrolling
403+ // the journal. (CreateContact assumes created was false prior to
404+ // invocation, and the journal rollback sets it to false).
405+ s .SetCode (addr , []byte {1 })
406+ }
407+ },
408+ },
388409 {
389410 name : "SelfDestruct" ,
390411 fn : func (a testAction , s * StateDB ) {
You can’t perform that action at this time.
0 commit comments