Skip to content

Upgrade reth 1.11.3 -> 2.2.0#928

Open
faheelsattar wants to merge 4 commits into
flashbots:developfrom
faheelsattar:faheel/reth-2.2-migration
Open

Upgrade reth 1.11.3 -> 2.2.0#928
faheelsattar wants to merge 4 commits into
flashbots:developfrom
faheelsattar:faheel/reth-2.2-migration

Conversation

@faheelsattar

Copy link
Copy Markdown
Contributor

📝 Summary

Bumps reth version from 1.11.3 to 2.2.0, and alloy dependencies.

💡 Motivation and Context

As part of adding support for epbs in rbuilder we were required to upgrade reth to 2.0. We initially added it via #855, but later decided to separate out the version bump in its own PR.

✅ I have completed the following steps:

  • Run make lint
  • Run make test
  • Added tests (if applicable)

Comment thread crates/rbuilder/src/building/mod.rs Outdated
extra_data: extra_data.clone().into(),
withdrawals: Some(attributes.withdrawals()),
parent_beacon_block_root: attributes.parent_beacon_block_root(),
extra_data: Bytes::new(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why did you remove the extra data? Probably it's not really needed now but maybe it's safer for future changes to keep the real one?

gas_refunded,
..
} => Ok(Some(gas_used + gas_refunded)),
ExecutionResult::Success { .. } => Ok(Some(res.result.tx_gas_used())),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You removed the gas_refunded why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the new revm changed ExecutionResult::Success to carry a single ResultGas instead of seperate gas_used and gas_refunded fields. Therefore i think instead of using just tx_gas_used, I can use total_gas_spent, which returns the total gas spent inside execution before any refunds

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think you should us total_gas_spent or add refunded gas.
Notice:

    #[inline]
    pub const fn tx_gas_used(&self) -> u64 {
        // consiste of regular and state gas.
        let total_gas_spent = self.total_gas_spent();
        // from total gas subtract the refunded gas. Refunded is capped by 20% of total gas spent.
        let tx_gas_refunded = total_gas_spent.saturating_sub(self.inner_refunded());
        max(tx_gas_refunded, self.floor_gas())
    }

As far as I understand, a tx is executed consuming up to the gaslimit set and after execution gas refunds are performed. So if the extra "refund gas" is not added to the limits the tx will fail. Do I have this wrong?

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 this pull request may close these issues.

2 participants