There is def a way to configure the gas limit in the replica, but I’ve never tried to do that. @Prithvi or @Akhi, what do I put in my ic.toml to make this work? In any case, it definitely isn’t configurable via dfx, at least not right now. We need to add that. The only way to make it work right now would be to create a file called ic.toml in the current directory, and then run the replica independently of dfx (e.g. $HOME/.cahce/dfinity/versions/$DFX_VERSION/replica ic.toml). Though as I said, I don’t know the exact setting…
thanks, appreciate the answer. would be indeed very nice to have a flag for dfx! currently running while true loops leads to this error at some point it seems, which makes sense because ongoing computation consumes gas which obviously isnt unlimited in this case.
Those settings for the .toml were:
[scheduler]
# Maximum amount of gas execution of a single round can consume.
round_gas_max = 26843545600
# Maximum amount of gas execution of a single message can consume.
exec_gas = 5368709120
Dfx can now run a replica with flags for these too: dfx replica --port 8000 --round-gas-limit 26843545600 --message-gas-limit 5368709120
This won’t serve candid or a front end by itself though. If you want that, add a web server and point it at the replica: dfx bootstrap --providers http://127.0.0.1:8000/api
…which will listen on 8081 by default. So in a browser: localhost:8081/candid?canisterId=ic:<canister_id>
Following up on this - it seems as if those flags for dfx replica are no longer supported or were renamed. No matter what I specify as gas limits, the error message (when it does eventually run out of gas) is always:
Sep 18 12:18:33.309 WARN s:fscpm-uiaaa-aaaaa-aaaap-yai/n:5wjwg-gteaa-aaaaa-aaaap-2ai/ic_http_handler/read Could not perform query on canister: IC0501: Canister 75hes-oqbaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q ran out of gas limit 1000000000
So the gas limit seems to be fixed at 1000000000 - or the flags to configure it changed.
Edit: Maybe to clarify - that’s mostly annoying as the gas limit seems to be exhausted after ~0.6s already, which feels a tad low.
With the release of 0.6.9 the issue I had above seems to be resolved, with the canister no longer running out of gas way too quickly. A simple endless loop runs for >30s before seemingly timing out - plenty time for anything.