@layerzerolabs/layerzero-v2-ton 3.0.31-ton.2 → 3.0.31

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.
Files changed (109) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/AllStorages.compiled.json +1 -1
  3. package/build/Channel.compiled.json +1 -1
  4. package/build/Channel.permissions.test.compiled.json +1 -1
  5. package/build/ChannelBurn.test.compiled.json +1 -1
  6. package/build/ChannelCommitPacket.test.compiled.json +1 -1
  7. package/build/ChannelConfig.test.compiled.json +1 -1
  8. package/build/ChannelInitialize.test.compiled.json +1 -1
  9. package/build/ChannelMsglibIntegration.test.compiled.json +1 -1
  10. package/build/ChannelMsglibSendCallback.test.compiled.json +1 -1
  11. package/build/ChannelNilify.test.compiled.json +1 -1
  12. package/build/ChannelReceive.test.compiled.json +1 -1
  13. package/build/ChannelReceiveCallback.test.compiled.json +1 -1
  14. package/build/ChannelReceiveView.test.compiled.json +1 -1
  15. package/build/ChannelSend.test.compiled.json +1 -1
  16. package/build/ChannelSerde.test.compiled.json +1 -1
  17. package/build/Classlib.test.compiled.json +1 -1
  18. package/build/Connection.compiled.json +1 -1
  19. package/build/Controller.assertions.test.compiled.json +1 -1
  20. package/build/Controller.compiled.json +1 -1
  21. package/build/Controller.permissions.test.compiled.json +1 -1
  22. package/build/Controller.test.compiled.json +1 -1
  23. package/build/Counter.compiled.json +1 -1
  24. package/build/Counter.permissions.test.compiled.json +1 -1
  25. package/build/Counter.setters.test.compiled.json +1 -1
  26. package/build/Counter.test.compiled.json +1 -1
  27. package/build/Dvn.compiled.json +1 -1
  28. package/build/Dvn.test.compiled.json +1 -1
  29. package/build/DvnFeeLibSerde.test.compiled.json +1 -1
  30. package/build/DvnPermissions.test.compiled.json +1 -1
  31. package/build/DvnSerde.test.compiled.json +1 -1
  32. package/build/Endpoint.compiled.json +1 -1
  33. package/build/Endpoint.permissions.test.compiled.json +1 -1
  34. package/build/Endpoint.test.compiled.json +1 -1
  35. package/build/EndpointSerde.test.compiled.json +1 -1
  36. package/build/EndpointSetEpConfigDefaults.test.compiled.json +1 -1
  37. package/build/Executor.compiled.json +1 -1
  38. package/build/Executor.test.compiled.json +1 -1
  39. package/build/ExecutorFeeLibSerde.test.compiled.json +1 -1
  40. package/build/ExecutorPermissions.test.compiled.json +1 -1
  41. package/build/ExecutorSerde.test.compiled.json +1 -1
  42. package/build/LzClasses.test.compiled.json +1 -1
  43. package/build/LzClassesSerde.test.compiled.json +1 -1
  44. package/build/LzUtil.test.compiled.json +1 -1
  45. package/build/MsgData.test.compiled.json +1 -1
  46. package/build/MsgDataSerde.test.compiled.json +1 -1
  47. package/build/MsglibPacketCodec.test.compiled.json +1 -1
  48. package/build/PipelinedOutOfOrderSerde.test.compiled.json +1 -1
  49. package/build/PriceFeedCache.compiled.json +1 -1
  50. package/build/PriceFeedCache.test.compiled.json +1 -1
  51. package/build/PriceFeedCache.test.permissions.compiled.json +1 -1
  52. package/build/PriceFeedCacheSerde.test.compiled.json +1 -1
  53. package/build/PriceFeedFeeLibSerde.test.compiled.json +1 -1
  54. package/build/Proxy.compiled.json +1 -1
  55. package/build/Proxy.permissions.test.compiled.json +1 -1
  56. package/build/Proxy.test.compiled.json +1 -1
  57. package/build/SmlConnection.compiled.json +1 -1
  58. package/build/SmlConnection.permissions.test.compiled.json +1 -1
  59. package/build/SmlConnection.test.compiled.json +1 -1
  60. package/build/SmlManager.compiled.json +1 -1
  61. package/build/SmlManager.permissions.test.compiled.json +1 -1
  62. package/build/SmlManager.test.compiled.json +1 -1
  63. package/build/Uln.compiled.json +1 -1
  64. package/build/Uln.test.compiled.json +1 -1
  65. package/build/UlnConnection.compiled.json +1 -1
  66. package/build/UlnConnection.test.compiled.json +1 -1
  67. package/build/UlnConnectionPermissions.test.compiled.json +1 -1
  68. package/build/UlnConnectionSerde.test.compiled.json +1 -1
  69. package/build/UlnManagement.test.compiled.json +1 -1
  70. package/build/UlnManager.compiled.json +1 -1
  71. package/build/UlnManager.test.compiled.json +1 -1
  72. package/build/UlnManagerPermissions.test.compiled.json +1 -1
  73. package/build/UlnManagerUtil.test.compiled.json +1 -1
  74. package/build/UlnMsgDataSerde.test.compiled.json +1 -1
  75. package/build/UlnPermissions.test.compiled.json +1 -1
  76. package/build/UlnReceiveConfig.test.compiled.json +1 -1
  77. package/build/UlnSend.test.compiled.json +1 -1
  78. package/build/UlnSendConfig.test.compiled.json +1 -1
  79. package/build/UlnSendWithDvnFeeLib.test.compiled.json +1 -1
  80. package/build/UlnSendWithExecFeeLib.test.compiled.json +1 -1
  81. package/build/UlnSendWorkerFactory.test.compiled.json +1 -1
  82. package/build/UlnSerde.test.compiled.json +1 -1
  83. package/build/UlnUtil.test.compiled.json +1 -1
  84. package/build/WorkerCore.test.compiled.json +1 -1
  85. package/build/WorkerCoreMsgDataSerde.test.compiled.json +1 -1
  86. package/build/WorkerCoreSerde.test.compiled.json +1 -1
  87. package/build/badFeeLib1.test.compiled.json +1 -1
  88. package/build/badFeeLib10.test.compiled.json +1 -1
  89. package/build/badFeeLib11.test.compiled.json +1 -1
  90. package/build/badFeeLib12.test.compiled.json +1 -1
  91. package/build/badFeeLib2.test.compiled.json +1 -1
  92. package/build/badFeeLib3.test.compiled.json +1 -1
  93. package/build/badFeeLib4.test.compiled.json +1 -1
  94. package/build/badFeeLib5.test.compiled.json +1 -1
  95. package/build/badFeeLib6.test.compiled.json +1 -1
  96. package/build/badFeeLib7.test.compiled.json +1 -1
  97. package/build/badFeeLib8.test.compiled.json +1 -1
  98. package/build/badFeeLib9.test.compiled.json +1 -1
  99. package/package.json +1 -1
  100. package/src/classes/lz/Config.fc +13 -0
  101. package/src/classes/lz/Packet.fc +4 -0
  102. package/src/classes/msgdata/LzSend.fc +8 -0
  103. package/src/classes/msgdata/MdObj.fc +8 -0
  104. package/src/classes/msgdata/OptionsExtended.fc +12 -0
  105. package/src/protocol/channel/handler.fc +7 -1
  106. package/src/protocol/channel/storage.fc +13 -4
  107. package/src/protocol/controller/handler.fc +27 -8
  108. package/src/protocol/endpoint/storage.fc +9 -0
  109. package/tests/baseSerdeTest.fc +1 -1
@@ -116,31 +116,50 @@ int _verifyEventSender(int sender, cell $senderStorageInit) impure method_id {
116
116
  }
117
117
 
118
118
  int storageType = cl::typeof($senderStorageInit);
119
- int senderOwner = $senderStorageInit
120
- .cl::get<objRef>(BASE_STORAGE_INDEX)
121
- .cl::get<address>(BaseStorage::owner);
122
-
123
- ;; If senderOwner != controller address, then this event sender might be using the correct
124
- ;; bytecode and storage but be part of a different LayerZero protocol deployment owned
125
- ;; by a different signer.
126
- throw_if(BaseInterface::ERROR::invalidEventSource, senderOwner != getContractAddress());
119
+ int senderOwner = NULLADDRESS;
127
120
 
128
121
  if (storageType == Endpoint::NAME) {
122
+ cell $endpointStorageInit = Endpoint::sanitize($senderStorageInit);
123
+ throw_if(
124
+ BaseInterface::ERROR::invalidEventSource,
125
+ $endpointStorageInit.cl::hash() != $senderStorageInit.cl::hash()
126
+ );
127
+
129
128
  cell endpointCode = $storage.cl::get<cellRef>(Controller::endpointCode);
130
129
  throw_unless(
131
130
  BaseInterface::ERROR::invalidEventSource,
132
131
  sender == computeContractAddress($senderStorageInit, endpointCode)
133
132
  );
133
+
134
+ senderOwner = $endpointStorageInit
135
+ .cl::get<objRef>(Endpoint::baseStorage)
136
+ .cl::get<address>(BaseStorage::owner);
137
+
134
138
  } elseif (storageType == Channel::NAME) {
139
+ cell $channelStorageInit = Channel::sanitize($senderStorageInit);
140
+ throw_if(
141
+ BaseInterface::ERROR::invalidEventSource,
142
+ $channelStorageInit.cl::hash() != $senderStorageInit.cl::hash()
143
+ );
144
+
135
145
  cell channelCode = $storage.cl::get<cellRef>(Controller::channelCode);
136
146
  throw_unless(
137
147
  BaseInterface::ERROR::invalidEventSource,
138
148
  sender == computeContractAddress($senderStorageInit, channelCode)
139
149
  );
150
+
151
+ senderOwner = $channelStorageInit
152
+ .cl::get<objRef>(Channel::baseStorage)
153
+ .cl::get<address>(BaseStorage::owner);
140
154
  } else {
141
155
  throw(BaseInterface::ERROR::invalidEventSource);
142
156
  }
143
157
 
158
+ ;; If senderOwner != controller address, then this event sender might be using the correct
159
+ ;; bytecode and storage but be part of a different LayerZero protocol deployment owned
160
+ ;; by a different signer.
161
+ throw_if(BaseInterface::ERROR::invalidEventSource, senderOwner != getContractAddress());
162
+
144
163
  return true;
145
164
  }
146
165
 
@@ -98,4 +98,13 @@ cell Endpoint::getDefaultTimeoutReceiveLibInfo(cell $self) impure inline {
98
98
  selfSlice.preloadRefAt(2).cellPreloadRefAt(3),
99
99
  selfSlice.preloadRefAt(3).cellPreloadRefAt(0)
100
100
  );
101
+ }
102
+
103
+ cell Endpoint::sanitize(cell $self) impure inline {
104
+ cell $baseStorage = $self.cl::get<cellRef>(Endpoint::baseStorage);
105
+ return Endpoint::New(
106
+ $self.cl::get<uint32>(Endpoint::eid),
107
+ $self.cl::get<uint32>(Endpoint::dstEid),
108
+ $baseStorage.cl::get<address>(BaseStorage::owner)
109
+ );
101
110
  }
@@ -82,7 +82,7 @@ cell baseTest::prepare(tuple args) impure {
82
82
  while (idx < expected.tlen()) {
83
83
  if (expected.at(idx).is_cell() & actual.at(idx).is_cell()) {
84
84
  if (expected.at(idx).cell_hash() != actual.at(idx).cell_hash()) {
85
- return (TEST_FAILED, "expected cell != actual cell");
85
+ return (TEST_FAILED, "expected cell at idx ".str::concatInt(idx).str::concat(" != actual cell"));
86
86
  }
87
87
  } elseif (expected.at(idx).is_int() & actual.at(idx).is_int()) {
88
88
  if (expected.at(idx) != actual.at(idx)) {