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

A0-1502: Finality version e2e test #717

Merged
merged 116 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from 79 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
5ac97f2
Setting up AlephBFT version
maciejzelaszczyk Aug 30, 2022
27e43a9
Merge branch 'main' into A0-1323-aleph-bft-version-coordination
maciejzelaszczyk Aug 31, 2022
62126ec
Merge branch 'main' into A0-1323-aleph-bft-version-coordination
maciejzelaszczyk Aug 31, 2022
459d145
Changed handling to map from session to version
maciejzelaszczyk Aug 31, 2022
ac02944
Changed logic to handle serving last set AlephBFT version
maciejzelaszczyk Sep 1, 2022
fb4b788
Merge branch 'main' into A0-1323-aleph-bft-version-coordination
maciejzelaszczyk Sep 5, 2022
c707921
Changed logic to handle setting of version in future only
maciejzelaszczyk Sep 5, 2022
afa232b
Reworked storage and accessors to only store one version plus session…
maciejzelaszczyk Sep 6, 2022
3eea0df
Merge branch 'main' into A0-1323-aleph-bft-version-coordination
maciejzelaszczyk Sep 7, 2022
357e2d9
Treat version change as a delimiting flag
maciejzelaszczyk Sep 7, 2022
b74359d
Loose coupling between pallet_aleph and pallet_session to access curr…
maciejzelaszczyk Sep 7, 2022
7c900a3
Fixed trait implementation for mock
maciejzelaszczyk Sep 8, 2022
4ae4f4c
Added comment to trait
maciejzelaszczyk Sep 8, 2022
71c1538
Replaced panics with Results in AlephBFT version handling
maciejzelaszczyk Sep 8, 2022
9ef7f8f
Changed logic to work with numbered versions
maciejzelaszczyk Sep 12, 2022
c781a0c
Merge branch 'main' into A0-1323-aleph-bft-version-coordination
maciejzelaszczyk Sep 12, 2022
0fee02d
Merge branch 'main' into A0-1323-aleph-bft-version-coordination
maciejzelaszczyk Sep 13, 2022
e0d9fb3
Changed behavior on session start and end
maciejzelaszczyk Sep 13, 2022
157d49b
Merge branch 'main' into A0-1323-aleph-bft-version-coordination
maciejzelaszczyk Sep 14, 2022
7eea19c
Fixed version change update
maciejzelaszczyk Sep 15, 2022
5ff7256
Linked SessionManager in runtime
maciejzelaszczyk Sep 16, 2022
08a0dc6
Merge branch 'main' into A0-1323-aleph-bft-version-coordination
maciejzelaszczyk Sep 16, 2022
f63875b
Mock impl
maciejzelaszczyk Sep 16, 2022
3f68522
Reworked SessionManage link
maciejzelaszczyk Sep 16, 2022
002a2b5
Linter
maciejzelaszczyk Sep 16, 2022
9b70cc4
Removed pallet_elections from mock
maciejzelaszczyk Sep 16, 2022
4853d8b
Removed event
maciejzelaszczyk Sep 16, 2022
706c9b1
linter
maciejzelaszczyk Sep 16, 2022
66989bf
Linter
maciejzelaszczyk Sep 16, 2022
23ae4a8
Reworked AlephBFT version history updates
maciejzelaszczyk Sep 19, 2022
f0bb79a
Merge branch 'main' into A0-1323-aleph-bft-version-coordination
maciejzelaszczyk Sep 20, 2022
f23314e
Reworked storage to use value instead of map
maciejzelaszczyk Sep 22, 2022
6416805
Merge branch 'main' into A0-1323-aleph-bft-version-coordination
maciejzelaszczyk Sep 22, 2022
f08cb5f
Added unit test
maciejzelaszczyk Sep 22, 2022
f11a76c
Added version change unscheduling and next session version
maciejzelaszczyk Sep 23, 2022
1ca8421
Merge branch 'main' into A0-1323-aleph-bft-version-coordination
maciejzelaszczyk Sep 26, 2022
8c46f55
Removed explicit version unscheduling; added version default
maciejzelaszczyk Sep 26, 2022
b76b5d3
Extended docs for pallet aleph
maciejzelaszczyk Sep 27, 2022
8f3d600
Merge branch 'main' into A0-1323-aleph-bft-version-coordination
maciejzelaszczyk Sep 27, 2022
ab33ed1
Moved default AlephBFT version to const
maciejzelaszczyk Sep 27, 2022
df25289
Merge branch 'main' into A0-1323-aleph-bft-version-coordination
maciejzelaszczyk Sep 30, 2022
cc89848
Renamed helper function
maciejzelaszczyk Oct 3, 2022
5a331e7
Merge branch 'A0-1323-aleph-bft-version-coordination' of github.com:C…
maciejzelaszczyk Oct 3, 2022
94519a2
Fixed test
maciejzelaszczyk Oct 3, 2022
1e9daef
Changed naming
maciejzelaszczyk Oct 3, 2022
27a1207
Bumped spec version
maciejzelaszczyk Oct 3, 2022
6599a4e
Bumped transaction version
maciejzelaszczyk Oct 4, 2022
5c131b8
Finality version RPC and e2e test, first stab
maciejzelaszczyk Oct 13, 2022
0a63a9c
Merging
maciejzelaszczyk Oct 13, 2022
d3f6d47
Added GenesisBuild to pallet_aleph
maciejzelaszczyk Oct 13, 2022
01b8e4e
Added finality version e2e test
maciejzelaszczyk Oct 14, 2022
b9edd93
Reworked test logic
maciejzelaszczyk Oct 17, 2022
c020660
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Nov 4, 2022
7d6bb8a
Removed unused imports
maciejzelaszczyk Nov 4, 2022
2bd4672
Dependency version fixes; prep work for test logic change
maciejzelaszczyk Nov 4, 2022
7cb6d06
Post factum checks
maciejzelaszczyk Nov 7, 2022
61b534e
Changed checks; changed finality version update session
maciejzelaszczyk Nov 8, 2022
9e4e77d
Added test description
maciejzelaszczyk Nov 8, 2022
01530d1
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Nov 8, 2022
6dc2068
aleph-client and aleph-e2e-client version bumps
maciejzelaszczyk Nov 8, 2022
944f6bd
spec_version and transaction_version bumps
maciejzelaszczyk Nov 8, 2022
24c1b1d
Changed comment about error code
maciejzelaszczyk Nov 8, 2022
8144b41
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Nov 8, 2022
692f957
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Nov 8, 2022
efda24b
Added doc comment
maciejzelaszczyk Nov 9, 2022
6ec8600
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Nov 14, 2022
06e8853
Cargo.lock
maciejzelaszczyk Nov 14, 2022
bdb9df4
Bumped runtime version
maciejzelaszczyk Nov 14, 2022
e4cc57b
Disabled runtime upgrade check in CI
maciejzelaszczyk Nov 18, 2022
ecfe53a
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Nov 18, 2022
154f2b9
Revert "Disabled runtime upgrade check in CI"
maciejzelaszczyk Nov 18, 2022
4abbd27
Disabled runtime upgrade check without removing it
maciejzelaszczyk Nov 18, 2022
c458f55
Merge remote-tracking branch 'origin/A0-1502-finality-version-e2e-tes…
maciejzelaszczyk Nov 18, 2022
5619520
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Nov 24, 2022
ae54e4a
Post-merge cleanup
maciejzelaszczyk Nov 24, 2022
1fea9b3
Back to storage; handle connection refactor
maciejzelaszczyk Nov 25, 2022
7962400
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Nov 25, 2022
6436acc
Codegen
maciejzelaszczyk Nov 25, 2022
c68e1e6
Bumped aleph-client version
maciejzelaszczyk Nov 25, 2022
9264f6b
Back to rpc call; prelims
maciejzelaszczyk Dec 7, 2022
cc4402c
Rpc interface
maciejzelaszczyk Dec 8, 2022
9684b89
Rpc
maciejzelaszczyk Dec 8, 2022
de89096
Link with node
maciejzelaszczyk Dec 8, 2022
52c0acb
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Dec 14, 2022
706a609
Rpc request; cleanup
maciejzelaszczyk Dec 15, 2022
58e433f
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Dec 16, 2022
b4eaddd
Partial fix
maciejzelaszczyk Dec 20, 2022
17f1873
Fixed RPC params
maciejzelaszczyk Dec 22, 2022
eb75a28
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Dec 22, 2022
eb196a1
Versioning
maciejzelaszczyk Dec 22, 2022
ab2eb0c
Linter
maciejzelaszczyk Dec 22, 2022
19fa8bb
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Jan 2, 2023
9c89347
Default version fix
maciejzelaszczyk Jan 2, 2023
d01c867
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Jan 2, 2023
0366d36
E2e test version bump
maciejzelaszczyk Jan 2, 2023
c5ebb3a
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Jan 3, 2023
ec49ef6
Interface reorg
maciejzelaszczyk Jan 3, 2023
c566cf3
Linter
maciejzelaszczyk Jan 3, 2023
cc79f26
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Jan 16, 2023
495aa47
Connection fixes; pipelines
maciejzelaszczyk Jan 16, 2023
1b78913
Linter
maciejzelaszczyk Jan 16, 2023
2887104
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Jan 17, 2023
0ec093c
Finality version set in chain spec
maciejzelaszczyk Jan 17, 2023
4b14085
Subxt codegen
maciejzelaszczyk Jan 17, 2023
125fb64
E2e test fix
maciejzelaszczyk Jan 17, 2023
dc86c13
Runtime metadata for aleph-client
maciejzelaszczyk Jan 17, 2023
e85eff2
Hide doc warnings
maciejzelaszczyk Jan 17, 2023
d5b57b9
Removed hide docs
maciejzelaszczyk Jan 17, 2023
b2bb910
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Jan 18, 2023
41972b4
Actually check the version change
maciejzelaszczyk Jan 19, 2023
d620d40
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Jan 19, 2023
984c4d2
Subxt metadata
maciejzelaszczyk Jan 19, 2023
e84635b
Linter cleanup
maciejzelaszczyk Jan 19, 2023
017c5eb
Merge branch 'main' into A0-1502-finality-version-e2e-test
maciejzelaszczyk Jan 31, 2023
f38f8eb
Const reorg
maciejzelaszczyk Jan 31, 2023
30046a5
Current finality version calculated based on the legacy one
maciejzelaszczyk Jan 31, 2023
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
3 changes: 3 additions & 0 deletions .github/scripts/run_consensus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ OVERRIDE_DOCKER_COMPOSE=${OVERRIDE_DOCKER_COMPOSE:-""}
# default minimum validator count
MIN_VALIDATOR_COUNT=4

# default minimum validator count
MIN_VALIDATOR_COUNT=4
DamianStraszak marked this conversation as resolved.
Show resolved Hide resolved

export NODE_IMAGE=aleph-node:latest

mkdir -p docker/data/
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/e2e-tests-main-devnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,21 @@ jobs:
run: |
./scripts/catchup_version_upgrade_test.sh

run-e2e-finality-version-change:
needs: [build-test-docker, build-test-client]
name: Run finality version change test
runs-on: ubuntu-20.04
steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Run e2e test
uses: ./.github/actions/run-e2e-test
with:
test-case: finality_version_change
follow-up-finalization-check: true
timeout-minutes: 10

check-e2e-test-suite-completion:
needs: [
run-e2e-finalization-test,
Expand Down Expand Up @@ -642,6 +657,7 @@ jobs:
run-e2e-version-upgrade,
run-e2e-failing-version-upgrade,
run-e2e-version-upgrade-catchup,
run-e2e-finality-version-change,
timorl marked this conversation as resolved.
Show resolved Hide resolved
]
name: Check e2e test suite completion
runs-on: ubuntu-20.04
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion aleph-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aleph_client"
version = "2.2.0"
version = "2.3.0"
edition = "2021"
license = "Apache 2.0"

Expand Down
26 changes: 23 additions & 3 deletions aleph-client/src/aleph_zero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6386,6 +6386,26 @@ pub mod api {
],
)
}
#[doc = " Next session finality version."]
pub fn next_session_finality_version(
&self,
) -> ::subxt::storage::address::StaticStorageAddress<
::subxt::metadata::DecodeStaticType<::core::primitive::u32>,
::subxt::storage::address::Yes,
::subxt::storage::address::Yes,
(),
> {
::subxt::storage::address::StaticStorageAddress::new(
"Aleph",
"NextSessionFinalityVersion",
vec![],
[
160u8, 211u8, 96u8, 130u8, 62u8, 24u8, 39u8, 81u8, 35u8, 251u8, 54u8,
64u8, 148u8, 207u8, 140u8, 56u8, 1u8, 57u8, 20u8, 148u8, 54u8, 152u8,
137u8, 146u8, 207u8, 116u8, 160u8, 50u8, 178u8, 126u8, 207u8, 117u8,
],
)
}
#[doc = " Scheduled finality version change."]
pub fn finality_scheduled_version_change(
&self,
Expand Down Expand Up @@ -19418,9 +19438,9 @@ pub mod api {
let runtime_metadata_hash = client.metadata().metadata_hash(&PALLETS);
if runtime_metadata_hash
!= [
243u8, 4u8, 194u8, 236u8, 110u8, 103u8, 34u8, 147u8, 254u8, 117u8, 205u8, 237u8,
68u8, 20u8, 176u8, 209u8, 157u8, 106u8, 80u8, 136u8, 50u8, 186u8, 119u8, 248u8,
34u8, 65u8, 187u8, 187u8, 110u8, 81u8, 88u8, 22u8,
248u8, 246u8, 131u8, 72u8, 246u8, 127u8, 112u8, 242u8, 195u8, 249u8, 99u8, 217u8,
184u8, 235u8, 164u8, 100u8, 197u8, 133u8, 225u8, 3u8, 228u8, 60u8, 163u8, 20u8,
13u8, 159u8, 133u8, 146u8, 64u8, 89u8, 20u8, 39u8,
]
{
Err(::subxt::error::MetadataError::IncompatibleMetadata)
Expand Down
25 changes: 24 additions & 1 deletion aleph-client/src/pallets/aleph.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use codec::Encode;
use primitives::{BlockNumber, SessionIndex};
use primitives::{BlockNumber, SessionIndex, Version};
use subxt::rpc_params;

use crate::{
api,
api::runtime_types::{
pallet_aleph::pallet::Call::set_emergency_finalizer, primitives::app::Public,
sp_core::ed25519::Public as EdPublic,
Expand All @@ -13,6 +14,13 @@ use crate::{
Connection, Pair, RootConnection, SudoCall, TxStatus,
};

#[async_trait::async_trait]
pub trait AlephApi {
async fn finality_version(&self, at: Option<BlockHash>) -> Version;

async fn next_session_finality_version(&self, at: Option<BlockHash>) -> Version;
}

#[async_trait::async_trait]
pub trait AlephSudoApi {
async fn set_emergency_finalizer(
Expand All @@ -39,6 +47,21 @@ pub trait AlephRpc {
) -> anyhow::Result<()>;
}

#[async_trait::async_trait]
impl AlephApi for Connection {
async fn finality_version(&self, at: Option<BlockHash>) -> Version {
let addrs = api::storage().aleph().finality_version();

self.get_storage_entry(&addrs, at).await
}

async fn next_session_finality_version(&self, at: Option<BlockHash>) -> Version {
let addrs = api::storage().aleph().next_session_finality_version();

self.get_storage_entry(&addrs, at).await
}
}

#[async_trait::async_trait]
impl AlephSudoApi for RootConnection {
async fn set_emergency_finalizer(
Expand Down
8 changes: 6 additions & 2 deletions bin/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ use aleph_primitives::{
AuthorityId as AlephId, ADDRESSES_ENCODING, TOKEN, TOKEN_DECIMALS,
};
use aleph_runtime::{
AccountId, AuraConfig, BalancesConfig, ElectionsConfig, GenesisConfig, Perbill, SessionConfig,
SessionKeys, StakingConfig, SudoConfig, SystemConfig, VestingConfig, WASM_BINARY,
AccountId, AlephConfig, AuraConfig, BalancesConfig, ElectionsConfig, GenesisConfig, Perbill,
SessionConfig, SessionKeys, StakingConfig, SudoConfig, SystemConfig, VestingConfig,
WASM_BINARY,
};
use clap::Args;
use libp2p::PeerId;
Expand Down Expand Up @@ -395,6 +396,9 @@ fn generate_genesis_config(
min_nominator_bond: MIN_NOMINATOR_BOND,
..Default::default()
},
aleph: AlephConfig {
..Default::default()
},
treasury: Default::default(),
vesting: VestingConfig { vesting: vec![] },
nomination_pools: Default::default(),
Expand Down
1 change: 1 addition & 0 deletions bin/node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ where
C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: aleph_primitives::AlephSessionApi<Block>,
C::Api: BlockBuilder<Block>,
P: TransactionPool + 'static,
B: BlockT,
Expand Down
2 changes: 1 addition & 1 deletion bin/runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aleph-runtime"
version = "0.8.2"
version = "0.9.0"
authors = ["Cardinal Cryptography"]
edition = "2021"
homepage = "https://alephzero.org"
Expand Down
2 changes: 1 addition & 1 deletion bin/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("aleph-node"),
impl_name: create_runtime_str!("aleph-node"),
authoring_version: 1,
spec_version: 41,
spec_version: 42,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 13,
Expand Down
3 changes: 2 additions & 1 deletion e2e-tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aleph-e2e-client"
version = "0.9.2"
version = "0.10.0"
edition = "2021"
license = "Apache 2.0"

Expand Down
5 changes: 4 additions & 1 deletion e2e-tests/src/cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use crate::{
channeling_fee_and_tip as test_channeling_fee_and_tip,
clearing_session_count as test_clearing_session_count, disable_node as test_disable_node,
era_payouts_calculated_correctly as test_era_payout, era_validators as test_era_validators,
fee_calculation as test_fee_calculation, finalization as test_finalization,
fee_calculation as test_fee_calculation,
finality_version_change as test_finality_version_change, finalization as test_finalization,
force_new_era as test_force_new_era, points_basic as test_points_basic,
points_stake_change as test_points_stake_change,
schedule_doomed_version_change_and_verify_finalization_stopped as test_schedule_doomed_version_change_and_verify_finalization_stopped,
Expand Down Expand Up @@ -51,6 +52,7 @@ pub async fn run_testcase(id: &str, config: &Config) -> anyhow::Result<()> {
"doomed_version_upgrade" => {
test_schedule_doomed_version_change_and_verify_finalization_stopped(config).await
}
"finality_version_change" => test_finality_version_change(config).await,
_ => panic!("unknown testcase"),
}
}
Expand Down Expand Up @@ -81,6 +83,7 @@ pub async fn run_all_testcases(config: &Config) -> anyhow::Result<()> {
"ban_manual",
"ban_threshold",
"doomed_version_upgrade",
"finality_version_change",
];

for testcase in all {
Expand Down
31 changes: 31 additions & 0 deletions e2e-tests/src/finality_version.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use aleph_client::{pallets::aleph::AlephApi, utility::BlocksApi, Connection};
use log::info;
use primitives::{BlockNumber, Version};

pub async fn check_finality_version_at_block(
connection: &Connection,
block_number: BlockNumber,
expected_version: Version,
) {
info!(
"Checking current session finality version for block {}",
block_number
);
let block_hash = connection.get_block_hash(block_number).await;
let finality_version = connection.finality_version(block_hash).await;
assert_eq!(finality_version, expected_version);
}

pub async fn check_next_session_finality_version_at_block(
connection: &Connection,
block_number: BlockNumber,
expected_version: Version,
) {
info!(
"Checking next session finality version for block {}",
block_number
);
let block_hash = connection.get_block_hash(block_number).await;
let next_finality_version = connection.next_session_finality_version(block_hash).await;
assert_eq!(next_finality_version, expected_version);
}
1 change: 1 addition & 0 deletions e2e-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mod ban;
mod cases;
mod config;
mod elections;
mod finality_version;
mod rewards;
mod test;
mod transfer;
Expand Down
Loading