Skip to content

Commit

Permalink
publish ethereum-triedb
Browse files Browse the repository at this point in the history
  • Loading branch information
seunlanlege committed May 13, 2024
1 parent e4d0e36 commit 3e68bda
Show file tree
Hide file tree
Showing 19 changed files with 79 additions and 46 deletions.
18 changes: 9 additions & 9 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ pallet-mmr = { path = "modules/trees/mmr/pallet", default-features = false }
# merkle trees
pallet-mmr-runtime-api = { path = "modules/trees/mmr/pallet/runtime-api", default-features = false }
mmr-gadget = { path = "modules/trees/mmr/gadget" }
ethereum-trie = { path = "./modules/trees/ethereum", default-features = false }
ethereum-triedb = { version = "0.1.1", path = "./modules/trees/ethereum", default-features = false }
mmr-primitives = { version = "1.6.2", path = "modules/trees/mmr/primitives", default-features = false }

# runtimes
Expand Down
2 changes: 1 addition & 1 deletion modules/hyperclient/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ evm-common = { workspace = true }
sp-core = { workspace = true }
substrate-state-machine = { workspace = true }
ismp-solidity-abi = { workspace = true }
ethereum-trie = { workspace = true }
ethereum-triedb = { workspace = true }
subxt-utils = { workspace = true }
hex = "0.4.3"

Expand Down
2 changes: 1 addition & 1 deletion modules/hyperclient/src/providers/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
providers::interface::{Client, RequestOrResponse},
types::BoxStream,
};
use ethereum_trie::StorageProof;
use ethereum_triedb::StorageProof;
use ethers::prelude::Middleware;
use evm_common::presets::{
REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT,
Expand Down
4 changes: 2 additions & 2 deletions modules/ismp/clients/arbitrum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ publish = false
[dependencies]
# polytope labs
ismp = { workspace = true }
ethereum-trie = { workspace = true }
ethereum-triedb = { workspace = true }
geth-primitives = { workspace = true }
evm-common = { workspace = true }

Expand All @@ -36,7 +36,7 @@ default = ["std"]
std = [
"codec/std",
"ismp/std",
"ethereum-trie/std",
"ethereum-triedb/std",
"alloy-rlp/std",
"alloy-primitives/std",
"ethabi/std",
Expand Down
4 changes: 2 additions & 2 deletions modules/ismp/clients/optimism/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
[dependencies]
# polytope labs
ismp = { workspace = true }
ethereum-trie = { workspace = true }
ethereum-triedb = { workspace = true }
geth-primitives = { workspace = true }
evm-common = { workspace = true }

Expand All @@ -29,7 +29,7 @@ default = ["std"]
std = [
"codec/std",
"ismp/std",
"ethereum-trie/std",
"ethereum-triedb/std",
"alloy-rlp/std",
"alloy-primitives/std",
"ethabi/std",
Expand Down
4 changes: 2 additions & 2 deletions modules/ismp/clients/sync-committee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ publish = false
ismp = { workspace = true, default-features = false }
sync-committee-primitives = { workspace = true, default-features = false }
sync-committee-verifier = { workspace = true, default-features = false }
ethereum-trie = { workspace = true, default-features = false }
ethereum-triedb = { workspace = true, default-features = false }
pallet-ismp = { workspace = true, default-features = false }
geth-primitives = { workspace = true, default-features = false }
evm-common = { workspace = true }
Expand All @@ -38,7 +38,7 @@ default = ["std"]
std = [
"codec/std",
"ismp/std",
"ethereum-trie/std",
"ethereum-triedb/std",
"ethabi/std",
"hex/std",
"sync-committee-primitives/std",
Expand Down
6 changes: 2 additions & 4 deletions modules/ismp/clients/sync-committee/evm-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ publish = false
[dependencies]
# polytope labs
ismp = { workspace = true }
ethereum-trie = { workspace = true }
ethereum-triedb = { workspace = true }
geth-primitives = { workspace = true }

# crates.io
Expand All @@ -31,7 +31,7 @@ default = ["std"]
std = [
"codec/std",
"ismp/std",
"ethereum-trie/std",
"ethereum-triedb/std",
"trie-db/std",
"hash-db/std",
"alloy-rlp/std",
Expand All @@ -41,5 +41,3 @@ std = [
"hex/std",
"geth-primitives/std"
]


Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use alloc::{format, string::ToString};
use alloy_rlp::Decodable;
use codec::Decode;
use ethabi::ethereum_types::{H256, U256};
use ethereum_trie::{EIP1186Layout, StorageProof};
use ethereum_triedb::{EIP1186Layout, StorageProof};
use ismp::{
consensus::{
ConsensusStateId, IntermediateState, StateCommitment, StateMachineHeight, StateMachineId,
Expand Down
12 changes: 6 additions & 6 deletions modules/ismp/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Rust implementation of the Interoperable State Machine Protocol. This project is

This repo provides an implementation of the neccessary components laid out in the [ISMP specifications](https://docs.hyperbridge.network/protocol/ismp).

- [x] [`Message` Definitions](https://docs.rs/ismp/latest/ismp/messaging/index.html)
- [x] [`Message` Handlers](https://docs.rs/ismp/latest/ismp/handlers/index.html)
- [x] [`ConsensusClient` and `StateMachineClient` definitions](https://docs.rs/ismp/latest/ismp/consensus/index.html)
- [x] [`IsmpHost` definitions](https://docs.rs/ismp/latest/ismp/host/index.html)
- [x] [`IsmpRouter` definitions](https://docs.rs/ismp/latest/ismp/router/index.html)
- [x] [`IsmpDispatcher` definitions](https://docs.rs/ismp/latest/ismp/dispatcher/index.html)
- [`Message` Definitions](https://docs.rs/ismp/latest/ismp/messaging/index.html)
- [`Message` Handlers](https://docs.rs/ismp/latest/ismp/handlers/index.html)
- [`ConsensusClient` and `StateMachineClient` definitions](https://docs.rs/ismp/latest/ismp/consensus/index.html)
- [`IsmpHost` definitions](https://docs.rs/ismp/latest/ismp/host/index.html)
- [`IsmpRouter` definitions](https://docs.rs/ismp/latest/ismp/router/index.html)
- [`IsmpDispatcher` definitions](https://docs.rs/ismp/latest/ismp/dispatcher/index.html)

## License

Expand Down
2 changes: 1 addition & 1 deletion modules/ismp/pallets/relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ethabi = { version = "18.0.0", features = ["rlp", "parity-codec"], default-featu
pallet-ismp = { workspace = true, features = [ "testing" ] }
pallet-timestamp = { workspace = true }
pallet-balances = { workspace = true }
ethereum-trie = { workspace = true }
ethereum-triedb = { workspace = true }
trie-db = { workspace = true }
hash-db = { workspace = true }
ismp-bsc = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion modules/ismp/pallets/testsuite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ismp-sync-committee = { workspace = true, default-features = true }
ismp-bsc = { workspace = true, default-features = true }
pallet-ismp = { workspace = true, default-features = true, features = ["testing"] }
pallet-hyperbridge = { workspace = true, default-features = true }
ethereum-trie = { workspace = true, default-features = true }
ethereum-triedb = { workspace = true, default-features = true }
substrate-state-machine = { workspace = true, default-features = true }
pallet-ismp-relayer = { workspace = true, default-features = true }
pallet-fishermen = { workspace = true, default-features = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use alloy_primitives::hex;
use codec::{Decode, Encode};
use ethereum_trie::{keccak::KeccakHasher, MemoryDB, StorageProof};
use ethereum_triedb::{keccak::KeccakHasher, MemoryDB, StorageProof};
use evm_common::types::EvmStateProof;
use frame_support::crypto::ecdsa::ECDSAExt;
use ismp::{
Expand Down
12 changes: 7 additions & 5 deletions modules/trees/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[package]
name = "ethereum-trie"
name = "ethereum-triedb"
version = "0.1.1"
edition = "2021"
description = "Ethereum EIP-1886 layout implementation for parity/trie"
description = "EIP-1186 ethereum trie layout implementation for parity/trie"
authors = ["Polytope Labs <[email protected]>"]
publish = false


license = "Apache-2.0"
repository = "https://github.com/polytope-labs/hyperbridge"
documentation = "https://docs.rs/ethereum-triedb"
keywords = ["merkle-patricia-trie", "ethereum", "state-proofs", "storage-proofs"]
readme = "./README.md"

[dependencies]
trie-db = { workspace = true }
Expand Down
15 changes: 10 additions & 5 deletions modules/trees/ethereum/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Ethereum Trie
# Ethereum TrieDB

This library allows users to verify ethereum style merkle patricia proofs as specified in this document: https://ethereum.github.io/execution-specs/autoapi/ethereum/frontier/trie/index.html
This crate exposes an implementation of [`trie_db::TrieLayout`](https://docs.rs/trie-db/0.29.0/trie_db/trait.TrieLayout.html) that allows [`trie_db::TrieDb`](https://docs.rs/trie-db/0.29.0/trie_db/triedb/struct.TrieDB.html)
be used for verifying Ethereum style merkle patricia proofs. as specified in this document [EIP-1186](https://eips.ethereum.org/EIPS/eip-1186).

```rust
use ethereum_trie::{
use ethereum_triedb::{
keccak::{keccak_256, KeccakHasher},
EIP1186Layout, StorageProof,
};
Expand Down Expand Up @@ -60,6 +61,10 @@ fn main() {
}
```

### No Std
### No Std

This library supports `no_std`, simply add `default-features = false` to the dependecncy entry in your `Cargo.toml`
This library also supports `no_std`, simply add `default-features = false` to the dependecncy entry in your `Cargo.toml`

## License

This library is licensed under the Apache 2.0 License, Copyright (c) 2024 Polytope Labs.
17 changes: 15 additions & 2 deletions modules/trees/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
//! This crate exposes an implementation of `trie_db::TrieLayout` that allows `trie_db::TrieDb`
//! be used for verifying Ethereum state proofs as per [EIP-1186](https://eips.ethereum.org/EIPS/eip-1186)
// Copyright (C) Polytope Labs Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![doc = include_str!("../README.md")]

extern crate alloc;

Expand Down
15 changes: 15 additions & 0 deletions modules/trees/ethereum/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// Copyright (C) Polytope Labs Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::{
keccak::{keccak_256, KeccakHasher},
EIP1186Layout, StorageProof,
Expand Down
2 changes: 1 addition & 1 deletion tesseract/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ismp = { workspace = true, default-features = true }
pallet-ismp-rpc = { workspace = true, default-features = true }
geth-primitives = { workspace = true, default-features = true }
ismp-sync-committee = { workspace = true, default-features = true }
ethereum-trie = { workspace = true, default-features = true }
ethereum-triedb = { workspace = true, default-features = true }
mmr-primitives = { workspace = true, default-features = true }
evm-common = { workspace = true, default-features = true }
sp-mmr-primitives = { workspace = true, default-features = true }
Expand Down
2 changes: 1 addition & 1 deletion tesseract/evm/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::{
gas_oracle::{get_current_gas_cost_in_usd, get_l2_data_cost},
tx::{generate_contract_calls, get_chain_gas_limit},
};
use ethereum_trie::StorageProof;
use ethereum_triedb::StorageProof;
use ethers::{
contract::parse_log,
types::{
Expand Down

0 comments on commit 3e68bda

Please sign in to comment.