Skip to content

Commit 51ef955

Browse files
committed
Merge branch 'david/eip-7702' of github.com:polytope-labs/polkadot-sdk into david/eip-7702
2 parents 8f515fb + 4fd8d79 commit 51ef955

File tree

82 files changed

+2149
-227
lines changed

Some content is hidden

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

82 files changed

+2149
-227
lines changed

.github/workflows/release-70_combined-publish-release.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ jobs:
106106
version: ${{ inputs.version }}
107107
stable_tag: ${{ needs.promote-rc-to-final.outputs.final_tag }}
108108
secrets: inherit
109+
permissions:
110+
contents: write
109111

110112
publish-docker-polkadot-parachain:
111113
name: Publish Docker image - polkadot-parachain
@@ -121,6 +123,8 @@ jobs:
121123
version: ${{ inputs.version }}
122124
stable_tag: ${{ needs.promote-rc-to-final.outputs.final_tag }}
123125
secrets: inherit
126+
permissions:
127+
contents: write
124128

125129
publish-docker-polkadot-omni-node:
126130
name: Publish Docker image - polkadot-omni-node
@@ -136,6 +140,8 @@ jobs:
136140
version: ${{ inputs.version }}
137141
stable_tag: ${{ needs.promote-rc-to-final.outputs.final_tag }}
138142
secrets: inherit
143+
permissions:
144+
contents: write
139145

140146
publish-docker-chain-spec-builder:
141147
name: Publish Docker image - chain-spec-builder
@@ -151,3 +157,5 @@ jobs:
151157
version: ${{ inputs.version }}
152158
stable_tag: ${{ needs.promote-rc-to-final.outputs.final_tag }}
153159
secrets: inherit
160+
permissions:
161+
contents: write

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/client/service/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ use sc_network::{
4343
};
4444
use sc_network_sync::SyncingService;
4545
use sc_network_transactions::TransactionsHandlerController;
46-
use sc_service::{Configuration, SpawnTaskHandle, TaskManager, WarpSyncConfig};
46+
use sc_service::{
47+
Configuration, SpawnEssentialTaskHandle, SpawnTaskHandle, TaskManager, WarpSyncConfig,
48+
};
4749
use sc_telemetry::{log, TelemetryWorkerHandle};
4850
use sc_tracing::block::TracingExecuteBlock;
4951
use sc_utils::mpsc::TracingUnboundedSender;
@@ -291,6 +293,7 @@ pub struct BuildNetworkParams<
291293
pub para_id: ParaId,
292294
pub relay_chain_interface: RCInterface,
293295
pub spawn_handle: SpawnTaskHandle,
296+
pub spawn_essential_handle: SpawnEssentialTaskHandle,
294297
pub import_queue: IQ,
295298
pub sybil_resistance_level: CollatorSybilResistance,
296299
pub metrics: sc_network::NotificationMetrics,
@@ -305,6 +308,7 @@ pub async fn build_network<'a, Block, Client, RCInterface, IQ, Network>(
305308
transaction_pool,
306309
para_id,
307310
spawn_handle,
311+
spawn_essential_handle,
308312
relay_chain_interface,
309313
import_queue,
310314
sybil_resistance_level,
@@ -374,6 +378,7 @@ where
374378
client,
375379
transaction_pool,
376380
spawn_handle,
381+
spawn_essential_handle,
377382
import_queue,
378383
block_announce_validator_builder: Some(Box::new(move |_| block_announce_validator)),
379384
warp_sync_config,

cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
147147
spec_name: alloc::borrow::Cow::Borrowed("westmint"),
148148
impl_name: alloc::borrow::Cow::Borrowed("westmint"),
149149
authoring_version: 1,
150-
spec_version: 1_021_001,
150+
spec_version: 1_021_002,
151151
impl_version: 0,
152152
apis: RUNTIME_API_VERSIONS,
153153
transaction_version: 16,

cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
244244
spec_name: alloc::borrow::Cow::Borrowed("bridge-hub-westend"),
245245
impl_name: alloc::borrow::Cow::Borrowed("bridge-hub-westend"),
246246
authoring_version: 1,
247-
spec_version: 1_021_000,
247+
spec_version: 1_021_001,
248248
impl_version: 0,
249249
apis: RUNTIME_API_VERSIONS,
250250
transaction_version: 6,

cumulus/polkadot-omni-node/lib/src/common/spec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ pub(crate) trait NodeSpec: BaseNodeSpec {
394394
transaction_pool: transaction_pool.clone(),
395395
para_id,
396396
spawn_handle: task_manager.spawn_handle(),
397+
spawn_essential_handle: task_manager.spawn_essential_handle(),
397398
relay_chain_interface: relay_chain_interface.clone(),
398399
import_queue: params.import_queue,
399400
sybil_resistance_level: Self::SYBIL_RESISTANCE,

0 commit comments

Comments
 (0)