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

CfgEnv.chain_id should be u64 #671

Closed
DaniPopes opened this issue Aug 31, 2023 · 0 comments · Fixed by #693
Closed

CfgEnv.chain_id should be u64 #671

DaniPopes opened this issue Aug 31, 2023 · 0 comments · Fixed by #693

Comments

@DaniPopes
Copy link
Collaborator

DaniPopes commented Aug 31, 2023

The only check done is by converting TxEnv.chain_id to U256 which is redundant:

// Check if the transaction's chain id is correct
if let Some(tx_chain_id) = self.tx.chain_id {
if U256::from(tx_chain_id) != self.cfg.chain_id {
return Err(InvalidTransaction::InvalidChainId);
}
}

It can be converted to U256 directly in the CHAINID opcode with U256::from, since it's very cheap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant