-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(sequencer): add snapshots for storage values to enforce non-sta…
…te-breaking changes (#1985) ## Summary Added snapshot tests for all storage values to ensure that future changes do not break state. ## Background The addition of the `BridgeTransfer` action revealed how inserting a value into the storage `ValueImpl` is a breaking change, since deserialization would then fail. New values, such as `BridgeTransferFees` need to be appended instead of inserted. Adding snapshots for each storage variant's discriminant ensures that there is an extra level of protection against making a state breaking change. ## Changes - Added snapshots for the borsch encoding of every `ValueImpl` variant and every `StoredValue` variant. ## Testing Manually reviewed every discriminant. ## Changelogs No updates required. ## Related Issues closes #1982 --------- Co-authored-by: Jordan Oroshiba <jordan@astria.org>
- Loading branch information
1 parent
46a5213
commit dd99bf9
Showing
60 changed files
with
723 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...ots/astria_sequencer__accounts__storage__values__tests__stored_value_account_variant.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/accounts/storage/values.rs | ||
expression: "borsh_then_hex(&StoredValue::Accounts(Value(ValueImpl::Nonce(Nonce(0)))))" | ||
--- | ||
030100000000 |
5 changes: 5 additions & 0 deletions
5
...age/snapshots/astria_sequencer__accounts__storage__values__tests__value_impl_balance.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/accounts/storage/values.rs | ||
expression: "borsh_then_hex(&ValueImpl::Balance(Balance(0)))" | ||
--- | ||
0000000000000000000000000000000000 |
5 changes: 5 additions & 0 deletions
5
...orage/snapshots/astria_sequencer__accounts__storage__values__tests__value_impl_nonce.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/accounts/storage/values.rs | ||
expression: "borsh_then_hex(&ValueImpl::Nonce(Nonce(0)))" | ||
--- | ||
0100000000 |
This file contains 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
5 changes: 5 additions & 0 deletions
5
...hots/astria_sequencer__address__storage__values__tests__stored_value_address_variant.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/address/storage/values.rs | ||
expression: "borsh_then_hex(&StoredValue::Address(Value(ValueImpl::AddressPrefix(\"test_prefix\".into()))))" | ||
--- | ||
01000b000000746573745f707265666978 |
5 changes: 5 additions & 0 deletions
5
...apshots/astria_sequencer__address__storage__values__tests__value_impl_address_prefix.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/address/storage/values.rs | ||
expression: "borsh_then_hex(&ValueImpl::AddressPrefix(\"test_prefix\".into()))" | ||
--- | ||
000b000000746573745f707265666978 |
This file contains 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 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
5 changes: 5 additions & 0 deletions
5
...es/snapshots/astria_sequencer__app__storage__values__tests__stored_value_app_variant.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/app/storage/values/mod.rs | ||
expression: "borsh_then_hex(&StoredValue::App(Value(ValueImpl::BlockHeight(1.into()))))" | ||
--- | ||
08020100000000000000 |
5 changes: 5 additions & 0 deletions
5
...ues/snapshots/astria_sequencer__app__storage__values__tests__value_impl_block_height.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/app/storage/values/mod.rs | ||
expression: "borsh_then_hex(&ValueImpl::BlockHeight(1.into()))" | ||
--- | ||
020100000000000000 |
5 changes: 5 additions & 0 deletions
5
.../snapshots/astria_sequencer__app__storage__values__tests__value_impl_block_timestamp.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/app/storage/values/mod.rs | ||
expression: "borsh_then_hex(&ValueImpl::BlockTimestamp(tendermint::Time::unix_epoch().into()))" | ||
--- | ||
0300000000000000000000000000000000 |
5 changes: 5 additions & 0 deletions
5
.../values/snapshots/astria_sequencer__app__storage__values__tests__value_impl_chain_id.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/app/storage/values/mod.rs | ||
expression: "borsh_then_hex(&ValueImpl::ChainId((&tendermint::chain::Id::try_from(\"test_prefix\".to_string()).unwrap()).into()))" | ||
--- | ||
000b000000746573745f707265666978 |
5 changes: 5 additions & 0 deletions
5
.../snapshots/astria_sequencer__app__storage__values__tests__value_impl_revision_number.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/app/storage/values/mod.rs | ||
expression: "borsh_then_hex(&ValueImpl::RevisionNumber(1.into()))" | ||
--- | ||
010100000000000000 |
5 changes: 5 additions & 0 deletions
5
.../snapshots/astria_sequencer__app__storage__values__tests__value_impl_storage_version.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/app/storage/values/mod.rs | ||
expression: "borsh_then_hex(&ValueImpl::StorageVersion(1.into()))" | ||
--- | ||
040100000000000000 |
5 changes: 5 additions & 0 deletions
5
...pshots/astria_sequencer__assets__storage__values__tests__stored_value_assets_variant.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/assets/storage/values.rs | ||
expression: "borsh_then_hex(&StoredValue::Assets(Value(ValueImpl::TracePrefixedDenom((&\"test_denom\".to_string().parse::<DomainTracePrefixed>().unwrap()).into()))))" | ||
--- | ||
0200000000000a000000746573745f64656e6f6d |
5 changes: 5 additions & 0 deletions
5
...ts/astria_sequencer__assets__storage__values__tests__value_impl_trace_prefixed_denom.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/assets/storage/values.rs | ||
expression: "borsh_then_hex(&ValueImpl::TracePrefixedDenom((&\"test_denom\".to_string().parse::<DomainTracePrefixed>().unwrap()).into()))" | ||
--- | ||
00000000000a000000746573745f64656e6f6d |
This file contains 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
5 changes: 5 additions & 0 deletions
5
.../astria_sequencer__authority__storage__values__tests__stored_value_authority_variant.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/authority/storage/values.rs | ||
expression: "borsh_then_hex(&StoredValue::Authority(Value(ValueImpl::ValidatorSet(ValidatorSet(vec![])))))" | ||
--- | ||
040100000000 |
5 changes: 5 additions & 0 deletions
5
...pshots/astria_sequencer__authority__storage__values__tests__value_impl_address_bytes.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/authority/storage/values.rs | ||
expression: "borsh_then_hex(&ValueImpl::AddressBytes((&[0; ADDRESS_LEN]).into()))" | ||
--- | ||
000000000000000000000000000000000000000000 |
5 changes: 5 additions & 0 deletions
5
...pshots/astria_sequencer__authority__storage__values__tests__value_impl_validator_set.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/authority/storage/values.rs | ||
expression: "borsh_then_hex(&ValueImpl::ValidatorSet(ValidatorSet(vec![])))" | ||
--- | ||
0100000000 |
This file contains 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 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
5 changes: 5 additions & 0 deletions
5
...pshots/astria_sequencer__bridge__storage__values__tests__stored_value_bridge_variant.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/bridge/storage/values/mod.rs | ||
expression: "borsh_then_hex(&StoredValue::Bridge(Value(ValueImpl::BlockHeight(1.into()))))" | ||
--- | ||
06030100000000000000 |
5 changes: 5 additions & 0 deletions
5
...snapshots/astria_sequencer__bridge__storage__values__tests__value_impl_address_bytes.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/bridge/storage/values/mod.rs | ||
expression: "borsh_then_hex(&ValueImpl::AddressBytes((&[0; ADDRESS_LENGTH]).into()))" | ||
--- | ||
020000000000000000000000000000000000000000 |
5 changes: 5 additions & 0 deletions
5
.../snapshots/astria_sequencer__bridge__storage__values__tests__value_impl_block_height.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/bridge/storage/values/mod.rs | ||
expression: "borsh_then_hex(&ValueImpl::BlockHeight(1.into()))" | ||
--- | ||
030100000000000000 |
5 changes: 5 additions & 0 deletions
5
...lues/snapshots/astria_sequencer__bridge__storage__values__tests__value_impl_deposits.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/bridge/storage/values/mod.rs | ||
expression: "borsh_then_hex(&ValueImpl::Deposits(Vec::<DomainDeposit>::new().iter().into()))" | ||
--- | ||
0400000000 |
5 changes: 5 additions & 0 deletions
5
...hots/astria_sequencer__bridge__storage__values__tests__value_impl_ibc_prefixed_denom.snap
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: crates/astria-sequencer/src/bridge/storage/values/mod.rs | ||
expression: "borsh_then_hex(&ValueImpl::IbcPrefixedDenom((&DomainIbcPrefixed::new([0;\n32])).into()))" | ||
--- | ||
010000000000000000000000000000000000000000000000000000000000000000 |
Oops, something went wrong.