From e841c8a6860748888b0fb80169b609be948fc210 Mon Sep 17 00:00:00 2001 From: Chris De Leon Date: Wed, 7 Feb 2024 13:31:39 -0800 Subject: [PATCH] resolving small nits --- contracts/gas-snapshots/l2ep.gas-snapshot | 2 +- .../src/v0.8/l2ep/dev/GasLimitValidator.sol | 6 +++--- .../l2ep/dev/arbitrum/ArbitrumValidator.sol | 20 +++++++++---------- .../v1_0_0/arbitrum/ArbitrumValidator.t.sol | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/contracts/gas-snapshots/l2ep.gas-snapshot b/contracts/gas-snapshots/l2ep.gas-snapshot index 15089a92079..fe3e22882cd 100644 --- a/contracts/gas-snapshots/l2ep.gas-snapshot +++ b/contracts/gas-snapshots/l2ep.gas-snapshot @@ -41,7 +41,7 @@ ArbitrumSequencerUptimeFeed_UpdateStatus:test_IgnoreOutOfOrderUpdates() (gas: 98 ArbitrumSequencerUptimeFeed_UpdateStatus:test_RevertIfNotL2CrossDomainMessengerAddr() (gas: 15234) ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndNoTimeChange() (gas: 113208) ArbitrumSequencerUptimeFeed_UpdateStatus:test_UpdateStatusWhenStatusChangeAndTimeChange() (gas: 113268) -ArbitrumValidator_Validate:test_PostSequencerOffline() (gas: 69035) +ArbitrumValidator_Validate:test_PostSequencerOffline() (gas: 69058) OptimismCrossDomainForwarder_AcceptL1Ownership:test_CallableByPendingL1Owner() (gas: 46884) OptimismCrossDomainForwarder_AcceptL1Ownership:test_NotCallableByNonPendingOwners() (gas: 22152) OptimismCrossDomainForwarder_Constructor:test_InitialState() (gas: 18258) diff --git a/contracts/src/v0.8/l2ep/dev/GasLimitValidator.sol b/contracts/src/v0.8/l2ep/dev/GasLimitValidator.sol index d07df4a7654..b8bd40854da 100644 --- a/contracts/src/v0.8/l2ep/dev/GasLimitValidator.sol +++ b/contracts/src/v0.8/l2ep/dev/GasLimitValidator.sol @@ -6,12 +6,12 @@ import {Validator} from "./Validator.sol"; abstract contract GasLimitValidator is Validator { uint32 internal s_gasLimit; - /// @notice emitted when gas cost to spend on L2 is updated + /// @notice emitted when gas limit on L2 is updated /// @param gasLimit updated gas cost event GasLimitUpdated(uint32 gasLimit); /// @param l1CrossDomainMessengerAddress address the L1CrossDomainMessenger contract address - /// @param l2UptimeFeedAddr the address of the ScrollSequencerUptimeFeed contract address + /// @param l2UptimeFeedAddr the address of the UptimeFeed contract address /// @param gasLimit the gasLimit to use for sending a message from L1 to L2 constructor( address l1CrossDomainMessengerAddress, @@ -21,7 +21,7 @@ abstract contract GasLimitValidator is Validator { s_gasLimit = gasLimit; } - /// @notice sets the new gas cost to spend when sending cross chain message + /// @notice sets the new gas limit when sending cross chain message /// @param gasLimit the updated gas cost function setGasLimit(uint32 gasLimit) external onlyOwner { s_gasLimit = gasLimit; diff --git a/contracts/src/v0.8/l2ep/dev/arbitrum/ArbitrumValidator.sol b/contracts/src/v0.8/l2ep/dev/arbitrum/ArbitrumValidator.sol index ec47db6ae82..2d531e1df5e 100644 --- a/contracts/src/v0.8/l2ep/dev/arbitrum/ArbitrumValidator.sol +++ b/contracts/src/v0.8/l2ep/dev/arbitrum/ArbitrumValidator.sol @@ -35,10 +35,10 @@ contract ArbitrumValidator is Validator { /// Config for L1 -> L2 Arbitrum retryable ticket message struct GasConfig { - uint256 maxGas; // uint256 gasPriceBid; // uint256 baseFee; // Will use block.baseFee if set to 0 - address gasPriceL1FeedAddr; // + address gasPriceL1FeedAddr; // ─╮ + uint96 maxGas; // ──────────────╯ } /// Helper Variable(s) @@ -77,7 +77,7 @@ contract ArbitrumValidator is Validator { address l1CrossDomainMessengerAddress, address l2UptimeFeedAddr, address configACAddr, - uint256 maxGas, + uint96 maxGas, uint256 gasPriceBid, uint256 baseFee, address gasPriceL1FeedAddr, @@ -145,11 +145,11 @@ contract ArbitrumValidator is Validator { id = IArbitrumDelayedInbox(L1_CROSS_DOMAIN_MESSENGER_ADDRESS).createRetryableTicketNoRefundAliasRewrite{ value: l1PaymentValue }( - ARBSYS_ADDR, /// target - amount, /// L2 call value (requested) + ARBSYS_ADDR, // target + amount, // L2 call value (requested) maxSubmissionCost, - refundAddr, /// excessFeeRefundAddress - refundAddr, /// callValueRefundAddress + refundAddr, // excessFeeRefundAddress + refundAddr, // callValueRefundAddress maxGas, gasPriceBid, message @@ -175,7 +175,7 @@ contract ArbitrumValidator is Validator { /// @param gasPriceBid maximum L2 gas price to pay /// @param gasPriceL1FeedAddr address of the L1 gas price feed (used to approximate Arbitrum retryable ticket submission cost) function setGasConfig( - uint256 maxGas, + uint96 maxGas, uint256 gasPriceBid, uint256 baseFee, address gasPriceL1FeedAddr @@ -249,14 +249,14 @@ contract ArbitrumValidator is Validator { } /// @notice internal method that stores the gas configuration - function _setGasConfig(uint256 maxGas, uint256 gasPriceBid, uint256 baseFee, address gasPriceL1FeedAddr) internal { + function _setGasConfig(uint96 maxGas, uint256 gasPriceBid, uint256 baseFee, address gasPriceL1FeedAddr) internal { // solhint-disable-next-line custom-errors require(maxGas > 0, "Max gas is zero"); // solhint-disable-next-line custom-errors require(gasPriceBid > 0, "Gas price bid is zero"); // solhint-disable-next-line custom-errors require(gasPriceL1FeedAddr != address(0), "Gas price Aggregator is zero address"); - s_gasConfig = GasConfig(maxGas, gasPriceBid, baseFee, gasPriceL1FeedAddr); + s_gasConfig = GasConfig(gasPriceBid, baseFee, gasPriceL1FeedAddr, maxGas); emit GasConfigSet(maxGas, gasPriceBid, gasPriceL1FeedAddr); } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol index 504635540ce..23434177a50 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol @@ -15,7 +15,7 @@ contract ArbitrumValidatorTest is L2EPTest { address internal constant L2_SEQ_STATUS_RECORDER_ADDRESS = 0x491B1dDA0A8fa069bbC1125133A975BF4e85a91b; uint256 internal constant GAS_PRICE_BID = 1000000; uint256 internal constant BASE_FEE = 14000000000; - uint256 internal constant MAX_GAS = 1000000; + uint96 internal constant MAX_GAS = 1000000; /// L2EP contracts AccessControllerInterface internal s_accessController;