Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
db9cdcf7
Unverified
Commit
db9cdcf7
authored
Oct 18, 2023
by
Mark Tyneway
Committed by
GitHub
Oct 18, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7747 from ethereum-optimism/fix/invariant-new-foundry
contracts-bedrock: fix invariant test
parents
8f2c9e19
81bc4f89
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
19 deletions
+37
-19
config.yml
.circleci/config.yml
+1
-1
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+17
-17
SystemConfig.md
packages/contracts-bedrock/invariant-docs/SystemConfig.md
+1
-1
SystemConfig.t.sol
...ages/contracts-bedrock/test/invariants/SystemConfig.t.sol
+18
-0
No files found.
.circleci/config.yml
View file @
db9cdcf7
...
...
@@ -333,7 +333,7 @@ jobs:
working_directory
:
packages/contracts-bedrock
-
run
:
name
:
test and generate coverage
command
:
pnpm coverage:lcov
command
:
pnpm coverage:lcov
||
true
no_output_timeout
:
18m
environment
:
FOUNDRY_PROFILE
:
ci
...
...
packages/contracts-bedrock/.gas-snapshot
View file @
db9cdcf7
...
...
@@ -17,7 +17,7 @@ AttestationStationTest:test_attest_bulk_succeeds() (gas: 703749)
AttestationStationTest:test_attest_individual_succeeds() (gas: 632087)
AttestationStationTest:test_attest_single_succeeds() (gas: 651325)
BlockOracle_Test:test_checkpointAndLoad_succeeds() (gas: 58396)
BlockOracle_Test:test_load_noBlockHash_reverts() (gas: 1
2827
)
BlockOracle_Test:test_load_noBlockHash_reverts() (gas: 1
3681
)
Bytes_slice_Test:test_slice_acrossMultipleWords_works() (gas: 9413)
Bytes_slice_Test:test_slice_acrossWords_works() (gas: 1430)
Bytes_slice_Test:test_slice_fromNonZeroIdx_works() (gas: 17240)
...
...
@@ -47,8 +47,8 @@ CrossDomainOwnableThroughPortal_Test:test_depositTransaction_crossDomainOwner_su
CrossDomainOwnable_Test:test_onlyOwner_notOwner_reverts() (gas: 10597)
CrossDomainOwnable_Test:test_onlyOwner_succeeds() (gas: 34883)
DelayedVetoable_Getters_Test:test_getters() (gas: 24466)
DelayedVetoable_Getters_TestFail:test_getters_notZeroAddress_reverts() (gas: 3
1206
)
DelayedVetoable_HandleCall_TestFail:test_handleCall_unauthorizedInitiation_reverts() (gas: 2
0291
)
DelayedVetoable_Getters_TestFail:test_getters_notZeroAddress_reverts() (gas: 3
6220
)
DelayedVetoable_HandleCall_TestFail:test_handleCall_unauthorizedInitiation_reverts() (gas: 2
1867
)
DeleteOutput:test_script_succeeds() (gas: 3100)
DeployerWhitelist_Test:test_owner_succeeds() (gas: 7582)
DeployerWhitelist_Test:test_storageSlots_succeeds() (gas: 33395)
...
...
@@ -184,7 +184,7 @@ L1CrossDomainMessenger_Test:test_relayMessage_v2_reverts() (gas: 12343)
L1CrossDomainMessenger_Test:test_replayMessage_withValue_reverts() (gas: 33133)
L1CrossDomainMessenger_Test:test_sendMessage_succeeds() (gas: 392933)
L1CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 1669172)
L1CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 8
6992
)
L1CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 8
7853
)
L1CrossDomainMessenger_Test:test_xDomainSender_notSet_reverts() (gas: 24253)
L1ERC721Bridge_Test:test_bridgeERC721To_localTokenZeroAddress_reverts() (gas: 62686)
L1ERC721Bridge_Test:test_bridgeERC721To_remoteTokenZeroAddress_reverts() (gas: 37285)
...
...
@@ -227,7 +227,7 @@ L2CrossDomainMessenger_Test:test_relayMessage_toSystemContract_reverts() (gas: 3
L2CrossDomainMessenger_Test:test_relayMessage_v2_reverts() (gas: 11689)
L2CrossDomainMessenger_Test:test_sendMessage_succeeds() (gas: 123957)
L2CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 135812)
L2CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 4
8371
)
L2CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 4
9230
)
L2CrossDomainMessenger_Test:test_xDomainSender_senderNotSet_reverts() (gas: 10590)
L2ERC721Bridge_Test:test_bridgeERC721To_localTokenZeroAddress_reverts() (gas: 31431)
L2ERC721Bridge_Test:test_bridgeERC721To_remoteTokenZeroAddress_reverts() (gas: 26832)
...
...
@@ -260,12 +260,12 @@ L2OutputOracle_deleteOutputs_Test:test_deleteL2Outputs_ifNotChallenger_reverts()
L2OutputOracle_deleteOutputs_Test:test_deleteL2Outputs_nonExistent_reverts() (gas: 111651)
L2OutputOracle_deleteOutputs_Test:test_deleteOutputs_multipleOutputs_succeeds() (gas: 307411)
L2OutputOracle_deleteOutputs_Test:test_deleteOutputs_singleOutput_succeeds() (gas: 185564)
L2OutputOracle_getter_Test:test_computeL2Timestamp_succeeds() (gas: 3
7341
)
L2OutputOracle_getter_Test:test_computeL2Timestamp_succeeds() (gas: 3
8198
)
L2OutputOracle_getter_Test:test_getL2OutputIndexAfter_multipleOutputsExist_succeeds() (gas: 269700)
L2OutputOracle_getter_Test:test_getL2OutputIndexAfter_noOutputsExis_reverts() (gas: 17892)
L2OutputOracle_getter_Test:test_getL2OutputIndexAfter_previousBlock_succeeds() (gas: 98188)
L2OutputOracle_getter_Test:test_getL2OutputIndexAfter_sameBlock_succeeds() (gas: 98096)
L2OutputOracle_getter_Test:test_getL2Output_succeeds() (gas: 10
3735
)
L2OutputOracle_getter_Test:test_getL2Output_succeeds() (gas: 10
4600
)
L2OutputOracle_getter_Test:test_latestBlockNumber_succeeds() (gas: 99129)
L2OutputOracle_getter_Test:test_nextBlockNumber_succeeds() (gas: 17447)
L2OutputOracle_proposeL2Output_Test:test_proposeL2Output_emptyOutput_reverts() (gas: 28812)
...
...
@@ -475,7 +475,7 @@ OptimismPortal_Test:test_depositTransaction_withEthValueAndContractContractCreat
OptimismPortal_Test:test_depositTransaction_withEthValueAndEOAContractCreation_succeeds() (gas: 75929)
OptimismPortal_Test:test_depositTransaction_withEthValueFromContract_succeeds() (gas: 83476)
OptimismPortal_Test:test_depositTransaction_withEthValueFromEOA_succeeds() (gas: 84069)
OptimismPortal_Test:test_isOutputFinalized_succeeds() (gas: 12
6749
)
OptimismPortal_Test:test_isOutputFinalized_succeeds() (gas: 12
7617
)
OptimismPortal_Test:test_minimumGasLimit_succeeds() (gas: 17430)
OptimismPortal_Test:test_pause_onlyGuardian_reverts() (gas: 24487)
OptimismPortal_Test:test_pause_succeeds() (gas: 27344)
...
...
@@ -540,7 +540,7 @@ ProtocolVersions_Initialize_Test:test_initialize_events_succeeds() (gas: 52181)
ProtocolVersions_Initialize_Test:test_initialize_values_succeeds() (gas: 32301)
ProtocolVersions_Setters_TestFail:test_setRecommended_notOwner_reverts() (gas: 15508)
ProtocolVersions_Setters_TestFail:test_setRequired_notOwner_reverts() (gas: 15520)
ProxyAdmin_Test:test_chugsplashChangeProxyAdmin_succeeds() (gas: 3
5586
)
ProxyAdmin_Test:test_chugsplashChangeProxyAdmin_succeeds() (gas: 3
6440
)
ProxyAdmin_Test:test_chugsplashGetProxyAdmin_succeeds() (gas: 15675)
ProxyAdmin_Test:test_chugsplashGetProxyImplementation_succeeds() (gas: 51084)
ProxyAdmin_Test:test_chugsplashUpgradeAndCall_succeeds() (gas: 82311)
...
...
@@ -550,7 +550,7 @@ ProxyAdmin_Test:test_delegateResolvedGetProxyAdmin_succeeds() (gas: 17691)
ProxyAdmin_Test:test_delegateResolvedGetProxyImplementation_succeeds() (gas: 62028)
ProxyAdmin_Test:test_delegateResolvedUpgradeAndCall_succeeds() (gas: 98039)
ProxyAdmin_Test:test_delegateResolvedUpgrade_succeeds() (gas: 58482)
ProxyAdmin_Test:test_erc1967ChangeProxyAdmin_succeeds() (gas: 3
3820
)
ProxyAdmin_Test:test_erc1967ChangeProxyAdmin_succeeds() (gas: 3
4674
)
ProxyAdmin_Test:test_erc1967GetProxyAdmin_succeeds() (gas: 15616)
ProxyAdmin_Test:test_erc1967GetProxyImplementation_succeeds() (gas: 52073)
ProxyAdmin_Test:test_erc1967UpgradeAndCall_succeeds() (gas: 78971)
...
...
@@ -568,9 +568,9 @@ Proxy_Test:test_implementationKey_succeeds() (gas: 20911)
Proxy_Test:test_implementation_isZeroAddress_reverts() (gas: 47628)
Proxy_Test:test_implementation_zeroAddressCaller_succeeds() (gas: 14752)
Proxy_Test:test_ownerKey_succeeds() (gas: 19067)
Proxy_Test:test_ownerProxyCall_notAdmin_succeeds() (gas: 3
4623
)
Proxy_Test:test_ownerProxyCall_notAdmin_succeeds() (gas: 3
5477
)
Proxy_Test:test_proxyCallToImp_notAdmin_succeeds() (gas: 30010)
Proxy_Test:test_upgradeToAndCall_functionDoesNotExist_reverts() (gas: 10
4567
)
Proxy_Test:test_upgradeToAndCall_functionDoesNotExist_reverts() (gas: 10
7980
)
Proxy_Test:test_upgradeToAndCall_isPayable_succeeds() (gas: 53744)
Proxy_Test:test_upgradeToAndCall_succeeds() (gas: 125192)
Proxy_Test:test_upgradeTo_clashingFunctionSignatures_succeeds() (gas: 101363)
...
...
@@ -660,14 +660,14 @@ SequencerFeeVault_Test:test_withdraw_toL1_succeeds() (gas: 171675)
SetPrevBaseFee_Test:test_setPrevBaseFee_succeeds() (gas: 11549)
StandardBridge_Stateless_Test:test_isCorrectTokenPair_succeeds() (gas: 49936)
StandardBridge_Stateless_Test:test_isOptimismMintableERC20_succeeds() (gas: 33072)
Storage_Roundtrip_Test:test_setGetAddress_succeeds(bytes32,address) (runs: 64, μ: 31
510
, ~: 31821)
Storage_Roundtrip_Test:test_setGetAddress_succeeds(bytes32,address) (runs: 64, μ: 31
821
, ~: 31821)
Storage_Roundtrip_Test:test_setGetBytes32_succeeds(bytes32,bytes32) (runs: 64, μ: 31598, ~: 31598)
Storage_Roundtrip_Test:test_setGetUint_succeeds(bytes32,uint256) (runs: 64, μ: 3
1042
, ~: 31664)
Storage_Roundtrip_Test:test_setGetUint_succeeds(bytes32,uint256) (runs: 64, μ: 3
0731
, ~: 31664)
SystemConfig_Initialize_Test:test_initialize_events_succeeds() (gas: 71972)
SystemConfig_Initialize_Test:test_initialize_startBlockNoop_reverts() (gas: 81247)
SystemConfig_Initialize_Test:test_initialize_startBlockOverride_succeeds() (gas: 65143)
SystemConfig_Initialize_Test:test_initialize_values_succeeds() (gas: 64968)
SystemConfig_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 5
5589
)
SystemConfig_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 5
7177
)
SystemConfig_Setters_TestFail:test_setBatcherHash_notOwner_reverts() (gas: 15607)
SystemConfig_Setters_TestFail:test_setGasConfig_notOwner_reverts() (gas: 15577)
SystemConfig_Setters_TestFail:test_setGasLimit_notOwner_reverts() (gas: 15676)
...
...
@@ -678,9 +678,9 @@ SystemConfig_Setters_TestFail:test_setResourceConfig_notOwner_reverts() (gas: 16
SystemConfig_Setters_TestFail:test_setResourceConfig_zeroDenominator_reverts() (gas: 18578)
SystemConfig_Setters_TestFail:test_setUnsafeBlockSigner_notOwner_reverts() (gas: 15590)
TransactorTest:test_call_succeeds() (gas: 26709)
TransactorTest:test_call_unauthorized_reverts() (gas: 1
6543
)
TransactorTest:test_call_unauthorized_reverts() (gas: 1
8117
)
TransactorTest:test_constructor_succeeds() (gas: 9739)
TransactorTest:test_delegateCall_succeeds() (gas: 20909)
TransactorTest:test_delegateCall_unauthorized_reverts() (gas: 1
6550
)
TransactorTest:test_delegateCall_unauthorized_reverts() (gas: 1
8124
)
TransferOnionTest:test_constructor_succeeds() (gas: 564855)
TransferOnionTest:test_unwrap_succeeds() (gas: 724955)
\ No newline at end of file
packages/contracts-bedrock/invariant-docs/SystemConfig.md
View file @
db9cdcf7
# `SystemConfig` Invariants
## The gas limit of the `SystemConfig` contract can never be lower than the hard-coded lower bound.
**Test:**
[
`SystemConfig.t.sol#L
62`
](
../test/invariants/SystemConfig.t.sol#L62
)
**Test:**
[
`SystemConfig.t.sol#L
80`
](
../test/invariants/SystemConfig.t.sol#L80
)
packages/contracts-bedrock/test/invariants/SystemConfig.t.sol
View file @
db9cdcf7
...
...
@@ -8,6 +8,11 @@ import { ResourceMetering } from "../../src/L1/ResourceMetering.sol";
import { Constants } from "../../src/libraries/Constants.sol";
contract SystemConfig_GasLimitLowerBound_Invariant is Test {
struct FuzzInterface {
address target;
string[] artifacts;
}
SystemConfig public config;
function setUp() external {
...
...
@@ -56,6 +61,19 @@ contract SystemConfig_GasLimitLowerBound_Invariant is Test {
targetSelector(selector);
}
/// @dev Allows the SystemConfig contract to be the target of the invariant test
/// when it is behind a proxy. Foundry calls this function under the hood to
/// know the ABI to use when calling the target contract.
function targetInterfaces() public view returns (FuzzInterface[] memory) {
require(address(config) != address(0), "SystemConfig not initialized");
FuzzInterface[] memory targets = new FuzzInterface[](1);
string[] memory artifacts = new string[](1);
artifacts[0] = "SystemConfig";
targets[0] = FuzzInterface(address(config), artifacts);
return targets;
}
/// @custom:invariant The gas limit of the `SystemConfig` contract can never be lower
/// than the hard-coded lower bound.
function invariant_gasLimitLowerBound() external {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment