mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 13:21:10 +00:00
Use array-bytes for All Array/Bytes/Hex Operations (#12190)
* Use `array-bytes` for All Array/Bytes/Hex Operations Signed-off-by: Xavier Lau <xavier@inv.cafe> * Reorder * Self Review * Format * Fix Tests * Bump `array-bytes` * Optimize large test res Signed-off-by: Xavier Lau <xavier@inv.cafe> Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -13,7 +13,7 @@ readme = "README.md"
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
hex = { version = "0.4", default-features = false, features = ["alloc"], optional = true }
|
||||
array-bytes = { version = "4.1", optional = true }
|
||||
sha2 = { version = "0.10.1", default-features = false, optional = true }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
|
||||
@@ -33,7 +33,7 @@ pallet-identity = { version = "4.0.0-dev", path = "../identity", default-feature
|
||||
pallet-collective = { version = "4.0.0-dev", path = "../collective", default-features = false, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.1"
|
||||
array-bytes = "4.1"
|
||||
sha2 = "0.10.1"
|
||||
pallet-balances = { version = "4.0.0-dev", path = "../balances" }
|
||||
pallet-collective = { version = "4.0.0-dev", path = "../collective" }
|
||||
@@ -55,7 +55,7 @@ std = [
|
||||
"pallet-identity/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"hex",
|
||||
"array-bytes",
|
||||
"sha2",
|
||||
"frame-benchmarking/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
|
||||
@@ -9,8 +9,8 @@ repository = "https://github.com/paritytech/substrate"
|
||||
homepage = "https://substrate.io"
|
||||
|
||||
[dependencies]
|
||||
array-bytes = { version = "4.1", optional = true }
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
hex = { version = "0.4", optional = true }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.136", optional = true }
|
||||
@@ -27,18 +27,18 @@ sp-runtime = { version = "6.0.0", default-features = false, path = "../../primit
|
||||
sp-std = { version = "4.0.0", default-features = false, path = "../../primitives/std" }
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3"
|
||||
array-bytes = "4.1"
|
||||
sp-staking = { version = "4.0.0-dev", path = "../../primitives/staking" }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"array-bytes",
|
||||
"beefy-merkle-tree/std",
|
||||
"beefy-primitives/std",
|
||||
"codec/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"hex",
|
||||
"log/std",
|
||||
"pallet-beefy/std",
|
||||
"pallet-mmr/std",
|
||||
|
||||
@@ -9,7 +9,7 @@ description = "A no-std/Substrate compatible library to construct binary merkle
|
||||
homepage = "https://substrate.io"
|
||||
|
||||
[dependencies]
|
||||
hex = { version = "0.4", default-features = false, optional = true }
|
||||
array-bytes = { version = "4.1", optional = true }
|
||||
log = { version = "0.4", default-features = false, optional = true }
|
||||
tiny-keccak = { version = "2.0.2", features = ["keccak"], optional = true }
|
||||
|
||||
@@ -17,12 +17,11 @@ beefy-primitives = { version = "4.0.0-dev", default-features = false, path = "..
|
||||
sp-api = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/api" }
|
||||
|
||||
[dev-dependencies]
|
||||
array-bytes = "4.1"
|
||||
env_logger = "0.9"
|
||||
hex = "0.4"
|
||||
hex-literal = "0.3"
|
||||
|
||||
[features]
|
||||
debug = ["hex", "hex/std", "log"]
|
||||
debug = ["array-bytes", "log"]
|
||||
default = ["debug", "keccak", "std"]
|
||||
keccak = ["tiny-keccak"]
|
||||
std = [
|
||||
|
||||
@@ -235,7 +235,11 @@ where
|
||||
#[cfg(feature = "debug")]
|
||||
log::debug!(
|
||||
"[merkle_proof] Proof: {:?}",
|
||||
collect_proof.proof.iter().map(hex::encode).collect::<Vec<_>>()
|
||||
collect_proof
|
||||
.proof
|
||||
.iter()
|
||||
.map(|s| array_bytes::bytes2hex("", s))
|
||||
.collect::<Vec<_>>()
|
||||
);
|
||||
|
||||
MerkleProof { root, proof: collect_proof.proof, number_of_leaves, leaf_index, leaf }
|
||||
@@ -308,10 +312,10 @@ where
|
||||
#[cfg(feature = "debug")]
|
||||
log::debug!(
|
||||
"[verify_proof]: (a, b) {:?}, {:?} => {:?} ({:?}) hash",
|
||||
hex::encode(a),
|
||||
hex::encode(b),
|
||||
hex::encode(hash),
|
||||
hex::encode(combined)
|
||||
array_bytes::bytes2hex("", &a),
|
||||
array_bytes::bytes2hex("", &b),
|
||||
array_bytes::bytes2hex("", &hash),
|
||||
array_bytes::bytes2hex("", &combined)
|
||||
);
|
||||
position /= 2;
|
||||
width = ((width - 1) / 2) + 1;
|
||||
@@ -348,7 +352,11 @@ where
|
||||
visitor.visit(index, &a, &b);
|
||||
|
||||
#[cfg(feature = "debug")]
|
||||
log::debug!(" {:?}\n {:?}", a.as_ref().map(hex::encode), b.as_ref().map(hex::encode));
|
||||
log::debug!(
|
||||
" {:?}\n {:?}",
|
||||
a.as_ref().map(|s| array_bytes::bytes2hex("", s)),
|
||||
b.as_ref().map(|s| array_bytes::bytes2hex("", s))
|
||||
);
|
||||
|
||||
index += 2;
|
||||
match (a, b) {
|
||||
@@ -369,7 +377,7 @@ where
|
||||
#[cfg(feature = "debug")]
|
||||
log::debug!(
|
||||
"[merkelize_row] Next: {:?}",
|
||||
next.iter().map(hex::encode).collect::<Vec<_>>()
|
||||
next.iter().map(|s| array_bytes::bytes2hex("", s)).collect::<Vec<_>>()
|
||||
);
|
||||
return Err(next)
|
||||
},
|
||||
@@ -395,7 +403,6 @@ sp_api::decl_runtime_apis! {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use hex_literal::hex;
|
||||
|
||||
#[test]
|
||||
fn should_generate_empty_root() {
|
||||
@@ -408,7 +415,7 @@ mod tests {
|
||||
|
||||
// then
|
||||
assert_eq!(
|
||||
hex::encode(&out),
|
||||
array_bytes::bytes2hex("", &out),
|
||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
);
|
||||
}
|
||||
@@ -417,14 +424,16 @@ mod tests {
|
||||
fn should_generate_single_root() {
|
||||
// given
|
||||
let _ = env_logger::try_init();
|
||||
let data = vec![hex!("E04CC55ebEE1cBCE552f250e85c57B70B2E2625b")];
|
||||
let data = vec![array_bytes::hex2array_unchecked::<20>(
|
||||
"E04CC55ebEE1cBCE552f250e85c57B70B2E2625b",
|
||||
)];
|
||||
|
||||
// when
|
||||
let out = merkle_root::<Keccak256, _, _>(data);
|
||||
|
||||
// then
|
||||
assert_eq!(
|
||||
hex::encode(&out),
|
||||
array_bytes::bytes2hex("", &out),
|
||||
"aeb47a269393297f4b0a3c9c9cfd00c7a4195255274cf39d83dabc2fcc9ff3d7"
|
||||
);
|
||||
}
|
||||
@@ -434,8 +443,8 @@ mod tests {
|
||||
// given
|
||||
let _ = env_logger::try_init();
|
||||
let data = vec![
|
||||
hex!("E04CC55ebEE1cBCE552f250e85c57B70B2E2625b"),
|
||||
hex!("25451A4de12dcCc2D166922fA938E900fCc4ED24"),
|
||||
array_bytes::hex2array_unchecked::<20>("E04CC55ebEE1cBCE552f250e85c57B70B2E2625b"),
|
||||
array_bytes::hex2array_unchecked::<20>("25451A4de12dcCc2D166922fA938E900fCc4ED24"),
|
||||
];
|
||||
|
||||
// when
|
||||
@@ -443,7 +452,7 @@ mod tests {
|
||||
|
||||
// then
|
||||
assert_eq!(
|
||||
hex::encode(&out),
|
||||
array_bytes::bytes2hex("", &out),
|
||||
"697ea2a8fe5b03468548a7a413424a6292ab44a82a6f5cc594c3fa7dda7ce402"
|
||||
);
|
||||
}
|
||||
@@ -452,7 +461,7 @@ mod tests {
|
||||
fn should_generate_root_complex() {
|
||||
let _ = env_logger::try_init();
|
||||
let test = |root, data| {
|
||||
assert_eq!(hex::encode(&merkle_root::<Keccak256, _, _>(data)), root);
|
||||
assert_eq!(array_bytes::bytes2hex("", &merkle_root::<Keccak256, _, _>(data)), root);
|
||||
};
|
||||
|
||||
test(
|
||||
@@ -511,11 +520,19 @@ mod tests {
|
||||
));
|
||||
|
||||
// then
|
||||
assert_eq!(hex::encode(proof0.root), hex::encode(proof1.root));
|
||||
assert_eq!(hex::encode(proof2.root), hex::encode(proof1.root));
|
||||
assert_eq!(
|
||||
array_bytes::bytes2hex("", &proof0.root),
|
||||
array_bytes::bytes2hex("", &proof1.root)
|
||||
);
|
||||
assert_eq!(
|
||||
array_bytes::bytes2hex("", &proof2.root),
|
||||
array_bytes::bytes2hex("", &proof1.root)
|
||||
);
|
||||
|
||||
assert!(!verify_proof::<Keccak256, _, _>(
|
||||
&hex!("fb3b3be94be9e983ba5e094c9c51a7d96a4fa2e5d8e891df00ca89ba05bb1239"),
|
||||
&array_bytes::hex2array_unchecked(
|
||||
"fb3b3be94be9e983ba5e094c9c51a7d96a4fa2e5d8e891df00ca89ba05bb1239"
|
||||
),
|
||||
proof0.proof,
|
||||
data.len(),
|
||||
proof0.leaf_index,
|
||||
@@ -779,17 +796,19 @@ mod tests {
|
||||
"0xA4cDc98593CE52d01Fe5Ca47CB3dA5320e0D7592",
|
||||
"0xc26B34D375533fFc4c5276282Fa5D660F3d8cbcB",
|
||||
];
|
||||
let root = hex!("72b0acd7c302a84f1f6b6cefe0ba7194b7398afb440e1b44a9dbbe270394ca53");
|
||||
let root = array_bytes::hex2array_unchecked(
|
||||
"72b0acd7c302a84f1f6b6cefe0ba7194b7398afb440e1b44a9dbbe270394ca53",
|
||||
);
|
||||
|
||||
let data = addresses
|
||||
.into_iter()
|
||||
.map(|address| hex::decode(&address[2..]).unwrap())
|
||||
.map(|address| array_bytes::hex2bytes_unchecked(&address))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
for l in 0..data.len() {
|
||||
// when
|
||||
let proof = merkle_proof::<Keccak256, _, _>(data.clone(), l);
|
||||
assert_eq!(hex::encode(&proof.root), hex::encode(&root));
|
||||
assert_eq!(array_bytes::bytes2hex("", &proof.root), array_bytes::bytes2hex("", &root));
|
||||
assert_eq!(proof.leaf_index, l);
|
||||
assert_eq!(&proof.leaf, &data[l]);
|
||||
|
||||
@@ -810,14 +829,25 @@ mod tests {
|
||||
MerkleProof {
|
||||
root,
|
||||
proof: vec![
|
||||
hex!("340bcb1d49b2d82802ddbcf5b85043edb3427b65d09d7f758fbc76932ad2da2f"),
|
||||
hex!("ba0580e5bd530bc93d61276df7969fb5b4ae8f1864b4a28c280249575198ff1f"),
|
||||
hex!("d02609d2bbdb28aa25f58b85afec937d5a4c85d37925bce6d0cf802f9d76ba79"),
|
||||
hex!("ae3f8991955ed884613b0a5f40295902eea0e0abe5858fc520b72959bc016d4e"),
|
||||
array_bytes::hex2array_unchecked(
|
||||
"340bcb1d49b2d82802ddbcf5b85043edb3427b65d09d7f758fbc76932ad2da2f"
|
||||
),
|
||||
array_bytes::hex2array_unchecked(
|
||||
"ba0580e5bd530bc93d61276df7969fb5b4ae8f1864b4a28c280249575198ff1f"
|
||||
),
|
||||
array_bytes::hex2array_unchecked(
|
||||
"d02609d2bbdb28aa25f58b85afec937d5a4c85d37925bce6d0cf802f9d76ba79"
|
||||
),
|
||||
array_bytes::hex2array_unchecked(
|
||||
"ae3f8991955ed884613b0a5f40295902eea0e0abe5858fc520b72959bc016d4e"
|
||||
),
|
||||
],
|
||||
number_of_leaves: data.len(),
|
||||
leaf_index: data.len() - 1,
|
||||
leaf: hex!("c26B34D375533fFc4c5276282Fa5D660F3d8cbcB").to_vec(),
|
||||
leaf: array_bytes::hex2array_unchecked::<20>(
|
||||
"c26B34D375533fFc4c5276282Fa5D660F3d8cbcB"
|
||||
)
|
||||
.to_vec(),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ use beefy_primitives::{
|
||||
ValidatorSet,
|
||||
};
|
||||
use codec::{Decode, Encode};
|
||||
use hex_literal::hex;
|
||||
|
||||
use sp_core::H256;
|
||||
use sp_io::TestExternalities;
|
||||
@@ -70,9 +69,9 @@ fn should_contain_mmr_digest() {
|
||||
beefy_log(ConsensusLog::AuthoritiesChange(
|
||||
ValidatorSet::new(vec![mock_beefy_id(1), mock_beefy_id(2)], 1).unwrap()
|
||||
)),
|
||||
beefy_log(ConsensusLog::MmrRoot(
|
||||
hex!("95803defe6ea9f41e7ec6afa497064f21bfded027d8812efacbdf984e630cbdc").into()
|
||||
))
|
||||
beefy_log(ConsensusLog::MmrRoot(array_bytes::hex_n_into_unchecked(
|
||||
"95803defe6ea9f41e7ec6afa497064f21bfded027d8812efacbdf984e630cbdc"
|
||||
)))
|
||||
]
|
||||
);
|
||||
|
||||
@@ -85,15 +84,15 @@ fn should_contain_mmr_digest() {
|
||||
beefy_log(ConsensusLog::AuthoritiesChange(
|
||||
ValidatorSet::new(vec![mock_beefy_id(1), mock_beefy_id(2)], 1).unwrap()
|
||||
)),
|
||||
beefy_log(ConsensusLog::MmrRoot(
|
||||
hex!("95803defe6ea9f41e7ec6afa497064f21bfded027d8812efacbdf984e630cbdc").into()
|
||||
)),
|
||||
beefy_log(ConsensusLog::MmrRoot(array_bytes::hex_n_into_unchecked(
|
||||
"95803defe6ea9f41e7ec6afa497064f21bfded027d8812efacbdf984e630cbdc"
|
||||
))),
|
||||
beefy_log(ConsensusLog::AuthoritiesChange(
|
||||
ValidatorSet::new(vec![mock_beefy_id(3), mock_beefy_id(4)], 2).unwrap()
|
||||
)),
|
||||
beefy_log(ConsensusLog::MmrRoot(
|
||||
hex!("a73271a0974f1e67d6e9b8dd58e506177a2e556519a330796721e98279a753e2").into()
|
||||
)),
|
||||
beefy_log(ConsensusLog::MmrRoot(array_bytes::hex_n_into_unchecked(
|
||||
"a73271a0974f1e67d6e9b8dd58e506177a2e556519a330796721e98279a753e2"
|
||||
))),
|
||||
]
|
||||
);
|
||||
});
|
||||
@@ -120,11 +119,13 @@ fn should_contain_valid_leaf_data() {
|
||||
beefy_next_authority_set: BeefyNextAuthoritySet {
|
||||
id: 2,
|
||||
len: 2,
|
||||
root: hex!("9c6b2c1b0d0b25a008e6c882cc7b415f309965c72ad2b944ac0931048ca31cd5")
|
||||
.into(),
|
||||
root: array_bytes::hex_n_into_unchecked(
|
||||
"9c6b2c1b0d0b25a008e6c882cc7b415f309965c72ad2b944ac0931048ca31cd5"
|
||||
)
|
||||
},
|
||||
leaf_extra: hex!("55b8e9e1cc9f0db7776fac0ca66318ef8acfb8ec26db11e373120583e07ee648")
|
||||
.to_vec(),
|
||||
leaf_extra: array_bytes::hex2bytes_unchecked(
|
||||
"55b8e9e1cc9f0db7776fac0ca66318ef8acfb8ec26db11e373120583e07ee648"
|
||||
)
|
||||
}
|
||||
);
|
||||
|
||||
@@ -143,11 +144,13 @@ fn should_contain_valid_leaf_data() {
|
||||
beefy_next_authority_set: BeefyNextAuthoritySet {
|
||||
id: 3,
|
||||
len: 2,
|
||||
root: hex!("9c6b2c1b0d0b25a008e6c882cc7b415f309965c72ad2b944ac0931048ca31cd5")
|
||||
.into(),
|
||||
root: array_bytes::hex_n_into_unchecked(
|
||||
"9c6b2c1b0d0b25a008e6c882cc7b415f309965c72ad2b944ac0931048ca31cd5"
|
||||
)
|
||||
},
|
||||
leaf_extra: hex!("55b8e9e1cc9f0db7776fac0ca66318ef8acfb8ec26db11e373120583e07ee648")
|
||||
.to_vec()
|
||||
leaf_extra: array_bytes::hex2bytes_unchecked(
|
||||
"55b8e9e1cc9f0db7776fac0ca66318ef8acfb8ec26db11e373120583e07ee648"
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -161,8 +164,9 @@ fn should_update_authorities() {
|
||||
// check current authority set
|
||||
assert_eq!(0, auth_set.id);
|
||||
assert_eq!(2, auth_set.len);
|
||||
let want: H256 =
|
||||
hex!("176e73f1bf656478b728e28dd1a7733c98621b8acf830bff585949763dca7a96").into();
|
||||
let want = array_bytes::hex_n_into_unchecked::<H256, 32>(
|
||||
"176e73f1bf656478b728e28dd1a7733c98621b8acf830bff585949763dca7a96",
|
||||
);
|
||||
assert_eq!(want, auth_set.root);
|
||||
|
||||
// next authority set should have same validators but different id
|
||||
@@ -180,8 +184,9 @@ fn should_update_authorities() {
|
||||
assert_eq!(1, auth_set.id);
|
||||
// check next auth set
|
||||
assert_eq!(2, next_auth_set.id);
|
||||
let want: H256 =
|
||||
hex!("9c6b2c1b0d0b25a008e6c882cc7b415f309965c72ad2b944ac0931048ca31cd5").into();
|
||||
let want = array_bytes::hex_n_into_unchecked::<H256, 32>(
|
||||
"9c6b2c1b0d0b25a008e6c882cc7b415f309965c72ad2b944ac0931048ca31cd5",
|
||||
);
|
||||
assert_eq!(2, next_auth_set.len);
|
||||
assert_eq!(want, next_auth_set.root);
|
||||
|
||||
@@ -195,8 +200,9 @@ fn should_update_authorities() {
|
||||
assert_eq!(2, auth_set.id);
|
||||
// check next auth set
|
||||
assert_eq!(3, next_auth_set.id);
|
||||
let want: H256 =
|
||||
hex!("9c6b2c1b0d0b25a008e6c882cc7b415f309965c72ad2b944ac0931048ca31cd5").into();
|
||||
let want = array_bytes::hex_n_into_unchecked::<H256, 32>(
|
||||
"9c6b2c1b0d0b25a008e6c882cc7b415f309965c72ad2b944ac0931048ca31cd5",
|
||||
);
|
||||
assert_eq!(2, next_auth_set.len);
|
||||
assert_eq!(want, next_auth_set.root);
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ sp-std = { version = "4.0.0", default-features = false, path = "../../primitives
|
||||
sp-storage = { version = "6.0.0", default-features = false, path = "../../primitives/storage" }
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.4"
|
||||
array-bytes = "4.1"
|
||||
rusty-fork = { version = "0.3.0", default-features = false }
|
||||
sp-keystore = { version = "0.12.0", path = "../../primitives/keystore" }
|
||||
|
||||
|
||||
@@ -1695,13 +1695,13 @@ pub fn show_benchmark_debug_info(
|
||||
/// use frame_benchmarking::TrackedStorageKey;
|
||||
/// let whitelist: Vec<TrackedStorageKey> = vec![
|
||||
/// // Block Number
|
||||
/// hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
|
||||
/// array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac"),
|
||||
/// // Total Issuance
|
||||
/// hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
|
||||
/// array_bytes::hex_into_unchecked("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80"),
|
||||
/// // Execution Phase
|
||||
/// hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
|
||||
/// array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a"),
|
||||
/// // Event Count
|
||||
/// hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
|
||||
/// array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850"),
|
||||
/// ];
|
||||
/// ```
|
||||
///
|
||||
|
||||
@@ -45,9 +45,9 @@ sp-sandbox = { version = "0.10.0-dev", default-features = false, path = "../../p
|
||||
sp-std = { version = "4.0.0", default-features = false, path = "../../primitives/std" }
|
||||
|
||||
[dev-dependencies]
|
||||
array-bytes = "4.1"
|
||||
assert_matches = "1"
|
||||
env_logger = "0.9"
|
||||
hex-literal = "0.3"
|
||||
pretty_assertions = "1"
|
||||
wat = "1"
|
||||
|
||||
|
||||
@@ -1379,7 +1379,6 @@ mod tests {
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::{assert_err, assert_ok, parameter_types};
|
||||
use frame_system::{EventRecord, Phase};
|
||||
use hex_literal::hex;
|
||||
use pallet_contracts_primitives::ReturnFlags;
|
||||
use pretty_assertions::assert_eq;
|
||||
use sp_core::Bytes;
|
||||
@@ -3210,13 +3209,12 @@ mod tests {
|
||||
#[test]
|
||||
fn ecdsa_to_eth_address_returns_proper_value() {
|
||||
let bob_ch = MockLoader::insert(Call, |ctx, _| {
|
||||
let pubkey_compressed: [u8; 33] =
|
||||
hex!("028db55b05db86c0b1786ca49f095d76344c9e6056b2f02701a7e7f3c20aabfd91")[..]
|
||||
.try_into()
|
||||
.unwrap();
|
||||
let pubkey_compressed = array_bytes::hex2array_unchecked(
|
||||
"028db55b05db86c0b1786ca49f095d76344c9e6056b2f02701a7e7f3c20aabfd91",
|
||||
);
|
||||
assert_eq!(
|
||||
ctx.ext.ecdsa_to_eth_address(&pubkey_compressed).unwrap(),
|
||||
hex!("09231da7b19A016f9e576d23B16277062F4d46A8")[..]
|
||||
array_bytes::hex2array_unchecked::<20>("09231da7b19A016f9e576d23B16277062F4d46A8")
|
||||
);
|
||||
exec_success()
|
||||
});
|
||||
|
||||
@@ -275,7 +275,6 @@ mod tests {
|
||||
};
|
||||
use assert_matches::assert_matches;
|
||||
use frame_support::{assert_ok, dispatch::DispatchResultWithPostInfo, weights::Weight};
|
||||
use hex_literal::hex;
|
||||
use pallet_contracts_primitives::{ExecReturnValue, ReturnFlags};
|
||||
use pretty_assertions::assert_eq;
|
||||
use sp_core::{Bytes, H256};
|
||||
@@ -1828,10 +1827,9 @@ mod tests {
|
||||
output,
|
||||
ExecReturnValue {
|
||||
flags: ReturnFlags::empty(),
|
||||
data: Bytes(
|
||||
hex!("000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F")
|
||||
.to_vec()
|
||||
),
|
||||
data: array_bytes::hex_into_unchecked(
|
||||
"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F"
|
||||
)
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -1901,7 +1899,9 @@ mod tests {
|
||||
flags: ReturnFlags::empty(),
|
||||
data: Bytes(
|
||||
(
|
||||
hex!("000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F"),
|
||||
array_bytes::hex2array_unchecked::<32>(
|
||||
"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F"
|
||||
),
|
||||
42u64,
|
||||
)
|
||||
.encode()
|
||||
@@ -2110,7 +2110,7 @@ mod tests {
|
||||
fn seal_return_with_success_status() {
|
||||
let output = execute(
|
||||
CODE_RETURN_WITH_DATA,
|
||||
hex!("00000000445566778899").to_vec(),
|
||||
array_bytes::hex2bytes_unchecked("00000000445566778899"),
|
||||
MockExt::default(),
|
||||
)
|
||||
.unwrap();
|
||||
@@ -2119,7 +2119,7 @@ mod tests {
|
||||
output,
|
||||
ExecReturnValue {
|
||||
flags: ReturnFlags::empty(),
|
||||
data: Bytes(hex!("445566778899").to_vec()),
|
||||
data: Bytes(array_bytes::hex2bytes_unchecked("445566778899")),
|
||||
}
|
||||
);
|
||||
assert!(!output.did_revert());
|
||||
@@ -2127,15 +2127,18 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn return_with_revert_status() {
|
||||
let output =
|
||||
execute(CODE_RETURN_WITH_DATA, hex!("010000005566778899").to_vec(), MockExt::default())
|
||||
.unwrap();
|
||||
let output = execute(
|
||||
CODE_RETURN_WITH_DATA,
|
||||
array_bytes::hex2bytes_unchecked("010000005566778899"),
|
||||
MockExt::default(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
output,
|
||||
ExecReturnValue {
|
||||
flags: ReturnFlags::REVERT,
|
||||
data: Bytes(hex!("5566778899").to_vec()),
|
||||
data: Bytes(array_bytes::hex2bytes_unchecked("5566778899")),
|
||||
}
|
||||
);
|
||||
assert!(output.did_revert());
|
||||
|
||||
@@ -27,7 +27,7 @@ sp-std = { version = "4.0.0", default-features = false, path = "../../primitives
|
||||
sp-tracing = { version = "5.0.0", default-features = false, path = "../../primitives/tracing" }
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.4"
|
||||
array-bytes = "4.1"
|
||||
pallet-balances = { version = "4.0.0-dev", path = "../balances" }
|
||||
pallet-transaction-payment = { version = "4.0.0-dev", path = "../transaction-payment" }
|
||||
sp-core = { version = "6.0.0", path = "../../primitives/core" }
|
||||
|
||||
@@ -602,8 +602,6 @@ where
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use hex_literal::hex;
|
||||
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
generic::{DigestItem, Era},
|
||||
@@ -947,11 +945,15 @@ mod tests {
|
||||
fn block_import_works() {
|
||||
block_import_works_inner(
|
||||
new_test_ext_v0(1),
|
||||
hex!("1039e1a4bd0cf5deefe65f313577e70169c41c7773d6acf31ca8d671397559f5").into(),
|
||||
array_bytes::hex_n_into_unchecked(
|
||||
"1039e1a4bd0cf5deefe65f313577e70169c41c7773d6acf31ca8d671397559f5",
|
||||
),
|
||||
);
|
||||
block_import_works_inner(
|
||||
new_test_ext(1),
|
||||
hex!("75e7d8f360d375bbe91bcf8019c01ab6362448b4a89e3b329717eb9d910340e5").into(),
|
||||
array_bytes::hex_n_into_unchecked(
|
||||
"75e7d8f360d375bbe91bcf8019c01ab6362448b4a89e3b329717eb9d910340e5",
|
||||
),
|
||||
);
|
||||
}
|
||||
fn block_import_works_inner(mut ext: sp_io::TestExternalities, state_root: H256) {
|
||||
@@ -961,10 +963,9 @@ mod tests {
|
||||
parent_hash: [69u8; 32].into(),
|
||||
number: 1,
|
||||
state_root,
|
||||
extrinsics_root: hex!(
|
||||
"03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314"
|
||||
)
|
||||
.into(),
|
||||
extrinsics_root: array_bytes::hex_n_into_unchecked(
|
||||
"03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314",
|
||||
),
|
||||
digest: Digest { logs: vec![] },
|
||||
},
|
||||
extrinsics: vec![],
|
||||
@@ -981,10 +982,9 @@ mod tests {
|
||||
parent_hash: [69u8; 32].into(),
|
||||
number: 1,
|
||||
state_root: [0u8; 32].into(),
|
||||
extrinsics_root: hex!(
|
||||
"03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314"
|
||||
)
|
||||
.into(),
|
||||
extrinsics_root: array_bytes::hex_n_into_unchecked(
|
||||
"03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314",
|
||||
),
|
||||
digest: Digest { logs: vec![] },
|
||||
},
|
||||
extrinsics: vec![],
|
||||
@@ -1000,10 +1000,9 @@ mod tests {
|
||||
header: Header {
|
||||
parent_hash: [69u8; 32].into(),
|
||||
number: 1,
|
||||
state_root: hex!(
|
||||
"75e7d8f360d375bbe91bcf8019c01ab6362448b4a89e3b329717eb9d910340e5"
|
||||
)
|
||||
.into(),
|
||||
state_root: array_bytes::hex_n_into_unchecked(
|
||||
"75e7d8f360d375bbe91bcf8019c01ab6362448b4a89e3b329717eb9d910340e5",
|
||||
),
|
||||
extrinsics_root: [0u8; 32].into(),
|
||||
digest: Digest { logs: vec![] },
|
||||
},
|
||||
|
||||
@@ -25,8 +25,8 @@ sp-runtime = { version = "6.0.0", default-features = false, path = "../../primit
|
||||
sp-std = { version = "4.0.0", default-features = false, path = "../../primitives/std" }
|
||||
|
||||
[dev-dependencies]
|
||||
array-bytes = "4.1"
|
||||
env_logger = "0.9"
|
||||
hex-literal = "0.3"
|
||||
itertools = "0.10.3"
|
||||
|
||||
[features]
|
||||
|
||||
@@ -13,8 +13,8 @@ readme = "README.md"
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
array-bytes = { version = "4.1", optional = true }
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
||||
hex-literal = { version = "0.3.4", optional = true }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.136", optional = true }
|
||||
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" }
|
||||
@@ -34,7 +34,7 @@ sp-transaction-storage-proof = { version = "4.0.0-dev", default-features = true,
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks", "hex-literal"]
|
||||
runtime-benchmarks = ["array-bytes", "frame-benchmarking/runtime-benchmarks"]
|
||||
std = [
|
||||
"log/std",
|
||||
"frame-benchmarking?/std",
|
||||
|
||||
@@ -40,67 +40,68 @@ use crate::Pallet as TransactionStorage;
|
||||
// build_proof(hash.as_slice(), transactions).unwrap().encode()
|
||||
// ```
|
||||
// while hardforcing target chunk key in `build_proof` to [22, 21, 1, 0].
|
||||
const PROOF: &[u8] = &hex_literal::hex!(
|
||||
"
|
||||
0104000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000014cd0780ffff8030
|
||||
2eb0a6d2f63b834d15f1e729d1c1004657e3048cf206d697eeb153f61a30ba0080302eb0a6d2
|
||||
f63b834d15f1e729d1c1004657e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15
|
||||
f1e729d1c1004657e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c1
|
||||
004657e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c1004657e304
|
||||
8cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c1004657e3048cf206d697
|
||||
eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c1004657e3048cf206d697eeb153f61a
|
||||
30ba80302eb0a6d2f63b834d15f1e729d1c1004657e3048cf206d697eeb153f61a30ba80302e
|
||||
b0a6d2f63b834d15f1e729d1c1004657e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b
|
||||
834d15f1e729d1c1004657e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e7
|
||||
29d1c1004657e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c10046
|
||||
57e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c1004657e3048cf2
|
||||
06d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c1004657e3048cf206d697eeb1
|
||||
53f61a30ba80302eb0a6d2f63b834d15f1e729d1c1004657e3048cf206d697eeb153f61a30ba
|
||||
bd058077778010fd81bc1359802f0b871aeb95e4410a8ec92b93af10ea767a2027cf4734e8de
|
||||
808da338e6b722f7bf2051901bd5bccee5e71d5cf6b1faff338ad7120b0256c28380221ce17f
|
||||
19117affa96e077905fe48a99723a065969c638593b7d9ab57b538438010fd81bc1359802f0b
|
||||
871aeb95e4410a8ec92b93af10ea767a2027cf4734e8de808da338e6b722f7bf2051901bd5bc
|
||||
cee5e71d5cf6b1faff338ad7120b0256c283008010fd81bc1359802f0b871aeb95e4410a8ec9
|
||||
2b93af10ea767a2027cf4734e8de808da338e6b722f7bf2051901bd5bccee5e71d5cf6b1faff
|
||||
338ad7120b0256c28380221ce17f19117affa96e077905fe48a99723a065969c638593b7d9ab
|
||||
57b538438010fd81bc1359802f0b871aeb95e4410a8ec92b93af10ea767a2027cf4734e8de80
|
||||
8da338e6b722f7bf2051901bd5bccee5e71d5cf6b1faff338ad7120b0256c28380221ce17f19
|
||||
117affa96e077905fe48a99723a065969c638593b7d9ab57b53843cd0780ffff804509f59593
|
||||
fd47b1a97189127ba65a5649cfb0346637f9836e155eaf891a939c00804509f59593fd47b1a9
|
||||
7189127ba65a5649cfb0346637f9836e155eaf891a939c804509f59593fd47b1a97189127ba6
|
||||
5a5649cfb0346637f9836e155eaf891a939c804509f59593fd47b1a97189127ba65a5649cfb0
|
||||
346637f9836e155eaf891a939c804509f59593fd47b1a97189127ba65a5649cfb0346637f983
|
||||
6e155eaf891a939c804509f59593fd47b1a97189127ba65a5649cfb0346637f9836e155eaf89
|
||||
1a939c804509f59593fd47b1a97189127ba65a5649cfb0346637f9836e155eaf891a939c8045
|
||||
09f59593fd47b1a97189127ba65a5649cfb0346637f9836e155eaf891a939c804509f59593fd
|
||||
47b1a97189127ba65a5649cfb0346637f9836e155eaf891a939c804509f59593fd47b1a97189
|
||||
127ba65a5649cfb0346637f9836e155eaf891a939c804509f59593fd47b1a97189127ba65a56
|
||||
49cfb0346637f9836e155eaf891a939c804509f59593fd47b1a97189127ba65a5649cfb03466
|
||||
37f9836e155eaf891a939c804509f59593fd47b1a97189127ba65a5649cfb0346637f9836e15
|
||||
5eaf891a939c804509f59593fd47b1a97189127ba65a5649cfb0346637f9836e155eaf891a93
|
||||
9c804509f59593fd47b1a97189127ba65a5649cfb0346637f9836e155eaf891a939ccd0780ff
|
||||
ff8078916e776c64ccea05e958559f015c082d9d06feafa3610fc44a5b2ef543cb818078916e
|
||||
776c64ccea05e958559f015c082d9d06feafa3610fc44a5b2ef543cb818078916e776c64ccea
|
||||
05e958559f015c082d9d06feafa3610fc44a5b2ef543cb818078916e776c64ccea05e958559f
|
||||
015c082d9d06feafa3610fc44a5b2ef543cb818078916e776c64ccea05e958559f015c082d9d
|
||||
06feafa3610fc44a5b2ef543cb81008078916e776c64ccea05e958559f015c082d9d06feafa3
|
||||
610fc44a5b2ef543cb818078916e776c64ccea05e958559f015c082d9d06feafa3610fc44a5b
|
||||
2ef543cb818078916e776c64ccea05e958559f015c082d9d06feafa3610fc44a5b2ef543cb81
|
||||
8078916e776c64ccea05e958559f015c082d9d06feafa3610fc44a5b2ef543cb818078916e77
|
||||
6c64ccea05e958559f015c082d9d06feafa3610fc44a5b2ef543cb818078916e776c64ccea05
|
||||
e958559f015c082d9d06feafa3610fc44a5b2ef543cb818078916e776c64ccea05e958559f01
|
||||
5c082d9d06feafa3610fc44a5b2ef543cb818078916e776c64ccea05e958559f015c082d9d06
|
||||
feafa3610fc44a5b2ef543cb818078916e776c64ccea05e958559f015c082d9d06feafa3610f
|
||||
c44a5b2ef543cb818078916e776c64ccea05e958559f015c082d9d06feafa3610fc44a5b2ef5
|
||||
43cb811044010000
|
||||
"
|
||||
);
|
||||
const PROOF: &str = "\
|
||||
0104000000000000000000000000000000000000000000000000000000000000000000000000\
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000\
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000\
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000\
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000\
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000\
|
||||
00000000000000000000000000000000000000000000000000000000000014cd0780ffff8030\
|
||||
2eb0a6d2f63b834d15f1e729d1c1004657e3048cf206d697eeb153f61a30ba0080302eb0a6d2\
|
||||
f63b834d15f1e729d1c1004657e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15\
|
||||
f1e729d1c1004657e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c1\
|
||||
004657e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c1004657e304\
|
||||
8cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c1004657e3048cf206d697\
|
||||
eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c1004657e3048cf206d697eeb153f61a\
|
||||
30ba80302eb0a6d2f63b834d15f1e729d1c1004657e3048cf206d697eeb153f61a30ba80302e\
|
||||
b0a6d2f63b834d15f1e729d1c1004657e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b\
|
||||
834d15f1e729d1c1004657e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e7\
|
||||
29d1c1004657e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c10046\
|
||||
57e3048cf206d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c1004657e3048cf2\
|
||||
06d697eeb153f61a30ba80302eb0a6d2f63b834d15f1e729d1c1004657e3048cf206d697eeb1\
|
||||
53f61a30ba80302eb0a6d2f63b834d15f1e729d1c1004657e3048cf206d697eeb153f61a30ba\
|
||||
bd058077778010fd81bc1359802f0b871aeb95e4410a8ec92b93af10ea767a2027cf4734e8de\
|
||||
808da338e6b722f7bf2051901bd5bccee5e71d5cf6b1faff338ad7120b0256c28380221ce17f\
|
||||
19117affa96e077905fe48a99723a065969c638593b7d9ab57b538438010fd81bc1359802f0b\
|
||||
871aeb95e4410a8ec92b93af10ea767a2027cf4734e8de808da338e6b722f7bf2051901bd5bc\
|
||||
cee5e71d5cf6b1faff338ad7120b0256c283008010fd81bc1359802f0b871aeb95e4410a8ec9\
|
||||
2b93af10ea767a2027cf4734e8de808da338e6b722f7bf2051901bd5bccee5e71d5cf6b1faff\
|
||||
338ad7120b0256c28380221ce17f19117affa96e077905fe48a99723a065969c638593b7d9ab\
|
||||
57b538438010fd81bc1359802f0b871aeb95e4410a8ec92b93af10ea767a2027cf4734e8de80\
|
||||
8da338e6b722f7bf2051901bd5bccee5e71d5cf6b1faff338ad7120b0256c28380221ce17f19\
|
||||
117affa96e077905fe48a99723a065969c638593b7d9ab57b53843cd0780ffff804509f59593\
|
||||
fd47b1a97189127ba65a5649cfb0346637f9836e155eaf891a939c00804509f59593fd47b1a9\
|
||||
7189127ba65a5649cfb0346637f9836e155eaf891a939c804509f59593fd47b1a97189127ba6\
|
||||
5a5649cfb0346637f9836e155eaf891a939c804509f59593fd47b1a97189127ba65a5649cfb0\
|
||||
346637f9836e155eaf891a939c804509f59593fd47b1a97189127ba65a5649cfb0346637f983\
|
||||
6e155eaf891a939c804509f59593fd47b1a97189127ba65a5649cfb0346637f9836e155eaf89\
|
||||
1a939c804509f59593fd47b1a97189127ba65a5649cfb0346637f9836e155eaf891a939c8045\
|
||||
09f59593fd47b1a97189127ba65a5649cfb0346637f9836e155eaf891a939c804509f59593fd\
|
||||
47b1a97189127ba65a5649cfb0346637f9836e155eaf891a939c804509f59593fd47b1a97189\
|
||||
127ba65a5649cfb0346637f9836e155eaf891a939c804509f59593fd47b1a97189127ba65a56\
|
||||
49cfb0346637f9836e155eaf891a939c804509f59593fd47b1a97189127ba65a5649cfb03466\
|
||||
37f9836e155eaf891a939c804509f59593fd47b1a97189127ba65a5649cfb0346637f9836e15\
|
||||
5eaf891a939c804509f59593fd47b1a97189127ba65a5649cfb0346637f9836e155eaf891a93\
|
||||
9c804509f59593fd47b1a97189127ba65a5649cfb0346637f9836e155eaf891a939ccd0780ff\
|
||||
ff8078916e776c64ccea05e958559f015c082d9d06feafa3610fc44a5b2ef543cb818078916e\
|
||||
776c64ccea05e958559f015c082d9d06feafa3610fc44a5b2ef543cb818078916e776c64ccea\
|
||||
05e958559f015c082d9d06feafa3610fc44a5b2ef543cb818078916e776c64ccea05e958559f\
|
||||
015c082d9d06feafa3610fc44a5b2ef543cb818078916e776c64ccea05e958559f015c082d9d\
|
||||
06feafa3610fc44a5b2ef543cb81008078916e776c64ccea05e958559f015c082d9d06feafa3\
|
||||
610fc44a5b2ef543cb818078916e776c64ccea05e958559f015c082d9d06feafa3610fc44a5b\
|
||||
2ef543cb818078916e776c64ccea05e958559f015c082d9d06feafa3610fc44a5b2ef543cb81\
|
||||
8078916e776c64ccea05e958559f015c082d9d06feafa3610fc44a5b2ef543cb818078916e77\
|
||||
6c64ccea05e958559f015c082d9d06feafa3610fc44a5b2ef543cb818078916e776c64ccea05\
|
||||
e958559f015c082d9d06feafa3610fc44a5b2ef543cb818078916e776c64ccea05e958559f01\
|
||||
5c082d9d06feafa3610fc44a5b2ef543cb818078916e776c64ccea05e958559f015c082d9d06\
|
||||
feafa3610fc44a5b2ef543cb818078916e776c64ccea05e958559f015c082d9d06feafa3610f\
|
||||
c44a5b2ef543cb818078916e776c64ccea05e958559f015c082d9d06feafa3610fc44a5b2ef5\
|
||||
43cb811044010000\
|
||||
";
|
||||
fn proof() -> Vec<u8> {
|
||||
array_bytes::hex2bytes_unchecked(PROOF)
|
||||
}
|
||||
|
||||
type BalanceOf<T> =
|
||||
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
|
||||
@@ -159,8 +160,8 @@ benchmarks! {
|
||||
)?;
|
||||
}
|
||||
run_to_block::<T>(StoragePeriod::<T>::get() + T::BlockNumber::one());
|
||||
let mut encoded_proof = PROOF;
|
||||
let proof = TransactionStorageProof::decode(&mut encoded_proof).unwrap();
|
||||
let encoded_proof = proof();
|
||||
let proof = TransactionStorageProof::decode(&mut &*encoded_proof).unwrap();
|
||||
}: check_proof(RawOrigin::None, proof)
|
||||
verify {
|
||||
assert_last_event::<T>(Event::ProofChecked.into());
|
||||
|
||||
Reference in New Issue
Block a user