neo-node icon indicating copy to clipboard operation
neo-node copied to clipboard

Optional RPC Server plugin dependency

Open AnnaShaleva opened this issue 5 months ago • 16 comments

Summary or problem description For cases like https://github.com/neo-project/neo/pull/4161#discussion_r2361427493 we need to provide an ability to disable RPC Server plugin dependency if needed.

For example, dBFT plugin requires StateService for stateroot calculation, but definitely doesn't need RPC Server plugin as a dependency (because RPC should likely be disabled on consensus nodes due to security reasons). However, right now StateService plugin requires RPC Server plugin as a dependency because StateService exposes a couple of RPC methods.

Do you have any solution you want to propose? For now, there are two possible solutions suggested:

  1. One solution is described in https://github.com/neo-project/neo/pull/4161#discussion_r2361427493: split StateService plugin into two plugins: plugin A should calculate stateroots, plugin B should expose state-related RPC methods. Then dBFT will be dependent from plugin A only, it won't introduce RPC Service plugin dependency to dBFT.
  2. Another solution is suggested by @shargon: decouple RpcMethod attribute implementation from RPC Server plugin and make RPC Server plugin dependency kind of an "optional". So that if RPC Server plugin is installed, then state-related RPC methods of StateService plugin are available, but if RPC Service plugin is not installed, then state-related RPC methods won't be exposed.

Where in the software does this update applies to?

  • Plugins

AnnaShaleva avatar Sep 22 '25 14:09 AnnaShaleva

I vote for @shargon's solution, it's simple and less invasive.

AnnaShaleva avatar Sep 22 '25 14:09 AnnaShaleva

Both solutions are good to me. I think that, in long term, both of them should be implemented, specially option 1.

For now, before 3.9.0 I think that any of them is good.

vncoelho avatar Sep 22 '25 14:09 vncoelho

Both work for me, but 2 is a bit preferable since it's less invasive and easier to manage.

roman-khimov avatar Sep 22 '25 14:09 roman-khimov

i dont like 2nd solution, easy as it is, but easy and simple should not be our way of working (not to mention its actually not a big deal or big issue or hard issue to fix at all), we should keep consistency, instead of having special case everywhere. simple as it is here, simple as it is there, special case here, special case there, in the end the proejct full of special case and no consistency at all, and when we maintain it, no system design but full of special cases.

Jim8y avatar Sep 23 '25 14:09 Jim8y

Both work for me, but 2 is a bit preferable since it's less invasive and easier to manage.

Like @Jim8y said, This makes more problems for us. RPC extensions should be just that, "extensions", not a requirement.

We have a messy house of code and don't need more when we are trying to fix and maintain this mess. Like I say all the time. One step forward 10 steps back. So, please do option one. We all need to be on the same page here with system designs, not a rando jumping in and doing their own thing. I been trying to get everyone on the same paper since I been working on NEO and all I get is ignored. No more asking, I'm telling you do the 1st one and split State Service. If not, blocked!

cschuchardt88 avatar Sep 23 '25 14:09 cschuchardt88

Option B is not a bad design, because option A require 3 plugins, B only will increase the state root functionalities if you installed the rpc server, otherwise, only will have the stateroot, simpler it's easier, for devs and users.

shargon avatar Sep 24 '25 03:09 shargon

Option B is not a bad design, because option A require 3 plugins, B only will increase the state root functionalities if you installed the rpc server, otherwise, only will have the stateroot, simpler it's easier, for devs and users.

Plugins do have a built-in communication protocol for talking to one another. So just put them all in RpcServer.

https://github.com/neo-project/neo/blob/9b9be47357e9065de524005755212ed54c3f6a11/src/Neo/Plugins/Plugin.cs#L241-L246

cschuchardt88 avatar Sep 24 '25 05:09 cschuchardt88

For me the best option right now is to decouple the RpcMethod attribute into a lightweight abstractions assembly making the RpcServer plugin an optional dependency. In my opinion this approach avoids introducing additional plugins to maintain, keeps StateService as a single module without forcing RPC exposure and minimizes deployment complexity

ajara87 avatar Sep 24 '25 07:09 ajara87

So you know just because a plugin is using RcpMethod doesn't mean It needs the RcpServer plugin loaded. Just look at the ApplicationLog

cschuchardt88 avatar Sep 24 '25 09:09 cschuchardt88

Check the implementation of Option 1).

I was carefully with the AI to make this split....aehuahea So, perhaps there is no change in the logic. I also verified accordingly.

As soon as you guys check that PR I will also proceed with some tests and we can follow to @superboyiii.

I still think that Option B is also good to be implemented, as I said.

But both are good to me and I think that if the PR i created worked we can implement both.

vncoelho avatar Sep 24 '25 22:09 vncoelho

But both are good to me and I think that if the PR i created worked we can implement both.

We have to stop allowing this. Having no design makes it very difficult to maintain and add new features. Please follow me and @Jim8y request. We are the developers maintaining this project mostly with @Wi1l-B0t now and we dont like cleaning up everyone else chicken scratch.

cschuchardt88 avatar Sep 25 '25 00:09 cschuchardt88

Votes for option 1 with👍

shargon avatar Oct 03 '25 09:10 shargon

Votes for option 2 with👍

shargon avatar Oct 03 '25 09:10 shargon

Votes for Option 1 and Option 2 being implemented with👍

vncoelho avatar Oct 03 '25 19:10 vncoelho

The easiest way is to move RpcMethodAttribute to neo library and be done with it.

cschuchardt88 avatar Oct 03 '25 20:10 cschuchardt88

The easiest way is to move RpcMethodAttribute to neo library and be done with it.

But maybe with other generic game

vncoelho avatar Oct 03 '25 20:10 vncoelho