Skip to content

Commit c98d6e5

Browse files
fix bounce msg processing issue (#2833)
* fix bounce msg processing issue Signed-off-by: master_jedy <[email protected]> * trigger ci --------- Signed-off-by: master_jedy <[email protected]> Co-authored-by: Ali Behjati <[email protected]>
1 parent 1101ad2 commit c98d6e5

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

target_chains/ton/contracts/contracts/Main.fc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@
2929
return ();
3030
}
3131

32-
;; * A 32-bit (big-endian) unsigned integer `op`, identifying the `operation` to be performed, or the `method` of the smart contract to be invoked.
33-
int op = in_msg_body~load_uint(32);
34-
cell data = in_msg_body~load_ref();
35-
slice data_slice = data.begin_parse();
36-
3732
;; Get sender address from message
3833
slice cs = in_msg_full.begin_parse();
3934
int flags = cs~load_uint(4);
@@ -42,6 +37,11 @@
4237
}
4338
slice sender_address = cs~load_msg_addr(); ;; load sender address
4439

40+
;; * A 32-bit (big-endian) unsigned integer `op`, identifying the `operation` to be performed, or the `method` of the smart contract to be invoked.
41+
int op = in_msg_body~load_uint(32);
42+
cell data = in_msg_body~load_ref();
43+
slice data_slice = data.begin_parse();
44+
4545
;; * The remainder of the message body is specific for each supported value of `op`.
4646
if (op == OP_UPDATE_GUARDIAN_SET) {
4747
;; @notice Updates the guardian set based on a Wormhole VAA

target_chains/ton/contracts/contracts/tests/PythTest.fc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@
1818
return ();
1919
}
2020

21-
int op = in_msg_body~load_uint(32);
22-
cell data = in_msg_body~load_ref();
23-
slice data_slice = data.begin_parse();
24-
2521
;; Get sender address from message
2622
slice cs = in_msg_full.begin_parse();
27-
cs~skip_bits(4); ;; skip flags
23+
int flags = cs~load_uint(4); ;; load flags
24+
if (flags & 1) {
25+
return ();
26+
}
2827
slice sender_address = cs~load_msg_addr(); ;; load sender address
2928

29+
int op = in_msg_body~load_uint(32);
30+
cell data = in_msg_body~load_ref();
31+
slice data_slice = data.begin_parse();
32+
3033
if (op == OP_UPDATE_GUARDIAN_SET) {
3134
update_guardian_set(data_slice);
3235
} elseif (op == OP_UPDATE_PRICE_FEEDS) {

0 commit comments

Comments
 (0)