Skip to content

Commit

Permalink
refactor: update log sync (#27)
Browse files Browse the repository at this point in the history
* refactor: log entry sync

* fix: reorg

* test: shard

* chore: storage node version
  • Loading branch information
MiniFrenchBread authored Oct 16, 2024
1 parent 892efd4 commit e7c7379
Show file tree
Hide file tree
Showing 21 changed files with 657 additions and 430 deletions.
54 changes: 28 additions & 26 deletions Cargo.lock

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

15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ enr = { path = "version-meld/enr" }
discv5 = { path = "version-meld/discv5" }

[workspace.dependencies]
append_merkle = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "3fc1543fb4a1b9321cf5ecc9a81e152a14950995" }
merkle_light = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "3fc1543fb4a1b9321cf5ecc9a81e152a14950995" }
merkle_tree = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "3fc1543fb4a1b9321cf5ecc9a81e152a14950995" }
shared_types = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "3fc1543fb4a1b9321cf5ecc9a81e152a14950995" }
task_executor = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "3fc1543fb4a1b9321cf5ecc9a81e152a14950995" }
storage = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "3fc1543fb4a1b9321cf5ecc9a81e152a14950995", package = "storage" }
contract-interface = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "3fc1543fb4a1b9321cf5ecc9a81e152a14950995" }
append_merkle = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "80b4d63cbabf3dd1cd84d95f2384a2e4cfdd3cd1" }
merkle_light = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "80b4d63cbabf3dd1cd84d95f2384a2e4cfdd3cd1" }
merkle_tree = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "80b4d63cbabf3dd1cd84d95f2384a2e4cfdd3cd1" }
shared_types = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "80b4d63cbabf3dd1cd84d95f2384a2e4cfdd3cd1" }
task_executor = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "80b4d63cbabf3dd1cd84d95f2384a2e4cfdd3cd1" }
storage = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "80b4d63cbabf3dd1cd84d95f2384a2e4cfdd3cd1", package = "storage" }
contract-interface = { git = "https://github.com/0glabs/0g-storage-node.git",rev = "80b4d63cbabf3dd1cd84d95f2384a2e4cfdd3cd1" }
metrics = { git = "https://github.com/Conflux-Chain/conflux-rust.git", rev = "992ebc5483d937c8f6b883e266f8ed2a67a7fa9a" }
4 changes: 3 additions & 1 deletion node/log_entry_sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ storage_with_stream = { path = "../storage_with_stream" }
contract-interface = { workspace = true }
futures-core = "0.3.28"
futures-util = "0.3.28"
thiserror = "1.0.44"
thiserror = "1.0.44"
lazy_static = "1.4.0"
metrics = { workspace = true }
5 changes: 3 additions & 2 deletions node/log_entry_sync/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
extern crate core;

pub(crate) mod rpc_proxy;
mod sync_manager;

pub use rpc_proxy::ContractAddress;
use ethers::prelude::H160;
pub use sync_manager::{
config::{CacheConfig, LogSyncConfig},
LogSyncEvent, LogSyncManager,
};

pub type ContractAddress = H160;
30 changes: 0 additions & 30 deletions node/log_entry_sync/src/rpc_proxy/eth.rs

This file was deleted.

38 changes: 0 additions & 38 deletions node/log_entry_sync/src/rpc_proxy/mod.rs

This file was deleted.

6 changes: 5 additions & 1 deletion node/log_entry_sync/src/sync_manager/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::rpc_proxy::ContractAddress;
use crate::ContractAddress;

pub struct LogSyncConfig {
pub rpc_endpoint_url: String,
Expand Down Expand Up @@ -32,6 +32,8 @@ pub struct LogSyncConfig {
pub remove_finalized_block_interval_minutes: u64,
// watch_loop (eth_getLogs) trigger interval
pub watch_loop_wait_time_ms: u64,
// force to sync log from start block number
pub force_log_sync_from_start_block_number: bool,
}

#[derive(Clone)]
Expand All @@ -58,6 +60,7 @@ impl LogSyncConfig {
default_finalized_block_count: u64,
remove_finalized_block_interval_minutes: u64,
watch_loop_wait_time_ms: u64,
force_log_sync_from_start_block_number: bool,
) -> Self {
Self {
rpc_endpoint_url,
Expand All @@ -73,6 +76,7 @@ impl LogSyncConfig {
default_finalized_block_count,
remove_finalized_block_interval_minutes,
watch_loop_wait_time_ms,
force_log_sync_from_start_block_number,
}
}
}
Loading

0 comments on commit e7c7379

Please sign in to comment.