-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from weaveVM/dev
Double indexing threads: parallel live blockheight & from genesis backfilling
- Loading branch information
Showing
13 changed files
with
124 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
archiver_pk=... | ||
archiver_pk="..." | ||
backfill_pk="..." | ||
network="./networks/your_network.json" | ||
|
||
DATABASE_HOST="" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
[package] | ||
name = "wvm-archiver" | ||
version = "0.1.3" | ||
version = "0.2.3" | ||
edition = "2021" | ||
description = "EL data pipeline for WVM testnet v0" | ||
authors = ["charmful0x <[email protected]>"] | ||
license = "MIT" | ||
repository = "https://github.com/weavevm/wvm-archiver" | ||
readme = "README.md" | ||
documentation = "https://docs.wvm.dev" | ||
keywords = ["wvm", "indexer", "arweave"] | ||
keywords = ["wvm", "indexer", "arweave", "etl"] | ||
|
||
[dependencies] | ||
anyhow = "1.0.86" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "$YOUR_NETWORK_NAME", | ||
"network_chain_id": 1, // your network ID | ||
"wvm_chain_id": 9496, | ||
"network_rpc": "https://", // your network public RPC URL | ||
"wvm_rpc": "https://testnet-rpc.wvm.dev", | ||
"block_time": 1, // your network block time in seconds | ||
"start_block": 7777, // at what blockheight your want to start the | ||
// archiving, it's advised to use the most recent blockheight | ||
"archiver_address": "$ARCHIVING_ADDRESS_1", // it archives starting from "start_block" | ||
"backfill_address": "$ARCHIVING_ADDRESS_2", // it archives from genesis until start_block | ||
"archive_pool_address": "$DIFFERENT_ADDRESS" // most common is 0x0 address (null) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pub mod utils; | ||
pub mod utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use crate::utils::archive_block::archive; | ||
use crate::utils::planetscale::ps_archive_block; | ||
use crate::utils::schema::Network; | ||
use anyhow::{Error, Ok}; | ||
|
||
pub async fn backfill_from_genesis() -> Result<(), Error> { | ||
let network = Network::config(); | ||
let config_start_block = network.start_block; | ||
let backfill_blocks: Vec<u64> = (0..=config_start_block).collect(); | ||
|
||
if config_start_block == 0 { | ||
return Ok(()); | ||
} | ||
|
||
for &block_number in backfill_blocks.iter() { | ||
println!("\n{}", "#".repeat(100)); | ||
println!( | ||
"\nARCHIVING **BACKFILL** BLOCK #{} of Network {} -- ChainId: {}\n", | ||
&block_number, network.name, network.network_chain_id | ||
); | ||
let archive_txid = archive(Some(block_number), true).await.unwrap(); | ||
let _ = ps_archive_block(&block_number, &archive_txid).await; | ||
println!("\n{}", "#".repeat(100)); | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod archive_block; | ||
pub mod backfill_genesis; | ||
pub mod env_var; | ||
pub mod get_block; | ||
pub mod planetscale; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters