Skip to content

Renovate EventTrigger—add metadata, applyToFields, and change output to Value type #340

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

Merged
merged 12 commits into from
Jun 21, 2025

Conversation

chrisli30
Copy link
Member

@chrisli30 chrisli30 commented Jun 20, 2025

This pull request introduces changes across multiple areas, including workflow configuration, Makefile updates, error code adjustments, and refactoring of event handling and enrichment logic. The most significant updates focus on improving error handling consistency, simplifying event enrichment processes, and enhancing test organization.

Workflow Configuration Updates:

Makefile Enhancements:

  • Makefile: Updated descriptions for audit, test, and test/cover targets to clarify the exclusion of long-running integration tests. Introduced new targets test/integration and test/all for debugging and exhaustive testing purposes. [1] [2] [3]

Error Code Adjustments:

  • aggregator/rpc_server.go and core/taskengine/engine.go: Replaced deprecated error enums (e.g., avsproto.Error_*) with updated enums (avsproto.ErrorCode_*) for consistency and clarity in error handling. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Event Handling Refactor:

  • core/taskengine/engine.go: Refactored event enrichment logic to remove the enrichEventTriggerFromOperatorData function and its associated complexity. Event enrichment is now handled during parsing, leveraging structured data directly. Simplified logging for event triggers. [1] [2]

Test Organization Improvements:

  • Makefile: Introduced a dedicated test/integration target for debugging long-running integration tests and a test/all target for running all tests, including integration tests, outside of CI workflows.

Copilot

This comment was marked as outdated.

@chrisli30 chrisli30 changed the title Used JSON string for the output of EventTrigger Renovate EventTrigger—add metadata, applyToFields, and change output to Value type Jun 21, 2025
@chrisli30 chrisli30 requested a review from Copilot June 21, 2025 09:40
Copy link
Contributor

@Copilot Copilot AI left a 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 refactors event trigger outputs to use structured google.protobuf.Value, adds metadata and decimal formatting for contract reads, consolidates error enums under ErrorCode, and improves test and Makefile targets.

  • Switch EventTrigger and Run* responses to use Value instead of oneof fields.
  • Introduce MethodCall support and buildStructuredDataWithDecimalFormatting in contract reads.
  • Replace old Error enum with the unified ErrorCode and update references.

Reviewed Changes

Copilot reviewed 29 out of 33 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
protobuf/avs.proto Replaced oneof outputs with google.protobuf.Value data, added MethodCall, and unified error codes into ErrorCode.
operator/worker_loop.go Updated NotifyTriggers payload to send structured Value instead of EVM log oneof.
core/taskengine/vm_runner_contract_read.go Added buildStructuredDataWithDecimalFormatting and support for decimal formatting metadata.
core/taskengine/engine.go Removed enrichEventTriggerFromOperatorData, logging only structured data, and updated error code mappings.
Makefile Clarified audit, test, and test/cover descriptions; added test/integration and test/all targets.
Comments suppressed due to low confidence (2)

core/taskengine/vm_runner_contract_read.go:93

  • Consider adding unit tests for buildStructuredDataWithDecimalFormatting to verify decimal formatting logic across various edge cases (e.g., zero decimals, no fields to format).
func (r *ContractReadProcessor) buildStructuredDataWithDecimalFormatting(method *abi.Method, result []interface{}, decimalsValue *big.Int, fieldsToFormat []string) ([]*avsproto.ContractReadNode_MethodResult_StructuredField, map[string]interface{}) {

core/taskengine/tenderly_client_integration_test.go:20

  • The test notes skipping when TENDERLY_API_KEY is missing, but does not actually skip; add a t.Skip() or require.NotEmpty(t, os.Getenv("TENDERLY_API_KEY")) guard to avoid failures in environments without the key.
	// Skip if no Tenderly API key - this requires real network calls

o.logger.Error("Failed to create structured event data", "error", err)
continue
}

if resp, err := o.nodeRpcClient.NotifyTriggers(context.Background(), &avspb.NotifyTriggersReq{
Copy link
Preview

Copilot AI Jun 21, 2025

Choose a reason for hiding this comment

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

Use the passed ctx instead of context.Background() when calling NotifyTriggers so that cancellation and deadlines propagate correctly.

Suggested change
if resp, err := o.nodeRpcClient.NotifyTriggers(context.Background(), &avspb.NotifyTriggersReq{
if resp, err := o.nodeRpcClient.NotifyTriggers(ctx, &avspb.NotifyTriggersReq{

Copilot uses AI. Check for mistakes.

@chrisli30 chrisli30 merged commit 101bfeb into staging Jun 21, 2025
2 of 3 checks passed
@chrisli30 chrisli30 deleted the chris-run_trigger_event branch June 21, 2025 09:50
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.

1 participant