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

feat: upgrade to polkadot 0.9.24 #341

Merged
merged 35 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
49a05f7
wip migrate to 0.9.2 polkadot
DylanVerstraete Apr 22, 2022
cf47614
fix node / runtime
DylanVerstraete Apr 22, 2022
6b34c39
try add migration
DylanVerstraete Apr 25, 2022
06d6c64
init
DylanVerstraete Apr 25, 2022
4fed1de
feat: add proper migrations
DylanVerstraete Apr 25, 2022
5d15ad4
wip
DylanVerstraete Jun 15, 2022
e483f86
more wip
DylanVerstraete Jun 15, 2022
84674ff
more wip
DylanVerstraete Jun 16, 2022
86d08ea
finally compiled
DylanVerstraete Jun 16, 2022
7ba8c1c
chore: wip fix smart contract module test suite
DylanVerstraete Jun 17, 2022
996f740
fix smart contract module test suite
DylanVerstraete Jun 20, 2022
d828574
merge development
DylanVerstraete Jun 20, 2022
2ea0c36
more test suites fixes
DylanVerstraete Jun 20, 2022
8d0077d
fix dao test suite
DylanVerstraete Jun 20, 2022
d0cfa87
wip remove reference counter migrations
DylanVerstraete Jun 22, 2022
366baec
first wip
DylanVerstraete Jun 22, 2022
13198c2
fix some tests
DylanVerstraete Jun 22, 2022
a2871e6
chore: fix pallet tfgrid tests
DylanVerstraete Jun 23, 2022
58b2e64
wip more pallet fixes
DylanVerstraete Jun 23, 2022
13f25aa
fix pallet smart contract
DylanVerstraete Jun 23, 2022
ddbc8df
fix pallet smart contract tests
DylanVerstraete Jun 23, 2022
9a08831
make it compile
DylanVerstraete Jun 23, 2022
f61b966
chore: reinstate migration to tripple ref count
DylanVerstraete Jun 23, 2022
c1fc628
fix runtime upgrade
DylanVerstraete Jun 23, 2022
a8f884d
Merge branch 'development' into upgrade_to_polkadot_0_9_24
DylanVerstraete Jun 23, 2022
5d6e414
chore: run fmt
DylanVerstraete Jun 23, 2022
bae96df
chore: fix warnings
DylanVerstraete Jun 24, 2022
14af248
chore: properly parse tft price
DylanVerstraete Jun 27, 2022
cce8a24
chore: merge development
DylanVerstraete Jun 28, 2022
d847653
fix devnet chainspecs
DylanVerstraete Jun 28, 2022
26a4084
fix dockerfile
DylanVerstraete Jun 28, 2022
fb4dda4
fix ca certificate in dockerfile
DylanVerstraete Jun 28, 2022
22b6b7e
fix: reinstate weight to fee
DylanVerstraete Jun 29, 2022
92f121d
chore: run fmt on pallet tfgrid
DylanVerstraete Jun 29, 2022
3bc687c
remove unused file
DylanVerstraete Jun 29, 2022
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
6,599 changes: 3,109 additions & 3,490 deletions substrate-node/Cargo.lock

Large diffs are not rendered by default.

7,781 changes: 7,781 additions & 0 deletions substrate-node/Cargo.lock.bak

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion substrate-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ panic = 'unwind'
members = [
'node',
'runtime',
'pallets/*',
'pallets/*',
'support'
]
16 changes: 8 additions & 8 deletions substrate-node/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM paritytech/ci-linux:c4f0daf3-20220110 as builder
FROM paritytech/ci-linux@sha256:c75cee0971ca54e57a875fac8714eea2db754e621841cde702478783fc28ab90 as builder

WORKDIR /tfchain

Expand All @@ -10,26 +10,26 @@ RUN cargo build --locked --release --features $FEATURES

# ===== SECOND STAGE ======

FROM phusion/baseimage:0.11
FROM docker.io/library/ubuntu:20.04
LABEL maintainer="[email protected]"
LABEL description="This is the 2nd stage: a very small image where we copy the tfchain binary."
ARG PROFILE=release

RUN rm -rf /usr/share/* && \
mkdir -p /tfchain/.local

COPY --from=builder /tfchain/target/$PROFILE/tfchain /usr/local/bin
COPY --from=builder /tfchain/chainspecs /etc/chainspecs/


# checks
RUN ldd /usr/local/bin/tfchain && \
/usr/local/bin/tfchain --version

# Install CA certificates not present in base image
RUN apt-get update
RUN apt-get install -y ca-certificates

# Shrinking
RUN rm -rf /usr/lib/python* && \
rm -rf /usr/bin /usr/sbin /usr/share/man && \
rm -rf /src
rm -rf /src && \
rm -rf /usr/bin /usr/sbin /usr/share/man

EXPOSE 30333 9933 9944 9615
VOLUME ["/tfchain"]
Expand Down
1 change: 0 additions & 1 deletion substrate-node/chainspecs/dev/chainSpec.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"tokenSymbol": "TFT"
},
"consensusEngine": null,
"lightSyncState": null,
"genesis": {
"runtime": {
"frameSystem": {
Expand Down
1 change: 0 additions & 1 deletion substrate-node/chainspecs/dev/chainSpecRaw.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"tokenSymbol": "TFT"
},
"consensusEngine": null,
"lightSyncState": null,
"genesis": {
"raw": {
"top": {
Expand Down
80 changes: 46 additions & 34 deletions substrate-node/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,56 @@ name = 'tfchain'
targets = ['x86_64-unknown-linux-gnu']

[build-dependencies]
substrate-build-script-utils = '3.0.0'
substrate-build-script-utils = {package = "substrate-build-script-utils", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
vergen = "3.1.0"

[dependencies]
jsonrpc-core = '15.1.0'
structopt = '0.3.8'
serde_json = "1.0.59"
futures = "0.3"
hex-literal = "0.2.1"
jsonrpc-core = "18.0.0"
log = "0.4"
structopt = "0.3.8"
serde = { version = "1.0.119", features = ["derive"] }
serde_json = "1.0.64"
jsonrpsee = { version = "0.13.0", features = ["server"] }
clap = { version = "3.1.18", features = ["derive"] }

# local dependencies
tfchain-runtime = { path = '../runtime', version = '3.0.0' }
frame-benchmarking = {git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24"}
frame-system = {git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24"}
frame-benchmarking-cli = {git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24"}
pallet-transaction-payment-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
pallet-transaction-payment = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-basic-authorship = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-client-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-executor = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-service = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-consensus-aura = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-finality-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-finality-grandpa-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sp-keyring = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-network = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-rpc-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-telemetry = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sc-transaction-pool-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sp-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sp-block-builder = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sp-blockchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sp-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sp-consensus-aura = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sp-core = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sp-finality-grandpa = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sp-inherents = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sp-runtime = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sp-timestamp = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
sp-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}
frame-rpc-system = {package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}

# Substrate dependencies
frame-benchmarking = '3.0.0'
frame-benchmarking-cli = '3.0.0'
pallet-transaction-payment-rpc = '3.0.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-aura = '0.9.0'
sc-finality-grandpa-rpc = '0.9.0'
sc-executor = { features = ['wasmtime'], version = '0.9.0' }
sc-finality-grandpa = '0.9.0'
sc-keystore = '3.0.0'
sc-rpc = '3.0.0'
sc-rpc-api = '0.9.0'
sc-service = { features = ['wasmtime'], version = '0.9.0' }
sc-transaction-pool = '3.0.0'
sp-api = '3.0.0'
sp-block-builder = '3.0.0'
sp-blockchain = '3.0.0'
sp-consensus = '0.9.0'
sp-consensus-aura = '0.9.0'
sp-core = '3.0.0'
sp-finality-grandpa = '3.0.0'
sp-inherents = '3.0.0'
sp-runtime = '3.0.0'
sp-transaction-pool = '3.0.0'
substrate-frame-rpc-system = '3.0.0'
tfchain-runtime = { path = '../runtime' }

[features]
default = []
Expand Down
73 changes: 38 additions & 35 deletions substrate-node/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ fn session_keys(aura: AuraId, grandpa: GrandpaId) -> SessionKeys {
SessionKeys { aura, grandpa }
}

pub fn authority_keys_from_seed(seed: &str) -> (AccountId, AuraId, GrandpaId) {
pub fn authority_keys_from_seed(s: &str) -> (AccountId, AuraId, GrandpaId) {
(
get_account_id_from_seed::<sr25519::Public>(seed),
get_from_seed::<AuraId>(seed),
get_from_seed::<GrandpaId>(seed),
get_account_id_from_seed::<sr25519::Public>(s),
get_from_seed::<AuraId>(s),
get_from_seed::<GrandpaId>(s),
)
}

Expand Down Expand Up @@ -125,6 +125,7 @@ pub fn development_config() -> Result<ChainSpec, String> {
None,
// Protocol ID
None,
None,
// Properties
properties,
// Extensions
Expand Down Expand Up @@ -204,6 +205,7 @@ pub fn local_testnet_config() -> Result<ChainSpec, String> {
},
// Bootnodes
vec![],
None,
// Telemetry
None,
// Protocol ID
Expand All @@ -229,26 +231,26 @@ fn testnet_genesis(
tft_price_allowed_account: AccountId,
) -> GenesisConfig {
GenesisConfig {
frame_system: Some(SystemConfig {
system: SystemConfig {
// Add Wasm runtime to storage.
code: wasm_binary.to_vec(),
changes_trie_config: Default::default(),
}),
pallet_balances: Some(BalancesConfig {
// changes_trie_config: Default::default(),
},
balances: BalancesConfig {
// Configure endowed accounts with initial balance of 1 << 60.
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, 1 << 60))
.collect(),
}),
validatorset: Some(ValidatorSetConfig {
validators: initial_authorities
},
validator_set: ValidatorSetConfig {
initial_validators: initial_authorities
.iter()
.map(|x| x.0.clone())
.collect::<Vec<_>>(),
}),
pallet_session: Some(SessionConfig {
},
session: SessionConfig {
keys: initial_authorities
.iter()
.map(|x| {
Expand All @@ -259,18 +261,18 @@ fn testnet_genesis(
)
})
.collect::<Vec<_>>(),
}),
pallet_aura: Some(AuraConfig {
},
aura: AuraConfig {
authorities: vec![],
}),
pallet_grandpa: Some(GrandpaConfig {
},
grandpa: GrandpaConfig {
authorities: vec![],
}),
pallet_sudo: Some(SudoConfig {
},
sudo: SudoConfig {
// Assign network admin rights.
key: root_key,
}),
pallet_tfgrid: Some(TfgridModuleConfig {
key: Some(root_key),
},
tfgrid_module: TfgridModuleConfig {
su_price_value: 300000,
su_price_unit: 4,
nu_price_value: 2000,
Expand All @@ -281,8 +283,9 @@ fn testnet_genesis(
ipu_price_unit: 4,
unique_name_price_value: 20000,
domain_name_price_value: 40000,
foundation_account,
sales_account,
domain_name_price_unit: 4,
foundation_account: Some(foundation_account),
sales_account: Some(sales_account),
farming_policy_diy_cu: 160000000,
farming_policy_diy_su: 100000000,
farming_policy_diy_nu: 2000000,
Expand All @@ -295,25 +298,25 @@ fn testnet_genesis(
farming_policy_certified_minimal_uptime: 95,
discount_for_dedication_nodes: 50,
connection_price: 80,
}),
pallet_tft_bridge: Some(TFTBridgeModuleConfig {
validator_accounts: bridge_validator_accounts,
fee_account: bridge_fee_account,
},
tft_bridge_module: TFTBridgeModuleConfig {
validator_accounts: Some(bridge_validator_accounts),
fee_account: Some(bridge_fee_account),
deposit_fee: 10000000,
withdraw_fee: 10000000,
}),
pallet_collective_Instance1: Some(CouncilConfig::default()),
pallet_membership_Instance1: Some(CouncilMembershipConfig {
},
council: CouncilConfig::default(),
council_membership: CouncilMembershipConfig {
members: vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
],
phantom: Default::default(),
}),
},
// just some default for development
pallet_tft_price: Some(TFTPriceModuleConfig {
allowed_origin: tft_price_allowed_account,
}),
tft_price_module: TFTPriceModuleConfig {
allowed_origin: Some(tft_price_allowed_account),
},
}
}
28 changes: 20 additions & 8 deletions substrate-node/node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
use structopt::StructOpt;
use sc_cli::RunCmd;

#[derive(Debug, StructOpt)]
#[derive(Debug, clap::Parser)]
pub struct Cli {
#[structopt(subcommand)]
#[clap(subcommand)]
pub subcommand: Option<Subcommand>,

#[structopt(flatten)]
#[clap(flatten)]
pub run: RunCmd,
}

#[derive(Debug, StructOpt)]
#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
/// Key management cli utilities
#[clap(subcommand)]
Key(sc_cli::KeySubcommand),

/// Build a chain specification.
BuildSpec(sc_cli::BuildSpecCmd),

Expand All @@ -35,7 +36,18 @@ pub enum Subcommand {
/// Revert the chain to a previous state.
Revert(sc_cli::RevertCmd),

/// The custom benchmark subcommmand benchmarking runtime pallets.
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
/// Sub-commands concerned with benchmarking.
#[clap(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
}

/// Try some command against runtime state.
#[cfg(feature = "try-runtime")]
TryRuntime(try_runtime_cli::TryRuntimeCmd),

/// Try some command against runtime state. Note: `try-runtime` feature must be enabled.
#[cfg(not(feature = "try-runtime"))]
TryRuntime,

/// Db meta columns information.
ChainInfo(sc_cli::ChainInfoCmd),
}
Loading