Skip to content

Commit

Permalink
Merge pull request #3599 from anoma/tomas/fix-prefix-iter-test
Browse files Browse the repository at this point in the history
test/state/prefix_iter: avoid generating empty `kvs` list
  • Loading branch information
mergify[bot] committed Aug 12, 2024
2 parents c1f015c + 2bec2c3 commit 6b827ec
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions crates/state/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ mod tests {
use merkle_tree::NO_DIFF_KEY_PREFIX;
use namada_core::address::InternalAddress;
use namada_core::borsh::{BorshDeserialize, BorshSerializeExt};
use namada_core::keccak::KeccakHash;
use namada_core::parameters::{EpochDuration, Parameters};
use namada_core::storage::DbKeySeg;
use namada_core::time::{self, DateTimeUtc, Duration};
Expand Down Expand Up @@ -1279,15 +1280,22 @@ mod tests {
)
.prop_map(|kvs| {
kvs.into_iter()
.filter_map(|(key, val)| {
.map(|(mut key, val)| {
if let DbKeySeg::AddressSeg(Address::Internal(
InternalAddress::EthBridgePool,
)) = key.segments[0]
{
None
} else {
Some((key, Level::Storage(val)))
// This is needed to be able to write this key to DB -
// the merkle tree's `BridgePoolTree::parse_key`
// requires a `KeccakHash` on the 2nd segment
key.segments.insert(
1,
DbKeySeg::StringSeg(
KeccakHash::default().to_string(),
),
);
}
(key, Level::Storage(val))
})
.collect::<Vec<_>>()
});
Expand Down

0 comments on commit 6b827ec

Please sign in to comment.