Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Fix build (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
salman01zp authored Aug 18, 2023
1 parent fef86da commit c61804f
Show file tree
Hide file tree
Showing 24 changed files with 101 additions and 107 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/validate_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-12-26
toolchain: nightly-2023-07-16
components: clippy
override: true

Expand All @@ -25,7 +25,7 @@ jobs:
uses: actions-rs/toolchain@master
with:
profile: minimal
toolchain: nightly-2022-12-26
toolchain: nightly-2023-07-16
target: wasm32-unknown-unknown

- name: Install protobuf-compiler
Expand Down
4 changes: 2 additions & 2 deletions crates/bls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ eth2-serde-utils = { package = "webb-eth2-serde-utils", path = "../serde-utils",
milagro_bls = { git = "https://github.com/Snowfork/milagro_bls", default-features = false }
rand = { version = "0.7.3", default-features = false }
rand_chacha = { version = "0.3.1", default-features = false }
serde = { version = "1.0.101", features = ["derive"], optional = true, default-features = false}
serde = { version = "1.0.152", features = ["derive"], default-features = false}

hex = { version = "0.4.2", default-features = false, features = ["alloc"] }
ethereum-types = { version = "0.14.1", default-features = false }
Expand All @@ -22,7 +22,7 @@ zeroize = { version = "1.4.2", features = ["zeroize_derive"], default-features =
[features]
default = ["std"]
std = [
"serde",
"serde/std",
"rand/std",
"rand_chacha/std",
"hex/std",
Expand Down
2 changes: 1 addition & 1 deletion crates/bls/src/generic_aggregate_signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ where
}

/// Hashes the `self.serialize()` bytes.
#[allow(clippy::derive_hash_xor_eq)]
#[allow(clippy::derived_hash_with_manual_eq)]
impl<Pub, AggPub, Sig, AggSig> Hash for GenericAggregateSignature<Pub, AggPub, Sig, AggSig>
where
Sig: TSignature<Pub>,
Expand Down
5 changes: 2 additions & 3 deletions crates/bls/src/zeroize_hash.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use super::SECRET_KEY_BYTES_LEN;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use zeroize::Zeroize;

/// Provides a wrapper around a `[u8; SECRET_KEY_BYTES_LEN]` that implements `Zeroize` on `Drop`.
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "std", serde(transparent))]
#[derive(Serialize, Deserialize)]
#[serde(transparent)]
#[derive(Zeroize)]
#[zeroize(drop)]
pub struct ZeroizeHash([u8; SECRET_KEY_BYTES_LEN]);
Expand Down
5 changes: 3 additions & 2 deletions crates/consensus-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ authors = ["Webb Developers"]
edition = "2021"

[dependencies]
serde = { version = "1.0.116", default-features = false, optional = true, features = ["derive"] }

serde = { version = "1.0.152", default-features = false, features = ["derive"] }

rlp = { version = "0.5.0", default-features = false }
rlp-derive = { version = "0.1.0", default-features = false }
ethereum-types = { version = "0.14.1", features = ["codec", "rlp", "serialize"], default-features = false }
Expand All @@ -29,7 +31,6 @@ scale-info = { version = "2.1.1", default-features = false, features = ["derive"
[features]
default = ["std"]
std = [
"serde",
"tree-hash/std",
"eth-types/std",
"bitvec/std",
Expand Down
7 changes: 3 additions & 4 deletions crates/consensus-types/src/network_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use alloc::string::String;
use codec::{Decode, Encode};
use core::str::FromStr;
use eth_types::eth2::{Epoch, ForkVersion, Slot};
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, Encode, Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Encode, Decode, scale_info::TypeInfo, Serialize, Deserialize)]
pub enum Network {
Mainnet,
Goerli,
Expand All @@ -22,8 +22,7 @@ impl FromStr for Network {
}
}

#[derive(Clone, Debug, PartialEq, Encode, Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Encode, Decode, scale_info::TypeInfo, Serialize, Deserialize)]
pub struct NetworkConfig {
pub genesis_validators_root: [u8; 32],
pub bellatrix_fork_version: ForkVersion,
Expand Down
2 changes: 1 addition & 1 deletion crates/eth-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Near Inc <[email protected]>", "Webb Developers <[email protected]
edition = "2021"

[dependencies]
serde = { version = "1.0.101", default-features = false, features = ["derive"], optional = true }
serde = { version = "1.0.152", default-features = false, features = ["derive"]}
rlp = { version = "0.5.0", default-features = false }
rlp-derive = { version = "0.1.0", default-features = false }
ethereum-types = { version = "0.14.1", features = ["codec", "rlp"], default-features = false }
Expand Down
7 changes: 3 additions & 4 deletions crates/eth-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use rlp::{
};
use rlp_derive::RlpDecodable as RlpDecodableDerive;
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use tiny_keccak::{Hasher, Keccak};

Expand Down Expand Up @@ -88,8 +87,9 @@ macro_rules! uint_declare_wrapper_and_serde_codec_typeinfo {
Encode,
Decode,
TypeInfo,
Serialize,
Deserialize,
)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct $name(pub ethereum_types::$name);

impl RlpEncodable for $name {
Expand All @@ -116,8 +116,7 @@ pub type Signature = H520;

// Block Header

#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode, TypeInfo, Serialize, Deserialize)]
pub struct BlockHeader {
pub parent_hash: H256,
pub uncles_hash: H256,
Expand Down
3 changes: 2 additions & 1 deletion crates/eth-types/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ macro_rules! arr_ethereum_types_wrapper_impl {
Encode,
Decode,
TypeInfo,
serde::Serialize,
serde::Deserialize,
)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct $name(pub ethereum_types::$name);

impl From<&[u8; $len]> for $name {
Expand Down
2 changes: 1 addition & 1 deletion crates/eth2-pallet-init/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ webb = { version = "0.7.3", default-features = false, features = [
]}
scale = { package = "parity-scale-codec", version = "3", default-features = false }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
webb-proposals = { git = "https://github.com/webb-tools/webb-rs.git", default-features = false, features = ["scale", "evm"] }
webb-proposals = { git = "https://github.com/webb-tools/webb-rs.git", rev="a960eaf", default-features = false, features = ["scale", "evm"] }
tokio = { version = "1.1", default-features = false, features = ["macros", "rt", "time"] }
dotenvy = "0.15.7"
2 changes: 1 addition & 1 deletion eth2substrate-block-relay-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ webb = { version = "0.5.17", features = [
"evm-runtime",
"substrate-runtime"
]}
webb-proposals = { git = "https://github.com/webb-tools/webb-rs.git", default-features = false, features = ["scale", "evm"] }
webb-proposals = { git = "https://github.com/webb-tools/webb-rs.git",rev="a960eaf", default-features = false, features = ["scale", "evm"] }

anyhow = "1.0"
funty = "2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion eth2substrate-block-relay-rs/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ pub async fn get_client_pallet(
let typed_chain_id = get_typed_chain_id(config_for_test);
let mut eth_client_pallet = EthClientPallet::new(api, typed_chain_id);

let mut config = get_init_config(config_for_test, &eth_client_pallet);
let config = get_init_config(config_for_test, &eth_client_pallet);

match from_file {
true => test_utils::init_pallet_from_files(&mut eth_client_pallet, config_for_test).await,
Expand Down
4 changes: 2 additions & 2 deletions gadget/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ eth2-to-substrate-relay = { path = "../eth2substrate-block-relay-rs" }
eth2-pallet-init = { package = "webb-eth2-pallet-init", path = "../crates/eth2-pallet-init" }

# DKG
dkg-runtime-primitives = { git = "https://github.com/webb-tools/dkg-substrate.git", default-features = false }
dkg-runtime-primitives = { git = "https://github.com/webb-tools/dkg-substrate.git", tag = "v0.4.1", default-features = false }

# Webb
webb-proposals = { git = "https://github.com/webb-tools/webb-rs", features = ["scale", "evm"] }
webb-proposals = { git = "https://github.com/webb-tools/webb-rs", rev="a960eaf", features = ["scale", "evm"] }
8 changes: 2 additions & 6 deletions gadget/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Webb Relayer Gadget
//!
//! Integrates the Webb Relayer into the Substrate Node.
#![allow(dead_code)]
use dkg_runtime_primitives::crypto;
use eth2_pallet_init::{init_pallet, substrate_pallet_client::EthClientPallet};
use eth2_to_substrate_relay::eth2substrate_relay::Eth2SubstrateRelay;
Expand All @@ -11,9 +12,6 @@ use sp_keystore::Keystore;
use std::{net::SocketAddr, path::PathBuf, sync::Arc};
use subxt::OnlineClient;
use webb_proposals::TypedChainId;
use webb_relayer::service;
use webb_relayer_context::RelayerContext;

pub mod errors;
use errors::*;

Expand All @@ -36,9 +34,7 @@ pub struct Eth2LightClientParams {
}

pub async fn start_gadget(relayer_params: Eth2LightClientParams) {
/// ///
/// ------------------ Light Client Relayer ------------------ ///
/// ///
// Light Client Relayer
let lc_relay_config = match relayer_params.lc_relay_config_path.as_ref() {
Some(p) =>
loads_light_client_relayer_config(p).expect("failed to load light client config"),
Expand Down
3 changes: 2 additions & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ futures = { version = "0.3.21", features = ["thread-pool"]}
rand = "0.7.2"

sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sc-offchain = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sc-network = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
Expand Down Expand Up @@ -57,7 +58,7 @@ sc-basic-authorship = { version = "0.10.0-dev", git = "https://github.com/parity
substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }

webb-proposals = { git = "https://github.com/webb-tools/webb-rs.git", default-features = false, features = ["scale", "evm"] }
webb-proposals = { git = "https://github.com/webb-tools/webb-rs.git", rev="a960eaf", default-features = false, features = ["scale", "evm"] }
webb-consensus-types = { path = "../crates/consensus-types" }
pallet-eth2-light-client-relayer-gadget = { path = "../gadget" }
pallet-eth2-light-client-relayer-gadget-cli = { path = "../gadget/cli" }
Expand Down
13 changes: 7 additions & 6 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use node_template_runtime::{
opaque::SessionKeys, AccountId, Balance, BalancesConfig, DKGConfig, DKGId, Eth2ClientConfig,
GenesisConfig, IndicesConfig, MaxNominations, SessionConfig, Signature, StakingConfig,
IndicesConfig, MaxNominations, RuntimeGenesisConfig, SessionConfig, Signature, StakingConfig,
SudoConfig, SystemConfig, DOLLARS, WASM_BINARY,
};
use pallet_staking::StakerStatus;
Expand All @@ -19,7 +19,7 @@ use webb_proposals::TypedChainId;
// const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";

/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig>;
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig>;

/// Generate a crypto pair from seed.
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
Expand Down Expand Up @@ -53,7 +53,7 @@ fn session_keys(grandpa: GrandpaId, aura: AuraId, dkg: DKGId) -> SessionKeys {
SessionKeys { grandpa, aura, dkg }
}

fn development_config_genesis() -> GenesisConfig {
fn development_config_genesis() -> RuntimeGenesisConfig {
let wasm_binary = WASM_BINARY.unwrap();
testnet_genesis(
wasm_binary,
Expand All @@ -80,7 +80,7 @@ pub fn development_config() -> ChainSpec {
)
}

fn local_testnet_genesis() -> GenesisConfig {
fn local_testnet_genesis() -> RuntimeGenesisConfig {
let wasm_binary = WASM_BINARY.unwrap();
testnet_genesis(
wasm_binary,
Expand Down Expand Up @@ -114,7 +114,7 @@ fn testnet_genesis(
initial_nominators: Vec<AccountId>,
root_key: AccountId,
endowed_accounts: Option<Vec<AccountId>>,
) -> GenesisConfig {
) -> RuntimeGenesisConfig {
let mut endowed_accounts: Vec<AccountId> = endowed_accounts.unwrap_or_else(|| {
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand Down Expand Up @@ -163,10 +163,11 @@ fn testnet_genesis(

const ENDOWMENT: Balance = 10_000_000 * DOLLARS;
const STASH: Balance = ENDOWMENT / 1000;
GenesisConfig {
RuntimeGenesisConfig {
system: SystemConfig {
// Add Wasm runtime to storage.
code: wasm_binary.to_vec(),
..Default::default()
},
balances: BalancesConfig {
// Configure endowed accounts with initial balance of 1 << 60.
Expand Down
8 changes: 2 additions & 6 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
};
use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE};
use node_template_runtime::{Block, EXISTENTIAL_DEPOSIT};
use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli};
use sc_cli::SubstrateCli;
use sc_service::PartialComponents;
use sp_keyring::Sr25519Keyring;

Expand Down Expand Up @@ -46,10 +46,6 @@ impl SubstrateCli for Cli {
Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
})
}

fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
&node_template_runtime::VERSION
}
}

/// Parse and run command line arguments
Expand Down Expand Up @@ -124,7 +120,7 @@ pub fn run() -> sc_cli::Result<()> {
)
}

cmd.run::<Block, service::ExecutorDispatch>(config)
cmd.run::<Block, ()>(config)
},
BenchmarkCmd::Block(cmd) => {
let PartialComponents { client, .. } = service::new_partial(&config)?;
Expand Down
4 changes: 2 additions & 2 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use std::sync::Arc;

use jsonrpsee::RpcModule;
use node_template_runtime::{opaque::Block, AccountId, Balance, Index};
use node_template_runtime::{opaque::Block, AccountId, Balance, Nonce};
use sc_transaction_pool_api::TransactionPool;
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
Expand All @@ -34,7 +34,7 @@ where
C: ProvideRuntimeApi<Block>,
C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,
C: Send + Sync + 'static,
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: BlockBuilder<Block>,
P: TransactionPool + 'static,
Expand Down
Loading

0 comments on commit c61804f

Please sign in to comment.