mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Revert excution when postOp reverts
This commit is contained in:
parent
4513a3d59c
commit
e61ee6c3cd
1 changed files with 3 additions and 0 deletions
|
|
@ -336,6 +336,7 @@ func applyPaymasterPostOpFrame(vpr *ValidationPhaseResult, executionResult *Exec
|
||||||
func ApplyRip7560ExecutionPhase(config *params.ChainConfig, vpr *ValidationPhaseResult, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, cfg vm.Config) (*types.Receipt, error) {
|
func ApplyRip7560ExecutionPhase(config *params.ChainConfig, vpr *ValidationPhaseResult, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, cfg vm.Config) (*types.Receipt, error) {
|
||||||
|
|
||||||
// TODO: snapshot EVM - we will revert back here if postOp fails
|
// TODO: snapshot EVM - we will revert back here if postOp fails
|
||||||
|
snapshotId := statedb.Snapshot()
|
||||||
|
|
||||||
blockContext := NewEVMBlockContext(header, bc, author)
|
blockContext := NewEVMBlockContext(header, bc, author)
|
||||||
message, err := TransactionToMessage(vpr.Tx, types.MakeSigner(config, header.Number, header.Time), header.BaseFee)
|
message, err := TransactionToMessage(vpr.Tx, types.MakeSigner(config, header.Number, header.Time), header.BaseFee)
|
||||||
|
|
@ -352,7 +353,9 @@ func ApplyRip7560ExecutionPhase(config *params.ChainConfig, vpr *ValidationPhase
|
||||||
if len(vpr.PaymasterContext) != 0 {
|
if len(vpr.PaymasterContext) != 0 {
|
||||||
paymasterPostOpResult, err = applyPaymasterPostOpFrame(vpr, executionResult, evm, gp, statedb, header)
|
paymasterPostOpResult, err = applyPaymasterPostOpFrame(vpr, executionResult, evm, gp, statedb, header)
|
||||||
}
|
}
|
||||||
|
// PostOp failed, reverting execution changes
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
statedb.RevertToSnapshot(snapshotId)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue