Skip to content

Commit

Permalink
Problem: performance regression because of un-cached sender recovery (e…
Browse files Browse the repository at this point in the history
…vmos#350)

Solution:
- re-order ante handlers, use cached from address
  • Loading branch information
yihuang authored and dudong2 committed Nov 15, 2023
1 parent 6a8ad57 commit f0c4147
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/ante/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler {
NewEthValidateBasicDecorator(options.EvmKeeper),
NewEthSigVerificationDecorator(options.EvmKeeper),
NewEthAccountVerificationDecorator(options.AccountKeeper, options.EvmKeeper),
extra,
NewCanTransferDecorator(options.EvmKeeper),
NewEthGasConsumeDecorator(options.EvmKeeper, options.MaxTxGasWanted),
NewEthIncrementSenderSequenceDecorator(options.AccountKeeper), // innermost AnteDecorator.
Expand All @@ -100,6 +101,7 @@ func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler {
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
extra,
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
Expand Down
4 changes: 4 additions & 0 deletions x/evm/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ func (msg *MsgEthereumTx) GetMsgs() []sdk.Msg {
//
// NOTE: This method panics if 'Sign' hasn't been called first.
func (msg *MsgEthereumTx) GetSigners() []sdk.AccAddress {
if len(msg.From) > 0 {
return []sdk.AccAddress{common.HexToAddress(msg.From).Bytes()}
}

data, err := UnpackTxData(msg.Data)
if err != nil {
panic(err)
Expand Down

0 comments on commit f0c4147

Please sign in to comment.