Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EVM state breakers on new gen #218

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/ante/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler {
NewEthSetUpContextDecorator(options.EvmKeeper), // outermost AnteDecorator. SetUpContext must be called first
NewEthMempoolFeeDecorator(options.EvmKeeper), // Check eth effective gas price against minimal-gas-prices
NewEthValidateBasicDecorator(options.EvmKeeper),
// TODO: UNCOMMENT THIS FOR PROD!!!!!!
// NewEthTxPayloadVerificationDecorator(),
NewEthTxPayloadVerificationDecorator(),
NewEthSigVerificationDecorator(options.EvmKeeper),
NewEthAccountVerificationDecorator(options.AccountKeeper, options.EvmKeeper),
NewEthGasConsumeDecorator(options.EvmKeeper, options.MaxTxGasWanted),
Expand Down
12 changes: 2 additions & 10 deletions x/evm/keeper/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,24 +382,16 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, msg core.Message, trace
// take over the nonce management from evm:
// reset sender's nonce to msg.Nonce() before calling evm on msg nonce
// as nonce already increased in db
// TODO: UNCOMMENT THIS FOR PROD!!!!!!
// stateDB.SetNonce(sender.Address(), msg.Nonce())
stateDB.SetNonce(sender.Address(), msg.Nonce())

if contractCreation {
// no need to increase nonce here as contract as during contract creation:
// - tx.origin nonce increase automatically
// - if IsEIP158 enabled, contract nonce will be set as 1

// NOTE: REMOVE THIS FOR PROD!!!!!!!!!!!
stateDB.SetNonce(sender.Address(), msg.Nonce())
ret, _, leftoverGas, vmErr = evm.Create(sender, msg.Data(), leftoverGas, msg.Value())

// NOTE: REMOVE THIS FOR PROD!!!!!!!!!!!
stateDB.SetNonce(sender.Address(), msg.Nonce()+1)
} else {
// should be incresed before call on nonce from msg so we make sure nonce remaining same as on init tx
// TODO: UNCOMMENT THIS FOR PROD!!!!!!
// stateDB.SetNonce(sender.Address(), msg.Nonce()+1)
stateDB.SetNonce(sender.Address(), msg.Nonce()+1)
ret, leftoverGas, vmErr = evm.Call(sender, *msg.To(), msg.Data(), leftoverGas, msg.Value())
}

Expand Down