Skip to content

Commit

Permalink
chore(proto, core)!: remove Action suffix from all action types
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperFluffy committed Oct 3, 2024
1 parent b54ccb9 commit 7287613
Show file tree
Hide file tree
Showing 44 changed files with 983 additions and 1,075 deletions.
2 changes: 1 addition & 1 deletion crates/astria-bridge-contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ where
let to = parse_destination_chain_as_address(&event)
.map_err(GetWithdrawalActionsError::destination_chain_as_address)?;

let action = astria_core::protocol::transaction::v1alpha1::action::BridgeUnlockAction {
let action = astria_core::protocol::transaction::v1alpha1::action::BridgeUnlock {
to,
amount,
rollup_block_number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use astria_core::{
memos::v1alpha1::Ics20WithdrawalFromRollup,
transaction::v1alpha1::{
action::{
BridgeUnlockAction,
BridgeUnlock,
Ics20Withdrawal,
},
Action,
Expand Down Expand Up @@ -435,7 +435,7 @@ pub fn make_native_bridge_unlock_action(receipt: &TransactionReceipt) -> Action
let rollup_transaction_hash = receipt.transaction_hash.encode_hex();
let event_index = receipt.logs[0].log_index.unwrap().encode_hex();

let inner = BridgeUnlockAction {
let inner = BridgeUnlock {
to: default_sequencer_address(),
amount: 1_000_000u128,
rollup_block_number: receipt.block_number.unwrap().as_u64(),
Expand Down Expand Up @@ -485,7 +485,7 @@ pub fn make_erc20_bridge_unlock_action(receipt: &TransactionReceipt) -> Action {
// use the second event because the erc20 transfer also emits an event
let event_index = receipt.logs[1].log_index.unwrap().encode_hex();

let inner = BridgeUnlockAction {
let inner = BridgeUnlock {
to: default_sequencer_address(),
amount: 1_000_000u128,
rollup_block_number: receipt.block_number.unwrap().as_u64(),
Expand Down
4 changes: 2 additions & 2 deletions crates/astria-cli/src/sequencer/bridge_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use astria_core::{
Address,
},
protocol::transaction::v1alpha1::{
action::BridgeLockAction,
action::BridgeLock,
Action,
},
};
Expand Down Expand Up @@ -62,7 +62,7 @@ impl Command {
self.sequencer_chain_id.clone(),
&self.prefix,
self.private_key.as_str(),
Action::BridgeLock(BridgeLockAction {
Action::BridgeLock(BridgeLock {
to: self.to_address,
asset: self.asset.clone(),
amount: self.amount,
Expand Down
4 changes: 2 additions & 2 deletions crates/astria-cli/src/sequencer/init_bridge_account.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use astria_core::{
primitive::v1::asset,
protocol::transaction::v1alpha1::{
action::InitBridgeAccountAction,
action::InitBridgeAccount,
Action,
},
};
Expand Down Expand Up @@ -57,7 +57,7 @@ impl Command {
self.sequencer_chain_id.clone(),
&self.prefix,
self.private_key.as_str(),
Action::InitBridgeAccount(InitBridgeAccountAction {
Action::InitBridgeAccount(InitBridgeAccount {
rollup_id,
asset: self.asset.clone(),
fee_asset: self.fee_asset.clone(),
Expand Down
6 changes: 3 additions & 3 deletions crates/astria-cli/src/sequencer/sudo/fee_asset.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use astria_core::{
primitive::v1::asset,
protocol::transaction::v1alpha1::{
action::FeeAssetChangeAction,
action::FeeAssetChange,
Action,
},
};
Expand Down Expand Up @@ -50,7 +50,7 @@ impl Add {
args.sequencer_chain_id.clone(),
&args.prefix,
args.private_key.as_str(),
Action::FeeAssetChange(FeeAssetChangeAction::Addition(args.asset.clone())),
Action::FeeAssetChange(FeeAssetChange::Addition(args.asset.clone())),
)
.await
.wrap_err("failed to submit FeeAssetChangeAction::Addition transaction")?;
Expand All @@ -75,7 +75,7 @@ impl Remove {
args.sequencer_chain_id.clone(),
&args.prefix,
args.private_key.as_str(),
Action::FeeAssetChange(FeeAssetChangeAction::Removal(args.asset.clone())),
Action::FeeAssetChange(FeeAssetChange::Removal(args.asset.clone())),
)
.await
.wrap_err("failed to submit FeeAssetChangeAction::Removal transaction")?;
Expand Down
6 changes: 3 additions & 3 deletions crates/astria-cli/src/sequencer/sudo/ibc_relayer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use astria_core::{
primitive::v1::Address,
protocol::transaction::v1alpha1::{
action::IbcRelayerChangeAction,
action::IbcRelayerChange,
Action,
},
};
Expand Down Expand Up @@ -47,7 +47,7 @@ impl Add {
args.sequencer_chain_id.clone(),
&args.prefix,
args.private_key.as_str(),
Action::IbcRelayerChange(IbcRelayerChangeAction::Addition(args.address)),
Action::IbcRelayerChange(IbcRelayerChange::Addition(args.address)),
)
.await
.wrap_err("failed to submit IbcRelayerChangeAction::Addition transaction")?;
Expand All @@ -72,7 +72,7 @@ impl Remove {
args.sequencer_chain_id.clone(),
&args.prefix,
args.private_key.as_str(),
Action::IbcRelayerChange(IbcRelayerChangeAction::Removal(args.address)),
Action::IbcRelayerChange(IbcRelayerChange::Removal(args.address)),
)
.await
.wrap_err("failed to submit IbcRelayerChangeAction::Removal transaction")?;
Expand Down
4 changes: 2 additions & 2 deletions crates/astria-cli/src/sequencer/sudo/sudo_address_change.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use astria_core::{
primitive::v1::Address,
protocol::transaction::v1alpha1::{
action::SudoAddressChangeAction,
action::SudoAddressChange,
Action,
},
};
Expand Down Expand Up @@ -49,7 +49,7 @@ impl Command {
self.sequencer_chain_id.clone(),
&self.prefix,
self.private_key.as_str(),
Action::SudoAddressChange(SudoAddressChangeAction {
Action::SudoAddressChange(SudoAddressChange {
new_address: self.address,
}),
)
Expand Down
4 changes: 2 additions & 2 deletions crates/astria-cli/src/sequencer/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use astria_core::{
Address,
},
protocol::transaction::v1alpha1::{
action::TransferAction,
action::Transfer,
Action,
},
};
Expand Down Expand Up @@ -61,7 +61,7 @@ impl Command {
self.sequencer_chain_id.clone(),
&self.prefix,
self.private_key.as_str(),
Action::Transfer(TransferAction {
Action::Transfer(Transfer {
to: self.to_address,
amount: self.amount,
asset: self.asset.clone(),
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::SequenceAction,
protocol::transaction::v1alpha1::action::Sequence,
};
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 = SequenceAction {
let seq_action = Sequence {
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: SequenceAction,
seq_action: Sequence,
tx_hash: ethers::types::H256,
txs_dropped_counter: &Counter,
) -> eyre::Result<()> {
Expand Down
4 changes: 2 additions & 2 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::SequenceAction,
protocol::transaction::v1alpha1::action::Sequence,
};
use tokio::sync::mpsc::error::SendTimeoutError;
use tonic::{
Expand Down Expand Up @@ -62,7 +62,7 @@ impl GrpcCollectorService for Grpc {
return Err(Status::invalid_argument("invalid rollup id"));
};

let sequence_action = SequenceAction {
let sequence_action = Sequence {
rollup_id,
data: submit_rollup_tx_request.data,
fee_asset: self.fee_asset.clone(),
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 @@ -7,7 +7,7 @@ use std::{
use astria_core::{
crypto::SigningKey,
primitive::v1::Address,
protocol::transaction::v1alpha1::action::SequenceAction,
protocol::transaction::v1alpha1::action::Sequence,
};
use astria_eyre::eyre::{
self,
Expand Down Expand Up @@ -63,7 +63,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::<SequenceAction>(256);
tokio::sync::mpsc::channel::<Sequence>(256);

Ok((
super::Executor {
Expand Down
21 changes: 9 additions & 12 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::SequenceAction,
action::Sequence,
Action,
UnsignedTransaction,
},
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(SequenceAction),
NotEnoughSpace(Sequence),
#[error("sequence action is larger than the max bundle size")]
SequenceActionTooLarge(SequenceAction),
SequenceActionTooLarge(Sequence),
}

pub(super) struct SizedBundleReport<'a>(pub(super) &'a SizedBundle);
Expand Down Expand Up @@ -100,7 +100,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: SequenceAction) -> Result<(), SizedBundleError> {
fn try_push(&mut self, seq_action: Sequence) -> Result<(), SizedBundleError> {
let seq_action_size = encoded_len(&seq_action);

if seq_action_size > self.max_size {
Expand Down Expand Up @@ -162,7 +162,7 @@ pub(super) struct FinishedQueueFull {
curr_bundle_size: usize,
finished_queue_capacity: usize,
sequence_action_size: usize,
seq_action: SequenceAction,
seq_action: Sequence,
}

impl From<FinishedQueueFull> for BundleFactoryError {
Expand Down Expand Up @@ -196,10 +196,7 @@ 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: SequenceAction,
) -> Result<(), BundleFactoryError> {
pub(super) fn try_push(&mut self, seq_action: Sequence) -> Result<(), BundleFactoryError> {
let seq_action = with_ibc_prefixed(seq_action);
let seq_action_size = encoded_len(&seq_action);

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

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

fn encoded_len(action: &SequenceAction) -> usize {
fn encoded_len(action: &Sequence) -> usize {
use prost::Message as _;
action.to_raw().encoded_len()
}
8 changes: 4 additions & 4 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::SequenceAction,
protocol::transaction::v1alpha1::action::Sequence,
};

mod sized_bundle {
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 = SequenceAction {
let seq_action1 = Sequence {
rollup_id: RollupId::new([1; ROLLUP_ID_LEN]),
..sequence_action_of_max_size(200)
};
Expand Down Expand Up @@ -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 = SequenceAction {
let seq_action1 = Sequence {
rollup_id: RollupId::new([1; ROLLUP_ID_LEN]),
..sequence_action_of_max_size(200)
};
Expand Down Expand Up @@ -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 = SequenceAction {
let seq_action1 = Sequence {
rollup_id: RollupId::new([1; ROLLUP_ID_LEN]),
..sequence_action_of_max_size(200)
};
Expand Down
14 changes: 7 additions & 7 deletions crates/astria-composer/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use astria_core::{
protocol::{
abci::AbciErrorCode,
transaction::v1alpha1::{
action::SequenceAction,
action::Sequence,
SignedTransaction,
},
},
Expand Down Expand Up @@ -120,7 +120,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<SequenceAction>,
serialized_rollup_transactions: mpsc::Receiver<Sequence>,
// The client for submitting wrapped and signed pending eth transactions to the astria
// sequencer.
sequencer_client: sequencer_client::HttpClient,
Expand All @@ -143,11 +143,11 @@ pub(super) struct Executor {

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

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

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

if let Err(e) = bundle_factory.try_push(seq_action) {
Expand Down
Loading

0 comments on commit 7287613

Please sign in to comment.