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

Feat: Add EIP-7702 - new type transaction #960

Open
wants to merge 16 commits into
base: feat/prague-hard-fork
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix clippy
mrLSD committed Jan 16, 2025
commit 6e7ea18bd71211efb08a589c4c6cf6a4c079ff73
15 changes: 7 additions & 8 deletions engine-transactions/src/eip_7702.rs
Original file line number Diff line number Diff line change
@@ -167,16 +167,15 @@ impl SignedTransaction7702 {
// `chain_id = 0 || current_chain_id`.
// AS `current_chain_id` we used `transaction.chain_id` as we will validate `chain_id` in
// Engine `submit_transaction` method.
let mut is_valid = auth.chain_id.is_zero() || auth.chain_id == current_tx_chain_id;

// Step 2 - validation logic inside EVM itself.
// Step 3. Checking: authority = ecrecover(keccak(MAGIC || rlp([chain_id, address, nonce])), y_parity, r, s])
// Validate the signature, as in tests it is possible to have invalid signatures values.

// Value `v` shouldn't be greater then 1
if auth.parity > U256::from(1) {
is_valid = false;
}
let mut is_valid = auth.chain_id.is_zero()
|| auth.chain_id == current_tx_chain_id
|| auth.parity <= U256::from(1);

let v = u8::try_from(auth.parity.as_u64()).map_err(|_| Error::InvalidV)?;
// EIP-2 validation
if auth.s > SECP256K1N_HALF {
@@ -440,7 +439,7 @@ mod tests {
};

let signed_tx = SignedTransaction7702 {
transaction: tx.clone(),
transaction: tx,
parity: 0,
r: 2.into(),
s: 3.into(),
@@ -511,7 +510,7 @@ mod tests {
s: 3.into(),
}];
let signed_tx = SignedTransaction7702 {
transaction: tx.clone(),
transaction: tx,
parity: 0,
r: 2.into(),
s: 3.into(),
@@ -564,7 +563,7 @@ mod tests {
s: SECP256K1N_HALF + U256::from(1),
}];
let signed_tx = SignedTransaction7702 {
transaction: tx.clone(),
transaction: tx,
parity: 0,
r: 2.into(),
s: 3.into(),