Skip to content

Commit

Permalink
merge w main
Browse files Browse the repository at this point in the history
  • Loading branch information
noot committed May 14, 2024
2 parents 8493ed7 + f1bf0be commit 81075b3
Show file tree
Hide file tree
Showing 35 changed files with 1,242 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.

2 changes: 1 addition & 1 deletion charts/evm-rollup/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.16.0
version: 0.16.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
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),
FeeChange(FeeChangeAction),
}

Expand All @@ -55,6 +56,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()),
Action::FeeChange(act) => Value::FeeChangeAction(act.into_raw()),
};
raw::Action {
Expand All @@ -79,6 +81,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()),
Action::FeeChange(act) => Value::FeeChangeAction(act.to_raw()),
};
raw::Action {
Expand Down Expand Up @@ -137,6 +140,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)?,
),
Value::FeeChangeAction(act) => Self::FeeChange(
FeeChangeAction::try_from_raw(&act).map_err(ActionError::fee_change)?,
),
Expand Down Expand Up @@ -221,6 +227,12 @@ impl From<BridgeLockAction> for Action {
}
}

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

impl From<FeeChangeAction> for Action {
fn from(value: FeeChangeAction) -> Self {
Self::FeeChange(value)
Expand Down Expand Up @@ -281,6 +293,10 @@ impl ActionError {
Self(ActionErrorKind::BridgeLock(inner))
}

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

fn fee_change(inner: FeeChangeActionError) -> Self {
Self(ActionErrorKind::FeeChange(inner))
}
Expand Down Expand Up @@ -312,6 +328,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),
#[error("fee change action was not valid")]
FeeChange(#[source] FeeChangeActionError),
}
Expand Down Expand Up @@ -1288,6 +1306,103 @@ enum BridgeLockActionErrorKind {
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),
}

#[derive(Debug, Clone)]
pub enum FeeChange {
TransferBaseFee,
Expand Down
Loading

0 comments on commit 81075b3

Please sign in to comment.