Skip to content

Commit

Permalink
remove light client deps
Browse files Browse the repository at this point in the history
  • Loading branch information
1xstj committed Dec 5, 2023
1 parent 78390bf commit 459a820
Show file tree
Hide file tree
Showing 11 changed files with 570 additions and 3,991 deletions.
4,419 changes: 499 additions & 3,920 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,12 @@ 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.5" }
pallet-eth2-light-client-relayer-gadget = { git = "https://github.com/webb-tools/pallet-eth2-light-client", default-features = false, tag = "v0.4.5" }
pallet-eth2-light-client-relayer-gadget-cli = { git = "https://github.com/webb-tools/pallet-eth2-light-client", default-features = false, tag = "v0.4.5" }
webb-consensus-types = { git = "https://github.com/webb-tools/pallet-eth2-light-client", default-features = false, tag = "v0.4.5" }
#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" }

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

primitives-ext = { path = "primitives/ext", default-features = false }
Expand Down
10 changes: 5 additions & 5 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ 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 }

# DKG dependencies
dkg-gadget = { workspace = true }
Expand Down Expand Up @@ -134,8 +134,8 @@ 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",
Expand Down
38 changes: 19 additions & 19 deletions node/src/chainspec/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ use sp_core::{sr25519, Pair, Public, H160};
use sp_runtime::traits::{IdentifyAccount, Verify};
use tangle_mainnet_runtime::{
AccountId, Balance, BalancesConfig, EVMChainIdConfig, EVMConfig, ElectionsConfig,
Eth2ClientConfig, ImOnlineConfig, MaxNominations, Perbill, RuntimeGenesisConfig, SessionConfig,
Signature, StakerStatus, StakingConfig, SudoConfig, SystemConfig, UNIT, WASM_BINARY,
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 @@ -294,14 +294,14 @@ fn testnet_genesis(
grandpa: Default::default(),
bridge_registry: 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 {
// // 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,
// },
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),
// )],
// phantom: PhantomData,
// },
bridge_registry: Default::default(),
}
}
24 changes: 12 additions & 12 deletions node/src/chainspec/testnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ use sp_core::{sr25519, Pair, Public, H160};
use sp_runtime::traits::{IdentifyAccount, Verify};
use tangle_testnet_runtime::{
AccountId, Balance, BalancesConfig, DKGConfig, DKGId, DKGProposalsConfig, EVMChainIdConfig,
EVMConfig, ElectionsConfig, Eth2ClientConfig, ImOnlineConfig, MaxNominations, Perbill,
RuntimeGenesisConfig, SessionConfig, Signature, StakerStatus, StakingConfig, SudoConfig,
SystemConfig, UNIT, WASM_BINARY,
EVMConfig, ElectionsConfig, 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};

// The URL for the telemetry server.
// const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
Expand Down Expand Up @@ -362,14 +362,14 @@ fn testnet_genesis(
dkg_proposals: DKGProposalsConfig { initial_chain_ids, initial_r_ids, initial_proposers },
bridge_registry: 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 {
// // 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,
// },
nomination_pools: Default::default(),
transaction_payment: Default::default(),
// EVM compatibility
Expand Down
1 change: 1 addition & 0 deletions precompiles/staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ std = [
"sp-runtime/std",
"sp-std/std",
"tangle-primitives/std",
"pallet-session/std"
]
4 changes: 2 additions & 2 deletions runtime/mainnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pallet-treasury = { workspace = true }

pallet-authorship = { workspace = true }
pallet-balances = { workspace = true }
pallet-eth2-light-client = { workspace = true }
#pallet-eth2-light-client = { workspace = true }
pallet-identity = { workspace = true }
pallet-proxy = { workspace = true }
pallet-randomness-collective-flip = { workspace = true }
Expand Down Expand Up @@ -211,7 +211,7 @@ std = [
"tangle-primitives/std",

# ETH2 light-client
"pallet-eth2-light-client/std",
#"pallet-eth2-light-client/std",

# Frontier
"fp-account/std",
Expand Down
25 changes: 12 additions & 13 deletions runtime/mainnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,7 @@ where
) -> Option<(RuntimeCall, <UncheckedExtrinsic as traits::Extrinsic>::SignaturePayload)> {
let tip = 0;
// take the biggest period possible.
let period =
BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2);
let period = BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2);
let current_block = System::block_number()
.saturated_into::<u64>()
// The `System::block_number` is initialized with `n+1`,
Expand Down Expand Up @@ -985,17 +984,17 @@ impl pallet_utility::Config for Runtime {
type WeightInfo = ();
}

parameter_types! {
pub const StoragePricePerByte: u128 = MILLIUNIT;
pub const Eth2ClientPalletId: PalletId = PalletId(*b"py/eth2c");
}
// parameter_types! {
// pub const StoragePricePerByte: u128 = MILLIUNIT;
// pub const Eth2ClientPalletId: PalletId = PalletId(*b"py/eth2c");
// }

impl pallet_eth2_light_client::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type StoragePricePerByte = StoragePricePerByte;
type PalletId = Eth2ClientPalletId;
type Currency = Balances;
}
// impl pallet_eth2_light_client::Config for Runtime {
// type RuntimeEvent = RuntimeEvent;
// type StoragePricePerByte = StoragePricePerByte;
// type PalletId = Eth2ClientPalletId;
// type Currency = Balances;
// }

pub struct BaseFilter;
impl Contains<RuntimeCall> for BaseFilter {
Expand Down Expand Up @@ -1101,7 +1100,7 @@ construct_runtime!(
BaseFee: pallet_base_fee,
HotfixSufficients: pallet_hotfix_sufficients,

Eth2Client: pallet_eth2_light_client,
//Eth2Client: pallet_eth2_light_client,
}
);

Expand Down
4 changes: 2 additions & 2 deletions runtime/testnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pallet-treasury = { workspace = true }

pallet-authorship = { workspace = true }
pallet-balances = { workspace = true }
pallet-eth2-light-client = { workspace = true }
#pallet-eth2-light-client = { workspace = true }
pallet-identity = { workspace = true }
pallet-proxy = { workspace = true }
pallet-randomness-collective-flip = { workspace = true }
Expand Down Expand Up @@ -230,7 +230,7 @@ std = [
"pallet-dkg/std",

# ETH2 light-client
"pallet-eth2-light-client/std",
#"pallet-eth2-light-client/std",

# Frontier
"fp-account/std",
Expand Down
24 changes: 12 additions & 12 deletions runtime/testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1079,17 +1079,17 @@ impl pallet_utility::Config for Runtime {
type WeightInfo = ();
}

parameter_types! {
pub const StoragePricePerByte: u128 = MILLIUNIT;
pub const Eth2ClientPalletId: PalletId = PalletId(*b"py/eth2c");
}

impl pallet_eth2_light_client::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type StoragePricePerByte = StoragePricePerByte;
type PalletId = Eth2ClientPalletId;
type Currency = Balances;
}
// parameter_types! {
// pub const StoragePricePerByte: u128 = MILLIUNIT;
// pub const Eth2ClientPalletId: PalletId = PalletId(*b"py/eth2c");
// }

// impl pallet_eth2_light_client::Config for Runtime {
// type RuntimeEvent = RuntimeEvent;
// type StoragePricePerByte = StoragePricePerByte;
// type PalletId = Eth2ClientPalletId;
// type Currency = Balances;
// }

parameter_types! {
pub const JobsPalletId: PalletId = PalletId(*b"py/jobss");
Expand Down Expand Up @@ -1293,7 +1293,7 @@ construct_runtime!(
DynamicFee: pallet_dynamic_fee,
BaseFee: pallet_base_fee,
HotfixSufficients: pallet_hotfix_sufficients,
Eth2Client: pallet_eth2_light_client,
//Eth2Client: pallet_eth2_light_client,

Roles: pallet_roles,
Jobs: pallet_jobs,
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
# substrate has issues with newer versions.
# See: https://substrate.stackexchange.com/questions/7714/cannot-run-substrate-on-a-fresh-macbook-m2
# and: https://stackoverflow.com/questions/75955457/substrate-node-template-cannot-create-a-runtime-error-othercannot-deserialize
channel = "nightly-2023-07-16"
channel = "nightly-2023-07-29"
components = ["rustfmt", "clippy", "rust-src"]
targets = ["wasm32-unknown-unknown"]

0 comments on commit 459a820

Please sign in to comment.