-
Notifications
You must be signed in to change notification settings - Fork 97
feat(sequencer)!: allow configuring base address prefix #1201
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
Merged
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
7c9e18a
WIP
SuperFluffy 884aa39
impl serde for all denom types, provide snapshot tests
SuperFluffy c91ecb7
sequencer: genesis serde in terms of core types
SuperFluffy 2184609
check that the genesis file contains only addresses with configured p…
SuperFluffy e428bab
update all tests that use a genesis, initialize the base prefix globally
SuperFluffy a9f427d
update address construction where necessary, stateless checks on all …
SuperFluffy f7f5aeb
remove unused code
SuperFluffy 03547f5
reject storage reads with incorrect addresses
SuperFluffy 1826b1c
use plain addresses as storage keys, not hex
SuperFluffy 3d3772b
remove chain id derived address construction
SuperFluffy 675df61
remove unused dep
SuperFluffy 33a5ce7
clippy
SuperFluffy 65f4fc6
clippy
SuperFluffy 46c1785
more clippy
SuperFluffy 73578fd
make address prefixes configurable on bridge withdrawer
SuperFluffy bf003e7
make address prefixes configurable on comnposer
SuperFluffy becce30
make astria-prefix const private
SuperFluffy 33fb78a
remove bridge withdrawer dependence on core const
SuperFluffy 2d0eed0
remove sequencer dependence on core const
SuperFluffy 36c6e82
remove sequencer0client dependence on core const
SuperFluffy 2642f51
make prefix configurable for all astria cli commands that construct a…
SuperFluffy 8c033cf
use address bytes without prefix to construct storage keys; provide s…
SuperFluffy 125f243
fix tests
SuperFluffy fe2e085
fix racy sequencer address prefix setter
SuperFluffy c8959a3
add subcommand to construct bech32m addresses from hex bytes and prefix
SuperFluffy aecdb85
WIP: update charts
SuperFluffy b26bd34
bump evm chart
SuperFluffy cf99150
add address prefixes to values.yaml
SuperFluffy b256e44
fix incorrectly named field in genesis
SuperFluffy 0f6ed18
fix evm-rollup charts
SuperFluffy 1b937f0
chore: minor updates to in flight pr chart (#1204)
joroshiba b1df3ce
typos
SuperFluffy da36830
use a better error message to state that address prefixes were unsupp…
SuperFluffy 0fe10b8
more descriptive names for genesis, key snapshots
SuperFluffy 6a169f7
bring back renamed snapshot tests
SuperFluffy 4751c5b
use astria as the default prefix for the bech32m cli tool
SuperFluffy 22a5f81
write address base prefix into state
SuperFluffy 34b83cc
use full address in sequencer-client extension trait
SuperFluffy 6313006
provide astria as the default prefix for all cli args
SuperFluffy c917e93
expand base prefix global getter/setter to mention sequencer restart
SuperFluffy 435c9ac
update after rebase
SuperFluffy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ use astria_core::{ | |
| Denom, | ||
| }, | ||
| Address, | ||
| ASTRIA_ADDRESS_PREFIX, | ||
| }, | ||
| protocol::transaction::v1alpha1::{ | ||
| action::{ | ||
|
|
@@ -60,6 +59,7 @@ pub(crate) fn event_to_action( | |
| rollup_asset_denom: Denom, | ||
| asset_withdrawal_divisor: u128, | ||
| bridge_address: Address, | ||
| sequencer_address_prefix: &str, | ||
| ) -> eyre::Result<Action> { | ||
| let action = match event_with_metadata.event { | ||
| WithdrawalEvent::Sequencer(event) => event_to_bridge_unlock( | ||
|
|
@@ -78,6 +78,7 @@ pub(crate) fn event_to_action( | |
| rollup_asset_denom, | ||
| asset_withdrawal_divisor, | ||
| bridge_address, | ||
| sequencer_address_prefix, | ||
| ) | ||
| .wrap_err("failed to convert ics20 withdrawal event to action")?, | ||
| }; | ||
|
|
@@ -102,8 +103,10 @@ fn event_to_bridge_unlock( | |
| transaction_hash, | ||
| }; | ||
| let action = BridgeUnlockAction { | ||
| to: Address::try_from_bech32m(&event.destination_chain_address) | ||
| .wrap_err("failed to parse destination chain address as bech32m")?, | ||
| to: event | ||
| .destination_chain_address | ||
| .parse() | ||
| .wrap_err("failed to parse destination chain address")?, | ||
| amount: event | ||
| .amount | ||
| .as_u128() | ||
|
|
@@ -119,6 +122,8 @@ fn event_to_bridge_unlock( | |
| Ok(Action::BridgeUnlock(action)) | ||
| } | ||
|
|
||
| // FIXME: Get this to work for now, but replace this with a builder. | ||
|
Contributor
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. i'm refactoring/removing this function in my next PR, so this is fine to leave |
||
| #[allow(clippy::too_many_arguments)] | ||
| fn event_to_ics20_withdrawal( | ||
| event: Ics20WithdrawalFilter, | ||
| block_number: U64, | ||
|
|
@@ -127,6 +132,7 @@ fn event_to_ics20_withdrawal( | |
| rollup_asset_denom: Denom, | ||
| asset_withdrawal_divisor: u128, | ||
| bridge_address: Address, | ||
| sequencer_address_prefix: &str, | ||
| ) -> eyre::Result<Action> { | ||
| // TODO: make this configurable | ||
| const ICS20_WITHDRAWAL_TIMEOUT: Duration = Duration::from_secs(300); | ||
|
|
@@ -155,7 +161,7 @@ fn event_to_ics20_withdrawal( | |
| // bytes, but this won't work otherwise. | ||
| return_address: Address::builder() | ||
| .array(sender) | ||
| .prefix(ASTRIA_ADDRESS_PREFIX) | ||
| .prefix(sequencer_address_prefix) | ||
| .try_build() | ||
| .wrap_err("failed to construct return address")?, | ||
| amount: event | ||
|
|
@@ -204,12 +210,7 @@ mod tests { | |
| event: WithdrawalEvent::Sequencer(SequencerWithdrawalFilter { | ||
| sender: [0u8; 20].into(), | ||
| amount: 99.into(), | ||
| destination_chain_address: Address::builder() | ||
| .array([1u8; 20]) | ||
| .prefix(ASTRIA_ADDRESS_PREFIX) | ||
| .try_build() | ||
| .unwrap() | ||
| .to_string(), | ||
| destination_chain_address: crate::astria_address([1u8; 20]).to_string(), | ||
| }), | ||
| block_number: 1.into(), | ||
| transaction_hash: [2u8; 32].into(), | ||
|
|
@@ -220,6 +221,7 @@ mod tests { | |
| denom.clone(), | ||
| 1, | ||
| crate::astria_address([99u8; 20]), | ||
| crate::ASTRIA_ADDRESS_PREFIX, | ||
| ) | ||
| .unwrap(); | ||
| let Action::BridgeUnlock(action) = action else { | ||
|
|
@@ -248,12 +250,7 @@ mod tests { | |
| event: WithdrawalEvent::Sequencer(SequencerWithdrawalFilter { | ||
| sender: [0u8; 20].into(), | ||
| amount: 990.into(), | ||
| destination_chain_address: Address::builder() | ||
| .array([1u8; 20]) | ||
| .prefix(ASTRIA_ADDRESS_PREFIX) | ||
| .try_build() | ||
| .unwrap() | ||
| .to_string(), | ||
| destination_chain_address: crate::astria_address([1u8; 20]).to_string(), | ||
| }), | ||
| block_number: 1.into(), | ||
| transaction_hash: [2u8; 32].into(), | ||
|
|
@@ -265,6 +262,7 @@ mod tests { | |
| denom.clone(), | ||
| divisor, | ||
| crate::astria_address([99u8; 20]), | ||
| crate::ASTRIA_ADDRESS_PREFIX, | ||
| ) | ||
| .unwrap(); | ||
| let Action::BridgeUnlock(action) = action else { | ||
|
|
@@ -289,7 +287,7 @@ mod tests { | |
| #[test] | ||
| fn event_to_ics20_withdrawal() { | ||
| let denom = "transfer/channel-0/utia".parse::<Denom>().unwrap(); | ||
| let destination_chain_address = "address".to_string(); | ||
| let destination_chain_address = crate::astria_address([1u8; 20]).to_string(); | ||
| let event_with_meta = EventWithMetadata { | ||
| event: WithdrawalEvent::Ics20(Ics20WithdrawalFilter { | ||
| sender: [0u8; 20].into(), | ||
|
|
@@ -308,6 +306,7 @@ mod tests { | |
| denom.clone(), | ||
| 1, | ||
| bridge_address, | ||
| crate::ASTRIA_ADDRESS_PREFIX, | ||
| ) | ||
| .unwrap(); | ||
| let Action::Ics20Withdrawal(mut action) = action else { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
just to confirm - does the genesis support both hex and bech32 now?
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.
So the chart is indifferent, when you run in dev mode it builds the old genesis that is intended to work with the latest release. When you run in
devmode it builds the new genesis which works on this PR and latest after this is merged.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.
Yeah to chime in: this is only for CI. The sequencer genesis itself only supports proper bech32m addresses.