Guys one question here related to task3 in tsc5. Just to verify if what I'm thinking it's correct, and in case I'm not how can I solve this issue.
One of the things that it's required in the task is to "update the contract code" when it's needed. Is it correct to assume the following?
;; update_code comes in the inbound message, the second argument of the message
;; set_code will update the contract code after a successful termination of the current run
set_code(update_code);
;; set_c3 will set the c3, which according to the doc
;; "Contains the current dictionary, essentially a hashmap containing
;; the code of all functions used in the program"
;; So after this call, I could access for example "migrate_one" that it's in the "update_code", right?
set_c3(update_code.begin_parse().bless());
;; will call "migrate_one" with the current code association in my old c3
;; in the new code. To avoid this, I've read the it's recommended to fix the
;; code associated to this method, in both contracts, the new one and the old one.
;; For example using method_id(1666), I've seen something like this in the elector contract
;; and in the dns resolver contract. I've put the links bellow.
cell new_storage = migrate_one(old_storage);
Now I think I'm missing something here, because, I have no way to fix "method_id(1666)" in the incoming code, the "update_code" I mean. On my tests when I don't fix this "method_id" to the "migrate_one" and "process_message" as well, I get exit code 11. Which according to the doc it's:
Most oftenly caused by trying to call get-method whose id wasn't found in the code
Links:
DNS contract and Elector contract
Jan 6, 2024, 4:25 PM
Replacement of func with c , in code snippets makes highlight works , would you please edit it , thank you
Jan 6, 2024, 5:58 PM
Anyone?
Jan 7, 2024, 7:20 AM
basically this updating is dependent on the function order, and as long as the migration code will have all the same functions (not sure if all the functions are needed now that I think about it) in the same order the call will work. that's why the migrate_one is within the <<<<< >>>>> update-able part of the code - its place should not be changed.
Jan 7, 2024, 9:08 AM
If I get you right, this is assuming that you will have recv_internal, process_message and migrate_one only? In this same order. I understand the part of <<< and >>>, to replace the last two, but if you had auxiliar functions before these functions, will that matter? For example if you have in this order, fun1, fun2, recv_internal, process_message and migrate_one, would that affect it?
Jan 7, 2024, 10:01 AM