latticexyz / mud

MUD is a framework for building autonomous worlds
https://mud.dev
MIT License
692 stars 174 forks source link

Out of gas during deploy to conduit chains #2907

Open qbzzt opened 2 weeks ago

qbzzt commented 2 weeks ago

When deploying to a conduit blockchain, you might get an error due to the post deploy script being out of gas:

Error: Error:
Transaction Failure: <transaction hash>
Error running "forge script PostDeploy --broadcast --sig run(address) <world address> --rpc-url <conduit URL> -vvv --legacy --no-gas-limit"
    at o (file:/// < directory > /tutorial3/node_modules/.pnpm/@latticexyz+common@2.0.12_@aws-sdk+client-kms@3.598.0_asn1.js@5.4.1_typescript@5.4.2_zod@3.23.8/node_modules/@latticexyz/common/dist/foundry.js:2:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    (...)

For some reason we are still investigating the default gas estimates coming from the blockchain are too low, so the transaction runs out of gas.

Workaround

Use the --forgeScriptOptions command line parameter to specify the gas estimate multiplier forge script will use.

pnpm mud deploy --rpc $RPC_URL --forgeScriptOptions '\-\-gas-estimate-multiplier 200'
holic commented 2 weeks ago

This sounds more like a forge/foundry issue than a MUD issue. Can you get this to consistently happen running just the forge script? If so, should we submit an issue there?

To work around this in the meantime, can pass the --forgeScriptOptions flag with mud deploy

qbzzt commented 2 weeks ago

This sounds more like a forge/foundry issue than a MUD issue. Can you get this to consistently happen running just the forge script? If so, should we submit an issue there?

To work around this in the meantime, can pass the --forgeScriptOptions flag with mud deploy

Thank you. I updated the workaround above and added this option to the docs (https://github.com/latticexyz/mud/pull/2908).