@layerzerolabs/layerzero-v2-ton 3.0.22-ton.2 → 3.0.24
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 +7 -0
- package/build/AllStorages.compiled.json +1 -1
- package/build/AllStorages.test.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/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/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/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/DvnFeeLib.compiled.json +1 -1
- package/build/DvnPermissions.test.compiled.json +1 -1
- package/build/Endpoint.compiled.json +1 -1
- package/build/Endpoint.permissions.test.compiled.json +1 -1
- package/build/Endpoint.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/ExecutorPermissions.test.compiled.json +1 -1
- package/build/LzClasses.test.compiled.json +1 -1
- package/build/LzUtil.test.compiled.json +1 -1
- package/build/MsgData.test.compiled.json +1 -1
- package/build/MsglibPacketCodec.test.compiled.json +1 -1
- package/build/PipelinedOutOfOrder.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 -0
- 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.compiled.json +1 -1
- package/build/SmlConnection.permissions.test.compiled.json +1 -1
- package/build/SmlConnection.test.compiled.json +1 -1
- package/build/SmlManager.compiled.json +1 -1
- package/build/SmlManager.permissions.test.compiled.json +1 -1
- package/build/SmlManager.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/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/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/UlnSendWithDvnFeeLib.test.compiled.json +1 -1
- package/build/UlnSendWithExecFeeLib.test.compiled.json +1 -1
- package/build/UlnSendWorkerFactory.test.compiled.json +1 -1
- package/build/UlnUtil.test.compiled.json +1 -1
- package/build/WorkerCore.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/funC++/classlib.fc +82 -65
- package/src/funC++/dataStructures/AddressList.fc +0 -1
- package/src/protocol/channel/storage.fc +1 -1
- package/src/protocol/endpoint/handler.fc +23 -7
- package/src/protocol/msglibs/ultralightnode/feeLibUtils.fc +2 -1
- package/src/protocol/msglibs/ultralightnode/uln/handler.fc +18 -10
- package/src/protocol/msglibs/ultralightnode/ulnConnection/handler.fc +5 -6
- package/src/protocol/msglibs/ultralightnode/ulnConnection/utils.fc +5 -1
- package/src/protocol/msglibs/ultralightnode/ulnManager/handler.fc +8 -5
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/handler.fc +1 -1
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/executorFeeLib/handler.fc +3 -3
- package/src/workers/core/abstract/workerHandler.fc +1 -1
- package/src/workers/core/interface.fc +2 -2
- package/src/workers/dvn/handler.fc +30 -13
- package/src/workers/dvn/interface.fc +4 -6
- package/src/workers/dvn/storage.fc +6 -6
- package/src/workers/executor/handler.fc +2 -2
- package/src/workers/priceFeedCache/main.fc +1 -1
- package/src/workers/proxy/handler.fc +0 -2
- package/src/workers/msgdata/ProxyMessage.fc +0 -20
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
totalGas += lzComposeGas + lzComposeBaseGas;
|
|
37
37
|
totalDstAmount += lzComposeValue;
|
|
38
38
|
}
|
|
39
|
-
} elseif (cl::
|
|
39
|
+
} elseif (cl::isNullObject($options)) {
|
|
40
40
|
return (0, 0);
|
|
41
41
|
} else {
|
|
42
42
|
throw(UlnWorkerInterface::ERROR::UNKNOWN_OPTIONS);
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
int totalGas = 0;
|
|
55
55
|
int totalDstAmount = 0;
|
|
56
56
|
|
|
57
|
-
ifnot ($extraOptions.cl::
|
|
57
|
+
ifnot ($extraOptions.cl::isNullObject()) {
|
|
58
58
|
(int _totalGas, int _totalDstAmount) = _decodeOption(lzReceiveBaseGas, lzComposeBaseGas, $extraOptions);
|
|
59
59
|
totalGas += _totalGas;
|
|
60
60
|
totalDstAmount += _totalDstAmount;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
ifnot ($enforcedOptions.cl::
|
|
63
|
+
ifnot ($enforcedOptions.cl::isNullObject()) {
|
|
64
64
|
(int _totalGas, int _totalDstAmount) = _decodeOption(lzReceiveBaseGas, lzComposeBaseGas, $enforcedOptions);
|
|
65
65
|
totalGas += _totalGas;
|
|
66
66
|
totalDstAmount += _totalDstAmount;
|
|
@@ -122,7 +122,7 @@ tuple _callViaProxy(tuple actions, cell $executeParams) impure {
|
|
|
122
122
|
;; only these opcodes are allowed to be called from the worker to the proxy
|
|
123
123
|
int opcode = $executeParams.cl::get<uint32>(md::ExecuteParams::opcode);
|
|
124
124
|
throw_unless(
|
|
125
|
-
Worker::ERROR::
|
|
125
|
+
Worker::ERROR::invalidSignedOpcode,
|
|
126
126
|
(opcode == Uln::OP::UPDATE_WORKER_FEELIB)
|
|
127
127
|
| (opcode == Uln::OP::DEREGISTER_WORKER_FEELIB)
|
|
128
128
|
| (opcode == UlnManager::OP::ADD_ULN_WORKER)
|
|
@@ -18,8 +18,8 @@ const int Worker::OP::SET_ADMINS = "Worker::OP::SET_ADMINS"c;
|
|
|
18
18
|
const int Worker::ERROR::onlyAdmin = 2015;
|
|
19
19
|
const int Worker::ERROR::invalidOpcode = 2014;
|
|
20
20
|
|
|
21
|
-
const int Worker::ERROR::
|
|
22
|
-
const int Worker::ERROR::
|
|
21
|
+
const int Worker::ERROR::invalidSignedOpcode = 2013;
|
|
22
|
+
const int Worker::ERROR::invalidInnerTarget = 2012;
|
|
23
23
|
|
|
24
24
|
;;; ==========================EVENTS=====================================
|
|
25
25
|
const int Worker::event::ADMINS_SET = "Worker::event::ADMINS_SET"u;
|
|
@@ -106,6 +106,7 @@ tuple _verifySignatures(tuple actions, int hash, cell signatures, cell verifiers
|
|
|
106
106
|
| (op == Worker::OP::SET_PROXY)
|
|
107
107
|
| (op == Worker::OP::CLAIM_TON)
|
|
108
108
|
| (op == Worker::OP::CALL_VIA_PROXY)
|
|
109
|
+
| (op == Dvn::OP::SET_PROXY_ADMINS)
|
|
109
110
|
) {
|
|
110
111
|
return assertAdmin();
|
|
111
112
|
} elseif (op == Proxy::OP::HANDLE_CALLBACK) {
|
|
@@ -120,17 +121,23 @@ tuple setVerifiers(cell $signedRequest) impure {
|
|
|
120
121
|
(cell $storage, tuple actions) = preamble();
|
|
121
122
|
|
|
122
123
|
cell $setDict = $signedRequest.cl::get<objRef>(md::SignedRequest::request);
|
|
124
|
+
cell $newVerifiers = $setDict.cl::get<dict256>(md::SetDict::dict);
|
|
125
|
+
|
|
126
|
+
throw_if(
|
|
127
|
+
Dvn::ERROR::invalidVerifiers,
|
|
128
|
+
cl::dict256::size($newVerifiers) < 1
|
|
129
|
+
);
|
|
123
130
|
|
|
124
131
|
int incomingNonce = $setDict.cl::get<uint64>(md::SetDict::nonce);
|
|
125
132
|
|
|
126
133
|
throw_if(
|
|
127
|
-
Dvn::ERROR::
|
|
134
|
+
Dvn::ERROR::invalidRequestNonce,
|
|
128
135
|
incomingNonce != $storage.cl::get<uint64>(Dvn::setVerifiersNonce)
|
|
129
136
|
);
|
|
130
137
|
|
|
131
138
|
int opcode = $setDict.cl::get<uint64>(md::SetDict::opcode);
|
|
132
139
|
throw_if(
|
|
133
|
-
|
|
140
|
+
Worker::ERROR::invalidSignedOpcode,
|
|
134
141
|
opcode != Dvn::OP::SET_VERIFIERS
|
|
135
142
|
);
|
|
136
143
|
|
|
@@ -144,10 +151,7 @@ tuple setVerifiers(cell $signedRequest) impure {
|
|
|
144
151
|
|
|
145
152
|
setContractStorage(
|
|
146
153
|
$storage
|
|
147
|
-
.cl::set(
|
|
148
|
-
Dvn::verifiers,
|
|
149
|
-
$setDict.cl::get<dict256>(md::SetDict::dict)
|
|
150
|
-
)
|
|
154
|
+
.cl::set(Dvn::verifiers, $newVerifiers)
|
|
151
155
|
.cl::set(Dvn::setVerifiersNonce, incomingNonce + 1)
|
|
152
156
|
);
|
|
153
157
|
|
|
@@ -164,21 +168,22 @@ tuple setQuorum(cell $signedRequest) impure {
|
|
|
164
168
|
int incomingNonce = $setQuorum.cl::get<uint64>(md::SetQuorum::nonce);
|
|
165
169
|
|
|
166
170
|
throw_if(
|
|
167
|
-
Dvn::ERROR::
|
|
171
|
+
Dvn::ERROR::invalidRequestNonce,
|
|
168
172
|
incomingNonce != $storage.cl::get<uint64>(Dvn::setQuorumNonce)
|
|
169
173
|
);
|
|
170
174
|
|
|
171
175
|
int opcode = $setQuorum.cl::get<uint64>(md::SetQuorum::opcode);
|
|
172
176
|
throw_if(
|
|
173
|
-
|
|
177
|
+
Worker::ERROR::invalidSignedOpcode,
|
|
174
178
|
opcode != Dvn::OP::SET_QUORUM
|
|
175
179
|
);
|
|
176
180
|
|
|
177
181
|
int newQuorum = $setQuorum.cl::get<uint64>(md::SetQuorum::quorum);
|
|
182
|
+
cell $verifiers = $storage.cl::get<dict256>(Dvn::verifiers);
|
|
178
183
|
|
|
179
184
|
throw_if(
|
|
180
185
|
Dvn::ERROR::invalidQuorum,
|
|
181
|
-
newQuorum < 1
|
|
186
|
+
(newQuorum < 1) | (newQuorum > cl::dict256::size($verifiers))
|
|
182
187
|
);
|
|
183
188
|
|
|
184
189
|
actions = _verifySignatures(
|
|
@@ -208,13 +213,13 @@ tuple setAdminsByQuorum(cell $signedRequest) impure {
|
|
|
208
213
|
int incomingNonce = $setDict.cl::get<uint64>(md::SetDict::nonce);
|
|
209
214
|
|
|
210
215
|
throw_if(
|
|
211
|
-
Dvn::ERROR::
|
|
216
|
+
Dvn::ERROR::invalidRequestNonce,
|
|
212
217
|
incomingNonce != $storage.cl::get<uint64>(Dvn::setAdminsByQuorumNonce)
|
|
213
218
|
);
|
|
214
219
|
|
|
215
220
|
int opcode = $setDict.cl::get<uint64>(md::SetDict::opcode);
|
|
216
221
|
throw_if(
|
|
217
|
-
|
|
222
|
+
Worker::ERROR::invalidSignedOpcode,
|
|
218
223
|
opcode != Dvn::OP::SET_ADMINS_BY_QUORUM
|
|
219
224
|
);
|
|
220
225
|
|
|
@@ -256,7 +261,7 @@ tuple verify(cell $signedRequest) impure inline {
|
|
|
256
261
|
|
|
257
262
|
int opcode = $executeParams.cl::get<uint32>(md::ExecuteParams::opcode);
|
|
258
263
|
throw_if(
|
|
259
|
-
|
|
264
|
+
Worker::ERROR::invalidSignedOpcode,
|
|
260
265
|
opcode != Uln::OP::ULN_VERIFY
|
|
261
266
|
);
|
|
262
267
|
|
|
@@ -297,10 +302,22 @@ tuple setProxyAdmins(cell $signedRequest) impure inline {
|
|
|
297
302
|
|
|
298
303
|
int opcode = $executeParams.cl::get<uint32>(md::ExecuteParams::opcode);
|
|
299
304
|
throw_if(
|
|
300
|
-
|
|
305
|
+
Worker::ERROR::invalidSignedOpcode,
|
|
301
306
|
opcode != Worker::OP::SET_ADMINS
|
|
302
307
|
);
|
|
303
308
|
|
|
309
|
+
int target = $executeParams.cl::get<address>(md::ExecuteParams::target);
|
|
310
|
+
throw_if(
|
|
311
|
+
Worker::ERROR::invalidInnerTarget,
|
|
312
|
+
target != getProxyAddress()
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
cell $newAdminList = $executeParams.cl::get<objRef>(md::ExecuteParams::callData);
|
|
316
|
+
throw_if(
|
|
317
|
+
Dvn::ERROR::invalidProxyAdmins,
|
|
318
|
+
AddressList::length($newAdminList) != 1
|
|
319
|
+
);
|
|
320
|
+
|
|
304
321
|
actions = _verifySignatures(
|
|
305
322
|
actions,
|
|
306
323
|
$executeParams.cl::hash(),
|
|
@@ -10,12 +10,10 @@ const int Dvn::OP::SET_PROXY_ADMINS = "Dvn::OP::SET_PROXY_ADMINS"c;
|
|
|
10
10
|
const int Dvn::ERROR::expired = 1983;
|
|
11
11
|
const int Dvn::ERROR::quorumNotMet = 1982;
|
|
12
12
|
const int Dvn::ERROR::notEnoughSignatures = 1981;
|
|
13
|
-
const int Dvn::ERROR::
|
|
14
|
-
const int Dvn::ERROR::
|
|
15
|
-
const int Dvn::ERROR::
|
|
16
|
-
|
|
17
|
-
const int Dvn::ERROR::invalidsetVerifiersNonce = 1977;
|
|
18
|
-
const int Dvn::ERROR::invalidSignedOpcode = 1976;
|
|
13
|
+
const int Dvn::ERROR::invalidQuorum = 1980;
|
|
14
|
+
const int Dvn::ERROR::invalidRequestNonce = 1979;
|
|
15
|
+
const int Dvn::ERROR::invalidVerifiers = 1978;
|
|
16
|
+
const int Dvn::ERROR::invalidProxyAdmins = 1977;
|
|
19
17
|
|
|
20
18
|
;;; ==========================EVENTS=====================================
|
|
21
19
|
const int Dvn::event::INVALID_SIGNATURE = "Dvn::event::INVALID_SIGNATURE"u;
|
|
@@ -16,12 +16,12 @@ cell Dvn::New(cell admins, int version, int quorum, cell verifiers) method_id {
|
|
|
16
16
|
return cl::declare(
|
|
17
17
|
Dvn::NAME,
|
|
18
18
|
unsafeTuple([
|
|
19
|
-
[cl::t::objRef, WorkerCoreStorage::New(admins, NULLADDRESS, version)],
|
|
20
|
-
[cl::t::uint64, quorum],
|
|
21
|
-
[cl::t::dict256, verifiers],
|
|
22
|
-
[cl::t::uint64, 1],
|
|
23
|
-
[cl::t::uint64, 1],
|
|
24
|
-
[cl::t::uint64, 1]
|
|
19
|
+
[cl::t::objRef, WorkerCoreStorage::New(admins, NULLADDRESS, version)], ;; Dvn::workerCoreStorage
|
|
20
|
+
[cl::t::uint64, quorum], ;; Dvn::quorum
|
|
21
|
+
[cl::t::dict256, verifiers], ;; Dvn::verifiers
|
|
22
|
+
[cl::t::uint64, 1], ;; Dvn::setQuorumNonce
|
|
23
|
+
[cl::t::uint64, 1], ;; Dvn::setVerifiersNonce
|
|
24
|
+
[cl::t::uint64, 1] ;; Dvn::setAdminsByQuorumNonce
|
|
25
25
|
])
|
|
26
26
|
);
|
|
27
27
|
}
|
|
@@ -55,7 +55,7 @@ tuple _executorNativeDrop(tuple actions, cell $mdNativeDrop) impure inline {
|
|
|
55
55
|
tuple _executorLzReceivePrepare(tuple actions, cell $executeParams) impure inline {
|
|
56
56
|
int opcode = $executeParams.cl::get<uint32>(md::ExecuteParams::opcode);
|
|
57
57
|
throw_unless(
|
|
58
|
-
Worker::ERROR::
|
|
58
|
+
Worker::ERROR::invalidSignedOpcode,
|
|
59
59
|
opcode == Channel::OP::LZ_RECEIVE_PREPARE
|
|
60
60
|
);
|
|
61
61
|
|
|
@@ -83,7 +83,7 @@ tuple executorLzReceiveAlert(cell $executeParams) impure inline {
|
|
|
83
83
|
|
|
84
84
|
int opcode = $executeParams.cl::get<uint32>(md::ExecuteParams::opcode);
|
|
85
85
|
throw_unless(
|
|
86
|
-
Worker::ERROR::
|
|
86
|
+
Worker::ERROR::invalidSignedOpcode,
|
|
87
87
|
opcode == Channel::OP::EMIT_LZ_RECEIVE_ALERT
|
|
88
88
|
);
|
|
89
89
|
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#include "../../funC++/classlib.fc";
|
|
2
|
-
|
|
3
|
-
;; required storage name
|
|
4
|
-
const int md::ProxyMessage::NAME = "ProxyMsg"u;
|
|
5
|
-
|
|
6
|
-
;; field names
|
|
7
|
-
const int md::ProxyMessage::destination = 0;
|
|
8
|
-
const int md::ProxyMessage::opcode = 1;
|
|
9
|
-
const int md::ProxyMessage::data = 2;
|
|
10
|
-
|
|
11
|
-
cell md::ProxyMessage::New(int destination, int opcode, cell data) method_id {
|
|
12
|
-
return cl::declare(
|
|
13
|
-
md::ProxyMessage::NAME,
|
|
14
|
-
unsafeTuple([
|
|
15
|
-
[cl::t::address, destination], ;; md::ProxyMessage::destination
|
|
16
|
-
[cl::t::uint32, opcode], ;; md::ProxyMessage::opcode
|
|
17
|
-
[cl::t::dict256, data] ;; md::ProxyMessage::data
|
|
18
|
-
])
|
|
19
|
-
);
|
|
20
|
-
}
|