-
Notifications
You must be signed in to change notification settings - Fork 1
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 #12 from datachainlab/fix-forks
Move fork impls into `fork` directory and add tests Signed-off-by: Jun Kimura <[email protected]>
- Loading branch information
Showing
22 changed files
with
2,678 additions
and
40 deletions.
There are no files selected for viewing
2,434 changes: 2,434 additions & 0 deletions
2,434
crates/consensus/data/mainnet_block_10265184.json
Large diffs are not rendered by default.
Oops, something went wrong.
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,7 @@ | ||
{ | ||
"slot": 10265184, | ||
"proposer_index": 1532287, | ||
"parent_root": "0x417a55d3a74a1ec7b364b451823c642bd03af2756f8d62a47b28d1201dfd13d4", | ||
"state_root": "0x21b01660ae708225e169a64dfce6b288a6b214cccd2cfe8e146bcbf2021c815c", | ||
"body_root": "0xc60be046dfd6099f3dc74c55a37f5e8829f0ec7a5f47f050a2ffecb3659eb57c" | ||
} |
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
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
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
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,39 @@ | ||
use crate::context::Context; | ||
use anyhow::Result; | ||
use clap::Parser; | ||
use lodestar_rpc::client::RPCClient; | ||
|
||
#[derive(Clone, Debug, Parser, PartialEq)] | ||
pub struct BlockCommand { | ||
#[clap(long = "slot", help = "Slot number")] | ||
pub slot: Option<u64>, | ||
} | ||
|
||
impl BlockCommand { | ||
pub async fn run< | ||
const BYTES_PER_LOGS_BLOOM: usize, | ||
const MAX_EXTRA_DATA_BYTES: usize, | ||
const SYNC_COMMITTEE_SIZE: usize, | ||
>( | ||
self, | ||
ctx: Context<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES, SYNC_COMMITTEE_SIZE>, | ||
) -> Result<()> { | ||
let client = RPCClient::new(ctx.beacon_endpoint()); | ||
|
||
let res = match self.slot { | ||
Some(slot) => client.get_beacon_block_by_slot(slot.into()).await?, | ||
None => { | ||
let res = client.get_finality_update::< | ||
SYNC_COMMITTEE_SIZE, | ||
BYTES_PER_LOGS_BLOOM, | ||
MAX_EXTRA_DATA_BYTES, | ||
>().await?; | ||
client | ||
.get_beacon_block_by_slot(res.data.finalized_header.beacon.slot) | ||
.await? | ||
} | ||
}; | ||
println!("{}", serde_json::to_string_pretty(&res.data.message)?); | ||
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use crate::context::Context; | ||
use anyhow::Result; | ||
use clap::Parser; | ||
use lodestar_rpc::client::RPCClient; | ||
|
||
#[derive(Clone, Debug, Parser, PartialEq)] | ||
pub struct HeaderCommand { | ||
#[clap(long = "slot", help = "Slot number")] | ||
pub slot: Option<u64>, | ||
} | ||
|
||
impl HeaderCommand { | ||
pub async fn run< | ||
const BYTES_PER_LOGS_BLOOM: usize, | ||
const MAX_EXTRA_DATA_BYTES: usize, | ||
const SYNC_COMMITTEE_SIZE: usize, | ||
>( | ||
self, | ||
ctx: Context<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES, SYNC_COMMITTEE_SIZE>, | ||
) -> Result<()> { | ||
let client = RPCClient::new(ctx.beacon_endpoint()); | ||
let res = match self.slot { | ||
Some(slot) => client.get_beacon_header_by_slot(slot.into()).await?, | ||
None => { | ||
let res = client.get_finality_update::< | ||
SYNC_COMMITTEE_SIZE, | ||
BYTES_PER_LOGS_BLOOM, | ||
MAX_EXTRA_DATA_BYTES, | ||
>().await?; | ||
client | ||
.get_beacon_header_by_slot(res.data.finalized_header.beacon.slot) | ||
.await? | ||
} | ||
}; | ||
println!( | ||
"{}", | ||
serde_json::to_string_pretty(&res.data.header.message)? | ||
); | ||
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
Oops, something went wrong.