-
Notifications
You must be signed in to change notification settings - Fork 354
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
Migrate SRC5 to component #767
Migrate SRC5 to component #767
Conversation
* feat: update format and add api * fix: typo * feat: add counterfactual deployment doc * feat: add API entries * feat: add events * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: update from reviews * feat: apply review updates * feat: update docs * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * feat: apply review updates * fix: account casing * feat: add headers * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * feat: add link * feat: move API * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * refactor: update wording * Update docs/antora.yml Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * feat: apply update reviews * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * refactor: UI * fix: UI * feat: focus on SRC6 * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * feat: apply review updates --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> Co-authored-by: Martín Triay <martriay@gmail.com>
* feat: update format and add api * fix: typo * feat: add counterfactual deployment doc * feat: add API entries * feat: add events * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: update from reviews * feat: apply review updates * feat: update docs * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * feat: apply review updates * fix: account casing * feat: add headers * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * feat: add link * feat: move API * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * refactor: update wording * Update docs/antora.yml Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * feat: apply update reviews * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * refactor: UI * fix: UI * feat: focus on SRC6 * add interface & dispatchers docs * apply review feedback * address feedback comments --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
* feat: update format and add api * fix: typo * feat: add counterfactual deployment doc * feat: add API entries * feat: add events * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: update from reviews * feat: apply review updates * feat: update docs * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/guides/deployment.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * feat: apply review updates * fix: account casing * feat: add headers * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * feat: add link * feat: move API * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * refactor: update wording * Update docs/antora.yml Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * feat: apply update reviews * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * refactor: UI * fix: UI * feat: focus on SRC6 * Update docs/modules/ROOT/pages/accounts.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * feat: update overview * feat: apply review updates * Update docs/modules/ROOT/pages/index.adoc Co-authored-by: Martín Triay <martriay@gmail.com> * feat: apply review updates * Update docs/modules/ROOT/pages/index.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> * feat: apply review updates * Update docs/modules/ROOT/pages/index.adoc Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> Co-authored-by: Martín Triay <martriay@gmail.com>
* feat: add prefixes * Update src/access/accesscontrol/accesscontrol.cairo Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> --------- Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
* refactor: sanitizing * feat: sanitizing * feat: apply review updates * feat: apply review updates
…eat/migrate-src5-to-component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, Eric! I left a few questions. And as mentioned in our discussion, I vote that we update the relevant documentation with each component migration PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improvements look good, sir! I left a couple suggestions and a question :)
[#SRC5-External-Functions] | ||
==== External Functions | ||
[#SRC5-Embeddable-Implementations-Functions] | ||
==== Embeddable Implementations Functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change the self
type in the functions below to ComponentState<TContractState>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about leaving just ComponentState? I think the generic TState is implicit since TContractState is always required, and this will appear frequently in the APIs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, and it's much less noisy. +1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think we should leave just ContractState
, because the embeddable implementation generated when you use embeddable_as
is the one having just ContractState, like this:
#[starknet::embeddable]
impl SRC5Impl<
TContractState, +HasComponent<TContractState>
, impl TContractStateDrop: Drop<TContractState>
> of interface::ISRC5<TContractState> {
fn supports_interface(self: @TContractState, interface_id: felt252
) -> bool {
let component = HasComponent::get_component(self);
SRC5::supports_interface(component, interface_id, )
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The impl we embed is not the one we write in the component, but the one the compiler generates from the embeddable_as
attribute. And this is the one the user would usually use. Is different for InternalImpl though, because this doesn't use embeddable_as
. For this one I think we should use ComponentState.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm if we go that route, should we include a NOTE or something to explain the rationale behind using ContractState
for embeddables and ComponentState
for internals? IMO it'd be weird to not say anything about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it can be confusing, but where can we add such note? It seems we would need to add it to every component API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repeating the same note is definitely not ideal. Even though this is about reading the API, it's IMO more about understanding the component architecture (as you described above). Maybe this can be addressed in the Extensibility
doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, let's stick with ContractState for embeddable impls functions, and ComponentState for InternalImpl in components, at least until we revisit how we present this in the Extensibility PR. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
…lo/cairo-contracts into feat/migrate-src5-to-component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left an optional comment to address and a couple small suggestions. Otherwise, LGTM!
==== External Functions | ||
[#SRC5-Embeddable-Implementations-Functions] | ||
==== Embeddable Implementations Functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the title: Embeddable Implementations Functions
, it reads kind of awkward. This is nitpicky, I know. I don't have a good alternative, just throwing it out there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call it just Embeddable Functions in the meantime (I think it reads better). Any suggestion is more than welcome.
.External Functions | ||
.Embeddable Implementations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the Ownable API, the index name is Embeddable Implementations Functions
. We should normalize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's stick with just Embeddable Implementations then if you agree.
Supersedes #755 Fixes #754
PR Checklist