Skip to content

Commit

Permalink
TestTxEnv::spawn_accounts should ignore internal addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
james-chf committed Oct 26, 2022
1 parent 836a6de commit db9a764
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/src/vm_host_env/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,20 @@ impl TestTxEnv {
);
}

/// Fake accounts existence by initializating their VP storage.
/// Fake accounts' existence by initializing their VP storage.
/// This is needed for accounts that are being modified by a tx test to
/// pass account existence check in `tx_write` function.
/// pass account existence check in `tx_write` function. Any internal
/// addresses ([`Address::Internal`]) passed in are ignored, as those
/// should not have wasm VPs in storage in any case.
pub fn spawn_accounts(
&mut self,
addresses: impl IntoIterator<Item = impl Borrow<Address>>,
) {
for address in addresses {
if matches!(address.borrow(), Address::Internal(_)) {
// don't write a VP for internal addresses
continue;
}
let key = Key::validity_predicate(address.borrow());
let vp_code = vec![];
self.storage
Expand Down

0 comments on commit db9a764

Please sign in to comment.