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

[env] dev to use anvil instead of geth for evm chains #1544

Merged
merged 26 commits into from
Feb 14, 2025
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
40 changes: 20 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion analog-gmp/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ solc = '0.8.28'
# - https://ethereumclassic.org/knowledge/history
evm_version = 'shanghai'
optimizer = true
optimizer_runs = 200000
optimizer_runs = 500000

###############
# EVM options #
Expand Down
8 changes: 0 additions & 8 deletions analog-gmp/remappings.txt

This file was deleted.

2 changes: 1 addition & 1 deletion analog-gmp/src/GatewayProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pragma solidity >=0.8.0;

import {ERC1967} from "./utils/ERC1967.sol";
import {Context, CreateKind, IUniversalFactory} from "@universal-factory/IUniversalFactory.sol";
import {Context, CreateKind, IUniversalFactory} from "../lib/universal-factory/src/IUniversalFactory.sol";

contract GatewayProxy {
/**
Expand Down
15 changes: 9 additions & 6 deletions analog-gmp/src/Primitives.sol
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ library PrimitiveUtils {
bytes memory onGmpReceived = callback.callback;
bytes32 dataHash;
assembly ("memory-safe") {
let offset := add(onGmpReceived, 0xa4)
let offset := add(onGmpReceived, 0xc4)
dataHash := keccak256(add(offset, 0x20), mload(offset))
}
callback.eip712hash = bytes32(GMP_VERSION);
Expand Down Expand Up @@ -332,9 +332,10 @@ library PrimitiveUtils {
// | 0x0124..0x0144 <- onGmpReceived.id
// | 0x0144..0x0164 <- onGmpReceived.network
// | 0x0164..0x0184 <- onGmpReceived.source
// | 0x0184..0x01a4 <- onGmpReceived.data.offset
// | 0x01a4..0x01c4 <- onGmpReceived.data.length
// | 0x01c4........ <- onGmpReceived.data
// | 0x0184..0x01a4 <- onGmpReceived.nonce
// | 0x01a4..0x01c4 <- onGmpReceived.data.offset
// | 0x01c4..0x01e4 <- onGmpReceived.data.length
// | 0x01e4........ <- onGmpReceived.data
if (isCalldata) {
GmpMessage calldata m = _intoCalldataPointer(message);
callback.source = m.source;
Expand All @@ -345,10 +346,11 @@ library PrimitiveUtils {
callback.nonce = m.nonce;
bytes calldata data = m.data;
callback.callback = abi.encodeWithSignature(
"onGmpReceived(bytes32,uint128,bytes32,bytes)",
"onGmpReceived(bytes32,uint128,bytes32,uint64,bytes)",
callback.eip712hash,
callback.srcNetwork,
callback.source,
callback.nonce,
data
);
} else {
Expand All @@ -360,10 +362,11 @@ library PrimitiveUtils {
callback.gasLimit = m.gasLimit;
callback.nonce = m.nonce;
callback.callback = abi.encodeWithSignature(
"onGmpReceived(bytes32,uint128,bytes32,bytes)",
"onGmpReceived(bytes32,uint128,bytes32,uint64,bytes)",
callback.eip712hash,
callback.srcNetwork,
callback.source,
callback.nonce,
m.data
);
}
Expand Down
2 changes: 1 addition & 1 deletion analog-gmp/src/interfaces/IGmpReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface IGmpReceiver {
* @param payload The message payload with no specified format
* @return 32 byte result which will be stored together with GMP message
*/
function onGmpReceived(bytes32 id, uint128 network, bytes32 source, bytes calldata payload)
function onGmpReceived(bytes32 id, uint128 network, bytes32 source, uint64 nonce, bytes calldata payload)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@agryaznov here's the change causing the issue

external
payable
returns (bytes32);
Expand Down
5 changes: 3 additions & 2 deletions analog-gmp/test/Batching.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ pragma solidity >=0.8.0;

import {Test, console, Vm} from "forge-std/Test.sol";
import {VmSafe} from "forge-std/Vm.sol";
import {FactoryUtils} from "@universal-factory/FactoryUtils.sol";
import {IUniversalFactory} from "@universal-factory/IUniversalFactory.sol";
import {FactoryUtils} from "../lib/universal-factory/src/FactoryUtils.sol";
import {IUniversalFactory} from "../lib/universal-factory/src/IUniversalFactory.sol";
import {TestUtils, SigningKey, SigningUtils} from "./TestUtils.sol";
import {GasSpender} from "./utils/GasSpender.sol";
import {BaseTest} from "./utils/BaseTest.sol";
Expand Down Expand Up @@ -161,6 +161,7 @@ contract Batching is BaseTest {
0x0000000000000000000000000000000000000000000000000000000000000000,
1,
0x0000000000000000000000000000000000000000000000000000000000000000,
0,
abi.encode(gasToWaste)
)
);
Expand Down
1 change: 1 addition & 0 deletions analog-gmp/test/Gateway.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ contract GatewayTest is BaseTest {
0x0000000000000000000000000000000000000000000000000000000000000000,
1,
0x0000000000000000000000000000000000000000000000000000000000000000,
0,
abi.encode(uint256(1234))
)
);
Expand Down
4 changes: 2 additions & 2 deletions analog-gmp/test/GatewayProxy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

pragma solidity >=0.8.0;

import {IUniversalFactory} from "@universal-factory/IUniversalFactory.sol";
import {FactoryUtils} from "@universal-factory/FactoryUtils.sol";
import {IUniversalFactory} from "../lib/universal-factory/src/IUniversalFactory.sol";
import {FactoryUtils} from "../lib/universal-factory/src/FactoryUtils.sol";
import {Test, console} from "forge-std/Test.sol";
import {VmSafe} from "forge-std/Vm.sol";
import {TestUtils, SigningKey, SigningUtils} from "./TestUtils.sol";
Expand Down
2 changes: 1 addition & 1 deletion analog-gmp/test/GmpTestTools.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {GatewayProxy} from "../src/GatewayProxy.sol";
import {IGateway} from "../src/interfaces/IGateway.sol";
import {BranchlessMath} from "../src/utils/BranchlessMath.sol";
import {GmpMessage, TssKey, Network, Signature, GmpSender, PrimitiveUtils} from "../src/Primitives.sol";
import {IUniversalFactory} from "@universal-factory/IUniversalFactory.sol";
import {IUniversalFactory} from "../lib/universal-factory/src/IUniversalFactory.sol";

library GmpTestTools {
/**
Expand Down
4 changes: 2 additions & 2 deletions analog-gmp/test/MockERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pragma solidity >=0.8.0;

import {ERC20} from "@solmate/tokens/ERC20.sol";
import {ERC20} from "../lib/solmate/src/tokens/ERC20.sol";
import {IGmpReceiver} from "../src/interfaces/IGmpReceiver.sol";
import {IGateway} from "../src/interfaces/IGateway.sol";

Expand Down Expand Up @@ -73,7 +73,7 @@ contract MockERC20 is ERC20, IGmpReceiver {
);
}

function onGmpReceived(bytes32 id, uint128 network, bytes32 sender, bytes calldata data)
function onGmpReceived(bytes32 id, uint128 network, bytes32 sender, uint64, bytes calldata data)
external
payable
returns (bytes32)
Expand Down
8 changes: 4 additions & 4 deletions analog-gmp/test/TestUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ pragma solidity >=0.8.0;

import {VmSafe, Vm} from "forge-std/Vm.sol";
import {console} from "forge-std/console.sol";
import {Schnorr} from "@frost-evm/Schnorr.sol";
import {SECP256K1} from "@frost-evm/SECP256K1.sol";
import {Schnorr} from "../lib/frost-evm/sol/Schnorr.sol";
import {SECP256K1} from "../lib/frost-evm/sol/SECP256K1.sol";
import {BranchlessMath} from "../src/utils/BranchlessMath.sol";
import {IUniversalFactory} from "@universal-factory/IUniversalFactory.sol";
import {FactoryUtils} from "@universal-factory/FactoryUtils.sol";
import {IUniversalFactory} from "../lib/universal-factory/src/IUniversalFactory.sol";
import {FactoryUtils} from "../lib/universal-factory/src/FactoryUtils.sol";
import {IGateway} from "../src/interfaces/IGateway.sol";
import {Gateway, GatewayEIP712} from "../src/Gateway.sol";
import {GatewayProxy} from "../src/GatewayProxy.sol";
Expand Down
6 changes: 3 additions & 3 deletions analog-gmp/test/utils/BaseTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

pragma solidity >=0.8.0;

import {IUniversalFactory} from "@universal-factory/IUniversalFactory.sol";
import {FactoryUtils} from "@universal-factory/FactoryUtils.sol";
import {Interpreter} from "@evm-interpreter/Interpreter.sol";
import {IUniversalFactory} from "../../lib/universal-factory/src/IUniversalFactory.sol";
import {FactoryUtils} from "../../lib/universal-factory/src/FactoryUtils.sol";
import {Interpreter} from "../../lib/evm-interpreter/src/Interpreter.sol";
import {Test, console, Vm} from "forge-std/Test.sol";
import {VmSafe} from "forge-std/Vm.sol";

Expand Down
6 changes: 3 additions & 3 deletions analog-gmp/test/utils/GasSpender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract GasSpender is IGmpReceiver {
// 0x07 0x3d RETURNDATASIZE
// 0x08 0x6020 PUSH1 0x20
// 0x0a 0x91 SWAP2
// 0x0b 0x6064 PUSH1 0x64
// 0x0b 0x6084 PUSH1 0x84
// 0x0d 0x35 CALLDATALOAD -- Load the payload offset from the calldata
// 0x0e 0x6024 PUSH1 0x24
// 0x10 0x01 ADD
Expand Down Expand Up @@ -61,7 +61,7 @@ contract GasSpender is IGmpReceiver {
// `=>0x3a 0x5b JUMPDEST
// 0x3b 0xf3 RETURN
bytes private constant BYTECODE =
hex"5a600201803d523d60209160643560240135146018575bfd5b60365a116018575a604903565b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5bf3";
hex"5a600201803d523d60209160843560240135146018575bfd5b60365a116018575a604903565b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5bf3";

constructor() payable {
bytes memory bytecode = BYTECODE;
Expand All @@ -70,7 +70,7 @@ contract GasSpender is IGmpReceiver {
}
}

function onGmpReceived(bytes32, uint128, bytes32, bytes calldata payload) external payable returns (bytes32) {
function onGmpReceived(bytes32, uint128, bytes32, uint64, bytes calldata payload) external payable returns (bytes32) {
unchecked {
// OBS: This is just an example on how this contract works, the actual code is implemented directly in
// low level EVM, as defined in the `BYTECODE` constant.
Expand Down
1 change: 1 addition & 0 deletions analog-gmp/test/utils/GasSpender.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ contract GasSpenderTest is BaseTest {
0x0000000000000000000000000000000000000000000000000000000000000000,
1,
0x0000000000000000000000000000000000000000000000000000000000000000,
0,
abi.encode(gasToWaste)
)
);
Expand Down
Loading
Loading