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

eth2util: clone go-eth2-client data version #2462

Merged
merged 5 commits into from
Jul 25, 2023
Merged

Conversation

corverroos
Copy link
Contributor

@corverroos corverroos commented Jul 23, 2023

Clones the go-eth2-client github.com/attestantio/go-eth2-client/spec.DataVersion type aligning with pre-v0.18 values.

This is required since we serialise these version numbers over the wire so they MUST remain constant to ensure backwards compatibility between charon versions. go-eth2-client changed the DataVersion numbers in the recent v0.18.0 upgrade which we had to roll-back.

This change allows the following:

  • Can upgrade to go-eth2-client to v0.18.0
  • Can start a migration to using "data version" strings instead of numbers.

The migration will look something like:

  • Introduce a new "string" based data version format, versus the old number based format.
  • v0.17 should support receiving both old and new message formats (incoming)
  • v0.17 should send old messages (outgoing) to remain compatible with v0.16.
  • v0.18 can then start sending new format (outgoing), it still supports receiving both old and new (incoming).
  • v0.19 can remove support for old format message, only receiving and sending the new format

category: refactor
ticket: #2433

@codecov
Copy link

codecov bot commented Jul 23, 2023

Codecov Report

Patch coverage: 34.70% and project coverage change: -0.13% ⚠️

Comparison is base (bdadb8d) 53.70% compared to head (f04fa8f) 53.57%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2462      +/-   ##
==========================================
- Coverage   53.70%   53.57%   -0.13%     
==========================================
  Files         198      198              
  Lines       26506    26619     +113     
==========================================
+ Hits        14234    14261      +27     
- Misses      10510    10582      +72     
- Partials     1762     1776      +14     
Files Changed Coverage Δ
eth2util/types.go 18.34% <0.00%> (-25.13%) ⬇️
core/signeddata.go 47.05% <50.00%> (+2.61%) ⬆️
core/unsigneddata.go 49.14% <50.00%> (+2.12%) ⬆️
core/ssz.go 67.44% <56.62%> (-7.56%) ⬇️

... and 7 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

core/ssz.go Outdated
@@ -42,7 +43,7 @@ func (b VersionedSignedBeaconBlock) MarshalSSZ() ([]byte, error) {

// MarshalSSZTo ssz marshals the VersionedSignedBeaconBlock object to a target array.
func (b VersionedSignedBeaconBlock) MarshalSSZTo(buf []byte) ([]byte, error) {
return marshalSSZVersionedTo(buf, b.Version, b.sszValFromVersion)
return marshalSSZVersionedTo(buf, eth2util.DataVersion(b.Version), b.sszValFromVersion)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note that casting isn't enough, we need to ensure the numbers we are working with are aligned with pre-v0.18.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this has been refactored to convert instead of cast.

@corverroos corverroos added the do not merge Indicate to bulldozer bot that this PR should not be merged label Jul 23, 2023
@corverroos corverroos removed the do not merge Indicate to bulldozer bot that this PR should not be merged label Jul 24, 2023
return b, nil
}

// UnmarshalJSON unmarshals the DataVersion from strings or a number equaled to the go-eth2-client
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// UnmarshalJSON unmarshals the DataVersion from strings or a number equaled to the go-eth2-client
// UnmarshalJSON unmarshals the DataVersion from string or a number equaled to the go-eth2-client

}

// ToETH2 returns a eth2spec.DataVersion equivalent to the DataVersion.
func (v DataVersion) ToETH2() eth2spec.DataVersion {
Copy link
Contributor

Choose a reason for hiding this comment

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

This method will return different values once we update go-eth2-client to v0.18, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup

@corverroos corverroos added the merge when ready Indicates bulldozer bot may merge when all checks pass label Jul 25, 2023
@obol-bulldozer obol-bulldozer bot merged commit d78d31c into main Jul 25, 2023
12 checks passed
@obol-bulldozer obol-bulldozer bot deleted the corver/eth2version branch July 25, 2023 09:11
obol-bulldozer bot pushed a commit that referenced this pull request Jul 25, 2023
Similar to the issue discovered in #2462, we should also pre-empt such a change in the `eth2spec.BuilderVersion` by introducing our own `eth2util.BuilderVersion` type.

category: refactor
ticket: #2466
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge when ready Indicates bulldozer bot may merge when all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants