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

Domain/Contract Level indexing #148

Closed
trajan0x opened this issue Aug 29, 2022 · 0 comments
Closed

Domain/Contract Level indexing #148

trajan0x opened this issue Aug 29, 2022 · 0 comments

Comments

@trajan0x
Copy link
Contributor

As part of efforts to separate indexing logic from agents, we've built (scribe #114) and (omnirpc #135). The final step here to making the off-chain agents invulnerable to chain-watching induced errors is configuring the indexer at a domain level. Currently, for notary (#77) we start an indexer to sync messages. This performs getLogs on the contracts and ignores every event from origin except for dispatch. Leaving starting this loop up to the notary will create the need to seperate dbs at an agent level despite these agents performing the same requests and makes testing harder.

Additionally, storing both agent level and indexer level data in the MessageDB interface creates the potential for logic errors in future work. Instead, we can do the following.

func NewIndexer(config DomainConfig, db ){}

DomainConfig struct {
    // Standard domain config (e.g. rpc, chain id, etc)
   DestinationAddress common.Address
   OriginAddress common.Address
   ConfirmationThreshold uint
   StartHeight uint32
   AttestationCollector common.Address
}

The indexer can then sync all events whichever of these contracts is not blank common.Adress{} != domainConfig.x and any agent can pull from that. Crucially, the IndexerDB exposes two types IndexWriter which is only used by the indexer and IndexReader which all agents use.

Each Notary, Broadcaster, Guard etc each have their own seperate db stores with the prefix based off the id speficied in the config.

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

No branches or pull requests

1 participant