Hi,
I get a very weird error in testnet. Can anyone help me please?

If I use lite-client to connect to testnet, and do getconfig 18 I can see a valid storage prices config similar to mainnet.

But when I use config_param(18) in my get method in a smart contract, it returns null!

Here is the super simple smart contract:

#include "imports/stdlib.fc";

() recv_internal() impure {
}

cell get_fees() method_id {
return config_param(18);
}

Jul 19, 2023, 1:09 PM
lite-client cannot take data from the network config inside contracts
tonlibjson can
Jul 19, 2023, 1:11 PM
I don't understand. Can you elaborate a little more?

lite-client shows me the config for param 15 which is different from mainnet.
Jul 19, 2023, 1:13 PM
TVM inside the lite-client is not able to get data from the network configuration. Accordingly, when starting a smart contract, a local TVM is launched and gives an error.
If you call a separate command in lite-client (getconfig), then TVM does not start
Jul 19, 2023, 1:18 PM
Thank you very much for answering, however, I still don't understand. I may miss something obvious here.

Let me explain the problem.

I wrote this simple code:
#include "imports/stdlib.fc";

() recv_internal() impure {
}

cell get_fees() method_id {
return config_param(18);
}

Which I think should return the storage prices config in testnet. When I deploy it using Blueprint, the get_fees method returns null.

I first thought that the config param 18 is null in testnet. Then I used lite-client to connect to testnet and query the config param. It returned a value similar to mainnet. I checked config param 15 and it returned a different value. So I concluded that config params 15 and 18 are available in testnet.

But now I wonder why the simple code that I presented is not working.
I deployed the simple code on testnet:

kf-aagBGHVPNYqVDVs2srnj1A-YqkB32XqEhblRpdxd2rLQ6

Then if I run this command in lite-client:
runmethod kf-aagBGHVPNYqVDVs2srnj1A-YqkB32XqEhblRpdxd2rLQ6 get_fees

returns this:
arguments: [ 67344 ]
result: [ () ]


and running:
getconfig 18

returns this:
ConfigParam(18) = (
(hm_edge
label:(hml_same v:0 n:32)
node:(hmn_leaf
value:( utime_since:0 bit_price_ps:1 cell_price_ps:500 mc_bit_price_ps:1000 mc_cell_price_ps:500000))))

x{D06600000000000000000000000080000000000000FA00000000000001F4000000000003D0904_}
I think I got your point.

I used testnet.ton.cx and the get methods there worked correctly.

So it seems that Blueprint is also using lite-client (right?), which is unable to access network configs in TVM.

So everything is correct and this weird behavior is from lite-client.
I also tested with tonlib and it worked. Thanks.
Jul 19, 2023, 2:22 PM

© 2024 Draquery.com All rights reserved.