Skip to content

Commit

Permalink
Merge pull request #3444 from dusk-network/neotamandua/synchronize_ar…
Browse files Browse the repository at this point in the history
…chive_block_events

rusk: synchronize archive with consensus
  • Loading branch information
Neotamandua authored Feb 3, 2025
2 parents 053db4e + 5b3895b commit 8cf2703
Show file tree
Hide file tree
Showing 18 changed files with 206 additions and 272 deletions.
9 changes: 9 additions & 0 deletions node-data/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add PartialEq, Eq to `BlockState` [#3359]

### Removed

- Removed `ArchivalData` together with archive module [#3359]

[1.0.1] - 2025-01-23

### Changed
Expand All @@ -20,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add Types used for interacting with Dusk node

<!-- Issues -->
[#3359]: https://github.com/dusk-network/rusk/issues/3359
[#3405]: https://github.com/dusk-network/rusk/issues/3405

[Unreleased]: https://github.com/dusk-network/rusk/compare/dusk-node-data-1.0.1...HEAD
Expand Down
25 changes: 0 additions & 25 deletions node-data/src/archive.rs

This file was deleted.

2 changes: 1 addition & 1 deletion node-data/src/events/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::ledger::{Block, Hash};
///
/// - `as_str() -> &'static str` - Returns the string representation of the
/// block state.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum BlockState {
Confirmed,
Finalized,
Expand Down
4 changes: 2 additions & 2 deletions node-data/src/ledger/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ impl Transaction {
/// Computes the transaction ID.
///
/// The transaction ID is a unique identifier for the transaction.
/// Unlike the [`hash()`](#method.hash) method, which is computed over the
/// entire transaction, the transaction ID is derived from specific
/// Unlike the [`digest()`](#method.digest) method, which is computed over
/// the entire transaction, the transaction ID is derived from specific
/// fields of the transaction and serves as a unique identifier of the
/// transaction itself.
///
Expand Down
1 change: 0 additions & 1 deletion node-data/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#![deny(unused_crate_dependencies)]
#![deny(unused_extern_crates)]

pub mod archive;
pub mod bls;
pub mod encoding;
pub mod events;
Expand Down
9 changes: 9 additions & 0 deletions node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Change the way the archive synchronizes with the node Acceptor [#3359]

### Changed

- Change deprecated `tempdir` with `tempfile` dependency [#3407]

### Removed

- Removed ArchivistSrv & archivist module [#3359]

## [1.0.1] - 2025-01-23

### Changed
Expand All @@ -22,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- First `dusk-node` release

<!-- Issues -->
[#3359]: https://github.com/dusk-network/rusk/issues/3359
[#3407]: https://github.com/dusk-network/rusk/issues/3407
[#3405]: https://github.com/dusk-network/rusk/issues/3405

Expand Down
2 changes: 0 additions & 2 deletions node/src/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ use rocksdb::OptimisticTransactionDB;
use sqlx::sqlite::SqlitePool;
use tracing::debug;

mod archivist;
mod moonlight;
mod sqlite;
mod transformer;

pub use archivist::ArchivistSrv;
pub use moonlight::{MoonlightGroup, Order};

// Archive folder containing the sqlite database and the moonlight database
Expand Down
95 changes: 0 additions & 95 deletions node/src/archive/archivist.rs

This file was deleted.

6 changes: 3 additions & 3 deletions node/src/archive/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl Archive {
impl Archive {
/// Store the list of **all** unfinalized vm events from the block of the
/// given height.
pub(super) async fn store_unfinalized_events(
pub(crate) async fn store_unfinalized_events(
&self,
block_height: u64,
block_hash: Hash,
Expand Down Expand Up @@ -276,7 +276,7 @@ impl Archive {
/// This also triggers the loading of the MoonlightTxEvents into the
/// moonlight db. This also updates the last finalized block height
/// attribute.
pub(super) async fn finalize_archive_data(
pub(crate) async fn finalize_archive_data(
&mut self,
current_block_height: u64,
hex_block_hash: &str,
Expand Down Expand Up @@ -375,7 +375,7 @@ impl Archive {

/// Remove the unfinalized block together with the unfinalized events of the
/// given hash from the archive.
pub(super) async fn remove_block_and_events(
pub(crate) async fn remove_block_and_events(
&self,
current_block_height: u64,
hex_block_hash: &str,
Expand Down
9 changes: 9 additions & 0 deletions node/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ use tracing::{debug, error, info, warn};

use self::acceptor::Acceptor;
use self::fsm::SimpleFSM;
#[cfg(feature = "archive")]
use crate::archive::Archive;
use crate::database::rocksdb::MD_HASH_KEY;
use crate::database::{Ledger, Metadata};
use crate::{database, vm, LongLivedService, Message, Network};
Expand All @@ -59,6 +61,8 @@ pub struct ChainSrv<N: Network, DB: database::DB, VM: vm::VMExecution> {
event_sender: Sender<Event>,
genesis_timestamp: u64,
dusk_key: BlsPublicKey,
#[cfg(feature = "archive")]
archive: Archive,
}

#[async_trait]
Expand Down Expand Up @@ -89,6 +93,8 @@ impl<N: Network, DB: database::DB, VM: vm::VMExecution>
db,
network,
vm,
#[cfg(feature = "archive")]
self.archive.clone(),
self.max_consensus_queue_size,
self.event_sender.clone(),
self.dusk_key,
Expand Down Expand Up @@ -251,6 +257,7 @@ impl<N: Network, DB: database::DB, VM: vm::VMExecution> ChainSrv<N, DB, VM> {
event_sender: Sender<Event>,
genesis_timestamp: u64,
dusk_key: BlsPublicKey,
#[cfg(feature = "archive")] archive: Archive,
) -> Self {
info!(
"ChainSrv::new with keys_path: {}, max_inbound_size: {}",
Expand All @@ -265,6 +272,8 @@ impl<N: Network, DB: database::DB, VM: vm::VMExecution> ChainSrv<N, DB, VM> {
event_sender,
genesis_timestamp,
dusk_key,
#[cfg(feature = "archive")]
archive,
}
}

Expand Down
Loading

0 comments on commit 8cf2703

Please sign in to comment.