oxen-io / oxen-core

Oxen core repository, containing oxend and oxen cli wallets
https://oxen.io
Other
317 stars 120 forks source link

Fix rewards claim, remove the work-around commit that got left in accidentally #1678

Closed Doy-lee closed 4 months ago

Doy-lee commented 5 months ago
Rewards claim was mistakenly working due to leaving a work-around commit
in the git-tree and mistakenly testing the python script and assuming it
worked. After backing out those changes I identified that rewards claim
was still broken due to several bugs of which I have debugged and
incorporated into this PR.

- Ethereum addresses stored in the DB are stored with a 0x prefix. This
  was omitted as we were passing address strings directly through to the
  DB. I've made this type safe and convert at the very last moment to
  ensure we don't hit this bug. In future, it'd be better to store binary
  in the DB.

- The exclude parameter when querying nodes was broken. The code was
  double aggregating the node that was requesting a rewards claim. This
  meant the generated aggregate signature did not match the smart
  contract. This is fixed with the correct break in the for loop.
  Additionally, I've added a trace log to dump out the aggregate pubkey
  and how many keys we aggregated.

- I've added more error checking in general to try and catch problems earlier.
darcys22 commented 5 months ago

LGTM