diff --git a/core/primitives-core/src/version.rs b/core/primitives-core/src/version.rs index ba2ae301950..7aa665683f7 100644 --- a/core/primitives-core/src/version.rs +++ b/core/primitives-core/src/version.rs @@ -188,6 +188,9 @@ impl ProtocolFeature { ProtocolFeature::RestrictTla | ProtocolFeature::TestnetFewerBlockProducers | ProtocolFeature::SimpleNightshadeV2 => 64, + // The SimpleNightshadeV3 should not be enabled in statelessnet. + // TODO(resharding) clean up after stake wars is over. + #[cfg(not(feature = "statelessnet_protocol"))] ProtocolFeature::SimpleNightshadeV3 => 65, // StatelessNet features @@ -206,6 +209,8 @@ impl ProtocolFeature { ProtocolFeature::EthImplicitAccounts => 138, #[cfg(feature = "protocol_feature_nonrefundable_transfer_nep491")] ProtocolFeature::NonRefundableBalance => 140, + #[cfg(feature = "statelessnet_protocol")] + ProtocolFeature::SimpleNightshadeV3 => 141, } } } diff --git a/integration-tests/src/tests/client/resharding.rs b/integration-tests/src/tests/client/resharding.rs index 728f76a6523..045f7e5e4db 100644 --- a/integration-tests/src/tests/client/resharding.rs +++ b/integration-tests/src/tests/client/resharding.rs @@ -42,6 +42,7 @@ const SIMPLE_NIGHTSHADE_PROTOCOL_VERSION: ProtocolVersion = const SIMPLE_NIGHTSHADE_V2_PROTOCOL_VERSION: ProtocolVersion = ProtocolFeature::SimpleNightshadeV2.protocol_version(); +#[cfg(not(feature = "statelessnet_protocol"))] const SIMPLE_NIGHTSHADE_V3_PROTOCOL_VERSION: ProtocolVersion = ProtocolFeature::SimpleNightshadeV3.protocol_version(); @@ -54,6 +55,7 @@ enum ReshardingType { // In the V1->V2 resharding outgoing receipts are reassigned to lowest index child. V2, // In the V2->V3 resharding outgoing receipts are reassigned to lowest index child. + #[cfg(not(feature = "statelessnet_protocol"))] V3, } @@ -61,6 +63,7 @@ fn get_target_protocol_version(resharding_type: &ReshardingType) -> ProtocolVers match resharding_type { ReshardingType::V1 => SIMPLE_NIGHTSHADE_PROTOCOL_VERSION, ReshardingType::V2 => SIMPLE_NIGHTSHADE_V2_PROTOCOL_VERSION, + #[cfg(not(feature = "statelessnet_protocol"))] ReshardingType::V3 => SIMPLE_NIGHTSHADE_V3_PROTOCOL_VERSION, } } @@ -69,6 +72,7 @@ fn get_genesis_protocol_version(resharding_type: &ReshardingType) -> ProtocolVer match resharding_type { ReshardingType::V1 => SIMPLE_NIGHTSHADE_PROTOCOL_VERSION - 1, ReshardingType::V2 => SIMPLE_NIGHTSHADE_V2_PROTOCOL_VERSION - 1, + #[cfg(not(feature = "statelessnet_protocol"))] ReshardingType::V3 => SIMPLE_NIGHTSHADE_V3_PROTOCOL_VERSION - 1, } } @@ -77,6 +81,7 @@ fn get_parent_shard_uids(resharding_type: &ReshardingType) -> Vec { let shard_layout = match resharding_type { ReshardingType::V1 => ShardLayout::v0_single_shard(), ReshardingType::V2 => ShardLayout::get_simple_nightshade_layout(), + #[cfg(not(feature = "statelessnet_protocol"))] ReshardingType::V3 => ShardLayout::get_simple_nightshade_layout_v2(), }; shard_layout.shard_uids().collect() @@ -92,12 +97,14 @@ fn get_expected_shards_num( match resharding_type { ReshardingType::V1 => 1, ReshardingType::V2 => 4, + #[cfg(not(feature = "statelessnet_protocol"))] ReshardingType::V3 => 5, } } else { match resharding_type { ReshardingType::V1 => 4, ReshardingType::V2 => 5, + #[cfg(not(feature = "statelessnet_protocol"))] ReshardingType::V3 => 6, } } @@ -800,6 +807,7 @@ fn check_outgoing_receipts_reassigned_impl( assert!(outgoing_receipts.is_empty()); } } + #[cfg(not(feature = "statelessnet_protocol"))] ReshardingType::V3 => { // In V2->V3 resharding the outgoing receipts should be reassigned // to the lowest index child of the parent shard. @@ -1039,16 +1047,19 @@ fn test_shard_layout_upgrade_simple_v2_seed_44() { test_shard_layout_upgrade_simple_impl(ReshardingType::V2, 44, false); } +#[cfg(not(feature = "statelessnet_protocol"))] #[test] fn test_shard_layout_upgrade_simple_v3_seed_42() { test_shard_layout_upgrade_simple_impl(ReshardingType::V3, 42, false); } +#[cfg(not(feature = "statelessnet_protocol"))] #[test] fn test_shard_layout_upgrade_simple_v3_seed_43() { test_shard_layout_upgrade_simple_impl(ReshardingType::V3, 43, false); } +#[cfg(not(feature = "statelessnet_protocol"))] #[test] fn test_shard_layout_upgrade_simple_v3_seed_44() { test_shard_layout_upgrade_simple_impl(ReshardingType::V3, 44, false); @@ -1093,6 +1104,7 @@ fn test_resharding_with_different_db_kind_v2() { test_resharding_with_different_db_kind_impl(ReshardingType::V2); } +#[cfg(not(feature = "statelessnet_protocol"))] #[test] fn test_resharding_with_different_db_kind_v3() { test_resharding_with_different_db_kind_impl(ReshardingType::V3); @@ -1146,6 +1158,7 @@ fn test_shard_layout_upgrade_gc_v2() { test_shard_layout_upgrade_gc_impl(ReshardingType::V2, 44); } +#[cfg(not(feature = "statelessnet_protocol"))] #[test] fn test_shard_layout_upgrade_gc_v3() { test_shard_layout_upgrade_gc_impl(ReshardingType::V3, 44); @@ -1427,6 +1440,7 @@ fn test_shard_layout_upgrade_cross_contract_calls_v2_seed_42() { // Test cross contract calls // This test case tests postponed receipts and delayed receipts +#[cfg(not(feature = "statelessnet_protocol"))] #[test] fn test_shard_layout_upgrade_cross_contract_calls_v2_seed_43() { test_shard_layout_upgrade_cross_contract_calls_impl(ReshardingType::V2, 43); @@ -1442,6 +1456,7 @@ fn test_shard_layout_upgrade_cross_contract_calls_v2_seed_44() { // Test cross contract calls // This test case tests postponed receipts and delayed receipts #[test] +#[cfg(not(feature = "statelessnet_protocol"))] fn test_shard_layout_upgrade_cross_contract_calls_v3_seed_42() { test_shard_layout_upgrade_cross_contract_calls_impl(ReshardingType::V3, 42); } @@ -1449,6 +1464,7 @@ fn test_shard_layout_upgrade_cross_contract_calls_v3_seed_42() { // Test cross contract calls // This test case tests postponed receipts and delayed receipts #[test] +#[cfg(not(feature = "statelessnet_protocol"))] fn test_shard_layout_upgrade_cross_contract_calls_v3_seed_43() { test_shard_layout_upgrade_cross_contract_calls_impl(ReshardingType::V3, 43); } @@ -1456,6 +1472,7 @@ fn test_shard_layout_upgrade_cross_contract_calls_v3_seed_43() { // Test cross contract calls // This test case tests postponed receipts and delayed receipts #[test] +#[cfg(not(feature = "statelessnet_protocol"))] fn test_shard_layout_upgrade_cross_contract_calls_v3_seed_44() { test_shard_layout_upgrade_cross_contract_calls_impl(ReshardingType::V3, 44); } @@ -1530,16 +1547,19 @@ fn test_shard_layout_upgrade_incoming_receipts_v2_seed_44() { test_shard_layout_upgrade_incoming_receipts_impl(ReshardingType::V2, 44); } +#[cfg(not(feature = "statelessnet_protocol"))] #[test] fn test_shard_layout_upgrade_incoming_receipts_v3_seed_42() { test_shard_layout_upgrade_incoming_receipts_impl(ReshardingType::V3, 42); } +#[cfg(not(feature = "statelessnet_protocol"))] #[test] fn test_shard_layout_upgrade_incoming_receipts_v3_seed_43() { test_shard_layout_upgrade_incoming_receipts_impl(ReshardingType::V3, 43); } +#[cfg(not(feature = "statelessnet_protocol"))] #[test] fn test_shard_layout_upgrade_incoming_receipts_v3_seed_44() { test_shard_layout_upgrade_incoming_receipts_impl(ReshardingType::V3, 44); @@ -1694,16 +1714,19 @@ fn test_shard_layout_upgrade_missing_chunks_high_missing_prob_v2_seed_44() { // V3 tests +#[cfg(not(feature = "statelessnet_protocol"))] #[test] fn test_shard_layout_upgrade_missing_chunks_low_missing_prob_v3() { test_shard_layout_upgrade_missing_chunks(ReshardingType::V3, 0.1, 42); } +#[cfg(not(feature = "statelessnet_protocol"))] #[test] fn test_shard_layout_upgrade_missing_chunks_mid_missing_prob_v3() { test_shard_layout_upgrade_missing_chunks(ReshardingType::V3, 0.5, 42); } +#[cfg(not(feature = "statelessnet_protocol"))] #[test] fn test_shard_layout_upgrade_missing_chunks_high_missing_prob_v3() { test_shard_layout_upgrade_missing_chunks(ReshardingType::V3, 0.9, 42); @@ -1811,6 +1834,7 @@ fn test_shard_layout_upgrade_error_handling_v2() { test_shard_layout_upgrade_error_handling_impl(ReshardingType::V2, 42, false); } +#[cfg(not(feature = "statelessnet_protocol"))] #[test] fn test_shard_layout_upgrade_error_handling_v3() { test_shard_layout_upgrade_error_handling_impl(ReshardingType::V3, 42, false);