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

Scaffold smart contract event storage #105

Merged
merged 2 commits into from
Aug 12, 2024

Conversation

neekolas
Copy link
Contributor

@neekolas neekolas commented Aug 10, 2024

tl;dr

  • Adds function to run log streamer and store events
  • Creates flexible interface for deserializing and storing events
  • Updates mockery config and moves all mocks to a dedicated folder

AI Assisted summary

  • blockchain/interfaces: Remove Stop() method from LogStreamer interface, add custom logger name to RpcLogStreamer.
  • blockchain/rpcLogStreamer.go: Add buffered channel to ListenForContractEvent to improve event handling.
  • indexer/indexer.go: Add new file for starting the indexer service with configuration for message contract events.
  • storer: Implement error handling for the log storer, including support for retryable errors. Add mock for LogStorer.
  • Refactoring: Move existing mock generation to the 'mocks' package for better code organization.
  • server/options.go: Integrate ContractsOptions into the server options for configuration.

This was referenced Aug 10, 2024
Copy link
Contributor Author

neekolas commented Aug 10, 2024

@neekolas neekolas changed the title Scaffold smart contract event storage refactor mockery configurations & streamline RpcLogStreamer Aug 10, 2024
@neekolas neekolas changed the title refactor mockery configurations & streamline RpcLogStreamer Sc Aug 10, 2024
@neekolas neekolas changed the title Sc Scaffold smart contract event storage Aug 10, 2024
@neekolas neekolas marked this pull request as ready for review August 10, 2024 19:22
@neekolas neekolas force-pushed the 08-10-scaffold_smart_contract_event_storage branch 2 times, most recently from fb310ee to 87eaedc Compare August 10, 2024 19:25
This was referenced Aug 10, 2024
@neekolas neekolas requested a review from richardhuaaa August 12, 2024 21:34
@neekolas neekolas changed the base branch from 08-09-add_smart_contracts to graphite-base/105 August 12, 2024 21:35
@neekolas neekolas force-pushed the 08-10-scaffold_smart_contract_event_storage branch from 87eaedc to c4246b6 Compare August 12, 2024 21:38
@neekolas neekolas changed the base branch from graphite-base/105 to main August 12, 2024 21:38
@neekolas neekolas mentioned this pull request Aug 12, 2024
Comment on lines 55 to 59
continue Retry
}
}
logger.Info("Stored log", zap.Uint64("blockNumber", event.BlockNumber))
break Retry
Copy link
Contributor

Choose a reason for hiding this comment

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

Are the continue/break labels needed here? It seems like we're only breaking out of one loop

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not needed. I kinda like them for clarity, but that's definitely more a question of style than anything else.

pkg/indexer/indexer.go Outdated Show resolved Hide resolved

type LogStorageError interface {
error
ShouldRetry() bool
Copy link
Contributor

Choose a reason for hiding this comment

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

Love that retries are built in from the beginning

@neekolas neekolas merged commit 93fef55 into main Aug 12, 2024
5 checks passed
@neekolas neekolas deleted the 08-10-scaffold_smart_contract_event_storage branch August 12, 2024 22:59
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