@layerzerolabs/layerzero-v2-ton 3.0.59 → 3.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/AllStorages.compiled.json +1 -1
- package/build/BaseContract.test.compiled.json +1 -1
- package/build/Channel.compiled.json +1 -1
- package/build/Channel.permissions.test.compiled.json +1 -1
- package/build/ChannelBurn.test.compiled.json +1 -1
- package/build/ChannelBurnDefaultConfig.test.compiled.json +1 -0
- package/build/ChannelCommitPacket.test.compiled.json +1 -1
- package/build/ChannelConfig.test.compiled.json +1 -1
- package/build/ChannelInitialize.test.compiled.json +1 -1
- package/build/ChannelMsglibIntegration.test.compiled.json +1 -1
- package/build/ChannelMsglibSendCallback.test.compiled.json +1 -1
- package/build/ChannelNilify.test.compiled.json +1 -1
- package/build/ChannelNilifyDefaultConfig.test.compiled.json +1 -0
- package/build/ChannelReceive.test.compiled.json +1 -1
- package/build/ChannelReceiveCallback.test.compiled.json +1 -1
- package/build/ChannelReceiveView.test.compiled.json +1 -1
- package/build/ChannelSend.test.compiled.json +1 -1
- package/build/ChannelSerde.test.compiled.json +1 -1
- package/build/Classlib.test.compiled.json +1 -1
- package/build/ComputeDataSizeGas.test.compiled.json +1 -1
- package/build/Connection.compiled.json +1 -1
- package/build/Controller.assertions.test.compiled.json +1 -1
- package/build/Controller.compiled.json +1 -1
- package/build/Controller.permissions.test.compiled.json +1 -1
- package/build/Controller.test.compiled.json +1 -1
- package/build/Counter.compiled.json +1 -1
- package/build/Counter.permissions.test.compiled.json +1 -1
- package/build/Counter.setters.test.compiled.json +1 -1
- package/build/Counter.test.compiled.json +1 -1
- package/build/Dvn.compiled.json +1 -1
- package/build/Dvn.test.compiled.json +1 -1
- package/build/DvnFeeLibSerde.test.compiled.json +1 -1
- package/build/DvnPermissions.test.compiled.json +1 -1
- package/build/DvnSerde.test.compiled.json +1 -1
- package/build/Endpoint.permissions.test.compiled.json +1 -1
- package/build/Endpoint.test.compiled.json +1 -1
- package/build/EndpointSerde.test.compiled.json +1 -1
- package/build/EndpointSetEpConfigDefaults.test.compiled.json +1 -1
- package/build/Executor.compiled.json +1 -1
- package/build/Executor.test.compiled.json +1 -1
- package/build/ExecutorFeeLib.compiled.json +1 -1
- package/build/ExecutorFeeLibSerde.test.compiled.json +1 -1
- package/build/ExecutorPermissions.test.compiled.json +1 -1
- package/build/ExecutorSerde.test.compiled.json +1 -1
- package/build/LzClasses.test.compiled.json +1 -1
- package/build/LzClassesSerde.test.compiled.json +1 -1
- package/build/LzUtil.test.compiled.json +1 -1
- package/build/MsgData.test.compiled.json +1 -1
- package/build/MsgDataSerde.test.compiled.json +1 -1
- package/build/MsglibPacketCodec.test.compiled.json +1 -1
- package/build/PipelinedOutOfOrderSerde.test.compiled.json +1 -1
- package/build/PriceFeedCache.compiled.json +1 -1
- package/build/PriceFeedCache.test.compiled.json +1 -1
- package/build/PriceFeedCache.test.permissions.compiled.json +1 -1
- package/build/PriceFeedCacheSerde.test.compiled.json +1 -1
- package/build/PriceFeedFeeLibArbitrum.test.compiled.json +1 -1
- package/build/PriceFeedFeeLibDefault.test.compiled.json +1 -1
- package/build/PriceFeedFeeLibOptimism.test.compiled.json +1 -1
- package/build/PriceFeedFeeLibSerde.test.compiled.json +1 -1
- package/build/Proxy.compiled.json +1 -1
- package/build/Proxy.permissions.test.compiled.json +1 -1
- package/build/Proxy.test.compiled.json +1 -1
- package/build/SmlConnection.permissions.test.compiled.json +1 -1
- package/build/SmlConnection.test.compiled.json +1 -1
- package/build/SmlManager.permissions.test.compiled.json +1 -1
- package/build/SmlManager.test.compiled.json +1 -1
- package/build/TxnContext.test.compiled.json +1 -1
- package/build/Uln.compiled.json +1 -1
- package/build/Uln.test.compiled.json +1 -1
- package/build/UlnConnection.compiled.json +1 -1
- package/build/UlnConnection.test.compiled.json +1 -1
- package/build/UlnConnectionPermissions.test.compiled.json +1 -1
- package/build/UlnConnectionSerde.test.compiled.json +1 -1
- package/build/UlnManagement.test.compiled.json +1 -1
- package/build/UlnManager.compiled.json +1 -1
- package/build/UlnManager.test.compiled.json +1 -1
- package/build/UlnManagerPermissions.test.compiled.json +1 -1
- package/build/UlnManagerUtil.test.compiled.json +1 -1
- package/build/UlnMsgDataSerde.test.compiled.json +1 -1
- package/build/UlnPermissions.test.compiled.json +1 -1
- package/build/UlnReceiveConfig.test.compiled.json +1 -1
- package/build/UlnSend.test.compiled.json +1 -1
- package/build/UlnSendConfig.test.compiled.json +1 -1
- package/build/UlnSendWithArbDvnFeeLib.test.compiled.json +1 -1
- package/build/UlnSendWithArbExecFeeLib.test.compiled.json +1 -1
- package/build/UlnSendWithDefaultDvnFeeLib.test.compiled.json +1 -1
- package/build/UlnSendWithDefaultExecFeeLib.test.compiled.json +1 -1
- package/build/UlnSendWithOpDvnFeeLib.test.compiled.json +1 -1
- package/build/UlnSendWithOpExecFeeLib.test.compiled.json +1 -1
- package/build/UlnSendWorkerFactory.test.compiled.json +1 -1
- package/build/UlnSerde.test.compiled.json +1 -1
- package/build/UlnUtil.test.compiled.json +1 -1
- package/build/WorkerCore.test.compiled.json +1 -1
- package/build/WorkerCoreMsgDataSerde.test.compiled.json +1 -1
- package/build/WorkerCoreSerde.test.compiled.json +1 -1
- package/build/badFeeLib1.test.compiled.json +1 -1
- package/build/badFeeLib10.test.compiled.json +1 -1
- package/build/badFeeLib11.test.compiled.json +1 -1
- package/build/badFeeLib12.test.compiled.json +1 -1
- package/build/badFeeLib2.test.compiled.json +1 -1
- package/build/badFeeLib3.test.compiled.json +1 -1
- package/build/badFeeLib4.test.compiled.json +1 -1
- package/build/badFeeLib5.test.compiled.json +1 -1
- package/build/badFeeLib6.test.compiled.json +1 -1
- package/build/badFeeLib7.test.compiled.json +1 -1
- package/build/badFeeLib8.test.compiled.json +1 -1
- package/build/badFeeLib9.test.compiled.json +1 -1
- package/package.json +1 -1
- package/src/classes/lz/Config.fc +1 -1
- package/src/classes/lz/EpConfig.fc +2 -2
- package/src/classes/lz/MsglibInfo.fc +1 -1
- package/src/classes/lz/Packet.fc +3 -3
- package/src/classes/lz/SendEpConfig.fc +1 -1
- package/src/classes/msgdata/AddMsglib.fc +1 -1
- package/src/classes/msgdata/Bool.fc +1 -1
- package/src/classes/msgdata/ChannelNonceInfo.fc +1 -1
- package/src/classes/msgdata/CoinsAmount.fc +1 -1
- package/src/classes/msgdata/CounterIncrement.fc +1 -1
- package/src/classes/msgdata/Deploy.fc +1 -1
- package/src/classes/msgdata/GetMsglibCallback.fc +1 -1
- package/src/classes/msgdata/InitEndpoint.fc +1 -1
- package/src/classes/msgdata/LzReceivePrepare.fc +1 -1
- package/src/classes/msgdata/LzReceiveStatus.fc +1 -1
- package/src/classes/msgdata/LzSend.fc +1 -1
- package/src/classes/msgdata/MdEid.fc +1 -1
- package/src/classes/msgdata/MdObj.fc +1 -1
- package/src/classes/msgdata/MessagingReceipt.fc +1 -1
- package/src/classes/msgdata/MsglibSendCallback.fc +3 -3
- package/src/classes/msgdata/Nonce.fc +1 -1
- package/src/classes/msgdata/OptionsExtended.fc +1 -1
- package/src/classes/msgdata/OptionsV1.fc +1 -1
- package/src/classes/msgdata/OptionsV2.fc +1 -1
- package/src/classes/msgdata/PacketId.fc +1 -1
- package/src/classes/msgdata/SetAddress.fc +1 -1
- package/src/classes/msgdata/SetEpConfig.fc +1 -1
- package/src/classes/msgdata/SetPeer.fc +1 -1
- package/src/funC++/actions/RawCall.fc +4 -4
- package/src/funC++/actions/call.fc +4 -4
- package/src/funC++/actions/deploy.fc +4 -4
- package/src/funC++/actions/event.fc +2 -2
- package/src/funC++/actions/payment.fc +4 -4
- package/src/funC++/actions/sendJettons.fc +6 -6
- package/src/funC++/actions/utils.fc +1 -1
- package/src/funC++/classlib.fc +30 -30
- package/src/funC++/dataStructures/AddressList.fc +1 -1
- package/src/funC++/dataStructures/DeterministicInsertionCircularQueue.fc +6 -6
- package/src/funC++/stringlib.fc +7 -7
- package/src/funC++/txnContext.fc +10 -10
- package/src/funC++/utils.fc +5 -5
- package/src/protocol/channel/handler.fc +3 -3
- package/src/protocol/channel/storage.fc +1 -1
- package/src/protocol/controller/handler.fc +2 -0
- package/src/protocol/controller/storage.fc +1 -1
- package/src/protocol/core/baseStorage.fc +1 -1
- package/src/protocol/endpoint/handler.fc +4 -4
- package/src/protocol/msglibs/BytesDecoder.fc +5 -5
- package/src/protocol/msglibs/BytesEncoder.fc +7 -7
- package/src/protocol/msglibs/ultralightnode/msgdata/Attestation.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/DvnFeesPaidEvent.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/ExecutorFeePaidEvent.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/InitUln.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/InitUlnConnection.fc +2 -2
- package/src/protocol/msglibs/ultralightnode/msgdata/InitUlnManager.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/RentRefill.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/SetAdminWorkerAddresses.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/TreasuryFeeBps.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnEvents.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnReceiveConfig.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnSend.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnVerification.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnWorkerFeelibBytecode.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnWorkerFeelibInfo.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/msgdata/VerificationStatus.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/uln/handler.fc +2 -3
- package/src/protocol/msglibs/ultralightnode/uln/storage.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/ulnConnection/handler.fc +14 -5
- package/src/protocol/msglibs/ultralightnode/ulnConnection/storage.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/ulnManager/storage.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/handler.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/storage.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/executorFeeLib/handler.fc +4 -6
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/executorFeeLib/storage.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/maliciousFeeLib/handler.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/storage.fc +1 -1
- package/src/workers/core/abstract/workerHandler.fc +6 -5
- package/src/workers/core/workerCoreStorage.fc +1 -1
- package/src/workers/dvn/handler.fc +3 -3
- package/src/workers/dvn/storage.fc +1 -1
- package/src/workers/executor/handler.fc +16 -4
- package/src/workers/executor/interface.fc +2 -0
- package/src/workers/executor/main.fc +4 -0
- package/src/workers/executor/storage.fc +1 -1
- package/src/workers/msgdata/ClaimTon.fc +1 -1
- package/src/workers/msgdata/ExecuteParams.fc +7 -7
- package/src/workers/msgdata/NativeDrop.fc +1 -1
- package/src/workers/msgdata/SetDict.fc +1 -1
- package/src/workers/msgdata/SetQuorum.fc +1 -1
- package/src/workers/msgdata/SignedRequest.fc +1 -1
- package/src/workers/priceFeedCache/storage.fc +1 -1
- package/src/workers/proxy/handler.fc +2 -12
- package/src/workers/proxy/storage.fc +1 -1
- package/tests/baseContractTest.fc +10 -0
- package/src/classes/lz/Worker.fc +0 -32
|
@@ -30,7 +30,7 @@ const int UlnConnection::hashLookups = 8; ;; map nonce -> map dvnAddress -> {has
|
|
|
30
30
|
const int UlnConnection::commitPOOO = 9;
|
|
31
31
|
|
|
32
32
|
;; @owner ulnManager
|
|
33
|
-
cell UlnConnection::New(int owner, cell $path, int ulnAddress) method_id {
|
|
33
|
+
cell UlnConnection::New(int owner, cell $path, int ulnAddress) impure method_id {
|
|
34
34
|
return cl::declare(
|
|
35
35
|
UlnConnection::NAME,
|
|
36
36
|
unsafeTuple([
|
|
@@ -53,7 +53,7 @@ int _getCallDataSize(cell $myStorage) impure inline_ref {
|
|
|
53
53
|
return DvnFeelib::EXECUTE_FIXED_BYTES + DvnFeelib::VERIFY_BYTES_ULN + totalSignatureBytes + 32;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
tuple ulnWorker::quote(tuple inputs) method_id {
|
|
56
|
+
tuple ulnWorker::quote(tuple inputs) impure method_id {
|
|
57
57
|
cell $myStorage = inputs.cell_at(0);
|
|
58
58
|
cell $priceFeedInfo = inputs.cell_at(1);
|
|
59
59
|
;; cell $path = inputs.cell_at(2);
|
|
@@ -16,7 +16,7 @@ int isV1Eid(int eid) impure inline {
|
|
|
16
16
|
return (eid < 30000);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
(int, int) _decodeOption(int
|
|
19
|
+
(int, int) _decodeOption(int lzComposeBaseGas, cell $options, cell $path) impure inline {
|
|
20
20
|
int totalGas = 0;
|
|
21
21
|
int totalDstAmount = 0;
|
|
22
22
|
|
|
@@ -35,7 +35,7 @@ int isV1Eid(int eid) impure inline {
|
|
|
35
35
|
(lzReceiveValue > 0) & isV1Eid($path.lz::Path::getDstEid())
|
|
36
36
|
);
|
|
37
37
|
|
|
38
|
-
totalGas +=
|
|
38
|
+
totalGas += lzReceiveGas;
|
|
39
39
|
|
|
40
40
|
totalDstAmount += lzReceiveValue + nativeDropAmount;
|
|
41
41
|
|
|
@@ -53,7 +53,7 @@ int isV1Eid(int eid) impure inline {
|
|
|
53
53
|
(lzComposeGas == 0) & (lzComposeValue > 0)
|
|
54
54
|
);
|
|
55
55
|
|
|
56
|
-
totalGas +=
|
|
56
|
+
totalGas += lzReceiveGas;
|
|
57
57
|
|
|
58
58
|
totalDstAmount += lzReceiveValue + nativeDropAmount;
|
|
59
59
|
|
|
@@ -83,7 +83,6 @@ int isV1Eid(int eid) impure inline {
|
|
|
83
83
|
|
|
84
84
|
ifnot ($extraOptions.cl::isNullObject()) {
|
|
85
85
|
(int _totalGas, int _totalDstAmount) = _decodeOption(
|
|
86
|
-
lzReceiveBaseGas,
|
|
87
86
|
lzComposeBaseGas,
|
|
88
87
|
$extraOptions,
|
|
89
88
|
$path
|
|
@@ -95,7 +94,6 @@ int isV1Eid(int eid) impure inline {
|
|
|
95
94
|
|
|
96
95
|
ifnot ($enforcedOptions.cl::isNullObject()) {
|
|
97
96
|
(int _totalGas, int _totalDstAmount) = _decodeOption(
|
|
98
|
-
lzReceiveBaseGas,
|
|
99
97
|
lzComposeBaseGas,
|
|
100
98
|
$enforcedOptions,
|
|
101
99
|
$path
|
|
@@ -104,7 +102,7 @@ int isV1Eid(int eid) impure inline {
|
|
|
104
102
|
totalDstAmount += _totalDstAmount;
|
|
105
103
|
}
|
|
106
104
|
|
|
107
|
-
return (totalGas, totalDstAmount);
|
|
105
|
+
return (totalGas + lzReceiveBaseGas, totalDstAmount);
|
|
108
106
|
}
|
|
109
107
|
|
|
110
108
|
;; current gas consumed: 16276
|
|
@@ -104,14 +104,15 @@ tuple _claimTon(tuple actions, cell $claimTon) impure {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
tuple _claimTonFromProxy(tuple actions, cell $claimTon) impure {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Worker::
|
|
107
|
+
;; event needs to be emitted before the call because call is a terminal action
|
|
108
|
+
actions~pushAction<event>(
|
|
109
|
+
Worker::event::CLAIMED_TON_FROM_PROXY,
|
|
110
110
|
$claimTon
|
|
111
111
|
);
|
|
112
112
|
|
|
113
|
-
actions~pushAction<
|
|
114
|
-
|
|
113
|
+
actions~pushAction<call>(
|
|
114
|
+
getProxyAddress(),
|
|
115
|
+
Worker::OP::CLAIM_TON,
|
|
115
116
|
$claimTon
|
|
116
117
|
);
|
|
117
118
|
|
|
@@ -20,7 +20,7 @@ const int WorkerCoreStorage::version = 2;
|
|
|
20
20
|
;; a context-free way to refer to the two ends of the channel.
|
|
21
21
|
;; The direction is inferred by the context of the contract (send vs receive).
|
|
22
22
|
;; The srcOApp is the 256-bit hashpart of a standard address.
|
|
23
|
-
cell WorkerCoreStorage::New(cell admins, int proxy, int version) inline method_id {
|
|
23
|
+
cell WorkerCoreStorage::New(cell admins, int proxy, int version) impure inline method_id {
|
|
24
24
|
return cl::declare(
|
|
25
25
|
WorkerCoreStorage::NAME,
|
|
26
26
|
unsafeTuple([
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
;;; Encodes [uint256 x1, uint256 x2] into a cell which represents the 64-byte public key
|
|
49
|
-
cell encodePublicKey(int x1, int x2) inline method_id {
|
|
49
|
+
cell encodePublicKey(int x1, int x2) impure inline method_id {
|
|
50
50
|
return begin_cell()
|
|
51
51
|
.store_uint256(x1)
|
|
52
52
|
.store_uint256(x2)
|
|
@@ -385,8 +385,8 @@ tuple setAdmins(cell $addressList) impure inline {
|
|
|
385
385
|
return _setAdmins(emptyActions(), $addressList);
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
-
tuple claimTon(cell $
|
|
389
|
-
return _claimTon(emptyActions(), $
|
|
388
|
+
tuple claimTon(cell $claimTon) impure inline {
|
|
389
|
+
return _claimTon(emptyActions(), $claimTon);
|
|
390
390
|
}
|
|
391
391
|
|
|
392
392
|
tuple claimTonFromProxy(cell $claimTon) impure inline {
|
|
@@ -12,7 +12,7 @@ const int Dvn::setVerifiersNonce = 4;
|
|
|
12
12
|
const int Dvn::setAdminsByQuorumNonce = 5;
|
|
13
13
|
|
|
14
14
|
;; @owner manager
|
|
15
|
-
cell Dvn::New(cell admins, int version, int quorum, cell verifiers) method_id {
|
|
15
|
+
cell Dvn::New(cell admins, int version, int quorum, cell verifiers) impure inline method_id {
|
|
16
16
|
return cl::declare(
|
|
17
17
|
Dvn::NAME,
|
|
18
18
|
unsafeTuple([
|
|
@@ -65,13 +65,25 @@ tuple _executorNativeDrop(tuple actions, cell $mdNativeDrop) impure inline {
|
|
|
65
65
|
tuple _executorLzReceivePrepare(tuple actions, cell $executeParams) impure inline {
|
|
66
66
|
int opcode = $executeParams.md::ExecuteParams::getOpcode();
|
|
67
67
|
throw_unless(
|
|
68
|
-
Worker::ERROR::
|
|
68
|
+
Worker::ERROR::invalidOpcode,
|
|
69
69
|
opcode == Channel::OP::LZ_RECEIVE_PREPARE
|
|
70
70
|
);
|
|
71
71
|
|
|
72
72
|
return _callContract(actions, $executeParams);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
tuple executorCommitPacket(cell $executeParams) impure inline {
|
|
76
|
+
tuple actions = emptyActions();
|
|
77
|
+
int opcode = $executeParams.md::ExecuteParams::getOpcode();
|
|
78
|
+
|
|
79
|
+
throw_unless(
|
|
80
|
+
Worker::ERROR::invalidOpcode,
|
|
81
|
+
opcode == Uln::OP::ULN_COMMIT_PACKET
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
return _callContract(actions, $executeParams);
|
|
85
|
+
}
|
|
86
|
+
|
|
75
87
|
tuple executorNativeDrop(cell $mdNativeDrop) impure inline {
|
|
76
88
|
return _executorNativeDrop(emptyActions(), $mdNativeDrop);
|
|
77
89
|
}
|
|
@@ -84,13 +96,13 @@ tuple executorLzReceivePrepare(cell $executeParams) impure inline {
|
|
|
84
96
|
;; obj: $executeParams for lzReceivePrepare
|
|
85
97
|
tuple executorNativeDropAndLzReceivePrepare(cell $mdObj) impure inline {
|
|
86
98
|
(
|
|
87
|
-
cell $
|
|
99
|
+
cell $executeParams,
|
|
88
100
|
cell $nativeDropMd
|
|
89
101
|
) = $mdObj.md::MdObj::deserialize();
|
|
90
102
|
|
|
91
103
|
return emptyActions()
|
|
92
104
|
._executorNativeDrop($nativeDropMd)
|
|
93
|
-
._executorLzReceivePrepare($
|
|
105
|
+
._executorLzReceivePrepare($executeParams);
|
|
94
106
|
}
|
|
95
107
|
|
|
96
108
|
tuple executorLzReceiveAlert(cell $executeParams) impure inline {
|
|
@@ -98,7 +110,7 @@ tuple executorLzReceiveAlert(cell $executeParams) impure inline {
|
|
|
98
110
|
|
|
99
111
|
int opcode = $executeParams.md::ExecuteParams::getOpcode();
|
|
100
112
|
throw_unless(
|
|
101
|
-
Worker::ERROR::
|
|
113
|
+
Worker::ERROR::invalidOpcode,
|
|
102
114
|
opcode == Channel::OP::EMIT_LZ_RECEIVE_ALERT
|
|
103
115
|
);
|
|
104
116
|
|
|
@@ -6,6 +6,8 @@ const int Executor::OP::NATIVE_DROP = "Executor::OP::NATIVE_DROP"c;
|
|
|
6
6
|
|
|
7
7
|
const int Executor::OP::LZ_RECEIVE_PREPARE = "Executor::OP::LZ_RECEIVE_PREPARE"c;
|
|
8
8
|
|
|
9
|
+
const int Executor::OP::COMMIT_PACKET = "Executor::OP::COMMIT_PACKET"c;
|
|
10
|
+
|
|
9
11
|
;; Native drop a batch of native tokens and execute a packet
|
|
10
12
|
const int Executor::OP::NATIVE_DROP_AND_LZ_RECEIVE_PREPARE = "Executor::OP::NATIVE_DROP_AND_LZ_RECEIVE_PREPARE"c;
|
|
11
13
|
|
|
@@ -8,6 +8,8 @@ tuple _executeOpcode(int op, cell $md) impure inline {
|
|
|
8
8
|
return executorNativeDrop($md);
|
|
9
9
|
} elseif (op == Executor::OP::NATIVE_DROP_AND_LZ_RECEIVE_PREPARE) {
|
|
10
10
|
return executorNativeDropAndLzReceivePrepare($md);
|
|
11
|
+
} elseif (op == Executor::OP::LZ_RECEIVE_PREPARE) {
|
|
12
|
+
return executorLzReceivePrepare($md);
|
|
11
13
|
} elseif (op == Executor::OP::LZ_RECEIVE_ALERT) {
|
|
12
14
|
return executorLzReceiveAlert($md);
|
|
13
15
|
} elseif (op == Worker::OP::SET_ADMINS) {
|
|
@@ -24,6 +26,8 @@ tuple _executeOpcode(int op, cell $md) impure inline {
|
|
|
24
26
|
return emptyActions();
|
|
25
27
|
} elseif (op == Executor::OP::SET_NATIVE_DROP_TOTAL_CAP) {
|
|
26
28
|
return setNativeDropTotalCap($md);
|
|
29
|
+
} elseif (op == Executor::OP::COMMIT_PACKET) {
|
|
30
|
+
return executorCommitPacket($md);
|
|
27
31
|
}
|
|
28
32
|
throw(BaseInterface::ERROR::invalidOpcode);
|
|
29
33
|
return empty_tuple();
|
|
@@ -8,7 +8,7 @@ const int Executor::workerCoreStorage = 0; ;; = WORKER_CORE_STORAGE_IDX
|
|
|
8
8
|
const int Executor::nativeDropTotalCap = 1;
|
|
9
9
|
|
|
10
10
|
;; @owner manager
|
|
11
|
-
cell Executor::New(cell admins, int version, int nativeDropTotalCap) method_id {
|
|
11
|
+
cell Executor::New(cell admins, int version, int nativeDropTotalCap) impure inline method_id {
|
|
12
12
|
return cl::declare(
|
|
13
13
|
Executor::NAME,
|
|
14
14
|
unsafeTuple([
|
|
@@ -7,7 +7,7 @@ const int md::ClaimTon::NAME = "claimTon"u;
|
|
|
7
7
|
const int md::ClaimTon::amount = 0;
|
|
8
8
|
const int md::ClaimTon::target = 1;
|
|
9
9
|
|
|
10
|
-
cell md::ClaimTon::New(int amount, int target) inline method_id {
|
|
10
|
+
cell md::ClaimTon::New(int amount, int target) impure inline method_id {
|
|
11
11
|
return cl::declare(
|
|
12
12
|
md::ClaimTon::NAME,
|
|
13
13
|
unsafeTuple([
|
|
@@ -23,20 +23,20 @@ cell md::ExecuteParams::New(
|
|
|
23
23
|
int expiration,
|
|
24
24
|
int opcode,
|
|
25
25
|
int forwardingAddress
|
|
26
|
-
) method_id {
|
|
26
|
+
) impure inline method_id {
|
|
27
27
|
return cl::declare(
|
|
28
28
|
md::ExecuteParams::NAME,
|
|
29
29
|
unsafeTuple([
|
|
30
|
-
[cl::t::address, target],
|
|
31
|
-
[cl::t::objRef, callData],
|
|
32
|
-
[cl::t::uint64, expiration],
|
|
33
|
-
[cl::t::uint32, opcode],
|
|
30
|
+
[cl::t::address, target], ;; md::ExecuteParams::target
|
|
31
|
+
[cl::t::objRef, callData], ;; md::ExecuteParams::callData
|
|
32
|
+
[cl::t::uint64, expiration], ;; md::ExecuteParams::expiration
|
|
33
|
+
[cl::t::uint32, opcode], ;; md::ExecuteParams::opcode
|
|
34
34
|
[cl::t::address, forwardingAddress] ;; md::ExecuteParams::forwardingAddress
|
|
35
35
|
])
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
;; ========================== Object Builders
|
|
39
|
+
;; ========================== Object Builders===========================w==========
|
|
40
40
|
|
|
41
41
|
const int md::ExecuteParams::_headerInfoBits = _BASIC_HEADER_WIDTH + (_FIELD_INFO_WIDTH * 5);
|
|
42
42
|
const int md::ExecuteParams::_headerFillerBits = _HEADER_WIDTH - md::ExecuteParams::_headerInfoBits;
|
|
@@ -47,7 +47,7 @@ cell md::ExecuteParams::build(
|
|
|
47
47
|
int expiration,
|
|
48
48
|
int opcode,
|
|
49
49
|
int forwardingAddress
|
|
50
|
-
) inline {
|
|
50
|
+
) impure inline {
|
|
51
51
|
return begin_cell()
|
|
52
52
|
.store_uint(593196021158614130743421175296147950525415477349115, md::ExecuteParams::_headerInfoBits)
|
|
53
53
|
.store_ones(md::ExecuteParams::_headerFillerBits)
|
|
@@ -8,7 +8,7 @@ const int md::NativeDrop::payees = 0;
|
|
|
8
8
|
const int md::NativeDrop::packetId = 1;
|
|
9
9
|
const int md::NativeDrop::msglib = 2;
|
|
10
10
|
|
|
11
|
-
cell md::NativeDrop::New(cell payees, cell $packetId, int msglib) inline method_id {
|
|
11
|
+
cell md::NativeDrop::New(cell payees, cell $packetId, int msglib) impure inline method_id {
|
|
12
12
|
return cl::declare(
|
|
13
13
|
md::NativeDrop::NAME,
|
|
14
14
|
unsafeTuple([
|
|
@@ -9,7 +9,7 @@ const int md::SetDict::opcode = 1;
|
|
|
9
9
|
const int md::SetDict::dict = 2;
|
|
10
10
|
const int md::SetDict::target = 3;
|
|
11
11
|
|
|
12
|
-
cell md::SetDict::New(int nonce, int opcode, cell _dict, int target) inline method_id {
|
|
12
|
+
cell md::SetDict::New(int nonce, int opcode, cell _dict, int target) impure inline method_id {
|
|
13
13
|
return cl::declare(
|
|
14
14
|
md::SetDict::NAME,
|
|
15
15
|
unsafeTuple([
|
|
@@ -9,7 +9,7 @@ const int md::SetQuorum::opcode = 1;
|
|
|
9
9
|
const int md::SetQuorum::quorum = 2;
|
|
10
10
|
const int md::SetQuorum::target = 3;
|
|
11
11
|
|
|
12
|
-
cell md::SetQuorum::New(int nonce, int opcode, int quorum, int target) inline method_id {
|
|
12
|
+
cell md::SetQuorum::New(int nonce, int opcode, int quorum, int target) impure inline method_id {
|
|
13
13
|
return cl::declare(
|
|
14
14
|
md::SetQuorum::NAME,
|
|
15
15
|
unsafeTuple([
|
|
@@ -7,7 +7,7 @@ const int md::SignedRequest::NAME = "sgndReq"u;
|
|
|
7
7
|
const int md::SignedRequest::request = 0;
|
|
8
8
|
const int md::SignedRequest::signatures = 1;
|
|
9
9
|
|
|
10
|
-
cell md::SignedRequest::New(cell $request, cell signatures) method_id {
|
|
10
|
+
cell md::SignedRequest::New(cell $request, cell signatures) impure inline method_id {
|
|
11
11
|
return cl::declare(
|
|
12
12
|
md::SignedRequest::NAME,
|
|
13
13
|
unsafeTuple([
|
|
@@ -13,7 +13,7 @@ const int PriceFeedCache::priceFeedFeeLibStorage = 1;
|
|
|
13
13
|
const int PriceFeedCache::dstEid = 2; ;; sharding key, unused in actual logic
|
|
14
14
|
|
|
15
15
|
;; @owner manager
|
|
16
|
-
cell PriceFeedCache::New(cell admins, int version, cell $priceFeedFeeLib, int dstEid) method_id {
|
|
16
|
+
cell PriceFeedCache::New(cell admins, int version, cell $priceFeedFeeLib, int dstEid) impure inline method_id {
|
|
17
17
|
return cl::declare(
|
|
18
18
|
PriceFeedCache::NAME,
|
|
19
19
|
unsafeTuple([
|
|
@@ -11,22 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
;;; ==========================PERMISSION FUNCTIONS=================================
|
|
13
13
|
|
|
14
|
-
() assertLatestAdmin() impure inline {
|
|
15
|
-
throw_unless(
|
|
16
|
-
Proxy::ERROR::NOT_LATEST_ADMIN,
|
|
17
|
-
getCaller() == getLatestAdmin()
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
14
|
;; this is special in proxy, only the people in the address book can call 'callContract'
|
|
22
15
|
() _checkPermissions(int op, cell $md) impure inline {
|
|
23
16
|
if (
|
|
24
|
-
(op == Proxy::OP::CALL_CONTRACT)
|
|
25
|
-
| (op == Proxy::OP::EMIT_EVENT)
|
|
26
|
-
) {
|
|
27
|
-
return assertLatestAdmin();
|
|
28
|
-
} elseif (
|
|
29
17
|
(op == Worker::OP::SET_ADMINS)
|
|
18
|
+
| (op == Proxy::OP::CALL_CONTRACT)
|
|
19
|
+
| (op == Proxy::OP::EMIT_EVENT)
|
|
30
20
|
| (op == Worker::OP::CLAIM_TON)
|
|
31
21
|
| (op == Proxy::OP::TOGGLE_CALLBACK)
|
|
32
22
|
) {
|
|
@@ -10,7 +10,7 @@ const int Proxy::workerCoreStorage = 0; ;; = WORKER_CORE_STORAGE_IDX
|
|
|
10
10
|
const int Proxy::callbackEnabled = 1;
|
|
11
11
|
|
|
12
12
|
;; @owner manager
|
|
13
|
-
cell Proxy::New(cell admins, int version) method_id {
|
|
13
|
+
cell Proxy::New(cell admins, int version) impure inline method_id {
|
|
14
14
|
return cl::declare(
|
|
15
15
|
Proxy::NAME,
|
|
16
16
|
unsafeTuple([
|
|
@@ -70,6 +70,7 @@ cell baseTest::prepare(tuple args) impure {
|
|
|
70
70
|
|
|
71
71
|
;; Check that each action matches the expected action
|
|
72
72
|
int index = 1;
|
|
73
|
+
int terminalActionEncountered = false;
|
|
73
74
|
tuple terminalIndices = empty_tuple();
|
|
74
75
|
while (index < numActions) {
|
|
75
76
|
tuple actualAction = actions.tuple_at(index);
|
|
@@ -79,13 +80,16 @@ cell baseTest::prepare(tuple args) impure {
|
|
|
79
80
|
}
|
|
80
81
|
int actionType = actualAction.int_at(0);
|
|
81
82
|
int equal = false;
|
|
83
|
+
int isCurrentActionTerminal = false;
|
|
82
84
|
|
|
83
85
|
if (actionType == action::deploy::NAME) {
|
|
84
86
|
terminalIndices = terminalIndices.tpush(index);
|
|
85
87
|
equal = action::deploy::equals(actualAction, expectedAction);
|
|
88
|
+
isCurrentActionTerminal = true;
|
|
86
89
|
} elseif (actionType == action::call::NAME) {
|
|
87
90
|
terminalIndices = terminalIndices.tpush(index);
|
|
88
91
|
equal = action::call::equals(actualAction, expectedAction);
|
|
92
|
+
isCurrentActionTerminal = true;
|
|
89
93
|
} elseif (actionType == action::dispatch::NAME) {
|
|
90
94
|
equal = action::dispatch::equals(actualAction, expectedAction);
|
|
91
95
|
} elseif (actionType == action::payment::NAME) {
|
|
@@ -94,13 +98,19 @@ cell baseTest::prepare(tuple args) impure {
|
|
|
94
98
|
equal = action::event::equals(actualAction, expectedAction);
|
|
95
99
|
} elseif (actionType == action::sendJettons::NAME) {
|
|
96
100
|
equal = action::sendJettons::equals(actualAction, expectedAction);
|
|
101
|
+
isCurrentActionTerminal = true;
|
|
97
102
|
} elseif (actionType == action::rawCall::NAME) {
|
|
98
103
|
equal = action::rawCall::equals(actualAction, expectedAction);
|
|
104
|
+
isCurrentActionTerminal = true;
|
|
99
105
|
}
|
|
100
106
|
ifnot (equal) {
|
|
101
107
|
test::throwError("action incorrect: ".str::concatInt(index));
|
|
102
108
|
}
|
|
109
|
+
if (terminalActionEncountered & (~ isCurrentActionTerminal)) {
|
|
110
|
+
test::throwError("terminal before non-terminal: ".str::concatInt(index));
|
|
111
|
+
}
|
|
103
112
|
index += 1;
|
|
113
|
+
terminalActionEncountered = terminalActionEncountered | isCurrentActionTerminal;
|
|
104
114
|
}
|
|
105
115
|
if (terminalIndices.tlen() > 1) {
|
|
106
116
|
test::throwError("Multiple terminal actions");
|
package/src/classes/lz/Worker.fc
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#include "../../funC++/classlib.fc";
|
|
2
|
-
|
|
3
|
-
;; required storage name
|
|
4
|
-
const int lz::Worker::NAME = "Worker"u;
|
|
5
|
-
|
|
6
|
-
;; field names
|
|
7
|
-
const int lz::Worker::owner = 0; ;; key
|
|
8
|
-
;; allowlist of workers who are allowed to view my storage
|
|
9
|
-
const int lz::Worker::viewAllowlist = 1;
|
|
10
|
-
;; list of workers whose storage I depend on
|
|
11
|
-
const int lz::Worker::viewDependencies = 2;
|
|
12
|
-
const int lz::Worker::bytecodeLibrary = 3; ;; library cell
|
|
13
|
-
const int lz::Worker::storage = 4;
|
|
14
|
-
|
|
15
|
-
;; In all blockchains with atomic cross-contract call, we can use src/dst/sender/receiver
|
|
16
|
-
;; because the send channel doesn't exist (it's just a nonce).
|
|
17
|
-
;; In TON, we need both send/receive channels, so we use local/remote to provide
|
|
18
|
-
;; a context-free way to refer to the two ends of the channel.
|
|
19
|
-
;; The direction is inferred by the context of the contract (send vs receive).
|
|
20
|
-
;; The srcOApp is the 256-bit hashpart of a standard address.
|
|
21
|
-
cell lz::Worker::New(int owner, int priceFeedAddress, cell bytecode, cell $storage) inline method_id {
|
|
22
|
-
return cl::declare(
|
|
23
|
-
lz::Worker::NAME,
|
|
24
|
-
unsafeTuple([
|
|
25
|
-
[cl::t::address, owner], ;; lz::Worker::owner
|
|
26
|
-
[cl::t::dict256, cl::dict256::New()], ;; lz::Worker::viewAllowlist
|
|
27
|
-
[cl::t::dict256, cl::dict256::New()], ;; lz::Worker::viewDependencies
|
|
28
|
-
[cl::t::cellRef, bytecode], ;; lz::Worker::bytecodeLibrary
|
|
29
|
-
[cl::t::objRef, $storage] ;; lz::Worker::storage
|
|
30
|
-
])
|
|
31
|
-
);
|
|
32
|
-
}
|