Skip to content

Commit

Permalink
Merge pull request #1347 from anoma/tiago/ethbridge/warn-valset-upd-r…
Browse files Browse the repository at this point in the history
…elay

Prevent unsuccessful validator set update relays
  • Loading branch information
sug0 authored May 11, 2023
2 parents c0a9798 + 72265cd commit 4f45eff
Show file tree
Hide file tree
Showing 9 changed files with 400 additions and 139 deletions.
10 changes: 10 additions & 0 deletions apps/src/lib/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2118,6 +2118,7 @@ pub mod args {
const RAW_PUBLIC_KEY_OPT: ArgOpt<common::PublicKey> = arg_opt("public-key");
const RECEIVER: Arg<String> = arg("receiver");
const RELAYER: Arg<Address> = arg("relayer");
const SAFE_MODE: ArgFlag = flag("safe-mode");
const SCHEME: ArgDefault<SchemeType> =
arg_default("scheme", DefaultFn(|| SchemeType::Ed25519));
const SIGNER: ArgOpt<WalletAddress> = arg_opt("signer");
Expand Down Expand Up @@ -2647,10 +2648,14 @@ pub mod args {
/// The amount of time to sleep between successful
/// daemon mode relays.
pub success_dur: Option<StdDuration>,
/// Safe mode overrides keyboard interrupt signals, to ensure
/// Ethereum transfers aren't canceled midway through.
pub safe_mode: bool,
}

impl Args for ValidatorSetUpdateRelay {
fn parse(matches: &ArgMatches) -> Self {
let safe_mode = SAFE_MODE.parse(matches);
let daemon = DAEMON_MODE.parse(matches);
let query = Query::parse(matches);
let epoch = EPOCH.parse(matches);
Expand All @@ -2676,11 +2681,16 @@ pub mod args {
eth_addr,
retry_dur,
success_dur,
safe_mode,
}
}

fn def(app: App) -> App {
app.add_args::<Query>()
.arg(SAFE_MODE.def().about(
"Safe mode overrides keyboard interrupt signals, to \
ensure Ethereum transfers aren't canceled midway through.",
))
.arg(DAEMON_MODE.def().about(
"Run in daemon mode, which will continuously perform \
validator set updates.",
Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/client/eth_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use tokio::time::{Duration, Instant};
use web30::client::Web3;

use crate::cli;
use crate::control_flow::timeouts::TimeoutStrategy;
use crate::node::ledger::ethereum_oracle::eth_syncing_status;
use crate::timeouts::TimeoutStrategy;

/// Arguments to [`block_on_eth_sync`].
pub struct BlockOnEthSync<'rpc_url> {
Expand Down
Loading

0 comments on commit 4f45eff

Please sign in to comment.