From 38e3051d60f9f8a80e33fab4e0f7f3ec3cde2ee2 Mon Sep 17 00:00:00 2001 From: just-mitch <68168980+just-mitch@users.noreply.github.com> Date: Tue, 17 Sep 2024 11:05:21 -0400 Subject: [PATCH] feat: update rollup storage to hold pending/proven tips (#8583) Update the rollup state to hold pending and proven tips, which themselves are structs with block/slot numbers, instead of proven/pending counts. --------- Co-authored-by: Lasse Herskind <16536249+LHerskind@users.noreply.github.com> --- .github/workflows/devnet-deploys.yml | 2 +- docker-compose.provernet.yml | 4 +- l1-contracts/src/core/Rollup.sol | 114 ++++++++++-------- l1-contracts/src/core/interfaces/IRollup.sol | 38 +++--- .../src/core/messagebridge/Outbox.sol | 4 +- l1-contracts/test/Outbox.t.sol | 12 +- l1-contracts/test/Rollup.t.sol | 58 ++++----- l1-contracts/test/portals/TokenPortal.t.sol | 4 +- l1-contracts/test/portals/UniswapPortal.t.sol | 2 +- l1-contracts/test/sparta/Sparta.t.sol | 2 +- .../aztec.js/src/utils/anvil_test_watcher.ts | 2 +- .../aztec/src/cli/aztec_start_options.ts | 4 +- yarn-project/aztec/src/cli/cmds/start_node.ts | 2 +- yarn-project/aztec/src/sandbox.ts | 4 +- ...oven_until.ts => assume_proven_through.ts} | 8 +- yarn-project/cli/src/cmds/l1/index.ts | 6 +- .../cli/src/cmds/l1/update_l1_validators.ts | 8 +- yarn-project/cli/src/utils/aztec.ts | 4 +- .../cross_chain_messaging_test.ts | 2 +- .../token_bridge_private.test.ts | 2 +- .../end-to-end/src/e2e_outbox.test.ts | 6 +- .../end-to-end/src/shared/uniswap_l1_l2.ts | 9 +- .../ethereum/src/deploy_l1_contracts.ts | 8 +- yarn-project/foundation/src/config/env_var.ts | 2 +- .../p2p/src/client/p2p_client.test.ts | 11 +- 25 files changed, 167 insertions(+), 151 deletions(-) rename yarn-project/cli/src/cmds/l1/{assume_proven_until.ts => assume_proven_through.ts} (76%) diff --git a/.github/workflows/devnet-deploys.yml b/.github/workflows/devnet-deploys.yml index 1749cb4c1fb..0edded3dcb1 100644 --- a/.github/workflows/devnet-deploys.yml +++ b/.github/workflows/devnet-deploys.yml @@ -735,7 +735,7 @@ jobs: # working-directory: ./yarn-project/aztec/terraform/pxe # run: | # set -eo pipefail - # docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} set-proven-until \ + # docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} set-proven-through \ # --rpc-url https://api.aztec.network/${{ env.DEPLOY_TAG }}/aztec-pxe/${{ env.API_KEY }} \ # --l1-rpc-url https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/admin-${{ env.FORK_ADMIN_API_KEY }} \ # --l1-chain-id ${{ env.L1_CHAIN_ID }} \ diff --git a/docker-compose.provernet.yml b/docker-compose.provernet.yml index 7fdf67c3b6a..1084e28bf7b 100644 --- a/docker-compose.provernet.yml +++ b/docker-compose.provernet.yml @@ -32,7 +32,7 @@ services: SEQ_PUBLISHER_PRIVATE_KEY: "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a" VALIDATOR_PRIVATE_KEY: "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a" PROVER_REAL_PROOFS: "${PROVER_REAL_PROOFS:-false}" - ASSUME_PROVEN_UNTIL_BLOCK_NUMBER: "${ASSUME_PROVEN_UNTIL_BLOCK_NUMBER:-4}" + ASSUME_PROVEN_THROUGH_BLOCK_NUMBER: "${ASSUME_PROVEN_THROUGH_BLOCK_NUMBER:-4}" P2P_ENABLED: false IS_DEV_NET: true volumes: @@ -104,7 +104,7 @@ services: PROVER_AGENT_ENABLED: false PROVER_PUBLISHER_PRIVATE_KEY: "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97" PROVER_REAL_PROOFS: "${PROVER_REAL_PROOFS:-false}" - ASSUME_PROVEN_UNTIL_BLOCK_NUMBER: "${ASSUME_PROVEN_UNTIL_BLOCK_NUMBER:-4}" + ASSUME_PROVEN_THROUGH_BLOCK_NUMBER: "${ASSUME_PROVEN_THROUGH_BLOCK_NUMBER:-4}" IS_DEV_NET: true volumes: - ./log/aztec-prover/:/usr/src/yarn-project/aztec/log:rw diff --git a/l1-contracts/src/core/Rollup.sol b/l1-contracts/src/core/Rollup.sol index f2f6f13c12d..cdda726092b 100644 --- a/l1-contracts/src/core/Rollup.sol +++ b/l1-contracts/src/core/Rollup.sol @@ -35,6 +35,11 @@ import {Leonidas} from "./sequencer_selection/Leonidas.sol"; contract Rollup is Leonidas, IRollup, ITestRollup { using SafeCast for uint256; + struct ChainTips { + uint256 pendingBlockNumber; + uint256 provenBlockNumber; + } + struct BlockLog { bytes32 archive; bytes32 blockHash; @@ -52,11 +57,9 @@ contract Rollup is Leonidas, IRollup, ITestRollup { IOutbox public immutable OUTBOX; uint256 public immutable VERSION; IFeeJuicePortal public immutable FEE_JUICE_PORTAL; - IVerifier public verifier; - uint256 public pendingBlockCount; - uint256 public provenBlockCount; + ChainTips public tips; // @todo Validate assumption: // Currently we assume that the archive root following a block is specific to the block @@ -67,9 +70,9 @@ contract Rollup is Leonidas, IRollup, ITestRollup { bytes32 public vkTreeRoot; - // @note Assume that all blocks up to this value are automatically proven. Speeds up bootstrapping. + // @note Assume that all blocks up to this value (inclusive) are automatically proven. Speeds up bootstrapping. // Testing only. This should be removed eventually. - uint256 private assumeProvenUntilBlockNumber; + uint256 private assumeProvenThroughBlockNumber; constructor( IRegistry _registry, @@ -93,9 +96,6 @@ contract Rollup is Leonidas, IRollup, ITestRollup { blockHash: bytes32(0), slotNumber: 0 }); - pendingBlockCount = 1; - provenBlockCount = 1; - for (uint256 i = 0; i < _validators.length; i++) { _addValidator(_validators[i]); } @@ -110,11 +110,11 @@ contract Rollup is Leonidas, IRollup, ITestRollup { * @dev While in devnet, this will be guarded behind an `onlyOwner` */ function prune() external override(IRollup) onlyOwner { - if (pendingBlockCount == provenBlockCount) { + if (tips.pendingBlockNumber == tips.provenBlockNumber) { revert Errors.Rollup__NothingToPrune(); } - BlockLog storage firstPendingNotInProven = blocks[provenBlockCount]; + BlockLog storage firstPendingNotInProven = blocks[tips.provenBlockNumber + 1]; uint256 prunableAtSlot = uint256(firstPendingNotInProven.slotNumber) + TIMELINESS_PROVING_IN_SLOTS; uint256 currentSlot = getCurrentSlot(); @@ -123,29 +123,30 @@ contract Rollup is Leonidas, IRollup, ITestRollup { revert Errors.Rollup__NotReadyToPrune(currentSlot, prunableAtSlot); } - // @note We are not deleting the blocks, but we are "winding back" the pendingBlockCount - // to the last block that was proven. - // The reason we can do this, is that any new block proposed will overwrite a previous block - // so no values should "survive". It it is however slightly odd for people reading - // the chain separately from the contract without using pendingBlockCount as a boundary. - pendingBlockCount = provenBlockCount; + uint256 pending = tips.pendingBlockNumber; - emit PrunedPending(provenBlockCount, pendingBlockCount); + // @note We are not deleting the blocks, but we are "winding back" the pendingTip to the last block that was proven. + // We can do because any new block proposed will overwrite a previous block in the block log, + // so no values should "survive". + // People must therefore read the chain using the pendingTip as a boundary. + tips.pendingBlockNumber = tips.provenBlockNumber; + + emit PrunedPending(tips.provenBlockNumber, pending); } /** - * Sets the assumeProvenUntilBlockNumber. Only the contract deployer can set it. + * Sets the assumeProvenThroughBlockNumber. Only the contract deployer can set it. * @param blockNumber - New value. */ - function setAssumeProvenUntilBlockNumber(uint256 blockNumber) + function setAssumeProvenThroughBlockNumber(uint256 blockNumber) external override(ITestRollup) onlyOwner { - if (blockNumber > provenBlockCount && blockNumber <= pendingBlockCount) { - provenBlockCount = blockNumber; + if (blockNumber > tips.provenBlockNumber && blockNumber <= tips.pendingBlockNumber) { + tips.provenBlockNumber = blockNumber; } - assumeProvenUntilBlockNumber = blockNumber; + assumeProvenThroughBlockNumber = blockNumber; } /** @@ -170,15 +171,6 @@ contract Rollup is Leonidas, IRollup, ITestRollup { vkTreeRoot = _vkTreeRoot; } - function computeTxsEffectsHash(bytes calldata _body) - external - pure - override(IRollup) - returns (bytes32) - { - return TxsDecoder.decode(_body); - } - /** * @notice Publishes the body and propose the block * @dev `eth_log_handlers` rely on this function @@ -213,14 +205,16 @@ contract Rollup is Leonidas, IRollup, ITestRollup { _flags: DataStructures.ExecutionFlags({ignoreDA: false, ignoreSignatures: false}) }); - blocks[pendingBlockCount++] = BlockLog({ + uint256 blockNumber = ++tips.pendingBlockNumber; + + blocks[blockNumber] = BlockLog({ archive: _archive, blockHash: _blockHash, slotNumber: header.globalVariables.slotNumber.toUint128() }); // @note The block number here will always be >=1 as the genesis block is at 0 - bytes32 inHash = INBOX.consume(header.globalVariables.blockNumber); + bytes32 inHash = INBOX.consume(blockNumber); if (header.contentCommitment.inHash != inHash) { revert Errors.Rollup__InvalidInHash(inHash, header.contentCommitment.inHash); } @@ -229,15 +223,13 @@ contract Rollup is Leonidas, IRollup, ITestRollup { // Min size = smallest path of the rollup tree + 1 (uint256 min,) = MerkleLib.computeMinMaxPathLength(header.contentCommitment.numTxs); uint256 l2ToL1TreeMinHeight = min + 1; - OUTBOX.insert( - header.globalVariables.blockNumber, header.contentCommitment.outHash, l2ToL1TreeMinHeight - ); + OUTBOX.insert(blockNumber, header.contentCommitment.outHash, l2ToL1TreeMinHeight); - emit L2BlockProposed(header.globalVariables.blockNumber); + emit L2BlockProposed(blockNumber); - // Automatically flag the block as proven if we have cheated and set assumeProvenUntilBlockNumber. - if (header.globalVariables.blockNumber < assumeProvenUntilBlockNumber) { - provenBlockCount += 1; + // Automatically flag the block as proven if we have cheated and set assumeProvenThroughBlockNumber. + if (blockNumber <= assumeProvenThroughBlockNumber) { + tips.provenBlockNumber = blockNumber; if (header.globalVariables.coinbase != address(0) && header.totalFees > 0) { // @note This will currently fail if there are insufficient funds in the bridge @@ -246,7 +238,7 @@ contract Rollup is Leonidas, IRollup, ITestRollup { FEE_JUICE_PORTAL.distributeFees(header.globalVariables.coinbase, header.totalFees); } - emit L2ProofVerified(header.globalVariables.blockNumber, "CHEAT"); + emit L2ProofVerified(blockNumber, "CHEAT"); } } @@ -283,20 +275,19 @@ contract Rollup is Leonidas, IRollup, ITestRollup { ) external override(IRollup) { HeaderLib.Header memory header = HeaderLib.decode(_header); - if (header.globalVariables.blockNumber >= pendingBlockCount) { + if (header.globalVariables.blockNumber > tips.pendingBlockNumber) { revert Errors.Rollup__TryingToProveNonExistingBlock(); } // @note This implicitly also ensures that we have not already proven, since - // the value `provenBlockCount` is incremented at the end of this function - if (header.globalVariables.blockNumber != provenBlockCount) { + // the value `tips.provenBlockNumber` is incremented at the end of this function + if (header.globalVariables.blockNumber != tips.provenBlockNumber + 1) { revert Errors.Rollup__NonSequentialProving(); } bytes32 expectedLastArchive = blocks[header.globalVariables.blockNumber - 1].archive; // We do it this way to provide better error messages than passing along the storage values - // TODO(#4148) Proper genesis state. If the state is empty, we allow anything for now. - if (expectedLastArchive != bytes32(0) && header.lastArchive.root != expectedLastArchive) { + if (header.lastArchive.root != expectedLastArchive) { revert Errors.Rollup__InvalidArchive(expectedLastArchive, header.lastArchive.root); } @@ -375,7 +366,7 @@ contract Rollup is Leonidas, IRollup, ITestRollup { revert Errors.Rollup__InvalidProof(); } - provenBlockCount += 1; + tips.provenBlockNumber = header.globalVariables.blockNumber; for (uint256 i = 0; i < 32; i++) { address coinbase = address(uint160(uint256(publicInputs[25 + i * 2]))); @@ -419,7 +410,7 @@ contract Rollup is Leonidas, IRollup, ITestRollup { { uint256 slot = getSlotAt(_ts); - uint256 lastSlot = uint256(blocks[pendingBlockCount - 1].slotNumber); + uint256 lastSlot = uint256(blocks[tips.pendingBlockNumber].slotNumber); if (slot <= lastSlot) { revert Errors.Rollup__SlotAlreadyInChain(lastSlot, slot); } @@ -435,7 +426,7 @@ contract Rollup is Leonidas, IRollup, ITestRollup { DataStructures.ExecutionFlags({ignoreDA: true, ignoreSignatures: true}); _validateLeonidas(slot, sigs, _archive, flags); - return (slot, pendingBlockCount); + return (slot, tips.pendingBlockNumber + 1); } /** @@ -462,13 +453,30 @@ contract Rollup is Leonidas, IRollup, ITestRollup { _validateHeader(header, _signatures, _digest, _currentTime, _txsEffectsHash, _flags); } + function computeTxsEffectsHash(bytes calldata _body) + external + pure + override(IRollup) + returns (bytes32) + { + return TxsDecoder.decode(_body); + } + /** * @notice Get the current archive root * * @return bytes32 - The current archive root */ function archive() public view override(IRollup) returns (bytes32) { - return blocks[pendingBlockCount - 1].archive; + return blocks[tips.pendingBlockNumber].archive; + } + + function getProvenBlockNumber() public view override(IRollup) returns (uint256) { + return tips.provenBlockNumber; + } + + function getPendingBlockNumber() public view override(IRollup) returns (uint256) { + return tips.pendingBlockNumber; } /** @@ -569,9 +577,9 @@ contract Rollup is Leonidas, IRollup, ITestRollup { revert Errors.Rollup__InvalidVersion(VERSION, _header.globalVariables.version); } - if (_header.globalVariables.blockNumber != pendingBlockCount) { + if (_header.globalVariables.blockNumber != tips.pendingBlockNumber + 1) { revert Errors.Rollup__InvalidBlockNumber( - pendingBlockCount, _header.globalVariables.blockNumber + tips.pendingBlockNumber + 1, _header.globalVariables.blockNumber ); } @@ -585,7 +593,7 @@ contract Rollup is Leonidas, IRollup, ITestRollup { revert Errors.Rollup__SlotValueTooLarge(slot); } - uint256 lastSlot = uint256(blocks[pendingBlockCount - 1].slotNumber); + uint256 lastSlot = uint256(blocks[tips.pendingBlockNumber].slotNumber); if (slot <= lastSlot) { revert Errors.Rollup__SlotAlreadyInChain(lastSlot, slot); } diff --git a/l1-contracts/src/core/interfaces/IRollup.sol b/l1-contracts/src/core/interfaces/IRollup.sol index baad94fe07c..131a71289c6 100644 --- a/l1-contracts/src/core/interfaces/IRollup.sol +++ b/l1-contracts/src/core/interfaces/IRollup.sol @@ -11,32 +11,16 @@ import {DataStructures} from "../libraries/DataStructures.sol"; interface ITestRollup { function setVerifier(address _verifier) external; function setVkTreeRoot(bytes32 _vkTreeRoot) external; - function setAssumeProvenUntilBlockNumber(uint256 blockNumber) external; + function setAssumeProvenThroughBlockNumber(uint256 blockNumber) external; } interface IRollup { event L2BlockProposed(uint256 indexed blockNumber); event L2ProofVerified(uint256 indexed blockNumber, bytes32 indexed proverId); - event PrunedPending(uint256 provenBlockCount, uint256 pendingBlockCount); - - function canProposeAtTime(uint256 _ts, bytes32 _archive) external view returns (uint256, uint256); - function validateHeader( - bytes calldata _header, - SignatureLib.Signature[] memory _signatures, - bytes32 _digest, - uint256 _currentTime, - bytes32 _txsEffecstHash, - DataStructures.ExecutionFlags memory _flags - ) external view; + event PrunedPending(uint256 provenBlockNumber, uint256 pendingBlockNumber); function prune() external; - function INBOX() external view returns (IInbox); - - function OUTBOX() external view returns (IOutbox); - - function L1_BLOCK_AT_GENESIS() external view returns (uint256); - function propose( bytes calldata _header, bytes32 _archive, @@ -54,6 +38,22 @@ interface IRollup { bytes calldata _proof ) external; + function canProposeAtTime(uint256 _ts, bytes32 _archive) external view returns (uint256, uint256); + function validateHeader( + bytes calldata _header, + SignatureLib.Signature[] memory _signatures, + bytes32 _digest, + uint256 _currentTime, + bytes32 _txsEffecstHash, + DataStructures.ExecutionFlags memory _flags + ) external view; + + function INBOX() external view returns (IInbox); + + function OUTBOX() external view returns (IOutbox); + + function L1_BLOCK_AT_GENESIS() external view returns (uint256); + // TODO(#7346): Integrate batch rollups // function submitRootProof( // bytes32 _previousArchive, @@ -68,5 +68,7 @@ interface IRollup { function archive() external view returns (bytes32); function archiveAt(uint256 _blockNumber) external view returns (bytes32); + function getProvenBlockNumber() external view returns (uint256); + function getPendingBlockNumber() external view returns (uint256); function computeTxsEffectsHash(bytes calldata _body) external pure returns (bytes32); } diff --git a/l1-contracts/src/core/messagebridge/Outbox.sol b/l1-contracts/src/core/messagebridge/Outbox.sol index d4131930d8c..5b0e1ebe47c 100644 --- a/l1-contracts/src/core/messagebridge/Outbox.sol +++ b/l1-contracts/src/core/messagebridge/Outbox.sol @@ -81,7 +81,7 @@ contract Outbox is IOutbox { uint256 _leafIndex, bytes32[] calldata _path ) external override(IOutbox) { - if (_l2BlockNumber >= ROLLUP.provenBlockCount()) { + if (_l2BlockNumber > ROLLUP.getProvenBlockNumber()) { revert Errors.Outbox__BlockNotProven(_l2BlockNumber); } @@ -157,7 +157,7 @@ contract Outbox is IOutbox { override(IOutbox) returns (bytes32 root, uint256 minHeight) { - if (_l2BlockNumber >= ROLLUP.provenBlockCount()) { + if (_l2BlockNumber > ROLLUP.getProvenBlockNumber()) { return (bytes32(0), 0); } RootData storage rootData = roots[_l2BlockNumber]; diff --git a/l1-contracts/test/Outbox.t.sol b/l1-contracts/test/Outbox.t.sol index 420e16625c7..f25bfd2e1b9 100644 --- a/l1-contracts/test/Outbox.t.sol +++ b/l1-contracts/test/Outbox.t.sol @@ -12,10 +12,10 @@ import {NaiveMerkle} from "./merkle/Naive.sol"; import {MerkleTestUtil} from "./merkle/TestUtil.sol"; contract FakeRollup { - uint256 public provenBlockCount = 1; + uint256 public getProvenBlockNumber = 0; - function setProvenBlockCount(uint256 _provenBlockCount) public { - provenBlockCount = _provenBlockCount; + function setProvenBlockNum(uint256 _provenBlockNum) public { + getProvenBlockNumber = _provenBlockNum; } } @@ -33,7 +33,7 @@ contract OutboxTest is Test { function setUp() public { ROLLUP_CONTRACT = address(new FakeRollup()); - FakeRollup(ROLLUP_CONTRACT).setProvenBlockCount(2); + FakeRollup(ROLLUP_CONTRACT).setProvenBlockNum(1); outbox = new Outbox(ROLLUP_CONTRACT); zeroedTree = new NaiveMerkle(DEFAULT_TREE_HEIGHT); @@ -203,7 +203,7 @@ contract OutboxTest is Test { } function testRevertIfConsumingFromTreeNotProven() public { - FakeRollup(ROLLUP_CONTRACT).setProvenBlockCount(1); + FakeRollup(ROLLUP_CONTRACT).setProvenBlockNum(0); DataStructures.L2ToL1Msg memory fakeMessage = _fakeMessage(address(this)); bytes32 leaf = fakeMessage.sha256ToField(); @@ -256,7 +256,7 @@ contract OutboxTest is Test { uint8 _size ) public { uint256 blockNumber = bound(_blockNumber, 1, 256); - FakeRollup(ROLLUP_CONTRACT).setProvenBlockCount(blockNumber + 1); + FakeRollup(ROLLUP_CONTRACT).setProvenBlockNum(blockNumber); uint256 numberOfMessages = bound(_size, 1, _recipients.length); DataStructures.L2ToL1Msg[] memory messages = new DataStructures.L2ToL1Msg[](numberOfMessages); diff --git a/l1-contracts/test/Rollup.t.sol b/l1-contracts/test/Rollup.t.sol index e9b1f899eaa..807d4563b05 100644 --- a/l1-contracts/test/Rollup.t.sol +++ b/l1-contracts/test/Rollup.t.sol @@ -138,8 +138,8 @@ contract RollupTest is DecoderBase { uint256 timeOfPrune = rollup.getTimestampForSlot(prunableAt); vm.warp(timeOfPrune); - assertEq(rollup.pendingBlockCount(), 2, "Invalid pending block count"); - assertEq(rollup.provenBlockCount(), 1, "Invalid proven block count"); + assertEq(rollup.getPendingBlockNumber(), 1, "Invalid pending block number"); + assertEq(rollup.getProvenBlockNumber(), 0, "Invalid proven block number"); // @note Get the root and min height that we have in the outbox. // We read it directly in storage because it is not yet proven, so the getter will give (0, 0). @@ -154,8 +154,8 @@ contract RollupTest is DecoderBase { rollup.prune(); assertEq(inbox.inProgress(), 3, "Invalid in progress"); - assertEq(rollup.pendingBlockCount(), 1, "Invalid pending block count"); - assertEq(rollup.provenBlockCount(), 1, "Invalid proven block count"); + assertEq(rollup.getPendingBlockNumber(), 0, "Invalid pending block number"); + assertEq(rollup.getProvenBlockNumber(), 0, "Invalid proven block number"); // @note We alter what slot is specified in the empty block! // This means that we keep the `empty_block_1` mostly as is, but replace the slot number @@ -166,8 +166,8 @@ contract RollupTest is DecoderBase { assertEq(inbox.inProgress(), 3, "Invalid in progress"); assertEq(inbox.getRoot(2), inboxRoot2, "Invalid inbox root"); - assertEq(rollup.pendingBlockCount(), 2, "Invalid pending block count"); - assertEq(rollup.provenBlockCount(), 1, "Invalid proven block count"); + assertEq(rollup.getPendingBlockNumber(), 1, "Invalid pending block number"); + assertEq(rollup.getProvenBlockNumber(), 0, "Invalid proven block number"); // We check that the roots in the outbox have correctly been updated. bytes32 rootEmpty = vm.load(address(outbox), keccak256(abi.encode(1, 0))); @@ -232,8 +232,8 @@ contract RollupTest is DecoderBase { function testMixedBlock(bool _toProve) public setUpFor("mixed_block_1") { _testBlock("mixed_block_1", _toProve); - assertEq(rollup.pendingBlockCount(), 2, "Invalid pending block count"); - assertEq(rollup.provenBlockCount(), _toProve ? 2 : 1, "Invalid proven block count"); + assertEq(rollup.getPendingBlockNumber(), 1, "Invalid pending block number"); + assertEq(rollup.getProvenBlockNumber(), _toProve ? 1 : 0, "Invalid proven block number"); } function testConsecutiveMixedBlocks(uint256 _blocksToProve) public setUpFor("mixed_block_1") { @@ -242,8 +242,8 @@ contract RollupTest is DecoderBase { _testBlock("mixed_block_1", toProve > 0); _testBlock("mixed_block_2", toProve > 1); - assertEq(rollup.pendingBlockCount(), 3, "Invalid pending block count"); - assertEq(rollup.provenBlockCount(), 1 + toProve, "Invalid proven block count"); + assertEq(rollup.getPendingBlockNumber(), 2, "Invalid pending block number"); + assertEq(rollup.getProvenBlockNumber(), 0 + toProve, "Invalid proven block number"); } function testConsecutiveMixedBlocksNonSequentialProof() public setUpFor("mixed_block_1") { @@ -261,14 +261,14 @@ contract RollupTest is DecoderBase { vm.expectRevert(abi.encodeWithSelector(Errors.Rollup__NonSequentialProving.selector)); rollup.submitBlockRootProof(header, archive, bytes32(0), "", ""); - assertEq(rollup.pendingBlockCount(), 3, "Invalid pending block count"); - assertEq(rollup.provenBlockCount(), 1, "Invalid proven block count"); + assertEq(rollup.getPendingBlockNumber(), 2, "Invalid pending block number"); + assertEq(rollup.getProvenBlockNumber(), 0, "Invalid proven block number"); } function testEmptyBlock(bool _toProve) public setUpFor("empty_block_1") { _testBlock("empty_block_1", _toProve); - assertEq(rollup.pendingBlockCount(), 2, "Invalid pending block count"); - assertEq(rollup.provenBlockCount(), _toProve ? 2 : 1, "Invalid proven block count"); + assertEq(rollup.getPendingBlockNumber(), 1, "Invalid pending block number"); + assertEq(rollup.getProvenBlockNumber(), _toProve ? 1 : 0, "Invalid proven block number"); } function testConsecutiveEmptyBlocks(uint256 _blocksToProve) public setUpFor("empty_block_1") { @@ -276,8 +276,8 @@ contract RollupTest is DecoderBase { _testBlock("empty_block_1", toProve > 0); _testBlock("empty_block_2", toProve > 1); - assertEq(rollup.pendingBlockCount(), 3, "Invalid pending block count"); - assertEq(rollup.provenBlockCount(), 1 + toProve, "Invalid proven block count"); + assertEq(rollup.getPendingBlockNumber(), 2, "Invalid pending block number"); + assertEq(rollup.getProvenBlockNumber(), 0 + toProve, "Invalid proven block number"); } function testRevertInvalidBlockNumber() public setUpFor("empty_block_1") { @@ -347,27 +347,27 @@ contract RollupTest is DecoderBase { } function testBlocksWithAssumeProven() public setUpFor("mixed_block_1") { - rollup.setAssumeProvenUntilBlockNumber(2); - assertEq(rollup.pendingBlockCount(), 1, "Invalid pending block count"); - assertEq(rollup.provenBlockCount(), 1, "Invalid proven block count"); + rollup.setAssumeProvenThroughBlockNumber(1); + assertEq(rollup.getPendingBlockNumber(), 0, "Invalid pending block number"); + assertEq(rollup.getProvenBlockNumber(), 0, "Invalid proven block number"); _testBlock("mixed_block_1", false); _testBlock("mixed_block_2", false); - assertEq(rollup.pendingBlockCount(), 3, "Invalid pending block count"); - assertEq(rollup.provenBlockCount(), 2, "Invalid proven block count"); + assertEq(rollup.getPendingBlockNumber(), 2, "Invalid pending block number"); + assertEq(rollup.getProvenBlockNumber(), 1, "Invalid proven block number"); } function testSetAssumeProvenAfterBlocksProcessed() public setUpFor("mixed_block_1") { - assertEq(rollup.pendingBlockCount(), 1, "Invalid pending block count"); - assertEq(rollup.provenBlockCount(), 1, "Invalid proven block count"); + assertEq(rollup.getPendingBlockNumber(), 0, "Invalid pending block number"); + assertEq(rollup.getProvenBlockNumber(), 0, "Invalid proven block number"); _testBlock("mixed_block_1", false); _testBlock("mixed_block_2", false); - rollup.setAssumeProvenUntilBlockNumber(2); + rollup.setAssumeProvenThroughBlockNumber(1); - assertEq(rollup.pendingBlockCount(), 3, "Invalid pending block count"); - assertEq(rollup.provenBlockCount(), 2, "Invalid proven block count"); + assertEq(rollup.getPendingBlockNumber(), 2, "Invalid pending block number"); + assertEq(rollup.getProvenBlockNumber(), 1, "Invalid proven block number"); } function testSubmitProofNonExistantBlock() public setUpFor("empty_block_1") { @@ -446,11 +446,11 @@ contract RollupTest is DecoderBase { rollup.propose(header, archive, bytes32(0), txHashes, signatures, body); if (_submitProof) { - uint256 pre = rollup.provenBlockCount(); + uint256 pre = rollup.getProvenBlockNumber(); rollup.submitBlockRootProof(header, archive, bytes32(0), "", ""); - assertEq(pre + 1, rollup.provenBlockCount(), "Block not proven"); + assertEq(pre + 1, rollup.getProvenBlockNumber(), "Block not proven"); } bytes32 l2ToL1MessageTreeRoot; @@ -484,7 +484,7 @@ contract RollupTest is DecoderBase { (bytes32 root,) = outbox.getRootData(full.block.decodedHeader.globalVariables.blockNumber); // If we are trying to read a block beyond the proven chain, we should see "nothing". - if (rollup.provenBlockCount() > full.block.decodedHeader.globalVariables.blockNumber) { + if (rollup.getProvenBlockNumber() >= full.block.decodedHeader.globalVariables.blockNumber) { assertEq(l2ToL1MessageTreeRoot, root, "Invalid l2 to l1 message tree root"); } else { assertEq(root, bytes32(0), "Invalid outbox root"); diff --git a/l1-contracts/test/portals/TokenPortal.t.sol b/l1-contracts/test/portals/TokenPortal.t.sol index 96104d54ddb..5832c544437 100644 --- a/l1-contracts/test/portals/TokenPortal.t.sol +++ b/l1-contracts/test/portals/TokenPortal.t.sol @@ -71,8 +71,8 @@ contract TokenPortalTest is Test { tokenPortal.initialize(address(registry), address(portalERC20), l2TokenAddress); // Modify the proven block count - vm.store(address(rollup), bytes32(uint256(7)), bytes32(l2BlockNumber + 1)); - assertEq(rollup.provenBlockCount(), l2BlockNumber + 1); + vm.store(address(rollup), bytes32(uint256(7)), bytes32(l2BlockNumber)); + assertEq(rollup.getProvenBlockNumber(), l2BlockNumber); vm.deal(address(this), 100 ether); } diff --git a/l1-contracts/test/portals/UniswapPortal.t.sol b/l1-contracts/test/portals/UniswapPortal.t.sol index 0f506b279ef..f0710fa9c3b 100644 --- a/l1-contracts/test/portals/UniswapPortal.t.sol +++ b/l1-contracts/test/portals/UniswapPortal.t.sol @@ -67,7 +67,7 @@ contract UniswapPortalTest is Test { // Modify the proven block count vm.store(address(rollup), bytes32(uint256(7)), bytes32(l2BlockNumber + 1)); - assertEq(rollup.provenBlockCount(), l2BlockNumber + 1); + assertEq(rollup.getProvenBlockNumber(), l2BlockNumber + 1); // have DAI locked in portal that can be moved when funds are withdrawn deal(address(DAI), address(daiTokenPortal), amount); diff --git a/l1-contracts/test/sparta/Sparta.t.sol b/l1-contracts/test/sparta/Sparta.t.sol index 57e15b2d5b5..f00adf2ea2d 100644 --- a/l1-contracts/test/sparta/Sparta.t.sol +++ b/l1-contracts/test/sparta/Sparta.t.sol @@ -259,7 +259,7 @@ contract SpartaTest is DecoderBase { (bytes32 root,) = outbox.getRootData(full.block.decodedHeader.globalVariables.blockNumber); // If we are trying to read a block beyond the proven chain, we should see "nothing". - if (rollup.provenBlockCount() > full.block.decodedHeader.globalVariables.blockNumber) { + if (rollup.getProvenBlockNumber() >= full.block.decodedHeader.globalVariables.blockNumber) { assertEq(l2ToL1MessageTreeRoot, root, "Invalid l2 to l1 message tree root"); } else { assertEq(root, bytes32(0), "Invalid outbox root"); diff --git a/yarn-project/aztec.js/src/utils/anvil_test_watcher.ts b/yarn-project/aztec.js/src/utils/anvil_test_watcher.ts index 1b6e0cf7f63..859799fd130 100644 --- a/yarn-project/aztec.js/src/utils/anvil_test_watcher.ts +++ b/yarn-project/aztec.js/src/utils/anvil_test_watcher.ts @@ -61,7 +61,7 @@ export class AnvilTestWatcher { async mineIfSlotFilled() { try { const currentSlot = await this.rollup.read.getCurrentSlot(); - const pendingBlockNumber = BigInt(await this.rollup.read.pendingBlockCount()) - 1n; + const pendingBlockNumber = BigInt(await this.rollup.read.getPendingBlockNumber()); const [, , lastSlotNumber] = await this.rollup.read.blocks([pendingBlockNumber]); if (currentSlot === lastSlotNumber) { diff --git a/yarn-project/aztec/src/cli/aztec_start_options.ts b/yarn-project/aztec/src/cli/aztec_start_options.ts index 4b551d2dc24..99aa5c54218 100644 --- a/yarn-project/aztec/src/cli/aztec_start_options.ts +++ b/yarn-project/aztec/src/cli/aztec_start_options.ts @@ -180,10 +180,10 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = { parseVal: (val: string) => (val ? parseInt(val) : undefined), }, { - flag: '--node.assumeProvenUntilBlockNumber', + flag: '--node.assumeProvenThroughBlockNumber', description: 'Cheats the rollup contract into assuming every block until this one is proven. Useful for speeding up bootstraps.', - envVar: 'ASSUME_PROVEN_UNTIL_BLOCK_NUMBER', + envVar: 'ASSUME_PROVEN_THROUGH_BLOCK_NUMBER', parseVal: (val: string) => parseInt(val, 10), defaultValue: 0, }, diff --git a/yarn-project/aztec/src/cli/cmds/start_node.ts b/yarn-project/aztec/src/cli/cmds/start_node.ts index 85f0f14fa54..80d538c675d 100644 --- a/yarn-project/aztec/src/cli/cmds/start_node.ts +++ b/yarn-project/aztec/src/cli/cmds/start_node.ts @@ -47,7 +47,7 @@ export const startNode = async ( throw new Error('--node.publisherPrivateKey or --l1-mnemonic is required to deploy L1 contracts'); } await deployContractsToL1(nodeConfig, account!, undefined, { - assumeProvenUntilBlockNumber: nodeSpecificOptions.assumeProvenUntilBlockNumber, + assumeProvenThroughBlockNumber: nodeSpecificOptions.assumeProvenThroughBlockNumber, salt: nodeSpecificOptions.deployAztecContractsSalt, }); } diff --git a/yarn-project/aztec/src/sandbox.ts b/yarn-project/aztec/src/sandbox.ts index 200cdcbe04f..f5f9464445c 100644 --- a/yarn-project/aztec/src/sandbox.ts +++ b/yarn-project/aztec/src/sandbox.ts @@ -88,7 +88,7 @@ export async function deployContractsToL1( aztecNodeConfig: AztecNodeConfig, hdAccount: HDAccount | PrivateKeyAccount, contractDeployLogger = logger, - opts: { assumeProvenUntilBlockNumber?: number; salt?: number } = {}, + opts: { assumeProvenThroughBlockNumber?: number; salt?: number } = {}, ) { const l1Artifacts: L1ContractArtifactsForDeployment = { registry: { @@ -125,7 +125,7 @@ export async function deployContractsToL1( deployL1Contracts(aztecNodeConfig.l1RpcUrl, hdAccount, chain.chainInfo, contractDeployLogger, l1Artifacts, { l2FeeJuiceAddress: FeeJuiceAddress, vkTreeRoot: getVKTreeRoot(), - assumeProvenUntil: opts.assumeProvenUntilBlockNumber, + assumeProvenThrough: opts.assumeProvenThroughBlockNumber, salt: opts.salt, }), ); diff --git a/yarn-project/cli/src/cmds/l1/assume_proven_until.ts b/yarn-project/cli/src/cmds/l1/assume_proven_through.ts similarity index 76% rename from yarn-project/cli/src/cmds/l1/assume_proven_until.ts rename to yarn-project/cli/src/cmds/l1/assume_proven_through.ts index 18a106a7870..23102deb8d1 100644 --- a/yarn-project/cli/src/cmds/l1/assume_proven_until.ts +++ b/yarn-project/cli/src/cmds/l1/assume_proven_through.ts @@ -2,9 +2,9 @@ import { createPXEClient, makeFetch } from '@aztec/aztec.js'; import { createEthereumChain, createL1Clients } from '@aztec/ethereum'; import { type LogFn } from '@aztec/foundation/log'; -import { setAssumeProvenUntil } from '../../utils/aztec.js'; +import { setAssumeProvenThrough } from '../../utils/aztec.js'; -export async function assumeProvenUntil( +export async function assumeProvenThrough( blockNumberOrLatest: number | undefined, l1RpcUrl: string, rpcUrl: string, @@ -20,6 +20,6 @@ export async function assumeProvenUntil( const rollupAddress = await pxe.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress); const blockNumber = blockNumberOrLatest ?? (await pxe.getBlockNumber()); - await setAssumeProvenUntil(blockNumber + 1, rollupAddress, walletClient); - log(`Assumed proven until block ${blockNumber}`); + await setAssumeProvenThrough(blockNumber, rollupAddress, walletClient); + log(`Assumed proven through block ${blockNumber}`); } diff --git a/yarn-project/cli/src/cmds/l1/index.ts b/yarn-project/cli/src/cmds/l1/index.ts index 4f8dd9ae6d6..e8729fa3aac 100644 --- a/yarn-project/cli/src/cmds/l1/index.ts +++ b/yarn-project/cli/src/cmds/l1/index.ts @@ -246,7 +246,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL }); program - .command('set-proven-until', { hidden: true }) + .command('set-proven-through', { hidden: true }) .description( 'Instructs the L1 rollup contract to assume all blocks until the given number are automatically proven.', ) @@ -265,8 +265,8 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL .addOption(l1ChainIdOption) .option('--l1-private-key ', 'The private key to use for deployment', PRIVATE_KEY) .action(async (blockNumber, options) => { - const { assumeProvenUntil } = await import('./assume_proven_until.js'); - await assumeProvenUntil( + const { assumeProvenThrough } = await import('./assume_proven_through.js'); + await assumeProvenThrough( blockNumber, options.l1RpcUrl, options.rpcUrl, diff --git a/yarn-project/cli/src/cmds/l1/update_l1_validators.ts b/yarn-project/cli/src/cmds/l1/update_l1_validators.ts index a230ed32b3b..b7459beb4b7 100644 --- a/yarn-project/cli/src/cmds/l1/update_l1_validators.ts +++ b/yarn-project/cli/src/cmds/l1/update_l1_validators.ts @@ -100,10 +100,10 @@ export async function debugRollup({ rpcUrl, chainId, rollupAddress, log }: Rollu client: publicClient, }); - const pendingCount = await rollup.read.pendingBlockCount(); - log(`Pending block count: ${pendingCount}`); - const provenCount = await rollup.read.provenBlockCount(); - log(`Proven block count: ${provenCount}`); + const pendingNum = await rollup.read.getPendingBlockNumber(); + log(`Pending block num: ${pendingNum}`); + const provenNum = await rollup.read.getProvenBlockNumber(); + log(`Proven block num: ${provenNum}`); const validators = await rollup.read.getValidators(); log(`Validators: ${validators.map(v => v.toString()).join(', ')}`); const committee = await rollup.read.getCurrentEpochCommittee(); diff --git a/yarn-project/cli/src/utils/aztec.ts b/yarn-project/cli/src/utils/aztec.ts index 921fd4ac56d..71919cd8ec7 100644 --- a/yarn-project/cli/src/utils/aztec.ts +++ b/yarn-project/cli/src/utils/aztec.ts @@ -118,7 +118,7 @@ export async function deployAztecContracts( } /** Sets the assumed proven block number on the rollup contract on L1 */ -export async function setAssumeProvenUntil( +export async function setAssumeProvenThrough( blockNumber: number, rollupAddress: EthAddress, walletClient: WalletClient, @@ -128,7 +128,7 @@ export async function setAssumeProvenUntil( abi: RollupAbi, client: walletClient, }); - const hash = await rollup.write.setAssumeProvenUntilBlockNumber([BigInt(blockNumber)]); + const hash = await rollup.write.setAssumeProvenThroughBlockNumber([BigInt(blockNumber)]); await walletClient.extend(publicActions).waitForTransactionReceipt({ hash }); } diff --git a/yarn-project/end-to-end/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts b/yarn-project/end-to-end/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts index c9fa3c27255..6f0f889e4eb 100644 --- a/yarn-project/end-to-end/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +++ b/yarn-project/end-to-end/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts @@ -57,7 +57,7 @@ export class CrossChainMessagingTest { } async assumeProven() { - await this.rollup.write.setAssumeProvenUntilBlockNumber([await this.rollup.read.pendingBlockCount()]); + await this.rollup.write.setAssumeProvenThroughBlockNumber([await this.rollup.read.getPendingBlockNumber()]); } async setup() { diff --git a/yarn-project/end-to-end/src/e2e_cross_chain_messaging/token_bridge_private.test.ts b/yarn-project/end-to-end/src/e2e_cross_chain_messaging/token_bridge_private.test.ts index 6edd41c5599..e9a525a3da4 100644 --- a/yarn-project/end-to-end/src/e2e_cross_chain_messaging/token_bridge_private.test.ts +++ b/yarn-project/end-to-end/src/e2e_cross_chain_messaging/token_bridge_private.test.ts @@ -104,7 +104,7 @@ describe('e2e_cross_chain_messaging token_bridge_private', () => { ); // Since the outbox is only consumable when the block is proven, we need to set the block to be proven - await rollup.write.setAssumeProvenUntilBlockNumber([await rollup.read.pendingBlockCount()]); + await rollup.write.setAssumeProvenThroughBlockNumber([await rollup.read.getPendingBlockNumber()]); // Check balance before and after exit. expect(await crossChainTestHarness.getL1BalanceOf(ethAccount)).toBe(l1TokenBalance - bridgeAmount); diff --git a/yarn-project/end-to-end/src/e2e_outbox.test.ts b/yarn-project/end-to-end/src/e2e_outbox.test.ts index 2317447e9a9..a3eb8fb43a6 100644 --- a/yarn-project/end-to-end/src/e2e_outbox.test.ts +++ b/yarn-project/end-to-end/src/e2e_outbox.test.ts @@ -100,7 +100,7 @@ describe('E2E Outbox Tests', () => { // Outbox L1 tests // Since the outbox is only consumable when the block is proven, we need to set the block to be proven - await rollup.write.setAssumeProvenUntilBlockNumber([1 + (txReceipt.blockNumber ?? 0)]); + await rollup.write.setAssumeProvenThroughBlockNumber([txReceipt.blockNumber ?? 0]); // Check L1 has expected message tree const [l1Root, l1MinHeight] = await outbox.read.getRootData([txReceipt.blockNumber]); @@ -218,7 +218,7 @@ describe('E2E Outbox Tests', () => { // Outbox L1 tests // Since the outbox is only consumable when the block is proven, we need to set the block to be proven - await rollup.write.setAssumeProvenUntilBlockNumber([1 + (l2TxReceipt0.blockNumber ?? 0)]); + await rollup.write.setAssumeProvenThroughBlockNumber([l2TxReceipt0.blockNumber ?? 0]); // Check L1 has expected message tree const [l1Root, l1MinHeight] = await outbox.read.getRootData([l2TxReceipt0.blockNumber]); @@ -336,7 +336,7 @@ describe('E2E Outbox Tests', () => { // Outbox L1 tests // Since the outbox is only consumable when the block is proven, we need to set the block to be proven - await rollup.write.setAssumeProvenUntilBlockNumber([1 + (l2TxReceipt0.blockNumber ?? 0)]); + await rollup.write.setAssumeProvenThroughBlockNumber([l2TxReceipt0.blockNumber ?? 0]); // Check L1 has expected message tree const [l1Root, l1MinHeight] = await outbox.read.getRootData([l2TxReceipt0.blockNumber]); diff --git a/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts b/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts index ac626458c4e..3bebc5073aa 100644 --- a/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts +++ b/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts @@ -26,6 +26,7 @@ import { parseEther, toFunctionSelector, } from 'viem'; +import type * as chains from 'viem/chains'; import { publicDeployAccounts } from '../fixtures/utils.js'; import { CrossChainTestHarness } from './cross_chain_test_harness.js'; @@ -91,7 +92,7 @@ export const uniswapL1L2TestSuite = ( let wethCrossChainHarness: CrossChainTestHarness; let deployL1ContractsValues: DeployL1Contracts; - let rollup: any; + let rollup: GetContractReturnType>; let uniswapPortal: GetContractReturnType>; let uniswapPortalAddress: EthAddress; let uniswapL2Contract: UniswapContract; @@ -297,7 +298,7 @@ export const uniswapL1L2TestSuite = ( await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n); // Since the outbox is only consumable when the block is proven, we need to set the block to be proven - await rollup.write.setAssumeProvenUntilBlockNumber([await rollup.read.pendingBlockCount()]); + await rollup.write.setAssumeProvenThroughBlockNumber([await rollup.read.getPendingBlockNumber()]); // 5. Consume L2 to L1 message by calling uniswapPortal.swap_private() logger.info('Execute withdraw and swap on the uniswapPortal!'); @@ -932,7 +933,7 @@ export const uniswapL1L2TestSuite = ( await wethCrossChainHarness.expectPrivateBalanceOnL2(ownerAddress, wethL2BalanceBeforeSwap - wethAmountToBridge); // Since the outbox is only consumable when the block is proven, we need to set the block to be proven - await rollup.write.setAssumeProvenUntilBlockNumber([await rollup.read.pendingBlockCount()]); + await rollup.write.setAssumeProvenThroughBlockNumber([await rollup.read.getPendingBlockNumber()]); // On L1 call swap_public! logger.info('call swap_public on L1'); @@ -1066,7 +1067,7 @@ export const uniswapL1L2TestSuite = ( await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n); // Since the outbox is only consumable when the block is proven, we need to set the block to be proven - await rollup.write.setAssumeProvenUntilBlockNumber([await rollup.read.pendingBlockCount()]); + await rollup.write.setAssumeProvenThroughBlockNumber([await rollup.read.getPendingBlockNumber()]); // Call swap_private on L1 const secretHashForRedeemingDai = Fr.random(); // creating my own secret hash diff --git a/yarn-project/ethereum/src/deploy_l1_contracts.ts b/yarn-project/ethereum/src/deploy_l1_contracts.ts index 290d0728a68..966bb00224f 100644 --- a/yarn-project/ethereum/src/deploy_l1_contracts.ts +++ b/yarn-project/ethereum/src/deploy_l1_contracts.ts @@ -147,7 +147,7 @@ export const deployL1Contracts = async ( args: { l2FeeJuiceAddress: AztecAddress; vkTreeRoot: Fr; - assumeProvenUntil?: number; + assumeProvenThrough?: number; salt: number | undefined; initialValidators?: EthAddress[]; }, @@ -277,9 +277,9 @@ export const deployL1Contracts = async ( } // Set initial blocks as proven if requested - if (args.assumeProvenUntil && args.assumeProvenUntil > 0) { - await rollup.write.setAssumeProvenUntilBlockNumber([BigInt(args.assumeProvenUntil)], { account }); - logger.info(`Set Rollup assumedProvenUntil to ${args.assumeProvenUntil}`); + if (args.assumeProvenThrough && args.assumeProvenThrough > 0) { + await rollup.write.setAssumeProvenThroughBlockNumber([BigInt(args.assumeProvenThrough)], { account }); + logger.info(`Set Rollup assumedProvenUntil to ${args.assumeProvenThrough}`); } // Inbox and Outbox are immutable and are deployed from Rollup's constructor so we just fetch them from the contract. diff --git a/yarn-project/foundation/src/config/env_var.ts b/yarn-project/foundation/src/config/env_var.ts index 6071602a2ab..5183e2847ed 100644 --- a/yarn-project/foundation/src/config/env_var.ts +++ b/yarn-project/foundation/src/config/env_var.ts @@ -1,6 +1,6 @@ export type EnvVar = | 'AZTEC_PORT' - | 'ASSUME_PROVEN_UNTIL_BLOCK_NUMBER' + | 'ASSUME_PROVEN_THROUGH_BLOCK_NUMBER' | 'TEST_ACCOUNTS' | 'ENABLE_GAS' | 'API_PREFIX' diff --git a/yarn-project/p2p/src/client/p2p_client.test.ts b/yarn-project/p2p/src/client/p2p_client.test.ts index f795da34aee..196a0ee45b7 100644 --- a/yarn-project/p2p/src/client/p2p_client.test.ts +++ b/yarn-project/p2p/src/client/p2p_client.test.ts @@ -61,9 +61,14 @@ describe('In-Memory P2P Client', () => { client = new P2PClient(kvStore, blockSource, txPool, attestationPool, p2pService, 0); }); - const advanceToProvenBlock = async (provenBlockNum: number) => { - blockSource.setProvenBlockNumber(provenBlockNum); - await retryUntil(() => Promise.resolve(client.getSyncedProvenBlockNum() >= provenBlockNum), 'synced', 10, 0.1); + const advanceToProvenBlock = async (getProvenBlockNumber: number) => { + blockSource.setProvenBlockNumber(getProvenBlockNumber); + await retryUntil( + () => Promise.resolve(client.getSyncedProvenBlockNum() >= getProvenBlockNumber), + 'synced', + 10, + 0.1, + ); }; it('can start & stop', async () => {