Skip to content

Commit

Permalink
Merge branch 'main' of github.com:astriaorg/astria into noot/slinky
Browse files Browse the repository at this point in the history
  • Loading branch information
noot committed Nov 5, 2024
2 parents 3722a2f + 3c6e456 commit 466e458
Show file tree
Hide file tree
Showing 13 changed files with 186 additions and 69 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions charts/evm-bridge-withdrawer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0
version: 1.0.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.0"
appVersion: "1.0.1"

maintainers:
- name: wafflesvonmaple
Expand Down
2 changes: 1 addition & 1 deletion charts/evm-bridge-withdrawer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ images:
evmBridgeWithdrawer:
repo: ghcr.io/astriaorg/evm-bridge-withdrawer
pullPolicy: IfNotPresent
tag: 1.0.0
tag: 1.0.1
devTag: latest

config:
Expand Down
6 changes: 3 additions & 3 deletions charts/evm-stack/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ dependencies:
version: 0.1.2
- name: evm-bridge-withdrawer
repository: file://../evm-bridge-withdrawer
version: 1.0.0
version: 1.0.1
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 15.2.4
- name: blockscout-stack
repository: https://blockscout.github.io/helm-charts
version: 1.6.2
digest: sha256:c849edbcf6b12442d9ec8ffe2f21ceb4f50e58a65c2186340cae6df034f34eae
generated: "2024-10-27T10:49:54.580428-07:00"
digest: sha256:b0f9adad7d8a55f86ebd7b2e7aeb4f5b479b5b38a6c423ff013b9a5a57446f4d
generated: "2024-11-01T11:28:14.128143-07:00"
4 changes: 2 additions & 2 deletions charts/evm-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0
version: 1.0.1

dependencies:
- name: celestia-node
Expand All @@ -34,7 +34,7 @@ dependencies:
repository: "file://../evm-faucet"
condition: evm-faucet.enabled
- name: evm-bridge-withdrawer
version: 1.0.0
version: 1.0.1
repository: "file://../evm-bridge-withdrawer"
condition: evm-bridge-withdrawer.enabled
- name: postgresql
Expand Down
5 changes: 4 additions & 1 deletion crates/astria-bridge-withdrawer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.0.1] - 2024-11-01

### Fixed

- Set `batch_total_settled_value` metric to 0 when no withdrawals are settled [#1778](https://github.com/astriaorg/astria/pull/1768)
Expand Down Expand Up @@ -99,7 +101,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial release of EVM Withdrawer.

[unreleased]: https://github.com/astriaorg/astria/compare/bridge-withdrawer-v1.0.0...HEAD
[unreleased]: https://github.com/astriaorg/astria/compare/bridge-withdrawer-v1.0.1...HEAD
[1.0.1]: https://github.com/astriaorg/astria/compare/bridge-withdrawer-v1.0.0...bridge-withdrawer-v1.0.1
[1.0.0]: https://github.com/astriaorg/astria/compare/bridge-withdrawer-v1.0.0-rc.2...bridge-withdrawer-v1.0.0
[1.0.0-rc.2]: https://github.com/astriaorg/astria/compare/bridge-withdrawer-v1.0.0-rc.1...bridge-withdrawer-v1.0.0-rc.2
[1.0.0-rc.1]: https://github.com/astriaorg/astria/compare/bridge-withdrawer-v0.3.0...bridge-withdrawer-v1.0.0-rc.1
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-bridge-withdrawer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "astria-bridge-withdrawer"
version = "1.0.0"
version = "1.0.1"
edition = "2021"
rust-version = "1.81.0"
license = "MIT OR Apache-2.0"
Expand Down
12 changes: 1 addition & 11 deletions crates/astria-bridge-withdrawer/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,8 @@ impl Metrics {
self.sequencer_submission_failure_count.increment(1);
}

#[expect(
clippy::cast_precision_loss,
reason = "metric with potential loss of precision, logging when it occurs"
)]
pub(crate) fn set_batch_total_settled_value(&self, value: u128) {
if value > u128::from(u32::MAX) {
tracing::warn!(
"{BATCH_TOTAL_SETTLED_VALUE} set with {value} which exceeds u32::MAX, precision \
loss in metric"
);
}
self.batch_total_settled_value.set(value as f64);
self.batch_total_settled_value.set(value);
}
}

Expand Down
75 changes: 60 additions & 15 deletions crates/astria-sequencer-relayer/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ pub struct Metrics {
sequencer_height_fetch_failure_count: Counter,
sequencer_submission_height: Counter,
compression_ratio_for_astria_block: Gauge,
celestia_fees_total_utia: Gauge,
celestia_fees_utia_per_uncompressed_blob_byte: Gauge,
celestia_fees_utia_per_compressed_blob_byte: Gauge,
}

impl Metrics {
Expand Down Expand Up @@ -73,11 +76,28 @@ impl Metrics {
pub(crate) fn set_compression_ratio_for_astria_block(&self, ratio: f64) {
self.compression_ratio_for_astria_block.set(ratio);
}

pub(crate) fn set_celestia_fees_total_utia(&self, utia: u64) {
self.celestia_fees_total_utia.set(utia);
}

pub(crate) fn set_celestia_fees_utia_per_uncompressed_blob_byte(&self, utia: f64) {
self.celestia_fees_utia_per_uncompressed_blob_byte.set(utia);
}

pub(crate) fn set_celestia_fees_utia_per_compressed_blob_byte(&self, utia: f64) {
self.celestia_fees_utia_per_compressed_blob_byte.set(utia);
}
}

impl telemetry::Metrics for Metrics {
type Config = ();

#[expect(
clippy::too_many_lines,
reason = "this is reasonable as we have a lot of metrics to register; the function is not \
complex, just long"
)]
fn register(
builder: &mut RegisteringBuilder,
_config: &Self::Config,
Expand Down Expand Up @@ -171,6 +191,29 @@ impl telemetry::Metrics for Metrics {
)?
.register()?;

let celestia_fees_total_utia = builder
.new_gauge_factory(
CELESTIA_FEES_TOTAL_UTIA,
"The total Celestia fees in utia for the latest successful submission",
)?
.register()?;

let celestia_fees_utia_per_uncompressed_blob_byte = builder
.new_gauge_factory(
CELESTIA_FEES_UTIA_PER_UNCOMPRESSED_BLOB_BYTE,
"The Celestia fees in utia per uncompressed blob byte for the latest successful \
submission",
)?
.register()?;

let celestia_fees_utia_per_compressed_blob_byte = builder
.new_gauge_factory(
CELESTIA_FEES_UTIA_PER_COMPRESSED_BLOB_BYTE,
"The Celestia fees in utia per compressed blob byte for the latest successful \
submission",
)?
.register()?;

Ok(Self {
celestia_submission_height,
celestia_submission_count,
Expand All @@ -184,6 +227,9 @@ impl telemetry::Metrics for Metrics {
sequencer_height_fetch_failure_count,
sequencer_submission_height,
compression_ratio_for_astria_block,
celestia_fees_total_utia,
celestia_fees_utia_per_uncompressed_blob_byte,
celestia_fees_utia_per_compressed_blob_byte,
})
}
}
Expand All @@ -200,25 +246,15 @@ metric_names!(const METRICS_NAMES:
SEQUENCER_BLOCK_FETCH_FAILURE_COUNT,
SEQUENCER_HEIGHT_FETCH_FAILURE_COUNT,
SEQUENCER_SUBMISSION_HEIGHT,
COMPRESSION_RATIO_FOR_ASTRIA_BLOCK
COMPRESSION_RATIO_FOR_ASTRIA_BLOCK,
CELESTIA_FEES_TOTAL_UTIA,
CELESTIA_FEES_UTIA_PER_UNCOMPRESSED_BLOB_BYTE,
CELESTIA_FEES_UTIA_PER_COMPRESSED_BLOB_BYTE
);

#[cfg(test)]
mod tests {
use super::{
BLOBS_PER_CELESTIA_TX,
BLOCKS_PER_CELESTIA_TX,
BYTES_PER_CELESTIA_TX,
CELESTIA_PAYLOAD_CREATION_LATENCY,
CELESTIA_SUBMISSION_COUNT,
CELESTIA_SUBMISSION_FAILURE_COUNT,
CELESTIA_SUBMISSION_HEIGHT,
CELESTIA_SUBMISSION_LATENCY,
COMPRESSION_RATIO_FOR_ASTRIA_BLOCK,
SEQUENCER_BLOCK_FETCH_FAILURE_COUNT,
SEQUENCER_HEIGHT_FETCH_FAILURE_COUNT,
SEQUENCER_SUBMISSION_HEIGHT,
};
use super::*;

#[track_caller]
fn assert_const(actual: &'static str, suffix: &str) {
Expand Down Expand Up @@ -257,5 +293,14 @@ mod tests {
COMPRESSION_RATIO_FOR_ASTRIA_BLOCK,
"compression_ratio_for_astria_block",
);
assert_const(CELESTIA_FEES_TOTAL_UTIA, "celestia_fees_total_utia");
assert_const(
CELESTIA_FEES_UTIA_PER_UNCOMPRESSED_BLOB_BYTE,
"celestia_fees_utia_per_uncompressed_blob_byte",
);
assert_const(
CELESTIA_FEES_UTIA_PER_COMPRESSED_BLOB_BYTE,
"celestia_fees_utia_per_compressed_blob_byte",
);
}
}
46 changes: 29 additions & 17 deletions crates/astria-sequencer-relayer/src/relayer/celestia_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl CelestiaClient {
&mut self,
blobs: Arc<Vec<Blob>>,
maybe_last_error: Option<TrySubmitError>,
) -> Result<BlobTx, TrySubmitError> {
) -> Result<BlobTxAndFee, TrySubmitError> {
info!("fetching cost params and account info from celestia app");
let (blob_params, auth_params, min_gas_price, base_account) = tokio::try_join!(
self.fetch_blob_params(),
Expand Down Expand Up @@ -196,7 +196,7 @@ impl CelestiaClient {
"prepared blob transaction for celestia app"
);

Ok(new_blob_tx(&signed_tx, blobs.iter()))
Ok(BlobTxAndFee::new(&signed_tx, blobs.iter(), fee))
}

#[instrument(skip_all, err(level = Level::WARN))]
Expand Down Expand Up @@ -775,22 +775,34 @@ fn new_signed_tx(
}
}

fn new_blob_tx<'a>(signed_tx: &Tx, blobs: impl Iterator<Item = &'a Blob>) -> BlobTx {
// From https://github.com/celestiaorg/celestia-core/blob/v1.29.0-tm-v0.34.29/pkg/consts/consts.go#L19
const BLOB_TX_TYPE_ID: &str = "BLOB";
pub(in crate::relayer) struct BlobTxAndFee {
pub(in crate::relayer) tx: BlobTx,
pub(in crate::relayer) fee: u64,
}

let blobs = blobs
.map(|blob| PbBlob {
namespace_id: Bytes::from(blob.namespace.id().to_vec()),
namespace_version: u32::from(blob.namespace.version()),
data: Bytes::from(blob.data.clone()),
share_version: u32::from(blob.share_version),
})
.collect();
BlobTx {
tx: Bytes::from(signed_tx.encode_to_vec()),
blobs,
type_id: BLOB_TX_TYPE_ID.to_string(),
impl BlobTxAndFee {
fn new<'a>(signed_tx: &Tx, blobs: impl Iterator<Item = &'a Blob>, fee: u64) -> Self {
// From https://github.com/celestiaorg/celestia-core/blob/v1.29.0-tm-v0.34.29/pkg/consts/consts.go#L19
const BLOB_TX_TYPE_ID: &str = "BLOB";

let blobs = blobs
.map(|blob| PbBlob {
namespace_id: Bytes::from(blob.namespace.id().to_vec()),
namespace_version: u32::from(blob.namespace.version()),
data: Bytes::from(blob.data.clone()),
share_version: u32::from(blob.share_version),
})
.collect();
let tx = BlobTx {
tx: Bytes::from(signed_tx.encode_to_vec()),
blobs,
type_id: BLOB_TX_TYPE_ID.to_string(),
};

Self {
tx,
fee,
}
}
}

Expand Down
Loading

0 comments on commit 466e458

Please sign in to comment.