@layerzerolabs/layerzero-v2-ton 3.0.19-ton.0 → 3.0.19-ton.1
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/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.permissions.test.compiled.json +1 -1
- package/build/PriceFeedCache.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.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 +5 -5
- package/src/classes/msgdata/LzReceiveStatus.fc +0 -1
- package/src/funC++/actions/call.fc +1 -0
- package/src/funC++/actions/deploy.fc +0 -1
- package/src/funC++/actions/destroy.fc +0 -1
- package/src/funC++/actions/dispatch.fc +0 -1
- package/src/funC++/actions/event.fc +0 -1
- package/src/funC++/actions/payment.fc +0 -1
- package/src/funC++/actions/sendJettons.fc +0 -1
- package/src/funC++/actions/utils.fc +0 -2
- package/src/funC++/baseInterface.fc +0 -2
- package/src/funC++/classlib.fc +0 -36
- package/src/funC++/contractMain.fc +2 -8
- package/src/funC++/dataStructures/DeterministicInsertionCircularQueue.fc +0 -1
- package/src/funC++/dataStructures/PipelinedOutOfOrder.fc +0 -1
- package/src/funC++/handlerCore.fc +2 -6
- package/src/funC++/stringlib.fc +0 -2
- package/src/funC++/testutils.fc +0 -1
- package/src/funC++/txnContext.fc +1 -1
- package/src/funC++/utils.fc +35 -0
- package/src/protocol/channel/callbackOpcodes.fc +10 -0
- package/src/protocol/channel/handler.fc +1032 -0
- package/src/protocol/channel/interface.fc +60 -0
- package/src/protocol/channel/main.fc +39 -0
- package/src/protocol/channel/storage.fc +55 -0
- package/src/protocol/controller/handler.fc +347 -0
- package/src/protocol/controller/interface.fc +25 -0
- package/src/protocol/controller/main.fc +29 -0
- package/src/protocol/controller/storage.fc +31 -0
- package/src/protocol/core/abstract/protocolHandler.fc +110 -0
- package/src/protocol/core/abstract/protocolMain.fc +30 -0
- package/src/protocol/core/baseStorage.fc +1 -2
- package/src/protocol/endpoint/handler.fc +426 -0
- package/src/protocol/endpoint/interface.fc +20 -0
- package/src/protocol/endpoint/main.fc +23 -0
- package/src/protocol/interfaces.fc +4 -0
- package/src/protocol/msglibs/BytesDecoder.fc +135 -0
- package/src/protocol/msglibs/BytesEncoder.fc +150 -0
- package/src/protocol/msglibs/interface.fc +16 -0
- package/src/protocol/msglibs/simpleMsglib/smlConnection/handler.fc +125 -0
- package/src/protocol/msglibs/simpleMsglib/smlConnection/interface.fc +3 -0
- package/src/protocol/msglibs/simpleMsglib/smlConnection/main.fc +19 -0
- package/src/protocol/msglibs/simpleMsglib/smlConnection/storage.fc +20 -0
- package/src/protocol/msglibs/simpleMsglib/smlManager/handler.fc +281 -0
- package/src/protocol/msglibs/simpleMsglib/smlManager/interface.fc +14 -0
- package/src/protocol/msglibs/simpleMsglib/smlManager/main.fc +24 -0
- package/src/protocol/msglibs/simpleMsglib/smlManager/storage.fc +38 -0
- package/src/protocol/msglibs/ultralightnode/callbackOpcodes.fc +1 -0
- package/src/protocol/msglibs/ultralightnode/feeLibInterface.fc +10 -0
- package/src/protocol/msglibs/ultralightnode/feeLibUtils.fc +51 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/Attestation.fc +49 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/DvnFeesPaidEvent.fc +26 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/ExecutorFeePaidEvent.fc +23 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/InitUln.fc +18 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/InitUlnConnection.fc +62 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/InitUlnManager.fc +18 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/RentRefill.fc +18 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/SetAdminWorkerAddresses.fc +18 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/TreasuryFeeBps.fc +16 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnEvents.fc +26 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnReceiveConfig.fc +249 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnSend.fc +27 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnSendConfig.fc +170 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnVerification.fc +21 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnWorkerFeelibBytecode.fc +16 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnWorkerFeelibEvents.fc +58 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/UlnWorkerFeelibInfo.fc +56 -0
- package/src/protocol/msglibs/ultralightnode/msgdata/VerificationStatus.fc +18 -0
- package/src/protocol/msglibs/ultralightnode/uln/handler.fc +803 -0
- package/src/protocol/msglibs/ultralightnode/uln/interface.fc +63 -0
- package/src/protocol/msglibs/ultralightnode/uln/main.fc +37 -0
- package/src/protocol/msglibs/ultralightnode/uln/storage.fc +43 -0
- package/src/protocol/msglibs/ultralightnode/ulnConnection/handler.fc +600 -0
- package/src/protocol/msglibs/ultralightnode/ulnConnection/interface.fc +36 -0
- package/src/protocol/msglibs/ultralightnode/ulnConnection/main.fc +32 -0
- package/src/protocol/msglibs/ultralightnode/ulnConnection/storage.fc +49 -0
- package/src/protocol/msglibs/ultralightnode/ulnConnection/utils.fc +141 -0
- package/src/protocol/msglibs/ultralightnode/ulnManager/handler.fc +495 -0
- package/src/protocol/msglibs/ultralightnode/ulnManager/interface.fc +59 -0
- package/src/protocol/msglibs/ultralightnode/ulnManager/main.fc +40 -0
- package/src/protocol/msglibs/ultralightnode/ulnManager/storage.fc +44 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/common.fc +27 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/handler.fc +80 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/main.fc +4 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/storage.fc +26 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/executorFeeLib/handler.fc +123 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/executorFeeLib/main.fc +4 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/executorFeeLib/storage.fc +29 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/main.fc +3 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/main.fc +1 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/storage.fc +39 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/ulnSendWorkerV1.fc +363 -0
- package/src/workers/core/abstract/workerHandler.fc +150 -0
- package/src/workers/core/interface.fc +25 -0
- package/src/workers/core/workerCoreStorage.fc +44 -0
- package/src/workers/dvn/handler.fc +332 -0
- package/src/workers/dvn/interface.fc +25 -0
- package/src/workers/dvn/main.fc +36 -0
- package/src/workers/dvn/storage.fc +27 -0
- package/src/workers/executor/handler.fc +110 -0
- package/src/workers/executor/interface.fc +19 -0
- package/src/workers/executor/main.fc +26 -0
- package/src/workers/executor/storage.fc +19 -0
- package/src/workers/msgdata/ExecuteParams.fc +29 -0
- package/src/workers/msgdata/NativeDrop.fc +16 -0
- package/src/workers/msgdata/ProxyMessage.fc +20 -0
- package/src/workers/msgdata/SetDict.fc +20 -0
- package/src/workers/msgdata/SetQuorum.fc +20 -0
- package/src/workers/msgdata/SignedRequest.fc +18 -0
- package/src/workers/priceFeedCache/handler.fc +114 -0
- package/src/workers/priceFeedCache/interface.fc +4 -0
- package/src/workers/priceFeedCache/main.fc +25 -0
- package/src/workers/priceFeedCache/storage.fc +21 -0
- package/src/workers/proxy/handler.fc +81 -0
- package/src/workers/proxy/interface.fc +11 -0
- package/src/workers/proxy/main.fc +17 -0
- package/src/workers/proxy/storage.fc +21 -0
- package/tests/testMain.fc +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#include "../../../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required md name
|
|
4
|
+
const int md::TreasuryFeeBps::NAME = "tfeebps"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int md::TreasuryFeeBps::treasuryFeeBps = 0;
|
|
8
|
+
|
|
9
|
+
cell md::TreasuryFeeBps::New(int treasuryFeeBps) inline method_id {
|
|
10
|
+
return cl::declare(
|
|
11
|
+
md::TreasuryFeeBps::NAME,
|
|
12
|
+
unsafeTuple([
|
|
13
|
+
[cl::t::uint16, treasuryFeeBps] ;; md::TreasuryFeeBps::treasuryFeeBps
|
|
14
|
+
])
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#include "../../../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int UlnEvents::NAME = "UlnEvents"u;
|
|
5
|
+
|
|
6
|
+
const int UlnEvents::CONSTS::NULL_WORKER_ID = 0;
|
|
7
|
+
|
|
8
|
+
;; field names
|
|
9
|
+
const int UlnEvents::workerEvents = 0;
|
|
10
|
+
const int UlnEvents::dvnFeesPaidEvent = 1;
|
|
11
|
+
const int UlnEvents::executorFeePaidEvent = 2;
|
|
12
|
+
|
|
13
|
+
cell UlnEvents::New(
|
|
14
|
+
cell workerEvents,
|
|
15
|
+
cell dvnFeesPaidEvent,
|
|
16
|
+
cell executorFeePaidEvent
|
|
17
|
+
) inline method_id {
|
|
18
|
+
return cl::declare(
|
|
19
|
+
UlnEvents::NAME,
|
|
20
|
+
unsafeTuple([
|
|
21
|
+
[cl::t::objRef, workerEvents], ;; UlnEvents::workerEvents
|
|
22
|
+
[cl::t::objRef, dvnFeesPaidEvent], ;; UlnEvents::dvnFeesPaidEvent
|
|
23
|
+
[cl::t::objRef, executorFeePaidEvent] ;; UlnEvents::executorFeePaidEvent
|
|
24
|
+
])
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
#include "../../../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
#include "../../../../funC++/dataStructures/AddressList.fc";
|
|
4
|
+
|
|
5
|
+
const int UlnReceiveConfig::CONST::NIL_ADDRESS = MAX_U256;
|
|
6
|
+
|
|
7
|
+
const int UlnReceiveConfig::COMMIT_PACKET_INTERNAL_MESSAGE_COUNT = 4;
|
|
8
|
+
;; connection -> endpoint -> channel -> connection
|
|
9
|
+
const int UlnReceiveConfig::ERROR::DVN_CONFIG_ERROR = 321;
|
|
10
|
+
|
|
11
|
+
;; Maximum number of DVNs allowed in the config is 8 required + 8 optional = 16 total.
|
|
12
|
+
;; The hashlookups is a mapping of nonce -> address -> attestation
|
|
13
|
+
;; meaning that 16 DVNs will require (2 * 16) - 1 cells for the dictionary tree inner nodes
|
|
14
|
+
;; and 16 cells for the attestations = 63 cells per nonce.
|
|
15
|
+
;; We allow up to 1000 nonces in the hashlookups, so the maximum number of cells required
|
|
16
|
+
;; for the hashlookups is 1000 * 63 = 63000 cells.
|
|
17
|
+
;; This leaves 2535 cells for the fixed-size storage and bytecode of this contract, which is
|
|
18
|
+
;; sufficient.
|
|
19
|
+
const int UlnReceiveConfig::MaxRequiredDVNs = 8;
|
|
20
|
+
const int UlnReceiveConfig::MaxOptionalDVNs = 4;
|
|
21
|
+
|
|
22
|
+
;; required storage name
|
|
23
|
+
const int UlnReceiveConfig::NAME = "UlnRecvCfg"u;
|
|
24
|
+
|
|
25
|
+
;; field names
|
|
26
|
+
|
|
27
|
+
;; EVM struct ExecutorConfig
|
|
28
|
+
;; uint32 maxMessageSize;
|
|
29
|
+
;; address executor;
|
|
30
|
+
|
|
31
|
+
const int UlnReceiveConfig::minCommitPacketGasNull = 0; ;; bool
|
|
32
|
+
const int UlnReceiveConfig::minCommitPacketGas = 1; ;; uint32
|
|
33
|
+
const int UlnReceiveConfig::confirmationsNull = 2; ;; bool
|
|
34
|
+
const int UlnReceiveConfig::confirmations = 3; ;; uint64
|
|
35
|
+
const int UlnReceiveConfig::requiredDVNsNull = 4; ;; bool
|
|
36
|
+
const int UlnReceiveConfig::requiredDVNs = 5; ;; address[] will be stored as a dictionary
|
|
37
|
+
const int UlnReceiveConfig::optionalDVNsNull = 6; ;; bool
|
|
38
|
+
const int UlnReceiveConfig::optionalDVNs = 7; ;; address[] will be stored as a dictionary
|
|
39
|
+
const int UlnReceiveConfig::optionalDVNThreshold = 8; ;; uint8
|
|
40
|
+
|
|
41
|
+
const int UlnReceiveConfig::ERROR::OPTIONAL_THRESHOLD_TOO_LARGE = 385;
|
|
42
|
+
const int UlnReceiveConfig::ERROR::OPTIONAL_THRESHOLD_TOO_LOW = 386;
|
|
43
|
+
const int UlnReceiveConfig::ERROR::DVN_COUNTS_ALL_NIL = 387;
|
|
44
|
+
const int UlnReceiveConfig::ERROR::INVALID_MIN_COMMIT_PACKET_GAS = 388;
|
|
45
|
+
|
|
46
|
+
;; EVM struct UlnReceiveConfig
|
|
47
|
+
;; uint64 confirmations;
|
|
48
|
+
;; // we store the length of required DVNs and optional DVNs instead of using DVN.length directly to save gas
|
|
49
|
+
;; uint8 requiredDVNCount; // 0 indicate DEFAULT, NIL_DVN_COUNT indicate NONE (to override the value of default)
|
|
50
|
+
;; uint8 optionalDVNCount; // 0 indicate DEFAULT, NIL_DVN_COUNT indicate NONE (to override the value of default)
|
|
51
|
+
;; uint8 optionalDVNThreshold; // (0, optionalDVNCount]
|
|
52
|
+
;; address[] requiredDVNs; // no duplicates. sorted an an ascending order. allowed overlap with optionalDVNs
|
|
53
|
+
;; address[] optionalDVNs; // no duplicates. sorted an an ascending order. allowed overlap with requiredDVNs
|
|
54
|
+
|
|
55
|
+
cell UlnReceiveConfig::New(
|
|
56
|
+
int useDefaultMinCommitPacketGas,
|
|
57
|
+
int minCommitPacketGas,
|
|
58
|
+
int useDefaultConfirmations,
|
|
59
|
+
int confirmations,
|
|
60
|
+
int useDefaultRequiredDVNs,
|
|
61
|
+
cell requiredDVNs,
|
|
62
|
+
int useDefaultOptionalDVNs,
|
|
63
|
+
cell optionalDVNs,
|
|
64
|
+
int optionalDVNThreshold
|
|
65
|
+
) impure method_id {
|
|
66
|
+
return cl::declare(
|
|
67
|
+
UlnReceiveConfig::NAME,
|
|
68
|
+
unsafeTuple([
|
|
69
|
+
[cl::t::bool, useDefaultMinCommitPacketGas],
|
|
70
|
+
[cl::t::uint32, minCommitPacketGas], ;; UlnReceiveConfig::minCommitPacketGas
|
|
71
|
+
[cl::t::bool, useDefaultConfirmations],
|
|
72
|
+
[cl::t::uint64, confirmations], ;; UlnReceiveConfig::confirmations
|
|
73
|
+
[cl::t::bool, useDefaultRequiredDVNs],
|
|
74
|
+
[cl::t::cellRef, requiredDVNs], ;; UlnReceiveConfig::requiredDVNs
|
|
75
|
+
[cl::t::bool, useDefaultOptionalDVNs],
|
|
76
|
+
[cl::t::cellRef, optionalDVNs], ;; UlnReceiveConfig::requiredDVNs
|
|
77
|
+
[cl::t::uint8, optionalDVNThreshold] ;; UlnReceiveConfig::optionalDVNThreshold
|
|
78
|
+
])
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
;; Important assumption: the gas consumption of the endpoint will not increase past
|
|
83
|
+
;; 1 million gas per handler in any future update of the TVM.
|
|
84
|
+
int UlnReceiveConfig::MaxCommitPacketValueAssertion() method_id {
|
|
85
|
+
(_, _, _, _, int gasLimit, _, _, _, _) = parseGasLimitsPrices(BASECHAIN);
|
|
86
|
+
gasLimit = max(gasLimit, 1000000);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
_gasToNanoton(gasLimit * UlnReceiveConfig::COMMIT_PACKET_INTERNAL_MESSAGE_COUNT)
|
|
90
|
+
+ (
|
|
91
|
+
UlnReceiveConfig::COMMIT_PACKET_INTERNAL_MESSAGE_COUNT
|
|
92
|
+
* get_forward_fee(false, MAX_U8 * MAX_CELL_BITS, MAX_U8)
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
cell UlnReceiveConfig::NewWithDefaults() inline method_id {
|
|
98
|
+
return UlnReceiveConfig::New(
|
|
99
|
+
true,
|
|
100
|
+
0,
|
|
101
|
+
true,
|
|
102
|
+
0,
|
|
103
|
+
true,
|
|
104
|
+
AddressList::empty(),
|
|
105
|
+
true,
|
|
106
|
+
AddressList::empty(),
|
|
107
|
+
0
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
int UlnReceiveConfig::utils::getConfirmations(
|
|
112
|
+
cell $UlnReceiveConfig,
|
|
113
|
+
cell $defaultUlnReceiveConfig
|
|
114
|
+
) impure inline {
|
|
115
|
+
if ($UlnReceiveConfig.cl::get<bool>(UlnReceiveConfig::confirmationsNull)) {
|
|
116
|
+
return $defaultUlnReceiveConfig.cl::get<uint64>(UlnReceiveConfig::confirmations);
|
|
117
|
+
}
|
|
118
|
+
return $UlnReceiveConfig.cl::get<uint64>(UlnReceiveConfig::confirmations);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
(cell, cell, int) UlnReceiveConfig::utils::getVerifyConfig(
|
|
122
|
+
cell $customUlnReceiveConfig,
|
|
123
|
+
cell $defaultUlnReceiveConfig
|
|
124
|
+
) impure inline {
|
|
125
|
+
int isValid = true;
|
|
126
|
+
|
|
127
|
+
cell requiredDVNs = $customUlnReceiveConfig.cl::get<cellRef>(UlnReceiveConfig::requiredDVNs);
|
|
128
|
+
cell optionalDVNs = $customUlnReceiveConfig.cl::get<cellRef>(UlnReceiveConfig::optionalDVNs);
|
|
129
|
+
|
|
130
|
+
if ($customUlnReceiveConfig.cl::get<bool>(UlnReceiveConfig::requiredDVNsNull)) {
|
|
131
|
+
isValid &= ($defaultUlnReceiveConfig.cl::get<bool>(UlnReceiveConfig::requiredDVNsNull) == false);
|
|
132
|
+
requiredDVNs = $defaultUlnReceiveConfig.cl::get<cellRef>(UlnReceiveConfig::requiredDVNs);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if ($customUlnReceiveConfig.cl::get<bool>(UlnReceiveConfig::optionalDVNsNull)) {
|
|
136
|
+
isValid &= ($defaultUlnReceiveConfig.cl::get<bool>(UlnReceiveConfig::optionalDVNsNull) == false);
|
|
137
|
+
optionalDVNs = $defaultUlnReceiveConfig.cl::get<cellRef>(UlnReceiveConfig::optionalDVNs);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return (requiredDVNs, optionalDVNs, isValid);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
(cell, cell, int, int, int, int) UlnReceiveConfig::utils::getCommitConfig(
|
|
144
|
+
cell $customUlnReceiveConfig,
|
|
145
|
+
cell $defaultUlnReceiveConfig
|
|
146
|
+
) inline method_id {
|
|
147
|
+
(cell $requiredDVNs, cell $optionalDVNs, int isValid) = UlnReceiveConfig::utils::getVerifyConfig(
|
|
148
|
+
$customUlnReceiveConfig,
|
|
149
|
+
$defaultUlnReceiveConfig
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
int optionalDVNThreshold = $customUlnReceiveConfig
|
|
153
|
+
.cl::get<uint8>(UlnReceiveConfig::optionalDVNThreshold);
|
|
154
|
+
int commitPacketGas = $customUlnReceiveConfig
|
|
155
|
+
.cl::get<uint32>(UlnReceiveConfig::minCommitPacketGas);
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
if ($customUlnReceiveConfig.cl::get<bool>(UlnReceiveConfig::optionalDVNsNull)) {
|
|
159
|
+
optionalDVNThreshold = $defaultUlnReceiveConfig
|
|
160
|
+
.cl::get<uint8>(UlnReceiveConfig::optionalDVNThreshold);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if ($customUlnReceiveConfig.cl::get<bool>(UlnReceiveConfig::minCommitPacketGasNull)) {
|
|
164
|
+
commitPacketGas = $defaultUlnReceiveConfig
|
|
165
|
+
.cl::get<uint32>(UlnReceiveConfig::minCommitPacketGas);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
int confirmations = UlnReceiveConfig::utils::getConfirmations(
|
|
169
|
+
$customUlnReceiveConfig,
|
|
170
|
+
$defaultUlnReceiveConfig
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
return ($requiredDVNs, $optionalDVNs, optionalDVNThreshold, confirmations, commitPacketGas, isValid);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
;; Ensure the Uln receive config does not contain garbage bits etc. that would cause
|
|
177
|
+
;; undefined behaviors in the protocol
|
|
178
|
+
cell UlnReceiveConfig::sanitize(cell $ulnReceiveConfigOApp) impure {
|
|
179
|
+
int useDefaultMinCommitPacketGas =
|
|
180
|
+
$ulnReceiveConfigOApp.cl::get<bool>(UlnReceiveConfig::minCommitPacketGasNull);
|
|
181
|
+
int minCommitPacketGas =
|
|
182
|
+
$ulnReceiveConfigOApp.cl::get<uint32>(UlnReceiveConfig::minCommitPacketGas);
|
|
183
|
+
int useDefaultConfirmations =
|
|
184
|
+
$ulnReceiveConfigOApp.cl::get<bool>(UlnReceiveConfig::confirmationsNull);
|
|
185
|
+
int confirmations =
|
|
186
|
+
$ulnReceiveConfigOApp.cl::get<uint64>(UlnReceiveConfig::confirmations);
|
|
187
|
+
int useDefaultRequiredDVNs =
|
|
188
|
+
$ulnReceiveConfigOApp.cl::get<bool>(UlnReceiveConfig::requiredDVNsNull);
|
|
189
|
+
cell requiredDVNs =
|
|
190
|
+
$ulnReceiveConfigOApp.cl::get<cellRef>(UlnReceiveConfig::requiredDVNs);
|
|
191
|
+
int useDefaultOptionalDVNs =
|
|
192
|
+
$ulnReceiveConfigOApp.cl::get<bool>(UlnReceiveConfig::optionalDVNsNull);
|
|
193
|
+
cell optionalDVNs =
|
|
194
|
+
$ulnReceiveConfigOApp.cl::get<cellRef>(UlnReceiveConfig::optionalDVNs);
|
|
195
|
+
int optionalDVNThreshold =
|
|
196
|
+
$ulnReceiveConfigOApp.cl::get<uint8>(UlnReceiveConfig::optionalDVNThreshold);
|
|
197
|
+
|
|
198
|
+
int numRequiredDVNs = requiredDVNs.AddressList::length();
|
|
199
|
+
int numOptionalDVNs = optionalDVNs.AddressList::length();
|
|
200
|
+
|
|
201
|
+
throw_unless(
|
|
202
|
+
UlnReceiveConfig::ERROR::DVN_CONFIG_ERROR,
|
|
203
|
+
AddressList::isValid(requiredDVNs, UlnReceiveConfig::MaxRequiredDVNs)
|
|
204
|
+
& AddressList::isValid(optionalDVNs, UlnReceiveConfig::MaxOptionalDVNs)
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
throw_if(
|
|
208
|
+
UlnReceiveConfig::ERROR::INVALID_MIN_COMMIT_PACKET_GAS,
|
|
209
|
+
(useDefaultMinCommitPacketGas == false)
|
|
210
|
+
& (minCommitPacketGas <= 0)
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
;; Prevent a malicious OApp from setting the threshold to a value that would
|
|
214
|
+
;; make it impossible to commit a packet
|
|
215
|
+
throw_if(
|
|
216
|
+
UlnReceiveConfig::ERROR::INVALID_MIN_COMMIT_PACKET_GAS,
|
|
217
|
+
_gasToNanoton(minCommitPacketGas) > UlnReceiveConfig::MaxCommitPacketValueAssertion()
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
throw_if(
|
|
221
|
+
UlnReceiveConfig::ERROR::OPTIONAL_THRESHOLD_TOO_LARGE,
|
|
222
|
+
optionalDVNThreshold > numOptionalDVNs
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
throw_if(
|
|
226
|
+
UlnReceiveConfig::ERROR::OPTIONAL_THRESHOLD_TOO_LOW,
|
|
227
|
+
(numOptionalDVNs > 0) & (optionalDVNThreshold <= 0)
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
throw_if(
|
|
231
|
+
UlnReceiveConfig::ERROR::DVN_COUNTS_ALL_NIL,
|
|
232
|
+
(useDefaultRequiredDVNs == false)
|
|
233
|
+
& (useDefaultOptionalDVNs == false)
|
|
234
|
+
& (numRequiredDVNs == 0)
|
|
235
|
+
& (numOptionalDVNs == 0)
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
return UlnReceiveConfig::New(
|
|
239
|
+
useDefaultMinCommitPacketGas,
|
|
240
|
+
minCommitPacketGas,
|
|
241
|
+
useDefaultConfirmations,
|
|
242
|
+
confirmations,
|
|
243
|
+
useDefaultRequiredDVNs,
|
|
244
|
+
requiredDVNs,
|
|
245
|
+
useDefaultOptionalDVNs,
|
|
246
|
+
optionalDVNs,
|
|
247
|
+
optionalDVNThreshold
|
|
248
|
+
);
|
|
249
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#include "../../../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int md::UlnSend::NAME = "UlnSend"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int md::UlnSend::lzSend = 0;
|
|
8
|
+
const int md::UlnSend::customUlnSendConfig = 1;
|
|
9
|
+
const int md::UlnSend::connectionInitialStorage = 2;
|
|
10
|
+
const int md::UlnSend::forwardingAddress = 3;
|
|
11
|
+
|
|
12
|
+
cell md::UlnSend::New(
|
|
13
|
+
cell $lzSend,
|
|
14
|
+
cell $customUlnSendConfig,
|
|
15
|
+
cell $connectionInitialStorage,
|
|
16
|
+
int forwardingAddress
|
|
17
|
+
) inline method_id {
|
|
18
|
+
return cl::declare(
|
|
19
|
+
md::UlnSend::NAME,
|
|
20
|
+
unsafeTuple([
|
|
21
|
+
[cl::t::objRef, $lzSend], ;; md::UlnSend::lzSend
|
|
22
|
+
[cl::t::objRef, $customUlnSendConfig], ;; md::UlnSend::customUlnSendConfig
|
|
23
|
+
[cl::t::objRef, $connectionInitialStorage], ;; md::UlnSend::connectionInitialStorage
|
|
24
|
+
[cl::t::address, forwardingAddress] ;; md::UlnSend::forwardingAddress
|
|
25
|
+
])
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
#include "../../../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
#include "../../../../funC++/dataStructures/AddressList.fc";
|
|
4
|
+
|
|
5
|
+
const int MAX_DVN_COUNT = 255; ;; uint8
|
|
6
|
+
const int lz::UlnSendConfig::CONST::NIL_ADDRESS = MAX_U256;
|
|
7
|
+
|
|
8
|
+
const int UlnSendConfig::ERROR::DVN_CONFIG_ERROR = 353;
|
|
9
|
+
|
|
10
|
+
;; required storage name
|
|
11
|
+
const int lz::UlnSendConfig::NAME = "UlnSendCfg"u;
|
|
12
|
+
|
|
13
|
+
;; field names
|
|
14
|
+
|
|
15
|
+
;; EVM struct ExecutorConfig
|
|
16
|
+
;; uint32 maxMessageSize;
|
|
17
|
+
;; address executor;
|
|
18
|
+
|
|
19
|
+
;; Both side configs
|
|
20
|
+
const int UlnSendConfig::workerQuoteGasLimit = 0; ;; uint64, set to 0 for using default
|
|
21
|
+
const int UlnSendConfig::maxMessageBytes = 1; ;; uint32, set to 0 for using default
|
|
22
|
+
const int UlnSendConfig::executorNull = 2; ;; bool
|
|
23
|
+
const int UlnSendConfig::executor = 3; ;; address (set to NIL for using default)
|
|
24
|
+
const int UlnSendConfig::requiredDVNsNull = 4; ;; bool
|
|
25
|
+
const int UlnSendConfig::requiredDVNs = 5; ;; address[] will be stored as a dictionary
|
|
26
|
+
const int UlnSendConfig::optionalDVNsNull = 6; ;; bool
|
|
27
|
+
const int UlnSendConfig::optionalDVNs = 7; ;; address[] will be stored as a dictionary
|
|
28
|
+
const int UlnSendConfig::confirmationsNull = 8;
|
|
29
|
+
const int UlnSendConfig::confirmations = 9;
|
|
30
|
+
|
|
31
|
+
;; these null flags above mean "try to resolve this field from the other config" if they're set to true.
|
|
32
|
+
|
|
33
|
+
cell UlnSendConfig::New(
|
|
34
|
+
int workerQuoteGasLimit,
|
|
35
|
+
int maxMessageBytes,
|
|
36
|
+
int executorNull,
|
|
37
|
+
int executor,
|
|
38
|
+
int requiredDVNsNull,
|
|
39
|
+
cell requiredDVNs,
|
|
40
|
+
int optionalDVNsNull,
|
|
41
|
+
cell optionalDVNs,
|
|
42
|
+
int confirmationsNull,
|
|
43
|
+
int confirmations
|
|
44
|
+
) impure method_id {
|
|
45
|
+
return cl::declare(
|
|
46
|
+
lz::UlnSendConfig::NAME,
|
|
47
|
+
unsafeTuple([
|
|
48
|
+
[cl::t::uint32, workerQuoteGasLimit], ;; lz::UlnSendConfig::workerQuoteGasLimit
|
|
49
|
+
[cl::t::uint32, maxMessageBytes], ;; lz::UlnSendConfig::maxMessageBytes
|
|
50
|
+
[cl::t::bool, executorNull], ;; lz::UlnSendConfig::executorNull
|
|
51
|
+
[cl::t::address, executor], ;; lz::UlnSendConfig::executor
|
|
52
|
+
[cl::t::bool, requiredDVNsNull], ;; lz::UlnSendConfig::requiredDVNsNull
|
|
53
|
+
[cl::t::cellRef, requiredDVNs], ;; lz::UlnSendConfig::requiredDVNs
|
|
54
|
+
[cl::t::bool, optionalDVNsNull], ;; lz::UlnSendConfig::optionalDVNsNull
|
|
55
|
+
[cl::t::cellRef, optionalDVNs], ;; lz::UlnSendConfig::optionalDVNs
|
|
56
|
+
[cl::t::bool, confirmationsNull], ;; lz::UlnSendConfig::confirmationsNull
|
|
57
|
+
[cl::t::uint64, confirmations] ;; lz::UlnSendConfig::confirmations
|
|
58
|
+
])
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
;; todo update these default values
|
|
63
|
+
cell UlnSendConfig::NewWithDefaults() impure method_id {
|
|
64
|
+
return UlnSendConfig::New(
|
|
65
|
+
0,
|
|
66
|
+
0,
|
|
67
|
+
true,
|
|
68
|
+
NULLADDRESS,
|
|
69
|
+
true,
|
|
70
|
+
empty_cell(),
|
|
71
|
+
true,
|
|
72
|
+
empty_cell(),
|
|
73
|
+
true,
|
|
74
|
+
0
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
;; quoteGasLimit, maxMsgBytes, executor, requiredDVNs, optionalDVNs, confirmations, isValid
|
|
79
|
+
(int, int, int, cell, cell, int, int) lz::UlnSendConfig::resolveUlnSendConfig(
|
|
80
|
+
cell $customUlnSendConfig,
|
|
81
|
+
cell $defaultUlnSendConfig
|
|
82
|
+
) impure inline {
|
|
83
|
+
int isValid = true;
|
|
84
|
+
|
|
85
|
+
;; low-level destructuring of customUlnSendConfig for efficiency
|
|
86
|
+
;; 1. skip the header
|
|
87
|
+
slice customUlnSendConfigSlice = $customUlnSendConfig
|
|
88
|
+
.begin_parse()
|
|
89
|
+
.sskipfirst(_HEADER_WIDTH, 0);
|
|
90
|
+
|
|
91
|
+
;; read all fields
|
|
92
|
+
;; 32 + 32 + 1 + 256 + 1 + 1 + 1 + 64 = 388 bits of data + 2 refs
|
|
93
|
+
;; all fit in the root cell with +350 bits for header (388 + 350 = 738 < 1023)
|
|
94
|
+
int quoteGasLimit = customUlnSendConfigSlice~load_uint32();
|
|
95
|
+
int maxMsgBytes = customUlnSendConfigSlice~load_uint32();
|
|
96
|
+
int executorNull = customUlnSendConfigSlice~load_bool();
|
|
97
|
+
int executor = customUlnSendConfigSlice~load_uint256();
|
|
98
|
+
int requiredDVNsNull = customUlnSendConfigSlice~load_bool();
|
|
99
|
+
cell requiredDVNs = customUlnSendConfigSlice~load_ref();
|
|
100
|
+
int optionalDVNsNull = customUlnSendConfigSlice~load_bool();
|
|
101
|
+
cell optionalDVNs = customUlnSendConfigSlice~load_ref();
|
|
102
|
+
int confirmationsNull = customUlnSendConfigSlice~load_bool();
|
|
103
|
+
int confirmations = customUlnSendConfigSlice~load_uint64();
|
|
104
|
+
|
|
105
|
+
if (quoteGasLimit == 0) {
|
|
106
|
+
quoteGasLimit = $defaultUlnSendConfig
|
|
107
|
+
.cl::get<uint32>(UlnSendConfig::workerQuoteGasLimit);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (maxMsgBytes == 0) {
|
|
111
|
+
maxMsgBytes = $defaultUlnSendConfig
|
|
112
|
+
.cl::get<uint32>(UlnSendConfig::maxMessageBytes);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (executorNull) {
|
|
116
|
+
isValid &= ($defaultUlnSendConfig.cl::get<bool>(UlnSendConfig::executorNull) == false);
|
|
117
|
+
executor = $defaultUlnSendConfig.cl::get<address>(UlnSendConfig::executor);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (requiredDVNsNull) {
|
|
121
|
+
isValid &= ($defaultUlnSendConfig.cl::get<bool>(UlnSendConfig::requiredDVNsNull) == false);
|
|
122
|
+
requiredDVNs = $defaultUlnSendConfig.cl::get<cellRef>(UlnSendConfig::requiredDVNs);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (optionalDVNsNull) {
|
|
126
|
+
isValid &= ($defaultUlnSendConfig.cl::get<bool>(UlnSendConfig::optionalDVNsNull) == false);
|
|
127
|
+
optionalDVNs = $defaultUlnSendConfig.cl::get<cellRef>(UlnSendConfig::optionalDVNs);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (confirmationsNull) {
|
|
131
|
+
isValid &= ($defaultUlnSendConfig.cl::get<bool>(UlnSendConfig::confirmationsNull) == false);
|
|
132
|
+
confirmations = $defaultUlnSendConfig.cl::get<uint64>(UlnSendConfig::confirmations);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return (quoteGasLimit, maxMsgBytes, executor, requiredDVNs, optionalDVNs, confirmations, isValid);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
;; Ensure the Uln send config does not contain garbage bits etc. that would cause
|
|
139
|
+
;; undefined behaviors in the protocol
|
|
140
|
+
cell UlnSendConfig::sanitize(cell $ulnSendConfig) impure inline_ref {
|
|
141
|
+
int workerQuoteGasLimit = $ulnSendConfig.cl::get<uint32>(UlnSendConfig::workerQuoteGasLimit);
|
|
142
|
+
int maxMessageBytes = $ulnSendConfig.cl::get<uint32>(UlnSendConfig::maxMessageBytes);
|
|
143
|
+
int useDefaultExecutor = $ulnSendConfig.cl::get<bool>(UlnSendConfig::executorNull);
|
|
144
|
+
int executor = $ulnSendConfig.cl::get<address>(UlnSendConfig::executor);
|
|
145
|
+
int useDefaultRequiredDVNs = $ulnSendConfig.cl::get<bool>(UlnSendConfig::requiredDVNsNull);
|
|
146
|
+
cell requiredDVNs = $ulnSendConfig.cl::get<cellRef>(UlnSendConfig::requiredDVNs);
|
|
147
|
+
int useDefaultOptionalDVNs = $ulnSendConfig.cl::get<bool>(UlnSendConfig::optionalDVNsNull);
|
|
148
|
+
cell optionalDVNs = $ulnSendConfig.cl::get<cellRef>(UlnSendConfig::optionalDVNs);
|
|
149
|
+
int useDefaultConfirmations = $ulnSendConfig.cl::get<bool>(UlnSendConfig::confirmationsNull);
|
|
150
|
+
int confirmations = $ulnSendConfig.cl::get<uint64>(UlnSendConfig::confirmations);
|
|
151
|
+
|
|
152
|
+
throw_unless(
|
|
153
|
+
UlnSendConfig::ERROR::DVN_CONFIG_ERROR,
|
|
154
|
+
AddressList::isValid(requiredDVNs, MAX_DVN_COUNT)
|
|
155
|
+
& AddressList::isValid(optionalDVNs, MAX_DVN_COUNT)
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
return UlnSendConfig::New(
|
|
159
|
+
workerQuoteGasLimit,
|
|
160
|
+
maxMessageBytes,
|
|
161
|
+
useDefaultExecutor,
|
|
162
|
+
executor,
|
|
163
|
+
useDefaultRequiredDVNs,
|
|
164
|
+
requiredDVNs,
|
|
165
|
+
useDefaultOptionalDVNs,
|
|
166
|
+
optionalDVNs,
|
|
167
|
+
useDefaultConfirmations,
|
|
168
|
+
confirmations
|
|
169
|
+
);
|
|
170
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#include "Attestation.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int md::UlnVerification::NAME = "UlnVerify"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int md::UlnVerification::nonce = 0; ;; hash
|
|
8
|
+
const int md::UlnVerification::attestation = 1; ;; uint64
|
|
9
|
+
|
|
10
|
+
cell md::UlnVerification::New(int nonce, int hash, int confirmations) inline method_id {
|
|
11
|
+
return cl::declare(
|
|
12
|
+
md::UlnVerification::NAME,
|
|
13
|
+
unsafeTuple([
|
|
14
|
+
[cl::t::uint64, nonce], ;; md::UlnVerification::nonce
|
|
15
|
+
[cl::t::objRef, lz::Attestation::New(
|
|
16
|
+
hash,
|
|
17
|
+
confirmations
|
|
18
|
+
)] ;; md::UlnVerification::attestation
|
|
19
|
+
])
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#include "../../../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int md::UlnWorkerFeelibBytecode::NAME = "Ulnbytecod"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int md::UlnWorkerFeelibBytecode::bytecode = 0; ;; cellRef
|
|
8
|
+
|
|
9
|
+
cell md::UlnWorkerFeelibBytecode::New(cell bytecode) inline method_id {
|
|
10
|
+
return cl::declare(
|
|
11
|
+
md::UlnWorkerFeelibBytecode::NAME,
|
|
12
|
+
unsafeTuple([
|
|
13
|
+
[cl::t::cellRef, bytecode] ;; md::UlnWorkerFeelibBytecode::nonce
|
|
14
|
+
])
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#include "../../../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int md::UlnWorkerFeelibEvents::NAME = "UlnWrkEvnt"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int md::UlnWorkerFeelibEvents::workerAddress = 0;
|
|
8
|
+
const int md::UlnWorkerFeelibEvents::workerEvents = 1;
|
|
9
|
+
const int md::UlnWorkerFeelibEvents::nextWorkerEvents = 2;
|
|
10
|
+
|
|
11
|
+
cell md::UlnWorkerFeelibEvents::New(
|
|
12
|
+
int workerAddress,
|
|
13
|
+
cell $workerEvents,
|
|
14
|
+
cell $nextWorkerEvents
|
|
15
|
+
) impure inline method_id {
|
|
16
|
+
return cl::declare(
|
|
17
|
+
md::UlnWorkerFeelibEvents::NAME,
|
|
18
|
+
unsafeTuple([
|
|
19
|
+
[cl::t::address, workerAddress], ;; md::UlnWorkerFeelibEvents::workerAddress
|
|
20
|
+
[cl::t::objRef, $workerEvents], ;; md::UlnWorkerFeelibEvents::workerEvents
|
|
21
|
+
[cl::t::objRef, $nextWorkerEvents] ;; md::UlnWorkerFeelibEvents::nextWorkerEvents
|
|
22
|
+
])
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
tuple UlnWorkerFeelibEventsBuilder::create() impure inline {
|
|
27
|
+
return empty_tuple();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
tuple UlnWorkerFeelibEventsBuilder::push(
|
|
31
|
+
tuple eventBuilder,
|
|
32
|
+
int workerAddress,
|
|
33
|
+
cell eventBody
|
|
34
|
+
) impure inline {
|
|
35
|
+
if (eventBody.is_null()) {
|
|
36
|
+
return eventBuilder;
|
|
37
|
+
}
|
|
38
|
+
return eventBuilder.tpush([workerAddress, eventBody]);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
cell UlnWorkerFeelibEvents::FromBuilder(tuple eventBuilder) impure inline {
|
|
42
|
+
if (eventBuilder.tlen() == 0) {
|
|
43
|
+
;; short-circuit the common case for efficiency
|
|
44
|
+
return cl::nullObject();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
cell $workerEvents = cl::nullObject();
|
|
48
|
+
while (eventBuilder.tlen() > 0) {
|
|
49
|
+
[int workerAddress, cell $workerEventBody] = eventBuilder~tpop();
|
|
50
|
+
$workerEvents = md::UlnWorkerFeelibEvents::New(
|
|
51
|
+
workerAddress,
|
|
52
|
+
$workerEventBody,
|
|
53
|
+
$workerEvents
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return $workerEvents;
|
|
58
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#include "../../../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int UlnWorkerFeelibInfo::NAME = "UlnWrkInfo"u;
|
|
5
|
+
|
|
6
|
+
;; 'UlnWorkerFeelibInfo::useDefaults' is ONLY used during the oapp config set flow.
|
|
7
|
+
;; When setting 'epConfigDefaults' as the owner, the flag doesnt matter, because call is for defaults
|
|
8
|
+
|
|
9
|
+
;; field names
|
|
10
|
+
const int UlnWorkerFeelibInfo::workerAddress = 0;
|
|
11
|
+
const int UlnWorkerFeelibInfo::workerFeelibBytecode = 1;
|
|
12
|
+
const int UlnWorkerFeelibInfo::workerFeelibStorage = 2;
|
|
13
|
+
const int UlnWorkerFeelibInfo::friendWorkerAddress = 3;
|
|
14
|
+
const int UlnWorkerFeelibInfo::dstEid = 4;
|
|
15
|
+
const int UlnWorkerFeelibInfo::rentBalance = 5;
|
|
16
|
+
const int UlnWorkerFeelibInfo::lastRentTimestamp = 6;
|
|
17
|
+
const int UlnWorkerFeelibInfo::isAdmin = 7;
|
|
18
|
+
|
|
19
|
+
cell UlnWorkerFeelibInfo::New(
|
|
20
|
+
int workerAddress,
|
|
21
|
+
cell workerFeelibBytecode,
|
|
22
|
+
cell workerFeelibStorage,
|
|
23
|
+
int friendWorkerAddress,
|
|
24
|
+
int dstEid,
|
|
25
|
+
int rentBalance,
|
|
26
|
+
int isAdmin
|
|
27
|
+
) inline method_id {
|
|
28
|
+
return cl::declare(
|
|
29
|
+
UlnWorkerFeelibInfo::NAME,
|
|
30
|
+
unsafeTuple([
|
|
31
|
+
[cl::t::address, workerAddress], ;; UlnWorkerFeelibInfo::workerAddress
|
|
32
|
+
[cl::t::cellRef, workerFeelibBytecode], ;; UlnWorkerFeelibInfo::workerFeelibBytecode
|
|
33
|
+
[cl::t::objRef, workerFeelibStorage], ;; UlnWorkerFeelibInfo::workerFeelibStorage
|
|
34
|
+
[cl::t::address, friendWorkerAddress], ;; UlnWorkerFeelibInfo::friendWorkerAddress
|
|
35
|
+
[cl::t::uint32, dstEid], ;; UlnWorkerFeelibInfo::dstEid
|
|
36
|
+
[cl::t::coins, rentBalance], ;; UlnWorkerFeelibInfo::rentBalance
|
|
37
|
+
[cl::t::uint64, 0], ;; UlnWorkerFeelibInfo::lastRentTimestamp
|
|
38
|
+
[cl::t::bool, isAdmin] ;; UlnWorkerFeelibInfo::isAdmin
|
|
39
|
+
])
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
cell UlnWorkerFeelibInfo::sanitize(cell $ulnWorkerFeelibInfo) {
|
|
44
|
+
return UlnWorkerFeelibInfo::New(
|
|
45
|
+
$ulnWorkerFeelibInfo.cl::get<address>(UlnWorkerFeelibInfo::workerAddress),
|
|
46
|
+
$ulnWorkerFeelibInfo.cl::get<cellRef>(UlnWorkerFeelibInfo::workerFeelibBytecode),
|
|
47
|
+
$ulnWorkerFeelibInfo.cl::get<objRef>(UlnWorkerFeelibInfo::workerFeelibStorage),
|
|
48
|
+
$ulnWorkerFeelibInfo.cl::get<address>(UlnWorkerFeelibInfo::friendWorkerAddress),
|
|
49
|
+
$ulnWorkerFeelibInfo.cl::get<uint32>(UlnWorkerFeelibInfo::dstEid),
|
|
50
|
+
$ulnWorkerFeelibInfo.cl::get<coins>(UlnWorkerFeelibInfo::rentBalance),
|
|
51
|
+
$ulnWorkerFeelibInfo.cl::get<bool>(UlnWorkerFeelibInfo::isAdmin)
|
|
52
|
+
).cl::set(
|
|
53
|
+
UlnWorkerFeelibInfo::lastRentTimestamp,
|
|
54
|
+
$ulnWorkerFeelibInfo.cl::get<uint64>(UlnWorkerFeelibInfo::lastRentTimestamp)
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#include "../../../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int md::VerificationStatus::NAME = "veristatus"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int md::VerificationStatus::nonce = 0; ;; hash
|
|
8
|
+
const int md::VerificationStatus::status = 1; ;; uint32
|
|
9
|
+
|
|
10
|
+
cell md::VerificationStatus::New(int nonce, int status) inline method_id {
|
|
11
|
+
return cl::declare(
|
|
12
|
+
md::VerificationStatus::NAME,
|
|
13
|
+
unsafeTuple([
|
|
14
|
+
[cl::t::uint64, nonce], ;; md::VerificationStatus::nonce
|
|
15
|
+
[cl::t::uint32, status] ;; md::VerificationStatus::status
|
|
16
|
+
])
|
|
17
|
+
);
|
|
18
|
+
}
|