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

Fix/evm gas estimation cherry pick #1201

Closed
wants to merge 4 commits into from

Conversation

JohnReedV
Copy link
Contributor

Description

Cherry-picked evm gas estimation fix from #1184

@JohnReedV JohnReedV requested a review from unconst as a code owner January 27, 2025 18:21
@github-actions github-actions bot added the hotfix This PR needs to be merged very quickly and will likely skip testing on devnet and testnet label Jan 27, 2025
Copy link

🚨🚨🚨 HOTFIX DETECTED 🚨🚨🚨

It looks like you are trying to merge a hotfix PR into main. If this isn't what you wanted to do, and you just wanted to make a regular PR, please close this PR, base your changes off the devnet-ready branch and open a new PR into devnet ready.

If you are trying to merge a hotfix PR, please complete the following essential steps:

  1. go ahead and get this PR into main merged, so we can get the change in as quickly as possible!
  2. merge main into testnet, bumping spec_version
  3. deploy testnet
  4. merge testnet into devnet, bumping spec_version
  5. deploy devnet
  6. merge devnet into devnet-ready

If you do not complete these steps, your hotfix may be inadvertently removed in the future when branches are promoted to main, so it is essential that you do so.

let amount: U256 = handle.context().apparent_value;
let method = get_slice(txdata, 0, 4)?;
if get_method_id("transfer(bytes32)") != method {
return Ok(PrecompileOutput {
Copy link
Contributor

Choose a reason for hiding this comment

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

it is better to return Err if the method not found in the contract.

let address_bytes_dst: &[u8] = get_slice(txdata, 4, 36)?;
let account_id_src = bytes_to_account_id(&ADDRESS_BYTES_SRC)?;
let account_id_dst = bytes_to_account_id(address_bytes_dst)?;
if amount_sub.is_zero() {
Copy link
Contributor

Choose a reason for hiding this comment

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

the same as last comment. return Err if the parameter is invalid.

@JohnReedV JohnReedV closed this Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotfix This PR needs to be merged very quickly and will likely skip testing on devnet and testnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants