Skip to content

Commit

Permalink
Erup 4 - Webb on Edgeware (#150)
Browse files Browse the repository at this point in the history
* use webb-tools/substrate fork

* Updates frontier dependency (#146)

* Update and add new inherent

* Update

* Update lock

* Update frontier

* Frontier fork update

* Ups

* Update frontier and substratet

* Update frontier fork

* fix merkle tree leaves index issue

Co-authored-by: Shady Khalifa <shekohex@gmail.com>
  • Loading branch information
drewstone and Shady Khalifa committed Jun 11, 2021
1 parent 2507563 commit 5500fa5
Show file tree
Hide file tree
Showing 18 changed files with 1,574 additions and 1,331 deletions.
2,309 changes: 1,256 additions & 1,053 deletions Cargo.lock

Large diffs are not rendered by default.

268 changes: 134 additions & 134 deletions Cargo.toml

Large diffs are not rendered by default.

65 changes: 33 additions & 32 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,39 @@ jsonrpc-pubsub = "15.0.0"
webb-runtime = { path = "../runtime", version = "3.0.0" }

# Substrate dependencies
frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-cli = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-executor = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-telemetry = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-rpc-api = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-service = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-block-builder = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-inherents = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-timestamp = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
frame-benchmarking = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
frame-benchmarking-cli = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
pallet-transaction-payment-rpc = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-basic-authorship = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-cli = { features = ["wasmtime"], git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-client-api = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-chain-spec = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-consensus = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-consensus-aura = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-executor = { features = ["wasmtime"], git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-finality-grandpa = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-finality-grandpa-rpc = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-network = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-keystore = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-telemetry = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-rpc = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-rpc-api = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-service = { features = ["wasmtime"], git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sc-transaction-pool = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-api = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-block-builder = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-blockchain = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-consensus = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-consensus-aura = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-core = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-finality-grandpa = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-inherents = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-runtime = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-timestamp = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-transaction-pool = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
substrate-frame-rpc-system = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }

pallet-contracts-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
pallet-contracts-rpc = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }

fc-consensus = { default-features = false, git = "https://github.com/webb-tools/frontier", branch = "erup-4" }
fp-consensus = { default-features = false, git = "https://github.com/webb-tools/frontier", branch = "erup-4" }
Expand All @@ -73,6 +73,7 @@ fc-mapping-sync = { default-features = false, git = "https://github.com/webb-too

pallet-evm = { git = "https://github.com/webb-tools/frontier", branch = "erup-4" }
pallet-ethereum = { git = "https://github.com/webb-tools/frontier", branch = "erup-4" }
pallet-dynamic-fee = { git = "https://github.com/webb-tools/frontier", branch = "erup-4" }

merkle = { package = "pallet-merkle", path = "../pallets/merkle" }
merkle-rpc = { package = "pallet-merkle-rpc", path = "../pallets/merkle/rpc" }
Expand Down
2 changes: 1 addition & 1 deletion node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ fn testnet_genesis(
// Configure endowed accounts with initial balance of 1 << 60.
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
},
pallet_contracts: Default::default(),
pallet_aura: AuraConfig {
authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(),
},
Expand All @@ -168,5 +167,6 @@ fn testnet_genesis(
pallet_evm: EVMConfig {
accounts: evm_accounts,
},
pallet_dynamic_fee: Default::default(),
}
}
4 changes: 4 additions & 0 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ pub struct RunCmd {
/// Maximum number of logs in a query.
#[structopt(long, default_value = "10000")]
pub max_past_logs: u32,

/// The dynamic-fee pallet target gas price set by block author
#[structopt(long, default_value = "1")]
pub target_gas_price: u64,
}

#[derive(Debug, StructOpt)]
Expand Down
11 changes: 9 additions & 2 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub use sc_executor::NativeExecutor;
use sc_service::{error::Error as ServiceError, BasePath, Configuration, TaskManager};
use sc_telemetry::{Telemetry, TelemetryWorker};
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
use sp_core::U256;

use sp_consensus::SlotData;
use std::{
Expand Down Expand Up @@ -148,6 +149,8 @@ pub fn new_partial(
let slot_duration = sc_consensus_aura::slot_duration(&*client)?;
let raw_slot_duration = slot_duration.slot_duration();

let target_gas_price = U256::from(cli.run.target_gas_price);

let import_queue = sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _, _>(
ImportQueueParams {
block_import: aura_block_import.clone(),
Expand All @@ -161,8 +164,9 @@ pub fn new_partial(
*timestamp,
raw_slot_duration,
);
let fee = pallet_dynamic_fee::InherentDataProvider(target_gas_price);

Ok((timestamp, slot))
Ok((timestamp, slot, fee))
},
spawner: &task_manager.spawn_essential_handle(),
can_author_with: sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),
Expand Down Expand Up @@ -193,6 +197,7 @@ pub fn new_partial(
/// Builds a new service for a full client.
pub fn new_full(mut config: Configuration, cli: &Cli) -> Result<TaskManager, ServiceError> {
let enable_dev_signer = cli.run.enable_dev_signer;
let target_gas_price = U256::from(cli.run.target_gas_price);

let sc_service::PartialComponents {
client,
Expand Down Expand Up @@ -361,7 +366,9 @@ pub fn new_full(mut config: Configuration, cli: &Cli) -> Result<TaskManager, Ser
raw_slot_duration,
);

Ok((timestamp, slot))
let fee = pallet_dynamic_fee::InherentDataProvider(target_gas_price);

Ok((timestamp, slot, fee))
},
force_authoring,
backoff_authoring_blocks,
Expand Down
16 changes: 8 additions & 8 deletions pallets/currencies/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ edition = "2018"
[dependencies]
serde = { version = "1.0.124", optional = true }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "master", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4", default-features = false }
sp-io = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4", default-features = false }
sp-std = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4", default-features = false }

frame-support = { git = "https://github.com/paritytech/substrate.git", branch = "master", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate.git", branch = "master", default-features = false }
frame-support = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4", default-features = false }
frame-system = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4", default-features = false }

webb-traits = { path = "../traits", default-features = false }
webb-utilities = { path = "../utilities", default-features = false }

funty = { version = "=1.1.0", default-features = false } # https://github.com/bitvecto-rs/bitvec/issues/105
frame-benchmarking = { default-features = false, version = "3.0.0", optional = true, git = "https://github.com/paritytech/substrate.git", branch = "master" }
frame-benchmarking = { default-features = false, version = "3.0.0", optional = true, git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }

[dev-dependencies]
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-core = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
pallet-balances = { git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
webb-tokens = { path = "../tokens" }

[features]
Expand Down
18 changes: 9 additions & 9 deletions pallets/merkle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
balances = { version = "3.0.0", default-features = false, package = "pallet-balances", git = "https://github.com/paritytech/substrate.git", branch = "master" }
frame-support = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
frame-system = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-std = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-runtime = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
balances = { version = "3.0.0", default-features = false, package = "pallet-balances", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
frame-support = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
frame-system = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-std = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-runtime = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
merlin = { version = "2.0.0", default-features = false }
sha2 = { version = "0.9.1", default-features = false }
rand_core = { version = "0.5", default-features = false, features = ["alloc", "getrandom"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] }
sp-api = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-io = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
frame-benchmarking = { default-features = false, version = "3.0.0", optional = true, git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-api = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-io = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
frame-benchmarking = { default-features = false, version = "3.0.0", optional = true, git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
lazy_static = { version = "1.4.0", features = ["spin_no_std"] }

[dependencies.curve25519-dalek]
Expand All @@ -41,7 +41,7 @@ version = "2.0.0"
default-features = false

[dev-dependencies]
sp-core = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-core = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }

[features]
default = ["std"]
Expand Down
8 changes: 4 additions & 4 deletions pallets/merkle/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jsonrpc-derive = "15"
sc-rpc = "3.0.0"

codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
sp-core = { version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-api = { version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-blockchain = { version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-runtime = { version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-core = { version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-api = { version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-blockchain = { version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-runtime = { version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }

merkle = { package = "pallet-merkle", path = "../", default-features = false }

Expand Down
8 changes: 7 additions & 1 deletion pallets/merkle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,16 @@ impl<T: Config> Tree<T::AccountId, T::BlockNumber, T::TreeId> for Pallet<T> {

let zero_tree = Self::generate_zero_tree(tree.hasher.clone());
for data in &members {
Self::add_leaf(&mut tree, *data, &zero_tree);
// first we check if we should store leaves.
if tree.should_store_leaves {
// if so, we save it.
// the index where the leaf should be saved is the count
// of leaves we have in the tree.
Leaves::<T>::insert(id, tree.leaf_count, *data);
}
// then we add it to the tree itself.
// note that, this method internally increments the leaves count.
Self::add_leaf(&mut tree, *data, &zero_tree);
}
let block_number: T::BlockNumber = <frame_system::Pallet<T>>::block_number();
CachedRoots::<T>::append(block_number, id, tree.root_hash);
Expand Down
16 changes: 8 additions & 8 deletions pallets/mixer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
log = "0.4.8"
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
pallet-balances = { version = "3.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }
frame-support = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
frame-system = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-std = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-runtime = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
pallet-balances = { version = "3.0.0", default-features = false, git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
frame-support = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
frame-system = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-std = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-runtime = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }

merkle = { package = "pallet-merkle", path = "../merkle", default-features = false }
webb-tokens = { path = "../tokens", default-features = false }


serde = { version = "1.0.101", optional = true, features = ["derive"] }
merlin = { version = "2.0.0", default-features = false }
frame-benchmarking = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master", optional = true }
frame-benchmarking = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4", optional = true }
webb-traits = { default-features = false, path = "../traits" }
webb-currencies = { default-features = false, path = "../currencies" }

Expand All @@ -47,8 +47,8 @@ features = ["u64_backend", "alloc"]
version = "0.1.5"

[dev-dependencies]
sp-core = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-io = { default-features = false, version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-core = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }
sp-io = { default-features = false, version = "3.0.0", git = "https://github.com/webb-tools/substrate.git", branch = "erup-4" }

[features]
default = ["std"]
Expand Down

0 comments on commit 5500fa5

Please sign in to comment.