Skip to content

Commit 18f32ca

Browse files
authored
feat: add general cross messages docs (#1252)
1 parent 967829f commit 18f32ca

File tree

8 files changed

+280
-126
lines changed

8 files changed

+280
-126
lines changed

contracts/.storage-layouts/GatewayActorModifiers.json

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -607,55 +607,55 @@
607607
"type": "t_enum(IpcMsgKind)21376"
608608
},
609609
{
610-
"astId": 21385,
610+
"astId": 21384,
611611
"contract": "contracts/lib/LibGatewayActorStorage.sol:GatewayActorModifiers",
612-
"label": "to",
613-
"offset": 0,
614-
"slot": "1",
615-
"type": "t_struct(IPCAddress)21658_storage"
612+
"label": "localNonce",
613+
"offset": 1,
614+
"slot": "0",
615+
"type": "t_uint64"
616616
},
617617
{
618-
"astId": 21389,
618+
"astId": 21387,
619619
"contract": "contracts/lib/LibGatewayActorStorage.sol:GatewayActorModifiers",
620-
"label": "from",
621-
"offset": 0,
622-
"slot": "5",
623-
"type": "t_struct(IPCAddress)21658_storage"
620+
"label": "originalNonce",
621+
"offset": 9,
622+
"slot": "0",
623+
"type": "t_uint64"
624624
},
625625
{
626-
"astId": 21392,
626+
"astId": 21390,
627627
"contract": "contracts/lib/LibGatewayActorStorage.sol:GatewayActorModifiers",
628-
"label": "localNonce",
628+
"label": "value",
629629
"offset": 0,
630-
"slot": "9",
631-
"type": "t_uint64"
630+
"slot": "1",
631+
"type": "t_uint256"
632632
},
633633
{
634-
"astId": 21395,
634+
"astId": 21394,
635635
"contract": "contracts/lib/LibGatewayActorStorage.sol:GatewayActorModifiers",
636-
"label": "value",
636+
"label": "to",
637637
"offset": 0,
638-
"slot": "10",
639-
"type": "t_uint256"
638+
"slot": "2",
639+
"type": "t_struct(IPCAddress)21658_storage"
640640
},
641641
{
642642
"astId": 21398,
643643
"contract": "contracts/lib/LibGatewayActorStorage.sol:GatewayActorModifiers",
644-
"label": "message",
644+
"label": "from",
645645
"offset": 0,
646-
"slot": "11",
647-
"type": "t_bytes_storage"
646+
"slot": "6",
647+
"type": "t_struct(IPCAddress)21658_storage"
648648
},
649649
{
650650
"astId": 21401,
651651
"contract": "contracts/lib/LibGatewayActorStorage.sol:GatewayActorModifiers",
652-
"label": "originalNonce",
652+
"label": "message",
653653
"offset": 0,
654-
"slot": "12",
655-
"type": "t_uint64"
654+
"slot": "10",
655+
"type": "t_bytes_storage"
656656
}
657657
],
658-
"numberOfBytes": "416"
658+
"numberOfBytes": "352"
659659
},
660660
"t_struct(MaxPQ)19752_storage": {
661661
"encoding": "inplace",

contracts/.storage-layouts/GatewayDiamond.json

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -607,55 +607,55 @@
607607
"type": "t_enum(IpcMsgKind)21376"
608608
},
609609
{
610-
"astId": 21385,
610+
"astId": 21384,
611611
"contract": "contracts/GatewayDiamond.sol:GatewayDiamond",
612-
"label": "to",
613-
"offset": 0,
614-
"slot": "1",
615-
"type": "t_struct(IPCAddress)21658_storage"
612+
"label": "localNonce",
613+
"offset": 1,
614+
"slot": "0",
615+
"type": "t_uint64"
616616
},
617617
{
618-
"astId": 21389,
618+
"astId": 21387,
619619
"contract": "contracts/GatewayDiamond.sol:GatewayDiamond",
620-
"label": "from",
621-
"offset": 0,
622-
"slot": "5",
623-
"type": "t_struct(IPCAddress)21658_storage"
620+
"label": "originalNonce",
621+
"offset": 9,
622+
"slot": "0",
623+
"type": "t_uint64"
624624
},
625625
{
626-
"astId": 21392,
626+
"astId": 21390,
627627
"contract": "contracts/GatewayDiamond.sol:GatewayDiamond",
628-
"label": "localNonce",
628+
"label": "value",
629629
"offset": 0,
630-
"slot": "9",
631-
"type": "t_uint64"
630+
"slot": "1",
631+
"type": "t_uint256"
632632
},
633633
{
634-
"astId": 21395,
634+
"astId": 21394,
635635
"contract": "contracts/GatewayDiamond.sol:GatewayDiamond",
636-
"label": "value",
636+
"label": "to",
637637
"offset": 0,
638-
"slot": "10",
639-
"type": "t_uint256"
638+
"slot": "2",
639+
"type": "t_struct(IPCAddress)21658_storage"
640640
},
641641
{
642642
"astId": 21398,
643643
"contract": "contracts/GatewayDiamond.sol:GatewayDiamond",
644-
"label": "message",
644+
"label": "from",
645645
"offset": 0,
646-
"slot": "11",
647-
"type": "t_bytes_storage"
646+
"slot": "6",
647+
"type": "t_struct(IPCAddress)21658_storage"
648648
},
649649
{
650650
"astId": 21401,
651651
"contract": "contracts/GatewayDiamond.sol:GatewayDiamond",
652-
"label": "originalNonce",
652+
"label": "message",
653653
"offset": 0,
654-
"slot": "12",
655-
"type": "t_uint64"
654+
"slot": "10",
655+
"type": "t_bytes_storage"
656656
}
657657
],
658-
"numberOfBytes": "416"
658+
"numberOfBytes": "352"
659659
},
660660
"t_struct(MaxPQ)19752_storage": {
661661
"encoding": "inplace",

contracts/.storage-layouts/SubnetActorDiamond.json

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -403,55 +403,55 @@
403403
"type": "t_enum(IpcMsgKind)21376"
404404
},
405405
{
406-
"astId": 21385,
406+
"astId": 21384,
407407
"contract": "contracts/SubnetActorDiamond.sol:SubnetActorDiamond",
408-
"label": "to",
409-
"offset": 0,
410-
"slot": "1",
411-
"type": "t_struct(IPCAddress)21658_storage"
408+
"label": "localNonce",
409+
"offset": 1,
410+
"slot": "0",
411+
"type": "t_uint64"
412412
},
413413
{
414-
"astId": 21389,
414+
"astId": 21387,
415415
"contract": "contracts/SubnetActorDiamond.sol:SubnetActorDiamond",
416-
"label": "from",
417-
"offset": 0,
418-
"slot": "5",
419-
"type": "t_struct(IPCAddress)21658_storage"
416+
"label": "originalNonce",
417+
"offset": 9,
418+
"slot": "0",
419+
"type": "t_uint64"
420420
},
421421
{
422-
"astId": 21392,
422+
"astId": 21390,
423423
"contract": "contracts/SubnetActorDiamond.sol:SubnetActorDiamond",
424-
"label": "localNonce",
424+
"label": "value",
425425
"offset": 0,
426-
"slot": "9",
427-
"type": "t_uint64"
426+
"slot": "1",
427+
"type": "t_uint256"
428428
},
429429
{
430-
"astId": 21395,
430+
"astId": 21394,
431431
"contract": "contracts/SubnetActorDiamond.sol:SubnetActorDiamond",
432-
"label": "value",
432+
"label": "to",
433433
"offset": 0,
434-
"slot": "10",
435-
"type": "t_uint256"
434+
"slot": "2",
435+
"type": "t_struct(IPCAddress)21658_storage"
436436
},
437437
{
438438
"astId": 21398,
439439
"contract": "contracts/SubnetActorDiamond.sol:SubnetActorDiamond",
440-
"label": "message",
440+
"label": "from",
441441
"offset": 0,
442-
"slot": "11",
443-
"type": "t_bytes_storage"
442+
"slot": "6",
443+
"type": "t_struct(IPCAddress)21658_storage"
444444
},
445445
{
446446
"astId": 21401,
447447
"contract": "contracts/SubnetActorDiamond.sol:SubnetActorDiamond",
448-
"label": "originalNonce",
448+
"label": "message",
449449
"offset": 0,
450-
"slot": "12",
451-
"type": "t_uint64"
450+
"slot": "10",
451+
"type": "t_bytes_storage"
452452
}
453453
],
454-
"numberOfBytes": "416"
454+
"numberOfBytes": "352"
455455
},
456456
"t_struct(MaxPQ)19752_storage": {
457457
"encoding": "inplace",

contracts/.storage-layouts/SubnetActorModifiers.json

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -403,55 +403,55 @@
403403
"type": "t_enum(IpcMsgKind)21376"
404404
},
405405
{
406-
"astId": 21385,
406+
"astId": 21384,
407407
"contract": "contracts/lib/LibSubnetActorStorage.sol:SubnetActorModifiers",
408-
"label": "to",
409-
"offset": 0,
410-
"slot": "1",
411-
"type": "t_struct(IPCAddress)21658_storage"
408+
"label": "localNonce",
409+
"offset": 1,
410+
"slot": "0",
411+
"type": "t_uint64"
412412
},
413413
{
414-
"astId": 21389,
414+
"astId": 21387,
415415
"contract": "contracts/lib/LibSubnetActorStorage.sol:SubnetActorModifiers",
416-
"label": "from",
417-
"offset": 0,
418-
"slot": "5",
419-
"type": "t_struct(IPCAddress)21658_storage"
416+
"label": "originalNonce",
417+
"offset": 9,
418+
"slot": "0",
419+
"type": "t_uint64"
420420
},
421421
{
422-
"astId": 21392,
422+
"astId": 21390,
423423
"contract": "contracts/lib/LibSubnetActorStorage.sol:SubnetActorModifiers",
424-
"label": "localNonce",
424+
"label": "value",
425425
"offset": 0,
426-
"slot": "9",
427-
"type": "t_uint64"
426+
"slot": "1",
427+
"type": "t_uint256"
428428
},
429429
{
430-
"astId": 21395,
430+
"astId": 21394,
431431
"contract": "contracts/lib/LibSubnetActorStorage.sol:SubnetActorModifiers",
432-
"label": "value",
432+
"label": "to",
433433
"offset": 0,
434-
"slot": "10",
435-
"type": "t_uint256"
434+
"slot": "2",
435+
"type": "t_struct(IPCAddress)21658_storage"
436436
},
437437
{
438438
"astId": 21398,
439439
"contract": "contracts/lib/LibSubnetActorStorage.sol:SubnetActorModifiers",
440-
"label": "message",
440+
"label": "from",
441441
"offset": 0,
442-
"slot": "11",
443-
"type": "t_bytes_storage"
442+
"slot": "6",
443+
"type": "t_struct(IPCAddress)21658_storage"
444444
},
445445
{
446446
"astId": 21401,
447447
"contract": "contracts/lib/LibSubnetActorStorage.sol:SubnetActorModifiers",
448-
"label": "originalNonce",
448+
"label": "message",
449449
"offset": 0,
450-
"slot": "12",
451-
"type": "t_uint64"
450+
"slot": "10",
451+
"type": "t_bytes_storage"
452452
}
453453
],
454-
"numberOfBytes": "416"
454+
"numberOfBytes": "352"
455455
},
456456
"t_struct(MaxPQ)19752_storage": {
457457
"encoding": "inplace",

contracts/contracts/structs/CrossNet.sol

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,42 +58,33 @@ enum IpcMsgKind {
5858
/// @dev general-purpose cross-net transaction that call smart contracts.
5959
Call,
6060
/// @dev receipt from the execution of cross-net messages
61-
/// (currently limited to `Transfer` messages)
6261
Result
6362
}
6463

6564
/// @notice Envelope used to propagate IPC cross-net messages
6665
struct IpcEnvelope {
6766
/// @dev type of message being propagated.
6867
IpcMsgKind kind;
69-
/// @dev destination of the message
70-
/// It makes sense to extract from the encoded message
71-
/// all shared fields required by all message, so they
72-
/// can be inspected without having to decode the message.
73-
IPCAddress to;
74-
/// @dev address sending the message
75-
IPCAddress from;
7668
/// @dev outgoing nonce for the envelope.
7769
/// This nonce is set by the gateway when committing the message for propagation.
7870
/// This nonce is changed on each network when the message is propagated,
7971
/// so it is unique for each network and prevents replay attacks.
8072
uint64 localNonce;
81-
/// @dev Value being sent in the message.
82-
/// For `Call` and `Result` kinds, the `value` field is synthetic and does not represent an actual token or native currency transfer.
83-
/// Instead, it serves as metadata or an abstract representation of value to be interpreted by the target contract or receipt handler.
84-
///
85-
/// For example, in a `Call` message, `value` might represent the intended payment amount for a service in a cross-network dApp,
86-
/// allowing the receiving contract to process it as part of its logic, regardless of the actual token transfer mechanics.
87-
/// Similarly, in a `Result` message, `value` might represent the outcome of a transaction, such as the total tokens minted or refunded.
88-
///
89-
/// For `Transfer` messages, `value` represents the actual amount of native tokens being transferred across networks.
90-
uint256 value;
91-
/// @dev abi.encoded message
92-
bytes message;
9373
/// @dev original nonce of the message from the source network.
9474
/// It is set once at the source network and remains unchanged during propagation.
9575
/// It is used to generate a unique tracing ID across networks, which is useful for debugging and auditing purposes.
9676
uint64 originalNonce;
77+
/// @dev Value being sent in the message.
78+
uint256 value;
79+
/// @dev destination of the message
80+
/// It makes sense to extract from the encoded message
81+
/// all shared fields required by all message, so they
82+
/// can be inspected without having to decode the message.
83+
IPCAddress to;
84+
/// @dev address sending the message
85+
IPCAddress from;
86+
/// @dev abi.encoded message
87+
bytes message;
9788
/// @dev the gas limit is currently not used.
9889
// FIXME: currently not used.
9990
// uint256 gasLimit;

0 commit comments

Comments
 (0)