mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 13:57:58 +00:00
a9b9ca5fa8
* Factor out can_set_code
The motivation for this feature is parachain runtime upgrades, which
happen in two different moments: the initial call, when the checks
should be performed, and at the actual upgrade block. It's much
better and more maintainable to just call `can_set_code` in the
function than to manually copy those checks.
I'm not entirely thrilled with the interface, which requires
cloning the entire code vector in `set_code`. However, it looks
like something in `decl_module!` does not play nicely with
references in its function arguments. If `code` has a lifetime,
it _must_ be named, which gives us this signature.
```rust
pub fn can_set_code<'a>(origin, code: &'a [u8]) {
```
Unfortunately, attempting to compile with that signature generates
a very large and baffling collection of build errors, so I decided
to abandon that path for now.
* make can_set_code non-dispatchable per PR revew
Not only can we now borrow the `code` slice, but we also no longer
need to worry about people sending a `can_set_code` transaction because
of some misunderstanding.
* move into existing impl block
Substrate ·

Substrate is a next-generation framework for blockchain innovation.
Trying it out
Simply go to substrate.dev and follow the getting started instructions.
Contributions & Code of Conduct
Please follow the contributions guidelines as outlined in docs/CONTRIBUTING.adoc. In all communications and contributions, this project follows the Contributor Covenant Code of Conduct.
Security
The security policy and procedures can be found in docs/SECURITY.md.
License
Substrate is GPL 3.0 licensed.