Skip to content

fix bounce msg processing issue #2833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions target_chains/ton/contracts/contracts/Main.fc
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
return ();
}

;; * A 32-bit (big-endian) unsigned integer `op`, identifying the `operation` to be performed, or the `method` of the smart contract to be invoked.
int op = in_msg_body~load_uint(32);
cell data = in_msg_body~load_ref();
slice data_slice = data.begin_parse();

;; Get sender address from message
slice cs = in_msg_full.begin_parse();
int flags = cs~load_uint(4);
Expand All @@ -42,6 +37,11 @@
}
slice sender_address = cs~load_msg_addr(); ;; load sender address

;; * A 32-bit (big-endian) unsigned integer `op`, identifying the `operation` to be performed, or the `method` of the smart contract to be invoked.
int op = in_msg_body~load_uint(32);
cell data = in_msg_body~load_ref();
slice data_slice = data.begin_parse();

;; * The remainder of the message body is specific for each supported value of `op`.
if (op == OP_UPDATE_GUARDIAN_SET) {
;; @notice Updates the guardian set based on a Wormhole VAA
Expand Down
13 changes: 8 additions & 5 deletions target_chains/ton/contracts/contracts/tests/PythTest.fc
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,18 @@
return ();
}

int op = in_msg_body~load_uint(32);
cell data = in_msg_body~load_ref();
slice data_slice = data.begin_parse();

;; Get sender address from message
slice cs = in_msg_full.begin_parse();
cs~skip_bits(4); ;; skip flags
int flags = cs~load_uint(4); ;; load flags
if (flags & 1) {
return ();
}
slice sender_address = cs~load_msg_addr(); ;; load sender address

int op = in_msg_body~load_uint(32);
cell data = in_msg_body~load_ref();
slice data_slice = data.begin_parse();

if (op == OP_UPDATE_GUARDIAN_SET) {
update_guardian_set(data_slice);
} elseif (op == OP_UPDATE_PRICE_FEEDS) {
Expand Down