refactor(core, proto)!: define app genesis state in proto#1346
refactor(core, proto)!: define app genesis state in proto#1346SuperFluffy merged 1 commit intomainfrom
Conversation
e4fea3b to
44c0045
Compare
| import "astria/primitive/v1/types.proto"; | ||
|
|
||
| message GenesisAppState { | ||
| string chain_id = 1; |
There was a problem hiding this comment.
This field is in preparation of a follow up refactoring sequencer to run init-chain with only the data provided by GenesisAppState.
There was a problem hiding this comment.
With this change we wouldn't additionally add a new chainId field into the genesis app_state would we?
There was a problem hiding this comment.
Yeah, we'd ultimately end up doing that. I had a dislike for extra configuration data being passed in "from the outside". I would like all genesis settings relevant to the app/sequencer to be in one place.
We would then either enforce that the cometbft chain ID match the sequencer chain ID - or ignore cometbft.
There was a problem hiding this comment.
The chain id is already part of the InitChain abci call, so this would be breaking expected abci conventions: https://github.com/cometbft/cometbft/blob/main/spec/abci/abci++_methods.md#initchain
This is inherently already a part of the call, I wouldn't want to override this core part of genesis definition and break the expected ABCI flow
There was a problem hiding this comment.
Agree, in my mind these fields would just be duplicates: sequencer would check if its genesis contains the same chain ID that cometbft reports.
Fraser999
left a comment
There was a problem hiding this comment.
One tiny nitpick, otherwise LGTM.
| #[cfg_attr( | ||
| feature = "serde", | ||
| derive(serde::Deserialize, serde::Serialize), | ||
| serde(try_from = "raw::GenesisAppState", into = "raw::GenesisAppState") |
There was a problem hiding this comment.
I remain not a fan of this approach, but I guess if we do decide to avoid this in the future we can always deal with this instance along with the others :)
| { | ||
| "address": {{ include "sequencer.address" $value.address }}, | ||
| "balance": {{ toString $value.balance | replace "\"" "" }} | ||
| "balance": {{ include "sequencer.fee" ( toString $value.balance | replace "\"" "" ) }} |
There was a problem hiding this comment.
This change disallows some hight initial balances that were previously possible. Limited to uint64 balances effectively.
There was a problem hiding this comment.
Yes indeed. For our current use cases this is fine. A followup should fix this. I wonder if there is a way to call out to a helper script using helm?
There was a problem hiding this comment.
We could have an init script which does the generation.
| import "astria/primitive/v1/types.proto"; | ||
|
|
||
| message GenesisAppState { | ||
| string chain_id = 1; |
There was a problem hiding this comment.
With this change we wouldn't additionally add a new chainId field into the genesis app_state would we?
024bb29 to
116590f
Compare
116590f to
a74509e
Compare
joroshiba
left a comment
There was a problem hiding this comment.
Approving, with assumption as discussed offline that the test fixes for astria-cli are moved into seperate PR before merge.
60a5022 to
c7e574b
Compare
Created a followup in #1392 |
* main: refactor(core, proto)!: define app genesis state in proto (#1346) fix(sequencer): bump penumbra dep to fix ibc state access bug (#1389) feat(conductor)!: support disabled celestia auth (#1372) fix(sequencer)!: fix block fees (#1343) perf(sequencer): add benchmark for prepare_proposal (ENG-660) (#1337) fix(proto): fix import name mismatch (#1380) fix(ci): enable bridge withdrawer building with tag (#1374) feat(sequencer): rewrite memool to have per-account transaction storage and maintenance (#1323) refactor(core, sequencer)!: require that bridge unlock address always be set (#1339) fix(sequencer)!: take funds from bridge in ics20 withdrawals (#1344) fix(sequencer)!: fix TOCTOU issues by merging check and execution (#1332) fix: abci error code (#1280) refactor(core): shorten `try_from_block_info_and_data()` (#1371) fix(relayer): change `reqwest` for `isahc` in relayer blackbox tests (ENG-699) (#1366) fix(conductor): update for celestia-node v0.15.0 (#1367) Chore: Upgrade celestia-node to v0.14.1 (#1360) chore(charts): fix charts production templates (#1359) chore(core, proto): migrate byte slices from Vec to Bytes (#1319)
Summary
Defines
astria.protocol.genesis.v1alpha1.GenesisAppState, replacing the Rust-as-JSON definition.Background
All protocol relevant Astria types are supposed to be defined in Astria's protobuf spec. With #1285 having redefined the memos as protobuf message, this patch migrates the last type to protobuf spec.
Changes
astria.protocol.genesis.v1alpha1.GenesisAppStateand related protobuf messagesastria-core::sequencer::GenesisStatemoduleTesting
All tests have been updated to use the new types, including snapshot tests. The genesis state is only read at
init-chainand does not affect the evaluation of the state machine. Hence no tests should change as long as the same data is passed in (which is reflected bytests-breaking-changesleading to the same hash).Breaking Changelist
This is a breaking change because an old sequencer would not understand a new (json-formatted) genesis app state and vise versa.
Related issues
Closes #1347