namada icon indicating copy to clipboard operation
namada copied to clipboard

`TestTxEnv::spawn_accounts` should ignore internal addresses

Open james-chf opened this issue 3 years ago • 3 comments

This test helper writes an empty wasm VP to the ? subkey for any passed in addresses. We shouldn't need to do this for internal (and maybe also implicit?) addresses, since they shouldn't have a VP in storage. The motivation for this PR is that in eth-bridge-integration, there will be an internal account (EthBridgePool) which uses a different Merkle tree to other accounts and cannot have arbitrary bytes written to its ? subkey.

james-chf avatar Oct 26 '22 15:10 james-chf

@tzemanovic does this change make sense in terms of accounts? Maybe this fn should ignore implicit accounts as well, in which case it could just accept EstablishedAddresses. All wasm tests are passing with this change.

james-chf avatar Oct 26 '22 16:10 james-chf

does this change make sense in terms of accounts? Maybe this fn should ignore implicit accounts as well, in which case it could just accept EstablishedAddresses. All wasm tests are passing with this change.

Yeah, I think this is fine and we can also ignore implicit accounts. I prefer this over changing type to EstablishedAddress as it's simpler ergonomics on caller side for a test helper and I don't think there's much danger to it.

The reason we have this helper for wasm is fn check_address_existence (shared/src/vm/host_env.rs) which already ignores implicit and internal accounts. On Storage there's also a method fn exists which should do the same, but it only works with established address and it's not being used at the moment.

tzemanovic avatar Oct 27 '22 09:10 tzemanovic

Great, have updated to ignore implicit accounts while still accepting Address

james-chf avatar Oct 27 '22 09:10 james-chf