Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

perf: make use of sender cache to reduce hotspot #1705

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion app/ante/sigverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (esvd EthSigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, s
"rejected unprotected Ethereum transaction. Please EIP155 sign your transaction to protect it against replay-attacks")
}

sender, err := signer.Sender(ethTx)
sender, err := ethtypes.Sender(signer, ethTx)
if err != nil {
return ctx, errorsmod.Wrapf(
errortypes.ErrorInvalidSigner,
Expand Down
3 changes: 2 additions & 1 deletion x/evm/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ func (msg MsgEthereumTx) AsMessage(signer ethtypes.Signer, baseFee *big.Int) (co
// GetSender extracts the sender address from the signature values using the latest signer for the given chainID.
func (msg *MsgEthereumTx) GetSender(chainID *big.Int) (common.Address, error) {
signer := ethtypes.LatestSignerForChainID(chainID)
from, err := signer.Sender(msg.AsTransaction())
tx := msg.AsTransaction()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we better to fill the tx.from field using msg.From here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes? ethtyes.Sender set in tx.from.Store

Copy link
Contributor

@yihuang yihuang Mar 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the tx is a temporary object, cache sender inside is not useful, we might need to find a way to cache the eth tx itself.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crypto-org-chain#227
I did a simple fix here.

from, err := ethtypes.Sender(signer, tx)
if err != nil {
return common.Address{}, err
}
Expand Down