-
Notifications
You must be signed in to change notification settings - Fork 955
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
Update the test wasm tx_write_storage_key
to be able to write any arbitrary value
#894
Conversation
core/src/types/tx_data.rs
Outdated
pub struct TxWriteData { | ||
/// The storage key to be written to. | ||
pub key: storage::Key, | ||
/// The bytes to be written. | ||
pub value: Vec<u8>, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure where best to put this, it needs to be importable into both the namada_wasm_for_tests
and namada_tests
crates. Maybe a namada_test_utils
crate like in #893, but have put this here for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the crate looks like a good idea! In the interim, I think you could put it behind cfg(feature = "testing")
, but it's not enabled from wasm_tests
yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this and having to use namada_core/testing
in the namada_wasm_for_tests
crate seems to break the wasm build somehow - probably via the pulling in of the rand
crate. e.g.
> make -C wasm_for_tests/wasm_source tx_write
cargo build --release --target wasm32-unknown-unknown --target-dir 'target' --features tx_write && \
cp "./target/wasm32-unknown-unknown/release/namada_wasm_for_tests.wasm" ../tx_write.wasm
Compiling num-traits v0.2.15
Compiling tempfile v3.3.0
Compiling wait-timeout v0.2.0
error[E0433]: failed to resolve: use of undeclared crate or module `imp`
--> /Users/main/.cargo/registry/src/github.com-1ecc6299db9ec823/wait-timeout-0.2.0/src/lib.rs:66:9
|
66 | imp::wait_timeout(self, dur)
| ^^^ use of undeclared crate or module `imp`
For more information about this error, try `rustc --explain E0433`.
I can try out putting this in a namada_test_utils
crate now since that should ultimately be less hacky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've put this in a namada_test_utils
crate now
pls update wasm |
6eeae29
to
a3e50e7
Compare
a3e50e7
to
aee7ed3
Compare
This PR:
namada_test_utils
crate and aTxWriteData
struct which contains a storage key and a valuetx_write_storage_key.wasm
totx_write.wasm
tx_write.wasm
can write any value to any key as specified in aTxWriteData
Motivation for this PR is to use it in #886, for writing arbitrary
token::Amount
values to balance keys in e2e tests.