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

Use parity polkadot docker image #787

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ jobs:

- name: Run latest node
run: |
docker run -p 9944:9944 -p 9933:9933 -p 30333:30333 paritypr/substrate:master-1680977e --dev --rpc-external &
docker run -p 9944:9944 -p 9933:9933 -p 30333:30333 parity/polkadot:latest --dev --rpc-external &

- name: Wait until node has started
run: sleep 20s
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ staking-xt = ["std", "ac-primitives/staking-xt"]
# of the functionality this feature provides.
contracts-xt = ["std", "ac-primitives/contracts-xt"]

# Provides compatibility to RFC-0078: "Merkelized Metadata" but disables the check of the metadata hash
disable-metadata-hash-check = ["ac-primitives/disable-metadata-hash-check"]

# Enables all std features of dependencies in case of std build.
std = [
# crates.io no_std
Expand Down
2 changes: 1 addition & 1 deletion examples/async/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch =
sp-weights = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }

# local deps
substrate-api-client = { path = "../..", version = "0.17", features = ["staking-xt", "contracts-xt"] }
substrate-api-client = { path = "../..", version = "0.17", features = ["staking-xt", "contracts-xt", "disable-metadata-hash-check"] }
2 changes: 1 addition & 1 deletion examples/sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch =
sp-weights = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }

# local deps
substrate-api-client = { path = "../..", version = "0.17", default-features = false, features = ["tungstenite-client", "ws-client"] }
substrate-api-client = { path = "../..", version = "0.17", default-features = false, features = ["tungstenite-client", "ws-client", "disable-metadata-hash-check"] }
1 change: 1 addition & 0 deletions primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ default = ["std"]
disable_target_static_assertions = [
"sp-runtime-interface/disable_target_static_assertions",
]
disable-metadata-hash-check = []
std = [
"codec/std",
"primitive-types/std",
Expand Down
51 changes: 40 additions & 11 deletions primitives/src/extrinsics/extrinsic_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,20 @@ pub struct GenericSignedExtra<Tip, Index> {
#[codec(compact)]
pub nonce: Index,
pub tip: Tip,
#[cfg(feature = "disable-metadata-hash-check")]
pub check_hash: u8,
}

impl<Tip, Index> GenericSignedExtra<Tip, Index> {
pub fn new(era: Era, nonce: Index, tip: Tip) -> Self {
Self { era, nonce, tip }
#[cfg(feature = "disable-metadata-hash-check")]
{
Self { era, nonce, tip, check_hash: 0 }
}
#[cfg(not(feature = "disable-metadata-hash-check"))]
{
Self { era, nonce, tip }
}
}
}

Expand All @@ -55,6 +64,9 @@ impl<Tip, Index> GenericSignedExtra<Tip, Index> {
// defines what is returned upon the `additional_signed` call. The AdditionalSigned defined here
// must mirror these return values.
// Example: https://github.com/paritytech/substrate/blob/23bb5a6255bbcd7ce2999044710428bc4a7a924f/frame/system/src/extensions/check_non_zero_sender.rs#L64-L66
#[cfg(feature = "disable-metadata-hash-check")]
pub type GenericAdditionalSigned<Hash> = ((), u32, u32, Hash, Hash, (), (), (), Option<[u8; 32]>);
#[cfg(not(feature = "disable-metadata-hash-check"))]
pub type GenericAdditionalSigned<Hash> = ((), u32, u32, Hash, Hash, (), (), ());

/// This trait allows you to configure the "signed extra" and
Expand Down Expand Up @@ -179,16 +191,33 @@ where
}

fn additional_signed(&self) -> Self::AdditionalSigned {
(
(),
self.spec_version,
self.transaction_version,
self.genesis_hash,
self.mortality_checkpoint,
(),
(),
(),
)
#[cfg(feature = "disable-metadata-hash-check")]
{
(
(),
self.spec_version,
self.transaction_version,
self.genesis_hash,
self.mortality_checkpoint,
(),
(),
(),
None,
)
}
#[cfg(not(feature = "disable-metadata-hash-check"))]
{
(
(),
self.spec_version,
self.transaction_version,
self.genesis_hash,
self.mortality_checkpoint,
(),
(),
(),
)
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions primitives/src/extrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ mod tests {
assert_eq!(call, call1);
}

// Currently does not with available version of substrate extrinsic
#[cfg(not(feature = "disable-metadata-hash-check"))]
#[test]
fn xt_hash_matches_substrate_impl() {
// Define extrinsic params.
Expand Down Expand Up @@ -384,6 +386,8 @@ mod tests {
)
}

// Currently does not work with stored bytes. Need to create a new version
#[cfg(not(feature = "disable-metadata-hash-check"))]
#[test]
fn xt_hash_matches_substrate_impl_large_xt() {
// Define xt parameters,
Expand Down
2 changes: 1 addition & 1 deletion testing/async/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk.git", bran
pallet-staking = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }

# local deps
substrate-api-client = { path = "../..", version = "0.17", features = ["staking-xt", "contracts-xt"] }
substrate-api-client = { path = "../..", version = "0.17", features = ["staking-xt", "contracts-xt", "disable-metadata-hash-check"] }
2 changes: 1 addition & 1 deletion testing/async/examples/state_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async fn main() {
.get_storage_keys_paged(Some(storage_key_prefix), max_keys, None, None)
.await
.unwrap();
assert_eq!(storage_keys.len() as u32, 13);
assert_eq!(storage_keys.len() as u32, 14);

let max_keys = 20;
let storage_keys = api
Expand Down
2 changes: 1 addition & 1 deletion testing/sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "ma
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }

# local deps
substrate-api-client = { path = "../..", version = "0.17", default-features = false, features = ["tungstenite-client", "ws-client"] }
substrate-api-client = { path = "../..", version = "0.17", default-features = false, features = ["tungstenite-client", "ws-client", "disable-metadata-hash-check"] }
ac-keystore = { path = "../../keystore" }
Loading