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

Add eth2 light client back #343

Merged
merged 3 commits into from
Dec 13, 2023
Merged
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
4,385 changes: 3,418 additions & 967 deletions Cargo.lock

Large diffs are not rendered by default.

19 changes: 12 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ members = [
"precompiles/proxy",
"precompiles/preimage",
"precompiles/jobs",
"relayer-gadget",
"relayer-gadget/cli",
]
resolver = "2"

Expand Down Expand Up @@ -71,8 +73,8 @@ paste = "1.0.6"
slices = "0.2.0"
schnorrkel = { version = "0.9.1", default-features = false }

webb-relayer-gadget = { git = "https://github.com/webb-tools/dkg-substrate.git", branch = "master" }
webb-relayer-gadget-cli = { git = "https://github.com/webb-tools/dkg-substrate.git", branch = "master" }
tangle-relayer-gadget = { packge = "tangle-relayer-gadget", path = "relayer-gadget" }
tangle-relayer-gadget-cli = { packge = "tangle-relayer-gadget-cli", path = "relayer-gadget/cli" }

tangle-testnet-runtime = { package = "tangle-testnet-runtime", path = "runtime/testnet" }
tangle-mainnet-runtime = { package = "tangle-mainnet-runtime", path = "runtime/mainnet" }
Expand Down Expand Up @@ -259,17 +261,20 @@ jsonrpsee = { version = "0.16.2", features = ["server"] }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
sc-consensus-manual-seal = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }

# Webb dependencies
tangle-primitives = { path = 'primitives', default-features = false }
pallet-transaction-pause = { path = 'pallets/transaction-pause', default-features = false }

# Light client dependencies
# pallet-eth2-light-client = { git = "https://github.com/webb-tools/pallet-eth2-light-client", default-features = false, tag = "v0.4.6" }
# pallet-eth2-light-client-relayer-gadget = { git = "https://github.com/webb-tools/pallet-eth2-light-client", default-features = false, tag = "v0.4.6" }
# pallet-eth2-light-client-relayer-gadget-cli = { git = "https://github.com/webb-tools/pallet-eth2-light-client", default-features = false, tag = "v0.4.6" }
# webb-consensus-types = { git = "https://github.com/webb-tools/pallet-eth2-light-client", default-features = false, tag = "v0.4.6" }
pallet-eth2-light-client = { git = "https://github.com/webb-tools/pallet-eth2-light-client", default-features = false, tag = "v0.5.0" }
pallet-eth2-light-client-relayer-gadget = { git = "https://github.com/webb-tools/pallet-eth2-light-client", default-features = false, tag = "v0.5.0" }
pallet-eth2-light-client-relayer-gadget-cli = { git = "https://github.com/webb-tools/pallet-eth2-light-client", default-features = false, tag = "v0.5.0" }
webb-consensus-types = { git = "https://github.com/webb-tools/pallet-eth2-light-client", default-features = false, tag = "v0.5.0" }

webb = { git = "https://github.com/webb-tools/webb-rs.git", default-features = false }
webb-proposals = { git = "https://github.com/webb-tools/webb-rs.git", default-features = false, features = ["scale", "evm"] }

webb = { version = "0.8.2", default-features = false }
primitives-ext = { path = "primitives/ext", default-features = false }
evm-tracing-events = { path = "primitives/rpc/evm-tracing-events", default-features = false }
rpc-primitives-debug = { path = "primitives/rpc/debug", default-features = false }
Expand Down
21 changes: 10 additions & 11 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ serde_json = { workspace = true }
tokio = { workspace = true }

# Light client dependencies
# pallet-eth2-light-client-relayer-gadget = { workspace = true, optional = true }
# pallet-eth2-light-client-relayer-gadget-cli = { workspace = true, optional = true }
# webb-consensus-types = { workspace = true }
pallet-eth2-light-client-relayer-gadget = { workspace = true, optional = true }
pallet-eth2-light-client-relayer-gadget-cli = { workspace = true, optional = true }
webb-consensus-types = { workspace = true }
webb-proposals = { workspace = true }

webb-relayer-gadget = { workspace = true, optional = true }
webb-relayer-gadget-cli = { workspace = true, optional = true }
tangle-relayer-gadget = { workspace = true, optional = true }
tangle-relayer-gadget-cli = { workspace = true, optional = true }

# Substrate dependencies
frame-benchmarking = { workspace = true }
Expand Down Expand Up @@ -129,12 +130,10 @@ rocksdb = [
sql = ["fc-db/sql", "fc-mapping-sync/sql"]
txpool = ["fc-rpc/txpool"]
light-client = [


# "pallet-eth2-light-client-relayer-gadget",
# "pallet-eth2-light-client-relayer-gadget-cli",
"pallet-eth2-light-client-relayer-gadget",
"pallet-eth2-light-client-relayer-gadget-cli",
]
relayer = [
"webb-relayer-gadget",
"webb-relayer-gadget-cli",
"tangle-relayer-gadget",
"tangle-relayer-gadget-cli",
]
38 changes: 19 additions & 19 deletions node/src/chainspec/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::{
distributions::{combine_distributions, develop, mainnet, testnet},
mainnet_fixtures::{get_root_key, get_standalone_bootnodes},
};
use core::marker::PhantomData;
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use sc_consensus_grandpa::AuthorityId as GrandpaId;
use sc_service::ChainType;
Expand All @@ -26,10 +27,10 @@ use sp_core::{sr25519, Pair, Public, H160};
use sp_runtime::traits::{IdentifyAccount, Verify};
use tangle_mainnet_runtime::{
AccountId, Balance, BalancesConfig, EVMChainIdConfig, EVMConfig, ElectionsConfig,
ImOnlineConfig, MaxNominations, Perbill, RuntimeGenesisConfig, SessionConfig, Signature,
StakerStatus, StakingConfig, SudoConfig, SystemConfig, UNIT, WASM_BINARY,
Eth2ClientConfig, ImOnlineConfig, MaxNominations, Perbill, RuntimeGenesisConfig, SessionConfig,
Signature, StakerStatus, StakingConfig, SudoConfig, SystemConfig, UNIT, WASM_BINARY,
};
//use webb_consensus_types::network_config::{Network, NetworkConfig};
use webb_consensus_types::network_config::{Network, NetworkConfig};

/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig>;
Expand Down Expand Up @@ -293,14 +294,13 @@ fn testnet_genesis(
aura: Default::default(),
grandpa: Default::default(),
im_online: ImOnlineConfig { keys: vec![] },
// eth_2_client: Eth2ClientConfig {
// // Vec<(TypedChainId, [u8; 32], ForkVersion, u64)>
// networks: vec![
// (webb_proposals::TypedChainId::Evm(1), NetworkConfig::new(&Network::Mainnet)),
// (webb_proposals::TypedChainId::Evm(5), NetworkConfig::new(&Network::Goerli)),
// ],
// phantom: PhantomData,
// },
eth_2_client: Eth2ClientConfig {
networks: vec![
(webb_proposals::TypedChainId::Evm(1), NetworkConfig::new(&Network::Mainnet)),
(webb_proposals::TypedChainId::Evm(5), NetworkConfig::new(&Network::Goerli)),
],
phantom: PhantomData,
},
nomination_pools: Default::default(),
transaction_payment: Default::default(),
// EVM compatibility
Expand Down Expand Up @@ -396,14 +396,14 @@ fn mainnet_genesis(
ethereum: Default::default(),
dynamic_fee: Default::default(),
base_fee: Default::default(),
// // ETH2 light client
// eth_2_client: Eth2ClientConfig {
// networks: vec![(
// webb_proposals::TypedChainId::Evm(1),
// NetworkConfig::new(&Network::Mainnet),
// )],
// phantom: PhantomData,
// },
// ETH2 light client
eth_2_client: Eth2ClientConfig {
networks: vec![
(webb_proposals::TypedChainId::Evm(1), NetworkConfig::new(&Network::Mainnet)),
(webb_proposals::TypedChainId::Evm(5), NetworkConfig::new(&Network::Goerli)),
],
phantom: PhantomData,
},
claims: Default::default(),
}
}
21 changes: 11 additions & 10 deletions node/src/chainspec/testnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::{
get_standalone_bootnodes, get_standalone_initial_authorities, get_testnet_root_key,
},
};
use core::marker::PhantomData;
use hex_literal::hex;
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use sc_consensus_grandpa::AuthorityId as GrandpaId;
Expand All @@ -28,9 +29,10 @@ use sp_core::{sr25519, Pair, Public, H160};
use sp_runtime::traits::{IdentifyAccount, Verify};
use tangle_testnet_runtime::{
AccountId, Balance, BalancesConfig, EVMChainIdConfig, EVMConfig, ElectionsConfig,
ImOnlineConfig, MaxNominations, Perbill, RuntimeGenesisConfig, SessionConfig, Signature,
StakerStatus, StakingConfig, SudoConfig, SystemConfig, UNIT, WASM_BINARY,
Eth2ClientConfig, ImOnlineConfig, MaxNominations, Perbill, RuntimeGenesisConfig, SessionConfig,
Signature, StakerStatus, StakingConfig, SudoConfig, SystemConfig, UNIT, WASM_BINARY,
};
use webb_consensus_types::network_config::{Network, NetworkConfig};

/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig>;
Expand Down Expand Up @@ -302,14 +304,13 @@ fn testnet_genesis(
aura: Default::default(),
grandpa: Default::default(),
im_online: ImOnlineConfig { keys: vec![] },
// eth_2_client: Eth2ClientConfig {
// // Vec<(TypedChainId, [u8; 32], ForkVersion, u64)>
// networks: vec![
// (webb_proposals::TypedChainId::Evm(1), NetworkConfig::new(&Network::Mainnet)),
// (webb_proposals::TypedChainId::Evm(5), NetworkConfig::new(&Network::Goerli)),
// ],
// phantom: PhantomData,
// },
eth_2_client: Eth2ClientConfig {
networks: vec![
(webb_proposals::TypedChainId::Evm(1), NetworkConfig::new(&Network::Mainnet)),
(webb_proposals::TypedChainId::Evm(5), NetworkConfig::new(&Network::Goerli)),
],
phantom: PhantomData,
},
nomination_pools: Default::default(),
transaction_payment: Default::default(),
// EVM compatibility
Expand Down
25 changes: 25 additions & 0 deletions relayer-gadget/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "tangle-relayer-gadget"
version = "0.0.1"
authors = ["Webb Developers <dev@webb.tools>", "Shady Khalifa <dev+github@shadykhalifa.me>"]
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
homepage = { workspace = true }
repository = { workspace = true }
edition = { workspace = true }

[dependencies]
tracing = { workspace = true }
ethereum-types = { workspace = true }

# Substrate
sp-application-crypto = { workspace = true }
sp-keystore = { workspace = true }
sc-keystore = { workspace = true }

# Relayer
webb-relayer = { git = "https://github.com/webb-tools/relayer", branch = "develop" }
webb-relayer-context = { git = "https://github.com/webb-tools/relayer", branch = "develop" }
webb-relayer-config = { git = "https://github.com/webb-tools/relayer", branch = "develop" }
webb-relayer-store = { git = "https://github.com/webb-tools/relayer", branch = "develop" }
webb-relayer-types = { git = "https://github.com/webb-tools/relayer", branch = "develop" }

11 changes: 11 additions & 0 deletions relayer-gadget/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "tangle-relayer-gadget-cli"
version = "0.0.1"
authors = ["Webb Developers <dev@webb.tools>", "Shady Khalifa <dev+github@shadykhalifa.me>"]
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
homepage = { workspace = true }
repository = { workspace = true }
edition = { workspace = true }

[dependencies]
clap = { workspace = true }
10 changes: 10 additions & 0 deletions relayer-gadget/cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use std::path::PathBuf;

/// Cli tool to interact with Webb Relayer CLI
#[derive(Debug, Clone, clap::Parser)]
#[clap(next_help_heading = "Webb Relayer")]
pub struct WebbRelayerCmd {
/// Directory that contains configration files for the relayer.
#[arg(long, value_name = "PATH")]
pub relayer_config_dir: Option<PathBuf>,
}
3 changes: 3 additions & 0 deletions relayer-gadget/config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Configuration Examples

This directory contains a very simple and minimal configuration for starting a Private Transaction Relayer over the Gorli Testnet. This configuration is used for testing and for demonstration purposes.
42 changes: 42 additions & 0 deletions relayer-gadget/config/simple.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
port = 9955

# Controls what features are enabled in the relayer system
[features]
# if you are an authority, this always true.
governance-relay = true
data-query = true
private-tx-relay = true

[evm.goerli]
name = "goerli"
http-endpoint = "https://rpc.ankr.com/eth_goerli"
ws-endpoint = "wss://rpc.ankr.com/eth_goerli"
chain-id = 5
enabled = true
block-confirmations = 2
# The private key of the account that will be used to sign transactions
# If not set, we will use the Keystore to get the ECDSA private key.
# private-key = "$PRIVATE_KEY"

[[evm.goerli.contracts]]
contract = "VAnchor"
address = "0x38e7aa90c77f86747fab355eecaa0c2e4c3a463d"
deployed-at = 8703495
events-watcher = { enabled = true, polling-interval = 15000 }
proposal-signing-backend = { type = "DKGNode", chain-id = 0 }

[substrate.internal]
name = "internal"
chain-id = 0
http-endpoint = "http://localhost:9933"
ws-endpoint = "ws://localhost:9944"
suri = "//Alice"
enabled = true

[[substrate.internal.pallets]]
pallet = "DKG"
events-watcher = { enabled = true, polling-interval = 3000, print-progress-interval = 30000 }

[[substrate.internal.pallets]]
pallet = "DKGProposalHandler"
events-watcher = { enabled = true, polling-interval = 3000, print-progress-interval = 30000 }
Loading
Loading