Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/control.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:

jobs:
control:
if: false # temporarily disable control building
Comment thread
yrong marked this conversation as resolved.
runs-on: snowbridge-runner
env:
CARGO_INCREMENTAL: 0
Expand Down
59 changes: 24 additions & 35 deletions contracts/integration/ForkUpgrade202509.t.sol
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.34;

import {Vm} from "forge-std/Vm.sol";
import {Test} from "forge-std/Test.sol";
import {stdJson} from "forge-std/StdJson.sol";
import {console} from "forge-std/console.sol";
import {UD60x18, ud60x18, unwrap} from "prb/math/src/UD60x18.sol";

import {IUpgradable} from "../../src/interfaces/IUpgradable.sol";
import {IGatewayV1} from "../../src/v1/IGateway.sol";
import {Verification} from "../../src/Verification.sol";
import {Gateway} from "../../src/Gateway.sol";
import {Gateway202509} from "../../src/upgrade/Gateway202509.sol";
import {AgentExecutor} from "../../src/AgentExecutor.sol";
import {UD60x18, unwrap} from "prb/math/src/UD60x18.sol";
import {WETH9} from "canonical-weth/WETH9.sol";

import {IUpgradable} from "../src/interfaces/IUpgradable.sol";
import {IGatewayV1} from "../src/v1/IGateway.sol";
import {Verification} from "../src/Verification.sol";
import {Gateway} from "../src/Gateway.sol";
import {Gateway202509} from "../src/upgrade/Gateway202509.sol";
import {AgentExecutor} from "../src/AgentExecutor.sol";
import {
UpgradeParams,
SetOperatingModeParams,
OperatingMode,
RegisterForeignTokenParams
} from "../../src/v1/Types.sol";
import {
ChannelID,
ParaID,
OperatingMode,
InboundMessage,
Command,
TokenInfo,
MintForeignTokenParams
} from "../../src/v1/Types.sol";
import {MultiAddress, multiAddressFromBytes32} from "../../src/v1/MultiAddress.sol";
} from "../src/v1/Types.sol";
Comment on lines 14 to +21

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can simplify to:

import {                                                                                                                                                                 
      UpgradeParams, SetOperatingModeParams, OperatingMode,
      RegisterForeignTokenParams, ChannelID, ParaID,                                                                                                                       
      InboundMessage, Command, TokenInfo, MintForeignTokenParams                                                                                                           
  } from "../src/v1/Types.sol";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

import {MultiAddress, multiAddressFromBytes32} from "../src/v1/MultiAddress.sol";
import {ForkTestFixtures, SubmitMessageFixture} from "../test/utils/ForkTestFixtures.sol";
import {WETH9} from "canonical-weth/WETH9.sol";

contract ForkUpgradeTest is Test {
address private constant GATEWAY_PROXY = 0x27ca963C279c93801941e1eB8799c23f407d68e7;
Expand All @@ -52,16 +42,15 @@ contract ForkUpgradeTest is Test {
0x4e241583d94b5d48a27a22064cd49b2ed6f5231d2d950e432f9b7c2e0ade52b2;
address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
WETH9 public weth = WETH9(payable(WETH));
string internal constant FORK_RPC_URL =
"https://virtual.mainnet.eu.rpc.tenderly.co/61589e0a-d204-449b-b095-64366ea949cb";

event Transfer(address indexed from, address indexed to, uint256 value);

function setUp() public {}

function setUp23432697() public {
vm.createSelectFork(
"https://virtual.mainnet.eu.rpc.tenderly.co/dc7e68d7-5fac-4a88-a797-01ed4155f437",
23_432_697
);
vm.createSelectFork(FORK_RPC_URL, 23_432_697);

(UD60x18 exchangeRate, uint128 deliveryCost) =
IGatewayV1(GATEWAY_PROXY).pricingParameters();
Expand Down Expand Up @@ -183,16 +172,14 @@ contract ForkUpgradeTest is Test {
vm.expectEmit(true, false, false, false);
emit IGatewayV1.OutboundMessageAccepted(paraID.into(), 1, bytes32("0x"), hex"");
hoax(user, amount + fee);
IGatewayV1(address(GATEWAY_PROXY))
.sendToken{value: amount + fee}(address(0), paraID, recipientAddress32, 1, amount);
IGatewayV1(address(GATEWAY_PROXY)).sendToken{value: amount + fee}(
address(0), paraID, recipientAddress32, 1, amount
);
assertEq(user.balance, 0);
}

function setUp23526799() public {
vm.createSelectFork(
"https://virtual.mainnet.eu.rpc.tenderly.co/1d4ab8c5-01fe-45a7-8583-8b4925e5a435",
23_526_799
);
vm.createSelectFork(FORK_RPC_URL, 23_526_799);

// Mock call to Verification.verifyCommitment to bypass BEEFY verification.
// Note that after the gateway is upgraded, the gateway will be linked to a new Verification
Expand Down Expand Up @@ -311,8 +298,9 @@ contract ForkUpgradeTest is Test {
bytes32(0x65b3c8970f6316e368291bddf21059f298f18ad356faafed0ac19244f15dc67f),
hex""
);
IGatewayV1(address(GATEWAY_PROXY))
.sendToken{value: fee}(DOT, paraID, recipientAddress32, 1, amount);
IGatewayV1(address(GATEWAY_PROXY)).sendToken{value: fee}(
DOT, paraID, recipientAddress32, 1, amount
);
}

// Send WETH can work with the upgraded Gateway
Expand All @@ -337,7 +325,8 @@ contract ForkUpgradeTest is Test {
emit IGatewayV1.TokenSent(WETH, user, paraID, recipientAddress32, amount);
vm.expectEmit(true, false, false, false);
emit IGatewayV1.OutboundMessageAccepted(paraID.into(), 1, bytes32("0x"), hex"");
IGatewayV1(address(GATEWAY_PROXY))
.sendToken{value: fee}(WETH, paraID, recipientAddress32, 1, amount);
IGatewayV1(address(GATEWAY_PROXY)).sendToken{value: fee}(
WETH, paraID, recipientAddress32, 1, amount
);
}
}
Loading
Loading