-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[Indexer] Add json serialized SuiSystemStateSummary to epochs table #19428
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
0f8db7c
to
336e937
Compare
336e937
to
84dcced
Compare
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.
I'm not fully following why we need to rename the column we currently use, instead of adding a new column it seems like this way we're more likely to break things.
crates/sui-indexer/migrations/pg/2024-09-18-003318_epochs_add_bcs_system_state/up.sql
Show resolved
Hide resolved
Why don't we instead store the serialized JSON form instead of a BCS form? JSON is a much more evolvable format that bcs and the SystemState type is not a core data structure that has a "canonical" bcs form. |
@@ -153,18 +158,15 @@ impl TryFrom<StoredEpochInfo> for EpochInfo { | |||
fn try_from(value: StoredEpochInfo) -> Result<Self, Self::Error> { | |||
let epoch = value.epoch as u64; | |||
let end_of_epoch_info = (&value).into(); | |||
let system_state: Option<SuiSystemStateSummary> = bcs::from_bytes(&value.system_state) | |||
let system_state: SuiSystemStateSummary = bcs::from_bytes(&value.system_state_deprecated) |
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.
👍 this should not have been Option indeed.
crates/sui-indexer/migrations/pg/2024-09-18-003318_epochs_add_bcs_system_state/up.sql
Outdated
Show resolved
Hide resolved
We certainly could. SuiSystemState type uses enum at the top so it should be "canonical"? |
Its just this will always be transmitted in json form, so we should just store and use the json form |
84dcced
to
cdc8ecb
Compare
All feedback addressed. Updated the PR description. |
cdc8ecb
to
92960c1
Compare
92960c1
to
8df2509
Compare
Description
The existing system_state column is a BCS serialization of a JSON-RPC type, which is not evolvable.
This PR adds a new column that is the JSON serialization of SuiSystemStateSummary without BCS.
It also fixes two bugs along the way:
Test plan
Added a debug assert to see that this column is populated with the correct epoch.
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.