Skip to content

Commit

Permalink
feat: replace axon-tools & upgrade to 0.111
Browse files Browse the repository at this point in the history
  • Loading branch information
wenyuanhust committed Oct 30, 2023
1 parent 6dc8eee commit 2aac0b7
Show file tree
Hide file tree
Showing 13 changed files with 1,058 additions and 186 deletions.
1,170 changes: 1,010 additions & 160 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion crates/relayer-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ description = "The storage part of SynapseWeb3 IBC Relayer"
thiserror = "1.0.37"
rocksdb = { package = "ckb-rocksdb", version ="=0.19.0", default-features = false, features = ["snappy"] }
eth2_types = { git = "https://github.com/synapseweb3/lighthouse", rev = "2c246d6", package = "types" }
eth_light_client_in_ckb-verification = { version = "0.2.1", git = "https://github.com/synapseweb3/eth-light-client-in-ckb", tag = "v0.2.1" }
# eth_light_client_in_ckb-verification = { version = "0.2.1", git = "https://github.com/synapseweb3/eth-light-client-in-ckb", tag = "v0.2.1" }
# eth_light_client_in_ckb-verification = { version = "0.3.0-alpha", git = "https://github.com/synapseweb3/eth-light-client-in-ckb" }
eth_light_client_in_ckb-verification = { path = "/root/git/eth-light-client-in-ckb/verification", version = "0.2.1" }
2 changes: 1 addition & 1 deletion crates/relayer-storage/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{fmt, result};

use eth_light_client_in_ckb_verification::{mmr, molecule};
use eth_light_client_in_ckb_verification::{molecule, mmr};

use thiserror::Error;

Expand Down
8 changes: 6 additions & 2 deletions crates/relayer-storage/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use eth2_types::EthSpec;
use eth_light_client_in_ckb_verification::{
mmr::{self, ClientRootMMR},
types::packed,
mmr::{self, ClientRootMMR},
};

use crate::{
Expand All @@ -27,7 +27,11 @@ pub trait StorageWriter<S: EthSpec>: Send + Sync + Sized {
}

pub trait StorageAsMMRStore<S: EthSpec>:
mmr::lib::MMRStore<packed::HeaderDigest> + StorageReader<S> + StorageWriter<S> + Clone
mmr::lib::MMRStoreReadOps<packed::HeaderDigest>
+ mmr::lib::MMRStoreWriteOps<packed::HeaderDigest>
+ StorageReader<S>
+ StorageWriter<S>
+ Clone
{
/// Checks if there is any data in the MMR.
fn is_initialized(&self) -> Result<bool> {
Expand Down
11 changes: 9 additions & 2 deletions crates/relayer-storage/src/storage/mmr.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
use eth2_types::EthSpec;
use eth_light_client_in_ckb_verification::{
mmr::lib::{Error as MMRError, MMRStore, Result as MMRResult},
types::packed,
mmr::lib::{
Error as MMRError, MMRStoreReadOps, MMRStoreWriteOps, Result as MMRResult,
},
};

use super::Storage;
use crate::prelude::*;

impl<S> MMRStore<packed::HeaderDigest> for Storage<S>
impl<S> MMRStoreReadOps<packed::HeaderDigest> for Storage<S>
where
S: EthSpec,
{
Expand All @@ -19,7 +21,12 @@ where
))
})
}
}

impl<S> MMRStoreWriteOps<packed::HeaderDigest> for Storage<S>
where
S: EthSpec,
{
fn append(&mut self, pos: u64, elems: Vec<packed::HeaderDigest>) -> MMRResult<()> {
for (offset, elem) in elems.iter().enumerate() {
let pos: u64 = pos + (offset as u64);
Expand Down
4 changes: 3 additions & 1 deletion crates/relayer-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ tree_hash_derive = { git = "https://github.com/synapseweb3/lighthouse", rev = "2
thiserror = "1.0"
ethereum-types = "0.14.1"
hex = "0.4"
axon-tools = { git = "https://github.com/axonweb3/axon-tools.git", branch = "main", version = "0.1.1", features = ["impl-serde", "proof"] }
# axon-tools = { path = "/root/git/axon-tools/axon-tools", version = "0.1.1", features = ["impl-serde", "proof"] }
# axon-tools = { git = "https://github.com/wenyuanhust/axon.git", branch = "forcerelay-test", version = "0.1.1", features = ["impl-serde", "proof"] }
axon-tools = { path = "/root/git/axon/devtools/axon-tools", version = "0.1.1", features = ["impl-serde", "proof"] }
strum = { version = "0.24.1", features = ["derive"] }

[dependencies.tendermint]
Expand Down
16 changes: 10 additions & 6 deletions crates/relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ eth2_types = { git = "https://github.com/synapseweb3/lighthouse", rev = "2c246d6
tree_hash_derive = { git = "https://github.com/synapseweb3/lighthouse", rev = "2c246d6" }
tree_hash = { git = "https://github.com/synapseweb3/lighthouse", rev = "2c246d6" }

eth_light_client_in_ckb-verification = { version = "0.2.1", git = "https://github.com/synapseweb3/eth-light-client-in-ckb", tag = "v0.2.1" }
eth_light_client_in_ckb-prover = { version = "0.2.1", git = "https://github.com/synapseweb3/eth-light-client-in-ckb", tag = "v0.2.1" }
axon-tools = { git = "https://github.com/axonweb3/axon-tools.git", branch = "main", version = "0.1.1", features = ["impl-serde", "proof"] }
# eth_light_client_in_ckb-verification = { version = "0.2.1", git = "https://github.com/synapseweb3/eth-light-client-in-ckb", tag = "v0.2.1" }
# eth_light_client_in_ckb-prover = { version = "0.2.1", git = "https://github.com/synapseweb3/eth-light-client-in-ckb", tag = "v0.2.1" }
eth_light_client_in_ckb-verification = { path = "/root/git/eth-light-client-in-ckb/verification", version = "0.2.1" }
eth_light_client_in_ckb-prover = { version = "0.3.0-alpha", git = "https://github.com/synapseweb3/eth-light-client-in-ckb" }
# axon-tools = { path = "/root/git/axon-tools/axon-tools", version = "0.1.1", features = ["impl-serde", "proof"] }
# axon-tools = { git = "https://github.com/wenyuanhust/axon.git", branch = "forcerelay-test", version = "0.1.1", features = ["impl-serde", "proof"] }
axon-tools = { path = "/root/git/axon/devtools/axon-tools", version = "0.1.1", features = ["impl-serde", "proof"] }

subtle-encoding = "0.5"
humantime-serde = "1.1.1"
Expand Down Expand Up @@ -92,10 +96,10 @@ reqwest-middleware = "0.1"
reqwest-retry = "0.1"
eyre = "0.6"
ethers = { version = "2.0.2", features = ["rustls", "ws"] }
ckb-sdk = "2.5.0"
ckb-sdk = "3.0.0"
ckb-hash = "0.108.0"
ckb-types = "0.108.0"
ckb-jsonrpc-types = "0.108.0"
ckb-types = "0.111.0"
ckb-jsonrpc-types = "0.111.0"
jsonrpc-core = "18.0"
strum = { version = "0.24.1", features = ["derive"] }
lazy_static = "1.4.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/relayer/src/chain/axon.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{collections::HashMap, str::FromStr, sync::Arc, thread, time::Duration};

use axon_tools::types::{AxonBlock, Proof as AxonProof, ValidatorExtend};
use axon_tools::types::{Block as AxonBlock, Proof as AxonProof, ValidatorExtend};
use eth2_types::Hash256;
use k256::ecdsa::SigningKey;
use rlp::Encodable;
Expand Down
2 changes: 1 addition & 1 deletion crates/relayer/src/chain/axon/rpc.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::error::Error;

use async_trait::async_trait;
use axon_tools::types::{AxonBlock, CkbRelatedInfo, Metadata, Proof};
use axon_tools::types::{Block as AxonBlock, CkbRelatedInfo, Metadata, Proof};
use ethers::types::{BlockId, BlockNumber};
use reqwest::Client;
use std::sync::atomic::{AtomicU64, Ordering};
Expand Down
2 changes: 1 addition & 1 deletion crates/relayer/src/chain/axon/utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::str::FromStr;

use axon_tools::types::{AxonBlock, Proof as AxonProof};
use axon_tools::types::{Block as AxonBlock, Proof as AxonProof};
use ckb_ics_axon::proof::{
Log as CkbLog, ObjectProof, TransactionReceipt as CkbTransactionReceipt,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/relayer/src/light_client/axon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::sync::Arc;

use axon_tools::types::AxonHeader as AxonChainHeader;
use axon_tools::types::Header as AxonChainHeader;
use ethers::prelude::k256::ecdsa::SigningKey;
use ethers::prelude::*;
use futures::TryFutureExt;
Expand Down
10 changes: 6 additions & 4 deletions tools/forcerelay-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ version = "0.1.0"
edition = "2021"

[dev-dependencies]
ckb-sdk = "2.5.0"
ckb-jsonrpc-types = "0.108.0"
ckb-types = "0.108.0"
ckb-sdk = "3.0.0"
ckb-jsonrpc-types = "0.111.0"
ckb-types = "0.111.0"
hex = "0.4"

eth_light_client_in_ckb-verification = { version = "0.2.1", git = "https://github.com/synapseweb3/eth-light-client-in-ckb", tag = "v0.2.1" }
# eth_light_client_in_ckb-verification = { version = "0.3.0-alpha", git = "https://github.com/synapseweb3/eth-light-client-in-ckb" }
# eth_light_client_in_ckb-verification = { version = "0.2.1", git = "https://github.com/synapseweb3/eth-light-client-in-ckb", tag = "v0.2.1" }
eth_light_client_in_ckb-verification = { path = "/root/git/eth-light-client-in-ckb/verification", version = "0.2.1" }
relayer = { version = "*", package = "ibc-relayer", path = "../../crates/relayer" }
11 changes: 6 additions & 5 deletions tools/ibc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ version = "0.1.0"
edition = "2021"

[dev-dependencies]
ckb-sdk = "2.5.0"
ckb-jsonrpc-types = "0.108.0"
ckb-types = "0.108.0"
ckb-chain-spec = "0.108.0"
ckb-sdk = "3.0.0"
ckb-jsonrpc-types = "0.111.0"
ckb-types = "0.111.0"
ckb-chain-spec = "0.111.0"
hex = "0.4"
eyre = "0.6.8"

Expand Down Expand Up @@ -45,7 +45,8 @@ toml_edit = "0.19.14"
lazy_static = "1.4.0"
ethers = { version = "2.0.2", features = ["rustls", "ws"] }

forcerelay-ckb-sdk = { git = "https://github.com/synapseweb3/forcerelay-ckb-sdk", rev = "cd82be97" }
# forcerelay-ckb-sdk = { git = "https://github.com/synapseweb3/forcerelay-ckb-sdk", rev = "cd82be97" }
forcerelay-ckb-sdk = { path = "/root/git/forcerelay-ckb-sdk", version = "0.1.0" }

[dependencies]
bytes = "1.5.0"
Expand Down

0 comments on commit 2aac0b7

Please sign in to comment.