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

Update Substrate to 3.0 #439

Merged
merged 50 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
7337ac1
Update Substrate
liuchengxu Jan 4, 2021
dc7074c
Fix cargo fmt
liuchengxu Jan 4, 2021
40318c1
Add runtime common
liuchengxu Jan 4, 2021
85b48e0
Rename Trait to Config
liuchengxu Jan 4, 2021
c6be31e
Merge branch 'master' of https://github.com/chainx-org/ChainX into up…
liuchengxu Jan 6, 2021
9882d12
Fix tests
liuchengxu Jan 6, 2021
9c8d0fa
Fix runtime benchmarks
liuchengxu Jan 6, 2021
05640a8
Merge branch 'master' of https://github.com/chainx-org/ChainX into up…
liuchengxu Jan 12, 2021
79f0675
Merge branch 'update-substrate-566ad0' of https://github.com/chainx-o…
liuchengxu Jan 12, 2021
5373f96
Merge branch 'master' of https://github.com/chainx-org/ChainX into up…
liuchengxu Jan 12, 2021
f12bf1c
Make it compile
liuchengxu Jan 15, 2021
fa2dbdc
Make tests compile
liuchengxu Jan 15, 2021
95c5442
Fix format
liuchengxu Jan 15, 2021
ed69aa0
Fix bitcoin header test
liuchengxu Jan 17, 2021
08281d8
Enable clippy check
liuchengxu Jan 19, 2021
3d9f6e4
Revert clippy check
liuchengxu Jan 19, 2021
b097d6e
Update Substrate to bb0fb2965f9eb59c305ce0c294962d3317a29ece
liuchengxu Jan 26, 2021
3f3dbea
Fix format
liuchengxu Jan 26, 2021
2fbf9d5
Fix test compile
liuchengxu Jan 26, 2021
9394bef
Remove debugging print
liuchengxu Jan 26, 2021
f12cfa6
Workaround for a potential Substrate glitch
liuchengxu Jan 26, 2021
a0f95c5
Merge branch 'master' of https://github.com/chainx-org/ChainX into up…
liuchengxu Jan 31, 2021
c1cae3f
Fix malan runtime build
liuchengxu Feb 1, 2021
e1f4c77
Add btc_2.0.json
liuchengxu Feb 2, 2021
ade5f08
Merge branch 'master' of https://github.com/chainx-org/ChainX into up…
liuchengxu Feb 4, 2021
2afbebc
Update Substrate to 93b231e79f5b4e551c34234e89fa4a2e5e9c1510
liuchengxu Feb 5, 2021
0dc335f
Remove tmp btc_2.0.json
liuchengxu Feb 5, 2021
5bf9350
Update Substrate to 81ca765646c35c7676ec2f86e718bf1f6a5cc274
liuchengxu Feb 5, 2021
b35e4ef
Update Substrate to bc69520ae4abb78ca89a57ff9af8887d598ce048
liuchengxu Feb 5, 2021
8cd4b48
Update Substrate to 075796f75f754a712ebb417c8b17633f7b88adf1
liuchengxu Feb 6, 2021
1fbbac4
Update Substrate to f14488dfca012659297d2b4676fab91c179095dd
liuchengxu Feb 6, 2021
aba5c21
Fix test
liuchengxu Feb 6, 2021
045c7bf
Fix todo! with current impl
liuchengxu Feb 6, 2021
0d9ccd6
Update Substrate to 3.0.0
liuchengxu Feb 13, 2021
45d4c7f
MIgrate assets-registrar test to construct_runtime!
liuchengxu Feb 15, 2021
db7beeb
Migrate xpallet_assets test to construct_runtime!
liuchengxu Feb 15, 2021
c4774ac
Migrate all tests to construct_runtime!
liuchengxu Feb 15, 2021
6e76f63
Update orml-* to 0.4.0
liuchengxu Feb 15, 2021
dd05904
Remove patches in Cargo.toml
liuchengxu Feb 15, 2021
82d0d2d
Impl ReportLongevity properly
liuchengxu Feb 16, 2021
9075572
Cargo fmt
liuchengxu Feb 18, 2021
0c16466
Merge branch 'master' of https://github.com/chainx-org/ChainX into up…
liuchengxu Feb 22, 2021
7d3ac23
Update to the latest master of Substrate
liuchengxu Feb 24, 2021
e1accba
Fix wrong feature gate on grandpa after splitting out service crate
liuchengxu Mar 17, 2021
1179c27
Cargo fmt
liuchengxu Mar 17, 2021
09e052e
Replace sc-finality-grandpa-wrap-sync git dep using crates.io dep
liuchengxu Mar 18, 2021
915f8f3
Merge branch 'master' of https://github.com/chainx-org/ChainX into up…
liuchengxu Mar 22, 2021
afb6dd0
Link the Substrate issue in comment
liuchengxu Apr 27, 2021
9abb0d7
Do some cleaning
liuchengxu Apr 28, 2021
368402f
Use sp_staking::SessionIndex and uprade wasm-builder to 4.0
liuchengxu May 6, 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
3,481 changes: 1,867 additions & 1,614 deletions Cargo.lock

Large diffs are not rendered by default.

163 changes: 83 additions & 80 deletions Cargo.toml

Large diffs are not rendered by default.

55 changes: 29 additions & 26 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,43 @@ log4rs = { version = "0.12", features = ["rolling_file_appender", "compound_poli
hex = "0.4"
hex-literal = "0.3.1"
jsonrpc-pubsub = "15.0.0"
parking_lot = "0.11.0"
parking_lot = "0.11.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
structopt = "0.3.8"

# Substrate client
sc-authority-discovery = "0.8.0"
sc-basic-authorship = "0.8.0"
sc-chain-spec = "2.0.0"
sc-client-api = "2.0.0"
sc-consensus = "0.8.0"
sc-consensus-babe = "0.8.0"
sc-consensus-slots = "0.8.0"
sc-executor = "0.8.0"
sc-finality-grandpa = "0.8.0"
sc-network = "0.8.0"
sc-rpc = "2.0.0"
sc-transaction-pool = "2.0.0"
sc-authority-discovery = "0.9.0"
sc-basic-authorship = "0.9.0"
sc-chain-spec = "3.0.0"
sc-client-api = "3.0.0"
sc-consensus = "0.9.0"
sc-consensus-babe = "0.9.0"
sc-consensus-slots = "0.9.0"
sc-executor = "0.9.0"
sc-finality-grandpa = "0.9.0"
sc-finality-grandpa-warp-sync = { version = "0.9.0", optional = true }
sc-network = "0.9.0"
sc-rpc = "3.0.0"
sc-transaction-pool = "3.0.0"
sc-telemetry = "3.0.0"

frame-benchmarking-cli = { version = "2.0.0", optional = true }
sc-cli = { version = "0.8.0", optional = true }
sc-service = { version = "0.8.0", optional = true }
frame-benchmarking-cli = { version = "3.0.0", optional = true }
sc-cli = { version = "0.9.0", optional = true }
sc-service = { version = "0.9.0", optional = true }

# Substrate primitives
sp-authority-discovery = "2.0.0"
sp-core = "2.0.0"
sp-consensus = "0.8.0"
sp-consensus-babe = "0.8.0"
sp-finality-grandpa = "2.0.0"
sp-inherents = "2.0.0"
sp-runtime = "2.0.0"
sp-transaction-pool = "2.0.0"
sp-authority-discovery = "3.0.0"
sp-core = "3.0.0"
sp-consensus = "0.9.0"
sp-consensus-babe = "0.9.0"
sp-finality-grandpa = "3.0.0"
sp-inherents = "3.0.0"
sp-runtime = "3.0.0"
sp-transaction-pool = "3.0.0"

# Substrate pallets
pallet-im-online = "2.0.0"
pallet-im-online = "3.0.0"

chainx-executor = { path = "../executor" }
chainx-primitives = { path = "../primitives" }
Expand All @@ -64,13 +66,14 @@ xpallet-gateway-bitcoin = { path = "../xpallets/gateway/bitcoin" }
xpallet-gateway-common = { path = "../xpallets/gateway/common" }

[build-dependencies]
substrate-build-script-utils = "2.0.0"
substrate-build-script-utils = "3.0.0"

[features]
default = ["cli"]
cli = [
"sc-cli",
"sc-service",
"sc-finality-grandpa-warp-sync",
"frame-benchmarking-cli",
"chainx-executor/wasmi-errno",
]
Expand Down
16 changes: 9 additions & 7 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,14 @@ pub fn run() -> sc_cli::Result<()> {
let chain_spec = &runner.config().chain_spec;
set_default_ss58_version(chain_spec);

runner.run_node_until_exit(|config| async move {
match config.role {
Role::Light => service::build_light(config),
_ => service::build_full(config),
}
})
runner
.run_node_until_exit(|config| async move {
match config.role {
Role::Light => service::build_light(config),
_ => service::build_full(config),
}
})
.map_err(sc_cli::Error::Service)
}
Some(Subcommand::Benchmark(cmd)) => {
if cfg!(feature = "runtime-benchmarks") {
Expand All @@ -120,7 +122,7 @@ pub fn run() -> sc_cli::Result<()> {
Ok(())
}
}
Some(Subcommand::Key(cmd)) => cmd.run(),
Some(Subcommand::Key(cmd)) => cmd.run(&cli),
Some(Subcommand::Sign(cmd)) => cmd.run(),
Some(Subcommand::Verify(cmd)) => cmd.run(),
Some(Subcommand::Vanity(cmd)) => cmd.run(),
Expand Down
4 changes: 2 additions & 2 deletions executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ authors = ["The ChainX Authors"]
edition = "2018"

[dependencies]
frame-benchmarking = "2.0.0"
sc-executor = "0.8.0"
frame-benchmarking = "3.0.0"
sc-executor = "0.9.0"

# ChainX runtime
chainx-runtime = { path = "../runtime/chainx" }
Expand Down
12 changes: 6 additions & 6 deletions primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ authors = ["The ChainX Authors"]
edition = "2018"

[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
serde = { version = "1.0.101", features = ["derive"], optional = true }

# Substrate primitives
sp-application-crypto = { version = "2.0.0", default-features = false }
sp-core = { version = "2.0.0", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
sp-application-crypto = { version = "3.0.0", default-features = false }
sp-core = { version = "3.0.0", default-features = false }
sp-runtime = { version = "3.0.0", default-features = false }
sp-std = { version = "3.0.0", default-features = false }

# Substrate pallets
frame-system = { version = "2.0.0", default-features = false }
frame-system = { version = "3.0.0", default-features = false }

[features]
default = ["std"]
Expand Down
8 changes: 4 additions & 4 deletions primitives/assets-registrar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ authors = ["The ChainX Authors"]
edition = "2018"

[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4", features = ["derive"], default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", features = ["derive"], default-features = false }
serde = { version = "1.0", features = ["derive"], optional = true }
impl-trait-for-tuples = "0.1.3"
impl-trait-for-tuples = "0.2.1"

# Substrate primitives
sp-runtime = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
sp-runtime = { version = "3.0.0", default-features = false }
sp-std = { version = "3.0.0", default-features = false }

# ChainX primitives
chainx-primitives = { path = "../../primitives", default-features = false }
Expand Down
10 changes: 5 additions & 5 deletions primitives/gateway/bitcoin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ authors = ["The ChainX Authors"]
edition = "2018"

[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
hex = { version = "0.4", default-features = false }
serde = { version = "1.0", features = ["derive"], optional = true }

# Substrate primitives
sp-core = { version = "2.0.0", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
frame-support = { version = "2.0.0", default-features = false }
sp-core = { version = "3.0.0", default-features = false }
sp-runtime = { version = "3.0.0", default-features = false }
sp-std = { version = "3.0.0", default-features = false }
frame-support = { version = "3.0.0", default-features = false }

# ChainX primitives
chainx-primitives = { path = "../../../primitives", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions primitives/gateway/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ bs58 = { version = "0.3", default-features = false, features = ["alloc"] }
hex = { version = "0.4", default-features = false }

# Substrate primitives
sp-core = { version = "2.0.0", default-features = false }
frame-support = { version = "2.0.0", default-features = false }
sp-core = { version = "3.0.0", default-features = false }
frame-support = { version = "3.0.0", default-features = false }

# ChainX primitives
xp-logging = { path = "../../logging", default-features = false }
Expand Down
8 changes: 4 additions & 4 deletions primitives/io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ authors = ["The ChainX Authors"]
edition = "2018"

[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }

# Substrate primitives
sp-core = { version = "2.0.0", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
sp-runtime-interface = { version = "2.0.0", default-features = false }
sp-core = { version = "3.0.0", default-features = false }
sp-runtime = { version = "3.0.0", default-features = false }
sp-runtime-interface = { version = "3.0.0", default-features = false }

[dev-dependencies]
hex = "0.4"
Expand Down
3 changes: 3 additions & 0 deletions primitives/io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ pub enum Ss58CheckError {
InvalidPath,
/// Mismatch version.
MismatchVersion,
/// Disallowed SS58 Address Format for this datatype.
FormatNotAllowed,
}

#[runtime_interface]
Expand All @@ -39,6 +41,7 @@ pub trait Ss58Codec {
PublicError::InvalidChecksum => Ss58CheckError::InvalidChecksum,
PublicError::InvalidFormat => Ss58CheckError::InvalidFormat,
PublicError::InvalidPath => Ss58CheckError::InvalidPath,
PublicError::FormatNotAllowed => Ss58CheckError::FormatNotAllowed,
})
.and_then(|(account, ver)| match ver {
ver if ver == Ss58AddressFormat::default() => Ok(account),
Expand Down
4 changes: 2 additions & 2 deletions primitives/mining/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ edition = "2018"

[dependencies]
# Substrate primitives
sp-arithmetic = { version = "2.0.0", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
sp-arithmetic = { version = "3.0.0", default-features = false }
sp-runtime = { version = "3.0.0", default-features = false }

# ChainX primitives
chainx-primitives = { path = "../../../primitives", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions primitives/mining/staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ edition = "2018"

[dependencies]
# Substrate primitives
sp-runtime = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
sp-runtime = { version = "3.0.0", default-features = false }
sp-std = { version = "3.0.0", default-features = false }

# ChainX primitives
chainx-primitives = { path = "../../../primitives", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions primitives/protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ authors = ["The ChainX Authors"]
edition = "2018"

[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4", features = ["derive"], default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", features = ["derive"], default-features = false }
serde = { version = "1.0", features = ["derive"], optional = true }

# Substrate primitives
sp-runtime = { version = "2.0.0", default-features = false }
sp-runtime = { version = "3.0.0", default-features = false }

# ChainX primitives
chainx-primitives = { path = "..", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion primitives/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"

[dependencies]
hex = "0.4"
jsonrpc-core = "15.0.0"
jsonrpc-core = "15.1.0"
serde = { version = "1.0", features = ["derive"] }

[dev-dependencies]
Expand Down
8 changes: 4 additions & 4 deletions primitives/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ authors = ["The ChainX Authors"]
edition = "2018"

[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
serde = { version = "1.0.101", optional = true, features = ["derive"] }

# Substrate primitives
sp-core = { version = "2.0.0", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
sp-core = { version = "3.0.0", default-features = false }
sp-runtime = { version = "3.0.0", default-features = false }
sp-std = { version = "3.0.0", default-features = false }

[dev-dependencies]
hex = "0.4"
Expand Down
52 changes: 27 additions & 25 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,39 @@ authors = ["The ChainX Authors"]
edition = "2018"

[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4", features = ["derive"] }
jsonrpc-core = "15.0.0"
jsonrpc-pubsub = "15.0.0"
codec = { package = "parity-scale-codec", version = "2.0.0", features = ["derive"] }
jsonrpc-core = "15.1.0"
jsonrpc-pubsub = "15.1.0"

# Substrate client
sc-client-api = "2.0.0"
sc-consensus-babe = "0.8.0"
sc-consensus-babe-rpc = "0.8.0"
sc-consensus-epochs = "0.8.0"
sc-finality-grandpa = "0.8.0"
sc-finality-grandpa-rpc = "0.8.0"
sc-keystore = "2.0.0"
sc-rpc = "2.0.0"
sc-rpc-api = "0.8.0"
sc-service = { version = "0.8.0", features = ["test-helpers"] }
sc-chain-spec = "3.0.0"
sc-client-api = "3.0.0"
sc-consensus-babe = "0.9.0"
sc-consensus-babe-rpc = "0.9.0"
sc-consensus-epochs = "0.9.0"
sc-finality-grandpa = "0.9.0"
sc-finality-grandpa-rpc = "0.9.0"
sc-keystore = "3.0.0"
sc-rpc = "3.0.0"
sc-rpc-api = "0.9.0"
sc-service = { version = "0.9.0", features = ["test-helpers"] }
sc-sync-state-rpc = { version = "0.9.0" }

# Substrate primitives
sp-api = "2.0.0"
sp-blockchain = "2.0.0"
sp-block-builder = "2.0.0"
sp-consensus = "0.8.0"
sp-consensus-babe = "0.8.0"
sp-keystore = "0.8.0"
sp-runtime = "2.0.0"
sp-state-machine = "0.8.0"
sp-transaction-pool = "2.0.0"
sp-api = "3.0.0"
sp-blockchain = "3.0.0"
sp-block-builder = "3.0.0"
sp-consensus = "0.9.0"
sp-consensus-babe = "0.9.0"
sp-keystore = "0.9.0"
sp-runtime = "3.0.0"
sp-state-machine = "0.9.0"
sp-transaction-pool = "3.0.0"

# Substrate pallets
frame-support = "2.0.0"
pallet-transaction-payment-rpc = "2.0.0"
substrate-frame-rpc-system = "2.0.0"
frame-support = "3.0.0"
pallet-transaction-payment-rpc = "3.0.0"
substrate-frame-rpc-system = "3.0.0"

# ChainX runtime
chainx-runtime = { path = "../runtime/chainx" }
Expand Down
Loading