Skip to content

Commit

Permalink
Merge branch 'main' into argo-pe-charts
Browse files Browse the repository at this point in the history
  • Loading branch information
aajimal authored May 15, 2024
2 parents 1c43037 + 59bdae7 commit 9dbbddb
Show file tree
Hide file tree
Showing 35 changed files with 1,246 additions and 178 deletions.
1 change: 1 addition & 0 deletions 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-rollup/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ data:
ASTRIA_CONDUCTOR_SEQUENCER_COMETBFT_URL: "{{ .Values.config.sequencer.rpc }}"
ASTRIA_CONDUCTOR_SEQUENCER_BLOCK_TIME_MS: "{{ .Values.config.sequencer.blockTimeMs }}"
ASTRIA_CONDUCTOR_NO_METRICS: "{{ not .Values.config.rollup.metrics.enabled }}"
ASTRIA_CONDUCTOR_METRICS_HTTP_LISTENER_ADDR: "127.0.0.1:{{ .Values.ports.conductorMetrics }}"
ASTRIA_CONDUCTOR_METRICS_HTTP_LISTENER_ADDR: "0.0.0.0:{{ .Values.ports.conductorMetrics }}"
ASTRIA_CONDUCTOR_FORCE_STDOUT: "{{ .Values.global.useTTY }}"
ASTRIA_CONDUCTOR_PRETTY_PRINT: "{{ .Values.global.useTTY }}"
ASTRIA_CONDUCTOR_NO_OTEL: "{{ not .Values.config.rollup.otel.enabled }}"
Expand Down Expand Up @@ -52,7 +52,7 @@ data:
ASTRIA_COMPOSER_BUNDLE_QUEUE_CAPACITY: "{{ .Values.config.rollup.bundleQueueCapacity }}"
ASTRIA_COMPOSER_MAX_SUBMIT_INTERVAL_MS: "{{ .Values.config.rollup.maxSubmitInterval }}"
ASTRIA_COMPOSER_NO_METRICS: "{{ not .Values.config.rollup.metrics.enabled }}"
ASTRIA_COMPOSER_METRICS_HTTP_LISTENER_ADDR: "127.0.0.1:{{ .Values.ports.composerMetrics }}"
ASTRIA_COMPOSER_METRICS_HTTP_LISTENER_ADDR: "0.0.0.0:{{ .Values.ports.composerMetrics }}"
ASTRIA_COMPOSER_FORCE_STDOUT: "{{ .Values.global.useTTY }}"
ASTRIA_COMPOSER_PRETTY_PRINT: "{{ .Values.global.useTTY }}"
ASTRIA_COMPOSER_NO_OTEL: "{{ not .Values.config.rollup.otel.enabled }}"
Expand Down
2 changes: 1 addition & 1 deletion charts/sequencer-relayer/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: 0.7.0
version: 0.7.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
Expand Down
2 changes: 1 addition & 1 deletion charts/sequencer-relayer/templates/configmaps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data:
ASTRIA_SEQUENCER_RELAYER_PRE_SUBMIT_PATH: "{{ include "sequencer-relayer.storage.preSubmitPath" . }}"
ASTRIA_SEQUENCER_RELAYER_POST_SUBMIT_PATH: "{{ include "sequencer-relayer.storage.postSubmitPath" . }}"
ASTRIA_SEQUENCER_RELAYER_NO_METRICS: "{{ not .Values.config.relayer.metrics.enabled }}"
ASTRIA_SEQUENCER_RELAYER_METRICS_HTTP_LISTENER_ADDR: "127.0.0.1:{{ .Values.ports.metrics }}"
ASTRIA_SEQUENCER_RELAYER_METRICS_HTTP_LISTENER_ADDR: "0.0.0.0:{{ .Values.ports.metrics }}"
ASTRIA_SEQUENCER_RELAYER_FORCE_STDOUT: "{{ .Values.global.useTTY }}"
ASTRIA_SEQUENCER_RELAYER_PRETTY_PRINT: "{{ .Values.global.useTTY }}"
ASTRIA_SEQUENCER_RELAYER_NO_OTEL: "{{ not .Values.config.relayer.otel.enabled }}"
Expand Down
6 changes: 3 additions & 3 deletions charts/sequencer/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: sequencer-relayer
repository: file://../sequencer-relayer
version: 0.7.0
digest: sha256:d2dd2fe6269d865f106374173bb2dd5cea3f354185fbd03c54b3a9ecceb01c71
generated: "2024-05-08T13:42:42.507768-07:00"
version: 0.7.1
digest: sha256:5a0466a5915b0efa3c5789c6f9ad1e083009e8c122b78c5e93248d30036e948a
generated: "2024-05-14T09:25:59.584035-04:00"
4 changes: 2 additions & 2 deletions charts/sequencer/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: 0.13.6
version: 0.13.7

# 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
Expand All @@ -25,7 +25,7 @@ appVersion: "0.11.0"

dependencies:
- name: sequencer-relayer
version: "0.7.0"
version: "0.7.1"
repository: "file://../sequencer-relayer"
condition: sequencer-relayer.enabled

Expand Down
2 changes: 1 addition & 1 deletion charts/sequencer/templates/configmaps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ data:
# Socket address for gRPC server
ASTRIA_SEQUENCER_GRPC_ADDR: "0.0.0.0:{{ .Values.ports.sequencerGRPC }}"
ASTRIA_SEQUENCER_NO_METRICS: "{{ not .Values.config.sequencer.metrics.enabled }}"
ASTRIA_SEQUENCER_METRICS_HTTP_LISTENER_ADDR: "127.0.0.1:{{ .Values.ports.sequencerMetrics }}"
ASTRIA_SEQUENCER_METRICS_HTTP_LISTENER_ADDR: "0.0.0.0:{{ .Values.ports.sequencerMetrics }}"
ASTRIA_SEQUENCER_FORCE_STDOUT: "{{ .Values.global.useTTY }}"
ASTRIA_SEQUENCER_PRETTY_PRINT: "{{ .Values.global.useTTY }}"
ASTRIA_SEQUENCER_NO_OTEL: "{{ not .Values.config.sequencer.otel.enabled }}"
Expand Down
5 changes: 2 additions & 3 deletions crates/astria-composer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ async fn main() -> ExitCode {
if !cfg.no_metrics {
telemetry_conf = telemetry_conf
.metrics_addr(&cfg.metrics_http_listener_addr)
.service_name(env!("CARGO_PKG_NAME"));
.service_name(env!("CARGO_PKG_NAME"))
.register_metrics(metrics_init::register);
}

metrics_init::register();

if let Err(e) = telemetry_conf
.try_init()
.wrap_err("failed to setup telemetry")
Expand Down
3 changes: 2 additions & 1 deletion crates/astria-conductor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ async fn main() -> ExitCode {
if !cfg.no_metrics {
telemetry_conf = telemetry_conf
.metrics_addr(&cfg.metrics_http_listener_addr)
.service_name(env!("CARGO_PKG_NAME"));
.service_name(env!("CARGO_PKG_NAME"))
.register_metrics(|| {}); // conductor currently has no metrics
}

if let Err(e) = telemetry_conf
Expand Down

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

115 changes: 115 additions & 0 deletions crates/astria-core/src/protocol/transaction/v1alpha1/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub enum Action {
FeeAssetChange(FeeAssetChangeAction),
InitBridgeAccount(InitBridgeAccountAction),
BridgeLock(BridgeLockAction),
BridgeUnlock(BridgeUnlockAction),
}

impl Action {
Expand All @@ -54,6 +55,7 @@ impl Action {
Action::FeeAssetChange(act) => Value::FeeAssetChangeAction(act.into_raw()),
Action::InitBridgeAccount(act) => Value::InitBridgeAccountAction(act.into_raw()),
Action::BridgeLock(act) => Value::BridgeLockAction(act.into_raw()),
Action::BridgeUnlock(act) => Value::BridgeUnlockAction(act.into_raw()),
};
raw::Action {
value: Some(kind),
Expand All @@ -77,6 +79,7 @@ impl Action {
Action::FeeAssetChange(act) => Value::FeeAssetChangeAction(act.to_raw()),
Action::InitBridgeAccount(act) => Value::InitBridgeAccountAction(act.to_raw()),
Action::BridgeLock(act) => Value::BridgeLockAction(act.to_raw()),
Action::BridgeUnlock(act) => Value::BridgeUnlockAction(act.to_raw()),
};
raw::Action {
value: Some(kind),
Expand Down Expand Up @@ -134,6 +137,9 @@ impl Action {
Value::BridgeLockAction(act) => Self::BridgeLock(
BridgeLockAction::try_from_raw(act).map_err(ActionError::bridge_lock)?,
),
Value::BridgeUnlockAction(act) => Self::BridgeUnlock(
BridgeUnlockAction::try_from_raw(act).map_err(ActionError::bridge_unlock)?,
),
};
Ok(action)
}
Expand Down Expand Up @@ -215,6 +221,12 @@ impl From<BridgeLockAction> for Action {
}
}

impl From<BridgeUnlockAction> for Action {
fn from(value: BridgeUnlockAction) -> Self {
Self::BridgeUnlock(value)
}
}

#[allow(clippy::module_name_repetitions)]
#[derive(Debug, thiserror::Error)]
#[error(transparent)]
Expand Down Expand Up @@ -268,6 +280,10 @@ impl ActionError {
fn bridge_lock(inner: BridgeLockActionError) -> Self {
Self(ActionErrorKind::BridgeLock(inner))
}

fn bridge_unlock(inner: BridgeUnlockActionError) -> Self {
Self(ActionErrorKind::BridgeUnlock(inner))
}
}

#[derive(Debug, thiserror::Error)]
Expand Down Expand Up @@ -296,6 +312,8 @@ enum ActionErrorKind {
InitBridgeAccount(#[source] InitBridgeAccountActionError),
#[error("bridge lock action was not valid")]
BridgeLock(#[source] BridgeLockActionError),
#[error("bridge unlock action was not valid")]
BridgeUnlock(#[source] BridgeUnlockActionError),
}

#[derive(Debug, thiserror::Error)]
Expand Down Expand Up @@ -1269,3 +1287,100 @@ enum BridgeLockActionErrorKind {
#[error("the `fee_asset_id` field was invalid")]
InvalidFeeAssetId(#[source] asset::IncorrectAssetIdLength),
}

#[allow(clippy::module_name_repetitions)]
#[derive(Debug, Clone)]
pub struct BridgeUnlockAction {
pub to: Address,
pub amount: u128,
// asset to use for fee payment.
pub fee_asset_id: asset::Id,
// memo for double spend protection.
pub memo: Vec<u8>,
}

impl BridgeUnlockAction {
#[must_use]
pub fn into_raw(self) -> raw::BridgeUnlockAction {
raw::BridgeUnlockAction {
to: Some(self.to.to_raw()),
amount: Some(self.amount.into()),
fee_asset_id: self.fee_asset_id.as_ref().to_vec(),
memo: self.memo,
}
}

#[must_use]
pub fn to_raw(&self) -> raw::BridgeUnlockAction {
raw::BridgeUnlockAction {
to: Some(self.to.to_raw()),
amount: Some(self.amount.into()),
fee_asset_id: self.fee_asset_id.as_ref().to_vec(),
memo: self.memo.clone(),
}
}

/// Convert from a raw, unchecked protobuf [`raw::BridgeUnlockAction`].
///
/// # Errors
///
/// - if the `to` field is not set
/// - if the `to` field is invalid
/// - if the `amount` field is invalid
/// - if the `fee_asset_id` field is invalid
pub fn try_from_raw(proto: raw::BridgeUnlockAction) -> Result<Self, BridgeUnlockActionError> {
let Some(to) = proto.to else {
return Err(BridgeUnlockActionError::field_not_set("to"));
};
let to = Address::try_from_raw(&to).map_err(BridgeUnlockActionError::invalid_address)?;
let amount = proto
.amount
.ok_or(BridgeUnlockActionError::missing_amount())?;
let fee_asset_id = asset::Id::try_from_slice(&proto.fee_asset_id)
.map_err(BridgeUnlockActionError::invalid_fee_asset_id)?;
Ok(Self {
to,
amount: amount.into(),
fee_asset_id,
memo: proto.memo,
})
}
}

#[derive(Debug, thiserror::Error)]
#[error(transparent)]
pub struct BridgeUnlockActionError(BridgeUnlockActionErrorKind);

impl BridgeUnlockActionError {
#[must_use]
fn field_not_set(field: &'static str) -> Self {
Self(BridgeUnlockActionErrorKind::FieldNotSet(field))
}

#[must_use]
fn invalid_address(err: IncorrectAddressLength) -> Self {
Self(BridgeUnlockActionErrorKind::InvalidAddress(err))
}

#[must_use]
fn missing_amount() -> Self {
Self(BridgeUnlockActionErrorKind::MissingAmount)
}

#[must_use]
fn invalid_fee_asset_id(err: asset::IncorrectAssetIdLength) -> Self {
Self(BridgeUnlockActionErrorKind::InvalidFeeAssetId(err))
}
}

#[derive(Debug, thiserror::Error)]
enum BridgeUnlockActionErrorKind {
#[error("the expected field in the raw source type was not set: `{0}`")]
FieldNotSet(&'static str),
#[error("the `to` field was invalid")]
InvalidAddress(#[source] IncorrectAddressLength),
#[error("the `amount` field was not set")]
MissingAmount,
#[error("the `fee_asset_id` field was invalid")]
InvalidFeeAssetId(#[source] asset::IncorrectAssetIdLength),
}
Loading

0 comments on commit 9dbbddb

Please sign in to comment.