Skip to content

Commit

Permalink
Use Milagro-BLS and Eth-ABI from crates.io (#1124)
Browse files Browse the repository at this point in the history
Co-authored-by: ron <yrong1997@gmail.com>
  • Loading branch information
vgeddes and yrong authored Jan 24, 2024
1 parent 53a5522 commit ef3d640
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion parachain/pallets/ethereum-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ pub mod pallet {
let mut pubkeys: Vec<PublicKeyPrepared> = Vec::new();
for (bit, pubkey) in sync_committee_bits.iter().zip(sync_committee_pubkeys.iter()) {
if *bit == u8::from(participant) {
pubkeys.push(*pubkey);
pubkeys.push(pubkey.clone());
}
}
pubkeys
Expand Down
2 changes: 1 addition & 1 deletion parachain/pallets/outbound-queue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bridge-hub-common = { path = "../../../polkadot-sdk/cumulus/parachains/runtimes/

snowbridge-core = { path = "../../primitives/core", default-features = false, features = ["serde"] }
snowbridge-outbound-queue-merkle-tree = { path = "merkle-tree", default-features = false }
ethabi = { git = "https://github.com/snowfork/ethabi-decode.git", package = "ethabi-decode", branch = "master", default-features = false }
ethabi = { package = "ethabi-decode", version = "1.0.0", default-features = false }

xcm = { package = "staging-xcm", path = "../../../polkadot-sdk/polkadot/xcm", default-features = false }

Expand Down
2 changes: 1 addition & 1 deletion parachain/pallets/system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ xcm = { package = "staging-xcm", path = "../../../polkadot-sdk/polkadot/xcm", de
xcm-builder = { package = "staging-xcm-builder", path = "../../../polkadot-sdk/polkadot/xcm/xcm-builder", default-features = false }
xcm-executor = { package = "staging-xcm-executor", path = "../../../polkadot-sdk/polkadot/xcm/xcm-executor", default-features = false }

ethabi = { git = "https://github.com/Snowfork/ethabi-decode.git", package = "ethabi-decode", branch = "master", default-features = false }
ethabi = { package = "ethabi-decode", version = "1.0.0", default-features = false }
snowbridge-core = { path = "../../primitives/core", default-features = false }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions parachain/primitives/beacon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ byte-slice-cast = { version = "1.2.1", default-features = false }

snowbridge-ethereum = { path = "../ethereum", default-features = false }
static_assertions = { version = "1.1.0" }
milagro_bls = { git = "https://github.com/snowfork/milagro_bls", default-features = false, rev = "a6d66e4eb89015e352fb1c9f7b661ecdbb5b2176" }
milagro-bls = { package = "snowbridge-milagro-bls", version = "1.5.4", default-features = false }

[dev-dependencies]
hex-literal = { version = "0.4.1" }
Expand All @@ -44,7 +44,7 @@ std = [
"frame-support/std",
"frame-system/std",
"hex/std",
"milagro_bls/std",
"milagro-bls/std",
"rlp/std",
"scale-info/std",
"serde",
Expand Down
11 changes: 8 additions & 3 deletions parachain/primitives/beacon/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use frame_support::{CloneNoBound, PartialEqNoBound, RuntimeDebugNoBound};
use scale_info::TypeInfo;
use sp_core::{H160, H256, U256};
use sp_runtime::RuntimeDebug;
use sp_std::{boxed::Box, prelude::*};
use sp_std::{boxed::Box, iter::repeat, prelude::*};

use crate::config::{PUBKEY_SIZE, SIGNATURE_SIZE};

Expand Down Expand Up @@ -190,9 +190,14 @@ pub struct SyncCommitteePrepared<const COMMITTEE_SIZE: usize> {

impl<const COMMITTEE_SIZE: usize> Default for SyncCommitteePrepared<COMMITTEE_SIZE> {
fn default() -> Self {
let pubkeys: Vec<PublicKeyPrepared> =
repeat(PublicKeyPrepared::default()).take(COMMITTEE_SIZE).collect();
let pubkeys: Box<[PublicKeyPrepared; COMMITTEE_SIZE]> =
Box::new(pubkeys.try_into().map_err(|_| ()).expect("checked statically; qed"));

SyncCommitteePrepared {
root: H256::default(),
pubkeys: Box::new([PublicKeyPrepared::default(); COMMITTEE_SIZE]),
pubkeys,
aggregate_pubkey: PublicKeyPrepared::default(),
}
}
Expand All @@ -208,7 +213,7 @@ impl<const COMMITTEE_SIZE: usize> TryFrom<&SyncCommittee<COMMITTEE_SIZE>>
let sync_committee_root = sync_committee.hash_tree_root().expect("checked statically; qed");

Ok(SyncCommitteePrepared::<COMMITTEE_SIZE> {
pubkeys: g1_pubkeys.try_into().expect("checked statically; qed"),
pubkeys: g1_pubkeys.try_into().map_err(|_| ()).expect("checked statically; qed"),
aggregate_pubkey: prepare_milagro_pubkey(&sync_committee.aggregate_pubkey)?,
root: sync_committee_root,
})
Expand Down
2 changes: 1 addition & 1 deletion parachain/primitives/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sp-arithmetic = { path = "../../../polkadot-sdk/substrate/primitives/arithmetic"

snowbridge-beacon-primitives = { path = "../beacon", default-features = false }

ethabi = { git = "https://github.com/Snowfork/ethabi-decode.git", package = "ethabi-decode", branch = "master", default-features = false }
ethabi = { package = "ethabi-decode", version = "1.0.0", default-features = false }

[dev-dependencies]
hex = { version = "0.4.3" }
Expand Down
2 changes: 1 addition & 1 deletion parachain/primitives/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sp-std = { path = "../../../polkadot-sdk/substrate/primitives/std", default-feat
sp-core = { path = "../../../polkadot-sdk/substrate/primitives/core", default-features = false }
sp-runtime = { path = "../../../polkadot-sdk/substrate/primitives/runtime", default-features = false }

ethabi = { git = "https://github.com/snowfork/ethabi-decode.git", package = "ethabi-decode", branch = "master", default-features = false }
ethabi = { package = "ethabi-decode", version = "1.0.0", default-features = false }

[dev-dependencies]
wasm-bindgen-test = "0.3.19"
Expand Down
2 changes: 1 addition & 1 deletion parachain/primitives/router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ xcm-executor = { package = "staging-xcm-executor", path = "../../../polkadot-sdk

snowbridge-core = { path = "../core", default-features = false }

ethabi = { git = "https://github.com/Snowfork/ethabi-decode.git", package = "ethabi-decode", branch = "master", default-features = false }
ethabi = { package = "ethabi-decode", version = "1.0.0", default-features = false }

hex-literal = { version = "0.4.1" }

Expand Down
2 changes: 1 addition & 1 deletion polkadot-sdk
Submodule polkadot-sdk updated 1 files
+28 −25 Cargo.lock

0 comments on commit ef3d640

Please sign in to comment.