Query Wildcard events concurrently with static events - #409
Merged
Conversation
DZakh
commented
Jan 9, 2025
Comment on lines
+20
to
+25
| | Normal({ | ||
| contractAddressMapping: ContractAddressingMap.mapping, | ||
| //Used to prune dynamic contract registrations in the event | ||
| //of a rollback. | ||
| dynamicContracts: array<TablesStatic.DynamicContractRegistry.t>, | ||
| }) |
Member
Author
There was a problem hiding this comment.
In the future, to support topic filtering for rpc, we'll need to have a partition per event.
Comment on lines
+95
to
+111
| switch (p, target) { | ||
| | ({kind: Wildcard}, _) | ||
| | (_, {kind: Wildcard}) => (p, Some(target)) | ||
| | ( | ||
| { | ||
| kind: Normal({ | ||
| contractAddressMapping: mergingContractAddressMapping, | ||
| dynamicContracts: mergingDynamicContracts, | ||
| }), | ||
| }, | ||
| { | ||
| kind: Normal({ | ||
| contractAddressMapping: targetContractAddressMapping, | ||
| dynamicContracts: targetDynamicContracts, | ||
| }), | ||
| }, | ||
| ) => { |
Member
Author
There was a problem hiding this comment.
The code is the same as before, it only skips merging for Wildcard partitions
Comment on lines
+381
to
+400
| type queryTarget = | ||
| | Head | ||
| | EndBlock({toBlock: int}) | ||
| | Merge({ | ||
| // The partition we are going to merge into | ||
| // It shouldn't be fetching during the query | ||
| intoPartitionId: string, | ||
| toBlock: int, | ||
| }) | ||
|
|
||
| // Strip internal fields from partition kind like dynamicContracts | ||
| type querySelection = | ||
| | Wildcard | ||
| | Normal({contractAddressMapping: ContractAddressingMap.mapping}) | ||
|
|
||
| type mergeQuery = { | ||
| // The catching up partition | ||
| type query = { | ||
| partitionId: string, | ||
| // The partition we are going to merge into | ||
| // It shouldn't be fetching during the query | ||
| intoPartitionId: string, | ||
| fromBlock: int, | ||
| toBlock: int, | ||
| contractAddressMapping: ContractAddressingMap.mapping, | ||
| } | ||
|
|
||
| type query = | ||
| | PartitionQuery(partitionQuery) | ||
| | MergeQuery(mergeQuery) | ||
|
|
||
| let queryFromBlock = query => { | ||
| switch query { | ||
| | PartitionQuery({fromBlock}) => fromBlock | ||
| | MergeQuery({fromBlock}) => fromBlock | ||
| } | ||
| } | ||
|
|
||
| let queryPartitionId = query => { | ||
| switch query { | ||
| | PartitionQuery({partitionId}) => partitionId | ||
| | MergeQuery({partitionId}) => partitionId | ||
| } | ||
| selection: querySelection, | ||
| target: queryTarget, |
Member
Author
There was a problem hiding this comment.
Change to make it easier to work according to the suggestion #405 (comment)
JasoonS
approved these changes
Jan 10, 2025
…istering wildcard event
DZakh
force-pushed
the
dz/partition-kinds
branch
from
January 10, 2025 12:22
7d28d73 to
678e186
Compare
DZakh
enabled auto-merge (squash)
January 10, 2025 12:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Even though the change looks scary, these are mostly test updates. What's going on:
Besides the partitions refactoring done in the previous release, the mane challenge of the PR is to make sure, that we always create partitions with the correct initial addresses (you can see it in the ChainFetcher logic). Now, a normal partition without addresses shouldn't be possible, so we throw an error on FetchState creation.