Skip to content

feat: Plugins improvements#410

Merged
zeljkoX merged 22 commits into
mainfrom
plugins-impr
Aug 5, 2025
Merged

feat: Plugins improvements#410
zeljkoX merged 22 commits into
mainfrom
plugins-impr

Conversation

@zeljkoX
Copy link
Copy Markdown
Collaborator

@zeljkoX zeljkoX commented Aug 4, 2025

Summary

This PR introduces a new approach to creating plugins, aimed at decoupling plugin implementation from the relayer repository.

Previously, plugins had to be defined in the plugins directory and were required to import the runPlugin function and PluginAPI type from the relayer repository to function properly.

Now, the runPlugin function is no longer used, eliminating that dependency. Instead, plugins are exported as named handler functions, which our system automatically detects and invokes.

The PluginAPI type will be exported via the SDK package, allowing custom plugins to import it from there.

With the new approach, users can easily define their plugin logic in shareable third-party packages and use them directly in the relayer repository or through Docker.

Currently, both approaches are supported, but the runPlugin-based approach will eventually be deprecated.

NOTE: We should publish types via sdk and update dep version and examples before merging this one.

Testing Process

Checklist

  • Add a reference to related issues in the PR description.
  • Add unit tests if applicable.

Comment thread examples/basic-example-plugin/config/config.json Outdated
Comment thread examples/basic-example-plugin/test-plugin/index.ts Outdated
Comment thread examples/basic-example-plugin/test-plugin/index.ts Outdated
Comment thread plugins/examples/example.ts Outdated
@zeljkoX zeljkoX marked this pull request as ready for review August 4, 2025 10:06
@zeljkoX zeljkoX requested review from a team as code owners August 4, 2025 10:06
@zeljkoX
Copy link
Copy Markdown
Collaborator Author

zeljkoX commented Aug 5, 2025

For some reason tests are failing in CI but not locally, debugging

Comment thread docs/modules/ROOT/pages/plugins.adoc Outdated
}
}
],
"networks": "./config/networks",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it is better to include the network that's being used, because otherwise you would need to include the networks folder in the example too.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is how is used in most examples and in out config.example.json

Comment thread examples/basic-example-plugin/docker-compose.yaml Outdated
Comment thread examples/basic-example-plugin/README.md
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.6%. Comparing base (f3c3426) to head (cd27bee).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #410     +/-   ##
=======================================
  Coverage   92.6%   92.6%             
=======================================
  Files        214     216      +2     
  Lines      69159   70950   +1791     
=======================================
+ Hits       64081   65749   +1668     
- Misses      5078    5201    +123     
Flag Coverage Δ
integration 0.5% <0.0%> (-0.1%) ⬇️
properties <0.1% <0.0%> (-0.1%) ⬇️
unittests 92.6% <100.0%> (+<0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

"dependencies": {
"@openzeppelin/relayer-sdk": "^1.2.1",
"@types/node": "^24.0.3",
"ethers": "^6.14.3",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does test plugin need ethers or uuid?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, leftover

Comment thread plugins/lib/plugin.ts
* Public interface for plugin API - only exposes methods that plugins should use.
* We are defining this interface here and in SDK. When changes are made to the interface, we need to update both places.
*/
export interface PluginAPI {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cant we just import this type from the SDK?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

For backward compatibility for now
We can once we stop supporting runPlugin

@zeljkoX zeljkoX merged commit 648a0f1 into main Aug 5, 2025
23 of 24 checks passed
@zeljkoX zeljkoX deleted the plugins-impr branch August 5, 2025 17:56
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants