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

[ANCHOR-342] Add clients to the configuration #946

Conversation

lijamie98
Copy link
Collaborator

@lijamie98 lijamie98 commented Jun 15, 2023

PR Checklist

PR Structure

  • This PR has reasonably narrow scope (if not, break it down into smaller PRs).
  • This PR avoids mixing refactoring changes with feature changes (split into two PRs
    otherwise).
  • This PR's title starts with name of package that is most changed in the PR, ex.
    paymentservice.stellar, or all or doc if the changes are broad or impact many
    packages.

Thoroughness

  • This PR adds tests for the most critical parts of the new functionality or fixes.

What

Add client_attribution to the configuration.

Why

This is to support the client status callback feature.

@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr946.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr946.previews.kube001.services.stellar-ops.com/

@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

@lijamie98 lijamie98 force-pushed the feature/anchor-342-client-attribution-configuration branch from 0cb9670 to 7af8a1c Compare June 15, 2023 21:05
@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr946.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr946.previews.kube001.services.stellar-ops.com/

@Ifropc
Copy link
Contributor

Ifropc commented Jun 15, 2023

Can we deprecate

  ## @param: omnibus_account_list
  ## A comma-separated list of omnibus accounts (comma separated).
  ## The SEP-10 omnibus account is described at:
  ##     https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0010.md#memos
  #
  omnibus_account_list:
  ## @param: require_known_omnibus_account
  ## @type: bool
  ## Whether to require authenticating clients to be in the omnibusAccountList
  #
  require_known_omnibus_account: false

Because with new schema we can always just use client_attribution

@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr946.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr946.previews.kube001.services.stellar-ops.com/

# Examples:
# - domain: lobstr.com
# type: non-custodial
# public_key: GBI2IWJGR4UQPBIKPP6WG76X5PHSD2QTEBGIP6AZ3ZXWV46ZUSGNEGN2
Copy link
Contributor

Choose a reason for hiding this comment

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

Does non-custodial wallet even have a public key? I think it should only be required for custodial wallets

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Doesn't lobstr.com server has a SIGNING_KEY in the TOML file?

cc: @JakeUrban

Copy link
Contributor

Choose a reason for hiding this comment

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

Noncustodial wallets do have a public key, published on their stellar.toml file. This is nice because the non-custodial wallet could rotate their signing key and the anchor's authentication process would still work because it should fetch the SIGNING_KEY on each authentication request.

For this same reason, I don't think we should require each wallet entry to have a public key attribute. Only custodial wallets will need the public_key attribute.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we can add type when there is an immediate use case. In that case, the public_key will stay.

@lijamie98
Copy link
Collaborator Author

Can we deprecate

  ## @param: omnibus_account_list
  ## A comma-separated list of omnibus accounts (comma separated).
  ## The SEP-10 omnibus account is described at:
  ##     https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0010.md#memos
  #
  omnibus_account_list:
  ## @param: require_known_omnibus_account
  ## @type: bool
  ## Whether to require authenticating clients to be in the omnibusAccountList
  #
  require_known_omnibus_account: false

Because with new schema we can always just use client_attribution

Is there a use case where a wallet uses omnibus_account without client_attribution?

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.

Made some comments / suggestions. Regarding backwards compatibility, I think we should deprecate the allowlist & denylist attributes but keep the client_attribution_required flag. Then we'll validate that everything matches on startup if the wallets object is present.

# Examples:
# - domain: lobstr.com
# type: non-custodial
# public_key: GBI2IWJGR4UQPBIKPP6WG76X5PHSD2QTEBGIP6AZ3ZXWV46ZUSGNEGN2
Copy link
Contributor

Choose a reason for hiding this comment

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

Noncustodial wallets do have a public key, published on their stellar.toml file. This is nice because the non-custodial wallet could rotate their signing key and the anchor's authentication process would still work because it should fetch the SIGNING_KEY on each authentication request.

For this same reason, I don't think we should require each wallet entry to have a public key attribute. Only custodial wallets will need the public_key attribute.

Comment on lines 142 to 145
# The flag to enable the status callback to the client domain
client_domain_status_callback_enabled: true
# The flag to enable the event delivery to the anchor business server
callback_api_event_delivery_enabled: true
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't love the naming here. I think something generalized would be better:

  events:
    transaction_status_updated:
      wallet_callbacks_enabled: true
      callback_api_requests_enabled: true

This way, we can add more event types and more handlers of those events using a predefined structure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is a event section that defines the existing EventService. This is specific to event-processor.

I would probably swap the structure like. Please refer to the updated commit.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, I don't mind using the event-processor top-level object.

What do you think about using event type as a sub-object though? That way the business could subscribe to a subset of events, instead of having just a single true/false attribute for all event types.

For example,

event_processor:
  event_type:
    transaction_status_updated:
      client_callback_enabled: true
      callback_api_requests_enabled: true
    transaction_created:
      client_callback_enabled: false
      callback_api_requests_enabled: true

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't feel strongly about this. If we want to use a single attribute for all requests that it ok, we'll just have less flexibility and need to make assumptions about what anchors and clients will want.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not all callbacks are interested in all event types. How about we do this:

event_processor:
  # The context path of the event processing server
  context_path: /
  # The listening port of the event processing server
  port: 8084
  # The configuration of the status callback to the client domain
  client_domain_status_callback:
    enabled: true
  # The configuration of the event delivery to the anchor business server
  callback_api_event_delivery:
    enabled: true

This will leave more room for customization and we don't have to define the behavior of the events unless it is necessary to customize.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey Jamie, can we use the following names, client_status_callback and callback_api_requests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can we use singular callback_api_request because client_status_callback is singular.

Copy link
Contributor

Choose a reason for hiding this comment

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

Works for me!

@lijamie98 lijamie98 force-pushed the feature/anchor-342-client-attribution-configuration branch from 8be50e0 to 41af11e Compare June 21, 2023 18:22
@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr946.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr946.previews.kube001.services.stellar-ops.com/

2 similar comments
@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr946.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr946.previews.kube001.services.stellar-ops.com/

@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr946.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr946.previews.kube001.services.stellar-ops.com/

@lijamie98
Copy link
Collaborator Author

I am not sure if we may deprecate the omnibus_account_list.

  • omnibus_account_list seems to be inconsistent with client.
  • I think it is possible omnibus_account_list can be different from the wallet_addresss defined in the clients section.

@lijamie98 lijamie98 force-pushed the feature/anchor-342-client-attribution-configuration branch from ca6f08f to ffd14b9 Compare June 27, 2023 15:49
@lijamie98 lijamie98 changed the title [ANCHOR-342] Add client_attribution to the configuration [ANCHOR-342] Add clients to the configuration Jun 27, 2023
@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr946.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr946.previews.kube001.services.stellar-ops.com/

@JakeUrban
Copy link
Contributor

I am not sure if we may deprecate the omnibus_account_list.
omnibus_account_list seems to be inconsistent with client.
I think it is possible omnibus_account_list can be different from the wallet_addresss defined in the clients section.

Can you provide an example of how it is inconsistent? I think the omnibus account list is directly associated with the auth_accounts of a given client.

@lijamie98 lijamie98 force-pushed the feature/anchor-342-client-attribution-configuration branch from ffd14b9 to f76a8a5 Compare June 27, 2023 21:47
@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr946.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr946.previews.kube001.services.stellar-ops.com/

@stellar-jenkins
Copy link

Reference Server Preview is available here:
https://anchor-ref-pr946.previews.kube001.services.stellar-ops.com/
SEP Server Preview is available here:
https://anchor-sep-pr946.previews.kube001.services.stellar-ops.com/

@lijamie98 lijamie98 merged commit 5349dbf into stellar:develop Jun 28, 2023
5 checks passed
@lijamie98 lijamie98 self-assigned this Jul 26, 2023
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.

4 participants