Skip to content

Commit

Permalink
chore(proto)!: rename sequence action to rollup data submission (#1665)
Browse files Browse the repository at this point in the history
## Summary
Renames `astria.protocol.transaction.v1alpha1.Sequence` to
`astria.protocol.transaction.v1alpha1.RollupDataSubmission`.

## Background
Talking to third parties our the term "sequence action" frequently lead
to double takes, as it was not clear that this action was intended to
do. This patch provides makes it clear which action submits rollup data
data to Astria.

In line with the other actions, `RollupDataSubmission` follows the
convention of using gerundial nouns.

## Changes
- Renames `astria.protocol.transaction.v1alpha1.Sequence` to
`astria.protocol.transaction.v1alpha1.RollupDataSubmission`.
- Renames the
`astria.protocol.transaction.v1alpha1.Action.value.sequence` variant to
`astria.protocol.transaction.v1alpha1.Action.value.rollup_data_submission`
- Renames `astria.protocol.fees.v1alpha1.SequenceFeeComponents` to
`astria.protocol.fees.v1alpha1.RollupDataSubmissionFeeComponents`
- Renames `astria.protocol.genesis.v1alpha1.GenesisFees.sequence` to
`astria.protocol.genesis.v1alpha1.GenesisFees.rollup_data_submission`
and updates its type appropriately.
- Renames all items related to this action from sequence* to
rollup_data_* or rollup_data_submission_*

## Testing
This is a crate-wide change that only affects names but not the shape of
on wire data. All tests pass.

## Breaking Changelist
This is technically network breaking as all protobuf shapes stay
unchanged. However, since the genesis file is changed, and since
cometbft chains consume JSON in their init chain events, this change
will stop old sequencer nodes from being initialized even if the
provided data is the same.

## Related Issues
Closes #1659
  • Loading branch information
SuperFluffy authored Oct 16, 2024
1 parent eecb5c1 commit 3ff1696
Show file tree
Hide file tree
Showing 64 changed files with 456 additions and 458 deletions.
2 changes: 1 addition & 1 deletion 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.24.0
version: 0.25.0
# 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 Down
10 changes: 5 additions & 5 deletions charts/sequencer/files/cometbft/config/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"fees": {
{{- if not .Values.global.dev }}
"transfer_base_fee": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.transfer.base }},
"sequence_base_fee": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.sequence.base }},
"sequence_byte_cost_multiplier": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.sequence.multiplier }},
"sequence_base_fee": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.rollupDataSubmission.base }},
"sequence_byte_cost_multiplier": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.rollupDataSubmission.multiplier }},
"init_bridge_account_base_fee": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.initBridgeAccount.base }},
"bridge_lock_byte_cost_multiplier": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.bridgeLock.multiplier }},
"bridge_sudo_change_fee": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.bridgeSudoChange.base }},
Expand Down Expand Up @@ -52,9 +52,9 @@
"base": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.initBridgeAccount.base }},
"multiplier": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.initBridgeAccount.multiplier }}
},
"sequence": {
"base": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.sequence.base }},
"multiplier": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.sequence.multiplier }}
"rollup_data_submission": {
"base": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.rollupDataSubmission.base }},
"multiplier": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.rollupDataSubmission.multiplier }}
},
"sudo_address_change": {
"base": {{ include "sequencer.toUint128Proto" .Values.genesis.fees.sudoAddressChange.base }},
Expand Down
2 changes: 1 addition & 1 deletion charts/sequencer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ genesis:
initBridgeAccount:
base: "48"
multiplier: "0"
sequence:
rollupDataSubmission:
base: "32"
multiplier: "1"
sudoAddressChange:
Expand Down
6 changes: 3 additions & 3 deletions crates/astria-composer/src/collectors/geth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use astria_core::{
asset,
RollupId,
},
protocol::transaction::v1alpha1::action::Sequence,
protocol::transaction::v1alpha1::action::RollupDataSubmission,
};
use astria_eyre::eyre::{
self,
Expand Down Expand Up @@ -194,7 +194,7 @@ impl Geth {
if let Some(tx) = tx_res {
let tx_hash = tx.hash;
let data = tx.rlp().to_vec();
let seq_action = Sequence {
let seq_action = RollupDataSubmission {
rollup_id,
data: data.into(),
fee_asset: fee_asset.clone(),
Expand Down Expand Up @@ -234,7 +234,7 @@ impl Geth {
#[instrument(skip_all)]
async fn forward_geth_tx(
executor_handle: &Handle,
seq_action: Sequence,
seq_action: RollupDataSubmission,
tx_hash: ethers::types::H256,
txs_dropped_counter: &Counter,
) -> eyre::Result<()> {
Expand Down
6 changes: 3 additions & 3 deletions crates/astria-composer/src/collectors/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use astria_core::{
asset,
RollupId,
},
protocol::transaction::v1alpha1::action::Sequence,
protocol::transaction::v1alpha1::action::RollupDataSubmission,
};
use tokio::sync::mpsc::error::SendTimeoutError;
use tonic::{
Expand Down Expand Up @@ -65,7 +65,7 @@ impl GrpcCollectorService for Grpc {
)
.map_err(|err| Status::invalid_argument(format!("invalid rollup ID: {err}")))?;

let sequence_action = Sequence {
let rollup_data_submission = RollupDataSubmission {
rollup_id,
data: submit_rollup_tx_request.data,
fee_asset: self.fee_asset.clone(),
Expand All @@ -74,7 +74,7 @@ impl GrpcCollectorService for Grpc {
self.metrics.increment_grpc_txs_received(&rollup_id);
match self
.executor
.send_timeout(sequence_action, EXECUTOR_SEND_TIMEOUT)
.send_timeout(rollup_data_submission, EXECUTOR_SEND_TIMEOUT)
.await
{
Ok(()) => {}
Expand Down
4 changes: 2 additions & 2 deletions crates/astria-composer/src/executor/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use astria_core::{
crypto::SigningKey,
generated::sequencerblock::v1alpha1::sequencer_service_client::SequencerServiceClient,
primitive::v1::Address,
protocol::transaction::v1alpha1::action::Sequence,
protocol::transaction::v1alpha1::action::RollupDataSubmission,
};
use astria_eyre::eyre::{
self,
Expand Down Expand Up @@ -72,7 +72,7 @@ impl Builder {
.wrap_err("failed constructing a sequencer address from private key")?;

let (serialized_rollup_transaction_tx, serialized_rollup_transaction_rx) =
tokio::sync::mpsc::channel::<Sequence>(256);
tokio::sync::mpsc::channel::<RollupDataSubmission>(256);

Ok((
super::Executor {
Expand Down
23 changes: 13 additions & 10 deletions crates/astria-composer/src/executor/bundle_factory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::{
use astria_core::{
primitive::v1::RollupId,
protocol::transaction::v1alpha1::{
action::Sequence,
action::RollupDataSubmission,
Action,
TransactionBody,
},
Expand All @@ -29,9 +29,9 @@ mod tests;
#[derive(Debug, thiserror::Error)]
enum SizedBundleError {
#[error("bundle does not have enough space left for the given sequence action")]
NotEnoughSpace(Sequence),
NotEnoughSpace(RollupDataSubmission),
#[error("sequence action is larger than the max bundle size")]
SequenceActionTooLarge(Sequence),
SequenceActionTooLarge(RollupDataSubmission),
}

pub(super) struct SizedBundleReport<'a>(pub(super) &'a SizedBundle);
Expand Down Expand Up @@ -97,7 +97,7 @@ impl SizedBundle {
/// # Errors
/// - `seq_action` is beyond the max size allowed for the entire bundle
/// - `seq_action` does not fit in the remaining space in the bundle
fn try_push(&mut self, seq_action: Sequence) -> Result<(), SizedBundleError> {
fn try_push(&mut self, seq_action: RollupDataSubmission) -> Result<(), SizedBundleError> {
let seq_action_size = encoded_len(&seq_action);

if seq_action_size > self.max_size {
Expand All @@ -114,7 +114,7 @@ impl SizedBundle {
.entry(seq_action.rollup_id)
.and_modify(|count| *count = count.saturating_add(1))
.or_insert(1);
self.buffer.push(Action::Sequence(seq_action));
self.buffer.push(Action::RollupDataSubmission(seq_action));
self.curr_size = new_size;

Ok(())
Expand Down Expand Up @@ -159,7 +159,7 @@ pub(super) struct FinishedQueueFull {
curr_bundle_size: usize,
finished_queue_capacity: usize,
sequence_action_size: usize,
seq_action: Sequence,
seq_action: RollupDataSubmission,
}

impl From<FinishedQueueFull> for BundleFactoryError {
Expand Down Expand Up @@ -193,7 +193,10 @@ impl BundleFactory {
/// Buffer `seq_action` into the current bundle. If the bundle won't fit `seq_action`, flush
/// `curr_bundle` into the `finished` queue and start a new bundle, unless the `finished` queue
/// is at capacity.
pub(super) fn try_push(&mut self, seq_action: Sequence) -> Result<(), BundleFactoryError> {
pub(super) fn try_push(
&mut self,
seq_action: RollupDataSubmission,
) -> Result<(), BundleFactoryError> {
let seq_action = with_ibc_prefixed(seq_action);
let seq_action_size = encoded_len(&seq_action);

Expand Down Expand Up @@ -283,14 +286,14 @@ impl<'a> NextFinishedBundle<'a> {
}
}

fn with_ibc_prefixed(action: Sequence) -> Sequence {
Sequence {
fn with_ibc_prefixed(action: RollupDataSubmission) -> RollupDataSubmission {
RollupDataSubmission {
fee_asset: action.fee_asset.to_ibc_prefixed().into(),
..action
}
}

fn encoded_len(action: &Sequence) -> usize {
fn encoded_len(action: &RollupDataSubmission) -> usize {
use prost::Message as _;
action.to_raw().encoded_len()
}
20 changes: 10 additions & 10 deletions crates/astria-composer/src/executor/bundle_factory/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use astria_core::{
RollupId,
ROLLUP_ID_LEN,
},
protocol::transaction::v1alpha1::action::Sequence,
protocol::transaction::v1alpha1::action::RollupDataSubmission,
};

mod sized_bundle {
Expand Down Expand Up @@ -75,7 +75,7 @@ mod sized_bundle {
// assert that the flushed bundle has just the sequence action pushed earlier
let actions = flushed_bundle.buffer;
assert_eq!(actions.len(), 1);
let actual_seq_action = actions[0].as_sequence().unwrap();
let actual_seq_action = actions[0].as_rollup_data_submission().unwrap();
assert_eq!(actual_seq_action.rollup_id, seq_action.rollup_id);
assert_eq!(actual_seq_action.data, seq_action.data);
}
Expand Down Expand Up @@ -138,7 +138,7 @@ mod bundle_factory {
// assert `pop_finished()` will return `seq_action0`
let next_actions = bundle_factory.next_finished();
let actions = next_actions.unwrap().pop().buffer;
let actual_seq_action = actions[0].as_sequence().unwrap();
let actual_seq_action = actions[0].as_rollup_data_submission().unwrap();
assert_eq!(actual_seq_action.rollup_id, seq_action0.rollup_id);
assert_eq!(actual_seq_action.data, seq_action0.data);
}
Expand Down Expand Up @@ -203,7 +203,7 @@ mod bundle_factory {
// try to push a third bundle that wouldn't fit in `curr_bundle`, forcing the factory to
// flush it into `finished` this shouldn't work since the `finished` queue's
// capacity is 1.
let seq_action1 = Sequence {
let seq_action1 = RollupDataSubmission {
rollup_id: RollupId::new([1; ROLLUP_ID_LEN]),
..sequence_action_of_max_size(200)
};
Expand Down Expand Up @@ -241,7 +241,7 @@ mod bundle_factory {
assert_eq!(bundle_factory.finished.len(), 0);
// assert `pop_now()` returns `seq_action`
let actions = bundle_factory.pop_now().buffer;
let actual_seq_action = actions[0].as_sequence().unwrap();
let actual_seq_action = actions[0].as_rollup_data_submission().unwrap();
assert_eq!(actual_seq_action.rollup_id, seq_action.rollup_id);
assert_eq!(actual_seq_action.data, seq_action.data);
}
Expand All @@ -256,7 +256,7 @@ mod bundle_factory {

// push another sequence action that is <100 bytes total to force the current bundle to
// flush
let seq_action1 = Sequence {
let seq_action1 = RollupDataSubmission {
rollup_id: RollupId::new([1; ROLLUP_ID_LEN]),
..sequence_action_of_max_size(200)
};
Expand All @@ -266,7 +266,7 @@ mod bundle_factory {
assert_eq!(bundle_factory.finished.len(), 1);
// assert `pop_now()` will return `seq_action0`
let actions = bundle_factory.pop_now().buffer;
let actual_seq_action = actions[0].as_sequence().unwrap();
let actual_seq_action = actions[0].as_rollup_data_submission().unwrap();
assert_eq!(actual_seq_action.rollup_id, seq_action0.rollup_id);
assert_eq!(actual_seq_action.data, seq_action0.data);
}
Expand All @@ -290,7 +290,7 @@ mod bundle_factory {
let seq_action0 = sequence_action_of_max_size(200);
bundle_factory.try_push(seq_action0.clone()).unwrap();

let seq_action1 = Sequence {
let seq_action1 = RollupDataSubmission {
rollup_id: RollupId::new([1; ROLLUP_ID_LEN]),
..sequence_action_of_max_size(200)
};
Expand All @@ -302,7 +302,7 @@ mod bundle_factory {
// assert `pop_now()` will return `seq_action0` on the first call
let actions_finished = bundle_factory.pop_now().buffer;
assert_eq!(actions_finished.len(), 1);
let actual_seq_action = actions_finished[0].as_sequence().unwrap();
let actual_seq_action = actions_finished[0].as_rollup_data_submission().unwrap();
assert_eq!(actual_seq_action.rollup_id, seq_action0.rollup_id);
assert_eq!(actual_seq_action.data, seq_action0.data);

Expand All @@ -312,7 +312,7 @@ mod bundle_factory {
// assert `pop_now()` will return `seq_action1` on the second call (i.e. from curr)
let actions_curr = bundle_factory.pop_now().buffer;
assert_eq!(actions_curr.len(), 1);
let actual_seq_action = actions_curr[0].as_sequence().unwrap();
let actual_seq_action = actions_curr[0].as_rollup_data_submission().unwrap();
assert_eq!(actual_seq_action.rollup_id, seq_action1.rollup_id);
assert_eq!(actual_seq_action.data, seq_action1.data);

Expand Down
18 changes: 11 additions & 7 deletions crates/astria-composer/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use astria_core::{
protocol::{
abci::AbciErrorCode,
transaction::v1alpha1::{
action::Sequence,
action::RollupDataSubmission,
Transaction,
},
},
Expand Down Expand Up @@ -126,7 +126,7 @@ pub(super) struct Executor {
// The status of this executor
status: watch::Sender<Status>,
// Channel for receiving `SequenceAction`s to be bundled.
serialized_rollup_transactions: mpsc::Receiver<Sequence>,
serialized_rollup_transactions: mpsc::Receiver<RollupDataSubmission>,
// The client for submitting wrapped and signed pending eth transactions to the astria
// sequencer via the ABCI client.
abci_client: sequencer_client::HttpClient,
Expand All @@ -151,11 +151,11 @@ pub(super) struct Executor {

#[derive(Clone)]
pub(super) struct Handle {
serialized_rollup_transactions_tx: mpsc::Sender<Sequence>,
serialized_rollup_transactions_tx: mpsc::Sender<RollupDataSubmission>,
}

impl Handle {
fn new(serialized_rollup_transactions_tx: mpsc::Sender<Sequence>) -> Self {
fn new(serialized_rollup_transactions_tx: mpsc::Sender<RollupDataSubmission>) -> Self {
Self {
serialized_rollup_transactions_tx,
}
Expand All @@ -164,9 +164,9 @@ impl Handle {
#[instrument(skip_all, err)]
pub(super) async fn send_timeout(
&self,
sequence_action: Sequence,
sequence_action: RollupDataSubmission,
timeout: Duration,
) -> Result<(), SendTimeoutError<Sequence>> {
) -> Result<(), SendTimeoutError<RollupDataSubmission>> {
self.serialized_rollup_transactions_tx
.send_timeout(sequence_action, timeout)
.await
Expand Down Expand Up @@ -454,7 +454,11 @@ impl Executor {

/// Pushes sequence action into current bundle, warning and dropping on failure.
#[instrument(skip_all)]
fn bundle_seq_action(&self, seq_action: Sequence, bundle_factory: &mut BundleFactory) {
fn bundle_seq_action(
&self,
seq_action: RollupDataSubmission,
bundle_factory: &mut BundleFactory,
) {
let rollup_id = seq_action.rollup_id;

if let Err(e) = bundle_factory.try_push(seq_action) {
Expand Down
12 changes: 6 additions & 6 deletions crates/astria-composer/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ use astria_core::{
RollupId,
ROLLUP_ID_LEN,
},
protocol::transaction::v1alpha1::action::Sequence,
protocol::transaction::v1alpha1::action::RollupDataSubmission,
Protobuf as _,
};

fn encoded_len(action: &Sequence) -> usize {
fn encoded_len(action: &RollupDataSubmission) -> usize {
use prost::Message as _;
action.to_raw().encoded_len()
}

pub(crate) fn sequence_action_with_n_bytes(n: usize) -> Sequence {
Sequence {
pub(crate) fn sequence_action_with_n_bytes(n: usize) -> RollupDataSubmission {
RollupDataSubmission {
rollup_id: RollupId::new([0; ROLLUP_ID_LEN]),
data: vec![0; n].into(),
fee_asset: "nria"
Expand All @@ -25,11 +25,11 @@ pub(crate) fn sequence_action_with_n_bytes(n: usize) -> Sequence {
}
}

pub(crate) fn empty_sequence_action() -> Sequence {
pub(crate) fn empty_sequence_action() -> RollupDataSubmission {
sequence_action_with_n_bytes(0)
}

pub(crate) fn sequence_action_of_max_size(max: usize) -> Sequence {
pub(crate) fn sequence_action_of_max_size(max: usize) -> RollupDataSubmission {
// an action where the data part is exactly max bytes long
let big_action = sequence_action_with_n_bytes(max);
// the number of bytes past max
Expand Down
Loading

0 comments on commit 3ff1696

Please sign in to comment.