-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* query event * more commands * fix conneciton * more cli * fix relayer * skip empty height * more logs * wait for execution result * more logging * Update ipc/cli/src/commands/checkpoint/bottomup_height.rs Co-authored-by: adlrocha <6717133+adlrocha@users.noreply.github.com> * Update ipc/cli/src/commands/checkpoint/bottomup_bundles.rs Co-authored-by: adlrocha <6717133+adlrocha@users.noreply.github.com> * Update ipc/cli/src/commands/checkpoint/bottomup_submitted.rs Co-authored-by: adlrocha <6717133+adlrocha@users.noreply.github.com> * Update ipc/provider/src/manager/subnet.rs Co-authored-by: adlrocha <6717133+adlrocha@users.noreply.github.com> * review fixes * fmt --------- Co-authored-by: adlrocha <6717133+adlrocha@users.noreply.github.com>
- Loading branch information
1 parent
3aab33d
commit 203afed
Showing
11 changed files
with
418 additions
and
31 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2022-2023 Protocol Labs | ||
// SPDX-License-Identifier: MIT | ||
//! List bottom up bundles | ||
use std::fmt::Debug; | ||
use std::str::FromStr; | ||
|
||
use async_trait::async_trait; | ||
use clap::Args; | ||
use fvm_shared::clock::ChainEpoch; | ||
use ipc_sdk::subnet_id::SubnetID; | ||
|
||
use crate::commands::get_ipc_provider; | ||
use crate::{CommandLineHandler, GlobalArguments}; | ||
|
||
/// The command to get bottom up bundles at height. | ||
pub(crate) struct GetBottomUpBundles; | ||
|
||
#[async_trait] | ||
impl CommandLineHandler for GetBottomUpBundles { | ||
type Arguments = GetBottomUpBundlesArgs; | ||
|
||
async fn handle(global: &GlobalArguments, arguments: &Self::Arguments) -> anyhow::Result<()> { | ||
log::debug!("get bottom up bundles with args: {:?}", arguments); | ||
|
||
let provider = get_ipc_provider(global)?; | ||
let subnet = SubnetID::from_str(&arguments.subnet)?; | ||
|
||
for h in arguments.from_epoch..=arguments.to_epoch { | ||
let bundle = provider.get_bottom_up_bundle(&subnet, h).await?; | ||
println!( | ||
"checkpoint: {:?}, signatures: {:?}, signatories: {:?}, cross_msgs: {:?}", | ||
bundle.checkpoint, bundle.signatures, bundle.signatories, bundle.cross_msgs, | ||
); | ||
println!("{bundle:?}"); | ||
} | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
#[derive(Debug, Args)] | ||
#[command(about = "List bottom up checkpoint signature bundle for a child subnet")] | ||
pub(crate) struct GetBottomUpBundlesArgs { | ||
#[arg(long, short, help = "The target subnet to perform query")] | ||
pub subnet: String, | ||
#[arg(long, short, help = "Include checkpoints from this epoch")] | ||
pub from_epoch: ChainEpoch, | ||
#[arg(long, short, help = "Include checkpoints up to this epoch")] | ||
pub to_epoch: ChainEpoch, | ||
} |
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,42 @@ | ||
// Copyright 2022-2023 Protocol Labs | ||
// SPDX-License-Identifier: MIT | ||
|
||
use std::fmt::Debug; | ||
use std::str::FromStr; | ||
|
||
use async_trait::async_trait; | ||
use clap::Args; | ||
use ipc_sdk::subnet_id::SubnetID; | ||
|
||
use crate::commands::get_ipc_provider; | ||
use crate::{CommandLineHandler, GlobalArguments}; | ||
|
||
/// The command to get the last bottom up checkpoint height in a subnet. | ||
pub(crate) struct LastBottomUpCheckpointHeight; | ||
|
||
#[async_trait] | ||
impl CommandLineHandler for LastBottomUpCheckpointHeight { | ||
type Arguments = LastBottomUpCheckpointHeightArgs; | ||
|
||
async fn handle(global: &GlobalArguments, arguments: &Self::Arguments) -> anyhow::Result<()> { | ||
log::debug!( | ||
"list bottom up checkpoint height with args: {:?}", | ||
arguments | ||
); | ||
|
||
let provider = get_ipc_provider(global)?; | ||
let subnet = SubnetID::from_str(&arguments.subnet)?; | ||
|
||
let height = provider.last_bottom_up_checkpoint_height(&subnet).await?; | ||
println!("height: {height}"); | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
#[derive(Debug, Args)] | ||
#[command(about = "Last bottom up checkpoint height committed in a child subnet")] | ||
pub(crate) struct LastBottomUpCheckpointHeightArgs { | ||
#[arg(long, short, help = "The target subnet to perform query")] | ||
pub subnet: String, | ||
} |
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,50 @@ | ||
// Copyright 2022-2023 Protocol Labs | ||
// SPDX-License-Identifier: MIT | ||
|
||
use std::fmt::Debug; | ||
use std::str::FromStr; | ||
|
||
use async_trait::async_trait; | ||
use clap::Args; | ||
use fvm_shared::address::Address; | ||
use ipc_sdk::subnet_id::SubnetID; | ||
|
||
use crate::commands::get_ipc_provider; | ||
use crate::{CommandLineHandler, GlobalArguments}; | ||
|
||
/// The command to check if the address has submitted in the last bottom up checkpoint height. | ||
pub(crate) struct SubmittedInBottomUpHeight; | ||
|
||
#[async_trait] | ||
impl CommandLineHandler for SubmittedInBottomUpHeight { | ||
type Arguments = SubmittedInBottomUpHeightArgs; | ||
|
||
async fn handle(global: &GlobalArguments, arguments: &Self::Arguments) -> anyhow::Result<()> { | ||
log::debug!( | ||
"check submitted bottom up checkpoint with args: {:?}", | ||
arguments | ||
); | ||
|
||
let provider = get_ipc_provider(global)?; | ||
let subnet = SubnetID::from_str(&arguments.subnet)?; | ||
let address = Address::from_str(&arguments.submitter)?; | ||
|
||
let submitted = provider | ||
.has_submitted_in_last_checkpoint_height(&subnet, &address) | ||
.await?; | ||
println!("has submitted: {submitted}"); | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
#[derive(Debug, Args)] | ||
#[command( | ||
about = "Check if the address has submitted a signature in the last bottom up checkpoint of a child subnet" | ||
)] | ||
pub(crate) struct SubmittedInBottomUpHeightArgs { | ||
#[arg(long, short, help = "The target subnet to perform query")] | ||
pub subnet: String, | ||
#[arg(long, short, help = "The hex encoded address of the submitter")] | ||
pub submitter: String, | ||
} |
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,49 @@ | ||
// Copyright 2022-2023 Protocol Labs | ||
// SPDX-License-Identifier: MIT | ||
//! List quorum reached events | ||
use std::fmt::Debug; | ||
use std::str::FromStr; | ||
|
||
use async_trait::async_trait; | ||
use clap::Args; | ||
use fvm_shared::clock::ChainEpoch; | ||
use ipc_sdk::subnet_id::SubnetID; | ||
|
||
use crate::commands::get_ipc_provider; | ||
use crate::{CommandLineHandler, GlobalArguments}; | ||
|
||
/// The command to list quorum reached at height. | ||
pub(crate) struct GetQuorumReacehdEvents; | ||
|
||
#[async_trait] | ||
impl CommandLineHandler for GetQuorumReacehdEvents { | ||
type Arguments = GetQuorumReachedEventsArgs; | ||
|
||
async fn handle(global: &GlobalArguments, arguments: &Self::Arguments) -> anyhow::Result<()> { | ||
log::debug!("get quorum reached events with args: {:?}", arguments); | ||
|
||
let provider = get_ipc_provider(global)?; | ||
let subnet = SubnetID::from_str(&arguments.subnet)?; | ||
|
||
for h in arguments.from_epoch..=arguments.to_epoch { | ||
let events = provider.quorum_reached_events(&subnet, h).await?; | ||
for e in events { | ||
println!("{e}"); | ||
} | ||
} | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
#[derive(Debug, Args)] | ||
#[command(about = "List quorum reached events for a child subnet")] | ||
pub(crate) struct GetQuorumReachedEventsArgs { | ||
#[arg(long, short, help = "The target subnet to perform query")] | ||
pub subnet: String, | ||
#[arg(long, short, help = "Include events from this epoch")] | ||
pub from_epoch: ChainEpoch, | ||
#[arg(long, short, help = "Include events up to this epoch")] | ||
pub to_epoch: ChainEpoch, | ||
} |
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.