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

feat: Full node mode #13

Merged
merged 19 commits into from
Oct 30, 2023
Merged

feat: Full node mode #13

merged 19 commits into from
Oct 30, 2023

Conversation

slowli
Copy link
Contributor

@slowli slowli commented Oct 26, 2023

What ❔

Allows to run a node without the consensus module. Refactors the executor library to be usable as a library and moves its binary to the tools crate.

Why ❔

We need to be able to use executor as a library from the consensus code; including when running an external node.

@@ -27,6 +27,8 @@ mod tests;
pub use crate::config::Config;
use crate::peers::PeerStates;

// FIXME(slowli): when run on validator node, the actor creates unnecessary `GetBlocks` requests
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd prefer to create a separate PR to fix this.

Comment on lines +85 to +86
replica_state_store: Arc<dyn ReplicaStateStore>,
blocks_sender: channel::UnboundedSender<FinalBlock>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These options could be made more fluent (e.g., if S implements ReplicaStateStore, it doesn't need to be provided again, and "standard" blocks_senders could be considered (e.g., one that saves a block to the store, or one that does nothing). I've decided against this to make code simpler.

node/tools/src/config/config_paths.rs Outdated Show resolved Hide resolved
@slowli slowli marked this pull request as ready for review October 27, 2023 07:12
@slowli slowli requested a review from pompon0 October 27, 2023 07:13
}

impl StateMachine {
/// Creates a new StateMachine struct. We try to recover a past state from the storage module,
/// otherwise we initialize the state machine with whatever head block we have.
pub(crate) async fn new(
ctx: &ctx::Ctx,
storage: Arc<dyn ReplicaStateStore>,
storage: FallbackReplicaStateStore,
Copy link
Collaborator

Choose a reason for hiding this comment

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

why "fallback"? It is supposed to be the primary source of state, with empty state being the fallback, no?

Copy link
Collaborator

Choose a reason for hiding this comment

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

or you mean WithFallback? But then do we need that verbosity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I've meant "store with fallback" (fallback being based on a BlockStore). Would something like FullReplicaStateStore work better?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess that would be better. But why not just ReplicaStateStore? The fallback is an implementation detail from the pov of this function. Perhaps we should make FallbackReplicaStateStore into a trait instead of ReplicaStateStore?

optional string metrics_server_addr = 2; // IpAddr

// Consensus network config.
optional ConsensusConfig consensus = 3;
Copy link
Collaborator

Choose a reason for hiding this comment

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

while you are at it please annotate all fields in this file as either optional or required (by just suffixing the field definition with a comment: "// required" or "// optional".

node/Cargo.toml Outdated
@@ -26,7 +26,7 @@ assert_matches = "1.5.0"
async-trait = "0.1.71"
bit-vec = "0.6"
blst = "0.3.10"
clap = { version = "4.3.3", features = ["derive"] }
clap = { version = "4.3.3", features = ["derive", "env"] }
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO we can drop support for specifying stuff via env vars. We don't use it and we will use eventually the zksync-era style configuration anyway.

.iter()
.any(|validator_key| validator_key == public),
"Key {public:?} is not a validator per validator set {:?}",
self.executor_config.validators
Copy link
Collaborator

Choose a reason for hiding this comment

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

Having a validator config, even though you are not a validator currently should be a valid setup. Once the validator set is dynamic, a node should be able to join and leave the consensus network. For now it would be enough to just ignore the ConsensusNetwork config if node is not a validator.

@pompon0 pompon0 self-requested a review October 27, 2023 14:47
pompon0
pompon0 previously approved these changes Oct 27, 2023
brunoffranca
brunoffranca previously approved these changes Oct 27, 2023
node/libs/concurrency/src/metrics.rs Outdated Show resolved Hide resolved
@slowli slowli merged commit 0217158 into main Oct 30, 2023
3 of 4 checks passed
@slowli slowli deleted the aov-bft-243-full-node-mode branch October 30, 2023 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants