From 68bb57891ae2dafb90237b6ef626edd16751e48c Mon Sep 17 00:00:00 2001 From: LHerskind Date: Mon, 18 Nov 2024 22:04:24 +0000 Subject: [PATCH 1/2] feat: updating consensus payload --- l1-contracts/package.json | 2 +- l1-contracts/src/core/Rollup.sol | 36 ++++------ l1-contracts/src/core/interfaces/IRollup.sol | 13 +--- .../src/core/libraries/ProposeLib.sol | 18 +++++ l1-contracts/test/Rollup.t.sol | 72 +++++++++++++++---- l1-contracts/test/sparta/Sparta.t.sol | 20 +++--- .../archiver/src/archiver/archiver.test.ts | 2 +- .../archiver/src/archiver/data_retrieval.ts | 17 +++-- .../src/p2p/consensus_payload.ts | 7 +- .../composed/integration_l1_publisher.test.ts | 20 +++--- .../src/e2e_p2p/gossip_network.test.ts | 5 +- .../src/publisher/l1-publisher.ts | 10 +-- 12 files changed, 146 insertions(+), 76 deletions(-) create mode 100644 l1-contracts/src/core/libraries/ProposeLib.sol diff --git a/l1-contracts/package.json b/l1-contracts/package.json index d8f9c5e85f2..cceaf797bb4 100644 --- a/l1-contracts/package.json +++ b/l1-contracts/package.json @@ -13,4 +13,4 @@ "slither": "forge clean && forge build --build-info --skip '*/test/**' --force && slither . --checklist --ignore-compile --show-ignored-findings --config-file ./slither.config.json | tee slither_output.md", "slither-has-diff": "./slither_has_diff.sh" } -} \ No newline at end of file +} diff --git a/l1-contracts/src/core/Rollup.sol b/l1-contracts/src/core/Rollup.sol index 9e30c805b11..47e27678fcf 100644 --- a/l1-contracts/src/core/Rollup.sol +++ b/l1-contracts/src/core/Rollup.sol @@ -16,6 +16,7 @@ import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; import {EpochProofQuoteLib} from "@aztec/core/libraries/EpochProofQuoteLib.sol"; import {Errors} from "@aztec/core/libraries/Errors.sol"; import {HeaderLib} from "@aztec/core/libraries/HeaderLib.sol"; +import {ProposeArgs, ProposeLib} from "@aztec/core/libraries/ProposeLib.sol"; import {Timestamp, Slot, Epoch, SlotLib, EpochLib} from "@aztec/core/libraries/TimeMath.sol"; import {TxsDecoder} from "@aztec/core/libraries/TxsDecoder.sol"; import {Inbox} from "@aztec/core/messagebridge/Inbox.sol"; @@ -40,6 +41,7 @@ contract Rollup is EIP712("Aztec Rollup", "1"), Leonidas, IRollup, ITestRollup { using SlotLib for Slot; using EpochLib for Epoch; using SafeERC20 for IERC20; + using ProposeLib for ProposeArgs; struct ChainTips { uint256 pendingBlockNumber; @@ -199,22 +201,17 @@ contract Rollup is EIP712("Aztec Rollup", "1"), Leonidas, IRollup, ITestRollup { * @notice Publishes the body and propose the block * @dev `eth_log_handlers` rely on this function * - * @param _header - The L2 block header - * @param _archive - A root of the archive tree after the L2 block is applied - * @param _blockHash - The poseidon2 hash of the header added to the archive tree in the rollup circuit + * @param _args - The arguments to propose the block * @param _signatures - Signatures from the validators * @param _body - The body of the L2 block */ function proposeAndClaim( - bytes calldata _header, - bytes32 _archive, - bytes32 _blockHash, - bytes32[] memory _txHashes, + ProposeArgs calldata _args, SignatureLib.Signature[] memory _signatures, bytes calldata _body, EpochProofQuoteLib.SignedEpochProofQuote calldata _quote ) external override(IRollup) { - propose(_header, _archive, _blockHash, _txHashes, _signatures, _body); + propose(_args, _signatures, _body); claimEpochProofRight(_quote); } @@ -464,30 +461,27 @@ contract Rollup is EIP712("Aztec Rollup", "1"), Leonidas, IRollup, ITestRollup { * @notice Publishes the body and propose the block * @dev `eth_log_handlers` rely on this function * - * @param _header - The L2 block header - * @param _archive - A root of the archive tree after the L2 block is applied - * @param _blockHash - The poseidon2 hash of the header added to the archive tree in the rollup circuit + * @param _args - The arguments to propose the block * @param _signatures - Signatures from the validators * @param _body - The body of the L2 block */ function propose( - bytes calldata _header, - bytes32 _archive, - bytes32 _blockHash, - bytes32[] memory _txHashes, + ProposeArgs calldata _args, SignatureLib.Signature[] memory _signatures, bytes calldata _body ) public override(IRollup) { if (canPrune()) { _prune(); } + // The `body` is passed outside the "args" as it does not directly need to be in the digest + // as long as the `txsEffectsHash` is included and matches what is in the header. + // Which we are checking in the `_validateHeader` call below. bytes32 txsEffectsHash = TxsDecoder.decode(_body); // Decode and validate header - HeaderLib.Header memory header = HeaderLib.decode(_header); + HeaderLib.Header memory header = HeaderLib.decode(_args.header); - uint8 domainSeperator = uint8(SignatureLib.SignatureDomainSeperator.blockAttestation); - bytes32 digest = keccak256(abi.encode(domainSeperator, _archive, _txHashes)); + bytes32 digest = _args.digest(); setupEpoch(); _validateHeader({ _header: header, @@ -501,8 +495,8 @@ contract Rollup is EIP712("Aztec Rollup", "1"), Leonidas, IRollup, ITestRollup { uint256 blockNumber = ++tips.pendingBlockNumber; blocks[blockNumber] = BlockLog({ - archive: _archive, - blockHash: _blockHash, + archive: _args.archive, + blockHash: _args.blockHash, slotNumber: Slot.wrap(header.globalVariables.slotNumber) }); @@ -519,7 +513,7 @@ contract Rollup is EIP712("Aztec Rollup", "1"), Leonidas, IRollup, ITestRollup { uint256 l2ToL1TreeMinHeight = min + 1; OUTBOX.insert(blockNumber, header.contentCommitment.outHash, l2ToL1TreeMinHeight); - emit L2BlockProposed(blockNumber, _archive); + emit L2BlockProposed(blockNumber, _args.archive); // Automatically flag the block as proven if we have cheated and set assumeProvenThroughBlockNumber. if (blockNumber <= assumeProvenThroughBlockNumber) { diff --git a/l1-contracts/src/core/interfaces/IRollup.sol b/l1-contracts/src/core/interfaces/IRollup.sol index 088762b56d0..3f128d7db5a 100644 --- a/l1-contracts/src/core/interfaces/IRollup.sol +++ b/l1-contracts/src/core/interfaces/IRollup.sol @@ -4,11 +4,10 @@ pragma solidity >=0.8.27; import {IInbox} from "@aztec/core/interfaces/messagebridge/IInbox.sol"; import {IOutbox} from "@aztec/core/interfaces/messagebridge/IOutbox.sol"; - import {SignatureLib} from "@aztec/core/libraries/crypto/SignatureLib.sol"; import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; import {EpochProofQuoteLib} from "@aztec/core/libraries/EpochProofQuoteLib.sol"; - +import {ProposeArgs} from "@aztec/core/libraries/ProposeLib.sol"; import {Timestamp, Slot, Epoch} from "@aztec/core/libraries/TimeMath.sol"; interface ITestRollup { @@ -35,19 +34,13 @@ interface IRollup { function claimEpochProofRight(EpochProofQuoteLib.SignedEpochProofQuote calldata _quote) external; function propose( - bytes calldata _header, - bytes32 _archive, - bytes32 _blockHash, - bytes32[] memory _txHashes, + ProposeArgs calldata _args, SignatureLib.Signature[] memory _signatures, bytes calldata _body ) external; function proposeAndClaim( - bytes calldata _header, - bytes32 _archive, - bytes32 _blockHash, - bytes32[] memory _txHashes, + ProposeArgs calldata _args, SignatureLib.Signature[] memory _signatures, bytes calldata _body, EpochProofQuoteLib.SignedEpochProofQuote calldata _quote diff --git a/l1-contracts/src/core/libraries/ProposeLib.sol b/l1-contracts/src/core/libraries/ProposeLib.sol new file mode 100644 index 00000000000..6abffad0939 --- /dev/null +++ b/l1-contracts/src/core/libraries/ProposeLib.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Aztec Labs. +pragma solidity >=0.8.27; + +import {SignatureLib} from "@aztec/core/libraries/crypto/SignatureLib.sol"; + +struct ProposeArgs { + bytes32 archive; + bytes32 blockHash; + bytes header; + bytes32[] txHashes; +} + +library ProposeLib { + function digest(ProposeArgs memory _args) internal pure returns (bytes32) { + return keccak256(abi.encode(SignatureLib.SignatureDomainSeperator.blockAttestation, _args)); + } +} diff --git a/l1-contracts/test/Rollup.t.sol b/l1-contracts/test/Rollup.t.sol index cea315a48ba..740f361b6b1 100644 --- a/l1-contracts/test/Rollup.t.sol +++ b/l1-contracts/test/Rollup.t.sol @@ -26,6 +26,7 @@ import {TestConstants} from "./harnesses/TestConstants.sol"; import {RewardDistributor} from "@aztec/governance/RewardDistributor.sol"; import {TxsDecoderHelper} from "./decoders/helpers/TxsDecoderHelper.sol"; import {IERC20Errors} from "@oz/interfaces/draft-IERC6093.sol"; +import {ProposeArgs, ProposeLib} from "@aztec/core/libraries/ProposeLib.sol"; import { Timestamp, Slot, Epoch, SlotLib, EpochLib, TimeFns @@ -40,6 +41,7 @@ import { contract RollupTest is DecoderBase, TimeFns { using SlotLib for Slot; using EpochLib for Epoch; + using ProposeLib for ProposeArgs; Registry internal registry; Inbox internal inbox; @@ -258,7 +260,9 @@ contract RollupTest is DecoderBase, TimeFns { // We jump to the time of the block. (unless it is in the past) vm.warp(max(block.timestamp, data.decodedHeader.globalVariables.timestamp)); - rollup.propose(header, archive, blockHash, txHashes, signatures, body); + ProposeArgs memory args = + ProposeArgs({header: header, archive: archive, blockHash: blockHash, txHashes: txHashes}); + rollup.propose(args, signatures, body); quote.epochToProve = Epoch.wrap(1); quote.validUntilSlot = toSlots(Epoch.wrap(2)); @@ -424,7 +428,9 @@ contract RollupTest is DecoderBase, TimeFns { // We jump to the time of the block. (unless it is in the past) vm.warp(max(block.timestamp, data.decodedHeader.globalVariables.timestamp)); - rollup.propose(header, archive, blockHash, txHashes, signatures, body); + ProposeArgs memory args = + ProposeArgs({header: header, archive: archive, blockHash: blockHash, txHashes: txHashes}); + rollup.propose(args, signatures, body); (bytes32 preArchive, bytes32 preBlockHash,) = rollup.blocks(0); _submitEpochProof(rollup, 1, preArchive, archive, preBlockHash, blockHash, proverId); @@ -556,7 +562,13 @@ contract RollupTest is DecoderBase, TimeFns { vm.warp(max(block.timestamp, data.decodedHeader.globalVariables.timestamp)); vm.expectRevert(abi.encodeWithSelector(Errors.Rollup__NonZeroDaFee.selector)); - rollup.propose(header, data.archive, data.blockHash, txHashes, signatures, data.body); + ProposeArgs memory args = ProposeArgs({ + header: header, + archive: data.archive, + blockHash: data.blockHash, + txHashes: txHashes + }); + rollup.propose(args, signatures, data.body); } function testNonZeroL2Fee() public setUpFor("mixed_block_1") { @@ -574,7 +586,13 @@ contract RollupTest is DecoderBase, TimeFns { vm.warp(max(block.timestamp, data.decodedHeader.globalVariables.timestamp)); vm.expectRevert(abi.encodeWithSelector(Errors.Rollup__NonZeroL2Fee.selector)); - rollup.propose(header, data.archive, data.blockHash, txHashes, signatures, data.body); + ProposeArgs memory args = ProposeArgs({ + header: header, + archive: data.archive, + blockHash: data.blockHash, + txHashes: txHashes + }); + rollup.propose(args, signatures, data.body); } function testBlockFee() public setUpFor("mixed_block_1") { @@ -603,7 +621,13 @@ contract RollupTest is DecoderBase, TimeFns { assertEq(coinbaseBalance, 0, "invalid initial coinbase balance"); // Assert that balance have NOT been increased by proposing the block - rollup.propose(header, data.archive, data.blockHash, txHashes, signatures, data.body); + ProposeArgs memory args = ProposeArgs({ + header: header, + archive: data.archive, + blockHash: data.blockHash, + txHashes: txHashes + }); + rollup.propose(args, signatures, data.body); assertEq(testERC20.balanceOf(coinbase), 0, "invalid coinbase balance"); } @@ -704,7 +728,13 @@ contract RollupTest is DecoderBase, TimeFns { bytes32[] memory txHashes = new bytes32[](0); vm.warp(max(block.timestamp, data2.decodedHeader.globalVariables.timestamp)); - rollup.propose(data2.header, data2.archive, data2.blockHash, txHashes, signatures, data2.body); + ProposeArgs memory args = ProposeArgs({ + header: data2.header, + archive: data2.archive, + blockHash: data2.blockHash, + txHashes: txHashes + }); + rollup.propose(args, signatures, data2.body); // Skips proving of block 1 (bytes32 preArchive,,) = rollup.blocks(0); @@ -749,7 +779,9 @@ contract RollupTest is DecoderBase, TimeFns { } vm.expectRevert(abi.encodeWithSelector(Errors.Rollup__InvalidBlockNumber.selector, 1, 0x420)); - rollup.propose(header, archive, data.blockHash, txHashes, signatures, body); + ProposeArgs memory args = + ProposeArgs({header: header, archive: archive, blockHash: data.blockHash, txHashes: txHashes}); + rollup.propose(args, signatures, body); } function testRevertInvalidChainId() public setUpFor("empty_block_1") { @@ -764,7 +796,9 @@ contract RollupTest is DecoderBase, TimeFns { } vm.expectRevert(abi.encodeWithSelector(Errors.Rollup__InvalidChainId.selector, 31337, 0x420)); - rollup.propose(header, archive, data.blockHash, txHashes, signatures, body); + ProposeArgs memory args = + ProposeArgs({header: header, archive: archive, blockHash: data.blockHash, txHashes: txHashes}); + rollup.propose(args, signatures, body); } function testRevertInvalidVersion() public setUpFor("empty_block_1") { @@ -779,7 +813,9 @@ contract RollupTest is DecoderBase, TimeFns { } vm.expectRevert(abi.encodeWithSelector(Errors.Rollup__InvalidVersion.selector, 1, 0x420)); - rollup.propose(header, archive, data.blockHash, txHashes, signatures, body); + ProposeArgs memory args = + ProposeArgs({header: header, archive: archive, blockHash: data.blockHash, txHashes: txHashes}); + rollup.propose(args, signatures, body); } function testRevertInvalidTimestamp() public setUpFor("empty_block_1") { @@ -799,7 +835,9 @@ contract RollupTest is DecoderBase, TimeFns { } vm.expectRevert(abi.encodeWithSelector(Errors.Rollup__InvalidTimestamp.selector, realTs, badTs)); - rollup.propose(header, archive, data.blockHash, txHashes, signatures, body); + ProposeArgs memory args = + ProposeArgs({header: header, archive: archive, blockHash: data.blockHash, txHashes: txHashes}); + rollup.propose(args, signatures, body); } function testBlocksWithAssumeProven() public setUpFor("mixed_block_1") { @@ -879,8 +917,6 @@ contract RollupTest is DecoderBase, TimeFns { function _testBlock(string memory name, bool _submitProof, uint256 _slotNumber) public { DecoderBase.Full memory full = load(name); bytes memory header = full.block.header; - bytes32 archive = full.block.archive; - bytes memory body = full.block.body; uint32 numTxs = full.block.numTxs; bytes32[] memory txHashes = new bytes32[](0); @@ -903,14 +939,20 @@ contract RollupTest is DecoderBase, TimeFns { _populateInbox(full.populate.sender, full.populate.recipient, full.populate.l1ToL2Content); - rollup.propose(header, archive, full.block.blockHash, txHashes, signatures, body); + ProposeArgs memory args = ProposeArgs({ + header: header, + archive: full.block.archive, + blockHash: full.block.blockHash, + txHashes: txHashes + }); + rollup.propose(args, signatures, full.block.body); if (_submitProof) { uint256 pre = rollup.getProvenBlockNumber(); (bytes32 preArchive, bytes32 preBlockHash,) = rollup.blocks(pre); _submitEpochProof( - rollup, 1, preArchive, archive, preBlockHash, full.block.blockHash, bytes32(0) + rollup, 1, preArchive, args.archive, preBlockHash, full.block.blockHash, bytes32(0) ); assertEq(pre + 1, rollup.getProvenBlockNumber(), "Block not proven"); } @@ -952,7 +994,7 @@ contract RollupTest is DecoderBase, TimeFns { assertEq(root, bytes32(0), "Invalid outbox root"); } - assertEq(rollup.archive(), archive, "Invalid archive"); + assertEq(rollup.archive(), args.archive, "Invalid archive"); } function _populateInbox(address _sender, bytes32 _recipient, bytes32[] memory _contents) internal { diff --git a/l1-contracts/test/sparta/Sparta.t.sol b/l1-contracts/test/sparta/Sparta.t.sol index b8893758cc7..1d5642e60fa 100644 --- a/l1-contracts/test/sparta/Sparta.t.sol +++ b/l1-contracts/test/sparta/Sparta.t.sol @@ -20,6 +20,7 @@ import {TestERC20} from "@aztec/mock/TestERC20.sol"; import {TxsDecoderHelper} from "../decoders/helpers/TxsDecoderHelper.sol"; import {MessageHashUtils} from "@oz/utils/cryptography/MessageHashUtils.sol"; import {MockFeeJuicePortal} from "@aztec/mock/MockFeeJuicePortal.sol"; +import {ProposeArgs, ProposeLib} from "@aztec/core/libraries/ProposeLib.sol"; import {Slot, Epoch, SlotLib, EpochLib} from "@aztec/core/libraries/TimeMath.sol"; import {RewardDistributor} from "@aztec/governance/RewardDistributor.sol"; @@ -166,8 +167,6 @@ contract SpartaTest is DecoderBase { ) internal { DecoderBase.Full memory full = load(_name); bytes memory header = full.block.header; - bytes32 archive = full.block.archive; - bytes memory body = full.block.body; StructToAvoidDeepStacks memory ree; @@ -183,14 +182,20 @@ contract SpartaTest is DecoderBase { bytes32[] memory txHashes = new bytes32[](0); + ProposeArgs memory args = ProposeArgs({ + header: header, + archive: full.block.archive, + blockHash: bytes32(0), + txHashes: txHashes + }); + if (_signatureCount > 0 && ree.proposer != address(0)) { address[] memory validators = rollup.getEpochCommittee(rollup.getCurrentEpoch()); ree.needed = validators.length * 2 / 3 + 1; SignatureLib.Signature[] memory signatures = new SignatureLib.Signature[](_signatureCount); - uint8 domainSeperator = uint8(SignatureLib.SignatureDomainSeperator.blockAttestation); - bytes32 digest = keccak256(abi.encode(domainSeperator, archive, txHashes)); + bytes32 digest = ProposeLib.digest(args); for (uint256 i = 0; i < _signatureCount; i++) { signatures[i] = createSignature(validators[i], digest); } @@ -222,15 +227,14 @@ contract SpartaTest is DecoderBase { } vm.prank(ree.proposer); - rollup.propose(header, archive, bytes32(0), txHashes, signatures, body); + rollup.propose(args, signatures, full.block.body); if (ree.shouldRevert) { return; } } else { SignatureLib.Signature[] memory signatures = new SignatureLib.Signature[](0); - - rollup.propose(header, archive, bytes32(0), txHashes, signatures, body); + rollup.propose(args, signatures, full.block.body); } assertEq(_expectRevert, ree.shouldRevert, "Does not match revert expectation"); @@ -273,7 +277,7 @@ contract SpartaTest is DecoderBase { assertEq(root, bytes32(0), "Invalid outbox root"); } - assertEq(rollup.archive(), archive, "Invalid archive"); + assertEq(rollup.archive(), args.archive, "Invalid archive"); } function _populateInbox(address _sender, bytes32 _recipient, bytes32[] memory _contents) internal { diff --git a/yarn-project/archiver/src/archiver/archiver.test.ts b/yarn-project/archiver/src/archiver/archiver.test.ts index 9d19fae994a..b542ee2475f 100644 --- a/yarn-project/archiver/src/archiver/archiver.test.ts +++ b/yarn-project/archiver/src/archiver/archiver.test.ts @@ -456,7 +456,7 @@ function makeRollupTx(l2Block: L2Block) { const input = encodeFunctionData({ abi: RollupAbi, functionName: 'propose', - args: [header, archive, blockHash, [], [], body], + args: [{ header, archive, blockHash, txHashes: [] }, [], body], }); return { input } as Transaction; } diff --git a/yarn-project/archiver/src/archiver/data_retrieval.ts b/yarn-project/archiver/src/archiver/data_retrieval.ts index 563f0b43c0f..ce3c6cadbd5 100644 --- a/yarn-project/archiver/src/archiver/data_retrieval.ts +++ b/yarn-project/archiver/src/archiver/data_retrieval.ts @@ -139,9 +139,18 @@ async function getBlockFromRollupTx( if (!allowedMethods.includes(functionName)) { throw new Error(`Unexpected method called ${functionName}`); } - const [headerHex, archiveRootHex, , , , bodyHex] = args! as readonly [Hex, Hex, Hex, Hex[], ViemSignature[], Hex]; - - const header = Header.fromBuffer(Buffer.from(hexToBytes(headerHex))); + const [decodedArgs, , bodyHex] = args! as readonly [ + { + header: Hex; + archive: Hex; + blockHash: Hex; + txHashes: Hex[]; + }, + ViemSignature[], + Hex, + ]; + + const header = Header.fromBuffer(Buffer.from(hexToBytes(decodedArgs.header))); const blockBody = Body.fromBuffer(Buffer.from(hexToBytes(bodyHex))); const blockNumberFromHeader = header.globalVariables.blockNumber.toBigInt(); @@ -152,7 +161,7 @@ async function getBlockFromRollupTx( const archive = AppendOnlyTreeSnapshot.fromBuffer( Buffer.concat([ - Buffer.from(hexToBytes(archiveRootHex)), // L2Block.archive.root + Buffer.from(hexToBytes(decodedArgs.archive)), // L2Block.archive.root numToUInt32BE(Number(l2BlockNum + 1n)), // L2Block.archive.nextAvailableLeafIndex ]), ); diff --git a/yarn-project/circuit-types/src/p2p/consensus_payload.ts b/yarn-project/circuit-types/src/p2p/consensus_payload.ts index f6b70a5f354..8b020397e4d 100644 --- a/yarn-project/circuit-types/src/p2p/consensus_payload.ts +++ b/yarn-project/circuit-types/src/p2p/consensus_payload.ts @@ -25,9 +25,12 @@ export class ConsensusPayload implements Signable { } getPayloadToSign(domainSeperator: SignatureDomainSeperator): Buffer { - const abi = parseAbiParameters('uint8, bytes32, bytes32[]'); + const abi = parseAbiParameters('uint8, (bytes32, bytes32, bytes, bytes32[])'); const txArray = this.txHashes.map(tx => tx.to0xString()); - const encodedData = encodeAbiParameters(abi, [domainSeperator, this.archive.toString(), txArray] as const); + const encodedData = encodeAbiParameters(abi, [ + domainSeperator, + [this.archive.toString(), this.header.hash().toString(), `0x${this.header.toString()}`, txArray], + ] as const); return Buffer.from(encodedData.slice(2), 'hex'); } diff --git a/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts b/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts index 194839cda36..7b47386c6ac 100644 --- a/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts +++ b/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts @@ -388,10 +388,12 @@ describe('L1Publisher integration', () => { abi: RollupAbi, functionName: 'propose', args: [ - `0x${block.header.toBuffer().toString('hex')}`, - `0x${block.archive.root.toBuffer().toString('hex')}`, - `0x${block.header.hash().toBuffer().toString('hex')}`, - [], + { + header: `0x${block.header.toBuffer().toString('hex')}`, + archive: `0x${block.archive.root.toBuffer().toString('hex')}`, + blockHash: `0x${block.header.hash().toBuffer().toString('hex')}`, + txHashes: [], + }, [], `0x${block.body.toBuffer().toString('hex')}`, ], @@ -485,10 +487,12 @@ describe('L1Publisher integration', () => { abi: RollupAbi, functionName: 'propose', args: [ - `0x${block.header.toBuffer().toString('hex')}`, - `0x${block.archive.root.toBuffer().toString('hex')}`, - `0x${block.header.hash().toBuffer().toString('hex')}`, - [], + { + header: `0x${block.header.toBuffer().toString('hex')}`, + archive: `0x${block.archive.root.toBuffer().toString('hex')}`, + blockHash: `0x${block.header.hash().toBuffer().toString('hex')}`, + txHashes: [], + }, [], `0x${block.body.toBuffer().toString('hex')}`, ], diff --git a/yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts b/yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts index 5e8e5d50e94..0fea8a7ea2c 100644 --- a/yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts +++ b/yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts @@ -3,7 +3,7 @@ import { sleep } from '@aztec/aztec.js'; import fs from 'fs'; -import { METRICS_PORT } from '../fixtures/fixtures.js'; +// import { METRICS_PORT } from '../fixtures/fixtures.js'; import { type NodeContext, createNodes } from '../fixtures/setup_p2p_test.js'; import { P2PNetworkTest, WAIT_FOR_TX_TIMEOUT } from './p2p_network.js'; import { createPXEServiceAndSubmitTransactions } from './shared.js'; @@ -57,7 +57,8 @@ describe('e2e_p2p_network', () => { NUM_NODES, BOOT_NODE_UDP_PORT, DATA_DIR, - METRICS_PORT, + // Uncomment to collect metrics - run in aztec-packages `docker compose --profile metrics up` + // METRICS_PORT, ); // wait a bit for peers to discover each other diff --git a/yarn-project/sequencer-client/src/publisher/l1-publisher.ts b/yarn-project/sequencer-client/src/publisher/l1-publisher.ts index 229ba4f7d75..a1e5a5799ee 100644 --- a/yarn-project/sequencer-client/src/publisher/l1-publisher.ts +++ b/yarn-project/sequencer-client/src/publisher/l1-publisher.ts @@ -732,10 +732,12 @@ export class L1Publisher { : []; const txHashes = encodedData.txHashes ? encodedData.txHashes.map(txHash => txHash.to0xString()) : []; const args = [ - `0x${encodedData.header.toString('hex')}`, - `0x${encodedData.archive.toString('hex')}`, - `0x${encodedData.blockHash.toString('hex')}`, - txHashes, + { + header: `0x${encodedData.header.toString('hex')}`, + archive: `0x${encodedData.archive.toString('hex')}`, + blockHash: `0x${encodedData.blockHash.toString('hex')}`, + txHashes, + }, attestations, `0x${encodedData.body.toString('hex')}`, ] as const; From bf74c135974c7cbef8ea61921fae2a321b47a483 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Tue, 19 Nov 2024 10:18:42 +0000 Subject: [PATCH 2/2] chore: update publisher test --- .../src/publisher/l1-publisher.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/yarn-project/sequencer-client/src/publisher/l1-publisher.test.ts b/yarn-project/sequencer-client/src/publisher/l1-publisher.test.ts index 3fd8ced0837..6c817d70a2c 100644 --- a/yarn-project/sequencer-client/src/publisher/l1-publisher.test.ts +++ b/yarn-project/sequencer-client/src/publisher/l1-publisher.test.ts @@ -120,10 +120,12 @@ describe('L1Publisher', () => { expect(result).toEqual(true); const args = [ - `0x${header.toString('hex')}`, - `0x${archive.toString('hex')}`, - `0x${blockHash.toString('hex')}`, - [], + { + header: `0x${header.toString('hex')}`, + archive: `0x${archive.toString('hex')}`, + blockHash: `0x${blockHash.toString('hex')}`, + txHashes: [], + }, [], `0x${body.toString('hex')}`, ] as const;