-
Notifications
You must be signed in to change notification settings - Fork 248
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
Add storage_version()
and runtime_wasm_code()
to storage
#1111
Changes from all commits
391e0ef
2791ea1
41727e0
6e3f8f5
49c2a6e
3760b13
5267dc4
13cf184
591de35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,3 +125,33 @@ async fn storage_n_map_storage_lookup() -> Result<(), subxt::Error> { | |
assert_eq!(entry.map(|a| a.amount), Some(123)); | ||
Ok(()) | ||
} | ||
|
||
#[tokio::test] | ||
async fn storage_runtime_wasm_code() -> Result<(), subxt::Error> { | ||
let ctx = test_context().await; | ||
let api = ctx.client(); | ||
let wasm_blob = api.storage().at_latest().await?.runtime_wasm_code().await?; | ||
assert!(wasm_blob.len() > 1000); // the wasm should be super big | ||
Ok(()) | ||
} | ||
|
||
#[tokio::test] | ||
async fn storage_pallet_storage_version() -> Result<(), subxt::Error> { | ||
let ctx = test_context().await; | ||
let api = ctx.client(); | ||
|
||
// cannot assume anything about version number, but should work to fetch it | ||
let _version = api | ||
.storage() | ||
.at_latest() | ||
.await? | ||
.storage_version("System") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Crazy thought here; could we use this to do a quick version validation? Similar to our hashing, I guess that would require substrate to constantly modify these numbers appropriately with changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When would that version validation happen? I guess we would need to make about 30 concurrent calls to validate all pallets. Or we might just validate the pallet whenever a storage query/call is made for a specific pallet? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already validate the keys and value types on a per-entry basis so probably what we have is already better (I imagine the version might increment for every storage change, but not really sure what it represents exactly?) |
||
.await?; | ||
let _version = api | ||
.storage() | ||
.at_latest() | ||
.await? | ||
.storage_version("Balances") | ||
.await?; | ||
Ok(()) | ||
} |
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.
nit: Does this comment needs updating?