Skip to content

Commit

Permalink
Merge branch 'james/mainline/dont-spawn-internal-account-vps' (#694)
Browse files Browse the repository at this point in the history
* james/mainline/dont-spawn-internal-account-vps:
  Remove comment
  Update spawn_accounts to ignore implicit addresses
  Add changelog
  TestTxEnv::spawn_accounts should ignore internal addresses
  • Loading branch information
tzemanovic committed Nov 16, 2022
2 parents 9e0dd9f + f6e4dbc commit 8c1e5d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Don't fake a wasm VP for internal addresses in tx tests
([#694](https://github.com/anoma/namada/pull/694))
13 changes: 11 additions & 2 deletions tests/src/vm_host_env/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,23 @@ 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. Only established
/// addresses ([`Address::Established`]) have their VP storage initialized,
/// as other types of accounts 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(_) | Address::Implicit(_)
) {
continue;
}
let key = Key::validity_predicate(address.borrow());
let vp_code = vec![];
self.storage
Expand Down

0 comments on commit 8c1e5d1

Please sign in to comment.