-
Notifications
You must be signed in to change notification settings - Fork 68
Fixed operator eventTrigger not capturing all ERC20 transfer problem #329
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances event processing and execution state management for the task engine, addressing duplicate event handling, improved logging, and more robust trigger output processing. Key changes include:
- Updates to protobuf messages and generated code to include execution state fields.
- Modifications in operator and trigger processing logic to leverage new execution state and enhanced deduplication.
- Improvements in event query optimization and cleanup routines.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
protobuf/node.proto & protobuf/node.pb.go | Added execution state fields in NotifyTriggersResp to support detailed task status. |
operator/worker_loop.go | Updated logging and task removal logic based on new execution state fields. |
core/taskengine/vm*.go | Injected enhanced trigger configuration data to support downstream processing. |
core/taskengine/trigger/event.go | Improved event deduplication, optimized filter query grouping, and added cleanup for processed events. |
core/taskengine/run_node_immediately.go | Adjusted event search logic to perform comprehensive query searches. |
core/taskengine/engine.go & aggregator/rpc_server.go | Modified aggregator logic to leverage AggregateChecksResultWithState for robust trigger handling. |
core/taskengine/vm_trigger_config_test.go | Expanded tests to verify proper exposure of trigger configuration data. |
eventKey := fmt.Sprintf("%s-%d", log.TxHash.Hex(), log.Index) | ||
|
||
t.processedEventsMutex.Lock() | ||
if t.processedEvents[eventKey] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The duplicate deduplication checks in the main event loop and in processLog create redundancy. Consider centralizing the deduplication logic to a single function to reduce code duplication and potential inconsistency.
Copilot uses AI. Check for mistakes.
@@ -727,3 +934,32 @@ func (t *EventTrigger) cleanupOldEventCounts(blocksToKeep uint64) { | |||
} | |||
} | |||
} | |||
|
|||
// Add cleanup for processed events to prevent memory leaks | |||
func (t *EventTrigger) cleanupOldProcessedEvents(maxEvents uint64) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The current cleanup method removes arbitrary entries since the keys lack timestamps. To improve accuracy and avoid processing duplicates that may reappear soon, consider augmenting the deduplication keys with timestamps or another expiry mechanism.
Copilot uses AI. Check for mistakes.
…329) * Improved operator event trigger monitoring * Fixed operator eventTrigger not capturing all ERC20 transfer problem * Updated tests that failed in CI/CD
This pull request introduces several enhancements and fixes to the task engine, focusing on improved execution state handling, deduplication of events, and more robust event processing. The key changes include adding execution state tracking, ensuring event deduplication, and refining event-trigger processing logic.
Execution State Enhancements:
AggregateChecksResultWithState
to return detailed execution state, including task activity status, remaining executions, and error messages. UpdatedNotifyTriggers
to leverage this new method. (aggregator/rpc_server.go
,core/taskengine/engine.go
) [1] [2] [3] [4]Event Deduplication:
blockNumber-txHash-logIndex
) and avoid duplicate processing across multiple subscriptions. (core/taskengine/trigger/event.go
) [1] [2]Event Processing Improvements:
buildExecutionStepOutputData
to handlenil
trigger outputs gracefully by creating empty structures based on trigger type. (core/taskengine/engine.go
) [1] [2]buildTriggerDataMapFromProtobuf
to align field names with therunTrigger
format for consistency. (core/taskengine/engine.go
)Event Trigger Logic Refinements:
core/taskengine/trigger/event.go
) [1] [2]Event Search Optimization:
core/taskengine/run_node_immediately.go
) [1] [2] [3]