Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion third_party/pyth/p2w_autoattest.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@

# Set helpfully chatty logging default, filtering especially annoying
# modules like async HTTP requests and tokio runtime logs
os.environ["RUST_LOG"] = os.environ.get("RUST_LOG", "pyth_wormhole_attester_client,solana_client,main,pyth_sdk_solana=trace")
os.environ["RUST_LOG"] = os.environ.get("RUST_LOG", "info")

# Send the first attestation in one-shot mode for testing
first_attest_result = run_or_die(
Expand All @@ -187,6 +187,7 @@
P2W_RPC_TIMEOUT_SECS,
],
capture_output=True,
debug = True,
)

logging.info("p2w_autoattest ready to roll!")
Expand Down
9 changes: 4 additions & 5 deletions tilt-devnet/docker-images/Dockerfile.client
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ RUN apt-get update && apt-get install -yq libudev-dev ncat
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs

ADD rust-toolchain /rust-toolchain
ADD wormhole-attester/ /usr/src/wormhole-attester
WORKDIR /usr/src/wormhole-attester
WORKDIR /usr/src/bridge-client

RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
--mount=type=cache,target=/usr/src/solana/pyth2wormhole/target,id=p2w_cargo_build \
--mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=target \
cargo install --version =2.0.12 --locked spl-token-cli --target-dir target


Expand All @@ -26,7 +25,7 @@ ENV BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o"

RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/src/solana/pyth2wormhole/target \
--mount=type=cache,target=target \
set -xe && \
cargo install bridge_client --git https://github.com/wormhole-foundation/wormhole --tag $WORMHOLE_TAG --locked --root /usr/local --target-dir target && \
cargo install token_bridge_client --git https://github.com/wormhole-foundation/wormhole --tag $WORMHOLE_TAG --locked --root /usr/local --target-dir target
Expand Down
4 changes: 3 additions & 1 deletion wormhole-attester/client/src/healthcheck.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
use {
crate::attestation_cfg,
std::{
collections::VecDeque,
convert::TryInto,
sync::Arc,
},
tokio::sync::Mutex,
};

lazy_static::lazy_static! {
pub static ref HEALTHCHECK_STATE: Arc<Mutex<HealthCheckState>> = Arc::new(Mutex::new(HealthCheckState::new(1, false)));
pub static ref HEALTHCHECK_STATE: Arc<Mutex<HealthCheckState>> = Arc::new(Mutex::new(HealthCheckState::new(attestation_cfg::default_healthcheck_window_size().try_into().expect("could not convert window size to usize"), attestation_cfg::default_enable_healthcheck())));
}

/// Helper structure for deciding service health
Expand Down
26 changes: 15 additions & 11 deletions wormhole-attester/client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use {
gen_set_config_tx,
gen_set_is_active_tx,
get_config_account,
healthcheck::HealthCheckState,
start_metrics_server,
AttestationConfig,
BatchState,
Expand Down Expand Up @@ -304,17 +305,20 @@ async fn handle_attest_daemon_mode(
metrics_bind_addr: SocketAddr,
) -> Result<(), ErrBox> {
// Update healthcheck window size from config
if attestation_cfg.enable_healthcheck {
if attestation_cfg.healthcheck_window_size == 0 {
return Err(format!(
"{} must be above 0",
stringify!(attestation_cfg.healthcheck_window_size)
)
.into());
}
let mut hc = HEALTHCHECK_STATE.lock().await;
hc.max_window_size = attestation_cfg.healthcheck_window_size as usize;
} else {
if attestation_cfg.healthcheck_window_size == 0 {
return Err(format!(
"{} must be above 0",
stringify!(attestation_cfg.healthcheck_window_size)
)
.into());
}

*HEALTHCHECK_STATE.lock().await = HealthCheckState::new(
attestation_cfg.healthcheck_window_size as usize,
attestation_cfg.enable_healthcheck,
);

if !attestation_cfg.enable_healthcheck {
warn!("WARNING: Healthcheck is disabled");
}

Expand Down