Files
pezkuwi-subxt/substrate
Peter Goodspeed-Niklaus a9b9ca5fa8 Factor out can_set_code (#5317)
* 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
2020-03-20 15:00:01 +01:00
..
2020-03-20 12:42:00 +01:00
2020-03-18 14:37:21 +01:00
2020-03-20 15:00:01 +01:00
2020-03-19 23:01:13 +01:00
2020-03-20 12:42:00 +01:00
2019-11-10 13:01:44 +01:00
2020-03-18 15:47:34 +01:00
2020-03-20 12:42:00 +01:00
2017-11-07 19:15:12 +01:00
2020-01-09 15:27:24 +01:00

Substrate · GitHub license GitLab Status PRs Welcome

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.