-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sequencer)!: transaction categories on UnsignedTransaction #1512
Changes from 16 commits
3cd390a
ed325e8
5fbd0b7
de9b744
b275612
8162f9d
a6f91a9
d3f0cf9
3694ee6
940cade
888b478
50eda1e
e41f6c7
3e79a1c
613993f
aca96e9
1809748
052dbfd
503e2e0
6a8a937
38cd7a4
33c9d44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,6 +153,7 @@ impl Protobuf for Action { | |
} | ||
} | ||
|
||
// TODO: add unit tests for these methods (https://github.com/astriaorg/astria/issues/1593) | ||
impl Action { | ||
#[must_use] | ||
pub fn as_sequence(&self) -> Option<&SequenceAction> { | ||
|
@@ -169,6 +170,14 @@ impl Action { | |
}; | ||
Some(transfer_action) | ||
} | ||
|
||
pub fn is_fee_asset_change(&self) -> bool { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's make a tracking issue to add unit tests for these. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. created and commented in code: #1593 |
||
matches!(self, Self::FeeAssetChange(_)) | ||
} | ||
|
||
pub fn is_fee_change(&self) -> bool { | ||
matches!(self, Self::FeeChange(_)) | ||
} | ||
} | ||
|
||
impl From<SequenceAction> for Action { | ||
|
@@ -263,6 +272,33 @@ impl TryFrom<raw::Action> for Action { | |
} | ||
} | ||
|
||
// TODO: replace this trait with a Protobuf:FullName implementation. | ||
// Issue tracked in #1567 | ||
pub(super) trait ActionName { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this. All of these should be done via the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discussed offline: this should flow through There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tracked in a note in the code and here: #1567 |
||
fn name(&self) -> &'static str; | ||
} | ||
|
||
impl ActionName for Action { | ||
fn name(&self) -> &'static str { | ||
match self { | ||
Action::Sequence(_) => "Sequence", | ||
Action::Transfer(_) => "Transfer", | ||
Action::ValidatorUpdate(_) => "ValidatorUpdate", | ||
Action::SudoAddressChange(_) => "SudoAddressChange", | ||
Action::Ibc(_) => "Ibc", | ||
Action::IbcSudoChange(_) => "IbcSudoChange", | ||
Action::Ics20Withdrawal(_) => "Ics20Withdrawal", | ||
Action::IbcRelayerChange(_) => "IbcRelayerChange", | ||
Action::FeeAssetChange(_) => "FeeAssetChange", | ||
Action::InitBridgeAccount(_) => "InitBridgeAccount", | ||
Action::BridgeLock(_) => "BridgeLock", | ||
Action::BridgeUnlock(_) => "BridgeUnlock", | ||
Action::BridgeSudoChange(_) => "BridgeSudoChange", | ||
Action::FeeChange(_) => "FeeChange", | ||
} | ||
} | ||
} | ||
|
||
#[allow(clippy::module_name_repetitions)] | ||
#[derive(Debug, thiserror::Error)] | ||
#[error(transparent)] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heads-up: with #1561 being merged we switch everything to
expect
and require areason
: