From db9a764020a70ecb104e764050045172e7e1165b Mon Sep 17 00:00:00 2001 From: James Hiew Date: Wed, 26 Oct 2022 15:53:40 +0100 Subject: [PATCH 1/4] TestTxEnv::spawn_accounts should ignore internal addresses --- tests/src/vm_host_env/tx.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/src/vm_host_env/tx.rs b/tests/src/vm_host_env/tx.rs index 6a3ef96084..af81f04111 100644 --- a/tests/src/vm_host_env/tx.rs +++ b/tests/src/vm_host_env/tx.rs @@ -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>, ) { 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 From a284eca81c51b3445283dd6f364b86b5291bc9bb Mon Sep 17 00:00:00 2001 From: James Hiew Date: Wed, 26 Oct 2022 17:41:48 +0100 Subject: [PATCH 2/4] Add changelog --- .../unreleased/testing/694-dont-spawn-internal-account-vps.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changelog/unreleased/testing/694-dont-spawn-internal-account-vps.md diff --git a/.changelog/unreleased/testing/694-dont-spawn-internal-account-vps.md b/.changelog/unreleased/testing/694-dont-spawn-internal-account-vps.md new file mode 100644 index 0000000000..664438b982 --- /dev/null +++ b/.changelog/unreleased/testing/694-dont-spawn-internal-account-vps.md @@ -0,0 +1,2 @@ +- Don't fake a wasm VP for internal addresses in tx tests + ([#694](https://github.com/anoma/namada/pull/694)) \ No newline at end of file From 22813dab682ebc507f897bcdf3fdfcbe01d31944 Mon Sep 17 00:00:00 2001 From: James Hiew Date: Thu, 27 Oct 2022 10:19:28 +0100 Subject: [PATCH 3/4] Update spawn_accounts to ignore implicit addresses --- tests/src/vm_host_env/tx.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/src/vm_host_env/tx.rs b/tests/src/vm_host_env/tx.rs index af81f04111..b21a0388ba 100644 --- a/tests/src/vm_host_env/tx.rs +++ b/tests/src/vm_host_env/tx.rs @@ -113,15 +113,19 @@ impl TestTxEnv { /// 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. Any internal - /// addresses ([`Address::Internal`]) passed in are ignored, as those - /// should not have wasm VPs in storage in any case. + /// 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>, ) { for address in addresses { - if matches!(address.borrow(), Address::Internal(_)) { + if matches!( + address.borrow(), + Address::Internal(_) | Address::Implicit(_) + ) { // don't write a VP for internal addresses continue; } From f6e4dbc246771b1da8c9ddc6a9b53eef19e3d324 Mon Sep 17 00:00:00 2001 From: James Hiew Date: Thu, 27 Oct 2022 15:34:44 +0100 Subject: [PATCH 4/4] Remove comment --- tests/src/vm_host_env/tx.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/src/vm_host_env/tx.rs b/tests/src/vm_host_env/tx.rs index b21a0388ba..3eb674946a 100644 --- a/tests/src/vm_host_env/tx.rs +++ b/tests/src/vm_host_env/tx.rs @@ -126,7 +126,6 @@ impl TestTxEnv { address.borrow(), Address::Internal(_) | Address::Implicit(_) ) { - // don't write a VP for internal addresses continue; } let key = Key::validity_predicate(address.borrow());