Closed 0xekez closed 1 year ago
The issue here I have discovered is that interchaintest uses the GasAdjustment
value set in ChainSpec
, and not the one in ChainConfig
. This is a little counterintuitive imo. Here's a spec that sets the gas adjustment to 2.0 for example:
gasAdjustment := 2.0
factory := interchaintest.NewBuiltinChainFactory(
zaptest.NewLogger(t),
[]*interchaintest.ChainSpec{
{
Name: "juno",
ChainName: "juno1",
Version: "latest",
GasAdjustment: &gasAdjustment,
ChainConfig: ibc.ChainConfig{
Denom: "ujuno",
GasPrices: "0.00ujuno",
EncodingConfig: wasm.WasmEncoding(),
},
},
{
Name: "juno",
ChainName: "juno2",
Version: "latest",
GasAdjustment: &gasAdjustment,
ChainConfig: ibc.ChainConfig{
Denom: "ujuno",
GasPrices: "0.00ujuno",
EncodingConfig: wasm.WasmEncoding(),
},
},
},
)
There is a separate-but-related issue that intercahintest does not set --gas auto
when executing messages which makes doing anything with smart contracts pretty hard. I've made a PR for this here: https://github.com/strangelove-ventures/interchaintest/pull/483
We don't want --gas auto
because it'll complain w/ two --gas
flags.
Rather, we want to follow this approach that @boojamya has in a branch. He'll follow up here.
Hey @0xekez,
You bring up a lot of good points in this issue.
To get you past this problem see:
https://github.com/strangelove-ventures/interchaintest/pull/496 - This should give you the ability to pass in that specific --gas auto
flag into InstantiateContract
https://github.com/strangelove-ventures/interchaintest/pull/489 - Will ensure that if you pass in --gas-prices
or --gas-adjustment
, your value will be used and not the value of the chainSpec/chainConfig
Which brings up another good point. It is indeed confusing that GasAdjustment
is in both the chainConfig
AND chainSpec
In order to break this issue down a bit more, I've created a separate issue for this topic: https://github.com/strangelove-ventures/interchaintest/issues/497
Lastly, do you have any insight as to why the query for listing the instances of a code ID returns an empty list (tn.ExecQuery(ctx, "wasm", "list-contract-by-code", codeID)
?
@boojamya: do you have any insight as to why the query for listing the instances of a code ID returns an empty list
for the case in this issue, I think that happens because instantiation errors and no contract is created. for whatever reason, instantiation erroring doesn't return an error here which causes the problem iirc.
InstantiateContract
To reproduce, check out the
zeke/gas-limits
branch and runjust integrationtest
.Note that the chain config used sets gas price and adjustment values:
But that in test output those values are not used. For example, when instantiating a contract the log output contains:
Note specifically:
--gas-adjustment 1.3
in the output which differs from the gas adjustment specified in the configuration.As always, it's totally possible I'm just doing this wrong. Thanks for your time!
another small thing, the contract instantiation running out of gas does not cause the expected error as
ExecTx
does not error. Instead, the query for listing the instances of a code ID returns an empty list and the error printed to the console ispanic: runtime error: index out of range [-1]
while indexing into the code ID list which has a length of zero. you can confirm that the error occuring is an out of gas error only by modifying the interchain test code to print the transaction output ofExecTx
like so: