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
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.8.4
version: 0.8.5

# 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/sequencer-relayer/templates/configmaps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ metadata:
data:
ASTRIA_SEQUENCER_RELAYER_LOG: "astria_sequencer_relayer=debug"
ASTRIA_SEQUENCER_RELAYER_BLOCK_TIME: "1000"
ASTRIA_SEQUENCER_RELAYER_VALIDATOR_KEY_FILE: /cometbft/config/priv_validator_key.json
ASTRIA_SEQUENCER_RELAYER_RELAY_ONLY_VALIDATOR_KEY_BLOCKS: "false"
ASTRIA_SEQUENCER_RELAYER_COMETBFT_ENDPOINT: "{{ .Values.config.relayer.cometbftRpc }}"
ASTRIA_SEQUENCER_RELAYER_SEQUENCER_GRPC_ENDPOINT: "{{ .Values.config.relayer.sequencerGrpc }}"
ASTRIA_SEQUENCER_RELAYER_CELESTIA_APP_GRPC_ENDPOINT: "{{ .Values.config.relayer.celestiaAppGrpc }}"
Expand All @@ -29,6 +27,8 @@ data:
OTEL_SERVICE_NAME: "{{ tpl .Values.config.relayer.otel.serviceName . }}"
ASTRIA_SEQUENCER_RELAYER_ONLY_INCLUDE_ROLLUPS: "{{ .Values.config.relayer.onlyIncludeRollups }}"
{{- if not .Values.global.dev }}
ASTRIA_SEQUENCER_RELAYER_VALIDATOR_KEY_FILE: /cometbft/config/priv_validator_key.json
ASTRIA_SEQUENCER_RELAYER_RELAY_ONLY_VALIDATOR_KEY_BLOCKS: "false"
{{- else }}
ASTRIA_SEQUENCER_RELAYER_SEQUENCER_CHAIN_ID: "{{ .Values.config.relayer.sequencerChainId }}"
ASTRIA_SEQUENCER_RELAYER_CELESTIA_CHAIN_ID: "{{ .Values.config.relayer.celestiaChainId }}"
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.8.4
digest: sha256:fa980cbe23353b162aad741afbf2ccde4d93b6d017be5fe478d5994bcfd1c992
generated: "2024-05-30T17:09:44.161456347+01:00"
version: 0.8.5
digest: sha256:66ce8c4cd8500a63282f7ab112682f8cd50c2253a0b046ec41e0c637c9b66bd9
generated: "2024-06-10T13:21:58.112283375+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.15.5
version: 0.15.6

# 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.13.0"

dependencies:
- name: sequencer-relayer
version: "0.8.4"
version: "0.8.5"
repository: "file://../sequencer-relayer"
condition: sequencer-relayer.enabled

Expand Down
8 changes: 0 additions & 8 deletions crates/astria-sequencer-relayer/local.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ ASTRIA_SEQUENCER_RELAYER_CELESTIA_APP_KEY_FILE=/path/to/priv_celestia_key.json
# requesting a new block from sequencer.
ASTRIA_SEQUENCER_RELAYER_BLOCK_TIME=1000

# Set to true to only relay blocks proposed by the validator key in `ASTRIA_SEQUENCER_RELAYER_VALIDATOR_KEY_FILE`.
ASTRIA_SEQUENCER_RELAYER_RELAY_ONLY_VALIDATOR_KEY_BLOCKS=false

# A comma-separated list of base64-encoded rollup IDs, often the sha256
# hash of a rollup name.
# Only data from these rollups will be submitted to Celestia.
Expand All @@ -60,11 +57,6 @@ ASTRIA_SEQUENCER_RELAYER_RELAY_ONLY_VALIDATOR_KEY_BLOCKS=false
# ASTRIA_SEQUENCER_RELAYER_ONLY_INCLUDE_ROLLUPS=AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyA=,IB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJCAcGBQQDAgE=
ASTRIA_SEQUENCER_RELAYER_ONLY_INCLUDE_ROLLUPS=

# The path to the file storing the cometbft validator key.
# Used to sign data before submitting it to celestia.
# Ignored if `ASTRIA_SEQUENCER_RELAYER_RELAY_ONLY_VALIDATOR_KEY_BLOCKS=false`.
ASTRIA_SEQUENCER_RELAYER_VALIDATOR_KEY_FILE=.cometbft/config/priv_validator_key.json

# The socket address at which sequencer relayer will server healthz, readyz, and status calls.
ASTRIA_SEQUENCER_RELAYER_API_ADDR=127.0.0.1:2450

Expand Down
3 changes: 0 additions & 3 deletions crates/astria-sequencer-relayer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ pub struct Config {
pub celestia_app_grpc_endpoint: String,
pub celestia_app_key_file: String,
pub block_time: u64,
pub relay_only_validator_key_blocks: bool,
#[serde(default)]
pub validator_key_file: String,
// Would ideally be private; accessed via the public getter which converts this to a collection
// of `RollupId`s. Left public for integration tests.
#[doc(hidden)]
Expand Down
13 changes: 1 addition & 12 deletions crates/astria-sequencer-relayer/src/relayer/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ use super::{
CelestiaClientBuilder,
CelestiaKeys,
};
use crate::{
validator::Validator,
IncludeRollup,
};
use crate::IncludeRollup;

pub(crate) struct Builder {
pub(crate) shutdown_token: tokio_util::sync::CancellationToken,
Expand All @@ -34,7 +31,6 @@ pub(crate) struct Builder {
pub(crate) cometbft_endpoint: String,
pub(crate) sequencer_poll_period: Duration,
pub(crate) sequencer_grpc_endpoint: String,
pub(crate) validator_key_path: Option<String>,
pub(crate) rollup_filter: IncludeRollup,
pub(crate) pre_submit_path: PathBuf,
pub(crate) post_submit_path: PathBuf,
Expand All @@ -52,7 +48,6 @@ impl Builder {
cometbft_endpoint,
sequencer_poll_period,
sequencer_grpc_endpoint,
validator_key_path,
rollup_filter,
pre_submit_path,
post_submit_path,
Expand All @@ -68,11 +63,6 @@ impl Builder {
SequencerServiceClient::new(endpoint.connect_lazy())
};

let validator = validator_key_path
.map(Validator::from_path)
.transpose()
.wrap_err("failed to get validator info from file")?;

let state = Arc::new(State::new());

let celestia_client_builder = {
Expand All @@ -92,7 +82,6 @@ impl Builder {
sequencer_grpc_client,
sequencer_poll_period,
celestia_client_builder,
validator,
rollup_filter,
state,
pre_submit_path,
Expand Down
25 changes: 0 additions & 25 deletions crates/astria-sequencer-relayer/src/relayer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ use tonic::transport::Channel;
use tracing::{
debug,
error,
field::DisplayValue,
info,
instrument,
trace,
Expand Down Expand Up @@ -97,9 +96,6 @@ pub(crate) struct Relayer {
/// The gRPC client for submitting sequencer blocks to celestia.
celestia_client_builder: CelestiaClientBuilder,

/// If this is set, only relay blocks to DA which are proposed by the same validator key.
validator: Option<Validator>,

/// The rollups whose data should be included in submissions.
rollup_filter: IncludeRollup,

Expand Down Expand Up @@ -245,19 +241,6 @@ impl Relayer {
reason.map(|_| ())
}

fn report_validator(&self) -> Option<DisplayValue<ReportValidator<'_>>> {
self.validator
.as_ref()
.map(ReportValidator)
.map(tracing::field::display)
}

fn block_does_not_match_validator(&self, block: &SequencerBlock) -> bool {
self.validator
.as_ref()
.is_some_and(|val| &val.address != block.header().proposer_address())
}

#[instrument(skip_all, fields(%height))]
fn forward_block_for_submission(
&self,
Expand All @@ -275,14 +258,6 @@ impl Relayer {
congested and this future is in-flight",
);

if self.block_does_not_match_validator(&block) {
info!(
address.validator = self.report_validator(),
address.block_proposer = %block.header().proposer_address(),
"block proposer does not match internal validator; dropping",
);
return Ok(());
}
if let Err(error) = submitter.try_send(block) {
debug!(
// Just print the error directly: TrySendError has no cause chain.
Expand Down
4 changes: 0 additions & 4 deletions crates/astria-sequencer-relayer/src/sequencer_relayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,12 @@ impl SequencerRelayer {
celestia_app_grpc_endpoint,
celestia_app_key_file,
block_time,
relay_only_validator_key_blocks,
validator_key_file,
api_addr,
pre_submit_path,
post_submit_path,
..
} = cfg;

let validator_key_path = relay_only_validator_key_blocks.then_some(validator_key_file);
let relayer = relayer::Builder {
shutdown_token: shutdown_handle.token(),
sequencer_chain_id,
Expand All @@ -72,7 +69,6 @@ impl SequencerRelayer {
cometbft_endpoint,
sequencer_poll_period: Duration::from_millis(block_time),
sequencer_grpc_endpoint,
validator_key_path,
rollup_filter,
pre_submit_path,
post_submit_path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,22 @@ impl MockSequencerServer {
}
}

pub async fn mount_sequencer_block_response<const RELAY_SELF: bool>(
pub async fn mount_sequencer_block_response(
&self,
account: AccountId,
block_to_mount: SequencerBlockToMount,
debug_name: impl Into<String>,
) {
prepare_sequencer_block_response::<RELAY_SELF>(account, block_to_mount, debug_name)
prepare_sequencer_block_response(block_to_mount, debug_name)
.mount(&self.mock_server)
.await;
}

pub async fn mount_sequencer_block_response_as_scoped<const RELAY_SELF: bool>(
pub async fn mount_sequencer_block_response_as_scoped(
&self,
account: AccountId,
block_to_mount: SequencerBlockToMount,
debug_name: impl Into<String>,
) -> MockGuard {
prepare_sequencer_block_response::<RELAY_SELF>(account, block_to_mount, debug_name)
prepare_sequencer_block_response(block_to_mount, debug_name)
.mount_as_scoped(&self.mock_server)
.await
}
Expand Down Expand Up @@ -136,17 +134,11 @@ impl SequencerService for SequencerServiceImpl {
}
}

fn prepare_sequencer_block_response<const RELAY_SELF: bool>(
account: AccountId,
fn prepare_sequencer_block_response(
block_to_mount: SequencerBlockToMount,
debug_name: impl Into<String>,
) -> Mock {
let proposer = if RELAY_SELF {
account
} else {
AccountId::try_from(vec![0u8; 20]).unwrap()
};

let proposer = AccountId::try_from(vec![0u8; 20]).unwrap();
let should_corrupt = matches!(block_to_mount, SequencerBlockToMount::BadAtHeight(_));

let block = match block_to_mount {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ pub struct TestSequencerRelayer {

pub signing_key: SigningKey,

pub account: tendermint::account::Id,

pub validator_keyfile: NamedTempFile,

pub pre_submit_file: NamedTempFile,
pub post_submit_file: NamedTempFile,
/// The sequencer chain ID which will be returned by the mock `cometbft` instance, and set via
Expand Down Expand Up @@ -230,31 +226,27 @@ impl TestSequencerRelayer {
/// Mounts a Sequencer block response.
///
/// The `debug_name` is assigned to the mock and is output on error to assist with debugging.
pub async fn mount_sequencer_block_response<const RELAY_SELF: bool>(
pub async fn mount_sequencer_block_response(
&self,
block_to_mount: SequencerBlockToMount,
debug_name: impl Into<String>,
) {
self.sequencer
.mount_sequencer_block_response::<RELAY_SELF>(self.account, block_to_mount, debug_name)
.mount_sequencer_block_response(block_to_mount, debug_name)
.await;
}

/// Mounts a Sequencer block response and returns a `GrpcMockGuard` to allow for waiting for
/// the mock to be satisfied.
///
/// The `debug_name` is assigned to the mock and is output on error to assist with debugging.
pub async fn mount_sequencer_block_response_as_scoped<const RELAY_SELF: bool>(
pub async fn mount_sequencer_block_response_as_scoped(
&self,
block_to_mount: SequencerBlockToMount,
debug_name: impl Into<String>,
) -> GrpcMockGuard {
self.sequencer
.mount_sequencer_block_response_as_scoped::<RELAY_SELF>(
self.account,
block_to_mount,
debug_name,
)
.mount_sequencer_block_response_as_scoped(block_to_mount, debug_name)
.await
}

Expand Down Expand Up @@ -668,9 +660,6 @@ impl TestSequencerRelayer {
// allow: want the name to reflect this is a test config.
#[allow(clippy::module_name_repetitions)]
pub struct TestSequencerRelayerConfig {
/// Sets up the test relayer to ignore all blocks except those proposed by the same address
/// stored in its validator key.
pub relay_only_self: bool,
/// Sets the start height of relayer and configures the on-disk pre- and post-submit files to
/// look accordingly.
pub last_written_sequencer_height: Option<u64>,
Expand Down Expand Up @@ -700,11 +689,8 @@ impl TestSequencerRelayerConfig {
)
.await;

let validator_keyfile = write_file(PRIVATE_VALIDATOR_KEY.as_bytes()).await;
let PrivValidatorKey {
address,
priv_key,
..
priv_key, ..
} = PrivValidatorKey::parse_json(PRIVATE_VALIDATOR_KEY).unwrap();
let signing_key = priv_key
.ed25519_signing_key()
Expand Down Expand Up @@ -736,8 +722,6 @@ impl TestSequencerRelayerConfig {
celestia_app_grpc_endpoint,
celestia_app_key_file: celestia_keyfile.path().to_string_lossy().to_string(),
block_time: 1000,
relay_only_validator_key_blocks: self.relay_only_self,
validator_key_file: validator_keyfile.path().to_string_lossy().to_string(),
only_include_rollups,
api_addr: "0.0.0.0:0".into(),
log: String::new(),
Expand Down Expand Up @@ -765,8 +749,6 @@ impl TestSequencerRelayerConfig {
relayer_shutdown_handle: Some(relayer_shutdown_handle),
sequencer_relayer,
signing_key,
account: address,
validator_keyfile,
pre_submit_file,
post_submit_file,
actual_sequencer_chain_id: self.sequencer_chain_id,
Expand All @@ -784,7 +766,6 @@ impl TestSequencerRelayerConfig {
impl Default for TestSequencerRelayerConfig {
fn default() -> Self {
Self {
relay_only_self: false,
last_written_sequencer_height: None,
only_include_rollups: HashSet::new(),
sequencer_chain_id: SEQUENCER_CHAIN_ID.to_string(),
Expand Down
Loading