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

chore(reth116): Ugly dirty yolo attempt at reth 1.1.6 update. #370

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ryanschneider
Copy link
Contributor

📝 Summary

This was just a quick test for me to see how bad the update to 1.1.6 will be now that we are on 1.1.5 (note that 1.1.6 hasn't been released yet, and we don't know what the final version needed for pectra will be).

My focus was on getting things to compile vs. changing method/trait signatures, so opted for .clone() etc as the quick and dirty way, obviously it'd be much better foruse to refactor our code to work around the upstream changes where possible.

💡 Motivation and Context

Making sure we can reasonably update to the final epctra release without major surprises.

A non-exhaustive list of what's changed upstream:

  • tx.hash() -> TxHash is removed in favor of tx.tx_hash() -> &TxHash so we need to either change our code to use references or add a bunch of .clones()
  • Most methods that took CfgEnv and BlockEnv arguments now instead take a &EvmEnv e.g. SystemCaller.pre_block_blockhashes_contract_call. We might want to change our context to hold a EvmEnv instead of .initialized_cfg/.block_env. For now I used an ugly clone/into monstrosity.
  • TransactionSignedEcRecovered is marked deprecated in favor of Recovered<TransactionSigned> so generates a couple pages of deprecated warnings when building
  • there doesn't seem to be an optimism feature on reth/primitives crate any more, removing it from rbuilder Cargo.toml seemed to work (with caveat about other build errors possibly blocking it)

It still doesn't compile, here's what's left to fix:

cargo build output:

   Compiling rbuilder v0.1.0 (/Users/ryanschneider/rust/rbuilder/crates/rbuilder)
warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
  --> crates/rbuilder/src/backtest/restore_landed_orders/resim_landed_block.rs:13:32
   |
13 | use reth_primitives::{Receipt, TransactionSignedEcRecovered};
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
  --> crates/rbuilder/src/backtest/restore_landed_orders/resim_landed_block.rs:19:9
   |
19 |     tx: TransactionSignedEcRecovered,
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
 --> crates/rbuilder/src/building/evm_inspector.rs:4:22
  |
4 | use reth_primitives::TransactionSignedEcRecovered;
  |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
  --> crates/rbuilder/src/building/evm_inspector.rs:60:37
   |
60 |     fn use_tx_nonce(&mut self, tx: &TransactionSignedEcRecovered) {
   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
   --> crates/rbuilder/src/building/evm_inspector.rs:212:14
    |
212 |         tx: &TransactionSignedEcRecovered,
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
 --> crates/rbuilder/src/building/payout_tx.rs:8:60
  |
8 | use reth_primitives::{transaction::FillTxEnv, Transaction, TransactionSignedEcRecovered};
  |                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
  --> crates/rbuilder/src/building/payout_tx.rs:19:13
   |
19 | ) -> Result<TransactionSignedEcRecovered, secp256k1::Error> {
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
  --> crates/rbuilder/src/building/testing/test_chain_state.rs:14:61
   |
14 |     primitives::{Account, BlockBody, Bytecode, SealedBlock, TransactionSignedEcRecovered},
   |                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
   --> crates/rbuilder/src/building/testing/test_chain_state.rs:222:57
    |
222 |     pub fn sign_tx(&self, args: TxArgs) -> eyre::Result<TransactionSignedEcRecovered> {
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
  --> crates/rbuilder/src/live_builder/mod.rs:41:22
   |
41 | use reth_primitives::TransactionSignedEcRecovered;
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
   --> crates/rbuilder/src/live_builder/mod.rs:383:9
    |
383 |     tx: TransactionSignedEcRecovered,
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
  --> crates/rbuilder/src/primitives/mod.rs:25:56
   |
25 |     PooledTransaction, Transaction, TransactionSigned, TransactionSignedEcRecovered,
   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
   --> crates/rbuilder/src/primitives/mod.rs:410:9
    |
410 |     tx: TransactionSignedEcRecovered,
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
   --> crates/rbuilder/src/primitives/mod.rs:477:13
    |
477 |         tx: TransactionSignedEcRecovered,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
   --> crates/rbuilder/src/primitives/mod.rs:498:29
    |
498 |     pub fn new_no_blobs(tx: TransactionSignedEcRecovered) -> Result<Self, TxWithBlobsCreateError> {
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
   --> crates/rbuilder/src/primitives/mod.rs:511:13
    |
511 |         tx: TransactionSignedEcRecovered,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
   --> crates/rbuilder/src/primitives/mod.rs:524:32
    |
524 |     pub fn new_for_testing(tx: TransactionSignedEcRecovered) -> Self {
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
   --> crates/rbuilder/src/primitives/mod.rs:553:44
    |
553 |     pub fn internal_tx_unsecure(&self) -> &TransactionSignedEcRecovered {
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
   --> crates/rbuilder/src/primitives/mod.rs:558:47
    |
558 |     pub fn into_internal_tx_unsecure(self) -> TransactionSignedEcRecovered {
    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
 --> crates/rbuilder/src/primitives/test_data_generator.rs:3:55
  |
3 | use reth_primitives::{Transaction, TransactionSigned, TransactionSignedEcRecovered};
  |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
  --> crates/rbuilder/src/primitives/test_data_generator.rs:21:36
   |
21 |     pub fn create_tx(&mut self) -> TransactionSignedEcRecovered {
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
  --> crates/rbuilder/src/primitives/test_data_generator.rs:25:70
   |
25 |     pub fn create_tx_nonce(&mut self, sender_nonce: AccountNonce) -> TransactionSignedEcRecovered {
   |                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
  --> crates/rbuilder/src/primitives/test_data_generator.rs:26:9
   |
26 |         TransactionSignedEcRecovered::new_unchecked(
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
 --> crates/rbuilder/src/utils/tx_signer.rs:3:60
  |
3 |     public_key_to_address, Transaction, TransactionSigned, TransactionSignedEcRecovered,
  |                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
  --> crates/rbuilder/src/utils/tx_signer.rs:40:17
   |
40 |     ) -> Result<TransactionSignedEcRecovered, secp256k1::Error> {
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated type alias `reth_primitives::TransactionSignedEcRecovered`: Use `Recovered` instead
  --> crates/rbuilder/src/utils/tx_signer.rs:43:12
   |
43 |         Ok(TransactionSignedEcRecovered::new_unchecked(
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0282]: type annotations needed
   --> crates/rbuilder/src/building/testing/test_chain_state.rs:128:22
    |
128 |                     .try_seal_with_senders()
    |                      ^^^^^^^^^^^^^^^^^^^^^ cannot infer type

error[E0277]: the trait bound `TransactionSigned: From<reth_primitives::Recovered<TransactionSigned>>` is not satisfied
   --> crates/rbuilder/src/building/mod.rs:764:60
    |
764 |                     .map(|t| t.into_internal_tx_unsecure().into())
    |                                                            ^^^^ the trait `From<reth_primitives::Recovered<TransactionSigned>>` is not implemented for `TransactionSigned`
    |
    = help: the following other types implement trait `From<T>`:
              `TransactionSigned` implements `From<PooledTransaction>`
              `TransactionSigned` implements `From<alloy_consensus::Signed<T>>`
              `TransactionSigned` implements `From<reth_ethereum_primitives::transaction::serde_bincode_compat::TransactionSigned<'_>>`
    = note: required for `reth_primitives::Recovered<TransactionSigned>` to implement `Into<TransactionSigned>`

error[E0599]: no method named `ok_or` found for enum `std::result::Result` in the current scope
   --> crates/rbuilder/src/primitives/mod.rs:580:14
    |
578 |           let signer = pooled_tx
    |  ______________________-
579 | |             .recover_signer()
580 | |             .ok_or(TxWithBlobsCreateError::InvalidTransactionSignature)?;
    | |             -^^^^^ method not found in `Result<Address, RecoveryError>`
    | |_____________|
    |

error[E0599]: no method named `with_signer` found for struct `TransactionSigned` in the current scope
   --> crates/rbuilder/src/primitives/mod.rs:587:79
    |
587 |                 TransactionSignedEcRecoveredWithBlobs::new_no_blobs(tx_signed.with_signer(signer))
    |                                                                               ^^^^^^^^^^^ method not found in `TransactionSigned`
    |
   ::: /Users/ryanschneider/.cargo/git/checkouts/reth-36d3ea1d1152b20c/82a0734/crates/primitives-traits/src/transaction/signed.rs:214:8
    |
214 |     fn with_signer(self, signer: Address) -> Recovered<Self> {
    |        ----------- the method is available for `TransactionSigned` here
    |
    = help: items from traits can only be used if the trait is in scope
help: trait `SignedTransactionIntoRecoveredExt` which provides `with_signer` is implemented but not in scope; perhaps you want to import it
    |
3   + use reth_primitives::transaction::SignedTransactionIntoRecoveredExt;
    |

error[E0599]: no method named `with_signer` found for struct `TransactionSigned` in the current scope
   --> crates/rbuilder/src/primitives/mod.rs:595:35
    |
595 |                     tx: tx_signed.with_signer(signer),
    |                                   ^^^^^^^^^^^ method not found in `TransactionSigned`
    |
   ::: /Users/ryanschneider/.cargo/git/checkouts/reth-36d3ea1d1152b20c/82a0734/crates/primitives-traits/src/transaction/signed.rs:214:8
    |
214 |     fn with_signer(self, signer: Address) -> Recovered<Self> {
    |        ----------- the method is available for `TransactionSigned` here
    |
    = help: items from traits can only be used if the trait is in scope
help: trait `SignedTransactionIntoRecoveredExt` which provides `with_signer` is implemented but not in scope; perhaps you want to import it
    |
3   + use reth_primitives::transaction::SignedTransactionIntoRecoveredExt;
    |

error[E0599]: no method named `into_ecrecovered` found for struct `TransactionSigned` in the current scope
   --> crates/rbuilder/src/primitives/mod.rs:609:14
    |
608 |           let tx = decoded
    |  __________________-
609 | |             .into_ecrecovered()
    | |_____________-^^^^^^^^^^^^^^^^
    |
help: there is a method `try_into_ecrecovered` with a similar name
    |
609 |             .try_into_ecrecovered()
    |              ~~~~~~~~~~~~~~~~~~~~

error[E0599]: no method named `signature_hash` found for enum `reth_primitives::Transaction` in the current scope
   --> crates/rbuilder/src/utils/tx_signer.rs:41:46
    |
41  |         let signature = self.sign_message(tx.signature_hash())?;
    |                                              ^^^^^^^^^^^^^^ method not found in `Transaction`
    |
   ::: /Users/ryanschneider/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alloy-consensus-0.9.2/src/transaction/mod.rs:228:8
    |
228 |     fn signature_hash(&self) -> B256 {
    |        -------------- the method is available for `reth_primitives::Transaction` here
    |
    = help: items from traits can only be used if the trait is in scope
help: trait `SignableTransaction` which provides `signature_hash` is implemented but not in scope; perhaps you want to import it
    |
1   + use alloy_consensus::SignableTransaction;
    |

Some errors have detailed explanations: E0277, E0282, E0599.
For more information about an error, try `rustc --explain E0277`.
warning: `rbuilder` (lib) generated 26 warnings
error: could not compile `rbuilder` (lib) due to 7 previous errors; 26 warnings emitted


✅ I have completed the following steps:

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

@efbig efbig mentioned this pull request Jan 29, 2025
3 tasks
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.

1 participant