refactor: pass queried chains to account ID calculation logic #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses the issue of a network-specific app deployment calling a provider from a different network (e.g.,
mainnet
app failed becausefilecoin
provider was down).The bug was as follows: due to account IDs being the same across different chains, the existing logic was somehow randomly selecting any chain from all queryable chains to create contract clients and execute the logic. These queryable chains are defined in the
RPC_CONFIG
. As a result, a deployment on themainnet
could request an account ID from afilecoin
contract instance (as long as it listed in the env var). Additionally, there was some more randomness involved, as the array of queryable chains was constructed based on the order of arbitrary JSON contract data.What has changed now is that the chain selection happens only on the chains indicated in the query. If no chain is specified in the query, the API will still search through all queryable chains, as this suggests that the caller wants results from every available chain, but this shouldn't cause any issues.