chore: remove backwards compatibility with 2.6.0#5415
Conversation
|
@sbackend123 I think that removing all migration code might be a bit too eager - can you make sure that the migration code covers the currently active bee node version still showing up in swarmscan? |
I agree, as there are still 2.6 nodes (not many, but still ~6%), it is early to release bee without compatibility. This code is intended to be temporary. It is a good effort, but I would suggest to hold on merging, for some time. |
I ran the previous bee version (v2.6.0) locally, let it sync to current block height on maiinet and build a real data directory. Then I started this build on the same data directory without clearing it. The node started successfully with no migration errors. I also ran earlier versions trying to sync with mainnet, but get error |
I suppose it does not error the migrations because there's nothing to do in the migrations in the current build. I am not 100% sure about the reasoning behind the necessity of those migrations. But we should definitely leave in place the migration code to support the migration path from the node version still running on the network (2.6.0 definitely). The older ones we can mark as nops. |
Those 2.6.0 nodes are on some |
|
@sbackend123 this needs a rebase |
acud
left a comment
There was a problem hiding this comment.
there's a whole chunk of changes that are in pkg/storer/migration/all_steps.go that is completely not touched but the code can probably also be removed. as for the individual migration steps which are not in use already - there's no need of keeping the files with empty functions that do nothing - those can be removed.
|
|
||
| func firstByteString(data []byte) string { | ||
| if len(data) == 0 { | ||
| return "none" |
| // step_02 was a migration step that migrated the cache to a new format. | ||
| // It is now a NOOP since all nodes have already run this migration, | ||
| // and new nodes start with an empty database. | ||
| func step_02(_ transaction.Storage) func() error { |
There was a problem hiding this comment.
if this is not used anywhere - why do we need to keep the file?
…2.6.0 # Conflicts: # pkg/p2p/libp2p/version_test.go # pkg/statestore/storeadapter/migration.go # pkg/storer/internal/reserve/olditems.go # pkg/storer/migration/refCntSize.go # pkg/storer/migration/step_02.go # pkg/storer/migration/step_04_test.go # pkg/storer/migration/step_05.go # pkg/storer/migration/step_05_test.go # pkg/storer/migration/step_06.go # pkg/storer/migration/step_06_test.go
Add test. Move db repair tool.
If I understand everything correctly, we can't remove it completely because of our migration mechanism. |
|
|
||
| func (a *Address) UnmarshalJSON(b []byte) error { | ||
| v := &addressJSON{} | ||
| err := json.Unmarshal(b, v) |
There was a problem hiding this comment.
Nice work @sbackend123.
I just have a concern here, what will happen for the 2.6.0 nodes here ? because I see you removed Underlay field from addressJSON, I know this is not needed anymore, but in the Unmarshal the node will have the Underlays filed empty.
Maybe we can keep it in addressJSON (just to for the Unmarshal) and we get that Underlay addr and set it to Underlays slice
Right or maybe I'm missing some parts ?
There was a problem hiding this comment.
This is main point, we remove compatibility with 2.6.0 so minimal supported version would be 2.7.0. So we force everybody update their versions
There was a problem hiding this comment.
Yes, I know.
I’m just thinking out loud, if I were a node operator on 2.6.0 or earlier, I might suddenly get disconnected without really understanding why. That could be a bit confusing.
But as @janos mentioned, those nodes are only around 6%, so the impact seems pretty small.
| 5: noop, | ||
| 6: noop, | ||
| 7: noop, | ||
| 8: noop, |
There was a problem hiding this comment.
like in the other migrations comment - the sequence and indexes of these migrations should be commented such that they aren't removed in the future
acud
left a comment
There was a problem hiding this comment.
LGTM but will need a squash + rebase after the upcoming release
…2.6.0 # Conflicts: # pkg/bzz/address.go # pkg/bzz/address_test.go # pkg/bzz/export_test.go # pkg/bzz/underlay.go # pkg/bzz/underlay_test.go # pkg/hive/hive.go # pkg/p2p/libp2p/internal/handshake/handshake.go # pkg/p2p/libp2p/libp2p.go # pkg/statestore/storeadapter/migration.go
|
@sbackend123 linter failing |
|
@sbackend123 can you update the PR description? |
|
|
||
| // For 0 or 2+ addresses, the custom list format with the prefix is used. | ||
| // The format is: [prefix_byte][varint_len_1][addr_1_bytes]... | ||
| // The format is: [varint_len_1][addr_1_bytes]... |
There was a problem hiding this comment.
missing the prefix byte here. see comment on the left
| } | ||
| // The result is returned as a single-element slice for a consistent return type. | ||
| return []multiaddr.Multiaddr{addr}, nil | ||
| return deserializeList(data) |
There was a problem hiding this comment.
this doesn't seem right. with this change, the underlay should always start with the prefix byte. the if block above should check whether the first byte is not a prefix byte and throw if that is the case, then just deserialize like in the current if statement below (happy path not nested).
also some input length validation is needed since the deserialize call can panic on a short buffer (pass just 0x99 as the underlay)
|
|
||
| observedUnderlays, err := bzz.DeserializeUnderlays(resp.Syn.ObservedUnderlay) | ||
| if err != nil { | ||
| s.logger.Debug("handshake invalid synack observed underlay payload", "payload_len", len(resp.Syn.ObservedUnderlay), "first_byte", firstByteString(resp.Syn.ObservedUnderlay), "payload_prefix", payloadPrefix(resp.Syn.ObservedUnderlay), "error", err) |
There was a problem hiding this comment.
lots of stuff in this log line... not sure if it will be just swallowed in the rest of the logs. maybe just better to instrument the error with a tiny bit of information of what went wrong (not all the fields here). the same for the other logline
| return fmt.Sprintf("0x%02x", data[0]) | ||
| } | ||
|
|
||
| func payloadPrefix(data []byte) string { |
There was a problem hiding this comment.
not sure i understand why this is needed... maybe some info about why and how to use this... also why is n=16?
| if len(data) < n { | ||
| n = len(data) | ||
| } | ||
| return fmt.Sprintf("%x", data[:n]) |
There was a problem hiding this comment.
you can just fmt.Sprintf("%x",data[:min(16,len(data))])
Checklist
Description
Breaking changes
Handshake protocol version bump (15.0.0 → 16.0.0)
Underlay wire format — removed
underlayListPrefixand legacy single-address encoding removedThe only supported enconding is
[varint_len_1][addr_1_bytes][varint_len_2][addr_2_bytes]...Changes in detail:
Nodes on Bee 2.8.0 (15.0.0 handshake, 0x99/raw formats) are not interoperable with this build, even if both sides could otherwise reach each other over libp2p.
Open API Spec Version Changes (if applicable)
Motivation and Context (Optional)
Related Issue (Optional)
#5340
Screenshots (if appropriate):
AI Disclosure