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: euclid v2 #158

Open
wants to merge 7 commits into
base: scroll
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 4 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -678,10 +678,10 @@ crunchy = "=0.2.2"
#
# revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", rev = "1207e33" }

[patch.crates-io]
revm = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/reth/v55" }
revm-primitives = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/reth/v55" }
revm-interpreter = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/reth/v55" }
[patch.crates-io] # FIXME: replace by v55 when it's merged
revm = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/feat/v55/euclid-v2" }
revm-primitives = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/feat/v55/euclid-v2" }
revm-interpreter = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/feat/v55/euclid-v2" }

ff = { git = "https://github.com/scroll-tech/ff", branch = "feat/sp1" }

Expand Down
2 changes: 2 additions & 0 deletions crates/primitives-traits/src/size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ mod scroll {
Self::Legacy(tx) => tx.size(),
Self::Eip2930(tx) => tx.size(),
Self::Eip1559(tx) => tx.size(),
Self::Eip7702(tx) => tx.size(),
Self::L1Message(tx) => tx.size(),
}
}
Expand All @@ -172,6 +173,7 @@ mod scroll {
Self::Legacy(tx) => tx.size(),
Self::Eip2930(tx) => tx.size(),
Self::Eip1559(tx) => tx.size(),
Self::Eip7702(tx) => tx.size(),
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions crates/primitives-traits/src/transaction/signed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ impl SignedTransaction for scroll_alloy_consensus::ScrollPooledTransaction {
Self::Legacy(tx) => tx.hash(),
Self::Eip2930(tx) => tx.hash(),
Self::Eip1559(tx) => tx.hash(),
Self::Eip7702(tx) => tx.hash(),
}
}

Expand All @@ -199,6 +200,7 @@ impl SignedTransaction for scroll_alloy_consensus::ScrollPooledTransaction {
Self::Legacy(tx) => tx.signature(),
Self::Eip2930(tx) => tx.signature(),
Self::Eip1559(tx) => tx.signature(),
Self::Eip7702(tx) => tx.signature(),
}
}

Expand All @@ -215,6 +217,7 @@ impl SignedTransaction for scroll_alloy_consensus::ScrollPooledTransaction {
Self::Legacy(tx) => tx.tx().encode_for_signing(buf),
Self::Eip2930(tx) => tx.tx().encode_for_signing(buf),
Self::Eip1559(tx) => tx.tx().encode_for_signing(buf),
Self::Eip7702(tx) => tx.tx().encode_for_signing(buf),
}
let signature_hash = keccak256(buf);
recover_signer_unchecked(self.signature(), signature_hash)
Expand Down
45 changes: 33 additions & 12 deletions crates/scroll/alloy/consensus/src/receipt/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ pub enum ScrollReceiptEnvelope<T = Log> {
/// [EIP-1559]: https://eips.ethereum.org/EIPS/eip-1559
#[cfg_attr(feature = "serde", serde(rename = "0x2", alias = "0x02"))]
Eip1559(ReceiptWithBloom<Receipt<T>>),
/// Receipt envelope with type flag 4, containing a [EIP-7702] receipt.
///
/// [EIP-7702]: https://eips.ethereum.org/EIPS/eip-7702
#[cfg_attr(feature = "serde", serde(rename = "0x4", alias = "0x04"))]
Eip7702(ReceiptWithBloom<Receipt<T>>),
/// Receipt envelope with type flag 126, containing a [Scroll-L1-Message] receipt.
#[cfg_attr(feature = "serde", serde(rename = "0x7e", alias = "0x7E"))]
L1Message(ReceiptWithBloom<Receipt<T>>),
Expand Down Expand Up @@ -64,6 +69,9 @@ impl ScrollReceiptEnvelope<Log> {
ScrollTxType::Eip1559 => {
Self::Eip1559(ReceiptWithBloom { receipt: inner_receipt, logs_bloom })
}
ScrollTxType::Eip7702 => {
Self::Eip7702(ReceiptWithBloom { receipt: inner_receipt, logs_bloom })
}
ScrollTxType::L1Message => {
Self::L1Message(ReceiptWithBloom { receipt: inner_receipt, logs_bloom })
}
Expand All @@ -78,6 +86,7 @@ impl<T> ScrollReceiptEnvelope<T> {
Self::Legacy(_) => ScrollTxType::Legacy,
Self::Eip2930(_) => ScrollTxType::Eip2930,
Self::Eip1559(_) => ScrollTxType::Eip1559,
Self::Eip7702(_) => ScrollTxType::Eip7702,
Self::L1Message(_) => ScrollTxType::L1Message,
}
}
Expand Down Expand Up @@ -105,9 +114,11 @@ impl<T> ScrollReceiptEnvelope<T> {
/// Return the receipt's bloom.
pub const fn logs_bloom(&self) -> &Bloom {
match self {
Self::Legacy(t) | Self::Eip2930(t) | Self::Eip1559(t) | Self::L1Message(t) => {
&t.logs_bloom
}
Self::Legacy(t) |
Self::Eip2930(t) |
Self::Eip1559(t) |
Self::Eip7702(t) |
Self::L1Message(t) => &t.logs_bloom,
}
}

Expand All @@ -131,9 +142,11 @@ impl<T> ScrollReceiptEnvelope<T> {
/// receipt types may be added.
pub const fn as_receipt(&self) -> Option<&Receipt<T>> {
match self {
Self::Legacy(t) | Self::Eip2930(t) | Self::Eip1559(t) | Self::L1Message(t) => {
Some(&t.receipt)
}
Self::Legacy(t) |
Self::Eip2930(t) |
Self::Eip1559(t) |
Self::Eip7702(t) |
Self::L1Message(t) => Some(&t.receipt),
}
}
}
Expand All @@ -142,9 +155,11 @@ impl ScrollReceiptEnvelope {
/// Get the length of the inner receipt in the 2718 encoding.
pub fn inner_length(&self) -> usize {
match self {
Self::Legacy(t) | Self::Eip2930(t) | Self::Eip1559(t) | Self::L1Message(t) => {
t.length()
}
Self::Legacy(t) |
Self::Eip2930(t) |
Self::Eip1559(t) |
Self::Eip7702(t) |
Self::L1Message(t) => t.length(),
}
}

Expand Down Expand Up @@ -219,6 +234,7 @@ impl Encodable2718 for ScrollReceiptEnvelope {
Self::Legacy(_) => None,
Self::Eip2930(_) => Some(ScrollTxType::Eip2930 as u8),
Self::Eip1559(_) => Some(ScrollTxType::Eip1559 as u8),
Self::Eip7702(_) => Some(ScrollTxType::Eip7702 as u8),
Self::L1Message(_) => Some(ScrollTxType::L1Message as u8),
}
}
Expand All @@ -233,9 +249,11 @@ impl Encodable2718 for ScrollReceiptEnvelope {
Some(ty) => out.put_u8(ty),
}
match self {
Self::L1Message(t) | Self::Legacy(t) | Self::Eip2930(t) | Self::Eip1559(t) => {
t.encode(out)
}
Self::L1Message(t) |
Self::Legacy(t) |
Self::Eip2930(t) |
Self::Eip1559(t) |
Self::Eip7702(t) => t.encode(out),
}
}
}
Expand All @@ -246,6 +264,7 @@ impl Typed2718 for ScrollReceiptEnvelope {
Self::Legacy(_) => ScrollTxType::Legacy,
Self::Eip2930(_) => ScrollTxType::Eip2930,
Self::Eip1559(_) => ScrollTxType::Eip1559,
Self::Eip7702(_) => ScrollTxType::Eip7702,
Self::L1Message(_) => ScrollTxType::L1Message,
};
ty as u8
Expand All @@ -261,6 +280,7 @@ impl Decodable2718 for ScrollReceiptEnvelope {
}
ScrollTxType::Eip1559 => Ok(Self::Eip1559(Decodable::decode(buf)?)),
ScrollTxType::Eip2930 => Ok(Self::Eip2930(Decodable::decode(buf)?)),
ScrollTxType::Eip7702 => Ok(Self::Eip7702(Decodable::decode(buf)?)),
ScrollTxType::L1Message => Ok(Self::L1Message(Decodable::decode(buf)?)),
}
}
Expand All @@ -280,6 +300,7 @@ where
0 => Ok(Self::Legacy(ReceiptWithBloom::arbitrary(u)?)),
1 => Ok(Self::Eip2930(ReceiptWithBloom::arbitrary(u)?)),
2 => Ok(Self::Eip1559(ReceiptWithBloom::arbitrary(u)?)),
4 => Ok(Self::Eip1559(ReceiptWithBloom::arbitrary(u)?)),
_ => Ok(Self::L1Message(ReceiptWithBloom::arbitrary(u)?)),
}
}
Expand Down
Loading
Loading