@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
|
@@ -10,7 +10,7 @@ const int DeterministicInsertionCircularQueue::invalidKey = -1;
|
|
|
10
10
|
const int DeterministicInsertionCircularQueue::invalidStatus = -1;
|
|
11
11
|
const int DeterministicInsertionCircularQueue::ERROR::invalidObject = 1185;
|
|
12
12
|
|
|
13
|
-
cell DeterministicInsertionCircularQueue::_buildLevel(int level, cell initialContents) inline {
|
|
13
|
+
cell DeterministicInsertionCircularQueue::_buildLevel(int level, cell initialContents) impure inline {
|
|
14
14
|
if (level == 0) {
|
|
15
15
|
return begin_cell()
|
|
16
16
|
.store_ref(initialContents)
|
|
@@ -32,7 +32,7 @@ cell DeterministicInsertionCircularQueue::_buildLevel(int level, cell initialCon
|
|
|
32
32
|
;; Given a well-formed commit_verification_queue
|
|
33
33
|
;; get the content of the queue at a given relative nonce
|
|
34
34
|
;; (actual key, entry, status, exists)
|
|
35
|
-
(int, cell, int, int) DeterministicInsertionCircularQueue::get(cell self, int key) inline {
|
|
35
|
+
(int, cell, int, int) DeterministicInsertionCircularQueue::get(cell self, int key) impure inline {
|
|
36
36
|
int position = key % MAX_CELL_BITS;
|
|
37
37
|
|
|
38
38
|
slice commitSlice = self
|
|
@@ -67,7 +67,7 @@ cell DeterministicInsertionCircularQueue::_buildLevel(int level, cell initialCon
|
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
cell DeterministicInsertionCircularQueue::_setRaw(cell self, int key, cell newLeaf) inline {
|
|
70
|
+
cell DeterministicInsertionCircularQueue::_setRaw(cell self, int key, cell newLeaf) impure inline {
|
|
71
71
|
int slot = key % MAX_CELL_BITS;
|
|
72
72
|
slice queueSlice = self.begin_parse();
|
|
73
73
|
int l0_idx = slot / 256;
|
|
@@ -115,7 +115,7 @@ cell DeterministicInsertionCircularQueue::_setRaw(cell self, int key, cell newLe
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
;; self
|
|
118
|
-
cell DeterministicInsertionCircularQueue::set(cell self, int key, cell $obj, int newState) inline {
|
|
118
|
+
cell DeterministicInsertionCircularQueue::set(cell self, int key, cell $obj, int newState) impure inline {
|
|
119
119
|
return DeterministicInsertionCircularQueue::_setRaw(
|
|
120
120
|
self,
|
|
121
121
|
key,
|
|
@@ -128,7 +128,7 @@ cell DeterministicInsertionCircularQueue::set(cell self, int key, cell $obj, int
|
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
cell DeterministicInsertionCircularQueue::delete(cell self, int key) inline {
|
|
131
|
+
cell DeterministicInsertionCircularQueue::delete(cell self, int key) impure inline {
|
|
132
132
|
return DeterministicInsertionCircularQueue::_setRaw(
|
|
133
133
|
self,
|
|
134
134
|
key,
|
|
@@ -141,7 +141,7 @@ cell DeterministicInsertionCircularQueue::delete(cell self, int key) inline {
|
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
cell DeterministicInsertionCircularQueue::create() method_id {
|
|
144
|
+
cell DeterministicInsertionCircularQueue::create() impure method_id {
|
|
145
145
|
;; ceil(log4(MAX_CELL_BITS)) == 4
|
|
146
146
|
;; build the initial contents of each leaf in the outer scope to save gas
|
|
147
147
|
cell initialContents = begin_cell()
|
package/src/funC++/stringlib.fc
CHANGED
|
@@ -7,26 +7,26 @@ const int ASCII_ZERO = 48;
|
|
|
7
7
|
const int ASCII_MASK = 0x1313131313131313131313131313131313131313131313131313131313131313;
|
|
8
8
|
const int ASCII_A = 65;
|
|
9
9
|
|
|
10
|
-
slice str::asciiUint256ToStr(int asciiUint256) {
|
|
10
|
+
slice str::asciiUint256ToStr(int asciiUint256) impure {
|
|
11
11
|
int leading_zeroes = _SDCNTLEAD0(begin_cell().store_uint256(asciiUint256).end_cell().begin_parse());
|
|
12
12
|
int trailing_bits = 256 - leading_zeroes;
|
|
13
13
|
int mask = POW2(trailing_bits) - 1;
|
|
14
14
|
return begin_cell().store_uint256(asciiUint256 | (ASCII_MASK & (~ mask))).end_cell().begin_parse();
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
(slice, ()) ~str::concat(slice self, slice other) {
|
|
17
|
+
(slice, ()) ~str::concat(slice self, slice other) impure {
|
|
18
18
|
if(self.slice_bits() + other.slice_bits() > 127 * MAX_U8) {
|
|
19
19
|
throwError("Cannot concatenate: string too long");
|
|
20
20
|
}
|
|
21
21
|
return (begin_cell().store_slice(self).store_slice(other).end_cell().begin_parse(), ());
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
slice str::concat(slice self, slice other) {
|
|
24
|
+
slice str::concat(slice self, slice other) impure {
|
|
25
25
|
self~str::concat(other);
|
|
26
26
|
return self;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
(slice, ()) ~str::concatInt(slice self, int val) {
|
|
29
|
+
(slice, ()) ~str::concatInt(slice self, int val) impure {
|
|
30
30
|
slice intSlice = empty_slice();
|
|
31
31
|
if (val < 0) {
|
|
32
32
|
self~str::concat("-");
|
|
@@ -42,12 +42,12 @@ slice str::concat(slice self, slice other) {
|
|
|
42
42
|
return (self.str::concat(intSlice), ());
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
slice str::concatInt(slice self, int val) {
|
|
45
|
+
slice str::concatInt(slice self, int val) impure {
|
|
46
46
|
self~str::concatInt(val);
|
|
47
47
|
return self;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
(slice, ()) ~str::concatHex(slice self, int val) {
|
|
50
|
+
(slice, ()) ~str::concatHex(slice self, int val) impure {
|
|
51
51
|
slice hexSlice = empty_slice();
|
|
52
52
|
if (val == 0) {
|
|
53
53
|
hexSlice~str::concat(begin_cell().store_uint8(ASCII_ZERO).end_cell().begin_parse());
|
|
@@ -63,7 +63,7 @@ slice str::concatInt(slice self, int val) {
|
|
|
63
63
|
return (self.str::concat(hexSlice), ());
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
slice str::concatHex(slice self, int val) {
|
|
66
|
+
slice str::concatHex(slice self, int val) impure {
|
|
67
67
|
self~str::concatHex(val);
|
|
68
68
|
return self;
|
|
69
69
|
}
|
package/src/funC++/txnContext.fc
CHANGED
|
@@ -15,39 +15,39 @@ const int _ORIGIN = 9;
|
|
|
15
15
|
const int _DONATION_NANOS = 10;
|
|
16
16
|
const int _MD = 11;
|
|
17
17
|
|
|
18
|
-
int getMsgValue() inline {
|
|
18
|
+
int getMsgValue() impure inline {
|
|
19
19
|
return txnContext.int_at(_MSG_VALUE);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
int getOpcode() inline {
|
|
22
|
+
int getOpcode() impure inline {
|
|
23
23
|
return txnContext.int_at(_OPCODE);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
int txnIsBounced() inline {
|
|
26
|
+
int txnIsBounced() impure inline {
|
|
27
27
|
return txnContext.int_at(_IS_BOUNCED);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
int getContractBalance() inline {
|
|
30
|
+
int getContractBalance() impure inline {
|
|
31
31
|
return txnContext.int_at(_BALANCE);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
int getInitialContractBalance() inline {
|
|
34
|
+
int getInitialContractBalance() impure inline {
|
|
35
35
|
return getContractBalance() - getMsgValue();
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
int getCaller() inline {
|
|
38
|
+
int getCaller() impure inline {
|
|
39
39
|
return txnContext.int_at(_CALLER);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
int getOrigin() inline {
|
|
42
|
+
int getOrigin() impure inline {
|
|
43
43
|
return txnContext.int_at(_ORIGIN);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
slice getOriginStd() inline {
|
|
46
|
+
slice getOriginStd() impure inline {
|
|
47
47
|
return hashpartToBasechainAddressStd(getOrigin());
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
int getDonationNanos() inline {
|
|
50
|
+
int getDonationNanos() impure inline {
|
|
51
51
|
return txnContext.int_at(_DONATION_NANOS);
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -55,7 +55,7 @@ int getDonationNanos() inline {
|
|
|
55
55
|
txnContext~tset(_DONATION_NANOS, nanos);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
cell getMsgData() inline {
|
|
58
|
+
cell getMsgData() impure inline {
|
|
59
59
|
return txnContext.cell_at(_MD);
|
|
60
60
|
}
|
|
61
61
|
|
package/src/funC++/utils.fc
CHANGED
|
@@ -47,7 +47,7 @@ forall X -> (tuple, X) tpop(tuple t) asm "TPOP";
|
|
|
47
47
|
int tlen(tuple t) asm "TLEN";
|
|
48
48
|
int keccak256Builder(builder b) asm "1 PUSHINT HASHEXT_KECCAK256";
|
|
49
49
|
|
|
50
|
-
int cell_is_empty(cell c) inline {
|
|
50
|
+
int cell_is_empty(cell c) impure inline {
|
|
51
51
|
return c.cell_hash() == 68134197439415885698044414435951397869210496020759160419881882418413283430343;
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -92,7 +92,7 @@ int POW2(int y) asm "POW2";
|
|
|
92
92
|
return (cellsCount, bitsCount);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
int calculateStorageFees(int cellsCount, int bitsCount, int timeDelta) inline {
|
|
95
|
+
int calculateStorageFees(int cellsCount, int bitsCount, int timeDelta) impure inline {
|
|
96
96
|
return get_storage_fee(BASECHAIN, timeDelta, bitsCount, cellsCount);
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -124,7 +124,7 @@ int treeShapeEqual(cell lhs, cell rhs) inline {
|
|
|
124
124
|
|
|
125
125
|
int _globvarIsNull(int idx) impure asm "GETGLOBVAR ISNULL";
|
|
126
126
|
|
|
127
|
-
int _gasToNanoton(int gas) inline {
|
|
127
|
+
int _gasToNanoton(int gas) impure inline {
|
|
128
128
|
return get_compute_fee(false, gas);
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -188,13 +188,13 @@ int _gasToNanoton(int gas) inline {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
;;; ====================== Address functions ======================
|
|
191
|
-
int basechainAddressStdToHashpart(slice full_address) inline {
|
|
191
|
+
int basechainAddressStdToHashpart(slice full_address) impure inline {
|
|
192
192
|
(int wc, int hp) = parseStdAddress(full_address);
|
|
193
193
|
throw_if(ERROR::WrongWorkchain, wc != BASECHAIN);
|
|
194
194
|
return hp;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
slice hashpartToBasechainAddressStd(int hashpart) inline {
|
|
197
|
+
slice hashpartToBasechainAddressStd(int hashpart) impure inline {
|
|
198
198
|
return begin_cell()
|
|
199
199
|
.store_uint(4, 3) ;; 0b100
|
|
200
200
|
.store_int(BASECHAIN, 8)
|
|
@@ -51,11 +51,11 @@ int _getEventSink() inline {
|
|
|
51
51
|
;; that stores a mapping from requestId => hash of LzSend object.
|
|
52
52
|
;; {_build, _read}SendRequestQueueEntry functions are helper functions that
|
|
53
53
|
;; serialize and deserialize the 256-bit hash that is stored in the DICQueue
|
|
54
|
-
cell _buildSendRequestQueueEntry(cell $lzSend) inline method_id {
|
|
54
|
+
cell _buildSendRequestQueueEntry(cell $lzSend) impure inline method_id {
|
|
55
55
|
return begin_cell().store_uint256($lzSend.cl::hash()).end_cell();
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
int _readSendRequestQueueEntry(cell contents) inline method_id {
|
|
58
|
+
int _readSendRequestQueueEntry(cell contents) impure inline method_id {
|
|
59
59
|
if (contents.is_null()) {
|
|
60
60
|
return 0;
|
|
61
61
|
} elseif (contents.cell_is_empty()) {
|
|
@@ -857,7 +857,7 @@ tuple lzReceiveExecuteCallback(cell $lzReceiveStatus) impure inline method_id {
|
|
|
857
857
|
$mockPacket,
|
|
858
858
|
$mockEpConfigDefaults, ;; this is completely ignored if useDefaults is false
|
|
859
859
|
$epConfigOApp.cl::get<bool>(lz::EpConfig::isNull)
|
|
860
|
-
? $mockEpConfigDefaults.cl::get<address>(lz::
|
|
860
|
+
? $mockEpConfigDefaults.cl::get<address>(lz::ReceiveEpConfig::receiveMsglibConnection)
|
|
861
861
|
: $epConfigOApp.cl::get<address>(lz::EpConfig::receiveMsglibConnection)
|
|
862
862
|
)
|
|
863
863
|
);
|
|
@@ -35,7 +35,7 @@ const int Channel::executionQueue = 9;
|
|
|
35
35
|
const int Channel::zroBalance = 10;
|
|
36
36
|
|
|
37
37
|
;; @owner manager
|
|
38
|
-
cell Channel::New(int owner, cell $path, int endpointAddress) inline method_id {
|
|
38
|
+
cell Channel::New(int owner, cell $path, int endpointAddress) impure inline method_id {
|
|
39
39
|
return cl::declare(
|
|
40
40
|
Channel::NAME,
|
|
41
41
|
unsafeTuple([
|
|
@@ -234,6 +234,8 @@ tuple deployChannel(cell $deploy) impure inline method_id {
|
|
|
234
234
|
tuple setEpConfigDefaults(cell $mdEid) impure inline method_id {
|
|
235
235
|
(_, tuple actions) = preamble();
|
|
236
236
|
|
|
237
|
+
$mdEid = $mdEid.md::MdEid::sanitize();
|
|
238
|
+
|
|
237
239
|
int dstEid = $mdEid.cl::get<uint32>(md::MdEid::eid);
|
|
238
240
|
cell $sanitizedSetEpConfig = $mdEid.cl::get<objRef>(md::MdEid::md).md::SetEpConfig::sanitize();
|
|
239
241
|
|
|
@@ -16,7 +16,7 @@ const int Controller::zroWallet = 4;
|
|
|
16
16
|
const int Controller::tentativeOwner = 5;
|
|
17
17
|
|
|
18
18
|
;; @owner Protocol admin EOA
|
|
19
|
-
cell Controller::New(int owner, int eid, cell endpointCode, cell channelCode) method_id {
|
|
19
|
+
cell Controller::New(int owner, int eid, cell endpointCode, cell channelCode) impure method_id {
|
|
20
20
|
return cl::declare(
|
|
21
21
|
Controller::NAME,
|
|
22
22
|
unsafeTuple([
|
|
@@ -20,7 +20,7 @@ const int BaseStorage::initialStorage = 3;
|
|
|
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 BaseStorage::New(int owner) inline method_id {
|
|
23
|
+
cell BaseStorage::New(int owner) impure inline method_id {
|
|
24
24
|
return cl::declare(
|
|
25
25
|
BaseStorage::NAME,
|
|
26
26
|
unsafeTuple([
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
;; Derive the channel address for a given path
|
|
59
|
-
int _getChannelAddress(cell $storage, cell $path) inline method_id {
|
|
59
|
+
int _getChannelAddress(cell $storage, cell $path) impure inline method_id {
|
|
60
60
|
return computeContractAddress(
|
|
61
61
|
$storage
|
|
62
62
|
.Endpoint::getChannelStorageInit()
|
|
@@ -74,7 +74,7 @@ int _getChannelAddressUnpacked(cell $channelStorage, cell channelCode, cell $pat
|
|
|
74
74
|
|
|
75
75
|
;; resolve manager addresses into msglib addresses
|
|
76
76
|
;; throws if the msglib manager is not registered or resolved
|
|
77
|
-
cell _getEpConfigFromManagerAddresses(cell $setEpConfigMd, cell $path) inline method_id {
|
|
77
|
+
cell _getEpConfigFromManagerAddresses(cell $setEpConfigMd, cell $path) impure inline method_id {
|
|
78
78
|
int sendMsglibManager = $setEpConfigMd.cl::get<address>(md::SetEpConfig::sendMsglibManager);
|
|
79
79
|
(int sendMsglib, int sendMsglibConnection) = _msglibManagerToShards(
|
|
80
80
|
sendMsglibManager,
|
|
@@ -122,7 +122,7 @@ cell _getEpConfigFromManagerAddresses(cell $setEpConfigMd, cell $path) inline me
|
|
|
122
122
|
);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
(int, int) getSendMsglibAndConnectionDefaults(cell $storage, cell $path) inline method_id {
|
|
125
|
+
(int, int) getSendMsglibAndConnectionDefaults(cell $storage, cell $path) impure inline method_id {
|
|
126
126
|
return _getMsglibAndConnectionDefaults(
|
|
127
127
|
$storage.Endpoint::getDefaultSendLibInfo(),
|
|
128
128
|
$path
|
|
@@ -136,7 +136,7 @@ cell _getEpConfigFromManagerAddresses(cell $setEpConfigMd, cell $path) inline me
|
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
(int, int) getTimeoutReceiveMsglibAndConnectionDefaults(cell $storage, cell $path) inline method_id {
|
|
139
|
+
(int, int) getTimeoutReceiveMsglibAndConnectionDefaults(cell $storage, cell $path) impure inline method_id {
|
|
140
140
|
return _getMsglibAndConnectionDefaults(
|
|
141
141
|
$storage.Endpoint::getDefaultTimeoutReceiveLibInfo(),
|
|
142
142
|
$path
|
|
@@ -5,7 +5,7 @@ const int BytesDecoder::ERROR::malformedOptions = 1122;
|
|
|
5
5
|
const int BytesDecoder::ERROR::malformedArray = 1123;
|
|
6
6
|
|
|
7
7
|
;; n_bytes should be <= 32
|
|
8
|
-
(slice, int) BytesDecoder::loadBytes(slice decoder, int nBytes) inline method_id {
|
|
8
|
+
(slice, int) BytesDecoder::loadBytes(slice decoder, int nBytes) impure inline method_id {
|
|
9
9
|
int sliceBits = decoder.slice_bits();
|
|
10
10
|
if ((decoder.slice_refs() > 1) | (sliceBits % 8 != 0)) {
|
|
11
11
|
throw(BytesDecoder::ERROR::malformedOptions);
|
|
@@ -79,7 +79,7 @@ cell BytesDecoder::compactRemainder(slice data) impure inline {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
;; returns (optionType, option, optionsTail)
|
|
82
|
-
(int, cell, cell) BytesDecoder::nextOption(cell options) inline {
|
|
82
|
+
(int, cell, cell) BytesDecoder::nextOption(cell options) impure inline {
|
|
83
83
|
slice parsingOptions = options.begin_parse();
|
|
84
84
|
(parsingOptions, int executorId) = BytesDecoder::loadBytes(parsingOptions, 1);
|
|
85
85
|
(parsingOptions, int optionSizeInBytes) = BytesDecoder::loadBytes(parsingOptions, 2);
|
|
@@ -93,7 +93,7 @@ cell BytesDecoder::compactRemainder(slice data) impure inline {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
;; (gas, value)
|
|
96
|
-
(int, int) BytesDecoder::decode<LzReceiveOption>(cell option) inline {
|
|
96
|
+
(int, int) BytesDecoder::decode<LzReceiveOption>(cell option) impure inline {
|
|
97
97
|
slice optionSlice = option.begin_parse();
|
|
98
98
|
int optionSizeInBytes = optionSlice.slice_bits() / 8;
|
|
99
99
|
if ((optionSizeInBytes != 16) & (optionSizeInBytes != 32)) {
|
|
@@ -106,7 +106,7 @@ cell BytesDecoder::compactRemainder(slice data) impure inline {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
;; (amount, receiver)
|
|
109
|
-
(int, int) BytesDecoder::decode<NativeDropOption>(cell option) inline {
|
|
109
|
+
(int, int) BytesDecoder::decode<NativeDropOption>(cell option) impure inline {
|
|
110
110
|
slice parsingOption = option.begin_parse();
|
|
111
111
|
int optionBytes = parsingOption.slice_bits() * 8;
|
|
112
112
|
throw_unless(BytesDecoder::ERROR::invalidOptionSize, optionBytes == (32 + 16));
|
|
@@ -117,7 +117,7 @@ cell BytesDecoder::compactRemainder(slice data) impure inline {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
;; returns lz::Packet
|
|
120
|
-
cell BytesDecoder::decode<PacketV1>(cell encodedPacket) inline method_id {
|
|
120
|
+
cell BytesDecoder::decode<PacketV1>(cell encodedPacket) impure inline method_id {
|
|
121
121
|
slice parsingPacket = encodedPacket.begin_parse();
|
|
122
122
|
(parsingPacket, int packetVersion) = BytesDecoder::loadBytes(parsingPacket, 1);
|
|
123
123
|
(parsingPacket, int nonce) = BytesDecoder::loadBytes(parsingPacket, 8);
|
|
@@ -105,31 +105,31 @@ cell BytesEncoder::serialize(tuple self) impure inline {
|
|
|
105
105
|
return secondLast.store_ref(last.end_cell()).end_cell();
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
tuple BytesEncoder::feed<uint8>(tuple self, int data) inline {
|
|
108
|
+
tuple BytesEncoder::feed<uint8>(tuple self, int data) impure inline {
|
|
109
109
|
return self.BytesEncoder::feed(begin_cell().store_uint8(data).as_slice());
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
tuple BytesEncoder::feed<uint16>(tuple self, int data) inline {
|
|
112
|
+
tuple BytesEncoder::feed<uint16>(tuple self, int data) impure inline {
|
|
113
113
|
return self.BytesEncoder::feed(begin_cell().store_uint16(data).as_slice());
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
tuple BytesEncoder::feed<uint32>(tuple self, int data) inline {
|
|
116
|
+
tuple BytesEncoder::feed<uint32>(tuple self, int data) impure inline {
|
|
117
117
|
return self.BytesEncoder::feed(begin_cell().store_uint32(data).as_slice());
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
tuple BytesEncoder::feed<uint64>(tuple self, int data) inline {
|
|
120
|
+
tuple BytesEncoder::feed<uint64>(tuple self, int data) impure inline {
|
|
121
121
|
return self.BytesEncoder::feed(begin_cell().store_uint64(data).as_slice());
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
tuple BytesEncoder::feed<coins>(tuple self, int data) inline {
|
|
124
|
+
tuple BytesEncoder::feed<coins>(tuple self, int data) impure inline {
|
|
125
125
|
return self.BytesEncoder::feed(begin_cell().store_uint128(data).as_slice());
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
tuple BytesEncoder::feed<uint256>(tuple self, int data) inline {
|
|
128
|
+
tuple BytesEncoder::feed<uint256>(tuple self, int data) impure inline {
|
|
129
129
|
return self.BytesEncoder::feed(begin_cell().store_uint256(data).as_slice());
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
tuple BytesEncoder::feed<cellRef>(tuple self, cell data) inline {
|
|
132
|
+
tuple BytesEncoder::feed<cellRef>(tuple self, cell data) impure inline {
|
|
133
133
|
return self.BytesEncoder::feed(data.begin_parse());
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -13,7 +13,7 @@ const int ULN_ATTESTATION_REFS = 0;
|
|
|
13
13
|
;; the attestation is parseable by classlib
|
|
14
14
|
const int lz::Attestation::leading16Bytes = 0x417474657374815ED897BFFF;
|
|
15
15
|
|
|
16
|
-
cell lz::Attestation::New(int hash, int confirmations) inline method_id {
|
|
16
|
+
cell lz::Attestation::New(int hash, int confirmations) impure inline method_id {
|
|
17
17
|
return cl::declare(
|
|
18
18
|
lz::Attestation::NAME,
|
|
19
19
|
unsafeTuple([
|
|
@@ -7,7 +7,7 @@ const int md::InitUln::NAME = "initUln"u;
|
|
|
7
7
|
const int md::InitUln::connectionCode = 0;
|
|
8
8
|
const int md::InitUln::treasuryFeeBps = 1;
|
|
9
9
|
|
|
10
|
-
cell md::InitUln::New(cell connectionCode, int treasuryFeeBps) inline method_id {
|
|
10
|
+
cell md::InitUln::New(cell connectionCode, int treasuryFeeBps) impure inline method_id {
|
|
11
11
|
return cl::declare(
|
|
12
12
|
md::InitUln::NAME,
|
|
13
13
|
unsafeTuple([
|
|
@@ -17,7 +17,7 @@ cell md::InitUlnConnection::New(
|
|
|
17
17
|
cell $ulnReceiveConfigOApp,
|
|
18
18
|
int endpointAddress,
|
|
19
19
|
int channelAddress
|
|
20
|
-
) inline method_id {
|
|
20
|
+
) impure inline method_id {
|
|
21
21
|
return cl::declare(
|
|
22
22
|
md::InitUlnConnection::NAME,
|
|
23
23
|
unsafeTuple([
|
|
@@ -32,7 +32,7 @@ cell md::InitUlnConnection::New(
|
|
|
32
32
|
cell md::InitUlnConnection::NewOnlyConfig(
|
|
33
33
|
cell $ulnSendConfigOApp,
|
|
34
34
|
cell $ulnReceiveConfigOApp
|
|
35
|
-
) inline method_id {
|
|
35
|
+
) impure inline method_id {
|
|
36
36
|
return md::InitUlnConnection::New(
|
|
37
37
|
$ulnSendConfigOApp,
|
|
38
38
|
$ulnReceiveConfigOApp,
|
|
@@ -7,7 +7,7 @@ const int md::InitUlnManager::NAME = "InitUlnMgr"u;
|
|
|
7
7
|
const int md::InitUlnManager::endpointCode = 0;
|
|
8
8
|
const int md::InitUlnManager::channelCode = 1;
|
|
9
9
|
|
|
10
|
-
cell md::InitUlnManager::New(cell endpointCode, cell channelCode) inline method_id {
|
|
10
|
+
cell md::InitUlnManager::New(cell endpointCode, cell channelCode) impure inline method_id {
|
|
11
11
|
return cl::declare(
|
|
12
12
|
md::InitUlnManager::NAME,
|
|
13
13
|
unsafeTuple([
|
|
@@ -7,7 +7,7 @@ const int md::RentRefill::NAME = "RentRefill"u;
|
|
|
7
7
|
const int md::RentRefill::address = 0;
|
|
8
8
|
const int md::RentRefill::amount = 1;
|
|
9
9
|
|
|
10
|
-
cell md::RentRefill::New(int address, int amount) inline method_id {
|
|
10
|
+
cell md::RentRefill::New(int address, int amount) impure inline method_id {
|
|
11
11
|
return cl::declare(
|
|
12
12
|
md::RentRefill::NAME,
|
|
13
13
|
unsafeTuple([
|
|
@@ -8,7 +8,7 @@ const int md::SetAdminWorkerAddresses::NAME = "adminwork"u;
|
|
|
8
8
|
;; AddressList
|
|
9
9
|
const int md::SetAdminWorkerAddresses::adminWorkers = 0;
|
|
10
10
|
|
|
11
|
-
cell md::SetAdminWorkerAddresses::New(cell adminWorkers) inline method_id {
|
|
11
|
+
cell md::SetAdminWorkerAddresses::New(cell adminWorkers) impure inline method_id {
|
|
12
12
|
return cl::declare(
|
|
13
13
|
md::SetAdminWorkerAddresses::NAME,
|
|
14
14
|
unsafeTuple([
|
|
@@ -6,7 +6,7 @@ const int md::TreasuryFeeBps::NAME = "tfeebps"u;
|
|
|
6
6
|
;; field names
|
|
7
7
|
const int md::TreasuryFeeBps::treasuryFeeBps = 0;
|
|
8
8
|
|
|
9
|
-
cell md::TreasuryFeeBps::New(int treasuryFeeBps) inline method_id {
|
|
9
|
+
cell md::TreasuryFeeBps::New(int treasuryFeeBps) impure inline method_id {
|
|
10
10
|
return cl::declare(
|
|
11
11
|
md::TreasuryFeeBps::NAME,
|
|
12
12
|
unsafeTuple([
|
|
@@ -81,7 +81,7 @@ cell UlnReceiveConfig::New(
|
|
|
81
81
|
|
|
82
82
|
;; Important assumption: the gas consumption of the endpoint will not increase past
|
|
83
83
|
;; 1 million gas per handler in any future update of the TVM.
|
|
84
|
-
int UlnReceiveConfig::MaxCommitPacketValueAssertion() method_id {
|
|
84
|
+
int UlnReceiveConfig::MaxCommitPacketValueAssertion() impure method_id {
|
|
85
85
|
(_, _, _, _, int gasLimit, _, _, _, _) = parseGasLimitsPrices(BASECHAIN);
|
|
86
86
|
gasLimit = max(gasLimit, 1000000);
|
|
87
87
|
|
|
@@ -7,7 +7,7 @@ const int md::UlnVerification::NAME = "UlnVerify"u;
|
|
|
7
7
|
const int md::UlnVerification::nonce = 0; ;; hash
|
|
8
8
|
const int md::UlnVerification::attestation = 1; ;; uint64
|
|
9
9
|
|
|
10
|
-
cell md::UlnVerification::New(int nonce, int hash, int confirmations) inline method_id {
|
|
10
|
+
cell md::UlnVerification::New(int nonce, int hash, int confirmations) impure inline method_id {
|
|
11
11
|
return cl::declare(
|
|
12
12
|
md::UlnVerification::NAME,
|
|
13
13
|
unsafeTuple([
|
|
@@ -6,7 +6,7 @@ const int md::UlnWorkerFeelibBytecode::NAME = "Ulnbytecod"u;
|
|
|
6
6
|
;; field names
|
|
7
7
|
const int md::UlnWorkerFeelibBytecode::bytecode = 0; ;; cellRef
|
|
8
8
|
|
|
9
|
-
cell md::UlnWorkerFeelibBytecode::New(cell bytecode) inline method_id {
|
|
9
|
+
cell md::UlnWorkerFeelibBytecode::New(cell bytecode) impure inline method_id {
|
|
10
10
|
return cl::declare(
|
|
11
11
|
md::UlnWorkerFeelibBytecode::NAME,
|
|
12
12
|
unsafeTuple([
|
|
@@ -7,7 +7,7 @@ const int md::VerificationStatus::NAME = "veristatus"u;
|
|
|
7
7
|
const int md::VerificationStatus::nonce = 0; ;; hash
|
|
8
8
|
const int md::VerificationStatus::status = 1; ;; uint32
|
|
9
9
|
|
|
10
|
-
cell md::VerificationStatus::New(int nonce, int status) inline method_id {
|
|
10
|
+
cell md::VerificationStatus::New(int nonce, int status) impure inline method_id {
|
|
11
11
|
return cl::declare(
|
|
12
12
|
md::VerificationStatus::NAME,
|
|
13
13
|
unsafeTuple([
|
|
@@ -353,7 +353,7 @@ cell _quoteWorkers(tuple args) impure inline method_id(23432) {
|
|
|
353
353
|
unsafeTuple([owner, treasuryFee])
|
|
354
354
|
);
|
|
355
355
|
|
|
356
|
-
|
|
356
|
+
return md::MsglibSendCallback::build(
|
|
357
357
|
totalNativeFee + treasuryFee,
|
|
358
358
|
0,
|
|
359
359
|
$lzSend,
|
|
@@ -370,7 +370,6 @@ cell _quoteWorkers(tuple args) impure inline method_id(23432) {
|
|
|
370
370
|
),
|
|
371
371
|
Channel::NO_ERROR
|
|
372
372
|
);
|
|
373
|
-
return ret;
|
|
374
373
|
}
|
|
375
374
|
|
|
376
375
|
;;; ================PERMISSION FUNCTIONS=====================
|
|
@@ -621,7 +620,7 @@ tuple setWorkerFeelibStorage(cell $newStorage) impure inline method_id {
|
|
|
621
620
|
return actions;
|
|
622
621
|
}
|
|
623
622
|
|
|
624
|
-
tuple refillWorkerRent(cell $rentRefill) {
|
|
623
|
+
tuple refillWorkerRent(cell $rentRefill) impure inline method_id {
|
|
625
624
|
(cell $storage, tuple actions) = preamble();
|
|
626
625
|
|
|
627
626
|
cell $workerFeelibInfos = $storage.Uln::getWorkerFeelibInfos();
|
|
@@ -24,7 +24,7 @@ const int Uln::remainingAdminWorkerSlots = 9;
|
|
|
24
24
|
;; Note that the default receive and send config can be initialized in the constructor unlike
|
|
25
25
|
;; ulnConnection which must be done in initialize due to opt-in semantics
|
|
26
26
|
;; @owner ulnManager
|
|
27
|
-
cell Uln::New(int owner, int eid, int dstEid) method_id {
|
|
27
|
+
cell Uln::New(int owner, int eid, int dstEid) impure method_id {
|
|
28
28
|
return cl::declare(
|
|
29
29
|
Uln::NAME,
|
|
30
30
|
unsafeTuple([
|
|
@@ -254,7 +254,7 @@ int _isDvnConfigured(int dvnAddress, cell $customUlnReceiveConfigOApp, cell $def
|
|
|
254
254
|
(op == MsglibConnection::OP::MSGLIB_CONNECTION_QUOTE)
|
|
255
255
|
) {
|
|
256
256
|
return ();
|
|
257
|
-
} elseif (op == UlnConnection::OP::GARBAGE_COLLECT_INVALID_ATTESTATIONS){
|
|
257
|
+
} elseif (op == UlnConnection::OP::GARBAGE_COLLECT_INVALID_ATTESTATIONS) {
|
|
258
258
|
return assertUln();
|
|
259
259
|
} elseif (op == MsglibConnection::OP::MSGLIB_CONNECTION_SYNC_CHANNEL_STATE) {
|
|
260
260
|
return assertChannel();
|
|
@@ -538,21 +538,30 @@ tuple msglibConnectionCommitPacketCallback(cell $channelNonceInfo) impure inline
|
|
|
538
538
|
setContractStorage(
|
|
539
539
|
$storage.UlnConnection::updateCommittmentInfo(committedNonce, firstUnexecutedNonce, $commitPOOO)
|
|
540
540
|
);
|
|
541
|
+
|
|
542
|
+
;; note that if msglibConnectionCommitPacketCallback is called before msglibConnectionSyncChannelState
|
|
543
|
+
;; is called, and the nonce is greater than the max settable bit, the msglibConnection will be in
|
|
544
|
+
;; a semi-blocked state until msglibConnectionSyncChannelState is called.
|
|
545
|
+
;; best practice is to call msglibConnectionSyncChannelState *before* switching to this msglib
|
|
541
546
|
|
|
542
547
|
return actions;
|
|
543
548
|
}
|
|
544
549
|
|
|
545
550
|
;; only channel
|
|
546
|
-
tuple msglibConnectionSyncChannelState(cell $
|
|
551
|
+
tuple msglibConnectionSyncChannelState(cell $mdObj) impure inline method_id {
|
|
547
552
|
(cell $storage, tuple actions) = preamble();
|
|
548
553
|
|
|
549
|
-
|
|
554
|
+
$mdObj = $mdObj.md::MdObj::sanitize();
|
|
555
|
+
|
|
556
|
+
cell $channelNonceInfo = $mdObj
|
|
557
|
+
.cl::get<objRef>(md::MdObj::md)
|
|
558
|
+
.md::ChannelNonceInfo::sanitize();
|
|
550
559
|
|
|
551
560
|
;; invariant:
|
|
552
561
|
;; firstUnexecutedNonce >= $storage.cl::get<uint64>(UlnConnection::firstUnexecutedNonce)
|
|
553
|
-
int firstUnexecutedNonce = $
|
|
562
|
+
int firstUnexecutedNonce = $channelNonceInfo
|
|
554
563
|
.cl::get<uint64>(md::ChannelNonceInfo::firstUnexecutedNonce);
|
|
555
|
-
int firstUncommittedNonce = $
|
|
564
|
+
int firstUncommittedNonce = $channelNonceInfo
|
|
556
565
|
.cl::get<uint64>(md::ChannelNonceInfo::nonce);
|
|
557
566
|
|
|
558
567
|
cell $commitPOOO = $storage.cl::get<objRef>(UlnConnection::commitPOOO);
|