Skip to content

use []any instead of []uint8 for messageId and messageHash in synth events#318

Merged
faisal-chainlink merged 3 commits intodevelopfrom
fix/avoid-default-insert-conversion-synth-events
Jan 12, 2026
Merged

use []any instead of []uint8 for messageId and messageHash in synth events#318
faisal-chainlink merged 3 commits intodevelopfrom
fix/avoid-default-insert-conversion-synth-events

Conversation

@faisal-chainlink
Copy link
Collaborator

No description provided.

@faisal-chainlink faisal-chainlink requested a review from a team as a code owner January 12, 2026 15:01
@github-actions
Copy link

👋 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[:]),
Copy link
Contributor

Choose a reason for hiding this comment

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

should we decode these values first?

base64.StdEncoding.DecodeString(messageId)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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"))
Copy link
Member

@RodrigoAD RodrigoAD Jan 12, 2026

Choose a reason for hiding this comment

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

Why not check the exact messageId? Same with messageHash

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added the exact messageId value check here: #301

@faisal-chainlink faisal-chainlink merged commit dd87010 into develop Jan 12, 2026
29 checks passed
@faisal-chainlink faisal-chainlink deleted the fix/avoid-default-insert-conversion-synth-events branch January 12, 2026 16:13
faisal-chainlink added a commit that referenced this pull request Jan 12, 2026
* 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>
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.

3 participants