Skip to content

bug: tezos and eth eventstreams use invalid SHA256 invocation #1678

Description

@mcsaucy

What happened?

https://github.com/search?q=repo%3Ahyperledger%2Ffirefly+sha256.New%28%29.Sum&type=code

sha256.New().Sum != sha256.Sum256. See https://go.dev/play/p/vSW0U3Hq4qk

I tried to make a PR but couldn't work out some test failures. Additionally, I don't have enough context to know whether this is a breaking change, so I'm just gonna file this issue instead.

What did you expect to happen?

I expected vars like "unique hash" to have unique hashes in them. Instead, they have the raw plaintext with SHA256("") appended to the end.

How can we reproduce it (as minimally and precisely as possible)?

Ya just gotta switch from sha256.New().Sum to sha256.Sum256. Note that you may need to throw that in a variable and then convert the byte array to byte slice with [:].

See kubernetes-sigs/bom#524 for a similar PR.

Anything else we need to know?

No response

OS version

Details
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Activity

  1. EnriqueL8 commented on Jul 2, 2025

    @EnriqueL8
    Contributor

    Thanks for raising @mcsaucy

  2. added this to the 1.4.0 milestone on Jul 2, 2025
  3. mcsaucy commented on Jul 2, 2025

    @mcsaucy
    Author

    Yeah that invocation looks right.

  4. EnriqueL8 commented on Jul 2, 2025

    @EnriqueL8
    Contributor

    Moving to using that then!

  5. EnriqueL8 commented on Jul 2, 2025

    @EnriqueL8
    Contributor

    This change has quite a lot of migration implications unfortunately...

    We use this hash to check for unique subscriptions for event streams against the connector, which means we will reprocess all the events from start again since this will create a new subscription with the new hash in the name! Which means we would need migration code to delete the old subscription and to be honest the value that is being hashed is the address of the contract which is already unique per chain so I think this change is not needed

  6. mcsaucy commented on Jul 2, 2025

    @mcsaucy
    Author

    That makes sense. Given the problem space, it seemed likely this could be a load-bearing bug and it looks like that's the case. As you've stated, the incorrect usage is still perfectly accurate for comparisons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions