Skip to content
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

Log Event Trigger Capability Development: Part 1 #14308

Merged
merged 45 commits into from
Sep 30, 2024

Conversation

kidambisrinivas
Copy link
Collaborator

@kidambisrinivas kidambisrinivas commented Sep 2, 2024

Updates

  • Log Event Trigger Capability to listen for specific events from contracts and start a workflow run
  • Built as a LOOPP Plugin process
  • Fetches ContractReader from RelayerSet passed in capability's Initialise method and uses it to Bind for a specific contract's event
  • Integration test with EVM relayer and ChainReader

References

Testing

$ go test -count=1 -v -run="^TestLogEventTriggerEVMHappyPath$" ./core/services/relay/evm/capabilities
            logger.go:146: 2024-09-30T22:32:12.405+0100 DEBUG   LogPoller       logpoller/log_poller.go:925     Polling for logs        {"version": "unset@unset", "currentBlockNumber": 5}
    logger.go:146: 2024-09-30T22:32:12.405+0100 DEBUG   LogPoller       logpoller/log_poller.go:1027    Latest blocks read from chain   {"version": "unset@unset", "latest": 4, "finalized": 2}
    logger.go:146: 2024-09-30T22:32:12.405+0100 DEBUG   LogPoller       logpoller/log_poller.go:937     No new blocks since last poll   {"version": "unset@unset", "currentBlockNumber": 5, "latestBlockNumber": 4}
    logger.go:146: 2024-09-30T22:32:12.438+0100 INFO    LogEventTriggerCapabilityService.LogEventTrigger.       logevent/trigger.go:141 Polling event logs from ContractReader using QueryKey at       {"version": "unset@unset", "time": "2024-09-30T22:32:12.438+0100", "startBlockNum": 0, "cursor": ""}
    logger.go:146: 2024-09-30T22:32:12.442+0100 INFO    testutils/chain_reader.go:119   Received log from ContractReader        {"version": "unset@unset", "event": "2-0-0x1260be74f7eebae959f26943cad3482061ee874a736829b936ecc2055b246f20"}
    logger.go:146: 2024-09-30T22:32:12.442+0100 INFO    capabilities/log_event_trigger_test.go:80       EmitLog {"version": "unset@unset", "output": {"Cursor":"2-0-0x1260be74f7eebae959f26943cad3482061ee874a736829b936ecc2055b246f20","Data":{"Arg0":10},"Head":{"Hash":"WhLchfaH8zTOz8cEAxpY0eywT/abTGjKORcxGH1T63s=","Height":"2","Timestamp":1727645551}}}
    logger.go:146: 2024-09-30T22:32:12.442+0100 INFO    LogEventTriggerCapabilityService        logevent/service.go:145 Stopping LogEventTriggerCapabilityService       {"version": "unset@unset"}
    logger.go:146: 2024-09-30T22:32:12.442+0100 INFO    LogEventTriggerCapabilityService.LogEventTrigger.       logevent/trigger.go:135 Closing trigger server for (waiting for waitGroup)    {"version": "unset@unset", "ChainID": "1337", "ContractName": "LogEmitter", "ContractAddress": "0x16401EFEa459E3C021248618B8Aca311E8e521ac", "ContractEventName": "Log1"}
--- PASS: TestLogEventTriggerEVMHappyPath (1.02s)
PASS
ok      github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/capabilities   2.501s

@kidambisrinivas kidambisrinivas requested a review from a team as a code owner September 2, 2024 14:40
@kidambisrinivas kidambisrinivas requested review from cedric-cordenier and removed request for a team September 2, 2024 14:40
Copy link
Contributor

@bolekk bolekk left a comment

Choose a reason for hiding this comment

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

It looks like this PR is only a skeleton of the Trigger, it doesn't actually process any logs. Can you modify the PR title to reflect that please?

core/capabilities/log_event_trigger/trigger.go Outdated Show resolved Hide resolved
core/capabilities/log_event_trigger/trigger.go Outdated Show resolved Hide resolved
jmank88
jmank88 previously approved these changes Sep 30, 2024
@kidambisrinivas kidambisrinivas added this pull request to the merge queue Sep 30, 2024
Merged via the queue into develop with commit 3e9e058 Sep 30, 2024
128 checks passed
@kidambisrinivas kidambisrinivas deleted the CM-378-log-event-trigger branch September 30, 2024 20:51
@kidambisrinivas kidambisrinivas restored the CM-378-log-event-trigger branch September 30, 2024 21:37
@kidambisrinivas kidambisrinivas deleted the CM-378-log-event-trigger branch September 30, 2024 22:28
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.

8 participants