Skip to content

Use 0x for CIO.#21

Merged
elffjs merged 4 commits intomainfrom
hrvdm/CioTweaks
Mar 12, 2025
Merged

Use 0x for CIO.#21
elffjs merged 4 commits intomainfrom
hrvdm/CioTweaks

Conversation

@hrvdm
Copy link
Copy Markdown
Contributor

@hrvdm hrvdm commented Mar 12, 2025

No description provided.

@elffjs elffjs self-requested a review March 12, 2025 18:37
Comment thread internal/controller/controller.go Outdated
}

if err := d.cioService.SetEmail(ctx, acct.ID, normalEmail); err != nil {
if err := d.cioService.SetEmail(ctx, acct.ID, *userAccount.EthereumAddress, normalEmail); err != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We're creating the user, and we only have email, souserAccount.EthereumAddress is almost certainly nil and the handler will panic.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think if you could guarantee that you'll never create an account with email first then we might be able to make this work. In fact, we would probably want to think about getting rid of this id KSUID altogether. Is this the case?

Copy link
Copy Markdown
Member

@elffjs elffjs Mar 12, 2025

Choose a reason for hiding this comment

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

Okay, I'm looking at these lines. In the logs it seems like we always start with wallet:

I have no idea why the other path is there, then.

Comment thread internal/services/cio/cio.go
Comment thread internal/services/cio/cio.go Outdated
}

func (c *Client) SetEmail(ctx context.Context, id, email string) error {
func (c *Client) SetEmail(ctx context.Context, id string, wallet common.Address, email string) error {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Again, does id do anything now?

Comment thread internal/controller/email_handlers.go Outdated
logger.Info().Msgf("Added unconfirmed email %s to account.", normalAddr)

if err := d.cioService.SetEmail(c.Context(), acct.ID, normalAddr); err != nil {
if err := d.cioService.SetEmail(c.Context(), acct.ID, *userAccount.EthereumAddress, normalAddr); err != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This has a better chance of not blowing up.

elffjs added 3 commits March 12, 2025 17:13
Guard against the (hopefully never-occurring) possibility that
creation happens under an email JWT
@elffjs elffjs merged commit ab6fc64 into main Mar 12, 2025
@elffjs elffjs deleted the hrvdm/CioTweaks branch March 12, 2025 21:17
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