help :v
Error: Func compilation error: contracts/task2.fc:88:21: error: cannot apply function store_uint : (builder, int, int) -> builder to arguments of type (builder, slice, int): cannot unify type slice with int
.store_coins(10 * 10 / 10)
Dec 30, 2023, 7:04 AM
second argument is slice , you send int
Func compilation error: contracts/task1.fc:7:3: error: uint256 is not a type identifier
(uint256 ,uint32 ,uint32 ,uint32 ) unpack() impure inline_ref {
(uint256 ,uint32 ,uint32 ,uint32 ) unpack() impure inline_ref {
what cause this problem? anybody knows?
Dec 30, 2023, 9:08 AM
use only int not uint 256 or 32
better use var
error: cannot apply function _>_ : (int, int) -> int to arguments of type (int, ??64 -> ??65): cannot unify type ??64 -> ??65 with int
throw_unless(124, curr_time > execution_time);
throw_unless(124, curr_time > execution_time);
Help
my bad, i forgot about scope of variables sorry
I guess I am reading the inputs wrong, can someone help me with understanding the TL-B scheme
ive read 60-70% documentation, didnt find this format in tl-b data format
help :(
Dec 30, 2023, 11:46 AM
Here is what that'd look like in FunC, I think this can help
begin_cell()
.store_uint(0x9df10277, 32)
.store_uint(query_id, 64)
.store_slice(signature)
.store_ref(
begin_cell()
.store_uint(locked_for, 32)
.store_uint(seqno, 32)
.end_cell()
)
.end_cell();
begin_cell()
.store_uint(0x9df10277, 32)
.store_uint(query_id, 64)
.store_slice(signature)
.store_ref(
begin_cell()
.store_uint(locked_for, 32)
.store_uint(seqno, 32)
.end_cell()
)
.end_cell();
Dec 30, 2023, 11:49 AM
I am actually confused here :
am i reading the values correctly? cause ive no clue whats going on, im unable to log and debug as in usual dev (im new to blockchain, specially funC)
Dec 30, 2023, 11:53 AM
can you send that in text form? I'll fix it for you
Dec 30, 2023, 11:53 AM
() recv_external(slice in_msg) impure {
slice tmp_in_msg = in_msg;
int op = tmp_in_msg~load_uint(32);
int query_id = tmp_in_msg~load_uint(64);
;; int locked_for = tmp_in_msg~load_uint(32);
slice tmp_in_msg = in_msg;
int op = tmp_in_msg~load_uint(32);
int query_id = tmp_in_msg~load_uint(64);
;; int locked_for = tmp_in_msg~load_uint(32);
thanks!
Dec 30, 2023, 11:53 AM
the locked_for and seqno are stored in a reference, but you are not loading the reference
Dec 30, 2023, 11:53 AM
i have actually commented that part to process them under specific operation codes
*maybe im wrong*
Dec 30, 2023, 11:55 AM
Here is the code with a bit of explanation. You technically don't need to copy in_msg to tmp_in_msg and to signature but this gets the point across well.
slice tmp_in_msg = in_msg;
int op = tmp_in_msg~load_uint(32);
int query_id = tmp_in_msg~load_uint(64);
;; Load the reference
;; `begin_parse` converts the reference `cell` to `slice`
;; `cell` for storing, `slice` for reading, `builder` for building cells.
slice reference = tmp_in_msg~load_ref().begin_parse();
;; Load the values from the reference
int locked_for = reference~load_uint(32);
int new_seqno = reference~load_uint(32);
;; The signature will be the leftover 512 bits from the previous slice
slice signature = tmp_in_msg;
slice tmp_in_msg = in_msg;
int op = tmp_in_msg~load_uint(32);
int query_id = tmp_in_msg~load_uint(64);
;; Load the reference
;; `begin_parse` converts the reference `cell` to `slice`
;; `cell` for storing, `slice` for reading, `builder` for building cells.
slice reference = tmp_in_msg~load_ref().begin_parse();
;; Load the values from the reference
int locked_for = reference~load_uint(32);
int new_seqno = reference~load_uint(32);
;; The signature will be the leftover 512 bits from the previous slice
slice signature = tmp_in_msg;
Dec 30, 2023, 11:58 AM
i kind of get it, thank you so much but why is signature listed before the reference??
Dec 30, 2023, 12:01 PM
well, my guess would be:
you need the entirety of the reference to do a signature check later, and you can't sign a cell that you have to put your signature inside of :)
so the signature has to be outside of the data, and while it could be put in another reference, so it'd be sequentially after the data, there is not really a need, since we still have data bits in the original cell left, so we just store it there as that's more optimized than unnecessary references
you need the entirety of the reference to do a signature check later, and you can't sign a cell that you have to put your signature inside of :)
so the signature has to be outside of the data, and while it could be put in another reference, so it'd be sequentially after the data, there is not really a need, since we still have data bits in the original cell left, so we just store it there as that's more optimized than unnecessary references
Dec 30, 2023, 12:04 PM
Okay! This was helpful, Thanks!
quick question: how do i see logs (outputs from ~dump(); commands) in github actions?
if someone can help me debug my code, pls dm :)
Dec 30, 2023, 12:43 PM