Skip to content
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

Custom error message for StorageNoopGuard #375

Closed
ggwpez opened this issue Mar 30, 2023 · 5 comments · Fixed by #1727
Closed

Custom error message for StorageNoopGuard #375

ggwpez opened this issue Mar 30, 2023 · 5 comments · Fixed by #1727
Labels
C1-mentor A task where a mentor is available. Please indicate in the issue who the mentor could be. T1-FRAME This PR/Issue is related to core FRAME, the framework.

Comments

@ggwpez
Copy link
Member

ggwpez commented Mar 30, 2023

👉 Good issue for newcomers (please dont pick up when you already have experience).

There should be a constructor like from_error_message and/or a setter for a custom error message on the StorageNoopGuard.
Also we should add a new() function which does the same as default() - seems to be a pattern in Rust.

@ggwpez
Copy link
Member Author

ggwpez commented Apr 17, 2023

@daredevil3435 if you are still looking for an easy issue; this here for example.

@daredevil3435
Copy link

@daredevil3435 if you are still looking for an easy issue; this here for example.

Yup. I'll look into this. If any question can I ask?

@ggwpez
Copy link
Member Author

ggwpez commented Apr 17, 2023

Yes, sure!

@juangirini juangirini transferred this issue from paritytech/substrate Aug 24, 2023
@the-right-joyce the-right-joyce added C1-mentor A task where a mentor is available. Please indicate in the issue who the mentor could be. T1-FRAME This PR/Issue is related to core FRAME, the framework. and removed Z6-mentor labels Aug 25, 2023
@seadanda
Copy link
Contributor

Hi @ggwpez, was there progress on this? I'll pick this up if not.

@seadanda
Copy link
Contributor

Hi @ggwpez, was there progress on this? I'll pick this up if not.

I checked the branches and forks and didn't see anything, so I've made the changes and made a PR.

seadanda added a commit that referenced this issue Sep 27, 2023
Expand `StorageNoopGuard` to be able to add extra context through a
custom error message. When the guard is triggered it panics with an
error message which can be defaulted, set on construction, or set after
it has been constructed.

Turn `StorageNoopGuard` into struct with `storage_root` and
`error_message` and added `from_error_message` constructor and
`set_error_message` setter.

Also added `new()` aliased to `default()`.

Closes #375

---------

Co-authored-by: joe petrowski <[email protected]>
Co-authored-by: Liam Aharon <[email protected]>
@github-project-automation github-project-automation bot moved this from Backlog to Done in Runtime / FRAME Sep 27, 2023
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this issue Mar 25, 2024
Expand `StorageNoopGuard` to be able to add extra context through a
custom error message. When the guard is triggered it panics with an
error message which can be defaulted, set on construction, or set after
it has been constructed.

Turn `StorageNoopGuard` into struct with `storage_root` and
`error_message` and added `from_error_message` constructor and
`set_error_message` setter.

Also added `new()` aliased to `default()`.

Closes paritytech#375

---------

Co-authored-by: joe petrowski <[email protected]>
Co-authored-by: Liam Aharon <[email protected]>
jonathanudd pushed a commit to jonathanudd/polkadot-sdk that referenced this issue Apr 10, 2024
* Remove the Substrate primitives crate

The types here were only used in one place, the pallet itself. If other
components start using these types we can considering moving them back
into a standalone crate.

* Start trying to integrate justification module

* Make Substrate blocks configurable in Pallet

* WIP: Try and generalize justification test helpers

* Fix tests which use "real" justifications

* Put common test helpers alongside mock code

* Use common helper for creating headers

* Remove usage of UintAuthorityId

This change favours the use of the Ed25519Keyring authorities
in order to keep things consistent with the tests.

* Add documentation around config trait types

* Make test header, hash, and number types consistent

* Update modules/substrate/src/verifier.rs

Co-authored-by: Svyatoslav Nikolsky <[email protected]>

* Update modules/substrate/src/lib.rs

Co-authored-by: Tomasz Drwięga <[email protected]>

* Update modules/substrate/Cargo.toml

Co-authored-by: Svyatoslav Nikolsky <[email protected]>

* Derive `RuntimeDebug` instead of `Debug`

* Add `Paramter` as a trait constraint on config types

Since we use these types as part of the dispatchable functions
we should explicitly require this.

* Enforce that hasher output matches expected hash type

* Accept headers over indexes when making test justifications

* Check that authority sets are valid

* Make Clippy happy

* Apply correct Clippy fix

* Move justification code into primitives module

* Use new module in verifier code

* Add primitives module for Substrate test helpers

* WIP

* Move justification generation into test_helpers

* Revert commits which move `justification` into primitives

This reverts commit 03a381f0bc4a8dbe4785c30d42ab252a06ba876c.

Co-authored-by: Svyatoslav Nikolsky <[email protected]>
Co-authored-by: Tomasz Drwięga <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C1-mentor A task where a mentor is available. Please indicate in the issue who the mentor could be. T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants