Skip to content

Commit 09549c9

Browse files
authored
Merge pull request #737 from nazar-pc/update-rust-toolchain
Update Rust toolchain to the latest nightly
2 parents e63bf97 + 13d11bb commit 09549c9

24 files changed

Lines changed: 225 additions & 236 deletions

File tree

crates/execution/ab-riscv-act4-runner/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
generic_const_items,
99
inherent_associated_types,
1010
iter_array_chunks,
11+
macroless_generic_const_args,
1112
min_generic_const_args,
1213
signed_bigint_helpers,
1314
try_blocks

crates/execution/ab-riscv-interpreter/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
generic_const_items,
7171
inherent_associated_types,
7272
integer_widen_truncate,
73+
macroless_generic_const_args,
7374
min_generic_const_args,
7475
signed_bigint_helpers,
7576
widening_mul

crates/execution/ab-riscv-primitives/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
generic_const_args,
7777
generic_const_items,
7878
min_adt_const_params,
79+
macroless_generic_const_args,
7980
min_generic_const_args,
8081
never_type,
8182
stmt_expr_attributes,

crates/farmer/ab-proof-of-space-gpu/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
66
#![cfg_attr(target_arch = "spirv", no_std)]
77
#![feature(step_trait)]
8-
#![cfg_attr(not(target_arch = "spirv"), feature(iter_array_chunks, portable_simd))]
8+
#![cfg_attr(
9+
not(target_arch = "spirv"),
10+
feature(iter_array_chunks, macroless_generic_const_args, portable_simd)
11+
)]
912
#![feature(generic_const_args, generic_const_items, min_generic_const_args)]
1013
#![expect(incomplete_features, reason = "generic_const_*")]
1114
#![cfg_attr(

crates/shared/ab-core-primitives/src/block.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ impl BlockNumber {
107107

108108
/// Create block number from bytes
109109
#[inline(always)]
110-
pub const fn from_bytes(bytes: [u8; const { Self::SIZE }]) -> Self {
110+
pub const fn from_bytes(bytes: [u8; Self::SIZE]) -> Self {
111111
Self(u64::from_le_bytes(bytes))
112112
}
113113

114114
/// Convert block number to bytes
115115
#[inline(always)]
116-
pub const fn to_bytes(self) -> [u8; const { Self::SIZE }] {
116+
pub const fn to_bytes(self) -> [u8; Self::SIZE] {
117117
self.0.to_le_bytes()
118118
}
119119

@@ -280,15 +280,15 @@ impl BlockRoot {
280280

281281
/// Convenient conversion from slice of underlying representation for efficiency purposes
282282
#[inline(always)]
283-
pub const fn slice_from_repr(value: &[[u8; const { Self::SIZE }]]) -> &[Self] {
283+
pub const fn slice_from_repr(value: &[[u8; Self::SIZE]]) -> &[Self] {
284284
let value = Blake3Hash::slice_from_repr(value);
285285
// SAFETY: `BlockHash` is `#[repr(C)]` and guaranteed to have the same memory layout
286286
unsafe { mem::transmute(value) }
287287
}
288288

289289
/// Convenient conversion to slice of underlying representation for efficiency purposes
290290
#[inline(always)]
291-
pub const fn repr_from_slice(value: &[Self]) -> &[[u8; const { Self::SIZE }]] {
291+
pub const fn repr_from_slice(value: &[Self]) -> &[[u8; Self::SIZE]] {
292292
// SAFETY: `BlockHash` is `#[repr(C)]` and guaranteed to have the same memory layout
293293
let value = unsafe { mem::transmute::<&[Self], &[Blake3Hash]>(value) };
294294
Blake3Hash::repr_from_slice(value)

crates/shared/ab-core-primitives/src/block/body.rs

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl OwnSegments<'_> {
8383
let root = BalancedMerkleTree::compute_root_only(&[
8484
single_block_hash(self.first_local_segment_index.as_bytes())
8585
.expect("Less than a single block worth of bytes; qed"),
86-
*compute_segments_root::<const { u64::from(u8::MAX) }, _>(self.segment_roots),
86+
*compute_segments_root::<{ u64::from(u8::MAX) }, _>(self.segment_roots),
8787
]);
8888

8989
Blake3Hash::new(root)
@@ -109,7 +109,7 @@ impl OwnSegments<'_> {
109109

110110
single_block_hash(&pair).expect("Less than a single block worth of bytes; qed")
111111
},
112-
*compute_segments_root::<const { u64::from(u8::MAX) }, _>(self.segment_roots),
112+
*compute_segments_root::<{ u64::from(u8::MAX) }, _>(self.segment_roots),
113113
]);
114114

115115
Blake3Hash::new(root)
@@ -173,9 +173,7 @@ impl<'a> IntermediateShardBlockInfo<'a> {
173173
// SAFETY: Valid pointer and size, no alignment requirements
174174
let own_segment_roots = unsafe {
175175
slice::from_raw_parts(
176-
own_segment_roots
177-
.as_ptr()
178-
.cast::<[u8; const { SegmentRoot::SIZE }]>(),
176+
own_segment_roots.as_ptr().cast::<[u8; SegmentRoot::SIZE]>(),
179177
num_own_segment_roots,
180178
)
181179
};
@@ -477,7 +475,7 @@ impl<'a> IntermediateShardBlocksInfo<'a> {
477475
let segments_proof = intermediate_shard_block.segments_proof.unwrap_or(&[0; _]);
478476

479477
let leaf_shards_root =
480-
UnbalancedMerkleTree::compute_root_only::<const { u64::from(u16::MAX) }, _, _>(
478+
UnbalancedMerkleTree::compute_root_only::<{ u64::from(u16::MAX) }, _, _>(
481479
intermediate_shard_block.leaf_shards_segments().map(
482480
|(shard_index, own_segments)| {
483481
own_segments.root_with_shard_index(shard_index)
@@ -559,9 +557,7 @@ impl<'a> IntermediateShardBlocksInfo<'a> {
559557
// SAFETY: Valid pointer and size, no alignment requirements
560558
let own_segment_roots = unsafe {
561559
slice::from_raw_parts(
562-
own_segment_roots
563-
.as_ptr()
564-
.cast::<[u8; const { SegmentRoot::SIZE }]>(),
560+
own_segment_roots.as_ptr().cast::<[u8; SegmentRoot::SIZE]>(),
565561
num_own_segment_roots,
566562
)
567563
};
@@ -629,9 +625,9 @@ impl<'a> IntermediateShardBlocksInfo<'a> {
629625
/// Returns the default value for an empty collection of segment roots.
630626
#[inline]
631627
pub fn segments_root(&self) -> Blake3Hash {
632-
let root = UnbalancedMerkleTree::compute_root_only::<const { u64::from(u16::MAX) }, _, _>(
628+
let root = UnbalancedMerkleTree::compute_root_only::<{ u64::from(u16::MAX) }, _, _>(
633629
self.iter().map(|shard_block_info| {
634-
UnbalancedMerkleTree::compute_root_only::<const { u64::from(u32::MAX) }, _, _>(
630+
UnbalancedMerkleTree::compute_root_only::<{ u64::from(u32::MAX) }, _, _>(
635631
shard_block_info
636632
.own_segments
637633
.as_ref()
@@ -656,7 +652,7 @@ impl<'a> IntermediateShardBlocksInfo<'a> {
656652
/// Returns the default value for an empty collection of shard blocks.
657653
#[inline]
658654
pub fn headers_root(&self) -> Blake3Hash {
659-
let root = UnbalancedMerkleTree::compute_root_only::<const { u64::from(u16::MAX) }, _, _>(
655+
let root = UnbalancedMerkleTree::compute_root_only::<{ u64::from(u16::MAX) }, _, _>(
660656
// TODO: Keyed hash
661657
self.iter().map(|shard_block_info| {
662658
// Hash the root again so we can prove it, otherwise the root of headers is
@@ -740,9 +736,7 @@ impl<'a> BeaconChainBody<'a> {
740736
// SAFETY: Valid pointer and size, no alignment requirements
741737
let own_segment_roots = unsafe {
742738
slice::from_raw_parts(
743-
own_segment_roots
744-
.as_ptr()
745-
.cast::<[u8; const { SegmentRoot::SIZE }]>(),
739+
own_segment_roots.as_ptr().cast::<[u8; SegmentRoot::SIZE]>(),
746740
num_own_segment_roots,
747741
)
748742
};
@@ -765,7 +759,7 @@ impl<'a> BeaconChainBody<'a> {
765759
slice::from_raw_parts(
766760
pot_checkpoints
767761
.as_ptr()
768-
.cast::<[u8; const { PotCheckpoints::SIZE }]>(),
762+
.cast::<[u8; PotCheckpoints::SIZE]>(),
769763
num_pot_checkpoints,
770764
)
771765
};
@@ -826,9 +820,7 @@ impl<'a> BeaconChainBody<'a> {
826820
// SAFETY: Valid pointer and size, no alignment requirements
827821
let own_segment_roots = unsafe {
828822
slice::from_raw_parts(
829-
own_segment_roots
830-
.as_ptr()
831-
.cast::<[u8; const { SegmentRoot::SIZE }]>(),
823+
own_segment_roots.as_ptr().cast::<[u8; SegmentRoot::SIZE]>(),
832824
num_own_segment_roots,
833825
)
834826
};
@@ -851,7 +843,7 @@ impl<'a> BeaconChainBody<'a> {
851843
slice::from_raw_parts(
852844
pot_checkpoints
853845
.as_ptr()
854-
.cast::<[u8; const { PotCheckpoints::SIZE }]>(),
846+
.cast::<[u8; PotCheckpoints::SIZE]>(),
855847
num_pot_checkpoints,
856848
)
857849
};
@@ -1204,9 +1196,7 @@ impl<'a> LeafShardBlocksInfo<'a> {
12041196
// SAFETY: Valid pointer and size, no alignment requirements
12051197
let own_segment_roots = unsafe {
12061198
slice::from_raw_parts(
1207-
own_segment_roots
1208-
.as_ptr()
1209-
.cast::<[u8; const { SegmentRoot::SIZE }]>(),
1199+
own_segment_roots.as_ptr().cast::<[u8; SegmentRoot::SIZE]>(),
12101200
num_own_segment_roots,
12111201
)
12121202
};
@@ -1245,7 +1235,7 @@ impl<'a> LeafShardBlocksInfo<'a> {
12451235
/// Returns the default value for an empty collection of segment roots.
12461236
#[inline]
12471237
pub fn segments_root(&self) -> Blake3Hash {
1248-
let root = UnbalancedMerkleTree::compute_root_only::<const { u64::from(u16::MAX) }, _, _>(
1238+
let root = UnbalancedMerkleTree::compute_root_only::<{ u64::from(u16::MAX) }, _, _>(
12491239
self.iter().map(|shard_block_info| {
12501240
shard_block_info
12511241
.segments
@@ -1267,7 +1257,7 @@ impl<'a> LeafShardBlocksInfo<'a> {
12671257
/// Returns the default value for an empty collection of shard blocks.
12681258
#[inline]
12691259
pub fn headers_root(&self) -> Blake3Hash {
1270-
let root = UnbalancedMerkleTree::compute_root_only::<const { u64::from(u16::MAX) }, _, _>(
1260+
let root = UnbalancedMerkleTree::compute_root_only::<{ u64::from(u16::MAX) }, _, _>(
12711261
self.iter().map(|shard_block_info| {
12721262
// Hash the root again so we can prove it, otherwise root of headers is
12731263
// indistinguishable from individual block roots and can be used to confuse
@@ -1340,9 +1330,7 @@ impl<'a> IntermediateShardBody<'a> {
13401330
// SAFETY: Valid pointer and size, no alignment requirements
13411331
let own_segment_roots = unsafe {
13421332
slice::from_raw_parts(
1343-
own_segment_roots
1344-
.as_ptr()
1345-
.cast::<[u8; const { SegmentRoot::SIZE }]>(),
1333+
own_segment_roots.as_ptr().cast::<[u8; SegmentRoot::SIZE]>(),
13461334
num_own_segment_roots,
13471335
)
13481336
};
@@ -1405,9 +1393,7 @@ impl<'a> IntermediateShardBody<'a> {
14051393
// SAFETY: Valid pointer and size, no alignment requirements
14061394
let own_segment_roots = unsafe {
14071395
slice::from_raw_parts(
1408-
own_segment_roots
1409-
.as_ptr()
1410-
.cast::<[u8; const { SegmentRoot::SIZE }]>(),
1396+
own_segment_roots.as_ptr().cast::<[u8; SegmentRoot::SIZE]>(),
14111397
num_own_segment_roots,
14121398
)
14131399
};
@@ -1571,7 +1557,7 @@ impl<'a> Transactions<'a> {
15711557
/// Returns the default value for an empty collection of transactions.
15721558
#[inline]
15731559
pub fn root(&self) -> Blake3Hash {
1574-
let root = UnbalancedMerkleTree::compute_root_only::<const { u64::from(u32::MAX) }, _, _>(
1560+
let root = UnbalancedMerkleTree::compute_root_only::<{ u64::from(u32::MAX) }, _, _>(
15751561
self.iter().map(|transaction| {
15761562
// Hash the hash again so we can prove it, otherwise root of transactions is
15771563
// indistinguishable from individual transaction roots and can be used to
@@ -1644,9 +1630,7 @@ impl<'a> LeafShardBody<'a> {
16441630
// SAFETY: Valid pointer and size, no alignment requirements
16451631
let own_segment_roots = unsafe {
16461632
slice::from_raw_parts(
1647-
own_segment_roots
1648-
.as_ptr()
1649-
.cast::<[u8; const { SegmentRoot::SIZE }]>(),
1633+
own_segment_roots.as_ptr().cast::<[u8; SegmentRoot::SIZE]>(),
16501634
num_own_segment_roots,
16511635
)
16521636
};
@@ -1709,9 +1693,7 @@ impl<'a> LeafShardBody<'a> {
17091693
// SAFETY: Valid pointer and size, no alignment requirements
17101694
let own_segment_roots = unsafe {
17111695
slice::from_raw_parts(
1712-
own_segment_roots
1713-
.as_ptr()
1714-
.cast::<[u8; const { SegmentRoot::SIZE }]>(),
1696+
own_segment_roots.as_ptr().cast::<[u8; SegmentRoot::SIZE]>(),
17151697
num_own_segment_roots,
17161698
)
17171699
};

crates/shared/ab-core-primitives/src/block/header.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,7 @@ impl<'a> BlockHeaderChildShardBlocks<'a> {
514514
// SAFETY: Valid pointer and size, no alignment requirements
515515
let child_shard_blocks = unsafe {
516516
slice::from_raw_parts(
517-
child_shard_blocks
518-
.as_ptr()
519-
.cast::<[u8; const { BlockRoot::SIZE }]>(),
517+
child_shard_blocks.as_ptr().cast::<[u8; BlockRoot::SIZE]>(),
520518
num_blocks,
521519
)
522520
};
@@ -529,19 +527,18 @@ impl<'a> BlockHeaderChildShardBlocks<'a> {
529527
///
530528
/// `None` is returned if there are no child shard blocks.
531529
pub fn root(&self) -> Option<Blake3Hash> {
532-
let root =
533-
UnbalancedMerkleTree::compute_root_only::<'_, const { u64::from(u32::MAX) }, _, _>(
534-
// TODO: Keyed hash
535-
self.child_shard_blocks
536-
.iter()
537-
.map(|child_shard_block_root| {
538-
// Hash the root again so we can prove it, otherwise headers root is
539-
// indistinguishable from individual block roots and can be used to confuse
540-
// verifier
541-
single_block_hash(child_shard_block_root.as_ref())
542-
.expect("Less than a single block worth of bytes; qed")
543-
}),
544-
)?;
530+
let root = UnbalancedMerkleTree::compute_root_only::<'_, { u64::from(u32::MAX) }, _, _>(
531+
// TODO: Keyed hash
532+
self.child_shard_blocks
533+
.iter()
534+
.map(|child_shard_block_root| {
535+
// Hash the root again so we can prove it, otherwise headers root is
536+
// indistinguishable from individual block roots and can be used to confuse
537+
// verifier
538+
single_block_hash(child_shard_block_root.as_ref())
539+
.expect("Less than a single block worth of bytes; qed")
540+
}),
541+
)?;
545542
Some(Blake3Hash::new(root))
546543
}
547544
}

crates/shared/ab-core-primitives/src/ed25519.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use serde_big_array::BigArray;
1919
)]
2020
#[cfg_attr(feature = "scale-codec", derive(Encode, Decode, MaxEncodedLen))]
2121
#[repr(C)]
22-
pub struct Ed25519PublicKey([u8; const { Ed25519PublicKey::SIZE }]);
22+
pub struct Ed25519PublicKey([u8; Ed25519PublicKey::SIZE]);
2323

2424
impl From<VerifyingKey> for Ed25519PublicKey {
2525
#[inline(always)]
@@ -40,12 +40,12 @@ impl fmt::Debug for Ed25519PublicKey {
4040
#[cfg(feature = "serde")]
4141
#[derive(Serialize, Deserialize)]
4242
#[serde(transparent)]
43-
struct Ed25519PublicKeyBinary([u8; const { Ed25519PublicKey::SIZE }]);
43+
struct Ed25519PublicKeyBinary([u8; Ed25519PublicKey::SIZE]);
4444

4545
#[cfg(feature = "serde")]
4646
#[derive(Serialize, Deserialize)]
4747
#[serde(transparent)]
48-
struct Ed25519PublicKeyHex(#[serde(with = "hex")] [u8; const { Ed25519PublicKey::SIZE }]);
48+
struct Ed25519PublicKeyHex(#[serde(with = "hex")] [u8; Ed25519PublicKey::SIZE]);
4949

5050
#[cfg(feature = "serde")]
5151
impl Serialize for Ed25519PublicKey {
@@ -117,7 +117,7 @@ impl Ed25519PublicKey {
117117
#[derive(Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, Deref, From, Into, TrivialType)]
118118
#[cfg_attr(feature = "scale-codec", derive(Encode, Decode, MaxEncodedLen))]
119119
#[repr(C)]
120-
pub struct Ed25519Signature([u8; const { Ed25519Signature::SIZE }]);
120+
pub struct Ed25519Signature([u8; Ed25519Signature::SIZE]);
121121

122122
impl From<Signature> for Ed25519Signature {
123123
#[inline(always)]
@@ -144,12 +144,12 @@ impl fmt::Debug for Ed25519Signature {
144144
#[cfg(feature = "serde")]
145145
#[derive(Serialize, Deserialize)]
146146
#[serde(transparent)]
147-
struct Ed25519SignatureBinary(#[serde(with = "BigArray")] [u8; const { Ed25519Signature::SIZE }]);
147+
struct Ed25519SignatureBinary(#[serde(with = "BigArray")] [u8; Ed25519Signature::SIZE]);
148148

149149
#[cfg(feature = "serde")]
150150
#[derive(Serialize, Deserialize)]
151151
#[serde(transparent)]
152-
struct Ed25519SignatureHex(#[serde(with = "hex")] [u8; const { Ed25519Signature::SIZE }]);
152+
struct Ed25519SignatureHex(#[serde(with = "hex")] [u8; Ed25519Signature::SIZE]);
153153

154154
#[cfg(feature = "serde")]
155155
impl Serialize for Ed25519Signature {

0 commit comments

Comments
 (0)