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

Allow Besu to host RPC endpoints via a plugin. #2754

Merged
merged 18 commits into from
Oct 11, 2021

Conversation

antonydenyer
Copy link
Member

@antonydenyer antonydenyer commented Sep 13, 2021

PR description

re-implementation of PegaSysEng/pantheon#1909

Implements #1317

You can now register endpoints using

context
  .getService(RpcEndpointService.class)
  .get()
  .registerRPCEndpoint("namespace", "method", request -> {
    return "any serializable response";
  });

To enable the endpoint you must utilise --rpc-http-api and specify the namespace e.g --rpc-http-api namespace.

Changelog

@vmichalik
Copy link

Watching! This is a great addition

@vmichalik vmichalik added the enhancement New feature or request label Sep 13, 2021
@antonydenyer antonydenyer force-pushed the json-rpc-plugin branch 2 times, most recently from 5dce0d8 to 908bfac Compare September 15, 2021 12:15
@antonydenyer antonydenyer marked this pull request as ready for review September 15, 2021 12:28
@antonydenyer antonydenyer force-pushed the json-rpc-plugin branch 2 times, most recently from b1b29e5 to 6badf77 Compare September 16, 2021 08:46
antonydenyer and others added 4 commits September 17, 2021 12:03
re-implementation of PegaSysEng/pantheon#1909

Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Co-authored-by: Danno Ferrin <danno.ferrin@gmail.com>
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
…-apis

Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
@antonydenyer antonydenyer changed the title Initial PoC for RPC end points via the plugin mechanism. Allow Besu to host RPC endpoints via a plugin. Sep 20, 2021
Copy link
Contributor

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

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

LGTM, I wonder whether we want to enable the ability to override built-in rpc endpoints though?

Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
@macfarla
Copy link
Contributor

macfarla commented Oct 1, 2021

LGTM. I can't think of a good reason to need to override built in endpoints.

Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
fix build

Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Copy link
Contributor

@macfarla macfarla left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
@antonydenyer antonydenyer merged commit a30c314 into hyperledger:main Oct 11, 2021
@antonydenyer antonydenyer deleted the json-rpc-plugin branch October 11, 2021 08:45
jframe added a commit to jframe/besu that referenced this pull request Oct 12, 2021
commit 75b4a41
Author: Jason Frame <jasonwframe@gmail.com>
Date:   Tue Oct 12 13:47:01 2021 +1000

    add block header test case

    Signed-off-by: Jason Frame <jasonwframe@gmail.com>

commit 7d3001d
Author: Jason Frame <jasonwframe@gmail.com>
Date:   Tue Oct 12 13:31:08 2021 +1000

    undo unintentional change fixing unit test

    Signed-off-by: Jason Frame <jasonwframe@gmail.com>

commit 772a428
Author: Jason Frame <jasonwframe@gmail.com>
Date:   Tue Oct 12 13:21:56 2021 +1000

    Qbft validation selection was incorrectly being applied for non validator selection mode transitions

    Signed-off-by: Jason Frame <jasonwframe@gmail.com>

commit a30c314
Author: Antony Denyer <git@antonydenyer.co.uk>
Date:   Mon Oct 11 09:45:52 2021 +0100

    Allow Besu to host RPC endpoints via a plugin. (hyperledger#2754)

    This is a re-implementation of the initial POC done in PegaSysEng/pantheon#1909 by Danno Ferrin <danno.ferrin@gmail.com>

    * Only enable plugin rpc api when enabled on --rpc-http-api or --rpc-ws-apis
    * Only allow new rpc endpoints to be defined

    Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>

commit fc687ab
Author: Simon Dudley <simon.dudley@consensys.net>
Date:   Mon Oct 11 08:18:03 2021 +0100

    Qbft RPCs should be disabled after starting with or switching to use validator contract (hyperledger#2817)

    Signed-off-by: Simon Dudley <simon.dudley@consensys.net>

commit 93013e9
Author: Usman Saleem <usman@usmans.info>
Date:   Fri Oct 8 15:51:40 2021 +1000

    Add QBFT support for evmtool (hyperledger#2807)

    * qbft support in evmtool

    Signed-off-by: Usman Saleem <usman@usmans.info>

commit 215e18c
Author: Sally MacFarlane <sally.macfarlane@consensys.net>
Date:   Fri Oct 8 12:32:52 2021 +1000

    master.svg -> main.svg (hyperledger#2864)

    Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

commit 82ecef6
Author: Sally MacFarlane <sally.macfarlane@consensys.net>
Date:   Fri Oct 8 11:13:11 2021 +1000

    Fixed build badge (hyperledger#2863)

    * typos

    Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

    * master -> main

    Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

commit 5fbf0b1
Author: Sally MacFarlane <sally.macfarlane@consensys.net>
Date:   Thu Oct 7 19:22:47 2021 +1000

    changed to trace level logging (hyperledger#2858)

    Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

commit fdd9352
Author: Diego López León <dieguitoll@gmail.com>
Date:   Wed Oct 6 21:51:33 2021 -0300

    Add a bash/zsh autocomplete script to distributions (hyperledger#538) (hyperledger#2854)

    Signed-off-by: Diego López León <dieguitoll@gmail.com>
jflo pushed a commit to jflo/besu that referenced this pull request Oct 14, 2021
This is a re-implementation of the initial POC done in PegaSysEng/pantheon#1909 by Danno Ferrin <danno.ferrin@gmail.com>

* Only enable plugin rpc api when enabled on --rpc-http-api or --rpc-ws-apis
* Only allow new rpc endpoints to be defined

Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
jflo pushed a commit to jflo/besu that referenced this pull request Oct 14, 2021
This is a re-implementation of the initial POC done in PegaSysEng/pantheon#1909 by Danno Ferrin <danno.ferrin@gmail.com>

* Only enable plugin rpc api when enabled on --rpc-http-api or --rpc-ws-apis
* Only allow new rpc endpoints to be defined

Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Signed-off-by: Justin Florentine <justin.florentine@consensys.net>
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
This is a re-implementation of the initial POC done in PegaSysEng/pantheon#1909 by Danno Ferrin <danno.ferrin@gmail.com>

* Only enable plugin rpc api when enabled on --rpc-http-api or --rpc-ws-apis
* Only allow new rpc endpoints to be defined

Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable plugins to expose custom JSON RPC / GraphQL / WebSocket methods
4 participants