Commit e9a95376 authored by Mark Tyneway's avatar Mark Tyneway

CrossDomainMessenger: ensure the base gas is always large enough

parent ee5c0ed1
...@@ -22,6 +22,22 @@ contract CrossDomainMessenger_BaseGas_Test is Messenger_Initializer { ...@@ -22,6 +22,22 @@ contract CrossDomainMessenger_BaseGas_Test is Messenger_Initializer {
function testFuzz_baseGas_succeeds(uint32 _minGasLimit) external view { function testFuzz_baseGas_succeeds(uint32 _minGasLimit) external view {
L1Messenger.baseGas(hex"ff", _minGasLimit); L1Messenger.baseGas(hex"ff", _minGasLimit);
} }
/**
* @notice The baseGas function should always return a value greater than
* or equal to the minimum gas limit value on the OptimismPortal.
* This guarantees that the messengers will always pass sufficient
* gas to the OptimismPortal.
*/
function testFuzz_baseGas_portalMinGasLimit_succeeds(
bytes memory _data,
uint32 _minGasLimit
) external {
vm.assume(_data.length <= type(uint64).max);
uint64 baseGas = L1Messenger.baseGas(_data, _minGasLimit);
uint64 minGasLimit = op.minimumGasLimit(uint64(_data.length));
assertTrue(baseGas >= minGasLimit);
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment