diff --git a/contracts/gas-snapshots/l2ep.gas-snapshot b/contracts/gas-snapshots/l2ep.gas-snapshot index 1f229f7d1d9..fadb687f8ad 100644 --- a/contracts/gas-snapshots/l2ep.gas-snapshot +++ b/contracts/gas-snapshots/l2ep.gas-snapshot @@ -1,9 +1,9 @@ ArbitrumCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37312) ArbitrumCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 12963) ArbitrumCrossDomainForwarder_Constructor:test_InitialState() (gas: 18431) -ArbitrumCrossDomainForwarder_Forward:test_Forward() (gas: 47601) -ArbitrumCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 22151) -ArbitrumCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 16048) +ArbitrumCrossDomainForwarder_Forward:test_Forward() (gas: 47623) +ArbitrumCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 22173) +ArbitrumCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 16070) ArbitrumCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 41408) ArbitrumCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19312) ArbitrumCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18323) @@ -15,28 +15,28 @@ ArbitrumCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 49720) ArbitrumCrossDomainGovernor_Forward:test_Forward() (gas: 47658) ArbitrumCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 24348) ArbitrumCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 18247) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 19386) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 19408) ArbitrumCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 60617) ArbitrumCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 62723) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 18237) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 18259) ArbitrumCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 64110) ArbitrumCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 41408) ArbitrumCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19312) ArbitrumCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18323) ArbitrumCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 13200) -ArbitrumSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetAnswer() (gas: 92118) -ArbitrumSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetRoundData() (gas: 92673) -ArbitrumSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetTimestamp() (gas: 92039) +ArbitrumSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetAnswer() (gas: 92075) +ArbitrumSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetRoundData() (gas: 92695) +ArbitrumSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetTimestamp() (gas: 92061) ArbitrumSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestAnswer() (gas: 89813) -ArbitrumSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestRound() (gas: 89705) -ArbitrumSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestRoundData() (gas: 90246) -ArbitrumSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestTimestamp() (gas: 89690) +ArbitrumSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestRound() (gas: 89727) +ArbitrumSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestRoundData() (gas: 90268) +ArbitrumSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestTimestamp() (gas: 89712) ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 98825) ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_Return0WhenRoundDoesNotExistYet() (gas: 18309) ArbitrumSequencerUptimeFeed_Constants:test_InitialState() (gas: 5684) ArbitrumSequencerUptimeFeed_GasCosts:test_GasCosts() (gas: 97495) -ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 602711) -ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 573802) +ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 602689) +ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 573780) ArbitrumSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 98976) ArbitrumSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 15416) ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 113269) @@ -45,9 +45,9 @@ ArbitrumValidator_Validate:test_PostSequencerOffline() (gas: 69068) OptimismCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 46888) OptimismCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22155) OptimismCrossDomainForwarder_Constructor:test_InitialState() (gas: 18266) -OptimismCrossDomainForwarder_Forward:test_Forward() (gas: 58025) -OptimismCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32546) -OptimismCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13859) +OptimismCrossDomainForwarder_Forward:test_Forward() (gas: 58047) +OptimismCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32568) +OptimismCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13881) OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48886) OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28767) OptimismCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16134) @@ -59,46 +59,46 @@ OptimismCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 47557) OptimismCrossDomainGovernor_Forward:test_Forward() (gas: 58096) OptimismCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 32627) OptimismCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 16061) -OptimismCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29181) +OptimismCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29203) OptimismCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 72695) OptimismCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 72685) -OptimismCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16051) +OptimismCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16073) OptimismCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 75908) OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48886) OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28767) OptimismCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16134) OptimismCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11011) -OptimismSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetAnswer() (gas: 59095) -OptimismSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetRoundData() (gas: 59635) -OptimismSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetTimestamp() (gas: 58950) +OptimismSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetAnswer() (gas: 59052) +OptimismSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetRoundData() (gas: 59657) +OptimismSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetTimestamp() (gas: 58972) OptimismSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestAnswer() (gas: 56887) -OptimismSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestRound() (gas: 56773) -OptimismSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestRoundData() (gas: 57309) -OptimismSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestTimestamp() (gas: 56740) +OptimismSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestRound() (gas: 56795) +OptimismSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestRoundData() (gas: 57331) +OptimismSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestTimestamp() (gas: 56762) OptimismSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 65617) OptimismSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 17679) OptimismSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 17897) OptimismSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17603) OptimismSequencerUptimeFeed_Constructor:test_InitialState() (gas: 21078) OptimismSequencerUptimeFeed_GasCosts:test_GasCosts() (gas: 67197) -OptimismSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 597640) -OptimismSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 573807) +OptimismSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 597618) +OptimismSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 573785) OptimismSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 66532) OptimismSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13200) OptimismSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddrAndNotL1SenderAddr() (gas: 23607) OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 74035) OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 96155) -OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 96215) -OptimismValidator_SetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 15503) +OptimismSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 96260) +OptimismValidator_SetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 15460) OptimismValidator_Validate:test_PostSequencerOffline() (gas: 74813) -OptimismValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 74869) -OptimismValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15563) +OptimismValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 74826) +OptimismValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15519) ScrollCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 46988) ScrollCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22207) ScrollCrossDomainForwarder_Constructor:test_InitialState() (gas: 17930) -ScrollCrossDomainForwarder_Forward:test_Forward() (gas: 58092) -ScrollCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32619) -ScrollCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13859) +ScrollCrossDomainForwarder_Forward:test_Forward() (gas: 58114) +ScrollCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32641) +ScrollCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13881) ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48952) ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28833) ScrollCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16134) @@ -110,37 +110,37 @@ ScrollCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 47552) ScrollCrossDomainGovernor_Forward:test_Forward() (gas: 58158) ScrollCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 32697) ScrollCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 16058) -ScrollCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29248) +ScrollCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29270) ScrollCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 72756) ScrollCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 72746) -ScrollCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16048) +ScrollCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16070) ScrollCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 75970) ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48952) ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28833) ScrollCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16134) ScrollCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11011) -ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetAnswer() (gas: 57250) -ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetRoundData() (gas: 57780) -ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetTimestamp() (gas: 57105) -ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestAnswer() (gas: 54888) -ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestRound() (gas: 54768) -ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestRoundData() (gas: 55473) -ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestTimestamp() (gas: 54758) -ScrollSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 63903) +ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetAnswer() (gas: 54559) +ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetRoundData() (gas: 55150) +ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForGetTimestamp() (gas: 54471) +ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestAnswer() (gas: 52210) +ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestRound() (gas: 52112) +ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestRoundData() (gas: 52839) +ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts:test_GasUsageForLatestTimestamp() (gas: 52167) +ScrollSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 61212) ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 17675) ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 17893) ScrollSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17599) -ScrollSequencerUptimeFeed_Constructor:test_InitialState() (gas: 102485) -ScrollSequencerUptimeFeed_GasCosts:test_GasCosts() (gas: 64888) -ScrollSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 597491) -ScrollSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 573807) -ScrollSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 64417) -ScrollSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13200) -ScrollSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddrAndNotL1SenderAddr() (gas: 23607) -ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 71618) -ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 92018) -ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 92078) -ScrollValidator_SetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 15503) -ScrollValidator_Validate:test_PostSequencerOffline() (gas: 75094) -ScrollValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 75156) -ScrollValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15563) \ No newline at end of file +ScrollSequencerUptimeFeed_Constructor:test_InitialState() (gas: 102454) +ScrollSequencerUptimeFeed_GasCosts:test_GasCosts() (gas: 61490) +ScrollSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 597445) +ScrollSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 573747) +ScrollSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 61094) +ScrollSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 15360) +ScrollSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddrAndNotL1SenderAddr() (gas: 25767) +ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 68316) +ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 88724) +ScrollSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 88829) +ScrollValidator_SetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 15594) +ScrollValidator_Validate:test_PostSequencerOffline() (gas: 78367) +ScrollValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 78380) +ScrollValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15525) \ No newline at end of file diff --git a/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollL1MessageQueue.sol b/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollL1MessageQueue.sol new file mode 100644 index 00000000000..1700bcbe168 --- /dev/null +++ b/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollL1MessageQueue.sol @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.19; + +import {IL1MessageQueue} from "@scroll-tech/contracts/L1/rollup/IL1MessageQueue.sol"; + +contract MockScrollL1MessageQueue is IL1MessageQueue { + /// @notice The start index of all pending inclusion messages. + function pendingQueueIndex() external pure returns (uint256) { + return 0; + } + + /// @notice Return the index of next appended message. + function nextCrossDomainMessageIndex() external pure returns (uint256) { + return 0; + } + + /// @notice Return the message of in `queueIndex`. + function getCrossDomainMessage(uint256 /* queueIndex */) external pure returns (bytes32) { + return ""; + } + + /// @notice Return the amount of ETH should pay for cross domain message. + function estimateCrossDomainMessageFee(uint256 /* gasLimit */) external pure returns (uint256) { + return 0; + } + + /// @notice Return the amount of intrinsic gas fee should pay for cross domain message. + function calculateIntrinsicGasFee(bytes memory /* _calldata */) external pure returns (uint256) { + return 0; + } + + /// @notice Return the hash of a L1 message. + function computeTransactionHash( + address /* sender */, + uint256 /* queueIndex */, + uint256 /* value */, + address /* target */, + uint256 /* gasLimit */, + bytes calldata /* data */ + ) external pure returns (bytes32) { + return 0; + } + + /// @notice Append a L1 to L2 message into this contract. + /// @param target The address of target contract to call in L2. + /// @param gasLimit The maximum gas should be used for relay this message in L2. + /// @param data The calldata passed to target contract. + function appendCrossDomainMessage(address target, uint256 gasLimit, bytes calldata data) external {} + + /// @notice Append an enforced transaction to this contract. + /// @dev The address of sender should be an EOA. + /// @param sender The address of sender who will initiate this transaction in L2. + /// @param target The address of target contract to call in L2. + /// @param value The value passed + /// @param gasLimit The maximum gas should be used for this transaction in L2. + /// @param data The calldata passed to target contract. + function appendEnforcedTransaction( + address sender, + address target, + uint256 value, + uint256 gasLimit, + bytes calldata data + ) external {} + + /// @notice Pop finalized messages from queue. + /// + /// @dev We can pop at most 256 messages each time. And if the message is not skipped, + /// the corresponding entry will be cleared. + /// + /// @param startIndex The start index to pop. + /// @param count The number of messages to pop. + /// @param skippedBitmap A bitmap indicates whether a message is skipped. + function popCrossDomainMessage(uint256 startIndex, uint256 count, uint256 skippedBitmap) external {} + + /// @notice Drop a skipped message from the queue. + function dropCrossDomainMessage(uint256 index) external {} +} diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol index 561e32be1a2..7cebd779ebc 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol @@ -79,4 +79,10 @@ contract L2EPTest is Test { function toArbitrumL2AliasAddress(address l1Address) public pure returns (address) { return address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111)); } + + /// @param l1Address - Address on L1 + /// @return a Scroll L2 address + function toScrollL2AliasAddress(address l1Address) public pure returns (address) { + return address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111)); + } } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollSequencerUptimeFeed.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollSequencerUptimeFeed.t.sol index 520fbf6dfdc..c299d791a59 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollSequencerUptimeFeed.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollSequencerUptimeFeed.t.sol @@ -11,6 +11,9 @@ contract ScrollSequencerUptimeFeedTest is L2EPTest { /// Constants uint256 internal constant GAS_USED_DEVIATION = 100; + /// Helper variable(s) + address internal s_l2MessengerAddr = toScrollL2AliasAddress(s_l1OwnerAddr); + /// L2EP contracts MockScrollL1CrossDomainMessenger internal s_mockScrollL1CrossDomainMessenger; MockScrollL2CrossDomainMessenger internal s_mockScrollL2CrossDomainMessenger; @@ -85,8 +88,7 @@ contract ScrollSequencerUptimeFeed_UpdateStatus is ScrollSequencerUptimeFeedTest /// @notice it should update status when status has not changed and incoming timestamp is the same as latest function test_UpdateStatusWhenNoChange() public { // Sets msg.sender and tx.origin to a valid address - address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); - vm.startPrank(l2MessengerAddr, l2MessengerAddr); + vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Fetches the latest timestamp uint256 timestamp = s_scrollSequencerUptimeFeed.latestTimestamp(); @@ -134,8 +136,7 @@ contract ScrollSequencerUptimeFeed_UpdateStatus is ScrollSequencerUptimeFeedTest /// @notice it should update status when status has changed and incoming timestamp is newer than the latest function test_UpdateStatusWhenStatusChangeAndTimeChange() public { // Sets msg.sender and tx.origin to a valid address - address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); - vm.startPrank(l2MessengerAddr, l2MessengerAddr); + vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Submits a status update uint256 timestamp = s_scrollSequencerUptimeFeed.latestTimestamp(); @@ -157,8 +158,7 @@ contract ScrollSequencerUptimeFeed_UpdateStatus is ScrollSequencerUptimeFeedTest /// @notice it should update status when status has changed and incoming timestamp is the same as latest function test_UpdateStatusWhenStatusChangeAndNoTimeChange() public { // Sets msg.sender and tx.origin to a valid address - address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); - vm.startPrank(l2MessengerAddr, l2MessengerAddr); + vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Fetches the latest timestamp uint256 timestamp = s_scrollSequencerUptimeFeed.latestTimestamp(); @@ -181,8 +181,7 @@ contract ScrollSequencerUptimeFeed_UpdateStatus is ScrollSequencerUptimeFeedTest /// @notice it should ignore out-of-order updates function test_IgnoreOutOfOrderUpdates() public { // Sets msg.sender and tx.origin to a valid address - address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); - vm.startPrank(l2MessengerAddr, l2MessengerAddr); + vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Submits a status update uint256 timestamp = s_scrollSequencerUptimeFeed.latestTimestamp() + 10000; @@ -205,8 +204,7 @@ contract ScrollSequencerUptimeFeed_AggregatorV3Interface is ScrollSequencerUptim /// @notice it should return valid answer from getRoundData and latestRoundData function test_AggregatorV3Interface() public { // Sets msg.sender and tx.origin to a valid address - address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); - vm.startPrank(l2MessengerAddr, l2MessengerAddr); + vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Defines helper variables uint80 roundId; @@ -327,8 +325,7 @@ contract ScrollSequencerUptimeFeed_GasCosts is ScrollSequencerUptimeFeedTest { /// @notice it should consume a known amount of gas for updates function test_GasCosts() public { // Sets msg.sender and tx.origin to a valid address - address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); - vm.startPrank(l2MessengerAddr, l2MessengerAddr); + vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Assert initial conditions uint256 timestamp = s_scrollSequencerUptimeFeed.latestTimestamp(); @@ -340,7 +337,7 @@ contract ScrollSequencerUptimeFeed_GasCosts is ScrollSequencerUptimeFeedTest { uint256 gasFinal; // measures gas used for no update - expectedGasUsed = 10197; // NOTE: used to be 38594 in hardhat tests + expectedGasUsed = 7513; // NOTE: used to be 38594 in hardhat tests gasStart = gasleft(); s_scrollSequencerUptimeFeed.updateStatus(false, uint64(timestamp + 1000)); gasFinal = gasleft(); @@ -348,7 +345,7 @@ contract ScrollSequencerUptimeFeed_GasCosts is ScrollSequencerUptimeFeedTest { assertGasUsageIsCloseTo(expectedGasUsed, gasStart, gasFinal, GAS_USED_DEVIATION); // measures gas used for update - expectedGasUsed = 31644; // NOTE: used to be 58458 in hardhat tests + expectedGasUsed = 30953; // NOTE: used to be 58458 in hardhat tests gasStart = gasleft(); s_scrollSequencerUptimeFeed.updateStatus(true, uint64(timestamp + 1000)); gasFinal = gasleft(); @@ -361,8 +358,7 @@ contract ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts is ScrollSequence /// @notice it should consume a known amount of gas for getRoundData(uint80) function test_GasUsageForGetRoundData() public { // Sets msg.sender and tx.origin to a valid address - address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); - vm.startPrank(l2MessengerAddr, l2MessengerAddr); + vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Defines helper variables for measuring gas usage uint256 expectedGasUsed = 4504; // NOTE: used to be 30952 in hardhat tesst @@ -385,8 +381,7 @@ contract ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts is ScrollSequence /// @notice it should consume a known amount of gas for latestRoundData() function test_GasUsageForLatestRoundData() public { // Sets msg.sender and tx.origin to a valid address - address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); - vm.startPrank(l2MessengerAddr, l2MessengerAddr); + vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Defines helper variables for measuring gas usage uint256 expectedGasUsed = 2154; // NOTE: used to be 28523 in hardhat tests @@ -409,8 +404,7 @@ contract ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts is ScrollSequence /// @notice it should consume a known amount of gas for latestAnswer() function test_GasUsageForLatestAnswer() public { // Sets msg.sender and tx.origin to a valid address - address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); - vm.startPrank(l2MessengerAddr, l2MessengerAddr); + vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Defines helper variables for measuring gas usage uint256 expectedGasUsed = 1566; // NOTE: used to be 28229 in hardhat tests @@ -433,8 +427,7 @@ contract ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts is ScrollSequence /// @notice it should consume a known amount of gas for latestTimestamp() function test_GasUsageForLatestTimestamp() public { // Sets msg.sender and tx.origin to a valid address - address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); - vm.startPrank(l2MessengerAddr, l2MessengerAddr); + vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Defines helper variables for measuring gas usage uint256 expectedGasUsed = 1459; // NOTE: used to be 28129 in hardhat tests @@ -457,8 +450,7 @@ contract ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts is ScrollSequence /// @notice it should consume a known amount of gas for latestRound() function test_GasUsageForLatestRound() public { // Sets msg.sender and tx.origin to a valid address - address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); - vm.startPrank(l2MessengerAddr, l2MessengerAddr); + vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Defines helper variables for measuring gas usage uint256 expectedGasUsed = 1470; // NOTE: used to be 28145 in hardhat tests @@ -481,8 +473,7 @@ contract ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts is ScrollSequence /// @notice it should consume a known amount of gas for getAnswer() function test_GasUsageForGetAnswer() public { // Sets msg.sender and tx.origin to a valid address - address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); - vm.startPrank(l2MessengerAddr, l2MessengerAddr); + vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Defines helper variables for measuring gas usage uint256 expectedGasUsed = 3929; // NOTE: used to be 30682 in hardhat tests @@ -505,8 +496,7 @@ contract ScrollSequencerUptimeFeed_AggregatorInterfaceGasCosts is ScrollSequence /// @notice it should consume a known amount of gas for getTimestamp() function test_GasUsageForGetTimestamp() public { // Sets msg.sender and tx.origin to a valid address - address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); - vm.startPrank(l2MessengerAddr, l2MessengerAddr); + vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Defines helper variables for measuring gas usage uint256 expectedGasUsed = 3817; // NOTE: used to be 30570 in hardhat tests diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollValidator.t.sol index 969c78c72ef..f425ca1c6e5 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollValidator.t.sol @@ -3,6 +3,7 @@ pragma solidity 0.8.19; import {MockScrollL1CrossDomainMessenger} from "../../mocks/scroll/MockScrollL1CrossDomainMessenger.sol"; import {MockScrollL2CrossDomainMessenger} from "../../mocks/scroll/MockScrollL2CrossDomainMessenger.sol"; +import {MockScrollL1MessageQueue} from "../../mocks/scroll/MockScrollL1MessageQueue.sol"; import {ScrollSequencerUptimeFeed} from "../../../dev/scroll/ScrollSequencerUptimeFeed.sol"; import {ScrollValidator} from "../../../dev/scroll/ScrollValidator.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; @@ -15,6 +16,7 @@ contract ScrollValidatorTest is L2EPTest { /// L2EP contracts MockScrollL1CrossDomainMessenger internal s_mockScrollL1CrossDomainMessenger; MockScrollL2CrossDomainMessenger internal s_mockScrollL2CrossDomainMessenger; + MockScrollL1MessageQueue internal s_mockScrollL1MessageQueue; ScrollSequencerUptimeFeed internal s_scrollSequencerUptimeFeed; ScrollValidator internal s_scrollValidator; @@ -32,6 +34,7 @@ contract ScrollValidatorTest is L2EPTest { function setUp() public { s_mockScrollL1CrossDomainMessenger = new MockScrollL1CrossDomainMessenger(); s_mockScrollL2CrossDomainMessenger = new MockScrollL2CrossDomainMessenger(); + s_mockScrollL1MessageQueue = new MockScrollL1MessageQueue(); s_scrollSequencerUptimeFeed = new ScrollSequencerUptimeFeed( address(s_mockScrollL1CrossDomainMessenger), @@ -42,6 +45,7 @@ contract ScrollValidatorTest is L2EPTest { s_scrollValidator = new ScrollValidator( address(s_mockScrollL1CrossDomainMessenger), address(s_scrollSequencerUptimeFeed), + address(s_mockScrollL1MessageQueue), INIT_GAS_LIMIT ); } diff --git a/contracts/test/v0.8/automation/AutomationRegistry2_2.test.ts b/contracts/test/v0.8/automation/AutomationRegistry2_2.test.ts index 8d022ddfe64..4d18bcbf7cf 100644 --- a/contracts/test/v0.8/automation/AutomationRegistry2_2.test.ts +++ b/contracts/test/v0.8/automation/AutomationRegistry2_2.test.ts @@ -995,9 +995,13 @@ describe('AutomationRegistry2_2', () => { .transfer(await admin.getAddress(), toWei('1000')) let tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) upkeepId = await getUpkeepID(tx) autoFunderUpkeep = await upkeepAutoFunderFactory @@ -1005,17 +1009,27 @@ describe('AutomationRegistry2_2', () => { .deploy(linkToken.address, registry.address) tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](autoFunderUpkeep.address, performGas, autoFunderUpkeep.address, randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + autoFunderUpkeep.address, + performGas, + autoFunderUpkeep.address, + randomBytes, + '0x', + ) afUpkeepId = await getUpkeepID(tx) ltUpkeep = await deployMockContract(owner, ILogAutomationactory.abi) tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,uint8,bytes,bytes,bytes)' - ](ltUpkeep.address, performGas, await admin.getAddress(), Trigger.LOG, '0x', logTriggerConfig, emptyBytes) + ['registerUpkeep(address,uint32,address,uint8,bytes,bytes,bytes)']( + ltUpkeep.address, + performGas, + await admin.getAddress(), + Trigger.LOG, + '0x', + logTriggerConfig, + emptyBytes, + ) logUpkeepId = await getUpkeepID(tx) await autoFunderUpkeep.setUpkeepId(afUpkeepId) @@ -1026,9 +1040,13 @@ describe('AutomationRegistry2_2', () => { tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](streamsLookupUpkeep.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + streamsLookupUpkeep.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) streamsLookupUpkeepId = await getUpkeepID(tx) } @@ -1046,9 +1064,13 @@ describe('AutomationRegistry2_2', () => { await mock.setPerformGasToBurn(BigNumber.from('0')) const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const condUpkeepId = await getUpkeepID(tx) passingConditionalUpkeepIds.push(condUpkeepId) @@ -1061,9 +1083,15 @@ describe('AutomationRegistry2_2', () => { await mock.setPerformGasToBurn(BigNumber.from('0')) const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,uint8,bytes,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), Trigger.LOG, '0x', logTriggerConfig, emptyBytes) + ['registerUpkeep(address,uint32,address,uint8,bytes,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + Trigger.LOG, + '0x', + logTriggerConfig, + emptyBytes, + ) const logUpkeepId = await getUpkeepID(tx) passingLogUpkeepIds.push(logUpkeepId) @@ -1076,9 +1104,13 @@ describe('AutomationRegistry2_2', () => { await mock.setPerformGasToBurn(BigNumber.from('0')) const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const failingUpkeepId = await getUpkeepID(tx) failingUpkeepIds.push(failingUpkeepId) } @@ -1560,9 +1592,13 @@ describe('AutomationRegistry2_2', () => { let tx = await arbRegistry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const testUpkeepId = await getUpkeepID(tx) await arbRegistry.connect(owner).addFunds(testUpkeepId, toWei('100')) @@ -2517,9 +2553,13 @@ describe('AutomationRegistry2_2', () => { const mock = await upkeepMockFactory.deploy() const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const testUpkeepId = await getUpkeepID(tx) upkeepIds.push(testUpkeepId) @@ -2554,9 +2594,13 @@ describe('AutomationRegistry2_2', () => { const mock = await upkeepMockFactory.deploy() const tx = await arbRegistry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const testUpkeepId = await getUpkeepID(tx) upkeepIds.push(testUpkeepId) @@ -2612,9 +2656,13 @@ describe('AutomationRegistry2_2', () => { // add funds to upkeep 1 and perform and withdraw some payment const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), emptyBytes, emptyBytes) + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + emptyBytes, + emptyBytes, + ) const id1 = await getUpkeepID(tx) await registry.connect(admin).addFunds(id1, toWei('5')) @@ -2636,9 +2684,13 @@ describe('AutomationRegistry2_2', () => { // add funds to upkeep 2 and perform and withdraw some payment const tx2 = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), emptyBytes, emptyBytes) + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + emptyBytes, + emptyBytes, + ) const id2 = await getUpkeepID(tx2) await registry.connect(admin).addFunds(id2, toWei('5')) @@ -2716,15 +2768,23 @@ describe('AutomationRegistry2_2', () => { it('uses maxPerformData size in checkUpkeep but actual performDataSize in transmit', async () => { const tx1 = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const upkeepID1 = await getUpkeepID(tx1) const tx2 = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const upkeepID2 = await getUpkeepID(tx2) await mock.setCanCheck(true) await mock.setCanPerform(true) @@ -2787,9 +2847,13 @@ describe('AutomationRegistry2_2', () => { beforeEach(async () => { const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) upkeepId2 = await getUpkeepID(tx) await registry.connect(admin).addFunds(upkeepId, toWei('100')) @@ -3929,9 +3993,13 @@ describe('AutomationRegistry2_2', () => { await evmRevert( registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), emptyBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + emptyBytes, + '0x', + ), 'RegistryPaused()', ) }) @@ -3940,9 +4008,13 @@ describe('AutomationRegistry2_2', () => { await evmRevert( registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](zeroAddress, performGas, await admin.getAddress(), emptyBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + zeroAddress, + performGas, + await admin.getAddress(), + emptyBytes, + '0x', + ), 'NotAContract()', ) }) @@ -3951,9 +4023,13 @@ describe('AutomationRegistry2_2', () => { await evmRevert( registry .connect(keeper1) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), emptyBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + emptyBytes, + '0x', + ), 'OnlyCallableByOwnerOrRegistrar()', ) }) @@ -3962,9 +4038,13 @@ describe('AutomationRegistry2_2', () => { await evmRevert( registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, 2299, await admin.getAddress(), emptyBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + 2299, + await admin.getAddress(), + emptyBytes, + '0x', + ), 'GasLimitOutsideRange()', ) }) @@ -3973,9 +4053,13 @@ describe('AutomationRegistry2_2', () => { await evmRevert( registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, 5000001, await admin.getAddress(), emptyBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + 5000001, + await admin.getAddress(), + emptyBytes, + '0x', + ), 'GasLimitOutsideRange()', ) }) @@ -3988,9 +4072,13 @@ describe('AutomationRegistry2_2', () => { await evmRevert( registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), longBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + longBytes, + '0x', + ), 'CheckDataExceedsLimit()', ) }) @@ -4005,9 +4093,13 @@ describe('AutomationRegistry2_2', () => { const checkData = checkDatas[kdx] const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), checkData, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + checkData, + '0x', + ) //confirm the upkeep details and verify emitted events const testUpkeepId = await getUpkeepID(tx) @@ -4670,9 +4762,13 @@ describe('AutomationRegistry2_2', () => { await evmRevert( registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), emptyBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + emptyBytes, + '0x', + ), 'RegistryPaused()', ) }) diff --git a/contracts/test/v0.8/automation/KeeperRegistry2_1.test.ts b/contracts/test/v0.8/automation/KeeperRegistry2_1.test.ts index 65f6a596fca..f6864bd36de 100644 --- a/contracts/test/v0.8/automation/KeeperRegistry2_1.test.ts +++ b/contracts/test/v0.8/automation/KeeperRegistry2_1.test.ts @@ -990,9 +990,13 @@ describe('KeeperRegistry2_1', () => { .transfer(await admin.getAddress(), toWei('1000')) let tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) upkeepId = await getUpkeepID(tx) autoFunderUpkeep = await upkeepAutoFunderFactory @@ -1000,17 +1004,27 @@ describe('KeeperRegistry2_1', () => { .deploy(linkToken.address, registry.address) tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](autoFunderUpkeep.address, performGas, autoFunderUpkeep.address, randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + autoFunderUpkeep.address, + performGas, + autoFunderUpkeep.address, + randomBytes, + '0x', + ) afUpkeepId = await getUpkeepID(tx) ltUpkeep = await deployMockContract(owner, ILogAutomationactory.abi) tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,uint8,bytes,bytes,bytes)' - ](ltUpkeep.address, performGas, await admin.getAddress(), Trigger.LOG, '0x', logTriggerConfig, emptyBytes) + ['registerUpkeep(address,uint32,address,uint8,bytes,bytes,bytes)']( + ltUpkeep.address, + performGas, + await admin.getAddress(), + Trigger.LOG, + '0x', + logTriggerConfig, + emptyBytes, + ) logUpkeepId = await getUpkeepID(tx) await autoFunderUpkeep.setUpkeepId(afUpkeepId) @@ -1021,9 +1035,13 @@ describe('KeeperRegistry2_1', () => { tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](streamsLookupUpkeep.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + streamsLookupUpkeep.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) streamsLookupUpkeepId = await getUpkeepID(tx) } @@ -1041,9 +1059,13 @@ describe('KeeperRegistry2_1', () => { await mock.setPerformGasToBurn(BigNumber.from('0')) const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const condUpkeepId = await getUpkeepID(tx) passingConditionalUpkeepIds.push(condUpkeepId) @@ -1056,9 +1078,15 @@ describe('KeeperRegistry2_1', () => { await mock.setPerformGasToBurn(BigNumber.from('0')) const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,uint8,bytes,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), Trigger.LOG, '0x', logTriggerConfig, emptyBytes) + ['registerUpkeep(address,uint32,address,uint8,bytes,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + Trigger.LOG, + '0x', + logTriggerConfig, + emptyBytes, + ) const logUpkeepId = await getUpkeepID(tx) passingLogUpkeepIds.push(logUpkeepId) @@ -1071,9 +1099,13 @@ describe('KeeperRegistry2_1', () => { await mock.setPerformGasToBurn(BigNumber.from('0')) const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const failingUpkeepId = await getUpkeepID(tx) failingUpkeepIds.push(failingUpkeepId) } @@ -1555,9 +1587,13 @@ describe('KeeperRegistry2_1', () => { let tx = await arbRegistry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const testUpkeepId = await getUpkeepID(tx) await arbRegistry.connect(owner).addFunds(testUpkeepId, toWei('100')) @@ -2529,9 +2565,13 @@ describe('KeeperRegistry2_1', () => { const mock = await upkeepMockFactory.deploy() const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const testUpkeepId = await getUpkeepID(tx) upkeepIds.push(testUpkeepId) @@ -2566,9 +2606,13 @@ describe('KeeperRegistry2_1', () => { const mock = await upkeepMockFactory.deploy() const tx = await arbRegistry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const testUpkeepId = await getUpkeepID(tx) upkeepIds.push(testUpkeepId) @@ -2625,9 +2669,13 @@ describe('KeeperRegistry2_1', () => { // add funds to upkeep 1 and perform and withdraw some payment const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), emptyBytes, emptyBytes) + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + emptyBytes, + emptyBytes, + ) const id1 = await getUpkeepID(tx) await registry.connect(admin).addFunds(id1, toWei('5')) @@ -2649,9 +2697,13 @@ describe('KeeperRegistry2_1', () => { // add funds to upkeep 2 and perform and withdraw some payment const tx2 = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), emptyBytes, emptyBytes) + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + emptyBytes, + emptyBytes, + ) const id2 = await getUpkeepID(tx2) await registry.connect(admin).addFunds(id2, toWei('5')) @@ -2729,15 +2781,23 @@ describe('KeeperRegistry2_1', () => { it('uses maxPerformData size in checkUpkeep but actual performDataSize in transmit', async () => { const tx1 = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const upkeepID1 = await getUpkeepID(tx1) const tx2 = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) const upkeepID2 = await getUpkeepID(tx2) await mock.setCanCheck(true) await mock.setCanPerform(true) @@ -2800,9 +2860,13 @@ describe('KeeperRegistry2_1', () => { beforeEach(async () => { const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), randomBytes, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + randomBytes, + '0x', + ) upkeepId2 = await getUpkeepID(tx) await registry.connect(admin).addFunds(upkeepId, toWei('100')) @@ -3942,9 +4006,13 @@ describe('KeeperRegistry2_1', () => { await evmRevert( registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), emptyBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + emptyBytes, + '0x', + ), 'RegistryPaused()', ) }) @@ -3953,9 +4021,13 @@ describe('KeeperRegistry2_1', () => { await evmRevert( registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](zeroAddress, performGas, await admin.getAddress(), emptyBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + zeroAddress, + performGas, + await admin.getAddress(), + emptyBytes, + '0x', + ), 'NotAContract()', ) }) @@ -3964,9 +4036,13 @@ describe('KeeperRegistry2_1', () => { await evmRevert( registry .connect(keeper1) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), emptyBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + emptyBytes, + '0x', + ), 'OnlyCallableByOwnerOrRegistrar()', ) }) @@ -3975,9 +4051,13 @@ describe('KeeperRegistry2_1', () => { await evmRevert( registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, 2299, await admin.getAddress(), emptyBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + 2299, + await admin.getAddress(), + emptyBytes, + '0x', + ), 'GasLimitOutsideRange()', ) }) @@ -3986,9 +4066,13 @@ describe('KeeperRegistry2_1', () => { await evmRevert( registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, 5000001, await admin.getAddress(), emptyBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + 5000001, + await admin.getAddress(), + emptyBytes, + '0x', + ), 'GasLimitOutsideRange()', ) }) @@ -4001,9 +4085,13 @@ describe('KeeperRegistry2_1', () => { await evmRevert( registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), longBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + longBytes, + '0x', + ), 'CheckDataExceedsLimit()', ) }) @@ -4018,9 +4106,13 @@ describe('KeeperRegistry2_1', () => { const checkData = checkDatas[kdx] const tx = await registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), checkData, '0x') + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + checkData, + '0x', + ) //confirm the upkeep details and verify emitted events const testUpkeepId = await getUpkeepID(tx) @@ -4681,9 +4773,13 @@ describe('KeeperRegistry2_1', () => { await evmRevert( registry .connect(owner) - [ - 'registerUpkeep(address,uint32,address,bytes,bytes)' - ](mock.address, performGas, await admin.getAddress(), emptyBytes, '0x'), + ['registerUpkeep(address,uint32,address,bytes,bytes)']( + mock.address, + performGas, + await admin.getAddress(), + emptyBytes, + '0x', + ), 'RegistryPaused()', ) }) diff --git a/contracts/test/v0.8/dev/ScrollSequencerUptimeFeed.test.ts b/contracts/test/v0.8/dev/ScrollSequencerUptimeFeed.test.ts index 1d93497b9fa..69075174b1e 100644 --- a/contracts/test/v0.8/dev/ScrollSequencerUptimeFeed.test.ts +++ b/contracts/test/v0.8/dev/ScrollSequencerUptimeFeed.test.ts @@ -27,12 +27,17 @@ describe('ScrollSequencerUptimeFeed', () => { l2CrossDomainMessenger = await l2CrossDomainMessengerFactory.deploy() + const l2MessengerAddress = ethers.utils.getAddress( + BigNumber.from(l1Owner.address) + .add('0x1111000000000000000000000000000000001111') + .toHexString(), + ) // Pretend we're on L2 await network.provider.request({ method: 'hardhat_impersonateAccount', - params: [l2CrossDomainMessenger.address], + params: [l2MessengerAddress], }) - l2Messenger = await ethers.getSigner(l2CrossDomainMessenger.address) + l2Messenger = await ethers.getSigner(l2MessengerAddress) // Credit the L2 messenger with some ETH await dummy.sendTransaction({ to: l2Messenger.address, @@ -304,7 +309,7 @@ describe('ScrollSequencerUptimeFeed', () => { // Assert no update expect(await scrollUptimeFeed.latestAnswer()).to.equal(0) expect(noUpdateTx.cumulativeGasUsed.toNumber()).to.be.closeTo( - 38594, + 35912, gasUsedDeviation, ) @@ -317,7 +322,7 @@ describe('ScrollSequencerUptimeFeed', () => { // Assert update expect(await scrollUptimeFeed.latestAnswer()).to.equal(1) expect(updateTx.cumulativeGasUsed.toNumber()).to.be.closeTo( - 58458, + 55770, gasUsedDeviation, ) }) @@ -391,7 +396,7 @@ describe('ScrollSequencerUptimeFeed', () => { ) const tx = await _tx.wait(1) expect(tx.cumulativeGasUsed.toNumber()).to.be.closeTo( - 28145, + 28035, gasUsedDeviation, ) }) diff --git a/contracts/test/v0.8/dev/ScrollValidator.test.ts b/contracts/test/v0.8/dev/ScrollValidator.test.ts index c5ec59c5c99..94205a03112 100644 --- a/contracts/test/v0.8/dev/ScrollValidator.test.ts +++ b/contracts/test/v0.8/dev/ScrollValidator.test.ts @@ -9,6 +9,7 @@ describe('ScrollValidator', () => { const L2_SEQ_STATUS_RECORDER_ADDRESS = '0x491B1dDA0A8fa069bbC1125133A975BF4e85a91b' let scrollValidator: Contract + let l1MessageQueue: Contract let scrollUptimeFeedFactory: ContractFactory let mockScrollL1CrossDomainMessenger: Contract let deployer: SignerWithAddress @@ -35,6 +36,13 @@ describe('ScrollValidator', () => { mockScrollL1CrossDomainMessenger = await mockScrollL1CrossDomainMessengerFactory.deploy() + // Scroll Message Queue contract on L1 + const l1MessageQueueFactory = await ethers.getContractFactory( + 'src/v0.8/l2ep/test/mocks/scroll/MockScrollL1MessageQueue.sol:MockScrollL1MessageQueue', + deployer, + ) + l1MessageQueue = await l1MessageQueueFactory.deploy() + // Contract under test const scrollValidatorFactory = await ethers.getContractFactory( 'src/v0.8/l2ep/dev/scroll/ScrollValidator.sol:ScrollValidator', @@ -44,6 +52,7 @@ describe('ScrollValidator', () => { scrollValidator = await scrollValidatorFactory.deploy( mockScrollL1CrossDomainMessenger.address, L2_SEQ_STATUS_RECORDER_ADDRESS, + l1MessageQueue.address, GAS_LIMIT, ) })