Joystream / Joystream/joystream
Actor validation redundant
@L3pereira is already working on this.
Since Apr 11, 2022.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Description
@shamil-gadelshin
Aren't these lines redundant? I think they're validating twice
https://github.com/Joystream/joystream/blob/1c37a713511cfaf35b9577069f78827492324f2c/runtime-modules/bounty/src/lib.rs#L784
https://github.com/Joystream/joystream/blob/1c37a713511cfaf35b9577069f78827492324f2c/runtime-modules/bounty/src/lib.rs#L1135
We could change these extrinsics by removing creator and oracle inputs, since we already have that information in the chain and we already do the necessary validation with ensure_bounty_exists
Something like this
pub fn cancel_bounty(origin, bounty_id: T::BountyId) {
let bounty = Self::ensure_bounty_exists(&bounty_id)?;
BountyActorManager::<T>::ensure_bounty_actor_manager(
origin,
bounty.creation_params.creator.clone(),
)?;
...
}
pub fn submit_oracle_judgment(
origin,
bounty_id: T::BountyId,
judgment: OracleJudgment<T::EntryId, BalanceOf<T>>
) {
let bounty = Self::ensure_bounty_exists(&bounty_id)?;
BountyActorManager::<T>::ensure_bounty_actor_manager(
origin,
bounty.creation_params.oracle.clone(),
)?;
...
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.