revert: feat: add binary codec with backward-compatible migration (#5419)#5501
Merged
Conversation
)" This reverts commit f53887f.
martinconic
approved these changes
Jun 12, 2026
sbackend123
approved these changes
Jun 12, 2026
Member
Author
|
Reasons for reverts are bellow. Here are issues that are detected in the logs of the public-testnet related to this: And if we run this tests, they will fail: // TestUnmarshalBinaryLegacyFormats verifies that UnmarshalBinary accepts the
// two legacy on-disk encodings the statestore produced before the Gob codec:
// unquoted decimals from json.Marshal(*big.Int) (including negatives, which
// triggered "encoding version 22 not supported") and quoted decimal strings
// from json.Marshal(bigint.BigInt). This is the backward-compatibility path
// that lets nodes read balances written by older code regardless of migration.
func TestUnmarshalBinaryLegacyFormats(t *testing.T) {
t.Parallel()
tests := []struct {
name string
data []byte
want *big.Int
}{
{"decimal positive", []byte("123456"), big.NewInt(123456)},
{"decimal negative", []byte("-123456"), big.NewInt(-123456)},
{"decimal zero", []byte("0"), big.NewInt(0)},
{"quoted positive", []byte(`"123456"`), big.NewInt(123456)},
{"quoted negative", []byte(`"-987654321"`), big.NewInt(-987654321)},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
var got bigint.BigInt
if err := got.UnmarshalBinary(tc.data); err != nil {
t.Fatalf("UnmarshalBinary(%q): %v", tc.data, err)
}
if got.Cmp(tc.want) != 0 {
t.Fatalf("got %v, want %v", got.Int, tc.want)
}
})
}
}
func TestUnmarshalBinaryInvalidDecimal(t *testing.T) {
t.Parallel()
var w bigint.BigInt
if err := w.UnmarshalBinary([]byte("not-a-number")); err == nil {
t.Fatal("expected error on invalid decimal data, got nil")
}
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
Description
Reverts #5419 (commit f53887f). Conflicts in accounting.go and migration.go from later commits (#5439, #5415, #5477) were resolved manually.
Open API Spec Version Changes (if applicable)
Motivation and Context (Optional)
Related Issue (Optional)
Screenshots (if appropriate):
AI Disclosure