Hi all 🙂

When deploying the contract code below with the initDataCell function, it fails. However, if a value other than 0 is used in initDataCell, the deployment is successful.



;; code
#pragma version >=0.2.0;

#include "../imports/stdlib.fc";

(int, int, int) load_data() inline {
slice ds = get_data().begin_parse();
int var1 = ds~load_uint(8);
int var2 = ds~load_uint(256);
int var3 = ds~load_uint(256);

return (
var1,
var2,
var3
);
}

() save_data(
int var1,
int var2,
int var3
) impure inline {
set_data(
begin_cell()
.store_uint(var1, 8)
.store_uint(var2, 256)
.store_uint(var3, 256)
.end_cell()
);
}

() recv_internal(int msg_value, cell in_msg_full, slice in_msg_body) impure {
if (in_msg_body.slice_empty?()) { ;; ignore empty messages
return ();
}
slice cs = in_msg_full.begin_parse();
int flags = cs~load_uint(4);

if (flags & 1) { ;; ignore all bounced messages
return ();
}
slice sender_address = cs~load_msg_addr();

int op = in_msg_body~load_uint(32);
int query_id = in_msg_body~load_uint(64);

throw(0xffff);
}

(int) version() method_id {
return (1234);
}



// Failed initDataCell in deploy ts script
beginCell()
.storeUint(0, 8)
.storeUint(0, 256)
.storeUint(0, 256)
.endCell()

// Successful initDataCell in deploy ts script
beginCell()
.storeUint(1, 8)
.storeUint(2, 256)
.storeUint(3, 256)
.endCell()



It seems not to be a Cell data bit length limit issue, but could you provide insights into the cause of this problem?

Jan 26, 2024, 2:30 AM
Do you also provide opcode and query ID during deployment? Do you have links to two contracts to compare?
Jan 26, 2024, 12:38 PM

© 2024 Draquery.com All rights reserved.