-
Notifications
You must be signed in to change notification settings - Fork 107
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
Adds runtime tests #1114
Adds runtime tests #1114
Changes from all commits
8c30f3b
32b8a12
2f48f99
d91fbbd
c0e3c4c
67863bd
3feefc4
f241bdb
9742661
a8c635c
d0fd1aa
dee62c7
c9a1c10
1bdcda9
653daa8
801d17c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[package] | ||
name = "snowbridge-pallet-ethereum-client-fixtures" | ||
description = "Snowbridge Ethereum Client Test Fixtures" | ||
version = "0.9.0" | ||
authors = ["Snowfork <[email protected]>"] | ||
edition.workspace = true | ||
repository.workspace = true | ||
license = "Apache-2.0" | ||
categories = ["cryptography::cryptocurrencies"] | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
hex-literal = { version = "0.4.1" } | ||
sp-core = { path = "../../../../polkadot-sdk/substrate/primitives/core", default-features = false } | ||
sp-std = { path = "../../../../polkadot-sdk/substrate/primitives/std", default-features = false } | ||
frame-benchmarking = { path = "../../../../polkadot-sdk/substrate/frame/benchmarking", default-features = false, optional = true } | ||
frame-support = { path = "../../../../polkadot-sdk/substrate/frame/support", default-features = false } | ||
frame-system = { path = "../../../../polkadot-sdk/substrate/frame/system", default-features = false } | ||
snowbridge-core = { path = "../../../primitives/core", default-features = false } | ||
snowbridge-beacon-primitives = { path = "../../../primitives/beacon", default-features = false } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"frame-benchmarking/std", | ||
"frame-support/std", | ||
"frame-system/std", | ||
"snowbridge-beacon-primitives/std", | ||
"snowbridge-core/std", | ||
"sp-core/std", | ||
"sp-std/std", | ||
] | ||
runtime-benchmarks = [ | ||
"frame-benchmarking", | ||
"frame-benchmarking/runtime-benchmarks", | ||
"frame-support/runtime-benchmarks", | ||
"frame-system/runtime-benchmarks", | ||
"snowbridge-core/runtime-benchmarks", | ||
] | ||
Comment on lines
+38
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I referenced the inbound fixtures crate you added. 😅 https://github.com/Snowfork/snowbridge/blob/main/parachain/pallets/inbound-queue/fixtures/Cargo.toml#L38 Is it necessary in that crate? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, seems also unnecessary in that crate because IIUC we're using the fixture from local setup for the benchmark? IMO the benefit of introducing the But it's nitpicky and not the scope of this PR, so feel free to ignore it. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]> | ||
// Generated, do not edit! | ||
// See README.md for instructions to generate | ||
use crate::{CheckpointUpdate, ExecutionHeaderUpdate, Update}; | ||
#![cfg_attr(not(feature = "std"), no_std)] | ||
|
||
use hex_literal::hex; | ||
use primitives::{ | ||
types::deneb, updates::AncestryProof, BeaconHeader, NextSyncCommitteeUpdate, SyncAggregate, | ||
SyncCommittee, VersionedExecutionPayloadHeader, | ||
use snowbridge_beacon_primitives::{ | ||
types::deneb, updates::AncestryProof, BeaconHeader, ExecutionHeaderUpdate, | ||
NextSyncCommitteeUpdate, SyncAggregate, SyncCommittee, VersionedExecutionPayloadHeader, | ||
}; | ||
use sp_core::U256; | ||
use sp_std::{boxed::Box, vec}; | ||
|
||
const SC_SIZE: usize = 512; | ||
const SC_BITS_SIZE: usize = 64; | ||
type CheckpointUpdate = snowbridge_beacon_primitives::CheckpointUpdate<SC_SIZE>; | ||
type Update = snowbridge_beacon_primitives::Update<SC_SIZE, SC_BITS_SIZE>; | ||
|
||
pub fn make_checkpoint() -> Box<CheckpointUpdate> { | ||
Box::new(CheckpointUpdate { | ||
header: BeaconHeader { | ||
|
@@ -536,11 +544,11 @@ pub fn make_checkpoint() -> Box<CheckpointUpdate> { | |
aggregate_pubkey: hex!("8fbd66eeec2ff69ef0b836f04b1d67d88bcd4dfd495061964ad757c77abe822a39fa1cd8ed0d4d9bc9276cea73fd745c").into(), | ||
}, | ||
current_sync_committee_branch: vec![ | ||
hex!("3ade38d498a062b50880a9409e1ca3a7fd4315d91eeb3bb83e56ac6bfe8d6a59").into(), | ||
hex!("93880225bf99a0c5ec22b266ff829837754e9c5edf37a68c05b8f803fd82fa45").into(), | ||
hex!("4c60656ec9a95fcf11030ad309c716b5b15beb7f60a0bcfc7c9d4eff505472ff").into(), | ||
hex!("22d1645fceb4bf9a695043dda19a53e784ec70df6a6b1bd66ea30eba1cca5f2f").into(), | ||
hex!("a8fc6cad84ceefc633ec56c2d031d525e1cb4b51c70eb252919fce5bba9a1fde").into(), | ||
hex!("3ade38d498a062b50880a9409e1ca3a7fd4315d91eeb3bb83e56ac6bfe8d6a59").into(), | ||
hex!("93880225bf99a0c5ec22b266ff829837754e9c5edf37a68c05b8f803fd82fa45").into(), | ||
hex!("4c60656ec9a95fcf11030ad309c716b5b15beb7f60a0bcfc7c9d4eff505472ff").into(), | ||
hex!("22d1645fceb4bf9a695043dda19a53e784ec70df6a6b1bd66ea30eba1cca5f2f").into(), | ||
hex!("a8fc6cad84ceefc633ec56c2d031d525e1cb4b51c70eb252919fce5bba9a1fde").into(), | ||
], | ||
validators_root: hex!("270d43e74ce340de4bca2b1936beca0f4f5408d9e78aec4850920baf659d5b69").into(), | ||
block_roots_root: hex!("d160b7687041891b73e54b06fc4e04f82d0fa8fdd76705895e216c6b24709dfe").into(), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]> | ||
use super::*; | ||
mod fixtures; | ||
mod util; | ||
|
||
use crate::Pallet as EthereumBeaconClient; | ||
use frame_benchmarking::v2::*; | ||
use frame_system::RawOrigin; | ||
|
||
use fixtures::*; | ||
use snowbridge_pallet_ethereum_client_fixtures::*; | ||
|
||
use primitives::{ | ||
fast_aggregate_verify, prepare_aggregate_pubkey, prepare_aggregate_signature, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems the fixture crate is only for tests so unnecessary here?