Skip to content

Commit b1afaac

Browse files
author
Stanisław Drozd
authored
drozdziak1/pyth attester rpc timeout fix (#391)
* pyth2wormhole-client: Stagger attestation sched jobs * pyth2wormhole-client 1.0.0-rc1 This is an initial semver release for the pyth2wormhole-client package. * p2w_autoattest.py: Add env for atteser --timeout option * pyth-attesster v1.0.0-rc2 * pyth-attester-v1.0.0-rc3 This fixes a typo in p2w_autoattest.py * pyth-attester-v1.0.0
1 parent 9c5425d commit b1afaac

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

solana/pyth2wormhole/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

solana/pyth2wormhole/client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyth2wormhole-client"
3-
version = "0.1.0"
3+
version = "1.0.0"
44
edition = "2018"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

solana/pyth2wormhole/client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ pub async fn crawl_pyth_mapping(
424424
"Mapping: Could not parse account {} as a Pyth mapping, crawling terminated. Error: {:?}",
425425
mapping_addr, e
426426
);
427-
continue;
427+
break;
428428
}
429429
};
430430

solana/pyth2wormhole/client/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,11 @@ async fn attestation_sched_job(args: AttestationSchedJobArgs) -> Result<(), ErrB
551551
message_q_mtx,
552552
} = args;
553553

554+
// Stagger this sched job by batch_no * 10 milliseconds. It
555+
// mitigates uneven distribution of tx requests which may resolve
556+
// RPC timeouts on larger interval-based symbol groups.
557+
tokio::time::sleep(Duration::from_millis(batch_no as u64 * 10)).await;
558+
554559
// Enforces the max batch job count
555560
let sema = Arc::new(Semaphore::new(batch.conditions.max_batch_jobs));
556561
loop {

third_party/pyth/p2w_autoattest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838

3939
P2W_MAX_LOG_LINES = int(os.environ.get("P2W_MAX_LOG_LINES", 1000))
4040

41+
# attester needs string, but we validate as int first
42+
P2W_RPC_TIMEOUT_SECS = str(int(os.environ.get("P2W_RPC_TIMEOUT_SECS", "20")))
43+
4144
ATTESTATIONS = {
4245
"pendingSeqnos": [],
4346
}
@@ -261,6 +264,8 @@ def find_and_log_seqnos(s):
261264
"attest",
262265
"-f",
263266
P2W_ATTESTATION_CFG,
267+
"--timeout",
268+
P2W_RPC_TIMEOUT_SECS,
264269
],
265270
capture_output=True,
266271
)
@@ -296,6 +301,8 @@ def find_and_log_seqnos(s):
296301
"-f",
297302
P2W_ATTESTATION_CFG,
298303
"-d",
304+
"--timeout",
305+
P2W_RPC_TIMEOUT_SECS,
299306
],
300307
stdout=PIPE,
301308
stderr=STDOUT,

third_party/pyth/pyth_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
)
1717
# How long to sleep between mock Pyth price updates
1818
PYTH_PUBLISHER_INTERVAL_SECS = float(os.environ.get("PYTH_PUBLISHER_INTERVAL_SECS", "5"))
19-
PYTH_TEST_SYMBOL_COUNT = int(os.environ.get("PYTH_TEST_SYMBOL_COUNT", "9"))
19+
PYTH_TEST_SYMBOL_COUNT = int(os.environ.get("PYTH_TEST_SYMBOL_COUNT", "11"))
2020

2121
# If above 0, adds a new test symbol periodically, waiting at least
2222
# the given number of seconds in between

0 commit comments

Comments
 (0)