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

*: fix compatibility with latest go-eth2-client #2650

Merged
merged 18 commits into from
Oct 30, 2023

Conversation

xenowits
Copy link
Contributor

Fix charon's compatibility with latest release of go-eth2-client which contains breaking changes, notably the ETH2 client interface methods. This PR also enables easy integration of deneb fork as the data structures for deneb are included in the new release. An example of the API change is as follows:

Earlier

validatorsProvider.Validators(ctx, "head", nil)

Now

validatorsProvider.Validators(ctx, &api.ValidatorsOpts{
  State: "head",
})

Also fix corresponding tests.

category: feature
ticket: #2646

@xenowits xenowits self-assigned this Oct 19, 2023
@xenowits xenowits force-pushed the xenowits/fix-eth2-client branch 3 times, most recently from 77fc3df to 81aaaba Compare October 19, 2023 10:54
@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

Attention: 622 lines in your changes are missing coverage. Please review.

Comparison is base (1e87eb9) 53.27% compared to head (47169ff) 53.16%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2650      +/-   ##
==========================================
- Coverage   53.27%   53.16%   -0.12%     
==========================================
  Files         202      202              
  Lines       27517    27980     +463     
==========================================
+ Hits        14661    14875     +214     
- Misses      11005    11244     +239     
- Partials     1851     1861      +10     
Files Coverage Δ
app/eth2wrap/valcache.go 74.57% <100.00%> (+2.87%) ⬆️
core/scheduler/scheduler.go 76.96% <100.00%> (+1.00%) ⬆️
core/tracker/tracker.go 79.51% <100.00%> (ø)
core/validatorapi/eth2types.go 50.00% <ø> (ø)
eth2util/eth2exp/attagg_old.go 52.94% <100.00%> (+4.00%) ⬆️
eth2util/signing/signing.go 39.21% <100.00%> (+2.48%) ⬆️
core/tracker/inclusion.go 41.06% <75.00%> (ø)
app/eth2wrap/success.go 50.00% <50.00%> (ø)
app/monitoringapi.go 50.00% <50.00%> (-0.58%) ⬇️
core/bcast/bcast.go 66.17% <66.66%> (ø)
... and 20 more

... and 2 files with indirect coverage changes

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

core/validatorapi/validatorapi.go Dismissed Show dismissed Hide dismissed
defer span.End()

return c.awaitAttFunc(ctx, int64(slot), int64(committeeIndex))
att, err := c.awaitAttFunc(ctx, int64(opts.Slot), int64(opts.CommitteeIndex))

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an unsigned 64-bit integer from
strconv.ParseUint
to a lower bit size type int64 without an upper bound check.
defer span.End()

return c.awaitAttFunc(ctx, int64(slot), int64(committeeIndex))
att, err := c.awaitAttFunc(ctx, int64(opts.Slot), int64(opts.CommitteeIndex))

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an unsigned 64-bit integer from
strconv.ParseUint
to a lower bit size type int64 without an upper bound check.
core/validatorapi/validatorapi.go Dismissed Show dismissed Hide dismissed
core/validatorapi/validatorapi.go Dismissed Show dismissed Hide dismissed
core/validatorapi/validatorapi.go Dismissed Show dismissed Hide dismissed
awaitSyncContributionFunc func(ctx context.Context, slot, subcommIdx int64, beaconBlockRoot eth2p0.Root) (*altair.SyncCommitteeContribution, error)
awaitAggAttFunc func(ctx context.Context, slot int64, attestationRoot eth2p0.Root) (*eth2p0.Attestation, error)
awaitAggSigDBFunc func(context.Context, core.Duty, core.PubKey) (core.SignedData, error)
dutyDefFunc func(ctx context.Context, duty core.Duty) (core.DutyDefinitionSet, error)
subs []func(context.Context, core.Duty, core.ParSignedDataSet) error
}

func (c *Component) Proposal(ctx context.Context, opts *eth2api.ProposalOpts) (*eth2api.Response[*eth2api.VersionedProposal], error) {
// Get proposer pubkey (this is a blocking query).
pubkey, err := c.getProposerPubkey(ctx, core.NewProposerDuty(int64(opts.Slot)))

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an unsigned 64-bit integer from
strconv.ParseUint
to a lower bit size type int64 without an upper bound check.
Signature: opts.RandaoReveal,
}

duty := core.NewRandaoDuty(int64(opts.Slot))

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an unsigned 64-bit integer from
strconv.ParseUint
to a lower bit size type int64 without an upper bound check.

func (c *Component) BlindedProposal(ctx context.Context, opts *eth2api.BlindedProposalOpts) (*eth2api.Response[*eth2api.VersionedBlindedProposal], error) {
// Get proposer pubkey (this is a blocking query).
pubkey, err := c.getProposerPubkey(ctx, core.NewBuilderProposerDuty(int64(opts.Slot)))

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an unsigned 64-bit integer from
strconv.ParseUint
to a lower bit size type int64 without an upper bound check.
Signature: opts.RandaoReveal,
}

duty := core.NewRandaoDuty(int64(opts.Slot))

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an unsigned 64-bit integer from
strconv.ParseUint
to a lower bit size type int64 without an upper bound check.
@xenowits
Copy link
Contributor Author

FYI: This PR also solves #2477

app/eth2wrap/synthproposer.go Outdated Show resolved Hide resolved
core/dutydb/memory.go Outdated Show resolved Hide resolved
core/dutydb/memory.go Outdated Show resolved Hide resolved
core/eth2signeddata.go Outdated Show resolved Hide resolved
core/fetcher/fetcher.go Outdated Show resolved Hide resolved
testutil/validatormock/propose.go Outdated Show resolved Hide resolved
testutil/validatormock/propose.go Outdated Show resolved Hide resolved
core/validatorapi/validatorapi.go Outdated Show resolved Hide resolved
core/validatorapi/validatorapi.go Outdated Show resolved Hide resolved
core/validatorapi/validatorapi.go Outdated Show resolved Hide resolved
app/eth2wrap/synthproposer_test.go Show resolved Hide resolved
core/unsigneddata.go Show resolved Hide resolved
testutil/fuzz.go Outdated Show resolved Hide resolved
testutil/fuzz.go Show resolved Hide resolved
core/validatorapi/router.go Show resolved Hide resolved
// Query unsigned block (this is blocking).
block, err := c.awaitBlockFunc(ctx, int64(slot))
// Query unsigned proposal (this is blocking).
proposal, err := c.awaitProposalFunc(ctx, int64(opts.Slot))

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an unsigned 64-bit integer from
strconv.ParseUint
to a lower bit size type int64 without an upper bound check.
@@ -446,17 +407,56 @@
// - Once inserted, the query below will return.

// Query unsigned block (this is blocking).
block, err := c.awaitBlindedBlockFunc(ctx, int64(slot))
proposal, err := c.awaitBlindedProposalFunc(ctx, int64(opts.Slot))

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an unsigned 64-bit integer from
strconv.ParseUint
to a lower bit size type int64 without an upper bound check.
@sonarcloud
Copy link

sonarcloud bot commented Oct 30, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 18 Code Smells

No Coverage information No Coverage information
3.2% 3.2% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@xenowits xenowits added the merge when ready Indicates bulldozer bot may merge when all checks pass label Oct 30, 2023
@obol-bulldozer obol-bulldozer bot merged commit 4632e21 into main Oct 30, 2023
13 of 15 checks passed
@obol-bulldozer obol-bulldozer bot deleted the xenowits/fix-eth2-client branch October 30, 2023 10:20
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.

None yet

3 participants