-
Notifications
You must be signed in to change notification settings - Fork 644
Implement Execution/Consensus interface over RPC #3617
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
base: master
Are you sure you want to change the base?
Implement Execution/Consensus interface over RPC #3617
Conversation
…on rpc server and connecting to one on both execution and consensus side
This PR has been changed from its initial design. Execution and Consensus each have capability to enable connections to them via json-rpc through the flags Nitro has two new flags that determine
Testing doneA new CI step has been added to run current system tests with json rpc interconnect enabled. Resolves NIT-2567 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 🙂, this is quite important for the alternative clients effort!
The way I see the UX on how to run a Nitro node, implemented in this repo, is something like this:
- Node operator runs only Execution
./nitro --consensus-node=false --execution-node=true
. In that case Execution will connect with Consensus through RPC. We don't even create a arbnode.Node object in this scenario. - Node operator runs only Consensus
./nitro --consensus-node=true --execution-node=false
. In that case Consensus will connect with Execution through RPC. - Node operator runs Execution and Consensus
./nitro --execution-node=true --consensus-node=true --consensus-execution-use-rpc=bool
. A single process will run both Execution and Consensus.
I don't like the --consensus-execution-use-rpc
flag on option 3 BTW, but it is worth having it for testing, at least for a while.
I don't see an advantage of running Option 3 over RPC in production if we have an option to have Consensus and Execution living in the same process.
But without this flag, to test this PR we would need to run two ./nitro
s, have an external component similar to consensusexecution_consensus.InitAndStartExecutionAndConsensusNodes, coordinating Execution/Consensus to handle the egg/chicken problem related to which component to start first.
It is a little bit different from what this PR is proposing.
WDYT?
ConsensusExecutionSyncer: DefaultConsensusExecutionSyncerConfig, | ||
SnapSyncTest: DefaultSnapSyncConfig, | ||
RPCServer: DefaultRPCServerConfig, | ||
ExecutionRPCClient: rpcclient.ClientConfig{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any specific reason for not using rpcclient.DefaultClientConfig?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rpcclient.DefaultClientConfig has URL = "self-auth" we dont want that as default so
if configFetcher.Get().ExecutionRPCClient.URL != "" { | ||
execConfigFetcher := func() *rpcclient.ClientConfig { return &configFetcher.Get().ExecutionRPCClient } | ||
executionClient = executionrpcclient.NewExecutionRpcClient(execConfigFetcher, nil) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: This code block is replicated in CreateNodeFullExecutionClient.
How about abstracting that into a function and calling it here and in CreateNodeFullExecutionClient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implementation has changed now and I feel like this is a small enough code diff to not warrant defining a function over...
|
||
var ErrSequencerInsertLockTaken = errors.New("insert lock taken") | ||
|
||
type MessageResult struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this defined in consensus instead of execution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure, i've removed it
To keep in mind:
By not worry I mean that we don't need to cover them in this PR, but we should definitely consider that those scenarios, could, and ideally will happen 🙂, so changes here shouldn't make our lives too difficult when covering them in the future. There is this test, in which is possible to create a Nitro node with an execution client that only implements the ExecutionClient interface, and not ExecutionRecorder, etc. That said, for this PR, the minimal requirements could be:
I am OK with covering all execution behaviors with the RPC approach right now TBH, it seems the way to go long term wise, but it is definitely not a requirement. We could have the same behavior without the --execution-node and --consensus-execution-use-rpc flags BTW, only relying on the rpc flags such as --execution-rpc-server and --execution-rpc-client.
WDYT? |
I've addressed your comments and added two new flags to nitro -
|
Fixes NIT-2567
I have implemented the JSON-RPC interface for the consensus and execution layer.
I setup a basic cli-arg setup has
--node.interconnect
which has 2 optionsdirect
the default uses the pre-existing interfacesjsonrpc
runs the Consensus and Execution interfaces over a json rpcI run
direct
and it works fine.jsonrpc
fails with"failed to create node err="not connected"
which to fix this I assume we need to ensure^ so basically ensuring the server's are running and properly connect before trying to use the interfaces
In terms of scope
Have configuration to use existing interface or new RPC interface
I set things up with this in mind. In the future I assume that we will allow users to specify running exclusively the consensus side so that a different execution layer client can be chosen, but to my knowledge that task was out of scope of this issue/pr and will definitely require some re-arranging and refactoring of how things are initialized.So I believe this Issue is more of a V1 before we add more complexity to how the node is initialized.
If anybody has any questions feel free to ask me
Updated description
#3617 (comment)