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

Polkadotsdk 1.1.0 #78

Draft
wants to merge 42 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4e2ba74
update packages
N1ghtStorm Nov 30, 2023
31b4ea2
change versions, comment beefy deps
N1ghtStorm Nov 30, 2023
73cbb67
fix cargo issue
N1ghtStorm Dec 1, 2023
d807b9e
fix build err with orml traits
N1ghtStorm Dec 5, 2023
d92ca88
fixed types
N1ghtStorm Dec 5, 2023
a8a9b9b
fix channels build
N1ghtStorm Dec 6, 2023
a54ccec
all pallets except beefy light client
N1ghtStorm Dec 6, 2023
b0e3ef5
fix beefy light client
N1ghtStorm Dec 6, 2023
47bc7e1
fix some tests
N1ghtStorm Jan 18, 2024
1f95b5a
fix tests
N1ghtStorm Jan 19, 2024
8a2e05e
refactor
N1ghtStorm Jan 19, 2024
f16355f
fix benchmarks
N1ghtStorm Jan 19, 2024
b982ce9
fixed rpc
N1ghtStorm Jan 19, 2024
d0bd98e
sanitize
N1ghtStorm Jan 19, 2024
da6eb0d
Merge pull request #70 from sora-xor/polkadotsdk_1.2.0
N1ghtStorm Jan 19, 2024
9385cea
remove comments
N1ghtStorm Jan 19, 2024
2ae4b49
refactor
N1ghtStorm Jan 19, 2024
5de8e3e
merge develop and update substrate app + liberland bridge provider
N1ghtStorm Mar 28, 2024
def9e72
fix benchmarks build
N1ghtStorm Mar 28, 2024
b3f6f36
refactor
N1ghtStorm Mar 28, 2024
14f582a
fmt
N1ghtStorm Mar 28, 2024
2ba1495
clippy fixes
N1ghtStorm Mar 28, 2024
d637d8d
update
N1ghtStorm Apr 15, 2024
ae0755a
change Cargo.lock
N1ghtStorm Apr 22, 2024
424172e
remove genesis build from beefy light client
N1ghtStorm May 18, 2024
8747f89
merge conflict resolved
N1ghtStorm May 18, 2024
b36a6f8
update evm f-app to 1.1.0
N1ghtStorm May 19, 2024
46d0e19
multisig
N1ghtStorm May 19, 2024
bb28501
fix build problems
N1ghtStorm Jun 13, 2024
5af21c3
fix: replace links to our fork
i3ima Aug 1, 2024
c00a60a
Merge branch 'develop' into polkadotsdk_1.1.0
i3ima Aug 1, 2024
7165f41
refactor: upgrade workspace ater merge
i3ima Aug 5, 2024
4b64603
refactor: cleanup patch section
i3ima Aug 5, 2024
ff6f162
refactor: cleanup warnings
i3ima Aug 5, 2024
3dba9a4
fix(liberland): add pallet-balances of liberland-bridge-provider to s…
i3ima Aug 5, 2024
26d9911
style: apply cargo fmt
i3ima Aug 5, 2024
8597de4
fix(types)!: remove cfg! off derives for TON structs
i3ima Aug 5, 2024
a0c06b2
Revert "fix(types)!: remove cfg! off derives for TON structs"
i3ima Aug 5, 2024
3542b69
fix(jetton & types): remove cfg_attr from serde usage
i3ima Aug 6, 2024
6ff1035
build: bump nightly compiler version to the same as in sora2-network
i3ima Aug 6, 2024
100f2d8
style(types): fix cargo.toml
i3ima Aug 20, 2024
8119cf1
Merge branch 'develop' of github.com:sora-xor/sora2-common into polka…
wer1st Oct 14, 2024
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,428 changes: 1,660 additions & 768 deletions Cargo.lock

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,55 @@ members = [
]

resolver = "2"

[patch."https://github.com/paritytech/polkadot-sdk.git"]
frame-benchmarking = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
frame-support = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
frame-system = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
pallet-authorship = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
pallet-balances = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
pallet-session = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
pallet-timestamp = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# sc-finality-grandpa = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-api = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-application-crypto = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-arithmetic = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-blockchain = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-consensus = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-core = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-database = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# sp-finality-grandpa = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-inherents = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-io = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-keystore = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-runtime = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-runtime-interface = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-session = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-staking = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-std = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-storage = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-timestamp = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-trie = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-version = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-keyring = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-state-machine = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-externalities = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
sp-mmr-primitives = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# mmr-rpc = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# pallet-mmr = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
pallet-beefy = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
staging-xcm = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# frame-benchmarking-cli = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# sc-consensus = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# sc-finality-grandpa = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# sp-consensus = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# sp-finality-grandpa = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# mmr-rpc = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# pallet-mmr = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# pallet-beefy-mmr = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# beefy-gadget = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# beefy-gadget-rpc = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
# beefy-merkle-tree = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
pallet-beefy-mmr = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }
pallet-mmr = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }

35 changes: 19 additions & 16 deletions pallets/beefy-light-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,45 @@ serde = { version = "1.0", features = [
], default-features = false }
rand = { version = "0.8.5", optional = true }
mmr-lib = { package = "ckb-merkle-mountain-range", version = "0.5.2", default-features = false, optional = true }
log = { version = "0.4.14", optional = true }
log = { version = "0.4.20" }
anyhow = { version = "1.0", optional = true }

# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false, optional = true }
frame-support = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
sp-beefy = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
beefy-merkle-tree = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", optional= true }
frame-benchmarking = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false, optional = true }
frame-support = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
frame-system = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
sp-io = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
sp-std = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
sp-core = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
sp-runtime = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
pallet-beefy-mmr = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", optional= true }
sp-consensus-beefy = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
binary-merkle-tree = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }

[dev-dependencies]
# Substrate
beefy-merkle-tree = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38" }
pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38" }
pallet-beefy-mmr = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0" }

serde_json = "1.0.73"
hex-literal = "0.4.1"
test-case = "3.1.0"
mmr-lib = { package = "ckb-merkle-mountain-range", version = "0.5.2", default-features = false }
rand = "0.8.5"
anyhow = "1.0"
log = "0.4.14"
# log = "0.4.20"

[features]
default = ["std"]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"bridge-types/runtime-benchmarks",
"mmr-lib",
"log",
# "log",
"anyhow",
]
std = ["codec/std", "serde/std", "bridge-common/std", "bridge-types/std", "beefy-merkle-tree/std", "sp-beefy/std", "sp-core/std", "sp-io/std", "sp-std/std", "scale-info/std", "frame-benchmarking/std", "frame-support/std", "frame-system/std"]
std = ["codec/std", "serde/std", "bridge-common/std", "bridge-types/std",
"binary-merkle-tree/std",
"sp-consensus-beefy/std",
"log/std",
"sp-core/std", "sp-io/std", "sp-std/std", "scale-info/std", "frame-benchmarking/std", "frame-support/std", "frame-system/std"]
try-runtime = ["frame-support/try-runtime"]
10 changes: 5 additions & 5 deletions pallets/beefy-light-client/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ repository = 'https://github.com/sora-xor/sora2-common'
serde = { version = "1.0.101", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3" }
jsonrpsee = { version = "0.16.2", features = ["server", "macros"] }
sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
sp-api = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
sp-blockchain = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
sp-runtime = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
sp-api = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
sp-blockchain = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
sp-std = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
sp-core = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
beefy-light-client-runtime-api = { path = "../runtime-api" }
7 changes: 3 additions & 4 deletions pallets/beefy-light-client/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ use jsonrpsee::{
};
use sp_api::ProvideRuntimeApi;
use sp_blockchain::HeaderBackend;
use sp_runtime::generic::BlockId;
use sp_runtime::traits::Block as BlockT;
use std::sync::Arc;

Expand Down Expand Up @@ -87,11 +86,11 @@ where
at: Option<<B as BlockT>::Hash>,
) -> Result<Bitfield> {
let api = self.client.runtime_api();
let at = BlockId::hash(at.unwrap_or(
let at = at.unwrap_or(
// If the block hash is not supplied assume the best block.
self.client.info().best_hash,
));
api.get_random_bitfield(&at, network_id, prior, num_of_validators)
);
api.get_random_bitfield(at, network_id, prior, num_of_validators)
.map_err(|e| RpcError::Call(CallError::Failed(e.into())))
}
}
6 changes: 3 additions & 3 deletions pallets/beefy-light-client/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ codec = { package = "parity-scale-codec", version = "3", default-features = fals
] }
scale-info = { version = "2", default-features = false, features = ["derive"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] }
sp-api = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
sp-api = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
sp-runtime = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
sp-std = { git = "https://github.com/sora-xor/polkadot-sdk.git", branch = "polkadot-v1.1.0", default-features = false }
bridge-types = { path = "../../types", default-features = false }


Expand Down
34 changes: 19 additions & 15 deletions pallets/beefy-light-client/src/fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ impl ValidatorSet {
fn sign_commitment<R: Rng>(
&self,
rng: &mut R,
commitment: sp_beefy::Commitment<u32>,
commitment: sp_consensus_beefy::Commitment<u32>,
count: Option<usize>,
) -> sp_beefy::SignedCommitment<u32, sp_core::ecdsa::Signature> {
) -> sp_consensus_beefy::SignedCommitment<u32, sp_core::ecdsa::Signature> {
let commitment_hash = sp_runtime::traits::Keccak256::hash_of(&commitment);
let validators_threshold = threshold(self.validators.len());
let signed_count = count.unwrap_or_else(|| {
Expand All @@ -100,14 +100,14 @@ impl ValidatorSet {
signatures[i] = Some(signature);
}

sp_beefy::SignedCommitment {
sp_consensus_beefy::SignedCommitment {
commitment,
signatures,
}
}

pub fn validator_pubkey_proof(&self, pos: usize) -> Vec<H256> {
let proof = beefy_merkle_tree::merkle_proof::<sp_runtime::traits::Keccak256, _, _>(
let proof = binary_merkle_tree::merkle_proof::<sp_runtime::traits::Keccak256, _, _>(
self.addresses.clone(),
pos,
)
Expand All @@ -131,20 +131,24 @@ impl ValidatorSet {
}

pub fn root(&self) -> H256 {
beefy_merkle_tree::merkle_root::<sp_runtime::traits::Keccak256, _>(self.addresses.clone())
binary_merkle_tree::merkle_root::<sp_runtime::traits::Keccak256, _>(self.addresses.clone())
}

fn authority_set(&self) -> sp_beefy::mmr::BeefyAuthoritySet<H256> {
sp_beefy::mmr::BeefyAuthoritySet {
fn authority_set(&self) -> sp_consensus_beefy::mmr::BeefyAuthoritySet<H256> {
sp_consensus_beefy::mmr::BeefyAuthoritySet {
id: self.id,
len: self.validators.len() as u32,
root: self.root(),
keyset_commitment: self.root(),
}
}
}

pub type MMRLeaf =
sp_beefy::mmr::MmrLeaf<u32, H256, H256, bridge_types::types::LeafExtraData<H256, H256>>;
pub type MMRLeaf = sp_consensus_beefy::mmr::MmrLeaf<
u32,
H256,
H256,
bridge_types::types::LeafExtraData<H256, H256>,
>;

struct FakeMMR {
// leaves: BTreeMap<u64, MMRLeaf>,
Expand Down Expand Up @@ -270,7 +274,7 @@ impl From<FixtureValidatorSet> for bridge_common::beefy_types::ValidatorSet {
bridge_common::beefy_types::ValidatorSet {
id: f.id,
len: f.len,
root: f.root,
keyset_commitment: f.root,
}
}
}
Expand All @@ -294,7 +298,7 @@ pub fn generate_fixture(validators: usize, tree_size: u32) -> AnyResult<Fixture>
let mut mmr = FakeMMR::new();
for i in 0..tree_size + 1 {
mmr.add_leaf(MMRLeaf {
version: sp_beefy::mmr::MmrLeafVersion::new(0, 0),
version: sp_consensus_beefy::mmr::MmrLeafVersion::new(0, 0),
parent_number_and_hash: (i, H256::random_using(&mut rng)),
beefy_next_authority_set: next_validator_set.authority_set(),
leaf_extra: bridge_types::types::LeafExtraData {
Expand All @@ -305,9 +309,9 @@ pub fn generate_fixture(validators: usize, tree_size: u32) -> AnyResult<Fixture>
}
let mmr_root = mmr.root(tree_size as u64)?;

let commitment = sp_beefy::Commitment::<u32> {
payload: sp_beefy::Payload::from_single_entry(
sp_beefy::known_payloads::MMR_ROOT_ID,
let commitment = sp_consensus_beefy::Commitment::<u32> {
payload: sp_consensus_beefy::Payload::from_single_entry(
sp_consensus_beefy::known_payloads::MMR_ROOT_ID,
mmr_root.encode(),
),
block_number: tree_size,
Expand Down
Loading
Loading