Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7c9e18a
WIP
SuperFluffy Jun 19, 2024
884aa39
impl serde for all denom types, provide snapshot tests
SuperFluffy Jun 19, 2024
c91ecb7
sequencer: genesis serde in terms of core types
SuperFluffy Jun 19, 2024
2184609
check that the genesis file contains only addresses with configured p…
SuperFluffy Jun 20, 2024
e428bab
update all tests that use a genesis, initialize the base prefix globally
SuperFluffy Jun 20, 2024
a9f427d
update address construction where necessary, stateless checks on all …
SuperFluffy Jun 20, 2024
f7f5aeb
remove unused code
SuperFluffy Jun 20, 2024
03547f5
reject storage reads with incorrect addresses
SuperFluffy Jun 20, 2024
1826b1c
use plain addresses as storage keys, not hex
SuperFluffy Jun 20, 2024
3d3772b
remove chain id derived address construction
SuperFluffy Jun 20, 2024
675df61
remove unused dep
SuperFluffy Jun 20, 2024
33a5ce7
clippy
SuperFluffy Jun 20, 2024
65f4fc6
clippy
SuperFluffy Jun 20, 2024
46c1785
more clippy
SuperFluffy Jun 20, 2024
73578fd
make address prefixes configurable on bridge withdrawer
SuperFluffy Jun 21, 2024
bf003e7
make address prefixes configurable on comnposer
SuperFluffy Jun 21, 2024
becce30
make astria-prefix const private
SuperFluffy Jun 21, 2024
33fb78a
remove bridge withdrawer dependence on core const
SuperFluffy Jun 21, 2024
2d0eed0
remove sequencer dependence on core const
SuperFluffy Jun 21, 2024
36c6e82
remove sequencer0client dependence on core const
SuperFluffy Jun 21, 2024
2642f51
make prefix configurable for all astria cli commands that construct a…
SuperFluffy Jun 21, 2024
8c033cf
use address bytes without prefix to construct storage keys; provide s…
SuperFluffy Jun 21, 2024
125f243
fix tests
SuperFluffy Jun 21, 2024
fe2e085
fix racy sequencer address prefix setter
SuperFluffy Jun 21, 2024
c8959a3
add subcommand to construct bech32m addresses from hex bytes and prefix
SuperFluffy Jun 21, 2024
aecdb85
WIP: update charts
SuperFluffy Jun 21, 2024
b26bd34
bump evm chart
SuperFluffy Jun 24, 2024
cf99150
add address prefixes to values.yaml
SuperFluffy Jun 24, 2024
b256e44
fix incorrectly named field in genesis
SuperFluffy Jun 24, 2024
0f6ed18
fix evm-rollup charts
SuperFluffy Jun 24, 2024
1b937f0
chore: minor updates to in flight pr chart (#1204)
joroshiba Jun 24, 2024
b1df3ce
typos
SuperFluffy Jun 24, 2024
da36830
use a better error message to state that address prefixes were unsupp…
SuperFluffy Jun 24, 2024
0fe10b8
more descriptive names for genesis, key snapshots
SuperFluffy Jun 24, 2024
6a169f7
bring back renamed snapshot tests
SuperFluffy Jun 24, 2024
4751c5b
use astria as the default prefix for the bech32m cli tool
SuperFluffy Jun 24, 2024
22a5f81
write address base prefix into state
SuperFluffy Jun 24, 2024
34b83cc
use full address in sequencer-client extension trait
SuperFluffy Jun 24, 2024
6313006
provide astria as the default prefix for all cli args
SuperFluffy Jun 24, 2024
c917e93
expand base prefix global getter/setter to mention sequencer restart
SuperFluffy Jun 24, 2024
435c9ac
update after rebase
SuperFluffy Jun 26, 2024
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion charts/evm-rollup/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.19.2
version: 0.20.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
Expand Down
1 change: 1 addition & 0 deletions charts/evm-rollup/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ data:
OTEL_SERVICE_NAME: "{{ tpl .Values.config.rollup.otel.serviceNamePrefix . }}-composer"
{{- if not .Values.global.dev }}
{{- else }}
ASTRIA_COMPOSER_SEQUENCER_ADDRESS_PREFIX: "{{ .Values.config.sequencer.addressPrefixes.base }}"
{{- end }}
---
{{- if .Values.config.faucet.enabled }}
Expand Down
2 changes: 2 additions & 0 deletions charts/evm-rollup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ config:

# Configuration related to sequencer connection for rollup
sequencer:
addressPrefixes:
base: "astria"
chainId: ""
# Block height to start syncing rollup from
initialBlockHeight: "2"
Expand Down
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.15.8
version: 0.16.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
Expand Down
56 changes: 38 additions & 18 deletions charts/sequencer/files/cometbft/config/genesis.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
{
"app_hash": "",
"app_state": {
"accounts": [
{{- range $index, $value := .Values.config.sequencer.genesisAccounts }}
{{- if $index }},{{- end }}
{
"address": "{{ $value.address }}",
"balance": {{ toString $value.balance | replace "\"" "" }}
}
{{- end }}
],
"authority_sudo_address": "{{ .Values.config.sequencer.authoritySudoAddress }}",
"native_asset_base_denomination": "{{ .Values.config.sequencer.nativeAssetBaseDenomination }}",
"fees": {
"transfer_base_fee": 12,
Expand All @@ -27,20 +17,50 @@
"{{ $value }}"
{{- end }}
],
"ibc_sudo_address": "{{ .Values.config.sequencer.ibc.sudoAddress }}",
"ibc_relayer_addresses": [
{{- range $index, $value := .Values.config.sequencer.ibc.relayerAddresses }}
{{- if $index }},{{- end }}
"{{ $value }}"
{{- end }}
],
"ibc_params": {
"ibc_enabled": {{ .Values.config.sequencer.ibc.enabled }},
"inbound_ics20_transfers_enabled": {{ .Values.config.sequencer.ibc.inboundEnabled }},
"outbound_ics20_transfers_enabled": {{ .Values.config.sequencer.ibc.outboundEnabled }}
}
},
{{- if not .Values.global.dev }}
"accounts": [
{{- range $index, $value := .Values.config.sequencer.genesisAccounts }}
{{- if $index }},{{- end }}
{
"address": "{{ $value.address }}",
"balance": {{ toString $value.balance | replace "\"" "" }}
}
{{- end }}
],
"authority_sudo_address": "{{ .Values.config.sequencer.authoritySudoAddress }}",
"ibc_sudo_address": "{{ .Values.config.sequencer.ibc.sudoAddress }}",
"ibc_relayer_addresses": [
{{- range $index, $value := .Values.config.sequencer.ibc.relayerAddresses }}
{{- if $index }},{{- end }}
"{{ $value }}"
{{- end }}
]
{{- else }}
"address_prefixes": {
"base": "{{ .Values.config.sequencer.addressPrefixes.base }}"
},
"accounts": [
{{- range $index, $value := .Values.config.sequencer.genesisAccounts }}
{{- if $index }},{{- end }}
{
"address": {{ include "sequencer.address" $value.address }},
"balance": {{ toString $value.balance | replace "\"" "" }}
}
{{- end }}
],
"authority_sudo_address": {{ include "sequencer.address" .Values.config.sequencer.authoritySudoAddress }},
"ibc_sudo_address": {{ include "sequencer.address" .Values.config.sequencer.ibc.sudoAddress }},
"ibc_relayer_addresses": [
{{- range $index, $value := .Values.config.sequencer.ibc.relayerAddresses }}
{{- if $index }},{{- end }}
{{ include "sequencer.address" $value }}
{{- end }}
]
{{- end}}
},
"chain_id": "{{ .Values.config.cometBFT.chainId }}",
Expand Down
4 changes: 4 additions & 0 deletions charts/sequencer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ Selector labels
app: {{ include "sequencer.name" . }}
name: {{ .Values.config.moniker }}-sequencer-metrics
{{- end }}

{{/* New sequencer address */}}
{{- define "sequencer.address"}}{ "bech32m": "{{ . }}" }
{{- end }}
20 changes: 11 additions & 9 deletions charts/sequencer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ images:
config:
moniker: "node"
sequencer:
addressPrefixes:
base: "astria"
authoritySudoAddress: 1c0c490f1b5528d8173c5de46d131160e4b2c0c3
nativeAssetBaseDenomination: nria
allowedFeeAssets:
Expand All @@ -37,15 +39,15 @@ config:
- 34fec43c7fcab9aef3b3cf8aba855e41ee69ca3a
# Note large balances must be strings support templating with the u128 size account balances
genesisAccounts:
- address: 1c0c490f1b5528d8173c5de46d131160e4b2c0c3
balance: "333333333333333333"
- address: 34fec43c7fcab9aef3b3cf8aba855e41ee69ca3a
balance: "333333333333333333"
- address: 60709e2d391864b732b4f0f51e387abb76743871
balance: "333333333333333333"
# NOTE - the following address matches the privKey that funds the sequencer-faucet
- address: 00d75b270542084a54fcf0d0f6eab0402982d156
balance: "333333333333333333"
- address: 1c0c490f1b5528d8173c5de46d131160e4b2c0c3
Copy link
Contributor

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?

Copy link
Member

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 dev mode it builds the new genesis which works on this PR and latest after this is merged.

Copy link
Contributor Author

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.

balance: "333333333333333333"
- address: 34fec43c7fcab9aef3b3cf8aba855e41ee69ca3a
balance: "333333333333333333"
- address: 60709e2d391864b732b4f0f51e387abb76743871
balance: "333333333333333333"
# NOTE - the following address matches the privKey that funds the sequencer-faucet
- address: 00d75b270542084a54fcf0d0f6eab0402982d156
balance: "333333333333333333"

metrics:
enabled: false
Expand Down
3 changes: 3 additions & 0 deletions crates/astria-bridge-withdrawer/local.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ ASTRIA_BRIDGE_WITHDRAWER_SEQUENCER_CHAIN_ID="astria"
# transactions. The file should contain a hex-encoded Ed25519 secret key.
ASTRIA_BRIDGE_WITHDRAWER_SEQUENCER_KEY_PATH=/path/to/priv_sequencer_key.json

# The prefix that will be used to construct bech32m sequencer addresses.
ASTRIA_BRIDGE_WITHDRAWER_SEQUENCER_ADDRESS_PREFIX=astria

# The fee asset denomination to use for the bridge account's transactions.
ASTRIA_BRIDGE_WITHDRAWER_FEE_ASSET_DENOMINATION="nria"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use astria_core::{
Denom,
},
Address,
ASTRIA_ADDRESS_PREFIX,
},
protocol::transaction::v1alpha1::{
action::{
Expand Down Expand Up @@ -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(
Expand All @@ -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")?,
};
Expand All @@ -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()
Expand All @@ -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.
Copy link
Contributor

@noot noot Jun 24, 2024

Choose a reason for hiding this comment

The 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,
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(),
Expand All @@ -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 {
Expand Down Expand Up @@ -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(),
Expand All @@ -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 {
Expand All @@ -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(),
Expand All @@ -308,6 +306,7 @@ mod tests {
denom.clone(),
1,
bridge_address,
crate::ASTRIA_ADDRESS_PREFIX,
)
.unwrap();
let Action::Ics20Withdrawal(mut action) = action else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::{
time::Duration,
};

use astria_core::primitive::v1::ASTRIA_ADDRESS_PREFIX;
use ethers::{
abi::Tokenizable,
core::utils::Anvil,
Expand Down Expand Up @@ -33,11 +32,7 @@ impl Default for ConfigureAstriaWithdrawerDeployer {
fn default() -> Self {
Self {
base_chain_asset_precision: 18,
base_chain_bridge_address: astria_core::primitive::v1::Address::builder()
.array([0u8; 20])
.prefix(ASTRIA_ADDRESS_PREFIX)
.try_build()
.unwrap(),
base_chain_bridge_address: crate::astria_address([0u8; 20]),
base_chain_asset_denomination: "test-denom".to_string(),
}
}
Expand Down Expand Up @@ -122,11 +117,7 @@ impl Default for ConfigureAstriaBridgeableERC20Deployer {
Self {
bridge_address: Address::zero(),
base_chain_asset_precision: 18,
base_chain_bridge_address: astria_core::primitive::v1::Address::builder()
.array([0u8; 20])
.prefix(ASTRIA_ADDRESS_PREFIX)
.try_build()
.unwrap(),
base_chain_bridge_address: crate::astria_address([0u8; 20]),
base_chain_asset_denomination: "testdenom".to_string(),
name: "test-token".to_string(),
symbol: "TT".to_string(),
Expand Down
Loading