alloy-core 1.0, alloy 0.14, revm 0.22 (001)

This moves to Rust 1.86 as were prior on Rust 1.81, and the new alloy
dependencies require 1.82.

The revm API changes were notable for us. Instead of relying on a modified call
instruction (with deep introspection into the EVM design), we now use the more
recent and now more prominent Inspector API. This:

1) Lets us perform far less introspection
2) Forces us to rewrite the gas estimation code we just had audited

Thankfully, it itself should be much easier to read/review, and our existing
test suite has extensively validated it.

This resolves 001 which was a concern for if/when this upgrade occurs. By doing
it now, with a dedicated test case ensuring the issue we would have had with
alloy-core 0.8 and `validate=false` isn't actively an issue, we resolve it.
This commit is contained in:
Luke Parker
2025-04-12 08:09:09 -04:00
parent 5a7b815e2e
commit 184c02714a
25 changed files with 1483 additions and 625 deletions

View File

@@ -22,5 +22,5 @@ borsh = { version = "1", default-features = false, features = ["std", "derive",
group = { version = "0.13", default-features = false }
k256 = { version = "^0.13.1", default-features = false, features = ["std", "arithmetic"] }
alloy-primitives = { version = "0.8", default-features = false }
alloy-consensus = { version = "0.9", default-features = false, features = ["k256"] }
alloy-primitives = { version = "1", default-features = false }
alloy-consensus = { version = "0.14", default-features = false, features = ["k256"] }

View File

@@ -7,7 +7,7 @@ use ::borsh::{BorshSerialize, BorshDeserialize};
use group::ff::PrimeField;
use k256::Scalar;
use alloy_primitives::PrimitiveSignature;
use alloy_primitives::Signature;
use alloy_consensus::{SignableTransaction, Signed, TxLegacy};
mod borsh;
@@ -68,8 +68,7 @@ pub fn deterministically_sign(tx: TxLegacy) -> Signed<TxLegacy> {
let s = Scalar::ONE;
let r_bytes: [u8; 32] = r.to_repr().into();
let s_bytes: [u8; 32] = s.to_repr().into();
let signature =
PrimitiveSignature::from_scalars_and_parity(r_bytes.into(), s_bytes.into(), false);
let signature = Signature::from_scalars_and_parity(r_bytes.into(), s_bytes.into(), false);
let res = tx.into_signed(signature);
debug_assert!(res.recover_signer().is_ok());