Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): deploy systems/modules before registering/installing them #1767

Merged
merged 3 commits into from
Oct 13, 2023

Conversation

holic
Copy link
Member

@holic holic commented Oct 13, 2023

Using the pending block tag to simulate/estimate gas seems to give bad results if the a contract being called does not yet exist (i.e. is itself pending in the mempool). So we need to wait for contracts to be deployed before proceeding.

@changeset-bot
Copy link

changeset-bot bot commented Oct 13, 2023

🦋 Changeset detected

Latest commit: c771374

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@latticexyz/cli Patch
@latticexyz/abi-ts Patch
@latticexyz/block-logs-stream Patch
@latticexyz/common Patch
@latticexyz/config Patch
create-mud Patch
@latticexyz/dev-tools Patch
@latticexyz/ecs-browser Patch
@latticexyz/faucet Patch
@latticexyz/gas-report Patch
@latticexyz/network Patch
@latticexyz/noise Patch
@latticexyz/phaserx Patch
@latticexyz/protocol-parser Patch
@latticexyz/react Patch
@latticexyz/recs Patch
@latticexyz/schema-type Patch
@latticexyz/services Patch
@latticexyz/solecs Patch
solhint-config-mud Patch
solhint-plugin-mud Patch
@latticexyz/std-client Patch
@latticexyz/std-contracts Patch
@latticexyz/store-cache Patch
@latticexyz/store-indexer Patch
@latticexyz/store-sync Patch
@latticexyz/store Patch
@latticexyz/utils Patch
@latticexyz/world-modules Patch
@latticexyz/world Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@holic holic marked this pull request as ready for review October 13, 2023 10:52
@holic holic requested a review from alvrs as a code owner October 13, 2023 10:52

if (contractTxs.length) {
debug("waiting for contracts");
// wait for each tx separately/serially, because parallelizing results in RPC errors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because parallelizing results in RPC errors

oh interesting

Copy link
Member Author

@holic holic Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think because viem under the hood sets up a block watcher when you call waitForTransactionReceipt, so when we do this 100x in parallel, we get a LOT of polling of the RPC.

Since ultimately the waitForTransactionReceipt just does a getTransactionReceipt for each watched block until it succeeds, it's fine to do this serially, because each transaction confirmed in the same block or blocks before will return immediately without the polling.

That means they'll all resolve in the same amount of time with far less RPC calls.

@holic holic merged commit 61c6ab7 into main Oct 13, 2023
11 checks passed
@holic holic deleted the holic/deploy-contracts-order branch October 13, 2023 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants