Skip to content

Commit

Permalink
Unset return data in state generation
Browse files Browse the repository at this point in the history
  • Loading branch information
simonlechner committed Dec 9, 2024
1 parent 2620ea1 commit 840a34c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
8 changes: 1 addition & 7 deletions go/ct/gen/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,12 +471,6 @@ func (g *StateGenerator) generateWith(rnd *rand.Rand, assignment Assignment) (*s
// Generate return data of last call
resultLastCallReturnData := RandomBytes(rnd, st.MaxDataSize)

// Generate return data for terminal states.
var resultReturnData Bytes
if resultStatus == st.Stopped || resultStatus == st.Reverted {
resultReturnData = RandomBytes(rnd, st.MaxDataSize)
}

// Invoke SelfDestructedGenerator
resultHasSelfdestructed, err := g.hasSelfDestructedGen.Generate(rnd)
if err != nil {
Expand Down Expand Up @@ -534,6 +528,7 @@ func (g *StateGenerator) generateWith(rnd *rand.Rand, assignment Assignment) (*s

resultRevision := GetRevisionForBlock(resultBlockContext.BlockNumber)

// Return data is not set as it should only be set by RETURN/REVERT opcodes.
result := st.NewState(resultCode)
result.Status = resultStatus
result.Revision = resultRevision
Expand All @@ -552,7 +547,6 @@ func (g *StateGenerator) generateWith(rnd *rand.Rand, assignment Assignment) (*s
result.TransactionContext = resultTransactionContext
result.CallData = resultCallData
result.LastCallReturnData = resultLastCallReturnData
result.ReturnData = resultReturnData
result.HasSelfDestructed = resultHasSelfdestructed
result.RecentBlockHashes = resultRecentBlockHashes

Expand Down
1 change: 1 addition & 0 deletions go/ct/spc/specification.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func getAllRules() []Rule {
),
Effect: Change(func(s *st.State) {
s.Status = st.Stopped
s.ReturnData = Bytes{}
s.Pc++
}),
})
Expand Down
3 changes: 1 addition & 2 deletions regression_inputs/no_code_#958.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
"44e536d9beb6692f f1771bc7786d984f e8121ed7845eb679 7481234b5f8357fc",
"a4908db06f82ce80 fa765578d53df1b1 79aa3a06d8ea630a 5946bb7a396ca860",
"5567e6eac386c167 503cbc87f4045ae3 03416fcf004cb556 f2339e0f9dad807a"
],
"ReturnData": "3078"
]
}

0 comments on commit 840a34c

Please sign in to comment.