-
Notifications
You must be signed in to change notification settings - Fork 33
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
[IBC] Add Event Logging System (ICS-24) #824
Comments
I looked into the link of ICS-24 provided and just sharing additional info regarding the event logging system: Wanted to call out that @adshmh is working on adding |
I think if the However by generalising it this way we would likely need additional methods added to query the relays specifically (this is what we will need to do for the different event types anyway). To give context the |
@h5law To confirm, you're saying that using |
I am saying that there may be a better solution to the in memory map used by Cosmos depending on how we do pruning (ie how long should events be persisted for). But also the type EventManager interface {
StoreEvent(event Event)
GetEvents(type Type, height uint64) Event
} All I meant was that the current implementation with the relay specific methods could be removed and instead have a function like |
Appreciate the extra context. Here is my suggestion for an initial approach once you get to implementing git
|
## Description <!-- reviewpad:summarize:start --> ### Summary generated by Reviewpad on 13 Jul 23 12:29 UTC This pull request introduces several changes across multiple files. Here is a summary of the diff: 1. In the file `benchmark_state_test.go`, a slice of `uint8` is modified to generate a random value using the `rand.Intn` function, preventing duplicate keys. 2. In the file `persistence_module.go`, new methods `SetIBCEvent` and `GetIBCEvents` are added to enhance the persistence module's functionality for handling IBC events. 3. In a different file related to IBC functionality, imports are added, and new methods `SetIBCEvent` and `GetIBCEvents` are added for storing and retrieving IBC events at a specific height and topic. 4. In the file `persistence/types/ibc.go`, multiple changes include adding constants, new functions for generating queries, renaming a function, and modifying existing functions for handling IBC events and entries. 5. In the file `bus.go`, a new function `GetEventLogger` is added to the `bus` struct, returning a value of type `modules.EventLogger`. 6. Another file diff involves adding imports, initializing variables related to the IBC submodule, and updating the `Create()` function in the `ibc/host` package. 7. In `ibc_test.go`, there are modifications to test functions, adding new test functions, and adding an `attribute` struct. 8. A new file `ibc_event_module.go` is added, defining a package, imports, constants, types, and methods related to an event logging system. 9. Changes in `bus_module.go` show the addition of a new method `GetEventLogger` to the `Bus` interface. 10. In `persistence/debug.go`, functions `ClearAllIBCQuery`, `ClearAllIBCStoreQuery`, and `ClearAllIBCEventsQuery` are added/removed, and a modification is made to the `HandleDebugMessage` function signature. 11. A new file `event_manager.go` is added, containing the definition of the `EventManager` struct and implementing the `EventLogger` interface. 12. A change is made to add a new table creation statement for the IBCEventLog table in an unspecified file. 13. Changes in the file `ics24.md` introduce a new section for an event logging system in the IBC module, with an overview of its implementation and usage of a persistence layer. 14. A new file `ibc_events.proto` is added, defining message types for attributes and IBC events in the shared/core/types/proto directory. These changes aim to introduce and enhance functionality related to IBC events, event logging, and persistence in the project. <!-- reviewpad:summarize:end --> ## Issue Fixes #824 ## Type of change Please mark the relevant option(s): - [x] New feature, functionality or library - [ ] Bug fix - [ ] Code health or cleanup - [ ] Major breaking change - [ ] Documentation - [ ] Other <!-- add details here if it a different type of change --> ## List of changes - Adds the `EventLogger` interface and submodule - Adds methods to add events to the persistence DB - Adds methods to query the persistence DB for events by height and topic - Adds `IBCEvent` protobuf type - Registers `EventLogger` to the bus for retrieval ## Testing - [x] `make develop_test`; if any code changes were made - [x] `make test_e2e` on [k8s LocalNet](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md); if any code changes were made - [x] `e2e-devnet-test` passes tests on [DevNet](https://pocketnetwork.notion.site/How-to-DevNet-ff1598f27efe44c09f34e2aa0051f0dd); if any code was changed - [x] [Docker Compose LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md); if any major functionality was changed or introduced - [x] [k8s LocalNet](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md); if any infrastructure or configuration changes were made ## Required Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added, or updated, [`godoc` format comments](https://go.dev/blog/godoc) on touched members (see: [tip.golang.org/doc/comment](https://tip.golang.org/doc/comment)) - [x] I have tested my changes using the available tooling - [ ] I have updated the corresponding CHANGELOG ### If Applicable Checklist - [x] I have updated the corresponding README(s); local and/or global - [x] I have added tests that prove my fix is effective or that my feature works - [ ] I have added, or updated, [mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding README(s) - [ ] I have added, or updated, documentation and [mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*` if I updated `shared/*`README(s)
Objective
ICS-24 details an Event Logging system that is to be used by the relayers to retrieve packet data and timeout information. As the IBC stores are used to generate proofs and these proofs are what is committed to the blockchain state. The Event logging system will be added to whenever a new event is processed (ie. creating a new client, or sending a ICS-20 token transfer), these can then be queried by height and topic by relayers to retrieve the actual data in question.
This PR should focus on creating an
EventManager
interface and struct to interact with differentEvent
types. These should be implemented in a general fashion such as:The Event logging system should use an efficient data structure to underpin the Event storage to maximise IO ops and should also implement pruning to keep the number of events stored to the minimum number required.
Origin Document
ICS-24 defines the Event logging system and PR #795 mentions that the ICS-24 implementation is not complete. This PR should address this aspect of ICS-24
Reference ibc-go events and cosmos-sdk event manager
Goals
Deliverable
EventManager
interface and its struct implementationEvent
interface and its implementationEventManager
through the host like theStoreManager
Non-goals / Non-deliverables
General issue deliverables
Testing Methodology
make ...
make ...
make test_all
LocalNet
is still functioning correctly by following the instructions at docs/development/README.mdk8s LocalNet
is still functioning correctly by following the instructions hereCreator: @h5law
Co-Owners: @h5law
The text was updated successfully, but these errors were encountered: