@aztec/ethereum 3.0.0-nightly.20250906 → 3.0.0-nightly.20250910

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -490,6 +490,7 @@ export class RollupContract {
490
490
  ViemHeader,
491
491
  ViemCommitteeAttestations,
492
492
  `0x${string}`[],
493
+ ViemSignature,
493
494
  `0x${string}`,
494
495
  `0x${string}`,
495
496
  {
@@ -512,77 +513,6 @@ export class RollupContract {
512
513
  }
513
514
  }
514
515
 
515
- /**
516
- * Packs an array of committee attestations into the format expected by the Solidity contract
517
- *
518
- * @param attestations - Array of committee attestations with addresses and signatures
519
- * @returns Packed attestations with bitmap and tightly packed signature/address data
520
- */
521
- static packAttestations(attestations: ViemCommitteeAttestation[]): ViemCommitteeAttestations {
522
- const length = attestations.length;
523
-
524
- // Calculate bitmap size (1 bit per attestation, rounded up to nearest byte)
525
- const bitmapSize = Math.ceil(length / 8);
526
- const signatureIndices = new Uint8Array(bitmapSize);
527
-
528
- // Calculate total data size needed
529
- let totalDataSize = 0;
530
- for (let i = 0; i < length; i++) {
531
- const signature = attestations[i].signature;
532
- // Check if signature is empty (v = 0)
533
- const isEmpty = signature.v === 0;
534
-
535
- if (!isEmpty) {
536
- totalDataSize += 65; // v (1) + r (32) + s (32)
537
- } else {
538
- totalDataSize += 20; // address only
539
- }
540
- }
541
-
542
- const signaturesOrAddresses = new Uint8Array(totalDataSize);
543
- let dataIndex = 0;
544
-
545
- // Pack the data
546
- for (let i = 0; i < length; i++) {
547
- const attestation = attestations[i];
548
- const signature = attestation.signature;
549
-
550
- // Check if signature is empty
551
- const isEmpty = signature.v === 0;
552
-
553
- if (!isEmpty) {
554
- // Set bit in bitmap (bit 7-0 in each byte, left to right)
555
- const byteIndex = Math.floor(i / 8);
556
- const bitIndex = 7 - (i % 8);
557
- signatureIndices[byteIndex] |= 1 << bitIndex;
558
-
559
- // Pack signature: v + r + s
560
- signaturesOrAddresses[dataIndex] = signature.v;
561
- dataIndex++;
562
-
563
- // Pack r (32 bytes)
564
- const rBytes = Buffer.from(signature.r.slice(2), 'hex');
565
- signaturesOrAddresses.set(rBytes, dataIndex);
566
- dataIndex += 32;
567
-
568
- // Pack s (32 bytes)
569
- const sBytes = Buffer.from(signature.s.slice(2), 'hex');
570
- signaturesOrAddresses.set(sBytes, dataIndex);
571
- dataIndex += 32;
572
- } else {
573
- // Pack address only (20 bytes)
574
- const addrBytes = Buffer.from(attestation.addr.slice(2), 'hex');
575
- signaturesOrAddresses.set(addrBytes, dataIndex);
576
- dataIndex += 20;
577
- }
578
- }
579
-
580
- return {
581
- signatureIndices: `0x${Buffer.from(signatureIndices).toString('hex')}`,
582
- signaturesOrAddresses: `0x${Buffer.from(signaturesOrAddresses).toString('hex')}`,
583
- };
584
- }
585
-
586
516
  /**
587
517
  * @notice Calls `canProposeAtTime` with the time of the next Ethereum block and the sender address
588
518
  *
@@ -647,7 +577,7 @@ export class RollupContract {
647
577
  /** Creates a request to Rollup#invalidateBadAttestation to be simulated or sent */
648
578
  public buildInvalidateBadAttestationRequest(
649
579
  blockNumber: number,
650
- attestations: ViemCommitteeAttestation[],
580
+ attestationsAndSigners: ViemCommitteeAttestations,
651
581
  committee: EthAddress[],
652
582
  invalidIndex: number,
653
583
  ): L1TxRequest {
@@ -658,7 +588,7 @@ export class RollupContract {
658
588
  functionName: 'invalidateBadAttestation',
659
589
  args: [
660
590
  BigInt(blockNumber),
661
- RollupContract.packAttestations(attestations),
591
+ attestationsAndSigners,
662
592
  committee.map(addr => addr.toString()),
663
593
  BigInt(invalidIndex),
664
594
  ],
@@ -669,7 +599,7 @@ export class RollupContract {
669
599
  /** Creates a request to Rollup#invalidateInsufficientAttestations to be simulated or sent */
670
600
  public buildInvalidateInsufficientAttestationsRequest(
671
601
  blockNumber: number,
672
- attestations: ViemCommitteeAttestation[],
602
+ attestationsAndSigners: ViemCommitteeAttestations,
673
603
  committee: EthAddress[],
674
604
  ): L1TxRequest {
675
605
  return {
@@ -677,11 +607,7 @@ export class RollupContract {
677
607
  data: encodeFunctionData({
678
608
  abi: RollupAbi,
679
609
  functionName: 'invalidateInsufficientAttestations',
680
- args: [
681
- BigInt(blockNumber),
682
- RollupContract.packAttestations(attestations),
683
- committee.map(addr => addr.toString()),
684
- ],
610
+ args: [BigInt(blockNumber), attestationsAndSigners, committee.map(addr => addr.toString())],
685
611
  }),
686
612
  };
687
613
  }
@@ -183,7 +183,7 @@ export const deploySharedContracts = async (
183
183
  args: DeployL1ContractsArgs,
184
184
  logger: Logger,
185
185
  ) => {
186
- logger.info(`Deploying shared contracts for network configration: ${networkName}`);
186
+ logger.info(`Deploying shared contracts for network configuration: ${networkName}`);
187
187
 
188
188
  const txHashes: Hex[] = [];
189
189