Skip to content

Commit

Permalink
[evm] remove NotCheckPutStateErrorOption() (#4040)
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinxie committed Jan 8, 2024
1 parent 3ec3374 commit 6171bdb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
3 changes: 0 additions & 3 deletions action/protocol/execution/evm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,6 @@ func prepareStateDB(ctx context.Context, sm protocol.StateManager) (*StateDBAdap
if featureCtx.RevertLog {
opts = append(opts, RevertLogOption())
}
if !featureCtx.FixUnproductiveDelegates {
opts = append(opts, NotCheckPutStateErrorOption())
}
if !featureCtx.CorrectGasRefund {
opts = append(opts, ManualCorrectGasRefundOption())
}
Expand Down
12 changes: 1 addition & 11 deletions action/protocol/execution/evm/evmstatedbadapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ type (
legacyNonceAccount bool
fixSnapshotOrder bool
revertLog bool
notCheckPutStateError bool
manualCorrectGasRefund bool
}
)
Expand Down Expand Up @@ -131,14 +130,6 @@ func RevertLogOption() StateDBAdapterOption {
}
}

// NotCheckPutStateErrorOption set notCheckPutStateError as true
func NotCheckPutStateErrorOption() StateDBAdapterOption {
return func(adapter *StateDBAdapter) error {
adapter.notCheckPutStateError = true
return nil
}
}

// ManualCorrectGasRefundOption set manualCorrectGasRefund as true
func ManualCorrectGasRefundOption() StateDBAdapterOption {
return func(adapter *StateDBAdapter) error {
Expand Down Expand Up @@ -990,8 +981,7 @@ func (stateDB *StateDBAdapter) CommitContracts() error {
v := stateDB.preimages[k]
h := make([]byte, len(k))
copy(h, k[:])
_, err = stateDB.sm.PutState(v, protocol.NamespaceOption(PreimageKVNameSpace), protocol.KeyOption(h))
if !stateDB.notCheckPutStateError && err != nil {
if _, err = stateDB.sm.PutState(v, protocol.NamespaceOption(PreimageKVNameSpace), protocol.KeyOption(h)); err != nil {
stateDB.logError(err)
return errors.Wrap(err, "failed to update preimage to db")
}
Expand Down

0 comments on commit 6171bdb

Please sign in to comment.