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

Rework consensus and graph #3162

Merged
merged 47 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
81fca31
Init v2 exports massa-graph.
AurelienFT Sep 26, 2022
d4cd93f
Add skeleton of new graph.
AurelienFT Sep 27, 2022
14fac1c
Add main loop of graph worker.
AurelienFT Sep 27, 2022
171349e
Fix main loop graph to avoid skipping slot when receiving command fro…
AurelienFT Sep 27, 2022
c5a64fc
Add shared state in graph thread and graph controller.
AurelienFT Sep 27, 2022
6d33ce6
Add first version of init of new block graph.
AurelienFT Sep 28, 2022
f6eb377
Refactor init function.
AurelienFT Sep 28, 2022
b72fe50
Add getter function and fill the state.
AurelienFT Sep 28, 2022
3b4c990
Add commands manager.
AurelienFT Sep 29, 2022
4da3972
Add lock for state.
AurelienFT Sep 29, 2022
d69a802
Move all variable in the state and the functions that process it.
AurelienFT Sep 30, 2022
036696c
Merge branch 'main' into remove_consensus
AurelienFT Oct 4, 2022
384928e
Merge branch 'main' into remove_consensus
AurelienFT Oct 10, 2022
c9cdba1
Add slot tick to new version of consensus. Need to fix errors with pr…
AurelienFT Oct 10, 2022
42c0b6c
Merge branch 'main' into remove_consensus
AurelienFT Oct 11, 2022
86dd52d
Fix send protocol.
AurelienFT Oct 11, 2022
91e1ea8
Add process of block and block header
AurelienFT Oct 11, 2022
10c5130
Add fetch get stats.
AurelienFT Oct 12, 2022
54db8d3
Move code from worker to state.
AurelienFT Oct 12, 2022
bbd8d43
Move graph functions in a specific file.
AurelienFT Oct 13, 2022
a41f567
Add docs and split functions of the graph.
AurelienFT Oct 13, 2022
1aea183
Format and clippy.
AurelienFT Oct 13, 2022
5e0c96f
Add documentation about state and channels communication in graph
AurelienFT Oct 18, 2022
387d5ef
Link new graph to the main.
AurelienFT Oct 18, 2022
e274667
Merge branch 'main' into remove_consensus
AurelienFT Oct 18, 2022
26ff121
Merge branch 'remove_consensus' into link_new_graph
AurelienFT Oct 18, 2022
1bf1383
Fix stopping consensus.
AurelienFT Oct 18, 2022
5eac870
Start replacing module everywhere.
AurelienFT Oct 19, 2022
2e0881b
Fix usage of old graph crate.
AurelienFT Oct 19, 2022
a986ad0
Add mock graph.
AurelienFT Oct 19, 2022
82a3b51
Fix test compilation.
AurelienFT Oct 21, 2022
f412e4c
Fix warnings and format.
AurelienFT Oct 21, 2022
2d0bbd8
Fix call to blocking context in async contexts in tests.
AurelienFT Oct 24, 2022
d8e0e9d
Fix doc tests
AurelienFT Oct 24, 2022
f02dcb0
Merge branch 'prepare_testnet_16' into link_new_graph
AurelienFT Oct 24, 2022
8d6fef8
Remove unnecessary import.
AurelienFT Oct 24, 2022
c55bf24
Revert config client.
AurelienFT Oct 24, 2022
337aa9b
Add doc and fix stop
AurelienFT Oct 24, 2022
70cc951
Add storage of protocol blocks in graph.
AurelienFT Oct 25, 2022
e8ec65c
Rename graph to consensus.
AurelienFT Oct 25, 2022
f3c1328
Fix format and remove todos.
AurelienFT Oct 25, 2022
58748fb
Add print debug each slot
AurelienFT Oct 26, 2022
747ebce
Add pruning functions.
AurelienFT Oct 27, 2022
5dcf004
Remove debug print.
AurelienFT Oct 27, 2022
a301550
Merge branch 'testnet_17' into link_new_graph
AurelienFT Nov 2, 2022
3e2ba48
Make channels from consensus to protocol blocking.
AurelienFT Nov 15, 2022
dd57ceb
Update tests.
AurelienFT Nov 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 31 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ members = [
"massa-bootstrap",
"massa-client",
"massa-cipher",
"massa-consensus-exports",
"massa-consensus-worker",
"massa-execution-exports",
"massa-execution-worker",
"massa-factory-exports",
"massa-factory-worker",
"massa-graph",
"massa-consensus-exports",
"massa-consensus-worker",
"massa-hash",
"massa-logging",
"massa-models",
Expand Down
1 change: 0 additions & 1 deletion massa-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ itertools = "0.10"
parking_lot = { version = "0.12", features = ["deadlock_detection"] }
# custom modules
massa_consensus_exports = { path = "../massa-consensus-exports" }
massa_graph = { path = "../massa-graph" }
massa_hash = { path = "../massa-hash" }
massa_models = { path = "../massa-models" }
massa_network_exports = { path = "../massa-network-exports" }
Expand Down
9 changes: 9 additions & 0 deletions massa-api/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2022 MASSA LABS <[email protected]>

use jsonrpc_core::serde::Deserialize;
use massa_time::MassaTime;
use std::net::SocketAddr;

/// API settings.
Expand All @@ -27,4 +28,12 @@ pub struct APIConfig {
pub max_function_name_length: u16,
/// max parameter size
pub max_parameter_size: u32,
/// thread count
pub thread_count: u8,
/// `genesis_timestamp`
pub genesis_timestamp: MassaTime,
/// t0
pub t0: MassaTime,
/// periods per cycle
pub periods_per_cycle: u64,
}
8 changes: 1 addition & 7 deletions massa-api/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub enum ApiError {
/// `massa_hash` error: {0}
MassaHashError(#[from] MassaHashError),
/// consensus error: {0}
ConsensusError(#[from] Box<ConsensusError>),
ConsensusError(#[from] ConsensusError),
/// execution error: {0}
ExecutionError(#[from] ExecutionError),
/// network error: {0}
Expand Down Expand Up @@ -57,9 +57,3 @@ impl From<ApiError> for jsonrpc_core::Error {
}
}
}

impl std::convert::From<ConsensusError> for ApiError {
fn from(err: ConsensusError) -> Self {
ApiError::ConsensusError(Box::new(err))
}
}
10 changes: 2 additions & 8 deletions massa-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use error::ApiError;
use jsonrpc_core::{BoxFuture, IoHandler, Value};
use jsonrpc_derive::rpc;
use jsonrpc_http_server::{CloseHandle, ServerBuilder};
use massa_consensus_exports::{ConsensusCommandSender, ConsensusConfig};
use massa_consensus_exports::ConsensusController;
use massa_execution_exports::ExecutionController;
use massa_models::api::{
AddressInfo, BlockInfo, BlockSummary, DatastoreEntryInput, DatastoreEntryOutput,
Expand Down Expand Up @@ -53,7 +53,7 @@ pub use config::APIConfig;
/// Public API component
pub struct Public {
/// link to the consensus component
pub consensus_command_sender: ConsensusCommandSender,
pub consensus_controller: Box<dyn ConsensusController>,
/// link to the execution component
pub execution_controller: Box<dyn ExecutionController>,
/// link to the selector component
Expand All @@ -64,8 +64,6 @@ pub struct Public {
pub protocol_command_sender: ProtocolCommandSender,
/// Massa storage
pub storage: Storage,
/// consensus configuration (TODO: remove it, can be retrieved via an endpoint)
pub consensus_config: ConsensusConfig,
/// API settings
pub api_settings: APIConfig,
/// network setting
Expand All @@ -82,14 +80,10 @@ pub struct Public {

/// Private API content
pub struct Private {
/// link to the consensus component
pub consensus_command_sender: ConsensusCommandSender,
/// link to the network component
pub network_command_sender: NetworkCommandSender,
/// link to the execution component
pub execution_controller: Box<dyn ExecutionController>,
/// consensus configuration (TODO: remove it, can be retrieved via an endpoint)
pub consensus_config: ConsensusConfig,
/// API settings
pub api_settings: APIConfig,
/// stop channel
Expand Down
5 changes: 0 additions & 5 deletions massa-api/src/private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::{Endpoints, Private, RpcServer, StopHandle, API};
use jsonrpc_core::BoxFuture;
use jsonrpc_http_server::tokio::sync::mpsc;

use massa_consensus_exports::{ConsensusCommandSender, ConsensusConfig};
use massa_execution_exports::ExecutionController;
use massa_models::api::{
AddressInfo, BlockInfo, BlockSummary, DatastoreEntryInput, DatastoreEntryOutput,
Expand Down Expand Up @@ -38,20 +37,16 @@ use std::sync::Arc;
impl API<Private> {
/// generate a new private API
pub fn new(
consensus_command_sender: ConsensusCommandSender,
network_command_sender: NetworkCommandSender,
execution_controller: Box<dyn ExecutionController>,
api_settings: APIConfig,
consensus_settings: ConsensusConfig,
node_wallet: Arc<RwLock<Wallet>>,
) -> (Self, mpsc::Receiver<()>) {
let (stop_node_channel, rx) = mpsc::channel(1);
(
API(Private {
consensus_command_sender,
network_command_sender,
execution_controller,
consensus_config: consensus_settings,
api_settings,
stop_node_channel,
node_wallet,
Expand Down
Loading