Skip to content

all: update golang/x/ext and fix slice sorting fallout#27909

Merged
fjl merged 6 commits intoethereum:masterfrom
karalabe:sortupdate
Aug 11, 2023
Merged

all: update golang/x/ext and fix slice sorting fallout#27909
fjl merged 6 commits intoethereum:masterfrom
karalabe:sortupdate

Conversation

@karalabe
Copy link
Copy Markdown
Member

@karalabe karalabe commented Aug 11, 2023

The Go authors updated golang/x/ext to change the function signature of the slices sort method. It's an entire shitshow now because x/ext is not tagged, so everyone's codebase just picked a new version that some other dep depends on, causing our code to fail building.

This PR updates the dep on our code too and does all the refactorings to follow upstream...

Fixes #27897

@karalabe karalabe added this to the 1.13.0 milestone Aug 11, 2023
slices.SortFunc(badBlocks, func(a, b *badBlock) int {
// Note: sorting in descending number order.
return a.Header.Number.Uint64() >= b.Header.Number.Uint64()
return -a.Header.Number.Cmp(b.Header.Number)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
return -a.Header.Number.Cmp(b.Header.Number)
return b.Header.Number.Cmp(a.Header.Number)

Alternative version is to just swap the arguments. Use with whichever you feel like

Comment thread p2p/protocol.go Outdated

// Less defines the canonical sorting order of capabilities.
func (cap Cap) Less(other Cap) bool {
func (cap Cap) Less(other Cap) int {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
func (cap Cap) Less(other Cap) int {
func (cap Cap) Cmp(other Cap) int {

Wouldn't that be more correct? Adds more fallout, sorry ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah yes, indeed

Copy link
Copy Markdown
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM

@fjl fjl merged commit be65b47 into ethereum:master Aug 11, 2023
@fjl fjl modified the milestones: 1.13.0, 1.12.2 Aug 11, 2023
fjl pushed a commit that referenced this pull request Aug 12, 2023
The Go authors updated golang/x/ext to change the function signature of the slices sort method. 
It's an entire shitshow now because x/ext is not tagged, so everyone's codebase just 
picked a new version that some other dep depends on, causing our code to fail building.

This PR updates the dep on our code too and does all the refactorings to follow upstream...
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
The Go authors updated golang/x/ext to change the function signature of the slices sort method. 
It's an entire shitshow now because x/ext is not tagged, so everyone's codebase just 
picked a new version that some other dep depends on, causing our code to fail building.

This PR updates the dep on our code too and does all the refactorings to follow upstream...
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
gartnera added a commit to zeta-chain/ethermint that referenced this pull request Jul 24, 2024
We cannot upgrade beyond 1.12.1 because of the x/ext slices mess:
- ethereum/go-ethereum#27909
- cosmos/cosmos-sdk#20159
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 13, 2024
gzliudan pushed a commit to gzliudan/XDPoSChain that referenced this pull request Jun 26, 2025
Co-authored-by: Felix Lange <fjl@twurst.com>
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Oct 30, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Oct 30, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Nov 28, 2025
AnilChinchawale pushed a commit to XinFinOrg/XDPoSChain that referenced this pull request Dec 7, 2025
gzliudan pushed a commit to gzliudan/XDPoSChain that referenced this pull request Jan 26, 2026
Co-authored-by: Felix Lange <fjl@twurst.com>
gzliudan pushed a commit to gzliudan/XDPoSChain that referenced this pull request Jan 26, 2026
Co-authored-by: Felix Lange <fjl@twurst.com>
gzliudan pushed a commit to gzliudan/XDPoSChain that referenced this pull request Jan 26, 2026
Co-authored-by: Felix Lange <fjl@twurst.com>
AnilChinchawale pushed a commit to XinFinOrg/XDPoSChain that referenced this pull request Jan 29, 2026
…1163)

Co-authored-by: Dan Laine <daniel.laine@avalabs.org>
Co-authored-by: Felix Lange <fjl@twurst.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.

could not load export data: no export data for "github.com/ethereum/go-ethereum/metrics"

3 participants