Skip to content

Commit f9f63cc

Browse files
committed
Merge remote-tracking branch 'origin/master' into sistemd/basti-feedback
2 parents 29ab636 + 51d25de commit f9f63cc

File tree

106 files changed

+5392
-287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+5392
-287
lines changed

.github/workflows/release-60_post-crates-release-activities.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ jobs:
200200
# Show git diff to see what changed
201201
git diff --stat
202202
203+
- name: Install newer Zepter
204+
run: |
205+
cargo install [email protected] --locked -q && zepter --version
206+
203207
- name: Run Zepter - check issues
204208
run: |
205209
echo "Running zepter run check to identify issues..."
@@ -296,9 +300,6 @@ jobs:
296300
BASE_RELEASE="$FULL_RELEASE"
297301
fi
298302
299-
BASE_RELEASE_UPPER=$(echo "$BASE_RELEASE" | tr '[:lower:]' '[:upper:]')
300-
echo "Base release branch (upper): $BASE_RELEASE_UPPER"
301-
302303
# Check if PR already exists
303304
EXISTING_PR=$(gh pr list --head "$BRANCH_NAME" --base "$BASE_RELEASE" --json number --jq '.[0].number')
304305
@@ -308,7 +309,7 @@ jobs:
308309
else
309310
echo "Creating PR from $BRANCH_NAME to $BASE_RELEASE..."
310311
gh pr create \
311-
--title "[${BASE_RELEASE_UPPER}] Post crates release activities for $FULL_RELEASE" \
312+
--title "[${BASE_RELEASE}] Post crates release activities for $FULL_RELEASE" \
312313
--body "Automated PR containing post-crates-release activities:
313314
- NODE_VERSION bumps (if selected)
314315
- Path dependencies replacement

Cargo.lock

Lines changed: 21 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ linked-hash-map = { version = "0.5.4" }
899899
linked_hash_set = { version = "0.1.4" }
900900
linregress = { version = "0.5.1" }
901901
lite-json = { version = "0.2.0", default-features = false }
902-
litep2p = { version = "0.12.3", features = ["rsa", "websocket"] }
902+
litep2p = { version = "0.13.0", features = ["rsa", "websocket"] }
903903
log = { version = "0.4.22", default-features = false }
904904
macro_magic = { version = "0.5.1" }
905905
maplit = { version = "1.0.2" }

bridges/snowbridge/pallets/ethereum-client/src/config/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub const MAX_FEE_RECIPIENT_SIZE: usize = 20;
1414
pub const MAX_BRANCH_PROOF_SIZE: usize = 20;
1515

1616
/// DomainType('0x07000000')
17-
/// <https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/beacon-chain.md#domain-types>
17+
/// <https://github.com/ethereum/consensus-specs/blob/master/specs/altair/beacon-chain.md#domains>
1818
pub const DOMAIN_SYNC_COMMITTEE: [u8; 4] = [7, 0, 0, 0];
1919
/// Validators public keys are 48 bytes.
2020
pub const PUBKEY_SIZE: usize = 48;

bridges/snowbridge/pallets/ethereum-client/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ pub mod pallet {
460460
Ok(())
461461
}
462462

463-
/// Reference and strictly follows <https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/sync-protocol.md#apply_light_client_update
463+
/// Reference and strictly follows <https://github.com/ethereum/consensus-specs/blob/master/specs/altair/light-client/sync-protocol.md#apply_light_client_update>
464464
/// Applies a finalized beacon header update to the beacon client. If a next sync committee
465465
/// is present in the update, verify the sync committee by converting it to a
466466
/// SyncCommitteePrepared type. Stores the provided finalized header. Updates are free
@@ -675,8 +675,11 @@ pub mod pallet {
675675
validators_root: H256,
676676
signature_slot: u64,
677677
) -> Result<H256, DispatchError> {
678+
// Per Ethereum Altair light-client spec, fork version is derived from signature_slot -
679+
// 1. See: https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/sync-protocol.md#validate_light_client_update
680+
// In validate_light_client_update: fork_version_slot = max(signature_slot, 1) - 1
678681
let fork_version = Self::compute_fork_version(compute_epoch(
679-
signature_slot,
682+
signature_slot.saturating_sub(1),
680683
config::SLOTS_PER_EPOCH as u64,
681684
));
682685
let domain_type = config::DOMAIN_SYNC_COMMITTEE.to_vec();

bridges/snowbridge/pallets/ethereum-client/src/tests.rs

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
pub use crate::mock::*;
44
use crate::{
55
config::{EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT},
6-
functions::compute_period,
6+
functions::{compute_epoch, compute_period},
77
mock::{
88
get_message_verification_payload, load_checkpoint_update_fixture,
99
load_finalized_header_update_fixture, load_next_finalized_header_update_fixture,
@@ -974,3 +974,83 @@ fn verify_message_invalid_topic() {
974974
);
975975
});
976976
}
977+
978+
#[test]
979+
fn signing_root_uses_previous_slot_for_fork_version() {
980+
new_tester().execute_with(|| {
981+
// Use a signature_slot at a fork boundary (first slot of the fulu epoch).
982+
// In mock.rs: electra.epoch = 0, fulu.epoch = 100000000
983+
let fulu_epoch = ChainForkVersions::get().fulu.epoch;
984+
let signature_slot: u64 = fulu_epoch * (SLOTS_PER_EPOCH as u64);
985+
986+
// Verify this is the first slot of the epoch
987+
assert_eq!(signature_slot % (SLOTS_PER_EPOCH as u64), 0);
988+
989+
let header = BeaconHeader {
990+
slot: signature_slot - 1,
991+
proposer_index: 0,
992+
parent_root: H256::repeat_byte(0x11),
993+
state_root: H256::repeat_byte(0x22),
994+
body_root: H256::repeat_byte(0x33),
995+
};
996+
997+
let validators_root = H256::repeat_byte(0x44);
998+
999+
// Get fork versions for comparison
1000+
let fork_version_at_signature_slot = EthereumBeaconClient::compute_fork_version(
1001+
compute_epoch(signature_slot, SLOTS_PER_EPOCH as u64),
1002+
);
1003+
let fork_version_at_previous_slot = EthereumBeaconClient::compute_fork_version(
1004+
compute_epoch(signature_slot.saturating_sub(1), SLOTS_PER_EPOCH as u64),
1005+
);
1006+
1007+
// At the fork boundary, these should differ
1008+
assert_ne!(
1009+
fork_version_at_signature_slot, fork_version_at_previous_slot,
1010+
"Test setup error: fork versions should differ at fork boundary"
1011+
);
1012+
1013+
// Compute signing roots using both fork versions
1014+
let domain_type = crate::config::DOMAIN_SYNC_COMMITTEE.to_vec();
1015+
1016+
let domain_with_previous_slot = EthereumBeaconClient::compute_domain(
1017+
domain_type.clone(),
1018+
fork_version_at_previous_slot,
1019+
validators_root,
1020+
)
1021+
.unwrap();
1022+
1023+
let signing_root_with_previous_slot =
1024+
EthereumBeaconClient::compute_signing_root(&header, domain_with_previous_slot).unwrap();
1025+
1026+
// The pallet's signing_root should use the previous slot's fork version (per spec)
1027+
let pallet_signing_root =
1028+
EthereumBeaconClient::signing_root(&header, validators_root, signature_slot).unwrap();
1029+
1030+
assert_eq!(
1031+
pallet_signing_root, signing_root_with_previous_slot,
1032+
"signing_root should use fork version from signature_slot - 1"
1033+
);
1034+
});
1035+
}
1036+
1037+
#[test]
1038+
fn signing_root_handles_signature_slot_zero() {
1039+
// Per spec: fork_version_slot = max(signature_slot, 1) - 1
1040+
// When signature_slot = 0, saturating_sub(1) = 0, which matches max(0, 1) - 1 = 0
1041+
new_tester().execute_with(|| {
1042+
let header = BeaconHeader {
1043+
slot: 0,
1044+
proposer_index: 0,
1045+
parent_root: H256::repeat_byte(0x11),
1046+
state_root: H256::repeat_byte(0x22),
1047+
body_root: H256::repeat_byte(0x33),
1048+
};
1049+
1050+
let validators_root = H256::repeat_byte(0x44);
1051+
1052+
// Should not panic and should use epoch 0 fork version
1053+
let result = EthereumBeaconClient::signing_root(&header, validators_root, 0);
1054+
assert!(result.is_ok(), "signing_root should handle signature_slot = 0");
1055+
});
1056+
}

bridges/snowbridge/primitives/beacon/src/merkle_proof.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use sp_core::H256;
44
use sp_io::hashing::sha2_256;
55

66
/// Specified by <https://github.com/ethereum/consensus-specs/blob/fe9c1a8cbf0c2da8a4f349efdcd77dd7ac8445c4/specs/phase0/beacon-chain.md?plain=1#L742>
7-
/// with improvements from <https://github.com/ethereum/consensus-specs/blob/dev/ssz/merkle-proofs.md>
7+
/// with improvements from <https://github.com/ethereum/consensus-specs/blob/master/ssz/merkle-proofs.md>
88
pub fn verify_merkle_branch(
99
leaf: H256,
1010
branch: &[H256],

bridges/snowbridge/primitives/beacon/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ pub mod deneb {
600600
use sp_std::prelude::*;
601601

602602
/// ExecutionPayloadHeader
603-
/// <https://github.com/ethereum/consensus-specs/blob/dev/specs/deneb/beacon-chain.md#executionpayloadheader>
603+
/// <https://github.com/ethereum/consensus-specs/blob/master/specs/deneb/beacon-chain.md#executionpayloadheader>
604604
#[derive(
605605
Default,
606606
Encode,

cumulus/pallets/parachain-system/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,11 @@ impl<T: Config> Pallet<T> {
11181118
fn messages_collection_size_limit() -> usize {
11191119
let max_block_weight = <T as frame_system::Config>::BlockWeights::get().max_block;
11201120
let max_block_pov = max_block_weight.proof_size();
1121-
(max_block_pov / 6).saturated_into()
1121+
1122+
let remaining_proof_size =
1123+
frame_system::Pallet::<T>::remaining_block_weight().remaining().proof_size();
1124+
1125+
(max_block_pov / 6).min(remaining_proof_size).saturated_into()
11221126
}
11231127

11241128
/// Updates inherent data to only include the messages that weren't already processed

cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pallet-scheduler = { workspace = true }
6363
pallet-session = { workspace = true }
6464
pallet-staking = { workspace = true }
6565
pallet-staking-async = { workspace = true }
66-
pallet-staking-async-rc-client = { workspace = true }
66+
pallet-staking-async-rc-client = { workspace = true, features = ["xcm-sender"] }
6767
pallet-staking-runtime-api = { workspace = true }
6868
pallet-state-trie-migration = { workspace = true }
6969
pallet-sudo = { workspace = true }
@@ -94,6 +94,12 @@ sp-storage = { workspace = true }
9494
sp-transaction-pool = { workspace = true }
9595
sp-version = { workspace = true }
9696

97+
# Consensus primitives for Relay Chain SessionKeys validation
98+
sp-authority-discovery = { workspace = true }
99+
sp-consensus-babe = { workspace = true }
100+
sp-consensus-beefy = { workspace = true }
101+
sp-consensus-grandpa = { workspace = true }
102+
97103
# num-traits feature needed for dex integer sq root:
98104
primitive-types = { features = ["codec", "num-traits", "scale-info"], workspace = true }
99105

@@ -102,6 +108,7 @@ pallet-xcm = { workspace = true }
102108
pallet-xcm-benchmarks = { optional = true, workspace = true }
103109
pallet-xcm-precompiles = { workspace = true }
104110
polkadot-parachain-primitives = { workspace = true }
111+
polkadot-primitives = { workspace = true }
105112
polkadot-runtime-common = { workspace = true }
106113
westend-runtime-constants = { workspace = true }
107114
xcm = { workspace = true }
@@ -143,6 +150,7 @@ asset-test-utils = { workspace = true, default-features = true }
143150
pallet-revive-fixtures = { workspace = true, default-features = true }
144151
parachains-runtimes-test-utils = { workspace = true, default-features = true }
145152
sp-tracing = { workspace = true, default-features = true }
153+
westend-runtime = { workspace = true, default-features = true }
146154

147155
[build-dependencies]
148156
substrate-wasm-builder = { optional = true, workspace = true, default-features = true }
@@ -211,12 +219,14 @@ runtime-benchmarks = [
211219
"pallet-xcm/runtime-benchmarks",
212220
"parachains-common/runtime-benchmarks",
213221
"polkadot-parachain-primitives/runtime-benchmarks",
222+
"polkadot-primitives/runtime-benchmarks",
214223
"polkadot-runtime-common/runtime-benchmarks",
215224
"snowbridge-pallet-system-frontend/runtime-benchmarks",
216225
"snowbridge-runtime-common/runtime-benchmarks",
217226
"sp-runtime/runtime-benchmarks",
218227
"sp-staking/runtime-benchmarks",
219228
"westend-runtime-constants/runtime-benchmarks",
229+
"westend-runtime/runtime-benchmarks",
220230
"xcm-builder/runtime-benchmarks",
221231
"xcm-executor/runtime-benchmarks",
222232
"xcm-runtime-apis/runtime-benchmarks",
@@ -289,6 +299,7 @@ try-runtime = [
289299
"snowbridge-pallet-system-frontend/try-runtime",
290300
"snowbridge-runtime-common/try-runtime",
291301
"sp-runtime/try-runtime",
302+
"westend-runtime/try-runtime",
292303
]
293304
std = [
294305
"alloy-core/std",
@@ -373,6 +384,7 @@ std = [
373384
"parachain-info/std",
374385
"parachains-common/std",
375386
"polkadot-parachain-primitives/std",
387+
"polkadot-primitives/std",
376388
"polkadot-runtime-common/std",
377389
"primitive-types/std",
378390
"scale-info/std",
@@ -382,8 +394,12 @@ std = [
382394
"snowbridge-runtime-common/std",
383395
"sp-api/std",
384396
"sp-arithmetic/std",
397+
"sp-authority-discovery/std",
385398
"sp-block-builder/std",
386399
"sp-consensus-aura/std",
400+
"sp-consensus-babe/std",
401+
"sp-consensus-beefy/std",
402+
"sp-consensus-grandpa/std",
387403
"sp-core/std",
388404
"sp-genesis-builder/std",
389405
"sp-inherents/std",

0 commit comments

Comments
 (0)