Skip to content

Commit 49b00cf

Browse files
committed
Merge branch 'main' into pyth-stylus-final-functions
2 parents 98e5e7d + 3664ef3 commit 49b00cf

File tree

24 files changed

+1049
-129
lines changed

24 files changed

+1049
-129
lines changed

.github/workflows/ci-lazer-rust.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ jobs:
4141
- name: Clippy check
4242
run: cargo clippy -p pyth-lazer-protocol -p pyth-lazer-client -p pyth-lazer-publisher-sdk --all-targets -- --deny warnings
4343
if: success() || failure()
44+
- name: Clippy check with mry
45+
run: cargo clippy -F mry -p pyth-lazer-protocol --all-targets -- --deny warnings
46+
if: success() || failure()
4447
- name: test
4548
run: cargo test -p pyth-lazer-protocol -p pyth-lazer-client -p pyth-lazer-publisher-sdk
4649
if: success() || failure()
50+
- name: test with mry
51+
run: cargo test -F mry -p pyth-lazer-protocol
52+
if: success() || failure()

Cargo.lock

Lines changed: 54 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/fortuna/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fortuna"
3-
version = "8.2.0"
3+
version = "8.2.1"
44
edition = "2021"
55

66
[lib]

apps/fortuna/src/eth_utils/utils.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use {
88
ethers::{
99
contract::{ContractCall, ContractError},
1010
middleware::Middleware,
11-
providers::ProviderError,
11+
providers::{MiddlewareError, ProviderError},
1212
signers::Signer,
1313
types::{
1414
transaction::eip2718::TypedTransaction, TransactionReceipt, TransactionRequest, U256,
@@ -253,7 +253,19 @@ pub async fn submit_tx<T: Middleware + NonceManaged + 'static>(
253253
client
254254
.fill_transaction(&mut transaction, None)
255255
.await
256-
.map_err(|e| backoff::Error::transient(SubmitTxError::GasPriceEstimateError(e)))?;
256+
.map_err(|e| {
257+
// If there is revert data, the contract reverted during gas usage estimation.
258+
if let Some(e) = e.as_error_response() {
259+
if let Some(e) = e.as_revert_data() {
260+
return backoff::Error::transient(SubmitTxError::GasUsageEstimateError(
261+
ContractError::Revert(e.clone()),
262+
));
263+
}
264+
}
265+
266+
// If there is no revert data, there was likely an error during gas price polling.
267+
backoff::Error::transient(SubmitTxError::GasPriceEstimateError(e))
268+
})?;
257269

258270
// Apply the fee escalation policy. Note: the unwrap_or_default should never default as we have a gas oracle
259271
// in the client that sets the gas price.

apps/fortuna/src/history.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,18 @@ impl History {
357357
}
358358
};
359359
if let Err(e) = result {
360-
tracing::error!("Failed to update request status: {}", e);
360+
match e.as_database_error() {
361+
Some(db_error) if db_error.is_unique_violation() => {
362+
tracing::info!(
363+
"Failed to insert request, request already exists: Chain ID: {}, Sequence: {}",
364+
network_id,
365+
sequence
366+
);
367+
}
368+
_ => {
369+
tracing::error!("Failed to update request status: {}", e);
370+
}
371+
}
361372
}
362373
}
363374

apps/fortuna/src/keeper/fee.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ async fn calculate_fair_fee_withdrawal_amount<M: Middleware + 'static>(
4444
.await
4545
.map_err(|e| anyhow!("Error while getting current keeper balance. error: {:?}", e))?;
4646

47+
tracing::info!(
48+
"Contract has available fees: {:?}, current keeper ({:?}) has balance: {:?}",
49+
available_fees,
50+
keeper_address,
51+
current_balance
52+
);
53+
4754
// Calculate total funds across all keepers + available fees
4855
let mut total_funds = current_balance + available_fees;
4956

@@ -55,6 +62,7 @@ async fn calculate_fair_fee_withdrawal_amount<M: Middleware + 'static>(
5562
e
5663
)
5764
})?;
65+
tracing::info!("Keeper address {:?} has balance: {:?}", address, balance);
5866
total_funds += balance;
5967
}
6068

@@ -174,7 +182,7 @@ pub async fn withdraw_fees_if_necessary(
174182
if withdrawal_amount < min_withdrawal_amount {
175183
// We don't have enough to meaningfully top up the balance.
176184
// NOTE: This log message triggers a grafana alert. If you want to change the text, please change the alert also.
177-
tracing::warn!("Keeper balance {:?} is too low (< {:?}) but provider fees are not sufficient to top-up.", keeper_balance, min_balance);
185+
tracing::warn!("Keeper balance {:?} is too low (< {:?}) but provider fees are not sufficient to top-up. (withdrawal_amount={:?} < min_withdrawal_amount={:?})", keeper_balance, min_balance, withdrawal_amount, min_withdrawal_amount);
178186
return Ok(());
179187
}
180188

governance/pyth_staking_sdk/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/staking-sdk",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "Pyth staking SDK",
55
"type": "module",
66
"exports": {
@@ -13,7 +13,7 @@
1313
"dist/**/*"
1414
],
1515
"engines": {
16-
"node": "20 || 22"
16+
"node": "20 || 22 || 24"
1717
},
1818
"publishConfig": {
1919
"access": "public"

lazer/contracts/solana/Cargo.lock

Lines changed: 10 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lazer/contracts/solana/programs/pyth-lazer-solana-contract/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ no-log-ix-name = []
2222
idl-build = ["anchor-lang/idl-build"]
2323

2424
[dependencies]
25-
pyth-lazer-protocol = { path = "../../../../sdk/rust/protocol", version = "0.8.1" }
25+
pyth-lazer-protocol = { path = "../../../../sdk/rust/protocol", version = "0.9.0" }
2626

2727
anchor-lang = "0.30.1"
2828
bytemuck = "1.20.0"

lazer/publisher_sdk/rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "Apache-2.0"
77
repository = "https://github.com/pyth-network/pyth-crosschain"
88

99
[dependencies]
10-
pyth-lazer-protocol = { version = "0.8.1", path = "../../sdk/rust/protocol" }
10+
pyth-lazer-protocol = { version = "0.9.0", path = "../../sdk/rust/protocol" }
1111
anyhow = "1.0.98"
1212
protobuf = "3.7.2"
1313
serde-value = "0.7.0"

0 commit comments

Comments
 (0)