audius-protocol icon indicating copy to clipboard operation
audius-protocol copied to clipboard

Fix signature in SDK rewards

Open rickyrombo opened this issue 10 months ago • 3 comments

Description

Occasionally an attestation signature returned by our services will have less than 64 bytes. When recreating this signature logic, I didn't realize that meant it could have 63 1/2 bytes 😝

Using Buffer.alloc() to ensure 64 bytes was stripping the last half-byte off and pushing everything a half byte. Eg.

d405b277dc948f97d7b7db8648cb16590d66084ba49642fedb08380ce5027a95d0a895287a3331332e7ad13daba87eed5c70820a19ca2eb6cc0ea1eb4695ba4

would become 00d405b277dc948f97d7b7db8648cb16590d66084ba49642fedb08380ce5027a95d0a895287a3331332e7ad13daba87eed5c70820a19ca2eb6cc0ea1eb4695ba (note the two prepended 0s)

instead of 0d405b277dc948f97d7b7db8648cb16590d66084ba49642fedb08380ce5027a95d0a895287a3331332e7ad13daba87eed5c70820a19ca2eb6cc0ea1eb4695ba4 (note the 4)

That was fun.

While I was at it, I noticed the new cooldown errors from @sddioulde 's changes, and decided the error handling in reportToSentry should add the responses if it can.

rickyrombo avatar Apr 23 '24 03:04 rickyrombo

🦋 Changeset detected

Latest commit: 1effb3b917890a59b3ee1ef6a2479c9a40f50db1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@audius/spl Patch
@audius/sdk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Apr 23 '24 03:04 changeset-bot[bot]

@sliptype for changeset review? am I doing this right? So cool!

rickyrombo avatar Apr 23 '24 03:04 rickyrombo

Preview this change https://demo.audius.co/mjp-sdk-rewards-again

audius-infra avatar Apr 23 '24 03:04 audius-infra

Preview this change https://demo.audius.co/mjp-sdk-rewards-again

audius-infra avatar Apr 23 '24 07:04 audius-infra

@sliptype for changeset review? am I doing this right? So cool!

Yup looks good! Could theoretically combine them into one changeset too, but no harm in having multiple

sliptype avatar Apr 23 '24 15:04 sliptype