Skip to content

Make Ownable2Step an account component #2570

@PhilippGackstatter

Description

@PhilippGackstatter

#2292 introduced the ownable2step component and a Ownable2Step struct. This struct is not an account component yet, but could be to not require re-exporting its procedures from components that build on top of it, like NetworkFungibleFaucet.

What's missing is basically an impl From<Ownable2Step> for AccountComponent { ... }, and removing the re-exports from NetworkFungibleFaucet.

NetworkFungibleFaucet depends on the presence of Ownable2Step (as it calls ownable2step::assert_sender_is_owner). So, whenever building an account with NetworkFungibleFaucet, one would also have to provide Ownable2Step.

For now, failing to do so would fail with a when executing transactions (missing ownership config slot), but eventually, we can express such dependencies in an AccountComponentInterface (different from the one we have now), e.g. NetworkFungibleFaucet::dependencies would return Ownable2Step::NAME (see also #1394 (comment)). Failing to provide Ownable2Step then would fail when building the account.

Then, it should become even easier to reuse Ownable2Step and integrate it with other components.

Tasks:

  • impl From<Ownable2Step> for AccountComponent.
  • Remove ownable2step MASM procedure re-exports from NetworkFungibleFaucet and remove the ownership field from NetworkFungibleFaucet.
  • Update create_network_fungible_faucet and other call sites that build a NetworkFungibleFaucet to also provide a Ownable2Step.

cc @afa7789 @onurinanc in case you have thoughts

Metadata

Metadata

Assignees

No one assigned

    Labels

    rustIssues that affect or pull requests that update Rust codestandardsRelated to standard note scripts or account components

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions