Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 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/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.11.0
version: 0.11.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
9 changes: 7 additions & 2 deletions charts/sequencer-relayer/files/scripts/start-relayer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ set -o errexit -o nounset -o pipefail

echo "Starting the Astria Sequencer Relayer..."

if ! [ -f "$ASTRIA_SEQUENCER_RELAYER_PRE_SUBMIT_PATH" ]; then
if ! [ -z ${ASTRIA_SEQUENCER_RELAYER_PRE_SUBMIT_PATH+x} ] && ! [ -f "$ASTRIA_SEQUENCER_RELAYER_PRE_SUBMIT_PATH" ]; then
echo "Pre-submit storage file not found, instantiating with ignore state. Post submit storage file will be created on first submit."
echo "{\"state\": \"ignore\"}" > $ASTRIA_SEQUENCER_RELAYER_PRE_SUBMIT_PATH
fi

if ! [ -f "$ASTRIA_SEQUENCER_RELAYER_POST_SUBMIT_PATH" ]; then
if ! [ -z ${ASTRIA_SEQUENCER_RELAYER_POST_SUBMIT_PATH+x} ] && ! [ -f "$ASTRIA_SEQUENCER_RELAYER_POST_SUBMIT_PATH" ]; then
echo "Post-submit storage file does not exist, instantiating with fresh state. Will start relaying from first sequencer block."
echo "{\"state\": \"fresh\"}" > $ASTRIA_SEQUENCER_RELAYER_POST_SUBMIT_PATH
fi

if ! [ -z ${ASTRIA_SEQUENCER_RELAYER_SUBMISSION_STATE_PATH+x} ] && ! [ -f "$ASTRIA_SEQUENCER_RELAYER_SUBMISSION_STATE_PATH" ]; then
echo "Submission state file does not exist, instantiating with fresh state. Will start relaying from first sequencer block."
echo "{\"state\": \"fresh\"}" > $ASTRIA_SEQUENCER_RELAYER_SUBMISSION_STATE_PATH
fi

exec /usr/local/bin/astria-sequencer-relayer
4 changes: 4 additions & 0 deletions charts/sequencer-relayer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ Namepsace to deploy elements into.
{{- define "sequencer-relayer.storage.postSubmitPath" -}}
{{ include "sequencer-relayer.storage.mountPath" . }}/postsubmit.json
{{- end }}

{{- define "sequencer-relayer.storage.submissionStatePath" -}}
{{ include "sequencer-relayer.storage.mountPath" . }}/submission-state.json
{{- end }}
5 changes: 3 additions & 2 deletions charts/sequencer-relayer/templates/configmaps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ data:
ASTRIA_SEQUENCER_RELAYER_CELESTIA_APP_GRPC_ENDPOINT: "{{ .Values.config.relayer.celestiaAppGrpc }}"
ASTRIA_SEQUENCER_RELAYER_CELESTIA_APP_KEY_FILE: "/celestia-key/{{ .Values.config.celestiaAppPrivateKey.secret.filename }}"
ASTRIA_SEQUENCER_RELAYER_API_ADDR: "0.0.0.0:{{ .Values.ports.healthAPI }}"
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: "0.0.0.0:{{ .Values.ports.metrics }}"
ASTRIA_SEQUENCER_RELAYER_FORCE_STDOUT: "{{ .Values.global.useTTY }}"
Expand All @@ -30,7 +28,10 @@ data:
ASTRIA_SEQUENCER_RELAYER_SEQUENCER_CHAIN_ID: "{{ .Values.config.relayer.sequencerChainId }}"
ASTRIA_SEQUENCER_RELAYER_CELESTIA_CHAIN_ID: "{{ .Values.config.relayer.celestiaChainId }}"
{{- if not .Values.global.dev }}
ASTRIA_SEQUENCER_RELAYER_PRE_SUBMIT_PATH: "{{ include "sequencer-relayer.storage.preSubmitPath" . }}"
ASTRIA_SEQUENCER_RELAYER_POST_SUBMIT_PATH: "{{ include "sequencer-relayer.storage.postSubmitPath" . }}"
{{- else }}
ASTRIA_SEQUENCER_RELAYER_SUBMISSION_STATE_PATH: "{{ include "sequencer-relayer.storage.submissionStatePath" . }}"
{{- end }}
---
apiVersion: v1
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.11.0
digest: sha256:70434f4e37c36660ff9b89258d4de6770f206712020bda7398a22772e8f74fa8
generated: "2024-07-19T12:21:51.250339+02:00"
version: 0.11.1
digest: sha256:9c44f4901c4b89bbf6261f1a92bb18f71aef6d95e536aadc8a4a275a01eec25b
generated: "2024-07-23T20:01:42.179395482+01: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.19.0
version: 0.19.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.
Expand All @@ -24,7 +24,7 @@ appVersion: "0.14.0"

dependencies:
- name: sequencer-relayer
version: "0.11.0"
version: "0.11.1"
repository: "file://../sequencer-relayer"
condition: sequencer-relayer.enabled

Expand Down
8 changes: 7 additions & 1 deletion crates/astria-sequencer-relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const_format = { workspace = true }
futures = { workspace = true }
hex = { workspace = true, features = ["serde"] }
humantime = { workspace = true }
humantime-serde = "1.1.1"
hyper = { workspace = true }
itoa = { workspace = true }
metrics = { workspace = true }
Expand All @@ -39,7 +40,12 @@ tendermint-config = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
tryhard = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "signal"] }
tokio = { workspace = true, features = [
"fs",
"macros",
"rt-multi-thread",
"signal",
] }
tokio-stream = { workspace = true }
tokio-util = { workspace = true }
tonic = { workspace = true }
Expand Down
22 changes: 8 additions & 14 deletions crates/astria-sequencer-relayer/local.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,17 @@ ASTRIA_SEQUENCER_RELAYER_ONLY_INCLUDE_ROLLUPS=
# The socket address at which sequencer relayer will server healthz, readyz, and status calls.
ASTRIA_SEQUENCER_RELAYER_API_ADDR=127.0.0.1:2450

# The path to which relayer will write its state prior to submitting to Celestia.
# A file must exist at this path, be readable and writable, and contain one of:
# 1. {"state": "ignore"}
# to ignore the pre-submit state entirely and only consider the object stored in
# ASTRIA_SEQUENCER_RELAYER_POST_SUBMIT_PATH.
# 2. {"state": "started", "last_submission": <post_submission_state> }
# which is usually only written by sequencer-relayer during normal operation and
# is checked for consistency with ASTRIA_SEQUENCER_RELAYER_POST_SUBMIT_PATH at startup.
ASTRIA_SEQUENCER_RELAYER_PRE_SUBMIT_PATH=/path/to/presubmit.json

# The path to which relayer will write its state after submitting to Celestia.
# The path to which relayer will write its state while submitting to Celestia.
# A file must exist at this path, be readable and writable, and contain one of:
# 1. {"state": "fresh"}
# for relaying sequencer blocks starting at sequencer height 1.
# 2. {"state": "submitted", "celestia_height": <number>, "sequencer_height": <number>}}
# for relaying blocks starting at `<number> + 1`.
ASTRIA_SEQUENCER_RELAYER_POST_SUBMIT_PATH=/path/to/postsubmit.json
# 2. {"state":"started","last_submission":{"celestia_height":<number>,"sequencer_height":<number>}}
# for relaying blocks starting at `[last_submission.sequencer_height] + 1`.
# 3. {"state":"prepared","sequencer_height":<number>,"last_submission":{"celestia_height":<number>,"sequencer_height":<number>},"blob_tx_hash":"<hex string>","at":"<timestamp>"}
# for trying to continue from the last submission attempt. Checks if the given blob tx is stored
# on Celestia, and if so, begins relaying blocks starting at `[sequencer_height] + 1`, otherwise
# begins relaying blocks starting at `[last_submission.sequencer_height] + 1`.
ASTRIA_SEQUENCER_RELAYER_SUBMISSION_STATE_PATH=/path/to/submission-state.json

# Set to true to enable prometheus metrics.
ASTRIA_SEQUENCER_RELAYER_NO_METRICS=true
Expand Down
6 changes: 2 additions & 4 deletions crates/astria-sequencer-relayer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ pub struct Config {
pub metrics_http_listener_addr: String,
/// Writes a human readable format to stdout instead of JSON formatted OTEL trace data.
pub pretty_print: bool,
/// The path to which relayer will write its state prior to submitting to Celestia.
pub pre_submit_path: PathBuf,
/// The path to which relayer will write its state after submitting to Celestia.
pub post_submit_path: PathBuf,
/// The path to which relayer will write its state while submitting to Celestia.
pub submission_state_path: PathBuf,
}

impl Config {
Expand Down
9 changes: 3 additions & 6 deletions crates/astria-sequencer-relayer/src/relayer/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ pub(crate) struct Builder {
pub(crate) sequencer_poll_period: Duration,
pub(crate) sequencer_grpc_endpoint: String,
pub(crate) rollup_filter: IncludeRollup,
pub(crate) pre_submit_path: PathBuf,
pub(crate) post_submit_path: PathBuf,
pub(crate) submission_state_path: PathBuf,
pub(crate) metrics: &'static Metrics,
}

Expand All @@ -53,8 +52,7 @@ impl Builder {
sequencer_poll_period,
sequencer_grpc_endpoint,
rollup_filter,
pre_submit_path,
post_submit_path,
submission_state_path,
metrics,
} = self;

Expand Down Expand Up @@ -93,8 +91,7 @@ impl Builder {
celestia_client_builder,
rollup_filter,
state,
pre_submit_path,
post_submit_path,
submission_state_path,
metrics,
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ pub(in crate::relayer) enum TrySubmitError {
#[derive(Clone, Debug)]
pub(in crate::relayer) struct GrpcResponseError(Status);

impl GrpcResponseError {
pub(in crate::relayer) fn is_timeout(&self) -> bool {
self.0.code() == tonic::Code::Cancelled
}
}

impl Display for GrpcResponseError {
fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
write!(
Expand Down
Loading