Skip to content

Commit

Permalink
Improve ChainIdManager test by removing second chainID (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
josojo authored Nov 22, 2023
1 parent 752cc61 commit d9e3182
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion test/ChainIdManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ contract ChainIdManagerTest is Test {
);
}

function testCheckGasBurn() public {
function testCheckGasBurn() view public {

Check warning on line 78 in test/ChainIdManager.t.sol

View workflow job for this annotation

GitHub Actions / Code linting (16.x, ubuntu-latest)

Visibility modifier must be first in list of modifiers
uint256 initialGasLeft = gasleft();
chainIdManager.burnGas();
uint256 finalGasLeft = gasleft();
Expand Down
19 changes: 9 additions & 10 deletions test/ForkingManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ contract ForkingManagerTest is Test {
address public zkevmImplementation;
address public forkonomicTokenImplementation;
address public globalExitRootImplementation;
address public chainIdManager;
address public chainIdManagerAddress;
bytes32 internal constant _IMPLEMENTATION_SLOT =
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

Expand All @@ -43,7 +43,6 @@ contract ForkingManagerTest is Test {
);
uint64 public forkID = 3;
uint64 public newForkID = 4;
uint64 public chainID = 4;
uint32 public networkID = 10;
uint64 public pendingStateTimeout = 123;
uint64 public trustedAggregatorTimeout = 124235;
Expand All @@ -59,8 +58,8 @@ contract ForkingManagerTest is Test {
bytes32[32] public depositTree;
address public admin = address(0xad);
uint64 public initialChainId = 1;
uint64 public firstChainId = 1;
uint64 public secondChainId = 2;
uint64 public firstChainId = initialChainId+1;
uint64 public secondChainId = initialChainId+2;

// Setup new implementations for the fork
address public newBridgeImplementation = address(new ForkableBridge());
Expand Down Expand Up @@ -131,8 +130,8 @@ contract ForkingManagerTest is Test {
)
)
);

chainIdManager = address(new ChainIdManager(initialChainId));
ChainIdManager chainIdManager= new ChainIdManager(initialChainId);
chainIdManagerAddress = address(chainIdManager);
globalExitRoot.initialize(
address(forkmanager),
address(0x0),
Expand Down Expand Up @@ -160,7 +159,7 @@ contract ForkingManagerTest is Test {
pendingStateTimeout: pendingStateTimeout,
trustedAggregator: trustedAggregator,
trustedAggregatorTimeout: trustedAggregatorTimeout,
chainID: chainID,
chainID: chainIdManager.getNextUsableChainId(),
forkID: forkID
});
zkevm.initialize(
Expand All @@ -183,7 +182,7 @@ contract ForkingManagerTest is Test {
address(0x0),
address(globalExitRoot),
arbitrationFee,
chainIdManager
chainIdManagerAddress
);
forkonomicToken.initialize(
address(forkmanager),
Expand Down Expand Up @@ -389,11 +388,11 @@ contract ForkingManagerTest is Test {
}
{
assertEq(
chainIdManager,
chainIdManagerAddress,
ForkingManager(childForkmanager1).chainIdManager()
);
assertEq(
chainIdManager,
chainIdManagerAddress,
ForkingManager(childForkmanager2).chainIdManager()
);
}
Expand Down

0 comments on commit d9e3182

Please sign in to comment.