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

TestTxEnv::spawn_accounts should ignore internal addresses #694

Merged
merged 4 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
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(_)) {
tzemanovic marked this conversation as resolved.
Show resolved Hide resolved
// don't write a VP for internal addresses
continue;
}
let key = Key::validity_predicate(address.borrow());
let vp_code = vec![];
self.storage
Expand Down