use []any instead of []uint8 for messageId and messageHash in synth events#318
Conversation
|
👋 faisal-chainlink, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
| "state": uint8(3), // 3 = FAILURE | ||
| // The conversion to []any is needed to avoid the default Go DB SDK behaviour of converting the byte slice to encoded base64 string. | ||
| "message_id": codec.BytesToAnySlice(execReport.Message.Header.MessageID), | ||
| "message_hash": codec.BytesToAnySlice(messageHash[:]), |
There was a problem hiding this comment.
should we decode these values first?
base64.StdEncoding.DecodeString(messageId)
There was a problem hiding this comment.
They are already []byte or [32]byte not strings. The issue here is that when inserting them as those types, the DB SDK auto-converts it to base64, all we're doing here is going from []byte to []any to match the JSON-friendly types that are inserted with regular events (comes from parsedJson).
This conversion effectively tells the DB SDK, we want to insert this slice as-is.
|
|
||
| executionStateChanged := events[0].Data.(*OfframpExecutionStateChanged) | ||
|
|
||
| require.True(t, strings.HasPrefix(executionStateChanged.MessageId, "0x")) |
There was a problem hiding this comment.
Why not check the exact messageId? Same with messageHash
There was a problem hiding this comment.
While we could parse reportStr and decode the report it has to get the actual message ID. It's not necessary imo.
The check just needs to verify that the type was read correctly. Given that it's a new contract being published, we can be fairly certain it's the same event we're looking for.
There was a problem hiding this comment.
Added the exact messageId value check here: #301
* Fix inconsistent timestamp for failed transactions (#316) * feat(deployment): Curse Uncurse changeset (#310) * feat(deployment): Curse Uncurse changeset * add tests * improve tests --------- Co-authored-by: FelixFan1992 <fankejin@gmail.com> * feat(deployment): Add changesets to configure MCMS and transfer ownership to self (#317) * refactor mcms config into a sequence * refactor to separate accept mcms ownership sequence * changesets to accept ownership and configure mcms * use []any instead of []uint8 for messageId and messageHash in synth events (#318) * use []any instead of []uint8 for messageId and messageHash in synth events * update transaction_index_test * extend transaction_indexer test --------- Co-authored-by: VSG <pedro.grilo@smartcontract.com> Co-authored-by: Rodrigo Soares <38868277+rodrigombsoares@users.noreply.github.com> Co-authored-by: FelixFan1992 <fankejin@gmail.com>
No description provided.