-
Notifications
You must be signed in to change notification settings - Fork 47
feat: support l2 plus #1157
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
Merged
Merged
feat: support l2 plus #1157
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
6343017
feat: add simple tests
karlem 3c18e12
feat: happy path with propagateAll
karlem a95fa93
feat: add more tests
karlem 39b1a1c
feat: check for proper path propagation
karlem 8fb277f
feat: added result paths to test
karlem e31475d
feat: add extra test and emits
karlem bb2b83c
feat: add missing actor tests + refactor
karlem 0cb82a9
feat: move validation
karlem d2bfdd9
feat: commit cross messages does not revert & fix tests
karlem 488a921
feat: remove logs
karlem b3c962a
feat: fix tests
karlem 9287fe4
feat: fmt
karlem 9d01bf8
feat: send across mixed token supplies
karlem 142d4d8
feat: propagate top down automatically
karlem f677ef1
feat: fmt & lint
karlem 807c030
feat: add extra check
karlem 471e059
feat: fix test & lint
karlem e923695
feat: fix comments
karlem 7b4d142
feat: fix comments
karlem 9c98fe8
feat: change error message
karlem ffab27e
feat: make sure ID is the same cross network & fix down func
karlem a3b7fd0
feat: update from comments
karlem 7e18939
feat: do not move funds with call kind
karlem 9df5c8b
feat: rebase fixes
karlem 5aff1b4
feat: fmt
karlem 1f2ef32
feat: storage layout
karlem 31b7766
feat: receipt - encode with selector
karlem 0259a0e
feat: fix nonce issue and add tests
karlem de3e6b1
feat: linbt
karlem 021ea53
feat: disable transfers for Call messages
karlem 469c7bd
feat(node): support l2 utils (#1219)
cryptoAtwill b9b0dcb
feat(node): support l2 plus value transfer (#1240)
cryptoAtwill fab6ae5
chore(contracts): L3+ remove unnecessary `CrossMessageValidationOutco…
raulk 73e7ef8
feat: consistent non clashing tracing id
karlem 490ce5e
fix: test
karlem edae481
feat: add original nonce to fendermint
karlem f37b285
fix: build
karlem 1a84b42
fix: rename nonce to local nonce
karlem b12e566
fix: formatter
karlem c387cdc
fix: build, test, storage
karlem 22e5009
fix: storage layoyt
karlem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
478 changes: 284 additions & 194 deletions
478
contracts/.storage-layouts/GatewayActorModifiers.json
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| // 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, ResultMsg} from "../structs/CrossNet.sol"; | ||
| import {IGateway} from "../interfaces/IGateway.sol"; | ||
| import {SubnetIDHelper} from "../lib/SubnetIDHelper.sol"; | ||
| import {FvmAddressHelper} from "../lib/FvmAddressHelper.sol"; | ||
| import {EMPTY_BYTES, METHOD_SEND} from "../constants/Constants.sol"; | ||
| import {IpcExchange} from "../../sdk/IpcContract.sol"; | ||
|
|
||
| interface ISubnetGetter { | ||
| function ipcGatewayAddr() external view returns (address); | ||
| function getParent() external view returns (SubnetID memory); | ||
| } | ||
|
|
||
| /// This is a simple example contract to invoke cross messages between subnets from different levels | ||
| contract CrossMessengerCaller is IpcExchange { | ||
| event CallReceived(IPCAddress from, CallMsg msg); | ||
| event ResultReceived(IpcEnvelope original, ResultMsg result); | ||
|
|
||
| uint256 public callsReceived; | ||
| uint256 public resultsReceived; | ||
|
|
||
| constructor(address gatewayAddr_) IpcExchange(gatewayAddr_) { | ||
| callsReceived = 0; | ||
| resultsReceived = 0; | ||
| } | ||
|
|
||
| function _handleIpcCall( | ||
| IpcEnvelope memory envelope, | ||
| CallMsg memory callMsg | ||
| ) internal override returns (bytes memory) { | ||
| emit CallReceived(envelope.from, callMsg); | ||
| callsReceived += 1; | ||
| return EMPTY_BYTES; | ||
| } | ||
|
|
||
| function _handleIpcResult( | ||
| IpcEnvelope storage original, | ||
| IpcEnvelope memory, | ||
| ResultMsg memory resultMsg | ||
| ) internal override { | ||
| resultsReceived += 1; | ||
| emit ResultReceived(original, resultMsg); | ||
| } | ||
|
|
||
| /// @dev Invoke a cross net send fund message from the current subnet to the target subnet | ||
| function invokeSendMessage(SubnetID calldata targetSubnet, address recipient, uint256 value) external { | ||
| IPCAddress memory to = IPCAddress({subnetId: targetSubnet, rawAddress: FvmAddressHelper.from(recipient)}); | ||
| CallMsg memory message = CallMsg({method: abi.encodePacked(METHOD_SEND), params: EMPTY_BYTES}); | ||
| invokeCrossMessage(to, message, value); | ||
| } | ||
|
|
||
| function invokeCrossMessage(IPCAddress memory to, CallMsg memory callMsg, uint256 value) internal { | ||
| // "sendContractXnetMessage" will handle the `from` | ||
| IPCAddress memory from; | ||
|
|
||
| IpcEnvelope memory envelope = IpcEnvelope({ | ||
| kind: IpcMsgKind.Call, | ||
| from: from, | ||
| to: to, | ||
| value: value, | ||
| message: abi.encode(callMsg), | ||
| originalNonce: 0, | ||
| localNonce: 0 | ||
| }); | ||
|
|
||
| IGateway(gatewayAddr).sendContractXnetMessage(envelope); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // SPDX-License-Identifier: MIT OR Apache-2.0 | ||
| pragma solidity ^0.8.23; | ||
|
|
||
| import {Asset} from "../structs/Subnet.sol"; | ||
|
|
||
| /// @title Subnet actor interface | ||
| interface ISubnetActor { | ||
| function supplySource() external view returns (Asset memory); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.