Skip to content

Conversation

hopeyen
Copy link
Contributor

@hopeyen hopeyen commented Dec 20, 2024

Why are these changes needed?

just for investigating account behaviors

Checks

  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • I've checked the new test coverage and the coverage percentage didn't drop.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@hopeyen hopeyen requested a review from ian-shim December 21, 2024 00:40
@hopeyen hopeyen marked this pull request as ready for review December 21, 2024 00:40
@hopeyen hopeyen changed the title temp: eth address as account id [v2] eth address as account id Dec 21, 2024
accountId := header.PaymentMetadata.AccountID
pubKey := crypto.PubkeyToAddress(*sigPublicKeyECDSA).Hex()

if pubKey != accountId {
Copy link
Contributor

@ian-shim ian-shim Dec 21, 2024

Choose a reason for hiding this comment

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

Here we're comparing strings, but this will fail if accountID isn't checksummed string.
I think it's safer to convert accountID to common.Address (common.HexToAddress()) and compare bytearrays using Address.Cmp()

Do we have a test capturing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use address type.

We have auth_test that check for authenticating the requests, but not as specific as whether it is checksum or not.

@hopeyen hopeyen merged commit 2d4d65b into master Jan 6, 2025
9 checks passed
@hopeyen hopeyen deleted the hope/account-id branch January 6, 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