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

SEP-10: Add support for contracts (storage bound) #1492

Closed
wants to merge 1 commit into from

Conversation

leighmcculloch
Copy link
Member

@leighmcculloch leighmcculloch commented Jun 14, 2024

What

Add support for contracts to SEP-10 using storage to store a fixed key.

Why

So that contract accounts can authenticate with SEP-24, SEP-30, etc.

State

This PR is a early draft and idea for how SEP-10 could be modified.

cc @JakeUrban @tomerweller @philipliu @reecexlm @mtwtfss

Related:

Copy link
Contributor

@JakeUrban JakeUrban left a comment

Choose a reason for hiding this comment

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

👏 this was much simpler than I expected.

To confirm, things that would require updates are:

  • SDKs
    • to use the G-zero address and add the additional manage data op when a C-address is passed as the client account
    • fetch the sep-10-signers key-val pair from contract storage when validating challenges
  • SEP-10 servers
    • need to run an RPC to fetch the contract's signers

Comment on lines +256 to +258
- (optional) `manage_data(source: client domain account or G-zero, key: 'client_account', value: client_account e.g. C...)`
- The source account is the **Client Domain Account** or G-zero
- Add this operation if the client account is a contract `C...` address
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you intended to update the first operation, the one that contains the client account, but this is the third operation, the one that contains the client domain account (i.e. the wallet's SIGNING_KEY)

Comment on lines +349 to +350
- if the first operation's source account is G-zero, and contains a Manage Data operation with the key `client_account`:
- use the value of this operation for the client account instead of the source account value
Copy link
Contributor

Choose a reason for hiding this comment

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

So this G-zero account acts as a special case / null value? Clever, I was stuck thinking we would have to support C-addresses as source accounts in order to add them to SEP-10.

@leighmcculloch leighmcculloch changed the title SEP-10: Add support for contracts SEP-10: Add support for contracts (storage bound) Jun 14, 2024
@leighmcculloch
Copy link
Member Author

leighmcculloch commented Jun 14, 2024

Closing in favor of proposing:

@leighmcculloch leighmcculloch deleted the sep-10-contracts branch June 14, 2024 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants