Skip to content

Commit

Permalink
Use upstream Ethereum transaction types from alloy-consensus
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Apr 13, 2024
1 parent 6c67854 commit fbe40e6
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 2,855 deletions.
13 changes: 4 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ exclude = ["benches/", "tests/"]
[workspace.dependencies]
alloy-rlp = { version = "0.3", default-features = false }
alloy-primitives = { version = "0.7.0", default-features = false }
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", branch = "main", default-features = false }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", branch = "main", default-features = false }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", branch = "main", default-features = false }
alloy-serde = { git = "https://github.com/alloy-rs/alloy", branch = "main", default-features = false }

## crypto
c-kzg = { version = "1.0", default-features = false }
k256 = { version = "0.13", default-features = false, features = ["ecdsa"] }
alloy-consensus = { git = "https://github.com/clabby/alloy", branch = "cl/consensus-expose-encoding", default-features = false }
alloy-eips = { git = "https://github.com/clabby/alloy", branch = "cl/consensus-expose-encoding", default-features = false }
alloy-signer = { git = "https://github.com/clabby/alloy", branch = "cl/consensus-expose-encoding", default-features = false }
alloy-serde = { git = "https://github.com/clabby/alloy", branch = "cl/consensus-expose-encoding", default-features = false }

## serde
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] }
Expand All @@ -31,7 +27,6 @@ serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
## misc
tokio = "1"
arbitrary = "1.3"
thiserror = "1.0"

[workspace.metadata.docs.rs]
all-features = true
Expand Down
13 changes: 3 additions & 10 deletions crates/op-consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ alloy-rlp.workspace = true
alloy-eips.workspace = true
alloy-serde = { workspace = true, optional = true }

sha2 = { version = "0.10", default-features = false }

# kzg
thiserror = { workspace = true, optional = true }
c-kzg = { workspace = true, features = ["serde"], optional = true }

# arbitrary
arbitrary = { workspace = true, features = ["derive"], optional = true }

Expand All @@ -33,14 +27,13 @@ serde = { workspace = true, features = ["derive"], optional = true }
[dev-dependencies]
alloy-signer.workspace = true
arbitrary = { workspace = true, features = ["derive"] }
k256.workspace = true
tokio = { workspace = true, features = ["macros"] }
serde_json.workspace = true

[features]
default = ["std"]
std = ["alloy-eips/std", "alloy-consensus/std", "sha2/std", "c-kzg?/std"]
std = ["alloy-eips/std", "alloy-consensus/std"]
k256 = ["alloy-primitives/k256", "alloy-consensus/k256"]
kzg = ["dep:c-kzg", "dep:thiserror", "alloy-eips/kzg", "alloy-consensus/kzg", "std"]
kzg = ["alloy-eips/kzg", "alloy-consensus/kzg", "std"]
arbitrary = ["std", "dep:arbitrary", "alloy-consensus/arbitrary", "alloy-eips/arbitrary", "alloy-primitives/rand"]
serde = ["dep:serde", "alloy-primitives/serde", "alloy-consensus/serde", "dep:alloy-serde", "alloy-eips/serde"]
serde = ["dep:serde", "dep:alloy-serde", "alloy-primitives/serde", "alloy-consensus/serde", "alloy-eips/serde"]
7 changes: 2 additions & 5 deletions crates/op-consensus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
OP Stack consensus interface.

This crate contains constants, types, and functions for implementing Optimism EL consensus and communication. This
includes transactions, [EIP-2718] envelopes, [EIP-2930], [EIP-4844], [deposit transactions][deposit], and receipts.
includes an extended `OpTxEnvelope` type with [deposit transactions][deposit], and receipts containing OP Stack
specific fields (`deposit_nonce` + `deposit_receipt_version`).

In general a type belongs in this crate if it exists in the `alloy-consensus` crate, but was modified from the base Ethereum protocol in the OP Stack.
For consensus types that are not modified by the OP Stack, the `alloy-consensus` types should be used instead.

[alloy-network]: ../network
[EIP-2718]: https://eips.ethereum.org/EIPS/eip-2718
[EIP-2930]: https://eips.ethereum.org/EIPS/eip-2930
[EIP-4844]: https://eips.ethereum.org/EIPS/eip-4844
[deposit]: https://specs.optimism.io/protocol/deposits.html

## Provenance
Expand Down
12 changes: 1 addition & 11 deletions crates/op-consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,4 @@ mod receipt;
pub use receipt::{OpReceipt, OpReceiptEnvelope, OpReceiptWithBloom, OpTxReceipt};

mod transaction;
pub use transaction::{
eip4844_utils, Blob, BlobTransactionSidecar, Bytes48, OpTxEnvelope, OpTxType,
OpTypedTransaction, SidecarBuilder, SidecarCoder, SimpleCoder, TxDeposit, TxEip1559, TxEip2930,
TxEip4844, TxEip4844Variant, TxEip4844WithSidecar, TxLegacy,
};

#[cfg(feature = "kzg")]
pub use transaction::BlobTransactionValidationError;

#[cfg(feature = "kzg")]
pub use alloy_eips::eip4844::env_settings::EnvKzgSettings;
pub use transaction::{OpTxEnvelope, OpTxType, OpTypedTransaction, TxDeposit};
Loading

0 comments on commit fbe40e6

Please sign in to comment.