Skip to content
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

Updates frozen abi test for bank snapshot serialization #1544

Merged
merged 1 commit into from
May 30, 2024

Conversation

brooksprumo
Copy link

Problem

The frozen abi test that we have for the bank serialization is not accurate/up to date with what we actually are serializing!

Summary of Changes

Update the test to use the same serializing function that real snapshotting uses.

Updated frozen abi digest details

The frozen abi digest for the test changed. This is expected, as we weren't testing the same thing as what is actually used by a real validator.

Here's the diff of the changes.

  1. The name of the wrapper type changed. We no longer have the concept of "newer" and "older", so I removed that here.
  2. The old test-only serialization used a raw Hash for the epoch accounts hash, but real validators use EpochAccountsHash. So now the test correctly reflects that.
❯ diff -u bank__serde_snapshot__tests__test_bank_serialize__BankAbiTestWrapperNewer_frozen_abi__test_abi_digest_7K1xfUkoCwhxssszgoSpbeMCcX3KEyjycGyLXrpFaJNe bank__serde_snapshot__tests__test_bank_serialize__BankAbiTestWrapper_frozen_abi__test_abi_digest_6riNuebfnAUpS2e3GYb5G8udH5PoEtep48ULchLjRDCB
--- bank__serde_snapshot__tests__test_bank_serialize__BankAbiTestWrapperNewer_frozen_abi__test_abi_digest_7K1xfUkoCwhxssszgoSpbeMCcX3KEyjycGyLXrpFaJNe	2024-05-30 11:28:12
+++ bank__serde_snapshot__tests__test_bank_serialize__BankAbiTestWrapper_frozen_abi__test_abi_digest_6riNuebfnAUpS2e3GYb5G8udH5PoEtep48ULchLjRDCB	2024-05-30 11:56:46
@@ -1,4 +1,4 @@
-struct BankAbiTestWrapperNewer (fields = 1)
+struct BankAbiTestWrapper (fields = 1)
     field bank: __SerializeWith
         tuple (elements = 5)
             element solana_runtime::serde_snapshot::SerializableVersionedBank
@@ -2009,73 +2009,74 @@
                                                 primitive u8
                             field incremental_capitalization: u64
                                 primitive u64
-            element core::option::Option<solana_program::hash::Hash>
+            element core::option::Option<solana_accounts_db::epoch_accounts_hash::EpochAccountsHash>
                 enum Option (variants = 2)
                     variant(0) None (unit)
-                    variant(1) Some(solana_program::hash::Hash) (newtype)
-                        struct Hash([u8; 32]) (newtype)
-                            tuple (elements = 32)
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
+                    variant(1) Some(solana_accounts_db::epoch_accounts_hash::EpochAccountsHash) (newtype)
+                        struct EpochAccountsHash(solana_program::hash::Hash) (newtype)
+                            struct Hash([u8; 32]) (newtype)
+                                tuple (elements = 32)
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8

```diff
❯ diff -u bank__serde_snapshot__tests__test_bank_serialize__BankAbiTestWrapperNewer_frozen_abi__test_abi_digest_7K1xfUkoCwhxssszgoSpbeMCcX3KEyjycGyLXrpFaJNe bank__serde_snapshot__tests__test_bank_serialize__BankAbiTestWrapper_frozen_abi__test_abi_digest_6riNuebfnAUpS2e3GYb5G8udH5PoEtep48ULchLjRDCB
--- bank__serde_snapshot__tests__test_bank_serialize__BankAbiTestWrapperNewer_frozen_abi__test_abi_digest_7K1xfUkoCwhxssszgoSpbeMCcX3KEyjycGyLXrpFaJNe	2024-05-30 11:28:12
+++ bank__serde_snapshot__tests__test_bank_serialize__BankAbiTestWrapper_frozen_abi__test_abi_digest_6riNuebfnAUpS2e3GYb5G8udH5PoEtep48ULchLjRDCB	2024-05-30 11:56:46
@@ -1,4 +1,4 @@
-struct BankAbiTestWrapperNewer (fields = 1)
+struct BankAbiTestWrapper (fields = 1)
     field bank: __SerializeWith
         tuple (elements = 5)
             element solana_runtime::serde_snapshot::SerializableVersionedBank
@@ -2009,73 +2009,74 @@
                                                 primitive u8
                             field incremental_capitalization: u64
                                 primitive u64
-            element core::option::Option<solana_program::hash::Hash>
+            element core::option::Option<solana_accounts_db::epoch_accounts_hash::EpochAccountsHash>
                 enum Option (variants = 2)
                     variant(0) None (unit)
-                    variant(1) Some(solana_program::hash::Hash) (newtype)
-                        struct Hash([u8; 32]) (newtype)
-                            tuple (elements = 32)
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
-                                element u8
-                                    primitive u8
+                    variant(1) Some(solana_accounts_db::epoch_accounts_hash::EpochAccountsHash) (newtype)
+                        struct EpochAccountsHash(solana_program::hash::Hash) (newtype)
+                            struct Hash([u8; 32]) (newtype)
+                                tuple (elements = 32)
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
+                                    element u8
+                                        primitive u8
```
@brooksprumo brooksprumo self-assigned this May 30, 2024
@brooksprumo brooksprumo marked this pull request as ready for review May 30, 2024 18:27
Copy link

@jeffwashington jeffwashington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@brooksprumo brooksprumo merged commit 97d36e6 into anza-xyz:master May 30, 2024
42 checks passed
@brooksprumo brooksprumo deleted the reserde/frozen-abi branch May 30, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants