Ticket redemption test fails against the streamflow geth image
- Dominant language
- TypeScript
- Stars
- 5
- Forks
- 7
- Avg merge
- 4h 1m
- Merged PRs (30d)
- 6
Description
`yarn test` currently runs two cases (23 are skipped). `subgraph does not fail` passes. `correctly updates the broadcaster deposit when ticket value is less than deposit` fails, so the suite exits 1 even when the subgraph is fine.
Found while validating #263, after #265 and #266 made the docker stack bootable again.
Three problems, in order of discovery:
1. The ticket hash is ABI-encoded with the wrong types: `recipientRandHash` as `string` (contract: `bytes32`) and `auxData` as `uint256` (contract: `bytes`). ethers throws `value out-of-bounds` before anything reaches the chain. Fix: use `TicketBroker.getTicketHash(ticket)`.
2. `signer.signMessage(hexString)` signs the UTF-8 text of the hex string, not the hash bytes. And geth's `personal_sign` requires a password argument that ethers' remote signer does not send, so it fails with `missing value for required argument 2`. Fix: `provider.send("personal_sign", [hash, address, ""])`.
3. With 1 and 2 fixed, `redeemWinningTicket` reverts on chain. Reason not yet identified. The `geth-with-livepeer-protocol:streamflow` image deploys a 2022 protocol commit, so this may be an image-side rule. Not worth debugging until the anvil-based test image from the [testnet proposal](https://forum.livepeer.org/t/livepeer-testnet-implementation-proposal/3322) exists.
The test also has no assertion, it only logs the query result.
Suggested short-term: land fixes 1 and 2 and `it.skip` the case with a pointer here, so `yarn test` exits 0 and can gate dependency PRs. Branch `fix/ticket-hash-encoding` has 1 and 2.
Contributor guide
Research direction
Start with the failing ticket redemption case run by yarn test and compare branch fix/ticket-hash-encoding with the test's TicketBroker.getTicketHash and personal_sign calls. Verify the two encoding and signing failures are covered, then handle the unresolved chain revert as described and ensure the suite exits 0 with an assertion or explicit skip.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, typescript
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100