Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert changes in HashTreeRoot and SSZ encoding for backwards-compatibility #354

Closed
wants to merge 2 commits into from

Conversation

moshe-blox
Copy link
Contributor

@moshe-blox moshe-blox commented Jan 30, 2024

fastssz was upgraded in #324 and it changed the roots for ConsensusData, SignedMessage and SSVMessage, which would be a fork.

This fastssz upgrade included a crucial hashing fix, replacing PutBytes with Append in order to prevent double-merkleization in HashTreeRoot methods, thereby changing roots for []byte fields exceeding 32 bytes.

It's noted that Beacon spec tests appear unaffected by this change, as they don't contain fields exceeding the threshold for the double-merkleization bug. However, we don't know that Beacon messages are absolutely not impacted.

Therefore, we propose inspecting the changes in _encoding.go files between the currently and previously imported versions of go-eth2-client, to ensure that any change from PutBytes to Append is encoding a field which can not exceed 32 bytes in size.

Two more changes were done to preserve backwards-compatibility:

  • Encoding of types.Contribution was copied over from v0.3.4
  • spec.DataVersion is now being decremented in encodings and incremented in decodings, because all of the values were incremented by 1 in go-eth2-client.

@moshe-blox moshe-blox changed the title fix: revert hashing of []byte back to PutBytes Revert merkleization of []byte fields back to PutBytes Jan 30, 2024
@moshe-blox moshe-blox changed the title Revert merkleization of []byte fields back to PutBytes Revert HashTreeRoot and SSZ encoding for backwards-compatibility Feb 1, 2024
@moshe-blox moshe-blox changed the title Revert HashTreeRoot and SSZ encoding for backwards-compatibility Revert changes in HashTreeRoot and SSZ encoding for backwards-compatibility Feb 1, 2024
@moshe-blox moshe-blox marked this pull request as ready for review February 1, 2024 14:11
@moshe-blox
Copy link
Contributor Author

Closed in favor of #361

@moshe-blox moshe-blox closed this Feb 1, 2024
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.

1 participant