Skip to content

Commit

Permalink
feat: add files
Browse files Browse the repository at this point in the history
  • Loading branch information
karlem committed Oct 21, 2024
1 parent 587b8f6 commit 751c615
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 0 deletions.
35 changes: 35 additions & 0 deletions contracts/contracts/materializer/CrossMessenger.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.23;

import {FvmAddress} from "../structs/FvmAddress.sol";
import {SubnetID, IPCAddress} from "../structs/Subnet.sol";
import {IpcEnvelope, IpcMsgKind, CallMsg} from "../structs/CrossNet.sol";
import {IGateway} from "../interfaces/IGateway.sol";
import {EMPTY_BYTES, METHOD_SEND} from "../../contracts/constants/Constants.sol";

/// This is a simple helper contract for Materializer to test cross messages.
contract CrossMessenger {
address internal gatewayAddr;

function setGatewayAddress(address gateway) external {
gatewayAddr = gateway;
}

function invokeCrossMessage(
IPCAddress memory from,
IPCAddress memory to,
uint256 value
) external {
CallMsg memory message = CallMsg({method: abi.encodePacked(METHOD_SEND), params: EMPTY_BYTES});
IpcEnvelope memory envelope = IpcEnvelope({
kind: IpcMsgKind.Call,
from: from,
to: to,
value: value,
message: abi.encode(message),
nonce: 0
});

IGateway(gatewayAddr).sendContractXnetMessage(envelope);
}
}
106 changes: 106 additions & 0 deletions fendermint/testing/materializer/tests/manifests/layer3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
accounts:
alice: {}
bob: {}
charlie: {}
will: {}

rootnet:
type: New
# Balances and collateral are in atto
validators:
alice: "100"
balances:
# 100FIL is 100_000_000_000_000_000_000
alice: "100000000000000000000"
will: "400000000000000000000"
bob: "8000000000000000000000000"
charlie: "900000000000000000000"
env:
CMT_CONSENSUS_TIMEOUT_COMMIT: 2s
FM_LOG_LEVEL: info,fendermint=debug

nodes:
brussels:
mode:
type: Validator
validator: alice
seed_nodes: []
ethapi: true

subnets:
england:
creator: bob
# Minimum collateral is 1 nanoFIL, which is 1_000_000_000 atto
validators:
charlie: "1000000000"
# Submitting a signature for a checkpoint says it needs 0.059552996FIL
balances:
bob: "30000000000000000000"
will: "200000000000000000000"
bottom_up_checkpoint:
period: 100
env:
FM_LOG_LEVEL: info,fendermint=debug
# Enable debug log on the relayers
RUST_LOG: debug
solidity_deployments:
- name: "cross_messenger"
deployer: will
foundry_root: "/Users/karlem/work/ipc/contracts"
contract:
name: "CrossMessenger"
path: "contracts/contracts/materializer/CrossMessenger.sol"
constructor_args:
- ""

relayers:
euston:
submitter: bob
follow_node: london
submit_node: brussels

nodes:
london:
mode:
type: Validator
validator: charlie
parent_node: brussels
seed_nodes: []
ethapi: true

subnets:
oxfordshire:
creator: will
validators:
will: "1000000000"
balances:
will: "100000000000000000000"
bottom_up_checkpoint:
period: 100
env:
FM_LOG_LEVEL: info,fendermint=debug
RUST_LOG: debug
solidity_deployments:
- name: "cross_messenger"
deployer: will
foundry_root: "/Users/karlem/work/ipc/contracts"
contract:
name: "CrossMessenger"
path: "contracts/contracts/materializer/CrossMessenger.sol"
constructor_args:
- ""

relayers:
kings_cross:
submitter: will
follow_node: oxford
submit_node: london

nodes:
oxford:
mode:
type: Validator
validator: will
parent_node: london
seed_nodes: []
ethapi: true

0 comments on commit 751c615

Please sign in to comment.