Skip to content

Commit

Permalink
adds requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-de-leon-cll committed Jan 10, 2024
1 parent 513bc56 commit c07a2c6
Show file tree
Hide file tree
Showing 20 changed files with 474 additions and 758 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/solidity-foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
product: [vrf, automation, llo-feeds, functions, shared]
product: [vrf, automation, llo-feeds, l2ep, functions, shared]
needs: [changes]
name: Foundry Tests ${{ matrix.product }}
# See https://github.com/foundry-rs/foundry/issues/3827
Expand Down
2 changes: 1 addition & 1 deletion contracts/GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ALL_FOUNDRY_PRODUCTS contains a list of all products that have a foundry
# profile defined and use the Foundry snapshots.
ALL_FOUNDRY_PRODUCTS = llo-feeds functions shared
ALL_FOUNDRY_PRODUCTS = l2ep llo-feeds functions shared

# To make a snapshot for a specific product, either set the `FOUNDRY_PROFILE` env var
# or call the target with `FOUNDRY_PROFILE=product`
Expand Down
146 changes: 146 additions & 0 deletions contracts/gas-snapshots/l2ep.gas-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
ArbitrumCrossDomainForwarderAcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37303)
ArbitrumCrossDomainForwarderAcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 12963)
ArbitrumCrossDomainForwarderConstructor:test_InitialState() (gas: 18431)
ArbitrumCrossDomainForwarderForward:test_Forward() (gas: 47610)
ArbitrumCrossDomainForwarderForward:test_ForwardRevert() (gas: 22157)
ArbitrumCrossDomainForwarderForward:test_NotCallableByUnknownAddress() (gas: 16048)
ArbitrumCrossDomainForwarderTransferL1Ownership:test_CallableByL1Owner() (gas: 41402)
ArbitrumCrossDomainForwarderTransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19309)
ArbitrumCrossDomainForwarderTransferL1Ownership:test_NotCallableByL2Owner() (gas: 18311)
ArbitrumCrossDomainForwarderTransferL1Ownership:test_NotCallableByNonOwners() (gas: 13200)
ArbitrumCrossDomainGovernorAcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 37303)
ArbitrumCrossDomainGovernorAcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 12963)
ArbitrumCrossDomainGovernorConstructor:test_InitialState() (gas: 18454)
ArbitrumCrossDomainGovernorForward:test_CallableByL2Owner() (gas: 49723)
ArbitrumCrossDomainGovernorForward:test_Forward() (gas: 47661)
ArbitrumCrossDomainGovernorForward:test_ForwardRevert() (gas: 24324)
ArbitrumCrossDomainGovernorForward:test_NotCallableByUnknownAddress() (gas: 18247)
ArbitrumCrossDomainGovernorForwardDelegate:test_BubbleUpRevert() (gas: 19386)
ArbitrumCrossDomainGovernorForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 60623)
ArbitrumCrossDomainGovernorForwardDelegate:test_CallableByL2Owner() (gas: 62729)
ArbitrumCrossDomainGovernorForwardDelegate:test_NotCallableByUnknownAddress() (gas: 18237)
ArbitrumCrossDomainGovernorForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 64116)
ArbitrumCrossDomainGovernorTransferL1Ownership:test_CallableByL1Owner() (gas: 41402)
ArbitrumCrossDomainGovernorTransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 19309)
ArbitrumCrossDomainGovernorTransferL1Ownership:test_NotCallableByL2Owner() (gas: 18311)
ArbitrumCrossDomainGovernorTransferL1Ownership:test_NotCallableByNonOwners() (gas: 13200)
ArbitrumSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForGetAnswer() (gas: 92098)
ArbitrumSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForGetRoundData() (gas: 92653)
ArbitrumSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForGetTimestamp() (gas: 92019)
ArbitrumSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForLatestAnswer() (gas: 89793)
ArbitrumSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForLatestRound() (gas: 89685)
ArbitrumSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForLatestRoundData() (gas: 90226)
ArbitrumSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForLatestTimestamp() (gas: 89670)
ArbitrumSequencerUptimeFeedAggregatorV3Interface:test_AggregatorV3Interface() (gas: 98825)
ArbitrumSequencerUptimeFeedAggregatorV3Interface:test_Return0WhenRoundDoesNotExistYet() (gas: 18309)
ArbitrumSequencerUptimeFeedConstants:test_InitialState() (gas: 5684)
ArbitrumSequencerUptimeFeedGasCosts:test_GasCosts() (gas: 97438)
ArbitrumSequencerUptimeFeedProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 602705)
ArbitrumSequencerUptimeFeedProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 573793)
ArbitrumSequencerUptimeFeedUpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 98952)
ArbitrumSequencerUptimeFeedUpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 15776)
ArbitrumSequencerUptimeFeedUpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 113233)
ArbitrumSequencerUptimeFeedUpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 113293)
ArbitrumValidatorValidate:test_PostSequencerOffline() (gas: 69068)
OptimismCrossDomainForwarderAcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 46891)
OptimismCrossDomainForwarderAcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22152)
OptimismCrossDomainForwarderConstructor:test_InitialState() (gas: 18266)
OptimismCrossDomainForwarderForward:test_Forward() (gas: 58028)
OptimismCrossDomainForwarderForward:test_ForwardRevert() (gas: 32549)
OptimismCrossDomainForwarderForward:test_NotCallableByUnknownAddress() (gas: 13859)
OptimismCrossDomainForwarderTransferL1Ownership:test_CallableByL1Owner() (gas: 48886)
OptimismCrossDomainForwarderTransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28767)
OptimismCrossDomainForwarderTransferL1Ownership:test_NotCallableByL2Owner() (gas: 16134)
OptimismCrossDomainForwarderTransferL1Ownership:test_NotCallableByNonOwners() (gas: 11011)
OptimismCrossDomainGovernorAcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 46891)
OptimismCrossDomainGovernorAcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22152)
OptimismCrossDomainGovernorConstructor:test_InitialState() (gas: 18289)
OptimismCrossDomainGovernorForward:test_CallableByL2Owner() (gas: 47557)
OptimismCrossDomainGovernorForward:test_Forward() (gas: 58087)
OptimismCrossDomainGovernorForward:test_ForwardRevert() (gas: 32633)
OptimismCrossDomainGovernorForward:test_NotCallableByUnknownAddress() (gas: 16061)
OptimismCrossDomainGovernorForwardDelegate:test_BubbleUpRevert() (gas: 29181)
OptimismCrossDomainGovernorForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 72698)
OptimismCrossDomainGovernorForwardDelegate:test_CallableByL2Owner() (gas: 72688)
OptimismCrossDomainGovernorForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16051)
OptimismCrossDomainGovernorForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 75911)
OptimismCrossDomainGovernorTransferL1Ownership:test_CallableByL1Owner() (gas: 48886)
OptimismCrossDomainGovernorTransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28767)
OptimismCrossDomainGovernorTransferL1Ownership:test_NotCallableByL2Owner() (gas: 16134)
OptimismCrossDomainGovernorTransferL1Ownership:test_NotCallableByNonOwners() (gas: 11011)
OptimismSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForGetAnswer() (gas: 59075)
OptimismSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForGetRoundData() (gas: 59615)
OptimismSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForGetTimestamp() (gas: 58930)
OptimismSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForLatestAnswer() (gas: 56867)
OptimismSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForLatestRound() (gas: 56753)
OptimismSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForLatestRoundData() (gas: 57289)
OptimismSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForLatestTimestamp() (gas: 56720)
OptimismSequencerUptimeFeedAggregatorV3Interface:test_AggregatorV3Interface() (gas: 65617)
OptimismSequencerUptimeFeedAggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 18039)
OptimismSequencerUptimeFeedAggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 18257)
OptimismSequencerUptimeFeedAggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17963)
OptimismSequencerUptimeFeedConstructor:test_InitialState() (gas: 21066)
OptimismSequencerUptimeFeedGasCosts:test_GasCosts() (gas: 67140)
OptimismSequencerUptimeFeedProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 597634)
OptimismSequencerUptimeFeedProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 573798)
OptimismSequencerUptimeFeedUpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 66508)
OptimismSequencerUptimeFeedUpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13560)
OptimismSequencerUptimeFeedUpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddrAndNotL1SenderAddr() (gas: 23967)
OptimismSequencerUptimeFeedUpdateStatus:test_UpdateStatusWhenNoChange() (gas: 73999)
OptimismSequencerUptimeFeedUpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 96119)
OptimismSequencerUptimeFeedUpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 96179)
OptimismValidatorSetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 15503)
OptimismValidatorValidate:test_PostSequencerOffline() (gas: 74813)
OptimismValidatorValidate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 74869)
OptimismValidatorValidate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15563)
ScrollCrossDomainForwarderAcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 46980)
ScrollCrossDomainForwarderAcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22204)
ScrollCrossDomainForwarderConstructor:test_InitialState() (gas: 17930)
ScrollCrossDomainForwarderForward:test_Forward() (gas: 58095)
ScrollCrossDomainForwarderForward:test_ForwardRevert() (gas: 32613)
ScrollCrossDomainForwarderForward:test_NotCallableByUnknownAddress() (gas: 13859)
ScrollCrossDomainForwarderTransferL1Ownership:test_CallableByL1Owner() (gas: 48952)
ScrollCrossDomainForwarderTransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28833)
ScrollCrossDomainForwarderTransferL1Ownership:test_NotCallableByL2Owner() (gas: 16134)
ScrollCrossDomainForwarderTransferL1Ownership:test_NotCallableByNonOwners() (gas: 11011)
ScrollCrossDomainGovernorAcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 46980)
ScrollCrossDomainGovernorAcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22204)
ScrollCrossDomainGovernorConstructor:test_InitialState() (gas: 17953)
ScrollCrossDomainGovernorForward:test_CallableByL2Owner() (gas: 47552)
ScrollCrossDomainGovernorForward:test_Forward() (gas: 58149)
ScrollCrossDomainGovernorForward:test_ForwardRevert() (gas: 32688)
ScrollCrossDomainGovernorForward:test_NotCallableByUnknownAddress() (gas: 16058)
ScrollCrossDomainGovernorForwardDelegate:test_BubbleUpRevert() (gas: 29242)
ScrollCrossDomainGovernorForwardDelegate:test_CallableByCrossDomainMessengerAddressOrL1Owner() (gas: 72750)
ScrollCrossDomainGovernorForwardDelegate:test_CallableByL2Owner() (gas: 72740)
ScrollCrossDomainGovernorForwardDelegate:test_NotCallableByUnknownAddress() (gas: 16048)
ScrollCrossDomainGovernorForwardDelegate:test_RevertsBatchWhenOneCallFails() (gas: 75964)
ScrollCrossDomainGovernorTransferL1Ownership:test_CallableByL1Owner() (gas: 48952)
ScrollCrossDomainGovernorTransferL1Ownership:test_CallableByL1OwnerOrZeroAddress() (gas: 28833)
ScrollCrossDomainGovernorTransferL1Ownership:test_NotCallableByL2Owner() (gas: 16134)
ScrollCrossDomainGovernorTransferL1Ownership:test_NotCallableByNonOwners() (gas: 11011)
ScrollSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForGetAnswer() (gas: 57230)
ScrollSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForGetRoundData() (gas: 57760)
ScrollSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForGetTimestamp() (gas: 57085)
ScrollSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForLatestAnswer() (gas: 54868)
ScrollSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForLatestRound() (gas: 54748)
ScrollSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForLatestRoundData() (gas: 55453)
ScrollSequencerUptimeFeedAggregatorInterfaceGasCosts:test_GasUsageForLatestTimestamp() (gas: 54738)
ScrollSequencerUptimeFeedAggregatorV3Interface:test_AggregatorV3Interface() (gas: 63903)
ScrollSequencerUptimeFeedAggregatorV3Interface:test_RevertGetAnswerWhenRoundDoesNotExistYet() (gas: 18035)
ScrollSequencerUptimeFeedAggregatorV3Interface:test_RevertGetRoundDataWhenRoundDoesNotExistYet() (gas: 18253)
ScrollSequencerUptimeFeedAggregatorV3Interface:test_RevertGetTimestampWhenRoundDoesNotExistYet() (gas: 17959)
ScrollSequencerUptimeFeedConstructor:test_InitialState() (gas: 21073)
ScrollSequencerUptimeFeedGasCosts:test_GasCosts() (gas: 64831)
ScrollSequencerUptimeFeedProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceAllowReadsIfConsumingContractIsWhitelisted() (gas: 597485)
ScrollSequencerUptimeFeedProtectReadsOnAggregatorV2V3InterfaceFunctions:test_AggregatorV2V3InterfaceDisallowReadsIfConsumingContractIsNotWhitelisted() (gas: 573798)
ScrollSequencerUptimeFeedUpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 64393)
ScrollSequencerUptimeFeedUpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 13560)
ScrollSequencerUptimeFeedUpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddrAndNotL1SenderAddr() (gas: 23967)
ScrollSequencerUptimeFeedUpdateStatus:test_UpdateStatusWhenNoChange() (gas: 71582)
ScrollSequencerUptimeFeedUpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 91982)
ScrollSequencerUptimeFeedUpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 92042)
ScrollValidatorSetGasLimit:test_CorrectlyUpdatesTheGasLimit() (gas: 15503)
ScrollValidatorValidate:test_PostSequencerOffline() (gas: 75094)
ScrollValidatorValidate:test_PostSequencerStatusWhenThereIsNotStatusChange() (gas: 75156)
ScrollValidatorValidate:test_RevertsIfCalledByAnAccountWithNoAccess() (gas: 15563)
16 changes: 15 additions & 1 deletion contracts/src/v0.8/l2ep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ To run a specific L2EP test, you can use a variation of the following command:
FOUNDRY_PROFILE=l2ep forge test -vvv --match-path ./src/v0.8/l2ep/test/v1_0_0/scroll/ScrollSequencerUptimeFeed.t.sol
```

Or alternatively:

```sh
FOUNDRY_PROFILE=l2ep forge test -vvv --match-contract ScrollSequencerUptimeFeed
```

If yu prefer, you can also export `FOUNDRY_PROFILE` so that it doesn't need
to be provided before every command:

```sh
export FOUNDRY_PROFILE=l2ep
forge test -vvv
```

A full list of flags for `forge test` can be found [here](https://book.getfoundry.sh/reference/forge/forge-test).

#### Coverage
Expand All @@ -119,5 +133,5 @@ v1 contracts are, being evaluated then temporarily change the L2EP profile in
`./foundry.toml`.

```sh
forge coverage --ir-minimum
forge coverage
```
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ contract MockOVMCrossDomainMessenger is iOVM_CrossDomainMessenger {
s_mockMessageSender = sender;
}

/********************
* Public Functions *
********************/

/**
* Sends a cross domain message to the target messenger.
* @param _target Target contract address.
Expand All @@ -32,4 +28,6 @@ contract MockOVMCrossDomainMessenger is iOVM_CrossDomainMessenger {
function sendMessage(address _target, bytes calldata _message, uint32) external override {
Address.functionCall(_target, _message, "sendMessage reverted");
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ contract MockScrollCrossDomainMessenger is IScrollMessenger {
s_mockMessageSender = sender;
}

/// *****************************
/// * Public Mutating Functions *
/// *****************************

/// @notice Send cross chain message from L1 to L2 or L2 to L1.
/// @param _target The address of account who receive the message.
/// @param _message The content of the message.
Expand Down
14 changes: 0 additions & 14 deletions contracts/src/v0.8/l2ep/test/v1_0_0/Example.t.sol

This file was deleted.

9 changes: 6 additions & 3 deletions contracts/src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
pragma solidity 0.8.19;

import {MultiSend} from "../../../../v0.8/vendor/MultiSend.sol";
import {Greeter} from "../../../../v0.8/tests/Greeter.sol";
import {MultiSend} from "../../../vendor/MultiSend.sol";
import {Greeter} from "../../../tests/Greeter.sol";
import {Test} from "forge-std/Test.sol";

contract L2EPTest is Test {
/// Helper variable(s)
address internal s_strangerAddr = vm.addr(0x1);

/// @param expectedGasUsage - the expected gas usage
/// @param startGasUsage - the gas usage before the code of interest is run
/// @param finalGasUsage - the gas usage after the code of interest is run
Expand Down
Loading

0 comments on commit c07a2c6

Please sign in to comment.