Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SC-105] Rewrite tests & remove 'aave-helpers' dependency #2

Merged
merged 41 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d4d32ac
forge install: xchain-helpers
barrutko Aug 25, 2023
4682b17
feat: add xchain helpers
barrutko Aug 25, 2023
1ccb02b
feat: shave PayloadWithEmit
barrutko Aug 25, 2023
dec52d3
feat: start working on optimism test
barrutko Aug 25, 2023
2899d41
feat: add more setup
barrutko Aug 28, 2023
cf58968
feat: add IExecutor interface
barrutko Aug 28, 2023
2e2e0f0
feat: work on test
barrutko Aug 28, 2023
1dbee8e
forge install: spark-spells
barrutko Aug 28, 2023
abcd544
feat: use spark-spells instead of aave-helpers
barrutko Aug 28, 2023
f712c4c
refactor: cleanup optimism test
barrutko Aug 28, 2023
f8abef1
feat: add arbitrum test
barrutko Aug 28, 2023
b512e9e
chore: remove old tests
barrutko Aug 28, 2023
66cb8ec
chore: remove aave-helpers
barrutko Aug 28, 2023
2fa4271
chore: minor aesthetics refactoring
barrutko Aug 28, 2023
74b9f94
chore: fix name 1/2
barrutko Aug 28, 2023
cddffb8
chore: fix name 2/2
barrutko Aug 28, 2023
4b326b0
chore: remove spark-spells dependency
barrutko Aug 28, 2023
c75dac6
feat: simplify dealing with gas
barrutko Aug 28, 2023
83baee0
chore: remove redundant stuff from foundry.toml
barrutko Sep 4, 2023
266d9bd
chore: update dependencies
barrutko Sep 4, 2023
d1de24d
chore: update dependencies
barrutko Sep 4, 2023
e740393
refactor: remove code duplication
barrutko Sep 4, 2023
68fb8d2
refactor: add further refactorings
barrutko Sep 4, 2023
b3b43a7
feat: extract bridge executor args
barrutko Sep 4, 2023
2305f37
feat: add fuzzing
barrutko Sep 4, 2023
4678629
chore: remove comment
barrutko Sep 5, 2023
6255449
test: add some more tests
barrutko Sep 5, 2023
af88905
test: add more tests
barrutko Sep 5, 2023
35d9088
fix: give more gas
barrutko Sep 5, 2023
75daa60
test: add more tests
barrutko Sep 5, 2023
943c80a
chore: remove redundant line
barrutko Sep 5, 2023
265a103
refactor: update test naming
barrutko Sep 8, 2023
c8f7d0e
fix: fix typo
barrutko Sep 8, 2023
1d04aa8
chore: update dependencies
barrutko Sep 18, 2023
dc9155f
fix: apply minor fixes
barrutko Sep 20, 2023
f06fccb
fix: change new guardian address
barrutko Sep 20, 2023
0c2b0a8
refactor: replace assume with bound
barrutko Sep 20, 2023
5c1f895
fix: move new guardian to payload constructor
barrutko Sep 20, 2023
d939970
refactor: move mock payload params to constructor
barrutko Sep 20, 2023
914aa58
fix: fix the alignment
barrutko Sep 21, 2023
86d79ae
fix: fix typos
barrutko Sep 25, 2023
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
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/aave-helpers"]
path = lib/aave-helpers
url = https://github.com/marsfoundation/aave-helpers
[submodule "lib/xchain-helpers"]
path = lib/xchain-helpers
url = https://github.com/marsfoundation/xchain-helpers
7 changes: 0 additions & 7 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,3 @@
src = "src"
out = "out"
libs = ["lib"]
remappings = [
'aave-helpers/=lib/aave-helpers/src/',
'solidity-utils/=lib/aave-helpers/lib/solidity-utils/src/',
'aave-address-book/=lib/aave-helpers/lib/aave-address-book/src'
]

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
1 change: 0 additions & 1 deletion lib/aave-helpers
Submodule aave-helpers deleted from 1f8582
1 change: 1 addition & 0 deletions lib/xchain-helpers
Submodule xchain-helpers added at 2ecc32
152 changes: 0 additions & 152 deletions test/ArbitrumCrossChainForwarderTest.t.sol

This file was deleted.

57 changes: 57 additions & 0 deletions test/ArbitrumCrosschainTest.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import 'forge-std/Test.sol';

import { Domain, ArbitrumDomain } from 'xchain-helpers/ArbitrumDomain.sol';

import { ArbitrumBridgeExecutor } from '../src/executors/ArbitrumBridgeExecutor.sol';
import { CrosschainForwarderArbitrum } from '../src/forwarders/CrosschainForwarderArbitrum.sol';

import { CrosschainTestBase } from './CrosschainTestBase.sol';

contract ArbitrumCrosschainTest is CrosschainTestBase {

function setUp() public {
hostDomain = new Domain(getChain('mainnet'));
bridgedDomain = new ArbitrumDomain(getChain('arbitrum_one'), hostDomain);

bridgedDomain.selectFork();
bridgeExecutor = address(new ArbitrumBridgeExecutor(
defaultL2BridgeExecutorArgs.ethereumGovernanceExecutor,
defaultL2BridgeExecutorArgs.delay,
defaultL2BridgeExecutorArgs.gracePeriod,
defaultL2BridgeExecutorArgs.minimumDelay,
defaultL2BridgeExecutorArgs.maximumDelay,
defaultL2BridgeExecutorArgs.guardian
));

hostDomain.selectFork();
forwarder = address(new CrosschainForwarderArbitrum(bridgeExecutor));
vm.deal(
L1_EXECUTOR,
0.01 ether
);
}

function testFuzz_arbitrumGasCalculations(uint256 payloadDataLength) public {
payloadDataLength = bound(
payloadDataLength,
256,
1024
);

hostDomain.selectFork();

vm.deal(L1_EXECUTOR, 0);
assertEq(L1_EXECUTOR.balance, 0);
(bool hasEnoughGasBefore, uint256 requiredGas) = CrosschainForwarderArbitrum(forwarder)
.hasSufficientGasForExecution(L1_EXECUTOR, payloadDataLength);
assertEq(hasEnoughGasBefore, false);

vm.deal(L1_EXECUTOR, requiredGas);
(bool hasEnoughGasAfter, ) = CrosschainForwarderArbitrum(forwarder)
.hasSufficientGasForExecution(L1_EXECUTOR, payloadDataLength);
assertEq(hasEnoughGasAfter, true);
}
}
Loading