Skip to content

fix: runTrigger with transfer and use oneOf for transfer_log and evm_log #310

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 4 commits into from
Jun 4, 2025

Conversation

chrisli30
Copy link
Member

No description provided.

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 enforces mutually exclusive evm_log and transfer_log fields via a oneof in EventTrigger.Output, updates all code paths and tests to use the new structure, and enhances the event‐trigger search strategy with chain‐specific ranges and improved logging.

  • Introduce oneof output_type in protobuf/avs.proto and regenerate Go bindings.
  • Refactor operator, VM, engine, and RPC handler to set and read OutputType instead of raw EvmLog/TransferLog fields.
  • Improve runEventTriggerImmediately with 3-month/6-month search ranges, chunked queries, richer logs, and a 60 s timeout; update docs and tests.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
protobuf/avs.proto Add oneof output_type to EventTrigger.Output for exclusive fields
protobuf/avs.pb.go Regenerate bindings to support the new OutputType interface
operator/worker_loop.go Set OutputType when notifying the aggregator
docs/EventTrigger-Chain-Specific-Search.md Add a new doc outlining 3- and 6-month chain-specific ranges
core/testutil/utils.go Update test util to populate OutputType in dummy trigger data
core/taskengine/vm_test.go Update tests to construct oneof data and initialize VM without separate transfer param
core/taskengine/vm.go Remove old EvmLog/TransferLog fields; use Event oneof
core/taskengine/token_metadata_test.go Adjust test for whitelist-only metadata behavior
core/taskengine/token_metadata.go Change comment to clarify nil return when no RPC client
core/taskengine/run_node_immediately.go Switch to chain-specific search ranges, richer logging, and 60 s timeout
core/taskengine/engine.go Refactor enrichment to set OutputType for transfer vs. raw events
core/taskengine/blockchain_constants.go Add GetBlockSearchRanges and GetChainSearchRanges helpers
core/taskengine/blockchain_constants_test.go New tests for block range calculations and slice helper
Comments suppressed due to low confidence (3)

core/taskengine/vm_test.go:538

  • The tests no longer cover the raw EvmLog branch of the new oneof OutputType. Add a test case where only an EvmLog is provided to verify the VM correctly populates and retrieves the EvmLog branch.
func TestEvaluateEvent(t *testing.T) {

core/taskengine/token_metadata_test.go:276

  • [nitpick] The test name TestGetTokenMetadataNotFound no longer matches its behavior of returning nil metadata without error. Consider renaming it to something like TestGetTokenMetadataWhitelistOnlyReturnsNil for clarity.
func TestGetTokenMetadataNotFound(t *testing.T) {

protobuf/avs.proto:164

  • [nitpick] Grammar nit: These shape of data is is incorrect. Consider changing to The shape of the data is or This shape of data is.
// These shape of data is https://docs.ethers.org/v6/api/providers/#Log

@chrisli30 chrisli30 merged commit cdeaa83 into staging Jun 4, 2025
16 checks passed
chrisli30 added a commit that referenced this pull request Jun 9, 2025
…log (#310)

* fix: runTrigger with transfer and use oneOf for transfer_log and evm_log

* Fix failing CI/CD and updated test case naming to reflect function

* Added more caught error messages

* Reduce timeout in runEventTriggerImmediately
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