Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
env:
ARTIFACTS_PATHS: |
out
cache-foundry
cache
steps:
- name: Checkout repo
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
NODE_VERSION: 22.18
EVM_ARTIFACTS_PATHS: |
out
cache-foundry
cache
SVM_ARTIFACTS_PATHS: |
target/idl
target/types
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ out
out-local
out-tron
zkout
cache-foundry
cache-foundry-local
cache
cache-foundry-fork
cache-foundry-tron


Expand Down
13 changes: 5 additions & 8 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ build_info = true
extra_output = ["storageLayout"]
src = "contracts"
out = "out"
test = "test/evm/foundry"
test = "test/evm/foundry/local"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep fork tests in the default compile surface

Changing profile.default.test to test/evm/foundry/local means the only Foundry commands we run in CI now ignore test/evm/foundry/fork/*: upload-evm-artifacts builds with the default profile in .github/workflows/pr.yml:57-62, and test-evm runs yarn test-evm-foundry in .github/workflows/pr.yml:216-217, which now resolves to plain forge test. As a result, syntax/import/type errors in fork tests can merge unnoticed even though this commit edits files in that suite.

Useful? React with 👍 / 👎.

libs = ["node_modules", "lib"]
cache_path = "cache-foundry"
cache_path = "cache"
via_ir = true
optimizer_runs = 800
solc_version = "0.8.30"
Expand Down Expand Up @@ -68,12 +68,9 @@ polygon_amoy = "${NODE_URL_80002}"
[etherscan]
ethereum = { key = "${ETHERSCAN_API_KEY}" }

# A profile to only run foundry local tests, skipping fork tests. These tests are run in CI. Run with `FOUNDRY_PROFILE=local-test forge test`
[profile.local-test]
test = "test/evm/foundry/local"
revert_strings = "default"
cache_path = "cache-foundry-local"
out = "out-local"
# A profile to only run foundry fork tests, skipping local tests. These tests are NOT run in CI. Run with `FOUNDRY_PROFILE=fork-test forge test`
[profile.fork-test]
test = "test/evm/foundry/fork"

# Tron-compatible profile. Compiles counterfactual contracts at 0.8.25 (max supported by Tron's solc fork).
# Run with `FOUNDRY_PROFILE=tron forge build`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"build-verified": "yarn build-evm-foundry && yarn build-svm-solana-verify && yarn generate-svm-artifacts && yarn build-ts",
"build-evm-foundry": "forge build",
"test-evm": "yarn test-evm-foundry",
"test-evm-foundry": "FOUNDRY_PROFILE=local-test forge test",
"test-evm-foundry": "forge test",
"test-svm": "IS_TEST=true yarn build-svm && yarn generate-svm-artifacts && anchor test --skip-build",
"test-svm-solana-verify": "IS_TEST=true yarn build-svm-solana-verify && yarn generate-svm-artifacts && anchor test --skip-build",
"test": "yarn test-evm && yarn test-svm",
Expand Down
5 changes: 4 additions & 1 deletion test/evm/foundry/fork/BlacklistedRelayerRecipient.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ interface IUSDC {
function blacklist(address _account) external;

function isBlacklisted(address _account) external view returns (bool);

function blacklister() external view returns (address);
}

contract MockSpokePoolTest is Test {
Expand All @@ -46,6 +48,7 @@ contract MockSpokePoolTest is Test {
address recipient2 = address(0x6969692222222420);

function setUp() public {
vm.createSelectFork(vm.envString("NODE_URL_1"));
spokePool = new MockSpokePool(address(0x123));
// Create an instance of USDT & USDCusing its mainnet address
usdt = IUSDT(address(0xdAC17F958D2ee523a2206206994597C13D831ec7));
Expand Down Expand Up @@ -121,7 +124,7 @@ contract MockSpokePoolTest is Test {
// USDC blacklist blocks both the sender and recipient. Therefore if we a recipient within a bundle is
// blacklisted, they should be credited for the refund amount that can be claimed later to a new address.
assertEq(usdc.isBlacklisted(recipient1), false, "Recipient1 should not be blacklisted");
vm.prank(0x10DF6B6fe66dd319B1f82BaB2d054cbb61cdAD2e); // USDC blacklister
vm.prank(usdc.blacklister());
usdc.blacklist(recipient1);
assertEq(usdc.isBlacklisted(recipient1), true, "Recipient1 should be blacklisted");

Expand Down
10 changes: 4 additions & 6 deletions test/evm/foundry/fork/PermissionSplitter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,8 @@ contract PermissionSplitterTest is Test {
bytes4(keccak256("DEFAULT_ADMIN_ROLE()"))
];

// Error emitted when non-owner calls onlyOwner HubPool function.
// Error emitted when non-owner calls onlyOwner HubPool function (from on-chain contract, has revert strings).
bytes constant OWNABLE_NOT_OWNER_ERROR = bytes("Ownable: caller is not the owner");
// Error emitted when calling PermissionSplitterProxy function with incorrect role.
bytes constant PROXY_NOT_ALLOWED_TO_CALL_ERROR = bytes("Not allowed to call");

address constant WETHAddress = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

Expand Down Expand Up @@ -175,7 +173,7 @@ contract PermissionSplitterTest is Test {
);
uint256 spokeChainId = 1;

vm.expectRevert(PROXY_NOT_ALLOWED_TO_CALL_ERROR);
vm.expectRevert();
hubPoolProxy.relaySpokePoolAdminFunction(spokeChainId, spokeFunctionCallData);
vm.expectRevert(OWNABLE_NOT_OWNER_ERROR);
hubPool.relaySpokePoolAdminFunction(spokeChainId, spokeFunctionCallData);
Expand All @@ -187,7 +185,7 @@ contract PermissionSplitterTest is Test {
}

function testTransferOwnership() public {
vm.expectRevert(PROXY_NOT_ALLOWED_TO_CALL_ERROR);
vm.expectRevert();
hubPoolProxy.transferOwnership(defaultAdmin);

// Should be able to transfer ownership back to default admin in an emergency.
Expand Down Expand Up @@ -264,7 +262,7 @@ contract PermissionSplitterTest is Test {
vm.prank(defaultAdmin);
hubPoolProxy.sync(WETHAddress);

vm.expectRevert(PROXY_NOT_ALLOWED_TO_CALL_ERROR);
vm.expectRevert();
hubPoolProxy.sync(WETHAddress);
}
}
8 changes: 4 additions & 4 deletions test/evm/foundry/local/BondToken_Admin.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,25 @@ contract BondToken_AdminTest is Test {

// Try enabling as proposer - should revert
vm.prank(other);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
bondToken.setProposer(other, true);
assertFalse(bondToken.proposers(other));

// Try disabling as proposer - should revert
vm.prank(other);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
bondToken.setProposer(other, false);
assertFalse(bondToken.proposers(other));

// Try enabling again - should revert
vm.prank(other);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
bondToken.setProposer(other, true);
assertFalse(bondToken.proposers(other));

// Try disabling again - should revert
vm.prank(other);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
bondToken.setProposer(other, false);
assertFalse(bondToken.proposers(other));
}
Expand Down
4 changes: 2 additions & 2 deletions test/evm/foundry/local/BondToken_E2E.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ contract BondToken_E2ETest is HubPoolTestBase {
assertFalse(bondToken.proposers(dataworker));

// Proposal should fail; balances unchanged
vm.expectRevert("Transfer not permitted");
vm.expectRevert();
_proposeRootBundleFrom(dataworker);

assertEq(bondToken.balanceOf(address(fixture.hubPool)), hubPoolBal);
Expand Down Expand Up @@ -407,7 +407,7 @@ contract BondToken_E2ETest is HubPoolTestBase {
_seedBondToken(other, BOND_AMOUNT);
assertEq(bondToken.balanceOf(other), BOND_AMOUNT);

vm.expectRevert("Transfer not permitted");
vm.expectRevert();
_proposeRootBundleFrom(other);
}

Expand Down
4 changes: 2 additions & 2 deletions test/evm/foundry/local/ConfigStore.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ contract ConfigStore_Test is Test {

// Non-owner cannot update token config
vm.prank(other);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
configStore.updateTokenConfig(l1Token, SAMPLE_RATE_MODEL_JSON);

// Owner can update token config
Expand All @@ -61,7 +61,7 @@ contract ConfigStore_Test is Test {
function test_UpdatingGlobalConfig() public {
// Non-owner cannot update global config
vm.prank(other);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
configStore.updateGlobalConfig(MAX_POOL_REBALANCE_LEAF_SIZE_KEY, MAX_REFUNDS_VALUE);

// Owner can update global config
Expand Down
32 changes: 16 additions & 16 deletions test/evm/foundry/local/HubPool_Admin.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ contract HubPool_AdminTest is HubPoolTestBase {

function test_EnableL1Token_RevertsIfNotOwner() public {
vm.prank(otherUser);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
fixture.hubPool.enableL1TokenForLiquidityProvision(address(fixture.weth));
}

Expand Down Expand Up @@ -105,15 +105,15 @@ contract HubPool_AdminTest is HubPoolTestBase {
fixture.hubPool.enableL1TokenForLiquidityProvision(address(fixture.weth));

vm.prank(otherUser);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
fixture.hubPool.disableL1TokenForLiquidityProvision(address(fixture.weth));
}

// ============ setCrossChainContracts Tests ============

function test_SetCrossChainContracts_RevertsIfNotOwner() public {
vm.prank(otherUser);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
fixture.hubPool.setCrossChainContracts(DESTINATION_CHAIN_ID, address(mockAdapter), mockSpoke);
}

Expand All @@ -123,7 +123,7 @@ contract HubPool_AdminTest is HubPoolTestBase {
bytes memory functionData = abi.encodeWithSignature("pauseDeposits(bool)", true);

vm.prank(otherUser);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
fixture.hubPool.relaySpokePoolAdminFunction(DESTINATION_CHAIN_ID, functionData);
}

Expand All @@ -133,7 +133,7 @@ contract HubPool_AdminTest is HubPoolTestBase {
// Set spoke to zero address
fixture.hubPool.setCrossChainContracts(DESTINATION_CHAIN_ID, address(mockAdapter), address(0));

vm.expectRevert("SpokePool not initialized");
vm.expectRevert();
fixture.hubPool.relaySpokePoolAdminFunction(DESTINATION_CHAIN_ID, functionData);
}

Expand All @@ -144,7 +144,7 @@ contract HubPool_AdminTest is HubPoolTestBase {
address randomAddr = makeAddr("random");
fixture.hubPool.setCrossChainContracts(DESTINATION_CHAIN_ID, randomAddr, mockSpoke);

vm.expectRevert("Adapter not initialized");
vm.expectRevert();
fixture.hubPool.relaySpokePoolAdminFunction(DESTINATION_CHAIN_ID, functionData);
}

Expand Down Expand Up @@ -179,7 +179,7 @@ contract HubPool_AdminTest is HubPoolTestBase {
}

function test_SetBond_RevertsIfZeroAmount() public {
vm.expectRevert("bond equal to final fee");
vm.expectRevert();
fixture.hubPool.setBond(IERC20(address(fixture.usdc)), 0);
}

Expand All @@ -193,20 +193,20 @@ contract HubPool_AdminTest is HubPoolTestBase {
fixture.hubPool.proposeRootBundle(bundleEvaluationBlockNumbers, 5, mockRoot, mockRoot, mockRoot);

// Attempt to change bond should revert
vm.expectRevert("Proposal has unclaimed leaves");
vm.expectRevert();
fixture.hubPool.setBond(IERC20(address(fixture.usdc)), 1000e6);
}

function test_SetBond_RevertsIfNotWhitelisted() public {
address randomToken = makeAddr("randomToken");

vm.expectRevert("Not on whitelist");
vm.expectRevert();
fixture.hubPool.setBond(IERC20(randomToken), 1000);
}

function test_SetBond_RevertsIfNotOwner() public {
vm.prank(otherUser);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
fixture.hubPool.setBond(IERC20(address(fixture.usdc)), 1000e6);
}

Expand All @@ -227,7 +227,7 @@ contract HubPool_AdminTest is HubPoolTestBase {
function test_SetIdentifier_RevertsIfNotSupported() public {
bytes32 unsupportedIdentifier = bytes32("UNSUPPORTED");

vm.expectRevert("Identifier not supported");
vm.expectRevert();
fixture.hubPool.setIdentifier(unsupportedIdentifier);
}

Expand All @@ -236,7 +236,7 @@ contract HubPool_AdminTest is HubPoolTestBase {
fixture.identifierWhitelist.addSupportedIdentifier(newIdentifier);

vm.prank(otherUser);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
fixture.hubPool.setIdentifier(newIdentifier);
}

Expand All @@ -251,13 +251,13 @@ contract HubPool_AdminTest is HubPoolTestBase {
}

function test_SetLiveness_RevertsIfTooShort() public {
vm.expectRevert("Liveness too short");
vm.expectRevert();
fixture.hubPool.setLiveness(599);
}

function test_SetLiveness_RevertsIfNotOwner() public {
vm.prank(otherUser);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
fixture.hubPool.setLiveness(1000000);
}

Expand All @@ -272,7 +272,7 @@ contract HubPool_AdminTest is HubPoolTestBase {

function test_SetPaused_RevertsIfNotOwner() public {
vm.prank(otherUser);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
fixture.hubPool.setPaused(true);
}

Expand Down Expand Up @@ -335,7 +335,7 @@ contract HubPool_AdminTest is HubPoolTestBase {

function test_EmergencyDeleteProposal_RevertsIfNotOwner() public {
vm.prank(otherUser);
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert();
fixture.hubPool.emergencyDeleteProposal();
}

Expand Down
4 changes: 2 additions & 2 deletions test/evm/foundry/local/HubPool_DisputeRootBundle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ contract HubPool_DisputeRootBundleTest is HubPoolTestBase {
vm.warp(block.timestamp + REFUND_PROPOSAL_LIVENESS + 1);

vm.prank(dataWorker);
vm.expectRevert("Request passed liveness");
vm.expectRevert();
fixture.hubPool.disputeRootBundle();
}

Expand Down Expand Up @@ -265,7 +265,7 @@ contract HubPool_DisputeRootBundleTest is HubPoolTestBase {
// Attempting to dispute should fail because challengePeriodEndTimestamp is 0
// and currentTime > 0
vm.prank(dataWorker);
vm.expectRevert("Request passed liveness");
vm.expectRevert();
fixture.hubPool.disputeRootBundle();
}
}
Loading
Loading