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

refactor!: substrate 3 upgrade #141

Merged
merged 42 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f559a1e
refactor: substrate 3 upgrade
enthusiastmartin Mar 9, 2021
5df54a6
fix: clippy
enthusiastmartin Mar 10, 2021
53e035b
test(amm): tests adjusted for substrate3
enthusiastmartin Mar 10, 2021
3cb0119
test(asset registry): tests adjusted for substrate3
enthusiastmartin Mar 10, 2021
666258c
test(exchange): tests adjusted for substrate3
enthusiastmartin Mar 10, 2021
39df661
test(faucet): tests adjusted for substrate3
enthusiastmartin Mar 10, 2021
a48e110
test(multipayment): tests adjusted for substrate3
enthusiastmartin Mar 10, 2021
693e78c
test(claims): tests adjusted for substrate3
enthusiastmartin Mar 10, 2021
85a8942
fix: block finalization
martinfridrich Mar 10, 2021
ccf4509
refactor: telemetry_on_connect
martinfridrich Mar 10, 2021
31ab6a0
test(amm): benchmarking tests fixed for substrate3
enthusiastmartin Mar 10, 2021
d5e826f
test(exchange): benchmarking tests fixed for substrate3
enthusiastmartin Mar 10, 2021
32a2524
test(multipayment): benchmarking tests fixed for substrate3
enthusiastmartin Mar 10, 2021
ed37011
Merge branch 'refactor/substrate_3' of github.com:galacticcouncil/Hyd…
enthusiastmartin Mar 10, 2021
080ab4e
refactor(assetregistry): migrate to new pallet macro
enthusiastmartin Mar 11, 2021
5a6af53
refactor(amm): migrate to new pallet macro
enthusiastmartin Mar 11, 2021
15dac7f
test(amm): use account ids in test for new substrate events
enthusiastmartin Mar 12, 2021
d289644
test(amm): use account ids in test for new substrate events
enthusiastmartin Mar 12, 2021
6bb2ebe
refactor(claims): migrate to new pallet macro
enthusiastmartin Mar 15, 2021
93757cc
refactor(faucet): migrate to new pallet macro
enthusiastmartin Mar 15, 2021
22781f7
refactor(payment): migrate to new pallet macro
enthusiastmartin Mar 15, 2021
32171d5
refactor(exchange): migrate to new pallet macro
enthusiastmartin Mar 15, 2021
5d9c624
chore: resolve warnings
enthusiastmartin Mar 15, 2021
5ed52ed
build: update more recent substrate version
enthusiastmartin Mar 15, 2021
e0a063e
build: bump substrate version
enthusiastmartin Mar 15, 2021
fdb81ae
Merge branch 'master' into refactor/substrate_3
enthusiastmartin Mar 15, 2021
f29b4df
Merge branch 'refactor/substrate_3' into refactor/substrate_3_pallets
enthusiastmartin Mar 15, 2021
c95fc5d
fix benchmark build with substrate 3
enthusiastmartin Mar 15, 2021
55232e6
Merge pull request #153 from galacticcouncil/refactor/substrate_3_pal…
enthusiastmartin Mar 15, 2021
93ae2fe
style: reformat
enthusiastmartin Mar 15, 2021
49ae375
build: bump spec version to 3
enthusiastmartin Mar 15, 2021
ffeb867
happy clippy - happy life
enthusiastmartin Mar 15, 2021
ccb3a3b
build: update toolchain in gh workflow
enthusiastmartin Mar 15, 2021
52af2fc
fix(payment): fix multi payment benchmark
enthusiastmartin Mar 15, 2021
baa4fe2
build: fix m1 build by downgrading libc version
jak-pan Mar 15, 2021
fcd9db7
refactor: remove version for local dependencies
enthusiastmartin Mar 16, 2021
cb58283
remove commented code
enthusiastmartin Mar 16, 2021
baae362
refactor(payment): remove migration (orderset type change)
enthusiastmartin Mar 16, 2021
f97090a
refactor: change ssh58 prefix in tests to 63
enthusiastmartin Mar 16, 2021
ebd7828
build: runtime impl version reset to 0
enthusiastmartin Mar 16, 2021
7bada42
Merge branch 'master' into refactor/substrate_3
enthusiastmartin Mar 16, 2021
cee3529
Merge branch 'master' into refactor/substrate_3
enthusiastmartin Mar 16, 2021
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
2,835 changes: 1,546 additions & 1,289 deletions Cargo.lock

Large diffs are not rendered by default.

156 changes: 78 additions & 78 deletions Cargo.toml

Large diffs are not rendered by default.

82 changes: 41 additions & 41 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage = 'https://github.com/galacticcouncil/hydradx-node'
license = 'Unlicense'
name = 'hydra-dx'
repository = 'https://github.com/galacticcouncil/hydradx-node'
version = '2.0.0'
version = '3.0.0'

[[bin]]
name = 'hydra-dx'
Expand All @@ -24,50 +24,50 @@ serde_json = "1.0.61"
structopt = '0.3.8'

# local dependencies
hydra-dx-runtime = {path = '../runtime', version = '2.0.0'}
module-amm-rpc = {path = '../pallets/amm/rpc', version = '2.0.0'}
primitives = {path = '../primitives', version = '2.0.0'}
hydra-dx-runtime = {path = '../runtime', version = '3.0.0'}
enthusiastmartin marked this conversation as resolved.
Show resolved Hide resolved
module-amm-rpc = {path = '../pallets/amm/rpc', version = '3.0.0'}
primitives = {path = '../primitives', version = '3.0.0'}

# Substrate dependencies
frame-benchmarking = '2.0.0'
frame-benchmarking-cli = {version = '2.0.0', optional = true}
frame-benchmarking = '3.0.0'
frame-benchmarking-cli = {version = '3.0.0', optional = true}
futures = '0.3.4'
hex-literal = "0.3.1"
pallet-im-online = "2.0.0"
pallet-staking = '2.0.0'
pallet-transaction-payment-rpc = '2.0.0'
sc-authority-discovery = '0.8.0'
sc-basic-authorship = '0.8.0'
sc-cli = {features = ['wasmtime'], version = '0.8.0'}
sc-client-api = '2.0.0'
sc-consensus = '0.8.0'
sc-consensus-babe = '0.8.0'
sc-consensus-babe-rpc = '0.8.0'
sc-consensus-epochs = '0.8.0'
sc-consensus-slots = '0.8.0'
sc-executor = {features = ['wasmtime'], version = '0.8.0'}
sc-finality-grandpa = '=0.8.0'
sc-finality-grandpa-rpc = '=0.8.0'
sc-keystore = '2.0.0'
sc-network = '0.8.0'
sc-rpc = '2.0.0'
sc-rpc-api = '0.8.0'
sc-service = '0.8.0'
sc-telemetry = '2.0.0'
sc-transaction-pool = '2.0.0'
sp-api = '2.0.0'
sp-authority-discovery = '2.0.0'
sp-block-builder = '2.0.0'
sp-blockchain = '2.0.0'
sp-consensus = '0.8.0'
sp-consensus-babe = '0.8.0'
sp-core = '=2.0.0'
sp-finality-grandpa = '2.0.0'
sp-inherents = '2.0.0'
sp-keystore = '0.8.0'
sp-runtime = '2.0.0'
sp-transaction-pool = '2.0.0'
substrate-frame-rpc-system = '2.0.0'
pallet-im-online = "3.0.0"
pallet-staking = '3.0.0'
pallet-transaction-payment-rpc = '3.0.0'
sc-authority-discovery = '0.9.0'
sc-basic-authorship = '0.9.0'
sc-cli = {features = ['wasmtime'], version = '0.9.0'}
sc-client-api = '3.0.0'
sc-consensus = '0.9.0'
sc-consensus-babe = '0.9.0'
sc-consensus-babe-rpc = '0.9.0'
sc-consensus-epochs = '0.9.0'
sc-consensus-slots = '0.9.0'
sc-executor = {features = ['wasmtime'], version = '0.9.0'}
sc-finality-grandpa = '=0.9.0'
sc-finality-grandpa-rpc = '=0.9.0'
sc-keystore = '3.0.0'
sc-network = '0.9.0'
sc-rpc = '3.0.0'
sc-rpc-api = '0.9.0'
sc-service = '0.9.0'
sc-telemetry = '3.0.0'
sc-transaction-pool = '3.0.0'
sp-api = '3.0.0'
sp-authority-discovery = '3.0.0'
sp-block-builder = '3.0.0'
sp-blockchain = '3.0.0'
sp-consensus = '0.9.0'
sp-consensus-babe = '0.9.0'
sp-core = '=3.0.0'
sp-finality-grandpa = '3.0.0'
sp-inherents = '3.0.0'
sp-keystore = '0.9.0'
sp-runtime = '3.0.0'
sp-transaction-pool = '3.0.0'
substrate-frame-rpc-system = '3.0.0'

[features]
default = [
Expand Down
6 changes: 4 additions & 2 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ impl SubstrateCli for Cli {
}

fn set_ss58() {
use sp_core::crypto::Ss58AddressFormat;
sp_core::crypto::set_default_ss58_version(Ss58AddressFormat::HydraDXAccount);
// TODO: not yet avaiable in this Subsrate version
//use sp_core::crypto::Ss58AddressFormat;
//sp_core::crypto::set_default_ss58_version(Ss58AddressFormat::HydraDXAccount);
}

/// Parse and run command line arguments
Expand Down Expand Up @@ -152,6 +153,7 @@ pub fn run() -> sc_cli::Result<()> {
Role::Light => service::new_light(config),
_ => service::new_full(config).map(|(task_manager, _, _, _, _, _)| task_manager),
}
.map_err(sc_cli::Error::Service)
})
}
}
Expand Down
18 changes: 9 additions & 9 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub fn new_partial(

let transaction_pool = sc_transaction_pool::BasicPool::new_full(
config.transaction_pool.clone(),
config.role.is_authority().into(),
config.prometheus_registry(),
task_manager.spawn_handle(),
client.clone(),
Expand Down Expand Up @@ -93,7 +94,8 @@ pub fn new_partial(
let justification_stream = grandpa_link.justification_stream();
let shared_authority_set = grandpa_link.shared_authority_set().clone();
let shared_voter_state = sc_finality_grandpa::SharedVoterState::empty();
let finality_proof_provider = GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
let finality_proof_provider =
GrandpaFinalityProofProvider::new_for_service(backend.clone(), Some(shared_authority_set.clone()));

let rpc_setup = shared_voter_state.clone();

Expand Down Expand Up @@ -176,8 +178,8 @@ pub fn new_full(

config
.network
.notifications_protocols
.push(sc_finality_grandpa::GRANDPA_PROTOCOL_NAME.into());
.extra_sets
.push(sc_finality_grandpa::grandpa_peers_set_config());

let (network, network_status_sinks, system_rpc_tx, network_starter) =
sc_service::build_network(sc_service::BuildNetworkParams {
Expand Down Expand Up @@ -205,9 +207,9 @@ pub fn new_full(
let name = config.network.node_name.clone();
let enable_grandpa = !config.disable_grandpa;
let prometheus_registry = config.prometheus_registry().cloned();
let telemetry_connection_sinks = sc_service::TelemetryConnectionSinks::default();
//let telemetry_connection_sinks = sc_service::TelemetryConnectionSinks::default();
enthusiastmartin marked this conversation as resolved.
Show resolved Hide resolved

sc_service::spawn_tasks(sc_service::SpawnTasksParams {
let (_rpc_handlers, telemetry_connection_notifier) = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
config,
backend: backend,
client: client.clone(),
Expand All @@ -218,7 +220,6 @@ pub fn new_full(
task_manager: &mut task_manager,
on_demand: None,
remote_blockchain: None,
telemetry_connection_sinks: telemetry_connection_sinks.clone(),
network_status_sinks: network_status_sinks.clone(),
system_rpc_tx,
})?;
Expand Down Expand Up @@ -301,7 +302,7 @@ pub fn new_full(
name: Some(name),
observer_enabled: false,
keystore,
is_authority: role.is_network_authority(),
is_authority: role.is_authority(),
};

if enable_grandpa {
Expand All @@ -315,7 +316,7 @@ pub fn new_full(
config: grandpa_config,
link: grandpa_link,
network: network.clone(),
telemetry_on_connect: Some(telemetry_connection_sinks.on_connect_stream()),
telemetry_on_connect: telemetry_connection_notifier.map(|x| x.on_connect_stream()),
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
prometheus_registry: prometheus_registry,
shared_voter_state,
Expand Down Expand Up @@ -403,7 +404,6 @@ pub fn new_light(config: Configuration) -> Result<TaskManager, ServiceError> {
task_manager: &mut task_manager,
on_demand: Some(on_demand),
rpc_extensions_builder: Box::new(|_, _| ()),
telemetry_connection_sinks: sc_service::TelemetryConnectionSinks::default(),
config,
client,
keystore: keystore_container.sync_keystore(),
Expand Down
31 changes: 16 additions & 15 deletions pallets/amm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage = 'https://github.com/galacticcouncil/hydradx-node'
license = 'Unlicense'
name = 'pallet-amm'
repository = 'https://github.com/galacticcouncil/hydradx-node'
version = '2.0.0'
version = '3.0.0'

[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
Expand All @@ -19,7 +19,7 @@ wasm-builder-runner = {package = 'substrate-wasm-builder-runner', version = '1.0
default-features = false
features = ['derive']
package = 'parity-scale-codec'
version = '1.3.4'
version = '2.0.0'

[dependencies]
primitive-types = {default-features = false, version = '0.8.0'}
Expand All @@ -28,25 +28,25 @@ serde = {features = ['derive'], optional = true, version = '1.0.101'}
hydra-dx-math = {default-features = false, version = "0.1.0", git = "https://github.com/galacticcouncil/hydraDX-math", tag="v0.1.0"}

# Local dependencies
pallet-asset-registry = {path = '../asset-registry', default-features = false, version = '2.0.0'}
primitives = {path = '../../primitives', default-features = false, version = '2.0.0'}
pallet-asset-registry = {path = '../asset-registry', default-features = false, version = '3.0.0'}
primitives = {path = '../../primitives', default-features = false, version = '3.0.0'}

# ORML dependencies
orml-tokens = {default-features = false, version = "0.3.3-dev"}
orml-traits = {default-features = false, version = "0.3.3-dev"}
orml-utilities = {default-features = false, version = "0.3.3-dev"}
orml-tokens = {default-features = false, version = "0.4.1-dev"}
orml-traits = {default-features = false, version = "0.4.1-dev"}
orml-utilities = {default-features = false, version = "0.4.1-dev"}

# Substrate dependencies
frame-benchmarking = {default-features = false, optional = true, version = '2.0.0'}
frame-support = {default-features = false, version = '2.0.0'}
frame-system = {default-features = false, version = '2.0.0'}
frame-system-benchmarking = {default-features = false, optional = true, version = '2.0.0'}
sp-core = {default-features = false, version = '2.0.0'}
sp-runtime = {default-features = false, version = '2.0.0'}
sp-std = {default-features = false, version = '2.0.0'}
frame-benchmarking = {default-features = false, optional = true, version = '3.0.0'}
frame-support = {default-features = false, version = '3.0.0'}
frame-system = {default-features = false, version = '3.0.0'}
frame-system-benchmarking = {default-features = false, optional = true, version = '3.0.0'}
sp-core = {default-features = false, version = '3.0.0'}
sp-runtime = {default-features = false, version = '3.0.0'}
sp-std = {default-features = false, version = '3.0.0'}

[dev-dependencies]
sp-io = {default-features = false, version = '2.0.0'}
sp-io = {default-features = false, version = '3.0.0'}

[features]
default = ['std']
Expand All @@ -56,6 +56,7 @@ runtime-benchmarks = [
"frame-support/runtime-benchmarks",
]
std = [
'serde',
'codec/std',
'frame-support/std',
'frame-system/std',
Expand Down
14 changes: 7 additions & 7 deletions pallets/amm/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
authors = ['GalacticCouncil']
edition = "2018"
name = "module-amm-rpc"
version = '2.0.0'
version = '3.0.0'

[dependencies.module-amm-rpc-runtime-api]
default-features = false
package = 'module-amm-rpc-runtime-api'
path = 'runtime-api'
version = '2.0.0'
version = '3.0.0'

[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
Expand All @@ -21,7 +21,7 @@ wasm-builder-runner = {package = 'substrate-wasm-builder-runner', version = '1.0
default-features = false
features = ['derive']
package = 'parity-scale-codec'
version = '1.3.4'
version = '2.0.0'

[dependencies]
jsonrpc-core = {default-features = false, version = '15.0.0'}
Expand All @@ -30,10 +30,10 @@ jsonrpc-derive = {default-features = false, version = '15.0.0'}
serde = {features = ['derive'], optional = true, version = '1.0.101'}

# Substrate dependencies
sp-api = {default-features = false, version = '2.0.0'}
sp-blockchain = {default-features = false, version = '2.0.0'}
sp-runtime = {default-features = false, version = '2.0.0'}
sp-std = {default-features = false, version = '2.0.0'}
sp-api = {default-features = false, version = '3.0.0'}
sp-blockchain = {default-features = false, version = '3.0.0'}
sp-runtime = {default-features = false, version = '3.0.0'}
sp-std = {default-features = false, version = '3.0.0'}

[features]
default = ['std']
Expand Down
10 changes: 5 additions & 5 deletions pallets/amm/rpc/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ['GalacticCouncil']
name = "module-amm-rpc-runtime-api"
version = '2.0.0'
version = '3.0.0'
edition = "2018"

[package.metadata.docs.rs]
Expand All @@ -15,15 +15,15 @@ wasm-builder-runner = { package = 'substrate-wasm-builder-runner', version = '1.
default-features = false
features = ['derive']
package = 'parity-scale-codec'
version = '1.3.4'
version = '2.0.0'

[dependencies]
serde = { features = ['derive'], optional = true, version = '1.0.101' }

# Substrate dependencies
sp-std = { default-features = false, version = '2.0.0' }
sp-api = { default-features = false, version = '2.0.0' }
sp-runtime = { default-features = false, version = '2.0.0' }
sp-std = { default-features = false, version = '3.0.0' }
sp-api = { default-features = false, version = '3.0.0' }
sp-runtime = { default-features = false, version = '3.0.0' }

[features]
default = ["std"]
Expand Down
3 changes: 0 additions & 3 deletions pallets/amm/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ fn funded_account<T: Config>(name: &'static str, index: u32) -> T::AccountId {
}

benchmarks! {
_ {
}

create_pool {
let caller = funded_account::<T>("caller", 0);

Expand Down
Loading