diff --git a/.github/workflows/solidity-foundry.yml b/.github/workflows/solidity-foundry.yml index ec08f4981a3..850374b0cd3 100644 --- a/.github/workflows/solidity-foundry.yml +++ b/.github/workflows/solidity-foundry.yml @@ -34,7 +34,7 @@ jobs: { "name": "functions", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": true, "run-forge-fmt": false }}, { "name": "keystone", "setup": { "run-coverage": true, "min-coverage": 72.8, "run-gas-snapshot": false, "run-forge-fmt": false }}, { "name": "l2ep", "setup": { "run-coverage": true, "min-coverage": 65.0, "run-gas-snapshot": true, "run-forge-fmt": false }}, - { "name": "liquiditymanager", "setup": { "run-coverage": true, "min-coverage": 46.3, "run-gas-snapshot": true, "run-forge-fmt": false }}, + { "name": "liquiditymanager", "setup": { "run-coverage": true, "min-coverage": 44, "run-gas-snapshot": true, "run-forge-fmt": false }}, { "name": "llo-feeds", "setup": { "run-coverage": true, "min-coverage": 49.3, "run-gas-snapshot": true, "run-forge-fmt": false }}, { "name": "operatorforwarder", "setup": { "run-coverage": true, "min-coverage": 55.7, "run-gas-snapshot": true, "run-forge-fmt": false }}, { "name": "shared", "setup": { "run-coverage": true, "extra-coverage-params": "--no-match-path='*CallWithExactGas*' --ir-minimum", "min-coverage": 32.6, "run-gas-snapshot": true, "run-forge-fmt": false }}, diff --git a/contracts/.changeset/stale-cougars-approve.md b/contracts/.changeset/stale-cougars-approve.md deleted file mode 100644 index fd219a2ad7e..00000000000 --- a/contracts/.changeset/stale-cougars-approve.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@chainlink/contracts': patch ---- - -minor var names and comments update -de-duplicate tests and fix file exclusion for coverage - - -SHIP-3521 \ No newline at end of file diff --git a/contracts/.changeset/thirty-rules-rule.md b/contracts/.changeset/thirty-rules-rule.md new file mode 100644 index 00000000000..c7b36132f3b --- /dev/null +++ b/contracts/.changeset/thirty-rules-rule.md @@ -0,0 +1,5 @@ +--- +'@chainlink/contracts': patch +--- + +[L2EP] Refactor tests and fix file exclusion for coverage diff --git a/contracts/gas-snapshots/l2ep.gas-snapshot b/contracts/gas-snapshots/l2ep.gas-snapshot index b9f0510d205..7caca346f48 100644 --- a/contracts/gas-snapshots/l2ep.gas-snapshot +++ b/contracts/gas-snapshots/l2ep.gas-snapshot @@ -1,132 +1,113 @@ -ArbitrumCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37568) -ArbitrumCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 12963) -ArbitrumCrossDomainForwarder_Constructor:test_InitialState() (gas: 22163) -ArbitrumCrossDomainForwarder_Forward:test_Forward() (gas: 47867) -ArbitrumCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 22181) -ArbitrumCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 16056) -ArbitrumCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 41453) -ArbitrumCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19290) -ArbitrumCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18637) -ArbitrumCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 13242) -ArbitrumCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37568) -ArbitrumCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 12963) -ArbitrumCrossDomainGovernor_Constructor:test_InitialState() (gas: 22186) -ArbitrumCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 50003) -ArbitrumCrossDomainGovernor_Forward:test_Forward() (gas: 47896) -ArbitrumCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 24326) -ArbitrumCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 18233) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 19386) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 60874) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 63003) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 18245) -ArbitrumCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 64368) -ArbitrumCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 41453) -ArbitrumCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19290) -ArbitrumCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18637) -ArbitrumCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 13242) -ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 104862) -ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_Return0WhenRoundDoesNotExistYet() (gas: 19967) -ArbitrumSequencerUptimeFeed_Constants:test_InitialState() (gas: 8518) -ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 604370) -ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 574432) -ArbitrumSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 99629) -ArbitrumSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 15447) -ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 114625) -ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 114708) -ArbitrumValidator_Validate:test_PostSequencerOffline() (gas: 69086) -BaseSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 69349) -BaseSequencerUptimeFeed_AggregatorV3Interface:test_GetValidAnswer() (gas: 57286) -BaseSequencerUptimeFeed_AggregatorV3Interface:test_GetValidTimestamp() (gas: 57177) -BaseSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 17676) -BaseSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 17893) -BaseSequencerUptimeFeed_AggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17620) -BaseSequencerUptimeFeed_Constructor:test_InitialState() (gas: 22054) -BaseSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 601614) -BaseSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 574443) -BaseSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 65950) -BaseSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 1470249) -BaseSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenNoChange() (gas: 77240) -BaseSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 96101) -BaseSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 96184) -BaseSequencerUptimeFeed_transferL1Sender:test_TransferL1Sender() (gas: 1492933) -BaseValidator_Constructor:test_ConstructingRevertedWithZeroL1BridgeAddress() (gas: 80830) -BaseValidator_Constructor:test_ConstructingRevertedWithZeroL2UpdateFeedAddress() (gas: 80887) -BaseValidator_GetAndSetGasLimit:test_CorrectlyGetsGasLimit() (gas: 20136) -OptimismCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47160) -OptimismCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22160) -OptimismCrossDomainForwarder_Constructor:test_InitialState() (gas: 21998) -OptimismCrossDomainForwarder_Forward:test_Forward() (gas: 58281) -OptimismCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32560) -OptimismCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13867) -OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48933) -OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28753) -OptimismCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16448) -OptimismCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11053) -OptimismCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47160) -OptimismCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22160) -OptimismCrossDomainGovernor_Constructor:test_InitialState() (gas: 22021) -OptimismCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 47846) -OptimismCrossDomainGovernor_Forward:test_Forward() (gas: 58330) -OptimismCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 32619) -OptimismCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 16047) -OptimismCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29189) -OptimismCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 72942) -OptimismCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 72947) -OptimismCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16059) -OptimismCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 76156) -OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48933) -OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28753) -OptimismCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16448) -OptimismCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11053) -OptimismSequencerUptimeFeed_Constructor:test_InitialState() (gas: 1548240) -OptimismSequencerUptimeFeed_ValidateSender:test_RevertIfL1CrossDomainMessengerAddrIsNotL1SenderAddr() (gas: 18213) -OptimismSequencerUptimeFeed_ValidateSender:test_RevertIfSenderIsNotL2CrossDomainMessengerAddr() (gas: 15127) -OptimismSequencerUptimeFeed_ValidateSender:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 17891) -OptimismValidator_Validate:test_PostSequencerOffline() (gas: 74790) -OptimismValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 74869) -OptimismValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15571) -ScrollCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47255) -ScrollCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22212) -ScrollCrossDomainForwarder_Constructor:test_InitialState() (gas: 21674) -ScrollCrossDomainForwarder_Forward:test_Forward() (gas: 58348) -ScrollCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32618) -ScrollCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13867) -ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48999) -ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28819) -ScrollCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16448) -ScrollCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11053) -ScrollCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47255) -ScrollCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22212) -ScrollCrossDomainGovernor_Constructor:test_InitialState() (gas: 21697) -ScrollCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 47841) -ScrollCrossDomainGovernor_Forward:test_Forward() (gas: 58392) -ScrollCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 32674) -ScrollCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 16044) -ScrollCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29250) -ScrollCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 73009) -ScrollCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 73014) -ScrollCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16056) -ScrollCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 76224) -ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48999) -ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28819) -ScrollCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16448) -ScrollCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11053) -ScrollSequencerUptimeFeed_Constructor:test_InitialStateWithInvalidL2XDomainManager() (gas: 173935) -ScrollSequencerUptimeFeed_Constructor:test_InitialStateWithValidL2XDomainManager() (gas: 1529275) -ScrollSequencerUptimeFeed_ValidateSender:test_RevertIfL1CrossDomainMessengerAddrIsNotL1SenderAddr() (gas: 18236) -ScrollSequencerUptimeFeed_ValidateSender:test_RevertIfSenderIsNotL2CrossDomainMessengerAddr() (gas: 15127) -ScrollSequencerUptimeFeed_ValidateSender:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 17914) -ScrollValidator_Constructor:test_InitialState() (gas: 110196) -ScrollValidator_Validate:test_PostSequencerOffline() (gas: 78326) -ScrollValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 78411) -ScrollValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15571) -ZKSyncSequencerUptimeFeed_ValidateSender:test_PassIfSenderIsValid() (gas: 12659) -ZKSyncSequencerUptimeFeed_ValidateSender:test_RevertIfPassIsNotValid() (gas: 10899) -ZKSyncValidator_Constructor:test_ConstructingRevertedWithInvalidChainId() (gas: 103725) -ZKSyncValidator_Constructor:test_ConstructingRevertedWithZeroL1BridgeAddress() (gas: 81440) -ZKSyncValidator_Constructor:test_ConstructingRevertedWithZeroL2UpdateFeedAddress() (gas: 81497) -ZKSyncValidator_GetChainId:test_CorrectlyGetsTheChainId() (gas: 8350) -ZKSyncValidator_GetSetL2GasPerPubdataByteLimit:test_CorrectlyGetsAndUpdatesTheGasPerPubdataByteLimit() (gas: 18915) -ZKSyncValidator_Validate:test_PostSequencerOffline() (gas: 52255) -ZKSyncValidator_Validate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 52355) -ZKSyncValidator_Validate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15644) +ArbitrumCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37567) +ArbitrumCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 12954) +ArbitrumCrossDomainForwarder_Constructor:test_InitialState() (gas: 22111) +ArbitrumCrossDomainForwarder_Forward:test_Forward() (gas: 47818) +ArbitrumCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 22147) +ArbitrumCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 16083) +ArbitrumCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 41439) +ArbitrumCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19274) +ArbitrumCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18644) +ArbitrumCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 13232) +ArbitrumCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37567) +ArbitrumCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 12954) +ArbitrumCrossDomainGovernor_Constructor:test_InitialState() (gas: 22134) +ArbitrumCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 49953) +ArbitrumCrossDomainGovernor_Forward:test_Forward() (gas: 47869) +ArbitrumCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 24268) +ArbitrumCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 18216) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 19338) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 60787) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 62915) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 18271) +ArbitrumCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 64276) +ArbitrumCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 41439) +ArbitrumCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19274) +ArbitrumCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 18644) +ArbitrumCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 13232) +ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface() (gas: 104766) +ArbitrumSequencerUptimeFeed_AggregatorV3Interface:test_Return0WhenRoundDoesNotExistYet() (gas: 19945) +ArbitrumSequencerUptimeFeed_Constants:test_InitialState() (gas: 8492) +ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 592246) +ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 562331) +ArbitrumSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 99593) +ArbitrumSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 15442) +ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 114527) +ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 114610) +ArbitrumValidator_Validate:test_PostSequencerOffline() (gas: 69009) +BaseSequencerUptimeFeed_AggregatorV3Interface:test_AggregatorV3Interface_ReturnsValidData() (gas: 69197) +BaseSequencerUptimeFeed_AggregatorV3Interface:test_getAnswer_ReturnsValidAnswer() (gas: 57300) +BaseSequencerUptimeFeed_AggregatorV3Interface:test_getTimestamp_ReturnsValidTimestamp() (gas: 57151) +BaseSequencerUptimeFeed_Constructor:test_Constructor_InitialState() (gas: 22050) +BaseSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_ProtectReads_AllowWhen_Whitelisted() (gas: 589517) +BaseSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions:test_ProtectReads_DisallowWhen_NotWhitelisted() (gas: 562342) +BaseSequencerUptimeFeed_UpdateStatus:test_updateStatus_IgnoreOutOfOrderUpdates() (gas: 69490) +BaseSequencerUptimeFeed_UpdateStatus:test_updateStatus_UpdateWhen_NoStatusChangeSameTimestamp() (gas: 77166) +BaseSequencerUptimeFeed_UpdateStatus:test_updateStatus_UpdateWhen_StatusChangeAndNoTimeChange() (gas: 96021) +BaseSequencerUptimeFeed_UpdateStatus:test_updateStatus_UpdateWhen_StatusChangeAndTimeChange() (gas: 96100) +BaseSequencerUptimeFeed_transferL1Sender:test_transferL1Sender_CorrectlyTransfersL1Sender() (gas: 1479310) +BaseValidator_GetAndSetGasLimit:test_GetAndSetGasLimit_CorrectlyHandlesGasLimit() (gas: 20119) +OptimismCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47110) +OptimismCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22135) +OptimismCrossDomainForwarder_Constructor:test_InitialState() (gas: 21947) +OptimismCrossDomainForwarder_Forward:test_Forward() (gas: 58213) +OptimismCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32533) +OptimismCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13895) +OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48912) +OptimismCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28733) +OptimismCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16456) +OptimismCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11044) +OptimismCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47110) +OptimismCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22135) +OptimismCrossDomainGovernor_Constructor:test_InitialState() (gas: 21970) +OptimismCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 47797) +OptimismCrossDomainGovernor_Forward:test_Forward() (gas: 58284) +OptimismCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 32569) +OptimismCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 16031) +OptimismCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29128) +OptimismCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 72836) +OptimismCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 72841) +OptimismCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16086) +OptimismCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 76045) +OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48912) +OptimismCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28733) +OptimismCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16456) +OptimismCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11044) +OptimismSequencerUptimeFeed_Constructor:test_Constructor_InitialState() (gas: 1530881) +OptimismSequencerUptimeFeed_ValidateSender:test_ValidateSender_UpdateStatusWhen_StatusChangeAndNoTimeChange() (gas: 17874) +OptimismValidator_Validate:test_Validate_PostSequencerOffline() (gas: 74773) +OptimismValidator_Validate:test_Validate_PostSequencerStatus_NoStatusChange() (gas: 74788) +ScrollCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47196) +ScrollCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22185) +ScrollCrossDomainForwarder_Constructor:test_InitialState() (gas: 21623) +ScrollCrossDomainForwarder_Forward:test_Forward() (gas: 58277) +ScrollCrossDomainForwarder_Forward:test_ForwardRevert() (gas: 32589) +ScrollCrossDomainForwarder_Forward:test_NotCallableByUnknownAddress() (gas: 13895) +ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1Owner() (gas: 48975) +ScrollCrossDomainForwarder_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28791) +ScrollCrossDomainForwarder_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16456) +ScrollCrossDomainForwarder_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11044) +ScrollCrossDomainGovernor_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 47196) +ScrollCrossDomainGovernor_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22185) +ScrollCrossDomainGovernor_Constructor:test_InitialState() (gas: 21646) +ScrollCrossDomainGovernor_Forward:test_CallableByL2Owner() (gas: 47792) +ScrollCrossDomainGovernor_Forward:test_Forward() (gas: 58343) +ScrollCrossDomainGovernor_Forward:test_ForwardRevert() (gas: 32622) +ScrollCrossDomainGovernor_Forward:test_NotCallableByUnknownAddress() (gas: 16028) +ScrollCrossDomainGovernor_ForwardDelegate:test_BubbleUpRevert() (gas: 29186) +ScrollCrossDomainGovernor_ForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 72900) +ScrollCrossDomainGovernor_ForwardDelegate:test_CallableByL2Owner() (gas: 72905) +ScrollCrossDomainGovernor_ForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16083) +ScrollCrossDomainGovernor_ForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 76110) +ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1Owner() (gas: 48975) +ScrollCrossDomainGovernor_TransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28791) +ScrollCrossDomainGovernor_TransferL1Ownership:test_NotCallableByL2Owner() (gas: 16456) +ScrollCrossDomainGovernor_TransferL1Ownership:test_NotCallableByNonOwners() (gas: 11044) +ScrollSequencerUptimeFeed_Constructor:test_Constructor_InitialState_WhenValidL2XDomainMessenger() (gas: 1511902) +ScrollSequencerUptimeFeed_ValidateSender:test_ValidateSender_UpdateStatusWhen_StatusChangeAndNoTimeChange() (gas: 17864) +ScrollValidator_Validate:test_Validate_PostSequencerOffline() (gas: 78317) +ScrollValidator_Validate:test_Validate_PostSequencerStatus_NoStatusChange() (gas: 78338) +ZKSyncSequencerUptimeFeed_ValidateSender:test_ValidateSender_SuccessWhen_SenderIsValid() (gas: 12611) +ZKSyncValidator_GetChainId:test_GetChainId_CorrectlyGetsTheChainId() (gas: 8369) +ZKSyncValidator_GetSetL2GasPerPubdataByteLimit:test_GetSetL2GasPerPubdataByteLimit_CorrectlyHandlesGasPerPubdataByteLimit() (gas: 18918) +ZKSyncValidator_Validate:test_Validate_PostSequencerOffline() (gas: 52208) +ZKSyncValidator_Validate:test_Validate_PostSequencerStatus_NoStatusChange() (gas: 52280) \ No newline at end of file diff --git a/contracts/src/v0.8/l2ep/shared/BaseSequencerUptimeFeed.sol b/contracts/src/v0.8/l2ep/base/BaseSequencerUptimeFeed.sol similarity index 100% rename from contracts/src/v0.8/l2ep/shared/BaseSequencerUptimeFeed.sol rename to contracts/src/v0.8/l2ep/base/BaseSequencerUptimeFeed.sol diff --git a/contracts/src/v0.8/l2ep/shared/BaseValidator.sol b/contracts/src/v0.8/l2ep/base/BaseValidator.sol similarity index 100% rename from contracts/src/v0.8/l2ep/shared/BaseValidator.sol rename to contracts/src/v0.8/l2ep/base/BaseValidator.sol diff --git a/contracts/src/v0.8/l2ep/test/mocks/MockBaseSequencerUptimeFeed.sol b/contracts/src/v0.8/l2ep/test/mocks/MockBaseSequencerUptimeFeed.sol index 5bd51b4df56..50d852faa45 100644 --- a/contracts/src/v0.8/l2ep/test/mocks/MockBaseSequencerUptimeFeed.sol +++ b/contracts/src/v0.8/l2ep/test/mocks/MockBaseSequencerUptimeFeed.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {BaseSequencerUptimeFeed} from "../../dev/base/BaseSequencerUptimeFeed.sol"; +import {BaseSequencerUptimeFeed} from "../../base/BaseSequencerUptimeFeed.sol"; contract MockBaseSequencerUptimeFeed is BaseSequencerUptimeFeed { string public constant override typeAndVersion = "MockSequencerUptimeFeed 1.1.0-dev"; diff --git a/contracts/src/v0.8/l2ep/test/mocks/MockBaseValidator.sol b/contracts/src/v0.8/l2ep/test/mocks/MockBaseValidator.sol index 2cd7cc25804..d23efb48656 100644 --- a/contracts/src/v0.8/l2ep/test/mocks/MockBaseValidator.sol +++ b/contracts/src/v0.8/l2ep/test/mocks/MockBaseValidator.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {BaseValidator} from "../../dev/base/BaseValidator.sol"; +import {BaseValidator} from "../../base/BaseValidator.sol"; contract MockBaseValidator is BaseValidator { string public constant override typeAndVersion = "MockValidator 1.1.0-dev"; diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismSequencerUptimeFeed.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismSequencerUptimeFeed.t.sol index e11a03267a0..34010c313e8 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismSequencerUptimeFeed.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismSequencerUptimeFeed.t.sol @@ -4,37 +4,36 @@ pragma solidity 0.8.24; import {MockOptimismL1CrossDomainMessenger} from "../../../../tests/MockOptimismL1CrossDomainMessenger.sol"; import {MockOptimismL2CrossDomainMessenger} from "../../../../tests/MockOptimismL2CrossDomainMessenger.sol"; import {OptimismSequencerUptimeFeed} from "../../../optimism/OptimismSequencerUptimeFeed.sol"; -import {BaseSequencerUptimeFeed} from "../../../shared/BaseSequencerUptimeFeed.sol"; -import {FeedConsumer} from "../../../../tests/FeedConsumer.sol"; +import {BaseSequencerUptimeFeed} from "../../../base/BaseSequencerUptimeFeed.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; -contract OptimismSequencerUptimeFeedTestWrapper is OptimismSequencerUptimeFeed { +contract OptimismSequencerUptimeFeed_TestWrapper is OptimismSequencerUptimeFeed { constructor( address l1SenderAddress, address l2CrossDomainMessengerAddr, bool initialStatus ) OptimismSequencerUptimeFeed(l1SenderAddress, l2CrossDomainMessengerAddr, initialStatus) {} - /// @notice it exposes the internal _validateSender function for testing + /// @notice Exposes the internal `_validateSender` function for testing function validateSenderTestWrapper(address l1Sender) external view { super._validateSender(l1Sender); } } -contract OptimismSequencerUptimeFeedTest is L2EPTest { +contract OptimismSequencerUptimeFeed_Setup is L2EPTest { event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt); /// L2EP contracts MockOptimismL1CrossDomainMessenger internal s_mockOptimismL1CrossDomainMessenger; MockOptimismL2CrossDomainMessenger internal s_mockOptimismL2CrossDomainMessenger; - OptimismSequencerUptimeFeedTestWrapper internal s_optimismSequencerUptimeFeed; + OptimismSequencerUptimeFeed_TestWrapper internal s_optimismSequencerUptimeFeed; /// Setup function setUp() public { - // Deploys contracts + // Deploy contracts s_mockOptimismL1CrossDomainMessenger = new MockOptimismL1CrossDomainMessenger(); s_mockOptimismL2CrossDomainMessenger = new MockOptimismL2CrossDomainMessenger(); - s_optimismSequencerUptimeFeed = new OptimismSequencerUptimeFeedTestWrapper( + s_optimismSequencerUptimeFeed = new OptimismSequencerUptimeFeed_TestWrapper( s_l1OwnerAddr, address(s_mockOptimismL2CrossDomainMessenger), false @@ -45,13 +44,13 @@ contract OptimismSequencerUptimeFeedTest is L2EPTest { } } -contract OptimismSequencerUptimeFeed_Constructor is OptimismSequencerUptimeFeedTest { - /// @notice it should have been deployed with the correct initial state - function test_InitialState() public { +contract OptimismSequencerUptimeFeed_Constructor is OptimismSequencerUptimeFeed_Setup { + /// @notice Tests the initial state of the contract + function test_Constructor_InitialState() public { // Sets msg.sender and tx.origin to a valid address vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr); - new OptimismSequencerUptimeFeedTestWrapper(s_l1OwnerAddr, address(s_mockOptimismL2CrossDomainMessenger), false); + new OptimismSequencerUptimeFeed_TestWrapper(s_l1OwnerAddr, address(s_mockOptimismL2CrossDomainMessenger), false); // Checks L1 sender address actualL1Addr = s_optimismSequencerUptimeFeed.l1Sender(); @@ -64,9 +63,9 @@ contract OptimismSequencerUptimeFeed_Constructor is OptimismSequencerUptimeFeedT } } -contract OptimismSequencerUptimeFeed_ValidateSender is OptimismSequencerUptimeFeedTest { - /// @notice it should revert if called by an address that is not the L2 Cross Domain Messenger - function test_RevertIfSenderIsNotL2CrossDomainMessengerAddr() public { +contract OptimismSequencerUptimeFeed_ValidateSender is OptimismSequencerUptimeFeed_Setup { + /// @notice Reverts if called by an address that is not the L2 Cross Domain Messenger + function test_ValidateSender_RevertWhen_SenderIsNotL2CrossDomainMessengerAddr() public { address l2MessengerAddr = address(s_mockOptimismL2CrossDomainMessenger); // Sets msg.sender to a different address vm.startPrank(s_strangerAddr, l2MessengerAddr); @@ -75,8 +74,8 @@ contract OptimismSequencerUptimeFeed_ValidateSender is OptimismSequencerUptimeFe s_optimismSequencerUptimeFeed.validateSenderTestWrapper(s_l1OwnerAddr); } - /// @notice it should revert if the L1 sender address is not the L1 Cross Domain Messenger Sender - function test_RevertIfL1CrossDomainMessengerAddrIsNotL1SenderAddr() public { + /// @notice Reverts if the L1 sender address is not the L1 Cross Domain Messenger Sender + function test_ValidateSender_RevertWhen_L1CrossDomainMessengerAddrIsNotL1SenderAddr() public { // Sets msg.sender and tx.origin to an unauthorized address address l2MessengerAddr = address(s_mockOptimismL2CrossDomainMessenger); vm.startPrank(l2MessengerAddr, l2MessengerAddr); @@ -85,8 +84,8 @@ contract OptimismSequencerUptimeFeed_ValidateSender is OptimismSequencerUptimeFe s_optimismSequencerUptimeFeed.validateSenderTestWrapper(s_strangerAddr); } - /// @notice it should update status when status has changed and incoming timestamp is the same as latest - function test_UpdateStatusWhenStatusChangeAndNoTimeChange() public { + /// @notice Updates status when status has changed and incoming timestamp is the same as the latest + function test_ValidateSender_UpdateStatusWhen_StatusChangeAndNoTimeChange() public { // Sets msg.sender and tx.origin to a valid address address l2MessengerAddr = address(s_mockOptimismL2CrossDomainMessenger); vm.startPrank(l2MessengerAddr, l2MessengerAddr); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismValidator.t.sol index dd1ca36132f..48ff1f7778d 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismValidator.t.sol @@ -9,7 +9,7 @@ import {OptimismSequencerUptimeFeed} from "../../../optimism/OptimismSequencerUp import {OptimismValidator} from "../../../optimism/OptimismValidator.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; -contract OptimismValidatorTest is L2EPTest { +contract OptimismValidator_Setup is L2EPTest { /// Helper constants address internal constant L2_SEQ_STATUS_RECORDER_ADDRESS = 0x491B1dDA0A8fa069bbC1125133A975BF4e85a91b; uint32 internal constant INIT_GAS_LIMIT = 1900000; @@ -42,16 +42,16 @@ contract OptimismValidatorTest is L2EPTest { } } -contract OptimismValidator_Validate is OptimismValidatorTest { +contract OptimismValidator_Validate is OptimismValidator_Setup { /// @notice it reverts if called by account with no access - function test_RevertsIfCalledByAnAccountWithNoAccess() public { + function test_Validate_RevertWhen_CalledByAccountWithNoAccess() public { vm.startPrank(s_strangerAddr); vm.expectRevert("No access"); s_optimismValidator.validate(0, 0, 1, 1); } - /// @notice it posts sequencer status when there is not status change - function test_PostSequencerStatusWhenThereIsNotStatusChange() public { + /// @notice it posts sequencer status when there is no status change + function test_Validate_PostSequencerStatus_NoStatusChange() public { // Gives access to the s_eoaValidator s_optimismValidator.addAccess(s_eoaValidator); @@ -74,8 +74,8 @@ contract OptimismValidator_Validate is OptimismValidatorTest { s_optimismValidator.validate(0, 0, 0, 0); } - /// @notice it post sequencer offline - function test_PostSequencerOffline() public { + /// @notice it posts sequencer offline + function test_Validate_PostSequencerOffline() public { // Gives access to the s_eoaValidator s_optimismValidator.addAccess(s_eoaValidator); 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 f60dd006d1a..1ad4bfd8119 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 @@ -4,8 +4,7 @@ pragma solidity 0.8.24; import {MockScrollL1CrossDomainMessenger} from "../../mocks/scroll/MockScrollL1CrossDomainMessenger.sol"; import {MockScrollL2CrossDomainMessenger} from "../../mocks/scroll/MockScrollL2CrossDomainMessenger.sol"; import {ScrollSequencerUptimeFeed} from "../../../scroll/ScrollSequencerUptimeFeed.sol"; -import {BaseSequencerUptimeFeed} from "../../../shared/BaseSequencerUptimeFeed.sol"; -import {FeedConsumer} from "../../../../tests/FeedConsumer.sol"; +import {BaseSequencerUptimeFeed} from "../../../base/BaseSequencerUptimeFeed.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; contract ScrollSequencerUptimeFeedTestWrapper is ScrollSequencerUptimeFeed { @@ -15,13 +14,13 @@ contract ScrollSequencerUptimeFeedTestWrapper is ScrollSequencerUptimeFeed { bool initialStatus ) ScrollSequencerUptimeFeed(l1SenderAddress, l2CrossDomainMessengerAddr, initialStatus) {} - /// @notice it exposes the internal _validateSender function for testing + /// @notice It exposes the internal _validateSender function for testing function validateSenderTestWrapper(address l1Sender) external view { super._validateSender(l1Sender); } } -contract ScrollSequencerUptimeFeedTest is L2EPTest { +contract ScrollSequencerUptimeFeed_Setup is L2EPTest { /// Constants uint256 internal constant GAS_USED_DEVIATION = 100; @@ -51,9 +50,9 @@ contract ScrollSequencerUptimeFeedTest is L2EPTest { } } -contract ScrollSequencerUptimeFeed_Constructor is ScrollSequencerUptimeFeedTest { - /// @notice it should have been deployed with the correct initial state - function test_InitialStateWithInvalidL2XDomainManager() public { +contract ScrollSequencerUptimeFeed_Constructor is ScrollSequencerUptimeFeed_Setup { + /// @notice Reverts when L2 Cross Domain Messenger address is invalid + function test_Constructor_RevertWhen_InvalidL2XDomainMessenger() public { // L2 cross domain messenger address must not be the zero address vm.expectRevert(ScrollSequencerUptimeFeed.ZeroAddress.selector); new ScrollSequencerUptimeFeed(s_l1OwnerAddr, address(0), false); @@ -70,7 +69,8 @@ contract ScrollSequencerUptimeFeed_Constructor is ScrollSequencerUptimeFeedTest assertEq(answer, 0); } - function test_InitialStateWithValidL2XDomainManager() public { + /// @notice Tests initial state with valid L2 Cross Domain Messenger + function test_Constructor_InitialState_WhenValidL2XDomainMessenger() public { vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr); ScrollSequencerUptimeFeed scrollSequencerUptimeFeed = new ScrollSequencerUptimeFeed( s_l1OwnerAddr, @@ -89,17 +89,17 @@ contract ScrollSequencerUptimeFeed_Constructor is ScrollSequencerUptimeFeedTest } } -contract ScrollSequencerUptimeFeed_ValidateSender is ScrollSequencerUptimeFeedTest { - /// @notice it should revert if called by an address that is not the L2 Cross Domain Messenger - function test_RevertIfSenderIsNotL2CrossDomainMessengerAddr() public { +contract ScrollSequencerUptimeFeed_ValidateSender is ScrollSequencerUptimeFeed_Setup { + /// @notice Reverts when sender is not L2 Cross Domain Messenger address + function test_ValidateSender_RevertWhen_SenderIsNotL2CrossDomainMessengerAddr() public { vm.startPrank(s_strangerAddr); vm.expectRevert(BaseSequencerUptimeFeed.InvalidSender.selector); s_scrollSequencerUptimeFeed.validateSenderTestWrapper(s_l1OwnerAddr); } - /// @notice it should revert if the L1 sender address is not the L1 Cross Domain Messenger Sender - function test_RevertIfL1CrossDomainMessengerAddrIsNotL1SenderAddr() public { + /// @notice Reverts when L1 Cross Domain Messenger address is not L1 sender address + function test_ValidateSender_RevertWhen_L1CrossDomainMessengerAddrIsNotL1SenderAddr() public { address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); vm.startPrank(l2MessengerAddr); @@ -107,8 +107,8 @@ contract ScrollSequencerUptimeFeed_ValidateSender is ScrollSequencerUptimeFeedTe s_scrollSequencerUptimeFeed.validateSenderTestWrapper(s_strangerAddr); } - /// @notice it should update status when status has changed and incoming timestamp is the same as latest - function test_UpdateStatusWhenStatusChangeAndNoTimeChange() public { + /// @notice Updates status when status changes and incoming timestamp is the same as latest + function test_ValidateSender_UpdateStatusWhen_StatusChangeAndNoTimeChange() public { address l2MessengerAddr = address(s_mockScrollL2CrossDomainMessenger); vm.startPrank(l2MessengerAddr); 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 6a9cbba44bd..b7708889100 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 @@ -10,7 +10,7 @@ import {ScrollSequencerUptimeFeed} from "../../../scroll/ScrollSequencerUptimeFe import {ScrollValidator} from "../../../scroll/ScrollValidator.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; -contract ScrollValidatorTest is L2EPTest { +contract ScrollValidator_Setup is L2EPTest { /// Helper constants address internal immutable L2_SEQ_STATUS_RECORDER_ADDRESS = makeAddr("L2_SEQ_STATUS_RECORDER_ADDRESS"); uint32 internal constant INIT_GAS_LIMIT = 1900000; @@ -53,9 +53,9 @@ contract ScrollValidatorTest is L2EPTest { } } -contract ScrollValidator_Constructor is ScrollValidatorTest { - /// @notice it should have been deployed with the correct initial state - function test_InitialState() public { +contract ScrollValidator_Constructor is ScrollValidator_Setup { + /// @notice Reverts when L1 message queue address is invalid + function test_Constructor_RevertWhen_InvalidL1MessageQueueAddress() public { vm.startPrank(s_l1OwnerAddr); vm.expectRevert("Invalid L1 message queue address"); @@ -68,16 +68,16 @@ contract ScrollValidator_Constructor is ScrollValidatorTest { } } -contract ScrollValidator_Validate is ScrollValidatorTest { - /// @notice it reverts if called by account with no access - function test_RevertsIfCalledByAnAccountWithNoAccess() public { +contract ScrollValidator_Validate is ScrollValidator_Setup { + /// @notice Reverts if called by an account with no access + function test_Validate_RevertWhen_CalledByAccountWithNoAccess() public { vm.startPrank(s_strangerAddr); vm.expectRevert("No access"); s_scrollValidator.validate(0, 0, 1, 1); } - /// @notice it posts sequencer status when there is not status change - function test_PostSequencerStatusWhenThereIsNotStatusChange() public { + /// @notice Posts sequencer status when there is no status change + function test_Validate_PostSequencerStatus_NoStatusChange() public { // Gives access to the s_eoaValidator s_scrollValidator.addAccess(s_eoaValidator); @@ -101,8 +101,8 @@ contract ScrollValidator_Validate is ScrollValidatorTest { s_scrollValidator.validate(0, 0, 0, 0); } - /// @notice it post sequencer offline - function test_PostSequencerOffline() public { + /// @notice Posts sequencer offline status + function test_Validate_PostSequencerOffline() public { // Gives access to the s_eoaValidator s_scrollValidator.addAccess(s_eoaValidator); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseSequencerUptimeFeed.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseSequencerUptimeFeed.t.sol index 529c0b53b41..20553e33bab 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseSequencerUptimeFeed.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseSequencerUptimeFeed.t.sol @@ -3,12 +3,12 @@ pragma solidity ^0.8.24; import {Vm} from "forge-std/Test.sol"; import {AddressAliasHelper} from "../../../../vendor/arb-bridge-eth/v0.8.0-custom/contracts/libraries/AddressAliasHelper.sol"; -import {BaseSequencerUptimeFeed} from "../../../dev/base/BaseSequencerUptimeFeed.sol"; +import {BaseSequencerUptimeFeed} from "../../../base/BaseSequencerUptimeFeed.sol"; import {MockBaseSequencerUptimeFeed} from "../../../test/mocks/MockBaseSequencerUptimeFeed.sol"; import {FeedConsumer} from "../../../../tests/FeedConsumer.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; -contract BaseSequencerUptimeFeedTest is L2EPTest { +contract BaseSequencerUptimeFeed_Setup is L2EPTest { /// Helper Variables address internal s_aliasedL1OwnerAddress = AddressAliasHelper.applyL1ToL2Alias(s_l1OwnerAddr); @@ -28,9 +28,9 @@ contract BaseSequencerUptimeFeedTest is L2EPTest { } } -contract BaseSequencerUptimeFeed_Constructor is BaseSequencerUptimeFeedTest { - /// @notice it should have been deployed with the correct initial state - function test_InitialState() public { +contract BaseSequencerUptimeFeed_Constructor is BaseSequencerUptimeFeed_Setup { + /// @notice Tests initial state of the contract + function test_Constructor_InitialState() public { // Sets msg.sender and tx.origin to a valid address vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr); @@ -45,9 +45,9 @@ contract BaseSequencerUptimeFeed_Constructor is BaseSequencerUptimeFeedTest { } } -contract BaseSequencerUptimeFeed_transferL1Sender is BaseSequencerUptimeFeedTest { - /// @notice it should revert if called by an unauthorized account - function test_TransferL1Sender() public { +contract BaseSequencerUptimeFeed_transferL1Sender is BaseSequencerUptimeFeed_Setup { + /// @notice Tests transferring L1 sender + function test_transferL1Sender_CorrectlyTransfersL1Sender() public { address initialSender = address(0); address newSender = makeAddr("newSender"); @@ -58,22 +58,33 @@ contract BaseSequencerUptimeFeed_transferL1Sender is BaseSequencerUptimeFeedTest assertEq(sequencerUptimeFeed.l1Sender(), initialSender); - // Tries to transfer the L1 sender from an unauthorized account + // Transfers the L1 sender vm.expectEmit(); emit L1SenderTransferred(initialSender, newSender); sequencerUptimeFeed.transferL1Sender(newSender); assertEq(sequencerUptimeFeed.l1Sender(), newSender); vm.recordLogs(); - // Tries to transfer to the same L1 sender should not emit an event + // Transfers to the same L1 sender should not emit an event sequencerUptimeFeed.transferL1Sender(newSender); assertEq(vm.getRecordedLogs().length, 0); } + + /// @notice Reverts if called by an unauthorized account + function test_transferL1Sender_RevertWhen_CalledByUnauthorizedAccount() public { + address newSender = makeAddr("newSender"); + + // Sets msg.sender and tx.origin to an unauthorized address + vm.startPrank(s_strangerAddr, s_strangerAddr); + + vm.expectRevert("Only callable by owner"); + s_sequencerUptimeFeed.transferL1Sender(newSender); + } } -contract BaseSequencerUptimeFeed_UpdateStatus is BaseSequencerUptimeFeedTest { - /// @notice it should revert if called by an unauthorized account - function test_RevertIfNotL2CrossDomainMessengerAddr() public { +contract BaseSequencerUptimeFeed_UpdateStatus is BaseSequencerUptimeFeed_Setup { + /// @notice Reverts if called by an unauthorized account + function test_updateStatus_RevertWhen_NotL2CrossDomainMessengerAddr() public { // Sets msg.sender and tx.origin to an unauthorized address vm.startPrank(s_strangerAddr, s_strangerAddr); @@ -88,8 +99,8 @@ contract BaseSequencerUptimeFeed_UpdateStatus is BaseSequencerUptimeFeedTest { s_sequencerUptimeFeedFailSenderCheck.updateStatus(true, uint64(1)); } - /// @notice it should update status when status has not changed and incoming timestamp is the same as latest - function test_UpdateStatusWhenNoChange() public { + /// @notice Updates status when status has not changed and incoming timestamp is the same as latest + function test_updateStatus_UpdateWhen_NoStatusChangeSameTimestamp() public { // Sets msg.sender and tx.origin to a valid address vm.startPrank(s_aliasedL1OwnerAddress, s_aliasedL1OwnerAddress); @@ -138,8 +149,8 @@ contract BaseSequencerUptimeFeed_UpdateStatus is BaseSequencerUptimeFeedTest { assertEq(updatedAtAfterUpdate, block.timestamp); } - /// @notice it should update status when status has changed and incoming timestamp is newer than the latest - function test_UpdateStatusWhenStatusChangeAndTimeChange() public { + /// @notice Updates status when status has changed and incoming timestamp is newer than the latest + function test_updateStatus_UpdateWhen_StatusChangeAndTimeChange() public { // Sets msg.sender and tx.origin to a valid address vm.startPrank(s_aliasedL1OwnerAddress, s_aliasedL1OwnerAddress); @@ -162,8 +173,8 @@ contract BaseSequencerUptimeFeed_UpdateStatus is BaseSequencerUptimeFeedTest { assertEq(s_sequencerUptimeFeed.latestTimestamp(), uint64(timestamp)); } - /// @notice it should update status when status has changed and incoming timestamp is the same as latest - function test_UpdateStatusWhenStatusChangeAndNoTimeChange() public { + /// @notice Updates status when status has changed and incoming timestamp is the same as latest + function test_updateStatus_UpdateWhen_StatusChangeAndNoTimeChange() public { // Sets msg.sender and tx.origin to a valid address vm.startPrank(s_aliasedL1OwnerAddress, s_aliasedL1OwnerAddress); @@ -187,8 +198,8 @@ contract BaseSequencerUptimeFeed_UpdateStatus is BaseSequencerUptimeFeedTest { assertEq(s_sequencerUptimeFeed.latestTimestamp(), uint64(timestamp)); } - /// @notice it should ignore out-of-order updates - function test_IgnoreOutOfOrderUpdates() public { + /// @notice Ignores out-of-order updates + function test_updateStatus_IgnoreOutOfOrderUpdates() public { // Sets msg.sender and tx.origin to a valid address vm.startPrank(s_aliasedL1OwnerAddress, s_aliasedL1OwnerAddress); @@ -208,7 +219,7 @@ contract BaseSequencerUptimeFeed_UpdateStatus is BaseSequencerUptimeFeedTest { vm.recordLogs(); - // Tries to transfer to the same L1 sender should not emit an updateRound event + // Tries to update with stale timestamp s_sequencerUptimeFeed.updateStatus(false, uint64(timestamp)); Vm.Log[] memory entries = vm.getRecordedLogs(); @@ -218,9 +229,9 @@ contract BaseSequencerUptimeFeed_UpdateStatus is BaseSequencerUptimeFeedTest { } } -contract BaseSequencerUptimeFeed_AggregatorV3Interface is BaseSequencerUptimeFeedTest { - /// @notice it should return valid answer from getRoundData and latestRoundData - function test_AggregatorV3Interface() public { +contract BaseSequencerUptimeFeed_AggregatorV3Interface is BaseSequencerUptimeFeed_Setup { + /// @notice Returns valid answer from getRoundData and latestRoundData + function test_AggregatorV3Interface_ReturnsValidData() public { // Sets msg.sender and tx.origin to a valid address vm.startPrank(s_aliasedL1OwnerAddress, s_aliasedL1OwnerAddress); @@ -271,8 +282,8 @@ contract BaseSequencerUptimeFeed_AggregatorV3Interface is BaseSequencerUptimeFee assertEq(answeredInRound2, answeredInRound); } - /// @notice it should revert from #getRoundData when round does not yet exist (future roundId) - function test_RevertGetRoundDataWhenRoundDoesNotExistYet() public { + /// @notice Reverts when getRoundData is called for a round that does not exist yet + function test_getRoundData_RevertWhen_RoundDoesNotExist() public { // Sets msg.sender and tx.origin to a valid address vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr); @@ -281,8 +292,8 @@ contract BaseSequencerUptimeFeed_AggregatorV3Interface is BaseSequencerUptimeFee s_sequencerUptimeFeed.getRoundData(2); } - /// @notice it should return the #getAnswer for the latest round - function test_GetValidAnswer() public { + /// @notice Returns the getAnswer for the latest round + function test_getAnswer_ReturnsValidAnswer() public { // Sets msg.sender and tx.origin to a valid address vm.startPrank(s_aliasedL1OwnerAddress, s_aliasedL1OwnerAddress); @@ -294,8 +305,8 @@ contract BaseSequencerUptimeFeed_AggregatorV3Interface is BaseSequencerUptimeFee assertEq(0, s_sequencerUptimeFeed.getAnswer(1)); } - /// @notice it should revert from #getAnswer when round does not yet exist (future roundId) - function test_RevertGetAnswerWhenRoundDoesNotExistYet() public { + /// @notice Reverts when getAnswer is called for a round that does not exist yet + function test_getAnswer_RevertWhen_RoundDoesNotExist() public { // Sets msg.sender and tx.origin to a valid address vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr); @@ -304,8 +315,8 @@ contract BaseSequencerUptimeFeed_AggregatorV3Interface is BaseSequencerUptimeFee s_sequencerUptimeFeed.getAnswer(2); } - /// @notice it should return the #getTimestamp for the latest round - function test_GetValidTimestamp() public { + /// @notice Returns the getTimestamp for the latest round + function test_getTimestamp_ReturnsValidTimestamp() public { // Sets msg.sender and tx.origin to a valid address vm.startPrank(s_aliasedL1OwnerAddress, s_aliasedL1OwnerAddress); @@ -317,8 +328,8 @@ contract BaseSequencerUptimeFeed_AggregatorV3Interface is BaseSequencerUptimeFee assertEq(startedAt, s_sequencerUptimeFeed.getTimestamp(1)); } - /// @notice it should revert from #getTimestamp when round does not yet exist (future roundId) - function test_RevertGetTimestampWhenRoundDoesNotExistYet() public { + /// @notice Reverts when getTimestamp is called for a round that does not exist yet + function test_getTimestamp_RevertWhen_RoundDoesNotExist() public { // Sets msg.sender and tx.origin to a valid address vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr); @@ -328,9 +339,9 @@ contract BaseSequencerUptimeFeed_AggregatorV3Interface is BaseSequencerUptimeFee } } -contract BaseSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions is BaseSequencerUptimeFeedTest { - /// @notice it should disallow reads on AggregatorV2V3Interface functions when consuming contract is not whitelisted - function test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() public { +contract BaseSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions is BaseSequencerUptimeFeed_Setup { + /// @notice Disallows reads on AggregatorV2V3Interface functions when consuming contract is not whitelisted + function test_ProtectReads_DisallowWhen_NotWhitelisted() public { // Deploys a FeedConsumer contract FeedConsumer feedConsumer = new FeedConsumer(address(s_sequencerUptimeFeed)); @@ -345,8 +356,8 @@ contract BaseSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions feedConsumer.latestRoundData(); } - /// @notice it should allow reads on AggregatorV2V3Interface functions when consuming contract is whitelisted - function test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() public { + /// @notice Allows reads on AggregatorV2V3Interface functions when consuming contract is whitelisted + function test_ProtectReads_AllowWhen_Whitelisted() public { // Deploys a FeedConsumer contract FeedConsumer feedConsumer = new FeedConsumer(address(s_sequencerUptimeFeed)); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseValidator.t.sol index f5a5508618e..4b0868c71b3 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseValidator.t.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {BaseValidator} from "../../../dev/base/BaseValidator.sol"; +import {BaseValidator} from "../../../base/BaseValidator.sol"; import {MockBaseValidator} from "../../mocks/MockBaseValidator.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; -contract BaseValidatorTest is L2EPTest { +contract BaseValidator_Setup is L2EPTest { address internal immutable L2_SEQ_STATUS_RECORDER_ADDRESS = makeAddr("L2_SEQ_STATUS_RECORDER_ADDRESS"); address internal immutable DUMMY_L1_XDOMAIN_MSNGR_ADDR = makeAddr("DUMMY_L1_XDOMAIN_MSNGR_ADDR"); address internal immutable DUMMY_L2_UPTIME_FEED_ADDR = makeAddr("DUMMY_L2_UPTIME_FEED_ADDR"); @@ -27,22 +27,23 @@ contract BaseValidatorTest is L2EPTest { } } -contract BaseValidator_Constructor is BaseValidatorTest { - /// @notice it correctly validates that the L1 bridge address is not zero - function test_ConstructingRevertedWithZeroL1BridgeAddress() public { +contract BaseValidator_Constructor is BaseValidator_Setup { + /// @notice Reverts when L1 bridge address is zero + function test_Constructor_RevertWhen_L1BridgeAddressIsZero() public { vm.expectRevert(BaseValidator.L1CrossDomainMessengerAddressZero.selector); new MockBaseValidator(address(0), DUMMY_L2_UPTIME_FEED_ADDR, INIT_GAS_LIMIT); } - /// @notice it correctly validates that the L2 Uptime feed address is not zero - function test_ConstructingRevertedWithZeroL2UpdateFeedAddress() public { + /// @notice Reverts when L2 Uptime feed address is zero + function test_Constructor_RevertWhen_L2UptimeFeedAddressIsZero() public { vm.expectRevert(BaseValidator.L2UptimeFeedAddrZero.selector); new MockBaseValidator(DUMMY_L1_XDOMAIN_MSNGR_ADDR, address(0), INIT_GAS_LIMIT); } } -contract BaseValidator_GetAndSetGasLimit is BaseValidatorTest { - function test_CorrectlyGetsGasLimit() public { +contract BaseValidator_GetAndSetGasLimit is BaseValidator_Setup { + /// @notice Verifies the correct retrieval and update of the gas limit + function test_GetAndSetGasLimit_CorrectlyHandlesGasLimit() public { assertEq(s_baseValidator.getGasLimit(), INIT_GAS_LIMIT); uint32 newGasLimit = INIT_GAS_LIMIT + 1; diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncSequencerUptimeFeed.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncSequencerUptimeFeed.t.sol index 9fd78d04642..8e9c387c875 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncSequencerUptimeFeed.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncSequencerUptimeFeed.t.sol @@ -3,37 +3,36 @@ pragma solidity ^0.8.24; import {AddressAliasHelper} from "../../../../vendor/arb-bridge-eth/v0.8.0-custom/contracts/libraries/AddressAliasHelper.sol"; import {ZKSyncSequencerUptimeFeed} from "../../../zksync/ZKSyncSequencerUptimeFeed.sol"; -import {BaseSequencerUptimeFeed} from "../../../shared/BaseSequencerUptimeFeed.sol"; -import {FeedConsumer} from "../../../../tests/FeedConsumer.sol"; +import {BaseSequencerUptimeFeed} from "../../../base/BaseSequencerUptimeFeed.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; -contract ZKSyncSequencerUptimeFeedTestWrapper is ZKSyncSequencerUptimeFeed { +contract ZKSyncSequencerUptimeFeed_TestWrapper is ZKSyncSequencerUptimeFeed { constructor(address l1SenderAddress, bool initialStatus) ZKSyncSequencerUptimeFeed(l1SenderAddress, initialStatus) {} - /// @notice it exposes the internal _validateSender function for testing + /// @notice Exposes the internal _validateSender function for testing function validateSenderTestWrapper(address l1Sender) external view { super._validateSender(l1Sender); } } -contract ZKSyncSequencerUptimeFeedTest is L2EPTest { +contract ZKSyncSequencerUptimeFeed_Setup is L2EPTest { /// Helper Variables address internal l1SenderAddress = address(5); address internal s_aliasedL1SenderAddress = AddressAliasHelper.applyL1ToL2Alias(l1SenderAddress); /// L2EP contracts - ZKSyncSequencerUptimeFeedTestWrapper internal s_zksyncSequencerUptimeFeed; + ZKSyncSequencerUptimeFeed_TestWrapper internal s_zksyncSequencerUptimeFeed; /// Setup function setUp() public { // Deploys contracts - s_zksyncSequencerUptimeFeed = new ZKSyncSequencerUptimeFeedTestWrapper(l1SenderAddress, false); + s_zksyncSequencerUptimeFeed = new ZKSyncSequencerUptimeFeed_TestWrapper(l1SenderAddress, false); } } -contract ZKSyncSequencerUptimeFeed_ValidateSender is ZKSyncSequencerUptimeFeedTest { - /// @notice it should revert if called by an unauthorized account - function test_RevertIfPassIsNotValid() public { +contract ZKSyncSequencerUptimeFeed_ValidateSender is ZKSyncSequencerUptimeFeed_Setup { + /// @notice Reverts when pass is not valid + function test_ValidateSender_RevertWhen_PassIsNotValid() public { // Sets msg.sender and tx.origin to an authorized address vm.startPrank(s_aliasedL1SenderAddress, s_aliasedL1SenderAddress); @@ -42,7 +41,8 @@ contract ZKSyncSequencerUptimeFeed_ValidateSender is ZKSyncSequencerUptimeFeedTe s_zksyncSequencerUptimeFeed.validateSenderTestWrapper(address(6)); } - function test_PassIfSenderIsValid() public { + /// @notice Passes when sender is valid + function test_ValidateSender_SuccessWhen_SenderIsValid() public { // Sets msg.sender and tx.origin to an authorized address vm.startPrank(s_aliasedL1SenderAddress, s_aliasedL1SenderAddress); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncValidator.t.sol index f3a0cf71da8..e36a2732c27 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncValidator.t.sol @@ -4,10 +4,10 @@ pragma solidity ^0.8.24; import {MockBridgehub} from "../../mocks/zksync/MockZKSyncL1Bridge.sol"; import {ISequencerUptimeFeed} from "../../../interfaces/ISequencerUptimeFeed.sol"; import {ZKSyncValidator} from "../../../zksync/ZKSyncValidator.sol"; -import {BaseValidator} from "../../../shared/BaseValidator.sol"; +import {BaseValidator} from "../../../base/BaseValidator.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; -contract ZKSyncValidatorTest is L2EPTest { +contract ZKSyncValidator_Setup is L2EPTest { address internal immutable L2_SEQ_STATUS_RECORDER_ADDRESS = makeAddr("L2_SEQ_STATUS_RECORDER_ADDRESS"); address internal immutable DUMMY_L1_XDOMAIN_MSNGR_ADDR = makeAddr("DUMMY_L1_XDOMAIN_MSNGR_ADDR"); address internal immutable DUMMY_L2_UPTIME_FEED_ADDR = makeAddr("DUMMY_L2_UPTIME_FEED_ADDR"); @@ -38,9 +38,9 @@ contract ZKSyncValidatorTest is L2EPTest { } } -contract ZKSyncValidator_Constructor is ZKSyncValidatorTest { - /// @notice it correctly validates that the chain id is valid - function test_ConstructingRevertedWithInvalidChainId() public { +contract ZKSyncValidator_Constructor is ZKSyncValidator_Setup { + /// @notice Reverts when chain ID is invalid + function test_Constructor_RevertWhen_ChainIdIsInvalid() public { vm.expectRevert(ZKSyncValidator.InvalidChainID.selector); new ZKSyncValidator( DUMMY_L1_XDOMAIN_MSNGR_ADDR, @@ -51,8 +51,8 @@ contract ZKSyncValidator_Constructor is ZKSyncValidatorTest { ); } - /// @notice it correctly validates that the L1 bridge address is not zero - function test_ConstructingRevertedWithZeroL1BridgeAddress() public { + /// @notice Reverts when L1 bridge address is zero + function test_Constructor_RevertWhen_L1BridgeAddressIsZero() public { vm.expectRevert(BaseValidator.L1CrossDomainMessengerAddressZero.selector); new ZKSyncValidator( address(0), @@ -63,8 +63,8 @@ contract ZKSyncValidator_Constructor is ZKSyncValidatorTest { ); } - /// @notice it correctly validates that the L2 Uptime feed address is not zero - function test_ConstructingRevertedWithZeroL2UpdateFeedAddress() public { + /// @notice Reverts when L2 update feed address is zero + function test_Constructor_RevertWhen_L2UpdateFeedAddressIsZero() public { vm.expectRevert(BaseValidator.L2UptimeFeedAddrZero.selector); new ZKSyncValidator( DUMMY_L1_XDOMAIN_MSNGR_ADDR, @@ -76,9 +76,9 @@ contract ZKSyncValidator_Constructor is ZKSyncValidatorTest { } } -contract ZKSyncValidator_GetSetL2GasPerPubdataByteLimit is ZKSyncValidatorTest { - /// @notice it correctly updates the gas limit per pubdata byte - function test_CorrectlyGetsAndUpdatesTheGasPerPubdataByteLimit() public { +contract ZKSyncValidator_GetSetL2GasPerPubdataByteLimit is ZKSyncValidator_Setup { + /// @notice Correctly gets and updates the gas per pubdata byte limit + function test_GetSetL2GasPerPubdataByteLimit_CorrectlyHandlesGasPerPubdataByteLimit() public { assertEq(s_zksyncValidator.getL2GasPerPubdataByteLimit(), INIT_GAS_PER_PUBDATA_BYTE_LIMIT); uint32 newGasPerPubDataByteLimit = 2000000; @@ -87,23 +87,23 @@ contract ZKSyncValidator_GetSetL2GasPerPubdataByteLimit is ZKSyncValidatorTest { } } -contract ZKSyncValidator_GetChainId is ZKSyncValidatorTest { - /// @notice it correctly gets the chain id - function test_CorrectlyGetsTheChainId() public view { +contract ZKSyncValidator_GetChainId is ZKSyncValidator_Setup { + /// @notice Correctly gets the chain ID + function test_GetChainId_CorrectlyGetsTheChainId() public view { assertEq(s_zksyncValidator.getChainId(), MAIN_NET_CHAIN_ID); } } -contract ZKSyncValidator_Validate is ZKSyncValidatorTest { - /// @notice it reverts if called by account with no access - function test_RevertsIfCalledByAnAccountWithNoAccess() public { +contract ZKSyncValidator_Validate is ZKSyncValidator_Setup { + /// @notice Reverts if called by an account with no access + function test_Validate_RevertWhen_CalledByAccountWithNoAccess() public { vm.startPrank(s_strangerAddr); vm.expectRevert("No access"); s_zksyncValidator.validate(0, 0, 1, 1); } - /// @notice it posts sequencer status when there is not status change - function test_PostSequencerStatusWhenThereIsNotStatusChange() public { + /// @notice Posts sequencer status when there is no status change + function test_Validate_PostSequencerStatus_NoStatusChange() public { // Gives access to the s_eoaValidator s_zksyncValidator.addAccess(s_eoaValidator); @@ -126,8 +126,8 @@ contract ZKSyncValidator_Validate is ZKSyncValidatorTest { s_zksyncValidator.validate(0, 0, 0, 0); } - /// @notice it post sequencer offline - function test_PostSequencerOffline() public { + /// @notice Posts sequencer offline status + function test_Validate_PostSequencerOffline() public { // Gives access to the s_eoaValidator s_zksyncValidator.addAccess(s_eoaValidator);