diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 54b419353..93bc0ac5d 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -16,4 +16,5 @@ - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. +- [ ] Gas snapshot have been updated. - [ ] Documentation comments have been added / updated. diff --git a/.github/workflows/l1-contracts-ci.yaml b/.github/workflows/l1-contracts-ci.yaml index 2123b47cb..b0b9044a5 100644 --- a/.github/workflows/l1-contracts-ci.yaml +++ b/.github/workflows/l1-contracts-ci.yaml @@ -145,3 +145,38 @@ jobs: - name: Compare run: diff tools/data/Verifier.sol l1-contracts/contracts/state-transition/Verifier.sol + + check-gas-snapshot: + needs: [build, lint] + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Use Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.18.0 + cache: yarn + + - name: Install dependencies + run: yarn + + - name: Restore artifacts cache + uses: actions/cache/restore@v3 + with: + fail-on-cache-miss: true + key: artifacts-l1-${{ github.sha }} + path: | + l1-contracts/artifacts + l1-contracts/cache + l1-contracts/typechain + + - name: Check gas snapshot + run: yarn gas-snapshot --check diff --git a/l1-contracts/.gas-snapshot b/l1-contracts/.gas-snapshot new file mode 100644 index 000000000..45562bbc1 --- /dev/null +++ b/l1-contracts/.gas-snapshot @@ -0,0 +1,445 @@ +AcceptAdminTest:test_revertWhen_calledByNonPendingAdmin() (gas: 20030) +AcceptAdminTest:test_successfulCall() (gas: 40992) +Authorization:test_RevertWhen_CancelByUnauthorisedAddress() (gas: 13111) +Authorization:test_RevertWhen_ExecutingByUnauthorisedAddress() (gas: 18905) +Authorization:test_RevertWhen_ExecutingInstantByOwner() (gas: 16762) +Authorization:test_RevertWhen_ExecutingInstantByUnauthorisedAddress() (gas: 16707) +Authorization:test_RevertWhen_SchedulingBySecurityCouncil() (gas: 16817) +Authorization:test_RevertWhen_SchedulingByUnauthorisedAddress() (gas: 16762) +Authorization:test_RevertWhen_SchedulingShadowBySecurityCouncil() (gas: 13286) +Authorization:test_RevertWhen_SchedulingShadowByUnauthorisedAddress() (gas: 13209) +Authorization:test_RevertWhen_UpdateDelayByOwner() (gas: 11094) +Authorization:test_RevertWhen_UpdateDelayBySecurityCouncil() (gas: 11114) +Authorization:test_RevertWhen_UpdateDelayByUnauthorisedAddress() (gas: 11039) +Authorization:test_RevertWhen_UpdateSecurityCouncilByOwner() (gas: 11284) +Authorization:test_RevertWhen_UpdateSecurityCouncilBySecurityCouncil() (gas: 11205) +Authorization:test_RevertWhen_UpdateSecurityCouncilByUnauthorisedAddress() (gas: 11207) +AuthorizationTest:test_RevertWhen_CommittingByUnauthorisedAddress() (gas: 63152) +AuthorizationTest:test_RevertWhen_ExecutingByUnauthorizedAddress() (gas: 43996) +AuthorizationTest:test_RevertWhen_ProvingByUnauthorisedAddress() (gas: 49931) +BridgehubRequestL2TransactionTest:test_revertWhen_FalseFilterer() (gas: 224816) +BridgehubRequestL2TransactionTest:test_successWithFilterer() (gas: 315250) +BridgehubRequestL2TransactionTest:test_successWithoutFilterer() (gas: 171481) +ChangeFeeParamsTest:test_revertWhen_calledByNonStateTransitionManager() (gas: 22907) +ChangeFeeParamsTest:test_revertWhen_newMaxPubdataPerBatchIsLessThanMaxPubdataPerTransaction() (gas: 29923) +ChangeFeeParamsTest:test_successfulChange() (gas: 55326) +ClaimFailedDepositTest:test_RevertWhen_ClaimAmountIsZero() (gas: 23408) +ClaimFailedDepositTest:test_claimFailedDepositSuccessfully() (gas: 203784) +CommittingTest:test_RevertWhen_BlobDoesNotExist() (gas: 264322) +CommittingTest:test_RevertWhen_CommittingBatchMoreThanOneBatch() (gas: 162105) +CommittingTest:test_RevertWhen_CommittingTooBigLastL2BatchTimestamp() (gas: 254838) +CommittingTest:test_RevertWhen_CommittingWithProcessingSystemContextLogTwice() (gas: 254833) +CommittingTest:test_RevertWhen_CommittingWithTooSmallNewBatchTimestamp() (gas: 254656) +CommittingTest:test_RevertWhen_CommittingWithUnknownSystemLogKey() (gas: 244704) +CommittingTest:test_RevertWhen_CommittingWithWrongCanonicalTxHash() (gas: 254953) +CommittingTest:test_RevertWhen_CommittingWithWrongLastCommittedBatchData() (gas: 160488) +CommittingTest:test_RevertWhen_CommittingWithWrongNewBatchTimestamp() (gas: 255297) +CommittingTest:test_RevertWhen_CommittingWithWrongNumberOfLayer1txs() (gas: 253457) +CommittingTest:test_RevertWhen_CommittingWithWrongOrderOfBatches() (gas: 165377) +CommittingTest:test_RevertWhen_CommittingWithWrongPreviousBatchHash() (gas: 254933) +CommittingTest:test_RevertWhen_CommittingWithoutProcessingSystemContextLog() (gas: 245235) +CommittingTest:test_RevertWhen_EmptyPubdataCommitments() (gas: 254655) +CommittingTest:test_RevertWhen_NotEnoughPubdataCommitments() (gas: 269785) +CommittingTest:test_RevertWhen_PartialPubdataCommitment() (gas: 255161) +CommittingTest:test_RevertWhen_SecondBlobLinearHashNotZeroWithEmptyCommitment() (gas: 272844) +CommittingTest:test_RevertWhen_SecondBlobLinearHashZeroWithCommitment() (gas: 279546) +CommittingTest:test_RevertWhen_SecondBlobSentWithoutCommitmentData() (gas: 269703) +CommittingTest:test_RevertWhen_SystemLogIsFromIncorrectAddress() (gas: 986345) +CommittingTest:test_RevertWhen_SystemLogIsMissing() (gas: 990866) +CommittingTest:test_RevertWhen_TooManyPubdataCommitments() (gas: 257045) +CommittingTest:test_RevertWhen_UnexpectedL2ToL1Log() (gas: 242547) +CommittingTest:test_SuccessfullyCommitBatch() (gas: 344934) +CommittingTest:test_SuccessfullyCommitBatchWithOneBlob() (gas: 340823) +CommittingTest:test_SuccessfullyCommitBatchWithTwoBlob() (gas: 350513) +DepositTest:test_RevertWhen_depositAmountIsZero() (gas: 18632) +DepositTest:test_RevertWhen_depositTokenIsNotContract() (gas: 20385) +DepositTest:test_RevertWhen_depositTokenTransferFailed() (gas: 27801) +DepositTest:test_RevertWhen_depositTransferAmountIsDifferent() (gas: 90147) +DepositTest:test_RevertWhen_legacyDepositAmountIsZero() (gas: 18537) +DepositTest:test_RevertWhen_legacyDepositTokenIsNotContract() (gas: 20451) +DepositTest:test_RevertWhen_legacyDepositTokenTransferFailed() (gas: 27844) +DepositTest:test_RevertWhen_legacyDepositTransferAmountIsDifferent() (gas: 90122) +DepositTest:test_depositSuccessfully() (gas: 100101) +DepositTest:test_legacyDepositSuccessfully() (gas: 101490) +DiamondProxyTest:test_revertWhenFacetIsFrozen() (gas: 2253473) +DiamondProxyTest:test_revertWhen_calledWithEmptyMsgData() (gas: 2231581) +DiamondProxyTest:test_revertWhen_calledWithFullSelectorInMsgData() (gas: 2231848) +DiamondProxyTest:test_revertWhen_chainIdDiffersFromBlockChainId() (gas: 553980) +DiamondProxyTest:test_revertWhen_proxyHasNoFacetForSelector() (gas: 928038) +DiamondProxyTest:test_revertWhen_removeFunctions() (gas: 2140054) +DiamondProxyTest:test_successfulExecution() (gas: 2228859) +ExecuteUpgradeTest:test_revertWhen_calledByNonGovernorOrStateTransitionManager() (gas: 21052) +ExecutingTest:test_CancelExistingOperation() (gas: 28952) +ExecutingTest:test_ExecutingOperationAfterRescheduling() (gas: 76588) +ExecutingTest:test_RevertWhen_CallWithRandomData() (gas: 17432) +ExecutingTest:test_RevertWhen_CancelNonExistingOperation() (gas: 15506) +ExecutingTest:test_RevertWhen_CommittingBlockWithWrongPreviousBatchHash() (gas: 165230) +ExecutingTest:test_RevertWhen_ExecutingBlockWithWrongBatchNumber() (gas: 45091) +ExecutingTest:test_RevertWhen_ExecutingBlockWithWrongData() (gas: 47705) +ExecutingTest:test_RevertWhen_ExecutingInstantNonScheduledOperation() (gas: 20498) +ExecutingTest:test_RevertWhen_ExecutingNonScheduledOperation() (gas: 20504) +ExecutingTest:test_RevertWhen_ExecutingOperationAfterCanceling() (gas: 41182) +ExecutingTest:test_RevertWhen_ExecutingOperationBeforeDeadline() (gas: 50977) +ExecutingTest:test_RevertWhen_ExecutingOperationFailed() (gas: 54906) +ExecutingTest:test_RevertWhen_ExecutingOperationTwice() (gas: 66232) +ExecutingTest:test_RevertWhen_ExecutingOperationWithDifferentData() (gas: 53811) +ExecutingTest:test_RevertWhen_ExecutingOperationWithDifferentPredecessor() (gas: 103287) +ExecutingTest:test_RevertWhen_ExecutingOperationWithDifferentSalt() (gas: 57708) +ExecutingTest:test_RevertWhen_ExecutingOperationWithDifferentTarget() (gas: 53538) +ExecutingTest:test_RevertWhen_ExecutingOperationWithDifferentValue() (gas: 53649) +ExecutingTest:test_RevertWhen_ExecutingOperationWithNonExecutedPredecessor() (gas: 57429) +ExecutingTest:test_RevertWhen_ExecutingRevertedBlockWithoutCommittingAndProvingAgain() (gas: 84189) +ExecutingTest:test_RevertWhen_ExecutingUnavailablePriorityOperationHash() (gas: 363008) +ExecutingTest:test_RevertWhen_ExecutingWithUnmatchedPriorityOperationHash() (gas: 520095) +ExecutingTest:test_RevertWhen_ScheduleOperationOnceAndExecuteTwice() (gas: 66216) +ExecutingTest:test_RevertWhen_ScheduleOperationWithDelayLessThanMinimumOne() (gas: 116983) +ExecutingTest:test_ScheduleShadowAndExecute() (gas: 63500) +ExecutingTest:test_ScheduleShadowAndExecuteInstant() (gas: 62900) +ExecutingTest:test_ScheduleTransparentAndExecute() (gas: 61686) +ExecutingTest:test_ScheduleTransparentAndExecuteInstant() (gas: 65780) +ExecutingTest:test_SendEtherToGovernance() (gas: 17167) +ExecutingTest:test_ShouldExecuteBatchesuccessfully() (gas: 83797) +ExecutorProofTest:test_Hashes() (gas: 106024) +ExperimentalBridgeTest:test_addStateTransitionManager(address) (runs: 256, μ: 41391, ~: 41391) +ExperimentalBridgeTest:test_addStateTransitionManager_cannotBeCalledByRandomAddress(address,address) (runs: 256, μ: 47958, ~: 47958) +ExperimentalBridgeTest:test_addToken(address,address) (runs: 256, μ: 67871, ~: 67871) +ExperimentalBridgeTest:test_addToken_cannotBeCalledByRandomAddress(address,address) (runs: 256, μ: 72526, ~: 72526) +ExperimentalBridgeTest:test_createNewChain(address,uint256,bool,bytes4[],address,bytes) (runs: 256, μ: 395571, ~: 394196) +ExperimentalBridgeTest:test_getHyperchain(uint256) (runs: 256, μ: 196180, ~: 196164) +ExperimentalBridgeTest:test_l2TransactionBaseCost(uint256,uint256,uint256,uint256,uint256) (runs: 256, μ: 196751, ~: 196641) +ExperimentalBridgeTest:test_onlyOwnerCanSetDeployer(address) (runs: 256, μ: 47463, ~: 47448) +ExperimentalBridgeTest:test_proveL1ToL2TransactionStatus(uint256,bytes32,uint256,uint256,uint16,bytes32[],bool,bool) (runs: 256, μ: 221384, ~: 218591) +ExperimentalBridgeTest:test_proveL1ToL2TransactionStatus_old(uint256,bytes32,uint256,uint256,uint16,bytes32[],bool) (runs: 256, μ: 82688, ~: 82893) +ExperimentalBridgeTest:test_proveL2LogInclusion(uint256,uint256,uint256,bytes32[],uint8,bool,uint16,address,bytes32,bytes32) (runs: 256, μ: 225550, ~: 220527) +ExperimentalBridgeTest:test_proveL2LogInclusion_old(uint256,uint256,uint256,bytes32[],uint8,bool,uint16,address,bytes32,bytes32) (runs: 256, μ: 79293, ~: 77914) +ExperimentalBridgeTest:test_proveL2MessageInclusion(uint256,uint256,uint256,bytes32[],uint16,address,bytes) (runs: 256, μ: 228427, ~: 224498) +ExperimentalBridgeTest:test_proveL2MessageInclusion_old(uint256,uint256,uint256,bytes32[],uint16,address,bytes) (runs: 256, μ: 83351, ~: 81021) +ExperimentalBridgeTest:test_randomCallerCannotSetDeployer(address,address) (runs: 256, μ: 17107, ~: 17107) +ExperimentalBridgeTest:test_removeStateTransitionManager(address) (runs: 256, μ: 34300, ~: 34284) +ExperimentalBridgeTest:test_removeStateTransitionManager_cannotBeCalledByRandomAddress(address,address) (runs: 256, μ: 39754, ~: 39722) +ExperimentalBridgeTest:test_requestL2TransactionDirect_ETHCase(uint256,uint256,address,uint256,bytes,uint256,uint256,bytes[],address,bytes[]) (runs: 256, μ: 597609, ~: 595821) +ExperimentalBridgeTest:test_requestL2TransactionDirect_NonETHCase(uint256,uint256,address,uint256,bytes,uint256,uint256,bytes[],address) (runs: 256, μ: 642877, ~: 645680) +ExperimentalBridgeTest:test_requestL2TransactionTwoBridges_ETHCase(uint256,uint256,uint256,uint256,uint256,address,uint256,bytes) (runs: 256, μ: 422207, ~: 422178) +ExperimentalBridgeTest:test_setSharedBridge(address) (runs: 256, μ: 37301, ~: 37301) +ExperimentalBridgeTest:test_setSharedBridge_cannotBeCalledByRandomAddress(address,address) (runs: 256, μ: 41880, ~: 41880) +FacetAddressTest:test() (gas: 35471) +FacetAddressesTest:test() (gas: 79224) +FacetCutTest:test_AddingFacetAfterRemoving() (gas: 458004) +FacetCutTest:test_AddingFacetsToFreeSelectors() (gas: 1406369) +FacetCutTest:test_ChangingFacetFreezability() (gas: 458022) +FacetCutTest:test_RemovingFacetFromOccupiedSelector() (gas: 256508) +FacetCutTest:test_ReplaceFacetForOccupiedSelector() (gas: 327922) +FacetCutTest:test_ReplacingASelectorFacetWithItself() (gas: 199375) +FacetCutTest:test_RevertWhen_AddingFacetToOccupiedSelector() (gas: 302734) +FacetCutTest:test_RevertWhen_AddingFacetWithDifferentFreezabilityThanExistingFacets() (gas: 139579) +FacetCutTest:test_RevertWhen_AddingFacetWithNoBytecode() (gas: 13268) +FacetCutTest:test_RevertWhen_AddingFacetWithZeroAddress() (gas: 20735) +FacetCutTest:test_RevertWhen_RemovingFacetFromFreeSelector() (gas: 22913) +FacetCutTest:test_RevertWhen_ReplacingFacetFromFreeSelector() (gas: 27902) +FacetCutTest:test_RevertWhen_ReplacingFacetWithDifferentFreezabilityThanExistingFacets() (gas: 147203) +FacetCutTest:test_RevertWhen_ReplacingFacetWithNoBytecode() (gas: 13303) +FacetFunctionSelectorsTest:test() (gas: 60740) +FacetsTest:test() (gas: 123700) +FinalizeWithdrawalTest:test_RevertWhen_withdrawalFinalized() (gas: 152844) +FinalizeWithdrawalTest:test_finalizeWithdrawalSuccessfully() (gas: 99277) +FreezeDiamondTest:test_revertWhen_calledByNonAdminOrStateTransitionManager() (gas: 22392) +GetAdminTest:test() (gas: 34964) +GetBaseTokenBridgeTest:test() (gas: 34874) +GetBaseTokenTest:test() (gas: 34989) +GetBridgehubTest:test() (gas: 34877) +GetFirstUnprocessedPriorityTxTest:test() (gas: 30654) +GetL2BootloaderBytecodeHashTest:test() (gas: 30587) +GetL2DefaultAccountBytecodeHashTest:test() (gas: 30588) +GetL2SystemContractsUpgradeBatchNumberTest:test() (gas: 30611) +GetL2SystemContractsUpgradeBlockNumberTest:test() (gas: 30634) +GetL2SystemContractsUpgradeTxHashTest:test() (gas: 30612) +GetPendingAdminTest:test() (gas: 34994) +GetPriorityQueueFrontOperationTest:test() (gas: 79575) +GetPriorityQueueFrontOperationTest:test_revertWhen_queueIsEmpty() (gas: 14362) +GetPriorityQueueSizeTest:test() (gas: 33100) +GetPriorityTxMaxGasLimitTest:test() (gas: 30601) +GetProtocolVersionTest:test() (gas: 30696) +GetStateTransitionManagerTest:test() (gas: 34953) +GetTotalBatchesCommittedTest:test() (gas: 30655) +GetTotalBatchesExecutedTest:test() (gas: 30611) +GetTotalBatchesVerifiedTest:test() (gas: 30698) +GetTotalBlocksCommittedTest:test() (gas: 30654) +GetTotalBlocksExecutedTest:test() (gas: 30613) +GetTotalBlocksVerifiedTest:test() (gas: 30611) +GetTotalPriorityTxsTest:test() (gas: 30666) +GetVerifierParamsTest:test() (gas: 76150) +GetVerifierTest:test() (gas: 34945) +GettersTest:test_l2TokenAddress() (gas: 304816) +InitializationTest:test_RevertWhen_DelegateCallToAContractWithWrongReturn() (gas: 15888) +InitializationTest:test_RevertWhen_DelegateCallToEOA() (gas: 15676) +InitializationTest:test_RevertWhen_DelegateCallToFailedContract() (gas: 15751) +InitializationTest:test_RevertWhen_DoubleInitialization() (gas: 10987) +InitializationTest:test_RevertWhen_InitializingDiamondCutWithZeroAddressAndNonZeroData() (gas: 10805) +InitializeTest:test_revertWhen_governorIsZeroAddress() (gas: 1692194) +InitializeTest:test_revertWhen_priorityTxMaxGasLimitIsGreaterThanMaxGasPerTransaction() (gas: 1692527) +InitializeTest:test_revertWhen_validatorTimelockIsZeroAddress() (gas: 1692404) +InitializeTest:test_revertWhen_verifierIsZeroAddress() (gas: 1691990) +InitializeTest:test_valuesCorrectWhenSuccessfulInit() (gas: 2128649) +IsDiamondStorageFrozenTest:test() (gas: 30714) +IsEthWithdrawalFinalizedTest:test() (gas: 31307) +IsFacetFreezableTest:test() (gas: 84816) +IsFacetFreezableTest:test_noSelectors() (gas: 12200) +IsFunctionFreezableTest:test() (gas: 37108) +IsFunctionFreezableTest:test_revertWhen_facetAddressIzZero() (gas: 35878) +IsValidatorTest:test_notValidator() (gas: 15406) +IsValidatorTest:test_validator() (gas: 35315) +L1SharedBridgeFailTest:test_bridgehubConfirmL2Transaction_depositAlreadyHappened() (gas: 30096) +L1SharedBridgeFailTest:test_bridgehubDepositBaseToken_ErcWrongErcDepositAmount() (gas: 134581) +L1SharedBridgeFailTest:test_bridgehubDepositBaseToken_ErcWrongMsgValue() (gas: 110226) +L1SharedBridgeFailTest:test_bridgehubDepositBaseToken_EthwrongMsgValue() (gas: 25590) +L1SharedBridgeFailTest:test_bridgehubDeposit_Erc_msgValue() (gas: 120382) +L1SharedBridgeFailTest:test_bridgehubDeposit_Erc_weth() (gas: 35264) +L1SharedBridgeFailTest:test_bridgehubDeposit_Erc_wrongDepositAmount() (gas: 144732) +L1SharedBridgeFailTest:test_bridgehubDeposit_Eth() (gas: 35397) +L1SharedBridgeFailTest:test_bridgehubDeposit_Eth_baseToken() (gas: 32917) +L1SharedBridgeFailTest:test_bridgehubDeposit_Eth_l2BridgeNotDeployed() (gas: 48246) +L1SharedBridgeFailTest:test_bridgehubDeposit_Eth_wrongDepositAmount() (gas: 112963) +L1SharedBridgeFailTest:test_checkWithdrawal_wrongProof() (gas: 70358) +L1SharedBridgeFailTest:test_claimFailedDeposit_amountZero() (gas: 45344) +L1SharedBridgeFailTest:test_claimFailedDeposit_chainBalanceLow() (gas: 56112) +L1SharedBridgeFailTest:test_claimFailedDeposit_depositDidNotHappen() (gas: 47764) +L1SharedBridgeFailTest:test_claimFailedDeposit_proofInvalid() (gas: 45861) +L1SharedBridgeFailTest:test_depositLegacyERC20Bridge_l2BridgeNotDeployed() (gas: 43360) +L1SharedBridgeFailTest:test_depositLegacyERC20Bridge_refundRecipient() (gas: 113659) +L1SharedBridgeFailTest:test_depositLegacyERC20Bridge_weth() (gas: 36758) +L1SharedBridgeFailTest:test_finalizeWithdrawal_EthOnEth_LegacyTxFinalizedInDiamondProxy() (gas: 72146) +L1SharedBridgeFailTest:test_finalizeWithdrawal_EthOnEth_LegacyTxFinalizedInERC20Bridge() (gas: 40406) +L1SharedBridgeFailTest:test_finalizeWithdrawal_EthOnEth_LegacyTxFinalizedInSharedBridge() (gas: 49298) +L1SharedBridgeFailTest:test_finalizeWithdrawal_chainBalance() (gas: 74988) +L1SharedBridgeFailTest:test_initialize_wrongOwner() (gas: 116700) +L1SharedBridgeFailTest:test_parseL2WithdrawalMessage_WrongMsgLength() (gas: 61371) +L1SharedBridgeFailTest:test_parseL2WithdrawalMessage_WrongMsgLength2() (gas: 66720) +L1SharedBridgeFailTest:test_parseL2WithdrawalMessage_WrongSelector() (gas: 66234) +L1SharedBridgeHyperEnabledTest:test_bridgehubConfirmL2Transaction() (gas: 55611) +L1SharedBridgeHyperEnabledTest:test_bridgehubDepositBaseToken_Erc() (gas: 126536) +L1SharedBridgeHyperEnabledTest:test_bridgehubDepositBaseToken_Eth() (gas: 61483) +L1SharedBridgeHyperEnabledTest:test_bridgehubDeposit_Erc() (gas: 154118) +L1SharedBridgeHyperEnabledTest:test_bridgehubDeposit_Eth() (gas: 82345) +L1SharedBridgeHyperEnabledTest:test_claimFailedDeposit_Erc() (gas: 109151) +L1SharedBridgeHyperEnabledTest:test_claimFailedDeposit_Eth() (gas: 74118) +L1SharedBridgeHyperEnabledTest:test_finalizeWithdrawal_BaseErcOnErc() (gas: 123698) +L1SharedBridgeHyperEnabledTest:test_finalizeWithdrawal_ErcOnEth() (gas: 127098) +L1SharedBridgeHyperEnabledTest:test_finalizeWithdrawal_EthOnErc() (gas: 99827) +L1SharedBridgeHyperEnabledTest:test_finalizeWithdrawal_EthOnEth() (gas: 93349) +L1SharedBridgeHyperEnabledTest:test_finalizeWithdrawal_NonBaseErcOnErc() (gas: 127090) +L1SharedBridgeLegacyTest:test_claimFailedDepositLegacyErc20Bridge_Erc() (gas: 113871) +L1SharedBridgeLegacyTest:test_depositLegacyERC20Bridge() (gas: 113677) +L1SharedBridgeLegacyTest:test_finalizeWithdrawalLegacyErc20Bridge_ErcOnEth() (gas: 132537) +L1SharedBridgeLegacyTest:test_finalizeWithdrawalLegacyErc20Bridge_EthOnEth() (gas: 100231) +L1SharedBridgeTest:test_bridgehubConfirmL2Transaction() (gas: 55656) +L1SharedBridgeTest:test_bridgehubDepositBaseToken_Erc() (gas: 126554) +L1SharedBridgeTest:test_bridgehubDepositBaseToken_Eth() (gas: 61505) +L1SharedBridgeTest:test_bridgehubDeposit_Erc() (gas: 154030) +L1SharedBridgeTest:test_bridgehubDeposit_Eth() (gas: 82326) +L1SharedBridgeTest:test_claimFailedDeposit_Erc() (gas: 108793) +L1SharedBridgeTest:test_claimFailedDeposit_Eth() (gas: 73645) +L1SharedBridgeTest:test_finalizeWithdrawal_BaseErcOnErc() (gas: 123716) +L1SharedBridgeTest:test_finalizeWithdrawal_ErcOnEth() (gas: 127116) +L1SharedBridgeTest:test_finalizeWithdrawal_EthOnErc() (gas: 99849) +L1SharedBridgeTest:test_finalizeWithdrawal_EthOnEth() (gas: 93455) +L1SharedBridgeTest:test_finalizeWithdrawal_EthOnEth_LegacyTx() (gas: 102988) +L1SharedBridgeTest:test_finalizeWithdrawal_NonBaseErcOnErc() (gas: 127090) +L2LogsRootHashTest:test() (gas: 30787) +MerkleTestTest:testElements(uint256) (runs: 256, μ: 197337, ~: 197339) +MerkleTestTest:testEmptyProof_shouldRevert() (gas: 13494) +MerkleTestTest:testFirstElement() (gas: 197345) +MerkleTestTest:testLastElement() (gas: 197254) +MerkleTestTest:testLeafIndexTooBig_shouldRevert() (gas: 193059) +MerkleTestTest:testProofLengthTooLarge_shouldRevert() (gas: 36642) +OnEmptyQueueTest:test_failGetFront() (gas: 14206) +OnEmptyQueueTest:test_failPopFront() (gas: 14197) +OnEmptyQueueTest:test_gets() (gas: 12543) +OnlyAdminOrStateTransitionManagerTest:test_revertWhen_calledByNonAdmin() (gas: 22266) +OnlyAdminOrStateTransitionManagerTest:test_revertWhen_calledByNonStateTransitionManager() (gas: 22282) +OnlyAdminOrStateTransitionManagerTest:test_successfulCallWhenCalledByAdmin() (gas: 25913) +OnlyAdminOrStateTransitionManagerTest:test_successfulCallWhenCalledByStateTransitionManager() (gas: 27994) +OnlyAdminTest:test_revertWhen_calledByNonAdmin() (gas: 20020) +OnlyAdminTest:test_successfulCall() (gas: 25819) +OnlyBridgehubTest:test_revertWhen_calledByNonBridgehub() (gas: 20063) +OnlyBridgehubTest:test_successfulCall() (gas: 25819) +OnlyStateTransitionManagerTest:test_revertWhen_calledByNonStateTransitionManager() (gas: 20214) +OnlyStateTransitionManagerTest:test_successfulCall() (gas: 25861) +OnlyValidatorTest:test_revertWhen_calledByNonValidator() (gas: 28702) +OnlyValidatorTest:test_successfulCall() (gas: 47747) +OperationStatusTest:test_ProcessedOperationAfterDelayHasReadyStatus() (gas: 65543) +OperationStatusTest:test_ProcessedOperationAfterDelayIsDone() (gas: 65580) +OperationStatusTest:test_ProcessedOperationAfterDelayIsNotReadyOperation() (gas: 65557) +OperationStatusTest:test_ProcessedOperationIsOperation() (gas: 65605) +OperationStatusTest:test_RandomIdIsHasUnsetStatus() (gas: 11999) +OperationStatusTest:test_RandomIdIsNotDoneOperation() (gas: 12081) +OperationStatusTest:test_RandomIdIsNotOperation() (gas: 12072) +OperationStatusTest:test_RandomIdIsNotPendingOperation() (gas: 12092) +OperationStatusTest:test_RandomIdIsNotReadyOperation() (gas: 12027) +OperationStatusTest:test_ScheduledOperationAfterDelayHasReadyStatus() (gas: 44491) +OperationStatusTest:test_ScheduledOperationAfterDelayIsNotDone() (gas: 44617) +OperationStatusTest:test_ScheduledOperationAfterDelayIsNotPendingOperation() (gas: 65612) +OperationStatusTest:test_ScheduledOperationAfterDelayIsOperation() (gas: 44611) +OperationStatusTest:test_ScheduledOperationAfterDelayIsPendingOperation() (gas: 44574) +OperationStatusTest:test_ScheduledOperationAfterDelayIsReadyOperation() (gas: 44509) +OperationStatusTest:test_ScheduledOperationHasWaitingStatus() (gas: 44065) +OperationStatusTest:test_ScheduledOperationIsNotDone() (gas: 44113) +OperationStatusTest:test_ScheduledOperationIsNotReadyOperation() (gas: 44037) +OperationStatusTest:test_ScheduledOperationIsOperation() (gas: 44127) +OperationStatusTest:test_ScheduledOperationIsPendingOperation() (gas: 44088) +PopOperationsTest:test_after_pop() (gas: 45079) +PopOperationsTest:test_pop_until_limit() (gas: 166809) +ProvingTest:test_RevertWhen_ProvingRevertedBlockWithoutCommittingAgain() (gas: 93247) +ProvingTest:test_RevertWhen_ProvingWithWrongCommittedBlock() (gas: 79304) +ProvingTest:test_RevertWhen_ProvingWithWrongPreviousBlockData() (gas: 76148) +ProvingTest:test_SuccessfulProve() (gas: 117406) +PushOperationsTest:test_front() (gas: 20082) +ReentrancyTest:test_ExecuteInstantOperationWithReentrancy() (gas: 271686) +ReentrancyTest:test_ExecuteOperationWithReentrancy() (gas: 182735) +ReentrancyTest:test_RevertedWith_ExecuteInstantOperationThatWillCancelItself() (gas: 803177) +ReentrancyTest:test_RevertedWith_ExecuteInstantTheSameOperationTwice() (gas: 824328) +ReentrancyTest:test_RevertedWith_ExecuteOperationThatWillCancelItself() (gas: 721300) +ReentrancyTest:test_RevertedWith_ExecuteTheSameOperationTwice() (gas: 742103) +ReentrancyTest:test_claimFailedDepositReenterClaimFailedDeposit() (gas: 204624) +ReentrancyTest:test_claimFailedDepositReenterDeposit() (gas: 204028) +ReentrancyTest:test_claimFailedDepositReenterFinalizeWithdrawal() (gas: 204772) +ReentrancyTest:test_claimFailedDepositReenterLegacyDeposit() (gas: 203872) +ReentrancyTest:test_depositReenterClaimFailedDeposit() (gas: 78741) +ReentrancyTest:test_depositReenterDeposit() (gas: 78017) +ReentrancyTest:test_depositReenterFinalizeWithdrawal() (gas: 78992) +ReentrancyTest:test_depositReenterLegacyDeposit() (gas: 77869) +ReentrancyTest:test_finalizeWithdrawalReenterClaimFailedDeposit() (gas: 33043) +ReentrancyTest:test_finalizeWithdrawalReenterDeposit() (gas: 32343) +ReentrancyTest:test_finalizeWithdrawalReenterFinalizeWithdrawal() (gas: 33294) +ReentrancyTest:test_finalizeWithdrawalReenterLegacyDeposit() (gas: 32128) +ReentrancyTest:test_legacyDepositReenterClaimFailedDeposit() (gas: 78575) +ReentrancyTest:test_legacyDepositReenterDeposit() (gas: 77894) +ReentrancyTest:test_legacyDepositReenterFinalizeWithdrawal() (gas: 78824) +ReentrancyTest:test_legacyDepositReenterLegacyDeposit() (gas: 77724) +RevertingTest:test_RevertWhen_RevertingMoreBatchesThanAlreadyCommitted() (gas: 27974) +RevertingTest:test_SuccessfulRevert() (gas: 44552) +SelfUpgradesTest:test_UpgradeDelay() (gas: 77686) +SelfUpgradesTest:test_UpgradeSecurityCouncil() (gas: 67139) +SetPendingAdminTest:test_revertWhen_calledByNonAdmin() (gas: 21814) +SetPendingAdminTest:test_successfulCall() (gas: 58910) +SetPorterAvailabilityTest:test_revertWhen_calledByNonStateTransitionManager() (gas: 20327) +SetPorterAvailabilityTest:test_setPorterAvailabilityToFalse() (gas: 42491) +SetPorterAvailabilityTest:test_setPorterAvailabilityToTrue() (gas: 58432) +SetPriorityTxMaxGasLimitTest:test_revertWhen_calledByNonStateTransitionManager() (gas: 20254) +SetPriorityTxMaxGasLimitTest:test_revertWhen_newPriorityTxMaxGasLimitIsGreaterThanMaxGasPerTransaction() (gas: 26905) +SetPriorityTxMaxGasLimitTest:test_successfulSet() (gas: 39660) +SetTransactionFiltererTest:test_initialFilterer() (gas: 53002) +SetTransactionFiltererTest:test_replaceFilterer() (gas: 58436) +SetTransactionFiltererTest:test_revertWhen_notAdmin() (gas: 21528) +SetValidatorTest:test_deactivateValidator() (gas: 44914) +SetValidatorTest:test_reactivateValidator() (gas: 61418) +SetValidatorTest:test_revertWhen_calledByNonStateTransitionManager() (gas: 21954) +StoredBatchHashTest:test() (gas: 30831) +StoredBlockHashTest:test() (gas: 30852) +UncheckedAddTest:test_Add() (gas: 5551) +UncheckedAddTest:test_AddWithOverflow() (gas: 8473) +UncheckedIncTest:test_Inc() (gas: 5524) +UncheckedIncTest:test_IncWithOverflow() (gas: 8426) +UnfreezeDiamondTest:test_revertWhen_calledByNonAdminOrStateTransitionManager() (gas: 22304) +UnfreezeDiamondTest:test_revertWhen_diamondIsNotFrozen() (gas: 30772) +UnsafeBytesTestTest:test() (gas: 53692) +UpgradeChainFromVersionTest:test_revertWhen_ProtocolVersionMismatchAfterUpgrading() (gas: 77584) +UpgradeChainFromVersionTest:test_revertWhen_ProtocolVersionMismatchWhenUpgrading() (gas: 67133) +UpgradeChainFromVersionTest:test_revertWhen_calledByNonAdminOrStateTransitionManager() (gas: 23472) +UpgradeChainFromVersionTest:test_revertWhen_cutHashMismatch() (gas: 40496) +UpgradeLogicTest:test_ExecuteDiamondCut() (gas: 577345) +UpgradeLogicTest:test_ExecutingSameProposalTwoTimes() (gas: 661006) +UpgradeLogicTest:test_RevertWhen_DoubleFreezingByGovernor() (gas: 43646) +UpgradeLogicTest:test_RevertWhen_EmergencyFreezeWhenUnauthorizedGovernor() (gas: 23003) +UpgradeLogicTest:test_RevertWhen_UnfreezingWhenNotFrozen() (gas: 20839) +UtilsTest:test_ConstructL2Log() (gas: 23461) +UtilsTest:test_CreateSystemLogs() (gas: 294502) +UtilsTest:test_PackBatchTimestampAndBlockTimestamp() (gas: 3650) +ValidateL1L2TxTest:test_BasicRequestL1L2() (gas: 5090) +ValidateL1L2TxTest:test_RevertWhen_BelowMinimumCost() (gas: 8350) +ValidateL1L2TxTest:test_RevertWhen_GasLimitDoesntCoverOverhead() (gas: 6997) +ValidateL1L2TxTest:test_RevertWhen_GasLimitHigherThanMax() (gas: 7154) +ValidateL1L2TxTest:test_RevertWhen_HugePubdata() (gas: 7607) +ValidateL1L2TxTest:test_RevertWhen_TooMuchPubdata() (gas: 7117) +ValidateL1L2TxTest:test_ShouldAllowLargeTransactions() (gas: 5126) +ValidateL1L2TxTest:test_ShouldReturnCorrectOverhead_LongTx() (gas: 489) +ValidateL1L2TxTest:test_ShouldReturnCorrectOverhead_ShortTx() (gas: 455) +ValidateUpgradeTxTest:test_BasicRequest() (gas: 2352) +ValidateUpgradeTxTest:test_RevertWhen_NonZeroSignature() (gas: 5753) +ValidateUpgradeTxTest:test_RevertWhen_PaymasterInputNonZero() (gas: 5786) +ValidateUpgradeTxTest:test_RevertWhen_PaymasterIsNotZero() (gas: 5318) +ValidateUpgradeTxTest:test_RevertWhen_RequestNotFromSystemContract() (gas: 5251) +ValidateUpgradeTxTest:test_RevertWhen_RequestNotToSystemContract() (gas: 5383) +ValidateUpgradeTxTest:test_RevertWhen_Reserved0IsNonZero() (gas: 5466) +ValidateUpgradeTxTest:test_RevertWhen_Reserved1IsTooLarge() (gas: 5631) +ValidateUpgradeTxTest:test_RevertWhen_Reserved2IsNonZero() (gas: 5544) +ValidateUpgradeTxTest:test_RevertWhen_Reserved3IsNonZero() (gas: 5564) +ValidateUpgradeTxTest:test_RevertWhen_ReservedDynamicIsNonZero() (gas: 5795) +ValidateUpgradeTxTest:test_RevertWhen_ValueIsNotZero() (gas: 5437) +ValidatorTimelockTest:test_RevertWhen_addValidatorAddressAlreadyValidator() (gas: 27147) +ValidatorTimelockTest:test_RevertWhen_addValidatorNotAdmin() (gas: 25422) +ValidatorTimelockTest:test_RevertWhen_executeBatchesNotValidator() (gas: 18649) +ValidatorTimelockTest:test_RevertWhen_executeBatchesSharedBridgeNotValidator() (gas: 20777) +ValidatorTimelockTest:test_RevertWhen_executeBatchesSharedBridgeTooEarly() (gas: 72740) +ValidatorTimelockTest:test_RevertWhen_executeBatchesTooEarly() (gas: 72497) +ValidatorTimelockTest:test_RevertWhen_proveBatchesNotValidator() (gas: 21008) +ValidatorTimelockTest:test_RevertWhen_proveBatchesSharedBridgeNotValidator() (gas: 25473) +ValidatorTimelockTest:test_RevertWhen_removeValidatorAddressNotValidator() (gas: 27135) +ValidatorTimelockTest:test_RevertWhen_removeValidatorNotAdmin() (gas: 25463) +ValidatorTimelockTest:test_RevertWhen_revertBatchesNotValidator() (gas: 13058) +ValidatorTimelockTest:test_RevertWhen_revertBatchesSharedBridgeNotValidator() (gas: 15111) +ValidatorTimelockTest:test_RevertWhen_setExecutionDelayNotOwner() (gas: 13296) +ValidatorTimelockTest:test_RevertWhen_setStateTransitionManagerNotOwner() (gas: 12838) +ValidatorTimelockTest:test_RevertWhen_validatorCanMakeCallNotValidator() (gas: 26559) +ValidatorTimelockTest:test_addValidator() (gas: 51647) +ValidatorTimelockTest:test_commitBatches() (gas: 61570) +ValidatorTimelockTest:test_executeBatches() (gas: 75365) +ValidatorTimelockTest:test_executeBatchesSharedBridge() (gas: 75647) +ValidatorTimelockTest:test_getCommittedBatchTimestamp() (gas: 63240) +ValidatorTimelockTest:test_getCommittedBatchTimestampEmpty() (gas: 12135) +ValidatorTimelockTest:test_proveBatches() (gas: 36703) +ValidatorTimelockTest:test_proveBatchesSharedBridge() (gas: 38838) +ValidatorTimelockTest:test_removeValidator() (gas: 40875) +ValidatorTimelockTest:test_revertBatches() (gas: 25964) +ValidatorTimelockTest:test_revertBatchesSharedBridge() (gas: 28128) +ValidatorTimelockTest:test_setExecutionDelay() (gas: 22700) +ValidatorTimelockTest:test_setStateTransitionManager() (gas: 156016) +ValidatorTimelockTest:test_validatorCanMakeCall() (gas: 61222) +VerifierRecursiveTestTest:testEllipticCurvePointAtInfinity_shouldRevert() (gas: 133017) +VerifierRecursiveTestTest:testEllipticCurvePointsOverModulo() (gas: 508312) +VerifierRecursiveTestTest:testEmptyProof_shouldRevert() (gas: 32126) +VerifierRecursiveTestTest:testEmptyPublicInput_shouldRevert() (gas: 125829) +VerifierRecursiveTestTest:testEmptyRecursiveInput_shouldRevert() (gas: 119313) +VerifierRecursiveTestTest:testFrOverModulo() (gas: 507857) +VerifierRecursiveTestTest:testInvalidPublicInput_shouldRevert() (gas: 149797) +VerifierRecursiveTestTest:testInvalidRecursiveInput_shouldRevert() (gas: 495968) +VerifierRecursiveTestTest:testMoreThan44WordsProof_shouldRevert() (gas: 148656) +VerifierRecursiveTestTest:testMoreThan4WordsRecursiveInput_shouldRevert() (gas: 132806) +VerifierRecursiveTestTest:testMoreThanOnePublicInput_shouldRevert() (gas: 130789) +VerifierRecursiveTestTest:testNotEmptyRecursiveAggregationInput_shouldRevert() (gas: 119915) +VerifierRecursiveTestTest:testShouldVerify() (gas: 502860) +VerifierRecursiveTestTest:testShouldVerifyWithDirtyBits() (gas: 503307) +VerifierRecursiveTestTest:testVerificationKeyHash() (gas: 6296) +VerifierTestTest:testEllipticCurvePointAtInfinity_shouldRevert() (gas: 123636) +VerifierTestTest:testEllipticCurvePointsOverModulo() (gas: 485839) +VerifierTestTest:testEmptyProof_shouldRevert() (gas: 22681) +VerifierTestTest:testEmptyPublicInput_shouldRevert() (gas: 116383) +VerifierTestTest:testFrOverModulo() (gas: 485362) +VerifierTestTest:testInvalidPublicInput_shouldRevert() (gas: 140364) +VerifierTestTest:testMoreThan44WordsProof_shouldRevert() (gas: 139209) +VerifierTestTest:testMoreThanOnePublicInput_shouldRevert() (gas: 121343) +VerifierTestTest:testNotEmptyRecursiveAggregationInput_shouldRevert() (gas: 119186) +VerifierTestTest:testShouldVerify() (gas: 480388) +VerifierTestTest:testShouldVerifyWithDirtyBits() (gas: 480835) +VerifierTestTest:testVerificationKeyHash() (gas: 6273) +applyL1ToL2AliasTest:testL1toL2AddressConversion() (gas: 7301) +createNewChainTest:test_RevertWhen_CalledNotByBridgehub() (gas: 122314) +createNewChainTest:test_RevertWhen_InitialDiamondCutHashMismatch() (gas: 149390) +createNewChainTest:test_SuccessfulCreationOfNewChain() (gas: 3422840) +freezeChainTest:test_FreezingChain() (gas: 3453153) +initializingSTMOwnerZeroTest:test_InitializingSTMWithGovernorZeroShouldRevert() (gas: 215516) +revertBatchesTest:test_SuccessfulBatchReverting() (gas: 4950919) +setInitialCutHashTest:test_SettingInitialCutHash() (gas: 197973) +setNewVersionUpgradeTest:test_SettingNewVersionUpgrade() (gas: 219735) +setUpgradeDiamondCutTest:test_SettingUpgradeDiamondCut() (gas: 170734) +setValidatorTimelockTest:test_SettingValidatorTimelock() (gas: 27186) +undoL1ToL2AliasTest:testL2toL1AddressConversion() (gas: 7197) \ No newline at end of file diff --git a/l1-contracts/package.json b/l1-contracts/package.json index 39726b13a..612537cfd 100644 --- a/l1-contracts/package.json +++ b/l1-contracts/package.json @@ -60,6 +60,7 @@ "test:foundry": "forge test", "test:fork": "TEST_CONTRACTS_FORK=1 yarn run hardhat test test/unit_tests/*.fork.ts --network hardhat", "coverage:foundry": "forge coverage", + "gas-snapshot": "forge snapshot --fuzz-seed 0x324", "deploy-no-build": "ts-node scripts/deploy.ts", "register-hyperchain": "ts-node scripts/register-hyperchain.ts", "deploy-weth-bridges": "ts-node scripts/deploy-weth-bridges.ts", diff --git a/package.json b/package.json index 9bb6bdd1e..e7774327b 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "lint:ts": "eslint .", "prettier:check": "prettier --check \"**/*.{js,json,md,sol,ts,yaml}\"", "prettier:fix": "prettier --write \"**/*.{js,json,md,sol,ts,yaml}\"", + "gas-snapshot": "yarn l1 gas-snapshot", "l1": "yarn workspace l1-contracts", "l2": "yarn workspace l2-contracts", "sc": "yarn workspace system-contracts"