Closed m-Peter closed 2 months ago
The changes introduce stricter checks for EVM-related event ingestion by comparing event type IDs directly to predefined identifiers based on the chain ID. This avoids false positives from fake contracts. New structures and modified functions now pass and utilize these identifiers, ensuring precise event validation.
Files | Change Summary |
---|---|
models/events.go |
Imported necessary packages, added event identifier structs, and modified functions to use these IDs |
models/events_test.go |
Updated tests to include the new event identifiers |
services/ingestion/engine_test.go |
Refactored function calls to include new parameters |
services/ingestion/subscriber.go |
Replaced chain field with evmEventIDs and adjusted methods accordingly |
sequenceDiagram
participant Client
participant RPCSubscriber
participant CadenceEvents
participant EVMEventIdentifiers
Client->>RPCSubscriber: NewRPCSubscriber()
RPCSubscriber->>EVMEventIdentifiers: NewEVMEventIdentifiers(chainID)
EVMEventIdentifiers-->>RPCSubscriber: Identifiers
Client->>RPCSubscriber: subscribe()
RPCSubscriber->>CadenceEvents: NewCadenceEvents(events, evmEventIDs)
CadenceEvents-->>RPCSubscriber: CadenceEvents
RPCSubscriber->>RPCSubscriber: blocksFilter() using evmEventIDs
RPCSubscriber-->>Client: Filtered BlockEvents
Objective (Issues) | Addressed | Explanation |
---|---|---|
Safeguard the logic for ingesting EVM-related events (#356) | ✅ |
In the code where events do play, EVM checks now have their way. With stricter IDs, they stand tall, No fake events shall slip or call. Logic firm, our code refined, In Flow's domain, true events we'll find.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Since the event subscription already filters only the events we are interested in we don't have to check again if events are coming from the correct address.
Closes: https://github.com/onflow/flow-evm-gateway/issues/356
Description
This change performs a strict comparison on the type IDs from the emitted events, to make sure that we're only accepting events emitted from the
AddressLocation
of theEVM
contract, on each network.For contributor use:
master
branchFiles changed
in the Github PR explorerSummary by CodeRabbit
New Features
Refactor
Bug Fixes
Tests