Skip to content
This repository has been archived by the owner on Jul 4, 2022. It is now read-only.

Augment DelegatedDispatchVerifier trait #42

Merged
merged 2 commits into from
Dec 24, 2019

Conversation

aliXsed
Copy link

@aliXsed aliXsed commented Dec 23, 2019

Implements step 1 of #32

Copy link
Contributor

@cowboy-bebug cowboy-bebug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep looks good so far. Hope the build issue is not too complicated 😄

frame/executive/src/lib.rs Outdated Show resolved Hide resolved
frame/executive/tests/doughnut_integration.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@cowboy-bebug cowboy-bebug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aliXsed aliXsed merged commit 9faf050 into develop Dec 24, 2019
@jordy25519 jordy25519 deleted the feature/32-contract-permissioning branch January 5, 2020 19:34
@@ -394,6 +394,7 @@ mod tests {
// We aren't testing doughnut verification here just return `Ok(())`
pub struct MockDelegatedDispatchVerifier<T: system::Trait>(rstd::marker::PhantomData<T>);
impl<T: system::Trait> DelegatedDispatchVerifier<T::Doughnut> for MockDelegatedDispatchVerifier<T> {
type AccountId = T::AccountId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we have mixed associated type (AccountId) and generic type (Doughnut). It would be sensible to stick to one or the other

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad for missing this. It looks like we don't use this associated type anywhere. I think we should remove it to keep it consistent

Copy link
Author

@aliXsed aliXsed Jan 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have used AccountId as the type of caller and contract addresses. DelegatedDispatchVerifier is defined generically with no knowledge about the type Doughnut or DoughnutRuntime or even generic asset.
A different solution to the one introduced here could be that we define our trait like this:
pub trait DelegatedDispatchVerifier<Doughnut, AccountId> { ... }
But this is then introducing a new generic parameter which is very similar to an associated type and worse because it makes it possible that we implement DelegatedDispatchVerifier for different combinations of Doughnut and AccountId which is not what we would need.
Introducing a dependency between frame/support and frame/system so we bring in generic asset definitions for the additional traits doesn't seem to be a good solution either.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that we should do all generic parameters or all associated types

pub trait DelegatedDispatchVerifier<Doughnut, AccountId> { ... }

or

pub trait DelegatedDispatchVerifier {
  type AccountId;
  type Doughnut;
}

but not a mix of both as it's confusing.

It will be good to change to all associated after #40 is resolved

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants