Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/L1/rollup/L1MessageQueueV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ contract L1MessageQueueV2 is OwnableUpgradeable, IL1MessageQueueV2 {
uint256 private constant INTRINSIC_GAS_TX = 21000;

/// @notice The appropriate intrinsic gas for each byte.
uint256 private constant APPROPRIATE_INTRINSIC_GAS_PER_BYTE = 16;
// @dev This accounts for both intrinsic gas and EIP-7623 floor gas.
uint256 private constant APPROPRIATE_INTRINSIC_GAS_PER_BYTE = 40;

uint256 private constant PRECISION = 1e18;

Expand Down
6 changes: 3 additions & 3 deletions src/test/L1MessageQueueV2.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ contract L1MessageQueueV2Test is ScrollTestBase {
}

function testCalculateIntrinsicGasFee(bytes calldata data) external {
assertEq(queueV2.calculateIntrinsicGasFee(data), 21000 + data.length * 16);
assertEq(queueV2.calculateIntrinsicGasFee(data), 21000 + data.length * 40);
}

function testAppendCrossDomainMessage(
uint256 gasLimit,
bytes memory data,
uint256 timestamp
) external {
gasLimit = bound(gasLimit, 21000 + data.length * 16, 10000000);
gasLimit = bound(gasLimit, 21000 + data.length * 40, 10000000);
timestamp = bound(timestamp, 1, 2**31 - 1);

// should revert, when non-messenger call
Expand Down Expand Up @@ -197,7 +197,7 @@ contract L1MessageQueueV2Test is ScrollTestBase {
bytes memory data,
uint256 timestamp
) external {
gasLimit = bound(gasLimit, 21000 + data.length * 16, 10000000);
gasLimit = bound(gasLimit, 21000 + data.length * 40, 10000000);
timestamp = bound(timestamp, 1, 2**31 - 1);

// should revert, when non-gateway call
Expand Down
8 changes: 4 additions & 4 deletions src/test/L1ScrollMessengerTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,13 @@ contract L1ScrollMessengerTest is L1GatewayTestBase {
// 32B value
// 32B nonce
// message byte array (32B offset + 32B length + bytes (padding to multiple of 32))
// So the intrinsic gas must be greater than 21000 + 16 * 228 = 24648
uint256 _fee = messageQueueV2.estimateL2BaseFee() * 24648;
l1Messenger.sendMessage{value: _fee + value}(address(0), value, hex"0011220033", 24648);
// So the intrinsic gas must be greater than 21000 + 40 * 228 = 30120
uint256 _fee = messageQueueV2.estimateL2BaseFee() * 30120;
l1Messenger.sendMessage{value: _fee + value}(address(0), value, hex"0011220033", 30120);

// insufficient intrinsic gas
hevm.expectRevert(L1MessageQueueV2.ErrorGasLimitBelowIntrinsicGas.selector);
l1Messenger.sendMessage{value: _fee + value}(address(0), 1, hex"0011220033", 24647);
l1Messenger.sendMessage{value: _fee + value}(address(0), 1, hex"0011220033", 30119);

// gas limit exceeds the max value
uint256 gasLimit = 100000000;
Expand Down
Loading