inject privval instance spawned by cometbft into the signer #2981
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
At Chorus One, we recently deployed https://github.com/ChorusOne/nebula on Berachain as a remote signing solution that allows for decoupling of the validator node from the signer keys. It seemed to be running fine, but we noticed that our node was failing to propose a block.
After some further investigation, we found out that beacon-kit spawns another privval signer that's based on file-on-disk, requiring the node to have access to the key regardless of the remote signer deployed.
Also, the remote signer did not receive any
SignBytesrequests, which should be required for building blocks (IIRC it's randao?)Proposed solution
After starting CometBFT, inject the built privval signer into the component provided to depinject. I deployed this on a local devnet, and I'm seeing the network progress, and also started seeing the requests (which currently on mainnet are absent)
Test setup
Clone the forked repo and checkout
privval-for-signing-v2:Start beacon-kit:
In a separate terminal, start reth:
Let it produce a few blocks to make sure it works properly, then stop both nodes.
Update CometBFT to use a remote signer:
Grab the private key, it will be supplied to the remote signer:
Clone nebula repo:
Use this config file to connect to your local beacon-kit node. Please remember to update the
private_key_path:Nebula config inside
Start the Nebula signer:
Then, start beacon-kit and reth. Remember to not reset the current state, i.e input
nwhen prompted.In second terminal:
After some time, the Nebula signer will receive requests to sign bytes, prevotes, precommits, and proposals:
Nebula logs inside
This is the full development setup. The logs show expected results. Now we can substitute the key in beacon-kit repo for some dummy key, and the consensus will still move forward, as opposed to the current
mainbranch, where payloads for proposals will fail to be built because of theBlsSigneralways using the local key.Other notes
Ideally, we'd just change the
ProvideBlsSignerto return the Comet's privval from the get go, but that caused issues with circular dependencies, because we'd have to provide CometBFT service to the Signer, which currently is relatively pure and used by components which are in turn used by CometBFT, closing the loop.Maybe there's some more sophisticated way to handle this. If so, please let me know! I'm not very well versed with cosmossdk / cometbft development, so there's a big chance this solution isn't optimal