From a2b75c2138eb187c8e50230b05025304fa269f22 Mon Sep 17 00:00:00 2001 From: lupin012 <58134934+lupin012@users.noreply.github.com> Date: Thu, 28 Nov 2024 10:14:44 +0100 Subject: [PATCH 01/25] qa-tests: bump rpc_test version and include new tests (#12894) --- .github/workflows/qa-rpc-integration-tests.yml | 2 +- .github/workflows/scripts/run_rpc_tests.sh | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/qa-rpc-integration-tests.yml b/.github/workflows/qa-rpc-integration-tests.yml index c762eaabeb2..953e6c41dac 100644 --- a/.github/workflows/qa-rpc-integration-tests.yml +++ b/.github/workflows/qa-rpc-integration-tests.yml @@ -32,7 +32,7 @@ jobs: - name: Checkout RPC Tests Repository & Install Requirements run: | rm -rf ${{ runner.workspace }}/rpc-tests - git -c advice.detachedHead=false clone --depth 1 --branch v1.20.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests + git -c advice.detachedHead=false clone --depth 1 --branch v1.22.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests cd ${{ runner.workspace }}/rpc-tests pip3 install -r requirements.txt diff --git a/.github/workflows/scripts/run_rpc_tests.sh b/.github/workflows/scripts/run_rpc_tests.sh index 5dadc6ee7d8..64dfe5d1975 100755 --- a/.github/workflows/scripts/run_rpc_tests.sh +++ b/.github/workflows/scripts/run_rpc_tests.sh @@ -8,20 +8,10 @@ disabled_tests=( trace_rawTransaction # Erigon bug https://github.com/erigontech/erigon/issues/12603 erigon_getLatestLogs - # created task https://github.com/erigontech/erigon/issues/12668 is merged - debug_traceCallMany/test_02.tar - debug_traceCallMany/test_04.tar - debug_traceCallMany/test_05.tar - debug_traceCallMany/test_06.tar - debug_traceCallMany/test_07.tar - debug_traceCallMany/test_09.json - debug_traceCallMany/test_10.tar # to investigate engine_exchangeCapabilities/test_1.json engine_exchangeTransitionConfigurationV1/test_01.json engine_getClientVersionV1/test_1.json - # waiting PR https://github.com/erigontech/rpc-tests/pull/298 to be merged - trace_replayBlockTransactions/test_29.tar # these tests requires Erigon active admin_nodeInfo/test_01.json admin_peers/test_01.json From 16db7ba21791d51507cc930c85ad68320a575f3c Mon Sep 17 00:00:00 2001 From: antonis19 Date: Thu, 28 Nov 2024 10:48:32 +0100 Subject: [PATCH 02/25] Remove rlp and bitutil from lint exclude-rules (#12895) Issue : https://github.com/erigontech/erigon/issues/12883 --------- Co-authored-by: antonis19 --- erigon-lib/.golangci.yml | 9 ++---- erigon-lib/common/bitutil/compress_test.go | 5 ++-- erigon-lib/rlp/decode.go | 34 ++++++++++++---------- erigon-lib/rlp/decode_test.go | 10 +++---- erigon-lib/rlp/raw_test.go | 10 +++---- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/erigon-lib/.golangci.yml b/erigon-lib/.golangci.yml index 2e0ddf2d260..363b8b04eea 100644 --- a/erigon-lib/.golangci.yml +++ b/erigon-lib/.golangci.yml @@ -96,15 +96,12 @@ linters-settings: issues: exclude-rules: - - path: rlp - linters: - - errorlint - - path: bitutil - linters: - - errorlint - linters: - golint text: "should be" + - linters: + - recvcheck + text: "the methods of" - linters: - errcheck text: "not checked" diff --git a/erigon-lib/common/bitutil/compress_test.go b/erigon-lib/common/bitutil/compress_test.go index 0393b5380a7..b970aff6d00 100644 --- a/erigon-lib/common/bitutil/compress_test.go +++ b/erigon-lib/common/bitutil/compress_test.go @@ -21,6 +21,7 @@ package bitutil import ( "bytes" + "errors" "math/rand" "testing" @@ -107,7 +108,7 @@ func TestDecodingCycle(t *testing.T) { data := hexutil.MustDecode(tt.input) orig, err := bitsetDecodeBytes(data, tt.size) - if err != tt.fail { + if !errors.Is(err, tt.fail) { t.Errorf("test %d: failure mismatch: have %v, want %v", i, err, tt.fail) } if err != nil { @@ -143,7 +144,7 @@ func TestCompression(t *testing.T) { t.Errorf("decoding mismatch for dense data: have %x, want %x, error %v", data, in, err) } // Check that decompressing a longer input than the target fails - if _, err := DecompressBytes([]byte{0xc0, 0x01, 0x01}, 2); err != errExceededTarget { + if _, err := DecompressBytes([]byte{0xc0, 0x01, 0x01}, 2); !errors.Is(err, errExceededTarget) { t.Errorf("decoding error mismatch for long data: have %v, want %v", err, errExceededTarget) } } diff --git a/erigon-lib/rlp/decode.go b/erigon-lib/rlp/decode.go index 206291e86db..149a4a4c980 100644 --- a/erigon-lib/rlp/decode.go +++ b/erigon-lib/rlp/decode.go @@ -157,18 +157,18 @@ func (err *decodeError) Error() string { } func wrapStreamError(err error, typ reflect.Type) error { - switch err { - case ErrCanonInt: + switch { + case errors.Is(err, ErrCanonInt): return &decodeError{msg: "non-canonical integer (leading zero bytes)", typ: typ} - case ErrCanonSize: + case errors.Is(err, ErrCanonSize): return &decodeError{msg: "non-canonical size information", typ: typ} - case ErrExpectedList: + case errors.Is(err, ErrExpectedList): return &decodeError{msg: "expected input list", typ: typ} - case ErrExpectedString: + case errors.Is(err, ErrExpectedString): return &decodeError{msg: "expected input string or byte", typ: typ} - case errUintOverflow: + case errors.Is(err, errUintOverflow): return &decodeError{msg: "input string too long", typ: typ} - case errNotAtEOL: + case errors.Is(err, errNotAtEOL): return &decodeError{msg: "input list has too many elements", typ: typ} } return err @@ -179,7 +179,8 @@ func WrapStreamError(err error, typ reflect.Type) error { } func addErrorContext(err error, ctx string) error { - if decErr, ok := err.(*decodeError); ok { + var decErr *decodeError + if errors.As(err, &decErr) { decErr.ctx = append(decErr.ctx, ctx) } return err @@ -368,7 +369,7 @@ func decodeSliceElems(s *Stream, val reflect.Value, elemdec decoder) error { val.SetLen(i + 1) } // decode into element - if err := elemdec(s, val.Index(i)); err == EOL { + if err := elemdec(s, val.Index(i)); errors.Is(err, EOL) { break } else if err != nil { return addErrorContext(err, fmt.Sprint("[", i, "]")) @@ -387,7 +388,7 @@ func decodeListArray(s *Stream, val reflect.Value, elemdec decoder) error { vlen := val.Len() i := 0 for ; i < vlen; i++ { - if err := elemdec(s, val.Index(i)); err == EOL { + if err := elemdec(s, val.Index(i)); errors.Is(err, EOL) { break } else if err != nil { return addErrorContext(err, fmt.Sprint("[", i, "]")) @@ -461,7 +462,7 @@ func makeStructDecoder(typ reflect.Type) (decoder, error) { } for i, f := range fields { err := f.info.decoder(s, val.Field(f.index)) - if err == EOL { + if errors.Is(err, EOL) { if f.optional { // The field is optional, so reaching the end of the list before // reaching the last field is acceptable. All remaining undecoded @@ -756,7 +757,7 @@ func (s *Stream) uint(maxbits int) (uint64, error) { } v, err := s.readUint(byte(size)) switch { - case err == ErrCanonSize: + case errors.Is(err, ErrCanonSize): // Adjust error because we're not reading a size right now. return 0, ErrCanonInt case err != nil: @@ -904,7 +905,8 @@ func (s *Stream) Decode(val interface{}) error { } err = dcd(s, rval.Elem()) - if decErr, ok := err.(*decodeError); ok && len(decErr.ctx) > 0 { + var decErr *decodeError + if errors.As(err, &decErr) && len(decErr.ctx) > 0 { // add decode target type to error so context has more meaning decErr.ctx = append(decErr.ctx, fmt.Sprint("(", rtyp.Elem(), ")")) } @@ -1000,10 +1002,10 @@ func (s *Stream) readKind() (kind Kind, size uint64, err error) { if len(s.stack) == 0 { // At toplevel, Adjust the error to actual EOF. io.EOF is // used by callers to determine when to stop decoding. - switch err { - case io.ErrUnexpectedEOF: + switch { + case errors.Is(err, io.ErrUnexpectedEOF): err = io.EOF - case ErrValueTooLarge: + case errors.Is(err, ErrValueTooLarge): err = io.EOF } } diff --git a/erigon-lib/rlp/decode_test.go b/erigon-lib/rlp/decode_test.go index 85c94751288..c4f92bb1f5c 100644 --- a/erigon-lib/rlp/decode_test.go +++ b/erigon-lib/rlp/decode_test.go @@ -248,7 +248,7 @@ func TestStreamList(t *testing.T) { } } - if _, err := s.Uint(); err != EOL { + if _, err := s.Uint(); !errors.Is(err, EOL) { t.Errorf("Uint error mismatch, got %v, want %v", err, EOL) } if err := s.ListEnd(); err != nil { @@ -290,16 +290,16 @@ func TestStreamRaw(t *testing.T) { func TestDecodeErrors(t *testing.T) { r := bytes.NewReader(nil) - if err := Decode(r, nil); err != errDecodeIntoNil { + if err := Decode(r, nil); !errors.Is(err, errDecodeIntoNil) { t.Errorf("Decode(r, nil) error mismatch, got %q, want %q", err, errDecodeIntoNil) } var nilptr *struct{} - if err := Decode(r, nilptr); err != errDecodeIntoNil { + if err := Decode(r, nilptr); !errors.Is(err, errDecodeIntoNil) { t.Errorf("Decode(r, nilptr) error mismatch, got %q, want %q", err, errDecodeIntoNil) } - if err := Decode(r, struct{}{}); err != errNoPointer { + if err := Decode(r, struct{}{}); !errors.Is(err, errNoPointer) { t.Errorf("Decode(r, struct{}{}) error mismatch, got %q, want %q", err, errNoPointer) } @@ -308,7 +308,7 @@ func TestDecodeErrors(t *testing.T) { t.Errorf("Decode(r, new(chan bool)) error mismatch, got %q, want %q", err, expectErr) } - if err := Decode(r, new(uint)); err != io.EOF { + if err := Decode(r, new(uint)); !errors.Is(err, io.EOF) { t.Errorf("Decode(r, new(int)) error mismatch, got %q, want %q", err, io.EOF) } } diff --git a/erigon-lib/rlp/raw_test.go b/erigon-lib/rlp/raw_test.go index 6b606ce6c47..c5d71c3dcdc 100644 --- a/erigon-lib/rlp/raw_test.go +++ b/erigon-lib/rlp/raw_test.go @@ -65,13 +65,13 @@ func TestCountValues(t *testing.T) { } func TestSplitTypes(t *testing.T) { - if _, _, err := SplitString(unhex("C100")); err != ErrExpectedString { + if _, _, err := SplitString(unhex("C100")); !errors.Is(err, ErrExpectedString) { t.Errorf("SplitString returned %q, want %q", err, ErrExpectedString) } - if _, _, err := SplitList(unhex("01")); err != ErrExpectedList { + if _, _, err := SplitList(unhex("01")); !errors.Is(err, ErrExpectedList) { t.Errorf("SplitString returned %q, want %q", err, ErrExpectedList) } - if _, _, err := SplitList(unhex("81FF")); err != ErrExpectedList { + if _, _, err := SplitList(unhex("81FF")); !errors.Is(err, ErrExpectedList) { t.Errorf("SplitString returned %q, want %q", err, ErrExpectedList) } } @@ -197,7 +197,7 @@ func TestSplit(t *testing.T) { if !bytes.Equal(rest, unhex(test.rest)) { t.Errorf("test %d: rest mismatch: got %x, want %s", i, rest, test.rest) } - if err != test.err { + if !errors.Is(err, test.err) { t.Errorf("test %d: error mismatch: got %q, want %q", i, err, test.err) } } @@ -235,7 +235,7 @@ func TestReadSize(t *testing.T) { for _, test := range tests { size, err := readSize(unhex(test.input), test.slen) - if err != test.err { + if !errors.Is(err, test.err) { t.Errorf("readSize(%s, %d): error mismatch: got %q, want %q", test.input, test.slen, err, test.err) continue } From 1823fa21174476e01a7d71a279ec27bd14d56569 Mon Sep 17 00:00:00 2001 From: Ostroukhov Nikita Date: Thu, 28 Nov 2024 13:50:26 +0000 Subject: [PATCH 03/25] Added metrics to track wiggles in polygon (#12888) --- eth/stagedsync/stage_polygon_sync.go | 12 +++- .../sync/canonical_chain_builder_factory.go | 6 +- polygon/sync/metrics.go | 31 ++++++++++ polygon/sync/service.go | 12 +++- polygon/sync/sync.go | 27 ++++++++ polygon/sync/wiggle.go | 62 +++++++++++++++++++ 6 files changed, 143 insertions(+), 7 deletions(-) create mode 100644 polygon/sync/metrics.go create mode 100644 polygon/sync/wiggle.go diff --git a/eth/stagedsync/stage_polygon_sync.go b/eth/stagedsync/stage_polygon_sync.go index 290e4346bd3..ea5a0dd9d4e 100644 --- a/eth/stagedsync/stage_polygon_sync.go +++ b/eth/stagedsync/stage_polygon_sync.go @@ -25,6 +25,8 @@ import ( "golang.org/x/sync/errgroup" + lru "github.com/hashicorp/golang-lru/arc/v2" + "github.com/erigontech/erigon-lib/chain" "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/generics" @@ -44,6 +46,7 @@ import ( "github.com/erigontech/erigon/polygon/bridge" "github.com/erigontech/erigon/polygon/heimdall" "github.com/erigontech/erigon/polygon/p2p" + "github.com/erigontech/erigon/polygon/sync" polygonsync "github.com/erigontech/erigon/polygon/sync" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/shards" @@ -115,6 +118,12 @@ func NewPolygonSyncStageCfg( checkpointVerifier := polygonsync.VerifyCheckpointHeaders milestoneVerifier := polygonsync.VerifyMilestoneHeaders blocksVerifier := polygonsync.VerifyBlocks + + signaturesCache, err := lru.NewARC[common.Hash, common.Address](sync.InMemorySignatures) + if err != nil { + panic(err) + } + syncStore := polygonsync.NewStore(logger, executionEngine, bridgeService) blockDownloader := polygonsync.NewBlockDownloader( logger, @@ -135,11 +144,12 @@ func NewPolygonSyncStageCfg( blocksVerifier, p2pService, blockDownloader, - polygonsync.NewCanonicalChainBuilderFactory(chainConfig, borConfig, heimdallService), + polygonsync.NewCanonicalChainBuilderFactory(chainConfig, borConfig, heimdallService, signaturesCache), heimdallService, bridgeService, events.Events(), notifications, + sync.NewWiggleCalculator(borConfig, signaturesCache, heimdallService), ) syncService := &polygonSyncStageService{ logger: logger, diff --git a/polygon/sync/canonical_chain_builder_factory.go b/polygon/sync/canonical_chain_builder_factory.go index 72314d57161..0a25621ee4a 100644 --- a/polygon/sync/canonical_chain_builder_factory.go +++ b/polygon/sync/canonical_chain_builder_factory.go @@ -33,12 +33,8 @@ func NewCanonicalChainBuilderFactory( chainConfig *chain.Config, borConfig *borcfg.BorConfig, blockProducersReader blockProducersReader, + signaturesCache *lru.ARCCache[common.Hash, common.Address], ) CanonicalChainBuilderFactory { - signaturesCache, err := lru.NewARC[common.Hash, common.Address](InMemorySignatures) - if err != nil { - panic(err) - } - difficultyCalculator := &DifficultyCalculator{ borConfig: borConfig, signaturesCache: signaturesCache, diff --git a/polygon/sync/metrics.go b/polygon/sync/metrics.go new file mode 100644 index 00000000000..a2815bef920 --- /dev/null +++ b/polygon/sync/metrics.go @@ -0,0 +1,31 @@ +// Copyright 2024 The Erigon Authors +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package sync + +import ( + "time" + + "github.com/erigontech/erigon-lib/metrics" +) + +var ( + wiggleDuration = metrics.NewSummary(`wiggle_duration`) +) + +func UpdateWiggleDuration(duration time.Duration) { + wiggleDuration.ObserveDuration(time.Now().Add(-duration)) +} diff --git a/polygon/sync/service.go b/polygon/sync/service.go index a1eef4132c2..06406b7c111 100644 --- a/polygon/sync/service.go +++ b/polygon/sync/service.go @@ -22,7 +22,10 @@ import ( "golang.org/x/sync/errgroup" + lru "github.com/hashicorp/golang-lru/arc/v2" + "github.com/erigontech/erigon-lib/chain" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/gointerfaces/executionproto" "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/log/v3" @@ -52,6 +55,12 @@ func NewService( blocksVerifier := VerifyBlocks p2pService := p2p.NewService(logger, maxPeers, sentryClient, statusDataProvider.GetStatusData) execution := newExecutionClient(executionClient) + + signaturesCache, err := lru.NewARC[common.Hash, common.Address](InMemorySignatures) + if err != nil { + panic(err) + } + store := NewStore(logger, execution, bridgeService) blockDownloader := NewBlockDownloader( logger, @@ -63,7 +72,7 @@ func NewService( store, blockLimit, ) - ccBuilderFactory := NewCanonicalChainBuilderFactory(chainConfig, borConfig, heimdallService) + ccBuilderFactory := NewCanonicalChainBuilderFactory(chainConfig, borConfig, heimdallService, signaturesCache) events := NewTipEvents(logger, p2pService, heimdallService) sync := NewSync( logger, @@ -78,6 +87,7 @@ func NewService( bridgeService, events.Events(), notifications, + NewWiggleCalculator(borConfig, signaturesCache, heimdallService), ) return &Service{ logger: logger, diff --git a/polygon/sync/sync.go b/polygon/sync/sync.go index 10ad46d2798..c2f702bafcd 100644 --- a/polygon/sync/sync.go +++ b/polygon/sync/sync.go @@ -46,6 +46,10 @@ type bridgeSynchronizer interface { Ready(ctx context.Context) <-chan error } +type wiggleCalculator interface { + CalculateWiggle(ctx context.Context, header *types.Header) (time.Duration, error) +} + func NewSync( logger log.Logger, store Store, @@ -59,6 +63,7 @@ func NewSync( bridgeSync bridgeSynchronizer, events <-chan Event, notifications *shards.Notifications, + wiggleCalculator wiggleCalculator, ) *Sync { badBlocksLru, err := simplelru.NewLRU[common.Hash, struct{}](1024, nil) if err != nil { @@ -79,6 +84,7 @@ func NewSync( events: events, badBlocks: badBlocksLru, notifications: notifications, + wiggleCalculator: wiggleCalculator, } } @@ -96,6 +102,7 @@ type Sync struct { events <-chan Event badBlocks *simplelru.LRU[common.Hash, struct{}] notifications *shards.Notifications + wiggleCalculator wiggleCalculator } func (s *Sync) commitExecution(ctx context.Context, newTip *types.Header, finalizedHeader *types.Header) error { @@ -306,6 +313,26 @@ func (s *Sync) applyNewBlockOnTip(ctx context.Context, event EventNewBlock, ccb return nil } + go func() { + for i := range newConnectedHeaders { + select { + case <-ctx.Done(): + return + default: + wiggle, err := s.wiggleCalculator.CalculateWiggle(ctx, newConnectedHeaders[i]) + if err != nil { + s.logger.Error( + syncLogPrefix("failed update wiggle metrics"), + "err", err, + ) + continue + } + + UpdateWiggleDuration(wiggle) + } + } + }() + newTip := ccb.Tip() firstNewConnectedHeader := newConnectedHeaders[0] if newTip != oldTip && oldTip.Hash() != firstNewConnectedHeader.ParentHash { diff --git a/polygon/sync/wiggle.go b/polygon/sync/wiggle.go new file mode 100644 index 00000000000..db148cd2caf --- /dev/null +++ b/polygon/sync/wiggle.go @@ -0,0 +1,62 @@ +// Copyright 2024 The Erigon Authors +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package sync + +import ( + "context" + "time" + + libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/polygon/bor" + "github.com/erigontech/erigon/polygon/bor/borcfg" + lru "github.com/hashicorp/golang-lru/arc/v2" +) + +type wiggleCalc struct { + borConfig *borcfg.BorConfig + signaturesCache *lru.ARCCache[libcommon.Hash, libcommon.Address] + blockProducersReader blockProducersReader +} + +func NewWiggleCalculator(borConfig *borcfg.BorConfig, signaturesCache *lru.ARCCache[libcommon.Hash, libcommon.Address], blockProducersReader blockProducersReader) *wiggleCalc { + return &wiggleCalc{ + borConfig: borConfig, + signaturesCache: signaturesCache, + blockProducersReader: blockProducersReader, + } +} + +func (calc *wiggleCalc) CalculateWiggle(ctx context.Context, header *types.Header) (time.Duration, error) { + signer, err := bor.Ecrecover(header, calc.signaturesCache, calc.borConfig) + if err != nil { + return 0, err + } + + producers, err := calc.blockProducersReader.Producers(ctx, header.Number.Uint64()) + if err != nil { + return 0, err + } + + succession, err := producers.GetSignerSuccessionNumber(signer, header.Number.Uint64()) + if err != nil { + return 0, err + } + + wiggle := time.Duration(succession) * time.Duration(calc.borConfig.CalculateBackupMultiplier(header.Number.Uint64())) * time.Second + return wiggle, nil +} From cd418eb8e564751f3f0a7a33f40b5a7882d80cf4 Mon Sep 17 00:00:00 2001 From: Somnath Date: Thu, 28 Nov 2024 20:22:59 +0400 Subject: [PATCH 04/25] =?UTF-8?q?Revert=20"Move=20turbo/trie=20and=20core/?= =?UTF-8?q?types/accounts=20to=20erigon-lib=20(#=E2=80=A6=20(#12903)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …#12879)" This reverts commit bc03aef37692b1d3eb3e8fa481b63efb34a52892. Has to be reverted due to RLP decoding related issue in ForkchoicUpdate and MiningLoop --- accounts/abi/abi_test.go | 2 +- accounts/abi/bind/backends/simulated.go | 2 +- accounts/abi/bind/backends/simulated_test.go | 4 +- accounts/abi/bind/base_test.go | 2 +- accounts/abi/bind/util_test.go | 4 +- accounts/abi/event_test.go | 2 +- accounts/abi/pack.go | 2 +- accounts/abi/pack_test.go | 2 +- accounts/abi/unpack_test.go | 2 +- cl/beacon/handler/rewards_test.go | 2 +- cl/beacon/handler/states_test.go | 2 +- cl/beacon/handler/validator_test.go | 2 +- cmd/abigen/main.go | 2 +- cmd/capcli/cli.go | 2 +- cmd/caplin/caplincli/config.go | 2 +- cmd/devnet/contracts/gen_subscription.go | 2 +- .../polygon/heimdallsim/heimdall_simulator.go | 2 +- cmd/devnet/services/polygon/proofgenerator.go | 4 +- .../services/polygon/proofgenerator_test.go | 2 +- cmd/downloader/main.go | 2 +- cmd/evm/internal/t8ntool/execution.go | 2 +- cmd/evm/internal/t8ntool/gen_stenv.go | 2 +- cmd/evm/internal/t8ntool/transition.go | 2 +- cmd/hack/db/lmdb.go | 2 +- cmd/hack/flow/flow.go | 2 +- cmd/hack/hack.go | 4 +- cmd/integration/commands/refetence_db.go | 2 +- cmd/integration/commands/state_stages.go | 2 +- cmd/observer/observer/handshake.go | 4 +- cmd/observer/observer/server.go | 2 +- cmd/pics/contracts/gen_token.go | 2 +- cmd/pics/state.go | 4 +- cmd/rlpdump/main.go | 2 +- cmd/rpcdaemon/cli/config.go | 4 +- cmd/rpcdaemon/rpcdaemontest/test_util.go | 2 +- cmd/rpcdaemon/rpcservices/eth_backend.go | 2 +- cmd/rpctest/rpctest/account_range_verify.go | 2 +- cmd/sentry/main.go | 2 +- cmd/state/commands/global_flags_vars.go | 2 +- cmd/state/commands/opcode_tracer.go | 2 +- cmd/state/stats/index_stats.go | 2 +- cmd/state/verify/check_indexes.go | 2 +- cmd/txpool/main.go | 4 +- cmd/utils/flags.go | 4 +- cmd/verkle/main.go | 4 +- cmd/verkle/verkletrie/incrementAccount.go | 4 +- cmd/verkle/verkletrie/incrementStorage.go | 4 +- cmd/verkle/verkletrie/pedersen_hashstate.go | 6 +- cmd/verkle/verkletrie/verkle_tree_writer.go | 6 +- cmd/verkle/verkletrie/workers.go | 4 +- .../common => common}/bitutil/bitutil.go | 0 .../common => common}/bitutil/bitutil_test.go | 8 - .../common => common}/bitutil/compress.go | 0 .../bitutil/compress_test.go | 1 - common/bytes.go | 130 +++ {erigon-lib/common => common}/bytes_test.go | 4 +- .../common => common}/compiler/helpers.go | 0 .../common => common}/compiler/solidity.go | 0 .../common => common}/compiler/test.v.py | 0 .../common => common}/compiler/test_bad.v.py | 0 .../common => common}/compiler/vyper.go | 0 .../common => common}/compiler/vyper_test.go | 1 - {erigon-lib/common => common}/debug.go | 0 .../common => common}/debug/callers.go | 0 .../common => common}/debug/log_panic.go | 0 .../common => common}/debug/pprof_cgo.go | 0 {core => common}/debugprint/receipts.go | 0 .../common => common}/fdlimit/fdlimit_bsd.go | 0 .../fdlimit/fdlimit_darwin.go | 0 .../common => common}/fdlimit/fdlimit_test.go | 0 .../common => common}/fdlimit/fdlimit_unix.go | 0 .../fdlimit/fdlimit_windows.go | 0 .../common => common}/mclock/mclock.go | 0 {erigon-lib/common => common}/mclock/mclock.s | 0 .../common => common}/mclock/simclock.go | 0 .../common => common}/mclock/simclock_test.go | 0 {erigon-lib/common => common}/path.go | 0 {erigon-lib/common => common}/paths/paths.go | 0 {erigon-lib/common => common}/prque/prque.go | 0 .../common => common}/prque/prque_test.go | 0 {erigon-lib/common => common}/prque/sstack.go | 0 .../common => common}/prque/sstack_test.go | 0 {erigon-lib/common => common}/size.go | 0 {erigon-lib/common => common}/size_test.go | 0 {erigon-lib/common => common}/test_utils.go | 2 +- {erigon-lib/common => common}/tuples.go | 0 {erigon-lib/common => common}/tuples_test.go | 0 {erigon-lib/common => common}/types.go | 24 +- {erigon-lib/common => common}/types_test.go | 32 +- common/u256/big.go | 36 + consensus/aura/aura.go | 2 +- consensus/aura/aura_test.go | 2 +- consensus/aura/config.go | 2 +- consensus/aura/empty_step.go | 2 +- consensus/aura/validators.go | 4 +- consensus/clique/clique.go | 6 +- consensus/consensus.go | 2 +- consensus/ethash/algorithm.go | 4 +- consensus/ethash/consensus.go | 4 +- consensus/ethash/ethash.go | 2 +- consensus/ethash/meter.go | 2 +- consensus/result.go | 2 +- core/blockchain.go | 4 +- core/chain_makers.go | 4 +- core/forkid/forkid_test.go | 2 +- core/genesis_test.go | 2 +- core/genesis_write.go | 2 +- core/mkalloc.go | 2 +- core/rawdb/accessors_chain.go | 2 +- core/rawdb/accessors_chain_test.go | 4 +- core/rlp_test.go | 4 +- core/snaptype/block_types.go | 2 +- core/state/cached_reader.go | 2 +- core/state/cached_reader3.go | 2 +- core/state/cached_writer.go | 2 +- core/state/contracts/gen_changer.go | 2 +- core/state/contracts/gen_phoenix.go | 2 +- core/state/contracts/gen_poly.go | 2 +- core/state/contracts/gen_revive.go | 2 +- core/state/contracts/gen_revive2.go | 2 +- core/state/contracts/gen_selfdestruct.go | 2 +- core/state/database.go | 2 +- core/state/database_test.go | 2 +- core/state/dump.go | 6 +- core/state/history_reader_v3.go | 2 +- core/state/intra_block_state.go | 6 +- core/state/rw_v3.go | 2 +- core/state/state_object.go | 6 +- core/state/state_object_test.go | 2 +- core/state/state_test.go | 2 +- core/state/state_writer_v4.go | 2 +- core/state/txtask.go | 2 +- core/state_transition.go | 2 +- core/test/domains_restart_test.go | 2 +- core/tx_cacher.go | 2 +- core/types/access_list_tx.go | 4 +- .../types/accounts/account.go | 16 +- .../types/accounts/account_benchmark_test.go | 0 .../types/accounts/account_proof.go | 0 .../types/accounts/account_test.go | 2 - core/types/authorization.go | 4 +- core/types/blob_tx.go | 4 +- core/types/blob_tx_wrapper.go | 2 +- core/types/block.go | 6 +- core/types/block_test.go | 7 +- core/types/dynamic_fee_tx.go | 4 +- core/types/encdec_test.go | 2 +- core/types/gen_genesis.go | 2 +- core/types/genesis.go | 2 +- core/types/hashing.go | 6 +- core/types/hashing_test.go | 4 +- core/types/legacy_tx.go | 4 +- core/types/log.go | 2 +- core/types/receipt.go | 2 +- core/types/receipt_test.go | 6 +- core/types/set_code_tx.go | 4 +- core/types/transaction.go | 4 +- core/types/transaction_signing.go | 2 +- core/types/transaction_test.go | 6 +- core/types/withdrawal.go | 2 +- core/vm/common.go | 2 +- core/vm/contracts.go | 2 +- core/vm/contracts_test.go | 2 +- core/vm/evm.go | 4 +- core/vm/instructions.go | 2 +- core/vm/instructions_test.go | 4 +- core/vm/memory_test.go | 2 +- core/vm/runtime/runtime_test.go | 4 +- diagnostics/db.go | 2 +- docs/readthedocs/source/rpc/tutorial.rst | 2 +- erigon-lib/commitment/hex_patricia_hashed.go | 2 +- erigon-lib/common/bytes.go | 91 --- erigon-lib/common/u256/big.go | 28 +- erigon-lib/crypto/crypto.go | 2 +- erigon-lib/go.mod | 5 +- erigon-lib/go.sum | 7 - erigon-lib/rlp/commitment.go | 284 +++++++ erigon-lib/rlp/encode.go | 749 +++++------------- erigon-lib/rlp/encode_test.go | 499 +----------- erigon-lib/rlp/parse.go | 288 +++++++ erigon-lib/rlp/parse_test.go | 108 +++ erigon-lib/rlp2/encodel.go | 8 - erigon-lib/tools/golangci_lint.sh | 2 +- erigon-lib/trie/hack.go | 145 ---- eth/backend.go | 2 +- eth/calltracer/calltracer.go | 2 +- eth/consensuschain/consensus_chain_reader.go | 2 +- eth/protocols/eth/discovery.go | 2 +- eth/protocols/eth/handler_test.go | 2 +- eth/protocols/eth/handlers.go | 4 +- eth/protocols/eth/protocol.go | 4 +- eth/protocols/eth/protocol_test.go | 4 +- eth/stagedsync/chain_reader.go | 2 +- eth/stagedsync/exec3.go | 2 +- eth/stagedsync/stage_commit_rebuild.go | 3 +- eth/stagedsync/stage_headers.go | 2 +- eth/stagedsync/stage_mining_create_block.go | 2 +- eth/stagedsync/stage_mining_exec.go | 2 +- eth/stagedsync/stage_polygon_sync.go | 2 +- eth/stagedsync/stage_senders.go | 2 +- eth/stagedsync/stage_senders_test.go | 2 +- eth/stagedsync/testutil.go | 2 +- .../internal/tracetest/calltrace_test.go | 2 +- .../internal/tracetest/prestate_test.go | 2 +- eth/tracers/js/goja.go | 2 +- eth/tracers/logger/json_stream.go | 2 +- eth/tracers/logger/logger_json.go | 2 +- eth/tracers/native/4byte.go | 2 +- ethdb/privateapi/ethbackend.go | 4 +- ethdb/privateapi/mining.go | 2 +- event/subscription.go | 2 +- go.mod | 4 +- node/nodecfg/config.go | 4 +- p2p/dial.go | 4 +- p2p/dial_test.go | 2 +- p2p/discover/common.go | 2 +- p2p/discover/ntp.go | 2 +- p2p/discover/table.go | 2 +- p2p/discover/v4_udp.go | 2 +- p2p/discover/v4wire/v4wire.go | 2 +- p2p/discover/v4wire/v4wire_test.go | 2 +- p2p/discover/v5_udp.go | 4 +- p2p/discover/v5_udp_test.go | 2 +- p2p/discover/v5wire/encoding.go | 4 +- p2p/discover/v5wire/encoding_test.go | 2 +- p2p/discover/v5wire/msg.go | 4 +- p2p/discover/v5wire/session.go | 2 +- p2p/dnsdisc/client.go | 2 +- p2p/dnsdisc/client_test.go | 2 +- p2p/dnsdisc/sync.go | 2 +- p2p/dnsdisc/tree.go | 2 +- p2p/enode/idscheme.go | 2 +- p2p/enode/idscheme_test.go | 2 +- p2p/enode/iter.go | 2 +- p2p/enode/node.go | 2 +- p2p/enode/node_test.go | 2 +- p2p/enode/nodedb.go | 2 +- p2p/enr/enr.go | 2 +- p2p/enr/enr_test.go | 2 +- p2p/enr/entries.go | 2 +- p2p/message.go | 4 +- p2p/nat/natpmp.go | 2 +- p2p/nat/natupnp.go | 2 +- p2p/netutil/iptrack.go | 2 +- p2p/netutil/iptrack_test.go | 2 +- p2p/peer.go | 6 +- p2p/rlpx/rlpx.go | 2 +- p2p/rlpx/rlpx_test.go | 2 +- p2p/sentry/sentry_grpc_server.go | 4 +- p2p/sentry/sentry_multi_client/broadcast.go | 2 +- p2p/sentry/sentry_multi_client/sentry_api.go | 2 +- .../sentry_multi_client.go | 2 +- p2p/sentry/simulator/sentry_simulator.go | 2 +- p2p/sentry/simulator/simulator_test.go | 2 +- p2p/server.go | 4 +- p2p/transport.go | 4 +- p2p/transport_test.go | 2 +- p2p/util.go | 2 +- p2p/util_test.go | 2 +- params/config.go | 2 +- params/dao.go | 2 +- polygon/bor/bor.go | 4 +- polygon/bor/bor_test.go | 2 +- polygon/bor/spanner.go | 2 +- polygon/bor/state_receiver.go | 2 +- polygon/bor/state_receiver_mock.go | 2 +- polygon/bridge/mdbx_store.go | 2 +- polygon/bridge/reader.go | 4 +- polygon/bridge/snapshot_store.go | 2 +- polygon/bridge/store.go | 2 +- polygon/heimdall/event_record.go | 2 +- polygon/heimdall/snapshots.go | 2 +- polygon/p2p/fetcher_base_test.go | 2 +- polygon/p2p/message_listener.go | 2 +- polygon/p2p/message_listener_test.go | 2 +- polygon/p2p/message_sender.go | 2 +- polygon/p2p/message_sender_test.go | 2 +- {erigon-lib/rlp => rlp}/decode.go | 6 +- {erigon-lib/rlp => rlp}/decode_tail_test.go | 0 {erigon-lib/rlp => rlp}/decode_test.go | 14 +- {erigon-lib/rlp => rlp}/doc.go | 0 {erigon-lib/rlp => rlp}/encbuffer.go | 0 rlp/encode.go | 681 ++++++++++++++++ rlp/encode_test.go | 508 ++++++++++++ .../rlp => rlp}/encoder_example_test.go | 0 .../internal/rlpstruct/rlpstruct.go | 0 {erigon-lib/rlp => rlp}/iterator.go | 0 {erigon-lib/rlp => rlp}/iterator_test.go | 0 {erigon-lib/rlp => rlp}/raw.go | 0 {erigon-lib/rlp => rlp}/raw_test.go | 0 {erigon-lib/rlp => rlp}/typecache.go | 0 rpc/client_test.go | 4 +- tests/block_test_util.go | 4 +- tests/bor/mining_test.go | 4 +- tests/contracts/gen_selfDestructor.go | 2 +- tests/contracts/gen_testcontract.go | 2 +- tests/fuzzers/bitutil/compress_fuzz.go | 2 +- tests/fuzzers/rlp/rlp_fuzzer.go | 2 +- tests/gen_stenv.go | 2 +- tests/rlp_test_util.go | 2 +- tests/state_test_util.go | 4 +- turbo/adapter/ethapi/get_proof.go | 4 +- turbo/app/import_cmd.go | 2 +- turbo/debug/flags.go | 2 +- turbo/debug/signal.go | 2 +- turbo/debug/signal_windows.go | 2 +- .../block_downloader.go | 2 +- turbo/engineapi/engine_server.go | 2 +- turbo/jsonrpc/contracts/gen_poly.go | 2 +- turbo/jsonrpc/contracts/gen_token.go | 2 +- turbo/jsonrpc/debug_api.go | 4 +- turbo/jsonrpc/erigon_block.go | 2 +- turbo/jsonrpc/erigon_receipts_test.go | 2 +- turbo/jsonrpc/eth_accounts.go | 2 +- turbo/jsonrpc/eth_api.go | 2 +- turbo/jsonrpc/eth_block_test.go | 2 +- turbo/jsonrpc/eth_call.go | 2 +- turbo/jsonrpc/eth_call_test.go | 2 +- turbo/jsonrpc/eth_filters.go | 2 +- turbo/jsonrpc/eth_mining_test.go | 2 +- turbo/jsonrpc/eth_subscribe_test.go | 2 +- turbo/jsonrpc/otterscan_contract_creator.go | 2 +- ...terscan_transaction_by_sender_and_nonce.go | 2 +- turbo/jsonrpc/parity_api_test.go | 2 +- turbo/jsonrpc/send_transaction_test.go | 4 +- turbo/jsonrpc/trace_adhoc.go | 2 +- turbo/jsonrpc/trace_adhoc_test.go | 2 +- {erigon-lib => turbo}/rlphacks/bytes.go | 0 {erigon-lib => turbo}/rlphacks/bytes_test.go | 2 +- .../rlphacks/serializable.go | 0 {erigon-lib => turbo}/rlphacks/struct.go | 0 {erigon-lib => turbo}/rlphacks/utils_bytes.go | 0 turbo/rpchelper/filters.go | 2 +- turbo/services/interfaces.go | 2 +- turbo/shards/state_cache.go | 2 +- turbo/shards/state_cache_test.go | 2 +- turbo/shards/trie_cache.go | 2 +- .../snapshotsync/freezeblocks/block_reader.go | 2 +- .../freezeblocks/block_snapshots.go | 2 +- turbo/snapshotsync/freezeblocks/dump_test.go | 2 +- turbo/stages/blockchain_test.go | 4 +- turbo/stages/chain_makers_test.go | 2 +- .../stages/headerdownload/header_algo_test.go | 2 +- turbo/stages/headerdownload/header_algos.go | 4 +- .../headerdownload/header_data_struct.go | 2 +- turbo/stages/mock/mock_sentry.go | 2 +- turbo/stages/mock/sentry_mock_test.go | 4 +- {erigon-lib => turbo}/trie/.gitignore | 0 .../trie/account_node_test.go | 2 +- {erigon-lib => turbo}/trie/debug.go | 0 .../trie/delete_subrtee_test.go | 2 +- {erigon-lib => turbo}/trie/encoding.go | 2 +- {erigon-lib => turbo}/trie/encoding_test.go | 35 +- {erigon-lib => turbo}/trie/errors.go | 0 .../trie/flatdb_sub_trie_loader_test.go | 17 +- {erigon-lib => turbo}/trie/gen_struct_step.go | 2 +- turbo/trie/hack.go | 146 ++++ {erigon-lib => turbo}/trie/hashbuilder.go | 15 +- {erigon-lib => turbo}/trie/hasher.go | 4 +- {erigon-lib => turbo}/trie/hasher_test.go | 0 .../trie/intermediate_hashes_test.go | 0 {erigon-lib => turbo}/trie/node.go | 4 +- {erigon-lib => turbo}/trie/proof.go | 4 +- {erigon-lib => turbo}/trie/retain_list.go | 2 +- .../trie/retain_list_test.go | 4 +- {erigon-lib => turbo}/trie/stream.go | 6 +- {erigon-lib => turbo}/trie/stream_test.go | 4 +- {erigon-lib => turbo}/trie/structural_test.go | 154 ++-- {erigon-lib => turbo}/trie/sub_trie_loader.go | 0 {erigon-lib => turbo}/trie/trie.go | 7 +- {erigon-lib => turbo}/trie/trie_root.go | 5 +- {erigon-lib => turbo}/trie/trie_test.go | 7 +- {erigon-lib => turbo}/trie/trie_transform.go | 6 +- {erigon-lib => turbo}/trie/utils.go | 0 .../trie/vtree/verkle_utils.go | 0 .../trie/vtree/verkle_utils_test.go | 0 txnprovider/txpool/fetch.go | 2 +- txnprovider/txpool/pool_fuzz_test.go | 2 +- txnprovider/txpool/pool_txn_packets.go | 2 +- txnprovider/txpool/pool_txn_parser.go | 2 +- txnprovider/txpool/send.go | 2 +- 381 files changed, 2952 insertions(+), 1875 deletions(-) rename {erigon-lib/common => common}/bitutil/bitutil.go (100%) rename {erigon-lib/common => common}/bitutil/bitutil_test.go (98%) rename {erigon-lib/common => common}/bitutil/compress.go (100%) rename {erigon-lib/common => common}/bitutil/compress_test.go (99%) create mode 100644 common/bytes.go rename {erigon-lib/common => common}/bytes_test.go (97%) rename {erigon-lib/common => common}/compiler/helpers.go (100%) rename {erigon-lib/common => common}/compiler/solidity.go (100%) rename {erigon-lib/common => common}/compiler/test.v.py (100%) rename {erigon-lib/common => common}/compiler/test_bad.v.py (100%) rename {erigon-lib/common => common}/compiler/vyper.go (100%) rename {erigon-lib/common => common}/compiler/vyper_test.go (99%) rename {erigon-lib/common => common}/debug.go (100%) rename {erigon-lib/common => common}/debug/callers.go (100%) rename {erigon-lib/common => common}/debug/log_panic.go (100%) rename {erigon-lib/common => common}/debug/pprof_cgo.go (100%) rename {core => common}/debugprint/receipts.go (100%) rename {erigon-lib/common => common}/fdlimit/fdlimit_bsd.go (100%) rename {erigon-lib/common => common}/fdlimit/fdlimit_darwin.go (100%) rename {erigon-lib/common => common}/fdlimit/fdlimit_test.go (100%) rename {erigon-lib/common => common}/fdlimit/fdlimit_unix.go (100%) rename {erigon-lib/common => common}/fdlimit/fdlimit_windows.go (100%) rename {erigon-lib/common => common}/mclock/mclock.go (100%) rename {erigon-lib/common => common}/mclock/mclock.s (100%) rename {erigon-lib/common => common}/mclock/simclock.go (100%) rename {erigon-lib/common => common}/mclock/simclock_test.go (100%) rename {erigon-lib/common => common}/path.go (100%) rename {erigon-lib/common => common}/paths/paths.go (100%) rename {erigon-lib/common => common}/prque/prque.go (100%) rename {erigon-lib/common => common}/prque/prque_test.go (100%) rename {erigon-lib/common => common}/prque/sstack.go (100%) rename {erigon-lib/common => common}/prque/sstack_test.go (100%) rename {erigon-lib/common => common}/size.go (100%) rename {erigon-lib/common => common}/size_test.go (100%) rename {erigon-lib/common => common}/test_utils.go (95%) rename {erigon-lib/common => common}/tuples.go (100%) rename {erigon-lib/common => common}/tuples_test.go (100%) rename {erigon-lib/common => common}/types.go (89%) rename {erigon-lib/common => common}/types_test.go (96%) create mode 100644 common/u256/big.go rename {erigon-lib => core}/types/accounts/account.go (98%) rename {erigon-lib => core}/types/accounts/account_benchmark_test.go (100%) rename {erigon-lib => core}/types/accounts/account_proof.go (100%) rename {erigon-lib => core}/types/accounts/account_test.go (99%) create mode 100644 erigon-lib/rlp/commitment.go create mode 100644 erigon-lib/rlp/parse.go create mode 100644 erigon-lib/rlp/parse_test.go delete mode 100644 erigon-lib/trie/hack.go rename {erigon-lib/rlp => rlp}/decode.go (99%) rename {erigon-lib/rlp => rlp}/decode_tail_test.go (100%) rename {erigon-lib/rlp => rlp}/decode_test.go (99%) rename {erigon-lib/rlp => rlp}/doc.go (100%) rename {erigon-lib/rlp => rlp}/encbuffer.go (100%) create mode 100644 rlp/encode.go create mode 100644 rlp/encode_test.go rename {erigon-lib/rlp => rlp}/encoder_example_test.go (100%) rename {erigon-lib/rlp => rlp}/internal/rlpstruct/rlpstruct.go (100%) rename {erigon-lib/rlp => rlp}/iterator.go (100%) rename {erigon-lib/rlp => rlp}/iterator_test.go (100%) rename {erigon-lib/rlp => rlp}/raw.go (100%) rename {erigon-lib/rlp => rlp}/raw_test.go (100%) rename {erigon-lib/rlp => rlp}/typecache.go (100%) rename {erigon-lib => turbo}/rlphacks/bytes.go (100%) rename {erigon-lib => turbo}/rlphacks/bytes_test.go (98%) rename {erigon-lib => turbo}/rlphacks/serializable.go (100%) rename {erigon-lib => turbo}/rlphacks/struct.go (100%) rename {erigon-lib => turbo}/rlphacks/utils_bytes.go (100%) rename {erigon-lib => turbo}/trie/.gitignore (100%) rename {erigon-lib => turbo}/trie/account_node_test.go (99%) rename {erigon-lib => turbo}/trie/debug.go (100%) rename {erigon-lib => turbo}/trie/delete_subrtee_test.go (99%) rename {erigon-lib => turbo}/trie/encoding.go (99%) rename {erigon-lib => turbo}/trie/encoding_test.go (79%) rename {erigon-lib => turbo}/trie/errors.go (100%) rename {erigon-lib => turbo}/trie/flatdb_sub_trie_loader_test.go (86%) rename {erigon-lib => turbo}/trie/gen_struct_step.go (99%) create mode 100644 turbo/trie/hack.go rename {erigon-lib => turbo}/trie/hashbuilder.go (98%) rename {erigon-lib => turbo}/trie/hasher.go (99%) rename {erigon-lib => turbo}/trie/hasher_test.go (100%) rename {erigon-lib => turbo}/trie/intermediate_hashes_test.go (100%) rename {erigon-lib => turbo}/trie/node.go (98%) rename {erigon-lib => turbo}/trie/proof.go (99%) rename {erigon-lib => turbo}/trie/retain_list.go (99%) rename {erigon-lib => turbo}/trie/retain_list_test.go (98%) rename {erigon-lib => turbo}/trie/stream.go (99%) rename {erigon-lib => turbo}/trie/stream_test.go (98%) rename {erigon-lib => turbo}/trie/structural_test.go (77%) rename {erigon-lib => turbo}/trie/sub_trie_loader.go (100%) rename {erigon-lib => turbo}/trie/trie.go (99%) rename {erigon-lib => turbo}/trie/trie_root.go (99%) rename {erigon-lib => turbo}/trie/trie_test.go (99%) rename {erigon-lib => turbo}/trie/trie_transform.go (94%) rename {erigon-lib => turbo}/trie/utils.go (100%) rename {erigon-lib => turbo}/trie/vtree/verkle_utils.go (100%) rename {erigon-lib => turbo}/trie/vtree/verkle_utils_test.go (100%) diff --git a/accounts/abi/abi_test.go b/accounts/abi/abi_test.go index 36738842100..4e93fc53b59 100644 --- a/accounts/abi/abi_test.go +++ b/accounts/abi/abi_test.go @@ -30,10 +30,10 @@ import ( "strings" "testing" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon/common" ) const jsondata = ` diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 667309affa4..74326cab8ee 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -35,12 +35,12 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/math" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" state2 "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/consensus/misc" diff --git a/accounts/abi/bind/backends/simulated_test.go b/accounts/abi/bind/backends/simulated_test.go index aec8ebd32b9..df82523d138 100644 --- a/accounts/abi/bind/backends/simulated_test.go +++ b/accounts/abi/bind/backends/simulated_test.go @@ -34,13 +34,13 @@ import ( "github.com/stretchr/testify/require" ethereum "github.com/erigontech/erigon" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" diff --git a/accounts/abi/bind/base_test.go b/accounts/abi/bind/base_test.go index 1aa2bea4f30..91e5bed7c54 100644 --- a/accounts/abi/bind/base_test.go +++ b/accounts/abi/bind/base_test.go @@ -30,10 +30,10 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" ) type mockCaller struct { diff --git a/accounts/abi/bind/util_test.go b/accounts/abi/bind/util_test.go index 5191579796e..b71505fed9f 100644 --- a/accounts/abi/bind/util_test.go +++ b/accounts/abi/bind/util_test.go @@ -27,12 +27,12 @@ import ( "testing" "time" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/accounts/abi/bind/backends" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" ) diff --git a/accounts/abi/event_test.go b/accounts/abi/event_test.go index b3b0ff272da..7a649eb186a 100644 --- a/accounts/abi/event_test.go +++ b/accounts/abi/event_test.go @@ -31,9 +31,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon/common" ) var jsonEventTransfer = []byte(`{ diff --git a/accounts/abi/pack.go b/accounts/abi/pack.go index 5c2492b3554..d4d64006355 100644 --- a/accounts/abi/pack.go +++ b/accounts/abi/pack.go @@ -25,9 +25,9 @@ import ( "math/big" "reflect" - "github.com/erigontech/erigon-lib/common" common2 "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" + "github.com/erigontech/erigon/common" ) // packBytesSlice packs the given bytes as [L, V] as the canonical representation diff --git a/accounts/abi/pack_test.go b/accounts/abi/pack_test.go index 66571cec410..01855e11b7a 100644 --- a/accounts/abi/pack_test.go +++ b/accounts/abi/pack_test.go @@ -33,7 +33,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" ) // TestPack tests the general pack/unpack tests in packing_test.go diff --git a/accounts/abi/unpack_test.go b/accounts/abi/unpack_test.go index 2ba8d3b3c36..1ab532ff497 100644 --- a/accounts/abi/unpack_test.go +++ b/accounts/abi/unpack_test.go @@ -33,7 +33,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/stretchr/testify/require" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" ) // TestUnpack tests the general pack/unpack tests in packing_test.go diff --git a/cl/beacon/handler/rewards_test.go b/cl/beacon/handler/rewards_test.go index 07bc6bbe769..0fb510651a4 100644 --- a/cl/beacon/handler/rewards_test.go +++ b/cl/beacon/handler/rewards_test.go @@ -27,10 +27,10 @@ import ( "github.com/stretchr/testify/require" - "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cl/cltypes/solid" + "github.com/erigontech/erigon/common" ) func TestGetBlockRewards(t *testing.T) { diff --git a/cl/beacon/handler/states_test.go b/cl/beacon/handler/states_test.go index 5222c291fa0..48035a6e599 100644 --- a/cl/beacon/handler/states_test.go +++ b/cl/beacon/handler/states_test.go @@ -27,11 +27,11 @@ import ( "github.com/stretchr/testify/require" - "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cl/cltypes/solid" "github.com/erigontech/erigon/cl/phase1/core/state" + "github.com/erigontech/erigon/common" ) func TestGetStateFork(t *testing.T) { diff --git a/cl/beacon/handler/validator_test.go b/cl/beacon/handler/validator_test.go index 0a8bcb31f54..181cc9b9482 100644 --- a/cl/beacon/handler/validator_test.go +++ b/cl/beacon/handler/validator_test.go @@ -23,12 +23,12 @@ import ( "net/http/httptest" "testing" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" mockaggregation "github.com/erigontech/erigon/cl/aggregation/mock_services" "github.com/erigontech/erigon/cl/beacon/beacon_router_configuration" "github.com/erigontech/erigon/cl/cltypes/solid" "github.com/erigontech/erigon/cl/pool" + "github.com/erigontech/erigon/common" "github.com/stretchr/testify/suite" "go.uber.org/mock/gomock" ) diff --git a/cmd/abigen/main.go b/cmd/abigen/main.go index 73452f99d9b..14c07575d32 100644 --- a/cmd/abigen/main.go +++ b/cmd/abigen/main.go @@ -31,12 +31,12 @@ import ( "github.com/urfave/cli/v2" "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/compiler" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/cmd/utils" + "github.com/erigontech/erigon/common/compiler" "github.com/erigontech/erigon/params" cli2 "github.com/erigontech/erigon/turbo/cli" ) diff --git a/cmd/capcli/cli.go b/cmd/capcli/cli.go index 9d392bbe765..7fb0a50a316 100644 --- a/cmd/capcli/cli.go +++ b/cmd/capcli/cli.go @@ -44,7 +44,6 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/metrics" - "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cl/antiquary" "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cl/clparams/initial_state" @@ -61,6 +60,7 @@ import ( "github.com/erigontech/erigon/cl/rpc" "github.com/erigontech/erigon/cl/utils/eth_clock" "github.com/erigontech/erigon/cmd/caplin/caplin1" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/eth/ethconfig/estimate" "github.com/erigontech/erigon/turbo/debug" diff --git a/cmd/caplin/caplincli/config.go b/cmd/caplin/caplincli/config.go index 48c65216428..7f6589e17c1 100644 --- a/cmd/caplin/caplincli/config.go +++ b/cmd/caplin/caplincli/config.go @@ -25,13 +25,13 @@ import ( "github.com/urfave/cli/v2" - "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cmd/caplin/caplinflags" "github.com/erigontech/erigon/cmd/sentinel/sentinelcli" "github.com/erigontech/erigon/cmd/utils" + "github.com/erigontech/erigon/common" ) type CaplinCliCfg struct { diff --git a/cmd/devnet/contracts/gen_subscription.go b/cmd/devnet/contracts/gen_subscription.go index 536350605e4..3db9b1b436f 100644 --- a/cmd/devnet/contracts/gen_subscription.go +++ b/cmd/devnet/contracts/gen_subscription.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/cmd/devnet/services/polygon/heimdallsim/heimdall_simulator.go b/cmd/devnet/services/polygon/heimdallsim/heimdall_simulator.go index 820735855e8..1904340e036 100644 --- a/cmd/devnet/services/polygon/heimdallsim/heimdall_simulator.go +++ b/cmd/devnet/services/polygon/heimdallsim/heimdall_simulator.go @@ -26,10 +26,10 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/downloader/snaptype" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/polygon/bridge" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks" ) diff --git a/cmd/devnet/services/polygon/proofgenerator.go b/cmd/devnet/services/polygon/proofgenerator.go index 1ce9317b941..c1a3ff948d4 100644 --- a/cmd/devnet/services/polygon/proofgenerator.go +++ b/cmd/devnet/services/polygon/proofgenerator.go @@ -32,16 +32,16 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon-lib/trie" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/cl/merkle_tree" "github.com/erigontech/erigon/cmd/devnet/devnet" "github.com/erigontech/erigon/cmd/devnet/requests" "github.com/erigontech/erigon/core/types" bortypes "github.com/erigontech/erigon/polygon/bor/types" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/jsonrpc" + "github.com/erigontech/erigon/turbo/trie" ) var ErrTokenIndexOutOfRange = errors.New("index is grater than the number of tokens in transaction") diff --git a/cmd/devnet/services/polygon/proofgenerator_test.go b/cmd/devnet/services/polygon/proofgenerator_test.go index 2d65745c151..301fa095f25 100644 --- a/cmd/devnet/services/polygon/proofgenerator_test.go +++ b/cmd/devnet/services/polygon/proofgenerator_test.go @@ -39,7 +39,6 @@ import ( "github.com/erigontech/erigon-lib/kv/memdb" "github.com/erigontech/erigon-lib/kv/rawdbv3" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/cmd/devnet/blocks" "github.com/erigontech/erigon/cmd/devnet/requests" @@ -50,6 +49,7 @@ import ( "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/polygon/bor" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/jsonrpc" "github.com/erigontech/erigon/turbo/services" diff --git a/cmd/downloader/main.go b/cmd/downloader/main.go index c3a83c79b94..b5c1ce05ef2 100644 --- a/cmd/downloader/main.go +++ b/cmd/downloader/main.go @@ -58,10 +58,10 @@ import ( "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon/cmd/downloader/downloadernat" "github.com/erigontech/erigon/cmd/hack/tool" "github.com/erigontech/erigon/cmd/utils" + "github.com/erigontech/erigon/common/paths" "github.com/erigontech/erigon/p2p/nat" "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/turbo/debug" diff --git a/cmd/evm/internal/t8ntool/execution.go b/cmd/evm/internal/t8ntool/execution.go index 93f78dae184..ccf3dfd50cf 100644 --- a/cmd/evm/internal/t8ntool/execution.go +++ b/cmd/evm/internal/t8ntool/execution.go @@ -31,7 +31,7 @@ import ( "github.com/erigontech/erigon-lib/kv" state3 "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/tracing" diff --git a/cmd/evm/internal/t8ntool/gen_stenv.go b/cmd/evm/internal/t8ntool/gen_stenv.go index c47122401a6..907617ed815 100644 --- a/cmd/evm/internal/t8ntool/gen_stenv.go +++ b/cmd/evm/internal/t8ntool/gen_stenv.go @@ -9,7 +9,7 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" - common0 "github.com/erigontech/erigon-lib/common" + common0 "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" ) diff --git a/cmd/evm/internal/t8ntool/transition.go b/cmd/evm/internal/t8ntool/transition.go index 903685dafc1..1bb6de532e3 100644 --- a/cmd/evm/internal/t8ntool/transition.go +++ b/cmd/evm/internal/t8ntool/transition.go @@ -44,7 +44,6 @@ import ( "github.com/erigontech/erigon-lib/kv/rawdbv3" "github.com/erigontech/erigon-lib/kv/temporal/temporaltest" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" libstate "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/consensus/merge" @@ -54,6 +53,7 @@ import ( "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/eth/consensuschain" trace_logger "github.com/erigontech/erigon/eth/tracers/logger" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/tests" "github.com/erigontech/erigon/turbo/jsonrpc" ) diff --git a/cmd/hack/db/lmdb.go b/cmd/hack/db/lmdb.go index a4489b670b2..0c3df544839 100644 --- a/cmd/hack/db/lmdb.go +++ b/cmd/hack/db/lmdb.go @@ -30,10 +30,10 @@ import ( "strconv" "strings" - "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/kv" kv2 "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/debug" ) var logger = log.New() diff --git a/cmd/hack/flow/flow.go b/cmd/hack/flow/flow.go index b11866a8894..8486203ae37 100644 --- a/cmd/hack/flow/flow.go +++ b/cmd/hack/flow/flow.go @@ -32,8 +32,8 @@ import ( "github.com/erigontech/erigon-lib/common/dbg" - "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon/cmd/hack/tool" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/core/vm" ) diff --git a/cmd/hack/hack.go b/cmd/hack/hack.go index 1d928427e56..ee441c6993f 100644 --- a/cmd/hack/hack.go +++ b/cmd/hack/hack.go @@ -45,11 +45,10 @@ import ( "github.com/erigontech/erigon-lib/recsplit/eliasfano32" "github.com/erigontech/erigon-lib/seg" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" hackdb "github.com/erigontech/erigon/cmd/hack/db" "github.com/erigontech/erigon/cmd/hack/flow" "github.com/erigontech/erigon/cmd/hack/tool" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/rawdb/blockio" @@ -57,6 +56,7 @@ import ( "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/eth/stagedsync/stages" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/debug" "github.com/erigontech/erigon/turbo/logging" "github.com/erigontech/erigon/turbo/services" diff --git a/cmd/integration/commands/refetence_db.go b/cmd/integration/commands/refetence_db.go index 088cb931831..2c6bc8687cc 100644 --- a/cmd/integration/commands/refetence_db.go +++ b/cmd/integration/commands/refetence_db.go @@ -36,7 +36,7 @@ import ( mdbx2 "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/turbo/debug" ) diff --git a/cmd/integration/commands/state_stages.go b/cmd/integration/commands/state_stages.go index 7258a2bd1e0..f9a831a6e2e 100644 --- a/cmd/integration/commands/state_stages.go +++ b/cmd/integration/commands/state_stages.go @@ -40,8 +40,8 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon/cmd/hack/tool/fromdb" "github.com/erigontech/erigon/cmd/utils" + "github.com/erigontech/erigon/common/debugprint" "github.com/erigontech/erigon/core" - "github.com/erigontech/erigon/core/debugprint" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/eth/stagedsync" diff --git a/cmd/observer/observer/handshake.go b/cmd/observer/observer/handshake.go index 7e9ff6b8bc6..3b89313de31 100644 --- a/cmd/observer/observer/handshake.go +++ b/cmd/observer/observer/handshake.go @@ -25,16 +25,16 @@ import ( "net" "time" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/direct" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/forkid" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p" "github.com/erigontech/erigon/p2p/rlpx" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" ) // https://github.com/ethereum/devp2p/blob/master/rlpx.md#p2p-capability diff --git a/cmd/observer/observer/server.go b/cmd/observer/observer/server.go index 290b7d03fcc..c211e780e70 100644 --- a/cmd/observer/observer/server.go +++ b/cmd/observer/observer/server.go @@ -26,8 +26,8 @@ import ( "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon/cmd/utils" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/core/forkid" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p" diff --git a/cmd/pics/contracts/gen_token.go b/cmd/pics/contracts/gen_token.go index 124fcb5f587..a0da6eff9be 100644 --- a/cmd/pics/contracts/gen_token.go +++ b/cmd/pics/contracts/gen_token.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/cmd/pics/state.go b/cmd/pics/state.go index e3c75c30275..1f0e322b634 100644 --- a/cmd/pics/state.go +++ b/cmd/pics/state.go @@ -29,21 +29,21 @@ import ( "github.com/holiman/uint256" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/memdb" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/trie" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/accounts/abi/bind/backends" "github.com/erigontech/erigon/cmd/pics/contracts" "github.com/erigontech/erigon/cmd/pics/visual" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/turbo/stages/mock" + "github.com/erigontech/erigon/turbo/trie" ) /*func statePicture(t *trie.Trie, number int, keyCompression int, codeCompressed bool, valCompressed bool, diff --git a/cmd/rlpdump/main.go b/cmd/rlpdump/main.go index 2fd6e9df405..a205a369ccf 100644 --- a/cmd/rlpdump/main.go +++ b/cmd/rlpdump/main.go @@ -29,7 +29,7 @@ import ( "os" "strings" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) var ( diff --git a/cmd/rpcdaemon/cli/config.go b/cmd/rpcdaemon/cli/config.go index 9e468f6a2ca..6a20c9813ba 100644 --- a/cmd/rpcdaemon/cli/config.go +++ b/cmd/rpcdaemon/cli/config.go @@ -38,11 +38,9 @@ import ( "google.golang.org/grpc/health/grpc_health_v1" "github.com/erigontech/erigon-lib/chain" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/common/hexutility" - "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon-lib/config3" "github.com/erigontech/erigon-lib/direct" "github.com/erigontech/erigon-lib/gointerfaces" @@ -64,6 +62,8 @@ import ( "github.com/erigontech/erigon/cmd/rpcdaemon/rpcservices" "github.com/erigontech/erigon/cmd/utils" "github.com/erigontech/erigon/cmd/utils/flags" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/common/paths" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/aura" "github.com/erigontech/erigon/consensus/ethash" diff --git a/cmd/rpcdaemon/rpcdaemontest/test_util.go b/cmd/rpcdaemon/rpcdaemontest/test_util.go index 7bcb1032592..5b073e423c0 100644 --- a/cmd/rpcdaemon/rpcdaemontest/test_util.go +++ b/cmd/rpcdaemon/rpcdaemontest/test_util.go @@ -32,7 +32,6 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" remote "github.com/erigontech/erigon-lib/gointerfaces/remoteproto" txpool "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" @@ -40,6 +39,7 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/accounts/abi/bind/backends" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core" diff --git a/cmd/rpcdaemon/rpcservices/eth_backend.go b/cmd/rpcdaemon/rpcservices/eth_backend.go index 68e06fabe83..fe38cac8334 100644 --- a/cmd/rpcdaemon/rpcservices/eth_backend.go +++ b/cmd/rpcdaemon/rpcservices/eth_backend.go @@ -36,13 +36,13 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces" remote "github.com/erigontech/erigon-lib/gointerfaces/remoteproto" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/ethdb/privateapi" "github.com/erigontech/erigon/p2p" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/snapshotsync" ) diff --git a/cmd/rpctest/rpctest/account_range_verify.go b/cmd/rpctest/rpctest/account_range_verify.go index 6077999c469..82230f49285 100644 --- a/cmd/rpctest/rpctest/account_range_verify.go +++ b/cmd/rpctest/rpctest/account_range_verify.go @@ -33,7 +33,7 @@ import ( "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/state" ) diff --git a/cmd/sentry/main.go b/cmd/sentry/main.go index dca4acd520a..aed5d2c5567 100644 --- a/cmd/sentry/main.go +++ b/cmd/sentry/main.go @@ -24,8 +24,8 @@ import ( "github.com/erigontech/erigon-lib/common/datadir" "github.com/spf13/cobra" - "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon/cmd/utils" + "github.com/erigontech/erigon/common/paths" "github.com/erigontech/erigon/p2p/sentry" "github.com/erigontech/erigon/turbo/debug" "github.com/erigontech/erigon/turbo/logging" diff --git a/cmd/state/commands/global_flags_vars.go b/cmd/state/commands/global_flags_vars.go index 43d0364df9b..9549343717c 100644 --- a/cmd/state/commands/global_flags_vars.go +++ b/cmd/state/commands/global_flags_vars.go @@ -21,7 +21,7 @@ import ( "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon-lib/common/paths" + "github.com/erigontech/erigon/common/paths" ) var ( diff --git a/cmd/state/commands/opcode_tracer.go b/cmd/state/commands/opcode_tracer.go index 7b8b8dbc737..f4207e64b15 100644 --- a/cmd/state/commands/opcode_tracer.go +++ b/cmd/state/commands/opcode_tracer.go @@ -41,7 +41,7 @@ import ( "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/kv/rawdbv3" - "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core" diff --git a/cmd/state/stats/index_stats.go b/cmd/state/stats/index_stats.go index 112b6ab3fa0..f4b3408ca16 100644 --- a/cmd/state/stats/index_stats.go +++ b/cmd/state/stats/index_stats.go @@ -33,7 +33,7 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/mdbx" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" ) func IndexStats(chaindata string, indexBucket string, statsFile string) error { diff --git a/cmd/state/verify/check_indexes.go b/cmd/state/verify/check_indexes.go index 4e29551f26c..e0fb0ea16e5 100644 --- a/cmd/state/verify/check_indexes.go +++ b/cmd/state/verify/check_indexes.go @@ -25,10 +25,10 @@ import ( "github.com/erigontech/erigon-lib/kv/dbutils" - "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv/bitmapdb" "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/kv/temporal/historyv2" + "github.com/erigontech/erigon/common" ) func CheckIndex(ctx context.Context, chaindata string, changeSetBucket string, indexBucket string) error { diff --git a/cmd/txpool/main.go b/cmd/txpool/main.go index 026b7c5525b..8a142f28b05 100644 --- a/cmd/txpool/main.go +++ b/cmd/txpool/main.go @@ -27,7 +27,6 @@ import ( "github.com/spf13/cobra" "github.com/erigontech/erigon-lib/common" - common2 "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/direct" "github.com/erigontech/erigon-lib/gointerfaces" @@ -39,14 +38,15 @@ import ( "github.com/erigontech/erigon-lib/kv/remotedbserver" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" + common2 "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus/misc" "github.com/erigontech/erigon/ethdb/privateapi" "github.com/erigontech/erigon/txnprovider/txpool" "github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg" "github.com/erigontech/erigon/txnprovider/txpool/txpoolutil" - "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon/cmd/utils" + "github.com/erigontech/erigon/common/paths" "github.com/erigontech/erigon/turbo/debug" "github.com/erigontech/erigon/turbo/logging" ) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index ce39f641440..1b0b8379f47 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -38,11 +38,9 @@ import ( "github.com/erigontech/erigon-lib/chain/networkid" "github.com/erigontech/erigon-lib/chain/networkname" "github.com/erigontech/erigon-lib/chain/snapcfg" - common2 "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/common/metrics" - "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon-lib/crypto" libkzg "github.com/erigontech/erigon-lib/crypto/kzg" "github.com/erigontech/erigon-lib/direct" @@ -51,6 +49,8 @@ import ( "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cmd/downloader/downloadernat" "github.com/erigontech/erigon/cmd/utils/flags" + common2 "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/common/paths" "github.com/erigontech/erigon/consensus/ethash/ethashcfg" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/eth/ethconfig" diff --git a/cmd/verkle/main.go b/cmd/verkle/main.go index c4030d80ff4..e600e2130cd 100644 --- a/cmd/verkle/main.go +++ b/cmd/verkle/main.go @@ -35,9 +35,9 @@ import ( "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon/cmd/verkle/verkletrie" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/eth/stagedsync/stages" ) diff --git a/cmd/verkle/verkletrie/incrementAccount.go b/cmd/verkle/verkletrie/incrementAccount.go index d714a9a5420..863bd47c687 100644 --- a/cmd/verkle/verkletrie/incrementAccount.go +++ b/cmd/verkle/verkletrie/incrementAccount.go @@ -28,8 +28,8 @@ import ( "github.com/erigontech/erigon-lib/kv/temporal/historyv2" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common/debug" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon/core/types/accounts" ) func IncrementAccount(vTx kv.RwTx, tx kv.Tx, workers uint64, verkleWriter *VerkleTreeWriter, from, to uint64, tmpdir string) error { diff --git a/cmd/verkle/verkletrie/incrementStorage.go b/cmd/verkle/verkletrie/incrementStorage.go index 462396e7f8b..f1641e40f88 100644 --- a/cmd/verkle/verkletrie/incrementStorage.go +++ b/cmd/verkle/verkletrie/incrementStorage.go @@ -29,8 +29,8 @@ import ( "github.com/erigontech/erigon-lib/kv/temporal/historyv2" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/core/rawdb" ) diff --git a/cmd/verkle/verkletrie/pedersen_hashstate.go b/cmd/verkle/verkletrie/pedersen_hashstate.go index 00569d2f660..9ee1191bc7f 100644 --- a/cmd/verkle/verkletrie/pedersen_hashstate.go +++ b/cmd/verkle/verkletrie/pedersen_hashstate.go @@ -29,9 +29,9 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/debug" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon/core/types/accounts" ) func RegeneratePedersenAccounts(outTx kv.RwTx, readTx kv.Tx, workers uint64, verkleWriter *VerkleTreeWriter) error { diff --git a/cmd/verkle/verkletrie/verkle_tree_writer.go b/cmd/verkle/verkletrie/verkle_tree_writer.go index f93c58db382..eb4c3bbdd7b 100644 --- a/cmd/verkle/verkletrie/verkle_tree_writer.go +++ b/cmd/verkle/verkletrie/verkle_tree_writer.go @@ -30,10 +30,10 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/trie/vtree" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/rawdb" + "github.com/erigontech/erigon/core/types/accounts" + "github.com/erigontech/erigon/turbo/trie/vtree" ) func int256ToVerkleFormat(x *uint256.Int, buffer []byte) { diff --git a/cmd/verkle/verkletrie/workers.go b/cmd/verkle/verkletrie/workers.go index ed572faa36e..0bd66244225 100644 --- a/cmd/verkle/verkletrie/workers.go +++ b/cmd/verkle/verkletrie/workers.go @@ -22,8 +22,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/holiman/uint256" - "github.com/erigontech/erigon-lib/trie/vtree" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" + "github.com/erigontech/erigon/turbo/trie/vtree" ) type regeneratePedersenAccountsJob struct { diff --git a/erigon-lib/common/bitutil/bitutil.go b/common/bitutil/bitutil.go similarity index 100% rename from erigon-lib/common/bitutil/bitutil.go rename to common/bitutil/bitutil.go diff --git a/erigon-lib/common/bitutil/bitutil_test.go b/common/bitutil/bitutil_test.go similarity index 98% rename from erigon-lib/common/bitutil/bitutil_test.go rename to common/bitutil/bitutil_test.go index 94bd3ec3b47..307bf731f76 100644 --- a/erigon-lib/common/bitutil/bitutil_test.go +++ b/common/bitutil/bitutil_test.go @@ -118,7 +118,6 @@ func BenchmarkFastXOR2KB(b *testing.B) { benchmarkFastXOR(b, 2048) } func BenchmarkFastXOR4KB(b *testing.B) { benchmarkFastXOR(b, 4096) } func benchmarkFastXOR(b *testing.B, size int) { - b.Helper() p, q := make([]byte, size), make([]byte, size) for i := 0; i < b.N; i++ { @@ -132,7 +131,6 @@ func BenchmarkBaseXOR2KB(b *testing.B) { benchmarkBaseXOR(b, 2048) } func BenchmarkBaseXOR4KB(b *testing.B) { benchmarkBaseXOR(b, 4096) } func benchmarkBaseXOR(b *testing.B, size int) { - b.Helper() p, q := make([]byte, size), make([]byte, size) for i := 0; i < b.N; i++ { @@ -146,7 +144,6 @@ func BenchmarkFastAND2KB(b *testing.B) { benchmarkFastAND(b, 2048) } func BenchmarkFastAND4KB(b *testing.B) { benchmarkFastAND(b, 4096) } func benchmarkFastAND(b *testing.B, size int) { - b.Helper() p, q := make([]byte, size), make([]byte, size) for i := 0; i < b.N; i++ { @@ -160,7 +157,6 @@ func BenchmarkBaseAND2KB(b *testing.B) { benchmarkBaseAND(b, 2048) } func BenchmarkBaseAND4KB(b *testing.B) { benchmarkBaseAND(b, 4096) } func benchmarkBaseAND(b *testing.B, size int) { - b.Helper() p, q := make([]byte, size), make([]byte, size) for i := 0; i < b.N; i++ { @@ -174,7 +170,6 @@ func BenchmarkFastOR2KB(b *testing.B) { benchmarkFastOR(b, 2048) } func BenchmarkFastOR4KB(b *testing.B) { benchmarkFastOR(b, 4096) } func benchmarkFastOR(b *testing.B, size int) { - b.Helper() p, q := make([]byte, size), make([]byte, size) for i := 0; i < b.N; i++ { @@ -188,7 +183,6 @@ func BenchmarkBaseOR2KB(b *testing.B) { benchmarkBaseOR(b, 2048) } func BenchmarkBaseOR4KB(b *testing.B) { benchmarkBaseOR(b, 4096) } func benchmarkBaseOR(b *testing.B, size int) { - b.Helper() p, q := make([]byte, size), make([]byte, size) for i := 0; i < b.N; i++ { @@ -204,7 +198,6 @@ func BenchmarkFastTest2KB(b *testing.B) { benchmarkFastTest(b, 2048) } func BenchmarkFastTest4KB(b *testing.B) { benchmarkFastTest(b, 4096) } func benchmarkFastTest(b *testing.B, size int) { - b.Helper() p := make([]byte, size) a := false for i := 0; i < b.N; i++ { @@ -219,7 +212,6 @@ func BenchmarkBaseTest2KB(b *testing.B) { benchmarkBaseTest(b, 2048) } func BenchmarkBaseTest4KB(b *testing.B) { benchmarkBaseTest(b, 4096) } func benchmarkBaseTest(b *testing.B, size int) { - b.Helper() p := make([]byte, size) a := false for i := 0; i < b.N; i++ { diff --git a/erigon-lib/common/bitutil/compress.go b/common/bitutil/compress.go similarity index 100% rename from erigon-lib/common/bitutil/compress.go rename to common/bitutil/compress.go diff --git a/erigon-lib/common/bitutil/compress_test.go b/common/bitutil/compress_test.go similarity index 99% rename from erigon-lib/common/bitutil/compress_test.go rename to common/bitutil/compress_test.go index b970aff6d00..5f1484a5582 100644 --- a/erigon-lib/common/bitutil/compress_test.go +++ b/common/bitutil/compress_test.go @@ -167,7 +167,6 @@ func BenchmarkEncoding2KBSaturated(b *testing.B) { benchmarkEncoding(b, 2048, 0. func BenchmarkEncoding4KBSaturated(b *testing.B) { benchmarkEncoding(b, 4096, 0.5) } func benchmarkEncoding(b *testing.B, bytes int, fill float64) { - b.Helper() // Generate a random slice of bytes to compress random := rand.NewSource(0) // reproducible and comparable diff --git a/common/bytes.go b/common/bytes.go new file mode 100644 index 00000000000..5b9d1306e27 --- /dev/null +++ b/common/bytes.go @@ -0,0 +1,130 @@ +// Copyright 2014 The go-ethereum Authors +// (original work) +// Copyright 2024 The Erigon Authors +// (modifications) +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +// Package common contains various helper functions. +package common + +import ( + "bytes" + "encoding/hex" + + "github.com/erigontech/erigon-lib/common" +) + +// FromHex returns the bytes represented by the hexadecimal string s. +// s may be prefixed with "0x". +func FromHex(s string) []byte { + if has0xPrefix(s) { + s = s[2:] + } + if len(s)%2 == 1 { + s = "0" + s + } + return common.Hex2Bytes(s) +} + +// has0xPrefix validates str begins with '0x' or '0X'. +func has0xPrefix(str string) bool { + return len(str) >= 2 && str[0] == '0' && (str[1] == 'x' || str[1] == 'X') +} + +// isHexCharacter returns bool of c being a valid hexadecimal. +func isHexCharacter(c byte) bool { + return ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') +} + +// isHex validates whether each byte is valid hexadecimal string. +func isHex(str string) bool { + if len(str)%2 != 0 { + return false + } + for _, c := range []byte(str) { + if !isHexCharacter(c) { + return false + } + } + return true +} + +// Bytes2Hex returns the hexadecimal encoding of d. +func Bytes2Hex(d []byte) string { + return hex.EncodeToString(d) +} + +// RightPadBytes zero-pads slice to the right up to length l. +func RightPadBytes(slice []byte, l int) []byte { + if l <= len(slice) { + return slice + } + + padded := make([]byte, l) + copy(padded, slice) + + return padded +} + +// LeftPadBytes zero-pads slice to the left up to length l. +func LeftPadBytes(slice []byte, l int) []byte { + if l <= len(slice) { + return slice + } + + padded := make([]byte, l) + copy(padded[l-len(slice):], slice) + + return padded +} + +// TrimLeftZeroes returns a subslice of s without leading zeroes +func TrimLeftZeroes(s []byte) []byte { + idx := 0 + for ; idx < len(s); idx++ { + if s[idx] != 0 { + break + } + } + return s[idx:] +} + +// TrimRightZeroes returns a subslice of s without trailing zeroes +func TrimRightZeroes(s []byte) []byte { + idx := len(s) + for ; idx > 0; idx-- { + if s[idx-1] != 0 { + break + } + } + return s[:idx] +} + +func KeyCmp(key1, key2 []byte) (int, bool) { + switch { + //both keys are empty + case len(key1) == 0 && len(key2) == 0: + return 0, true + // key1 is empty + case len(key1) == 0 && len(key2) != 0: + return 1, false + // key2 is empty + case len(key1) != 0 && len(key2) == 0: + return -1, false + default: + return bytes.Compare(key1, key2), false + } +} diff --git a/erigon-lib/common/bytes_test.go b/common/bytes_test.go similarity index 97% rename from erigon-lib/common/bytes_test.go rename to common/bytes_test.go index 235a60912a7..50178a5edf2 100644 --- a/erigon-lib/common/bytes_test.go +++ b/common/bytes_test.go @@ -22,12 +22,14 @@ package common import ( "bytes" "testing" + + "github.com/erigontech/erigon-lib/common" ) func TestCopyBytes(t *testing.T) { input := []byte{1, 2, 3, 4} - v := CopyBytes(input) + v := common.CopyBytes(input) if !bytes.Equal(v, []byte{1, 2, 3, 4}) { t.Fatal("not equal after copy") } diff --git a/erigon-lib/common/compiler/helpers.go b/common/compiler/helpers.go similarity index 100% rename from erigon-lib/common/compiler/helpers.go rename to common/compiler/helpers.go diff --git a/erigon-lib/common/compiler/solidity.go b/common/compiler/solidity.go similarity index 100% rename from erigon-lib/common/compiler/solidity.go rename to common/compiler/solidity.go diff --git a/erigon-lib/common/compiler/test.v.py b/common/compiler/test.v.py similarity index 100% rename from erigon-lib/common/compiler/test.v.py rename to common/compiler/test.v.py diff --git a/erigon-lib/common/compiler/test_bad.v.py b/common/compiler/test_bad.v.py similarity index 100% rename from erigon-lib/common/compiler/test_bad.v.py rename to common/compiler/test_bad.v.py diff --git a/erigon-lib/common/compiler/vyper.go b/common/compiler/vyper.go similarity index 100% rename from erigon-lib/common/compiler/vyper.go rename to common/compiler/vyper.go diff --git a/erigon-lib/common/compiler/vyper_test.go b/common/compiler/vyper_test.go similarity index 99% rename from erigon-lib/common/compiler/vyper_test.go rename to common/compiler/vyper_test.go index 251d02e8f3e..13ad279138e 100644 --- a/erigon-lib/common/compiler/vyper_test.go +++ b/common/compiler/vyper_test.go @@ -25,7 +25,6 @@ import ( ) func skipWithoutVyper(t *testing.T) { - t.Helper() if _, err := exec.LookPath("vyper"); err != nil { t.Skip(err) } diff --git a/erigon-lib/common/debug.go b/common/debug.go similarity index 100% rename from erigon-lib/common/debug.go rename to common/debug.go diff --git a/erigon-lib/common/debug/callers.go b/common/debug/callers.go similarity index 100% rename from erigon-lib/common/debug/callers.go rename to common/debug/callers.go diff --git a/erigon-lib/common/debug/log_panic.go b/common/debug/log_panic.go similarity index 100% rename from erigon-lib/common/debug/log_panic.go rename to common/debug/log_panic.go diff --git a/erigon-lib/common/debug/pprof_cgo.go b/common/debug/pprof_cgo.go similarity index 100% rename from erigon-lib/common/debug/pprof_cgo.go rename to common/debug/pprof_cgo.go diff --git a/core/debugprint/receipts.go b/common/debugprint/receipts.go similarity index 100% rename from core/debugprint/receipts.go rename to common/debugprint/receipts.go diff --git a/erigon-lib/common/fdlimit/fdlimit_bsd.go b/common/fdlimit/fdlimit_bsd.go similarity index 100% rename from erigon-lib/common/fdlimit/fdlimit_bsd.go rename to common/fdlimit/fdlimit_bsd.go diff --git a/erigon-lib/common/fdlimit/fdlimit_darwin.go b/common/fdlimit/fdlimit_darwin.go similarity index 100% rename from erigon-lib/common/fdlimit/fdlimit_darwin.go rename to common/fdlimit/fdlimit_darwin.go diff --git a/erigon-lib/common/fdlimit/fdlimit_test.go b/common/fdlimit/fdlimit_test.go similarity index 100% rename from erigon-lib/common/fdlimit/fdlimit_test.go rename to common/fdlimit/fdlimit_test.go diff --git a/erigon-lib/common/fdlimit/fdlimit_unix.go b/common/fdlimit/fdlimit_unix.go similarity index 100% rename from erigon-lib/common/fdlimit/fdlimit_unix.go rename to common/fdlimit/fdlimit_unix.go diff --git a/erigon-lib/common/fdlimit/fdlimit_windows.go b/common/fdlimit/fdlimit_windows.go similarity index 100% rename from erigon-lib/common/fdlimit/fdlimit_windows.go rename to common/fdlimit/fdlimit_windows.go diff --git a/erigon-lib/common/mclock/mclock.go b/common/mclock/mclock.go similarity index 100% rename from erigon-lib/common/mclock/mclock.go rename to common/mclock/mclock.go diff --git a/erigon-lib/common/mclock/mclock.s b/common/mclock/mclock.s similarity index 100% rename from erigon-lib/common/mclock/mclock.s rename to common/mclock/mclock.s diff --git a/erigon-lib/common/mclock/simclock.go b/common/mclock/simclock.go similarity index 100% rename from erigon-lib/common/mclock/simclock.go rename to common/mclock/simclock.go diff --git a/erigon-lib/common/mclock/simclock_test.go b/common/mclock/simclock_test.go similarity index 100% rename from erigon-lib/common/mclock/simclock_test.go rename to common/mclock/simclock_test.go diff --git a/erigon-lib/common/path.go b/common/path.go similarity index 100% rename from erigon-lib/common/path.go rename to common/path.go diff --git a/erigon-lib/common/paths/paths.go b/common/paths/paths.go similarity index 100% rename from erigon-lib/common/paths/paths.go rename to common/paths/paths.go diff --git a/erigon-lib/common/prque/prque.go b/common/prque/prque.go similarity index 100% rename from erigon-lib/common/prque/prque.go rename to common/prque/prque.go diff --git a/erigon-lib/common/prque/prque_test.go b/common/prque/prque_test.go similarity index 100% rename from erigon-lib/common/prque/prque_test.go rename to common/prque/prque_test.go diff --git a/erigon-lib/common/prque/sstack.go b/common/prque/sstack.go similarity index 100% rename from erigon-lib/common/prque/sstack.go rename to common/prque/sstack.go diff --git a/erigon-lib/common/prque/sstack_test.go b/common/prque/sstack_test.go similarity index 100% rename from erigon-lib/common/prque/sstack_test.go rename to common/prque/sstack_test.go diff --git a/erigon-lib/common/size.go b/common/size.go similarity index 100% rename from erigon-lib/common/size.go rename to common/size.go diff --git a/erigon-lib/common/size_test.go b/common/size_test.go similarity index 100% rename from erigon-lib/common/size_test.go rename to common/size_test.go diff --git a/erigon-lib/common/test_utils.go b/common/test_utils.go similarity index 95% rename from erigon-lib/common/test_utils.go rename to common/test_utils.go index 0ed165919e5..455c7069034 100644 --- a/erigon-lib/common/test_utils.go +++ b/common/test_utils.go @@ -32,7 +32,7 @@ func LoadJSON(file string, val interface{}) error { return err } if err := json.Unmarshal(content, val); err != nil { - if syntaxerr, ok := err.(*json.SyntaxError); ok { //nolint:errorlint + if syntaxerr, ok := err.(*json.SyntaxError); ok { line := findLine(content, syntaxerr.Offset) return fmt.Errorf("JSON syntax error at %v:%v: %w", file, line, err) } diff --git a/erigon-lib/common/tuples.go b/common/tuples.go similarity index 100% rename from erigon-lib/common/tuples.go rename to common/tuples.go diff --git a/erigon-lib/common/tuples_test.go b/common/tuples_test.go similarity index 100% rename from erigon-lib/common/tuples_test.go rename to common/tuples_test.go diff --git a/erigon-lib/common/types.go b/common/types.go similarity index 89% rename from erigon-lib/common/types.go rename to common/types.go index 4f87da3ce6e..ae31348b168 100644 --- a/erigon-lib/common/types.go +++ b/common/types.go @@ -24,8 +24,10 @@ import ( "encoding/hex" "encoding/json" "errors" + "reflect" "strings" + libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/length" @@ -40,7 +42,7 @@ const ( ) // UnprefixedHash allows marshaling a Hash without 0x prefix. -type UnprefixedHash Hash +type UnprefixedHash libcommon.Hash // UnmarshalText decodes the hash from hex. The 0x prefix is optional. func (h *UnprefixedHash) UnmarshalText(input []byte) error { @@ -52,8 +54,12 @@ func (h UnprefixedHash) MarshalText() ([]byte, error) { return []byte(hex.EncodeToString(h[:])), nil } +/////////// Address + +var addressT = reflect.TypeOf(libcommon.Address{}) + // UnprefixedAddress allows marshaling an Address without 0x prefix. -type UnprefixedAddress Address +type UnprefixedAddress libcommon.Address // UnmarshalText decodes the address from hex. The 0x prefix is optional. func (a *UnprefixedAddress) UnmarshalText(input []byte) error { @@ -68,22 +74,22 @@ func (a UnprefixedAddress) MarshalText() ([]byte, error) { // MixedcaseAddress retains the original string, which may or may not be // correctly checksummed type MixedcaseAddress struct { - addr Address + addr libcommon.Address original string } // NewMixedcaseAddress constructor (mainly for testing) -func NewMixedcaseAddress(addr Address) MixedcaseAddress { +func NewMixedcaseAddress(addr libcommon.Address) MixedcaseAddress { return MixedcaseAddress{addr: addr, original: addr.Hex()} } // NewMixedcaseAddressFromString is mainly meant for unit-testing func NewMixedcaseAddressFromString(hexaddr string) (*MixedcaseAddress, error) { - if !IsHexAddress(hexaddr) { + if !libcommon.IsHexAddress(hexaddr) { return nil, errors.New("invalid address") } a := FromHex(hexaddr) - return &MixedcaseAddress{addr: BytesToAddress(a), original: hexaddr}, nil + return &MixedcaseAddress{addr: libcommon.BytesToAddress(a), original: hexaddr}, nil } // UnmarshalJSON parses MixedcaseAddress @@ -103,7 +109,7 @@ func (ma *MixedcaseAddress) MarshalJSON() ([]byte, error) { } // Address returns the address -func (ma *MixedcaseAddress) Address() Address { +func (ma *MixedcaseAddress) Address() libcommon.Address { return ma.addr } @@ -126,7 +132,7 @@ func (ma *MixedcaseAddress) Original() string { } // Addresses is a slice of libcommon.Address, implementing sort.Interface -type Addresses []Address +type Addresses []libcommon.Address func (addrs Addresses) Len() int { return len(addrs) @@ -139,7 +145,7 @@ func (addrs Addresses) Swap(i, j int) { } // Hashes is a slice of libcommon.Hash, implementing sort.Interface -type Hashes []Hash +type Hashes []libcommon.Hash func (hashes Hashes) Len() int { return len(hashes) diff --git a/erigon-lib/common/types_test.go b/common/types_test.go similarity index 96% rename from erigon-lib/common/types_test.go rename to common/types_test.go index ec93c88607d..7918817aef7 100644 --- a/erigon-lib/common/types_test.go +++ b/common/types_test.go @@ -28,13 +28,15 @@ import ( "reflect" "strings" "testing" + + libcommon "github.com/erigontech/erigon-lib/common" ) func TestBytesConversion(t *testing.T) { byteSlice := []byte{5} - hash := BytesToHash(byteSlice) + hash := libcommon.BytesToHash(byteSlice) - var exp Hash + var exp libcommon.Hash exp[31] = 5 if hash != exp { @@ -59,7 +61,7 @@ func TestIsHexAddress(t *testing.T) { } for _, test := range tests { - if result := IsHexAddress(test.str); result != test.exp { + if result := libcommon.IsHexAddress(test.str); result != test.exp { t.Errorf("IsHexAddress(%s) == %v; expected %v", test.str, result, test.exp) } @@ -81,7 +83,7 @@ func TestHashJsonValidation(t *testing.T) { } for _, test := range tests { input := `"` + test.Prefix + strings.Repeat("0", test.Size) + `"` - var v Hash + var v libcommon.Hash err := json.Unmarshal([]byte(input), &v) if err == nil { if test.Error != "" { @@ -110,7 +112,7 @@ func TestAddressUnmarshalJSON(t *testing.T) { {`"0x0000000000000000000000000000000000000010"`, false, big.NewInt(16)}, } for i, test := range tests { - var v Address + var v libcommon.Address err := json.Unmarshal([]byte(test.Input), &v) if err != nil && !test.ShouldErr { t.Errorf("test #%d: unexpected error: %v", i, err) @@ -143,7 +145,7 @@ func TestAddressHexChecksum(t *testing.T) { {"0x000000000000000000000000000000000000000a", "0x000000000000000000000000000000000000000A"}, } for i, test := range tests { - output := HexToAddress(test.Input).Hex() + output := libcommon.HexToAddress(test.Input).Hex() if output != test.Output { t.Errorf("test #%d: failed to match when it should (%s != %s)", i, output, test.Output) } @@ -151,7 +153,7 @@ func TestAddressHexChecksum(t *testing.T) { } func BenchmarkAddressHex(b *testing.B) { - testAddr := HexToAddress("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") + testAddr := libcommon.HexToAddress("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") for n := 0; n < b.N; n++ { testAddr.Hex() } @@ -236,7 +238,7 @@ func TestHash_Scan(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - h := &Hash{} + h := &libcommon.Hash{} if err := h.Scan(tt.args.src); (err != nil) != tt.wantErr { t.Errorf("Hash.Scan() error = %v, wantErr %v", err, tt.wantErr) } @@ -262,11 +264,11 @@ func TestHash_Value(t *testing.T) { 0xa2, 0x18, 0xc6, 0xa9, 0x27, 0x4d, 0x30, 0xab, 0x9a, 0x15, 0x10, 0x00, } - var usedH Hash + var usedH libcommon.Hash usedH.SetBytes(b) tests := []struct { name string - h Hash + h libcommon.Hash want driver.Value wantErr bool }{ @@ -324,7 +326,7 @@ func TestAddress_Scan(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - a := &Address{} + a := &libcommon.Address{} if err := a.Scan(tt.args.src); (err != nil) != tt.wantErr { t.Errorf("Address.Scan() error = %v, wantErr %v", err, tt.wantErr) } @@ -348,11 +350,11 @@ func TestAddress_Value(t *testing.T) { 0xb2, 0x6f, 0x2b, 0x34, 0x2a, 0xab, 0x24, 0xbc, 0xf6, 0x3e, 0xa2, 0x18, 0xc6, 0xa9, 0x27, 0x4d, 0x30, 0xab, 0x9a, 0x15, } - var usedA Address + var usedA libcommon.Address usedA.SetBytes(b) tests := []struct { name string - a Address + a libcommon.Address want driver.Value wantErr bool }{ @@ -382,7 +384,7 @@ func TestAddress_Format(t *testing.T) { 0xb2, 0x6f, 0x2b, 0x34, 0x2a, 0xab, 0x24, 0xbc, 0xf6, 0x3e, 0xa2, 0x18, 0xc6, 0xa9, 0x27, 0x4d, 0x30, 0xab, 0x9a, 0x15, } - var addr Address + var addr libcommon.Address addr.SetBytes(b) tests := []struct { @@ -457,7 +459,7 @@ func TestAddress_Format(t *testing.T) { } func TestHash_Format(t *testing.T) { - var hash Hash + var hash libcommon.Hash hash.SetBytes([]byte{ 0xb2, 0x6f, 0x2b, 0x34, 0x2a, 0xab, 0x24, 0xbc, 0xf6, 0x3e, 0xa2, 0x18, 0xc6, 0xa9, 0x27, 0x4d, 0x30, 0xab, 0x9a, 0x15, diff --git a/common/u256/big.go b/common/u256/big.go new file mode 100644 index 00000000000..f03cba28ef7 --- /dev/null +++ b/common/u256/big.go @@ -0,0 +1,36 @@ +// Copyright 2014 The go-ethereum Authors +// (original work) +// Copyright 2024 The Erigon Authors +// (modifications) +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package u256 + +import ( + "github.com/holiman/uint256" +) + +// Common big integers often used +var ( + Num0 = uint256.NewInt(0) + Num1 = uint256.NewInt(1) + Num2 = uint256.NewInt(2) + Num4 = uint256.NewInt(4) + Num8 = uint256.NewInt(8) + Num27 = uint256.NewInt(27) + Num32 = uint256.NewInt(32) + Num35 = uint256.NewInt(35) +) diff --git a/consensus/aura/aura.go b/consensus/aura/aura.go index 1ce7be14920..05000a6bf34 100644 --- a/consensus/aura/aura.go +++ b/consensus/aura/aura.go @@ -33,7 +33,6 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/clique" "github.com/erigontech/erigon/consensus/ethash" @@ -41,6 +40,7 @@ import ( "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/vm/evmtypes" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" ) diff --git a/consensus/aura/aura_test.go b/consensus/aura/aura_test.go index f95e5815693..b26c59a0c49 100644 --- a/consensus/aura/aura_test.go +++ b/consensus/aura/aura_test.go @@ -30,13 +30,13 @@ import ( "github.com/erigontech/erigon-lib/kv/memdb" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/trie" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/consensus/aura" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/turbo/stages/mock" + "github.com/erigontech/erigon/turbo/trie" ) // Check that the first block of Gnosis Chain, which doesn't have any transactions, diff --git a/consensus/aura/config.go b/consensus/aura/config.go index 2f4d775870f..4ed031fcb09 100644 --- a/consensus/aura/config.go +++ b/consensus/aura/config.go @@ -26,7 +26,7 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/u256" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus" ) diff --git a/consensus/aura/empty_step.go b/consensus/aura/empty_step.go index b95c16c177c..37a498dd827 100644 --- a/consensus/aura/empty_step.go +++ b/consensus/aura/empty_step.go @@ -25,7 +25,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) // A message broadcast by authorities when it's their turn to seal a block but there are no diff --git a/consensus/aura/validators.go b/consensus/aura/validators.go index 45deb297650..f6883b0981a 100644 --- a/consensus/aura/validators.go +++ b/consensus/aura/validators.go @@ -28,17 +28,17 @@ import ( lru "github.com/hashicorp/golang-lru/v2" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/aura/auraabi" "github.com/erigontech/erigon/consensus/aura/aurainterfaces" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" ) // nolint diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index c72202bb31b..47b5cf61d83 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -36,21 +36,21 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/crypto/cryptopool" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/dbutils" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/core/vm/evmtypes" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/services" ) diff --git a/consensus/consensus.go b/consensus/consensus.go index 0429f57e335..fb8c00ae76a 100644 --- a/consensus/consensus.go +++ b/consensus/consensus.go @@ -29,11 +29,11 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/vm/evmtypes" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" ) diff --git a/consensus/ethash/algorithm.go b/consensus/ethash/algorithm.go index b094d469917..6747790a263 100644 --- a/consensus/ethash/algorithm.go +++ b/consensus/ethash/algorithm.go @@ -33,11 +33,11 @@ import ( "golang.org/x/crypto/sha3" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/bitutil" - "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/bitutil" + "github.com/erigontech/erigon/common/debug" ) const ( diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index 2ab2624f96d..fbb3130f8b8 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -36,8 +36,7 @@ import ( "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common/u256" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/ethash/ethashcfg" "github.com/erigontech/erigon/consensus/misc" @@ -45,6 +44,7 @@ import ( "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" ) // Ethash proof-of-work protocol constants. diff --git a/consensus/ethash/ethash.go b/consensus/ethash/ethash.go index 4b8219d9398..08e3f79359a 100644 --- a/consensus/ethash/ethash.go +++ b/consensus/ethash/ethash.go @@ -40,7 +40,7 @@ import ( "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/ethash/ethashcfg" "github.com/erigontech/erigon/core/vm/evmtypes" diff --git a/consensus/ethash/meter.go b/consensus/ethash/meter.go index b6a90e60fc0..1414dac98fb 100644 --- a/consensus/ethash/meter.go +++ b/consensus/ethash/meter.go @@ -22,7 +22,7 @@ import ( "sync/atomic" "time" - "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon/common/debug" ) func newHashRateMeter() *hashRateMeter { diff --git a/consensus/result.go b/consensus/result.go index f08544cc51d..2bf12da0a6e 100644 --- a/consensus/result.go +++ b/consensus/result.go @@ -19,8 +19,8 @@ package consensus import ( "context" - "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/core/types" ) diff --git a/core/blockchain.go b/core/blockchain.go index 8d86276b636..eb6f35ff483 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -36,8 +36,7 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/metrics" - "github.com/erigontech/erigon-lib/common/u256" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/tracing" @@ -46,6 +45,7 @@ import ( "github.com/erigontech/erigon/core/vm/evmtypes" "github.com/erigontech/erigon/eth/ethutils" bortypes "github.com/erigontech/erigon/polygon/bor/types" + "github.com/erigontech/erigon/rlp" ) var ( diff --git a/core/chain_makers.go b/core/chain_makers.go index 3b31c8b6ff2..5ab070225d8 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -33,17 +33,17 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon-lib/rlp" libstate "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/merge" "github.com/erigontech/erigon/consensus/misc" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" ) // BlockGen creates blocks for testing. diff --git a/core/forkid/forkid_test.go b/core/forkid/forkid_test.go index 37b69875e95..4e1907f1415 100644 --- a/core/forkid/forkid_test.go +++ b/core/forkid/forkid_test.go @@ -27,8 +27,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" ) // TestCreation tests that different genesis and fork rule combinations result in diff --git a/core/genesis_test.go b/core/genesis_test.go index 83c4820dfc9..84042f9e7ae 100644 --- a/core/genesis_test.go +++ b/core/genesis_test.go @@ -28,7 +28,6 @@ import ( "github.com/stretchr/testify/require" "github.com/erigontech/erigon-lib/chain/networkname" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/crypto" @@ -36,6 +35,7 @@ import ( "github.com/erigontech/erigon-lib/kv/rawdbv3" "github.com/erigontech/erigon-lib/kv/temporal/temporaltest" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" diff --git a/core/genesis_write.go b/core/genesis_write.go index a7820b4aa61..1320d0aef2b 100644 --- a/core/genesis_write.go +++ b/core/genesis_write.go @@ -35,7 +35,6 @@ import ( "github.com/erigontech/erigon-lib/chain" "github.com/erigontech/erigon-lib/chain/networkname" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/common/hexutil" @@ -47,6 +46,7 @@ import ( "github.com/erigontech/erigon-lib/kv/temporal" "github.com/erigontech/erigon-lib/log/v3" state2 "github.com/erigontech/erigon-lib/state" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/tracing" diff --git a/core/mkalloc.go b/core/mkalloc.go index 125190f2357..184187cef44 100644 --- a/core/mkalloc.go +++ b/core/mkalloc.go @@ -35,8 +35,8 @@ import ( "sort" "strconv" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" ) type allocItem struct{ Addr, Balance *big.Int } diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index 55a6641c3b3..694e82d6b73 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -40,9 +40,9 @@ import ( "github.com/erigontech/erigon-lib/kv/dbutils" "github.com/erigontech/erigon-lib/kv/rawdbv3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/ethdb/cbor" + "github.com/erigontech/erigon/rlp" ) // ReadCanonicalHash retrieves the hash assigned to a canonical block number. diff --git a/core/rawdb/accessors_chain_test.go b/core/rawdb/accessors_chain_test.go index 4d3ed9e6a3f..4b88e04ae1e 100644 --- a/core/rawdb/accessors_chain_test.go +++ b/core/rawdb/accessors_chain_test.go @@ -31,14 +31,14 @@ import ( "golang.org/x/crypto/sha3" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv/memdb" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/core/rlp_test.go b/core/rlp_test.go index 04678fc61ce..82eb876d904 100644 --- a/core/rlp_test.go +++ b/core/rlp_test.go @@ -28,14 +28,14 @@ import ( "golang.org/x/crypto/sha3" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/core/snaptype/block_types.go b/core/snaptype/block_types.go index 62854c1a163..98bf47a284f 100644 --- a/core/snaptype/block_types.go +++ b/core/snaptype/block_types.go @@ -36,9 +36,9 @@ import ( "github.com/erigontech/erigon-lib/downloader/snaptype" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/recsplit" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon-lib/seg" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/txnprovider/txpool" ) diff --git a/core/state/cached_reader.go b/core/state/cached_reader.go index fba1496474b..629c1d0da09 100644 --- a/core/state/cached_reader.go +++ b/core/state/cached_reader.go @@ -19,7 +19,7 @@ package state import ( "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/turbo/shards" ) diff --git a/core/state/cached_reader3.go b/core/state/cached_reader3.go index b8ceec09f76..81f2e18a7d6 100644 --- a/core/state/cached_reader3.go +++ b/core/state/cached_reader3.go @@ -23,7 +23,7 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/kvcache" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" ) // CachedReader3 is a wrapper for an instance of type StateReader diff --git a/core/state/cached_writer.go b/core/state/cached_writer.go index b3b6850080d..db832e4475f 100644 --- a/core/state/cached_writer.go +++ b/core/state/cached_writer.go @@ -21,7 +21,7 @@ import ( "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/turbo/shards" ) diff --git a/core/state/contracts/gen_changer.go b/core/state/contracts/gen_changer.go index 26e66ba0adc..7b78acb2399 100644 --- a/core/state/contracts/gen_changer.go +++ b/core/state/contracts/gen_changer.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/core/state/contracts/gen_phoenix.go b/core/state/contracts/gen_phoenix.go index 9ba545f3357..4d683e4f3fa 100644 --- a/core/state/contracts/gen_phoenix.go +++ b/core/state/contracts/gen_phoenix.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/core/state/contracts/gen_poly.go b/core/state/contracts/gen_poly.go index d19fabe2014..4a672411d4e 100644 --- a/core/state/contracts/gen_poly.go +++ b/core/state/contracts/gen_poly.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/core/state/contracts/gen_revive.go b/core/state/contracts/gen_revive.go index af48b7bf9c6..64e4dbfaebe 100644 --- a/core/state/contracts/gen_revive.go +++ b/core/state/contracts/gen_revive.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/core/state/contracts/gen_revive2.go b/core/state/contracts/gen_revive2.go index 588bba45b9b..b017e744d5d 100644 --- a/core/state/contracts/gen_revive2.go +++ b/core/state/contracts/gen_revive2.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/core/state/contracts/gen_selfdestruct.go b/core/state/contracts/gen_selfdestruct.go index cea4977b7d9..15257b0259d 100644 --- a/core/state/contracts/gen_selfdestruct.go +++ b/core/state/contracts/gen_selfdestruct.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/core/state/database.go b/core/state/database.go index eccdc195b2d..f99f7516451 100644 --- a/core/state/database.go +++ b/core/state/database.go @@ -25,7 +25,7 @@ import ( "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" ) const ( diff --git a/core/state/database_test.go b/core/state/database_test.go index 83d36886e5f..55e466820ed 100644 --- a/core/state/database_test.go +++ b/core/state/database_test.go @@ -31,7 +31,6 @@ import ( "github.com/stretchr/testify/require" "github.com/erigontech/erigon-lib/chain" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv" @@ -39,6 +38,7 @@ import ( state3 "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/accounts/abi/bind/backends" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/state/contracts" diff --git a/core/state/dump.go b/core/state/dump.go index aced41f6052..774cb1a7d3d 100644 --- a/core/state/dump.go +++ b/core/state/dump.go @@ -24,15 +24,15 @@ import ( "errors" "fmt" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/order" "github.com/erigontech/erigon-lib/kv/rawdbv3" - "github.com/erigontech/erigon-lib/trie" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/core/types/accounts" + "github.com/erigontech/erigon/turbo/trie" ) type Dumper struct { diff --git a/core/state/history_reader_v3.go b/core/state/history_reader_v3.go index 05db794cb5f..d404d1ba82d 100644 --- a/core/state/history_reader_v3.go +++ b/core/state/history_reader_v3.go @@ -22,7 +22,7 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" ) // HistoryReaderV3 Implements StateReader and StateWriter diff --git a/core/state/intra_block_state.go b/core/state/intra_block_state.go index 721bf2b574c..ff09d7ead60 100644 --- a/core/state/intra_block_state.go +++ b/core/state/intra_block_state.go @@ -29,13 +29,13 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/trie" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/core/vm/evmtypes" + "github.com/erigontech/erigon/turbo/trie" ) var _ evmtypes.IntraBlockState = new(IntraBlockState) // compile-time interface-check diff --git a/core/state/rw_v3.go b/core/state/rw_v3.go index e691c6a0c20..56c438bc975 100644 --- a/core/state/rw_v3.go +++ b/core/state/rw_v3.go @@ -34,7 +34,7 @@ import ( "github.com/erigontech/erigon-lib/metrics" "github.com/erigontech/erigon-lib/state" libstate "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/turbo/shards" ) diff --git a/core/state/state_object.go b/core/state/state_object.go index b47058752f4..00f52adf149 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -29,10 +29,10 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon-lib/trie" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon/core/tracing" + "github.com/erigontech/erigon/core/types/accounts" + "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon/turbo/trie" ) var emptyCodeHash = crypto.Keccak256(nil) diff --git a/core/state/state_object_test.go b/core/state/state_object_test.go index e841e724dfd..9a77541b6a3 100644 --- a/core/state/state_object_test.go +++ b/core/state/state_object_test.go @@ -23,8 +23,8 @@ import ( "bytes" "testing" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" ) func BenchmarkCutOriginal(b *testing.B) { diff --git a/core/state/state_test.go b/core/state/state_test.go index 3a5665b359b..6712c5b36b5 100644 --- a/core/state/state_test.go +++ b/core/state/state_test.go @@ -39,8 +39,8 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/state" stateLib "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon/core/tracing" + "github.com/erigontech/erigon/core/types/accounts" ) var toAddr = common.BytesToAddress diff --git a/core/state/state_writer_v4.go b/core/state/state_writer_v4.go index a6d11763e24..12654ea5298 100644 --- a/core/state/state_writer_v4.go +++ b/core/state/state_writer_v4.go @@ -23,7 +23,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" ) var _ StateWriter = (*WriterV4)(nil) diff --git a/core/state/txtask.go b/core/state/txtask.go index 8604c3a38d4..ff4a79feeb9 100644 --- a/core/state/txtask.go +++ b/core/state/txtask.go @@ -29,8 +29,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/core/vm/evmtypes" ) diff --git a/core/state_transition.go b/core/state_transition.go index fdda38bd87c..44e6f3e0fa6 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -30,9 +30,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/fixedgas" "github.com/erigontech/erigon-lib/common/math" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/vm" diff --git a/core/test/domains_restart_test.go b/core/test/domains_restart_test.go index 5fd7ea02572..10e3acf5226 100644 --- a/core/test/domains_restart_test.go +++ b/core/test/domains_restart_test.go @@ -44,11 +44,11 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/state" types2 "github.com/erigontech/erigon-lib/types" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon/core" reset2 "github.com/erigontech/erigon/core/rawdb/rawdbreset" state2 "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/params" ) diff --git a/core/tx_cacher.go b/core/tx_cacher.go index 3bb7ca3b9cc..0bdb67c5a9e 100644 --- a/core/tx_cacher.go +++ b/core/tx_cacher.go @@ -23,7 +23,7 @@ import ( "sync" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/core/types" ) diff --git a/core/types/access_list_tx.go b/core/types/access_list_tx.go index eeadb2949e6..24f09377caa 100644 --- a/core/types/access_list_tx.go +++ b/core/types/access_list_tx.go @@ -31,8 +31,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" - rlp2 "github.com/erigontech/erigon-lib/rlp2" + rlp2 "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) // AccessTuple is the element type of an access list. diff --git a/erigon-lib/types/accounts/account.go b/core/types/accounts/account.go similarity index 98% rename from erigon-lib/types/accounts/account.go rename to core/types/accounts/account.go index 0221af2a1bd..736bc1e2152 100644 --- a/erigon-lib/types/accounts/account.go +++ b/core/types/accounts/account.go @@ -26,8 +26,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" - rlp2 "github.com/erigontech/erigon-lib/rlp2" + rlp2 "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) // Account is the Ethereum consensus representation of accounts. @@ -157,21 +157,21 @@ func decodeLengthForHashing(buffer []byte, pos int) (length int, structure bool, case firstByte < 192: // Next byte is the length of the length + 183 lenEnd := pos + 1 + firstByte - 183 - length = 0 + len := 0 for i := pos + 1; i < lenEnd; i++ { - length = (length << 8) + int(buffer[i]) + len = (len << 8) + int(buffer[i]) } - return length, false, lenEnd + return len, false, lenEnd case firstByte < 248: return firstByte - 192, true, pos + 1 default: // Next byte is the length of the length + 247 lenEnd := pos + 1 + firstByte - 247 - length = 0 + len := 0 for i := pos + 1; i < lenEnd; i++ { - length = (length << 8) + int(buffer[i]) + len = (len << 8) + int(buffer[i]) } - return length, true, lenEnd + return len, true, lenEnd } } diff --git a/erigon-lib/types/accounts/account_benchmark_test.go b/core/types/accounts/account_benchmark_test.go similarity index 100% rename from erigon-lib/types/accounts/account_benchmark_test.go rename to core/types/accounts/account_benchmark_test.go diff --git a/erigon-lib/types/accounts/account_proof.go b/core/types/accounts/account_proof.go similarity index 100% rename from erigon-lib/types/accounts/account_proof.go rename to core/types/accounts/account_proof.go diff --git a/erigon-lib/types/accounts/account_test.go b/core/types/accounts/account_test.go similarity index 99% rename from erigon-lib/types/accounts/account_test.go rename to core/types/accounts/account_test.go index 4f8d5087583..25226d0d32a 100644 --- a/erigon-lib/types/accounts/account_test.go +++ b/core/types/accounts/account_test.go @@ -194,7 +194,6 @@ func TestEncodeAccountWithEmptyBalanceAndNotZeroIncarnation(t *testing.T) { } func isAccountsEqual(t *testing.T, src, dst Account) { - t.Helper() if dst.Initialised != src.Initialised { t.Fatal("cant decode the account Initialised", src.Initialised, dst.Initialised) } @@ -326,7 +325,6 @@ func TestIncarnationWithInvalidEncodedAccount(t *testing.T) { } func isIncarnationEqual(t *testing.T, initialIncarnation uint64, decodedIncarnation uint64) { - t.Helper() if initialIncarnation != decodedIncarnation { t.Fatal("Can't decode the incarnation", initialIncarnation, decodedIncarnation) } diff --git a/core/types/authorization.go b/core/types/authorization.go index 35a39e16d68..ed9036b2db6 100644 --- a/core/types/authorization.go +++ b/core/types/authorization.go @@ -11,9 +11,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" - rlp2 "github.com/erigontech/erigon-lib/rlp2" + rlp2 "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" ) type Authorization struct { diff --git a/core/types/blob_tx.go b/core/types/blob_tx.go index 9ac4228cafd..72845624e3e 100644 --- a/core/types/blob_tx.go +++ b/core/types/blob_tx.go @@ -27,8 +27,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/fixedgas" - "github.com/erigontech/erigon-lib/rlp" - rlp2 "github.com/erigontech/erigon-lib/rlp2" + rlp2 "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) type BlobTx struct { diff --git a/core/types/blob_tx_wrapper.go b/core/types/blob_tx_wrapper.go index 1f6a9b3a84e..2f0a761f388 100644 --- a/core/types/blob_tx_wrapper.go +++ b/core/types/blob_tx_wrapper.go @@ -30,7 +30,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/fixedgas" libkzg "github.com/erigontech/erigon-lib/crypto/kzg" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) const ( diff --git a/core/types/block.go b/core/types/block.go index 9c5d857f70b..1a549caba0a 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -32,12 +32,12 @@ import ( "github.com/gballet/go-verkle" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/hexutility" - "github.com/erigontech/erigon-lib/rlp" - rlp2 "github.com/erigontech/erigon-lib/rlp2" + rlp2 "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/rlp" ) var ( diff --git a/core/types/block_test.go b/core/types/block_test.go index 69e62056374..87abce6ebd2 100644 --- a/core/types/block_test.go +++ b/core/types/block_test.go @@ -32,15 +32,15 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/math" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" ) // the following 2 functions are replica for the test @@ -606,5 +606,4 @@ func TestCopyTxs(t *testing.T) { copies := CopyTxs(txs) assert.Equal(t, txs, copies) - } diff --git a/core/types/dynamic_fee_tx.go b/core/types/dynamic_fee_tx.go index d9a6ed7a54a..225467caa4d 100644 --- a/core/types/dynamic_fee_tx.go +++ b/core/types/dynamic_fee_tx.go @@ -29,8 +29,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" - rlp2 "github.com/erigontech/erigon-lib/rlp2" + rlp2 "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) type DynamicFeeTransaction struct { diff --git a/core/types/encdec_test.go b/core/types/encdec_test.go index e25c976068e..b5a5e903568 100644 --- a/core/types/encdec_test.go +++ b/core/types/encdec_test.go @@ -28,7 +28,7 @@ import ( "github.com/holiman/uint256" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) const RUNS = 100 // for local tests increase this number diff --git a/core/types/gen_genesis.go b/core/types/gen_genesis.go index d6ff602976e..720cc0410ee 100644 --- a/core/types/gen_genesis.go +++ b/core/types/gen_genesis.go @@ -11,7 +11,7 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/math" - common0 "github.com/erigontech/erigon-lib/common" + common0 "github.com/erigontech/erigon/common" ) var _ = (*genesisSpecMarshaling)(nil) diff --git a/core/types/genesis.go b/core/types/genesis.go index 8e66640afa5..10c5e4f6526 100644 --- a/core/types/genesis.go +++ b/core/types/genesis.go @@ -32,7 +32,7 @@ import ( "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/math" - common2 "github.com/erigontech/erigon-lib/common" + common2 "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/params" ) diff --git a/core/types/hashing.go b/core/types/hashing.go index 6a632b2907d..44f54e62693 100644 --- a/core/types/hashing.go +++ b/core/types/hashing.go @@ -29,9 +29,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/crypto/cryptopool" - "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon-lib/rlphacks" - "github.com/erigontech/erigon-lib/trie" + "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon/turbo/rlphacks" + "github.com/erigontech/erigon/turbo/trie" ) type DerivableList interface { diff --git a/core/types/hashing_test.go b/core/types/hashing_test.go index dcd2e37c798..9898267f02d 100644 --- a/core/types/hashing_test.go +++ b/core/types/hashing_test.go @@ -25,8 +25,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon-lib/trie" + "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon/turbo/trie" ) func genTransactions(n uint64) Transactions { diff --git a/core/types/legacy_tx.go b/core/types/legacy_tx.go index 9696f97a4fb..1cffe818772 100644 --- a/core/types/legacy_tx.go +++ b/core/types/legacy_tx.go @@ -29,8 +29,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" - rlp2 "github.com/erigontech/erigon-lib/rlp2" + rlp2 "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) type CommonTx struct { diff --git a/core/types/log.go b/core/types/log.go index 5895578c509..bd4591e300a 100644 --- a/core/types/log.go +++ b/core/types/log.go @@ -27,7 +27,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) //(go:generate gencodec -type Log -field-override logMarshaling -out gen_log_json.go) diff --git a/core/types/receipt.go b/core/types/receipt.go index 38e987707d7..4cbd9af12fd 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -31,7 +31,7 @@ import ( "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) //(go:generate gencodec -type Receipt -field-override receiptMarshaling -out gen_receipt_json.go) diff --git a/core/types/receipt_test.go b/core/types/receipt_test.go index 3077a2708f3..7d7d8e64f95 100644 --- a/core/types/receipt_test.go +++ b/core/types/receipt_test.go @@ -29,12 +29,12 @@ import ( "github.com/holiman/uint256" "github.com/stretchr/testify/assert" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" ) func TestDecodeEmptyTypedReceipt(t *testing.T) { diff --git a/core/types/set_code_tx.go b/core/types/set_code_tx.go index be12f8aa6ef..fc6542f6375 100644 --- a/core/types/set_code_tx.go +++ b/core/types/set_code_tx.go @@ -27,9 +27,9 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" - rlp2 "github.com/erigontech/erigon-lib/rlp2" + rlp2 "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" ) const DelegateDesignationCodeSize = 23 diff --git a/core/types/transaction.go b/core/types/transaction.go index 3d9b4adc1d9..4e912cac451 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -36,8 +36,8 @@ import ( "github.com/erigontech/erigon-lib/common/math" libcrypto "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" - rlp2 "github.com/erigontech/erigon-lib/rlp2" + rlp2 "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) var ( diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index ff8467b063c..46767e9c430 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -31,8 +31,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon/common/u256" ) var ErrInvalidChainId = errors.New("invalid chain id for signer") diff --git a/core/types/transaction_test.go b/core/types/transaction_test.go index 7f9792cdd3e..dde277fe879 100644 --- a/core/types/transaction_test.go +++ b/core/types/transaction_test.go @@ -35,13 +35,13 @@ import ( "github.com/holiman/uint256" "github.com/stretchr/testify/assert" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/fixedgas" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/types/typestest" + "github.com/erigontech/erigon/rlp" ) // The values in those tests are from the Transaction Tests diff --git a/core/types/withdrawal.go b/core/types/withdrawal.go index 1dc0540d73a..a38d9542db8 100644 --- a/core/types/withdrawal.go +++ b/core/types/withdrawal.go @@ -27,8 +27,8 @@ import ( "github.com/erigontech/erigon-lib/common/hexutil" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon-lib/types/clonable" + "github.com/erigontech/erigon/rlp" ) //go:generate gencodec -type Withdrawal -field-override withdrawalMarshaling -out gen_withdrawal_json.go diff --git a/core/vm/common.go b/core/vm/common.go index fb63750eb3d..355d3a378d9 100644 --- a/core/vm/common.go +++ b/core/vm/common.go @@ -22,8 +22,8 @@ package vm import ( "github.com/holiman/uint256" - "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" + "github.com/erigontech/erigon/common" ) // calcMemSize64 calculates the required memory size, and returns diff --git a/core/vm/contracts.go b/core/vm/contracts.go index a026b64f1cb..ddf15224ceb 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -32,7 +32,6 @@ import ( "github.com/holiman/uint256" "github.com/erigontech/erigon-lib/chain" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/crypto" @@ -40,6 +39,7 @@ import ( "github.com/erigontech/erigon-lib/crypto/bn256" libkzg "github.com/erigontech/erigon-lib/crypto/kzg" "github.com/erigontech/erigon-lib/crypto/secp256r1" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/params" //lint:ignore SA1019 Needed for precompile diff --git a/core/vm/contracts_test.go b/core/vm/contracts_test.go index 357058f9ed6..a7c466677d8 100644 --- a/core/vm/contracts_test.go +++ b/core/vm/contracts_test.go @@ -29,7 +29,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" ) // precompiledTest defines the input/output pairs for precompiled contract tests. diff --git a/core/vm/evm.go b/core/vm/evm.go index a01a97d8a2a..fb46915fed3 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -26,12 +26,12 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/trie" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/vm/evmtypes" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/turbo/trie" ) var emptyHash = libcommon.Hash{} diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 17ccb4ae4ef..da5960d0504 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -31,7 +31,7 @@ import ( "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" diff --git a/core/vm/instructions_test.go b/core/vm/instructions_test.go index 7be19c87b3d..e9f6f08c92e 100644 --- a/core/vm/instructions_test.go +++ b/core/vm/instructions_test.go @@ -30,11 +30,11 @@ import ( "github.com/holiman/uint256" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/vm/evmtypes" "github.com/erigontech/erigon/core/vm/stack" diff --git a/core/vm/memory_test.go b/core/vm/memory_test.go index cd7854c4f9f..b87f1089705 100644 --- a/core/vm/memory_test.go +++ b/core/vm/memory_test.go @@ -21,7 +21,7 @@ import ( "strings" "testing" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" ) func TestMemoryCopy(t *testing.T) { diff --git a/core/vm/runtime/runtime_test.go b/core/vm/runtime/runtime_test.go index df98c37a8d0..d9f1054fcfe 100644 --- a/core/vm/runtime/runtime_test.go +++ b/core/vm/runtime/runtime_test.go @@ -40,9 +40,8 @@ import ( "github.com/erigontech/erigon-lib/log/v3" stateLib "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/accounts/abi" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/asm" @@ -50,6 +49,7 @@ import ( "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/eth/tracers/logger" + "github.com/erigontech/erigon/rlp" ) func NewTestTemporalDb(tb testing.TB) (kv.RwDB, kv.RwTx, *stateLib.Aggregator) { diff --git a/diagnostics/db.go b/diagnostics/db.go index 90d2e196ea8..36df284796f 100644 --- a/diagnostics/db.go +++ b/diagnostics/db.go @@ -25,9 +25,9 @@ import ( "path/filepath" "strings" - "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/mdbx" + "github.com/erigontech/erigon/common/paths" "github.com/urfave/cli/v2" ) diff --git a/docs/readthedocs/source/rpc/tutorial.rst b/docs/readthedocs/source/rpc/tutorial.rst index 5338d3d0dcd..7d903ae80ad 100644 --- a/docs/readthedocs/source/rpc/tutorial.rst +++ b/docs/readthedocs/source/rpc/tutorial.rst @@ -15,7 +15,7 @@ our daemon will only contain one method: `myNamespace_getBlockNumberByHash` whic "context" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/rawdb" ) diff --git a/erigon-lib/commitment/hex_patricia_hashed.go b/erigon-lib/commitment/hex_patricia_hashed.go index 95765476930..618dae69781 100644 --- a/erigon-lib/commitment/hex_patricia_hashed.go +++ b/erigon-lib/commitment/hex_patricia_hashed.go @@ -44,7 +44,7 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/length" - rlp "github.com/erigontech/erigon-lib/rlp2" + "github.com/erigontech/erigon-lib/rlp" ) // keccakState wraps sha3.state. In addition to the usual hash methods, it also supports diff --git a/erigon-lib/common/bytes.go b/erigon-lib/common/bytes.go index 8d1de9c7f85..5d35ca1afc7 100644 --- a/erigon-lib/common/bytes.go +++ b/erigon-lib/common/bytes.go @@ -18,7 +18,6 @@ package common import ( "bytes" - "encoding/hex" "fmt" ) @@ -92,93 +91,3 @@ func BytesToUint64(buf []byte) (x uint64) { } return } - -// has0xPrefix validates str begins with '0x' or '0X'. -func has0xPrefix(str string) bool { //nolint - return len(str) >= 2 && str[0] == '0' && (str[1] == 'x' || str[1] == 'X') -} - -// isHexCharacter returns bool of c being a valid hexadecimal. -func isHexCharacter(c byte) bool { - return ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') -} - -// isHex validates whether each byte is valid hexadecimal string. -func isHex(str string) bool { - if len(str)%2 != 0 { - return false - } - for _, c := range []byte(str) { - if !isHexCharacter(c) { - return false - } - } - return true -} - -// Bytes2Hex returns the hexadecimal encoding of d. -func Bytes2Hex(d []byte) string { - return hex.EncodeToString(d) -} - -// RightPadBytes zero-pads slice to the right up to length l. -func RightPadBytes(slice []byte, l int) []byte { - if l <= len(slice) { - return slice - } - - padded := make([]byte, l) - copy(padded, slice) - - return padded -} - -// LeftPadBytes zero-pads slice to the left up to length l. -func LeftPadBytes(slice []byte, l int) []byte { - if l <= len(slice) { - return slice - } - - padded := make([]byte, l) - copy(padded[l-len(slice):], slice) - - return padded -} - -// TrimLeftZeroes returns a subslice of s without leading zeroes -func TrimLeftZeroes(s []byte) []byte { - idx := 0 - for ; idx < len(s); idx++ { - if s[idx] != 0 { - break - } - } - return s[idx:] -} - -// TrimRightZeroes returns a subslice of s without trailing zeroes -func TrimRightZeroes(s []byte) []byte { - idx := len(s) - for ; idx > 0; idx-- { - if s[idx-1] != 0 { - break - } - } - return s[:idx] -} - -func KeyCmp(key1, key2 []byte) (int, bool) { - switch { - //both keys are empty - case len(key1) == 0 && len(key2) == 0: - return 0, true - // key1 is empty - case len(key1) == 0 && len(key2) != 0: - return 1, false - // key2 is empty - case len(key1) != 0 && len(key2) == 0: - return -1, false - default: - return bytes.Compare(key1, key2), false - } -} diff --git a/erigon-lib/common/u256/big.go b/erigon-lib/common/u256/big.go index d56c103067e..25b9863b3f7 100644 --- a/erigon-lib/common/u256/big.go +++ b/erigon-lib/common/u256/big.go @@ -22,22 +22,14 @@ import ( // Common big integers often used var ( - N0 = uint256.NewInt(0) - N1 = uint256.NewInt(1) - N2 = uint256.NewInt(2) - N4 = uint256.NewInt(4) - N8 = uint256.NewInt(8) - N27 = uint256.NewInt(27) - N28 = uint256.NewInt(28) - N32 = uint256.NewInt(32) - N35 = uint256.NewInt(35) - N100 = uint256.NewInt(100) - Num0 = uint256.NewInt(0) - Num1 = uint256.NewInt(1) - Num2 = uint256.NewInt(2) - Num4 = uint256.NewInt(4) - Num8 = uint256.NewInt(8) - Num27 = uint256.NewInt(27) - Num32 = uint256.NewInt(32) - Num35 = uint256.NewInt(35) + N0 = uint256.NewInt(0) + N1 = uint256.NewInt(1) + N2 = uint256.NewInt(2) + N4 = uint256.NewInt(4) + N8 = uint256.NewInt(8) + N27 = uint256.NewInt(27) + N28 = uint256.NewInt(28) + N32 = uint256.NewInt(32) + N35 = uint256.NewInt(35) + N100 = uint256.NewInt(100) ) diff --git a/erigon-lib/crypto/crypto.go b/erigon-lib/crypto/crypto.go index 066b78332fd..b1e017d2ff2 100644 --- a/erigon-lib/crypto/crypto.go +++ b/erigon-lib/crypto/crypto.go @@ -39,7 +39,7 @@ import ( "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/crypto/cryptopool" - rlp "github.com/erigontech/erigon-lib/rlp2" + "github.com/erigontech/erigon-lib/rlp" ) // SignatureLength indicates the byte length required to carry a signature with recovery id. diff --git a/erigon-lib/go.mod b/erigon-lib/go.mod index 486ad3e8613..0dd3d523f36 100644 --- a/erigon-lib/go.mod +++ b/erigon-lib/go.mod @@ -16,16 +16,13 @@ require ( github.com/anacrolix/go-libutp v1.3.1 github.com/anacrolix/log v0.15.2 github.com/anacrolix/torrent v1.52.6-0.20231201115409-7ea994b6bbd8 - github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b github.com/c2h5oh/datasize v0.0.0-20231215233829-aa82cc1e6500 github.com/containerd/cgroups/v3 v3.0.3 - github.com/crate-crypto/go-ipa v0.0.0-20221111143132-9aa5d42120bc github.com/crate-crypto/go-kzg-4844 v0.7.0 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 github.com/edsrzf/mmap-go v1.1.0 github.com/elastic/go-freelru v0.13.0 github.com/erigontech/speedtest v0.0.2 - github.com/gballet/go-verkle v0.0.0-20221121182333-31427a1f2d35 github.com/go-stack/stack v1.8.1 github.com/gofrs/flock v0.12.1 github.com/google/btree v1.1.3 @@ -96,7 +93,7 @@ require ( github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect - github.com/davecgh/go-spew v1.1.1 + github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/go-llsqlite/adapter v0.0.0-20230927005056-7f5ce7f0c916 // indirect diff --git a/erigon-lib/go.sum b/erigon-lib/go.sum index 63af7e40d9e..1279e36072c 100644 --- a/erigon-lib/go.sum +++ b/erigon-lib/go.sum @@ -88,8 +88,6 @@ github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx github.com/benbjohnson/immutable v0.2.0/go.mod h1:uc6OHo6PN2++n98KHLxW8ef4W42ylHiQSENghE1ezxI= github.com/benbjohnson/immutable v0.4.1-0.20221220213129-8932b999621d h1:2qVb9bsAMtmAfnxXltm+6eBzrrS7SZ52c3SedsulaMI= github.com/benbjohnson/immutable v0.4.1-0.20221220213129-8932b999621d/go.mod h1:iAr8OjJGLnLmVUr9MZ/rz4PWUy6Ouc2JLYuMArmvAJM= -github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b h1:5JgaFtHFRnOPReItxvhMDXbvuBkjSWE+9glJyF466yw= -github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b/go.mod h1:eMD2XUcPsHYbakFEocKrWZp47G0MRJYoC60qFblGjpA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -120,8 +118,6 @@ github.com/containerd/cgroups/v3 v3.0.3 h1:S5ByHZ/h9PMe5IOQoN7E+nMc2UcLEM/V48DGD github.com/containerd/cgroups/v3 v3.0.3/go.mod h1:8HBe7V3aWGLFPd/k03swSIsGjZhHI2WzJmticMgVuz0= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/crate-crypto/go-ipa v0.0.0-20221111143132-9aa5d42120bc h1:mtR7MuscVeP/s0/ERWA2uSr5QOrRYy1pdvZqG1USfXI= -github.com/crate-crypto/go-ipa v0.0.0-20221111143132-9aa5d42120bc/go.mod h1:gFnFS95y8HstDP6P9pPwzrxOOC5TRDkwbM+ao15ChAI= github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -169,8 +165,6 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/gballet/go-verkle v0.0.0-20221121182333-31427a1f2d35 h1:I8QswD9gf3VEpr7bpepKKOm7ChxFITIG+oc1I5/S0no= -github.com/gballet/go-verkle v0.0.0-20221121182333-31427a1f2d35/go.mod h1:DMDd04jjQgdynaAwbEgiRERIGpC8fDjx0+y06an7Psg= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= @@ -590,7 +584,6 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211020174200-9d6173849985/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/erigon-lib/rlp/commitment.go b/erigon-lib/rlp/commitment.go new file mode 100644 index 00000000000..7a3b744df07 --- /dev/null +++ b/erigon-lib/rlp/commitment.go @@ -0,0 +1,284 @@ +// Copyright 2022 The Erigon Authors +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package rlp + +import "io" + +// RLP-related utilities necessary for computing commitments for state root hash + +// generateRlpPrefixLenDouble calculates the length of RLP prefix to encode a string of bytes of length l "twice", +// meaning that it is the prefix for rlp(rlp(data)) +func generateRlpPrefixLenDouble(l int, firstByte byte) int { + if l < 2 { + // firstByte only matters when there is 1 byte to encode + if firstByte >= 0x80 { + return 2 + } + return 0 + } + if l < 55 { + return 2 + } + if l < 56 { // 2 + 1 + return 3 + } + if l < 254 { + return 4 + } + if l < 256 { + return 5 + } + if l < 65533 { + return 6 + } + if l < 65536 { + return 7 + } + return 8 +} + +func multiByteHeaderPrefixOfLen(l int) byte { + // > If a string is more than 55 bytes long, the + // > RLP encoding consists of a single byte with value 0xB7 plus the length + // > of the length of the string in binary form, followed by the length of + // > the string, followed by the string. For example, a length-1024 string + // > would be encoded as 0xB90400 followed by the string. The range of + // > the first byte is thus [0xB8, 0xBF]. + // + // see package rlp/decode.go:887 + return byte(0xB7 + l) +} + +func generateByteArrayLen(buffer []byte, pos int, l int) int { + if l < 56 { + buffer[pos] = byte(0x80 + l) + pos++ + } else if l < 256 { + // len(vn) can be encoded as 1 byte + buffer[pos] = multiByteHeaderPrefixOfLen(1) + pos++ + buffer[pos] = byte(l) + pos++ + } else if l < 65536 { + // len(vn) is encoded as two bytes + buffer[pos] = multiByteHeaderPrefixOfLen(2) + pos++ + buffer[pos] = byte(l >> 8) + pos++ + buffer[pos] = byte(l & 255) + pos++ + } else { + // len(vn) is encoded as three bytes + buffer[pos] = multiByteHeaderPrefixOfLen(3) + pos++ + buffer[pos] = byte(l >> 16) + pos++ + buffer[pos] = byte((l >> 8) & 255) + pos++ + buffer[pos] = byte(l & 255) + pos++ + } + return pos +} + +func generateByteArrayLenDouble(buffer []byte, pos int, l int) int { + if l < 55 { + // After first wrapping, the length will be l + 1 < 56 + buffer[pos] = byte(0x80 + l + 1) + pos++ + buffer[pos] = byte(0x80 + l) + pos++ + } else if l < 56 { + buffer[pos] = multiByteHeaderPrefixOfLen(1) + pos++ + buffer[pos] = byte(l + 1) + pos++ + buffer[pos] = byte(0x80 + l) + pos++ + } else if l < 254 { + // After first wrapping, the length will be l + 2 < 256 + buffer[pos] = multiByteHeaderPrefixOfLen(1) + pos++ + buffer[pos] = byte(l + 2) + pos++ + buffer[pos] = multiByteHeaderPrefixOfLen(1) + pos++ + buffer[pos] = byte(l) + pos++ + } else if l < 256 { + // First wrapping is 2 bytes, second wrapping 3 bytes + buffer[pos] = multiByteHeaderPrefixOfLen(2) + pos++ + buffer[pos] = byte((l + 2) >> 8) + pos++ + buffer[pos] = byte((l + 2) & 255) + pos++ + buffer[pos] = multiByteHeaderPrefixOfLen(1) + pos++ + buffer[pos] = byte(l) + pos++ + } else if l < 65533 { + // Both wrappings are 3 bytes + buffer[pos] = multiByteHeaderPrefixOfLen(2) + pos++ + buffer[pos] = byte((l + 3) >> 8) + pos++ + buffer[pos] = byte((l + 3) & 255) + pos++ + buffer[pos] = multiByteHeaderPrefixOfLen(2) + pos++ + buffer[pos] = byte(l >> 8) + pos++ + buffer[pos] = byte(l & 255) + pos++ + } else if l < 65536 { + // First wrapping is 3 bytes, second wrapping is 4 bytes + buffer[pos] = multiByteHeaderPrefixOfLen(3) + pos++ + buffer[pos] = byte((l + 3) >> 16) + pos++ + buffer[pos] = byte(((l + 3) >> 8) & 255) + pos++ + buffer[pos] = byte((l + 3) & 255) + pos++ + buffer[pos] = multiByteHeaderPrefixOfLen(2) + pos++ + buffer[pos] = byte((l >> 8) & 255) + pos++ + buffer[pos] = byte(l & 255) + pos++ + } else { + // Both wrappings are 4 bytes + buffer[pos] = multiByteHeaderPrefixOfLen(3) + pos++ + buffer[pos] = byte((l + 4) >> 16) + pos++ + buffer[pos] = byte(((l + 4) >> 8) & 255) + pos++ + buffer[pos] = byte((l + 4) & 255) + pos++ + buffer[pos] = multiByteHeaderPrefixOfLen(3) + pos++ + buffer[pos] = byte(l >> 16) + pos++ + buffer[pos] = byte((l >> 8) & 255) + pos++ + buffer[pos] = byte(l & 255) + pos++ + } + return pos +} + +func generateRlpPrefixLen(l int) int { + if l < 2 { + return 0 + } + if l < 56 { + return 1 + } + if l < 256 { + return 2 + } + if l < 65536 { + return 3 + } + return 4 +} + +// RlpSerializable is a value that can be double-RLP coded. +type RlpSerializable interface { + ToDoubleRLP(io.Writer, []byte) error + DoubleRLPLen() int + RawBytes() []byte +} + +type RlpSerializableBytes []byte + +func (b RlpSerializableBytes) ToDoubleRLP(w io.Writer, prefixBuf []byte) error { + return encodeBytesAsRlpToWriter(b, w, generateByteArrayLenDouble, prefixBuf) +} + +func (b RlpSerializableBytes) RawBytes() []byte { + return b +} + +func (b RlpSerializableBytes) DoubleRLPLen() int { + if len(b) < 1 { + return 0 + } + return generateRlpPrefixLenDouble(len(b), b[0]) + len(b) +} + +type RlpEncodedBytes []byte + +func (b RlpEncodedBytes) ToDoubleRLP(w io.Writer, prefixBuf []byte) error { + return encodeBytesAsRlpToWriter(b, w, generateByteArrayLen, prefixBuf) +} + +func (b RlpEncodedBytes) RawBytes() []byte { + return b +} + +func (b RlpEncodedBytes) DoubleRLPLen() int { + return generateRlpPrefixLen(len(b)) + len(b) +} + +func encodeBytesAsRlpToWriter(source []byte, w io.Writer, prefixGenFunc func([]byte, int, int) int, prefixBuf []byte) error { + // > 1 byte, write a prefix or prefixes first + if len(source) > 1 || (len(source) == 1 && source[0] >= 0x80) { + prefixLen := prefixGenFunc(prefixBuf, 0, len(source)) + + if _, err := w.Write(prefixBuf[:prefixLen]); err != nil { + return err + } + } + + _, err := w.Write(source) + return err +} + +func EncodeByteArrayAsRlp(raw []byte, w io.Writer, prefixBuf []byte) (int, error) { + err := encodeBytesAsRlpToWriter(raw, w, generateByteArrayLen, prefixBuf) + if err != nil { + return 0, err + } + return generateRlpPrefixLen(len(raw)) + len(raw), nil +} + +func GenerateStructLen(buffer []byte, l int) int { + if l < 56 { + buffer[0] = byte(192 + l) + return 1 + } + if l < 256 { + // l can be encoded as 1 byte + buffer[1] = byte(l) + buffer[0] = byte(247 + 1) + return 2 + } + if l < 65536 { + buffer[2] = byte(l & 255) + buffer[1] = byte(l >> 8) + buffer[0] = byte(247 + 2) + return 3 + } + buffer[3] = byte(l & 255) + buffer[2] = byte((l >> 8) & 255) + buffer[1] = byte(l >> 16) + buffer[0] = byte(247 + 3) + return 4 +} diff --git a/erigon-lib/rlp/encode.go b/erigon-lib/rlp/encode.go index 22b1b5b46fa..93269debd4b 100644 --- a/erigon-lib/rlp/encode.go +++ b/erigon-lib/rlp/encode.go @@ -1,7 +1,4 @@ -// Copyright 2014 The go-ethereum Authors -// (original work) -// Copyright 2024 The Erigon Authors -// (modifications) +// Copyright 2021 The Erigon Authors // This file is part of Erigon. // // Erigon is free software: you can redistribute it and/or modify @@ -21,506 +18,138 @@ package rlp import ( "encoding/binary" - "errors" - "fmt" - "io" - "math/big" "math/bits" - "reflect" - "github.com/holiman/uint256" - - libcommon "github.com/erigontech/erigon-lib/common" -) - -// https://github.com/ethereum/wiki/wiki/RLP -const ( - // EmptyStringCode is the RLP code for empty strings. - EmptyStringCode = 0x80 - // EmptyListCode is the RLP code for empty lists. - EmptyListCode = 0xC0 -) - -var ErrNegativeBigInt = errors.New("rlp: cannot encode negative big.Int") - -var ( - // Common encoded values. - // These are useful when implementing EncodeRLP. - EmptyString = []byte{EmptyStringCode} - EmptyList = []byte{EmptyListCode} + "github.com/erigontech/erigon-lib/common" ) -// Encoder is implemented by types that require custom -// encoding rules or want to encode private fields. -type Encoder interface { - // EncodeRLP should write the RLP encoding of its receiver to w. - // If the implementation is a pointer method, it may also be - // called for nil pointers. - // - // Implementations should generate valid RLP. The data written is - // not verified at the moment, but a future version might. It is - // recommended to write only a single value but writing multiple - // values or no value at all is also permitted. - EncodeRLP(io.Writer) error -} - -// Encode writes the RLP encoding of val to w. Note that Encode may -// perform many small writes in some cases. Consider making w -// buffered. +// General design: +// - rlp package doesn't manage memory - and Caller must ensure buffers are big enough. +// - no io.Writer, because it's incompatible with binary.BigEndian functions and Writer can't be used as temporary buffer +// +// Composition: +// - each Encode method does write to given buffer and return written len +// - each Parse accept position in payload and return new position +// +// General rules: +// - functions to calculate prefix len are fast (and pure). it's ok to call them multiple times during encoding of large object for readability. +// - rlp has 2 data types: List and String (bytes array), and low-level funcs are operate with this types. +// - but for convenience and performance - provided higher-level functions (for example for EncodeHash - for []byte of len 32) +// - functions to Parse (Decode) data - using data type as name (without any prefix): rlp.String(), rlp.List, rlp.U64(), rlp.U256() // -// Please see package-level documentation of encoding rules. -func Encode(w io.Writer, val interface{}) error { - if outer, ok := w.(*encBuffer); ok { - // Encode was called by some type's EncodeRLP. - // Avoid copying by writing to the outer encBuffer directly. - return outer.encode(val) - } - eb := encBufferPool.Get().(*encBuffer) - defer encBufferPool.Put(eb) - eb.reset() - if err := eb.encode(val); err != nil { - return err - } - return eb.toWriter(w) -} -func Write(w io.Writer, val []byte) error { - if outer, ok := w.(*encBuffer); ok { - // Encode was called by some type's EncodeRLP. - // Avoid copying by writing to the outer encBuffer directly. - _, err := outer.Write(val) - return err +func ListPrefixLen(dataLen int) int { + if dataLen >= 56 { + return 1 + common.BitLenToByteLen(bits.Len64(uint64(dataLen))) } - - _, err := w.Write(val) - return err + return 1 } - -// EncodeToBytes returns the RLP encoding of val. -// Please see package-level documentation for the encoding rules. -func EncodeToBytes(val interface{}) ([]byte, error) { - eb := encBufferPool.Get().(*encBuffer) - defer encBufferPool.Put(eb) - eb.reset() - if err := eb.encode(val); err != nil { - return nil, err +func EncodeListPrefix(dataLen int, to []byte) int { + if dataLen >= 56 { + _ = to[9] + beLen := common.BitLenToByteLen(bits.Len64(uint64(dataLen))) + binary.BigEndian.PutUint64(to[1:], uint64(dataLen)) + to[8-beLen] = 247 + byte(beLen) + copy(to, to[8-beLen:9]) + return 1 + beLen } - return eb.toBytes(), nil + to[0] = 192 + byte(dataLen) + return 1 } -// EncodeToReader returns a reader from which the RLP encoding of val -// can be read. The returned size is the total size of the encoded -// data. -// -// Please see the documentation of Encode for the encoding rules. -func EncodeToReader(val interface{}) (size int, r io.Reader, err error) { - eb := encBufferPool.Get().(*encBuffer) - eb.reset() - if err := eb.encode(val); err != nil { - return 0, nil, err +func U32Len(i uint32) int { + if i < 128 { + return 1 } - return eb.size(), &encReader{buf: eb}, nil -} - -type listhead struct { - offset int // index of this header in string data - size int // total size of encoded data (including list headers) + return 1 + common.BitLenToByteLen(bits.Len32(i)) } -// encode writes head to the given buffer, which must be at least -// 9 bytes long. It returns the encoded bytes. -func (head *listhead) encode(buf []byte) []byte { - return buf[:puthead(buf, 0xC0, 0xF7, uint64(head.size))] -} - -// headsize returns the size of a list or string header -// for a value of the given size. -func headsize(size uint64) int { - if size < 56 { +func U64Len(i uint64) int { + if i < 128 { return 1 } - return 1 + intsize(size) + return 1 + common.BitLenToByteLen(bits.Len64(i)) } -// puthead writes a list or string header to buf. -// buf must be at least 9 bytes long. -func puthead(buf []byte, smalltag, largetag byte, size uint64) int { - if size < 56 { - buf[0] = smalltag + byte(size) +func EncodeU32(i uint32, to []byte) int { + if i == 0 { + to[0] = 128 + return 1 + } + if i < 128 { + to[0] = byte(i) // fits single byte return 1 } - sizesize := putint(buf[1:], size) - buf[0] = largetag + byte(sizesize) - return sizesize + 1 -} -var encoderInterface = reflect.TypeOf(new(Encoder)).Elem() + b := to[1:] + var l int -// makeWriter creates a writer function for the given type. -func makeWriter(typ reflect.Type, ts tags) (writer, error) { - kind := typ.Kind() + // writes i to b in big endian byte order, using the least number of bytes needed to represent i. switch { - case typ == rawValueType: - return writeRawValue, nil - case typ.AssignableTo(reflect.PtrTo(bigInt)): - return writeBigIntPtr, nil - case typ.AssignableTo(bigInt): - return writeBigIntNoPtr, nil - case typ.AssignableTo(reflect.PtrTo(uint256Int)): - return writeUint256Ptr, nil - case typ.AssignableTo(uint256Int): - return writeUint256NoPtr, nil - case kind == reflect.Ptr: - return makePtrWriter(typ, ts) - case reflect.PtrTo(typ).Implements(encoderInterface): - return makeEncoderWriter(typ), nil - case isUint(kind): - return writeUint, nil - case kind == reflect.Bool: - return writeBool, nil - case kind == reflect.String: - return writeString, nil - case kind == reflect.Slice && isByte(typ.Elem()): - return writeBytes, nil - case kind == reflect.Array && isByte(typ.Elem()): - return makeByteArrayWriter(typ), nil - case kind == reflect.Slice || kind == reflect.Array: - return makeSliceWriter(typ, ts) - case kind == reflect.Struct: - return makeStructWriter(typ) - case kind == reflect.Interface: - return writeInterface, nil + case i < (1 << 8): + b[0] = byte(i) + l = 1 + case i < (1 << 16): + b[0] = byte(i >> 8) + b[1] = byte(i) + l = 2 + case i < (1 << 24): + b[0] = byte(i >> 16) + b[1] = byte(i >> 8) + b[2] = byte(i) + l = 3 default: - return nil, fmt.Errorf("rlp: type %v is not RLP-serializable", typ) - } -} - -func writeRawValue(val reflect.Value, w *encBuffer) error { - w.str = append(w.str, val.Bytes()...) - return nil -} - -func writeUint(val reflect.Value, w *encBuffer) error { - w.encodeUint(val.Uint()) - return nil -} - -func writeBool(val reflect.Value, w *encBuffer) error { - if val.Bool() { - w.str = append(w.str, 0x01) - } else { - w.str = append(w.str, EmptyStringCode) - } - return nil -} - -func writeBigIntPtr(val reflect.Value, w *encBuffer) error { - ptr := val.Interface().(*big.Int) - if ptr == nil { - w.str = append(w.str, EmptyStringCode) - return nil - } - return writeBigInt(ptr, w) -} - -func writeBigIntNoPtr(val reflect.Value, w *encBuffer) error { - i := val.Interface().(big.Int) - return writeBigInt(&i, w) -} - -// wordBytes is the number of bytes in a big.Word -const wordBytes = (32 << (uint64(^big.Word(0)) >> 63)) / 8 - -func writeBigInt(i *big.Int, w *encBuffer) error { - if i.Sign() == -1 { - return errors.New("rlp: cannot encode negative *big.Int") - } - bitlen := i.BitLen() - if bitlen <= 64 { - w.encodeUint(i.Uint64()) - return nil - } - // Integer is larger than 64 bits, encode from i.Bits(). - // The minimal byte length is bitlen rounded up to the next - // multiple of 8, divided by 8. - length := ((bitlen + 7) & -8) >> 3 - w.encodeStringHeader(length) - w.str = append(w.str, make([]byte, length)...) - index := length - buf := w.str[len(w.str)-length:] - for _, d := range i.Bits() { - for j := 0; j < wordBytes && index > 0; j++ { - index-- - buf[index] = byte(d) - d >>= 8 - } - } - return nil -} - -func writeUint256Ptr(val reflect.Value, w *encBuffer) error { - ptr := val.Interface().(*uint256.Int) - if ptr == nil { - w.str = append(w.str, EmptyStringCode) - return nil - } - return writeUint256(ptr, w) -} - -func writeUint256NoPtr(val reflect.Value, w *encBuffer) error { - i := val.Interface().(uint256.Int) - return writeUint256(&i, w) -} - -func writeUint256(i *uint256.Int, w *encBuffer) error { - if i.IsZero() { - w.str = append(w.str, EmptyStringCode) - } else if i.LtUint64(0x80) { - w.str = append(w.str, byte(i.Uint64())) - } else { - n := i.ByteLen() - w.str = append(w.str, EmptyStringCode+byte(n)) - pos := len(w.str) - w.str = append(w.str, make([]byte, n)...) - i.WriteToSlice(w.str[pos:]) - } - return nil -} - -func writeBytes(val reflect.Value, w *encBuffer) error { - w.encodeString(val.Bytes()) - return nil -} - -var byteType = reflect.TypeOf(byte(0)) - -func makeByteArrayWriter(typ reflect.Type) writer { - length := typ.Len() - if length == 0 { - return writeLengthZeroByteArray - } else if length == 1 { - return writeLengthOneByteArray - } - if typ.Elem() != byteType { - return writeNamedByteArray - } - return func(val reflect.Value, w *encBuffer) error { - writeByteArrayCopy(length, val, w) - return nil - } -} - -func writeLengthZeroByteArray(val reflect.Value, w *encBuffer) error { - w.str = append(w.str, 0x80) - return nil -} - -func writeLengthOneByteArray(val reflect.Value, w *encBuffer) error { - b := byte(val.Index(0).Uint()) - if b <= 0x7f { - w.str = append(w.str, b) - } else { - w.str = append(w.str, 0x81, b) - } - return nil -} - -// writeByteArrayCopy encodes byte arrays using reflect.Copy. This is -// the fast path for [N]byte where N > 1. -func writeByteArrayCopy(length int, val reflect.Value, w *encBuffer) { - w.encodeStringHeader(length) - offset := len(w.str) - w.str = append(w.str, make([]byte, length)...) - w.bufvalue.SetBytes(w.str[offset:]) - reflect.Copy(w.bufvalue, val) -} - -// writeNamedByteArray encodes byte arrays with named element type. -// This exists because reflect.Copy can't be used with such types. -func writeNamedByteArray(val reflect.Value, w *encBuffer) error { - if !val.CanAddr() { - // Slice requires the value to be addressable. - // Make it addressable by copying. - valCopy := reflect.New(val.Type()).Elem() - valCopy.Set(val) - val = valCopy - } - size := val.Len() - slice := val.Slice(0, size).Bytes() - w.encodeString(slice) - return nil -} - -func writeString(val reflect.Value, w *encBuffer) error { - s := val.String() - if len(s) == 1 && s[0] <= 0x7f { - // fits single byte, no string header - w.str = append(w.str, s[0]) - } else { - w.encodeStringHeader(len(s)) - w.str = append(w.str, s...) - } - return nil -} - -func writeInterface(val reflect.Value, w *encBuffer) error { - if val.IsNil() { - // Write empty list. This is consistent with the previous RLP - // encoder that we had and should therefore avoid any - // problems. - w.str = append(w.str, EmptyListCode) - return nil - } - eval := val.Elem() - wtr, wErr := cachedWriter(eval.Type()) - if wErr != nil { - return wErr - } - return wtr(eval, w) -} - -func makeSliceWriter(typ reflect.Type, ts tags) (writer, error) { - etypeinfo := cachedTypeInfo1(typ.Elem(), tags{}) - if etypeinfo.writerErr != nil { - return nil, etypeinfo.writerErr - } - writer := func(val reflect.Value, w *encBuffer) error { - if !ts.tail { - defer w.listEnd(w.list()) - } - vlen := val.Len() - for i := 0; i < vlen; i++ { - if err := etypeinfo.writer(val.Index(i), w); err != nil { - return err - } - } - return nil - } - return writer, nil -} - -func makeStructWriter(typ reflect.Type) (writer, error) { - fields, err := structFields(typ) - if err != nil { - return nil, err - } - for _, f := range fields { - if f.info.writerErr != nil { - return nil, structFieldError{typ, f.index, f.info.writerErr} - } + b[0] = byte(i >> 24) + b[1] = byte(i >> 16) + b[2] = byte(i >> 8) + b[3] = byte(i) + l = 4 } - var writer writer - firstOptionalField := firstOptionalField(fields) - if firstOptionalField == len(fields) { - // This is the writer function for structs without any optional fields. - writer = func(val reflect.Value, w *encBuffer) error { - lh := w.list() - for _, f := range fields { - if err := f.info.writer(val.Field(f.index), w); err != nil { - return err - } - } - w.listEnd(lh) - return nil - } - } else { - // If there are any "optional" fields, the writer needs to perform additional - // checks to determine the output list length. - writer = func(val reflect.Value, w *encBuffer) error { - lastField := len(fields) - 1 - for ; lastField >= firstOptionalField; lastField-- { - if !val.Field(fields[lastField].index).IsZero() { - break - } - } - lh := w.list() - for i := 0; i <= lastField; i++ { - if err := fields[i].info.writer(val.Field(fields[i].index), w); err != nil { - return err - } - } - w.listEnd(lh) - return nil - } - } - return writer, nil + to[0] = 128 + byte(l) + return 1 + l } -func makePtrWriter(typ reflect.Type, ts tags) (writer, error) { - etypeinfo := cachedTypeInfo1(typ.Elem(), tags{}) - if etypeinfo.writerErr != nil { - return nil, etypeinfo.writerErr +func EncodeU64(i uint64, to []byte) int { + if i == 0 { + to[0] = 128 + return 1 } - // Determine how to encode nil pointers. - var nilKind Kind - if ts.nilOK { - nilKind = ts.nilKind // use struct tag if provided - } else { - nilKind = defaultNilKind(typ.Elem()) + if i < 128 { + to[0] = byte(i) // fits single byte + return 1 } - writer := func(val reflect.Value, w *encBuffer) error { - if val.IsNil() { - if nilKind == String { - w.str = append(w.str, EmptyStringCode) - } else { - w.listEnd(w.list()) - } - return nil - } - return etypeinfo.writer(val.Elem(), w) - } - return writer, nil -} - -func makeEncoderWriter(typ reflect.Type) writer { - if typ.Implements(encoderInterface) { - return func(val reflect.Value, w *encBuffer) error { - return val.Interface().(Encoder).EncodeRLP(w) - } - } - w := func(val reflect.Value, w *encBuffer) error { - if !val.CanAddr() { - // package json simply doesn't call MarshalJSON for this case, but encodes the - // value as if it didn't implement the interface. We don't want to handle it that - // way. - return fmt.Errorf("rlp: unadressable value of type %v, EncodeRLP is pointer method", val.Type()) - } - return val.Addr().Interface().(Encoder).EncodeRLP(w) - } - return w -} + b := to[1:] + var l int -// putint writes i to the beginning of b in big endian byte -// order, using the least number of bytes needed to represent i. -func putint(b []byte, i uint64) (size int) { + // writes i to b in big endian byte order, using the least number of bytes needed to represent i. switch { case i < (1 << 8): b[0] = byte(i) - return 1 + l = 1 case i < (1 << 16): b[0] = byte(i >> 8) b[1] = byte(i) - return 2 + l = 2 case i < (1 << 24): b[0] = byte(i >> 16) b[1] = byte(i >> 8) b[2] = byte(i) - return 3 + l = 3 case i < (1 << 32): b[0] = byte(i >> 24) b[1] = byte(i >> 16) b[2] = byte(i >> 8) b[3] = byte(i) - return 4 + l = 4 case i < (1 << 40): b[0] = byte(i >> 32) b[1] = byte(i >> 24) b[2] = byte(i >> 16) b[3] = byte(i >> 8) b[4] = byte(i) - return 5 + l = 5 case i < (1 << 48): b[0] = byte(i >> 40) b[1] = byte(i >> 32) @@ -528,7 +157,7 @@ func putint(b []byte, i uint64) (size int) { b[3] = byte(i >> 16) b[4] = byte(i >> 8) b[5] = byte(i) - return 6 + l = 6 case i < (1 << 56): b[0] = byte(i >> 48) b[1] = byte(i >> 40) @@ -537,7 +166,7 @@ func putint(b []byte, i uint64) (size int) { b[4] = byte(i >> 16) b[5] = byte(i >> 8) b[6] = byte(i) - return 7 + l = 7 default: b[0] = byte(i >> 56) b[1] = byte(i >> 48) @@ -547,135 +176,131 @@ func putint(b []byte, i uint64) (size int) { b[5] = byte(i >> 16) b[6] = byte(i >> 8) b[7] = byte(i) - return 8 + l = 8 } -} -// intsize computes the minimum number of bytes required to store i. -func intsize(i uint64) (size int) { - return libcommon.BitLenToByteLen(bits.Len64(i)) + to[0] = 128 + byte(l) + return 1 + l } -func IntLenExcludingHead(i uint64) int { - if i < 0x80 { - return 0 +func StringLen(s []byte) int { + sLen := len(s) + switch { + case sLen >= 56: + beLen := common.BitLenToByteLen(bits.Len(uint(sLen))) + return 1 + beLen + sLen + case sLen == 0: + return 1 + case sLen == 1: + if s[0] < 128 { + return 1 + } + return 1 + sLen + default: // 1= 56: + beLen := common.BitLenToByteLen(bits.Len(uint(len(s)))) + binary.BigEndian.PutUint64(to[1:], uint64(len(s))) + _ = to[beLen+len(s)] + + to[8-beLen] = byte(beLen) + 183 + copy(to, to[8-beLen:9]) + copy(to[1+beLen:], s) + return 1 + beLen + len(s) + case len(s) == 0: + to[0] = 128 + return 1 + case len(s) == 1: + if s[0] < 128 { + to[0] = s[0] + return 1 + } + to[0] = 129 + to[1] = s[0] + return 2 + default: // 1= 9 -func EncodeInt(i uint64, w io.Writer, buffer []byte) error { - if 0 < i && i < 0x80 { - buffer[0] = byte(i) - _, err := w.Write(buffer[:1]) - return err - } - - binary.BigEndian.PutUint64(buffer[1:], i) - size := intsize(i) - buffer[8-size] = 0x80 + byte(size) - _, err := w.Write(buffer[8-size : 9]) - return err +// EncodeHash assumes that `to` buffer is already 33-bytes long +func EncodeHash(h, to []byte) int { + _ = to[32] // early bounds check to guarantee safety of writes below + to[0] = 128 + 32 + copy(to[1:33], h[:32]) + return 33 } -func EncodeBigInt(i *big.Int, w io.Writer, buffer []byte) error { - bitLen := 0 // treat nil as 0 - if i != nil { - bitLen = i.BitLen() - } - if bitLen < 8 { - if bitLen > 0 { - buffer[0] = byte(i.Uint64()) - } else { - buffer[0] = 0x80 - } - _, err := w.Write(buffer[:1]) - return err - } - - size := libcommon.BitLenToByteLen(bitLen) - buffer[0] = 0x80 + byte(size) - i.FillBytes(buffer[1 : 1+size]) - _, err := w.Write(buffer[:1+size]) - return err +func HashesLen(hashes []byte) int { + hashesLen := len(hashes) / 32 * 33 + return ListPrefixLen(hashesLen) + hashesLen } -func EncodeString(s []byte, w io.Writer, buffer []byte) error { - switch len(s) { - case 0: - buffer[0] = 128 - if _, err := w.Write(buffer[:1]); err != nil { - return err - } - case 1: - if s[0] >= 128 { - buffer[0] = 129 - if _, err := w.Write(buffer[:1]); err != nil { - return err - } - } - if _, err := w.Write(s); err != nil { - return err - } - default: - if err := EncodeStringSizePrefix(len(s), w, buffer); err != nil { - return err - } - if _, err := w.Write(s); err != nil { - return err - } +func EncodeHashes(hashes []byte, encodeBuf []byte) int { + pos := 0 + hashesLen := len(hashes) / 32 * 33 + pos += EncodeListPrefix(hashesLen, encodeBuf) + for i := 0; i < len(hashes); i += 32 { + pos += EncodeHash(hashes[i:], encodeBuf[pos:]) } - return nil + return pos } -func EncodeStringSizePrefix(size int, w io.Writer, buffer []byte) error { - if size >= 56 { - beSize := libcommon.BitLenToByteLen(bits.Len(uint(size))) - binary.BigEndian.PutUint64(buffer[1:], uint64(size)) - buffer[8-beSize] = byte(beSize) + 183 - if _, err := w.Write(buffer[8-beSize : 9]); err != nil { - return err - } - } else { - buffer[0] = byte(size) + 128 - if _, err := w.Write(buffer[:1]); err != nil { - return err - } +func AnnouncementsLen(types []byte, sizes []uint32, hashes []byte) int { + if len(types) == 0 { + return 4 } - return nil -} - -func EncodeOptionalAddress(addr *libcommon.Address, w io.Writer, buffer []byte) error { - if addr == nil { - buffer[0] = 128 - } else { - buffer[0] = 128 + 20 + typesLen := StringLen(types) + var sizesLen int + for _, size := range sizes { + sizesLen += U32Len(size) } + hashesLen := len(hashes) / 32 * 33 + totalLen := typesLen + sizesLen + ListPrefixLen(sizesLen) + hashesLen + ListPrefixLen(hashesLen) + return ListPrefixLen(totalLen) + totalLen +} - if _, err := w.Write(buffer[:1]); err != nil { - return err - } - if addr != nil { - if _, err := w.Write(addr.Bytes()); err != nil { - return err - } +// EIP-5793: eth/68 - Add txn type to txn announcement +func EncodeAnnouncements(types []byte, sizes []uint32, hashes []byte, encodeBuf []byte) int { + if len(types) == 0 { + encodeBuf[0] = 0xc3 + encodeBuf[1] = 0x80 + encodeBuf[2] = 0xc0 + encodeBuf[3] = 0xc0 + return 4 } - - return nil + pos := 0 + typesLen := StringLen(types) + var sizesLen int + for _, size := range sizes { + sizesLen += U32Len(size) + } + hashesLen := len(hashes) / 32 * 33 + totalLen := typesLen + sizesLen + ListPrefixLen(sizesLen) + hashesLen + ListPrefixLen(hashesLen) + pos += EncodeListPrefix(totalLen, encodeBuf) + pos += EncodeString(types, encodeBuf[pos:]) + pos += EncodeListPrefix(sizesLen, encodeBuf[pos:]) + for _, size := range sizes { + pos += EncodeU32(size, encodeBuf[pos:]) + } + pos += EncodeListPrefix(hashesLen, encodeBuf[pos:]) + for i := 0; i < len(hashes); i += 32 { + pos += EncodeHash(hashes[i:], encodeBuf[pos:]) + } + return pos } diff --git a/erigon-lib/rlp/encode_test.go b/erigon-lib/rlp/encode_test.go index 7926779f71a..cdca78e2505 100644 --- a/erigon-lib/rlp/encode_test.go +++ b/erigon-lib/rlp/encode_test.go @@ -1,7 +1,4 @@ -// Copyright 2014 The go-ethereum Authors -// (original work) -// Copyright 2024 The Erigon Authors -// (modifications) +// Copyright 2023 The Erigon Authors // This file is part of Erigon. // // Erigon is free software: you can redistribute it and/or modify @@ -20,490 +17,28 @@ package rlp import ( - "bytes" - "errors" - "fmt" - "io" - "math/big" - "sync" "testing" - "github.com/holiman/uint256" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" - "github.com/erigontech/erigon-lib/common/math" + "github.com/erigontech/erigon-lib/common/hexutility" ) -type testEncoder struct { - err error -} - -func (e *testEncoder) EncodeRLP(w io.Writer) error { - if e == nil { - panic("EncodeRLP called on nil value") - } - if e.err != nil { - return e.err - } - if _, err := w.Write([]byte{0, 1, 0, 1, 0, 1, 0, 1, 0, 1}); err != nil { - return err - } - return nil -} - -type testEncoderValueMethod struct{} - -func (e testEncoderValueMethod) EncodeRLP(w io.Writer) error { - _, err := w.Write([]byte{0xFA, 0xFE, 0xF0}) - return err -} - -type byteEncoder byte - -func (e byteEncoder) EncodeRLP(w io.Writer) error { - _, err := w.Write(EmptyList) - return err -} - -type undecodableEncoder func() - -func (f undecodableEncoder) EncodeRLP(w io.Writer) error { - _, err := w.Write([]byte{0xF5, 0xF5, 0xF5}) - return err -} - -type encodableReader struct { - A, B uint -} - -func (e *encodableReader) Read(b []byte) (int, error) { - panic("called") -} - -type namedByteType byte - -var ( - _ = Encoder(&testEncoder{}) - _ = Encoder(byteEncoder(0)) - - reader io.Reader = &encodableReader{1, 2} -) - -type encTest struct { - val interface{} - output, error string -} - -var encTests = []encTest{ - // booleans - {val: true, output: "01"}, - {val: false, output: "80"}, - - // integers - {val: uint32(0), output: "80"}, - {val: uint32(127), output: "7F"}, - {val: uint32(128), output: "8180"}, - {val: uint32(256), output: "820100"}, - {val: uint32(1024), output: "820400"}, - {val: uint32(0xFFFFFF), output: "83FFFFFF"}, - {val: uint32(0xFFFFFFFF), output: "84FFFFFFFF"}, - {val: uint64(0xFFFFFFFF), output: "84FFFFFFFF"}, - {val: uint64(0xFFFFFFFFFF), output: "85FFFFFFFFFF"}, - {val: uint64(0xFFFFFFFFFFFF), output: "86FFFFFFFFFFFF"}, - {val: uint64(0xFFFFFFFFFFFFFF), output: "87FFFFFFFFFFFFFF"}, - {val: uint64(0xFFFFFFFFFFFFFFFF), output: "88FFFFFFFFFFFFFFFF"}, - - // big integers (should match uint for small values) - {val: big.NewInt(0), output: "80"}, - {val: big.NewInt(1), output: "01"}, - {val: big.NewInt(127), output: "7F"}, - {val: big.NewInt(128), output: "8180"}, - {val: big.NewInt(256), output: "820100"}, - {val: big.NewInt(1024), output: "820400"}, - {val: big.NewInt(0xFFFFFF), output: "83FFFFFF"}, - {val: big.NewInt(0xFFFFFFFF), output: "84FFFFFFFF"}, - {val: big.NewInt(0xFFFFFFFFFF), output: "85FFFFFFFFFF"}, - {val: big.NewInt(0xFFFFFFFFFFFF), output: "86FFFFFFFFFFFF"}, - {val: big.NewInt(0xFFFFFFFFFFFFFF), output: "87FFFFFFFFFFFFFF"}, - { - val: big.NewInt(0).SetBytes(unhex("102030405060708090A0B0C0D0E0F2")), - output: "8F102030405060708090A0B0C0D0E0F2", - }, - { - val: big.NewInt(0).SetBytes(unhex("0100020003000400050006000700080009000A000B000C000D000E01")), - output: "9C0100020003000400050006000700080009000A000B000C000D000E01", - }, - { - val: big.NewInt(0).SetBytes(unhex("010000000000000000000000000000000000000000000000000000000000000000")), - output: "A1010000000000000000000000000000000000000000000000000000000000000000", - }, - { - val: veryBigInt, - output: "89FFFFFFFFFFFFFFFFFF", - }, - { - val: veryVeryBigInt, - output: "B848FFFFFFFFFFFFFFFFF800000000000000001BFFFFFFFFFFFFFFFFC8000000000000000045FFFFFFFFFFFFFFFFC800000000000000001BFFFFFFFFFFFFFFFFF8000000000000000001", - }, - - // non-pointer big.Int - {val: *big.NewInt(0), output: "80"}, - {val: *big.NewInt(0xFFFFFF), output: "83FFFFFF"}, - - // negative ints are not supported - {val: big.NewInt(-1), error: "rlp: cannot encode negative *big.Int"}, - - // uint256 integers (should match uint for small values) - {val: uint256.NewInt(0), output: "80"}, - {val: uint256.NewInt(1), output: "01"}, - {val: uint256.NewInt(127), output: "7F"}, - {val: uint256.NewInt(128), output: "8180"}, - {val: uint256.NewInt(256), output: "820100"}, - {val: uint256.NewInt(1024), output: "820400"}, - {val: uint256.NewInt(0xFFFFFF), output: "83FFFFFF"}, - {val: uint256.NewInt(0xFFFFFFFF), output: "84FFFFFFFF"}, - {val: uint256.NewInt(0xFFFFFFFFFF), output: "85FFFFFFFFFF"}, - {val: uint256.NewInt(0xFFFFFFFFFFFF), output: "86FFFFFFFFFFFF"}, - {val: uint256.NewInt(0xFFFFFFFFFFFFFF), output: "87FFFFFFFFFFFFFF"}, - { - val: uint256.NewInt(0).SetBytes(unhex("102030405060708090A0B0C0D0E0F2")), - output: "8F102030405060708090A0B0C0D0E0F2", - }, - { - val: uint256.NewInt(0).SetBytes(unhex("0100020003000400050006000700080009000A000B000C000D000E01")), - output: "9C0100020003000400050006000700080009000A000B000C000D000E01", - }, - - // named byte type arrays - {val: [0]namedByteType{}, output: "80"}, - {val: [1]namedByteType{0}, output: "00"}, - {val: [1]namedByteType{1}, output: "01"}, - {val: [1]namedByteType{0x7F}, output: "7F"}, - {val: [1]namedByteType{0x80}, output: "8180"}, - {val: [1]namedByteType{0xFF}, output: "81FF"}, - {val: [3]namedByteType{1, 2, 3}, output: "83010203"}, - {val: [57]namedByteType{1, 2, 3}, output: "B839010203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, - - // byte slices - {val: []byte{}, output: "80"}, - {val: []byte{0}, output: "00"}, - {val: []byte{0x7E}, output: "7E"}, - {val: []byte{0x7F}, output: "7F"}, - {val: []byte{0x80}, output: "8180"}, - {val: []byte{1, 2, 3}, output: "83010203"}, - - // named byte type slices - {val: []namedByteType{}, output: "80"}, - {val: []namedByteType{0}, output: "00"}, - {val: []namedByteType{0x7E}, output: "7E"}, - {val: []namedByteType{0x7F}, output: "7F"}, - {val: []namedByteType{0x80}, output: "8180"}, - {val: []namedByteType{1, 2, 3}, output: "83010203"}, - - // strings - {val: "", output: "80"}, - {val: "\x7E", output: "7E"}, - {val: "\x7F", output: "7F"}, - {val: "\x80", output: "8180"}, - {val: "dog", output: "83646F67"}, - { - val: "Lorem ipsum dolor sit amet, consectetur adipisicing eli", - output: "B74C6F72656D20697073756D20646F6C6F722073697420616D65742C20636F6E7365637465747572206164697069736963696E6720656C69", - }, - { - val: "Lorem ipsum dolor sit amet, consectetur adipisicing elit", - output: "B8384C6F72656D20697073756D20646F6C6F722073697420616D65742C20636F6E7365637465747572206164697069736963696E6720656C6974", - }, - { - val: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur mauris magna, suscipit sed vehicula non, iaculis faucibus tortor. Proin suscipit ultricies malesuada. Duis tortor elit, dictum quis tristique eu, ultrices at risus. Morbi a est imperdiet mi ullamcorper aliquet suscipit nec lorem. Aenean quis leo mollis, vulputate elit varius, consequat enim. Nulla ultrices turpis justo, et posuere urna consectetur nec. Proin non convallis metus. Donec tempor ipsum in mauris congue sollicitudin. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse convallis sem vel massa faucibus, eget lacinia lacus tempor. Nulla quis ultricies purus. Proin auctor rhoncus nibh condimentum mollis. Aliquam consequat enim at metus luctus, a eleifend purus egestas. Curabitur at nibh metus. Nam bibendum, neque at auctor tristique, lorem libero aliquet arcu, non interdum tellus lectus sit amet eros. Cras rhoncus, metus ac ornare cursus, dolor justo ultrices metus, at ullamcorper volutpat", - output: "B904004C6F72656D20697073756D20646F6C6F722073697420616D65742C20636F6E73656374657475722061646970697363696E6720656C69742E20437572616269747572206D6175726973206D61676E612C20737573636970697420736564207665686963756C61206E6F6E2C20696163756C697320666175636962757320746F72746F722E2050726F696E20737573636970697420756C74726963696573206D616C6573756164612E204475697320746F72746F7220656C69742C2064696374756D2071756973207472697374697175652065752C20756C7472696365732061742072697375732E204D6F72626920612065737420696D70657264696574206D6920756C6C616D636F7270657220616C6971756574207375736369706974206E6563206C6F72656D2E2041656E65616E2071756973206C656F206D6F6C6C69732C2076756C70757461746520656C6974207661726975732C20636F6E73657175617420656E696D2E204E756C6C6120756C74726963657320747572706973206A7573746F2C20657420706F73756572652075726E6120636F6E7365637465747572206E65632E2050726F696E206E6F6E20636F6E76616C6C6973206D657475732E20446F6E65632074656D706F7220697073756D20696E206D617572697320636F6E67756520736F6C6C696369747564696E2E20566573746962756C756D20616E746520697073756D207072696D697320696E206661756369627573206F726369206C756374757320657420756C74726963657320706F737565726520637562696C69612043757261653B2053757370656E646973736520636F6E76616C6C69732073656D2076656C206D617373612066617563696275732C2065676574206C6163696E6961206C616375732074656D706F722E204E756C6C61207175697320756C747269636965732070757275732E2050726F696E20617563746F722072686F6E637573206E69626820636F6E64696D656E74756D206D6F6C6C69732E20416C697175616D20636F6E73657175617420656E696D206174206D65747573206C75637475732C206120656C656966656E6420707572757320656765737461732E20437572616269747572206174206E696268206D657475732E204E616D20626962656E64756D2C206E6571756520617420617563746F72207472697374697175652C206C6F72656D206C696265726F20616C697175657420617263752C206E6F6E20696E74657264756D2074656C6C7573206C65637475732073697420616D65742065726F732E20437261732072686F6E6375732C206D65747573206163206F726E617265206375727375732C20646F6C6F72206A7573746F20756C747269636573206D657475732C20617420756C6C616D636F7270657220766F6C7574706174", - }, +// Strings of length 56 are a boundary case. +// See https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/#definition +func TestStringLen56(t *testing.T) { + str := hexutility.MustDecodeHex("7907ca011864321def1e92a3021868f397516ce37c959f25f8dddd3161d7b8301152b35f135c814fae9f487206471b6b0d713cd51a2d3598") + require.Equal(t, 56, len(str)) - // slices - {val: []uint{}, output: "C0"}, - {val: []uint{1, 2, 3}, output: "C3010203"}, - { - // [ [], [[]], [ [], [[]] ] ] - val: []interface{}{[]interface{}{}, [][]interface{}{{}}, []interface{}{[]interface{}{}, [][]interface{}{{}}}}, - output: "C7C0C1C0C3C0C1C0", - }, - { - val: []string{"aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk", "lll", "mmm", "nnn", "ooo"}, - output: "F83C836161618362626283636363836464648365656583666666836767678368686883696969836A6A6A836B6B6B836C6C6C836D6D6D836E6E6E836F6F6F", - }, - { - val: []interface{}{uint(1), uint(0xFFFFFF), []interface{}{[]uint{4, 5, 5}}, "abc"}, - output: "CE0183FFFFFFC4C304050583616263", - }, - { - val: [][]string{ - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - {"asdf", "qwer", "zxcv"}, - }, - output: "F90200CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376", - }, - - // RawValue - {val: RawValue(unhex("01")), output: "01"}, - {val: RawValue(unhex("82FFFF")), output: "82FFFF"}, - {val: []RawValue{unhex("01"), unhex("02")}, output: "C20102"}, - - // structs - {val: simplestruct{}, output: "C28080"}, - {val: simplestruct{A: 3, B: "foo"}, output: "C50383666F6F"}, - {val: &recstruct{5, nil}, output: "C205C0"}, - {val: &recstruct{5, &recstruct{4, &recstruct{3, nil}}}, output: "C605C404C203C0"}, - {val: &intField{X: 3}, error: "rlp: type int is not RLP-serializable (struct field rlp.intField.X)"}, - - // struct tag "-" - {val: &ignoredField{A: 1, B: 2, C: 3}, output: "C20103"}, - - // struct tag "tail" - {val: &tailRaw{A: 1, Tail: []RawValue{unhex("02"), unhex("03")}}, output: "C3010203"}, - {val: &tailRaw{A: 1, Tail: []RawValue{unhex("02")}}, output: "C20102"}, - {val: &tailRaw{A: 1, Tail: []RawValue{}}, output: "C101"}, - {val: &tailRaw{A: 1, Tail: nil}, output: "C101"}, - - // struct tag "optional" - {val: &optionalFields{}, output: "C180"}, - {val: &optionalFields{A: 1}, output: "C101"}, - {val: &optionalFields{A: 1, B: 2}, output: "C20102"}, - {val: &optionalFields{A: 1, B: 2, C: 3}, output: "C3010203"}, - {val: &optionalFields{A: 1, B: 0, C: 3}, output: "C3018003"}, - {val: &optionalAndTailField{A: 1}, output: "C101"}, - {val: &optionalAndTailField{A: 1, B: 2}, output: "C20102"}, - {val: &optionalAndTailField{A: 1, Tail: []uint{5, 6}}, output: "C401800506"}, - {val: &optionalAndTailField{A: 1, Tail: []uint{5, 6}}, output: "C401800506"}, - {val: &optionalBigIntField{A: 1}, output: "C101"}, - {val: &optionalPtrField{A: 1}, output: "C101"}, - {val: &optionalPtrFieldNil{A: 1}, output: "C101"}, - - // nil - {val: (*uint)(nil), output: "80"}, - {val: (*string)(nil), output: "80"}, - {val: (*[]byte)(nil), output: "80"}, - {val: (*[10]byte)(nil), output: "80"}, - {val: (*big.Int)(nil), output: "80"}, - {val: (*uint256.Int)(nil), output: "80"}, - {val: (*[]string)(nil), output: "C0"}, - {val: (*[10]string)(nil), output: "C0"}, - {val: (*[]interface{})(nil), output: "C0"}, - {val: (*[]struct{ uint })(nil), output: "C0"}, - {val: (*interface{})(nil), output: "C0"}, - - // nil struct fields - { - val: struct { - X *[]byte - }{}, - output: "C180", - }, - { - val: struct { - X *[2]byte - }{}, - output: "C180", - }, - { - val: struct { - X *uint64 - }{}, - output: "C180", - }, - { - val: struct { - X *uint64 `rlp:"nilList"` - }{}, - output: "C1C0", - }, - { - val: struct { - X *[]uint64 - }{}, - output: "C1C0", - }, - { - val: struct { - X *[]uint64 `rlp:"nilString"` - }{}, - output: "C180", - }, - - // interfaces - {val: []io.Reader{reader}, output: "C3C20102"}, // the contained value is a struct - - // Encoder - {val: (*testEncoder)(nil), output: "C0"}, - {val: &testEncoder{}, output: "00010001000100010001"}, - {val: &testEncoder{errors.New("test error")}, error: "test error"}, - {val: struct{ E testEncoderValueMethod }{}, output: "C3FAFEF0"}, - {val: struct{ E *testEncoderValueMethod }{}, output: "C1C0"}, - - // Verify that the Encoder interface works for unsupported types like func(). - {val: undecodableEncoder(func() {}), output: "F5F5F5"}, - - // Verify that pointer method testEncoder.EncodeRLP is called for - // addressable non-pointer values. - {val: &struct{ TE testEncoder }{testEncoder{}}, output: "CA00010001000100010001"}, - {val: &struct{ TE testEncoder }{testEncoder{errors.New("test error")}}, error: "test error"}, - - // Verify the error for non-addressable non-pointer Encoder. - {val: testEncoder{}, error: "rlp: unadressable value of type rlp.testEncoder, EncodeRLP is pointer method"}, - - // Verify Encoder takes precedence over []byte. - {val: []byteEncoder{0, 1, 2, 3, 4}, output: "C5C0C0C0C0C0"}, -} - -func runEncTests(t *testing.T, f func(val interface{}) ([]byte, error)) { - t.Helper() - for i, test := range encTests { - output, err := f(test.val) - if err != nil && test.error == "" { - t.Errorf("test %d: unexpected error: %v\nvalue %#v\ntype %T", - i, err, test.val, test.val) - continue - } - if test.error != "" && fmt.Sprint(err) != test.error { - t.Errorf("test %d: error mismatch\ngot %v\nwant %v\nvalue %#v\ntype %T", - i, err, test.error, test.val, test.val) - continue - } - if err == nil && !bytes.Equal(output, unhex(test.output)) { - t.Errorf("test %d: output mismatch:\ngot %X\nwant %s\nvalue %#v\ntype %T", - i, output, test.output, test.val, test.val) - } - } -} - -func TestEncode(t *testing.T) { - runEncTests(t, func(val interface{}) ([]byte, error) { - b := new(bytes.Buffer) - err := Encode(b, val) - return b.Bytes(), err - }) -} - -func TestEncodeToBytes(t *testing.T) { - runEncTests(t, EncodeToBytes) -} - -func TestEncodeToReader(t *testing.T) { - runEncTests(t, func(val interface{}) ([]byte, error) { - _, r, err := EncodeToReader(val) - if err != nil { - return nil, err - } - return io.ReadAll(r) - }) -} - -func TestEncodeToReaderPiecewise(t *testing.T) { - runEncTests(t, func(val interface{}) ([]byte, error) { - size, r, err := EncodeToReader(val) - if err != nil { - return nil, err - } - - // read output piecewise - output := make([]byte, size) - for start, end := 0, 0; start < size; start = end { - if remaining := size - start; remaining < 3 { - end += remaining - } else { - end = start + 3 - } - n, err := r.Read(output[start:end]) - end = start + n - if errors.Is(err, io.EOF) { - break - } else if err != nil { - return nil, err - } - } - return output, nil - }) -} - -// This is a regression test verifying that encReader -// returns its encBuffer to the pool only once. -func TestEncodeToReaderReturnToPool(t *testing.T) { - buf := make([]byte, 50) - wg := new(sync.WaitGroup) - for i := 0; i < 5; i++ { - wg.Add(1) - go func() { - for i := 0; i < 1000; i++ { - _, r, _ := EncodeToReader("foo") - io.ReadAll(r) - r.Read(buf) - r.Read(buf) - r.Read(buf) - r.Read(buf) - } - wg.Done() - }() - } - wg.Wait() -} - -var sink interface{} - -func BenchmarkIntsize(b *testing.B) { - for i := 0; i < b.N; i++ { - sink = intsize(0x12345678) - } -} - -func BenchmarkPutint(b *testing.B) { - buf := make([]byte, 8) - for i := 0; i < b.N; i++ { - putint(buf, 0x12345678) - sink = buf - } -} + strLen := StringLen(str) + assert.Equal(t, 56+2, strLen) -func BenchmarkEncodeBigInts(b *testing.B) { - ints := make([]*big.Int, 200) - for i := range ints { - ints[i] = math.BigPow(2, int64(i)) - } - out := bytes.NewBuffer(make([]byte, 0, 4096)) - b.ResetTimer() - b.ReportAllocs() + encoded := make([]byte, strLen) + EncodeString(str, encoded) - for i := 0; i < b.N; i++ { - out.Reset() - if err := Encode(out, ints); err != nil { - b.Fatal(err) - } - } + dataPos, dataLen, err := String(encoded, 0) + require.NoError(t, err) + assert.Equal(t, dataPos, 2) + assert.Equal(t, dataLen, 56) } diff --git a/erigon-lib/rlp/parse.go b/erigon-lib/rlp/parse.go new file mode 100644 index 00000000000..09545f4347e --- /dev/null +++ b/erigon-lib/rlp/parse.go @@ -0,0 +1,288 @@ +// Copyright 2021 The Erigon Authors +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package rlp + +import ( + "errors" + "fmt" + + "github.com/holiman/uint256" + + "github.com/erigontech/erigon-lib/common" +) + +var ( + ErrBase = errors.New("rlp") + ErrParse = fmt.Errorf("%w parse", ErrBase) + ErrDecode = fmt.Errorf("%w decode", ErrBase) +) + +func IsRLPError(err error) bool { return errors.Is(err, ErrBase) } + +// BeInt parses Big Endian representation of an integer from given payload at given position +func BeInt(payload []byte, pos, length int) (int, error) { + var r int + if pos+length >= len(payload) { + return 0, fmt.Errorf("%w: unexpected end of payload", ErrParse) + } + if length > 0 && payload[pos] == 0 { + return 0, fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: %x", ErrParse, payload[pos:pos+length]) + } + for _, b := range payload[pos : pos+length] { + r = (r << 8) | int(b) + } + return r, nil +} + +// Prefix parses RLP Prefix from given payload at given position. It returns the offset and length of the RLP element +// as well as the indication of whether it is a list of string +func Prefix(payload []byte, pos int) (dataPos int, dataLen int, isList bool, err error) { + if pos < 0 { + return 0, 0, false, fmt.Errorf("%w: negative position not allowed", ErrParse) + } + if pos >= len(payload) { + return 0, 0, false, fmt.Errorf("%w: unexpected end of payload", ErrParse) + } + switch first := payload[pos]; { + case first < 128: + dataPos = pos + dataLen = 1 + isList = false + case first < 184: + // Otherwise, if a string is 0-55 bytes long, + // the RLP encoding consists of a single byte with value 0x80 plus the + // length of the string followed by the string. The range of the first + // byte is thus [0x80, 0xB7]. + dataPos = pos + 1 + dataLen = int(first) - 128 + isList = false + if dataLen == 1 && dataPos < len(payload) && payload[dataPos] < 128 { + err = fmt.Errorf("%w: non-canonical size information", ErrParse) + } + case first < 192: + // If a string is more than 55 bytes long, the + // RLP encoding consists of a single byte with value 0xB7 plus the length + // of the length of the string in binary form, followed by the length of + // the string, followed by the string. For example, a length-1024 string + // would be encoded as 0xB90400 followed by the string. The range of + // the first byte is thus [0xB8, 0xBF]. + beLen := int(first) - 183 + dataPos = pos + 1 + beLen + dataLen, err = BeInt(payload, pos+1, beLen) + isList = false + if dataLen < 56 { + err = fmt.Errorf("%w: non-canonical size information", ErrParse) + } + case first < 248: + // isList of len < 56 + // If the total payload of a list + // (i.e. the combined length of all its items) is 0-55 bytes long, the + // RLP encoding consists of a single byte with value 0xC0 plus the length + // of the list followed by the concatenation of the RLP encodings of the + // items. The range of the first byte is thus [0xC0, 0xF7]. + dataPos = pos + 1 + dataLen = int(first) - 192 + isList = true + default: + // If the total payload of a list is more than 55 bytes long, + // the RLP encoding consists of a single byte with value 0xF7 + // plus the length of the length of the payload in binary + // form, followed by the length of the payload, followed by + // the concatenation of the RLP encodings of the items. The + // range of the first byte is thus [0xF8, 0xFF]. + beLen := int(first) - 247 + dataPos = pos + 1 + beLen + dataLen, err = BeInt(payload, pos+1, beLen) + isList = true + if dataLen < 56 { + err = fmt.Errorf("%w: : non-canonical size information", ErrParse) + } + } + if err == nil { + if dataPos+dataLen > len(payload) { + err = fmt.Errorf("%w: unexpected end of payload", ErrParse) + } else if dataPos+dataLen < 0 { + err = fmt.Errorf("%w: found too big len", ErrParse) + } + } + return +} + +func List(payload []byte, pos int) (dataPos, dataLen int, err error) { + dataPos, dataLen, isList, err := Prefix(payload, pos) + if err != nil { + return 0, 0, err + } + if !isList { + return 0, 0, fmt.Errorf("%w: must be a list", ErrParse) + } + return +} + +func String(payload []byte, pos int) (dataPos, dataLen int, err error) { + dataPos, dataLen, isList, err := Prefix(payload, pos) + if err != nil { + return 0, 0, err + } + if isList { + return 0, 0, fmt.Errorf("%w: must be a string, instead of a list", ErrParse) + } + return +} +func StringOfLen(payload []byte, pos, expectedLen int) (dataPos int, err error) { + dataPos, dataLen, err := String(payload, pos) + if err != nil { + return 0, err + } + if dataLen != expectedLen { + return 0, fmt.Errorf("%w: expected string of len %d, got %d", ErrParse, expectedLen, dataLen) + } + return +} + +// U64 parses uint64 number from given payload at given position +func U64(payload []byte, pos int) (int, uint64, error) { + dataPos, dataLen, isList, err := Prefix(payload, pos) + if err != nil { + return 0, 0, err + } + if isList { + return 0, 0, fmt.Errorf("%w: uint64 must be a string, not isList", ErrParse) + } + if dataLen > 8 { + return 0, 0, fmt.Errorf("%w: uint64 must not be more than 8 bytes long, got %d", ErrParse, dataLen) + } + if dataLen > 0 && payload[dataPos] == 0 { + return 0, 0, fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: %x", ErrParse, payload[dataPos:dataPos+dataLen]) + } + var r uint64 + for _, b := range payload[dataPos : dataPos+dataLen] { + r = (r << 8) | uint64(b) + } + return dataPos + dataLen, r, nil +} + +// U32 parses uint64 number from given payload at given position +func U32(payload []byte, pos int) (int, uint32, error) { + dataPos, dataLen, isList, err := Prefix(payload, pos) + if err != nil { + return 0, 0, err + } + if isList { + return 0, 0, fmt.Errorf("%w: uint32 must be a string, not isList", ErrParse) + } + if dataLen > 4 { + return 0, 0, fmt.Errorf("%w: uint32 must not be more than 4 bytes long, got %d", ErrParse, dataLen) + } + if dataLen > 0 && payload[dataPos] == 0 { + return 0, 0, fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: %x", ErrParse, payload[dataPos:dataPos+dataLen]) + } + var r uint32 + for _, b := range payload[dataPos : dataPos+dataLen] { + r = (r << 8) | uint32(b) + } + return dataPos + dataLen, r, nil +} + +// U256 parses uint256 number from given payload at given position +func U256(payload []byte, pos int, x *uint256.Int) (int, error) { + dataPos, dataLen, err := String(payload, pos) + if err != nil { + return 0, err + } + if dataLen > 32 { + return 0, fmt.Errorf("%w: uint256 must not be more than 32 bytes long, got %d", ErrParse, dataLen) + } + if dataLen > 0 && payload[dataPos] == 0 { + return 0, fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: %x", ErrParse, payload[dataPos:dataPos+dataLen]) + } + x.SetBytes(payload[dataPos : dataPos+dataLen]) + return dataPos + dataLen, nil +} + +func U256Len(z *uint256.Int) int { + if z == nil { + return 1 + } + nBits := z.BitLen() + if nBits == 0 { + return 1 + } + if nBits <= 7 { + return 1 + } + return 1 + common.BitLenToByteLen(nBits) +} + +func ParseHash(payload []byte, pos int, hashbuf []byte) (int, error) { + pos, err := StringOfLen(payload, pos, 32) + if err != nil { + return 0, fmt.Errorf("%s: hash len: %w", ParseHashErrorPrefix, err) + } + copy(hashbuf, payload[pos:pos+32]) + return pos + 32, nil +} + +const ParseHashErrorPrefix = "parse hash payload" + +const ParseAnnouncementsErrorPrefix = "parse announcement payload" + +func ParseAnnouncements(payload []byte, pos int) ([]byte, []uint32, []byte, int, error) { + pos, totalLen, err := List(payload, pos) + if err != nil { + return nil, nil, nil, pos, err + } + if pos+totalLen > len(payload) { + return nil, nil, nil, pos, fmt.Errorf("%s: totalLen %d is beyond the end of payload", ParseAnnouncementsErrorPrefix, totalLen) + } + pos, typesLen, err := String(payload, pos) + if err != nil { + return nil, nil, nil, pos, err + } + if pos+typesLen > len(payload) { + return nil, nil, nil, pos, fmt.Errorf("%s: typesLen %d is beyond the end of payload", ParseAnnouncementsErrorPrefix, typesLen) + } + types := payload[pos : pos+typesLen] + pos += typesLen + pos, sizesLen, err := List(payload, pos) + if err != nil { + return nil, nil, nil, pos, err + } + if pos+sizesLen > len(payload) { + return nil, nil, nil, pos, fmt.Errorf("%s: sizesLen %d is beyond the end of payload", ParseAnnouncementsErrorPrefix, sizesLen) + } + sizes := make([]uint32, typesLen) + for i := 0; i < len(sizes); i++ { + if pos, sizes[i], err = U32(payload, pos); err != nil { + return nil, nil, nil, pos, err + } + } + pos, hashesLen, err := List(payload, pos) + if err != nil { + return nil, nil, nil, pos, err + } + if pos+hashesLen > len(payload) { + return nil, nil, nil, pos, fmt.Errorf("%s: hashesLen %d is beyond the end of payload", ParseAnnouncementsErrorPrefix, hashesLen) + } + hashes := make([]byte, 32*(hashesLen/33)) + for i := 0; i < len(hashes); i += 32 { + if pos, err = ParseHash(payload, pos, hashes[i:]); err != nil { + return nil, nil, nil, pos, err + } + } + return types, sizes, hashes, pos, nil +} diff --git a/erigon-lib/rlp/parse_test.go b/erigon-lib/rlp/parse_test.go new file mode 100644 index 00000000000..a100d77afb5 --- /dev/null +++ b/erigon-lib/rlp/parse_test.go @@ -0,0 +1,108 @@ +// Copyright 2024 The Erigon Authors +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package rlp + +import ( + "fmt" + "testing" + + "github.com/holiman/uint256" + "github.com/stretchr/testify/assert" + + "github.com/erigontech/erigon-lib/common/hexutility" +) + +var parseU64Tests = []struct { + expectErr error + payload []byte + expectPos int + expectRes uint64 +}{ + {payload: hexutility.MustDecodeHex("820400"), expectPos: 3, expectRes: 1024}, + {payload: hexutility.MustDecodeHex("07"), expectPos: 1, expectRes: 7}, + {payload: hexutility.MustDecodeHex("8107"), expectErr: fmt.Errorf("%w: non-canonical size information", ErrParse)}, + {payload: hexutility.MustDecodeHex("B8020004"), expectErr: fmt.Errorf("%w: non-canonical size information", ErrParse)}, + {payload: hexutility.MustDecodeHex("C0"), expectErr: fmt.Errorf("%w: uint64 must be a string, not isList", ErrParse)}, + {payload: hexutility.MustDecodeHex("00"), expectErr: fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: 00", ErrParse)}, + {payload: hexutility.MustDecodeHex("8AFFFFFFFFFFFFFFFFFF7C"), expectErr: fmt.Errorf("%w: uint64 must not be more than 8 bytes long, got 10", ErrParse)}, +} + +var parseU32Tests = []struct { + expectErr error + payload []byte + expectPos int + expectRes uint32 +}{ + {payload: hexutility.MustDecodeHex("820400"), expectPos: 3, expectRes: 1024}, + {payload: hexutility.MustDecodeHex("07"), expectPos: 1, expectRes: 7}, + {payload: hexutility.MustDecodeHex("8107"), expectErr: fmt.Errorf("%w: non-canonical size information", ErrParse)}, + {payload: hexutility.MustDecodeHex("B8020004"), expectErr: fmt.Errorf("%w: non-canonical size information", ErrParse)}, + {payload: hexutility.MustDecodeHex("C0"), expectErr: fmt.Errorf("%w: uint32 must be a string, not isList", ErrParse)}, + {payload: hexutility.MustDecodeHex("00"), expectErr: fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: 00", ErrParse)}, + {payload: hexutility.MustDecodeHex("85FF6738FF7C"), expectErr: fmt.Errorf("%w: uint32 must not be more than 4 bytes long, got 5", ErrParse)}, +} + +var parseU256Tests = []struct { + expectErr error + expectRes *uint256.Int + payload []byte + expectPos int +}{ + {payload: hexutility.MustDecodeHex("8BFFFFFFFFFFFFFFFFFF7C"), expectErr: fmt.Errorf("%w: unexpected end of payload", ErrParse)}, + {payload: hexutility.MustDecodeHex("8AFFFFFFFFFFFFFFFFFF7C"), expectPos: 11, expectRes: new(uint256.Int).SetBytes(hexutility.MustDecodeHex("FFFFFFFFFFFFFFFFFF7C"))}, + {payload: hexutility.MustDecodeHex("85CE05050505"), expectPos: 6, expectRes: new(uint256.Int).SetUint64(0xCE05050505)}, + {payload: hexutility.MustDecodeHex("820400"), expectPos: 3, expectRes: new(uint256.Int).SetUint64(1024)}, + {payload: hexutility.MustDecodeHex("07"), expectPos: 1, expectRes: new(uint256.Int).SetUint64(7)}, + {payload: hexutility.MustDecodeHex("8107"), expectErr: fmt.Errorf("%w: non-canonical size information", ErrParse)}, + {payload: hexutility.MustDecodeHex("B8020004"), expectErr: fmt.Errorf("%w: non-canonical size information", ErrParse)}, + {payload: hexutility.MustDecodeHex("C0"), expectErr: fmt.Errorf("%w: must be a string, instead of a list", ErrParse)}, + {payload: hexutility.MustDecodeHex("00"), expectErr: fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: 00", ErrParse)}, + {payload: hexutility.MustDecodeHex("A101000000000000000000000000000000000000008B000000000000000000000000"), expectErr: fmt.Errorf("%w: uint256 must not be more than 32 bytes long, got 33", ErrParse)}, +} + +func TestPrimitives(t *testing.T) { + for i, tt := range parseU64Tests { + t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { + assert := assert.New(t) + pos, res, err := U64(tt.payload, 0) + assert.Equal(tt.expectErr, err) + assert.Equal(tt.expectPos, pos) + assert.Equal(tt.expectRes, res) + }) + } + for i, tt := range parseU32Tests { + t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { + assert := assert.New(t) + pos, res, err := U32(tt.payload, 0) + assert.Equal(tt.expectErr, err) + assert.Equal(tt.expectPos, pos) + assert.Equal(tt.expectRes, res) + }) + } + for i, tt := range parseU256Tests { + t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { + assert := assert.New(t) + res := new(uint256.Int) + pos, err := U256(tt.payload, 0, res) + assert.Equal(tt.expectErr, err) + assert.Equal(tt.expectPos, pos) + if err == nil { + assert.Equal(tt.expectRes, res) + } + }) + } +} diff --git a/erigon-lib/rlp2/encodel.go b/erigon-lib/rlp2/encodel.go index 40090308aa4..2a706ff76b7 100644 --- a/erigon-lib/rlp2/encodel.go +++ b/erigon-lib/rlp2/encodel.go @@ -296,11 +296,3 @@ func EncodeAnnouncements(types []byte, sizes []uint32, hashes []byte, encodeBuf } return pos } - -// EncodeAddress assumes that `to` buffer is already 21-bytes long -func EncodeAddress(a, to []byte) int { - _ = to[20] // early bounds check to guarantee safety of writes below - to[0] = 128 + 20 - copy(to[1:21], a[:20]) - return 21 -} diff --git a/erigon-lib/tools/golangci_lint.sh b/erigon-lib/tools/golangci_lint.sh index 1ff8b402e4c..4c812bc72b9 100755 --- a/erigon-lib/tools/golangci_lint.sh +++ b/erigon-lib/tools/golangci_lint.sh @@ -2,7 +2,7 @@ scriptDir=$(dirname "${BASH_SOURCE[0]}") scriptName=$(basename "${BASH_SOURCE[0]}") -version="v1.60.3" +version="v1.60.0" if [[ "$1" == "--install-deps" ]] then diff --git a/erigon-lib/trie/hack.go b/erigon-lib/trie/hack.go deleted file mode 100644 index ab95af40fe8..00000000000 --- a/erigon-lib/trie/hack.go +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2024 The Erigon Authors -// This file is part of Erigon. -// -// Erigon is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Erigon is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Erigon. If not, see . - -package trie - -import ( - "fmt" - - libcommon "github.com/erigontech/erigon-lib/common" - - "github.com/erigontech/erigon-lib/rlp" -) - -func FullNode1() { - f := &fullNode{} - b, err := rlp.EncodeToBytes(f) - if err != nil { - panic(err) - } - fmt.Printf("FullNode1 %x\n", b) -} - -func FullNode2() { - f := &fullNode{} - f.Children[0] = valueNode(nil) - b, err := rlp.EncodeToBytes(f) - if err != nil { - panic(err) - } - fmt.Printf("FullNode2 %x\n", b) -} - -func FullNode3() { - f := &fullNode{} - f.Children[0] = valueNode(nil) - h := libcommon.Hash{} - f.Children[1] = hashNode{hash: h[:]} - b, err := rlp.EncodeToBytes(f) - if err != nil { - panic(err) - } - fmt.Printf("FullNode3 %x\n", b) -} - -func FullNode4() { - f := &fullNode{} - h := libcommon.Hash{} - for i := 0; i < 17; i++ { - f.Children[i] = hashNode{hash: h[:]} - } - b, err := rlp.EncodeToBytes(f) - if err != nil { - panic(err) - } - fmt.Printf("FullNode4 %x\n", b) -} - -func ShortNode1() { - s := NewShortNode([]byte("1"), valueNode("2")) - b, err := rlp.EncodeToBytes(s) - if err != nil { - panic(err) - } - fmt.Printf("ShortNode1 %x\n", b) -} - -func ShortNode2() { - s := NewShortNode([]byte("1"), valueNode("123456789012345678901234567890123456789012345678901234567890")) - b, err := rlp.EncodeToBytes(s) - if err != nil { - panic(err) - } - fmt.Printf("ShortNode2 %x\n", b) -} - -func hashRoot(n node, title string) { - h := newHasher(false) - h1 := newHasher(true) - defer returnHasherToPool(h) - defer returnHasherToPool(h1) - var hash libcommon.Hash - hLen, _ := h.hash(n, true, hash[:]) - if hLen < 32 { - panic("expected hashNode") - } - fmt.Printf("%s noencode: %x\n", title, hash[:]) - hLen, _ = h1.hash(n, true, hash[:]) - if hLen < 32 { - panic("expected hashNode") - } - fmt.Printf("%s encode: %x\n", title, hash[:]) -} - -func Hash1() { - f := &fullNode{} - hashRoot(f, "Hash1") -} - -func Hash2() { - f := &fullNode{} - f.Children[0] = &fullNode{} - hashRoot(f, "Hash2") -} - -func Hash3() { - s := NewShortNode([]byte("12"), valueNode("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012")) - hashRoot(s, "Hash3") -} - -func Hash4() { - s := NewShortNode([]byte("12345678901234567890123456789012"), valueNode("12345678901234567890")) - hashRoot(s, "Hash4") -} - -func Hash5() { - s := NewShortNode([]byte("1234567890123456789012345678901"), valueNode("1")) - hashRoot(s, "Hash5") -} - -func Hash6() { - s := NewShortNode(libcommon.FromHex("080010"), valueNode(libcommon.FromHex("f90129a0bc7bbe9ce39e604900ca736606290650c4c630501a97745a3f21fae5261623df830362c0b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0"))) - hashRoot(s, "Hash6") -} - -func Hash7() { - d := &duoNode{} - d.child1 = NewShortNode(libcommon.FromHex("0110"), valueNode(libcommon.FromHex("f871820ba5850ba43b7400830186a0942eb08efb9e10d9f56e46938f28c13ecb33f67b158a085c1bad4187cfe90000801ba0a7e45cf38e44d2c39a4b94bae2e14fccde41e3280c57b611d9cb6494fde12fc7a00858adac2ba2381c591978b8404c22981f7141f0aef9c3cab8f93a55efc40acc"))) - d.child2 = NewShortNode(libcommon.FromHex("0010"), valueNode(libcommon.FromHex("fa02368e820276850ba43b7400830f4240947fd85d1fc04087b3d9d1e610410989191c09b97380ba023624847b07e7000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000011af74000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000790000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000006f0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000720000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000007a000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000350000000000000000000000000000000000000000000000000000000000000056000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000eb00000000000000000000000000000000000000000000000000000000000000a100000000000000000000000000000000000000000000000000000000000000c1000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000005d0000000000000000000000000000000000000000000000000000000000000085000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000fe000000000000000000000000000000000000000000000000000000000000005f0000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000008300000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000045000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000a2000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000d900000000000000000000000000000000000000000000000000000000000000d900000000000000000000000000000000000000000000000000000000000000d1000000000000000000000000000000000000000000000000000000000000008800000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000d700000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000008b0000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000b20000000000000000000000000000000000000000000000000000000000000096000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000dd00000000000000000000000000000000000000000000000000000000000000ba00000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000ae0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003900000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000009d000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000006500000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000ab0000000000000000000000000000000000000000000000000000000000000099000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000ee00000000000000000000000000000000000000000000000000000000000000830000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000760000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000004b00000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000a600000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000008e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000e50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000b600000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000b2000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000008b0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000006f0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000006e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000530000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000004c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000003500000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002d0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004700000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000350000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000390000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000003700000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000003500000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000390000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000039000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000006500000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000350000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002d0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000560000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000006500000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000530000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000007a0000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b70000000000000000000000000000000000000000000000000000000000000075000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000097000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000008f000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000d500000000000000000000000000000000000000000000000000000000000000d60000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f40000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000c7000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000f1000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000a700000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000b900000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000bd000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000b10000000000000000000000000000000000000000000000000000000000000039000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000a60000000000000000000000000000000000000000000000000000000000000059000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000dd000000000000000000000000000000000000000000000000000000000000008d000000000000000000000000000000000000000000000000000000000000009d000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000008700000000000000000000000000000000000000000000000000000000000000cb00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000007e0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000000000000000000000000000620000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000ae00000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000b3000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000d700000000000000000000000000000000000000000000000000000000000000fb000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000ae000000000000000000000000000000000000000000000000000000000000006b0000000000000000000000000000000000000000000000000000000000000075000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000fc00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000de0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000d50000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000000000000000de000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000be00000000000000000000000000000000000000000000000000000000000000f30000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000099000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000009f000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000004100000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000093000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000970000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000fe00000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000de000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000ba000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000c700000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000a30000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008b00000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000e8000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000d600000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000da00000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000ef000000000000000000000000000000000000000000000000000000000000002700000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000e500000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000003900000000000000000000000000000000000000000000000000000000000000cd000000000000000000000000000000000000000000000000000000000000002300000000000000000000000000000000000000000000000000000000000000aa000000000000000000000000000000000000000000000000000000000000005d00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000008e0000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000f9000000000000000000000000000000000000000000000000000000000000009b0000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000007600000000000000000000000000000000000000000000000000000000000000bb0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000b3000000000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000000000000000000000000000dd00000000000000000000000000000000000000000000000000000000000000a5000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000970000000000000000000000000000000000000000000000000000000000000085000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000f50000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002d0000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000ea00000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000f50000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008c00000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000e4000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000760000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000001b00000000000000000000000000000000000000000000000000000000000000c90000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000f200000000000000000000000000000000000000000000000000000000000000e90000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a300000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000002300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000fc00000000000000000000000000000000000000000000000000000000000000d300000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000ce0000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000005b00000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000e2000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000cb00000000000000000000000000000000000000000000000000000000000000590000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000490000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000079000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000086000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000079000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d0000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000007a0000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000007a0000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000086000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000079000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000045000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003e0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000480000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000680000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000006500000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000b600000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000b40000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000c500000000000000000000000000000000000000000000000000000000000000da00000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000f6000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000bb0000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000e90000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000bd000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000b20000000000000000000000000000000000000000000000000000000000000039000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000008a000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000ba000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000370000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000590000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000009d00000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000d600000000000000000000000000000000000000000000000000000000000000da0000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008d00000000000000000000000000000000000000000000000000000000000000c900000000000000000000000000000000000000000000000000000000000000f10000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000bf0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000ac000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000fe000000000000000000000000000000000000000000000000000000000000003300000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000008400000000000000000000000000000000000000000000000000000000000000f200000000000000000000000000000000000000000000000000000000000000fd00000000000000000000000000000000000000000000000000000000000000cd00000000000000000000000000000000000000000000000000000000000000bb000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000004e0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000db0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000950000000000000000000000000000000000000000000000000000000000000085000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000fe00000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000590000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000430000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000005f000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000490000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000f80000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000c50000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000b6000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000ea0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000003d00000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000093000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000007100000000000000000000000000000000000000000000000000000000000000b600000000000000000000000000000000000000000000000000000000000000e70000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000008b00000000000000000000000000000000000000000000000000000000000000840000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000007500000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000910000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000003300000000000000000000000000000000000000000000000000000000000000f700000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000b3000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000a60000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000009e000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000008b000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000023000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000720000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009b00000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000d60000000000000000000000000000000000000000000000000000000000000071000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000810000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000e4000000000000000000000000000000000000000000000000000000000000008a000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000c50000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000007900000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000008f00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000b900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000b300000000000000000000000000000000000000000000000000000000000000ef00000000000000000000000000000000000000000000000000000000000000eb0000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000009d000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000e5000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000ea000000000000000000000000000000000000000000000000000000000000003900000000000000000000000000000000000000000000000000000000000000b500000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000004f00000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000099000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000b700000000000000000000000000000000000000000000000000000000000000a100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000006b0000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000fd00000000000000000000000000000000000000000000000000000000000000e2000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000083000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000a100000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000006d0000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000e900000000000000000000000000000000000000000000000000000000000000b60000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000000d0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000db000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000c700000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000009d00000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000bd0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000006f0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000006e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000001b00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000006f0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000620000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000340000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000039000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000003900000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003500000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000003900000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000006f0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000006e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000530000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000004c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000003500000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000003300000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000af0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000009b00000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000005d000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000c600000000000000000000000000000000000000000000000000000000000000d500000000000000000000000000000000000000000000000000000000000000e8000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000d0000000000000000000000000000000000000000000000000000000000000008b000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000e4000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000a700000000000000000000000000000000000000000000000000000000000000dd0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000d4000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000005d0000000000000000000000000000000000000000000000000000000000000098000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000008d0000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000da000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000d60000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000b500000000000000000000000000000000000000000000000000000000000000e9000000000000000000000000000000000000000000000000000000000000004a000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000e2000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000340000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000005f000000000000000000000000000000000000000000000000000000000000003f000000000000000000000000000000000000000000000000000000000000003f0000000000000000000000000000000000000000000000000000000000000091000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000c7000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000b60000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000009f0000000000000000000000000000000000000000000000000000000000000086000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000a300000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000008300000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000d3000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000009d0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000c9000000000000000000000000000000000000000000000000000000000000008300000000000000000000000000000000000000000000000000000000000000e7000000000000000000000000000000000000000000000000000000000000001b00000000000000000000000000000000000000000000000000000000000000c4000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000ac000000000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000000000000000000000000000e700000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000009e000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000000000000000000d800000000000000000000000000000000000000000000000000000000000000be000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000008f00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000006800000000000000000000000000000000000000000000000000000000000000710000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000de0000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000bf00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d300000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000b300000000000000000000000000000000000000000000000000000000000000d70000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000009b00000000000000000000000000000000000000000000000000000000000000fd000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000008c00000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000f1000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000b30000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000a700000000000000000000000000000000000000000000000000000000000000830000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000e700000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000b5000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000fc00000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000008400000000000000000000000000000000000000000000000000000000000000d1000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000bc000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000000000000000000000000000000000000ad00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000088000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000d7000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000008700000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000007e0000000000000000000000000000000000000000000000000000000000000087000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000f9000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000fd000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000980000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008d00000000000000000000000000000000000000000000000000000000000000d600000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000bb000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000480000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000008b00000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000b70000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000bf00000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000d900000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000bc0000000000000000000000000000000000000000000000000000000000000057000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000e50000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000bb000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000000000000000000b600000000000000000000000000000000000000000000000000000000000000590000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a300000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000002300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000980000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000008d000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000fb00000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000aa000000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000006500000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000000000000000000000000000000000004e0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000fc00000000000000000000000000000000000000000000000000000000000000d300000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000ce0000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000005b00000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000e2000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000079000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000620000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000079000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000480000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f80000000000000000000000000000000000000000000000000000000000000045000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000250000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000007500000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a30000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000c60000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000ac000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000093000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000b700000000000000000000000000000000000000000000000000000000000000ea00000000000000000000000000000000000000000000000000000000000000ae000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000007e0000000000000000000000000000000000000000000000000000000000000078000000000000000000000000000000000000000000000000000000000000008d000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000f8000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000ef00000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000000000000000000000000000000000005b00000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000009a000000000000000000000000000000000000000000000000000000000000008f0000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000002700000000000000000000000000000000000000000000000000000000000000c7000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000fb00000000000000000000000000000000000000000000000000000000000000930000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000a9000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000ef000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000008400000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000c4000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000af0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000830000000000000000000000000000000000000000000000000000000000000087000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000009700000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000710000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000b300000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000d9000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000009200000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000b6000000000000000000000000000000000000000000000000000000000000007900000000000000000000000000000000000000000000000000000000000000bc0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000004a000000000000000000000000000000000000000000000000000000000000009d0000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000c5000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000f200000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000b4000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000aa0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000ba000000000000000000000000000000000000000000000000000000000000004f00000000000000000000000000000000000000000000000000000000000000ef0000000000000000000000000000000000000000000000000000000000000093000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000ef000000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000008e0000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000000000000000000000000000b10000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000009700000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000b200000000000000000000000000000000000000000000000000000000000000c6000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000007900000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000000d0000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000037000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000340000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000be0000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000390000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000fb000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000a100000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000004e0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000008d00000000000000000000000000000000000000000000000000000000000000cd000000000000000000000000000000000000000000000000000000000000008c00000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000fe000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000000000000000000000000000000000000000005d0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000f8000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000056000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000075000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000a60000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000ba000000000000000000000000000000000000000000000000000000000000004b00000000000000000000000000000000000000000000000000000000000000a5000000000000000000000000000000000000000000000000000000000000005d0000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000009a000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000008d000000000000000000000000000000000000000000000000000000000000005f0000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000ef00000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000009900000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000f20000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000980000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000f60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000006b0000000000000000000000000000000000000000000000000000000000000041000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000a6000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000fe00000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000ba000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000ed0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000a100000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000c7000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000d60000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000b1000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000c4000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000007a0000000000000000000000000000000000000000000000000000000000000086000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000078000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000ef00000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000fb00000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000a50000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000093000000000000000000000000000000000000000000000000000000000000009e0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000001d0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000009d00000000000000000000000000000000000000000000000000000000000000fc00000000000000000000000000000000000000000000000000000000000000e900000000000000000000000000000000000000000000000000000000000000ae00000000000000000000000000000000000000000000000000000000000000ae00000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000ef000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000b700000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000c1000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000e3000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000e6000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000004b0000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000ea000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000000000000000ec0000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000b600000000000000000000000000000000000000000000000000000000000000b7000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000008a00000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000e6000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000e7000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c5000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000e200000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000fe000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000004b0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000ee000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000ab0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000d5000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000f1000000000000000000000000000000000000000000000000000000000000005b0000000000000000000000000000000000000000000000000000000000000097000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000000000000000000fe0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000870000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000004f00000000000000000000000000000000000000000000000000000000000000b1000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000b900000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000006200000000000000000000000000000000000000000000000000000000000000af0000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000005b0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000004c00000000000000000000000000000000000000000000000000000000000000b80000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000005c000000000000000000000000000000000000000000000000000000000000009900000000000000000000000000000000000000000000000000000000000000c70000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000b7000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000a2000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000de000000000000000000000000000000000000000000000000000000000000008a0000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000b7000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000c500000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000ad00000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000008d000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000e9000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000ed000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000c50000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000da00000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000aa0000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000ae000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000009a000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000760000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000cd000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000520000000000000000000000000000000000000000000000000000000000000023000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000d4000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000004a000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000021000000000000000000000000000000000000000000000000000000000000006b00000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000e7000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000006a0000000000000000000000000000000000000000000000000000000000000039000000000000000000000000000000000000000000000000000000000000004100000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000bf00000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000007100000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009d00000000000000000000000000000000000000000000000000000000000000ea0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000a2000000000000000000000000000000000000000000000000000000000000007a000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000230000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000008a0000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000ac0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000003700000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000d700000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000007600000000000000000000000000000000000000000000000000000000000000c1000000000000000000000000000000000000000000000000000000000000005c000000000000000000000000000000000000000000000000000000000000009b0000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000009a000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000008b00000000000000000000000000000000000000000000000000000000000000a90000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000093000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000f6000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000ba00000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000e10000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000c5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000d2000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000c600000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000c90000000000000000000000000000000000000000000000000000000000000098000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000c700000000000000000000000000000000000000000000000000000000000000780000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000009a0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000d900000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000007100000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000a80000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000c900000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000ef000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000d800000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000000000000000000000000000000000000000003700000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000620000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000c4000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000d50000000000000000000000000000000000000000000000000000000000000045000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000008b00000000000000000000000000000000000000000000000000000000000000a10000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000002300000000000000000000000000000000000000000000000000000000000000d2000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000007600000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000041000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000e70000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000c1000000000000000000000000000000000000000000000000000000000000009a0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000c60000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000b3000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000970000000000000000000000000000000000000000000000000000000000000078000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000db000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000cd000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000000000000000000000000000000000005d000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000c4000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000bc000000000000000000000000000000000000000000000000000000000000009c0000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000d4000000000000000000000000000000000000000000000000000000000000009e000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000fc00000000000000000000000000000000000000000000000000000000000000e600000000000000000000000000000000000000000000000000000000000000ed00000000000000000000000000000000000000000000000000000000000000b6000000000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000000000000000000000000000930000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000006e0000000000000000000000000000000000000000000000000000000000000023000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000e700000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000df0000000000000000000000000000000000000000000000000000000000000097000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000aa000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000ae00000000000000000000000000000000000000000000000000000000000000d0000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000cd00000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000b200000000000000000000000000000000000000000000000000000000000000b100000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000920000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000003f000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000d10000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000e50000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000003e00000000000000000000000000000000000000000000000000000000000000b4000000000000000000000000000000000000000000000000000000000000002d0000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000b6000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000096000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000a2000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000ec0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000008b00000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000085000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000f1000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000da00000000000000000000000000000000000000000000000000000000000000230000000000000000000000000000000000000000000000000000000000000045000000000000000000000000000000000000000000000000000000000000003f000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000a6000000000000000000000000000000000000000000000000000000000000005f000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000007900000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000004f00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000009e0000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000008f00000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000083000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000007100000000000000000000000000000000000000000000000000000000000000cd000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000cf00000000000000000000000000000000000000000000000000000000000000d600000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000f6000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000003300000000000000000000000000000000000000000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000056000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000e8000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000d3000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000de0000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000009f000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000b2000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000ba000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000d700000000000000000000000000000000000000000000000000000000000000cc0000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000d500000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000d1000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000b50000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000f80000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000008d0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000fd000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000cb0000000000000000000000000000000000000000000000000000000000000057000000000000000000000000000000000000000000000000000000000000008400000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000086000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000d8000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000ae00000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000009e000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000bc0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000fc0000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000e90000000000000000000000000000000000000000000000000000000000000096000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000d500000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000d2000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000eb000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000da000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000e900000000000000000000000000000000000000000000000000000000000000a9000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000fd00000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000de000000000000000000000000000000000000000000000000000000000000009e000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000e5000000000000000000000000000000000000000000000000000000000000007a0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000f1000000000000000000000000000000000000000000000000000000000000005d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e8000000000000000000000000000000000000000000000000000000000000003500000000000000000000000000000000000000000000000000000000000000c6000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000005f0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000003f000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000fb000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000db000000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000a80000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000d900000000000000000000000000000000000000000000000000000000000000dc000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000009f0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000b20000000000000000000000000000000000000000000000000000000000000059000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000ac000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000e500000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000e6000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000be00000000000000000000000000000000000000000000000000000000000000850000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000b4000000000000000000000000000000000000000000000000000000000000008d00000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000008100000000000000000000000000000000000000000000000000000000000000bf00000000000000000000000000000000000000000000000000000000000000e5000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000720000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000fd000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000ed000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000008a000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000e6000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000e4000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000007600000000000000000000000000000000000000000000000000000000000000f9000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000005d000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000005b0000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000006a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002d0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000a800000000000000000000000000000000000000000000000000000000000000e500000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001b0000000000000000000000000000000000000000000000000000000000000041000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000a20000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000004100000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000004d00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000de00000000000000000000000000000000000000000000000000000000000000e4000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000950000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000350000000000000000000000000000000000000000000000000000000000000071000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000d900000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000bb000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000e20000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000008f00000000000000000000000000000000000000000000000000000000000000fd000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000e500000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000078000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000a70000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000ed00000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000005d00000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000c500000000000000000000000000000000000000000000000000000000000000c4000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000b7000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000a9000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000d7000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000f70000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000ea000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000ae000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000ad00000000000000000000000000000000000000000000000000000000000000a6000000000000000000000000000000000000000000000000000000000000003e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000006800000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000ee000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000e50000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000fb0000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000059000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000da000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000a600000000000000000000000000000000000000000000000000000000000000cf00000000000000000000000000000000000000000000000000000000000000a6000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000008f00000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000008a0000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000002b0000000000000000000000000000000000000000000000000000000000000057000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000059000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000ee00000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000d800000000000000000000000000000000000000000000000000000000000000df0000000000000000000000000000000000000000000000000000000000000089000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000c600000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000d7000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000f40000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000cd000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000150000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000eb00000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000250000000000000000000000000000000000000000000000000000000000000087000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000000000000000000000000000000000000000009f000000000000000000000000000000000000000000000000000000000000008100000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000e800000000000000000000000000000000000000000000000000000000000000dc000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000f700000000000000000000000000000000000000000000000000000000000000e800000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000bb000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000ea000000000000000000000000000000000000000000000000000000000000005e00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000089000000000000000000000000000000000000000000000000000000000000004700000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000c1000000000000000000000000000000000000000000000000000000000000007900000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000c20000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000006b00000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000de0000000000000000000000000000000000000000000000000000000000000023000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000fc0000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000e6000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000b1000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000dd00000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000a2000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000bd0000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000d5000000000000000000000000000000000000000000000000000000000000005e00000000000000000000000000000000000000000000000000000000000000e90000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000d800000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000b300000000000000000000000000000000000000000000000000000000000000b5000000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000da000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000e500000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000000000000000000000000000000000000000008e0000000000000000000000000000000000000000000000000000000000000066000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000b3000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000f700000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000ee000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000000000000000000000000071000000000000000000000000000000000000000000000000000000000000006d0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000db000000000000000000000000000000000000000000000000000000000000008d0000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000004f00000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000e2000000000000000000000000000000000000000000000000000000000000008b000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000004100000000000000000000000000000000000000000000000000000000000000ac0000000000000000000000000000000000000000000000000000000000000021000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000be000000000000000000000000000000000000000000000000000000000000009c0000000000000000000000000000000000000000000000000000000000000099000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000008f000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000aa00000000000000000000000000000000000000000000000000000000000000b4000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000b100000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000cd00000000000000000000000000000000000000000000000000000000000000f80000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000bf0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000008a000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000ef000000000000000000000000000000000000000000000000000000000000005b00000000000000000000000000000000000000000000000000000000000000b900000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000b2000000000000000000000000000000000000000000000000000000000000009e000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000980000000000000000000000000000000000000000000000000000000000000037000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000e20000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000005c00000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000cf00000000000000000000000000000000000000000000000000000000000000cf0000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000b200000000000000000000000000000000000000000000000000000000000000d8000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000210000000000000000000000000000000000000000000000000000000000000083000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000a70000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000003b00000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000a9000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000086000000000000000000000000000000000000000000000000000000000000008500000000000000000000000000000000000000000000000000000000000000350000000000000000000000000000000000000000000000000000000000000097000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000fb000000000000000000000000000000000000000000000000000000000000008e000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000bc000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000850000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000b200000000000000000000000000000000000000000000000000000000000000ee00000000000000000000000000000000000000000000000000000000000000aa0000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e10000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000c20000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000006d0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000005d000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000a40000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000041000000000000000000000000000000000000000000000000000000000000005c00000000000000000000000000000000000000000000000000000000000000b40000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000004d0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000a800000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000037000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000aa000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000f70000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000002700000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000023000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000d500000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000be00000000000000000000000000000000000000000000000000000000000000b100000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000920000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000ef00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000087000000000000000000000000000000000000000000000000000000000000008800000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000005c00000000000000000000000000000000000000000000000000000000000000cc0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000ea00000000000000000000000000000000000000000000000000000000000000b7000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000057000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000bd000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000c70000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000b900000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000003e00000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000bd0000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000a700000000000000000000000000000000000000000000000000000000000000bc000000000000000000000000000000000000000000000000000000000000008b000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000c600000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000fa0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000005e0000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000a300000000000000000000000000000000000000000000000000000000000000490000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000009a000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000a600000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000d8000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000004b0000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000760000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e3000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000da00000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000e700000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000075000000000000000000000000000000000000000000000000000000000000009f000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000ed00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000e50000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000eb00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000ea00000000000000000000000000000000000000000000000000000000000000c9000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000a40000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000b300000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000b70000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000007a0000000000000000000000000000000000000000000000000000000000000045000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000ea00000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000b700000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000005e00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000b7000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000009200000000000000000000000000000000000000000000000000000000000000760000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000006200000000000000000000000000000000000000000000000000000000000000bc000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000590000000000000000000000000000000000000000000000000000000000000021000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000d500000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000f70000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000b100000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000a600000000000000000000000000000000000000000000000000000000000000f1000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000003f000000000000000000000000000000000000000000000000000000000000004c00000000000000000000000000000000000000000000000000000000000000850000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000b1000000000000000000000000000000000000000000000000000000000000006800000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000a9000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000c70000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000920000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000fd0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000c9000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000007100000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000d1000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000004a0000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000008500000000000000000000000000000000000000000000000000000000000000aa00000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000079000000000000000000000000000000000000000000000000000000000000005c000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000008300000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008500000000000000000000000000000000000000000000000000000000000000e9000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000560000000000000000000000000000000000000000000000000000000000000041000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000b60000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000009f000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000066000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000fe00000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000fb00000000000000000000000000000000000000000000000000000000000000fe00000000000000000000000000000000000000000000000000000000000000ba00000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000b600000000000000000000000000000000000000000000000000000000000000a20000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000004b00000000000000000000000000000000000000000000000000000000000000da00000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000dd00000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000000000000000000000000091000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000ee000000000000000000000000000000000000000000000000000000000000008a0000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000004100000000000000000000000000000000000000000000000000000000000000530000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000c500000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000850000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000005e00000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000008f00000000000000000000000000000000000000000000000000000000000000930000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000fb00000000000000000000000000000000000000000000000000000000000000b2000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000d800000000000000000000000000000000000000000000000000000000000000a700000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000bb0000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000e800000000000000000000000000000000000000000000000000000000000000fe000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000370000000000000000000000000000000000000000000000000000000000000083000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000c20000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000e2000000000000000000000000000000000000000000000000000000000000006800000000000000000000000000000000000000000000000000000000000000c9000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000c6000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000ed000000000000000000000000000000000000000000000000000000000000004700000000000000000000000000000000000000000000000000000000000000cd00000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000d7000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000000d0000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000078000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000d9000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000007600000000000000000000000000000000000000000000000000000000000000ed00000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000008800000000000000000000000000000000000000000000000000000000000000e9000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000d10000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000d70000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000009700000000000000000000000000000000000000000000000000000000000000d600000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000088000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000a800000000000000000000000000000000000000000000000000000000000000930000000000000000000000000000000000000000000000000000000000000021000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000ed000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000a300000000000000000000000000000000000000000000000000000000000000950000000000000000000000000000000000000000000000000000000000000098000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000d4000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000510000000000000000000000000000000000000000000000000000000000000091000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000f9000000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000009b00000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000ed000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000aa000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000004d00000000000000000000000000000000000000000000000000000000000000bc000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000d4000000000000000000000000000000000000000000000000000000000000008f000000000000000000000000000000000000000000000000000000000000005d000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000008f0000000000000000000000000000000000000000000000000000000000000085000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000de00000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000df0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001b00000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000005c00000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000fd000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000007600000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000a9000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000d9000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000c6000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000cb00000000000000000000000000000000000000000000000000000000000000a30000000000000000000000000000000000000000000000000000000000000021000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000aa000000000000000000000000000000000000000000000000000000000000003300000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000004e0000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000c5000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000fd00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000097000000000000000000000000000000000000000000000000000000000000006b0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000960000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000008a00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000089000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000d10000000000000000000000000000000000000000000000000000000000000098000000000000000000000000000000000000000000000000000000000000002700000000000000000000000000000000000000000000000000000000000000e3000000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000008300000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000004100000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000008100000000000000000000000000000000000000000000000000000000000000ac000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000bd000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000fd00000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000aa00000000000000000000000000000000000000000000000000000000000000d1000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000ac000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000bc0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000950000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000ed000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000eb000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000eb00000000000000000000000000000000000000000000000000000000000000d300000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000c900000000000000000000000000000000000000000000000000000000000000d70000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000085000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000a6000000000000000000000000000000000000000000000000000000000000008f000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000078000000000000000000000000000000000000000000000000000000000000009200000000000000000000000000000000000000000000000000000000000000f80000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000aa0000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000006a0000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000350000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000037000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000ee000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000006b00000000000000000000000000000000000000000000000000000000000000580000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004d00000000000000000000000000000000000000000000000000000000000000b4000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000c1000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000e500000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000c500000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000710000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000007e0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000d800000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000009200000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000006a0000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000f60000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000008a00000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000007a000000000000000000000000000000000000000000000000000000000000003f0000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000005d00000000000000000000000000000000000000000000000000000000000000c900000000000000000000000000000000000000000000000000000000000000ae0000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000d60000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000008b000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000d700000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000000cb00000000000000000000000000000000000000000000000000000000000000ce0000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000e700000000000000000000000000000000000000000000000000000000000000ab0000000000000000000000000000000000000000000000000000000000000075000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000001ba05d4d29b6f1b101809f9b43edea6e227828ed7df55663b482cff3d9d7a14ec20aa023db82ed86dd399e73aee94f0f0f8854d352c413e64c4b7f8d8a9bf5cb198d4b"))) - d.mask |= uint32(1) << 0 - d.mask |= uint32(1) << 8 - hashRoot(d, "Hash7") -} diff --git a/eth/backend.go b/eth/backend.go index 7ed0895c9d6..e2dce8d56cd 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -50,7 +50,6 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/common/dbg" - "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/common/dir" "github.com/erigontech/erigon-lib/common/disk" "github.com/erigontech/erigon-lib/common/mem" @@ -82,6 +81,7 @@ import ( executionclient "github.com/erigontech/erigon/cl/phase1/execution_client" "github.com/erigontech/erigon/cmd/caplin/caplin1" "github.com/erigontech/erigon/cmd/rpcdaemon/cli" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/clique" "github.com/erigontech/erigon/consensus/ethash" diff --git a/eth/calltracer/calltracer.go b/eth/calltracer/calltracer.go index 4d6dd32a6b5..224e6a8b756 100644 --- a/eth/calltracer/calltracer.go +++ b/eth/calltracer/calltracer.go @@ -26,7 +26,7 @@ import ( "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/vm" ) diff --git a/eth/consensuschain/consensus_chain_reader.go b/eth/consensuschain/consensus_chain_reader.go index 1340727fb5d..83c5ca088a6 100644 --- a/eth/consensuschain/consensus_chain_reader.go +++ b/eth/consensuschain/consensus_chain_reader.go @@ -25,10 +25,10 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" ) diff --git a/eth/protocols/eth/discovery.go b/eth/protocols/eth/discovery.go index 395da4c96ad..a10ce596043 100644 --- a/eth/protocols/eth/discovery.go +++ b/eth/protocols/eth/discovery.go @@ -24,9 +24,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/forkid" "github.com/erigontech/erigon/p2p/enr" + "github.com/erigontech/erigon/rlp" ) // enrEntry is the ENR entry which advertises `eth` protocol on the discovery. diff --git a/eth/protocols/eth/handler_test.go b/eth/protocols/eth/handler_test.go index e605f88be1c..700f5d15172 100644 --- a/eth/protocols/eth/handler_test.go +++ b/eth/protocols/eth/handler_test.go @@ -31,13 +31,13 @@ import ( "github.com/erigontech/erigon-lib/direct" sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p/sentry/sentry_multi_client" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/jsonrpc/receipts" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/eth/protocols/eth/handlers.go b/eth/protocols/eth/handlers.go index a5cca7277c7..18693db825a 100644 --- a/eth/protocols/eth/handlers.go +++ b/eth/protocols/eth/handlers.go @@ -24,13 +24,13 @@ import ( "fmt" "github.com/erigontech/erigon-lib/chain" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" ) diff --git a/eth/protocols/eth/protocol.go b/eth/protocols/eth/protocol.go index 6447591388b..f17e6cbc85a 100644 --- a/eth/protocols/eth/protocol.go +++ b/eth/protocols/eth/protocol.go @@ -27,11 +27,11 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/direct" proto_sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" - rlp2 "github.com/erigontech/erigon-lib/rlp2" + rlp2 "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/forkid" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" ) var ProtocolToString = map[uint]string{ diff --git a/eth/protocols/eth/protocol_test.go b/eth/protocols/eth/protocol_test.go index 3e7ced9cec4..82fa9f846c6 100644 --- a/eth/protocols/eth/protocol_test.go +++ b/eth/protocols/eth/protocol_test.go @@ -26,9 +26,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" ) // Tests that the custom union field encoder and decoder works correctly. diff --git a/eth/stagedsync/chain_reader.go b/eth/stagedsync/chain_reader.go index 1fd37f6f17f..270b06de861 100644 --- a/eth/stagedsync/chain_reader.go +++ b/eth/stagedsync/chain_reader.go @@ -25,10 +25,10 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" ) diff --git a/eth/stagedsync/exec3.go b/eth/stagedsync/exec3.go index c5d0b840f53..2fbc037efc0 100644 --- a/eth/stagedsync/exec3.go +++ b/eth/stagedsync/exec3.go @@ -37,7 +37,6 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/metrics" state2 "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon-lib/wrap" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" @@ -45,6 +44,7 @@ import ( "github.com/erigontech/erigon/core/rawdb/rawtemporaldb" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/eth/ethconfig/estimate" "github.com/erigontech/erigon/eth/stagedsync/stages" "github.com/erigontech/erigon/turbo/services" diff --git a/eth/stagedsync/stage_commit_rebuild.go b/eth/stagedsync/stage_commit_rebuild.go index 2bb0d6696af..82ce0303181 100644 --- a/eth/stagedsync/stage_commit_rebuild.go +++ b/eth/stagedsync/stage_commit_rebuild.go @@ -19,7 +19,6 @@ package stagedsync import ( "context" "errors" - "github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks" "github.com/erigontech/erigon/turbo/stages/headerdownload" @@ -29,7 +28,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon-lib/trie" + "github.com/erigontech/erigon/turbo/trie" ) type TrieCfg struct { diff --git a/eth/stagedsync/stage_headers.go b/eth/stagedsync/stage_headers.go index fe03640c415..c083e4d2fdc 100644 --- a/eth/stagedsync/stage_headers.go +++ b/eth/stagedsync/stage_headers.go @@ -34,13 +34,13 @@ import ( "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/diagnostics" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/rawdb/blockio" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/shards" "github.com/erigontech/erigon/turbo/stages/bodydownload" diff --git a/eth/stagedsync/stage_mining_create_block.go b/eth/stagedsync/stage_mining_create_block.go index 8da7c5bed4a..d6ebbfd858d 100644 --- a/eth/stagedsync/stage_mining_create_block.go +++ b/eth/stagedsync/stage_mining_create_block.go @@ -31,8 +31,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/kv" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/misc" "github.com/erigontech/erigon/core" diff --git a/eth/stagedsync/stage_mining_exec.go b/eth/stagedsync/stage_mining_exec.go index db03cb9fe53..f9a07141143 100644 --- a/eth/stagedsync/stage_mining_exec.go +++ b/eth/stagedsync/stage_mining_exec.go @@ -33,13 +33,13 @@ import ( "github.com/erigontech/erigon-lib/kv/membatchwithdb" "github.com/erigontech/erigon-lib/log/v3" state2 "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon-lib/wrap" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/eth/stagedsync/stages" "github.com/erigontech/erigon/params" diff --git a/eth/stagedsync/stage_polygon_sync.go b/eth/stagedsync/stage_polygon_sync.go index ea5a0dd9d4e..7d9e393913d 100644 --- a/eth/stagedsync/stage_polygon_sync.go +++ b/eth/stagedsync/stage_polygon_sync.go @@ -35,7 +35,6 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/rawdb/blockio" "github.com/erigontech/erigon/core/types" @@ -48,6 +47,7 @@ import ( "github.com/erigontech/erigon/polygon/p2p" "github.com/erigontech/erigon/polygon/sync" polygonsync "github.com/erigontech/erigon/polygon/sync" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/shards" ) diff --git a/eth/stagedsync/stage_senders.go b/eth/stagedsync/stage_senders.go index c235dacbaec..61845af230f 100644 --- a/eth/stagedsync/stage_senders.go +++ b/eth/stagedsync/stage_senders.go @@ -36,7 +36,7 @@ import ( "github.com/erigontech/erigon-lib/kv/dbutils" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" diff --git a/eth/stagedsync/stage_senders_test.go b/eth/stagedsync/stage_senders_test.go index 0e2beae1b34..47e24e70acb 100644 --- a/eth/stagedsync/stage_senders_test.go +++ b/eth/stagedsync/stage_senders_test.go @@ -23,10 +23,10 @@ import ( "github.com/stretchr/testify/require" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" diff --git a/eth/stagedsync/testutil.go b/eth/stagedsync/testutil.go index 802a9a8aec1..5bb4a71ef13 100644 --- a/eth/stagedsync/testutil.go +++ b/eth/stagedsync/testutil.go @@ -24,8 +24,8 @@ import ( "github.com/holiman/uint256" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon/core/state" + "github.com/erigontech/erigon/core/types/accounts" ) const ( diff --git a/eth/tracers/internal/tracetest/calltrace_test.go b/eth/tracers/internal/tracetest/calltrace_test.go index 40082cfa26f..f393e91ef58 100644 --- a/eth/tracers/internal/tracetest/calltrace_test.go +++ b/eth/tracers/internal/tracetest/calltrace_test.go @@ -31,13 +31,13 @@ import ( "github.com/stretchr/testify/require" "github.com/erigontech/erigon-lib/chain" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/dir" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" diff --git a/eth/tracers/internal/tracetest/prestate_test.go b/eth/tracers/internal/tracetest/prestate_test.go index 36abdde4d08..00efcd98ba7 100644 --- a/eth/tracers/internal/tracetest/prestate_test.go +++ b/eth/tracers/internal/tracetest/prestate_test.go @@ -30,9 +30,9 @@ import ( "github.com/holiman/uint256" "github.com/stretchr/testify/require" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/dir" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" diff --git a/eth/tracers/js/goja.go b/eth/tracers/js/goja.go index e8f84ce44bf..a0674cbd51c 100644 --- a/eth/tracers/js/goja.go +++ b/eth/tracers/js/goja.go @@ -28,10 +28,10 @@ import ( "github.com/dop251/goja" "github.com/holiman/uint256" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/core/vm/evmtypes" "github.com/erigontech/erigon/core/vm/stack" diff --git a/eth/tracers/logger/json_stream.go b/eth/tracers/logger/json_stream.go index e9a582e4ef7..1ba2c40ca95 100644 --- a/eth/tracers/logger/json_stream.go +++ b/eth/tracers/logger/json_stream.go @@ -26,7 +26,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/vm" ) diff --git a/eth/tracers/logger/logger_json.go b/eth/tracers/logger/logger_json.go index 87d9ce8fa5c..6ad2d7a6a4f 100644 --- a/eth/tracers/logger/logger_json.go +++ b/eth/tracers/logger/logger_json.go @@ -29,7 +29,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/vm" ) diff --git a/eth/tracers/native/4byte.go b/eth/tracers/native/4byte.go index 77942f307dd..f7cc63eb654 100644 --- a/eth/tracers/native/4byte.go +++ b/eth/tracers/native/4byte.go @@ -28,7 +28,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/eth/tracers" ) diff --git a/ethdb/privateapi/ethbackend.go b/ethdb/privateapi/ethbackend.go index 75780673e58..33d0e7126a3 100644 --- a/ethdb/privateapi/ethbackend.go +++ b/ethdb/privateapi/ethbackend.go @@ -24,7 +24,6 @@ import ( "google.golang.org/protobuf/types/known/emptypb" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/direct" "github.com/erigontech/erigon-lib/gointerfaces" @@ -32,9 +31,10 @@ import ( types2 "github.com/erigontech/erigon-lib/gointerfaces/typesproto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/eth/stagedsync/stages" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/builder" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/shards" diff --git a/ethdb/privateapi/mining.go b/ethdb/privateapi/mining.go index 15aa10e278f..b8f9d6e3ea7 100644 --- a/ethdb/privateapi/mining.go +++ b/ethdb/privateapi/mining.go @@ -31,9 +31,9 @@ import ( types2 "github.com/erigontech/erigon-lib/gointerfaces/typesproto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" ) // MiningAPIVersion diff --git a/event/subscription.go b/event/subscription.go index 8fd192bca01..2eda0e2b7fc 100644 --- a/event/subscription.go +++ b/event/subscription.go @@ -24,7 +24,7 @@ import ( "sync" "time" - "github.com/erigontech/erigon-lib/common/mclock" + "github.com/erigontech/erigon/common/mclock" ) // Subscription represents a stream of events. The carrier of the events is typically a diff --git a/go.mod b/go.mod index 62ee556903d..9a6d9449db7 100644 --- a/go.mod +++ b/go.mod @@ -20,9 +20,11 @@ require ( github.com/alecthomas/kong v0.8.1 github.com/anacrolix/sync v0.5.1 github.com/anacrolix/torrent v1.52.6-0.20231201115409-7ea994b6bbd8 + github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b github.com/c2h5oh/datasize v0.0.0-20231215233829-aa82cc1e6500 github.com/cenkalti/backoff/v4 v4.2.1 github.com/consensys/gnark-crypto v0.12.1 + github.com/crate-crypto/go-ipa v0.0.0-20221111143132-9aa5d42120bc github.com/crate-crypto/go-kzg-4844 v0.7.0 github.com/davecgh/go-spew v1.1.1 github.com/deckarep/golang-set v1.8.0 @@ -105,8 +107,6 @@ require ( require ( github.com/alecthomas/atomic v0.1.0-alpha2 // indirect - github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b // indirect - github.com/crate-crypto/go-ipa v0.0.0-20221111143132-9aa5d42120bc // indirect github.com/elastic/go-freelru v0.13.0 // indirect github.com/erigontech/speedtest v0.0.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect diff --git a/node/nodecfg/config.go b/node/nodecfg/config.go index 8ac0c78a8dd..e13c6cb21ab 100644 --- a/node/nodecfg/config.go +++ b/node/nodecfg/config.go @@ -29,12 +29,12 @@ import ( "github.com/c2h5oh/datasize" - "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" - "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cmd/rpcdaemon/cli/httpcfg" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/common/paths" "github.com/erigontech/erigon/p2p" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/rpc/rpccfg" diff --git a/p2p/dial.go b/p2p/dial.go index 7d5e223d35e..b9523ed66f5 100644 --- a/p2p/dial.go +++ b/p2p/dial.go @@ -31,9 +31,9 @@ import ( "sync/atomic" "time" - "github.com/erigontech/erigon-lib/common/debug" - "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/netutil" ) diff --git a/p2p/dial_test.go b/p2p/dial_test.go index bfb9045bce0..d88f1ca93eb 100644 --- a/p2p/dial_test.go +++ b/p2p/dial_test.go @@ -30,8 +30,8 @@ import ( "testing" "time" - "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/netutil" "github.com/erigontech/erigon/turbo/testlog" diff --git a/p2p/discover/common.go b/p2p/discover/common.go index f35584c3f39..3307bc84267 100644 --- a/p2p/discover/common.go +++ b/p2p/discover/common.go @@ -25,9 +25,9 @@ import ( "net" "time" - "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" "github.com/erigontech/erigon/p2p/netutil" diff --git a/p2p/discover/ntp.go b/p2p/discover/ntp.go index 53cf7ed7d36..d0a7d2a4016 100644 --- a/p2p/discover/ntp.go +++ b/p2p/discover/ntp.go @@ -28,8 +28,8 @@ import ( "sort" "time" - "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/debug" ) const ( diff --git a/p2p/discover/table.go b/p2p/discover/table.go index 9b640322582..330fd7ac484 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -39,7 +39,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/netutil" ) diff --git a/p2p/discover/v4_udp.go b/p2p/discover/v4_udp.go index 803d497afff..846ca702533 100644 --- a/p2p/discover/v4_udp.go +++ b/p2p/discover/v4_udp.go @@ -33,9 +33,9 @@ import ( lru "github.com/hashicorp/golang-lru/v2" - "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/p2p/discover/v4wire" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/netutil" diff --git a/p2p/discover/v4wire/v4wire.go b/p2p/discover/v4wire/v4wire.go index 55d6cb2b41f..6ee38c52fa4 100644 --- a/p2p/discover/v4wire/v4wire.go +++ b/p2p/discover/v4wire/v4wire.go @@ -32,8 +32,8 @@ import ( "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/enr" + "github.com/erigontech/erigon/rlp" ) // RPC packet types diff --git a/p2p/discover/v4wire/v4wire_test.go b/p2p/discover/v4wire/v4wire_test.go index 0a5c7f56d26..296b611dd26 100644 --- a/p2p/discover/v4wire/v4wire_test.go +++ b/p2p/discover/v4wire/v4wire_test.go @@ -28,7 +28,7 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) // EIP-8 test vectors. diff --git a/p2p/discover/v5_udp.go b/p2p/discover/v5_udp.go index 78041cda899..0ed36b0a3e7 100644 --- a/p2p/discover/v5_udp.go +++ b/p2p/discover/v5_udp.go @@ -35,8 +35,8 @@ import ( "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common/debug" - "github.com/erigontech/erigon-lib/common/mclock" + "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/discover/v5wire" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" diff --git a/p2p/discover/v5_udp_test.go b/p2p/discover/v5_udp_test.go index 7d03bf9f13b..fa770f619b3 100644 --- a/p2p/discover/v5_udp_test.go +++ b/p2p/discover/v5_udp_test.go @@ -37,10 +37,10 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/turbo/testlog" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/discover/v5wire" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" + "github.com/erigontech/erigon/rlp" ) func startLocalhostV5(t *testing.T, cfg Config, logger log.Logger) *UDPv5 { diff --git a/p2p/discover/v5wire/encoding.go b/p2p/discover/v5wire/encoding.go index 5db2fa4d5d3..d813ca2a31e 100644 --- a/p2p/discover/v5wire/encoding.go +++ b/p2p/discover/v5wire/encoding.go @@ -31,10 +31,10 @@ import ( "fmt" "hash" - "github.com/erigontech/erigon-lib/common/mclock" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" + "github.com/erigontech/erigon/rlp" ) // TODO concurrent WHOAREYOU tie-breaker diff --git a/p2p/discover/v5wire/encoding_test.go b/p2p/discover/v5wire/encoding_test.go index 68ba2598af2..61e2b29039d 100644 --- a/p2p/discover/v5wire/encoding_test.go +++ b/p2p/discover/v5wire/encoding_test.go @@ -37,9 +37,9 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/erigontech/erigon-lib/common/hexutil" - "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" ) diff --git a/p2p/discover/v5wire/msg.go b/p2p/discover/v5wire/msg.go index c20a5343c7c..4931db883bc 100644 --- a/p2p/discover/v5wire/msg.go +++ b/p2p/discover/v5wire/msg.go @@ -23,10 +23,10 @@ import ( "fmt" "net" - "github.com/erigontech/erigon-lib/common/mclock" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" + "github.com/erigontech/erigon/rlp" ) // Packet is implemented by all message types. diff --git a/p2p/discover/v5wire/session.go b/p2p/discover/v5wire/session.go index b7fff118697..0c0c736d3ce 100644 --- a/p2p/discover/v5wire/session.go +++ b/p2p/discover/v5wire/session.go @@ -27,8 +27,8 @@ import ( "github.com/hashicorp/golang-lru/v2/simplelru" - "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" ) diff --git a/p2p/dnsdisc/client.go b/p2p/dnsdisc/client.go index 0431c481764..037dca61933 100644 --- a/p2p/dnsdisc/client.go +++ b/p2p/dnsdisc/client.go @@ -34,9 +34,9 @@ import ( "golang.org/x/sync/singleflight" "golang.org/x/time/rate" - "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" ) diff --git a/p2p/dnsdisc/client_test.go b/p2p/dnsdisc/client_test.go index 697bb4f7fca..82a1382dcd6 100644 --- a/p2p/dnsdisc/client_test.go +++ b/p2p/dnsdisc/client_test.go @@ -30,9 +30,9 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/erigontech/erigon-lib/common/hexutil" - "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" "github.com/erigontech/erigon/turbo/testlog" diff --git a/p2p/dnsdisc/sync.go b/p2p/dnsdisc/sync.go index a721c5527b7..36eb8e7a7a9 100644 --- a/p2p/dnsdisc/sync.go +++ b/p2p/dnsdisc/sync.go @@ -24,7 +24,7 @@ import ( "math/rand" "time" - "github.com/erigontech/erigon-lib/common/mclock" + "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" ) diff --git a/p2p/dnsdisc/tree.go b/p2p/dnsdisc/tree.go index 9389da3965e..dc846b4706f 100644 --- a/p2p/dnsdisc/tree.go +++ b/p2p/dnsdisc/tree.go @@ -33,9 +33,9 @@ import ( "golang.org/x/crypto/sha3" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" + "github.com/erigontech/erigon/rlp" ) // Tree is a merkle tree of node records. diff --git a/p2p/enode/idscheme.go b/p2p/enode/idscheme.go index 6c53341305c..fdee0783b4f 100644 --- a/p2p/enode/idscheme.go +++ b/p2p/enode/idscheme.go @@ -27,9 +27,9 @@ import ( "golang.org/x/crypto/sha3" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/discover/v4wire" "github.com/erigontech/erigon/p2p/enr" + "github.com/erigontech/erigon/rlp" ) // List of known secure identity schemes. diff --git a/p2p/enode/idscheme_test.go b/p2p/enode/idscheme_test.go index 0e8ff17b57f..ff34d2de36f 100644 --- a/p2p/enode/idscheme_test.go +++ b/p2p/enode/idscheme_test.go @@ -30,8 +30,8 @@ import ( "github.com/stretchr/testify/require" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/enr" + "github.com/erigontech/erigon/rlp" ) var ( diff --git a/p2p/enode/iter.go b/p2p/enode/iter.go index 0bf89f43725..7a06c187fcc 100644 --- a/p2p/enode/iter.go +++ b/p2p/enode/iter.go @@ -23,7 +23,7 @@ import ( "sync" "time" - "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon/common/debug" ) // Iterator represents a sequence of nodes. The Next method moves to the next node in the diff --git a/p2p/enode/node.go b/p2p/enode/node.go index c74a366ff3f..a504b719fdd 100644 --- a/p2p/enode/node.go +++ b/p2p/enode/node.go @@ -29,8 +29,8 @@ import ( "net" "strings" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/enr" + "github.com/erigontech/erigon/rlp" ) var errMissingPrefix = errors.New("missing 'enr:' prefix for base64-encoded record") diff --git a/p2p/enode/node_test.go b/p2p/enode/node_test.go index 67dda497010..5aae5d2ddcf 100644 --- a/p2p/enode/node_test.go +++ b/p2p/enode/node_test.go @@ -27,8 +27,8 @@ import ( "testing" "testing/quick" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/enr" + "github.com/erigontech/erigon/rlp" "github.com/stretchr/testify/assert" ) diff --git a/p2p/enode/nodedb.go b/p2p/enode/nodedb.go index 5466ebf8e2c..88b951525ed 100644 --- a/p2p/enode/nodedb.go +++ b/p2p/enode/nodedb.go @@ -37,7 +37,7 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/mdbx" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) // Keys in the node database. diff --git a/p2p/enr/enr.go b/p2p/enr/enr.go index 5298a4d075c..6b1719c39a3 100644 --- a/p2p/enr/enr.go +++ b/p2p/enr/enr.go @@ -43,7 +43,7 @@ import ( "io" "sort" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) const SizeLimit = 300 // maximum encoded size of a node record in bytes diff --git a/p2p/enr/enr_test.go b/p2p/enr/enr_test.go index 75358d8bc8b..bfcd5f74806 100644 --- a/p2p/enr/enr_test.go +++ b/p2p/enr/enr_test.go @@ -27,7 +27,7 @@ import ( "testing" "time" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/p2p/enr/entries.go b/p2p/enr/entries.go index 6e8b53b605a..d433d46706c 100644 --- a/p2p/enr/entries.go +++ b/p2p/enr/entries.go @@ -24,7 +24,7 @@ import ( "io" "net" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) // Entry is implemented by known node record entry types. diff --git a/p2p/message.go b/p2p/message.go index 81f57a1ff07..c847e353a82 100644 --- a/p2p/message.go +++ b/p2p/message.go @@ -28,10 +28,10 @@ import ( "sync/atomic" "time" - "github.com/erigontech/erigon-lib/common/debug" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/event" "github.com/erigontech/erigon/p2p/enode" + "github.com/erigontech/erigon/rlp" ) // Msg defines the structure of a p2p message. diff --git a/p2p/nat/natpmp.go b/p2p/nat/natpmp.go index 779a843cec6..b6239268fc4 100644 --- a/p2p/nat/natpmp.go +++ b/p2p/nat/natpmp.go @@ -28,7 +28,7 @@ import ( natpmp "github.com/jackpal/go-nat-pmp" - "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon/common/debug" ) // natPMPClient adapts the NAT-PMP protocol implementation so it conforms to diff --git a/p2p/nat/natupnp.go b/p2p/nat/natupnp.go index cfe3ba2d1f9..062570ead7a 100644 --- a/p2p/nat/natupnp.go +++ b/p2p/nat/natupnp.go @@ -31,7 +31,7 @@ import ( "github.com/huin/goupnp/dcps/internetgateway1" "github.com/huin/goupnp/dcps/internetgateway2" - "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon/common/debug" ) const ( diff --git a/p2p/netutil/iptrack.go b/p2p/netutil/iptrack.go index 0ceaf9e1048..36b3a1df5b9 100644 --- a/p2p/netutil/iptrack.go +++ b/p2p/netutil/iptrack.go @@ -22,7 +22,7 @@ package netutil import ( "time" - "github.com/erigontech/erigon-lib/common/mclock" + "github.com/erigontech/erigon/common/mclock" ) // IPTracker predicts the external endpoint, i.e. IP address and port, of the local host diff --git a/p2p/netutil/iptrack_test.go b/p2p/netutil/iptrack_test.go index 54de69ad11b..98c9131ad92 100644 --- a/p2p/netutil/iptrack_test.go +++ b/p2p/netutil/iptrack_test.go @@ -25,7 +25,7 @@ import ( "testing" "time" - "github.com/erigontech/erigon-lib/common/mclock" + "github.com/erigontech/erigon/common/mclock" ) const ( diff --git a/p2p/peer.go b/p2p/peer.go index 2dbbbec1ef5..ec59c235162 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -32,13 +32,13 @@ import ( "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common/debug" - "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/metrics" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/event" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" + "github.com/erigontech/erigon/rlp" ) var ( diff --git a/p2p/rlpx/rlpx.go b/p2p/rlpx/rlpx.go index bd0ca367b61..56dd8dd36b3 100644 --- a/p2p/rlpx/rlpx.go +++ b/p2p/rlpx/rlpx.go @@ -42,7 +42,7 @@ import ( "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/crypto/ecies" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) // Conn is an RLPx network connection. It wraps a low-level network connection. The diff --git a/p2p/rlpx/rlpx_test.go b/p2p/rlpx/rlpx_test.go index be116c7cd49..169b99fc7e6 100644 --- a/p2p/rlpx/rlpx_test.go +++ b/p2p/rlpx/rlpx_test.go @@ -36,8 +36,8 @@ import ( "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/crypto/ecies" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/simulations/pipes" + "github.com/erigontech/erigon/rlp" ) type message struct { diff --git a/p2p/sentry/sentry_grpc_server.go b/p2p/sentry/sentry_grpc_server.go index 21e47443680..732bf623ed2 100644 --- a/p2p/sentry/sentry_grpc_server.go +++ b/p2p/sentry/sentry_grpc_server.go @@ -51,15 +51,15 @@ import ( proto_sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" proto_types "github.com/erigontech/erigon-lib/gointerfaces/typesproto" - "github.com/erigontech/erigon-lib/common/debug" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/cmd/utils" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/core/forkid" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p" "github.com/erigontech/erigon/p2p/dnsdisc" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" ) const ( diff --git a/p2p/sentry/sentry_multi_client/broadcast.go b/p2p/sentry/sentry_multi_client/broadcast.go index 8b9bab490db..3ae450af624 100644 --- a/p2p/sentry/sentry_multi_client/broadcast.go +++ b/p2p/sentry/sentry_multi_client/broadcast.go @@ -29,10 +29,10 @@ import ( proto_sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/headerdownload" ) diff --git a/p2p/sentry/sentry_multi_client/sentry_api.go b/p2p/sentry/sentry_multi_client/sentry_api.go index 23f37d38a67..2e06d669007 100644 --- a/p2p/sentry/sentry_multi_client/sentry_api.go +++ b/p2p/sentry/sentry_multi_client/sentry_api.go @@ -26,9 +26,9 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces" proto_sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p/sentry" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/bodydownload" "github.com/erigontech/erigon/turbo/stages/headerdownload" ) diff --git a/p2p/sentry/sentry_multi_client/sentry_multi_client.go b/p2p/sentry/sentry_multi_client/sentry_multi_client.go index 4136cf01757..f4aace8590e 100644 --- a/p2p/sentry/sentry_multi_client/sentry_multi_client.go +++ b/p2p/sentry/sentry_multi_client/sentry_multi_client.go @@ -43,12 +43,12 @@ import ( "github.com/erigontech/erigon-lib/log/v3" libsentry "github.com/erigontech/erigon-lib/p2p/sentry" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p/sentry" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/jsonrpc/receipts" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/stages/bodydownload" diff --git a/p2p/sentry/simulator/sentry_simulator.go b/p2p/sentry/simulator/sentry_simulator.go index 264ee8d0b35..42101f799d4 100644 --- a/p2p/sentry/simulator/sentry_simulator.go +++ b/p2p/sentry/simulator/sentry_simulator.go @@ -33,7 +33,6 @@ import ( isentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" types "github.com/erigontech/erigon-lib/gointerfaces/typesproto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/cmd/snapshots/sync" coresnaptype "github.com/erigontech/erigon/core/snaptype" coretypes "github.com/erigontech/erigon/core/types" @@ -43,6 +42,7 @@ import ( "github.com/erigontech/erigon/p2p/discover/v4wire" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/sentry" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/snapshotsync" "github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks" ) diff --git a/p2p/sentry/simulator/simulator_test.go b/p2p/sentry/simulator/simulator_test.go index f4a865982a9..471753d8009 100644 --- a/p2p/sentry/simulator/simulator_test.go +++ b/p2p/sentry/simulator/simulator_test.go @@ -28,9 +28,9 @@ import ( "github.com/erigontech/erigon-lib/direct" sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" sentry_if "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p/sentry/simulator" + "github.com/erigontech/erigon/rlp" ) func TestSimulatorStart(t *testing.T) { diff --git a/p2p/server.go b/p2p/server.go index e4bdbf6834f..bf20f0bf596 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -37,10 +37,10 @@ import ( "golang.org/x/sync/semaphore" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/debug" - "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/event" "github.com/erigontech/erigon/p2p/discover" "github.com/erigontech/erigon/p2p/enode" diff --git a/p2p/transport.go b/p2p/transport.go index d3c4bb8f0d4..51dab6dceb9 100644 --- a/p2p/transport.go +++ b/p2p/transport.go @@ -31,9 +31,9 @@ import ( "time" "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/bitutil" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common/bitutil" "github.com/erigontech/erigon/p2p/rlpx" + "github.com/erigontech/erigon/rlp" ) const ( diff --git a/p2p/transport_test.go b/p2p/transport_test.go index 48c186da6b4..b7da37b4c90 100644 --- a/p2p/transport_test.go +++ b/p2p/transport_test.go @@ -29,8 +29,8 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/simulations/pipes" + "github.com/erigontech/erigon/rlp" ) func TestProtocolHandshake(t *testing.T) { diff --git a/p2p/util.go b/p2p/util.go index 7720034286b..b6b1fb5e594 100644 --- a/p2p/util.go +++ b/p2p/util.go @@ -22,7 +22,7 @@ package p2p import ( "container/heap" - "github.com/erigontech/erigon-lib/common/mclock" + "github.com/erigontech/erigon/common/mclock" ) // expHeap tracks strings and their expiry time. diff --git a/p2p/util_test.go b/p2p/util_test.go index b1791be5a24..956aa72d011 100644 --- a/p2p/util_test.go +++ b/p2p/util_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - "github.com/erigontech/erigon-lib/common/mclock" + "github.com/erigontech/erigon/common/mclock" ) func TestExpHeap(t *testing.T) { diff --git a/params/config.go b/params/config.go index a0bdcccfbb6..681e5856a37 100644 --- a/params/config.go +++ b/params/config.go @@ -31,7 +31,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/polygon/bor/borcfg" - "github.com/erigontech/erigon-lib/common/paths" + "github.com/erigontech/erigon/common/paths" ) //go:embed chainspecs diff --git a/params/dao.go b/params/dao.go index 86753f7969d..c8a21258b8f 100644 --- a/params/dao.go +++ b/params/dao.go @@ -24,7 +24,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" ) // DAOForkBlockExtra is the block header extra-data field to set for the DAO fork diff --git a/polygon/bor/bor.go b/polygon/bor/bor.go index 36337ac941c..e514be0c342 100644 --- a/polygon/bor/bor.go +++ b/polygon/bor/bor.go @@ -46,14 +46,13 @@ import ( "github.com/erigontech/erigon-lib/crypto/cryptopool" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/misc" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/core/vm/evmtypes" "github.com/erigontech/erigon/eth/ethconfig/estimate" "github.com/erigontech/erigon/params" @@ -64,6 +63,7 @@ import ( "github.com/erigontech/erigon/polygon/bor/statefull" "github.com/erigontech/erigon/polygon/bor/valset" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/services" ) diff --git a/polygon/bor/bor_test.go b/polygon/bor/bor_test.go index ac8221ac6fc..bf9dc122ab5 100644 --- a/polygon/bor/bor_test.go +++ b/polygon/bor/bor_test.go @@ -34,7 +34,6 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/kv/memdb" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" @@ -46,6 +45,7 @@ import ( "github.com/erigontech/erigon/polygon/bor/borcfg" "github.com/erigontech/erigon/polygon/bor/valset" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/polygon/bor/spanner.go b/polygon/bor/spanner.go index 78a27552d4d..f40bda6c92a 100644 --- a/polygon/bor/spanner.go +++ b/polygon/bor/spanner.go @@ -24,12 +24,12 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/polygon/bor/borcfg" "github.com/erigontech/erigon/polygon/bor/valset" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" ) //go:generate mockgen -typed=true -destination=./spanner_mock.go -package=bor . Spanner diff --git a/polygon/bor/state_receiver.go b/polygon/bor/state_receiver.go index fe685583055..e74f7cf0e54 100644 --- a/polygon/bor/state_receiver.go +++ b/polygon/bor/state_receiver.go @@ -18,8 +18,8 @@ package bor import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus" + "github.com/erigontech/erigon/rlp" ) //go:generate mockgen -typed=true -destination=./state_receiver_mock.go -package=bor . StateReceiver diff --git a/polygon/bor/state_receiver_mock.go b/polygon/bor/state_receiver_mock.go index 37d68a31cc1..f708a2b012e 100644 --- a/polygon/bor/state_receiver_mock.go +++ b/polygon/bor/state_receiver_mock.go @@ -13,7 +13,7 @@ import ( reflect "reflect" consensus "github.com/erigontech/erigon/consensus" - rlp "github.com/erigontech/erigon-lib/rlp" + rlp "github.com/erigontech/erigon/rlp" gomock "go.uber.org/mock/gomock" ) diff --git a/polygon/bridge/mdbx_store.go b/polygon/bridge/mdbx_store.go index 05b3d148e8a..75695e0826e 100644 --- a/polygon/bridge/mdbx_store.go +++ b/polygon/bridge/mdbx_store.go @@ -30,9 +30,9 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/order" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/polygon/heimdall" "github.com/erigontech/erigon/polygon/polygoncommon" + "github.com/erigontech/erigon/rlp" ) /* diff --git a/polygon/bridge/reader.go b/polygon/bridge/reader.go index 5074968bdc7..6cb9e965a8a 100644 --- a/polygon/bridge/reader.go +++ b/polygon/bridge/reader.go @@ -25,14 +25,14 @@ import ( "google.golang.org/protobuf/types/known/emptypb" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/gointerfaces" remote "github.com/erigontech/erigon-lib/gointerfaces/remoteproto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" ) type Reader struct { diff --git a/polygon/bridge/snapshot_store.go b/polygon/bridge/snapshot_store.go index c0b65742bf7..f25ccd93a3c 100644 --- a/polygon/bridge/snapshot_store.go +++ b/polygon/bridge/snapshot_store.go @@ -29,8 +29,8 @@ import ( "github.com/erigontech/erigon-lib/downloader/snaptype" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/recsplit" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/snapshotsync" ) diff --git a/polygon/bridge/store.go b/polygon/bridge/store.go index 48fea16c000..53ea631378f 100644 --- a/polygon/bridge/store.go +++ b/polygon/bridge/store.go @@ -21,8 +21,8 @@ import ( "time" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" ) type Store interface { diff --git a/polygon/heimdall/event_record.go b/polygon/heimdall/event_record.go index 6381f7970d0..ad897f9302b 100644 --- a/polygon/heimdall/event_record.go +++ b/polygon/heimdall/event_record.go @@ -26,8 +26,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/polygon/bor/borabi" + "github.com/erigontech/erigon/rlp" ) // EventRecord represents state record diff --git a/polygon/heimdall/snapshots.go b/polygon/heimdall/snapshots.go index 4ed939f889d..01e3e86d9cb 100644 --- a/polygon/heimdall/snapshots.go +++ b/polygon/heimdall/snapshots.go @@ -28,11 +28,11 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/polygon/bor/borcfg" bortypes "github.com/erigontech/erigon/polygon/bor/types" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/snapshotsync" ) diff --git a/polygon/p2p/fetcher_base_test.go b/polygon/p2p/fetcher_base_test.go index f38541c7633..27af15974a9 100644 --- a/polygon/p2p/fetcher_base_test.go +++ b/polygon/p2p/fetcher_base_test.go @@ -35,9 +35,9 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/typesproto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/p2p/sentry" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/testlog" ) diff --git a/polygon/p2p/message_listener.go b/polygon/p2p/message_listener.go index 3d32038bccd..046b3be607c 100644 --- a/polygon/p2p/message_listener.go +++ b/polygon/p2p/message_listener.go @@ -27,9 +27,9 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/p2p/sentry" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/polygon/polygoncommon" + "github.com/erigontech/erigon/rlp" ) type DecodedInboundMessage[TPacket any] struct { diff --git a/polygon/p2p/message_listener_test.go b/polygon/p2p/message_listener_test.go index aefd6e6b793..6ce296e268d 100644 --- a/polygon/p2p/message_listener_test.go +++ b/polygon/p2p/message_listener_test.go @@ -36,9 +36,9 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/p2p/sentry" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/testlog" ) diff --git a/polygon/p2p/message_sender.go b/polygon/p2p/message_sender.go index 5fe50842f0b..8a7722a7dac 100644 --- a/polygon/p2p/message_sender.go +++ b/polygon/p2p/message_sender.go @@ -23,8 +23,8 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/p2p/sentry" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/eth/protocols/eth" + "github.com/erigontech/erigon/rlp" ) var ErrPeerNotFound = errors.New("peer not found") diff --git a/polygon/p2p/message_sender_test.go b/polygon/p2p/message_sender_test.go index 24b8e6eb86e..a560d1cd0e1 100644 --- a/polygon/p2p/message_sender_test.go +++ b/polygon/p2p/message_sender_test.go @@ -29,9 +29,9 @@ import ( "github.com/erigontech/erigon-lib/direct" sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" erigonlibtypes "github.com/erigontech/erigon-lib/gointerfaces/typesproto" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" + "github.com/erigontech/erigon/rlp" ) func TestMessageSenderSendGetBlockHeaders(t *testing.T) { diff --git a/erigon-lib/rlp/decode.go b/rlp/decode.go similarity index 99% rename from erigon-lib/rlp/decode.go rename to rlp/decode.go index 149a4a4c980..ef2e5c4e5b3 100644 --- a/erigon-lib/rlp/decode.go +++ b/rlp/decode.go @@ -668,11 +668,11 @@ func NewStream(r io.Reader, inputLimit uint64) *Stream { // NewListStream creates a new stream that pretends to be positioned // at an encoded list of the given length. -func NewListStream(r io.Reader, _len uint64) *Stream { +func NewListStream(r io.Reader, len uint64) *Stream { s := new(Stream) - s.Reset(r, _len) + s.Reset(r, len) s.kind = List - s.size = _len + s.size = len return s } diff --git a/erigon-lib/rlp/decode_tail_test.go b/rlp/decode_tail_test.go similarity index 100% rename from erigon-lib/rlp/decode_tail_test.go rename to rlp/decode_tail_test.go diff --git a/erigon-lib/rlp/decode_test.go b/rlp/decode_test.go similarity index 99% rename from erigon-lib/rlp/decode_test.go rename to rlp/decode_test.go index c4f92bb1f5c..55915dcdb05 100644 --- a/erigon-lib/rlp/decode_test.go +++ b/rlp/decode_test.go @@ -56,7 +56,7 @@ func TestStreamKind(t *testing.T) { for i, test := range tests { // using plainReader to inhibit input limit errors. s := NewStream(newPlainReader(unhex(test.input)), 0) - kind, _len, err := s.Kind() + kind, len, err := s.Kind() if err != nil { t.Errorf("test %d: Kind returned error: %v", i, err) continue @@ -64,8 +64,8 @@ func TestStreamKind(t *testing.T) { if kind != test.wantKind { t.Errorf("test %d: kind mismatch: got %d, want %d", i, kind, test.wantKind) } - if _len != test.wantLen { - t.Errorf("test %d: _len mismatch: got %d, want %d", i, _len, test.wantLen) + if len != test.wantLen { + t.Errorf("test %d: len mismatch: got %d, want %d", i, len, test.wantLen) } } } @@ -234,10 +234,10 @@ testfor: func TestStreamList(t *testing.T) { s := NewStream(bytes.NewReader(unhex("C80102030405060708")), 0) - if _len, err := s.List(); err != nil { + if len, err := s.List(); err != nil { t.Fatalf("List error: %v", err) - } else if _len != 8 { - t.Fatalf("List returned invalid length, got %d, want 8", _len) + } else if len != 8 { + t.Fatalf("List returned invalid length, got %d, want 8", len) } for i := uint64(1); i <= 8; i++ { @@ -795,7 +795,6 @@ var decodeTests = []decodeTest{ func uintp(i uint) *uint { return &i } func runTests(t *testing.T, decode func([]byte, interface{}) error) { - t.Helper() for i, test := range decodeTests { input, err := hex.DecodeString(test.input) if err != nil { @@ -828,7 +827,6 @@ func TestDecodeWithByteReader(t *testing.T) { } func testDecodeWithEncReader(t *testing.T, n int) { - t.Helper() s := strings.Repeat("0", n) _, r, _ := EncodeToReader(s) var decoded string diff --git a/erigon-lib/rlp/doc.go b/rlp/doc.go similarity index 100% rename from erigon-lib/rlp/doc.go rename to rlp/doc.go diff --git a/erigon-lib/rlp/encbuffer.go b/rlp/encbuffer.go similarity index 100% rename from erigon-lib/rlp/encbuffer.go rename to rlp/encbuffer.go diff --git a/rlp/encode.go b/rlp/encode.go new file mode 100644 index 00000000000..75c14a9913b --- /dev/null +++ b/rlp/encode.go @@ -0,0 +1,681 @@ +// Copyright 2014 The go-ethereum Authors +// (original work) +// Copyright 2024 The Erigon Authors +// (modifications) +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package rlp + +import ( + "encoding/binary" + "errors" + "fmt" + "io" + "math/big" + "math/bits" + "reflect" + + "github.com/holiman/uint256" + + libcommon "github.com/erigontech/erigon-lib/common" +) + +// https://github.com/ethereum/wiki/wiki/RLP +const ( + // EmptyStringCode is the RLP code for empty strings. + EmptyStringCode = 0x80 + // EmptyListCode is the RLP code for empty lists. + EmptyListCode = 0xC0 +) + +var ErrNegativeBigInt = errors.New("rlp: cannot encode negative big.Int") + +var ( + // Common encoded values. + // These are useful when implementing EncodeRLP. + EmptyString = []byte{EmptyStringCode} + EmptyList = []byte{EmptyListCode} +) + +// Encoder is implemented by types that require custom +// encoding rules or want to encode private fields. +type Encoder interface { + // EncodeRLP should write the RLP encoding of its receiver to w. + // If the implementation is a pointer method, it may also be + // called for nil pointers. + // + // Implementations should generate valid RLP. The data written is + // not verified at the moment, but a future version might. It is + // recommended to write only a single value but writing multiple + // values or no value at all is also permitted. + EncodeRLP(io.Writer) error +} + +// Encode writes the RLP encoding of val to w. Note that Encode may +// perform many small writes in some cases. Consider making w +// buffered. +// +// Please see package-level documentation of encoding rules. +func Encode(w io.Writer, val interface{}) error { + if outer, ok := w.(*encBuffer); ok { + // Encode was called by some type's EncodeRLP. + // Avoid copying by writing to the outer encBuffer directly. + return outer.encode(val) + } + eb := encBufferPool.Get().(*encBuffer) + defer encBufferPool.Put(eb) + eb.reset() + if err := eb.encode(val); err != nil { + return err + } + return eb.toWriter(w) +} + +func Write(w io.Writer, val []byte) error { + if outer, ok := w.(*encBuffer); ok { + // Encode was called by some type's EncodeRLP. + // Avoid copying by writing to the outer encBuffer directly. + _, err := outer.Write(val) + return err + } + + _, err := w.Write(val) + return err +} + +// EncodeToBytes returns the RLP encoding of val. +// Please see package-level documentation for the encoding rules. +func EncodeToBytes(val interface{}) ([]byte, error) { + eb := encBufferPool.Get().(*encBuffer) + defer encBufferPool.Put(eb) + eb.reset() + if err := eb.encode(val); err != nil { + return nil, err + } + return eb.toBytes(), nil +} + +// EncodeToReader returns a reader from which the RLP encoding of val +// can be read. The returned size is the total size of the encoded +// data. +// +// Please see the documentation of Encode for the encoding rules. +func EncodeToReader(val interface{}) (size int, r io.Reader, err error) { + eb := encBufferPool.Get().(*encBuffer) + eb.reset() + if err := eb.encode(val); err != nil { + return 0, nil, err + } + return eb.size(), &encReader{buf: eb}, nil +} + +type listhead struct { + offset int // index of this header in string data + size int // total size of encoded data (including list headers) +} + +// encode writes head to the given buffer, which must be at least +// 9 bytes long. It returns the encoded bytes. +func (head *listhead) encode(buf []byte) []byte { + return buf[:puthead(buf, 0xC0, 0xF7, uint64(head.size))] +} + +// headsize returns the size of a list or string header +// for a value of the given size. +func headsize(size uint64) int { + if size < 56 { + return 1 + } + return 1 + intsize(size) +} + +// puthead writes a list or string header to buf. +// buf must be at least 9 bytes long. +func puthead(buf []byte, smalltag, largetag byte, size uint64) int { + if size < 56 { + buf[0] = smalltag + byte(size) + return 1 + } + sizesize := putint(buf[1:], size) + buf[0] = largetag + byte(sizesize) + return sizesize + 1 +} + +var encoderInterface = reflect.TypeOf(new(Encoder)).Elem() + +// makeWriter creates a writer function for the given type. +func makeWriter(typ reflect.Type, ts tags) (writer, error) { + kind := typ.Kind() + switch { + case typ == rawValueType: + return writeRawValue, nil + case typ.AssignableTo(reflect.PtrTo(bigInt)): + return writeBigIntPtr, nil + case typ.AssignableTo(bigInt): + return writeBigIntNoPtr, nil + case typ.AssignableTo(reflect.PtrTo(uint256Int)): + return writeUint256Ptr, nil + case typ.AssignableTo(uint256Int): + return writeUint256NoPtr, nil + case kind == reflect.Ptr: + return makePtrWriter(typ, ts) + case reflect.PtrTo(typ).Implements(encoderInterface): + return makeEncoderWriter(typ), nil + case isUint(kind): + return writeUint, nil + case kind == reflect.Bool: + return writeBool, nil + case kind == reflect.String: + return writeString, nil + case kind == reflect.Slice && isByte(typ.Elem()): + return writeBytes, nil + case kind == reflect.Array && isByte(typ.Elem()): + return makeByteArrayWriter(typ), nil + case kind == reflect.Slice || kind == reflect.Array: + return makeSliceWriter(typ, ts) + case kind == reflect.Struct: + return makeStructWriter(typ) + case kind == reflect.Interface: + return writeInterface, nil + default: + return nil, fmt.Errorf("rlp: type %v is not RLP-serializable", typ) + } +} + +func writeRawValue(val reflect.Value, w *encBuffer) error { + w.str = append(w.str, val.Bytes()...) + return nil +} + +func writeUint(val reflect.Value, w *encBuffer) error { + w.encodeUint(val.Uint()) + return nil +} + +func writeBool(val reflect.Value, w *encBuffer) error { + if val.Bool() { + w.str = append(w.str, 0x01) + } else { + w.str = append(w.str, EmptyStringCode) + } + return nil +} + +func writeBigIntPtr(val reflect.Value, w *encBuffer) error { + ptr := val.Interface().(*big.Int) + if ptr == nil { + w.str = append(w.str, EmptyStringCode) + return nil + } + return writeBigInt(ptr, w) +} + +func writeBigIntNoPtr(val reflect.Value, w *encBuffer) error { + i := val.Interface().(big.Int) + return writeBigInt(&i, w) +} + +// wordBytes is the number of bytes in a big.Word +const wordBytes = (32 << (uint64(^big.Word(0)) >> 63)) / 8 + +func writeBigInt(i *big.Int, w *encBuffer) error { + if i.Sign() == -1 { + return errors.New("rlp: cannot encode negative *big.Int") + } + bitlen := i.BitLen() + if bitlen <= 64 { + w.encodeUint(i.Uint64()) + return nil + } + // Integer is larger than 64 bits, encode from i.Bits(). + // The minimal byte length is bitlen rounded up to the next + // multiple of 8, divided by 8. + length := ((bitlen + 7) & -8) >> 3 + w.encodeStringHeader(length) + w.str = append(w.str, make([]byte, length)...) + index := length + buf := w.str[len(w.str)-length:] + for _, d := range i.Bits() { + for j := 0; j < wordBytes && index > 0; j++ { + index-- + buf[index] = byte(d) + d >>= 8 + } + } + return nil +} + +func writeUint256Ptr(val reflect.Value, w *encBuffer) error { + ptr := val.Interface().(*uint256.Int) + if ptr == nil { + w.str = append(w.str, EmptyStringCode) + return nil + } + return writeUint256(ptr, w) +} + +func writeUint256NoPtr(val reflect.Value, w *encBuffer) error { + i := val.Interface().(uint256.Int) + return writeUint256(&i, w) +} + +func writeUint256(i *uint256.Int, w *encBuffer) error { + if i.IsZero() { + w.str = append(w.str, EmptyStringCode) + } else if i.LtUint64(0x80) { + w.str = append(w.str, byte(i.Uint64())) + } else { + n := i.ByteLen() + w.str = append(w.str, EmptyStringCode+byte(n)) + pos := len(w.str) + w.str = append(w.str, make([]byte, n)...) + i.WriteToSlice(w.str[pos:]) + } + return nil +} + +func writeBytes(val reflect.Value, w *encBuffer) error { + w.encodeString(val.Bytes()) + return nil +} + +var byteType = reflect.TypeOf(byte(0)) + +func makeByteArrayWriter(typ reflect.Type) writer { + length := typ.Len() + if length == 0 { + return writeLengthZeroByteArray + } else if length == 1 { + return writeLengthOneByteArray + } + if typ.Elem() != byteType { + return writeNamedByteArray + } + return func(val reflect.Value, w *encBuffer) error { + writeByteArrayCopy(length, val, w) + return nil + } +} + +func writeLengthZeroByteArray(val reflect.Value, w *encBuffer) error { + w.str = append(w.str, 0x80) + return nil +} + +func writeLengthOneByteArray(val reflect.Value, w *encBuffer) error { + b := byte(val.Index(0).Uint()) + if b <= 0x7f { + w.str = append(w.str, b) + } else { + w.str = append(w.str, 0x81, b) + } + return nil +} + +// writeByteArrayCopy encodes byte arrays using reflect.Copy. This is +// the fast path for [N]byte where N > 1. +func writeByteArrayCopy(length int, val reflect.Value, w *encBuffer) { + w.encodeStringHeader(length) + offset := len(w.str) + w.str = append(w.str, make([]byte, length)...) + w.bufvalue.SetBytes(w.str[offset:]) + reflect.Copy(w.bufvalue, val) +} + +// writeNamedByteArray encodes byte arrays with named element type. +// This exists because reflect.Copy can't be used with such types. +func writeNamedByteArray(val reflect.Value, w *encBuffer) error { + if !val.CanAddr() { + // Slice requires the value to be addressable. + // Make it addressable by copying. + copy := reflect.New(val.Type()).Elem() + copy.Set(val) + val = copy + } + size := val.Len() + slice := val.Slice(0, size).Bytes() + w.encodeString(slice) + return nil +} + +func writeString(val reflect.Value, w *encBuffer) error { + s := val.String() + if len(s) == 1 && s[0] <= 0x7f { + // fits single byte, no string header + w.str = append(w.str, s[0]) + } else { + w.encodeStringHeader(len(s)) + w.str = append(w.str, s...) + } + return nil +} + +func writeInterface(val reflect.Value, w *encBuffer) error { + if val.IsNil() { + // Write empty list. This is consistent with the previous RLP + // encoder that we had and should therefore avoid any + // problems. + w.str = append(w.str, EmptyListCode) + return nil + } + eval := val.Elem() + wtr, wErr := cachedWriter(eval.Type()) + if wErr != nil { + return wErr + } + return wtr(eval, w) +} + +func makeSliceWriter(typ reflect.Type, ts tags) (writer, error) { + etypeinfo := cachedTypeInfo1(typ.Elem(), tags{}) + if etypeinfo.writerErr != nil { + return nil, etypeinfo.writerErr + } + writer := func(val reflect.Value, w *encBuffer) error { + if !ts.tail { + defer w.listEnd(w.list()) + } + vlen := val.Len() + for i := 0; i < vlen; i++ { + if err := etypeinfo.writer(val.Index(i), w); err != nil { + return err + } + } + return nil + } + return writer, nil +} + +func makeStructWriter(typ reflect.Type) (writer, error) { + fields, err := structFields(typ) + if err != nil { + return nil, err + } + for _, f := range fields { + if f.info.writerErr != nil { + return nil, structFieldError{typ, f.index, f.info.writerErr} + } + } + + var writer writer + firstOptionalField := firstOptionalField(fields) + if firstOptionalField == len(fields) { + // This is the writer function for structs without any optional fields. + writer = func(val reflect.Value, w *encBuffer) error { + lh := w.list() + for _, f := range fields { + if err := f.info.writer(val.Field(f.index), w); err != nil { + return err + } + } + w.listEnd(lh) + return nil + } + } else { + // If there are any "optional" fields, the writer needs to perform additional + // checks to determine the output list length. + writer = func(val reflect.Value, w *encBuffer) error { + lastField := len(fields) - 1 + for ; lastField >= firstOptionalField; lastField-- { + if !val.Field(fields[lastField].index).IsZero() { + break + } + } + lh := w.list() + for i := 0; i <= lastField; i++ { + if err := fields[i].info.writer(val.Field(fields[i].index), w); err != nil { + return err + } + } + w.listEnd(lh) + return nil + } + } + return writer, nil +} + +func makePtrWriter(typ reflect.Type, ts tags) (writer, error) { + etypeinfo := cachedTypeInfo1(typ.Elem(), tags{}) + if etypeinfo.writerErr != nil { + return nil, etypeinfo.writerErr + } + // Determine how to encode nil pointers. + var nilKind Kind + if ts.nilOK { + nilKind = ts.nilKind // use struct tag if provided + } else { + nilKind = defaultNilKind(typ.Elem()) + } + + writer := func(val reflect.Value, w *encBuffer) error { + if val.IsNil() { + if nilKind == String { + w.str = append(w.str, EmptyStringCode) + } else { + w.listEnd(w.list()) + } + return nil + } + return etypeinfo.writer(val.Elem(), w) + } + return writer, nil +} + +func makeEncoderWriter(typ reflect.Type) writer { + if typ.Implements(encoderInterface) { + return func(val reflect.Value, w *encBuffer) error { + return val.Interface().(Encoder).EncodeRLP(w) + } + } + w := func(val reflect.Value, w *encBuffer) error { + if !val.CanAddr() { + // package json simply doesn't call MarshalJSON for this case, but encodes the + // value as if it didn't implement the interface. We don't want to handle it that + // way. + return fmt.Errorf("rlp: unadressable value of type %v, EncodeRLP is pointer method", val.Type()) + } + return val.Addr().Interface().(Encoder).EncodeRLP(w) + } + return w +} + +// putint writes i to the beginning of b in big endian byte +// order, using the least number of bytes needed to represent i. +func putint(b []byte, i uint64) (size int) { + switch { + case i < (1 << 8): + b[0] = byte(i) + return 1 + case i < (1 << 16): + b[0] = byte(i >> 8) + b[1] = byte(i) + return 2 + case i < (1 << 24): + b[0] = byte(i >> 16) + b[1] = byte(i >> 8) + b[2] = byte(i) + return 3 + case i < (1 << 32): + b[0] = byte(i >> 24) + b[1] = byte(i >> 16) + b[2] = byte(i >> 8) + b[3] = byte(i) + return 4 + case i < (1 << 40): + b[0] = byte(i >> 32) + b[1] = byte(i >> 24) + b[2] = byte(i >> 16) + b[3] = byte(i >> 8) + b[4] = byte(i) + return 5 + case i < (1 << 48): + b[0] = byte(i >> 40) + b[1] = byte(i >> 32) + b[2] = byte(i >> 24) + b[3] = byte(i >> 16) + b[4] = byte(i >> 8) + b[5] = byte(i) + return 6 + case i < (1 << 56): + b[0] = byte(i >> 48) + b[1] = byte(i >> 40) + b[2] = byte(i >> 32) + b[3] = byte(i >> 24) + b[4] = byte(i >> 16) + b[5] = byte(i >> 8) + b[6] = byte(i) + return 7 + default: + b[0] = byte(i >> 56) + b[1] = byte(i >> 48) + b[2] = byte(i >> 40) + b[3] = byte(i >> 32) + b[4] = byte(i >> 24) + b[5] = byte(i >> 16) + b[6] = byte(i >> 8) + b[7] = byte(i) + return 8 + } +} + +// intsize computes the minimum number of bytes required to store i. +func intsize(i uint64) (size int) { + return libcommon.BitLenToByteLen(bits.Len64(i)) +} + +func IntLenExcludingHead(i uint64) int { + if i < 0x80 { + return 0 + } + return intsize(i) +} + +func BigIntLenExcludingHead(i *big.Int) int { + bitLen := i.BitLen() + if bitLen < 8 { + return 0 + } + return libcommon.BitLenToByteLen(bitLen) +} + +func Uint256LenExcludingHead(i *uint256.Int) int { + bitLen := i.BitLen() + if bitLen < 8 { + return 0 + } + return libcommon.BitLenToByteLen(bitLen) +} + +// precondition: len(buffer) >= 9 +func EncodeInt(i uint64, w io.Writer, buffer []byte) error { + if 0 < i && i < 0x80 { + buffer[0] = byte(i) + _, err := w.Write(buffer[:1]) + return err + } + + binary.BigEndian.PutUint64(buffer[1:], i) + size := intsize(i) + buffer[8-size] = 0x80 + byte(size) + _, err := w.Write(buffer[8-size : 9]) + return err +} + +func EncodeBigInt(i *big.Int, w io.Writer, buffer []byte) error { + bitLen := 0 // treat nil as 0 + if i != nil { + bitLen = i.BitLen() + } + if bitLen < 8 { + if bitLen > 0 { + buffer[0] = byte(i.Uint64()) + } else { + buffer[0] = 0x80 + } + _, err := w.Write(buffer[:1]) + return err + } + + size := libcommon.BitLenToByteLen(bitLen) + buffer[0] = 0x80 + byte(size) + i.FillBytes(buffer[1 : 1+size]) + _, err := w.Write(buffer[:1+size]) + return err +} + +func EncodeString(s []byte, w io.Writer, buffer []byte) error { + switch len(s) { + case 0: + buffer[0] = 128 + if _, err := w.Write(buffer[:1]); err != nil { + return err + } + case 1: + if s[0] >= 128 { + buffer[0] = 129 + if _, err := w.Write(buffer[:1]); err != nil { + return err + } + } + if _, err := w.Write(s); err != nil { + return err + } + default: + if err := EncodeStringSizePrefix(len(s), w, buffer); err != nil { + return err + } + if _, err := w.Write(s); err != nil { + return err + } + } + return nil +} + +func EncodeStringSizePrefix(size int, w io.Writer, buffer []byte) error { + if size >= 56 { + beSize := libcommon.BitLenToByteLen(bits.Len(uint(size))) + binary.BigEndian.PutUint64(buffer[1:], uint64(size)) + buffer[8-beSize] = byte(beSize) + 183 + if _, err := w.Write(buffer[8-beSize : 9]); err != nil { + return err + } + } else { + buffer[0] = byte(size) + 128 + if _, err := w.Write(buffer[:1]); err != nil { + return err + } + } + return nil +} + +func EncodeOptionalAddress(addr *libcommon.Address, w io.Writer, buffer []byte) error { + if addr == nil { + buffer[0] = 128 + } else { + buffer[0] = 128 + 20 + } + + if _, err := w.Write(buffer[:1]); err != nil { + return err + } + if addr != nil { + if _, err := w.Write(addr.Bytes()); err != nil { + return err + } + } + + return nil +} diff --git a/rlp/encode_test.go b/rlp/encode_test.go new file mode 100644 index 00000000000..a5118cbc408 --- /dev/null +++ b/rlp/encode_test.go @@ -0,0 +1,508 @@ +// Copyright 2014 The go-ethereum Authors +// (original work) +// Copyright 2024 The Erigon Authors +// (modifications) +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package rlp + +import ( + "bytes" + "errors" + "fmt" + "io" + "math/big" + "sync" + "testing" + + "github.com/holiman/uint256" + + "github.com/erigontech/erigon-lib/common/math" +) + +type testEncoder struct { + err error +} + +func (e *testEncoder) EncodeRLP(w io.Writer) error { + if e == nil { + panic("EncodeRLP called on nil value") + } + if e.err != nil { + return e.err + } + if _, err := w.Write([]byte{0, 1, 0, 1, 0, 1, 0, 1, 0, 1}); err != nil { + return err + } + return nil +} + +type testEncoderValueMethod struct{} + +func (e testEncoderValueMethod) EncodeRLP(w io.Writer) error { + _, err := w.Write([]byte{0xFA, 0xFE, 0xF0}) + return err +} + +type byteEncoder byte + +func (e byteEncoder) EncodeRLP(w io.Writer) error { + _, err := w.Write(EmptyList) + return err +} + +type undecodableEncoder func() + +func (f undecodableEncoder) EncodeRLP(w io.Writer) error { + _, err := w.Write([]byte{0xF5, 0xF5, 0xF5}) + return err +} + +type encodableReader struct { + A, B uint +} + +func (e *encodableReader) Read(b []byte) (int, error) { + panic("called") +} + +type namedByteType byte + +var ( + _ = Encoder(&testEncoder{}) + _ = Encoder(byteEncoder(0)) + + reader io.Reader = &encodableReader{1, 2} +) + +type encTest struct { + val interface{} + output, error string +} + +var encTests = []encTest{ + // booleans + {val: true, output: "01"}, + {val: false, output: "80"}, + + // integers + {val: uint32(0), output: "80"}, + {val: uint32(127), output: "7F"}, + {val: uint32(128), output: "8180"}, + {val: uint32(256), output: "820100"}, + {val: uint32(1024), output: "820400"}, + {val: uint32(0xFFFFFF), output: "83FFFFFF"}, + {val: uint32(0xFFFFFFFF), output: "84FFFFFFFF"}, + {val: uint64(0xFFFFFFFF), output: "84FFFFFFFF"}, + {val: uint64(0xFFFFFFFFFF), output: "85FFFFFFFFFF"}, + {val: uint64(0xFFFFFFFFFFFF), output: "86FFFFFFFFFFFF"}, + {val: uint64(0xFFFFFFFFFFFFFF), output: "87FFFFFFFFFFFFFF"}, + {val: uint64(0xFFFFFFFFFFFFFFFF), output: "88FFFFFFFFFFFFFFFF"}, + + // big integers (should match uint for small values) + {val: big.NewInt(0), output: "80"}, + {val: big.NewInt(1), output: "01"}, + {val: big.NewInt(127), output: "7F"}, + {val: big.NewInt(128), output: "8180"}, + {val: big.NewInt(256), output: "820100"}, + {val: big.NewInt(1024), output: "820400"}, + {val: big.NewInt(0xFFFFFF), output: "83FFFFFF"}, + {val: big.NewInt(0xFFFFFFFF), output: "84FFFFFFFF"}, + {val: big.NewInt(0xFFFFFFFFFF), output: "85FFFFFFFFFF"}, + {val: big.NewInt(0xFFFFFFFFFFFF), output: "86FFFFFFFFFFFF"}, + {val: big.NewInt(0xFFFFFFFFFFFFFF), output: "87FFFFFFFFFFFFFF"}, + { + val: big.NewInt(0).SetBytes(unhex("102030405060708090A0B0C0D0E0F2")), + output: "8F102030405060708090A0B0C0D0E0F2", + }, + { + val: big.NewInt(0).SetBytes(unhex("0100020003000400050006000700080009000A000B000C000D000E01")), + output: "9C0100020003000400050006000700080009000A000B000C000D000E01", + }, + { + val: big.NewInt(0).SetBytes(unhex("010000000000000000000000000000000000000000000000000000000000000000")), + output: "A1010000000000000000000000000000000000000000000000000000000000000000", + }, + { + val: veryBigInt, + output: "89FFFFFFFFFFFFFFFFFF", + }, + { + val: veryVeryBigInt, + output: "B848FFFFFFFFFFFFFFFFF800000000000000001BFFFFFFFFFFFFFFFFC8000000000000000045FFFFFFFFFFFFFFFFC800000000000000001BFFFFFFFFFFFFFFFFF8000000000000000001", + }, + + // non-pointer big.Int + {val: *big.NewInt(0), output: "80"}, + {val: *big.NewInt(0xFFFFFF), output: "83FFFFFF"}, + + // negative ints are not supported + {val: big.NewInt(-1), error: "rlp: cannot encode negative *big.Int"}, + + // uint256 integers (should match uint for small values) + {val: uint256.NewInt(0), output: "80"}, + {val: uint256.NewInt(1), output: "01"}, + {val: uint256.NewInt(127), output: "7F"}, + {val: uint256.NewInt(128), output: "8180"}, + {val: uint256.NewInt(256), output: "820100"}, + {val: uint256.NewInt(1024), output: "820400"}, + {val: uint256.NewInt(0xFFFFFF), output: "83FFFFFF"}, + {val: uint256.NewInt(0xFFFFFFFF), output: "84FFFFFFFF"}, + {val: uint256.NewInt(0xFFFFFFFFFF), output: "85FFFFFFFFFF"}, + {val: uint256.NewInt(0xFFFFFFFFFFFF), output: "86FFFFFFFFFFFF"}, + {val: uint256.NewInt(0xFFFFFFFFFFFFFF), output: "87FFFFFFFFFFFFFF"}, + { + val: uint256.NewInt(0).SetBytes(unhex("102030405060708090A0B0C0D0E0F2")), + output: "8F102030405060708090A0B0C0D0E0F2", + }, + { + val: uint256.NewInt(0).SetBytes(unhex("0100020003000400050006000700080009000A000B000C000D000E01")), + output: "9C0100020003000400050006000700080009000A000B000C000D000E01", + }, + + // named byte type arrays + {val: [0]namedByteType{}, output: "80"}, + {val: [1]namedByteType{0}, output: "00"}, + {val: [1]namedByteType{1}, output: "01"}, + {val: [1]namedByteType{0x7F}, output: "7F"}, + {val: [1]namedByteType{0x80}, output: "8180"}, + {val: [1]namedByteType{0xFF}, output: "81FF"}, + {val: [3]namedByteType{1, 2, 3}, output: "83010203"}, + {val: [57]namedByteType{1, 2, 3}, output: "B839010203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, + + // byte slices + {val: []byte{}, output: "80"}, + {val: []byte{0}, output: "00"}, + {val: []byte{0x7E}, output: "7E"}, + {val: []byte{0x7F}, output: "7F"}, + {val: []byte{0x80}, output: "8180"}, + {val: []byte{1, 2, 3}, output: "83010203"}, + + // named byte type slices + {val: []namedByteType{}, output: "80"}, + {val: []namedByteType{0}, output: "00"}, + {val: []namedByteType{0x7E}, output: "7E"}, + {val: []namedByteType{0x7F}, output: "7F"}, + {val: []namedByteType{0x80}, output: "8180"}, + {val: []namedByteType{1, 2, 3}, output: "83010203"}, + + // strings + {val: "", output: "80"}, + {val: "\x7E", output: "7E"}, + {val: "\x7F", output: "7F"}, + {val: "\x80", output: "8180"}, + {val: "dog", output: "83646F67"}, + { + val: "Lorem ipsum dolor sit amet, consectetur adipisicing eli", + output: "B74C6F72656D20697073756D20646F6C6F722073697420616D65742C20636F6E7365637465747572206164697069736963696E6720656C69", + }, + { + val: "Lorem ipsum dolor sit amet, consectetur adipisicing elit", + output: "B8384C6F72656D20697073756D20646F6C6F722073697420616D65742C20636F6E7365637465747572206164697069736963696E6720656C6974", + }, + { + val: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur mauris magna, suscipit sed vehicula non, iaculis faucibus tortor. Proin suscipit ultricies malesuada. Duis tortor elit, dictum quis tristique eu, ultrices at risus. Morbi a est imperdiet mi ullamcorper aliquet suscipit nec lorem. Aenean quis leo mollis, vulputate elit varius, consequat enim. Nulla ultrices turpis justo, et posuere urna consectetur nec. Proin non convallis metus. Donec tempor ipsum in mauris congue sollicitudin. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse convallis sem vel massa faucibus, eget lacinia lacus tempor. Nulla quis ultricies purus. Proin auctor rhoncus nibh condimentum mollis. Aliquam consequat enim at metus luctus, a eleifend purus egestas. Curabitur at nibh metus. Nam bibendum, neque at auctor tristique, lorem libero aliquet arcu, non interdum tellus lectus sit amet eros. Cras rhoncus, metus ac ornare cursus, dolor justo ultrices metus, at ullamcorper volutpat", + output: "B904004C6F72656D20697073756D20646F6C6F722073697420616D65742C20636F6E73656374657475722061646970697363696E6720656C69742E20437572616269747572206D6175726973206D61676E612C20737573636970697420736564207665686963756C61206E6F6E2C20696163756C697320666175636962757320746F72746F722E2050726F696E20737573636970697420756C74726963696573206D616C6573756164612E204475697320746F72746F7220656C69742C2064696374756D2071756973207472697374697175652065752C20756C7472696365732061742072697375732E204D6F72626920612065737420696D70657264696574206D6920756C6C616D636F7270657220616C6971756574207375736369706974206E6563206C6F72656D2E2041656E65616E2071756973206C656F206D6F6C6C69732C2076756C70757461746520656C6974207661726975732C20636F6E73657175617420656E696D2E204E756C6C6120756C74726963657320747572706973206A7573746F2C20657420706F73756572652075726E6120636F6E7365637465747572206E65632E2050726F696E206E6F6E20636F6E76616C6C6973206D657475732E20446F6E65632074656D706F7220697073756D20696E206D617572697320636F6E67756520736F6C6C696369747564696E2E20566573746962756C756D20616E746520697073756D207072696D697320696E206661756369627573206F726369206C756374757320657420756C74726963657320706F737565726520637562696C69612043757261653B2053757370656E646973736520636F6E76616C6C69732073656D2076656C206D617373612066617563696275732C2065676574206C6163696E6961206C616375732074656D706F722E204E756C6C61207175697320756C747269636965732070757275732E2050726F696E20617563746F722072686F6E637573206E69626820636F6E64696D656E74756D206D6F6C6C69732E20416C697175616D20636F6E73657175617420656E696D206174206D65747573206C75637475732C206120656C656966656E6420707572757320656765737461732E20437572616269747572206174206E696268206D657475732E204E616D20626962656E64756D2C206E6571756520617420617563746F72207472697374697175652C206C6F72656D206C696265726F20616C697175657420617263752C206E6F6E20696E74657264756D2074656C6C7573206C65637475732073697420616D65742065726F732E20437261732072686F6E6375732C206D65747573206163206F726E617265206375727375732C20646F6C6F72206A7573746F20756C747269636573206D657475732C20617420756C6C616D636F7270657220766F6C7574706174", + }, + + // slices + {val: []uint{}, output: "C0"}, + {val: []uint{1, 2, 3}, output: "C3010203"}, + { + // [ [], [[]], [ [], [[]] ] ] + val: []interface{}{[]interface{}{}, [][]interface{}{{}}, []interface{}{[]interface{}{}, [][]interface{}{{}}}}, + output: "C7C0C1C0C3C0C1C0", + }, + { + val: []string{"aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk", "lll", "mmm", "nnn", "ooo"}, + output: "F83C836161618362626283636363836464648365656583666666836767678368686883696969836A6A6A836B6B6B836C6C6C836D6D6D836E6E6E836F6F6F", + }, + { + val: []interface{}{uint(1), uint(0xFFFFFF), []interface{}{[]uint{4, 5, 5}}, "abc"}, + output: "CE0183FFFFFFC4C304050583616263", + }, + { + val: [][]string{ + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + {"asdf", "qwer", "zxcv"}, + }, + output: "F90200CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376CF84617364668471776572847A786376", + }, + + // RawValue + {val: RawValue(unhex("01")), output: "01"}, + {val: RawValue(unhex("82FFFF")), output: "82FFFF"}, + {val: []RawValue{unhex("01"), unhex("02")}, output: "C20102"}, + + // structs + {val: simplestruct{}, output: "C28080"}, + {val: simplestruct{A: 3, B: "foo"}, output: "C50383666F6F"}, + {val: &recstruct{5, nil}, output: "C205C0"}, + {val: &recstruct{5, &recstruct{4, &recstruct{3, nil}}}, output: "C605C404C203C0"}, + {val: &intField{X: 3}, error: "rlp: type int is not RLP-serializable (struct field rlp.intField.X)"}, + + // struct tag "-" + {val: &ignoredField{A: 1, B: 2, C: 3}, output: "C20103"}, + + // struct tag "tail" + {val: &tailRaw{A: 1, Tail: []RawValue{unhex("02"), unhex("03")}}, output: "C3010203"}, + {val: &tailRaw{A: 1, Tail: []RawValue{unhex("02")}}, output: "C20102"}, + {val: &tailRaw{A: 1, Tail: []RawValue{}}, output: "C101"}, + {val: &tailRaw{A: 1, Tail: nil}, output: "C101"}, + + // struct tag "optional" + {val: &optionalFields{}, output: "C180"}, + {val: &optionalFields{A: 1}, output: "C101"}, + {val: &optionalFields{A: 1, B: 2}, output: "C20102"}, + {val: &optionalFields{A: 1, B: 2, C: 3}, output: "C3010203"}, + {val: &optionalFields{A: 1, B: 0, C: 3}, output: "C3018003"}, + {val: &optionalAndTailField{A: 1}, output: "C101"}, + {val: &optionalAndTailField{A: 1, B: 2}, output: "C20102"}, + {val: &optionalAndTailField{A: 1, Tail: []uint{5, 6}}, output: "C401800506"}, + {val: &optionalAndTailField{A: 1, Tail: []uint{5, 6}}, output: "C401800506"}, + {val: &optionalBigIntField{A: 1}, output: "C101"}, + {val: &optionalPtrField{A: 1}, output: "C101"}, + {val: &optionalPtrFieldNil{A: 1}, output: "C101"}, + + // nil + {val: (*uint)(nil), output: "80"}, + {val: (*string)(nil), output: "80"}, + {val: (*[]byte)(nil), output: "80"}, + {val: (*[10]byte)(nil), output: "80"}, + {val: (*big.Int)(nil), output: "80"}, + {val: (*uint256.Int)(nil), output: "80"}, + {val: (*[]string)(nil), output: "C0"}, + {val: (*[10]string)(nil), output: "C0"}, + {val: (*[]interface{})(nil), output: "C0"}, + {val: (*[]struct{ uint })(nil), output: "C0"}, + {val: (*interface{})(nil), output: "C0"}, + + // nil struct fields + { + val: struct { + X *[]byte + }{}, + output: "C180", + }, + { + val: struct { + X *[2]byte + }{}, + output: "C180", + }, + { + val: struct { + X *uint64 + }{}, + output: "C180", + }, + { + val: struct { + X *uint64 `rlp:"nilList"` + }{}, + output: "C1C0", + }, + { + val: struct { + X *[]uint64 + }{}, + output: "C1C0", + }, + { + val: struct { + X *[]uint64 `rlp:"nilString"` + }{}, + output: "C180", + }, + + // interfaces + {val: []io.Reader{reader}, output: "C3C20102"}, // the contained value is a struct + + // Encoder + {val: (*testEncoder)(nil), output: "C0"}, + {val: &testEncoder{}, output: "00010001000100010001"}, + {val: &testEncoder{errors.New("test error")}, error: "test error"}, + {val: struct{ E testEncoderValueMethod }{}, output: "C3FAFEF0"}, + {val: struct{ E *testEncoderValueMethod }{}, output: "C1C0"}, + + // Verify that the Encoder interface works for unsupported types like func(). + {val: undecodableEncoder(func() {}), output: "F5F5F5"}, + + // Verify that pointer method testEncoder.EncodeRLP is called for + // addressable non-pointer values. + {val: &struct{ TE testEncoder }{testEncoder{}}, output: "CA00010001000100010001"}, + {val: &struct{ TE testEncoder }{testEncoder{errors.New("test error")}}, error: "test error"}, + + // Verify the error for non-addressable non-pointer Encoder. + {val: testEncoder{}, error: "rlp: unadressable value of type rlp.testEncoder, EncodeRLP is pointer method"}, + + // Verify Encoder takes precedence over []byte. + {val: []byteEncoder{0, 1, 2, 3, 4}, output: "C5C0C0C0C0C0"}, +} + +func runEncTests(t *testing.T, f func(val interface{}) ([]byte, error)) { + for i, test := range encTests { + output, err := f(test.val) + if err != nil && test.error == "" { + t.Errorf("test %d: unexpected error: %v\nvalue %#v\ntype %T", + i, err, test.val, test.val) + continue + } + if test.error != "" && fmt.Sprint(err) != test.error { + t.Errorf("test %d: error mismatch\ngot %v\nwant %v\nvalue %#v\ntype %T", + i, err, test.error, test.val, test.val) + continue + } + if err == nil && !bytes.Equal(output, unhex(test.output)) { + t.Errorf("test %d: output mismatch:\ngot %X\nwant %s\nvalue %#v\ntype %T", + i, output, test.output, test.val, test.val) + } + } +} + +func TestEncode(t *testing.T) { + runEncTests(t, func(val interface{}) ([]byte, error) { + b := new(bytes.Buffer) + err := Encode(b, val) + return b.Bytes(), err + }) +} + +func TestEncodeToBytes(t *testing.T) { + runEncTests(t, EncodeToBytes) +} + +func TestEncodeToReader(t *testing.T) { + runEncTests(t, func(val interface{}) ([]byte, error) { + _, r, err := EncodeToReader(val) + if err != nil { + return nil, err + } + return io.ReadAll(r) + }) +} + +func TestEncodeToReaderPiecewise(t *testing.T) { + runEncTests(t, func(val interface{}) ([]byte, error) { + size, r, err := EncodeToReader(val) + if err != nil { + return nil, err + } + + // read output piecewise + output := make([]byte, size) + for start, end := 0, 0; start < size; start = end { + if remaining := size - start; remaining < 3 { + end += remaining + } else { + end = start + 3 + } + n, err := r.Read(output[start:end]) + end = start + n + if errors.Is(err, io.EOF) { + break + } else if err != nil { + return nil, err + } + } + return output, nil + }) +} + +// This is a regression test verifying that encReader +// returns its encBuffer to the pool only once. +func TestEncodeToReaderReturnToPool(t *testing.T) { + buf := make([]byte, 50) + wg := new(sync.WaitGroup) + for i := 0; i < 5; i++ { + wg.Add(1) + go func() { + for i := 0; i < 1000; i++ { + _, r, _ := EncodeToReader("foo") + io.ReadAll(r) + r.Read(buf) + r.Read(buf) + r.Read(buf) + r.Read(buf) + } + wg.Done() + }() + } + wg.Wait() +} + +var sink interface{} + +func BenchmarkIntsize(b *testing.B) { + for i := 0; i < b.N; i++ { + sink = intsize(0x12345678) + } +} + +func BenchmarkPutint(b *testing.B) { + buf := make([]byte, 8) + for i := 0; i < b.N; i++ { + putint(buf, 0x12345678) + sink = buf + } +} + +func BenchmarkEncodeBigInts(b *testing.B) { + ints := make([]*big.Int, 200) + for i := range ints { + ints[i] = math.BigPow(2, int64(i)) + } + out := bytes.NewBuffer(make([]byte, 0, 4096)) + b.ResetTimer() + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + out.Reset() + if err := Encode(out, ints); err != nil { + b.Fatal(err) + } + } +} diff --git a/erigon-lib/rlp/encoder_example_test.go b/rlp/encoder_example_test.go similarity index 100% rename from erigon-lib/rlp/encoder_example_test.go rename to rlp/encoder_example_test.go diff --git a/erigon-lib/rlp/internal/rlpstruct/rlpstruct.go b/rlp/internal/rlpstruct/rlpstruct.go similarity index 100% rename from erigon-lib/rlp/internal/rlpstruct/rlpstruct.go rename to rlp/internal/rlpstruct/rlpstruct.go diff --git a/erigon-lib/rlp/iterator.go b/rlp/iterator.go similarity index 100% rename from erigon-lib/rlp/iterator.go rename to rlp/iterator.go diff --git a/erigon-lib/rlp/iterator_test.go b/rlp/iterator_test.go similarity index 100% rename from erigon-lib/rlp/iterator_test.go rename to rlp/iterator_test.go diff --git a/erigon-lib/rlp/raw.go b/rlp/raw.go similarity index 100% rename from erigon-lib/rlp/raw.go rename to rlp/raw.go diff --git a/erigon-lib/rlp/raw_test.go b/rlp/raw_test.go similarity index 100% rename from erigon-lib/rlp/raw_test.go rename to rlp/raw_test.go diff --git a/erigon-lib/rlp/typecache.go b/rlp/typecache.go similarity index 100% rename from erigon-lib/rlp/typecache.go rename to rlp/typecache.go diff --git a/rpc/client_test.go b/rpc/client_test.go index 22e9bf3fd6d..6af327275d0 100644 --- a/rpc/client_test.go +++ b/rpc/client_test.go @@ -223,13 +223,13 @@ func testClientCancel(transport string, t *testing.T, logger log.Logger) { if index < ncallers/2 { // For half of the callers, create a context without deadline // and cancel it later. - ctx, cancel = context.WithCancel(context.Background()) //nolint:fatcontext + ctx, cancel = context.WithCancel(context.Background()) time.AfterFunc(timeout, cancel) } else { // For the other half, create a context with a deadline instead. This is // different because the context deadline is used to set the socket write // deadline. - ctx, cancel = context.WithTimeout(context.Background(), timeout) //nolint:fatcontext + ctx, cancel = context.WithTimeout(context.Background(), timeout) } // Now perform a call with the context. diff --git a/tests/block_test_util.go b/tests/block_test_util.go index 079da8e4280..83e7f174e62 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -41,13 +41,13 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconsensusconfig" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/tests/bor/mining_test.go b/tests/bor/mining_test.go index aff98b80221..aab87128e97 100644 --- a/tests/bor/mining_test.go +++ b/tests/bor/mining_test.go @@ -21,8 +21,8 @@ import ( txpool_proto "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/fdlimit" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/common/fdlimit" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth" "github.com/erigontech/erigon/node" diff --git a/tests/contracts/gen_selfDestructor.go b/tests/contracts/gen_selfDestructor.go index d6639e8c0b4..7eef45cbc8a 100644 --- a/tests/contracts/gen_selfDestructor.go +++ b/tests/contracts/gen_selfDestructor.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/tests/contracts/gen_testcontract.go b/tests/contracts/gen_testcontract.go index 544f65b6c3b..c27258491f4 100644 --- a/tests/contracts/gen_testcontract.go +++ b/tests/contracts/gen_testcontract.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/tests/fuzzers/bitutil/compress_fuzz.go b/tests/fuzzers/bitutil/compress_fuzz.go index 07c3d9366d0..ed2105e1907 100644 --- a/tests/fuzzers/bitutil/compress_fuzz.go +++ b/tests/fuzzers/bitutil/compress_fuzz.go @@ -22,7 +22,7 @@ package bitutil import ( "bytes" - "github.com/erigontech/erigon-lib/common/bitutil" + "github.com/erigontech/erigon/common/bitutil" ) // Fuzz implements a go-fuzz fuzzer method to test various encoding method diff --git a/tests/fuzzers/rlp/rlp_fuzzer.go b/tests/fuzzers/rlp/rlp_fuzzer.go index 4b2a97de993..7e1691a7cb8 100644 --- a/tests/fuzzers/rlp/rlp_fuzzer.go +++ b/tests/fuzzers/rlp/rlp_fuzzer.go @@ -23,8 +23,8 @@ import ( "bytes" "fmt" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" ) func decodeEncode(input []byte, val interface{}, i int) { diff --git a/tests/gen_stenv.go b/tests/gen_stenv.go index 02bbd20fa1c..7b91dd290ed 100644 --- a/tests/gen_stenv.go +++ b/tests/gen_stenv.go @@ -10,7 +10,7 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" - common0 "github.com/erigontech/erigon-lib/common" + common0 "github.com/erigontech/erigon/common" ) var _ = (*stEnvMarshaling)(nil) diff --git a/tests/rlp_test_util.go b/tests/rlp_test_util.go index 708661eb030..7af1af689a9 100644 --- a/tests/rlp_test_util.go +++ b/tests/rlp_test_util.go @@ -27,7 +27,7 @@ import ( "math/big" "strings" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) // RLPTest is the JSON structure of a single RLP test. diff --git a/tests/state_test_util.go b/tests/state_test_util.go index fda1cc7108a..86c5c15ad42 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -44,14 +44,14 @@ import ( state2 "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon-lib/wrap" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus/misc" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/vm" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/rpchelper" ) diff --git a/turbo/adapter/ethapi/get_proof.go b/turbo/adapter/ethapi/get_proof.go index 855e6ea3f27..3bc2f606fe9 100644 --- a/turbo/adapter/ethapi/get_proof.go +++ b/turbo/adapter/ethapi/get_proof.go @@ -24,8 +24,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/length" - "github.com/erigontech/erigon-lib/trie" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" + "github.com/erigontech/erigon/turbo/trie" ) // Result structs for GetProof diff --git a/turbo/app/import_cmd.go b/turbo/app/import_cmd.go index dd776226d03..ba0f9622b1e 100644 --- a/turbo/app/import_cmd.go +++ b/turbo/app/import_cmd.go @@ -40,12 +40,12 @@ import ( "github.com/erigontech/erigon/turbo/execution/eth1/eth1_chain_reader.go" "github.com/erigontech/erigon/turbo/services" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/cmd/utils" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/debug" turboNode "github.com/erigontech/erigon/turbo/node" "github.com/erigontech/erigon/turbo/stages" diff --git a/turbo/debug/flags.go b/turbo/debug/flags.go index f77e2384e0d..d6567c479ab 100644 --- a/turbo/debug/flags.go +++ b/turbo/debug/flags.go @@ -38,7 +38,7 @@ import ( "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common/fdlimit" + "github.com/erigontech/erigon/common/fdlimit" "github.com/erigontech/erigon/turbo/logging" ) diff --git a/turbo/debug/signal.go b/turbo/debug/signal.go index 3f574a3245a..92d1f8b66b2 100644 --- a/turbo/debug/signal.go +++ b/turbo/debug/signal.go @@ -26,8 +26,8 @@ import ( "golang.org/x/sys/unix" - _debug "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/log/v3" + _debug "github.com/erigontech/erigon/common/debug" ) func ListenSignals(stack io.Closer, logger log.Logger) { diff --git a/turbo/debug/signal_windows.go b/turbo/debug/signal_windows.go index 2f5c39ef934..28a6c10f886 100644 --- a/turbo/debug/signal_windows.go +++ b/turbo/debug/signal_windows.go @@ -23,8 +23,8 @@ import ( "os" "os/signal" - _debug "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/log/v3" + _debug "github.com/erigontech/erigon/common/debug" ) func ListenSignals(stack io.Closer, logger log.Logger) { diff --git a/turbo/engineapi/engine_block_downloader/block_downloader.go b/turbo/engineapi/engine_block_downloader/block_downloader.go index 43f2f239e76..b2449124595 100644 --- a/turbo/engineapi/engine_block_downloader/block_downloader.go +++ b/turbo/engineapi/engine_block_downloader/block_downloader.go @@ -37,9 +37,9 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/dbutils" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/adapter" "github.com/erigontech/erigon/turbo/execution/eth1/eth1_chain_reader.go" "github.com/erigontech/erigon/turbo/services" diff --git a/turbo/engineapi/engine_server.go b/turbo/engineapi/engine_server.go index f5b4500d5f2..d8b8348f358 100644 --- a/turbo/engineapi/engine_server.go +++ b/turbo/engineapi/engine_server.go @@ -37,10 +37,10 @@ import ( "github.com/erigontech/erigon-lib/kv/kvcache" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cmd/rpcdaemon/cli" "github.com/erigontech/erigon/cmd/rpcdaemon/cli/httpcfg" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/merge" "github.com/erigontech/erigon/core/types" diff --git a/turbo/jsonrpc/contracts/gen_poly.go b/turbo/jsonrpc/contracts/gen_poly.go index dd984a87a22..185e7624542 100644 --- a/turbo/jsonrpc/contracts/gen_poly.go +++ b/turbo/jsonrpc/contracts/gen_poly.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/turbo/jsonrpc/contracts/gen_token.go b/turbo/jsonrpc/contracts/gen_token.go index 124fcb5f587..a0da6eff9be 100644 --- a/turbo/jsonrpc/contracts/gen_token.go +++ b/turbo/jsonrpc/contracts/gen_token.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/turbo/jsonrpc/debug_api.go b/turbo/jsonrpc/debug_api.go index 013dcfd62cb..7f5a5ab0744 100644 --- a/turbo/jsonrpc/debug_api.go +++ b/turbo/jsonrpc/debug_api.go @@ -29,11 +29,11 @@ import ( "github.com/erigontech/erigon-lib/kv/rawdbv3" jsoniter "github.com/json-iterator/go" - "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon/core/state" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/eth/stagedsync/stages" tracersConfig "github.com/erigontech/erigon/eth/tracers/config" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/adapter/ethapi" "github.com/erigontech/erigon/turbo/rpchelper" diff --git a/turbo/jsonrpc/erigon_block.go b/turbo/jsonrpc/erigon_block.go index 8b66cec0032..e78381ab7ff 100644 --- a/turbo/jsonrpc/erigon_block.go +++ b/turbo/jsonrpc/erigon_block.go @@ -32,9 +32,9 @@ import ( "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/adapter/ethapi" "github.com/erigontech/erigon/turbo/rpchelper" diff --git a/turbo/jsonrpc/erigon_receipts_test.go b/turbo/jsonrpc/erigon_receipts_test.go index cb1a833acdb..59597d0d837 100644 --- a/turbo/jsonrpc/erigon_receipts_test.go +++ b/turbo/jsonrpc/erigon_receipts_test.go @@ -31,8 +31,8 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" diff --git a/turbo/jsonrpc/eth_accounts.go b/turbo/jsonrpc/eth_accounts.go index fb2c8587e3b..8f3ce779760 100644 --- a/turbo/jsonrpc/eth_accounts.go +++ b/turbo/jsonrpc/eth_accounts.go @@ -32,7 +32,7 @@ import ( txpool_proto "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" - "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/rpc" ) diff --git a/turbo/jsonrpc/eth_api.go b/turbo/jsonrpc/eth_api.go index 13ad6d2bd6b..5a1c7ac617e 100644 --- a/turbo/jsonrpc/eth_api.go +++ b/turbo/jsonrpc/eth_api.go @@ -39,12 +39,12 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/kvcache" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/misc" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/core/types/accounts" ethFilters "github.com/erigontech/erigon/eth/filters" "github.com/erigontech/erigon/ethdb/prune" "github.com/erigontech/erigon/polygon/bor/borcfg" diff --git a/turbo/jsonrpc/eth_block_test.go b/turbo/jsonrpc/eth_block_test.go index d9edc58ab4b..0b155d3cf32 100644 --- a/turbo/jsonrpc/eth_block_test.go +++ b/turbo/jsonrpc/eth_block_test.go @@ -31,10 +31,10 @@ import ( "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/rpc/rpccfg" "github.com/erigontech/erigon/turbo/rpchelper" diff --git a/turbo/jsonrpc/eth_call.go b/turbo/jsonrpc/eth_call.go index cc6d8dc748a..77df5853720 100644 --- a/turbo/jsonrpc/eth_call.go +++ b/turbo/jsonrpc/eth_call.go @@ -34,10 +34,10 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/rawdbv3" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/core/vm/evmtypes" "github.com/erigontech/erigon/eth/tracers/logger" diff --git a/turbo/jsonrpc/eth_call_test.go b/turbo/jsonrpc/eth_call_test.go index c69b69da3f0..c2580625b0a 100644 --- a/turbo/jsonrpc/eth_call_test.go +++ b/turbo/jsonrpc/eth_call_test.go @@ -39,7 +39,6 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/turbo/testlog" - "github.com/erigontech/erigon-lib/trie" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" @@ -51,6 +50,7 @@ import ( "github.com/erigontech/erigon/turbo/adapter/ethapi" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/stages/mock" + "github.com/erigontech/erigon/turbo/trie" ) func TestEstimateGas(t *testing.T) { diff --git a/turbo/jsonrpc/eth_filters.go b/turbo/jsonrpc/eth_filters.go index 3f70f7d3d8a..5852d1015e0 100644 --- a/turbo/jsonrpc/eth_filters.go +++ b/turbo/jsonrpc/eth_filters.go @@ -22,7 +22,7 @@ import ( "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/filters" "github.com/erigontech/erigon/rpc" diff --git a/turbo/jsonrpc/eth_mining_test.go b/turbo/jsonrpc/eth_mining_test.go index d142cd67156..f51e3c178cf 100644 --- a/turbo/jsonrpc/eth_mining_test.go +++ b/turbo/jsonrpc/eth_mining_test.go @@ -30,9 +30,9 @@ import ( txpool "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" "github.com/erigontech/erigon-lib/kv/kvcache" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/turbo/jsonrpc/eth_subscribe_test.go b/turbo/jsonrpc/eth_subscribe_test.go index 0aad2fdf209..16ad4cfc257 100644 --- a/turbo/jsonrpc/eth_subscribe_test.go +++ b/turbo/jsonrpc/eth_subscribe_test.go @@ -30,11 +30,11 @@ import ( "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcservices" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/ethdb/privateapi" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/builder" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/stages" diff --git a/turbo/jsonrpc/otterscan_contract_creator.go b/turbo/jsonrpc/otterscan_contract_creator.go index d26e3b3aa81..3d1d13ec484 100644 --- a/turbo/jsonrpc/otterscan_contract_creator.go +++ b/turbo/jsonrpc/otterscan_contract_creator.go @@ -28,7 +28,7 @@ import ( "github.com/erigontech/erigon-lib/kv/order" "github.com/erigontech/erigon-lib/kv/rawdbv3" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks" ) diff --git a/turbo/jsonrpc/otterscan_transaction_by_sender_and_nonce.go b/turbo/jsonrpc/otterscan_transaction_by_sender_and_nonce.go index 62b52ba945a..2411bb10c5c 100644 --- a/turbo/jsonrpc/otterscan_transaction_by_sender_and_nonce.go +++ b/turbo/jsonrpc/otterscan_transaction_by_sender_and_nonce.go @@ -28,7 +28,7 @@ import ( "github.com/erigontech/erigon-lib/kv/order" "github.com/erigontech/erigon-lib/kv/rawdbv3" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks" ) diff --git a/turbo/jsonrpc/parity_api_test.go b/turbo/jsonrpc/parity_api_test.go index 6924e6c56b0..0d91fbc47bb 100644 --- a/turbo/jsonrpc/parity_api_test.go +++ b/turbo/jsonrpc/parity_api_test.go @@ -28,8 +28,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" - "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/rpc" ) diff --git a/turbo/jsonrpc/send_transaction_test.go b/turbo/jsonrpc/send_transaction_test.go index 1a3d99ddb91..e8b88309f43 100644 --- a/turbo/jsonrpc/send_transaction_test.go +++ b/turbo/jsonrpc/send_transaction_test.go @@ -35,17 +35,17 @@ import ( "github.com/erigontech/erigon/rpc/rpccfg" "github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon-lib/log/v3" txpool_proto "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/jsonrpc" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/stages" diff --git a/turbo/jsonrpc/trace_adhoc.go b/turbo/jsonrpc/trace_adhoc.go index 86c2ba0db9d..57cf151420a 100644 --- a/turbo/jsonrpc/trace_adhoc.go +++ b/turbo/jsonrpc/trace_adhoc.go @@ -33,10 +33,10 @@ import ( math2 "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/types/accounts" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/core/vm/evmtypes" "github.com/erigontech/erigon/eth/tracers/config" diff --git a/turbo/jsonrpc/trace_adhoc_test.go b/turbo/jsonrpc/trace_adhoc_test.go index 33590c3a9ec..2f081af3eea 100644 --- a/turbo/jsonrpc/trace_adhoc_test.go +++ b/turbo/jsonrpc/trace_adhoc_test.go @@ -34,9 +34,9 @@ import ( "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cmd/rpcdaemon/cli/httpcfg" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" diff --git a/erigon-lib/rlphacks/bytes.go b/turbo/rlphacks/bytes.go similarity index 100% rename from erigon-lib/rlphacks/bytes.go rename to turbo/rlphacks/bytes.go diff --git a/erigon-lib/rlphacks/bytes_test.go b/turbo/rlphacks/bytes_test.go similarity index 98% rename from erigon-lib/rlphacks/bytes_test.go rename to turbo/rlphacks/bytes_test.go index 42b64eaeb19..21699cffe72 100644 --- a/erigon-lib/rlphacks/bytes_test.go +++ b/turbo/rlphacks/bytes_test.go @@ -22,7 +22,7 @@ import ( "bytes" "testing" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) func TestFastDoubleRlpForByteArrays(t *testing.T) { diff --git a/erigon-lib/rlphacks/serializable.go b/turbo/rlphacks/serializable.go similarity index 100% rename from erigon-lib/rlphacks/serializable.go rename to turbo/rlphacks/serializable.go diff --git a/erigon-lib/rlphacks/struct.go b/turbo/rlphacks/struct.go similarity index 100% rename from erigon-lib/rlphacks/struct.go rename to turbo/rlphacks/struct.go diff --git a/erigon-lib/rlphacks/utils_bytes.go b/turbo/rlphacks/utils_bytes.go similarity index 100% rename from erigon-lib/rlphacks/utils_bytes.go rename to turbo/rlphacks/utils_bytes.go diff --git a/turbo/rpchelper/filters.go b/turbo/rpchelper/filters.go index 0ae44ace3e5..25ab3fa44b6 100644 --- a/turbo/rpchelper/filters.go +++ b/turbo/rpchelper/filters.go @@ -41,9 +41,9 @@ import ( "github.com/erigontech/erigon-lib/log/v3" txpool2 "github.com/erigontech/erigon/txnprovider/txpool" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/filters" + "github.com/erigontech/erigon/rlp" ) // Filters holds the state for managing subscriptions to various Ethereum events. diff --git a/turbo/services/interfaces.go b/turbo/services/interfaces.go index dd26a7cfd64..b18a59890a7 100644 --- a/turbo/services/interfaces.go +++ b/turbo/services/interfaces.go @@ -25,10 +25,10 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/downloader/snaptype" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/snapshotsync" ) diff --git a/turbo/shards/state_cache.go b/turbo/shards/state_cache.go index e42a8f0e98f..2e7a4e59482 100644 --- a/turbo/shards/state_cache.go +++ b/turbo/shards/state_cache.go @@ -29,7 +29,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/metrics" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" ) // LRU state cache consists of two structures - B-Tree and binary heap diff --git a/turbo/shards/state_cache_test.go b/turbo/shards/state_cache_test.go index da425e68074..4ad54f3c6da 100644 --- a/turbo/shards/state_cache_test.go +++ b/turbo/shards/state_cache_test.go @@ -26,7 +26,7 @@ import ( "github.com/stretchr/testify/assert" "golang.org/x/crypto/sha3" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" ) func TestCacheBtreeOrderAccountStorage2(t *testing.T) { diff --git a/turbo/shards/trie_cache.go b/turbo/shards/trie_cache.go index e9002f882c1..28c1d29331d 100644 --- a/turbo/shards/trie_cache.go +++ b/turbo/shards/trie_cache.go @@ -27,7 +27,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv/dbutils" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" ) // An optional addition to the state cache, helping to calculate state root diff --git a/turbo/snapshotsync/freezeblocks/block_reader.go b/turbo/snapshotsync/freezeblocks/block_reader.go index 634bc10e0ef..2b397655ded 100644 --- a/turbo/snapshotsync/freezeblocks/block_reader.go +++ b/turbo/snapshotsync/freezeblocks/block_reader.go @@ -34,13 +34,13 @@ import ( "github.com/erigontech/erigon-lib/kv/rawdbv3" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/recsplit" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/rawdb" coresnaptype "github.com/erigontech/erigon/core/snaptype" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/polygon/bridge" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/snapshotsync" ) diff --git a/turbo/snapshotsync/freezeblocks/block_snapshots.go b/turbo/snapshotsync/freezeblocks/block_snapshots.go index 64e24b51b89..f5af0d8f047 100644 --- a/turbo/snapshotsync/freezeblocks/block_snapshots.go +++ b/turbo/snapshotsync/freezeblocks/block_snapshots.go @@ -48,7 +48,6 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/metrics" "github.com/erigontech/erigon-lib/recsplit" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon-lib/seg" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/rawdb/blockio" @@ -60,6 +59,7 @@ import ( "github.com/erigontech/erigon/polygon/bor/bordb" "github.com/erigontech/erigon/polygon/bridge" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/snapshotsync" "github.com/erigontech/erigon/txnprovider/txpool" diff --git a/turbo/snapshotsync/freezeblocks/dump_test.go b/turbo/snapshotsync/freezeblocks/dump_test.go index ec34ff7c2a3..3d135eb3cfd 100644 --- a/turbo/snapshotsync/freezeblocks/dump_test.go +++ b/turbo/snapshotsync/freezeblocks/dump_test.go @@ -34,12 +34,12 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/txnprovider/txpool" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/ethdb/prune" "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/polygon/bor/borcfg" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/turbo/stages/blockchain_test.go b/turbo/stages/blockchain_test.go index 3c58f35a1b4..7978aa65f84 100644 --- a/turbo/stages/blockchain_test.go +++ b/turbo/stages/blockchain_test.go @@ -36,13 +36,12 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/length" - "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" protosentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/bitmapdb" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" @@ -53,6 +52,7 @@ import ( "github.com/erigontech/erigon/ethdb/prune" "github.com/erigontech/erigon/p2p/sentry/sentry_multi_client" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/turbo/stages/chain_makers_test.go b/turbo/stages/chain_makers_test.go index 08dcd772cc2..fe3db7bdff1 100644 --- a/turbo/stages/chain_makers_test.go +++ b/turbo/stages/chain_makers_test.go @@ -31,13 +31,13 @@ import ( "github.com/erigontech/erigon-lib/crypto" protosentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p/sentry/sentry_multi_client" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/turbo/stages/headerdownload/header_algo_test.go b/turbo/stages/headerdownload/header_algo_test.go index e950b4176e3..92bc6a646d6 100644 --- a/turbo/stages/headerdownload/header_algo_test.go +++ b/turbo/stages/headerdownload/header_algo_test.go @@ -24,9 +24,9 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/headerdownload" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/turbo/stages/headerdownload/header_algos.go b/turbo/stages/headerdownload/header_algos.go index fbc5158b903..343fe7d8281 100644 --- a/turbo/stages/headerdownload/header_algos.go +++ b/turbo/stages/headerdownload/header_algos.go @@ -43,13 +43,13 @@ import ( "github.com/erigontech/erigon/dataflow" "github.com/erigontech/erigon/turbo/services" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/stagedsync/stages" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" ) const POSPandaBanner = ` diff --git a/turbo/stages/headerdownload/header_data_struct.go b/turbo/stages/headerdownload/header_data_struct.go index 6965a4d8668..c3e353b44e6 100644 --- a/turbo/stages/headerdownload/header_data_struct.go +++ b/turbo/stages/headerdownload/header_data_struct.go @@ -29,9 +29,9 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/etl" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" ) diff --git a/turbo/stages/mock/mock_sentry.go b/turbo/stages/mock/mock_sentry.go index 3ecd3d1827f..e7790887f6f 100644 --- a/turbo/stages/mock/mock_sentry.go +++ b/turbo/stages/mock/mock_sentry.go @@ -52,7 +52,6 @@ import ( "github.com/erigontech/erigon-lib/kv/remotedbserver" "github.com/erigontech/erigon-lib/kv/temporal/temporaltest" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" libstate "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon-lib/wrap" "github.com/erigontech/erigon/consensus" @@ -77,6 +76,7 @@ import ( "github.com/erigontech/erigon/polygon/bor" "github.com/erigontech/erigon/polygon/bridge" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/builder" "github.com/erigontech/erigon/turbo/engineapi/engine_helpers" "github.com/erigontech/erigon/turbo/execution/eth1" diff --git a/turbo/stages/mock/sentry_mock_test.go b/turbo/stages/mock/sentry_mock_test.go index 7edfb7f590d..a7a0de58357 100644 --- a/turbo/stages/mock/sentry_mock_test.go +++ b/turbo/stages/mock/sentry_mock_test.go @@ -29,12 +29,12 @@ import ( sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/wrap" - "github.com/erigontech/erigon-lib/common/u256" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/params" + "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/erigon-lib/trie/.gitignore b/turbo/trie/.gitignore similarity index 100% rename from erigon-lib/trie/.gitignore rename to turbo/trie/.gitignore diff --git a/erigon-lib/trie/account_node_test.go b/turbo/trie/account_node_test.go similarity index 99% rename from erigon-lib/trie/account_node_test.go rename to turbo/trie/account_node_test.go index 04c50eb0208..d36cfa47bd9 100644 --- a/erigon-lib/trie/account_node_test.go +++ b/turbo/trie/account_node_test.go @@ -27,7 +27,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv/dbutils" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" ) func TestGetAccount(t *testing.T) { diff --git a/erigon-lib/trie/debug.go b/turbo/trie/debug.go similarity index 100% rename from erigon-lib/trie/debug.go rename to turbo/trie/debug.go diff --git a/erigon-lib/trie/delete_subrtee_test.go b/turbo/trie/delete_subrtee_test.go similarity index 99% rename from erigon-lib/trie/delete_subrtee_test.go rename to turbo/trie/delete_subrtee_test.go index b29dccf8e90..ea226f49843 100644 --- a/erigon-lib/trie/delete_subrtee_test.go +++ b/turbo/trie/delete_subrtee_test.go @@ -28,7 +28,7 @@ import ( "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" ) func TestTrieDeleteSubtree_ShortNode(t *testing.T) { diff --git a/erigon-lib/trie/encoding.go b/turbo/trie/encoding.go similarity index 99% rename from erigon-lib/trie/encoding.go rename to turbo/trie/encoding.go index 3e5136c6f98..03437937dc7 100644 --- a/erigon-lib/trie/encoding.go +++ b/turbo/trie/encoding.go @@ -22,7 +22,7 @@ package trie import ( "io" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) // Trie keys are dealt with in three distinct encodings: diff --git a/erigon-lib/trie/encoding_test.go b/turbo/trie/encoding_test.go similarity index 79% rename from erigon-lib/trie/encoding_test.go rename to turbo/trie/encoding_test.go index 20d70ef06b2..577a220ef9b 100644 --- a/erigon-lib/trie/encoding_test.go +++ b/turbo/trie/encoding_test.go @@ -23,8 +23,9 @@ import ( "bytes" "testing" - libcommon "github.com/erigontech/erigon-lib/common" "github.com/stretchr/testify/assert" + + "github.com/erigontech/erigon/common" ) func TestHexCompact(t *testing.T) { @@ -82,39 +83,39 @@ func TestHexKeybytes(t *testing.T) { } func TestKeybytesToCompact(t *testing.T) { - keybytes := Keybytes{libcommon.FromHex("5a70"), true, true} + keybytes := Keybytes{common.FromHex("5a70"), true, true} compact := keybytes.ToCompact() - assert.Equal(t, libcommon.FromHex("35a7"), compact) + assert.Equal(t, common.FromHex("35a7"), compact) - keybytes = Keybytes{libcommon.FromHex("5a70"), true, false} + keybytes = Keybytes{common.FromHex("5a70"), true, false} compact = keybytes.ToCompact() - assert.Equal(t, libcommon.FromHex("15a7"), compact) + assert.Equal(t, common.FromHex("15a7"), compact) - keybytes = Keybytes{libcommon.FromHex("5a7c"), false, true} + keybytes = Keybytes{common.FromHex("5a7c"), false, true} compact = keybytes.ToCompact() - assert.Equal(t, libcommon.FromHex("205a7c"), compact) + assert.Equal(t, common.FromHex("205a7c"), compact) - keybytes = Keybytes{libcommon.FromHex("5a7c"), false, false} + keybytes = Keybytes{common.FromHex("5a7c"), false, false} compact = keybytes.ToCompact() - assert.Equal(t, libcommon.FromHex("005a7c"), compact) + assert.Equal(t, common.FromHex("005a7c"), compact) } func TestCompactToKeybytes(t *testing.T) { - compact := libcommon.FromHex("35a7") + compact := common.FromHex("35a7") keybytes := CompactToKeybytes(compact) - assert.Equal(t, Keybytes{libcommon.FromHex("5a70"), true, true}, keybytes) + assert.Equal(t, Keybytes{common.FromHex("5a70"), true, true}, keybytes) - compact = libcommon.FromHex("15a7") + compact = common.FromHex("15a7") keybytes = CompactToKeybytes(compact) - assert.Equal(t, Keybytes{libcommon.FromHex("5a70"), true, false}, keybytes) + assert.Equal(t, Keybytes{common.FromHex("5a70"), true, false}, keybytes) - compact = libcommon.FromHex("205a7c") + compact = common.FromHex("205a7c") keybytes = CompactToKeybytes(compact) - assert.Equal(t, Keybytes{libcommon.FromHex("5a7c"), false, true}, keybytes) + assert.Equal(t, Keybytes{common.FromHex("5a7c"), false, true}, keybytes) - compact = libcommon.FromHex("005a7c") + compact = common.FromHex("005a7c") keybytes = CompactToKeybytes(compact) - assert.Equal(t, Keybytes{libcommon.FromHex("5a7c"), false, false}, keybytes) + assert.Equal(t, Keybytes{common.FromHex("5a7c"), false, false}, keybytes) } func BenchmarkHexToCompact(b *testing.B) { diff --git a/erigon-lib/trie/errors.go b/turbo/trie/errors.go similarity index 100% rename from erigon-lib/trie/errors.go rename to turbo/trie/errors.go diff --git a/erigon-lib/trie/flatdb_sub_trie_loader_test.go b/turbo/trie/flatdb_sub_trie_loader_test.go similarity index 86% rename from erigon-lib/trie/flatdb_sub_trie_loader_test.go rename to turbo/trie/flatdb_sub_trie_loader_test.go index 5dc501f8dd6..981c958f016 100644 --- a/erigon-lib/trie/flatdb_sub_trie_loader_test.go +++ b/turbo/trie/flatdb_sub_trie_loader_test.go @@ -25,17 +25,18 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/stretchr/testify/assert" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/core/types/accounts" ) func TestCreateLoadingPrefixes(t *testing.T) { assert := assert.New(t) tr := New(libcommon.Hash{}) - kAcc1 := libcommon.FromHex("0001cf1ce0664746d39af9f6db99dc3370282f1d9d48df7f804b7e6499558c83") + kAcc1 := common.FromHex("0001cf1ce0664746d39af9f6db99dc3370282f1d9d48df7f804b7e6499558c83") kInc := make([]byte, 8) binary.BigEndian.PutUint64(kInc, uint64(1)) - ks1 := libcommon.FromHex("0000000000000000000000000000000000000000000000000000000000000001") + ks1 := common.FromHex("0000000000000000000000000000000000000000000000000000000000000001") acc1 := accounts.NewAccount() acc1.Balance.SetUint64(12345) acc1.Incarnation = 1 @@ -43,9 +44,9 @@ func TestCreateLoadingPrefixes(t *testing.T) { tr.UpdateAccount(kAcc1, &acc1) tr.Update(concat(kAcc1, ks1...), []byte{1, 2, 3}) - kAcc2 := libcommon.FromHex("0002cf1ce0664746d39af9f6db99dc3370282f1d9d48df7f804b7e6499558c83") - ks2 := libcommon.FromHex("0000000000000000000000000000000000000000000000000000000000000001") - ks22 := libcommon.FromHex("0000000000000000000000000000000000000000000000000000000000000002") + kAcc2 := common.FromHex("0002cf1ce0664746d39af9f6db99dc3370282f1d9d48df7f804b7e6499558c83") + ks2 := common.FromHex("0000000000000000000000000000000000000000000000000000000000000001") + ks22 := common.FromHex("0000000000000000000000000000000000000000000000000000000000000002") acc2 := accounts.NewAccount() acc2.Balance.SetUint64(6789) acc2.Incarnation = 1 @@ -124,8 +125,8 @@ func TestIsSequence(t *testing.T) { {prev: "1234", next: "5678", expect: false}, } for _, tc := range cases { - next, _ := kv.NextSubtree(libcommon.FromHex(tc.prev)) - res := isSequenceOld(next, libcommon.FromHex(tc.next)) + next, _ := kv.NextSubtree(common.FromHex(tc.prev)) + res := isSequenceOld(next, common.FromHex(tc.next)) assert.Equal(tc.expect, res, "%s, %s", tc.prev, tc.next) } diff --git a/erigon-lib/trie/gen_struct_step.go b/turbo/trie/gen_struct_step.go similarity index 99% rename from erigon-lib/trie/gen_struct_step.go rename to turbo/trie/gen_struct_step.go index 93eda075aaf..6a751c84b9c 100644 --- a/erigon-lib/trie/gen_struct_step.go +++ b/turbo/trie/gen_struct_step.go @@ -26,7 +26,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlphacks" + "github.com/erigontech/erigon/turbo/rlphacks" ) // Experimental code for separating data and structural information diff --git a/turbo/trie/hack.go b/turbo/trie/hack.go new file mode 100644 index 00000000000..3cfc9b35b9f --- /dev/null +++ b/turbo/trie/hack.go @@ -0,0 +1,146 @@ +// Copyright 2024 The Erigon Authors +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package trie + +import ( + "fmt" + + libcommon "github.com/erigontech/erigon-lib/common" + + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/rlp" +) + +func FullNode1() { + f := &fullNode{} + b, err := rlp.EncodeToBytes(f) + if err != nil { + panic(err) + } + fmt.Printf("FullNode1 %x\n", b) +} + +func FullNode2() { + f := &fullNode{} + f.Children[0] = valueNode(nil) + b, err := rlp.EncodeToBytes(f) + if err != nil { + panic(err) + } + fmt.Printf("FullNode2 %x\n", b) +} + +func FullNode3() { + f := &fullNode{} + f.Children[0] = valueNode(nil) + h := libcommon.Hash{} + f.Children[1] = hashNode{hash: h[:]} + b, err := rlp.EncodeToBytes(f) + if err != nil { + panic(err) + } + fmt.Printf("FullNode3 %x\n", b) +} + +func FullNode4() { + f := &fullNode{} + h := libcommon.Hash{} + for i := 0; i < 17; i++ { + f.Children[i] = hashNode{hash: h[:]} + } + b, err := rlp.EncodeToBytes(f) + if err != nil { + panic(err) + } + fmt.Printf("FullNode4 %x\n", b) +} + +func ShortNode1() { + s := NewShortNode([]byte("1"), valueNode("2")) + b, err := rlp.EncodeToBytes(s) + if err != nil { + panic(err) + } + fmt.Printf("ShortNode1 %x\n", b) +} + +func ShortNode2() { + s := NewShortNode([]byte("1"), valueNode("123456789012345678901234567890123456789012345678901234567890")) + b, err := rlp.EncodeToBytes(s) + if err != nil { + panic(err) + } + fmt.Printf("ShortNode2 %x\n", b) +} + +func hashRoot(n node, title string) { + h := newHasher(false) + h1 := newHasher(true) + defer returnHasherToPool(h) + defer returnHasherToPool(h1) + var hash libcommon.Hash + hLen, _ := h.hash(n, true, hash[:]) + if hLen < 32 { + panic("expected hashNode") + } + fmt.Printf("%s noencode: %x\n", title, hash[:]) + hLen, _ = h1.hash(n, true, hash[:]) + if hLen < 32 { + panic("expected hashNode") + } + fmt.Printf("%s encode: %x\n", title, hash[:]) +} + +func Hash1() { + f := &fullNode{} + hashRoot(f, "Hash1") +} + +func Hash2() { + f := &fullNode{} + f.Children[0] = &fullNode{} + hashRoot(f, "Hash2") +} + +func Hash3() { + s := NewShortNode([]byte("12"), valueNode("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012")) + hashRoot(s, "Hash3") +} + +func Hash4() { + s := NewShortNode([]byte("12345678901234567890123456789012"), valueNode("12345678901234567890")) + hashRoot(s, "Hash4") +} + +func Hash5() { + s := NewShortNode([]byte("1234567890123456789012345678901"), valueNode("1")) + hashRoot(s, "Hash5") +} + +func Hash6() { + s := NewShortNode(common.FromHex("080010"), valueNode(common.FromHex("f90129a0bc7bbe9ce39e604900ca736606290650c4c630501a97745a3f21fae5261623df830362c0b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0"))) + hashRoot(s, "Hash6") +} + +func Hash7() { + d := &duoNode{} + d.child1 = NewShortNode(common.FromHex("0110"), valueNode(common.FromHex("f871820ba5850ba43b7400830186a0942eb08efb9e10d9f56e46938f28c13ecb33f67b158a085c1bad4187cfe90000801ba0a7e45cf38e44d2c39a4b94bae2e14fccde41e3280c57b611d9cb6494fde12fc7a00858adac2ba2381c591978b8404c22981f7141f0aef9c3cab8f93a55efc40acc"))) + d.child2 = NewShortNode(common.FromHex("0010"), valueNode(common.FromHex("fa02368e820276850ba43b7400830f4240947fd85d1fc04087b3d9d1e610410989191c09b97380ba023624847b07e7000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000011af74000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000790000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000006f0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000720000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000007a000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000350000000000000000000000000000000000000000000000000000000000000056000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000eb00000000000000000000000000000000000000000000000000000000000000a100000000000000000000000000000000000000000000000000000000000000c1000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000005d0000000000000000000000000000000000000000000000000000000000000085000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000fe000000000000000000000000000000000000000000000000000000000000005f0000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000008300000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000045000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000a2000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000d900000000000000000000000000000000000000000000000000000000000000d900000000000000000000000000000000000000000000000000000000000000d1000000000000000000000000000000000000000000000000000000000000008800000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000d700000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000008b0000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000b20000000000000000000000000000000000000000000000000000000000000096000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000dd00000000000000000000000000000000000000000000000000000000000000ba00000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000ae0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003900000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000009d000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000006500000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000ab0000000000000000000000000000000000000000000000000000000000000099000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000ee00000000000000000000000000000000000000000000000000000000000000830000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000760000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000004b00000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000a600000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000008e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000e50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000b600000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000b2000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000008b0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000006f0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000006e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000530000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000004c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000003500000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002d0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004700000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000350000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000390000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000003700000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000003500000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000390000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000039000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000006500000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000350000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002d0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000560000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000006500000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000530000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000007a0000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b70000000000000000000000000000000000000000000000000000000000000075000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000097000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000008f000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000d500000000000000000000000000000000000000000000000000000000000000d60000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f40000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000c7000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000f1000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000a700000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000b900000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000bd000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000b10000000000000000000000000000000000000000000000000000000000000039000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000a60000000000000000000000000000000000000000000000000000000000000059000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000dd000000000000000000000000000000000000000000000000000000000000008d000000000000000000000000000000000000000000000000000000000000009d000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000008700000000000000000000000000000000000000000000000000000000000000cb00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000007e0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000000000000000000000000000620000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000ae00000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000b3000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000d700000000000000000000000000000000000000000000000000000000000000fb000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000ae000000000000000000000000000000000000000000000000000000000000006b0000000000000000000000000000000000000000000000000000000000000075000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000fc00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000de0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000d50000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000000000000000de000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000be00000000000000000000000000000000000000000000000000000000000000f30000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000099000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000009f000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000004100000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000093000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000970000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000fe00000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000de000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000ba000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000c700000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000a30000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008b00000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000e8000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000d600000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000da00000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000ef000000000000000000000000000000000000000000000000000000000000002700000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000e500000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000003900000000000000000000000000000000000000000000000000000000000000cd000000000000000000000000000000000000000000000000000000000000002300000000000000000000000000000000000000000000000000000000000000aa000000000000000000000000000000000000000000000000000000000000005d00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000008e0000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000f9000000000000000000000000000000000000000000000000000000000000009b0000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000007600000000000000000000000000000000000000000000000000000000000000bb0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000b3000000000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000000000000000000000000000dd00000000000000000000000000000000000000000000000000000000000000a5000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000970000000000000000000000000000000000000000000000000000000000000085000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000f50000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002d0000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000ea00000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000f50000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008c00000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000e4000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000760000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000001b00000000000000000000000000000000000000000000000000000000000000c90000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000f200000000000000000000000000000000000000000000000000000000000000e90000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a300000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000002300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000fc00000000000000000000000000000000000000000000000000000000000000d300000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000ce0000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000005b00000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000e2000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000cb00000000000000000000000000000000000000000000000000000000000000590000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000490000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000079000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000086000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000079000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d0000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000007a0000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000007a0000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000086000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000079000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000045000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003e0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000480000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000680000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000006500000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000b600000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000b40000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000c500000000000000000000000000000000000000000000000000000000000000da00000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000f6000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000bb0000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000e90000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000bd000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000b20000000000000000000000000000000000000000000000000000000000000039000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000008a000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000ba000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000370000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000590000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000009d00000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000d600000000000000000000000000000000000000000000000000000000000000da0000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008d00000000000000000000000000000000000000000000000000000000000000c900000000000000000000000000000000000000000000000000000000000000f10000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000bf0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000ac000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000fe000000000000000000000000000000000000000000000000000000000000003300000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000008400000000000000000000000000000000000000000000000000000000000000f200000000000000000000000000000000000000000000000000000000000000fd00000000000000000000000000000000000000000000000000000000000000cd00000000000000000000000000000000000000000000000000000000000000bb000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000004e0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000db0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000950000000000000000000000000000000000000000000000000000000000000085000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000fe00000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000590000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000430000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000005f000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000490000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000f80000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000c50000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000b6000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000ea0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000003d00000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000093000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000007100000000000000000000000000000000000000000000000000000000000000b600000000000000000000000000000000000000000000000000000000000000e70000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000008b00000000000000000000000000000000000000000000000000000000000000840000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000007500000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000910000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000003300000000000000000000000000000000000000000000000000000000000000f700000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000b3000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000a60000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000009e000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000008b000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000023000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000720000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009b00000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000d60000000000000000000000000000000000000000000000000000000000000071000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000810000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000e4000000000000000000000000000000000000000000000000000000000000008a000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000c50000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000007900000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000008f00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000b900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000b300000000000000000000000000000000000000000000000000000000000000ef00000000000000000000000000000000000000000000000000000000000000eb0000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000009d000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000e5000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000ea000000000000000000000000000000000000000000000000000000000000003900000000000000000000000000000000000000000000000000000000000000b500000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000004f00000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000099000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000b700000000000000000000000000000000000000000000000000000000000000a100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000006b0000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000fd00000000000000000000000000000000000000000000000000000000000000e2000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000083000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000a100000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000006d0000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000e900000000000000000000000000000000000000000000000000000000000000b60000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000000d0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000db000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000c700000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000009d00000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000bd0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000006f0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000006e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000001b00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000006f0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000620000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000340000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000039000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000003900000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003500000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000003900000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000006f0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000006e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000530000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000004c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000003500000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000003300000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000af0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000009b00000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000005d000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000c600000000000000000000000000000000000000000000000000000000000000d500000000000000000000000000000000000000000000000000000000000000e8000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000d0000000000000000000000000000000000000000000000000000000000000008b000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000e4000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000a700000000000000000000000000000000000000000000000000000000000000dd0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000d4000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000005d0000000000000000000000000000000000000000000000000000000000000098000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000008d0000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000da000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000d60000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000b500000000000000000000000000000000000000000000000000000000000000e9000000000000000000000000000000000000000000000000000000000000004a000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000e2000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000340000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000005f000000000000000000000000000000000000000000000000000000000000003f000000000000000000000000000000000000000000000000000000000000003f0000000000000000000000000000000000000000000000000000000000000091000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000c7000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000b60000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000009f0000000000000000000000000000000000000000000000000000000000000086000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000a300000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000008300000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000d3000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000009d0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000c9000000000000000000000000000000000000000000000000000000000000008300000000000000000000000000000000000000000000000000000000000000e7000000000000000000000000000000000000000000000000000000000000001b00000000000000000000000000000000000000000000000000000000000000c4000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000ac000000000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000000000000000000000000000e700000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000009e000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000000000000000000d800000000000000000000000000000000000000000000000000000000000000be000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000008f00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000006800000000000000000000000000000000000000000000000000000000000000710000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000de0000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000bf00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d300000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000b300000000000000000000000000000000000000000000000000000000000000d70000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000009b00000000000000000000000000000000000000000000000000000000000000fd000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000008c00000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000f1000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000b30000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000a700000000000000000000000000000000000000000000000000000000000000830000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000e700000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000b5000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000fc00000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000008400000000000000000000000000000000000000000000000000000000000000d1000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000bc000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000000000000000000000000000000000000ad00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000088000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000d7000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000008700000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000007e0000000000000000000000000000000000000000000000000000000000000087000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000f9000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000fd000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000980000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008d00000000000000000000000000000000000000000000000000000000000000d600000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000bb000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000480000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000008b00000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000b70000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000bf00000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000d900000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000bc0000000000000000000000000000000000000000000000000000000000000057000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000e50000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000bb000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000000000000000000b600000000000000000000000000000000000000000000000000000000000000590000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a300000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000002300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000980000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000008d000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000fb00000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000aa000000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000006500000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000000000000000000000000000000000004e0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000fc00000000000000000000000000000000000000000000000000000000000000d300000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000ce0000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000005b00000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000e2000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000079000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000620000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000079000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000480000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f80000000000000000000000000000000000000000000000000000000000000045000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002b0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000250000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000007400000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000007500000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000730000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a30000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000c60000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000ac000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000093000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000b700000000000000000000000000000000000000000000000000000000000000ea00000000000000000000000000000000000000000000000000000000000000ae000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000007e0000000000000000000000000000000000000000000000000000000000000078000000000000000000000000000000000000000000000000000000000000008d000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000f8000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000ef00000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000000000000000000000000000000000005b00000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000009a000000000000000000000000000000000000000000000000000000000000008f0000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000002700000000000000000000000000000000000000000000000000000000000000c7000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000fb00000000000000000000000000000000000000000000000000000000000000930000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000a9000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000ef000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000008400000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000c4000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000af0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000830000000000000000000000000000000000000000000000000000000000000087000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000009700000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000710000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000b300000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000d9000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000009200000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000b6000000000000000000000000000000000000000000000000000000000000007900000000000000000000000000000000000000000000000000000000000000bc0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000004a000000000000000000000000000000000000000000000000000000000000009d0000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000c5000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000f200000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000b4000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000aa0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000ba000000000000000000000000000000000000000000000000000000000000004f00000000000000000000000000000000000000000000000000000000000000ef0000000000000000000000000000000000000000000000000000000000000093000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000ef000000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000008e0000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000000000000000000000000000b10000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000009700000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000b200000000000000000000000000000000000000000000000000000000000000c6000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000007900000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000000d0000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000037000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000340000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000be0000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000390000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000fb000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000a100000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000004e0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000008d00000000000000000000000000000000000000000000000000000000000000cd000000000000000000000000000000000000000000000000000000000000008c00000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000fe000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000000000000000000000000000000000000000005d0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000f8000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000056000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000075000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000a60000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000ba000000000000000000000000000000000000000000000000000000000000004b00000000000000000000000000000000000000000000000000000000000000a5000000000000000000000000000000000000000000000000000000000000005d0000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000009a000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000008d000000000000000000000000000000000000000000000000000000000000005f0000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000ef00000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000009900000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000f20000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000980000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000f60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000006b0000000000000000000000000000000000000000000000000000000000000041000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000a6000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000fe00000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000ba000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000ed0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000a100000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000c7000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000d60000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000b1000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000c4000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000007a0000000000000000000000000000000000000000000000000000000000000086000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000078000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000ef00000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000fb00000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000a50000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000093000000000000000000000000000000000000000000000000000000000000009e0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000001d0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000009d00000000000000000000000000000000000000000000000000000000000000fc00000000000000000000000000000000000000000000000000000000000000e900000000000000000000000000000000000000000000000000000000000000ae00000000000000000000000000000000000000000000000000000000000000ae00000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000ef000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000b700000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000c1000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000e3000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000e6000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000004b0000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000ea000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000000000000000ec0000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000b600000000000000000000000000000000000000000000000000000000000000b7000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000630000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000008a00000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000e6000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000e7000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c5000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000e200000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000fe000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000004b0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000ee000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000ab0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000d5000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000f1000000000000000000000000000000000000000000000000000000000000005b0000000000000000000000000000000000000000000000000000000000000097000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000000000000000000fe0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000870000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000004f00000000000000000000000000000000000000000000000000000000000000b1000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000b900000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000006200000000000000000000000000000000000000000000000000000000000000af0000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000005b0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000004c00000000000000000000000000000000000000000000000000000000000000b80000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000005c000000000000000000000000000000000000000000000000000000000000009900000000000000000000000000000000000000000000000000000000000000c70000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000b7000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000a2000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000de000000000000000000000000000000000000000000000000000000000000008a0000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000b7000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000c500000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000ad00000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000008d000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000e9000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000ed000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000c50000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000da00000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000aa0000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000ae000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000009a000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000760000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000cd000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000520000000000000000000000000000000000000000000000000000000000000023000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000d4000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000004a000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000021000000000000000000000000000000000000000000000000000000000000006b00000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000e7000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000006a0000000000000000000000000000000000000000000000000000000000000039000000000000000000000000000000000000000000000000000000000000004100000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000bf00000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000007100000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009d00000000000000000000000000000000000000000000000000000000000000ea0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000a2000000000000000000000000000000000000000000000000000000000000007a000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000230000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000008a0000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000ac0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000003700000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000d700000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000007600000000000000000000000000000000000000000000000000000000000000c1000000000000000000000000000000000000000000000000000000000000005c000000000000000000000000000000000000000000000000000000000000009b0000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000009a000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000550000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000008b00000000000000000000000000000000000000000000000000000000000000a90000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000093000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000f6000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000ba00000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000e10000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000c5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000d2000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000c600000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000c90000000000000000000000000000000000000000000000000000000000000098000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000c700000000000000000000000000000000000000000000000000000000000000780000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000009a0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000d900000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000007100000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000a80000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000c900000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000ef000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000a4000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000d800000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000000000000000000000000000000000000000003700000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000620000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000c4000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000d50000000000000000000000000000000000000000000000000000000000000045000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000008b00000000000000000000000000000000000000000000000000000000000000a10000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000002300000000000000000000000000000000000000000000000000000000000000d2000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000007600000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000041000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000e70000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000c1000000000000000000000000000000000000000000000000000000000000009a0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000c60000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000b3000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000970000000000000000000000000000000000000000000000000000000000000078000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000db000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000cd000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000000000000000000000000000000000005d000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000c4000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000bc000000000000000000000000000000000000000000000000000000000000009c0000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000d4000000000000000000000000000000000000000000000000000000000000009e000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000fc00000000000000000000000000000000000000000000000000000000000000e600000000000000000000000000000000000000000000000000000000000000ed00000000000000000000000000000000000000000000000000000000000000b6000000000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000000000000000000000000000930000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000006e0000000000000000000000000000000000000000000000000000000000000023000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000e700000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000df0000000000000000000000000000000000000000000000000000000000000097000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000aa000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000ae00000000000000000000000000000000000000000000000000000000000000d0000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000cd00000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000b200000000000000000000000000000000000000000000000000000000000000b100000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000920000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000003f000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000d10000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000e50000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000003e00000000000000000000000000000000000000000000000000000000000000b4000000000000000000000000000000000000000000000000000000000000002d0000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000b6000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000096000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000a2000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000ec0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000008b00000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000085000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000f1000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000da00000000000000000000000000000000000000000000000000000000000000230000000000000000000000000000000000000000000000000000000000000045000000000000000000000000000000000000000000000000000000000000003f000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000a6000000000000000000000000000000000000000000000000000000000000005f000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000007900000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000004f00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000009e0000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000008f00000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000083000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000007100000000000000000000000000000000000000000000000000000000000000cd000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000cf00000000000000000000000000000000000000000000000000000000000000d600000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000f6000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000003300000000000000000000000000000000000000000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000046000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000056000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000e8000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000d3000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000de0000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000009f000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000b2000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000ba000000000000000000000000000000000000000000000000000000000000006900000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000d700000000000000000000000000000000000000000000000000000000000000cc0000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000d500000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000d1000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000b50000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000f80000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000008d0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000fd000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000cb0000000000000000000000000000000000000000000000000000000000000057000000000000000000000000000000000000000000000000000000000000008400000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000086000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000d8000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000ae00000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000009e000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000bc0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000fc0000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000e90000000000000000000000000000000000000000000000000000000000000096000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000d500000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000d2000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000eb000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000da000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000e900000000000000000000000000000000000000000000000000000000000000a9000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000fd00000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000de000000000000000000000000000000000000000000000000000000000000009e000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000e5000000000000000000000000000000000000000000000000000000000000007a0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000f1000000000000000000000000000000000000000000000000000000000000005d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e8000000000000000000000000000000000000000000000000000000000000003500000000000000000000000000000000000000000000000000000000000000c6000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000005f0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000003f000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000fb000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000db000000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000a80000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000d900000000000000000000000000000000000000000000000000000000000000dc000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000009f0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000006d00000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000b20000000000000000000000000000000000000000000000000000000000000059000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000ac000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000e500000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000e6000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000be00000000000000000000000000000000000000000000000000000000000000850000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000b4000000000000000000000000000000000000000000000000000000000000008d00000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000008100000000000000000000000000000000000000000000000000000000000000bf00000000000000000000000000000000000000000000000000000000000000e5000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000720000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000fd000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000047000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000ed000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000008a000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000e6000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000e4000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000007600000000000000000000000000000000000000000000000000000000000000f9000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000005d000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000005b0000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000006a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002d0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000a800000000000000000000000000000000000000000000000000000000000000e500000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001b0000000000000000000000000000000000000000000000000000000000000041000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000a20000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000004100000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000004d00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000de00000000000000000000000000000000000000000000000000000000000000e4000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000950000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000350000000000000000000000000000000000000000000000000000000000000071000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000d900000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000bb000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000e20000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000008f00000000000000000000000000000000000000000000000000000000000000fd000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000e500000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000078000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000a70000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000ed00000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000005d00000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000c500000000000000000000000000000000000000000000000000000000000000c4000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000b7000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000a9000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000d7000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000f70000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000ea000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000ae000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000ad00000000000000000000000000000000000000000000000000000000000000a6000000000000000000000000000000000000000000000000000000000000003e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000006800000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000ee000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000e50000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000fb0000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000059000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000da000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000a600000000000000000000000000000000000000000000000000000000000000cf00000000000000000000000000000000000000000000000000000000000000a6000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000008f00000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000008a0000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000002b0000000000000000000000000000000000000000000000000000000000000057000000000000000000000000000000000000000000000000000000000000004800000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000059000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000005500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000ee00000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000d800000000000000000000000000000000000000000000000000000000000000df0000000000000000000000000000000000000000000000000000000000000089000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000c600000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000d7000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000f40000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000cd000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000150000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000eb00000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000069000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000250000000000000000000000000000000000000000000000000000000000000087000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000000000000000000000000000000000000000009f000000000000000000000000000000000000000000000000000000000000008100000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000e800000000000000000000000000000000000000000000000000000000000000dc000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000f700000000000000000000000000000000000000000000000000000000000000e800000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000bb000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000ea000000000000000000000000000000000000000000000000000000000000005e00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000089000000000000000000000000000000000000000000000000000000000000004700000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000c1000000000000000000000000000000000000000000000000000000000000007900000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000c20000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000006b00000000000000000000000000000000000000000000000000000000000000410000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000de0000000000000000000000000000000000000000000000000000000000000023000000000000000000000000000000000000000000000000000000000000006f00000000000000000000000000000000000000000000000000000000000000fc0000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000e6000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000b1000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000dd00000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000a2000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000f800000000000000000000000000000000000000000000000000000000000000bd0000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000d5000000000000000000000000000000000000000000000000000000000000005e00000000000000000000000000000000000000000000000000000000000000e90000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000d800000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000b300000000000000000000000000000000000000000000000000000000000000b5000000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000da000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000cc000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000e500000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000000000000000000000000000000000000000008e0000000000000000000000000000000000000000000000000000000000000066000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000b3000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000f700000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000ee000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000000000000000000000000071000000000000000000000000000000000000000000000000000000000000006d0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000db000000000000000000000000000000000000000000000000000000000000008d0000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000004f00000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000e2000000000000000000000000000000000000000000000000000000000000008b000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000004100000000000000000000000000000000000000000000000000000000000000ac0000000000000000000000000000000000000000000000000000000000000021000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000be000000000000000000000000000000000000000000000000000000000000009c0000000000000000000000000000000000000000000000000000000000000099000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000a8000000000000000000000000000000000000000000000000000000000000008f000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000aa00000000000000000000000000000000000000000000000000000000000000b4000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000b100000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000cd00000000000000000000000000000000000000000000000000000000000000f80000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000bf0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000008a000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000ef000000000000000000000000000000000000000000000000000000000000005b00000000000000000000000000000000000000000000000000000000000000b900000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000b2000000000000000000000000000000000000000000000000000000000000009e000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000980000000000000000000000000000000000000000000000000000000000000037000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000e20000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000005c00000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000cf00000000000000000000000000000000000000000000000000000000000000cf0000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000b200000000000000000000000000000000000000000000000000000000000000d8000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000210000000000000000000000000000000000000000000000000000000000000083000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000a70000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000003b00000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000077000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000a9000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000086000000000000000000000000000000000000000000000000000000000000008500000000000000000000000000000000000000000000000000000000000000350000000000000000000000000000000000000000000000000000000000000097000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000fb000000000000000000000000000000000000000000000000000000000000008e000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000bc000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000005900000000000000000000000000000000000000000000000000000000000000850000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000b200000000000000000000000000000000000000000000000000000000000000ee00000000000000000000000000000000000000000000000000000000000000aa0000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e10000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000c20000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000006d0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000005d000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000a40000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000041000000000000000000000000000000000000000000000000000000000000005c00000000000000000000000000000000000000000000000000000000000000b40000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000004d0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000a800000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000037000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000aa000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000f70000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000002700000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000023000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000d500000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000be00000000000000000000000000000000000000000000000000000000000000b100000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000920000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000ef00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000087000000000000000000000000000000000000000000000000000000000000008800000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000006f000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000005c00000000000000000000000000000000000000000000000000000000000000cc0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000ea00000000000000000000000000000000000000000000000000000000000000b7000000000000000000000000000000000000000000000000000000000000004f0000000000000000000000000000000000000000000000000000000000000057000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000bd000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000c70000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000b900000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000003e00000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000bd0000000000000000000000000000000000000000000000000000000000000062000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000a700000000000000000000000000000000000000000000000000000000000000bc000000000000000000000000000000000000000000000000000000000000008b000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000c600000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000fa0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000005e0000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000a300000000000000000000000000000000000000000000000000000000000000490000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000009a000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000a600000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000d8000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000004b0000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000760000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e3000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000da00000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000e700000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000092000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000075000000000000000000000000000000000000000000000000000000000000009f000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000ed00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000e50000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000bf000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000eb00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000ea00000000000000000000000000000000000000000000000000000000000000c9000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000a40000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000b300000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000ca00000000000000000000000000000000000000000000000000000000000000b70000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000007a0000000000000000000000000000000000000000000000000000000000000045000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000ea00000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000b700000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000005e00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000b7000000000000000000000000000000000000000000000000000000000000006700000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000009200000000000000000000000000000000000000000000000000000000000000760000000000000000000000000000000000000000000000000000000000000031000000000000000000000000000000000000000000000000000000000000006200000000000000000000000000000000000000000000000000000000000000bc000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000590000000000000000000000000000000000000000000000000000000000000021000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000d500000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000f70000000000000000000000000000000000000000000000000000000000000095000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000b100000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000a600000000000000000000000000000000000000000000000000000000000000f1000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000003f000000000000000000000000000000000000000000000000000000000000004c00000000000000000000000000000000000000000000000000000000000000850000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000043000000000000000000000000000000000000000000000000000000000000005600000000000000000000000000000000000000000000000000000000000000b1000000000000000000000000000000000000000000000000000000000000006800000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000a9000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000c70000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000f900000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000ce000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000c3000000000000000000000000000000000000000000000000000000000000007300000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000f500000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000920000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000005700000000000000000000000000000000000000000000000000000000000000f4000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000fd0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000c9000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000007100000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000d1000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000004a0000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000008500000000000000000000000000000000000000000000000000000000000000aa00000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000079000000000000000000000000000000000000000000000000000000000000005c000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000008300000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008500000000000000000000000000000000000000000000000000000000000000e9000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000d100000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000bd00000000000000000000000000000000000000000000000000000000000000560000000000000000000000000000000000000000000000000000000000000041000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000b60000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000009f000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000f3000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000ec00000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000066000000000000000000000000000000000000000000000000000000000000004b000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000fe00000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000fb00000000000000000000000000000000000000000000000000000000000000fe00000000000000000000000000000000000000000000000000000000000000ba00000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000b600000000000000000000000000000000000000000000000000000000000000a20000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000004b00000000000000000000000000000000000000000000000000000000000000da00000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000dd00000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000000000000000000000000091000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000ee000000000000000000000000000000000000000000000000000000000000008a0000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000004100000000000000000000000000000000000000000000000000000000000000530000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000c500000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000850000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000005e00000000000000000000000000000000000000000000000000000000000000fc000000000000000000000000000000000000000000000000000000000000008f00000000000000000000000000000000000000000000000000000000000000930000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000fb00000000000000000000000000000000000000000000000000000000000000b2000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000d800000000000000000000000000000000000000000000000000000000000000a700000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000a500000000000000000000000000000000000000000000000000000000000000bb0000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000e800000000000000000000000000000000000000000000000000000000000000fe000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000370000000000000000000000000000000000000000000000000000000000000083000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000c20000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000e2000000000000000000000000000000000000000000000000000000000000006800000000000000000000000000000000000000000000000000000000000000c9000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000af000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000c6000000000000000000000000000000000000000000000000000000000000007700000000000000000000000000000000000000000000000000000000000000ed000000000000000000000000000000000000000000000000000000000000004700000000000000000000000000000000000000000000000000000000000000cd00000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000d7000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000000d0000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000078000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000d9000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000007600000000000000000000000000000000000000000000000000000000000000ed00000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000008800000000000000000000000000000000000000000000000000000000000000e9000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000df00000000000000000000000000000000000000000000000000000000000000d10000000000000000000000000000000000000000000000000000000000000073000000000000000000000000000000000000000000000000000000000000005f00000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000d70000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000009700000000000000000000000000000000000000000000000000000000000000d600000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000088000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000a800000000000000000000000000000000000000000000000000000000000000930000000000000000000000000000000000000000000000000000000000000021000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000ed000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000a300000000000000000000000000000000000000000000000000000000000000950000000000000000000000000000000000000000000000000000000000000098000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000d4000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000f300000000000000000000000000000000000000000000000000000000000000510000000000000000000000000000000000000000000000000000000000000091000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000f9000000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000009b00000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000ed000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000aa000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000007a00000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000004d00000000000000000000000000000000000000000000000000000000000000bc000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000d4000000000000000000000000000000000000000000000000000000000000008f000000000000000000000000000000000000000000000000000000000000005d000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000008f0000000000000000000000000000000000000000000000000000000000000085000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000a900000000000000000000000000000000000000000000000000000000000000de00000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000df0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001b00000000000000000000000000000000000000000000000000000000000000f7000000000000000000000000000000000000000000000000000000000000005c00000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000fd000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000004d000000000000000000000000000000000000000000000000000000000000007600000000000000000000000000000000000000000000000000000000000000750000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005300000000000000000000000000000000000000000000000000000000000000a9000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000d9000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000c6000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000cb00000000000000000000000000000000000000000000000000000000000000a30000000000000000000000000000000000000000000000000000000000000021000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000aa000000000000000000000000000000000000000000000000000000000000003300000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000009300000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000004e0000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000c5000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000ab000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000fd00000000000000000000000000000000000000000000000000000000000000860000000000000000000000000000000000000000000000000000000000000097000000000000000000000000000000000000000000000000000000000000006b0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000960000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000b8000000000000000000000000000000000000000000000000000000000000008a00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000089000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000d10000000000000000000000000000000000000000000000000000000000000098000000000000000000000000000000000000000000000000000000000000002700000000000000000000000000000000000000000000000000000000000000e3000000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000008300000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000290000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000004100000000000000000000000000000000000000000000000000000000000000df000000000000000000000000000000000000000000000000000000000000008100000000000000000000000000000000000000000000000000000000000000ac000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000bd000000000000000000000000000000000000000000000000000000000000009e00000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000fd00000000000000000000000000000000000000000000000000000000000000f600000000000000000000000000000000000000000000000000000000000000a7000000000000000000000000000000000000000000000000000000000000004200000000000000000000000000000000000000000000000000000000000000aa00000000000000000000000000000000000000000000000000000000000000d1000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000c100000000000000000000000000000000000000000000000000000000000000ac000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000bc0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000cf000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000053000000000000000000000000000000000000000000000000000000000000005400000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000950000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000ed000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000a3000000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000eb000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000000000000000eb00000000000000000000000000000000000000000000000000000000000000d300000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000c900000000000000000000000000000000000000000000000000000000000000d70000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000085000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000002b00000000000000000000000000000000000000000000000000000000000000a6000000000000000000000000000000000000000000000000000000000000008f000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000008c000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000078000000000000000000000000000000000000000000000000000000000000009200000000000000000000000000000000000000000000000000000000000000f80000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000aa0000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000f100000000000000000000000000000000000000000000000000000000000000a1000000000000000000000000000000000000000000000000000000000000006a0000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000350000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000037000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000ee000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000006b00000000000000000000000000000000000000000000000000000000000000580000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004d00000000000000000000000000000000000000000000000000000000000000b4000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000c1000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000006300000000000000000000000000000000000000000000000000000000000000e500000000000000000000000000000000000000000000000000000000000000db00000000000000000000000000000000000000000000000000000000000000c500000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000f400000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000710000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000007e0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000d800000000000000000000000000000000000000000000000000000000000000cb000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000009200000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000006a0000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000c300000000000000000000000000000000000000000000000000000000000000f60000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000008a00000000000000000000000000000000000000000000000000000000000000f5000000000000000000000000000000000000000000000000000000000000007a000000000000000000000000000000000000000000000000000000000000003f0000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000005d00000000000000000000000000000000000000000000000000000000000000c900000000000000000000000000000000000000000000000000000000000000ae0000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000d60000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000008b000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000d700000000000000000000000000000000000000000000000000000000000000b9000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000000cb00000000000000000000000000000000000000000000000000000000000000ce0000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000e700000000000000000000000000000000000000000000000000000000000000ab0000000000000000000000000000000000000000000000000000000000000075000000000000000000000000000000000000000000000000000000000000009f00000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000000000000000000000000000000000000000004900000000000000000000000000000000000000000000000000000000000000ad000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000009b000000000000000000000000000000000000000000000000000000000000001ba05d4d29b6f1b101809f9b43edea6e227828ed7df55663b482cff3d9d7a14ec20aa023db82ed86dd399e73aee94f0f0f8854d352c413e64c4b7f8d8a9bf5cb198d4b"))) + d.mask |= uint32(1) << 0 + d.mask |= uint32(1) << 8 + hashRoot(d, "Hash7") +} diff --git a/erigon-lib/trie/hashbuilder.go b/turbo/trie/hashbuilder.go similarity index 98% rename from erigon-lib/trie/hashbuilder.go rename to turbo/trie/hashbuilder.go index 8dff485a678..99cceb12bca 100644 --- a/erigon-lib/trie/hashbuilder.go +++ b/turbo/trie/hashbuilder.go @@ -30,9 +30,9 @@ import ( length2 "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon-lib/rlphacks" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" + "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon/turbo/rlphacks" ) const hashStackStride = length2.Hash + 1 // + 1 byte for RLP encoding @@ -658,7 +658,6 @@ func (hb *HashBuilder) code(code []byte) error { return nil } -// nolint func (hb *HashBuilder) emptyRoot() { if hb.trace { fmt.Printf("EMPTYROOT\n") @@ -696,12 +695,12 @@ func (hb *HashBuilder) rootHash() libcommon.Hash { func (hb *HashBuilder) topHash() []byte { pos := len(hb.hashStack) - hashStackStride - length := hb.hashStack[pos] - 0x80 - if length > 32 { + len := hb.hashStack[pos] - 0x80 + if len > 32 { // node itself (RLP list), not its hash - length = hb.hashStack[pos] - 0xc0 + len = hb.hashStack[pos] - 0xc0 } - return hb.hashStack[pos : pos+1+int(length)] + return hb.hashStack[pos : pos+1+int(len)] } func (hb *HashBuilder) printTopHashes(prefix []byte, _, children uint16) { diff --git a/erigon-lib/trie/hasher.go b/turbo/trie/hasher.go similarity index 99% rename from erigon-lib/trie/hasher.go rename to turbo/trie/hasher.go index e191ca32044..0b85558413c 100644 --- a/erigon-lib/trie/hasher.go +++ b/turbo/trie/hasher.go @@ -30,8 +30,8 @@ import ( "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon-lib/rlphacks" + "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon/turbo/rlphacks" ) type hasher struct { diff --git a/erigon-lib/trie/hasher_test.go b/turbo/trie/hasher_test.go similarity index 100% rename from erigon-lib/trie/hasher_test.go rename to turbo/trie/hasher_test.go diff --git a/erigon-lib/trie/intermediate_hashes_test.go b/turbo/trie/intermediate_hashes_test.go similarity index 100% rename from erigon-lib/trie/intermediate_hashes_test.go rename to turbo/trie/intermediate_hashes_test.go diff --git a/erigon-lib/trie/node.go b/turbo/trie/node.go similarity index 98% rename from erigon-lib/trie/node.go rename to turbo/trie/node.go index 5fbdfb187df..8851ddfc67e 100644 --- a/erigon-lib/trie/node.go +++ b/turbo/trie/node.go @@ -25,9 +25,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" - "github.com/erigontech/erigon-lib/rlp" + "github.com/erigontech/erigon/rlp" ) const codeSizeUncached = -1 diff --git a/erigon-lib/trie/proof.go b/turbo/trie/proof.go similarity index 99% rename from erigon-lib/trie/proof.go rename to turbo/trie/proof.go index 9fcd8770aea..b6c3ddf75de 100644 --- a/erigon-lib/trie/proof.go +++ b/turbo/trie/proof.go @@ -25,8 +25,8 @@ import ( "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" + "github.com/erigontech/erigon/rlp" ) // Prove constructs a merkle proof for key. The result contains all encoded nodes diff --git a/erigon-lib/trie/retain_list.go b/turbo/trie/retain_list.go similarity index 99% rename from erigon-lib/trie/retain_list.go rename to turbo/trie/retain_list.go index fb9215c3c4f..5d43c95b451 100644 --- a/erigon-lib/trie/retain_list.go +++ b/turbo/trie/retain_list.go @@ -34,7 +34,7 @@ import ( "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/length" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" ) type RetainDecider interface { diff --git a/erigon-lib/trie/retain_list_test.go b/turbo/trie/retain_list_test.go similarity index 98% rename from erigon-lib/trie/retain_list_test.go rename to turbo/trie/retain_list_test.go index 26bea0dc64f..96e1381544a 100644 --- a/erigon-lib/trie/retain_list_test.go +++ b/turbo/trie/retain_list_test.go @@ -24,7 +24,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" ) func FakePreimage(hash libcommon.Hash) libcommon.Hash { @@ -39,7 +39,7 @@ func FakePreimage(hash libcommon.Hash) libcommon.Hash { // manually construct a ProofRetainer based on a set of keys. This is // especially useful for tests which want to manually manipulate the hash // databases without worrying about generating and tracking pre-images. -func NewManualProofRetainer(t *testing.T, acc *accounts.Account, rl *RetainList, keys [][]byte) *ProofRetainer { //nolint +func NewManualProofRetainer(t *testing.T, acc *accounts.Account, rl *RetainList, keys [][]byte) *ProofRetainer { var accHexKey []byte var storageKeys []libcommon.Hash var storageHexKeys [][]byte diff --git a/erigon-lib/trie/stream.go b/turbo/trie/stream.go similarity index 99% rename from erigon-lib/trie/stream.go rename to turbo/trie/stream.go index 9d106f62c78..44852f74b42 100644 --- a/erigon-lib/trie/stream.go +++ b/turbo/trie/stream.go @@ -28,9 +28,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/length" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/rlphacks" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/core/types/accounts" + "github.com/erigontech/erigon/turbo/rlphacks" ) // StreamItem is an enum type for values that help distinguish different diff --git a/erigon-lib/trie/stream_test.go b/turbo/trie/stream_test.go similarity index 98% rename from erigon-lib/trie/stream_test.go rename to turbo/trie/stream_test.go index 213859c4d07..e9a938d70cf 100644 --- a/erigon-lib/trie/stream_test.go +++ b/turbo/trie/stream_test.go @@ -27,8 +27,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/core/types/accounts" ) func TestHashWithModificationsEmpty(t *testing.T) { diff --git a/erigon-lib/trie/structural_test.go b/turbo/trie/structural_test.go similarity index 77% rename from erigon-lib/trie/structural_test.go rename to turbo/trie/structural_test.go index 7766d96f24f..9622fa65aae 100644 --- a/erigon-lib/trie/structural_test.go +++ b/turbo/trie/structural_test.go @@ -31,12 +31,12 @@ import ( "github.com/stretchr/testify/require" - "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlphacks" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/turbo/rlphacks" ) func TestV2HashBuilding(t *testing.T) { @@ -261,28 +261,28 @@ func TestEmbeddedStorage11(t *testing.T) { }{ { - k: libcommon.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae9800000000000000010d2f4a412d2809e00f42a7f8cb0e659bddf0b4f201d24eb1b2946493cbae334c"), - v: libcommon.FromHex("496e7374616e6365000000000000000000000000000000000000000000000000"), + k: common.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae9800000000000000010d2f4a412d2809e00f42a7f8cb0e659bddf0b4f201d24eb1b2946493cbae334c"), + v: common.FromHex("496e7374616e6365000000000000000000000000000000000000000000000000"), }, { - k: libcommon.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae98000000000000000123a5384746519cbca71a22098063e5608768276f2dc212e71fd2c6c643c726c4"), - v: libcommon.FromHex("65eea643e9a9d6f5f2f7e13ccdff36cf45b46aab"), + k: common.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae98000000000000000123a5384746519cbca71a22098063e5608768276f2dc212e71fd2c6c643c726c4"), + v: common.FromHex("65eea643e9a9d6f5f2f7e13ccdff36cf45b46aab"), }, { - k: libcommon.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae980000000000000001387a79e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), - v: libcommon.FromHex("01"), + k: common.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae980000000000000001387a79e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), + v: common.FromHex("01"), }, { - k: libcommon.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae980000000000000001a8dc6a21510692d70d47860a1bbd432c801d1860bfbbe6856756ad4c062ba601"), - v: libcommon.FromHex("53706f7265000000000000000000000000000000000000000000000000000000"), + k: common.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae980000000000000001a8dc6a21510692d70d47860a1bbd432c801d1860bfbbe6856756ad4c062ba601"), + v: common.FromHex("53706f7265000000000000000000000000000000000000000000000000000000"), }, { - k: libcommon.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae980000000000000001dee260551c74e3b37ed31b6e5f482a3ff9342f863a5880c9090db0cc9e002750"), - v: libcommon.FromHex("5067247f2214dca445bfb213277b5f19711e309f"), + k: common.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae980000000000000001dee260551c74e3b37ed31b6e5f482a3ff9342f863a5880c9090db0cc9e002750"), + v: common.FromHex("5067247f2214dca445bfb213277b5f19711e309f"), }, { - k: libcommon.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae980000000000000001fe59747b95e3ddbc3fd7e47a8bdf2465d2d88a030c9bd19cc3c0b7a9860c0d5f"), - v: libcommon.FromHex("01"), + k: common.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae980000000000000001fe59747b95e3ddbc3fd7e47a8bdf2465d2d88a030c9bd19cc3c0b7a9860c0d5f"), + v: common.FromHex("01"), }, } hb := NewHashBuilder(true) @@ -332,16 +332,16 @@ func TestAccountsOnly(t *testing.T) { k []byte v []byte }{ - {k: libcommon.FromHex("10002a312d2809e00f42a7f8cb0e659bddf0b4f201d24eb1b2946493cbae334c"), v: libcommon.FromHex("01")}, - {k: libcommon.FromHex("10002a412d2809e00f42a7f8cb0e659bddf0b4f201d24eb1b2946493cbae334c"), v: libcommon.FromHex("01")}, - {k: libcommon.FromHex("10002b412d2809e00f42a7f8cb0e659bddf0b4f201d24eb1b2946493cbae334c"), v: libcommon.FromHex("01")}, - {k: libcommon.FromHex("10009384e46519cbc71a22098063e5608768276f2dc212e71fd2c6c643c726c4"), v: libcommon.FromHex("01")}, - {k: libcommon.FromHex("10009484e46519cbc71a22098063e5608768276f2dc212e71fd2c6c643c726c4"), v: libcommon.FromHex("01")}, - {k: libcommon.FromHex("1000a9e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: libcommon.FromHex("01")}, - {k: libcommon.FromHex("110006a1510692d70d47860a1bbd432c801d1860bfbbe6856756ad4c062ba601"), v: libcommon.FromHex("01")}, - {k: libcommon.FromHex("120006a1510692d70d47860a1bbd432c801d1860bfbbe6856756ad4c062ba601"), v: libcommon.FromHex("01")}, - {k: libcommon.FromHex("121006a1510692d70d47860a1bbd432c801d1860bfbbe6856756ad4c062ba601"), v: libcommon.FromHex("01")}, - {k: libcommon.FromHex("200c6a21510692d70d47860a1bbd432c801d1860bfbbe6856756ad4c062ba601"), v: libcommon.FromHex("01")}, + {k: common.FromHex("10002a312d2809e00f42a7f8cb0e659bddf0b4f201d24eb1b2946493cbae334c"), v: common.FromHex("01")}, + {k: common.FromHex("10002a412d2809e00f42a7f8cb0e659bddf0b4f201d24eb1b2946493cbae334c"), v: common.FromHex("01")}, + {k: common.FromHex("10002b412d2809e00f42a7f8cb0e659bddf0b4f201d24eb1b2946493cbae334c"), v: common.FromHex("01")}, + {k: common.FromHex("10009384w46519cbc71a22098063e5608768276f2dc212e71fd2c6c643c726c4"), v: common.FromHex("01")}, + {k: common.FromHex("10009484w46519cbc71a22098063e5608768276f2dc212e71fd2c6c643c726c4"), v: common.FromHex("01")}, + {k: common.FromHex("1000a9e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: common.FromHex("01")}, + {k: common.FromHex("110006a1510692d70d47860a1bbd432c801d1860bfbbe6856756ad4c062ba601"), v: common.FromHex("01")}, + {k: common.FromHex("120006a1510692d70d47860a1bbd432c801d1860bfbbe6856756ad4c062ba601"), v: common.FromHex("01")}, + {k: common.FromHex("121006a1510692d70d47860a1bbd432c801d1860bfbbe6856756ad4c062ba601"), v: common.FromHex("01")}, + {k: common.FromHex("200c6a21510692d70d47860a1bbd432c801d1860bfbbe6856756ad4c062ba601"), v: common.FromHex("01")}, } hb := NewHashBuilder(false) var succ bytes.Buffer @@ -356,22 +356,22 @@ func TestAccountsOnly(t *testing.T) { i++ switch i { case 1: - require.Equal(t, libcommon.FromHex("0100000002"), keyHex) + require.Equal(t, common.FromHex("0100000002"), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b10000000000)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b000)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) case 2: - require.Equal(t, libcommon.FromHex("01000000"), keyHex) + require.Equal(t, common.FromHex("01000000"), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b1000000100)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b100)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) case 3: - require.Equal(t, libcommon.FromHex("01"), keyHex) + require.Equal(t, common.FromHex("01"), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b100)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b001)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) case 4: - require.Equal(t, libcommon.FromHex(""), keyHex) + require.Equal(t, common.FromHex(""), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b10)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b10)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) @@ -412,19 +412,19 @@ func TestBranchesOnly(t *testing.T) { k []byte hasTree bool }{ - {k: libcommon.FromHex("0100000002000a03"), hasTree: false}, - {k: libcommon.FromHex("0100000002000a04"), hasTree: true}, - {k: libcommon.FromHex("01000000020b"), hasTree: false}, - {k: libcommon.FromHex("010000000900000103"), hasTree: false}, - //{k:libcommon.FromHex("010000000900000104"), hasTree: false}, - //{k:libcommon.FromHex("010000000900000203"), hasTree: false}, - //{k:libcommon.FromHex("010000000900000204"), hasTree: false}, - {k: libcommon.FromHex("010000000901"), hasTree: false}, - {k: libcommon.FromHex("010000000a"), hasTree: false}, - {k: libcommon.FromHex("0101"), hasTree: false}, - {k: libcommon.FromHex("010200000a"), hasTree: false}, - {k: libcommon.FromHex("010200000b"), hasTree: false}, - {k: libcommon.FromHex("0201"), hasTree: false}, + {k: common.FromHex("0100000002000a03"), hasTree: false}, + {k: common.FromHex("0100000002000a04"), hasTree: true}, + {k: common.FromHex("01000000020b"), hasTree: false}, + {k: common.FromHex("010000000900000103"), hasTree: false}, + //{k: common.FromHex("010000000900000104"), hasTree: false}, + //{k: common.FromHex("010000000900000203"), hasTree: false}, + //{k: common.FromHex("010000000900000204"), hasTree: false}, + {k: common.FromHex("010000000901"), hasTree: false}, + {k: common.FromHex("010000000a"), hasTree: false}, + {k: common.FromHex("0101"), hasTree: false}, + {k: common.FromHex("010200000a"), hasTree: false}, + {k: common.FromHex("010200000b"), hasTree: false}, + {k: common.FromHex("0201"), hasTree: false}, } hb := NewHashBuilder(false) var succ, curr bytes.Buffer @@ -438,37 +438,37 @@ func TestBranchesOnly(t *testing.T) { i++ switch i { case 1: - require.Equal(t, libcommon.FromHex("0100000002000a"), keyHex) + require.Equal(t, common.FromHex("0100000002000a"), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b11000)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b1000)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) case 2: - require.Equal(t, libcommon.FromHex("0100000002"), keyHex) + require.Equal(t, common.FromHex("0100000002"), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b100000000000)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b1)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) case 3: - require.Equal(t, libcommon.FromHex("0100000009"), keyHex) + require.Equal(t, common.FromHex("0100000009"), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b10)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b0)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) case 4: - require.Equal(t, libcommon.FromHex("01000000"), keyHex) + require.Equal(t, common.FromHex("01000000"), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b11000000100)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b01000000100)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) case 5: - require.Equal(t, libcommon.FromHex("01020000"), keyHex) + require.Equal(t, common.FromHex("01020000"), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b110000000000)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b0)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) case 6: - require.Equal(t, libcommon.FromHex("01"), keyHex) + require.Equal(t, common.FromHex("01"), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b10)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b101)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) case 7: - require.Equal(t, libcommon.FromHex(""), keyHex) + require.Equal(t, common.FromHex(""), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b10)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b10)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) @@ -500,28 +500,28 @@ func TestBranchesOnly(t *testing.T) { } func TestStorageOnly(t *testing.T) { - //acc :=libcommon.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae980000000000000001") + //acc := common.FromHex("fff9c1aa5884f1130301f60f98419b9d4217bc4ab65a2976b41e9a00bbceae980000000000000001") keys := []struct { k []byte v []byte }{ { - k: libcommon.FromHex("500020e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: libcommon.FromHex("01"), + k: common.FromHex("500020e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: common.FromHex("01"), }, { - k: libcommon.FromHex("500021e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: libcommon.FromHex("01"), + k: common.FromHex("500021e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: common.FromHex("01"), }, { - k: libcommon.FromHex("500027e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: libcommon.FromHex("01"), + k: common.FromHex("500027e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: common.FromHex("01"), }, { - k: libcommon.FromHex("5000979e93fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: libcommon.FromHex("01"), + k: common.FromHex("5000979e93fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: common.FromHex("01"), }, { - k: libcommon.FromHex("5000a7e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: libcommon.FromHex("01"), + k: common.FromHex("5000a7e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: common.FromHex("01"), }, { - k: libcommon.FromHex("600a79e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: libcommon.FromHex("01"), + k: common.FromHex("600a79e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: common.FromHex("01"), }, } hb := NewHashBuilder(false) @@ -537,17 +537,17 @@ func TestStorageOnly(t *testing.T) { i++ switch i { case 1: - require.Equal(t, libcommon.FromHex("05000000"), keyHex) + require.Equal(t, common.FromHex("05000000"), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b100)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b0)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) case 3: - require.Equal(t, libcommon.FromHex("05000000"), keyHex) + require.Equal(t, common.FromHex("05000000"), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b100)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b000)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) case 4: - require.Equal(t, libcommon.FromHex(""), keyHex) + require.Equal(t, common.FromHex(""), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b0)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b100000)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) @@ -595,15 +595,15 @@ func TestStorageWithoutBranchNodeInRoot(t *testing.T) { hasTree bool }{ { - k: libcommon.FromHex("500020"), + k: common.FromHex("500020"), hasTree: true, }, { - k: libcommon.FromHex("500021"), + k: common.FromHex("500021"), hasTree: false, }, { - k: libcommon.FromHex("500027"), + k: common.FromHex("500027"), hasTree: false, }, } @@ -615,13 +615,13 @@ func TestStorageWithoutBranchNodeInRoot(t *testing.T) { i++ switch i { case 1: - require.Equal(t, libcommon.FromHex("0500000002"), keyHex) + require.Equal(t, common.FromHex("0500000002"), keyHex) //require.Equal(t, fmt.Sprintf("%b", uint16(0b10000011)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b10000011)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b1)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) case 2: - require.Equal(t, libcommon.FromHex(""), keyHex) + require.Equal(t, common.FromHex(""), keyHex) require.Equal(t, fmt.Sprintf("%b", uint16(0b0)), fmt.Sprintf("%b", hasHash)) require.Equal(t, fmt.Sprintf("%b", uint16(0b100000)), fmt.Sprintf("%b", hasTree)) require.NotNil(t, hashes) @@ -671,32 +671,32 @@ func Test2(t *testing.T) { v []byte }{ { - k: libcommon.FromHex("000000"), - v: libcommon.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), + k: common.FromHex("000000"), + v: common.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), }, { - k: libcommon.FromHex("000001"), - v: libcommon.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), + k: common.FromHex("000001"), + v: common.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), }, { - k: libcommon.FromHex("000009"), - v: libcommon.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), + k: common.FromHex("000009"), + v: common.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), }, //{ - // k:libcommon.FromHex("000010"), - // v:libcommon.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), + // k: common.FromHex("000010"), + // v: common.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), //}, //{ - // k:libcommon.FromHex("000020"), - // v:libcommon.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), + // k: common.FromHex("000020"), + // v: common.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), //}, { - k: libcommon.FromHex("01"), - v: libcommon.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), + k: common.FromHex("01"), + v: common.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), }, { - k: libcommon.FromHex("02"), - v: libcommon.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), + k: common.FromHex("02"), + v: common.FromHex("0100000000000000000000000000000000000000000000000000000000000000"), }, } hb := NewHashBuilder(false) diff --git a/erigon-lib/trie/sub_trie_loader.go b/turbo/trie/sub_trie_loader.go similarity index 100% rename from erigon-lib/trie/sub_trie_loader.go rename to turbo/trie/sub_trie_loader.go diff --git a/erigon-lib/trie/trie.go b/turbo/trie/trie.go similarity index 99% rename from erigon-lib/trie/trie.go rename to turbo/trie/trie.go index 5fb5c9e7dd9..09686362c77 100644 --- a/erigon-lib/trie/trie.go +++ b/turbo/trie/trie.go @@ -28,7 +28,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" + "github.com/erigontech/erigon/ethdb" ) var ( @@ -333,7 +334,7 @@ func (t *Trie) UpdateAccountCode(key []byte, code codeNode) error { accNode, gotValue := t.getAccount(t.root, hex, 0) if accNode == nil || !gotValue { - return fmt.Errorf("account not found with key: %x", key) + return fmt.Errorf("account not found with key: %x, %w", key, ethdb.ErrKeyNotFound) } actualCodeHash := crypto.Keccak256(code) @@ -359,7 +360,7 @@ func (t *Trie) UpdateAccountCodeSize(key []byte, codeSize int) error { accNode, gotValue := t.getAccount(t.root, hex, 0) if accNode == nil || !gotValue { - return fmt.Errorf("account not found with key: %x", key) + return fmt.Errorf("account not found with key: %x, %w", key, ethdb.ErrKeyNotFound) } accNode.codeSize = codeSize diff --git a/erigon-lib/trie/trie_root.go b/turbo/trie/trie_root.go similarity index 99% rename from erigon-lib/trie/trie_root.go rename to turbo/trie/trie_root.go index 6ec60f00a2b..fe89780a437 100644 --- a/erigon-lib/trie/trie_root.go +++ b/turbo/trie/trie_root.go @@ -32,8 +32,8 @@ import ( "github.com/erigontech/erigon-lib/kv" dbutils2 "github.com/erigontech/erigon-lib/kv/dbutils" - "github.com/erigontech/erigon-lib/rlphacks" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" + "github.com/erigontech/erigon/turbo/rlphacks" ) /* @@ -127,6 +127,7 @@ type RootHashAggregator struct { curr bytes.Buffer // Current key for the structure generation algorithm, as well as the input tape for the hash builder succ bytes.Buffer currAccK []byte + value []byte // Current value to be used as the value tape for the hash builder hadTreeAcc bool groups []uint16 // `groups` parameter is the map of the stack. each element of the `groups` slice is a bitmask, one bit per element currently on the stack. See `GenStructStep` docs hasTree []uint16 diff --git a/erigon-lib/trie/trie_test.go b/turbo/trie/trie_test.go similarity index 99% rename from erigon-lib/trie/trie_test.go rename to turbo/trie/trie_test.go index f3e1b85dcd4..9c5de2abd13 100644 --- a/erigon-lib/trie/trie_test.go +++ b/turbo/trie/trie_test.go @@ -33,8 +33,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon/core/types/accounts" + "github.com/erigontech/erigon/rlp" ) func init() { @@ -631,7 +632,7 @@ func TestNextSubtreeHex(t *testing.T) { } for _, tc := range cases { - res := isDenseSequence(libcommon.FromHex(tc.prev), libcommon.FromHex(tc.next)) + res := isDenseSequence(common.FromHex(tc.prev), common.FromHex(tc.next)) assert.Equal(tc.expect, res, "%s, %s", tc.prev, tc.next) } } diff --git a/erigon-lib/trie/trie_transform.go b/turbo/trie/trie_transform.go similarity index 94% rename from erigon-lib/trie/trie_transform.go rename to turbo/trie/trie_transform.go index 17e9e0be57d..ff1d15a2324 100644 --- a/erigon-lib/trie/trie_transform.go +++ b/turbo/trie/trie_transform.go @@ -18,12 +18,12 @@ package trie import ( "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/types/accounts" + "github.com/erigontech/erigon/core/types/accounts" ) -type keyTransformFunc func([]byte) []byte //nolint +type keyTransformFunc func([]byte) []byte -func transformSubTrie(nd node, hex []byte, newTrie *Trie, transformFunc keyTransformFunc) { //nolint +func transformSubTrie(nd node, hex []byte, newTrie *Trie, transformFunc keyTransformFunc) { switch n := nd.(type) { case nil: return diff --git a/erigon-lib/trie/utils.go b/turbo/trie/utils.go similarity index 100% rename from erigon-lib/trie/utils.go rename to turbo/trie/utils.go diff --git a/erigon-lib/trie/vtree/verkle_utils.go b/turbo/trie/vtree/verkle_utils.go similarity index 100% rename from erigon-lib/trie/vtree/verkle_utils.go rename to turbo/trie/vtree/verkle_utils.go diff --git a/erigon-lib/trie/vtree/verkle_utils_test.go b/turbo/trie/vtree/verkle_utils_test.go similarity index 100% rename from erigon-lib/trie/vtree/verkle_utils_test.go rename to turbo/trie/vtree/verkle_utils_test.go diff --git a/txnprovider/txpool/fetch.go b/txnprovider/txpool/fetch.go index 2277381620d..21838e85798 100644 --- a/txnprovider/txpool/fetch.go +++ b/txnprovider/txpool/fetch.go @@ -33,7 +33,7 @@ import ( sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - rlp "github.com/erigontech/erigon-lib/rlp2" + "github.com/erigontech/erigon-lib/rlp" ) // Fetch connects to sentry and implements eth/66 protocol regarding the transaction diff --git a/txnprovider/txpool/pool_fuzz_test.go b/txnprovider/txpool/pool_fuzz_test.go index fbdbc860f19..4f90167f48c 100644 --- a/txnprovider/txpool/pool_fuzz_test.go +++ b/txnprovider/txpool/pool_fuzz_test.go @@ -39,7 +39,7 @@ import ( "github.com/erigontech/erigon-lib/kv/memdb" "github.com/erigontech/erigon-lib/kv/temporal/temporaltest" "github.com/erigontech/erigon-lib/log/v3" - rlp "github.com/erigontech/erigon-lib/rlp2" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg" ) diff --git a/txnprovider/txpool/pool_txn_packets.go b/txnprovider/txpool/pool_txn_packets.go index 26dec533275..25cf5a28c4a 100644 --- a/txnprovider/txpool/pool_txn_packets.go +++ b/txnprovider/txpool/pool_txn_packets.go @@ -22,7 +22,7 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/length" - rlp "github.com/erigontech/erigon-lib/rlp2" + "github.com/erigontech/erigon-lib/rlp" ) type NewPooledTransactionHashesPacket [][length.Hash]byte diff --git a/txnprovider/txpool/pool_txn_parser.go b/txnprovider/txpool/pool_txn_parser.go index 274ef637999..645658a6312 100644 --- a/txnprovider/txpool/pool_txn_parser.go +++ b/txnprovider/txpool/pool_txn_parser.go @@ -34,7 +34,7 @@ import ( "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" - rlp "github.com/erigontech/erigon-lib/rlp2" + "github.com/erigontech/erigon-lib/rlp" ) const ( diff --git a/txnprovider/txpool/send.go b/txnprovider/txpool/send.go index 52b16c0e542..f5e25f1c75c 100644 --- a/txnprovider/txpool/send.go +++ b/txnprovider/txpool/send.go @@ -28,7 +28,7 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/p2p/sentry" - rlp "github.com/erigontech/erigon-lib/rlp2" + "github.com/erigontech/erigon-lib/rlp" ) // Send - does send concrete P2P messages to Sentry. Same as Fetch but for outbound traffic From 002d9a2227427cf41b9e1c320fce3290331b0dab Mon Sep 17 00:00:00 2001 From: lystopad Date: Thu, 28 Nov 2024 17:39:24 +0100 Subject: [PATCH 05/25] Update ci-cd-main-branch-docker-images.yml (#12904) We agreed to get rid of regular kurtosis tests in docker image build workflow. This change should unlock our routine docker image builds. --- .../ci-cd-main-branch-docker-images.yml | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/.github/workflows/ci-cd-main-branch-docker-images.yml b/.github/workflows/ci-cd-main-branch-docker-images.yml index 2fbb28b0d2a..fd40202ffff 100644 --- a/.github/workflows/ci-cd-main-branch-docker-images.yml +++ b/.github/workflows/ci-cd-main-branch-docker-images.yml @@ -20,19 +20,9 @@ on: workflow_dispatch: jobs: - define_matrix: - runs-on: ubuntu-latest - outputs: - os: ${{ steps.os.outputs.os }} - - steps: - - name: Define os - id: os - run: echo 'os=ubuntu-latest' >> "$GITHUB_OUTPUT" Build: - needs: define_matrix - runs-on: ${{ needs.define_matrix.outputs.os }} + runs-on: ubuntu-latest timeout-minutes: 45 outputs: docker_build_tag: ${{ steps.built_tag_export.outputs.docker_build_tag }} @@ -167,11 +157,3 @@ jobs: fi echo "Done." done - - run-kurtosis-assertoor: - needs: [define_matrix, Build] - uses: erigontech/erigon/.github/workflows/test-kurtosis-assertoor.yml@main - with: - checkout_ref: ${{ github.sha }} - os: ${{ needs.define_matrix.outputs.os }} - docker_build_tag: ${{ needs.Build.outputs.docker_build_tag }} From 9474ca4ac0fb31c5c1dfbb9ad2559ff8168aa1a2 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Fri, 29 Nov 2024 10:33:44 +0700 Subject: [PATCH 06/25] increase receipt cache and make it configurable (#12862) --- README.md | 2 +- cmd/rpcdaemon/test.http | 3 +- core/types/receipt.go | 8 ++++ eth/protocols/eth/handler_test.go | 2 +- .../sentry_multi_client.go | 2 +- turbo/jsonrpc/eth_api.go | 8 ++-- turbo/jsonrpc/eth_receipts.go | 1 - .../receipts/bor_receipts_generator.go | 6 +-- turbo/jsonrpc/receipts/receipts_generator.go | 47 ++++++++++++++----- turbo/stages/mock/mock_sentry.go | 2 +- 10 files changed, 55 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index cc704e6a28f..65d6aa75c67 100644 --- a/README.md +++ b/README.md @@ -207,7 +207,7 @@ du -hsc /erigon/snapshots/* - **Store most of data in immutable files (segments/snapshots):** - can symlink/mount latest state to fast drive and history to cheap drive - `chaindata` is less than `15gb`. It's ok to `rm -rf chaindata`. (to prevent grow: recommend `--batchSize <= 1G`) -- **`--prune` flags changed**: see `--prune.mode` (default: `archive`, full: `full`, EIP-4444: `minimal`) +- **`--prune` flags changed**: see `--prune.mode` (default: `full`, archive: `archive`, EIP-4444: `minimal`) - **Other changes:** - ExecutionStage included many E2 stages: stage_hash_state, stage_trie, log_index, history_index, trace_index - Restart doesn't loose much partial progress: `--sync.loop.block.limit=5_000` enabled by default diff --git a/cmd/rpcdaemon/test.http b/cmd/rpcdaemon/test.http index 929031c4ead..3a676aaaf3a 100644 --- a/cmd/rpcdaemon/test.http +++ b/cmd/rpcdaemon/test.http @@ -105,7 +105,8 @@ Content-Type: application/json ### -# curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber", "params": ["0x1b4", true], "id":1}' localhost:8545 + +# curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber", "params": ["0x141F644", true], "id":1}' localhost:8545 POST localhost:8545 Content-Type: application/json diff --git a/core/types/receipt.go b/core/types/receipt.go index 4cbd9af12fd..f77daa38b31 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -352,6 +352,14 @@ type Receipts []*Receipt // Len returns the number of receipts in this list. func (rs Receipts) Len() int { return len(rs) } +func (rs Receipts) Copy() Receipts { + rsCopy := make(Receipts, 0, rs.Len()) + for _, r := range rs { + rsCopy = append(rsCopy, r.Copy()) + } + return rsCopy +} + // EncodeIndex encodes the i'th receipt to w. func (rs Receipts) EncodeIndex(i int, w *bytes.Buffer) { r := rs[i] diff --git a/eth/protocols/eth/handler_test.go b/eth/protocols/eth/handler_test.go index 700f5d15172..90923dfd169 100644 --- a/eth/protocols/eth/handler_test.go +++ b/eth/protocols/eth/handler_test.go @@ -91,7 +91,7 @@ func TestGetBlockReceipts(t *testing.T) { } // Assemble the test environment m := mockWithGenerator(t, 4, generator) - receiptsGetter := receipts.NewGenerator(32, m.BlockReader, m.Engine) + receiptsGetter := receipts.NewGenerator(m.BlockReader, m.Engine) // Collect the hashes to request, and the response to expect var ( hashes []libcommon.Hash diff --git a/p2p/sentry/sentry_multi_client/sentry_multi_client.go b/p2p/sentry/sentry_multi_client/sentry_multi_client.go index f4aace8590e..21f6d5c6707 100644 --- a/p2p/sentry/sentry_multi_client/sentry_multi_client.go +++ b/p2p/sentry/sentry_multi_client/sentry_multi_client.go @@ -226,7 +226,7 @@ func NewMultiClient( disableBlockDownload: disableBlockDownload, logger: logger, getReceiptsActiveGoroutineNumber: semaphore.NewWeighted(1), - ethApiWrapper: receipts.NewGenerator(32, blockReader, engine), + ethApiWrapper: receipts.NewGenerator(blockReader, engine), } return cs, nil diff --git a/turbo/jsonrpc/eth_api.go b/turbo/jsonrpc/eth_api.go index 5a1c7ac617e..94a5e53ddb2 100644 --- a/turbo/jsonrpc/eth_api.go +++ b/turbo/jsonrpc/eth_api.go @@ -149,13 +149,11 @@ type BaseAPI struct { func NewBaseApi(f *rpchelper.Filters, stateCache kvcache.Cache, blockReader services.FullBlockReader, singleNodeMode bool, evmCallTimeout time.Duration, engine consensus.EngineReader, dirs datadir.Dirs, bridgeReader bridgeReader) *BaseAPI { var ( - blocksLRUSize = 128 // ~32Mb - receiptsCacheLimit = 32 + blocksLRUSize = 128 // ~32Mb ) // if RPCDaemon deployed as independent process: increase cache sizes if !singleNodeMode { blocksLRUSize *= 5 - receiptsCacheLimit *= 5 } blocksLRU, err := lru.New[common.Hash, *types.Block](blocksLRUSize) if err != nil { @@ -170,8 +168,8 @@ func NewBaseApi(f *rpchelper.Filters, stateCache kvcache.Cache, blockReader serv _txnReader: blockReader, evmCallTimeout: evmCallTimeout, _engine: engine, - receiptsGenerator: receipts.NewGenerator(receiptsCacheLimit, blockReader, engine), - borReceiptGenerator: receipts.NewBorGenerator(receiptsCacheLimit, blockReader, engine), + receiptsGenerator: receipts.NewGenerator(blockReader, engine), + borReceiptGenerator: receipts.NewBorGenerator(blockReader, engine), dirs: dirs, useBridgeReader: bridgeReader != nil && !reflect.ValueOf(bridgeReader).IsNil(), // needed for interface nil caveat bridgeReader: bridgeReader, diff --git a/turbo/jsonrpc/eth_receipts.go b/turbo/jsonrpc/eth_receipts.go index 2c2677d3145..92066aaf4a4 100644 --- a/turbo/jsonrpc/eth_receipts.go +++ b/turbo/jsonrpc/eth_receipts.go @@ -22,7 +22,6 @@ import ( "fmt" "github.com/RoaringBitmap/roaring" - "github.com/erigontech/erigon-lib/chain" "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" diff --git a/turbo/jsonrpc/receipts/bor_receipts_generator.go b/turbo/jsonrpc/receipts/bor_receipts_generator.go index 6838e6c54e4..5e950043fe2 100644 --- a/turbo/jsonrpc/receipts/bor_receipts_generator.go +++ b/turbo/jsonrpc/receipts/bor_receipts_generator.go @@ -27,9 +27,9 @@ type BorGenerator struct { engine consensus.EngineReader } -func NewBorGenerator(cacheSize int, blockReader services.FullBlockReader, +func NewBorGenerator(blockReader services.FullBlockReader, engine consensus.EngineReader) *BorGenerator { - receiptCache, err := lru.New[libcommon.Hash, *types.Receipt](cacheSize) + receiptCache, err := lru.New[libcommon.Hash, *types.Receipt](receiptsCacheLimit) if err != nil { panic(err) } @@ -62,7 +62,7 @@ func (g *BorGenerator) GenerateBorReceipt(ctx context.Context, tx kv.Tx, block * return nil, err } - g.receiptCache.Add(block.Hash(), receipt) + g.receiptCache.Add(block.Hash(), receipt.Copy()) return receipt, nil } diff --git a/turbo/jsonrpc/receipts/receipts_generator.go b/turbo/jsonrpc/receipts/receipts_generator.go index ff9c7ca9a2b..4848ef0e6f4 100644 --- a/turbo/jsonrpc/receipts/receipts_generator.go +++ b/turbo/jsonrpc/receipts/receipts_generator.go @@ -4,10 +4,9 @@ import ( "context" "fmt" - lru "github.com/hashicorp/golang-lru/v2" - "github.com/erigontech/erigon-lib/chain" "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/dbg" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/rawdbv3" "github.com/erigontech/erigon-lib/log/v3" @@ -19,12 +18,15 @@ import ( "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks" "github.com/erigontech/erigon/turbo/transactions" + lru "github.com/hashicorp/golang-lru/v2" ) type Generator struct { - receiptsCache *lru.Cache[common.Hash, []*types.Receipt] - blockReader services.FullBlockReader - engine consensus.EngineReader + receiptsCache *lru.Cache[common.Hash, types.Receipts] + receiptsCacheTrace bool + + blockReader services.FullBlockReader + engine consensus.EngineReader } type ReceiptEnv struct { @@ -37,20 +39,33 @@ type ReceiptEnv struct { header *types.Header } -func NewGenerator(cacheSize int, blockReader services.FullBlockReader, - engine consensus.EngineReader) *Generator { - receiptsCache, err := lru.New[common.Hash, []*types.Receipt](cacheSize) +var ( + receiptsCacheLimit = dbg.EnvInt("R_LRU", 1024) //ethmainnet: 1K receipts is ~200mb RAM + receiptsCacheTrace = dbg.EnvBool("R_LRU_TRACE", false) +) + +func NewGenerator(blockReader services.FullBlockReader, engine consensus.EngineReader) *Generator { + receiptsCache, err := lru.New[common.Hash, types.Receipts](receiptsCacheLimit) if err != nil { panic(err) } return &Generator{ - receiptsCache: receiptsCache, - blockReader: blockReader, - engine: engine, + receiptsCache: receiptsCache, + blockReader: blockReader, + engine: engine, + receiptsCacheTrace: receiptsCacheTrace, } } +func (g *Generator) LogStats() { + if g == nil || !g.receiptsCacheTrace { + return + } + //m := g.receiptsCache.Metrics() + //log.Warn("[dbg] ReceiptsCache", "hit", m.Hits, "total", m.Hits+m.Misses, "Collisions", m.Collisions, "Evictions", m.Evictions, "Inserts", m.Inserts, "limit", receiptsCacheLimit, "ratio", fmt.Sprintf("%.2f", float64(m.Hits)/float64(m.Hits+m.Misses))) +} + func (g *Generator) GetCachedReceipts(ctx context.Context, blockHash common.Hash) (types.Receipts, bool) { return g.receiptsCache.Get(blockHash) } @@ -87,7 +102,15 @@ func (g *Generator) PrepareEnv(ctx context.Context, block *types.Block, cfg *cha }, nil } +func (g *Generator) addToCache(header *types.Header, receipts types.Receipts) { + g.receiptsCache.Add(header.Hash(), receipts.Copy()) +} + func (g *Generator) GetReceipt(ctx context.Context, cfg *chain.Config, tx kv.Tx, block *types.Block, index int, optimize bool) (*types.Receipt, error) { + if receipts, ok := g.receiptsCache.Get(block.Hash()); ok && len(receipts) > index { + return receipts[index], nil + } + var receipt *types.Receipt if optimize { genEnv, err := g.PrepareEnv(ctx, block, cfg, tx, index) @@ -142,6 +165,6 @@ func (g *Generator) GetReceipts(ctx context.Context, cfg *chain.Config, tx kv.Tx receipts[i] = receipt } - g.receiptsCache.Add(block.Hash(), receipts) + g.addToCache(block.HeaderNoCopy(), receipts) return receipts, nil } diff --git a/turbo/stages/mock/mock_sentry.go b/turbo/stages/mock/mock_sentry.go index e7790887f6f..cf9947b83b3 100644 --- a/turbo/stages/mock/mock_sentry.go +++ b/turbo/stages/mock/mock_sentry.go @@ -313,7 +313,7 @@ func MockWithEverything(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateK PeerId: gointerfaces.ConvertHashToH512([64]byte{0x12, 0x34, 0x50}), // "12345" BlockSnapshots: allSnapshots, BlockReader: br, - ReceiptsReader: receipts.NewGenerator(16, br, engine), + ReceiptsReader: receipts.NewGenerator(br, engine), HistoryV3: true, } From 59e274cd82efd9ce23e027273a6b55a892a51859 Mon Sep 17 00:00:00 2001 From: sudeep Date: Fri, 29 Nov 2024 13:10:35 +0530 Subject: [PATCH 07/25] tiny refactor (#12909) --- erigon-lib/kv/tables.go | 2 +- turbo/snapshotsync/caplin_state_snapshots.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erigon-lib/kv/tables.go b/erigon-lib/kv/tables.go index 1920e06331a..505023cc39c 100644 --- a/erigon-lib/kv/tables.go +++ b/erigon-lib/kv/tables.go @@ -402,7 +402,7 @@ const ( // Erigon-CL Objects - // [slot] => [signature + block without execution payload] + // [slot + block root] => [signature + block without execution payload] BeaconBlocks = "BeaconBlock" EffectiveBalancesDump = "EffectiveBalancesDump" diff --git a/turbo/snapshotsync/caplin_state_snapshots.go b/turbo/snapshotsync/caplin_state_snapshots.go index 48bc93cc693..8cd6f6c1350 100644 --- a/turbo/snapshotsync/caplin_state_snapshots.go +++ b/turbo/snapshotsync/caplin_state_snapshots.go @@ -81,7 +81,7 @@ func getKvGetterForStateTable(db kv.RoDB, tableName string) KeyValueGetter { var err error if err := db.View(context.TODO(), func(tx kv.Tx) error { key = base_encoding.Encode64ToBytes4(numId) - value, err = tx.GetOne(tableName, base_encoding.Encode64ToBytes4(numId)) + value, err = tx.GetOne(tableName, key) value = libcommon.Copy(value) return err }); err != nil { From 54e8ddbe89e83164e5b8dcd688e74bbfd53f13e0 Mon Sep 17 00:00:00 2001 From: awskii Date: Fri, 29 Nov 2024 09:44:01 +0000 Subject: [PATCH 08/25] commitment: reuse pre-allocated buffer for hash computation (#12812) Co-authored-by: alex.sharov --- erigon-lib/commitment/hex_patricia_hashed.go | 87 +++++++------------- 1 file changed, 32 insertions(+), 55 deletions(-) diff --git a/erigon-lib/commitment/hex_patricia_hashed.go b/erigon-lib/commitment/hex_patricia_hashed.go index 618dae69781..bc1e9ac504a 100644 --- a/erigon-lib/commitment/hex_patricia_hashed.go +++ b/erigon-lib/commitment/hex_patricia_hashed.go @@ -765,62 +765,44 @@ func (hph *HexPatriciaHashed) computeCellHash(cell *cell, depth int, buf []byte) cell.hashedExtension[64-hashedKeyOffset] = 16 // Add terminator if cell.stateHashLen > 0 { - res := append([]byte{160}, cell.stateHash[:cell.stateHashLen]...) hph.keccak.Reset() if hph.trace { - fmt.Printf("REUSED stateHash %x spk %x\n", res, cell.storageAddr[:cell.storageAddrLen]) + fmt.Printf("REUSED stateHash %x spk %x\n", cell.stateHash[:cell.stateHashLen], cell.storageAddr[:cell.storageAddrLen]) } mxTrieStateSkipRate.Inc() skippedLoad.Add(1) if !singleton { - return res, nil - } else { - storageRootHashIsSet = true - storageRootHash = *(*[length.Hash]byte)(res[1:]) - //copy(storageRootHash[:], res[1:]) - //cell.stateHashLen = 0 + return append([]byte{160}, cell.stateHash[:cell.stateHashLen]...), nil } + storageRootHashIsSet = true + storageRootHash = *(*[length.Hash]byte)(cell.stateHash[:cell.stateHashLen]) } else { if !cell.loaded.storage() { - update, err := hph.ctx.Storage(cell.storageAddr[:cell.storageAddrLen]) - if err != nil { - return nil, err - } - cell.setFromUpdate(update) - fmt.Printf("Storage %x was not loaded\n", cell.storageAddr[:cell.storageAddrLen]) + return nil, fmt.Errorf("storage %x was not loaded as expected: cell %v", cell.storageAddr[:cell.storageAddrLen], cell.String()) + // update, err := hph.ctx.Storage(cell.storageAddr[:cell.storageAddrLen]) + // if err != nil { + // return nil, err + // } + // cell.setFromUpdate(update) } - if singleton { - if hph.trace { - fmt.Printf("leafHashWithKeyVal(singleton) for [%x]=>[%x]\n", cell.hashedExtension[:64-hashedKeyOffset+1], cell.Storage[:cell.StorageLen]) - } - aux := make([]byte, 0, 33) - if aux, err = hph.leafHashWithKeyVal(aux, cell.hashedExtension[:64-hashedKeyOffset+1], cell.Storage[:cell.StorageLen], true); err != nil { - return nil, err - } - if hph.trace { - fmt.Printf("leafHashWithKeyVal(singleton) storage hash [%x]\n", aux) - } - storageRootHash = *(*[length.Hash]byte)(aux[1:]) - storageRootHashIsSet = true - cell.stateHashLen = 0 - hadToReset.Add(1) - } else { - if hph.trace { - fmt.Printf("leafHashWithKeyVal for [%x]=>[%x] %v\n", cell.hashedExtension[:64-hashedKeyOffset+1], cell.Storage[:cell.StorageLen], cell.String()) - } - leafHash, err := hph.leafHashWithKeyVal(buf, cell.hashedExtension[:64-hashedKeyOffset+1], cell.Storage[:cell.StorageLen], false) - if err != nil { - return nil, err - } + leafHash, err := hph.leafHashWithKeyVal(buf, cell.hashedExtension[:64-hashedKeyOffset+1], cell.Storage[:cell.StorageLen], singleton) + if err != nil { + return nil, err + } + if hph.trace { + fmt.Printf("leafHashWithKeyVal(singleton=%t) {%x} for [%x]=>[%x] %v\n", + singleton, leafHash, cell.hashedExtension[:64-hashedKeyOffset+1], cell.Storage[:cell.StorageLen], cell.String()) + } + if !singleton { copy(cell.stateHash[:], leafHash[1:]) cell.stateHashLen = len(leafHash) - 1 - if hph.trace { - fmt.Printf("STATE HASH storage memoized %x spk %x\n", leafHash, cell.storageAddr[:cell.storageAddrLen]) - } - return leafHash, nil } + storageRootHash = *(*[length.Hash]byte)(leafHash[1:]) + storageRootHashIsSet = true + cell.stateHashLen = 0 + hadToReset.Add(1) } } if cell.accountAddrLen > 0 { @@ -852,15 +834,14 @@ func (hph *HexPatriciaHashed) computeCellHash(cell *cell, depth int, buf []byte) } if !cell.loaded.account() { if cell.stateHashLen > 0 { - res := append([]byte{160}, cell.stateHash[:cell.stateHashLen]...) hph.keccak.Reset() mxTrieStateSkipRate.Inc() skippedLoad.Add(1) if hph.trace { - fmt.Printf("REUSED stateHash %x apk %x\n", res, cell.accountAddr[:cell.accountAddrLen]) + fmt.Printf("REUSED stateHash %x apk %x\n", cell.stateHash[:cell.stateHashLen], cell.accountAddr[:cell.accountAddrLen]) } - return res, nil + return append([]byte{160}, cell.stateHash[:cell.stateHashLen]...), nil } // storage root update or extension update could invalidate older stateHash, so we need to reload state update, err := hph.ctx.Account(cell.accountAddr[:cell.accountAddrLen]) @@ -872,19 +853,16 @@ func (hph *HexPatriciaHashed) computeCellHash(cell *cell, depth int, buf []byte) var valBuf [128]byte valLen := cell.accountForHashing(valBuf[:], storageRootHash) - if hph.trace { - fmt.Printf("accountLeafHashWithKey for [%x]=>[%x]\n", cell.hashedExtension[:65-depth], rlp.RlpEncodedBytes(valBuf[:valLen])) - } - leafHash, err := hph.accountLeafHashWithKey(buf, cell.hashedExtension[:65-depth], rlp.RlpEncodedBytes(valBuf[:valLen])) + buf, err = hph.accountLeafHashWithKey(buf, cell.hashedExtension[:65-depth], rlp.RlpEncodedBytes(valBuf[:valLen])) if err != nil { return nil, err } if hph.trace { - fmt.Printf("STATE HASH account memoized %x\n", leafHash) + fmt.Printf("accountLeafHashWithKey {%x} (memorised) for [%x]=>[%x]\n", buf, cell.hashedExtension[:65-depth], rlp.RlpEncodedBytes(valBuf[:valLen])) } - copy(cell.stateHash[:], leafHash[1:]) - cell.stateHashLen = len(leafHash) - 1 - return leafHash, nil + copy(cell.stateHash[:], buf[1:]) + cell.stateHashLen = len(buf) - 1 + return buf, nil } buf = append(buf, 0x80+32) @@ -893,11 +871,10 @@ func (hph *HexPatriciaHashed) computeCellHash(cell *cell, depth int, buf []byte) if hph.trace { fmt.Printf("extensionHash for [%x]=>[%x]\n", cell.extension[:cell.extLen], cell.hash[:cell.hashLen]) } - var hash [length.Hash]byte - if hash, err = hph.extensionHash(cell.extension[:cell.extLen], cell.hash[:cell.hashLen]); err != nil { + if storageRootHash, err = hph.extensionHash(cell.extension[:cell.extLen], cell.hash[:cell.hashLen]); err != nil { return nil, err } - buf = append(buf, hash[:]...) + buf = append(buf, storageRootHash[:]...) } else { return nil, errors.New("computeCellHash extension without hash") } From 42e96b9c75757ac1f30c89bc47206e93e21aaf20 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Fri, 29 Nov 2024 17:02:54 +0700 Subject: [PATCH 09/25] hashKey: escape analysis (#12911) seems `hashKey` didn't pass escape analysis and highlited by pprof --- erigon-lib/commitment/hex_patricia_hashed.go | 24 ++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/erigon-lib/commitment/hex_patricia_hashed.go b/erigon-lib/commitment/hex_patricia_hashed.go index bc1e9ac504a..35aa15b2ef7 100644 --- a/erigon-lib/commitment/hex_patricia_hashed.go +++ b/erigon-lib/commitment/hex_patricia_hashed.go @@ -117,6 +117,9 @@ type cell struct { stateHashLen int // stateHash length, if > 0 can reuse loaded loadFlags // folded Cell have only hash, unfolded have all fields Update // state update + + // temporary buffers + hashBuf [length.Hash]byte } type loadFlags uint8 @@ -163,6 +166,14 @@ var ( EmptyCodeHashArray = *(*[length.Hash]byte)(EmptyCodeHash) ) +func (cell *cell) hashAccKey(keccak keccakState, depth int) error { + return hashKey(keccak, cell.accountAddr[:cell.accountAddrLen], cell.hashedExtension[:], depth, cell.hashBuf[:]) +} + +func (cell *cell) hashStorageKey(keccak keccakState, accountKeyLen, downOffset int, hashedKeyOffset int) error { + return hashKey(keccak, cell.storageAddr[accountKeyLen:cell.storageAddrLen], cell.hashedExtension[downOffset:], hashedKeyOffset, cell.hashBuf[:]) +} + func (cell *cell) reset() { cell.accountAddrLen = 0 cell.storageAddrLen = 0 @@ -345,10 +356,9 @@ func (cell *cell) fillFromLowerCell(lowCell *cell, lowDepth int, preExtension [] cell.loaded = lowCell.loaded } -func hashKey(keccak keccakState, plainKey []byte, dest []byte, hashedKeyOffset int) error { +func hashKey(keccak keccakState, plainKey []byte, dest []byte, hashedKeyOffset int, hashBuf []byte) error { + _, _ = hashBuf[length.Hash-1], dest[length.Hash*2-1] // bounds checks elimination keccak.Reset() - var hashBufBack [length.Hash]byte - hashBuf := hashBufBack[:] if _, err := keccak.Write(plainKey); err != nil { return err } @@ -393,7 +403,7 @@ func (cell *cell) deriveHashedKeys(depth int, keccak keccakState, accountKeyLen cell.hashedExtLen = min(extraLen+cell.hashedExtLen, len(cell.hashedExtension)) var hashedKeyOffset, downOffset int if cell.accountAddrLen > 0 { - if err := hashKey(keccak, cell.accountAddr[:cell.accountAddrLen], cell.hashedExtension[:], depth); err != nil { + if err := cell.hashAccKey(keccak, depth); err != nil { return err } downOffset = 64 - depth @@ -405,7 +415,7 @@ func (cell *cell) deriveHashedKeys(depth int, keccak keccakState, accountKeyLen if depth == 0 { accountKeyLen = 0 } - if err := hashKey(keccak, cell.storageAddr[accountKeyLen:cell.storageAddrLen], cell.hashedExtension[downOffset:], hashedKeyOffset); err != nil { + if err := cell.hashStorageKey(keccak, accountKeyLen, downOffset, hashedKeyOffset); err != nil { return err } } @@ -759,7 +769,7 @@ func (hph *HexPatriciaHashed) computeCellHash(cell *cell, depth int, buf []byte) // if account key is empty, then we need to hash storage key from the key beginning koffset = 0 } - if err = hashKey(hph.keccak, cell.storageAddr[koffset:cell.storageAddrLen], cell.hashedExtension[:], hashedKeyOffset); err != nil { + if err = cell.hashStorageKey(hph.keccak, koffset, 0, hashedKeyOffset); err != nil { return nil, err } cell.hashedExtension[64-hashedKeyOffset] = 16 // Add terminator @@ -806,7 +816,7 @@ func (hph *HexPatriciaHashed) computeCellHash(cell *cell, depth int, buf []byte) } } if cell.accountAddrLen > 0 { - if err := hashKey(hph.keccak, cell.accountAddr[:cell.accountAddrLen], cell.hashedExtension[:], depth); err != nil { + if err := cell.hashAccKey(hph.keccak, depth); err != nil { return nil, err } cell.hashedExtension[64-depth] = 16 // Add terminator From afd7697015a7517f70ae57ba143dd12177bb41cf Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Fri, 29 Nov 2024 17:04:51 +0700 Subject: [PATCH 10/25] commitment: avoid binary.Wirte (#12912) `binary.Write` is slow: - does dynamic interface method call - does alloc - bench of `binary.Write` vs `binary.BigEndian.PutUint32` shows 100ns vs 1ns Also i turned `putUvarAndVal` into method (otherwise it allocates closure - and it's context). --- erigon-lib/commitment/commitment.go | 47 +++++++++++++---------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/erigon-lib/commitment/commitment.go b/erigon-lib/commitment/commitment.go index 2d7e6c316c5..db7464ed17f 100644 --- a/erigon-lib/commitment/commitment.go +++ b/erigon-lib/commitment/commitment.go @@ -258,36 +258,31 @@ func (be *BranchEncoder) CollectUpdate( return lastNibble, nil } +func (be *BranchEncoder) putUvarAndVal(size uint64, val []byte) error { + n := binary.PutUvarint(be.bitmapBuf[:], size) + if _, err := be.buf.Write(be.bitmapBuf[:n]); err != nil { + return err + } + if _, err := be.buf.Write(val); err != nil { + return err + } + return nil +} + // Encoded result should be copied before next call to EncodeBranch, underlying slice is reused func (be *BranchEncoder) EncodeBranch(bitmap, touchMap, afterMap uint16, readCell func(nibble int, skip bool) (*cell, error)) (BranchData, int, error) { be.buf.Reset() - if err := binary.Write(be.buf, binary.BigEndian, touchMap); err != nil { + var encoded [2]byte + binary.BigEndian.PutUint16(encoded[:], touchMap) + if _, err := be.buf.Write(encoded[:]); err != nil { return nil, 0, err } - if err := binary.Write(be.buf, binary.BigEndian, afterMap); err != nil { + binary.BigEndian.PutUint16(encoded[:], afterMap) + if _, err := be.buf.Write(encoded[:]); err != nil { return nil, 0, err } - putUvarAndVal := func(size uint64, val []byte) error { - n := binary.PutUvarint(be.bitmapBuf[:], size) - wn, err := be.buf.Write(be.bitmapBuf[:n]) - if err != nil { - return err - } - if n != wn { - return errors.New("n != wn size") - } - wn, err = be.buf.Write(val) - if err != nil { - return err - } - if len(val) != wn { - return errors.New("wn != value size") - } - return nil - } - var lastNibble int for bitset, j := afterMap, 0; bitset != 0; j++ { bit := bitset & -bitset @@ -325,27 +320,27 @@ func (be *BranchEncoder) EncodeBranch(bitmap, touchMap, afterMap uint16, readCel return nil, 0, err } if fields&fieldExtension != 0 { - if err := putUvarAndVal(uint64(cell.extLen), cell.extension[:cell.extLen]); err != nil { + if err := be.putUvarAndVal(uint64(cell.extLen), cell.extension[:cell.extLen]); err != nil { return nil, 0, err } } if fields&fieldAccountAddr != 0 { - if err := putUvarAndVal(uint64(cell.accountAddrLen), cell.accountAddr[:cell.accountAddrLen]); err != nil { + if err := be.putUvarAndVal(uint64(cell.accountAddrLen), cell.accountAddr[:cell.accountAddrLen]); err != nil { return nil, 0, err } } if fields&fieldStorageAddr != 0 { - if err := putUvarAndVal(uint64(cell.storageAddrLen), cell.storageAddr[:cell.storageAddrLen]); err != nil { + if err := be.putUvarAndVal(uint64(cell.storageAddrLen), cell.storageAddr[:cell.storageAddrLen]); err != nil { return nil, 0, err } } if fields&fieldHash != 0 { - if err := putUvarAndVal(uint64(cell.hashLen), cell.hash[:cell.hashLen]); err != nil { + if err := be.putUvarAndVal(uint64(cell.hashLen), cell.hash[:cell.hashLen]); err != nil { return nil, 0, err } } if fields&fieldStateHash != 0 { - if err := putUvarAndVal(uint64(cell.stateHashLen), cell.stateHash[:cell.stateHashLen]); err != nil { + if err := be.putUvarAndVal(uint64(cell.stateHashLen), cell.stateHash[:cell.stateHashLen]); err != nil { return nil, 0, err } } From 96b865560169ce41561255577bddca03bf995ac0 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Fri, 29 Nov 2024 17:20:11 +0700 Subject: [PATCH 11/25] commitment: reuse pre-allocated buffer for hash computation, step2 (#12914) follow up on https://github.com/erigontech/erigon/pull/12812 --- erigon-lib/commitment/hex_patricia_hashed.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erigon-lib/commitment/hex_patricia_hashed.go b/erigon-lib/commitment/hex_patricia_hashed.go index 35aa15b2ef7..10bf5375eab 100644 --- a/erigon-lib/commitment/hex_patricia_hashed.go +++ b/erigon-lib/commitment/hex_patricia_hashed.go @@ -782,7 +782,7 @@ func (hph *HexPatriciaHashed) computeCellHash(cell *cell, depth int, buf []byte) mxTrieStateSkipRate.Inc() skippedLoad.Add(1) if !singleton { - return append([]byte{160}, cell.stateHash[:cell.stateHashLen]...), nil + return append(append(buf[:0], byte(160)), cell.stateHash[:cell.stateHashLen]...), nil } storageRootHashIsSet = true storageRootHash = *(*[length.Hash]byte)(cell.stateHash[:cell.stateHashLen]) @@ -851,7 +851,7 @@ func (hph *HexPatriciaHashed) computeCellHash(cell *cell, depth int, buf []byte) if hph.trace { fmt.Printf("REUSED stateHash %x apk %x\n", cell.stateHash[:cell.stateHashLen], cell.accountAddr[:cell.accountAddrLen]) } - return append([]byte{160}, cell.stateHash[:cell.stateHashLen]...), nil + return append(append(buf[:0], byte(160)), cell.stateHash[:cell.stateHashLen]...), nil } // storage root update or extension update could invalidate older stateHash, so we need to reload state update, err := hph.ctx.Account(cell.accountAddr[:cell.accountAddrLen]) From dd5c46f8bc36461666aa94cb45095eb7c269e413 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Fri, 29 Nov 2024 17:51:50 +0700 Subject: [PATCH 12/25] commitment.EncodeBranch: rely on external copy (#12916) --- erigon-lib/state/domain_shared.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/erigon-lib/state/domain_shared.go b/erigon-lib/state/domain_shared.go index 251c8eaa0da..b632f82bdb8 100644 --- a/erigon-lib/state/domain_shared.go +++ b/erigon-lib/state/domain_shared.go @@ -410,9 +410,8 @@ func (sd *SharedDomains) put(domain kv.Domain, key string, val []byte) { // get returns cached value by key. Cache is invalidated when associated WAL is flushed func (sd *SharedDomains) get(table kv.Domain, key []byte) (v []byte, prevStep uint64, ok bool) { //sd.muMaps.RLock() - keyS := *(*string)(unsafe.Pointer(&key)) + keyS := toStringZeroCopy(key) var dataWithPrevStep dataWithPrevStep - //keyS := string(key) if table == kv.StorageDomain { dataWithPrevStep, ok = sd.storage.Get(keyS) return dataWithPrevStep.data, dataWithPrevStep.prevStep, ok @@ -619,9 +618,9 @@ func (sd *SharedDomains) updateAccountCode(addr, code, prevCode []byte, prevStep return sd.domainWriters[kv.CodeDomain].PutWithPrev(addr, nil, code, prevCode, prevStep) } -func (sd *SharedDomains) updateCommitmentData(prefix []byte, data, prev []byte, prevStep uint64) error { - sd.put(kv.CommitmentDomain, string(prefix), data) - return sd.domainWriters[kv.CommitmentDomain].PutWithPrev(prefix, nil, data, prev, prevStep) +func (sd *SharedDomains) updateCommitmentData(prefix string, data, prev []byte, prevStep uint64) error { + sd.put(kv.CommitmentDomain, prefix, data) + return sd.domainWriters[kv.CommitmentDomain].PutWithPrev([]byte(prefix), nil, data, prev, prevStep) } func (sd *SharedDomains) deleteAccount(addr, prev []byte, prevStep uint64) error { @@ -1064,7 +1063,7 @@ func (sd *SharedDomains) DomainDel(domain kv.Domain, k1, k2 []byte, prevVal []by } return sd.updateAccountCode(k1, nil, prevVal, prevStep) case kv.CommitmentDomain: - return sd.updateCommitmentData(k1, nil, prevVal, prevStep) + return sd.updateCommitmentData(toStringZeroCopy(k1), nil, prevVal, prevStep) default: sd.put(domain, string(append(k1, k2...)), nil) return sd.domainWriters[domain].DeleteWithPrev(k1, k2, prevVal, prevStep) @@ -1153,7 +1152,8 @@ func (sdc *SharedDomainsCommitmentContext) ResetBranchCache() { } func (sdc *SharedDomainsCommitmentContext) Branch(pref []byte) ([]byte, uint64, error) { - cached, ok := sdc.branches[string(pref)] + prefixS := string(pref) + cached, ok := sdc.branches[prefixS] if ok { // cached value is already transformed/clean to read. // Cache should ResetBranchCache after each commitment computation @@ -1169,7 +1169,7 @@ func (sdc *SharedDomainsCommitmentContext) Branch(pref []byte) ([]byte, uint64, } // Trie reads prefix during unfold and after everything is ready reads it again to Merge update, if any, so // cache branch until ResetBranchCache called - sdc.branches[string(pref)] = cachedBranch{data: v, step: step} + sdc.branches[prefixS] = cachedBranch{data: v, step: step} if len(v) == 0 { return nil, 0, nil @@ -1178,12 +1178,13 @@ func (sdc *SharedDomainsCommitmentContext) Branch(pref []byte) ([]byte, uint64, } func (sdc *SharedDomainsCommitmentContext) PutBranch(prefix []byte, data []byte, prevData []byte, prevStep uint64) error { + prefixS := toStringZeroCopy(prefix) if sdc.sharedDomains.trace { fmt.Printf("[SDC] PutBranch: %x: %x\n", prefix, data) } - sdc.branches[string(prefix)] = cachedBranch{data: data, step: prevStep} + sdc.branches[prefixS] = cachedBranch{data: data, step: prevStep} - return sdc.sharedDomains.updateCommitmentData(prefix, data, prevData, prevStep) + return sdc.sharedDomains.updateCommitmentData(prefixS, data, prevData, prevStep) } func (sdc *SharedDomainsCommitmentContext) Account(plainKey []byte) (u *commitment.Update, err error) { @@ -1466,3 +1467,5 @@ func (sdc *SharedDomainsCommitmentContext) restorePatriciaState(value []byte) (u } return cs.blockNum, cs.txNum, nil } + +func toStringZeroCopy(v []byte) string { return *(*string)(unsafe.Pointer(&v)) } From 550d8958d787502b6723b30e957eb39d527ddc0f Mon Sep 17 00:00:00 2001 From: antonis19 Date: Fri, 29 Nov 2024 13:17:24 +0100 Subject: [PATCH 13/25] Move erigon-lib/rlp to erigon-lib/rlp2 (#12915) Since the change here : https://github.com/erigontech/erigon/pull/12879 was too big and had to be reverted since it caused the pectra kurtosis tests to fail due to rlp errors, I am breaking it down into a sequence of smaller PRs. This RP moves `erigon-lib/rlp` to `erigon-lib/rlp2` . In a next PR I will move `rlp` to `erigon-lib/rlp` . Co-authored-by: antonis19 --- core/types/access_list_tx.go | 2 +- core/types/accounts/account.go | 2 +- core/types/authorization.go | 2 +- core/types/blob_tx.go | 2 +- core/types/block.go | 2 +- core/types/dynamic_fee_tx.go | 2 +- core/types/legacy_tx.go | 2 +- core/types/set_code_tx.go | 2 +- core/types/transaction.go | 2 +- erigon-lib/commitment/hex_patricia_hashed.go | 2 +- erigon-lib/crypto/crypto.go | 2 +- erigon-lib/rlp/commitment.go | 284 ------------------ erigon-lib/rlp/parse.go | 288 ------------------ erigon-lib/rlp/parse_test.go | 108 ------- erigon-lib/rlp2/decoder.go | 293 ------------------ erigon-lib/{rlp => rlp2}/encode.go | 0 erigon-lib/{rlp => rlp2}/encode_test.go | 0 erigon-lib/rlp2/encodel.go | 298 ------------------- erigon-lib/rlp2/encoder.go | 207 ------------- erigon-lib/rlp2/parse.go | 11 +- erigon-lib/rlp2/readme.md | 11 - erigon-lib/rlp2/types.go | 75 ----- erigon-lib/rlp2/unmarshaler.go | 207 ------------- erigon-lib/rlp2/unmarshaler_test.go | 82 ----- erigon-lib/rlp2/util.go | 100 ------- eth/protocols/eth/protocol.go | 2 +- txnprovider/txpool/fetch.go | 2 +- txnprovider/txpool/pool_fuzz_test.go | 2 +- txnprovider/txpool/pool_txn_packets.go | 2 +- txnprovider/txpool/pool_txn_parser.go | 2 +- txnprovider/txpool/send.go | 2 +- 31 files changed, 22 insertions(+), 1976 deletions(-) delete mode 100644 erigon-lib/rlp/commitment.go delete mode 100644 erigon-lib/rlp/parse.go delete mode 100644 erigon-lib/rlp/parse_test.go delete mode 100644 erigon-lib/rlp2/decoder.go rename erigon-lib/{rlp => rlp2}/encode.go (100%) rename erigon-lib/{rlp => rlp2}/encode_test.go (100%) delete mode 100644 erigon-lib/rlp2/encodel.go delete mode 100644 erigon-lib/rlp2/encoder.go delete mode 100644 erigon-lib/rlp2/readme.md delete mode 100644 erigon-lib/rlp2/types.go delete mode 100644 erigon-lib/rlp2/unmarshaler.go delete mode 100644 erigon-lib/rlp2/unmarshaler_test.go delete mode 100644 erigon-lib/rlp2/util.go diff --git a/core/types/access_list_tx.go b/core/types/access_list_tx.go index 24f09377caa..9a80fb6c5c3 100644 --- a/core/types/access_list_tx.go +++ b/core/types/access_list_tx.go @@ -31,7 +31,7 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - rlp2 "github.com/erigontech/erigon-lib/rlp" + rlp2 "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/rlp" ) diff --git a/core/types/accounts/account.go b/core/types/accounts/account.go index 736bc1e2152..0fb527e09ce 100644 --- a/core/types/accounts/account.go +++ b/core/types/accounts/account.go @@ -26,7 +26,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" - rlp2 "github.com/erigontech/erigon-lib/rlp" + rlp2 "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/rlp" ) diff --git a/core/types/authorization.go b/core/types/authorization.go index ed9036b2db6..68c1e3e3300 100644 --- a/core/types/authorization.go +++ b/core/types/authorization.go @@ -11,7 +11,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" - rlp2 "github.com/erigontech/erigon-lib/rlp" + rlp2 "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/rlp" ) diff --git a/core/types/blob_tx.go b/core/types/blob_tx.go index 72845624e3e..3a6001eb6ac 100644 --- a/core/types/blob_tx.go +++ b/core/types/blob_tx.go @@ -27,7 +27,7 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/fixedgas" - rlp2 "github.com/erigontech/erigon-lib/rlp" + rlp2 "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/rlp" ) diff --git a/core/types/block.go b/core/types/block.go index 1a549caba0a..d961784dc60 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -35,7 +35,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/hexutility" - rlp2 "github.com/erigontech/erigon-lib/rlp" + rlp2 "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/rlp" ) diff --git a/core/types/dynamic_fee_tx.go b/core/types/dynamic_fee_tx.go index 225467caa4d..a03a53e017f 100644 --- a/core/types/dynamic_fee_tx.go +++ b/core/types/dynamic_fee_tx.go @@ -29,7 +29,7 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - rlp2 "github.com/erigontech/erigon-lib/rlp" + rlp2 "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/rlp" ) diff --git a/core/types/legacy_tx.go b/core/types/legacy_tx.go index 1cffe818772..97eedfe655d 100644 --- a/core/types/legacy_tx.go +++ b/core/types/legacy_tx.go @@ -29,7 +29,7 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - rlp2 "github.com/erigontech/erigon-lib/rlp" + rlp2 "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/rlp" ) diff --git a/core/types/set_code_tx.go b/core/types/set_code_tx.go index fc6542f6375..94af792f54b 100644 --- a/core/types/set_code_tx.go +++ b/core/types/set_code_tx.go @@ -27,7 +27,7 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - rlp2 "github.com/erigontech/erigon-lib/rlp" + rlp2 "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/rlp" ) diff --git a/core/types/transaction.go b/core/types/transaction.go index 4e912cac451..c159865ddbe 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -36,7 +36,7 @@ import ( "github.com/erigontech/erigon-lib/common/math" libcrypto "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" - rlp2 "github.com/erigontech/erigon-lib/rlp" + rlp2 "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/rlp" ) diff --git a/erigon-lib/commitment/hex_patricia_hashed.go b/erigon-lib/commitment/hex_patricia_hashed.go index 10bf5375eab..faf9c68d6b3 100644 --- a/erigon-lib/commitment/hex_patricia_hashed.go +++ b/erigon-lib/commitment/hex_patricia_hashed.go @@ -44,7 +44,7 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/length" - "github.com/erigontech/erigon-lib/rlp" + rlp "github.com/erigontech/erigon-lib/rlp2" ) // keccakState wraps sha3.state. In addition to the usual hash methods, it also supports diff --git a/erigon-lib/crypto/crypto.go b/erigon-lib/crypto/crypto.go index b1e017d2ff2..066b78332fd 100644 --- a/erigon-lib/crypto/crypto.go +++ b/erigon-lib/crypto/crypto.go @@ -39,7 +39,7 @@ import ( "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/crypto/cryptopool" - "github.com/erigontech/erigon-lib/rlp" + rlp "github.com/erigontech/erigon-lib/rlp2" ) // SignatureLength indicates the byte length required to carry a signature with recovery id. diff --git a/erigon-lib/rlp/commitment.go b/erigon-lib/rlp/commitment.go deleted file mode 100644 index 7a3b744df07..00000000000 --- a/erigon-lib/rlp/commitment.go +++ /dev/null @@ -1,284 +0,0 @@ -// Copyright 2022 The Erigon Authors -// This file is part of Erigon. -// -// Erigon is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Erigon is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Erigon. If not, see . - -package rlp - -import "io" - -// RLP-related utilities necessary for computing commitments for state root hash - -// generateRlpPrefixLenDouble calculates the length of RLP prefix to encode a string of bytes of length l "twice", -// meaning that it is the prefix for rlp(rlp(data)) -func generateRlpPrefixLenDouble(l int, firstByte byte) int { - if l < 2 { - // firstByte only matters when there is 1 byte to encode - if firstByte >= 0x80 { - return 2 - } - return 0 - } - if l < 55 { - return 2 - } - if l < 56 { // 2 + 1 - return 3 - } - if l < 254 { - return 4 - } - if l < 256 { - return 5 - } - if l < 65533 { - return 6 - } - if l < 65536 { - return 7 - } - return 8 -} - -func multiByteHeaderPrefixOfLen(l int) byte { - // > If a string is more than 55 bytes long, the - // > RLP encoding consists of a single byte with value 0xB7 plus the length - // > of the length of the string in binary form, followed by the length of - // > the string, followed by the string. For example, a length-1024 string - // > would be encoded as 0xB90400 followed by the string. The range of - // > the first byte is thus [0xB8, 0xBF]. - // - // see package rlp/decode.go:887 - return byte(0xB7 + l) -} - -func generateByteArrayLen(buffer []byte, pos int, l int) int { - if l < 56 { - buffer[pos] = byte(0x80 + l) - pos++ - } else if l < 256 { - // len(vn) can be encoded as 1 byte - buffer[pos] = multiByteHeaderPrefixOfLen(1) - pos++ - buffer[pos] = byte(l) - pos++ - } else if l < 65536 { - // len(vn) is encoded as two bytes - buffer[pos] = multiByteHeaderPrefixOfLen(2) - pos++ - buffer[pos] = byte(l >> 8) - pos++ - buffer[pos] = byte(l & 255) - pos++ - } else { - // len(vn) is encoded as three bytes - buffer[pos] = multiByteHeaderPrefixOfLen(3) - pos++ - buffer[pos] = byte(l >> 16) - pos++ - buffer[pos] = byte((l >> 8) & 255) - pos++ - buffer[pos] = byte(l & 255) - pos++ - } - return pos -} - -func generateByteArrayLenDouble(buffer []byte, pos int, l int) int { - if l < 55 { - // After first wrapping, the length will be l + 1 < 56 - buffer[pos] = byte(0x80 + l + 1) - pos++ - buffer[pos] = byte(0x80 + l) - pos++ - } else if l < 56 { - buffer[pos] = multiByteHeaderPrefixOfLen(1) - pos++ - buffer[pos] = byte(l + 1) - pos++ - buffer[pos] = byte(0x80 + l) - pos++ - } else if l < 254 { - // After first wrapping, the length will be l + 2 < 256 - buffer[pos] = multiByteHeaderPrefixOfLen(1) - pos++ - buffer[pos] = byte(l + 2) - pos++ - buffer[pos] = multiByteHeaderPrefixOfLen(1) - pos++ - buffer[pos] = byte(l) - pos++ - } else if l < 256 { - // First wrapping is 2 bytes, second wrapping 3 bytes - buffer[pos] = multiByteHeaderPrefixOfLen(2) - pos++ - buffer[pos] = byte((l + 2) >> 8) - pos++ - buffer[pos] = byte((l + 2) & 255) - pos++ - buffer[pos] = multiByteHeaderPrefixOfLen(1) - pos++ - buffer[pos] = byte(l) - pos++ - } else if l < 65533 { - // Both wrappings are 3 bytes - buffer[pos] = multiByteHeaderPrefixOfLen(2) - pos++ - buffer[pos] = byte((l + 3) >> 8) - pos++ - buffer[pos] = byte((l + 3) & 255) - pos++ - buffer[pos] = multiByteHeaderPrefixOfLen(2) - pos++ - buffer[pos] = byte(l >> 8) - pos++ - buffer[pos] = byte(l & 255) - pos++ - } else if l < 65536 { - // First wrapping is 3 bytes, second wrapping is 4 bytes - buffer[pos] = multiByteHeaderPrefixOfLen(3) - pos++ - buffer[pos] = byte((l + 3) >> 16) - pos++ - buffer[pos] = byte(((l + 3) >> 8) & 255) - pos++ - buffer[pos] = byte((l + 3) & 255) - pos++ - buffer[pos] = multiByteHeaderPrefixOfLen(2) - pos++ - buffer[pos] = byte((l >> 8) & 255) - pos++ - buffer[pos] = byte(l & 255) - pos++ - } else { - // Both wrappings are 4 bytes - buffer[pos] = multiByteHeaderPrefixOfLen(3) - pos++ - buffer[pos] = byte((l + 4) >> 16) - pos++ - buffer[pos] = byte(((l + 4) >> 8) & 255) - pos++ - buffer[pos] = byte((l + 4) & 255) - pos++ - buffer[pos] = multiByteHeaderPrefixOfLen(3) - pos++ - buffer[pos] = byte(l >> 16) - pos++ - buffer[pos] = byte((l >> 8) & 255) - pos++ - buffer[pos] = byte(l & 255) - pos++ - } - return pos -} - -func generateRlpPrefixLen(l int) int { - if l < 2 { - return 0 - } - if l < 56 { - return 1 - } - if l < 256 { - return 2 - } - if l < 65536 { - return 3 - } - return 4 -} - -// RlpSerializable is a value that can be double-RLP coded. -type RlpSerializable interface { - ToDoubleRLP(io.Writer, []byte) error - DoubleRLPLen() int - RawBytes() []byte -} - -type RlpSerializableBytes []byte - -func (b RlpSerializableBytes) ToDoubleRLP(w io.Writer, prefixBuf []byte) error { - return encodeBytesAsRlpToWriter(b, w, generateByteArrayLenDouble, prefixBuf) -} - -func (b RlpSerializableBytes) RawBytes() []byte { - return b -} - -func (b RlpSerializableBytes) DoubleRLPLen() int { - if len(b) < 1 { - return 0 - } - return generateRlpPrefixLenDouble(len(b), b[0]) + len(b) -} - -type RlpEncodedBytes []byte - -func (b RlpEncodedBytes) ToDoubleRLP(w io.Writer, prefixBuf []byte) error { - return encodeBytesAsRlpToWriter(b, w, generateByteArrayLen, prefixBuf) -} - -func (b RlpEncodedBytes) RawBytes() []byte { - return b -} - -func (b RlpEncodedBytes) DoubleRLPLen() int { - return generateRlpPrefixLen(len(b)) + len(b) -} - -func encodeBytesAsRlpToWriter(source []byte, w io.Writer, prefixGenFunc func([]byte, int, int) int, prefixBuf []byte) error { - // > 1 byte, write a prefix or prefixes first - if len(source) > 1 || (len(source) == 1 && source[0] >= 0x80) { - prefixLen := prefixGenFunc(prefixBuf, 0, len(source)) - - if _, err := w.Write(prefixBuf[:prefixLen]); err != nil { - return err - } - } - - _, err := w.Write(source) - return err -} - -func EncodeByteArrayAsRlp(raw []byte, w io.Writer, prefixBuf []byte) (int, error) { - err := encodeBytesAsRlpToWriter(raw, w, generateByteArrayLen, prefixBuf) - if err != nil { - return 0, err - } - return generateRlpPrefixLen(len(raw)) + len(raw), nil -} - -func GenerateStructLen(buffer []byte, l int) int { - if l < 56 { - buffer[0] = byte(192 + l) - return 1 - } - if l < 256 { - // l can be encoded as 1 byte - buffer[1] = byte(l) - buffer[0] = byte(247 + 1) - return 2 - } - if l < 65536 { - buffer[2] = byte(l & 255) - buffer[1] = byte(l >> 8) - buffer[0] = byte(247 + 2) - return 3 - } - buffer[3] = byte(l & 255) - buffer[2] = byte((l >> 8) & 255) - buffer[1] = byte(l >> 16) - buffer[0] = byte(247 + 3) - return 4 -} diff --git a/erigon-lib/rlp/parse.go b/erigon-lib/rlp/parse.go deleted file mode 100644 index 09545f4347e..00000000000 --- a/erigon-lib/rlp/parse.go +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright 2021 The Erigon Authors -// This file is part of Erigon. -// -// Erigon is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Erigon is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Erigon. If not, see . - -package rlp - -import ( - "errors" - "fmt" - - "github.com/holiman/uint256" - - "github.com/erigontech/erigon-lib/common" -) - -var ( - ErrBase = errors.New("rlp") - ErrParse = fmt.Errorf("%w parse", ErrBase) - ErrDecode = fmt.Errorf("%w decode", ErrBase) -) - -func IsRLPError(err error) bool { return errors.Is(err, ErrBase) } - -// BeInt parses Big Endian representation of an integer from given payload at given position -func BeInt(payload []byte, pos, length int) (int, error) { - var r int - if pos+length >= len(payload) { - return 0, fmt.Errorf("%w: unexpected end of payload", ErrParse) - } - if length > 0 && payload[pos] == 0 { - return 0, fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: %x", ErrParse, payload[pos:pos+length]) - } - for _, b := range payload[pos : pos+length] { - r = (r << 8) | int(b) - } - return r, nil -} - -// Prefix parses RLP Prefix from given payload at given position. It returns the offset and length of the RLP element -// as well as the indication of whether it is a list of string -func Prefix(payload []byte, pos int) (dataPos int, dataLen int, isList bool, err error) { - if pos < 0 { - return 0, 0, false, fmt.Errorf("%w: negative position not allowed", ErrParse) - } - if pos >= len(payload) { - return 0, 0, false, fmt.Errorf("%w: unexpected end of payload", ErrParse) - } - switch first := payload[pos]; { - case first < 128: - dataPos = pos - dataLen = 1 - isList = false - case first < 184: - // Otherwise, if a string is 0-55 bytes long, - // the RLP encoding consists of a single byte with value 0x80 plus the - // length of the string followed by the string. The range of the first - // byte is thus [0x80, 0xB7]. - dataPos = pos + 1 - dataLen = int(first) - 128 - isList = false - if dataLen == 1 && dataPos < len(payload) && payload[dataPos] < 128 { - err = fmt.Errorf("%w: non-canonical size information", ErrParse) - } - case first < 192: - // If a string is more than 55 bytes long, the - // RLP encoding consists of a single byte with value 0xB7 plus the length - // of the length of the string in binary form, followed by the length of - // the string, followed by the string. For example, a length-1024 string - // would be encoded as 0xB90400 followed by the string. The range of - // the first byte is thus [0xB8, 0xBF]. - beLen := int(first) - 183 - dataPos = pos + 1 + beLen - dataLen, err = BeInt(payload, pos+1, beLen) - isList = false - if dataLen < 56 { - err = fmt.Errorf("%w: non-canonical size information", ErrParse) - } - case first < 248: - // isList of len < 56 - // If the total payload of a list - // (i.e. the combined length of all its items) is 0-55 bytes long, the - // RLP encoding consists of a single byte with value 0xC0 plus the length - // of the list followed by the concatenation of the RLP encodings of the - // items. The range of the first byte is thus [0xC0, 0xF7]. - dataPos = pos + 1 - dataLen = int(first) - 192 - isList = true - default: - // If the total payload of a list is more than 55 bytes long, - // the RLP encoding consists of a single byte with value 0xF7 - // plus the length of the length of the payload in binary - // form, followed by the length of the payload, followed by - // the concatenation of the RLP encodings of the items. The - // range of the first byte is thus [0xF8, 0xFF]. - beLen := int(first) - 247 - dataPos = pos + 1 + beLen - dataLen, err = BeInt(payload, pos+1, beLen) - isList = true - if dataLen < 56 { - err = fmt.Errorf("%w: : non-canonical size information", ErrParse) - } - } - if err == nil { - if dataPos+dataLen > len(payload) { - err = fmt.Errorf("%w: unexpected end of payload", ErrParse) - } else if dataPos+dataLen < 0 { - err = fmt.Errorf("%w: found too big len", ErrParse) - } - } - return -} - -func List(payload []byte, pos int) (dataPos, dataLen int, err error) { - dataPos, dataLen, isList, err := Prefix(payload, pos) - if err != nil { - return 0, 0, err - } - if !isList { - return 0, 0, fmt.Errorf("%w: must be a list", ErrParse) - } - return -} - -func String(payload []byte, pos int) (dataPos, dataLen int, err error) { - dataPos, dataLen, isList, err := Prefix(payload, pos) - if err != nil { - return 0, 0, err - } - if isList { - return 0, 0, fmt.Errorf("%w: must be a string, instead of a list", ErrParse) - } - return -} -func StringOfLen(payload []byte, pos, expectedLen int) (dataPos int, err error) { - dataPos, dataLen, err := String(payload, pos) - if err != nil { - return 0, err - } - if dataLen != expectedLen { - return 0, fmt.Errorf("%w: expected string of len %d, got %d", ErrParse, expectedLen, dataLen) - } - return -} - -// U64 parses uint64 number from given payload at given position -func U64(payload []byte, pos int) (int, uint64, error) { - dataPos, dataLen, isList, err := Prefix(payload, pos) - if err != nil { - return 0, 0, err - } - if isList { - return 0, 0, fmt.Errorf("%w: uint64 must be a string, not isList", ErrParse) - } - if dataLen > 8 { - return 0, 0, fmt.Errorf("%w: uint64 must not be more than 8 bytes long, got %d", ErrParse, dataLen) - } - if dataLen > 0 && payload[dataPos] == 0 { - return 0, 0, fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: %x", ErrParse, payload[dataPos:dataPos+dataLen]) - } - var r uint64 - for _, b := range payload[dataPos : dataPos+dataLen] { - r = (r << 8) | uint64(b) - } - return dataPos + dataLen, r, nil -} - -// U32 parses uint64 number from given payload at given position -func U32(payload []byte, pos int) (int, uint32, error) { - dataPos, dataLen, isList, err := Prefix(payload, pos) - if err != nil { - return 0, 0, err - } - if isList { - return 0, 0, fmt.Errorf("%w: uint32 must be a string, not isList", ErrParse) - } - if dataLen > 4 { - return 0, 0, fmt.Errorf("%w: uint32 must not be more than 4 bytes long, got %d", ErrParse, dataLen) - } - if dataLen > 0 && payload[dataPos] == 0 { - return 0, 0, fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: %x", ErrParse, payload[dataPos:dataPos+dataLen]) - } - var r uint32 - for _, b := range payload[dataPos : dataPos+dataLen] { - r = (r << 8) | uint32(b) - } - return dataPos + dataLen, r, nil -} - -// U256 parses uint256 number from given payload at given position -func U256(payload []byte, pos int, x *uint256.Int) (int, error) { - dataPos, dataLen, err := String(payload, pos) - if err != nil { - return 0, err - } - if dataLen > 32 { - return 0, fmt.Errorf("%w: uint256 must not be more than 32 bytes long, got %d", ErrParse, dataLen) - } - if dataLen > 0 && payload[dataPos] == 0 { - return 0, fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: %x", ErrParse, payload[dataPos:dataPos+dataLen]) - } - x.SetBytes(payload[dataPos : dataPos+dataLen]) - return dataPos + dataLen, nil -} - -func U256Len(z *uint256.Int) int { - if z == nil { - return 1 - } - nBits := z.BitLen() - if nBits == 0 { - return 1 - } - if nBits <= 7 { - return 1 - } - return 1 + common.BitLenToByteLen(nBits) -} - -func ParseHash(payload []byte, pos int, hashbuf []byte) (int, error) { - pos, err := StringOfLen(payload, pos, 32) - if err != nil { - return 0, fmt.Errorf("%s: hash len: %w", ParseHashErrorPrefix, err) - } - copy(hashbuf, payload[pos:pos+32]) - return pos + 32, nil -} - -const ParseHashErrorPrefix = "parse hash payload" - -const ParseAnnouncementsErrorPrefix = "parse announcement payload" - -func ParseAnnouncements(payload []byte, pos int) ([]byte, []uint32, []byte, int, error) { - pos, totalLen, err := List(payload, pos) - if err != nil { - return nil, nil, nil, pos, err - } - if pos+totalLen > len(payload) { - return nil, nil, nil, pos, fmt.Errorf("%s: totalLen %d is beyond the end of payload", ParseAnnouncementsErrorPrefix, totalLen) - } - pos, typesLen, err := String(payload, pos) - if err != nil { - return nil, nil, nil, pos, err - } - if pos+typesLen > len(payload) { - return nil, nil, nil, pos, fmt.Errorf("%s: typesLen %d is beyond the end of payload", ParseAnnouncementsErrorPrefix, typesLen) - } - types := payload[pos : pos+typesLen] - pos += typesLen - pos, sizesLen, err := List(payload, pos) - if err != nil { - return nil, nil, nil, pos, err - } - if pos+sizesLen > len(payload) { - return nil, nil, nil, pos, fmt.Errorf("%s: sizesLen %d is beyond the end of payload", ParseAnnouncementsErrorPrefix, sizesLen) - } - sizes := make([]uint32, typesLen) - for i := 0; i < len(sizes); i++ { - if pos, sizes[i], err = U32(payload, pos); err != nil { - return nil, nil, nil, pos, err - } - } - pos, hashesLen, err := List(payload, pos) - if err != nil { - return nil, nil, nil, pos, err - } - if pos+hashesLen > len(payload) { - return nil, nil, nil, pos, fmt.Errorf("%s: hashesLen %d is beyond the end of payload", ParseAnnouncementsErrorPrefix, hashesLen) - } - hashes := make([]byte, 32*(hashesLen/33)) - for i := 0; i < len(hashes); i += 32 { - if pos, err = ParseHash(payload, pos, hashes[i:]); err != nil { - return nil, nil, nil, pos, err - } - } - return types, sizes, hashes, pos, nil -} diff --git a/erigon-lib/rlp/parse_test.go b/erigon-lib/rlp/parse_test.go deleted file mode 100644 index a100d77afb5..00000000000 --- a/erigon-lib/rlp/parse_test.go +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2024 The Erigon Authors -// This file is part of Erigon. -// -// Erigon is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Erigon is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Erigon. If not, see . - -package rlp - -import ( - "fmt" - "testing" - - "github.com/holiman/uint256" - "github.com/stretchr/testify/assert" - - "github.com/erigontech/erigon-lib/common/hexutility" -) - -var parseU64Tests = []struct { - expectErr error - payload []byte - expectPos int - expectRes uint64 -}{ - {payload: hexutility.MustDecodeHex("820400"), expectPos: 3, expectRes: 1024}, - {payload: hexutility.MustDecodeHex("07"), expectPos: 1, expectRes: 7}, - {payload: hexutility.MustDecodeHex("8107"), expectErr: fmt.Errorf("%w: non-canonical size information", ErrParse)}, - {payload: hexutility.MustDecodeHex("B8020004"), expectErr: fmt.Errorf("%w: non-canonical size information", ErrParse)}, - {payload: hexutility.MustDecodeHex("C0"), expectErr: fmt.Errorf("%w: uint64 must be a string, not isList", ErrParse)}, - {payload: hexutility.MustDecodeHex("00"), expectErr: fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: 00", ErrParse)}, - {payload: hexutility.MustDecodeHex("8AFFFFFFFFFFFFFFFFFF7C"), expectErr: fmt.Errorf("%w: uint64 must not be more than 8 bytes long, got 10", ErrParse)}, -} - -var parseU32Tests = []struct { - expectErr error - payload []byte - expectPos int - expectRes uint32 -}{ - {payload: hexutility.MustDecodeHex("820400"), expectPos: 3, expectRes: 1024}, - {payload: hexutility.MustDecodeHex("07"), expectPos: 1, expectRes: 7}, - {payload: hexutility.MustDecodeHex("8107"), expectErr: fmt.Errorf("%w: non-canonical size information", ErrParse)}, - {payload: hexutility.MustDecodeHex("B8020004"), expectErr: fmt.Errorf("%w: non-canonical size information", ErrParse)}, - {payload: hexutility.MustDecodeHex("C0"), expectErr: fmt.Errorf("%w: uint32 must be a string, not isList", ErrParse)}, - {payload: hexutility.MustDecodeHex("00"), expectErr: fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: 00", ErrParse)}, - {payload: hexutility.MustDecodeHex("85FF6738FF7C"), expectErr: fmt.Errorf("%w: uint32 must not be more than 4 bytes long, got 5", ErrParse)}, -} - -var parseU256Tests = []struct { - expectErr error - expectRes *uint256.Int - payload []byte - expectPos int -}{ - {payload: hexutility.MustDecodeHex("8BFFFFFFFFFFFFFFFFFF7C"), expectErr: fmt.Errorf("%w: unexpected end of payload", ErrParse)}, - {payload: hexutility.MustDecodeHex("8AFFFFFFFFFFFFFFFFFF7C"), expectPos: 11, expectRes: new(uint256.Int).SetBytes(hexutility.MustDecodeHex("FFFFFFFFFFFFFFFFFF7C"))}, - {payload: hexutility.MustDecodeHex("85CE05050505"), expectPos: 6, expectRes: new(uint256.Int).SetUint64(0xCE05050505)}, - {payload: hexutility.MustDecodeHex("820400"), expectPos: 3, expectRes: new(uint256.Int).SetUint64(1024)}, - {payload: hexutility.MustDecodeHex("07"), expectPos: 1, expectRes: new(uint256.Int).SetUint64(7)}, - {payload: hexutility.MustDecodeHex("8107"), expectErr: fmt.Errorf("%w: non-canonical size information", ErrParse)}, - {payload: hexutility.MustDecodeHex("B8020004"), expectErr: fmt.Errorf("%w: non-canonical size information", ErrParse)}, - {payload: hexutility.MustDecodeHex("C0"), expectErr: fmt.Errorf("%w: must be a string, instead of a list", ErrParse)}, - {payload: hexutility.MustDecodeHex("00"), expectErr: fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: 00", ErrParse)}, - {payload: hexutility.MustDecodeHex("A101000000000000000000000000000000000000008B000000000000000000000000"), expectErr: fmt.Errorf("%w: uint256 must not be more than 32 bytes long, got 33", ErrParse)}, -} - -func TestPrimitives(t *testing.T) { - for i, tt := range parseU64Tests { - t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { - assert := assert.New(t) - pos, res, err := U64(tt.payload, 0) - assert.Equal(tt.expectErr, err) - assert.Equal(tt.expectPos, pos) - assert.Equal(tt.expectRes, res) - }) - } - for i, tt := range parseU32Tests { - t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { - assert := assert.New(t) - pos, res, err := U32(tt.payload, 0) - assert.Equal(tt.expectErr, err) - assert.Equal(tt.expectPos, pos) - assert.Equal(tt.expectRes, res) - }) - } - for i, tt := range parseU256Tests { - t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { - assert := assert.New(t) - res := new(uint256.Int) - pos, err := U256(tt.payload, 0, res) - assert.Equal(tt.expectErr, err) - assert.Equal(tt.expectPos, pos) - if err == nil { - assert.Equal(tt.expectRes, res) - } - }) - } -} diff --git a/erigon-lib/rlp2/decoder.go b/erigon-lib/rlp2/decoder.go deleted file mode 100644 index 34b8e5821cd..00000000000 --- a/erigon-lib/rlp2/decoder.go +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright 2024 The Erigon Authors -// This file is part of Erigon. -// -// Erigon is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Erigon is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Erigon. If not, see . - -package rlp - -import ( - "errors" - "fmt" - "io" -) - -type Decoder struct { - buf *buf -} - -func NewDecoder(buf []byte) *Decoder { - return &Decoder{ - buf: newBuf(buf, 0), - } -} - -func (d *Decoder) String() string { - return fmt.Sprintf(`left=%x pos=%d`, d.buf.Bytes(), d.buf.off) -} - -func (d *Decoder) Consumed() []byte { - return d.buf.u[:d.buf.off] -} - -func (d *Decoder) Underlying() []byte { - return d.buf.Underlying() -} - -func (d *Decoder) Empty() bool { - return d.buf.empty() -} - -func (d *Decoder) Offset() int { - return d.buf.Offset() -} - -func (d *Decoder) Bytes() []byte { - return d.buf.Bytes() -} - -func (d *Decoder) ReadByte() (n byte, err error) { - return d.buf.ReadByte() -} - -func (d *Decoder) PeekByte() (n byte, err error) { - return d.buf.PeekByte() -} - -func (d *Decoder) Rebase() { - d.buf.u = d.Bytes() - d.buf.off = 0 -} -func (d *Decoder) Fork() *Decoder { - return &Decoder{ - buf: newBuf(d.buf.u, d.buf.off), - } -} - -func (d *Decoder) PeekToken() (Token, error) { - prefix, err := d.PeekByte() - if err != nil { - return TokenUnknown, err - } - return identifyToken(prefix), nil -} - -func (d *Decoder) ElemDec() (*Decoder, Token, error) { - a, t, err := d.Elem() - return NewDecoder(a), t, err -} - -func (d *Decoder) RawElemDec() (*Decoder, Token, error) { - a, t, err := d.RawElem() - return NewDecoder(a), t, err -} - -func (d *Decoder) RawElem() ([]byte, Token, error) { - w := d.buf - start := w.Offset() - // figure out what we are reading - prefix, err := w.ReadByte() - if err != nil { - return nil, TokenUnknown, err - } - token := identifyToken(prefix) - - var ( - sz int - lenSz int - ) - // switch on the token - switch token { - case TokenDecimal: - // in this case, the value is just the byte itself - case TokenShortList: - sz = int(token.Diff(prefix)) - _, err = nextFull(w, sz) - case TokenLongList: - lenSz = int(token.Diff(prefix)) - sz, err = nextBeInt(w, lenSz) - if err != nil { - return nil, token, err - } - _, err = nextFull(w, sz) - case TokenShortBlob: - sz := int(token.Diff(prefix)) - _, err = nextFull(w, sz) - case TokenLongBlob: - lenSz := int(token.Diff(prefix)) - sz, err = nextBeInt(w, lenSz) - if err != nil { - return nil, token, err - } - _, err = nextFull(w, sz) - default: - return nil, token, fmt.Errorf("%w: unknown token", ErrDecode) - } - stop := w.Offset() - //log.Printf("%x %s\n", buf, token) - if err != nil { - return nil, token, err - } - return w.Underlying()[start:stop], token, nil -} - -func (d *Decoder) Elem() ([]byte, Token, error) { - w := d.buf - // figure out what we are reading - prefix, err := w.ReadByte() - if err != nil { - return nil, TokenUnknown, err - } - token := identifyToken(prefix) - - var ( - buf []byte - sz int - lenSz int - ) - // switch on the token - switch token { - case TokenDecimal: - // in this case, the value is just the byte itself - buf = []byte{prefix} - case TokenShortList: - sz = int(token.Diff(prefix)) - buf, err = nextFull(w, sz) - case TokenLongList: - lenSz = int(token.Diff(prefix)) - sz, err = nextBeInt(w, lenSz) - if err != nil { - return nil, token, err - } - buf, err = nextFull(w, sz) - case TokenShortBlob: - sz := int(token.Diff(prefix)) - buf, err = nextFull(w, sz) - case TokenLongBlob: - lenSz := int(token.Diff(prefix)) - sz, err = nextBeInt(w, lenSz) - if err != nil { - return nil, token, err - } - buf, err = nextFull(w, sz) - default: - return nil, token, fmt.Errorf("%w: unknown token", ErrDecode) - } - //log.Printf("%x %s\n", buf, token) - if err != nil { - return nil, token, fmt.Errorf("read data: %w", err) - } - return buf, token, nil -} - -func ReadElem[T any](d *Decoder, fn func(*T, []byte) error, receiver *T) error { - buf, token, err := d.Elem() - if err != nil { - return err - } - switch token { - case TokenDecimal, - TokenShortBlob, - TokenLongBlob, - TokenShortList, - TokenLongList: - return fn(receiver, buf) - default: - return fmt.Errorf("%w: ReadElem found unexpected token", ErrDecode) - } -} - -func (d *Decoder) ForList(fn func(*Decoder) error) error { - // grab the list bytes - buf, token, err := d.Elem() - if err != nil { - return err - } - switch token { - case TokenShortList, TokenLongList: - dec := NewDecoder(buf) - for { - if dec.buf.Len() == 0 { - return nil - } - err := fn(dec) - if errors.Is(err, io.EOF) { - return nil - } - if err != nil { - return err - } - // reset the byte - dec = NewDecoder(dec.Bytes()) - } - default: - return fmt.Errorf("%w: ForList on non-list", ErrDecode) - } -} - -type buf struct { - u []byte - off int -} - -func newBuf(u []byte, off int) *buf { - return &buf{u: u, off: off} -} - -func (b *buf) empty() bool { return len(b.u) <= b.off } - -func (b *buf) PeekByte() (n byte, err error) { - if len(b.u) <= b.off { - return 0, io.EOF - } - return b.u[b.off], nil -} -func (b *buf) ReadByte() (n byte, err error) { - if len(b.u) <= b.off { - return 0, io.EOF - } - b.off++ - return b.u[b.off-1], nil -} - -func (b *buf) Next(n int) (xs []byte) { - m := b.Len() - if n > m { - n = m - } - data := b.u[b.off : b.off+n] - b.off += n - return data -} - -func (b *buf) Offset() int { - return b.off -} - -func (b *buf) Bytes() []byte { - return b.u[b.off:] -} - -func (b *buf) String() string { - if b == nil { - // Special case, useful in debugging. - return "" - } - return string(b.u[b.off:]) -} - -func (b *buf) Len() int { return len(b.u) - b.off } - -func (b *buf) Underlying() []byte { - return b.u -} diff --git a/erigon-lib/rlp/encode.go b/erigon-lib/rlp2/encode.go similarity index 100% rename from erigon-lib/rlp/encode.go rename to erigon-lib/rlp2/encode.go diff --git a/erigon-lib/rlp/encode_test.go b/erigon-lib/rlp2/encode_test.go similarity index 100% rename from erigon-lib/rlp/encode_test.go rename to erigon-lib/rlp2/encode_test.go diff --git a/erigon-lib/rlp2/encodel.go b/erigon-lib/rlp2/encodel.go deleted file mode 100644 index 2a706ff76b7..00000000000 --- a/erigon-lib/rlp2/encodel.go +++ /dev/null @@ -1,298 +0,0 @@ -// Copyright 2021 The Erigon Authors -// This file is part of Erigon. -// -// Erigon is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Erigon is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Erigon. If not, see . - -package rlp - -import ( - "encoding/binary" - "math/bits" - - "github.com/erigontech/erigon-lib/common" -) - -// General design: -// - rlp package doesn't manage memory - and Caller must ensure buffers are big enough. -// - no io.Writer, because it's incompatible with binary.BigEndian functions and Writer can't be used as temporary buffer -// -// Composition: -// - each Encode method does write to given buffer and return written len -// - each Parse accept position in payload and return new position -// -// General rules: -// - functions to calculate prefix len are fast (and pure). it's ok to call them multiple times during encoding of large object for readability. -// - rlp has 2 data types: List and String (bytes array), and low-level funcs are operate with this types. -// - but for convenience and performance - provided higher-level functions (for example for EncodeHash - for []byte of len 32) -// - functions to Parse (Decode) data - using data type as name (without any prefix): rlp.String(), rlp.List, rlp.U64(), rlp.U256() -// - -func ListPrefixLen(dataLen int) int { - if dataLen >= 56 { - return 1 + common.BitLenToByteLen(bits.Len64(uint64(dataLen))) - } - return 1 -} -func EncodeListPrefix(dataLen int, to []byte) int { - if dataLen >= 56 { - _ = to[9] - beLen := common.BitLenToByteLen(bits.Len64(uint64(dataLen))) - binary.BigEndian.PutUint64(to[1:], uint64(dataLen)) - to[8-beLen] = 247 + byte(beLen) - copy(to, to[8-beLen:9]) - return 1 + beLen - } - to[0] = 192 + byte(dataLen) - return 1 -} - -func U32Len(i uint32) int { - if i < 128 { - return 1 - } - return 1 + common.BitLenToByteLen(bits.Len32(i)) -} - -func U64Len(i uint64) int { - if i < 128 { - return 1 - } - return 1 + common.BitLenToByteLen(bits.Len64(i)) -} - -func EncodeU32(i uint32, to []byte) int { - if i == 0 { - to[0] = 128 - return 1 - } - if i < 128 { - to[0] = byte(i) // fits single byte - return 1 - } - - b := to[1:] - var l int - - // writes i to b in big endian byte order, using the least number of bytes needed to represent i. - switch { - case i < (1 << 8): - b[0] = byte(i) - l = 1 - case i < (1 << 16): - b[0] = byte(i >> 8) - b[1] = byte(i) - l = 2 - case i < (1 << 24): - b[0] = byte(i >> 16) - b[1] = byte(i >> 8) - b[2] = byte(i) - l = 3 - default: - b[0] = byte(i >> 24) - b[1] = byte(i >> 16) - b[2] = byte(i >> 8) - b[3] = byte(i) - l = 4 - } - - to[0] = 128 + byte(l) - return 1 + l -} - -func EncodeU64(i uint64, to []byte) int { - if i == 0 { - to[0] = 128 - return 1 - } - if i < 128 { - to[0] = byte(i) // fits single byte - return 1 - } - - b := to[1:] - var l int - - // writes i to b in big endian byte order, using the least number of bytes needed to represent i. - switch { - case i < (1 << 8): - b[0] = byte(i) - l = 1 - case i < (1 << 16): - b[0] = byte(i >> 8) - b[1] = byte(i) - l = 2 - case i < (1 << 24): - b[0] = byte(i >> 16) - b[1] = byte(i >> 8) - b[2] = byte(i) - l = 3 - case i < (1 << 32): - b[0] = byte(i >> 24) - b[1] = byte(i >> 16) - b[2] = byte(i >> 8) - b[3] = byte(i) - l = 4 - case i < (1 << 40): - b[0] = byte(i >> 32) - b[1] = byte(i >> 24) - b[2] = byte(i >> 16) - b[3] = byte(i >> 8) - b[4] = byte(i) - l = 5 - case i < (1 << 48): - b[0] = byte(i >> 40) - b[1] = byte(i >> 32) - b[2] = byte(i >> 24) - b[3] = byte(i >> 16) - b[4] = byte(i >> 8) - b[5] = byte(i) - l = 6 - case i < (1 << 56): - b[0] = byte(i >> 48) - b[1] = byte(i >> 40) - b[2] = byte(i >> 32) - b[3] = byte(i >> 24) - b[4] = byte(i >> 16) - b[5] = byte(i >> 8) - b[6] = byte(i) - l = 7 - default: - b[0] = byte(i >> 56) - b[1] = byte(i >> 48) - b[2] = byte(i >> 40) - b[3] = byte(i >> 32) - b[4] = byte(i >> 24) - b[5] = byte(i >> 16) - b[6] = byte(i >> 8) - b[7] = byte(i) - l = 8 - } - - to[0] = 128 + byte(l) - return 1 + l -} - -func StringLen(s []byte) int { - sLen := len(s) - switch { - case sLen > 56: - beLen := common.BitLenToByteLen(bits.Len(uint(sLen))) - return 1 + beLen + sLen - case sLen == 0: - return 1 - case sLen == 1: - if s[0] < 128 { - return 1 - } - return 1 + sLen - default: // 1 56: - beLen := common.BitLenToByteLen(bits.Len(uint(len(s)))) - binary.BigEndian.PutUint64(to[1:], uint64(len(s))) - _ = to[beLen+len(s)] - - to[8-beLen] = byte(beLen) + 183 - copy(to, to[8-beLen:9]) - copy(to[1+beLen:], s) - return 1 + beLen + len(s) - case len(s) == 0: - to[0] = 128 - return 1 - case len(s) == 1: - if s[0] < 128 { - to[0] = s[0] - return 1 - } - to[0] = 129 - to[1] = s[0] - return 2 - default: // 1. - -package rlp - -import ( - "golang.org/x/exp/constraints" -) - -type EncoderFunc = func(i *Encoder) *Encoder - -type Encoder struct { - buf []byte -} - -func NewEncoder(buf []byte) *Encoder { - return &Encoder{ - buf: buf, - } -} - -// Buffer returns the underlying buffer -func (e *Encoder) Buffer() []byte { - return e.buf -} - -func (e *Encoder) Byte(p byte) *Encoder { - e.buf = append(e.buf, p) - return e -} - -func (e *Encoder) Bytes(p []byte) *Encoder { - e.buf = append(e.buf, p...) - return e -} - -// Str will write a string correctly -func (e *Encoder) Str(str []byte) *Encoder { - if len(str) > 55 { - return e.LongString(str) - } - return e.ShortString(str) -} - -// String will assume your string is less than 56 bytes long, and do no validation as such -func (e *Encoder) ShortString(str []byte) *Encoder { - return e.Byte(TokenShortBlob.Plus(byte(len(str)))).Bytes(str) -} - -// String will assume your string is greater than 55 bytes long, and do no validation as such -func (e *Encoder) LongString(str []byte) *Encoder { - // write the indicator token - e.Byte(byte(TokenLongBlob)) - // write the integer, knowing that we appended n bytes - n := putUint(e, len(str)) - // so we knw the indicator token was n+1 bytes ago. - e.buf[len(e.buf)-(int(n)+1)] += n - // and now add the actual length - e.buf = append(e.buf, str...) - return e -} - -// List will attempt to write the list of encoder funcs to the buf -func (e *Encoder) List(items ...EncoderFunc) *Encoder { - return e.writeList(true, items...) -} - -// ShortList actually calls List -func (e *Encoder) ShortList(items ...EncoderFunc) *Encoder { - return e.writeList(true, items...) -} - -// LongList will assume that your list payload is more than 55 bytes long, and do no validation as such -func (e *Encoder) LongList(items ...EncoderFunc) *Encoder { - return e.writeList(false, items...) -} - -// writeList will first attempt to write a long list with the dat -// if validate is false, it will just format it like the length is above 55 -// if validate is true, it will format it like it is a shrot list -func (e *Encoder) writeList(validate bool, items ...EncoderFunc) *Encoder { - // write the indicator token - e = e.Byte(byte(TokenLongList)) - // now pad 8 bytes - e = e.Bytes(make([]byte, 8)) - // record the length before encoding items - startLength := len(e.buf) - // now write all the items - for _, v := range items { - e = v(e) - } - // the size is the difference in the lengths now - dataSize := len(e.buf) - startLength - if dataSize <= 55 && validate { - // oh it's actually a short string! awkward. let's set that then. - e.buf[startLength-8-1] = TokenShortList.Plus(byte(dataSize)) - // and then copy the data over - copy(e.buf[startLength-8:], e.buf[startLength:startLength+dataSize]) - // and now set the new size - e.buf = e.buf[:startLength+dataSize-8] - // we are done, return - return e - } - // ok, so it's a long string. - // create a new encoder centered at startLength - 8 - enc := NewEncoder(e.buf[startLength-8:]) - // now write using that encoder the size - n := putUint(enc, dataSize) - // and update the token, which we know is at startLength-8-1 - e.buf[startLength-8-1] += n - // the shift to perform now is 8 - n. - shift := int(8 - n) - // if there is a positive shift, then we must perform the shift - if shift > 0 { - // copy the data - copy(e.buf[startLength-shift:], e.buf[startLength:startLength+dataSize]) - // set the new length - e.buf = e.buf[:startLength-shift+dataSize] - } - return e -} - -func putUint[T constraints.Integer](e *Encoder, t T) (size byte) { - i := uint64(t) - switch { - case i < (1 << 8): - e.buf = append(e.buf, byte(i)) - return 1 - case i < (1 << 16): - e.buf = append(e.buf, - byte(i>>8), - byte(i), - ) - return 2 - case i < (1 << 24): - - e.buf = append(e.buf, - byte(i>>16), - byte(i>>8), - byte(i), - ) - return 3 - case i < (1 << 32): - e.buf = append(e.buf, - byte(i>>24), - byte(i>>16), - byte(i>>8), - byte(i), - ) - return 4 - case i < (1 << 40): - e.buf = append(e.buf, - byte(i>>32), - byte(i>>24), - byte(i>>16), - byte(i>>8), - byte(i), - ) - return 5 - case i < (1 << 48): - e.buf = append(e.buf, - byte(i>>40), - byte(i>>32), - byte(i>>24), - byte(i>>16), - byte(i>>8), - byte(i), - ) - return 6 - case i < (1 << 56): - e.buf = append(e.buf, - byte(i>>48), - byte(i>>40), - byte(i>>32), - byte(i>>24), - byte(i>>16), - byte(i>>8), - byte(i), - ) - return 7 - default: - e.buf = append(e.buf, - byte(i>>56), - byte(i>>48), - byte(i>>40), - byte(i>>32), - byte(i>>24), - byte(i>>16), - byte(i>>8), - byte(i), - ) - return 8 - } -} diff --git a/erigon-lib/rlp2/parse.go b/erigon-lib/rlp2/parse.go index bda7935e15a..09545f4347e 100644 --- a/erigon-lib/rlp2/parse.go +++ b/erigon-lib/rlp2/parse.go @@ -26,10 +26,9 @@ import ( ) var ( - ErrBase = errors.New("rlp") - ErrParse = fmt.Errorf("%w parse", ErrBase) - ErrDecode = fmt.Errorf("%w decode", ErrBase) - ErrUnexpectedEOF = fmt.Errorf("%w EOF", ErrBase) + ErrBase = errors.New("rlp") + ErrParse = fmt.Errorf("%w parse", ErrBase) + ErrDecode = fmt.Errorf("%w decode", ErrBase) ) func IsRLPError(err error) bool { return errors.Is(err, ErrBase) } @@ -37,8 +36,8 @@ func IsRLPError(err error) bool { return errors.Is(err, ErrBase) } // BeInt parses Big Endian representation of an integer from given payload at given position func BeInt(payload []byte, pos, length int) (int, error) { var r int - if pos+length > len(payload) { - return 0, ErrUnexpectedEOF + if pos+length >= len(payload) { + return 0, fmt.Errorf("%w: unexpected end of payload", ErrParse) } if length > 0 && payload[pos] == 0 { return 0, fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: %x", ErrParse, payload[pos:pos+length]) diff --git a/erigon-lib/rlp2/readme.md b/erigon-lib/rlp2/readme.md deleted file mode 100644 index 74e9f96eeb4..00000000000 --- a/erigon-lib/rlp2/readme.md +++ /dev/null @@ -1,11 +0,0 @@ -## rlp - - -TERMINOLOGY: - -``` -RLP string = "Blob" // this is so we don't conflict with existing go name for String -RLP list = "List" // luckily we can keep using list name since go doesn't use it -RLP single byte number = "Decimal" // for numbers from 1-127. a special case -``` - diff --git a/erigon-lib/rlp2/types.go b/erigon-lib/rlp2/types.go deleted file mode 100644 index 2bf3c6438f3..00000000000 --- a/erigon-lib/rlp2/types.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2024 The Erigon Authors -// This file is part of Erigon. -// -// Erigon is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Erigon is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Erigon. If not, see . - -package rlp - -import ( - "fmt" - - "github.com/holiman/uint256" -) - -func Bytes(dst *[]byte, src []byte) error { - if len(*dst) < len(src) { - (*dst) = make([]byte, len(src)) - } - copy(*dst, src) - return nil -} -func BytesExact(dst *[]byte, src []byte) error { - if len(*dst) != len(src) { - return fmt.Errorf("%w: BytesExact no match", ErrDecode) - } - copy(*dst, src) - return nil -} - -func Uint256(dst *uint256.Int, src []byte) error { - if len(src) > 32 { - return fmt.Errorf("%w: uint256 must not be more than 32 bytes long, got %d", ErrParse, len(src)) - } - if len(src) > 0 && src[0] == 0 { - return fmt.Errorf("%w: integer encoding for RLP must not have leading zeros: %x", ErrParse, src) - } - dst.SetBytes(src) - return nil -} - -func Uint64(dst *uint64, src []byte) error { - var r uint64 - for _, b := range src { - r = (r << 8) | uint64(b) - } - (*dst) = r - return nil -} - -func IsEmpty(dst *bool, src []byte) error { - if len(src) == 0 { - (*dst) = true - } else { - (*dst) = false - } - return nil -} -func BlobLength(dst *int, src []byte) error { - (*dst) = len(src) - return nil -} - -func Skip(dst *int, src []byte) error { - return nil -} diff --git a/erigon-lib/rlp2/unmarshaler.go b/erigon-lib/rlp2/unmarshaler.go deleted file mode 100644 index 7bcb547e28e..00000000000 --- a/erigon-lib/rlp2/unmarshaler.go +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright 2024 The Erigon Authors -// This file is part of Erigon. -// -// Erigon is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Erigon is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Erigon. If not, see . - -package rlp - -import ( - "fmt" - "reflect" -) - -type Unmarshaler interface { - UnmarshalRLP(data []byte) error -} - -func Unmarshal(data []byte, val any) error { - buf := newBuf(data, 0) - return unmarshal(buf, val) -} - -func unmarshal(buf *buf, val any) error { - rv := reflect.ValueOf(val) - if rv.Kind() != reflect.Pointer || rv.IsNil() { - return fmt.Errorf("%w: v must be ptr", ErrDecode) - } - v := rv.Elem() - err := reflectAny(buf, v, rv) - if err != nil { - return fmt.Errorf("%w: %w", ErrDecode, err) - } - return nil -} - -func reflectAny(w *buf, v reflect.Value, rv reflect.Value) error { - if um, ok := rv.Interface().(Unmarshaler); ok { - return um.UnmarshalRLP(w.Bytes()) - } - // figure out what we are reading - prefix, err := w.ReadByte() - if err != nil { - return err - } - token := identifyToken(prefix) - // switch - switch token { - case TokenDecimal: - // in this case, the value is just the byte itself - switch v.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - v.SetInt(int64(prefix)) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - v.SetUint(uint64(prefix)) - case reflect.Invalid: - // do nothing - default: - return fmt.Errorf("%w: decimal must be unmarshal into integer type", ErrDecode) - } - case TokenShortBlob: - sz := int(token.Diff(prefix)) - str, err := nextFull(w, sz) - if err != nil { - return err - } - return putBlob(str, v, rv) - case TokenLongBlob: - lenSz := int(token.Diff(prefix)) - sz, err := nextBeInt(w, lenSz) - if err != nil { - return err - } - str, err := nextFull(w, sz) - if err != nil { - return err - } - return putBlob(str, v, rv) - case TokenShortList: - sz := int(token.Diff(prefix)) - buf, err := nextFull(w, sz) - if err != nil { - return err - } - return reflectList(newBuf(buf, 0), v, rv) - case TokenLongList: - lenSz := int(token.Diff(prefix)) - sz, err := nextBeInt(w, lenSz) - if err != nil { - return err - } - buf, err := nextFull(w, sz) - if err != nil { - return err - } - return reflectList(newBuf(buf, 0), v, rv) - case TokenUnknown: - return fmt.Errorf("%w: unknown token", ErrDecode) - } - return nil -} - -func putBlob(w []byte, v reflect.Value, rv reflect.Value) error { - switch v.Kind() { - case reflect.String: - v.SetString(string(w)) - case reflect.Slice: - if v.Type().Elem().Kind() != reflect.Uint8 { - return fmt.Errorf("%w: need to use uint8 as underlying if want slice output from longstring", ErrDecode) - } - v.SetBytes(w) - case reflect.Array: - if v.Type().Elem().Kind() != reflect.Uint8 { - return fmt.Errorf("%w: need to use uint8 as underlying if want array output from longstring", ErrDecode) - } - reflect.Copy(v, reflect.ValueOf(w)) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - val, err := BeInt(w, 0, len(w)) - if err != nil { - return err - } - v.SetInt(int64(val)) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - val, err := BeInt(w, 0, len(w)) - if err != nil { - return err - } - v.SetUint(uint64(val)) - case reflect.Invalid: - // do nothing - return nil - } - return nil -} - -func reflectList(w *buf, v reflect.Value, rv reflect.Value) error { - switch v.Kind() { - case reflect.Invalid: - // do nothing - return nil - case reflect.Map: - rv1 := reflect.New(v.Type().Key()) - v1 := rv1.Elem() - err := reflectAny(w, v1, rv1) - if err != nil { - return err - } - rv2 := reflect.New(v.Type().Elem()) - v2 := rv2.Elem() - err = reflectAny(w, v2, rv2) - if err != nil { - return err - } - v.SetMapIndex(rv1, rv2) - case reflect.Struct: - for idx := 0; idx < v.NumField(); idx++ { - // Decode into element. - rv1 := v.Field(idx).Addr() - rt1 := v.Type().Field(idx) - v1 := rv1.Elem() - shouldSet := rt1.IsExported() - if shouldSet { - err := reflectAny(w, v1, rv1) - if err != nil { - return err - } - } - } - case reflect.Array, reflect.Slice: - idx := 0 - for { - if idx >= v.Cap() { - v.Grow(1) - } - if idx >= v.Len() { - v.SetLen(idx + 1) - } - if idx < v.Len() { - // Decode into element. - rv1 := v.Index(idx) - v1 := rv1.Elem() - err := reflectAny(w, v1, rv1) - if err != nil { - return err - } - } else { - // Ran out of fixed array: skip. - rv1 := reflect.Value{} - err := reflectAny(w, rv1, rv1) - if err != nil { - return err - } - } - idx++ - } - } - return nil -} diff --git a/erigon-lib/rlp2/unmarshaler_test.go b/erigon-lib/rlp2/unmarshaler_test.go deleted file mode 100644 index 3887f93d011..00000000000 --- a/erigon-lib/rlp2/unmarshaler_test.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2024 The Erigon Authors -// This file is part of Erigon. -// -// Erigon is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Erigon is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Erigon. If not, see . - -package rlp_test - -import ( - "testing" - - rlp "github.com/erigontech/erigon-lib/rlp2" - "github.com/stretchr/testify/require" -) - -type plusOne int - -func (p *plusOne) UnmarshalRLP(data []byte) error { - var s int - err := rlp.Unmarshal(data, &s) - if err != nil { - return err - } - (*p) = plusOne(s + 1) - return nil -} - -func TestDecoder(t *testing.T) { - - type simple struct { - Key string - Value string - } - - t.Run("ShortString", func(t *testing.T) { - t.Run("ToString", func(t *testing.T) { - bts := []byte{0x83, 'd', 'o', 'g'} - var s string - err := rlp.Unmarshal(bts, &s) - require.NoError(t, err) - require.EqualValues(t, "dog", s) - }) - t.Run("ToBytes", func(t *testing.T) { - bts := []byte{0x83, 'd', 'o', 'g'} - var s []byte - err := rlp.Unmarshal(bts, &s) - require.NoError(t, err) - require.EqualValues(t, []byte("dog"), s) - }) - t.Run("ToInt", func(t *testing.T) { - bts := []byte{0x82, 0x04, 0x00} - var s int - err := rlp.Unmarshal(bts, &s) - require.NoError(t, err) - require.EqualValues(t, 1024, s) - }) - t.Run("ToIntUnmarshaler", func(t *testing.T) { - bts := []byte{0x82, 0x04, 0x00} - var s plusOne - err := rlp.Unmarshal(bts, &s) - require.NoError(t, err) - require.EqualValues(t, plusOne(1025), s) - }) - t.Run("ToSimpleStruct", func(t *testing.T) { - bts := []byte{0xc8, 0x83, 'c', 'a', 't', 0x83, 'd', 'o', 'g'} - var s simple - err := rlp.Unmarshal(bts, &s) - require.NoError(t, err) - require.EqualValues(t, simple{Key: "cat", Value: "dog"}, s) - }) - }) -} diff --git a/erigon-lib/rlp2/util.go b/erigon-lib/rlp2/util.go deleted file mode 100644 index c3d1de93d81..00000000000 --- a/erigon-lib/rlp2/util.go +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2024 The Erigon Authors -// This file is part of Erigon. -// -// Erigon is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Erigon is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Erigon. If not, see . - -package rlp - -type Token int32 - -func (T Token) String() string { - switch T { - case TokenDecimal: - return "decimal" - case TokenShortBlob: - return "short_blob" - case TokenLongBlob: - return "long_blob" - case TokenShortList: - return "short_list" - case TokenLongList: - return "long_list" - case TokenEOF: - return "eof" - case TokenUnknown: - return "unknown" - default: - return "nan" - } -} - -func (T Token) Plus(n byte) byte { - return byte(T) + n -} - -func (T Token) Diff(n byte) byte { - return n - byte(T) -} - -func (T Token) IsListType() bool { - return T == TokenLongList || T == TokenShortList -} - -func (T Token) IsBlobType() bool { - return T == TokenLongBlob || T == TokenShortBlob -} - -const ( - TokenDecimal Token = 0x00 - TokenShortBlob Token = 0x80 - TokenLongBlob Token = 0xb7 - TokenShortList Token = 0xc0 - TokenLongList Token = 0xf7 - - TokenUnknown Token = 0xff01 - TokenEOF Token = 0xdead -) - -func identifyToken(b byte) Token { - switch { - case b <= 127: - return TokenDecimal - case b >= 128 && b <= 183: - return TokenShortBlob - case b >= 184 && b <= 191: - return TokenLongBlob - case b >= 192 && b <= 247: - return TokenShortList - case b >= 248: - return TokenLongList - } - return TokenUnknown -} - -// BeInt parses Big Endian representation of an integer from given payload at given position -func nextBeInt(w *buf, length int) (int, error) { - dat, err := nextFull(w, length) - if err != nil { - return 0, ErrUnexpectedEOF - } - return BeInt(dat, 0, length) -} - -func nextFull(dat *buf, size int) ([]byte, error) { - d := dat.Next(size) - if len(d) != size { - return nil, ErrUnexpectedEOF - } - return d, nil -} diff --git a/eth/protocols/eth/protocol.go b/eth/protocols/eth/protocol.go index f17e6cbc85a..efae4740533 100644 --- a/eth/protocols/eth/protocol.go +++ b/eth/protocols/eth/protocol.go @@ -27,7 +27,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/direct" proto_sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" - rlp2 "github.com/erigontech/erigon-lib/rlp" + rlp2 "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/core/forkid" "github.com/erigontech/erigon/core/types" diff --git a/txnprovider/txpool/fetch.go b/txnprovider/txpool/fetch.go index 21838e85798..2277381620d 100644 --- a/txnprovider/txpool/fetch.go +++ b/txnprovider/txpool/fetch.go @@ -33,7 +33,7 @@ import ( sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" + rlp "github.com/erigontech/erigon-lib/rlp2" ) // Fetch connects to sentry and implements eth/66 protocol regarding the transaction diff --git a/txnprovider/txpool/pool_fuzz_test.go b/txnprovider/txpool/pool_fuzz_test.go index 4f90167f48c..fbdbc860f19 100644 --- a/txnprovider/txpool/pool_fuzz_test.go +++ b/txnprovider/txpool/pool_fuzz_test.go @@ -39,7 +39,7 @@ import ( "github.com/erigontech/erigon-lib/kv/memdb" "github.com/erigontech/erigon-lib/kv/temporal/temporaltest" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/rlp" + rlp "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg" ) diff --git a/txnprovider/txpool/pool_txn_packets.go b/txnprovider/txpool/pool_txn_packets.go index 25cf5a28c4a..26dec533275 100644 --- a/txnprovider/txpool/pool_txn_packets.go +++ b/txnprovider/txpool/pool_txn_packets.go @@ -22,7 +22,7 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/length" - "github.com/erigontech/erigon-lib/rlp" + rlp "github.com/erigontech/erigon-lib/rlp2" ) type NewPooledTransactionHashesPacket [][length.Hash]byte diff --git a/txnprovider/txpool/pool_txn_parser.go b/txnprovider/txpool/pool_txn_parser.go index 645658a6312..274ef637999 100644 --- a/txnprovider/txpool/pool_txn_parser.go +++ b/txnprovider/txpool/pool_txn_parser.go @@ -34,7 +34,7 @@ import ( "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon-lib/rlp" + rlp "github.com/erigontech/erigon-lib/rlp2" ) const ( diff --git a/txnprovider/txpool/send.go b/txnprovider/txpool/send.go index f5e25f1c75c..52b16c0e542 100644 --- a/txnprovider/txpool/send.go +++ b/txnprovider/txpool/send.go @@ -28,7 +28,7 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/p2p/sentry" - "github.com/erigontech/erigon-lib/rlp" + rlp "github.com/erigontech/erigon-lib/rlp2" ) // Send - does send concrete P2P messages to Sentry. Same as Fetch but for outbound traffic From 4b12ea35f00276cec4c62d84f2f113a6e7918114 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Fri, 29 Nov 2024 19:49:54 +0700 Subject: [PATCH 14/25] diffs: toString zero-copy (#12913) --- erigon-lib/state/domain_shared.go | 6 ++-- erigon-lib/state/state_changeset.go | 48 ++++++++++++++--------------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/erigon-lib/state/domain_shared.go b/erigon-lib/state/domain_shared.go index b632f82bdb8..db42e834f82 100644 --- a/erigon-lib/state/domain_shared.go +++ b/erigon-lib/state/domain_shared.go @@ -155,17 +155,17 @@ func (sd *SharedDomains) SavePastChangesetAccumulator(blockHash common.Hash, blo if sd.pastChangesAccumulator == nil { sd.pastChangesAccumulator = make(map[string]*StateChangeSet) } - var key [40]byte + key := make([]byte, 40) binary.BigEndian.PutUint64(key[:8], blockNumber) copy(key[8:], blockHash[:]) - sd.pastChangesAccumulator[string(key[:])] = acc + sd.pastChangesAccumulator[toStringZeroCopy(key)] = acc } func (sd *SharedDomains) GetDiffset(tx kv.RwTx, blockHash common.Hash, blockNumber uint64) ([kv.DomainLen][]DomainEntryDiff, bool, error) { var key [40]byte binary.BigEndian.PutUint64(key[:8], blockNumber) copy(key[8:], blockHash[:]) - if changeset, ok := sd.pastChangesAccumulator[string(key[:])]; ok { + if changeset, ok := sd.pastChangesAccumulator[toStringZeroCopy(key[:])]; ok { return [kv.DomainLen][]DomainEntryDiff{ changeset.Diffs[kv.AccountsDomain].GetDiffSet(), changeset.Diffs[kv.StorageDomain].GetDiffSet(), diff --git a/erigon-lib/state/state_changeset.go b/erigon-lib/state/state_changeset.go index 7b0d9b4838c..439f1f6f4ff 100644 --- a/erigon-lib/state/state_changeset.go +++ b/erigon-lib/state/state_changeset.go @@ -19,6 +19,7 @@ package state import ( "bytes" "encoding/binary" + "maps" "math" "sort" @@ -54,16 +55,7 @@ type StateDiffDomain struct { } func (d *StateDiffDomain) Copy() *StateDiffDomain { - res := &StateDiffDomain{} - res.keys = make(map[string][]byte) - res.prevValues = make(map[string][]byte) - for k, v := range d.keys { - res.keys[k] = v - } - for k, v := range d.prevValues { - res.prevValues[k] = v - } - return res + return &StateDiffDomain{keys: maps.Clone(d.keys), prevValues: maps.Clone(d.prevValues)} } // RecordDelta records a state change. @@ -77,20 +69,24 @@ func (d *StateDiffDomain) DomainUpdate(key1, key2, prevValue, stepBytes []byte, prevStepBytes := make([]byte, 8) binary.BigEndian.PutUint64(prevStepBytes, ^prevStep) - key := append(common.Copy(key1), key2...) + key := make([]byte, len(key1)+len(key2)) + copy(key, key1) + copy(key[len(key1):], key2) - if _, ok := d.keys[string(key)]; !ok { - d.keys[string(key)] = prevStepBytes + keyS := toStringZeroCopy(key) + if _, ok := d.keys[keyS]; !ok { + d.keys[keyS] = prevStepBytes } - prevValue = common.Copy(prevValue) - - valsKey := string(append(common.Copy(key), stepBytes...)) - if _, ok := d.prevValues[valsKey]; !ok { + valsKey := make([]byte, len(key)+len(stepBytes)) + copy(valsKey, key) + copy(valsKey[len(key):], stepBytes) + valsKeyS := toStringZeroCopy(valsKey) + if _, ok := d.prevValues[valsKeyS]; !ok { if bytes.Equal(stepBytes, prevStepBytes) { - d.prevValues[valsKey] = prevValue + d.prevValues[valsKeyS] = common.Copy(prevValue) } else { - d.prevValues[valsKey] = []byte{} // We need to delete the current step but restore the previous one + d.prevValues[valsKeyS] = []byte{} // We need to delete the current step but restore the previous one } d.prevValsSlice = nil } @@ -109,7 +105,7 @@ func (d *StateDiffDomain) GetDiffSet() (keysToValue []DomainEntryDiff) { }) } sort.Slice(d.prevValsSlice, func(i, j int) bool { - return string(d.prevValsSlice[i].Key) < string(d.prevValsSlice[j].Key) + return bytes.Compare(d.prevValsSlice[i].Key, d.prevValsSlice[j].Key) < 0 }) return d.prevValsSlice @@ -121,10 +117,11 @@ func SerializeDiffSet(diffSet []DomainEntryDiff, out []byte) []byte { dict := make(map[string]byte) id := byte(0x00) for _, diff := range diffSet { - if _, ok := dict[string(diff.PrevStepBytes)]; ok { + prevStepS := toStringZeroCopy(diff.PrevStepBytes) + if _, ok := dict[prevStepS]; ok { continue } - dict[string(diff.PrevStepBytes)] = id + dict[prevStepS] = id id++ } // Write the dictionary @@ -145,7 +142,7 @@ func SerializeDiffSet(diffSet []DomainEntryDiff, out []byte) []byte { binary.BigEndian.PutUint32(tmp, uint32(len(diff.Value))) ret = append(ret, tmp...) ret = append(ret, diff.Value...) - ret = append(ret, dict[string(diff.PrevStepBytes)]) + ret = append(ret, dict[toStringZeroCopy(diff.PrevStepBytes)]) } return ret } @@ -155,10 +152,11 @@ func SerializeDiffSetBufLen(diffSet []DomainEntryDiff) int { dict := make(map[string]byte) id := byte(0x00) for _, diff := range diffSet { - if _, ok := dict[string(diff.PrevStepBytes)]; ok { + prevStepS := toStringZeroCopy(diff.PrevStepBytes) + if _, ok := dict[prevStepS]; ok { continue } - dict[string(diff.PrevStepBytes)] = id + dict[prevStepS] = id id++ } // Write the dictionary From 2f32cd2493f4a157557a717f2b88700ab23ed7cd Mon Sep 17 00:00:00 2001 From: ledgerwatch Date: Fri, 29 Nov 2024 12:59:27 +0000 Subject: [PATCH 15/25] Fix externalcl integration for erigon3 (#12906) Fixes https://github.com/erigontech/erigon/issues/12225 --- erigon-lib/kv/mdbx/kv_mdbx_temporary.go | 2 +- eth/stagedsync/stage_bodies.go | 2 +- .../sentry_multi_client.go | 3 +- .../block_downloader.go | 3 +- .../engineapi/engine_block_downloader/body.go | 2 +- .../engineapi/engine_block_downloader/core.go | 11 ++++- turbo/engineapi/engine_server.go | 1 - turbo/stages/bodydownload/body_algos.go | 40 ++----------------- turbo/stages/bodydownload/body_test.go | 2 +- 9 files changed, 20 insertions(+), 46 deletions(-) diff --git a/erigon-lib/kv/mdbx/kv_mdbx_temporary.go b/erigon-lib/kv/mdbx/kv_mdbx_temporary.go index aa4e87f5f16..879a2e95fe4 100644 --- a/erigon-lib/kv/mdbx/kv_mdbx_temporary.go +++ b/erigon-lib/kv/mdbx/kv_mdbx_temporary.go @@ -37,7 +37,7 @@ func NewTemporaryMdbx(ctx context.Context, tempdir string) (kv.RwDB, error) { return &TemporaryMdbx{}, err } - db, err := New(kv.ChainDB, log.Root()).InMem(path).Open(ctx) + db, err := New(kv.ChainDB, log.Root()).InMem(path).GrowthStep(64 * datasize.MB).Open(ctx) if err != nil { return &TemporaryMdbx{}, err } diff --git a/eth/stagedsync/stage_bodies.go b/eth/stagedsync/stage_bodies.go index 4b9364252c4..9e403ccf7ce 100644 --- a/eth/stagedsync/stage_bodies.go +++ b/eth/stagedsync/stage_bodies.go @@ -98,7 +98,7 @@ func BodiesForward(s *StageState, u Unwinder, ctx context.Context, tx kv.RwTx, c } } // This will update bd.maxProgress - if _, _, _, _, err = cfg.bd.UpdateFromDb(tx); err != nil { + if err = cfg.bd.UpdateFromDb(tx); err != nil { return err } defer cfg.bd.ClearBodyCache() diff --git a/p2p/sentry/sentry_multi_client/sentry_multi_client.go b/p2p/sentry/sentry_multi_client/sentry_multi_client.go index 21f6d5c6707..64a82af96bd 100644 --- a/p2p/sentry/sentry_multi_client/sentry_multi_client.go +++ b/p2p/sentry/sentry_multi_client/sentry_multi_client.go @@ -202,8 +202,7 @@ func NewMultiClient( if !disableBlockDownload { bd = bodydownload.NewBodyDownload(engine, blockBufferSize, int(syncCfg.BodyCacheLimit), blockReader, logger) if err := db.View(context.Background(), func(tx kv.Tx) error { - _, _, _, _, err := bd.UpdateFromDb(tx) - return err + return bd.UpdateFromDb(tx) }); err != nil { return nil, err } diff --git a/turbo/engineapi/engine_block_downloader/block_downloader.go b/turbo/engineapi/engine_block_downloader/block_downloader.go index b2449124595..7b748cff0fa 100644 --- a/turbo/engineapi/engine_block_downloader/block_downloader.go +++ b/turbo/engineapi/engine_block_downloader/block_downloader.go @@ -222,7 +222,6 @@ func (e *EngineBlockDownloader) loadDownloadedHeaders(tx kv.RwTx) (fromBlock uin func saveHeader(db kv.RwTx, header *types.Header, hash libcommon.Hash) error { blockHeight := header.Number.Uint64() // TODO(yperbasis): do we need to check if the header is already inserted (oldH)? - parentTd, err := rawdb.ReadTd(db, header.ParentHash, blockHeight-1) if err != nil || parentTd == nil { return fmt.Errorf("[saveHeader] parent's total difficulty not found with hash %x and height %d for header %x %d: %v", header.ParentHash, blockHeight-1, hash, blockHeight, err) @@ -235,7 +234,7 @@ func saveHeader(db kv.RwTx, header *types.Header, hash libcommon.Hash) error { return fmt.Errorf("[saveHeader] failed to WriteTd: %w", err) } if err = rawdb.WriteCanonicalHash(db, hash, blockHeight); err != nil { - return fmt.Errorf("[saveHeader] failed to canonical hash: %w", err) + return fmt.Errorf("[saveHeader] failed to save canonical hash: %w", err) } return nil } diff --git a/turbo/engineapi/engine_block_downloader/body.go b/turbo/engineapi/engine_block_downloader/body.go index 645d4a3651e..5d440ff680f 100644 --- a/turbo/engineapi/engine_block_downloader/body.go +++ b/turbo/engineapi/engine_block_downloader/body.go @@ -50,7 +50,7 @@ func (e *EngineBlockDownloader) downloadAndLoadBodiesSyncronously(ctx context.Co timeout := e.timeout // This will update bd.maxProgress - if _, _, _, _, err = e.bd.UpdateFromDb(tx); err != nil { + if err = e.bd.UpdateFromDb(tx); err != nil { return } defer e.bd.ClearBodyCache() diff --git a/turbo/engineapi/engine_block_downloader/core.go b/turbo/engineapi/engine_block_downloader/core.go index 1e9352f4388..adf9f61d7a3 100644 --- a/turbo/engineapi/engine_block_downloader/core.go +++ b/turbo/engineapi/engine_block_downloader/core.go @@ -23,6 +23,7 @@ import ( execution "github.com/erigontech/erigon-lib/gointerfaces/executionproto" "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/kv/membatchwithdb" + "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/turbo/stages/headerdownload" ) @@ -79,9 +80,17 @@ func (e *EngineBlockDownloader) download(ctx context.Context, hashToDownload lib memoryMutation := membatchwithdb.NewMemoryBatchWithCustomDB(tx, tmpDb, tmpTx) defer memoryMutation.Rollback() + if block != nil { + err = rawdb.WriteCanonicalHash(memoryMutation, block.Hash(), block.NumberU64()) + if err != nil { + e.logger.Warn("[EngineBlockDownloader] Could not make leading header canonical", "err", err) + e.status.Store(headerdownload.Idle) + return + } + } startBlock, endBlock, startHash, err := e.loadDownloadedHeaders(memoryMutation) if err != nil { - e.logger.Warn("[EngineBlockDownloader] Could load headers", "err", err) + e.logger.Warn("[EngineBlockDownloader] Could not load headers", "err", err) e.status.Store(headerdownload.Idle) return } diff --git a/turbo/engineapi/engine_server.go b/turbo/engineapi/engine_server.go index d8b8348f358..ae27bc21060 100644 --- a/turbo/engineapi/engine_server.go +++ b/turbo/engineapi/engine_server.go @@ -868,7 +868,6 @@ func (e *EngineServer) HandleNewPayload( if !success { return &engine_types.PayloadStatus{Status: engine_types.SyncingStatus}, nil } - status, _, latestValidHash, err := e.chainRW.ValidateChain(ctx, headerHash, headerNumber) if err != nil { return nil, err diff --git a/turbo/stages/bodydownload/body_algos.go b/turbo/stages/bodydownload/body_algos.go index 509af2bc67b..b6580584ce5 100644 --- a/turbo/stages/bodydownload/body_algos.go +++ b/turbo/stages/bodydownload/body_algos.go @@ -19,7 +19,6 @@ package bodydownload import ( "bytes" "context" - "errors" "fmt" "math/big" @@ -33,19 +32,18 @@ import ( "github.com/erigontech/erigon/eth/stagedsync/stages" "github.com/erigontech/erigon/turbo/adapter" "github.com/erigontech/erigon/turbo/services" - "github.com/holiman/uint256" ) // UpdateFromDb reads the state of the database and refreshes the state of the body download -func (bd *BodyDownload) UpdateFromDb(db kv.Tx) (headHeight, headTime uint64, headHash libcommon.Hash, headTd256 *uint256.Int, err error) { +func (bd *BodyDownload) UpdateFromDb(db kv.Tx) (err error) { var headerProgress, bodyProgress uint64 headerProgress, err = stages.GetStageProgress(db, stages.Headers) if err != nil { - return 0, 0, libcommon.Hash{}, nil, err + return err } bodyProgress, err = stages.GetStageProgress(db, stages.Bodies) if err != nil { - return 0, 0, libcommon.Hash{}, nil, err + return err } bd.maxProgress = headerProgress + 1 // Resetting for requesting a new range of blocks @@ -58,37 +56,7 @@ func (bd *BodyDownload) UpdateFromDb(db kv.Tx) (headHeight, headTime uint64, hea clear(bd.requests) clear(bd.peerMap) bd.ClearBodyCache() - headHeight = bodyProgress - var ok bool - headHash, ok, err = bd.br.CanonicalHash(context.Background(), db, headHeight) - if err != nil { - return 0, 0, libcommon.Hash{}, nil, err - } - if !ok { - return 0, 0, libcommon.Hash{}, nil, fmt.Errorf("canonical marker not found: %d", headHeight) - } - var headTd *big.Int - headTd, err = rawdb.ReadTd(db, headHash, headHeight) - if err != nil { - return 0, 0, libcommon.Hash{}, nil, fmt.Errorf("reading total difficulty for head height %d and hash %x: %d, %w", headHeight, headHash, headTd, err) - } - if headTd == nil { - headTd = new(big.Int) - } - headTd256 = new(uint256.Int) - overflow := headTd256.SetFromBig(headTd) - if overflow { - return 0, 0, libcommon.Hash{}, nil, errors.New("headTd higher than 2^256-1") - } - headTime = 0 - headHeader, err := bd.br.Header(context.Background(), db, headHash, headHeight) - if err != nil { - return 0, 0, libcommon.Hash{}, nil, fmt.Errorf("reading header for head height %d and hash %x: %d, %w", headHeight, headHash, headTd, err) - } - if headHeader != nil { - headTime = headHeader.Time - } - return headHeight, headTime, headHash, headTd256, nil + return nil } // RequestMoreBodies - returns nil if nothing to request diff --git a/turbo/stages/bodydownload/body_test.go b/turbo/stages/bodydownload/body_test.go index 4164eb977e7..2545b0d6cd5 100644 --- a/turbo/stages/bodydownload/body_test.go +++ b/turbo/stages/bodydownload/body_test.go @@ -33,7 +33,7 @@ func TestCreateBodyDownload(t *testing.T) { require.NoError(t, err) defer tx.Rollback() bd := bodydownload.NewBodyDownload(ethash.NewFaker(), 128, 100, m.BlockReader, m.Log) - if _, _, _, _, err := bd.UpdateFromDb(tx); err != nil { + if err := bd.UpdateFromDb(tx); err != nil { t.Fatalf("update from db: %v", err) } } From 05bfe7bb88b73bff246664b94f3d7b1d21d5610e Mon Sep 17 00:00:00 2001 From: antonis19 Date: Fri, 29 Nov 2024 15:56:15 +0100 Subject: [PATCH 16/25] Move `rlp` to `erigon-lib/rlp` (#12919) Follow-up to : https://github.com/erigontech/erigon/pull/12915 --------- Co-authored-by: antonis19 --- accounts/abi/bind/base_test.go | 2 +- .../services/polygon/heimdallsim/heimdall_simulator.go | 2 +- cmd/devnet/services/polygon/proofgenerator.go | 2 +- cmd/devnet/services/polygon/proofgenerator_test.go | 2 +- cmd/evm/internal/t8ntool/transition.go | 2 +- cmd/hack/hack.go | 2 +- cmd/observer/observer/handshake.go | 2 +- cmd/rlpdump/main.go | 2 +- cmd/rpcdaemon/rpcservices/eth_backend.go | 2 +- consensus/aura/aura.go | 2 +- consensus/aura/empty_step.go | 2 +- consensus/aura/validators.go | 2 +- consensus/clique/clique.go | 2 +- consensus/consensus.go | 2 +- consensus/ethash/consensus.go | 2 +- core/blockchain.go | 2 +- core/chain_makers.go | 2 +- core/forkid/forkid_test.go | 2 +- core/mkalloc.go | 2 +- core/rawdb/accessors_chain.go | 2 +- core/rawdb/accessors_chain_test.go | 2 +- core/rlp_test.go | 2 +- core/snaptype/block_types.go | 2 +- core/state/state_object.go | 2 +- core/types/access_list_tx.go | 2 +- core/types/accounts/account.go | 2 +- core/types/authorization.go | 2 +- core/types/blob_tx.go | 2 +- core/types/blob_tx_wrapper.go | 2 +- core/types/block.go | 2 +- core/types/block_test.go | 2 +- core/types/dynamic_fee_tx.go | 2 +- core/types/encdec_test.go | 2 +- core/types/hashing.go | 2 +- core/types/hashing_test.go | 2 +- core/types/legacy_tx.go | 2 +- core/types/log.go | 2 +- core/types/receipt.go | 2 +- core/types/receipt_test.go | 2 +- core/types/set_code_tx.go | 2 +- core/types/transaction.go | 2 +- core/types/transaction_test.go | 2 +- core/types/withdrawal.go | 2 +- core/vm/runtime/runtime_test.go | 2 +- erigon-lib/.golangci.yml | 5 +++++ {rlp => erigon-lib/rlp}/decode.go | 0 {rlp => erigon-lib/rlp}/decode_tail_test.go | 0 {rlp => erigon-lib/rlp}/decode_test.go | 0 {rlp => erigon-lib/rlp}/doc.go | 0 {rlp => erigon-lib/rlp}/encbuffer.go | 0 {rlp => erigon-lib/rlp}/encode.go | 0 {rlp => erigon-lib/rlp}/encode_test.go | 0 {rlp => erigon-lib/rlp}/encoder_example_test.go | 0 {rlp => erigon-lib/rlp}/internal/rlpstruct/rlpstruct.go | 0 {rlp => erigon-lib/rlp}/iterator.go | 0 {rlp => erigon-lib/rlp}/iterator_test.go | 0 {rlp => erigon-lib/rlp}/raw.go | 0 {rlp => erigon-lib/rlp}/raw_test.go | 0 {rlp => erigon-lib/rlp}/typecache.go | 0 eth/consensuschain/consensus_chain_reader.go | 2 +- eth/protocols/eth/discovery.go | 2 +- eth/protocols/eth/handler_test.go | 2 +- eth/protocols/eth/handlers.go | 2 +- eth/protocols/eth/protocol.go | 2 +- eth/protocols/eth/protocol_test.go | 2 +- eth/stagedsync/chain_reader.go | 2 +- eth/stagedsync/stage_headers.go | 2 +- eth/stagedsync/stage_polygon_sync.go | 2 +- ethdb/privateapi/ethbackend.go | 2 +- ethdb/privateapi/mining.go | 2 +- p2p/discover/v4wire/v4wire.go | 2 +- p2p/discover/v4wire/v4wire_test.go | 2 +- p2p/discover/v5_udp_test.go | 2 +- p2p/discover/v5wire/encoding.go | 2 +- p2p/discover/v5wire/msg.go | 2 +- p2p/dnsdisc/tree.go | 2 +- p2p/enode/idscheme.go | 2 +- p2p/enode/idscheme_test.go | 2 +- p2p/enode/node.go | 2 +- p2p/enode/node_test.go | 2 +- p2p/enode/nodedb.go | 2 +- p2p/enr/enr.go | 2 +- p2p/enr/enr_test.go | 2 +- p2p/enr/entries.go | 2 +- p2p/message.go | 2 +- p2p/peer.go | 2 +- p2p/rlpx/rlpx.go | 2 +- p2p/rlpx/rlpx_test.go | 2 +- p2p/sentry/sentry_grpc_server.go | 2 +- p2p/sentry/sentry_multi_client/broadcast.go | 2 +- p2p/sentry/sentry_multi_client/sentry_api.go | 2 +- p2p/sentry/sentry_multi_client/sentry_multi_client.go | 2 +- p2p/sentry/simulator/sentry_simulator.go | 2 +- p2p/sentry/simulator/simulator_test.go | 2 +- p2p/transport.go | 2 +- p2p/transport_test.go | 2 +- polygon/bor/bor.go | 2 +- polygon/bor/bor_test.go | 2 +- polygon/bor/spanner.go | 2 +- polygon/bor/state_receiver.go | 2 +- polygon/bor/state_receiver_mock.go | 2 +- polygon/bridge/mdbx_store.go | 2 +- polygon/bridge/reader.go | 2 +- polygon/bridge/snapshot_store.go | 2 +- polygon/bridge/store.go | 2 +- polygon/heimdall/event_record.go | 2 +- polygon/heimdall/snapshots.go | 2 +- polygon/p2p/fetcher_base_test.go | 2 +- polygon/p2p/message_listener.go | 2 +- polygon/p2p/message_listener_test.go | 2 +- polygon/p2p/message_sender.go | 2 +- polygon/p2p/message_sender_test.go | 2 +- tests/block_test_util.go | 2 +- tests/fuzzers/rlp/rlp_fuzzer.go | 2 +- tests/rlp_test_util.go | 2 +- tests/state_test_util.go | 2 +- turbo/app/import_cmd.go | 2 +- turbo/engineapi/engine_block_downloader/block_downloader.go | 2 +- turbo/jsonrpc/debug_api.go | 2 +- turbo/jsonrpc/eth_block_test.go | 2 +- turbo/jsonrpc/eth_mining_test.go | 2 +- turbo/jsonrpc/eth_subscribe_test.go | 2 +- turbo/jsonrpc/send_transaction_test.go | 2 +- turbo/rlphacks/bytes_test.go | 2 +- turbo/rpchelper/filters.go | 2 +- turbo/services/interfaces.go | 2 +- turbo/snapshotsync/freezeblocks/block_reader.go | 2 +- turbo/snapshotsync/freezeblocks/block_snapshots.go | 2 +- turbo/snapshotsync/freezeblocks/dump_test.go | 2 +- turbo/stages/blockchain_test.go | 2 +- turbo/stages/chain_makers_test.go | 2 +- turbo/stages/headerdownload/header_algo_test.go | 2 +- turbo/stages/headerdownload/header_algos.go | 2 +- turbo/stages/headerdownload/header_data_struct.go | 2 +- turbo/stages/mock/mock_sentry.go | 2 +- turbo/stages/mock/sentry_mock_test.go | 2 +- turbo/trie/encoding.go | 2 +- turbo/trie/hack.go | 2 +- turbo/trie/hashbuilder.go | 2 +- turbo/trie/hasher.go | 2 +- turbo/trie/node.go | 2 +- turbo/trie/proof.go | 2 +- turbo/trie/trie_test.go | 2 +- 143 files changed, 133 insertions(+), 128 deletions(-) rename {rlp => erigon-lib/rlp}/decode.go (100%) rename {rlp => erigon-lib/rlp}/decode_tail_test.go (100%) rename {rlp => erigon-lib/rlp}/decode_test.go (100%) rename {rlp => erigon-lib/rlp}/doc.go (100%) rename {rlp => erigon-lib/rlp}/encbuffer.go (100%) rename {rlp => erigon-lib/rlp}/encode.go (100%) rename {rlp => erigon-lib/rlp}/encode_test.go (100%) rename {rlp => erigon-lib/rlp}/encoder_example_test.go (100%) rename {rlp => erigon-lib/rlp}/internal/rlpstruct/rlpstruct.go (100%) rename {rlp => erigon-lib/rlp}/iterator.go (100%) rename {rlp => erigon-lib/rlp}/iterator_test.go (100%) rename {rlp => erigon-lib/rlp}/raw.go (100%) rename {rlp => erigon-lib/rlp}/raw_test.go (100%) rename {rlp => erigon-lib/rlp}/typecache.go (100%) diff --git a/accounts/abi/bind/base_test.go b/accounts/abi/bind/base_test.go index 91e5bed7c54..1aa2bea4f30 100644 --- a/accounts/abi/bind/base_test.go +++ b/accounts/abi/bind/base_test.go @@ -30,10 +30,10 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" ) type mockCaller struct { diff --git a/cmd/devnet/services/polygon/heimdallsim/heimdall_simulator.go b/cmd/devnet/services/polygon/heimdallsim/heimdall_simulator.go index 1904340e036..820735855e8 100644 --- a/cmd/devnet/services/polygon/heimdallsim/heimdall_simulator.go +++ b/cmd/devnet/services/polygon/heimdallsim/heimdall_simulator.go @@ -26,10 +26,10 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/downloader/snaptype" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/polygon/bridge" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks" ) diff --git a/cmd/devnet/services/polygon/proofgenerator.go b/cmd/devnet/services/polygon/proofgenerator.go index c1a3ff948d4..15d64c5ae56 100644 --- a/cmd/devnet/services/polygon/proofgenerator.go +++ b/cmd/devnet/services/polygon/proofgenerator.go @@ -32,13 +32,13 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/cl/merkle_tree" "github.com/erigontech/erigon/cmd/devnet/devnet" "github.com/erigontech/erigon/cmd/devnet/requests" "github.com/erigontech/erigon/core/types" bortypes "github.com/erigontech/erigon/polygon/bor/types" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/jsonrpc" "github.com/erigontech/erigon/turbo/trie" diff --git a/cmd/devnet/services/polygon/proofgenerator_test.go b/cmd/devnet/services/polygon/proofgenerator_test.go index 301fa095f25..2d65745c151 100644 --- a/cmd/devnet/services/polygon/proofgenerator_test.go +++ b/cmd/devnet/services/polygon/proofgenerator_test.go @@ -39,6 +39,7 @@ import ( "github.com/erigontech/erigon-lib/kv/memdb" "github.com/erigontech/erigon-lib/kv/rawdbv3" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/cmd/devnet/blocks" "github.com/erigontech/erigon/cmd/devnet/requests" @@ -49,7 +50,6 @@ import ( "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/polygon/bor" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/jsonrpc" "github.com/erigontech/erigon/turbo/services" diff --git a/cmd/evm/internal/t8ntool/transition.go b/cmd/evm/internal/t8ntool/transition.go index 1bb6de532e3..903685dafc1 100644 --- a/cmd/evm/internal/t8ntool/transition.go +++ b/cmd/evm/internal/t8ntool/transition.go @@ -44,6 +44,7 @@ import ( "github.com/erigontech/erigon-lib/kv/rawdbv3" "github.com/erigontech/erigon-lib/kv/temporal/temporaltest" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" libstate "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/consensus/merge" @@ -53,7 +54,6 @@ import ( "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/eth/consensuschain" trace_logger "github.com/erigontech/erigon/eth/tracers/logger" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/tests" "github.com/erigontech/erigon/turbo/jsonrpc" ) diff --git a/cmd/hack/hack.go b/cmd/hack/hack.go index ee441c6993f..aea30b87721 100644 --- a/cmd/hack/hack.go +++ b/cmd/hack/hack.go @@ -45,6 +45,7 @@ import ( "github.com/erigontech/erigon-lib/recsplit/eliasfano32" "github.com/erigontech/erigon-lib/seg" + "github.com/erigontech/erigon-lib/rlp" hackdb "github.com/erigontech/erigon/cmd/hack/db" "github.com/erigontech/erigon/cmd/hack/flow" "github.com/erigontech/erigon/cmd/hack/tool" @@ -56,7 +57,6 @@ import ( "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/eth/stagedsync/stages" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/debug" "github.com/erigontech/erigon/turbo/logging" "github.com/erigontech/erigon/turbo/services" diff --git a/cmd/observer/observer/handshake.go b/cmd/observer/observer/handshake.go index 3b89313de31..3eb104a1a34 100644 --- a/cmd/observer/observer/handshake.go +++ b/cmd/observer/observer/handshake.go @@ -28,13 +28,13 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/direct" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/forkid" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p" "github.com/erigontech/erigon/p2p/rlpx" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" ) // https://github.com/ethereum/devp2p/blob/master/rlpx.md#p2p-capability diff --git a/cmd/rlpdump/main.go b/cmd/rlpdump/main.go index a205a369ccf..2fd6e9df405 100644 --- a/cmd/rlpdump/main.go +++ b/cmd/rlpdump/main.go @@ -29,7 +29,7 @@ import ( "os" "strings" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) var ( diff --git a/cmd/rpcdaemon/rpcservices/eth_backend.go b/cmd/rpcdaemon/rpcservices/eth_backend.go index fe38cac8334..68e06fabe83 100644 --- a/cmd/rpcdaemon/rpcservices/eth_backend.go +++ b/cmd/rpcdaemon/rpcservices/eth_backend.go @@ -36,13 +36,13 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces" remote "github.com/erigontech/erigon-lib/gointerfaces/remoteproto" "github.com/erigontech/erigon-lib/kv" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/ethdb/privateapi" "github.com/erigontech/erigon/p2p" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/snapshotsync" ) diff --git a/consensus/aura/aura.go b/consensus/aura/aura.go index 05000a6bf34..1ce7be14920 100644 --- a/consensus/aura/aura.go +++ b/consensus/aura/aura.go @@ -33,6 +33,7 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/clique" "github.com/erigontech/erigon/consensus/ethash" @@ -40,7 +41,6 @@ import ( "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/vm/evmtypes" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" ) diff --git a/consensus/aura/empty_step.go b/consensus/aura/empty_step.go index 37a498dd827..b95c16c177c 100644 --- a/consensus/aura/empty_step.go +++ b/consensus/aura/empty_step.go @@ -25,7 +25,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) // A message broadcast by authorities when it's their turn to seal a block but there are no diff --git a/consensus/aura/validators.go b/consensus/aura/validators.go index f6883b0981a..3f8a16cbd2c 100644 --- a/consensus/aura/validators.go +++ b/consensus/aura/validators.go @@ -31,6 +31,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/common" @@ -38,7 +39,6 @@ import ( "github.com/erigontech/erigon/consensus/aura/auraabi" "github.com/erigontech/erigon/consensus/aura/aurainterfaces" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" ) // nolint diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index 47b5cf61d83..973819aad2c 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -42,6 +42,7 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/dbutils" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/state" @@ -50,7 +51,6 @@ import ( "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/core/vm/evmtypes" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/services" ) diff --git a/consensus/consensus.go b/consensus/consensus.go index fb8c00ae76a..0429f57e335 100644 --- a/consensus/consensus.go +++ b/consensus/consensus.go @@ -29,11 +29,11 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/vm/evmtypes" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" ) diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index fbb3130f8b8..6163742ed7d 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -36,6 +36,7 @@ import ( "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/ethash/ethashcfg" @@ -44,7 +45,6 @@ import ( "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" ) // Ethash proof-of-work protocol constants. diff --git a/core/blockchain.go b/core/blockchain.go index eb6f35ff483..6bba592b454 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -36,6 +36,7 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/metrics" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/state" @@ -45,7 +46,6 @@ import ( "github.com/erigontech/erigon/core/vm/evmtypes" "github.com/erigontech/erigon/eth/ethutils" bortypes "github.com/erigontech/erigon/polygon/bor/types" - "github.com/erigontech/erigon/rlp" ) var ( diff --git a/core/chain_makers.go b/core/chain_makers.go index 5ab070225d8..fde0aa3ccd5 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -33,6 +33,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/kv" + "github.com/erigontech/erigon-lib/rlp" libstate "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/merge" @@ -43,7 +44,6 @@ import ( "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" ) // BlockGen creates blocks for testing. diff --git a/core/forkid/forkid_test.go b/core/forkid/forkid_test.go index 4e1907f1415..37b69875e95 100644 --- a/core/forkid/forkid_test.go +++ b/core/forkid/forkid_test.go @@ -27,8 +27,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" ) // TestCreation tests that different genesis and fork rule combinations result in diff --git a/core/mkalloc.go b/core/mkalloc.go index 184187cef44..125190f2357 100644 --- a/core/mkalloc.go +++ b/core/mkalloc.go @@ -35,8 +35,8 @@ import ( "sort" "strconv" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" ) type allocItem struct{ Addr, Balance *big.Int } diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index 694e82d6b73..55a6641c3b3 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -40,9 +40,9 @@ import ( "github.com/erigontech/erigon-lib/kv/dbutils" "github.com/erigontech/erigon-lib/kv/rawdbv3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/ethdb/cbor" - "github.com/erigontech/erigon/rlp" ) // ReadCanonicalHash retrieves the hash assigned to a canonical block number. diff --git a/core/rawdb/accessors_chain_test.go b/core/rawdb/accessors_chain_test.go index 4b88e04ae1e..286adc5533e 100644 --- a/core/rawdb/accessors_chain_test.go +++ b/core/rawdb/accessors_chain_test.go @@ -34,11 +34,11 @@ import ( "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv/memdb" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/core/rlp_test.go b/core/rlp_test.go index 82eb876d904..502df7026f0 100644 --- a/core/rlp_test.go +++ b/core/rlp_test.go @@ -30,12 +30,12 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/core/snaptype/block_types.go b/core/snaptype/block_types.go index 98bf47a284f..62854c1a163 100644 --- a/core/snaptype/block_types.go +++ b/core/snaptype/block_types.go @@ -36,9 +36,9 @@ import ( "github.com/erigontech/erigon-lib/downloader/snaptype" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/recsplit" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon-lib/seg" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/txnprovider/txpool" ) diff --git a/core/state/state_object.go b/core/state/state_object.go index 00f52adf149..21a3a833e69 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -29,9 +29,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types/accounts" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/trie" ) diff --git a/core/types/access_list_tx.go b/core/types/access_list_tx.go index 9a80fb6c5c3..eeadb2949e6 100644 --- a/core/types/access_list_tx.go +++ b/core/types/access_list_tx.go @@ -31,8 +31,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/rlp" rlp2 "github.com/erigontech/erigon-lib/rlp2" - "github.com/erigontech/erigon/rlp" ) // AccessTuple is the element type of an access list. diff --git a/core/types/accounts/account.go b/core/types/accounts/account.go index 0fb527e09ce..2c14bbb2b79 100644 --- a/core/types/accounts/account.go +++ b/core/types/accounts/account.go @@ -26,8 +26,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" rlp2 "github.com/erigontech/erigon-lib/rlp2" - "github.com/erigontech/erigon/rlp" ) // Account is the Ethereum consensus representation of accounts. diff --git a/core/types/authorization.go b/core/types/authorization.go index 68c1e3e3300..35a39e16d68 100644 --- a/core/types/authorization.go +++ b/core/types/authorization.go @@ -11,9 +11,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" rlp2 "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" ) type Authorization struct { diff --git a/core/types/blob_tx.go b/core/types/blob_tx.go index 3a6001eb6ac..9ac4228cafd 100644 --- a/core/types/blob_tx.go +++ b/core/types/blob_tx.go @@ -27,8 +27,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/fixedgas" + "github.com/erigontech/erigon-lib/rlp" rlp2 "github.com/erigontech/erigon-lib/rlp2" - "github.com/erigontech/erigon/rlp" ) type BlobTx struct { diff --git a/core/types/blob_tx_wrapper.go b/core/types/blob_tx_wrapper.go index 2f0a761f388..1f6a9b3a84e 100644 --- a/core/types/blob_tx_wrapper.go +++ b/core/types/blob_tx_wrapper.go @@ -30,7 +30,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/fixedgas" libkzg "github.com/erigontech/erigon-lib/crypto/kzg" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) const ( diff --git a/core/types/block.go b/core/types/block.go index d961784dc60..fdba3f61d70 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -35,9 +35,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/hexutility" + "github.com/erigontech/erigon-lib/rlp" rlp2 "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/rlp" ) var ( diff --git a/core/types/block_test.go b/core/types/block_test.go index 87abce6ebd2..2ff2599f430 100644 --- a/core/types/block_test.go +++ b/core/types/block_test.go @@ -37,10 +37,10 @@ import ( "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" ) // the following 2 functions are replica for the test diff --git a/core/types/dynamic_fee_tx.go b/core/types/dynamic_fee_tx.go index a03a53e017f..d9a6ed7a54a 100644 --- a/core/types/dynamic_fee_tx.go +++ b/core/types/dynamic_fee_tx.go @@ -29,8 +29,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/rlp" rlp2 "github.com/erigontech/erigon-lib/rlp2" - "github.com/erigontech/erigon/rlp" ) type DynamicFeeTransaction struct { diff --git a/core/types/encdec_test.go b/core/types/encdec_test.go index b5a5e903568..e25c976068e 100644 --- a/core/types/encdec_test.go +++ b/core/types/encdec_test.go @@ -28,7 +28,7 @@ import ( "github.com/holiman/uint256" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) const RUNS = 100 // for local tests increase this number diff --git a/core/types/hashing.go b/core/types/hashing.go index 44f54e62693..3ad4261e8af 100644 --- a/core/types/hashing.go +++ b/core/types/hashing.go @@ -29,7 +29,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/crypto/cryptopool" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/turbo/rlphacks" "github.com/erigontech/erigon/turbo/trie" ) diff --git a/core/types/hashing_test.go b/core/types/hashing_test.go index 9898267f02d..f40909cef43 100644 --- a/core/types/hashing_test.go +++ b/core/types/hashing_test.go @@ -25,7 +25,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/turbo/trie" ) diff --git a/core/types/legacy_tx.go b/core/types/legacy_tx.go index 97eedfe655d..9696f97a4fb 100644 --- a/core/types/legacy_tx.go +++ b/core/types/legacy_tx.go @@ -29,8 +29,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/rlp" rlp2 "github.com/erigontech/erigon-lib/rlp2" - "github.com/erigontech/erigon/rlp" ) type CommonTx struct { diff --git a/core/types/log.go b/core/types/log.go index bd4591e300a..5895578c509 100644 --- a/core/types/log.go +++ b/core/types/log.go @@ -27,7 +27,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) //(go:generate gencodec -type Log -field-override logMarshaling -out gen_log_json.go) diff --git a/core/types/receipt.go b/core/types/receipt.go index f77daa38b31..ae633066264 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -31,7 +31,7 @@ import ( "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) //(go:generate gencodec -type Receipt -field-override receiptMarshaling -out gen_receipt_json.go) diff --git a/core/types/receipt_test.go b/core/types/receipt_test.go index 7d7d8e64f95..2cde0914ea9 100644 --- a/core/types/receipt_test.go +++ b/core/types/receipt_test.go @@ -31,10 +31,10 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" ) func TestDecodeEmptyTypedReceipt(t *testing.T) { diff --git a/core/types/set_code_tx.go b/core/types/set_code_tx.go index 94af792f54b..be12f8aa6ef 100644 --- a/core/types/set_code_tx.go +++ b/core/types/set_code_tx.go @@ -27,9 +27,9 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/rlp" rlp2 "github.com/erigontech/erigon-lib/rlp2" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" ) const DelegateDesignationCodeSize = 23 diff --git a/core/types/transaction.go b/core/types/transaction.go index c159865ddbe..3d9b4adc1d9 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -36,8 +36,8 @@ import ( "github.com/erigontech/erigon-lib/common/math" libcrypto "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" rlp2 "github.com/erigontech/erigon-lib/rlp2" - "github.com/erigontech/erigon/rlp" ) var ( diff --git a/core/types/transaction_test.go b/core/types/transaction_test.go index dde277fe879..5cc136bced5 100644 --- a/core/types/transaction_test.go +++ b/core/types/transaction_test.go @@ -38,10 +38,10 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/fixedgas" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/types/typestest" - "github.com/erigontech/erigon/rlp" ) // The values in those tests are from the Transaction Tests diff --git a/core/types/withdrawal.go b/core/types/withdrawal.go index a38d9542db8..1dc0540d73a 100644 --- a/core/types/withdrawal.go +++ b/core/types/withdrawal.go @@ -27,8 +27,8 @@ import ( "github.com/erigontech/erigon-lib/common/hexutil" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon-lib/types/clonable" - "github.com/erigontech/erigon/rlp" ) //go:generate gencodec -type Withdrawal -field-override withdrawalMarshaling -out gen_withdrawal_json.go diff --git a/core/vm/runtime/runtime_test.go b/core/vm/runtime/runtime_test.go index d9f1054fcfe..371b9689ff4 100644 --- a/core/vm/runtime/runtime_test.go +++ b/core/vm/runtime/runtime_test.go @@ -40,6 +40,7 @@ import ( "github.com/erigontech/erigon-lib/log/v3" stateLib "github.com/erigontech/erigon-lib/state" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" @@ -49,7 +50,6 @@ import ( "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/eth/tracers/logger" - "github.com/erigontech/erigon/rlp" ) func NewTestTemporalDb(tb testing.TB) (kv.RwDB, kv.RwTx, *stateLib.Aggregator) { diff --git a/erigon-lib/.golangci.yml b/erigon-lib/.golangci.yml index 363b8b04eea..ef0658d69f6 100644 --- a/erigon-lib/.golangci.yml +++ b/erigon-lib/.golangci.yml @@ -96,6 +96,11 @@ linters-settings: issues: exclude-rules: + - path: rlp/.*\.go + linters: + - predeclared + - thelper + - all - linters: - golint text: "should be" diff --git a/rlp/decode.go b/erigon-lib/rlp/decode.go similarity index 100% rename from rlp/decode.go rename to erigon-lib/rlp/decode.go diff --git a/rlp/decode_tail_test.go b/erigon-lib/rlp/decode_tail_test.go similarity index 100% rename from rlp/decode_tail_test.go rename to erigon-lib/rlp/decode_tail_test.go diff --git a/rlp/decode_test.go b/erigon-lib/rlp/decode_test.go similarity index 100% rename from rlp/decode_test.go rename to erigon-lib/rlp/decode_test.go diff --git a/rlp/doc.go b/erigon-lib/rlp/doc.go similarity index 100% rename from rlp/doc.go rename to erigon-lib/rlp/doc.go diff --git a/rlp/encbuffer.go b/erigon-lib/rlp/encbuffer.go similarity index 100% rename from rlp/encbuffer.go rename to erigon-lib/rlp/encbuffer.go diff --git a/rlp/encode.go b/erigon-lib/rlp/encode.go similarity index 100% rename from rlp/encode.go rename to erigon-lib/rlp/encode.go diff --git a/rlp/encode_test.go b/erigon-lib/rlp/encode_test.go similarity index 100% rename from rlp/encode_test.go rename to erigon-lib/rlp/encode_test.go diff --git a/rlp/encoder_example_test.go b/erigon-lib/rlp/encoder_example_test.go similarity index 100% rename from rlp/encoder_example_test.go rename to erigon-lib/rlp/encoder_example_test.go diff --git a/rlp/internal/rlpstruct/rlpstruct.go b/erigon-lib/rlp/internal/rlpstruct/rlpstruct.go similarity index 100% rename from rlp/internal/rlpstruct/rlpstruct.go rename to erigon-lib/rlp/internal/rlpstruct/rlpstruct.go diff --git a/rlp/iterator.go b/erigon-lib/rlp/iterator.go similarity index 100% rename from rlp/iterator.go rename to erigon-lib/rlp/iterator.go diff --git a/rlp/iterator_test.go b/erigon-lib/rlp/iterator_test.go similarity index 100% rename from rlp/iterator_test.go rename to erigon-lib/rlp/iterator_test.go diff --git a/rlp/raw.go b/erigon-lib/rlp/raw.go similarity index 100% rename from rlp/raw.go rename to erigon-lib/rlp/raw.go diff --git a/rlp/raw_test.go b/erigon-lib/rlp/raw_test.go similarity index 100% rename from rlp/raw_test.go rename to erigon-lib/rlp/raw_test.go diff --git a/rlp/typecache.go b/erigon-lib/rlp/typecache.go similarity index 100% rename from rlp/typecache.go rename to erigon-lib/rlp/typecache.go diff --git a/eth/consensuschain/consensus_chain_reader.go b/eth/consensuschain/consensus_chain_reader.go index 83c5ca088a6..1340727fb5d 100644 --- a/eth/consensuschain/consensus_chain_reader.go +++ b/eth/consensuschain/consensus_chain_reader.go @@ -25,10 +25,10 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" ) diff --git a/eth/protocols/eth/discovery.go b/eth/protocols/eth/discovery.go index a10ce596043..395da4c96ad 100644 --- a/eth/protocols/eth/discovery.go +++ b/eth/protocols/eth/discovery.go @@ -24,9 +24,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/forkid" "github.com/erigontech/erigon/p2p/enr" - "github.com/erigontech/erigon/rlp" ) // enrEntry is the ENR entry which advertises `eth` protocol on the discovery. diff --git a/eth/protocols/eth/handler_test.go b/eth/protocols/eth/handler_test.go index 90923dfd169..d461f921575 100644 --- a/eth/protocols/eth/handler_test.go +++ b/eth/protocols/eth/handler_test.go @@ -31,13 +31,13 @@ import ( "github.com/erigontech/erigon-lib/direct" sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/kv" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p/sentry/sentry_multi_client" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/jsonrpc/receipts" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/eth/protocols/eth/handlers.go b/eth/protocols/eth/handlers.go index 18693db825a..1e85a125821 100644 --- a/eth/protocols/eth/handlers.go +++ b/eth/protocols/eth/handlers.go @@ -27,10 +27,10 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" ) diff --git a/eth/protocols/eth/protocol.go b/eth/protocols/eth/protocol.go index efae4740533..6447591388b 100644 --- a/eth/protocols/eth/protocol.go +++ b/eth/protocols/eth/protocol.go @@ -29,9 +29,9 @@ import ( proto_sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" rlp2 "github.com/erigontech/erigon-lib/rlp2" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/forkid" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" ) var ProtocolToString = map[uint]string{ diff --git a/eth/protocols/eth/protocol_test.go b/eth/protocols/eth/protocol_test.go index 82fa9f846c6..630c920084b 100644 --- a/eth/protocols/eth/protocol_test.go +++ b/eth/protocols/eth/protocol_test.go @@ -26,9 +26,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" ) // Tests that the custom union field encoder and decoder works correctly. diff --git a/eth/stagedsync/chain_reader.go b/eth/stagedsync/chain_reader.go index 270b06de861..1fd37f6f17f 100644 --- a/eth/stagedsync/chain_reader.go +++ b/eth/stagedsync/chain_reader.go @@ -25,10 +25,10 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" ) diff --git a/eth/stagedsync/stage_headers.go b/eth/stagedsync/stage_headers.go index c083e4d2fdc..fe03640c415 100644 --- a/eth/stagedsync/stage_headers.go +++ b/eth/stagedsync/stage_headers.go @@ -34,13 +34,13 @@ import ( "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/diagnostics" "github.com/erigontech/erigon-lib/kv" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/rawdb/blockio" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/shards" "github.com/erigontech/erigon/turbo/stages/bodydownload" diff --git a/eth/stagedsync/stage_polygon_sync.go b/eth/stagedsync/stage_polygon_sync.go index 7d9e393913d..ea5a0dd9d4e 100644 --- a/eth/stagedsync/stage_polygon_sync.go +++ b/eth/stagedsync/stage_polygon_sync.go @@ -35,6 +35,7 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/rawdb/blockio" "github.com/erigontech/erigon/core/types" @@ -47,7 +48,6 @@ import ( "github.com/erigontech/erigon/polygon/p2p" "github.com/erigontech/erigon/polygon/sync" polygonsync "github.com/erigontech/erigon/polygon/sync" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/shards" ) diff --git a/ethdb/privateapi/ethbackend.go b/ethdb/privateapi/ethbackend.go index 33d0e7126a3..769096fe712 100644 --- a/ethdb/privateapi/ethbackend.go +++ b/ethdb/privateapi/ethbackend.go @@ -31,10 +31,10 @@ import ( types2 "github.com/erigontech/erigon-lib/gointerfaces/typesproto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/eth/stagedsync/stages" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/builder" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/shards" diff --git a/ethdb/privateapi/mining.go b/ethdb/privateapi/mining.go index b8f9d6e3ea7..15aa10e278f 100644 --- a/ethdb/privateapi/mining.go +++ b/ethdb/privateapi/mining.go @@ -31,9 +31,9 @@ import ( types2 "github.com/erigontech/erigon-lib/gointerfaces/typesproto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" ) // MiningAPIVersion diff --git a/p2p/discover/v4wire/v4wire.go b/p2p/discover/v4wire/v4wire.go index 6ee38c52fa4..55d6cb2b41f 100644 --- a/p2p/discover/v4wire/v4wire.go +++ b/p2p/discover/v4wire/v4wire.go @@ -32,8 +32,8 @@ import ( "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/enr" - "github.com/erigontech/erigon/rlp" ) // RPC packet types diff --git a/p2p/discover/v4wire/v4wire_test.go b/p2p/discover/v4wire/v4wire_test.go index 296b611dd26..0a5c7f56d26 100644 --- a/p2p/discover/v4wire/v4wire_test.go +++ b/p2p/discover/v4wire/v4wire_test.go @@ -28,7 +28,7 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) // EIP-8 test vectors. diff --git a/p2p/discover/v5_udp_test.go b/p2p/discover/v5_udp_test.go index fa770f619b3..7d03bf9f13b 100644 --- a/p2p/discover/v5_udp_test.go +++ b/p2p/discover/v5_udp_test.go @@ -37,10 +37,10 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/turbo/testlog" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/discover/v5wire" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" - "github.com/erigontech/erigon/rlp" ) func startLocalhostV5(t *testing.T, cfg Config, logger log.Logger) *UDPv5 { diff --git a/p2p/discover/v5wire/encoding.go b/p2p/discover/v5wire/encoding.go index d813ca2a31e..3801ba3ced1 100644 --- a/p2p/discover/v5wire/encoding.go +++ b/p2p/discover/v5wire/encoding.go @@ -31,10 +31,10 @@ import ( "fmt" "hash" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" - "github.com/erigontech/erigon/rlp" ) // TODO concurrent WHOAREYOU tie-breaker diff --git a/p2p/discover/v5wire/msg.go b/p2p/discover/v5wire/msg.go index 4931db883bc..f6a71144404 100644 --- a/p2p/discover/v5wire/msg.go +++ b/p2p/discover/v5wire/msg.go @@ -23,10 +23,10 @@ import ( "fmt" "net" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" - "github.com/erigontech/erigon/rlp" ) // Packet is implemented by all message types. diff --git a/p2p/dnsdisc/tree.go b/p2p/dnsdisc/tree.go index dc846b4706f..9389da3965e 100644 --- a/p2p/dnsdisc/tree.go +++ b/p2p/dnsdisc/tree.go @@ -33,9 +33,9 @@ import ( "golang.org/x/crypto/sha3" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" - "github.com/erigontech/erigon/rlp" ) // Tree is a merkle tree of node records. diff --git a/p2p/enode/idscheme.go b/p2p/enode/idscheme.go index fdee0783b4f..6c53341305c 100644 --- a/p2p/enode/idscheme.go +++ b/p2p/enode/idscheme.go @@ -27,9 +27,9 @@ import ( "golang.org/x/crypto/sha3" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/discover/v4wire" "github.com/erigontech/erigon/p2p/enr" - "github.com/erigontech/erigon/rlp" ) // List of known secure identity schemes. diff --git a/p2p/enode/idscheme_test.go b/p2p/enode/idscheme_test.go index ff34d2de36f..0e8ff17b57f 100644 --- a/p2p/enode/idscheme_test.go +++ b/p2p/enode/idscheme_test.go @@ -30,8 +30,8 @@ import ( "github.com/stretchr/testify/require" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/enr" - "github.com/erigontech/erigon/rlp" ) var ( diff --git a/p2p/enode/node.go b/p2p/enode/node.go index a504b719fdd..c74a366ff3f 100644 --- a/p2p/enode/node.go +++ b/p2p/enode/node.go @@ -29,8 +29,8 @@ import ( "net" "strings" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/enr" - "github.com/erigontech/erigon/rlp" ) var errMissingPrefix = errors.New("missing 'enr:' prefix for base64-encoded record") diff --git a/p2p/enode/node_test.go b/p2p/enode/node_test.go index 5aae5d2ddcf..67dda497010 100644 --- a/p2p/enode/node_test.go +++ b/p2p/enode/node_test.go @@ -27,8 +27,8 @@ import ( "testing" "testing/quick" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/enr" - "github.com/erigontech/erigon/rlp" "github.com/stretchr/testify/assert" ) diff --git a/p2p/enode/nodedb.go b/p2p/enode/nodedb.go index 88b951525ed..5466ebf8e2c 100644 --- a/p2p/enode/nodedb.go +++ b/p2p/enode/nodedb.go @@ -37,7 +37,7 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/mdbx" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) // Keys in the node database. diff --git a/p2p/enr/enr.go b/p2p/enr/enr.go index 6b1719c39a3..5298a4d075c 100644 --- a/p2p/enr/enr.go +++ b/p2p/enr/enr.go @@ -43,7 +43,7 @@ import ( "io" "sort" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) const SizeLimit = 300 // maximum encoded size of a node record in bytes diff --git a/p2p/enr/enr_test.go b/p2p/enr/enr_test.go index bfcd5f74806..75358d8bc8b 100644 --- a/p2p/enr/enr_test.go +++ b/p2p/enr/enr_test.go @@ -27,7 +27,7 @@ import ( "testing" "time" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/p2p/enr/entries.go b/p2p/enr/entries.go index d433d46706c..6e8b53b605a 100644 --- a/p2p/enr/entries.go +++ b/p2p/enr/entries.go @@ -24,7 +24,7 @@ import ( "io" "net" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) // Entry is implemented by known node record entry types. diff --git a/p2p/message.go b/p2p/message.go index c847e353a82..a64f8e4a906 100644 --- a/p2p/message.go +++ b/p2p/message.go @@ -28,10 +28,10 @@ import ( "sync/atomic" "time" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/event" "github.com/erigontech/erigon/p2p/enode" - "github.com/erigontech/erigon/rlp" ) // Msg defines the structure of a p2p message. diff --git a/p2p/peer.go b/p2p/peer.go index ec59c235162..edb9624f756 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -33,12 +33,12 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/metrics" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/event" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" - "github.com/erigontech/erigon/rlp" ) var ( diff --git a/p2p/rlpx/rlpx.go b/p2p/rlpx/rlpx.go index 56dd8dd36b3..bd0ca367b61 100644 --- a/p2p/rlpx/rlpx.go +++ b/p2p/rlpx/rlpx.go @@ -42,7 +42,7 @@ import ( "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/crypto/ecies" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) // Conn is an RLPx network connection. It wraps a low-level network connection. The diff --git a/p2p/rlpx/rlpx_test.go b/p2p/rlpx/rlpx_test.go index 169b99fc7e6..be116c7cd49 100644 --- a/p2p/rlpx/rlpx_test.go +++ b/p2p/rlpx/rlpx_test.go @@ -36,8 +36,8 @@ import ( "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/crypto/ecies" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/simulations/pipes" - "github.com/erigontech/erigon/rlp" ) type message struct { diff --git a/p2p/sentry/sentry_grpc_server.go b/p2p/sentry/sentry_grpc_server.go index 732bf623ed2..952a8ace783 100644 --- a/p2p/sentry/sentry_grpc_server.go +++ b/p2p/sentry/sentry_grpc_server.go @@ -51,6 +51,7 @@ import ( proto_sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" proto_types "github.com/erigontech/erigon-lib/gointerfaces/typesproto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/cmd/utils" "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/core/forkid" @@ -59,7 +60,6 @@ import ( "github.com/erigontech/erigon/p2p/dnsdisc" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" ) const ( diff --git a/p2p/sentry/sentry_multi_client/broadcast.go b/p2p/sentry/sentry_multi_client/broadcast.go index 3ae450af624..8b9bab490db 100644 --- a/p2p/sentry/sentry_multi_client/broadcast.go +++ b/p2p/sentry/sentry_multi_client/broadcast.go @@ -29,10 +29,10 @@ import ( proto_sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/headerdownload" ) diff --git a/p2p/sentry/sentry_multi_client/sentry_api.go b/p2p/sentry/sentry_multi_client/sentry_api.go index 2e06d669007..23f37d38a67 100644 --- a/p2p/sentry/sentry_multi_client/sentry_api.go +++ b/p2p/sentry/sentry_multi_client/sentry_api.go @@ -26,9 +26,9 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces" proto_sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p/sentry" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/bodydownload" "github.com/erigontech/erigon/turbo/stages/headerdownload" ) diff --git a/p2p/sentry/sentry_multi_client/sentry_multi_client.go b/p2p/sentry/sentry_multi_client/sentry_multi_client.go index 64a82af96bd..8ac05870cce 100644 --- a/p2p/sentry/sentry_multi_client/sentry_multi_client.go +++ b/p2p/sentry/sentry_multi_client/sentry_multi_client.go @@ -43,12 +43,12 @@ import ( "github.com/erigontech/erigon-lib/log/v3" libsentry "github.com/erigontech/erigon-lib/p2p/sentry" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p/sentry" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/jsonrpc/receipts" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/stages/bodydownload" diff --git a/p2p/sentry/simulator/sentry_simulator.go b/p2p/sentry/simulator/sentry_simulator.go index 42101f799d4..264ee8d0b35 100644 --- a/p2p/sentry/simulator/sentry_simulator.go +++ b/p2p/sentry/simulator/sentry_simulator.go @@ -33,6 +33,7 @@ import ( isentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" types "github.com/erigontech/erigon-lib/gointerfaces/typesproto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/cmd/snapshots/sync" coresnaptype "github.com/erigontech/erigon/core/snaptype" coretypes "github.com/erigontech/erigon/core/types" @@ -42,7 +43,6 @@ import ( "github.com/erigontech/erigon/p2p/discover/v4wire" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/sentry" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/snapshotsync" "github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks" ) diff --git a/p2p/sentry/simulator/simulator_test.go b/p2p/sentry/simulator/simulator_test.go index 471753d8009..f4a865982a9 100644 --- a/p2p/sentry/simulator/simulator_test.go +++ b/p2p/sentry/simulator/simulator_test.go @@ -28,9 +28,9 @@ import ( "github.com/erigontech/erigon-lib/direct" sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" sentry_if "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p/sentry/simulator" - "github.com/erigontech/erigon/rlp" ) func TestSimulatorStart(t *testing.T) { diff --git a/p2p/transport.go b/p2p/transport.go index 51dab6dceb9..c0c42454d4a 100644 --- a/p2p/transport.go +++ b/p2p/transport.go @@ -31,9 +31,9 @@ import ( "time" "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common/bitutil" "github.com/erigontech/erigon/p2p/rlpx" - "github.com/erigontech/erigon/rlp" ) const ( diff --git a/p2p/transport_test.go b/p2p/transport_test.go index b7da37b4c90..48c186da6b4 100644 --- a/p2p/transport_test.go +++ b/p2p/transport_test.go @@ -29,8 +29,8 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/p2p/simulations/pipes" - "github.com/erigontech/erigon/rlp" ) func TestProtocolHandshake(t *testing.T) { diff --git a/polygon/bor/bor.go b/polygon/bor/bor.go index e514be0c342..4e6972beab5 100644 --- a/polygon/bor/bor.go +++ b/polygon/bor/bor.go @@ -46,6 +46,7 @@ import ( "github.com/erigontech/erigon-lib/crypto/cryptopool" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/misc" "github.com/erigontech/erigon/core/rawdb" @@ -63,7 +64,6 @@ import ( "github.com/erigontech/erigon/polygon/bor/statefull" "github.com/erigontech/erigon/polygon/bor/valset" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/services" ) diff --git a/polygon/bor/bor_test.go b/polygon/bor/bor_test.go index bf9dc122ab5..ac8221ac6fc 100644 --- a/polygon/bor/bor_test.go +++ b/polygon/bor/bor_test.go @@ -34,6 +34,7 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/kv/memdb" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" @@ -45,7 +46,6 @@ import ( "github.com/erigontech/erigon/polygon/bor/borcfg" "github.com/erigontech/erigon/polygon/bor/valset" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/polygon/bor/spanner.go b/polygon/bor/spanner.go index f40bda6c92a..78a27552d4d 100644 --- a/polygon/bor/spanner.go +++ b/polygon/bor/spanner.go @@ -24,12 +24,12 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/polygon/bor/borcfg" "github.com/erigontech/erigon/polygon/bor/valset" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" ) //go:generate mockgen -typed=true -destination=./spanner_mock.go -package=bor . Spanner diff --git a/polygon/bor/state_receiver.go b/polygon/bor/state_receiver.go index e74f7cf0e54..fe685583055 100644 --- a/polygon/bor/state_receiver.go +++ b/polygon/bor/state_receiver.go @@ -18,8 +18,8 @@ package bor import ( libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus" - "github.com/erigontech/erigon/rlp" ) //go:generate mockgen -typed=true -destination=./state_receiver_mock.go -package=bor . StateReceiver diff --git a/polygon/bor/state_receiver_mock.go b/polygon/bor/state_receiver_mock.go index f708a2b012e..37d68a31cc1 100644 --- a/polygon/bor/state_receiver_mock.go +++ b/polygon/bor/state_receiver_mock.go @@ -13,7 +13,7 @@ import ( reflect "reflect" consensus "github.com/erigontech/erigon/consensus" - rlp "github.com/erigontech/erigon/rlp" + rlp "github.com/erigontech/erigon-lib/rlp" gomock "go.uber.org/mock/gomock" ) diff --git a/polygon/bridge/mdbx_store.go b/polygon/bridge/mdbx_store.go index 75695e0826e..05b3d148e8a 100644 --- a/polygon/bridge/mdbx_store.go +++ b/polygon/bridge/mdbx_store.go @@ -30,9 +30,9 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/order" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/polygon/heimdall" "github.com/erigontech/erigon/polygon/polygoncommon" - "github.com/erigontech/erigon/rlp" ) /* diff --git a/polygon/bridge/reader.go b/polygon/bridge/reader.go index 6cb9e965a8a..d7b6f7d4960 100644 --- a/polygon/bridge/reader.go +++ b/polygon/bridge/reader.go @@ -28,11 +28,11 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces" remote "github.com/erigontech/erigon-lib/gointerfaces/remoteproto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" ) type Reader struct { diff --git a/polygon/bridge/snapshot_store.go b/polygon/bridge/snapshot_store.go index f25ccd93a3c..c0b65742bf7 100644 --- a/polygon/bridge/snapshot_store.go +++ b/polygon/bridge/snapshot_store.go @@ -29,8 +29,8 @@ import ( "github.com/erigontech/erigon-lib/downloader/snaptype" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/recsplit" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/snapshotsync" ) diff --git a/polygon/bridge/store.go b/polygon/bridge/store.go index 53ea631378f..48fea16c000 100644 --- a/polygon/bridge/store.go +++ b/polygon/bridge/store.go @@ -21,8 +21,8 @@ import ( "time" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" ) type Store interface { diff --git a/polygon/heimdall/event_record.go b/polygon/heimdall/event_record.go index ad897f9302b..6381f7970d0 100644 --- a/polygon/heimdall/event_record.go +++ b/polygon/heimdall/event_record.go @@ -26,8 +26,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/polygon/bor/borabi" - "github.com/erigontech/erigon/rlp" ) // EventRecord represents state record diff --git a/polygon/heimdall/snapshots.go b/polygon/heimdall/snapshots.go index 01e3e86d9cb..4ed939f889d 100644 --- a/polygon/heimdall/snapshots.go +++ b/polygon/heimdall/snapshots.go @@ -28,11 +28,11 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/polygon/bor/borcfg" bortypes "github.com/erigontech/erigon/polygon/bor/types" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/snapshotsync" ) diff --git a/polygon/p2p/fetcher_base_test.go b/polygon/p2p/fetcher_base_test.go index 27af15974a9..f38541c7633 100644 --- a/polygon/p2p/fetcher_base_test.go +++ b/polygon/p2p/fetcher_base_test.go @@ -35,9 +35,9 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/typesproto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/p2p/sentry" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/testlog" ) diff --git a/polygon/p2p/message_listener.go b/polygon/p2p/message_listener.go index 046b3be607c..3d32038bccd 100644 --- a/polygon/p2p/message_listener.go +++ b/polygon/p2p/message_listener.go @@ -27,9 +27,9 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/p2p/sentry" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/polygon/polygoncommon" - "github.com/erigontech/erigon/rlp" ) type DecodedInboundMessage[TPacket any] struct { diff --git a/polygon/p2p/message_listener_test.go b/polygon/p2p/message_listener_test.go index 6ce296e268d..aefd6e6b793 100644 --- a/polygon/p2p/message_listener_test.go +++ b/polygon/p2p/message_listener_test.go @@ -36,9 +36,9 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/p2p/sentry" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/testlog" ) diff --git a/polygon/p2p/message_sender.go b/polygon/p2p/message_sender.go index 8a7722a7dac..5fe50842f0b 100644 --- a/polygon/p2p/message_sender.go +++ b/polygon/p2p/message_sender.go @@ -23,8 +23,8 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/p2p/sentry" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/eth/protocols/eth" - "github.com/erigontech/erigon/rlp" ) var ErrPeerNotFound = errors.New("peer not found") diff --git a/polygon/p2p/message_sender_test.go b/polygon/p2p/message_sender_test.go index a560d1cd0e1..24b8e6eb86e 100644 --- a/polygon/p2p/message_sender_test.go +++ b/polygon/p2p/message_sender_test.go @@ -29,9 +29,9 @@ import ( "github.com/erigontech/erigon-lib/direct" sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" erigonlibtypes "github.com/erigontech/erigon-lib/gointerfaces/typesproto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" - "github.com/erigontech/erigon/rlp" ) func TestMessageSenderSendGetBlockHeaders(t *testing.T) { diff --git a/tests/block_test_util.go b/tests/block_test_util.go index 83e7f174e62..cb902108ede 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -41,13 +41,13 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconsensusconfig" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/tests/fuzzers/rlp/rlp_fuzzer.go b/tests/fuzzers/rlp/rlp_fuzzer.go index 7e1691a7cb8..4b2a97de993 100644 --- a/tests/fuzzers/rlp/rlp_fuzzer.go +++ b/tests/fuzzers/rlp/rlp_fuzzer.go @@ -23,8 +23,8 @@ import ( "bytes" "fmt" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" ) func decodeEncode(input []byte, val interface{}, i int) { diff --git a/tests/rlp_test_util.go b/tests/rlp_test_util.go index 7af1af689a9..708661eb030 100644 --- a/tests/rlp_test_util.go +++ b/tests/rlp_test_util.go @@ -27,7 +27,7 @@ import ( "math/big" "strings" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) // RLPTest is the JSON structure of a single RLP test. diff --git a/tests/state_test_util.go b/tests/state_test_util.go index 86c5c15ad42..234d2e052d2 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -44,6 +44,7 @@ import ( state2 "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon-lib/wrap" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus/misc" "github.com/erigontech/erigon/core" @@ -51,7 +52,6 @@ import ( "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/vm" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/rpchelper" ) diff --git a/turbo/app/import_cmd.go b/turbo/app/import_cmd.go index ba0f9622b1e..dd776226d03 100644 --- a/turbo/app/import_cmd.go +++ b/turbo/app/import_cmd.go @@ -40,12 +40,12 @@ import ( "github.com/erigontech/erigon/turbo/execution/eth1/eth1_chain_reader.go" "github.com/erigontech/erigon/turbo/services" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/cmd/utils" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/debug" turboNode "github.com/erigontech/erigon/turbo/node" "github.com/erigontech/erigon/turbo/stages" diff --git a/turbo/engineapi/engine_block_downloader/block_downloader.go b/turbo/engineapi/engine_block_downloader/block_downloader.go index 7b748cff0fa..60d64fd0e0a 100644 --- a/turbo/engineapi/engine_block_downloader/block_downloader.go +++ b/turbo/engineapi/engine_block_downloader/block_downloader.go @@ -37,9 +37,9 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/dbutils" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/adapter" "github.com/erigontech/erigon/turbo/execution/eth1/eth1_chain_reader.go" "github.com/erigontech/erigon/turbo/services" diff --git a/turbo/jsonrpc/debug_api.go b/turbo/jsonrpc/debug_api.go index 7f5a5ab0744..139c62485f1 100644 --- a/turbo/jsonrpc/debug_api.go +++ b/turbo/jsonrpc/debug_api.go @@ -29,11 +29,11 @@ import ( "github.com/erigontech/erigon-lib/kv/rawdbv3" jsoniter "github.com/json-iterator/go" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/eth/stagedsync/stages" tracersConfig "github.com/erigontech/erigon/eth/tracers/config" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/adapter/ethapi" "github.com/erigontech/erigon/turbo/rpchelper" diff --git a/turbo/jsonrpc/eth_block_test.go b/turbo/jsonrpc/eth_block_test.go index 0b155d3cf32..d9edc58ab4b 100644 --- a/turbo/jsonrpc/eth_block_test.go +++ b/turbo/jsonrpc/eth_block_test.go @@ -31,10 +31,10 @@ import ( "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/rpc/rpccfg" "github.com/erigontech/erigon/turbo/rpchelper" diff --git a/turbo/jsonrpc/eth_mining_test.go b/turbo/jsonrpc/eth_mining_test.go index f51e3c178cf..d142cd67156 100644 --- a/turbo/jsonrpc/eth_mining_test.go +++ b/turbo/jsonrpc/eth_mining_test.go @@ -30,9 +30,9 @@ import ( txpool "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" "github.com/erigontech/erigon-lib/kv/kvcache" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/turbo/jsonrpc/eth_subscribe_test.go b/turbo/jsonrpc/eth_subscribe_test.go index 16ad4cfc257..0aad2fdf209 100644 --- a/turbo/jsonrpc/eth_subscribe_test.go +++ b/turbo/jsonrpc/eth_subscribe_test.go @@ -30,11 +30,11 @@ import ( "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcservices" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/ethdb/privateapi" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/builder" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/stages" diff --git a/turbo/jsonrpc/send_transaction_test.go b/turbo/jsonrpc/send_transaction_test.go index e8b88309f43..201a2831163 100644 --- a/turbo/jsonrpc/send_transaction_test.go +++ b/turbo/jsonrpc/send_transaction_test.go @@ -41,11 +41,11 @@ import ( "github.com/erigontech/erigon-lib/log/v3" txpool_proto "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/jsonrpc" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/stages" diff --git a/turbo/rlphacks/bytes_test.go b/turbo/rlphacks/bytes_test.go index 21699cffe72..42b64eaeb19 100644 --- a/turbo/rlphacks/bytes_test.go +++ b/turbo/rlphacks/bytes_test.go @@ -22,7 +22,7 @@ import ( "bytes" "testing" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) func TestFastDoubleRlpForByteArrays(t *testing.T) { diff --git a/turbo/rpchelper/filters.go b/turbo/rpchelper/filters.go index 25ab3fa44b6..0ae44ace3e5 100644 --- a/turbo/rpchelper/filters.go +++ b/turbo/rpchelper/filters.go @@ -41,9 +41,9 @@ import ( "github.com/erigontech/erigon-lib/log/v3" txpool2 "github.com/erigontech/erigon/txnprovider/txpool" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/filters" - "github.com/erigontech/erigon/rlp" ) // Filters holds the state for managing subscriptions to various Ethereum events. diff --git a/turbo/services/interfaces.go b/turbo/services/interfaces.go index b18a59890a7..dd26a7cfd64 100644 --- a/turbo/services/interfaces.go +++ b/turbo/services/interfaces.go @@ -25,10 +25,10 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/downloader/snaptype" "github.com/erigontech/erigon-lib/kv" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/snapshotsync" ) diff --git a/turbo/snapshotsync/freezeblocks/block_reader.go b/turbo/snapshotsync/freezeblocks/block_reader.go index 2b397655ded..634bc10e0ef 100644 --- a/turbo/snapshotsync/freezeblocks/block_reader.go +++ b/turbo/snapshotsync/freezeblocks/block_reader.go @@ -34,13 +34,13 @@ import ( "github.com/erigontech/erigon-lib/kv/rawdbv3" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/recsplit" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/rawdb" coresnaptype "github.com/erigontech/erigon/core/snaptype" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/polygon/bridge" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/snapshotsync" ) diff --git a/turbo/snapshotsync/freezeblocks/block_snapshots.go b/turbo/snapshotsync/freezeblocks/block_snapshots.go index f5af0d8f047..64e24b51b89 100644 --- a/turbo/snapshotsync/freezeblocks/block_snapshots.go +++ b/turbo/snapshotsync/freezeblocks/block_snapshots.go @@ -48,6 +48,7 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/metrics" "github.com/erigontech/erigon-lib/recsplit" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon-lib/seg" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/rawdb/blockio" @@ -59,7 +60,6 @@ import ( "github.com/erigontech/erigon/polygon/bor/bordb" "github.com/erigontech/erigon/polygon/bridge" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/snapshotsync" "github.com/erigontech/erigon/txnprovider/txpool" diff --git a/turbo/snapshotsync/freezeblocks/dump_test.go b/turbo/snapshotsync/freezeblocks/dump_test.go index 3d135eb3cfd..ec34ff7c2a3 100644 --- a/turbo/snapshotsync/freezeblocks/dump_test.go +++ b/turbo/snapshotsync/freezeblocks/dump_test.go @@ -34,12 +34,12 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/txnprovider/txpool" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/ethdb/prune" "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/polygon/bor/borcfg" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/turbo/stages/blockchain_test.go b/turbo/stages/blockchain_test.go index 7978aa65f84..4e92e6d6f1e 100644 --- a/turbo/stages/blockchain_test.go +++ b/turbo/stages/blockchain_test.go @@ -41,6 +41,7 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/bitmapdb" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core" @@ -52,7 +53,6 @@ import ( "github.com/erigontech/erigon/ethdb/prune" "github.com/erigontech/erigon/p2p/sentry/sentry_multi_client" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/turbo/stages/chain_makers_test.go b/turbo/stages/chain_makers_test.go index fe3db7bdff1..08dcd772cc2 100644 --- a/turbo/stages/chain_makers_test.go +++ b/turbo/stages/chain_makers_test.go @@ -31,13 +31,13 @@ import ( "github.com/erigontech/erigon-lib/crypto" protosentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p/sentry/sentry_multi_client" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/turbo/stages/headerdownload/header_algo_test.go b/turbo/stages/headerdownload/header_algo_test.go index 92bc6a646d6..e950b4176e3 100644 --- a/turbo/stages/headerdownload/header_algo_test.go +++ b/turbo/stages/headerdownload/header_algo_test.go @@ -24,9 +24,9 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages/headerdownload" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/turbo/stages/headerdownload/header_algos.go b/turbo/stages/headerdownload/header_algos.go index 343fe7d8281..6216f64cf60 100644 --- a/turbo/stages/headerdownload/header_algos.go +++ b/turbo/stages/headerdownload/header_algos.go @@ -43,13 +43,13 @@ import ( "github.com/erigontech/erigon/dataflow" "github.com/erigontech/erigon/turbo/services" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/stagedsync/stages" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" ) const POSPandaBanner = ` diff --git a/turbo/stages/headerdownload/header_data_struct.go b/turbo/stages/headerdownload/header_data_struct.go index c3e353b44e6..6965a4d8668 100644 --- a/turbo/stages/headerdownload/header_data_struct.go +++ b/turbo/stages/headerdownload/header_data_struct.go @@ -29,9 +29,9 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/etl" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/services" ) diff --git a/turbo/stages/mock/mock_sentry.go b/turbo/stages/mock/mock_sentry.go index cf9947b83b3..2598beb5312 100644 --- a/turbo/stages/mock/mock_sentry.go +++ b/turbo/stages/mock/mock_sentry.go @@ -52,6 +52,7 @@ import ( "github.com/erigontech/erigon-lib/kv/remotedbserver" "github.com/erigontech/erigon-lib/kv/temporal/temporaltest" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/rlp" libstate "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon-lib/wrap" "github.com/erigontech/erigon/consensus" @@ -76,7 +77,6 @@ import ( "github.com/erigontech/erigon/polygon/bor" "github.com/erigontech/erigon/polygon/bridge" "github.com/erigontech/erigon/polygon/heimdall" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/builder" "github.com/erigontech/erigon/turbo/engineapi/engine_helpers" "github.com/erigontech/erigon/turbo/execution/eth1" diff --git a/turbo/stages/mock/sentry_mock_test.go b/turbo/stages/mock/sentry_mock_test.go index a7a0de58357..977a907d25f 100644 --- a/turbo/stages/mock/sentry_mock_test.go +++ b/turbo/stages/mock/sentry_mock_test.go @@ -29,12 +29,12 @@ import ( sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/wrap" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/params" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/stages" "github.com/erigontech/erigon/turbo/stages/mock" ) diff --git a/turbo/trie/encoding.go b/turbo/trie/encoding.go index 03437937dc7..3e5136c6f98 100644 --- a/turbo/trie/encoding.go +++ b/turbo/trie/encoding.go @@ -22,7 +22,7 @@ package trie import ( "io" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) // Trie keys are dealt with in three distinct encodings: diff --git a/turbo/trie/hack.go b/turbo/trie/hack.go index 3cfc9b35b9f..25885f86ba3 100644 --- a/turbo/trie/hack.go +++ b/turbo/trie/hack.go @@ -21,8 +21,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/rlp" ) func FullNode1() { diff --git a/turbo/trie/hashbuilder.go b/turbo/trie/hashbuilder.go index 99cceb12bca..d8e3c53126d 100644 --- a/turbo/trie/hashbuilder.go +++ b/turbo/trie/hashbuilder.go @@ -30,8 +30,8 @@ import ( length2 "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types/accounts" - "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/rlphacks" ) diff --git a/turbo/trie/hasher.go b/turbo/trie/hasher.go index 0b85558413c..27e41816c24 100644 --- a/turbo/trie/hasher.go +++ b/turbo/trie/hasher.go @@ -30,7 +30,7 @@ import ( "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/turbo/rlphacks" ) diff --git a/turbo/trie/node.go b/turbo/trie/node.go index 8851ddfc67e..1423a8aeba4 100644 --- a/turbo/trie/node.go +++ b/turbo/trie/node.go @@ -27,7 +27,7 @@ import ( "github.com/erigontech/erigon/core/types/accounts" - "github.com/erigontech/erigon/rlp" + "github.com/erigontech/erigon-lib/rlp" ) const codeSizeUncached = -1 diff --git a/turbo/trie/proof.go b/turbo/trie/proof.go index b6c3ddf75de..5c3eb271418 100644 --- a/turbo/trie/proof.go +++ b/turbo/trie/proof.go @@ -25,8 +25,8 @@ import ( "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/types/accounts" - "github.com/erigontech/erigon/rlp" ) // Prove constructs a merkle proof for key. The result contains all encoded nodes diff --git a/turbo/trie/trie_test.go b/turbo/trie/trie_test.go index 9c5de2abd13..8aa467c7986 100644 --- a/turbo/trie/trie_test.go +++ b/turbo/trie/trie_test.go @@ -33,9 +33,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" + "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types/accounts" - "github.com/erigontech/erigon/rlp" ) func init() { From d1954a6e0c0a270bdf8d8f6c0dbcf22160ec56e8 Mon Sep 17 00:00:00 2001 From: Ostroukhov Nikita Date: Fri, 29 Nov 2024 15:09:42 +0000 Subject: [PATCH 17/25] removed unused check in forkchoice (#12893) --- turbo/execution/eth1/forkchoice.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/turbo/execution/eth1/forkchoice.go b/turbo/execution/eth1/forkchoice.go index 92844d9836a..a7d1bf0563e 100644 --- a/turbo/execution/eth1/forkchoice.go +++ b/turbo/execution/eth1/forkchoice.go @@ -280,15 +280,6 @@ func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, original return } - // If we don't have it, too bad - if fcuHeader == nil { - sendForkchoiceReceiptWithoutWaiting(outcomeCh, &execution.ForkChoiceReceipt{ - LatestValidHash: gointerfaces.ConvertHashToH256(common.Hash{}), - Status: execution.ExecutionStatus_MissingSegment, - }, false) - return - } - currentParentHash := fcuHeader.ParentHash currentParentNumber := fcuHeader.Number.Uint64() - 1 isCanonicalHash, err := e.isCanonicalHash(ctx, tx, currentParentHash) From 0e40f36a1d229d641401770ca1fc4fba2c0f4f54 Mon Sep 17 00:00:00 2001 From: Noisy <125606576+donatik27@users.noreply.github.com> Date: Fri, 29 Nov 2024 16:32:22 +0100 Subject: [PATCH 18/25] Fix typos in documentation and comments (#12905) ## Changes ### erigon-lib/downloader/README.md - `availible` -> `available` - Correct spelling of "available" in documentation - `seperate` -> `separate` - Correct spelling of "separate" in documentation - `reather` -> `rather` - Correct spelling of "rather" in documentation ### erigon-lib/downloader/mdbx_piece_completion.go - `intefere` -> `interfere` - Correct spelling of "interfere" in code comment The changes fix typos and grammatical errors to improve code documentation quality and readability. Having correct spelling and grammar in documentation and comments helps other developers better understand the codebase. All changes are simple text corrections with no functional code changes. --- erigon-lib/downloader/README.md | 6 +++--- erigon-lib/downloader/mdbx_piece_completion.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erigon-lib/downloader/README.md b/erigon-lib/downloader/README.md index 0d1d9e2c95e..515fc0f6d21 100644 --- a/erigon-lib/downloader/README.md +++ b/erigon-lib/downloader/README.md @@ -8,7 +8,7 @@ The diagram below shows the components used to manage downloads between torrents By default the downloader will try to use the underlying bittorrent library to download files from peers and web peers. -However this can result in slow or stalled downloads. When this happens [rclone](https://rclone.org/) can be used as an auxiliary process to aid the download process. When it is availible the download library will pass downloads to rclone under the following circumstances: +However this can result in slow or stalled downloads. When this happens [rclone](https://rclone.org/) can be used as an auxiliary process to aid the download process. When it is available the download library will pass downloads to rclone under the following circumstances: * There are no torrent peers available for a file * There is not torrent info available for a file, but a torrent file with a matching info hash can be found on the webseeds @@ -43,13 +43,13 @@ the `well know` hash for a particular segment file in the following format. Where multiple version of files exists there may be several likes per segment and the code in the released Erigon version will select the version that it is interesting. -As this file is versioned as part of the Erigon release process the file to hash mapping can potentially change between releases. This can potentially cause an issue for running Erigon node which expect the downloads in the snapshots directory to remain constant, which is why a seperate file is used to record the hases used by the process when it originally downloaded its files. +As this file is versioned as part of the Erigon release process the file to hash mapping can potentially change between releases. This can potentially cause an issue for running Erigon node which expect the downloads in the snapshots directory to remain constant, which is why a separate file is used to record the hases used by the process when it originally downloaded its files. ## snapshot-lock.json This is a file which resides in the /snapshots directory for an Erigon node. It is created when the node performs its initial download. It contains the list of downloaded files and their respective hashes. -When a `snapshot-lock` file exists it is used reather than the chain.toml file to determine which files should be downloaded. This means that the directory contents can be maintained even if Erigon is re-versioned and the chain.toml contents change. +When a `snapshot-lock` file exists it is used rather than the chain.toml file to determine which files should be downloaded. This means that the directory contents can be maintained even if Erigon is re-versioned and the chain.toml contents change. ### Deleting snapshot-lock.json diff --git a/erigon-lib/downloader/mdbx_piece_completion.go b/erigon-lib/downloader/mdbx_piece_completion.go index 5325a74cb62..fe03cb207e8 100644 --- a/erigon-lib/downloader/mdbx_piece_completion.go +++ b/erigon-lib/downloader/mdbx_piece_completion.go @@ -129,7 +129,7 @@ func (m *mdbxPieceCompletion) Set(pk metainfo.PieceKey, b bool, awaitFlush bool) } // if we're awaiting flush update the DB immediately so it does not - // intefere with the timing of the background commit - may not be + // interfere with the timing of the background commit - may not be // necessary - in which case the batch can be used if awaitFlush { return m.db.Update(context.Background(), func(tx kv.RwTx) error { From a0889a7c552ead7513bb30aab16feaa63342f4e8 Mon Sep 17 00:00:00 2001 From: antonis19 Date: Sat, 30 Nov 2024 05:05:16 +0100 Subject: [PATCH 19/25] Merge `common` into `erigon-lib/common` (#12923) Co-authored-by: antonis19 --- accounts/abi/abi_test.go | 2 +- accounts/abi/bind/backends/simulated.go | 2 +- accounts/abi/bind/backends/simulated_test.go | 4 +- accounts/abi/bind/util_test.go | 4 +- accounts/abi/event_test.go | 2 +- accounts/abi/pack.go | 2 +- accounts/abi/pack_test.go | 2 +- accounts/abi/unpack_test.go | 2 +- cl/beacon/handler/rewards_test.go | 2 +- cl/beacon/handler/states_test.go | 2 +- cl/beacon/handler/validator_test.go | 2 +- cmd/abigen/main.go | 2 +- cmd/capcli/cli.go | 2 +- cmd/caplin/caplincli/config.go | 2 +- cmd/devnet/contracts/gen_subscription.go | 2 +- cmd/downloader/main.go | 2 +- cmd/evm/internal/t8ntool/execution.go | 2 +- cmd/evm/internal/t8ntool/gen_stenv.go | 2 +- cmd/hack/db/lmdb.go | 2 +- cmd/hack/flow/flow.go | 2 +- cmd/hack/hack.go | 2 +- cmd/integration/commands/refetence_db.go | 2 +- cmd/integration/commands/state_stages.go | 2 +- cmd/observer/observer/handshake.go | 2 +- cmd/observer/observer/server.go | 2 +- cmd/pics/contracts/gen_token.go | 2 +- cmd/pics/state.go | 2 +- cmd/rpcdaemon/cli/config.go | 4 +- cmd/rpcdaemon/rpcdaemontest/test_util.go | 2 +- cmd/rpctest/rpctest/account_range_verify.go | 2 +- cmd/sentry/main.go | 2 +- cmd/state/commands/global_flags_vars.go | 2 +- cmd/state/commands/opcode_tracer.go | 2 +- cmd/state/stats/index_stats.go | 2 +- cmd/state/verify/check_indexes.go | 2 +- cmd/txpool/main.go | 4 +- cmd/utils/flags.go | 4 +- cmd/verkle/main.go | 2 +- cmd/verkle/verkletrie/incrementAccount.go | 2 +- cmd/verkle/verkletrie/incrementStorage.go | 4 +- cmd/verkle/verkletrie/pedersen_hashstate.go | 4 +- cmd/verkle/verkletrie/verkle_tree_writer.go | 2 +- common/bytes.go | 130 ------------------ consensus/aura/config.go | 2 +- consensus/aura/validators.go | 2 +- consensus/clique/clique.go | 2 +- consensus/ethash/algorithm.go | 4 +- consensus/ethash/consensus.go | 2 +- consensus/ethash/ethash.go | 2 +- consensus/ethash/meter.go | 2 +- consensus/result.go | 2 +- core/blockchain.go | 2 +- {common => core}/debugprint/receipts.go | 0 core/genesis_test.go | 2 +- core/genesis_write.go | 2 +- core/rawdb/accessors_chain_test.go | 2 +- core/rlp_test.go | 2 +- core/state/contracts/gen_changer.go | 2 +- core/state/contracts/gen_phoenix.go | 2 +- core/state/contracts/gen_poly.go | 2 +- core/state/contracts/gen_revive.go | 2 +- core/state/contracts/gen_revive2.go | 2 +- core/state/contracts/gen_selfdestruct.go | 2 +- core/state/database_test.go | 2 +- core/state/dump.go | 2 +- core/state/intra_block_state.go | 2 +- core/state/state_object_test.go | 2 +- core/state_transition.go | 2 +- core/tx_cacher.go | 2 +- core/types/block.go | 2 +- core/types/block_test.go | 4 +- core/types/gen_genesis.go | 2 +- core/types/genesis.go | 2 +- core/types/receipt_test.go | 4 +- core/types/transaction_signing.go | 2 +- core/types/transaction_test.go | 4 +- core/vm/common.go | 2 +- core/vm/contracts.go | 2 +- core/vm/contracts_test.go | 2 +- core/vm/evm.go | 2 +- core/vm/instructions.go | 2 +- core/vm/instructions_test.go | 4 +- core/vm/memory_test.go | 2 +- core/vm/runtime/runtime_test.go | 2 +- diagnostics/db.go | 2 +- docs/readthedocs/source/rpc/tutorial.rst | 2 +- erigon-lib/common/address.go | 5 - erigon-lib/common/big.go | 14 +- .../common}/bitutil/bitutil.go | 0 .../common}/bitutil/bitutil_test.go | 8 ++ .../common}/bitutil/compress.go | 0 .../common}/bitutil/compress_test.go | 1 + erigon-lib/common/bytes.go | 86 ++++++++++++ {common => erigon-lib/common}/bytes_test.go | 4 +- .../common}/compiler/helpers.go | 0 .../common}/compiler/solidity.go | 0 .../common}/compiler/test.v.py | 0 .../common}/compiler/test_bad.v.py | 0 .../common}/compiler/vyper.go | 0 .../common}/compiler/vyper_test.go | 1 + {common => erigon-lib/common}/debug.go | 0 .../common}/debug/callers.go | 0 .../common}/debug/log_panic.go | 0 .../common}/debug/pprof_cgo.go | 0 .../common}/fdlimit/fdlimit_bsd.go | 0 .../common}/fdlimit/fdlimit_darwin.go | 0 .../common}/fdlimit/fdlimit_test.go | 0 .../common}/fdlimit/fdlimit_unix.go | 0 .../common}/fdlimit/fdlimit_windows.go | 0 .../common}/mclock/mclock.go | 0 {common => erigon-lib/common}/mclock/mclock.s | 0 .../common}/mclock/simclock.go | 0 .../common}/mclock/simclock_test.go | 0 {common => erigon-lib/common}/path.go | 0 {common => erigon-lib/common}/paths/paths.go | 0 {common => erigon-lib/common}/prque/prque.go | 0 .../common}/prque/prque_test.go | 0 {common => erigon-lib/common}/prque/sstack.go | 0 .../common}/prque/sstack_test.go | 0 {common => erigon-lib/common}/size.go | 0 {common => erigon-lib/common}/size_test.go | 0 {common => erigon-lib/common}/test_utils.go | 4 +- {common => erigon-lib/common}/tuples.go | 0 {common => erigon-lib/common}/tuples_test.go | 0 {common => erigon-lib/common}/types.go | 21 ++- {common => erigon-lib/common}/types_test.go | 32 ++--- erigon-lib/common/u256/big.go | 28 ++-- erigon-lib/debug/callers.go | 41 ++++++ erigon-lib/debug/log_panic.go | 45 ++++++ erigon-lib/debug/pprof_cgo.go | 24 ++++ erigon-lib/go.mod | 1 + erigon-lib/go.sum | 2 + eth/backend.go | 2 +- eth/calltracer/calltracer.go | 2 +- eth/protocols/eth/handlers.go | 2 +- eth/protocols/eth/protocol_test.go | 2 +- eth/stagedsync/stage_mining_create_block.go | 2 +- eth/stagedsync/stage_senders.go | 2 +- eth/stagedsync/stage_senders_test.go | 2 +- .../internal/tracetest/calltrace_test.go | 2 +- .../internal/tracetest/prestate_test.go | 2 +- eth/tracers/js/goja.go | 2 +- eth/tracers/logger/json_stream.go | 2 +- eth/tracers/logger/logger_json.go | 2 +- eth/tracers/native/4byte.go | 2 +- ethdb/privateapi/ethbackend.go | 2 +- event/subscription.go | 2 +- go.mod | 2 +- node/nodecfg/config.go | 4 +- p2p/dial.go | 4 +- p2p/dial_test.go | 2 +- p2p/discover/common.go | 2 +- p2p/discover/ntp.go | 2 +- p2p/discover/table.go | 2 +- p2p/discover/v4_udp.go | 2 +- p2p/discover/v5_udp.go | 4 +- p2p/discover/v5wire/encoding.go | 2 +- p2p/discover/v5wire/encoding_test.go | 2 +- p2p/discover/v5wire/msg.go | 2 +- p2p/discover/v5wire/session.go | 2 +- p2p/dnsdisc/client.go | 2 +- p2p/dnsdisc/client_test.go | 2 +- p2p/dnsdisc/sync.go | 2 +- p2p/enode/iter.go | 2 +- p2p/message.go | 2 +- p2p/nat/natpmp.go | 2 +- p2p/nat/natupnp.go | 2 +- p2p/netutil/iptrack.go | 2 +- p2p/netutil/iptrack_test.go | 2 +- p2p/peer.go | 4 +- p2p/sentry/sentry_grpc_server.go | 2 +- p2p/server.go | 4 +- p2p/transport.go | 2 +- p2p/util.go | 2 +- p2p/util_test.go | 2 +- params/config.go | 2 +- params/dao.go | 2 +- polygon/bridge/reader.go | 2 +- tests/block_test_util.go | 2 +- tests/bor/mining_test.go | 4 +- tests/contracts/gen_selfDestructor.go | 2 +- tests/contracts/gen_testcontract.go | 2 +- tests/fuzzers/bitutil/compress_fuzz.go | 2 +- tests/gen_stenv.go | 2 +- tests/state_test_util.go | 2 +- turbo/debug/flags.go | 2 +- turbo/debug/signal.go | 2 +- turbo/debug/signal_windows.go | 2 +- turbo/engineapi/engine_server.go | 2 +- turbo/jsonrpc/contracts/gen_poly.go | 2 +- turbo/jsonrpc/contracts/gen_token.go | 2 +- turbo/jsonrpc/erigon_receipts_test.go | 2 +- turbo/jsonrpc/eth_accounts.go | 2 +- turbo/jsonrpc/eth_filters.go | 2 +- turbo/jsonrpc/parity_api_test.go | 2 +- turbo/jsonrpc/send_transaction_test.go | 2 +- turbo/jsonrpc/trace_adhoc_test.go | 2 +- turbo/stages/blockchain_test.go | 2 +- turbo/stages/headerdownload/header_algos.go | 2 +- turbo/stages/mock/sentry_mock_test.go | 2 +- turbo/trie/encoding_test.go | 2 +- turbo/trie/flatdb_sub_trie_loader_test.go | 2 +- turbo/trie/hack.go | 2 +- turbo/trie/stream.go | 2 +- turbo/trie/stream_test.go | 2 +- turbo/trie/structural_test.go | 6 +- turbo/trie/trie_test.go | 2 +- 207 files changed, 448 insertions(+), 357 deletions(-) delete mode 100644 common/bytes.go rename {common => core}/debugprint/receipts.go (100%) rename {common => erigon-lib/common}/bitutil/bitutil.go (100%) rename {common => erigon-lib/common}/bitutil/bitutil_test.go (98%) rename {common => erigon-lib/common}/bitutil/compress.go (100%) rename {common => erigon-lib/common}/bitutil/compress_test.go (99%) rename {common => erigon-lib/common}/bytes_test.go (97%) rename {common => erigon-lib/common}/compiler/helpers.go (100%) rename {common => erigon-lib/common}/compiler/solidity.go (100%) rename {common => erigon-lib/common}/compiler/test.v.py (100%) rename {common => erigon-lib/common}/compiler/test_bad.v.py (100%) rename {common => erigon-lib/common}/compiler/vyper.go (100%) rename {common => erigon-lib/common}/compiler/vyper_test.go (99%) rename {common => erigon-lib/common}/debug.go (100%) rename {common => erigon-lib/common}/debug/callers.go (100%) rename {common => erigon-lib/common}/debug/log_panic.go (100%) rename {common => erigon-lib/common}/debug/pprof_cgo.go (100%) rename {common => erigon-lib/common}/fdlimit/fdlimit_bsd.go (100%) rename {common => erigon-lib/common}/fdlimit/fdlimit_darwin.go (100%) rename {common => erigon-lib/common}/fdlimit/fdlimit_test.go (100%) rename {common => erigon-lib/common}/fdlimit/fdlimit_unix.go (100%) rename {common => erigon-lib/common}/fdlimit/fdlimit_windows.go (100%) rename {common => erigon-lib/common}/mclock/mclock.go (100%) rename {common => erigon-lib/common}/mclock/mclock.s (100%) rename {common => erigon-lib/common}/mclock/simclock.go (100%) rename {common => erigon-lib/common}/mclock/simclock_test.go (100%) rename {common => erigon-lib/common}/path.go (100%) rename {common => erigon-lib/common}/paths/paths.go (100%) rename {common => erigon-lib/common}/prque/prque.go (100%) rename {common => erigon-lib/common}/prque/prque_test.go (100%) rename {common => erigon-lib/common}/prque/sstack.go (100%) rename {common => erigon-lib/common}/prque/sstack_test.go (100%) rename {common => erigon-lib/common}/size.go (100%) rename {common => erigon-lib/common}/size_test.go (100%) rename {common => erigon-lib/common}/test_utils.go (94%) rename {common => erigon-lib/common}/tuples.go (100%) rename {common => erigon-lib/common}/tuples_test.go (100%) rename {common => erigon-lib/common}/types.go (90%) rename {common => erigon-lib/common}/types_test.go (96%) create mode 100644 erigon-lib/debug/callers.go create mode 100644 erigon-lib/debug/log_panic.go create mode 100644 erigon-lib/debug/pprof_cgo.go diff --git a/accounts/abi/abi_test.go b/accounts/abi/abi_test.go index 4e93fc53b59..36738842100 100644 --- a/accounts/abi/abi_test.go +++ b/accounts/abi/abi_test.go @@ -30,10 +30,10 @@ import ( "strings" "testing" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/common" ) const jsondata = ` diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 74326cab8ee..667309affa4 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -35,12 +35,12 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/math" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" state2 "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/consensus/misc" diff --git a/accounts/abi/bind/backends/simulated_test.go b/accounts/abi/bind/backends/simulated_test.go index df82523d138..aec8ebd32b9 100644 --- a/accounts/abi/bind/backends/simulated_test.go +++ b/accounts/abi/bind/backends/simulated_test.go @@ -34,13 +34,13 @@ import ( "github.com/stretchr/testify/require" ethereum "github.com/erigontech/erigon" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" diff --git a/accounts/abi/bind/util_test.go b/accounts/abi/bind/util_test.go index b71505fed9f..5191579796e 100644 --- a/accounts/abi/bind/util_test.go +++ b/accounts/abi/bind/util_test.go @@ -27,12 +27,12 @@ import ( "testing" "time" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/accounts/abi/bind/backends" - "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" ) diff --git a/accounts/abi/event_test.go b/accounts/abi/event_test.go index 7a649eb186a..b3b0ff272da 100644 --- a/accounts/abi/event_test.go +++ b/accounts/abi/event_test.go @@ -31,9 +31,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/common" ) var jsonEventTransfer = []byte(`{ diff --git a/accounts/abi/pack.go b/accounts/abi/pack.go index d4d64006355..5c2492b3554 100644 --- a/accounts/abi/pack.go +++ b/accounts/abi/pack.go @@ -25,9 +25,9 @@ import ( "math/big" "reflect" + "github.com/erigontech/erigon-lib/common" common2 "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" - "github.com/erigontech/erigon/common" ) // packBytesSlice packs the given bytes as [L, V] as the canonical representation diff --git a/accounts/abi/pack_test.go b/accounts/abi/pack_test.go index 01855e11b7a..66571cec410 100644 --- a/accounts/abi/pack_test.go +++ b/accounts/abi/pack_test.go @@ -33,7 +33,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" ) // TestPack tests the general pack/unpack tests in packing_test.go diff --git a/accounts/abi/unpack_test.go b/accounts/abi/unpack_test.go index 1ab532ff497..2ba8d3b3c36 100644 --- a/accounts/abi/unpack_test.go +++ b/accounts/abi/unpack_test.go @@ -33,7 +33,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/stretchr/testify/require" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" ) // TestUnpack tests the general pack/unpack tests in packing_test.go diff --git a/cl/beacon/handler/rewards_test.go b/cl/beacon/handler/rewards_test.go index 0fb510651a4..07bc6bbe769 100644 --- a/cl/beacon/handler/rewards_test.go +++ b/cl/beacon/handler/rewards_test.go @@ -27,10 +27,10 @@ import ( "github.com/stretchr/testify/require" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cl/cltypes/solid" - "github.com/erigontech/erigon/common" ) func TestGetBlockRewards(t *testing.T) { diff --git a/cl/beacon/handler/states_test.go b/cl/beacon/handler/states_test.go index 48035a6e599..5222c291fa0 100644 --- a/cl/beacon/handler/states_test.go +++ b/cl/beacon/handler/states_test.go @@ -27,11 +27,11 @@ import ( "github.com/stretchr/testify/require" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cl/cltypes/solid" "github.com/erigontech/erigon/cl/phase1/core/state" - "github.com/erigontech/erigon/common" ) func TestGetStateFork(t *testing.T) { diff --git a/cl/beacon/handler/validator_test.go b/cl/beacon/handler/validator_test.go index 181cc9b9482..0a8bcb31f54 100644 --- a/cl/beacon/handler/validator_test.go +++ b/cl/beacon/handler/validator_test.go @@ -23,12 +23,12 @@ import ( "net/http/httptest" "testing" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" mockaggregation "github.com/erigontech/erigon/cl/aggregation/mock_services" "github.com/erigontech/erigon/cl/beacon/beacon_router_configuration" "github.com/erigontech/erigon/cl/cltypes/solid" "github.com/erigontech/erigon/cl/pool" - "github.com/erigontech/erigon/common" "github.com/stretchr/testify/suite" "go.uber.org/mock/gomock" ) diff --git a/cmd/abigen/main.go b/cmd/abigen/main.go index 14c07575d32..73452f99d9b 100644 --- a/cmd/abigen/main.go +++ b/cmd/abigen/main.go @@ -31,12 +31,12 @@ import ( "github.com/urfave/cli/v2" "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/compiler" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/cmd/utils" - "github.com/erigontech/erigon/common/compiler" "github.com/erigontech/erigon/params" cli2 "github.com/erigontech/erigon/turbo/cli" ) diff --git a/cmd/capcli/cli.go b/cmd/capcli/cli.go index 7fb0a50a316..9d392bbe765 100644 --- a/cmd/capcli/cli.go +++ b/cmd/capcli/cli.go @@ -44,6 +44,7 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/metrics" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cl/antiquary" "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cl/clparams/initial_state" @@ -60,7 +61,6 @@ import ( "github.com/erigontech/erigon/cl/rpc" "github.com/erigontech/erigon/cl/utils/eth_clock" "github.com/erigontech/erigon/cmd/caplin/caplin1" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/eth/ethconfig/estimate" "github.com/erigontech/erigon/turbo/debug" diff --git a/cmd/caplin/caplincli/config.go b/cmd/caplin/caplincli/config.go index 7f6589e17c1..48c65216428 100644 --- a/cmd/caplin/caplincli/config.go +++ b/cmd/caplin/caplincli/config.go @@ -25,13 +25,13 @@ import ( "github.com/urfave/cli/v2" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cmd/caplin/caplinflags" "github.com/erigontech/erigon/cmd/sentinel/sentinelcli" "github.com/erigontech/erigon/cmd/utils" - "github.com/erigontech/erigon/common" ) type CaplinCliCfg struct { diff --git a/cmd/devnet/contracts/gen_subscription.go b/cmd/devnet/contracts/gen_subscription.go index 3db9b1b436f..536350605e4 100644 --- a/cmd/devnet/contracts/gen_subscription.go +++ b/cmd/devnet/contracts/gen_subscription.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/cmd/downloader/main.go b/cmd/downloader/main.go index b5c1ce05ef2..c3a83c79b94 100644 --- a/cmd/downloader/main.go +++ b/cmd/downloader/main.go @@ -58,10 +58,10 @@ import ( "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon/cmd/downloader/downloadernat" "github.com/erigontech/erigon/cmd/hack/tool" "github.com/erigontech/erigon/cmd/utils" - "github.com/erigontech/erigon/common/paths" "github.com/erigontech/erigon/p2p/nat" "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/turbo/debug" diff --git a/cmd/evm/internal/t8ntool/execution.go b/cmd/evm/internal/t8ntool/execution.go index ccf3dfd50cf..93f78dae184 100644 --- a/cmd/evm/internal/t8ntool/execution.go +++ b/cmd/evm/internal/t8ntool/execution.go @@ -31,7 +31,7 @@ import ( "github.com/erigontech/erigon-lib/kv" state3 "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/tracing" diff --git a/cmd/evm/internal/t8ntool/gen_stenv.go b/cmd/evm/internal/t8ntool/gen_stenv.go index 907617ed815..c47122401a6 100644 --- a/cmd/evm/internal/t8ntool/gen_stenv.go +++ b/cmd/evm/internal/t8ntool/gen_stenv.go @@ -9,7 +9,7 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" - common0 "github.com/erigontech/erigon/common" + common0 "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" ) diff --git a/cmd/hack/db/lmdb.go b/cmd/hack/db/lmdb.go index 0c3df544839..a4489b670b2 100644 --- a/cmd/hack/db/lmdb.go +++ b/cmd/hack/db/lmdb.go @@ -30,10 +30,10 @@ import ( "strconv" "strings" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/kv" kv2 "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/debug" ) var logger = log.New() diff --git a/cmd/hack/flow/flow.go b/cmd/hack/flow/flow.go index 8486203ae37..b11866a8894 100644 --- a/cmd/hack/flow/flow.go +++ b/cmd/hack/flow/flow.go @@ -32,8 +32,8 @@ import ( "github.com/erigontech/erigon-lib/common/dbg" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon/cmd/hack/tool" - "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/core/vm" ) diff --git a/cmd/hack/hack.go b/cmd/hack/hack.go index aea30b87721..1d928427e56 100644 --- a/cmd/hack/hack.go +++ b/cmd/hack/hack.go @@ -45,11 +45,11 @@ import ( "github.com/erigontech/erigon-lib/recsplit/eliasfano32" "github.com/erigontech/erigon-lib/seg" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/rlp" hackdb "github.com/erigontech/erigon/cmd/hack/db" "github.com/erigontech/erigon/cmd/hack/flow" "github.com/erigontech/erigon/cmd/hack/tool" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/rawdb/blockio" diff --git a/cmd/integration/commands/refetence_db.go b/cmd/integration/commands/refetence_db.go index 2c6bc8687cc..088cb931831 100644 --- a/cmd/integration/commands/refetence_db.go +++ b/cmd/integration/commands/refetence_db.go @@ -36,7 +36,7 @@ import ( mdbx2 "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/turbo/debug" ) diff --git a/cmd/integration/commands/state_stages.go b/cmd/integration/commands/state_stages.go index f9a831a6e2e..7258a2bd1e0 100644 --- a/cmd/integration/commands/state_stages.go +++ b/cmd/integration/commands/state_stages.go @@ -40,8 +40,8 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon/cmd/hack/tool/fromdb" "github.com/erigontech/erigon/cmd/utils" - "github.com/erigontech/erigon/common/debugprint" "github.com/erigontech/erigon/core" + "github.com/erigontech/erigon/core/debugprint" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/eth/stagedsync" diff --git a/cmd/observer/observer/handshake.go b/cmd/observer/observer/handshake.go index 3eb104a1a34..7e9ff6b8bc6 100644 --- a/cmd/observer/observer/handshake.go +++ b/cmd/observer/observer/handshake.go @@ -25,11 +25,11 @@ import ( "net" "time" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/direct" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/forkid" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p" diff --git a/cmd/observer/observer/server.go b/cmd/observer/observer/server.go index c211e780e70..290b7d03fcc 100644 --- a/cmd/observer/observer/server.go +++ b/cmd/observer/observer/server.go @@ -26,8 +26,8 @@ import ( "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon/cmd/utils" - "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/core/forkid" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p" diff --git a/cmd/pics/contracts/gen_token.go b/cmd/pics/contracts/gen_token.go index a0da6eff9be..124fcb5f587 100644 --- a/cmd/pics/contracts/gen_token.go +++ b/cmd/pics/contracts/gen_token.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/cmd/pics/state.go b/cmd/pics/state.go index 1f0e322b634..99364e97e6b 100644 --- a/cmd/pics/state.go +++ b/cmd/pics/state.go @@ -29,6 +29,7 @@ import ( "github.com/holiman/uint256" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv" @@ -38,7 +39,6 @@ import ( "github.com/erigontech/erigon/accounts/abi/bind/backends" "github.com/erigontech/erigon/cmd/pics/contracts" "github.com/erigontech/erigon/cmd/pics/visual" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" diff --git a/cmd/rpcdaemon/cli/config.go b/cmd/rpcdaemon/cli/config.go index 6a20c9813ba..9e468f6a2ca 100644 --- a/cmd/rpcdaemon/cli/config.go +++ b/cmd/rpcdaemon/cli/config.go @@ -38,9 +38,11 @@ import ( "google.golang.org/grpc/health/grpc_health_v1" "github.com/erigontech/erigon-lib/chain" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/common/hexutility" + "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon-lib/config3" "github.com/erigontech/erigon-lib/direct" "github.com/erigontech/erigon-lib/gointerfaces" @@ -62,8 +64,6 @@ import ( "github.com/erigontech/erigon/cmd/rpcdaemon/rpcservices" "github.com/erigontech/erigon/cmd/utils" "github.com/erigontech/erigon/cmd/utils/flags" - "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/common/paths" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/aura" "github.com/erigontech/erigon/consensus/ethash" diff --git a/cmd/rpcdaemon/rpcdaemontest/test_util.go b/cmd/rpcdaemon/rpcdaemontest/test_util.go index 5b073e423c0..7bcb1032592 100644 --- a/cmd/rpcdaemon/rpcdaemontest/test_util.go +++ b/cmd/rpcdaemon/rpcdaemontest/test_util.go @@ -32,6 +32,7 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" remote "github.com/erigontech/erigon-lib/gointerfaces/remoteproto" txpool "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" @@ -39,7 +40,6 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/accounts/abi/bind/backends" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core" diff --git a/cmd/rpctest/rpctest/account_range_verify.go b/cmd/rpctest/rpctest/account_range_verify.go index 82230f49285..6077999c469 100644 --- a/cmd/rpctest/rpctest/account_range_verify.go +++ b/cmd/rpctest/rpctest/account_range_verify.go @@ -33,7 +33,7 @@ import ( "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/state" ) diff --git a/cmd/sentry/main.go b/cmd/sentry/main.go index aed5d2c5567..dca4acd520a 100644 --- a/cmd/sentry/main.go +++ b/cmd/sentry/main.go @@ -24,8 +24,8 @@ import ( "github.com/erigontech/erigon-lib/common/datadir" "github.com/spf13/cobra" + "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon/cmd/utils" - "github.com/erigontech/erigon/common/paths" "github.com/erigontech/erigon/p2p/sentry" "github.com/erigontech/erigon/turbo/debug" "github.com/erigontech/erigon/turbo/logging" diff --git a/cmd/state/commands/global_flags_vars.go b/cmd/state/commands/global_flags_vars.go index 9549343717c..43d0364df9b 100644 --- a/cmd/state/commands/global_flags_vars.go +++ b/cmd/state/commands/global_flags_vars.go @@ -21,7 +21,7 @@ import ( "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon/common/paths" + "github.com/erigontech/erigon-lib/common/paths" ) var ( diff --git a/cmd/state/commands/opcode_tracer.go b/cmd/state/commands/opcode_tracer.go index f4207e64b15..7b8b8dbc737 100644 --- a/cmd/state/commands/opcode_tracer.go +++ b/cmd/state/commands/opcode_tracer.go @@ -41,7 +41,7 @@ import ( "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/kv/rawdbv3" - "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core" diff --git a/cmd/state/stats/index_stats.go b/cmd/state/stats/index_stats.go index f4b3408ca16..112b6ab3fa0 100644 --- a/cmd/state/stats/index_stats.go +++ b/cmd/state/stats/index_stats.go @@ -33,7 +33,7 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/mdbx" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" ) func IndexStats(chaindata string, indexBucket string, statsFile string) error { diff --git a/cmd/state/verify/check_indexes.go b/cmd/state/verify/check_indexes.go index e0fb0ea16e5..4e29551f26c 100644 --- a/cmd/state/verify/check_indexes.go +++ b/cmd/state/verify/check_indexes.go @@ -25,10 +25,10 @@ import ( "github.com/erigontech/erigon-lib/kv/dbutils" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv/bitmapdb" "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/kv/temporal/historyv2" - "github.com/erigontech/erigon/common" ) func CheckIndex(ctx context.Context, chaindata string, changeSetBucket string, indexBucket string) error { diff --git a/cmd/txpool/main.go b/cmd/txpool/main.go index 8a142f28b05..026b7c5525b 100644 --- a/cmd/txpool/main.go +++ b/cmd/txpool/main.go @@ -27,6 +27,7 @@ import ( "github.com/spf13/cobra" "github.com/erigontech/erigon-lib/common" + common2 "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/direct" "github.com/erigontech/erigon-lib/gointerfaces" @@ -38,15 +39,14 @@ import ( "github.com/erigontech/erigon-lib/kv/remotedbserver" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" - common2 "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus/misc" "github.com/erigontech/erigon/ethdb/privateapi" "github.com/erigontech/erigon/txnprovider/txpool" "github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg" "github.com/erigontech/erigon/txnprovider/txpool/txpoolutil" + "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon/cmd/utils" - "github.com/erigontech/erigon/common/paths" "github.com/erigontech/erigon/turbo/debug" "github.com/erigontech/erigon/turbo/logging" ) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 1b0b8379f47..ce39f641440 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -38,9 +38,11 @@ import ( "github.com/erigontech/erigon-lib/chain/networkid" "github.com/erigontech/erigon-lib/chain/networkname" "github.com/erigontech/erigon-lib/chain/snapcfg" + common2 "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/common/metrics" + "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon-lib/crypto" libkzg "github.com/erigontech/erigon-lib/crypto/kzg" "github.com/erigontech/erigon-lib/direct" @@ -49,8 +51,6 @@ import ( "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cmd/downloader/downloadernat" "github.com/erigontech/erigon/cmd/utils/flags" - common2 "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/common/paths" "github.com/erigontech/erigon/consensus/ethash/ethashcfg" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/eth/ethconfig" diff --git a/cmd/verkle/main.go b/cmd/verkle/main.go index e600e2130cd..c9f2aa49b85 100644 --- a/cmd/verkle/main.go +++ b/cmd/verkle/main.go @@ -35,8 +35,8 @@ import ( "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cmd/verkle/verkletrie" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/eth/stagedsync/stages" ) diff --git a/cmd/verkle/verkletrie/incrementAccount.go b/cmd/verkle/verkletrie/incrementAccount.go index 863bd47c687..6618691dc9c 100644 --- a/cmd/verkle/verkletrie/incrementAccount.go +++ b/cmd/verkle/verkletrie/incrementAccount.go @@ -28,7 +28,7 @@ import ( "github.com/erigontech/erigon-lib/kv/temporal/historyv2" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon/core/types/accounts" ) diff --git a/cmd/verkle/verkletrie/incrementStorage.go b/cmd/verkle/verkletrie/incrementStorage.go index f1641e40f88..462396e7f8b 100644 --- a/cmd/verkle/verkletrie/incrementStorage.go +++ b/cmd/verkle/verkletrie/incrementStorage.go @@ -29,8 +29,8 @@ import ( "github.com/erigontech/erigon-lib/kv/temporal/historyv2" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon/core/rawdb" ) diff --git a/cmd/verkle/verkletrie/pedersen_hashstate.go b/cmd/verkle/verkletrie/pedersen_hashstate.go index 9ee1191bc7f..edfbebba9ee 100644 --- a/cmd/verkle/verkletrie/pedersen_hashstate.go +++ b/cmd/verkle/verkletrie/pedersen_hashstate.go @@ -29,8 +29,8 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon/core/types/accounts" ) diff --git a/cmd/verkle/verkletrie/verkle_tree_writer.go b/cmd/verkle/verkletrie/verkle_tree_writer.go index eb4c3bbdd7b..40f74b8e2b2 100644 --- a/cmd/verkle/verkletrie/verkle_tree_writer.go +++ b/cmd/verkle/verkletrie/verkle_tree_writer.go @@ -30,7 +30,7 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/turbo/trie/vtree" diff --git a/common/bytes.go b/common/bytes.go deleted file mode 100644 index 5b9d1306e27..00000000000 --- a/common/bytes.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// (original work) -// Copyright 2024 The Erigon Authors -// (modifications) -// This file is part of Erigon. -// -// Erigon is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Erigon is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Erigon. If not, see . - -// Package common contains various helper functions. -package common - -import ( - "bytes" - "encoding/hex" - - "github.com/erigontech/erigon-lib/common" -) - -// FromHex returns the bytes represented by the hexadecimal string s. -// s may be prefixed with "0x". -func FromHex(s string) []byte { - if has0xPrefix(s) { - s = s[2:] - } - if len(s)%2 == 1 { - s = "0" + s - } - return common.Hex2Bytes(s) -} - -// has0xPrefix validates str begins with '0x' or '0X'. -func has0xPrefix(str string) bool { - return len(str) >= 2 && str[0] == '0' && (str[1] == 'x' || str[1] == 'X') -} - -// isHexCharacter returns bool of c being a valid hexadecimal. -func isHexCharacter(c byte) bool { - return ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') -} - -// isHex validates whether each byte is valid hexadecimal string. -func isHex(str string) bool { - if len(str)%2 != 0 { - return false - } - for _, c := range []byte(str) { - if !isHexCharacter(c) { - return false - } - } - return true -} - -// Bytes2Hex returns the hexadecimal encoding of d. -func Bytes2Hex(d []byte) string { - return hex.EncodeToString(d) -} - -// RightPadBytes zero-pads slice to the right up to length l. -func RightPadBytes(slice []byte, l int) []byte { - if l <= len(slice) { - return slice - } - - padded := make([]byte, l) - copy(padded, slice) - - return padded -} - -// LeftPadBytes zero-pads slice to the left up to length l. -func LeftPadBytes(slice []byte, l int) []byte { - if l <= len(slice) { - return slice - } - - padded := make([]byte, l) - copy(padded[l-len(slice):], slice) - - return padded -} - -// TrimLeftZeroes returns a subslice of s without leading zeroes -func TrimLeftZeroes(s []byte) []byte { - idx := 0 - for ; idx < len(s); idx++ { - if s[idx] != 0 { - break - } - } - return s[idx:] -} - -// TrimRightZeroes returns a subslice of s without trailing zeroes -func TrimRightZeroes(s []byte) []byte { - idx := len(s) - for ; idx > 0; idx-- { - if s[idx-1] != 0 { - break - } - } - return s[:idx] -} - -func KeyCmp(key1, key2 []byte) (int, bool) { - switch { - //both keys are empty - case len(key1) == 0 && len(key2) == 0: - return 0, true - // key1 is empty - case len(key1) == 0 && len(key2) != 0: - return 1, false - // key2 is empty - case len(key1) != 0 && len(key2) == 0: - return -1, false - default: - return bytes.Compare(key1, key2), false - } -} diff --git a/consensus/aura/config.go b/consensus/aura/config.go index 4ed031fcb09..2f4d775870f 100644 --- a/consensus/aura/config.go +++ b/consensus/aura/config.go @@ -26,7 +26,7 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon/common/u256" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon/consensus" ) diff --git a/consensus/aura/validators.go b/consensus/aura/validators.go index 3f8a16cbd2c..45deb297650 100644 --- a/consensus/aura/validators.go +++ b/consensus/aura/validators.go @@ -28,13 +28,13 @@ import ( lru "github.com/hashicorp/golang-lru/v2" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/aura/auraabi" "github.com/erigontech/erigon/consensus/aura/aurainterfaces" diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index 973819aad2c..413242b2415 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -36,6 +36,7 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/crypto/cryptopool" @@ -43,7 +44,6 @@ import ( "github.com/erigontech/erigon-lib/kv/dbutils" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/tracing" diff --git a/consensus/ethash/algorithm.go b/consensus/ethash/algorithm.go index 6747790a263..b094d469917 100644 --- a/consensus/ethash/algorithm.go +++ b/consensus/ethash/algorithm.go @@ -33,11 +33,11 @@ import ( "golang.org/x/crypto/sha3" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/bitutil" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/bitutil" - "github.com/erigontech/erigon/common/debug" ) const ( diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index 6163742ed7d..2ab2624f96d 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -36,8 +36,8 @@ import ( "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/ethash/ethashcfg" "github.com/erigontech/erigon/consensus/misc" diff --git a/consensus/ethash/ethash.go b/consensus/ethash/ethash.go index 08e3f79359a..4b8219d9398 100644 --- a/consensus/ethash/ethash.go +++ b/consensus/ethash/ethash.go @@ -40,7 +40,7 @@ import ( "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/ethash/ethashcfg" "github.com/erigontech/erigon/core/vm/evmtypes" diff --git a/consensus/ethash/meter.go b/consensus/ethash/meter.go index 1414dac98fb..b6a90e60fc0 100644 --- a/consensus/ethash/meter.go +++ b/consensus/ethash/meter.go @@ -22,7 +22,7 @@ import ( "sync/atomic" "time" - "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon-lib/common/debug" ) func newHashRateMeter() *hashRateMeter { diff --git a/consensus/result.go b/consensus/result.go index 2bf12da0a6e..f08544cc51d 100644 --- a/consensus/result.go +++ b/consensus/result.go @@ -19,8 +19,8 @@ package consensus import ( "context" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/core/types" ) diff --git a/core/blockchain.go b/core/blockchain.go index 6bba592b454..8d86276b636 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -36,8 +36,8 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/metrics" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/tracing" diff --git a/common/debugprint/receipts.go b/core/debugprint/receipts.go similarity index 100% rename from common/debugprint/receipts.go rename to core/debugprint/receipts.go diff --git a/core/genesis_test.go b/core/genesis_test.go index 84042f9e7ae..83c4820dfc9 100644 --- a/core/genesis_test.go +++ b/core/genesis_test.go @@ -28,6 +28,7 @@ import ( "github.com/stretchr/testify/require" "github.com/erigontech/erigon-lib/chain/networkname" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/crypto" @@ -35,7 +36,6 @@ import ( "github.com/erigontech/erigon-lib/kv/rawdbv3" "github.com/erigontech/erigon-lib/kv/temporal/temporaltest" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" diff --git a/core/genesis_write.go b/core/genesis_write.go index 1320d0aef2b..a7820b4aa61 100644 --- a/core/genesis_write.go +++ b/core/genesis_write.go @@ -35,6 +35,7 @@ import ( "github.com/erigontech/erigon-lib/chain" "github.com/erigontech/erigon-lib/chain/networkname" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/common/hexutil" @@ -46,7 +47,6 @@ import ( "github.com/erigontech/erigon-lib/kv/temporal" "github.com/erigontech/erigon-lib/log/v3" state2 "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/tracing" diff --git a/core/rawdb/accessors_chain_test.go b/core/rawdb/accessors_chain_test.go index 286adc5533e..4d3ed9e6a3f 100644 --- a/core/rawdb/accessors_chain_test.go +++ b/core/rawdb/accessors_chain_test.go @@ -31,11 +31,11 @@ import ( "golang.org/x/crypto/sha3" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv/memdb" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" diff --git a/core/rlp_test.go b/core/rlp_test.go index 502df7026f0..04678fc61ce 100644 --- a/core/rlp_test.go +++ b/core/rlp_test.go @@ -28,10 +28,10 @@ import ( "golang.org/x/crypto/sha3" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" diff --git a/core/state/contracts/gen_changer.go b/core/state/contracts/gen_changer.go index 7b78acb2399..26e66ba0adc 100644 --- a/core/state/contracts/gen_changer.go +++ b/core/state/contracts/gen_changer.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/core/state/contracts/gen_phoenix.go b/core/state/contracts/gen_phoenix.go index 4d683e4f3fa..9ba545f3357 100644 --- a/core/state/contracts/gen_phoenix.go +++ b/core/state/contracts/gen_phoenix.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/core/state/contracts/gen_poly.go b/core/state/contracts/gen_poly.go index 4a672411d4e..d19fabe2014 100644 --- a/core/state/contracts/gen_poly.go +++ b/core/state/contracts/gen_poly.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/core/state/contracts/gen_revive.go b/core/state/contracts/gen_revive.go index 64e4dbfaebe..af48b7bf9c6 100644 --- a/core/state/contracts/gen_revive.go +++ b/core/state/contracts/gen_revive.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/core/state/contracts/gen_revive2.go b/core/state/contracts/gen_revive2.go index b017e744d5d..588bba45b9b 100644 --- a/core/state/contracts/gen_revive2.go +++ b/core/state/contracts/gen_revive2.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/core/state/contracts/gen_selfdestruct.go b/core/state/contracts/gen_selfdestruct.go index 15257b0259d..cea4977b7d9 100644 --- a/core/state/contracts/gen_selfdestruct.go +++ b/core/state/contracts/gen_selfdestruct.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/core/state/database_test.go b/core/state/database_test.go index 55e466820ed..83d36886e5f 100644 --- a/core/state/database_test.go +++ b/core/state/database_test.go @@ -31,6 +31,7 @@ import ( "github.com/stretchr/testify/require" "github.com/erigontech/erigon-lib/chain" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv" @@ -38,7 +39,6 @@ import ( state3 "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon/accounts/abi/bind" "github.com/erigontech/erigon/accounts/abi/bind/backends" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/state/contracts" diff --git a/core/state/dump.go b/core/state/dump.go index 774cb1a7d3d..884a64d5f92 100644 --- a/core/state/dump.go +++ b/core/state/dump.go @@ -24,13 +24,13 @@ import ( "errors" "fmt" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/order" "github.com/erigontech/erigon-lib/kv/rawdbv3" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/turbo/trie" ) diff --git a/core/state/intra_block_state.go b/core/state/intra_block_state.go index ff09d7ead60..89a10a80e3a 100644 --- a/core/state/intra_block_state.go +++ b/core/state/intra_block_state.go @@ -29,8 +29,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/types/accounts" diff --git a/core/state/state_object_test.go b/core/state/state_object_test.go index 9a77541b6a3..e841e724dfd 100644 --- a/core/state/state_object_test.go +++ b/core/state/state_object_test.go @@ -23,8 +23,8 @@ import ( "bytes" "testing" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon/common" ) func BenchmarkCutOriginal(b *testing.B) { diff --git a/core/state_transition.go b/core/state_transition.go index 44e6f3e0fa6..fdda38bd87c 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -30,9 +30,9 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/fixedgas" "github.com/erigontech/erigon-lib/common/math" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/vm" diff --git a/core/tx_cacher.go b/core/tx_cacher.go index 0bdb67c5a9e..3bb7ca3b9cc 100644 --- a/core/tx_cacher.go +++ b/core/tx_cacher.go @@ -23,7 +23,7 @@ import ( "sync" libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon/core/types" ) diff --git a/core/types/block.go b/core/types/block.go index fdba3f61d70..9c5d857f70b 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -32,12 +32,12 @@ import ( "github.com/gballet/go-verkle" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/rlp" rlp2 "github.com/erigontech/erigon-lib/rlp2" - "github.com/erigontech/erigon/common" ) var ( diff --git a/core/types/block_test.go b/core/types/block_test.go index 2ff2599f430..3907b72bed0 100644 --- a/core/types/block_test.go +++ b/core/types/block_test.go @@ -32,14 +32,14 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/math" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/params" ) diff --git a/core/types/gen_genesis.go b/core/types/gen_genesis.go index 720cc0410ee..d6ff602976e 100644 --- a/core/types/gen_genesis.go +++ b/core/types/gen_genesis.go @@ -11,7 +11,7 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/math" - common0 "github.com/erigontech/erigon/common" + common0 "github.com/erigontech/erigon-lib/common" ) var _ = (*genesisSpecMarshaling)(nil) diff --git a/core/types/genesis.go b/core/types/genesis.go index 10c5e4f6526..8e66640afa5 100644 --- a/core/types/genesis.go +++ b/core/types/genesis.go @@ -32,7 +32,7 @@ import ( "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/math" - common2 "github.com/erigontech/erigon/common" + common2 "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/params" ) diff --git a/core/types/receipt_test.go b/core/types/receipt_test.go index 2cde0914ea9..3077a2708f3 100644 --- a/core/types/receipt_test.go +++ b/core/types/receipt_test.go @@ -29,11 +29,11 @@ import ( "github.com/holiman/uint256" "github.com/stretchr/testify/assert" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/params" ) diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index 46767e9c430..ff8467b063c 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -31,8 +31,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/common/u256" ) var ErrInvalidChainId = errors.New("invalid chain id for signer") diff --git a/core/types/transaction_test.go b/core/types/transaction_test.go index 5cc136bced5..7f9792cdd3e 100644 --- a/core/types/transaction_test.go +++ b/core/types/transaction_test.go @@ -35,12 +35,12 @@ import ( "github.com/holiman/uint256" "github.com/stretchr/testify/assert" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/fixedgas" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/types/typestest" ) diff --git a/core/vm/common.go b/core/vm/common.go index 355d3a378d9..fb63750eb3d 100644 --- a/core/vm/common.go +++ b/core/vm/common.go @@ -22,8 +22,8 @@ package vm import ( "github.com/holiman/uint256" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" - "github.com/erigontech/erigon/common" ) // calcMemSize64 calculates the required memory size, and returns diff --git a/core/vm/contracts.go b/core/vm/contracts.go index ddf15224ceb..a026b64f1cb 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -32,6 +32,7 @@ import ( "github.com/holiman/uint256" "github.com/erigontech/erigon-lib/chain" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/crypto" @@ -39,7 +40,6 @@ import ( "github.com/erigontech/erigon-lib/crypto/bn256" libkzg "github.com/erigontech/erigon-lib/crypto/kzg" "github.com/erigontech/erigon-lib/crypto/secp256r1" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/params" //lint:ignore SA1019 Needed for precompile diff --git a/core/vm/contracts_test.go b/core/vm/contracts_test.go index a7c466677d8..357058f9ed6 100644 --- a/core/vm/contracts_test.go +++ b/core/vm/contracts_test.go @@ -29,7 +29,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" ) // precompiledTest defines the input/output pairs for precompiled contract tests. diff --git a/core/vm/evm.go b/core/vm/evm.go index fb46915fed3..80812b97b05 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -26,8 +26,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/vm/evmtypes" "github.com/erigontech/erigon/params" diff --git a/core/vm/instructions.go b/core/vm/instructions.go index da5960d0504..17ccb4ae4ef 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -31,7 +31,7 @@ import ( "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/tracing" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" diff --git a/core/vm/instructions_test.go b/core/vm/instructions_test.go index e9f6f08c92e..7be19c87b3d 100644 --- a/core/vm/instructions_test.go +++ b/core/vm/instructions_test.go @@ -30,11 +30,11 @@ import ( "github.com/holiman/uint256" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/vm/evmtypes" "github.com/erigontech/erigon/core/vm/stack" diff --git a/core/vm/memory_test.go b/core/vm/memory_test.go index b87f1089705..cd7854c4f9f 100644 --- a/core/vm/memory_test.go +++ b/core/vm/memory_test.go @@ -21,7 +21,7 @@ import ( "strings" "testing" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" ) func TestMemoryCopy(t *testing.T) { diff --git a/core/vm/runtime/runtime_test.go b/core/vm/runtime/runtime_test.go index 371b9689ff4..df98c37a8d0 100644 --- a/core/vm/runtime/runtime_test.go +++ b/core/vm/runtime/runtime_test.go @@ -40,9 +40,9 @@ import ( "github.com/erigontech/erigon-lib/log/v3" stateLib "github.com/erigontech/erigon-lib/state" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/accounts/abi" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/asm" diff --git a/diagnostics/db.go b/diagnostics/db.go index 36df284796f..90d2e196ea8 100644 --- a/diagnostics/db.go +++ b/diagnostics/db.go @@ -25,9 +25,9 @@ import ( "path/filepath" "strings" + "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/mdbx" - "github.com/erigontech/erigon/common/paths" "github.com/urfave/cli/v2" ) diff --git a/docs/readthedocs/source/rpc/tutorial.rst b/docs/readthedocs/source/rpc/tutorial.rst index 7d903ae80ad..5338d3d0dcd 100644 --- a/docs/readthedocs/source/rpc/tutorial.rst +++ b/docs/readthedocs/source/rpc/tutorial.rst @@ -15,7 +15,7 @@ our daemon will only contain one method: `myNamespace_getBlockNumberByHash` whic "context" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/rawdb" ) diff --git a/erigon-lib/common/address.go b/erigon-lib/common/address.go index 0a6f6445613..258ea4729a0 100644 --- a/erigon-lib/common/address.go +++ b/erigon-lib/common/address.go @@ -22,17 +22,12 @@ import ( "encoding/hex" "fmt" "math/big" - "reflect" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto/cryptopool" ) -var ( - addressT = reflect.TypeOf(Address{}) -) - // Address represents the 20 byte address of an Ethereum account. type Address [length.Addr]byte diff --git a/erigon-lib/common/big.go b/erigon-lib/common/big.go index a05af330360..5f5467acafe 100644 --- a/erigon-lib/common/big.go +++ b/erigon-lib/common/big.go @@ -16,7 +16,11 @@ package common -import "math/big" +import ( + "math/big" + + "github.com/holiman/uint256" +) var ( Big0 = big.NewInt(0) @@ -26,4 +30,12 @@ var ( Big32 = big.NewInt(32) Big256 = big.NewInt(256) Big257 = big.NewInt(257) + Num0 = uint256.NewInt(0) + Num1 = uint256.NewInt(1) + Num2 = uint256.NewInt(2) + Num4 = uint256.NewInt(4) + Num8 = uint256.NewInt(8) + Num27 = uint256.NewInt(27) + Num32 = uint256.NewInt(32) + Num35 = uint256.NewInt(35) ) diff --git a/common/bitutil/bitutil.go b/erigon-lib/common/bitutil/bitutil.go similarity index 100% rename from common/bitutil/bitutil.go rename to erigon-lib/common/bitutil/bitutil.go diff --git a/common/bitutil/bitutil_test.go b/erigon-lib/common/bitutil/bitutil_test.go similarity index 98% rename from common/bitutil/bitutil_test.go rename to erigon-lib/common/bitutil/bitutil_test.go index 307bf731f76..94bd3ec3b47 100644 --- a/common/bitutil/bitutil_test.go +++ b/erigon-lib/common/bitutil/bitutil_test.go @@ -118,6 +118,7 @@ func BenchmarkFastXOR2KB(b *testing.B) { benchmarkFastXOR(b, 2048) } func BenchmarkFastXOR4KB(b *testing.B) { benchmarkFastXOR(b, 4096) } func benchmarkFastXOR(b *testing.B, size int) { + b.Helper() p, q := make([]byte, size), make([]byte, size) for i := 0; i < b.N; i++ { @@ -131,6 +132,7 @@ func BenchmarkBaseXOR2KB(b *testing.B) { benchmarkBaseXOR(b, 2048) } func BenchmarkBaseXOR4KB(b *testing.B) { benchmarkBaseXOR(b, 4096) } func benchmarkBaseXOR(b *testing.B, size int) { + b.Helper() p, q := make([]byte, size), make([]byte, size) for i := 0; i < b.N; i++ { @@ -144,6 +146,7 @@ func BenchmarkFastAND2KB(b *testing.B) { benchmarkFastAND(b, 2048) } func BenchmarkFastAND4KB(b *testing.B) { benchmarkFastAND(b, 4096) } func benchmarkFastAND(b *testing.B, size int) { + b.Helper() p, q := make([]byte, size), make([]byte, size) for i := 0; i < b.N; i++ { @@ -157,6 +160,7 @@ func BenchmarkBaseAND2KB(b *testing.B) { benchmarkBaseAND(b, 2048) } func BenchmarkBaseAND4KB(b *testing.B) { benchmarkBaseAND(b, 4096) } func benchmarkBaseAND(b *testing.B, size int) { + b.Helper() p, q := make([]byte, size), make([]byte, size) for i := 0; i < b.N; i++ { @@ -170,6 +174,7 @@ func BenchmarkFastOR2KB(b *testing.B) { benchmarkFastOR(b, 2048) } func BenchmarkFastOR4KB(b *testing.B) { benchmarkFastOR(b, 4096) } func benchmarkFastOR(b *testing.B, size int) { + b.Helper() p, q := make([]byte, size), make([]byte, size) for i := 0; i < b.N; i++ { @@ -183,6 +188,7 @@ func BenchmarkBaseOR2KB(b *testing.B) { benchmarkBaseOR(b, 2048) } func BenchmarkBaseOR4KB(b *testing.B) { benchmarkBaseOR(b, 4096) } func benchmarkBaseOR(b *testing.B, size int) { + b.Helper() p, q := make([]byte, size), make([]byte, size) for i := 0; i < b.N; i++ { @@ -198,6 +204,7 @@ func BenchmarkFastTest2KB(b *testing.B) { benchmarkFastTest(b, 2048) } func BenchmarkFastTest4KB(b *testing.B) { benchmarkFastTest(b, 4096) } func benchmarkFastTest(b *testing.B, size int) { + b.Helper() p := make([]byte, size) a := false for i := 0; i < b.N; i++ { @@ -212,6 +219,7 @@ func BenchmarkBaseTest2KB(b *testing.B) { benchmarkBaseTest(b, 2048) } func BenchmarkBaseTest4KB(b *testing.B) { benchmarkBaseTest(b, 4096) } func benchmarkBaseTest(b *testing.B, size int) { + b.Helper() p := make([]byte, size) a := false for i := 0; i < b.N; i++ { diff --git a/common/bitutil/compress.go b/erigon-lib/common/bitutil/compress.go similarity index 100% rename from common/bitutil/compress.go rename to erigon-lib/common/bitutil/compress.go diff --git a/common/bitutil/compress_test.go b/erigon-lib/common/bitutil/compress_test.go similarity index 99% rename from common/bitutil/compress_test.go rename to erigon-lib/common/bitutil/compress_test.go index 5f1484a5582..b970aff6d00 100644 --- a/common/bitutil/compress_test.go +++ b/erigon-lib/common/bitutil/compress_test.go @@ -167,6 +167,7 @@ func BenchmarkEncoding2KBSaturated(b *testing.B) { benchmarkEncoding(b, 2048, 0. func BenchmarkEncoding4KBSaturated(b *testing.B) { benchmarkEncoding(b, 4096, 0.5) } func benchmarkEncoding(b *testing.B, bytes int, fill float64) { + b.Helper() // Generate a random slice of bytes to compress random := rand.NewSource(0) // reproducible and comparable diff --git a/erigon-lib/common/bytes.go b/erigon-lib/common/bytes.go index 5d35ca1afc7..1e5d4cce608 100644 --- a/erigon-lib/common/bytes.go +++ b/erigon-lib/common/bytes.go @@ -18,6 +18,7 @@ package common import ( "bytes" + "encoding/hex" "fmt" ) @@ -91,3 +92,88 @@ func BytesToUint64(buf []byte) (x uint64) { } return } + +// isHexCharacter returns bool of c being a valid hexadecimal. +func isHexCharacter(c byte) bool { + return ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') +} + +// isHex validates whether each byte is valid hexadecimal string. +func isHex(str string) bool { + if len(str)%2 != 0 { + return false + } + for _, c := range []byte(str) { + if !isHexCharacter(c) { + return false + } + } + return true +} + +// Bytes2Hex returns the hexadecimal encoding of d. +func Bytes2Hex(d []byte) string { + return hex.EncodeToString(d) +} + +// RightPadBytes zero-pads slice to the right up to length l. +func RightPadBytes(slice []byte, l int) []byte { + if l <= len(slice) { + return slice + } + + padded := make([]byte, l) + copy(padded, slice) + + return padded +} + +// LeftPadBytes zero-pads slice to the left up to length l. +func LeftPadBytes(slice []byte, l int) []byte { + if l <= len(slice) { + return slice + } + + padded := make([]byte, l) + copy(padded[l-len(slice):], slice) + + return padded +} + +// TrimLeftZeroes returns a subslice of s without leading zeroes +func TrimLeftZeroes(s []byte) []byte { + idx := 0 + for ; idx < len(s); idx++ { + if s[idx] != 0 { + break + } + } + return s[idx:] +} + +// TrimRightZeroes returns a subslice of s without trailing zeroes +func TrimRightZeroes(s []byte) []byte { + idx := len(s) + for ; idx > 0; idx-- { + if s[idx-1] != 0 { + break + } + } + return s[:idx] +} + +func KeyCmp(key1, key2 []byte) (int, bool) { + switch { + //both keys are empty + case len(key1) == 0 && len(key2) == 0: + return 0, true + // key1 is empty + case len(key1) == 0 && len(key2) != 0: + return 1, false + // key2 is empty + case len(key1) != 0 && len(key2) == 0: + return -1, false + default: + return bytes.Compare(key1, key2), false + } +} diff --git a/common/bytes_test.go b/erigon-lib/common/bytes_test.go similarity index 97% rename from common/bytes_test.go rename to erigon-lib/common/bytes_test.go index 50178a5edf2..235a60912a7 100644 --- a/common/bytes_test.go +++ b/erigon-lib/common/bytes_test.go @@ -22,14 +22,12 @@ package common import ( "bytes" "testing" - - "github.com/erigontech/erigon-lib/common" ) func TestCopyBytes(t *testing.T) { input := []byte{1, 2, 3, 4} - v := common.CopyBytes(input) + v := CopyBytes(input) if !bytes.Equal(v, []byte{1, 2, 3, 4}) { t.Fatal("not equal after copy") } diff --git a/common/compiler/helpers.go b/erigon-lib/common/compiler/helpers.go similarity index 100% rename from common/compiler/helpers.go rename to erigon-lib/common/compiler/helpers.go diff --git a/common/compiler/solidity.go b/erigon-lib/common/compiler/solidity.go similarity index 100% rename from common/compiler/solidity.go rename to erigon-lib/common/compiler/solidity.go diff --git a/common/compiler/test.v.py b/erigon-lib/common/compiler/test.v.py similarity index 100% rename from common/compiler/test.v.py rename to erigon-lib/common/compiler/test.v.py diff --git a/common/compiler/test_bad.v.py b/erigon-lib/common/compiler/test_bad.v.py similarity index 100% rename from common/compiler/test_bad.v.py rename to erigon-lib/common/compiler/test_bad.v.py diff --git a/common/compiler/vyper.go b/erigon-lib/common/compiler/vyper.go similarity index 100% rename from common/compiler/vyper.go rename to erigon-lib/common/compiler/vyper.go diff --git a/common/compiler/vyper_test.go b/erigon-lib/common/compiler/vyper_test.go similarity index 99% rename from common/compiler/vyper_test.go rename to erigon-lib/common/compiler/vyper_test.go index 13ad279138e..251d02e8f3e 100644 --- a/common/compiler/vyper_test.go +++ b/erigon-lib/common/compiler/vyper_test.go @@ -25,6 +25,7 @@ import ( ) func skipWithoutVyper(t *testing.T) { + t.Helper() if _, err := exec.LookPath("vyper"); err != nil { t.Skip(err) } diff --git a/common/debug.go b/erigon-lib/common/debug.go similarity index 100% rename from common/debug.go rename to erigon-lib/common/debug.go diff --git a/common/debug/callers.go b/erigon-lib/common/debug/callers.go similarity index 100% rename from common/debug/callers.go rename to erigon-lib/common/debug/callers.go diff --git a/common/debug/log_panic.go b/erigon-lib/common/debug/log_panic.go similarity index 100% rename from common/debug/log_panic.go rename to erigon-lib/common/debug/log_panic.go diff --git a/common/debug/pprof_cgo.go b/erigon-lib/common/debug/pprof_cgo.go similarity index 100% rename from common/debug/pprof_cgo.go rename to erigon-lib/common/debug/pprof_cgo.go diff --git a/common/fdlimit/fdlimit_bsd.go b/erigon-lib/common/fdlimit/fdlimit_bsd.go similarity index 100% rename from common/fdlimit/fdlimit_bsd.go rename to erigon-lib/common/fdlimit/fdlimit_bsd.go diff --git a/common/fdlimit/fdlimit_darwin.go b/erigon-lib/common/fdlimit/fdlimit_darwin.go similarity index 100% rename from common/fdlimit/fdlimit_darwin.go rename to erigon-lib/common/fdlimit/fdlimit_darwin.go diff --git a/common/fdlimit/fdlimit_test.go b/erigon-lib/common/fdlimit/fdlimit_test.go similarity index 100% rename from common/fdlimit/fdlimit_test.go rename to erigon-lib/common/fdlimit/fdlimit_test.go diff --git a/common/fdlimit/fdlimit_unix.go b/erigon-lib/common/fdlimit/fdlimit_unix.go similarity index 100% rename from common/fdlimit/fdlimit_unix.go rename to erigon-lib/common/fdlimit/fdlimit_unix.go diff --git a/common/fdlimit/fdlimit_windows.go b/erigon-lib/common/fdlimit/fdlimit_windows.go similarity index 100% rename from common/fdlimit/fdlimit_windows.go rename to erigon-lib/common/fdlimit/fdlimit_windows.go diff --git a/common/mclock/mclock.go b/erigon-lib/common/mclock/mclock.go similarity index 100% rename from common/mclock/mclock.go rename to erigon-lib/common/mclock/mclock.go diff --git a/common/mclock/mclock.s b/erigon-lib/common/mclock/mclock.s similarity index 100% rename from common/mclock/mclock.s rename to erigon-lib/common/mclock/mclock.s diff --git a/common/mclock/simclock.go b/erigon-lib/common/mclock/simclock.go similarity index 100% rename from common/mclock/simclock.go rename to erigon-lib/common/mclock/simclock.go diff --git a/common/mclock/simclock_test.go b/erigon-lib/common/mclock/simclock_test.go similarity index 100% rename from common/mclock/simclock_test.go rename to erigon-lib/common/mclock/simclock_test.go diff --git a/common/path.go b/erigon-lib/common/path.go similarity index 100% rename from common/path.go rename to erigon-lib/common/path.go diff --git a/common/paths/paths.go b/erigon-lib/common/paths/paths.go similarity index 100% rename from common/paths/paths.go rename to erigon-lib/common/paths/paths.go diff --git a/common/prque/prque.go b/erigon-lib/common/prque/prque.go similarity index 100% rename from common/prque/prque.go rename to erigon-lib/common/prque/prque.go diff --git a/common/prque/prque_test.go b/erigon-lib/common/prque/prque_test.go similarity index 100% rename from common/prque/prque_test.go rename to erigon-lib/common/prque/prque_test.go diff --git a/common/prque/sstack.go b/erigon-lib/common/prque/sstack.go similarity index 100% rename from common/prque/sstack.go rename to erigon-lib/common/prque/sstack.go diff --git a/common/prque/sstack_test.go b/erigon-lib/common/prque/sstack_test.go similarity index 100% rename from common/prque/sstack_test.go rename to erigon-lib/common/prque/sstack_test.go diff --git a/common/size.go b/erigon-lib/common/size.go similarity index 100% rename from common/size.go rename to erigon-lib/common/size.go diff --git a/common/size_test.go b/erigon-lib/common/size_test.go similarity index 100% rename from common/size_test.go rename to erigon-lib/common/size_test.go diff --git a/common/test_utils.go b/erigon-lib/common/test_utils.go similarity index 94% rename from common/test_utils.go rename to erigon-lib/common/test_utils.go index 455c7069034..e3081b06c33 100644 --- a/common/test_utils.go +++ b/erigon-lib/common/test_utils.go @@ -21,6 +21,7 @@ package common import ( "encoding/json" + "errors" "fmt" "os" ) @@ -32,7 +33,8 @@ func LoadJSON(file string, val interface{}) error { return err } if err := json.Unmarshal(content, val); err != nil { - if syntaxerr, ok := err.(*json.SyntaxError); ok { + var syntaxerr *json.SyntaxError + if ok := errors.As(err, &syntaxerr); ok { line := findLine(content, syntaxerr.Offset) return fmt.Errorf("JSON syntax error at %v:%v: %w", file, line, err) } diff --git a/common/tuples.go b/erigon-lib/common/tuples.go similarity index 100% rename from common/tuples.go rename to erigon-lib/common/tuples.go diff --git a/common/tuples_test.go b/erigon-lib/common/tuples_test.go similarity index 100% rename from common/tuples_test.go rename to erigon-lib/common/tuples_test.go diff --git a/common/types.go b/erigon-lib/common/types.go similarity index 90% rename from common/types.go rename to erigon-lib/common/types.go index ae31348b168..d4c32b80aeb 100644 --- a/common/types.go +++ b/erigon-lib/common/types.go @@ -27,7 +27,6 @@ import ( "reflect" "strings" - libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/length" @@ -42,7 +41,7 @@ const ( ) // UnprefixedHash allows marshaling a Hash without 0x prefix. -type UnprefixedHash libcommon.Hash +type UnprefixedHash Hash // UnmarshalText decodes the hash from hex. The 0x prefix is optional. func (h *UnprefixedHash) UnmarshalText(input []byte) error { @@ -56,10 +55,10 @@ func (h UnprefixedHash) MarshalText() ([]byte, error) { /////////// Address -var addressT = reflect.TypeOf(libcommon.Address{}) +var addressT = reflect.TypeOf(Address{}) // UnprefixedAddress allows marshaling an Address without 0x prefix. -type UnprefixedAddress libcommon.Address +type UnprefixedAddress Address // UnmarshalText decodes the address from hex. The 0x prefix is optional. func (a *UnprefixedAddress) UnmarshalText(input []byte) error { @@ -74,22 +73,22 @@ func (a UnprefixedAddress) MarshalText() ([]byte, error) { // MixedcaseAddress retains the original string, which may or may not be // correctly checksummed type MixedcaseAddress struct { - addr libcommon.Address + addr Address original string } // NewMixedcaseAddress constructor (mainly for testing) -func NewMixedcaseAddress(addr libcommon.Address) MixedcaseAddress { +func NewMixedcaseAddress(addr Address) MixedcaseAddress { return MixedcaseAddress{addr: addr, original: addr.Hex()} } // NewMixedcaseAddressFromString is mainly meant for unit-testing func NewMixedcaseAddressFromString(hexaddr string) (*MixedcaseAddress, error) { - if !libcommon.IsHexAddress(hexaddr) { + if !IsHexAddress(hexaddr) { return nil, errors.New("invalid address") } a := FromHex(hexaddr) - return &MixedcaseAddress{addr: libcommon.BytesToAddress(a), original: hexaddr}, nil + return &MixedcaseAddress{addr: BytesToAddress(a), original: hexaddr}, nil } // UnmarshalJSON parses MixedcaseAddress @@ -109,7 +108,7 @@ func (ma *MixedcaseAddress) MarshalJSON() ([]byte, error) { } // Address returns the address -func (ma *MixedcaseAddress) Address() libcommon.Address { +func (ma *MixedcaseAddress) Address() Address { return ma.addr } @@ -132,7 +131,7 @@ func (ma *MixedcaseAddress) Original() string { } // Addresses is a slice of libcommon.Address, implementing sort.Interface -type Addresses []libcommon.Address +type Addresses []Address func (addrs Addresses) Len() int { return len(addrs) @@ -145,7 +144,7 @@ func (addrs Addresses) Swap(i, j int) { } // Hashes is a slice of libcommon.Hash, implementing sort.Interface -type Hashes []libcommon.Hash +type Hashes []Hash func (hashes Hashes) Len() int { return len(hashes) diff --git a/common/types_test.go b/erigon-lib/common/types_test.go similarity index 96% rename from common/types_test.go rename to erigon-lib/common/types_test.go index 7918817aef7..ec93c88607d 100644 --- a/common/types_test.go +++ b/erigon-lib/common/types_test.go @@ -28,15 +28,13 @@ import ( "reflect" "strings" "testing" - - libcommon "github.com/erigontech/erigon-lib/common" ) func TestBytesConversion(t *testing.T) { byteSlice := []byte{5} - hash := libcommon.BytesToHash(byteSlice) + hash := BytesToHash(byteSlice) - var exp libcommon.Hash + var exp Hash exp[31] = 5 if hash != exp { @@ -61,7 +59,7 @@ func TestIsHexAddress(t *testing.T) { } for _, test := range tests { - if result := libcommon.IsHexAddress(test.str); result != test.exp { + if result := IsHexAddress(test.str); result != test.exp { t.Errorf("IsHexAddress(%s) == %v; expected %v", test.str, result, test.exp) } @@ -83,7 +81,7 @@ func TestHashJsonValidation(t *testing.T) { } for _, test := range tests { input := `"` + test.Prefix + strings.Repeat("0", test.Size) + `"` - var v libcommon.Hash + var v Hash err := json.Unmarshal([]byte(input), &v) if err == nil { if test.Error != "" { @@ -112,7 +110,7 @@ func TestAddressUnmarshalJSON(t *testing.T) { {`"0x0000000000000000000000000000000000000010"`, false, big.NewInt(16)}, } for i, test := range tests { - var v libcommon.Address + var v Address err := json.Unmarshal([]byte(test.Input), &v) if err != nil && !test.ShouldErr { t.Errorf("test #%d: unexpected error: %v", i, err) @@ -145,7 +143,7 @@ func TestAddressHexChecksum(t *testing.T) { {"0x000000000000000000000000000000000000000a", "0x000000000000000000000000000000000000000A"}, } for i, test := range tests { - output := libcommon.HexToAddress(test.Input).Hex() + output := HexToAddress(test.Input).Hex() if output != test.Output { t.Errorf("test #%d: failed to match when it should (%s != %s)", i, output, test.Output) } @@ -153,7 +151,7 @@ func TestAddressHexChecksum(t *testing.T) { } func BenchmarkAddressHex(b *testing.B) { - testAddr := libcommon.HexToAddress("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") + testAddr := HexToAddress("0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed") for n := 0; n < b.N; n++ { testAddr.Hex() } @@ -238,7 +236,7 @@ func TestHash_Scan(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - h := &libcommon.Hash{} + h := &Hash{} if err := h.Scan(tt.args.src); (err != nil) != tt.wantErr { t.Errorf("Hash.Scan() error = %v, wantErr %v", err, tt.wantErr) } @@ -264,11 +262,11 @@ func TestHash_Value(t *testing.T) { 0xa2, 0x18, 0xc6, 0xa9, 0x27, 0x4d, 0x30, 0xab, 0x9a, 0x15, 0x10, 0x00, } - var usedH libcommon.Hash + var usedH Hash usedH.SetBytes(b) tests := []struct { name string - h libcommon.Hash + h Hash want driver.Value wantErr bool }{ @@ -326,7 +324,7 @@ func TestAddress_Scan(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - a := &libcommon.Address{} + a := &Address{} if err := a.Scan(tt.args.src); (err != nil) != tt.wantErr { t.Errorf("Address.Scan() error = %v, wantErr %v", err, tt.wantErr) } @@ -350,11 +348,11 @@ func TestAddress_Value(t *testing.T) { 0xb2, 0x6f, 0x2b, 0x34, 0x2a, 0xab, 0x24, 0xbc, 0xf6, 0x3e, 0xa2, 0x18, 0xc6, 0xa9, 0x27, 0x4d, 0x30, 0xab, 0x9a, 0x15, } - var usedA libcommon.Address + var usedA Address usedA.SetBytes(b) tests := []struct { name string - a libcommon.Address + a Address want driver.Value wantErr bool }{ @@ -384,7 +382,7 @@ func TestAddress_Format(t *testing.T) { 0xb2, 0x6f, 0x2b, 0x34, 0x2a, 0xab, 0x24, 0xbc, 0xf6, 0x3e, 0xa2, 0x18, 0xc6, 0xa9, 0x27, 0x4d, 0x30, 0xab, 0x9a, 0x15, } - var addr libcommon.Address + var addr Address addr.SetBytes(b) tests := []struct { @@ -459,7 +457,7 @@ func TestAddress_Format(t *testing.T) { } func TestHash_Format(t *testing.T) { - var hash libcommon.Hash + var hash Hash hash.SetBytes([]byte{ 0xb2, 0x6f, 0x2b, 0x34, 0x2a, 0xab, 0x24, 0xbc, 0xf6, 0x3e, 0xa2, 0x18, 0xc6, 0xa9, 0x27, 0x4d, 0x30, 0xab, 0x9a, 0x15, diff --git a/erigon-lib/common/u256/big.go b/erigon-lib/common/u256/big.go index 25b9863b3f7..d56c103067e 100644 --- a/erigon-lib/common/u256/big.go +++ b/erigon-lib/common/u256/big.go @@ -22,14 +22,22 @@ import ( // Common big integers often used var ( - N0 = uint256.NewInt(0) - N1 = uint256.NewInt(1) - N2 = uint256.NewInt(2) - N4 = uint256.NewInt(4) - N8 = uint256.NewInt(8) - N27 = uint256.NewInt(27) - N28 = uint256.NewInt(28) - N32 = uint256.NewInt(32) - N35 = uint256.NewInt(35) - N100 = uint256.NewInt(100) + N0 = uint256.NewInt(0) + N1 = uint256.NewInt(1) + N2 = uint256.NewInt(2) + N4 = uint256.NewInt(4) + N8 = uint256.NewInt(8) + N27 = uint256.NewInt(27) + N28 = uint256.NewInt(28) + N32 = uint256.NewInt(32) + N35 = uint256.NewInt(35) + N100 = uint256.NewInt(100) + Num0 = uint256.NewInt(0) + Num1 = uint256.NewInt(1) + Num2 = uint256.NewInt(2) + Num4 = uint256.NewInt(4) + Num8 = uint256.NewInt(8) + Num27 = uint256.NewInt(27) + Num32 = uint256.NewInt(32) + Num35 = uint256.NewInt(35) ) diff --git a/erigon-lib/debug/callers.go b/erigon-lib/debug/callers.go new file mode 100644 index 00000000000..570f28550ff --- /dev/null +++ b/erigon-lib/debug/callers.go @@ -0,0 +1,41 @@ +// Copyright 2024 The Erigon Authors +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package debug + +import ( + "runtime" +) + +// Callers returns given number of callers with packages +func Callers(show int) []string { + fpcs := make([]uintptr, show) + n := runtime.Callers(2, fpcs) + if n == 0 { + return nil + } + + callers := make([]string, 0, len(fpcs)) + for _, p := range fpcs { + caller := runtime.FuncForPC(p - 1) + if caller == nil { + continue + } + callers = append(callers, caller.Name()) + } + + return callers +} diff --git a/erigon-lib/debug/log_panic.go b/erigon-lib/debug/log_panic.go new file mode 100644 index 00000000000..e5bdb079b16 --- /dev/null +++ b/erigon-lib/debug/log_panic.go @@ -0,0 +1,45 @@ +// Copyright 2024 The Erigon Authors +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package debug + +import ( + "os" + "sync/atomic" + "syscall" + + "github.com/erigontech/erigon-lib/common/dbg" + "github.com/erigontech/erigon-lib/log/v3" +) + +var sigc atomic.Value + +func GetSigC(sig *chan os.Signal) { + sigc.Store(*sig) +} + +// LogPanic - does log panic to logger and to /crashreports then stops the process +func LogPanic() { + panicResult := recover() + if panicResult == nil { + return + } + + log.Error("catch panic", "err", panicResult, "stack", dbg.Stack()) + if sl := sigc.Load(); sl != nil { + sl.(chan os.Signal) <- syscall.SIGINT + } +} diff --git a/erigon-lib/debug/pprof_cgo.go b/erigon-lib/debug/pprof_cgo.go new file mode 100644 index 00000000000..7c120c4d846 --- /dev/null +++ b/erigon-lib/debug/pprof_cgo.go @@ -0,0 +1,24 @@ +// Copyright 2024 The Erigon Authors +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +//go:build debug +// +build debug + +package debug + +import ( + _ "github.com/benesch/cgosymbolizer" +) diff --git a/erigon-lib/go.mod b/erigon-lib/go.mod index 0dd3d523f36..4ff738b58b2 100644 --- a/erigon-lib/go.mod +++ b/erigon-lib/go.mod @@ -16,6 +16,7 @@ require ( github.com/anacrolix/go-libutp v1.3.1 github.com/anacrolix/log v0.15.2 github.com/anacrolix/torrent v1.52.6-0.20231201115409-7ea994b6bbd8 + github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b github.com/c2h5oh/datasize v0.0.0-20231215233829-aa82cc1e6500 github.com/containerd/cgroups/v3 v3.0.3 github.com/crate-crypto/go-kzg-4844 v0.7.0 diff --git a/erigon-lib/go.sum b/erigon-lib/go.sum index 1279e36072c..99a9c905fd4 100644 --- a/erigon-lib/go.sum +++ b/erigon-lib/go.sum @@ -88,6 +88,8 @@ github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx github.com/benbjohnson/immutable v0.2.0/go.mod h1:uc6OHo6PN2++n98KHLxW8ef4W42ylHiQSENghE1ezxI= github.com/benbjohnson/immutable v0.4.1-0.20221220213129-8932b999621d h1:2qVb9bsAMtmAfnxXltm+6eBzrrS7SZ52c3SedsulaMI= github.com/benbjohnson/immutable v0.4.1-0.20221220213129-8932b999621d/go.mod h1:iAr8OjJGLnLmVUr9MZ/rz4PWUy6Ouc2JLYuMArmvAJM= +github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b h1:5JgaFtHFRnOPReItxvhMDXbvuBkjSWE+9glJyF466yw= +github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b/go.mod h1:eMD2XUcPsHYbakFEocKrWZp47G0MRJYoC60qFblGjpA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= diff --git a/eth/backend.go b/eth/backend.go index e2dce8d56cd..7ed0895c9d6 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -50,6 +50,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/common/dbg" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/common/dir" "github.com/erigontech/erigon-lib/common/disk" "github.com/erigontech/erigon-lib/common/mem" @@ -81,7 +82,6 @@ import ( executionclient "github.com/erigontech/erigon/cl/phase1/execution_client" "github.com/erigontech/erigon/cmd/caplin/caplin1" "github.com/erigontech/erigon/cmd/rpcdaemon/cli" - "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/clique" "github.com/erigontech/erigon/consensus/ethash" diff --git a/eth/calltracer/calltracer.go b/eth/calltracer/calltracer.go index 224e6a8b756..4d6dd32a6b5 100644 --- a/eth/calltracer/calltracer.go +++ b/eth/calltracer/calltracer.go @@ -26,7 +26,7 @@ import ( "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/vm" ) diff --git a/eth/protocols/eth/handlers.go b/eth/protocols/eth/handlers.go index 1e85a125821..a5cca7277c7 100644 --- a/eth/protocols/eth/handlers.go +++ b/eth/protocols/eth/handlers.go @@ -24,11 +24,11 @@ import ( "fmt" "github.com/erigontech/erigon-lib/chain" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/turbo/services" diff --git a/eth/protocols/eth/protocol_test.go b/eth/protocols/eth/protocol_test.go index 630c920084b..3e7ced9cec4 100644 --- a/eth/protocols/eth/protocol_test.go +++ b/eth/protocols/eth/protocol_test.go @@ -26,8 +26,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types" ) diff --git a/eth/stagedsync/stage_mining_create_block.go b/eth/stagedsync/stage_mining_create_block.go index d6ebbfd858d..8da7c5bed4a 100644 --- a/eth/stagedsync/stage_mining_create_block.go +++ b/eth/stagedsync/stage_mining_create_block.go @@ -31,8 +31,8 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/misc" "github.com/erigontech/erigon/core" diff --git a/eth/stagedsync/stage_senders.go b/eth/stagedsync/stage_senders.go index 61845af230f..c235dacbaec 100644 --- a/eth/stagedsync/stage_senders.go +++ b/eth/stagedsync/stage_senders.go @@ -36,7 +36,7 @@ import ( "github.com/erigontech/erigon-lib/kv/dbutils" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" diff --git a/eth/stagedsync/stage_senders_test.go b/eth/stagedsync/stage_senders_test.go index 47e24e70acb..0e2beae1b34 100644 --- a/eth/stagedsync/stage_senders_test.go +++ b/eth/stagedsync/stage_senders_test.go @@ -23,10 +23,10 @@ import ( "github.com/stretchr/testify/require" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/ethconfig" diff --git a/eth/tracers/internal/tracetest/calltrace_test.go b/eth/tracers/internal/tracetest/calltrace_test.go index f393e91ef58..40082cfa26f 100644 --- a/eth/tracers/internal/tracetest/calltrace_test.go +++ b/eth/tracers/internal/tracetest/calltrace_test.go @@ -31,13 +31,13 @@ import ( "github.com/stretchr/testify/require" "github.com/erigontech/erigon-lib/chain" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/dir" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" diff --git a/eth/tracers/internal/tracetest/prestate_test.go b/eth/tracers/internal/tracetest/prestate_test.go index 00efcd98ba7..36abdde4d08 100644 --- a/eth/tracers/internal/tracetest/prestate_test.go +++ b/eth/tracers/internal/tracetest/prestate_test.go @@ -30,9 +30,9 @@ import ( "github.com/holiman/uint256" "github.com/stretchr/testify/require" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/dir" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" diff --git a/eth/tracers/js/goja.go b/eth/tracers/js/goja.go index a0674cbd51c..e8f84ce44bf 100644 --- a/eth/tracers/js/goja.go +++ b/eth/tracers/js/goja.go @@ -28,10 +28,10 @@ import ( "github.com/dop251/goja" "github.com/holiman/uint256" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/core/vm/evmtypes" "github.com/erigontech/erigon/core/vm/stack" diff --git a/eth/tracers/logger/json_stream.go b/eth/tracers/logger/json_stream.go index 1ba2c40ca95..e9a582e4ef7 100644 --- a/eth/tracers/logger/json_stream.go +++ b/eth/tracers/logger/json_stream.go @@ -26,7 +26,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/vm" ) diff --git a/eth/tracers/logger/logger_json.go b/eth/tracers/logger/logger_json.go index 6ad2d7a6a4f..87d9ce8fa5c 100644 --- a/eth/tracers/logger/logger_json.go +++ b/eth/tracers/logger/logger_json.go @@ -29,7 +29,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/vm" ) diff --git a/eth/tracers/native/4byte.go b/eth/tracers/native/4byte.go index f7cc63eb654..77942f307dd 100644 --- a/eth/tracers/native/4byte.go +++ b/eth/tracers/native/4byte.go @@ -28,7 +28,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/eth/tracers" ) diff --git a/ethdb/privateapi/ethbackend.go b/ethdb/privateapi/ethbackend.go index 769096fe712..75780673e58 100644 --- a/ethdb/privateapi/ethbackend.go +++ b/ethdb/privateapi/ethbackend.go @@ -24,6 +24,7 @@ import ( "google.golang.org/protobuf/types/known/emptypb" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/direct" "github.com/erigontech/erigon-lib/gointerfaces" @@ -32,7 +33,6 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/eth/stagedsync/stages" "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/turbo/builder" diff --git a/event/subscription.go b/event/subscription.go index 2eda0e2b7fc..8fd192bca01 100644 --- a/event/subscription.go +++ b/event/subscription.go @@ -24,7 +24,7 @@ import ( "sync" "time" - "github.com/erigontech/erigon/common/mclock" + "github.com/erigontech/erigon-lib/common/mclock" ) // Subscription represents a stream of events. The carrier of the events is typically a diff --git a/go.mod b/go.mod index 9a6d9449db7..571d2469e52 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,6 @@ require ( github.com/alecthomas/kong v0.8.1 github.com/anacrolix/sync v0.5.1 github.com/anacrolix/torrent v1.52.6-0.20231201115409-7ea994b6bbd8 - github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b github.com/c2h5oh/datasize v0.0.0-20231215233829-aa82cc1e6500 github.com/cenkalti/backoff/v4 v4.2.1 github.com/consensys/gnark-crypto v0.12.1 @@ -107,6 +106,7 @@ require ( require ( github.com/alecthomas/atomic v0.1.0-alpha2 // indirect + github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b // indirect github.com/elastic/go-freelru v0.13.0 // indirect github.com/erigontech/speedtest v0.0.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect diff --git a/node/nodecfg/config.go b/node/nodecfg/config.go index e13c6cb21ab..8ac0c78a8dd 100644 --- a/node/nodecfg/config.go +++ b/node/nodecfg/config.go @@ -29,12 +29,12 @@ import ( "github.com/c2h5oh/datasize" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/datadir" + "github.com/erigontech/erigon-lib/common/paths" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cmd/rpcdaemon/cli/httpcfg" - "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/common/paths" "github.com/erigontech/erigon/p2p" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/rpc/rpccfg" diff --git a/p2p/dial.go b/p2p/dial.go index b9523ed66f5..7d5e223d35e 100644 --- a/p2p/dial.go +++ b/p2p/dial.go @@ -31,9 +31,9 @@ import ( "sync/atomic" "time" + "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/debug" - "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/netutil" ) diff --git a/p2p/dial_test.go b/p2p/dial_test.go index d88f1ca93eb..bfb9045bce0 100644 --- a/p2p/dial_test.go +++ b/p2p/dial_test.go @@ -30,8 +30,8 @@ import ( "testing" "time" + "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/netutil" "github.com/erigontech/erigon/turbo/testlog" diff --git a/p2p/discover/common.go b/p2p/discover/common.go index 3307bc84267..f35584c3f39 100644 --- a/p2p/discover/common.go +++ b/p2p/discover/common.go @@ -25,9 +25,9 @@ import ( "net" "time" + "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" "github.com/erigontech/erigon/p2p/netutil" diff --git a/p2p/discover/ntp.go b/p2p/discover/ntp.go index d0a7d2a4016..53cf7ed7d36 100644 --- a/p2p/discover/ntp.go +++ b/p2p/discover/ntp.go @@ -28,8 +28,8 @@ import ( "sort" "time" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/debug" ) const ( diff --git a/p2p/discover/table.go b/p2p/discover/table.go index 330fd7ac484..9b640322582 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -39,7 +39,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/netutil" ) diff --git a/p2p/discover/v4_udp.go b/p2p/discover/v4_udp.go index 846ca702533..803d497afff 100644 --- a/p2p/discover/v4_udp.go +++ b/p2p/discover/v4_udp.go @@ -33,9 +33,9 @@ import ( lru "github.com/hashicorp/golang-lru/v2" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/p2p/discover/v4wire" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/netutil" diff --git a/p2p/discover/v5_udp.go b/p2p/discover/v5_udp.go index 0ed36b0a3e7..78041cda899 100644 --- a/p2p/discover/v5_udp.go +++ b/p2p/discover/v5_udp.go @@ -35,8 +35,8 @@ import ( "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/debug" - "github.com/erigontech/erigon/common/mclock" + "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon/p2p/discover/v5wire" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" diff --git a/p2p/discover/v5wire/encoding.go b/p2p/discover/v5wire/encoding.go index 3801ba3ced1..5db2fa4d5d3 100644 --- a/p2p/discover/v5wire/encoding.go +++ b/p2p/discover/v5wire/encoding.go @@ -31,8 +31,8 @@ import ( "fmt" "hash" + "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" ) diff --git a/p2p/discover/v5wire/encoding_test.go b/p2p/discover/v5wire/encoding_test.go index 61e2b29039d..68ba2598af2 100644 --- a/p2p/discover/v5wire/encoding_test.go +++ b/p2p/discover/v5wire/encoding_test.go @@ -37,9 +37,9 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/erigontech/erigon-lib/common/hexutil" + "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" ) diff --git a/p2p/discover/v5wire/msg.go b/p2p/discover/v5wire/msg.go index f6a71144404..c20a5343c7c 100644 --- a/p2p/discover/v5wire/msg.go +++ b/p2p/discover/v5wire/msg.go @@ -23,8 +23,8 @@ import ( "fmt" "net" + "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" ) diff --git a/p2p/discover/v5wire/session.go b/p2p/discover/v5wire/session.go index 0c0c736d3ce..b7fff118697 100644 --- a/p2p/discover/v5wire/session.go +++ b/p2p/discover/v5wire/session.go @@ -27,8 +27,8 @@ import ( "github.com/hashicorp/golang-lru/v2/simplelru" + "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" ) diff --git a/p2p/dnsdisc/client.go b/p2p/dnsdisc/client.go index 037dca61933..0431c481764 100644 --- a/p2p/dnsdisc/client.go +++ b/p2p/dnsdisc/client.go @@ -34,9 +34,9 @@ import ( "golang.org/x/sync/singleflight" "golang.org/x/time/rate" + "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" ) diff --git a/p2p/dnsdisc/client_test.go b/p2p/dnsdisc/client_test.go index 82a1382dcd6..697bb4f7fca 100644 --- a/p2p/dnsdisc/client_test.go +++ b/p2p/dnsdisc/client_test.go @@ -30,9 +30,9 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/erigontech/erigon-lib/common/hexutil" + "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" "github.com/erigontech/erigon/turbo/testlog" diff --git a/p2p/dnsdisc/sync.go b/p2p/dnsdisc/sync.go index 36eb8e7a7a9..a721c5527b7 100644 --- a/p2p/dnsdisc/sync.go +++ b/p2p/dnsdisc/sync.go @@ -24,7 +24,7 @@ import ( "math/rand" "time" - "github.com/erigontech/erigon/common/mclock" + "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon/p2p/enode" ) diff --git a/p2p/enode/iter.go b/p2p/enode/iter.go index 7a06c187fcc..0bf89f43725 100644 --- a/p2p/enode/iter.go +++ b/p2p/enode/iter.go @@ -23,7 +23,7 @@ import ( "sync" "time" - "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon-lib/common/debug" ) // Iterator represents a sequence of nodes. The Next method moves to the next node in the diff --git a/p2p/message.go b/p2p/message.go index a64f8e4a906..81f57a1ff07 100644 --- a/p2p/message.go +++ b/p2p/message.go @@ -28,8 +28,8 @@ import ( "sync/atomic" "time" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/event" "github.com/erigontech/erigon/p2p/enode" ) diff --git a/p2p/nat/natpmp.go b/p2p/nat/natpmp.go index b6239268fc4..779a843cec6 100644 --- a/p2p/nat/natpmp.go +++ b/p2p/nat/natpmp.go @@ -28,7 +28,7 @@ import ( natpmp "github.com/jackpal/go-nat-pmp" - "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon-lib/common/debug" ) // natPMPClient adapts the NAT-PMP protocol implementation so it conforms to diff --git a/p2p/nat/natupnp.go b/p2p/nat/natupnp.go index 062570ead7a..cfe3ba2d1f9 100644 --- a/p2p/nat/natupnp.go +++ b/p2p/nat/natupnp.go @@ -31,7 +31,7 @@ import ( "github.com/huin/goupnp/dcps/internetgateway1" "github.com/huin/goupnp/dcps/internetgateway2" - "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon-lib/common/debug" ) const ( diff --git a/p2p/netutil/iptrack.go b/p2p/netutil/iptrack.go index 36b3a1df5b9..0ceaf9e1048 100644 --- a/p2p/netutil/iptrack.go +++ b/p2p/netutil/iptrack.go @@ -22,7 +22,7 @@ package netutil import ( "time" - "github.com/erigontech/erigon/common/mclock" + "github.com/erigontech/erigon-lib/common/mclock" ) // IPTracker predicts the external endpoint, i.e. IP address and port, of the local host diff --git a/p2p/netutil/iptrack_test.go b/p2p/netutil/iptrack_test.go index 98c9131ad92..54de69ad11b 100644 --- a/p2p/netutil/iptrack_test.go +++ b/p2p/netutil/iptrack_test.go @@ -25,7 +25,7 @@ import ( "testing" "time" - "github.com/erigontech/erigon/common/mclock" + "github.com/erigontech/erigon-lib/common/mclock" ) const ( diff --git a/p2p/peer.go b/p2p/peer.go index edb9624f756..2dbbbec1ef5 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -32,10 +32,10 @@ import ( "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/metrics" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common/debug" - "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/event" "github.com/erigontech/erigon/p2p/enode" "github.com/erigontech/erigon/p2p/enr" diff --git a/p2p/sentry/sentry_grpc_server.go b/p2p/sentry/sentry_grpc_server.go index 952a8ace783..21e47443680 100644 --- a/p2p/sentry/sentry_grpc_server.go +++ b/p2p/sentry/sentry_grpc_server.go @@ -51,9 +51,9 @@ import ( proto_sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" proto_types "github.com/erigontech/erigon-lib/gointerfaces/typesproto" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/cmd/utils" - "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/core/forkid" "github.com/erigontech/erigon/eth/protocols/eth" "github.com/erigontech/erigon/p2p" diff --git a/p2p/server.go b/p2p/server.go index bf20f0bf596..e4bdbf6834f 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -37,10 +37,10 @@ import ( "golang.org/x/sync/semaphore" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/debug" + "github.com/erigontech/erigon-lib/common/mclock" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/debug" - "github.com/erigontech/erigon/common/mclock" "github.com/erigontech/erigon/event" "github.com/erigontech/erigon/p2p/discover" "github.com/erigontech/erigon/p2p/enode" diff --git a/p2p/transport.go b/p2p/transport.go index c0c42454d4a..d3c4bb8f0d4 100644 --- a/p2p/transport.go +++ b/p2p/transport.go @@ -31,8 +31,8 @@ import ( "time" "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/bitutil" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common/bitutil" "github.com/erigontech/erigon/p2p/rlpx" ) diff --git a/p2p/util.go b/p2p/util.go index b6b1fb5e594..7720034286b 100644 --- a/p2p/util.go +++ b/p2p/util.go @@ -22,7 +22,7 @@ package p2p import ( "container/heap" - "github.com/erigontech/erigon/common/mclock" + "github.com/erigontech/erigon-lib/common/mclock" ) // expHeap tracks strings and their expiry time. diff --git a/p2p/util_test.go b/p2p/util_test.go index 956aa72d011..b1791be5a24 100644 --- a/p2p/util_test.go +++ b/p2p/util_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - "github.com/erigontech/erigon/common/mclock" + "github.com/erigontech/erigon-lib/common/mclock" ) func TestExpHeap(t *testing.T) { diff --git a/params/config.go b/params/config.go index 681e5856a37..a0bdcccfbb6 100644 --- a/params/config.go +++ b/params/config.go @@ -31,7 +31,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/polygon/bor/borcfg" - "github.com/erigontech/erigon/common/paths" + "github.com/erigontech/erigon-lib/common/paths" ) //go:embed chainspecs diff --git a/params/dao.go b/params/dao.go index c8a21258b8f..86753f7969d 100644 --- a/params/dao.go +++ b/params/dao.go @@ -24,7 +24,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" ) // DAOForkBlockExtra is the block header extra-data field to set for the DAO fork diff --git a/polygon/bridge/reader.go b/polygon/bridge/reader.go index d7b6f7d4960..5074968bdc7 100644 --- a/polygon/bridge/reader.go +++ b/polygon/bridge/reader.go @@ -25,11 +25,11 @@ import ( "google.golang.org/protobuf/types/known/emptypb" libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/gointerfaces" remote "github.com/erigontech/erigon-lib/gointerfaces/remoteproto" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" diff --git a/tests/block_test_util.go b/tests/block_test_util.go index cb902108ede..079da8e4280 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -41,8 +41,8 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/state" diff --git a/tests/bor/mining_test.go b/tests/bor/mining_test.go index aab87128e97..aff98b80221 100644 --- a/tests/bor/mining_test.go +++ b/tests/bor/mining_test.go @@ -21,8 +21,8 @@ import ( txpool_proto "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common" - "github.com/erigontech/erigon/common/fdlimit" + "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common/fdlimit" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth" "github.com/erigontech/erigon/node" diff --git a/tests/contracts/gen_selfDestructor.go b/tests/contracts/gen_selfDestructor.go index 7eef45cbc8a..d6639e8c0b4 100644 --- a/tests/contracts/gen_selfDestructor.go +++ b/tests/contracts/gen_selfDestructor.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/tests/contracts/gen_testcontract.go b/tests/contracts/gen_testcontract.go index c27258491f4..544f65b6c3b 100644 --- a/tests/contracts/gen_testcontract.go +++ b/tests/contracts/gen_testcontract.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/tests/fuzzers/bitutil/compress_fuzz.go b/tests/fuzzers/bitutil/compress_fuzz.go index ed2105e1907..07c3d9366d0 100644 --- a/tests/fuzzers/bitutil/compress_fuzz.go +++ b/tests/fuzzers/bitutil/compress_fuzz.go @@ -22,7 +22,7 @@ package bitutil import ( "bytes" - "github.com/erigontech/erigon/common/bitutil" + "github.com/erigontech/erigon-lib/common/bitutil" ) // Fuzz implements a go-fuzz fuzzer method to test various encoding method diff --git a/tests/gen_stenv.go b/tests/gen_stenv.go index 7b91dd290ed..02bbd20fa1c 100644 --- a/tests/gen_stenv.go +++ b/tests/gen_stenv.go @@ -10,7 +10,7 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/math" - common0 "github.com/erigontech/erigon/common" + common0 "github.com/erigontech/erigon-lib/common" ) var _ = (*stEnvMarshaling)(nil) diff --git a/tests/state_test_util.go b/tests/state_test_util.go index 234d2e052d2..fda1cc7108a 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -44,8 +44,8 @@ import ( state2 "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon-lib/wrap" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus/misc" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" diff --git a/turbo/debug/flags.go b/turbo/debug/flags.go index d6567c479ab..f77e2384e0d 100644 --- a/turbo/debug/flags.go +++ b/turbo/debug/flags.go @@ -38,7 +38,7 @@ import ( "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/fdlimit" + "github.com/erigontech/erigon-lib/common/fdlimit" "github.com/erigontech/erigon/turbo/logging" ) diff --git a/turbo/debug/signal.go b/turbo/debug/signal.go index 92d1f8b66b2..3f574a3245a 100644 --- a/turbo/debug/signal.go +++ b/turbo/debug/signal.go @@ -26,8 +26,8 @@ import ( "golang.org/x/sys/unix" + _debug "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/log/v3" - _debug "github.com/erigontech/erigon/common/debug" ) func ListenSignals(stack io.Closer, logger log.Logger) { diff --git a/turbo/debug/signal_windows.go b/turbo/debug/signal_windows.go index 28a6c10f886..2f5c39ef934 100644 --- a/turbo/debug/signal_windows.go +++ b/turbo/debug/signal_windows.go @@ -23,8 +23,8 @@ import ( "os" "os/signal" + _debug "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon-lib/log/v3" - _debug "github.com/erigontech/erigon/common/debug" ) func ListenSignals(stack io.Closer, logger log.Logger) { diff --git a/turbo/engineapi/engine_server.go b/turbo/engineapi/engine_server.go index ae27bc21060..ec4b0414b09 100644 --- a/turbo/engineapi/engine_server.go +++ b/turbo/engineapi/engine_server.go @@ -37,10 +37,10 @@ import ( "github.com/erigontech/erigon-lib/kv/kvcache" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cmd/rpcdaemon/cli" "github.com/erigontech/erigon/cmd/rpcdaemon/cli/httpcfg" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/consensus/merge" "github.com/erigontech/erigon/core/types" diff --git a/turbo/jsonrpc/contracts/gen_poly.go b/turbo/jsonrpc/contracts/gen_poly.go index 185e7624542..dd984a87a22 100644 --- a/turbo/jsonrpc/contracts/gen_poly.go +++ b/turbo/jsonrpc/contracts/gen_poly.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/turbo/jsonrpc/contracts/gen_token.go b/turbo/jsonrpc/contracts/gen_token.go index a0da6eff9be..124fcb5f587 100644 --- a/turbo/jsonrpc/contracts/gen_token.go +++ b/turbo/jsonrpc/contracts/gen_token.go @@ -12,7 +12,7 @@ import ( ethereum "github.com/erigontech/erigon" "github.com/erigontech/erigon/accounts/abi" "github.com/erigontech/erigon/accounts/abi/bind" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/event" ) diff --git a/turbo/jsonrpc/erigon_receipts_test.go b/turbo/jsonrpc/erigon_receipts_test.go index 59597d0d837..cb1a833acdb 100644 --- a/turbo/jsonrpc/erigon_receipts_test.go +++ b/turbo/jsonrpc/erigon_receipts_test.go @@ -31,8 +31,8 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" diff --git a/turbo/jsonrpc/eth_accounts.go b/turbo/jsonrpc/eth_accounts.go index 8f3ce779760..fb2c8587e3b 100644 --- a/turbo/jsonrpc/eth_accounts.go +++ b/turbo/jsonrpc/eth_accounts.go @@ -32,7 +32,7 @@ import ( txpool_proto "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/rpc" ) diff --git a/turbo/jsonrpc/eth_filters.go b/turbo/jsonrpc/eth_filters.go index 5852d1015e0..3f70f7d3d8a 100644 --- a/turbo/jsonrpc/eth_filters.go +++ b/turbo/jsonrpc/eth_filters.go @@ -22,7 +22,7 @@ import ( "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon/common/debug" + "github.com/erigontech/erigon-lib/common/debug" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/filters" "github.com/erigontech/erigon/rpc" diff --git a/turbo/jsonrpc/parity_api_test.go b/turbo/jsonrpc/parity_api_test.go index 0d91fbc47bb..6924e6c56b0 100644 --- a/turbo/jsonrpc/parity_api_test.go +++ b/turbo/jsonrpc/parity_api_test.go @@ -28,8 +28,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutility" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/rpc" ) diff --git a/turbo/jsonrpc/send_transaction_test.go b/turbo/jsonrpc/send_transaction_test.go index 201a2831163..1a3d99ddb91 100644 --- a/turbo/jsonrpc/send_transaction_test.go +++ b/turbo/jsonrpc/send_transaction_test.go @@ -35,8 +35,8 @@ import ( "github.com/erigontech/erigon/rpc/rpccfg" "github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon-lib/log/v3" diff --git a/turbo/jsonrpc/trace_adhoc_test.go b/turbo/jsonrpc/trace_adhoc_test.go index 2f081af3eea..33590c3a9ec 100644 --- a/turbo/jsonrpc/trace_adhoc_test.go +++ b/turbo/jsonrpc/trace_adhoc_test.go @@ -34,9 +34,9 @@ import ( "github.com/erigontech/erigon-lib/common/math" "github.com/erigontech/erigon-lib/kv" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/cmd/rpcdaemon/cli/httpcfg" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" diff --git a/turbo/stages/blockchain_test.go b/turbo/stages/blockchain_test.go index 4e92e6d6f1e..3c58f35a1b4 100644 --- a/turbo/stages/blockchain_test.go +++ b/turbo/stages/blockchain_test.go @@ -36,13 +36,13 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/length" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/crypto" protosentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/bitmapdb" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" diff --git a/turbo/stages/headerdownload/header_algos.go b/turbo/stages/headerdownload/header_algos.go index 6216f64cf60..fbc5158b903 100644 --- a/turbo/stages/headerdownload/header_algos.go +++ b/turbo/stages/headerdownload/header_algos.go @@ -43,8 +43,8 @@ import ( "github.com/erigontech/erigon/dataflow" "github.com/erigontech/erigon/turbo/services" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" diff --git a/turbo/stages/mock/sentry_mock_test.go b/turbo/stages/mock/sentry_mock_test.go index 977a907d25f..7edfb7f590d 100644 --- a/turbo/stages/mock/sentry_mock_test.go +++ b/turbo/stages/mock/sentry_mock_test.go @@ -29,8 +29,8 @@ import ( sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/wrap" + "github.com/erigontech/erigon-lib/common/u256" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common/u256" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/eth/protocols/eth" diff --git a/turbo/trie/encoding_test.go b/turbo/trie/encoding_test.go index 577a220ef9b..8f5ce4a0760 100644 --- a/turbo/trie/encoding_test.go +++ b/turbo/trie/encoding_test.go @@ -25,7 +25,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" ) func TestHexCompact(t *testing.T) { diff --git a/turbo/trie/flatdb_sub_trie_loader_test.go b/turbo/trie/flatdb_sub_trie_loader_test.go index 981c958f016..a9b8a399b73 100644 --- a/turbo/trie/flatdb_sub_trie_loader_test.go +++ b/turbo/trie/flatdb_sub_trie_loader_test.go @@ -25,7 +25,7 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/stretchr/testify/assert" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types/accounts" ) diff --git a/turbo/trie/hack.go b/turbo/trie/hack.go index 25885f86ba3..fd59eab089c 100644 --- a/turbo/trie/hack.go +++ b/turbo/trie/hack.go @@ -21,8 +21,8 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common" ) func FullNode1() { diff --git a/turbo/trie/stream.go b/turbo/trie/stream.go index 44852f74b42..19e81503d05 100644 --- a/turbo/trie/stream.go +++ b/turbo/trie/stream.go @@ -28,7 +28,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/length" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/turbo/rlphacks" ) diff --git a/turbo/trie/stream_test.go b/turbo/trie/stream_test.go index e9a938d70cf..2c4ea1ee298 100644 --- a/turbo/trie/stream_test.go +++ b/turbo/trie/stream_test.go @@ -27,7 +27,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/core/types/accounts" ) diff --git a/turbo/trie/structural_test.go b/turbo/trie/structural_test.go index 9622fa65aae..83219343804 100644 --- a/turbo/trie/structural_test.go +++ b/turbo/trie/structural_test.go @@ -35,7 +35,7 @@ import ( "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/crypto" - "github.com/erigontech/erigon/common" + "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon/turbo/rlphacks" ) @@ -335,8 +335,8 @@ func TestAccountsOnly(t *testing.T) { {k: common.FromHex("10002a312d2809e00f42a7f8cb0e659bddf0b4f201d24eb1b2946493cbae334c"), v: common.FromHex("01")}, {k: common.FromHex("10002a412d2809e00f42a7f8cb0e659bddf0b4f201d24eb1b2946493cbae334c"), v: common.FromHex("01")}, {k: common.FromHex("10002b412d2809e00f42a7f8cb0e659bddf0b4f201d24eb1b2946493cbae334c"), v: common.FromHex("01")}, - {k: common.FromHex("10009384w46519cbc71a22098063e5608768276f2dc212e71fd2c6c643c726c4"), v: common.FromHex("01")}, - {k: common.FromHex("10009484w46519cbc71a22098063e5608768276f2dc212e71fd2c6c643c726c4"), v: common.FromHex("01")}, + {k: common.FromHex("10009384e46519cbc71a22098063e5608768276f2dc212e71fd2c6c643c726c4"), v: common.FromHex("01")}, + {k: common.FromHex("10009484e46519cbc71a22098063e5608768276f2dc212e71fd2c6c643c726c4"), v: common.FromHex("01")}, {k: common.FromHex("1000a9e493fff57a9c96dc0a7efb356613eafd5c89ea9f2be54d8ecf96ce0d28"), v: common.FromHex("01")}, {k: common.FromHex("110006a1510692d70d47860a1bbd432c801d1860bfbbe6856756ad4c062ba601"), v: common.FromHex("01")}, {k: common.FromHex("120006a1510692d70d47860a1bbd432c801d1860bfbbe6856756ad4c062ba601"), v: common.FromHex("01")}, diff --git a/turbo/trie/trie_test.go b/turbo/trie/trie_test.go index 8aa467c7986..c7edcb84eb3 100644 --- a/turbo/trie/trie_test.go +++ b/turbo/trie/trie_test.go @@ -31,10 +31,10 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/stretchr/testify/assert" + "github.com/erigontech/erigon-lib/common" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/crypto" "github.com/erigontech/erigon-lib/rlp" - "github.com/erigontech/erigon/common" "github.com/erigontech/erigon/core/types/accounts" ) From 3b6a6cea77e3c81d1e48e47fc6c2f977c9430849 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Sat, 30 Nov 2024 02:20:54 -0300 Subject: [PATCH 20/25] Rename constant to DefaultStepSize (#12928) I always forget that constant name when I need to check the value, let's rename it to something more direct. I think we could also rename/move the package "config3" to some other place with global constants, but no idea of good place. --- cmd/evm/runner.go | 2 +- cmd/evm/staterunner.go | 2 +- cmd/integration/commands/stages.go | 2 +- cmd/rpcdaemon/cli/config.go | 2 +- core/genesis_write.go | 2 +- core/rawdb/rawdbhelpers/rawdbhelpers.go | 2 +- core/vm/runtime/runtime.go | 4 ++-- erigon-lib/config3/config3.go | 5 ++--- erigon-lib/kv/temporal/temporaltest/kv_temporal_testdb.go | 2 +- erigon-lib/state/files_item.go | 2 +- eth/backend.go | 2 +- eth/stagedsync/exec3.go | 2 +- turbo/app/snapshots_cmd.go | 2 +- turbo/app/squeeze_cmd.go | 4 ++-- turbo/snapshotsync/snapshotsync.go | 6 +++--- 15 files changed, 20 insertions(+), 21 deletions(-) diff --git a/cmd/evm/runner.go b/cmd/evm/runner.go index f36d6b37c9a..321da4344eb 100644 --- a/cmd/evm/runner.go +++ b/cmd/evm/runner.go @@ -171,7 +171,7 @@ func runCmd(ctx *cli.Context) error { } else { genesisConfig = new(types.Genesis) } - agg, err := state2.NewAggregator(context.Background(), datadir.New(os.TempDir()), config3.HistoryV3AggregationStep, db, log.New()) + agg, err := state2.NewAggregator(context.Background(), datadir.New(os.TempDir()), config3.DefaultStepSize, db, log.New()) if err != nil { return err } diff --git a/cmd/evm/staterunner.go b/cmd/evm/staterunner.go index b11683b638d..6b2270207bc 100644 --- a/cmd/evm/staterunner.go +++ b/cmd/evm/staterunner.go @@ -141,7 +141,7 @@ func aggregateResultsFromStateTests( MustOpen() defer _db.Close() - agg, err := libstate.NewAggregator(context.Background(), dirs, config3.HistoryV3AggregationStep, _db, log.New()) + agg, err := libstate.NewAggregator(context.Background(), dirs, config3.DefaultStepSize, _db, log.New()) if err != nil { return nil, err } diff --git a/cmd/integration/commands/stages.go b/cmd/integration/commands/stages.go index 7498e34ff63..d94f33d7f24 100644 --- a/cmd/integration/commands/stages.go +++ b/cmd/integration/commands/stages.go @@ -1342,7 +1342,7 @@ func allSnapshots(ctx context.Context, db kv.RoDB, logger log.Logger) (*freezebl blockReader := freezeblocks.NewBlockReader(_allSnapshotsSingleton, _allBorSnapshotsSingleton, _heimdallStoreSingleton, _bridgeStoreSingleton) txNums := rawdbv3.TxNums.WithCustomReadTxNumFunc(freezeblocks.ReadTxNumFuncFromBlockReader(ctx, blockReader)) - _aggSingleton, err = libstate.NewAggregator(ctx, dirs, config3.HistoryV3AggregationStep, db, logger) + _aggSingleton, err = libstate.NewAggregator(ctx, dirs, config3.DefaultStepSize, db, logger) if err != nil { panic(err) } diff --git a/cmd/rpcdaemon/cli/config.go b/cmd/rpcdaemon/cli/config.go index 9e468f6a2ca..ac99e4c341e 100644 --- a/cmd/rpcdaemon/cli/config.go +++ b/cmd/rpcdaemon/cli/config.go @@ -426,7 +426,7 @@ func RemoteServices(ctx context.Context, cfg *httpcfg.HttpCfg, logger log.Logger blockReader = freezeblocks.NewBlockReader(allSnapshots, allBorSnapshots, heimdallStore, bridgeStore) txNumsReader := rawdbv3.TxNums.WithCustomReadTxNumFunc(freezeblocks.ReadTxNumFuncFromBlockReader(ctx, blockReader)) - agg, err := libstate.NewAggregator(ctx, cfg.Dirs, config3.HistoryV3AggregationStep, db, logger) + agg, err := libstate.NewAggregator(ctx, cfg.Dirs, config3.DefaultStepSize, db, logger) if err != nil { return nil, nil, nil, nil, nil, nil, nil, ff, nil, nil, fmt.Errorf("create aggregator: %w", err) } diff --git a/core/genesis_write.go b/core/genesis_write.go index a7820b4aa61..02e5a3f81ce 100644 --- a/core/genesis_write.go +++ b/core/genesis_write.go @@ -506,7 +506,7 @@ func GenesisToBlock(g *types.Genesis, dirs datadir.Dirs, logger log.Logger) (*ty genesisTmpDB := mdbx.New(kv.TemporaryDB, logger).InMem(dirs.DataDir).MapSize(2 * datasize.GB).GrowthStep(1 * datasize.MB).MustOpen() defer genesisTmpDB.Close() - agg, err := state2.NewAggregator(context.Background(), dirs, config3.HistoryV3AggregationStep, genesisTmpDB, logger) + agg, err := state2.NewAggregator(context.Background(), dirs, config3.DefaultStepSize, genesisTmpDB, logger) if err != nil { return err } diff --git a/core/rawdb/rawdbhelpers/rawdbhelpers.go b/core/rawdb/rawdbhelpers/rawdbhelpers.go index e731db8a616..53a5970df75 100644 --- a/core/rawdb/rawdbhelpers/rawdbhelpers.go +++ b/core/rawdb/rawdbhelpers/rawdbhelpers.go @@ -30,7 +30,7 @@ func IdxStepsCountV3(tx kv.Tx) float64 { fstTxNum := binary.BigEndian.Uint64(fst) lstTxNum := binary.BigEndian.Uint64(lst) - return float64(lstTxNum-fstTxNum) / float64(config3.HistoryV3AggregationStep) + return float64(lstTxNum-fstTxNum) / float64(config3.DefaultStepSize) } return 0 } diff --git a/core/vm/runtime/runtime.go b/core/vm/runtime/runtime.go index c580b39b25a..5515933f389 100644 --- a/core/vm/runtime/runtime.go +++ b/core/vm/runtime/runtime.go @@ -131,7 +131,7 @@ func Execute(code, input []byte, cfg *Config, tempdir string) ([]byte, *state.In if !externalState { db := memdb.NewStateDB(tempdir) defer db.Close() - agg, err := state3.NewAggregator(context.Background(), datadir.New(tempdir), config3.HistoryV3AggregationStep, db, log.New()) + agg, err := state3.NewAggregator(context.Background(), datadir.New(tempdir), config3.DefaultStepSize, db, log.New()) if err != nil { return nil, nil, err } @@ -193,7 +193,7 @@ func Create(input []byte, cfg *Config, blockNr uint64) ([]byte, libcommon.Addres db := memdb.NewStateDB(tmp) defer db.Close() - agg, err := state3.NewAggregator(context.Background(), datadir.New(tmp), config3.HistoryV3AggregationStep, db, log.New()) + agg, err := state3.NewAggregator(context.Background(), datadir.New(tmp), config3.DefaultStepSize, db, log.New()) if err != nil { return nil, [20]byte{}, 0, err } diff --git a/erigon-lib/config3/config3.go b/erigon-lib/config3/config3.go index 43e089d9ede..791a689c4ef 100644 --- a/erigon-lib/config3/config3.go +++ b/erigon-lib/config3/config3.go @@ -16,9 +16,8 @@ package config3 -// AggregationStep number of transactions in smallest static file -const HistoryV3AggregationStep = 1_562_500 // = 100M / 64. Dividers: 2, 5, 10, 20, 50, 100, 500 -// const HistoryV3AggregationStep = 1_562_500 / 10 +// Default number of transactions (txNums) in one "step". One static file can have [1, 64] steps. +const DefaultStepSize = 1_562_500 // = 100M / 64. Dividers: 2, 5, 10, 20, 50, 100, 500 const EnableHistoryV4InTest = true diff --git a/erigon-lib/kv/temporal/temporaltest/kv_temporal_testdb.go b/erigon-lib/kv/temporal/temporaltest/kv_temporal_testdb.go index 5c2df633b9e..d8020599dd3 100644 --- a/erigon-lib/kv/temporal/temporaltest/kv_temporal_testdb.go +++ b/erigon-lib/kv/temporal/temporaltest/kv_temporal_testdb.go @@ -42,7 +42,7 @@ func NewTestDB(tb testing.TB, dirs datadir.Dirs) (db kv.RwDB, agg *state.Aggrega } var err error - agg, err = state.NewAggregator(context.Background(), dirs, config3.HistoryV3AggregationStep, db, log.New()) + agg, err = state.NewAggregator(context.Background(), dirs, config3.DefaultStepSize, db, log.New()) if err != nil { panic(err) } diff --git a/erigon-lib/state/files_item.go b/erigon-lib/state/files_item.go index 237f2f0a775..fbdc399a6b4 100644 --- a/erigon-lib/state/files_item.go +++ b/erigon-lib/state/files_item.go @@ -336,7 +336,7 @@ func (files visibleFiles) LatestMergedRange() MergeRange { return MergeRange{} } for i := len(files) - 1; i >= 0; i-- { - shardSize := (files[i].endTxNum - files[i].startTxNum) / config3.HistoryV3AggregationStep + shardSize := (files[i].endTxNum - files[i].startTxNum) / config3.DefaultStepSize if shardSize > 2 { return MergeRange{from: files[i].startTxNum, to: files[i].endTxNum} } diff --git a/eth/backend.go b/eth/backend.go index 7ed0895c9d6..02f9e085c8c 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -1504,7 +1504,7 @@ func setUpBlockReader(ctx context.Context, db kv.RwDB, dirs datadir.Dirs, snConf } } blockReader := freezeblocks.NewBlockReader(allSnapshots, allBorSnapshots, heimdallStore, bridgeStore) - agg, err := libstate.NewAggregator(ctx, dirs, config3.HistoryV3AggregationStep, db, logger) + agg, err := libstate.NewAggregator(ctx, dirs, config3.DefaultStepSize, db, logger) if err != nil { return nil, nil, nil, nil, nil, nil, nil, err } diff --git a/eth/stagedsync/exec3.go b/eth/stagedsync/exec3.go index 2fbc037efc0..3ccd0880007 100644 --- a/eth/stagedsync/exec3.go +++ b/eth/stagedsync/exec3.go @@ -120,7 +120,7 @@ func (p *Progress) Log(suffix string, rs *state.StateV3, in *state.QueueWithRetr //"workers", p.workersCount, "buf", fmt.Sprintf("%s/%s", common.ByteCount(sizeEstimate), common.ByteCount(p.commitThreshold)), "stepsInDB", fmt.Sprintf("%.2f", idxStepsAmountInDB), - "step", fmt.Sprintf("%.1f", float64(outTxNum)/float64(config3.HistoryV3AggregationStep)), + "step", fmt.Sprintf("%.1f", float64(outTxNum)/float64(config3.DefaultStepSize)), "inMem", inMemExec, "alloc", common.ByteCount(m.Alloc), "sys", common.ByteCount(m.Sys), ) diff --git a/turbo/app/snapshots_cmd.go b/turbo/app/snapshots_cmd.go index 2244ccc68a0..5495457c31c 100644 --- a/turbo/app/snapshots_cmd.go +++ b/turbo/app/snapshots_cmd.go @@ -1473,7 +1473,7 @@ func dbCfg(label kv.Label, path string) mdbx.MdbxOpts { Accede(true) // integration tool: open db without creation and without blocking erigon } func openAgg(ctx context.Context, dirs datadir.Dirs, chainDB kv.RwDB, logger log.Logger) *libstate.Aggregator { - agg, err := libstate.NewAggregator(ctx, dirs, config3.HistoryV3AggregationStep, chainDB, logger) + agg, err := libstate.NewAggregator(ctx, dirs, config3.DefaultStepSize, chainDB, logger) if err != nil { panic(err) } diff --git a/turbo/app/squeeze_cmd.go b/turbo/app/squeeze_cmd.go index f5445471f9f..da096ff2c02 100644 --- a/turbo/app/squeeze_cmd.go +++ b/turbo/app/squeeze_cmd.go @@ -137,7 +137,7 @@ func squeezeStorage(ctx context.Context, dirs datadir.Dirs, logger log.Logger) e ac := agg.BeginFilesRo() defer ac.Close() - aggOld, err := state.NewAggregator(ctx, dirsOld, config3.HistoryV3AggregationStep, db, logger) + aggOld, err := state.NewAggregator(ctx, dirsOld, config3.DefaultStepSize, db, logger) if err != nil { panic(err) } @@ -178,7 +178,7 @@ func squeezeStorage(ctx context.Context, dirs datadir.Dirs, logger log.Logger) e func squeezeCode(ctx context.Context, dirs datadir.Dirs, logger log.Logger) error { db := dbCfg(kv.ChainDB, dirs.Chaindata).MustOpen() defer db.Close() - agg, err := state.NewAggregator(ctx, dirs, config3.HistoryV3AggregationStep, db, logger) + agg, err := state.NewAggregator(ctx, dirs, config3.DefaultStepSize, db, logger) if err != nil { return err } diff --git a/turbo/snapshotsync/snapshotsync.go b/turbo/snapshotsync/snapshotsync.go index 5f96e176f90..7bbfee50d17 100644 --- a/turbo/snapshotsync/snapshotsync.go +++ b/turbo/snapshotsync/snapshotsync.go @@ -228,11 +228,11 @@ func getMinimumBlocksToDownload(tx kv.Tx, blockReader blockReader, minStep uint6 frozenBlocks := blockReader.Snapshots().SegmentsMax() minToDownload := uint64(math.MaxUint64) minStepToDownload := uint64(math.MaxUint32) - stateTxNum := minStep * config3.HistoryV3AggregationStep + stateTxNum := minStep * config3.DefaultStepSize if err := blockReader.IterateFrozenBodies(func(blockNum, baseTxNum, txAmount uint64) error { if blockNum == historyPruneTo { - minStepToDownload = (baseTxNum - (config3.HistoryV3AggregationStep - 1)) / config3.HistoryV3AggregationStep - if baseTxNum < (config3.HistoryV3AggregationStep - 1) { + minStepToDownload = (baseTxNum - (config3.DefaultStepSize - 1)) / config3.DefaultStepSize + if baseTxNum < (config3.DefaultStepSize - 1) { minStepToDownload = 0 } } From ba101ac45258a77e18c4b4599977b57c3ab49114 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Sat, 30 Nov 2024 20:09:54 +0700 Subject: [PATCH 21/25] rpc-test: logsByHash non-nils (#12929) --- core/types/log.go | 26 ++++++++----- core/types/receipt.go | 40 ++++++++------------ turbo/jsonrpc/receipts/receipts_generator.go | 2 +- 3 files changed, 33 insertions(+), 35 deletions(-) diff --git a/core/types/log.go b/core/types/log.go index 5895578c509..f9433e9a422 100644 --- a/core/types/log.go +++ b/core/types/log.go @@ -21,6 +21,7 @@ package types import ( "io" + "slices" "github.com/erigontech/erigon-lib/common/hexutil" @@ -79,6 +80,17 @@ type ErigonLogs []*ErigonLog type Logs []*Log +func (logs Logs) Copy() Logs { + if logs == nil { + return nil + } + logsCopy := make(Logs, len(logs)) + for i, log := range logs { + logsCopy[i] = log.Copy() + } + return logsCopy +} + func (logs Logs) Filter(addrMap map[libcommon.Address]struct{}, topics [][]libcommon.Hash, maxLogs uint64) Logs { topicMap := make(map[int]map[libcommon.Hash]struct{}, 7) @@ -251,19 +263,13 @@ func (l *Log) DecodeRLP(s *rlp.Stream) error { // Copy creates a deep copy of the Log. func (l *Log) Copy() *Log { - topics := make([]libcommon.Hash, 0, len(l.Topics)) - for _, topic := range l.Topics { - topicCopy := libcommon.BytesToHash(topic.Bytes()) - topics = append(topics, topicCopy) + if l == nil { + return nil } - - data := make([]byte, len(l.Data)) - copy(data, l.Data) - return &Log{ Address: libcommon.BytesToAddress(l.Address.Bytes()), - Topics: topics, - Data: data, + Topics: slices.Clone(l.Topics), + Data: slices.Clone(l.Data), BlockNumber: l.BlockNumber, TxHash: libcommon.BytesToHash(l.TxHash.Bytes()), TxIndex: l.TxIndex, diff --git a/core/types/receipt.go b/core/types/receipt.go index ae633066264..271b25507b8 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -26,6 +26,7 @@ import ( "fmt" "io" "math/big" + "slices" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" @@ -272,33 +273,21 @@ func (r *Receipt) statusEncoding() []byte { // Copy creates a deep copy of the Receipt. func (r *Receipt) Copy() *Receipt { - postState := make([]byte, len(r.PostState)) - copy(postState, r.PostState) - - bloom := BytesToBloom(r.Bloom.Bytes()) - - logs := make(Logs, 0, len(r.Logs)) - for _, log := range r.Logs { - logs = append(logs, log.Copy()) + if r == nil { + return nil } - - txHash := libcommon.BytesToHash(r.TxHash.Bytes()) - contractAddress := libcommon.BytesToAddress(r.ContractAddress.Bytes()) - blockHash := libcommon.BytesToHash(r.BlockHash.Bytes()) - blockNumber := big.NewInt(0).Set(r.BlockNumber) - return &Receipt{ Type: r.Type, - PostState: postState, + PostState: slices.Clone(r.PostState), Status: r.Status, CumulativeGasUsed: r.CumulativeGasUsed, - Bloom: bloom, - Logs: logs, - TxHash: txHash, - ContractAddress: contractAddress, + Bloom: BytesToBloom(r.Bloom.Bytes()), + Logs: r.Logs.Copy(), + TxHash: libcommon.BytesToHash(r.TxHash.Bytes()), + ContractAddress: libcommon.BytesToAddress(r.ContractAddress.Bytes()), GasUsed: r.GasUsed, - BlockHash: blockHash, - BlockNumber: blockNumber, + BlockHash: libcommon.BytesToHash(r.BlockHash.Bytes()), + BlockNumber: big.NewInt(0).Set(r.BlockNumber), TransactionIndex: r.TransactionIndex, } } @@ -353,9 +342,12 @@ type Receipts []*Receipt func (rs Receipts) Len() int { return len(rs) } func (rs Receipts) Copy() Receipts { - rsCopy := make(Receipts, 0, rs.Len()) - for _, r := range rs { - rsCopy = append(rsCopy, r.Copy()) + if rs == nil { + return nil + } + rsCopy := make(Receipts, rs.Len()) + for i, r := range rs { + rsCopy[i] = r.Copy() } return rsCopy } diff --git a/turbo/jsonrpc/receipts/receipts_generator.go b/turbo/jsonrpc/receipts/receipts_generator.go index 4848ef0e6f4..05d6f92fa7b 100644 --- a/turbo/jsonrpc/receipts/receipts_generator.go +++ b/turbo/jsonrpc/receipts/receipts_generator.go @@ -103,7 +103,7 @@ func (g *Generator) PrepareEnv(ctx context.Context, block *types.Block, cfg *cha } func (g *Generator) addToCache(header *types.Header, receipts types.Receipts) { - g.receiptsCache.Add(header.Hash(), receipts.Copy()) + g.receiptsCache.Add(header.Hash(), receipts.Copy()) // .Copy() helps pprof to attribute memory to cache - instead of evm (where it was allocated). } func (g *Generator) GetReceipt(ctx context.Context, cfg *chain.Config, tx kv.Tx, block *types.Block, index int, optimize bool) (*types.Receipt, error) { From baf0a609131bd09f9a5f138be025c5ccd2ca1485 Mon Sep 17 00:00:00 2001 From: ledgerwatch Date: Sat, 30 Nov 2024 13:52:27 +0000 Subject: [PATCH 22/25] Additional fix for externalCL integration (prevent MDBX_MAP_FULL) (#12922) Fixes https://github.com/erigontech/erigon/issues/12225 --- erigon-lib/kv/mdbx/kv_mdbx_temporary.go | 2 +- .../block_downloader.go | 80 ++----------------- .../engineapi/engine_block_downloader/body.go | 27 +++++-- .../engineapi/engine_block_downloader/core.go | 7 +- 4 files changed, 31 insertions(+), 85 deletions(-) diff --git a/erigon-lib/kv/mdbx/kv_mdbx_temporary.go b/erigon-lib/kv/mdbx/kv_mdbx_temporary.go index 879a2e95fe4..aa4e87f5f16 100644 --- a/erigon-lib/kv/mdbx/kv_mdbx_temporary.go +++ b/erigon-lib/kv/mdbx/kv_mdbx_temporary.go @@ -37,7 +37,7 @@ func NewTemporaryMdbx(ctx context.Context, tempdir string) (kv.RwDB, error) { return &TemporaryMdbx{}, err } - db, err := New(kv.ChainDB, log.Root()).InMem(path).GrowthStep(64 * datasize.MB).Open(ctx) + db, err := New(kv.ChainDB, log.Root()).InMem(path).Open(ctx) if err != nil { return &TemporaryMdbx{}, err } diff --git a/turbo/engineapi/engine_block_downloader/block_downloader.go b/turbo/engineapi/engine_block_downloader/block_downloader.go index 60d64fd0e0a..a516896d265 100644 --- a/turbo/engineapi/engine_block_downloader/block_downloader.go +++ b/turbo/engineapi/engine_block_downloader/block_downloader.go @@ -17,7 +17,6 @@ package engine_block_downloader import ( - "bytes" "context" "encoding/binary" "fmt" @@ -35,7 +34,6 @@ import ( "github.com/erigontech/erigon-lib/etl" execution "github.com/erigontech/erigon-lib/gointerfaces/executionproto" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon-lib/kv/dbutils" "github.com/erigontech/erigon-lib/rlp" "github.com/erigontech/erigon/core/rawdb" @@ -164,10 +162,11 @@ func (e *EngineBlockDownloader) waitForEndOfHeadersDownload(ctx context.Context) } // waitForEndOfHeadersDownload waits until the download of headers ends and returns the outcome. -func (e *EngineBlockDownloader) loadDownloadedHeaders(tx kv.RwTx) (fromBlock uint64, toBlock uint64, fromHash libcommon.Hash, err error) { +func (e *EngineBlockDownloader) loadDownloadedHeaders(tx kv.RwTx) (fromBlock uint64, toBlock uint64, err error) { var lastValidHash libcommon.Hash var badChainError error // TODO(yperbasis): this is not set anywhere var foundPow bool + var found bool headerLoadFunc := func(key, value []byte, _ etl.CurrentTableReader, _ etl.LoadNextFunc) error { var h types.Header @@ -185,8 +184,8 @@ func (e *EngineBlockDownloader) loadDownloadedHeaders(tx kv.RwTx) (fromBlock uin lastValidHash = h.ParentHash // If we are in PoW range then block validation is not required anymore. if foundPow { - if (fromHash == libcommon.Hash{}) { - fromHash = h.Hash() + if !found { + found = true fromBlock = h.Number.Uint64() } toBlock = h.Number.Uint64() @@ -195,15 +194,15 @@ func (e *EngineBlockDownloader) loadDownloadedHeaders(tx kv.RwTx) (fromBlock uin foundPow = h.Difficulty.Sign() != 0 if foundPow { - if (fromHash == libcommon.Hash{}) { - fromHash = h.Hash() + if !found { + found = true fromBlock = h.Number.Uint64() } toBlock = h.Number.Uint64() return saveHeader(tx, &h, h.Hash()) } - if (fromHash == libcommon.Hash{}) { - fromHash = h.Hash() + if !found { + found = true fromBlock = h.Number.Uint64() } toBlock = h.Number.Uint64() @@ -238,66 +237,3 @@ func saveHeader(db kv.RwTx, header *types.Header, hash libcommon.Hash) error { } return nil } - -func (e *EngineBlockDownloader) insertHeadersAndBodies(ctx context.Context, tx kv.Tx, fromBlock uint64, fromHash libcommon.Hash, toBlock uint64) error { - blockBatchSize := 500 - blockWrittenLogSize := 20_000 - // We divide them in batches - blocksBatch := []*types.Block{} - - headersCursors, err := tx.Cursor(kv.Headers) - if err != nil { - return err - } - inserted := uint64(0) - - log.Info("Beginning downloaded blocks insertion") - // Start by seeking headers - for k, v, err := headersCursors.Seek(dbutils.HeaderKey(fromBlock, fromHash)); k != nil; k, v, err = headersCursors.Next() { - if err != nil { - return err - } - if len(blocksBatch) == blockBatchSize { - if err := e.chainRW.InsertBlocksAndWait(ctx, blocksBatch); err != nil { - return err - } - currentHeader := e.chainRW.CurrentHeader(ctx) - lastBlockNumber := blocksBatch[len(blocksBatch)-1].NumberU64() - isForkChoiceNeeded := currentHeader == nil || lastBlockNumber > currentHeader.Number.Uint64() - inserted += uint64(len(blocksBatch)) - if inserted >= uint64(e.syncCfg.LoopBlockLimit) { - lastHash := blocksBatch[len(blocksBatch)-1].Hash() - if isForkChoiceNeeded { - if _, _, _, err := e.chainRW.UpdateForkChoice(ctx, lastHash, lastHash, lastHash); err != nil { - return err - } - } - inserted = 0 - } - blocksBatch = blocksBatch[:0] - } - header := new(types.Header) - if err := rlp.Decode(bytes.NewReader(v), header); err != nil { - e.logger.Error("Invalid block header RLP", "err", err) - return nil - } - number := header.Number.Uint64() - if number > toBlock { - return e.chainRW.InsertBlocksAndWait(ctx, blocksBatch) - } - hash := header.Hash() - body, err := rawdb.ReadBodyWithTransactions(tx, hash, number) - if err != nil { - return err - } - if body == nil { - return fmt.Errorf("missing body at block=%d", number) - } - blocksBatch = append(blocksBatch, types.NewBlockFromStorage(hash, header, body.Transactions, body.Uncles, body.Withdrawals)) - if number%uint64(blockWrittenLogSize) == 0 { - e.logger.Info("[insertHeadersAndBodies] Written blocks", "progress", number, "to", toBlock) - } - } - return e.chainRW.InsertBlocksAndWait(ctx, blocksBatch) - -} diff --git a/turbo/engineapi/engine_block_downloader/body.go b/turbo/engineapi/engine_block_downloader/body.go index 5d440ff680f..bdb640a385f 100644 --- a/turbo/engineapi/engine_block_downloader/body.go +++ b/turbo/engineapi/engine_block_downloader/body.go @@ -27,7 +27,7 @@ import ( libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/dbg" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon/core/rawdb" + "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/dataflow" "github.com/erigontech/erigon/eth/stagedsync/stages" "github.com/erigontech/erigon/turbo/stages/bodydownload" @@ -80,6 +80,9 @@ func (e *EngineBlockDownloader) downloadAndLoadBodiesSyncronously(ctx context.Co prevProgress := bodyProgress var noProgressCount uint = 0 // How many time the progress was printed without actual progress var totalDelivered uint64 = 0 + blockBatchSize := 500 + // We divide them in batches + blocksBatch := []*types.Block{} loopBody := func() (bool, error) { // loopCount is used here to ensure we don't get caught in a constant loop of making requests @@ -146,14 +149,20 @@ func (e *EngineBlockDownloader) downloadAndLoadBodiesSyncronously(ctx context.Co return false, fmt.Errorf("[%s] Header block unexpected when matching body, got %v, expected %v", logPrefix, blockHeight, nextBlock) } + if len(blocksBatch) == blockBatchSize { + if err := e.chainRW.InsertBlocksAndWait(ctx, blocksBatch); err != nil { + return false, fmt.Errorf("InsertBlock: %w", err) + } + blocksBatch = blocksBatch[:0] + } // Check existence before write - because WriteRawBody isn't idempotent (it allocates new sequence range for transactions on every call) - ok, err := rawdb.WriteRawBodyIfNotExists(tx, header.Hash(), blockHeight, rawBody) + rawBlock := types.RawBlock{Header: header, Body: rawBody} + block, err := rawBlock.AsBlock() if err != nil { - return false, fmt.Errorf("WriteRawBodyIfNotExists: %w", err) - } - if ok { - dataflow.BlockBodyDownloadStates.AddChange(blockHeight, dataflow.BlockBodyCleared) + return false, fmt.Errorf("Could not construct block: %w", err) } + blocksBatch = append(blocksBatch, block) + dataflow.BlockBodyDownloadStates.AddChange(blockHeight, dataflow.BlockBodyCleared) if blockHeight > bodyProgress { bodyProgress = blockHeight @@ -202,6 +211,12 @@ func (e *EngineBlockDownloader) downloadAndLoadBodiesSyncronously(ctx context.Co return err } } + if len(blocksBatch) > 0 { + if err := e.chainRW.InsertBlocksAndWait(ctx, blocksBatch); err != nil { + return fmt.Errorf("InsertBlock: %w", err) + } + blocksBatch = blocksBatch[:0] + } if stopped { return libcommon.ErrStopped diff --git a/turbo/engineapi/engine_block_downloader/core.go b/turbo/engineapi/engine_block_downloader/core.go index adf9f61d7a3..03e7fa47a47 100644 --- a/turbo/engineapi/engine_block_downloader/core.go +++ b/turbo/engineapi/engine_block_downloader/core.go @@ -88,7 +88,7 @@ func (e *EngineBlockDownloader) download(ctx context.Context, hashToDownload lib return } } - startBlock, endBlock, startHash, err := e.loadDownloadedHeaders(memoryMutation) + startBlock, endBlock, err := e.loadDownloadedHeaders(memoryMutation) if err != nil { e.logger.Warn("[EngineBlockDownloader] Could not load headers", "err", err) e.status.Store(headerdownload.Idle) @@ -102,11 +102,6 @@ func (e *EngineBlockDownloader) download(ctx context.Context, hashToDownload lib return } tx.Rollback() // Discard the original db tx - if err := e.insertHeadersAndBodies(ctx, tmpTx, startBlock, startHash, endBlock); err != nil { - e.logger.Warn("[EngineBlockDownloader] Could not insert headers and bodies", "err", err) - e.status.Store(headerdownload.Idle) - return - } e.logger.Info("[EngineBlockDownloader] Finished downloading blocks", "from", startBlock-1, "to", endBlock) if block == nil { e.status.Store(headerdownload.Idle) From a962e997f1d95c5585061f8fffcf25954889bf81 Mon Sep 17 00:00:00 2001 From: Mark Holt <135143369+mh0lt@users.noreply.github.com> Date: Sun, 1 Dec 2024 10:30:18 +0000 Subject: [PATCH 23/25] Add error returns to inttrablock state (#12926) This PR adds error returns to intrablock state calls so that errors are consistently returned to the caller code. Previously several of these where just swallowed by the implementation. This is necessary for parallel execution processing which needs to be able to distinguish between retryable errors due to parallel data access from system and other fails which need to stop processing. Without this the code goes into a continuous retry of fail loop. --- accounts/abi/bind/backends/simulated.go | 25 +- accounts/abi/bind/backends/simulated_test.go | 5 +- cl/beacon/handler/subscription.go | 1 + cl/phase1/forkchoice/on_attestation.go | 1 - cl/phase1/forkchoice/on_attester_slashing.go | 1 - cl/phase1/network/services/block_service.go | 1 - cmd/state/exec3/state.go | 1 + consensus/consensus.go | 9 +- consensus/misc/dao.go | 15 +- consensus/misc/eip2935.go | 18 +- core/chain_makers.go | 12 +- core/evm.go | 8 +- core/genesis_test.go | 6 +- core/state/database_test.go | 201 +++++++++--- core/state/intra_block_state.go | 302 ++++++++++++------ core/state/intra_block_state_logger_test.go | 6 +- core/state/intra_block_state_test.go | 82 ++++- core/state/journal.go | 85 +++-- core/state/state_test.go | 45 ++- core/state/txtask.go | 5 +- core/state_transition.go | 97 ++++-- core/vm/eips.go | 5 +- core/vm/errors.go | 4 + core/vm/evm.go | 52 ++- core/vm/evmtypes/evmtypes.go | 50 +-- core/vm/gas_table.go | 42 ++- core/vm/gas_table_test.go | 12 +- core/vm/instructions.go | 47 ++- core/vm/operations_acl.go | 35 +- core/vm/runtime/runtime.go | 5 +- eth/stagedsync/exec3.go | 290 +++++++++-------- eth/stagedsync/exec3_parallel.go | 190 ++++++----- eth/stagedsync/exec3_serial.go | 49 +-- eth/tracers/js/goja.go | 28 +- eth/tracers/js/tracer_test.go | 6 +- eth/tracers/logger/access_list_tracer.go | 3 +- eth/tracers/native/prestate.go | 22 +- polygon/bor/bor.go | 40 ++- tests/block_test_util.go | 15 +- tests/statedb_chain_test.go | 30 +- .../statedb_insert_chain_transaction_test.go | 205 ++++++++++-- turbo/jsonrpc/eth_call.go | 5 +- turbo/jsonrpc/eth_call_test.go | 8 +- turbo/jsonrpc/overlay_api.go | 16 +- turbo/jsonrpc/overlay_create_tracer.go | 6 +- turbo/jsonrpc/trace_adhoc.go | 81 ++++- turbo/stages/blockchain_test.go | 85 ++++- turbo/stages/chain_makers_test.go | 24 +- 48 files changed, 1603 insertions(+), 678 deletions(-) diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 667309affa4..3645d0cc824 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -207,7 +207,7 @@ func (b *SimulatedBackend) CodeAt(ctx context.Context, contract libcommon.Addres } defer tx.Rollback() stateDB := b.stateByBlockNumber(tx, blockNumber) - return stateDB.GetCode(contract), nil + return stateDB.GetCode(contract) } // BalanceAt returns the wei balance of a certain account in the blockchain. @@ -220,7 +220,7 @@ func (b *SimulatedBackend) BalanceAt(ctx context.Context, contract libcommon.Add } defer tx.Rollback() stateDB := b.stateByBlockNumber(tx, blockNumber) - return stateDB.GetBalance(contract), nil + return stateDB.GetBalance(contract) } // NonceAt returns the nonce of a certain account in the blockchain. @@ -234,7 +234,7 @@ func (b *SimulatedBackend) NonceAt(ctx context.Context, contract libcommon.Addre defer tx.Rollback() stateDB := b.stateByBlockNumber(tx, blockNumber) - return stateDB.GetNonce(contract), nil + return stateDB.GetNonce(contract) } // StorageAt returns the value of key in the storage of an account in the blockchain. @@ -518,7 +518,7 @@ func (b *SimulatedBackend) PendingCodeAt(ctx context.Context, contract libcommon b.mu.Lock() defer b.mu.Unlock() - return b.pendingState.GetCode(contract), nil + return b.pendingState.GetCode(contract) } func newRevertError(result *evmtypes.ExecutionResult) *revertError { @@ -600,7 +600,7 @@ func (b *SimulatedBackend) PendingNonceAt(ctx context.Context, account libcommon b.mu.Lock() defer b.mu.Unlock() - return b.pendingState.GetNonce(account), nil + return b.pendingState.GetNonce(account) } // SuggestGasPrice implements ContractTransactor.SuggestGasPrice. Since the simulated @@ -628,7 +628,10 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs } // Recap the highest gas allowance with account's balance. if call.GasPrice != nil && !call.GasPrice.IsZero() { - balance := b.pendingState.GetBalance(call.From) // from can't be nil + balance, err := b.pendingState.GetBalance(call.From) // from can't be nil + if err != nil { + return 0, err + } available := balance.ToBig() if call.Value != nil { if call.Value.ToBig().Cmp(available) >= 0 { @@ -724,7 +727,10 @@ func (b *SimulatedBackend) callContract(_ context.Context, call ethereum.CallMsg call.Value = new(uint256.Int) } // Set infinite balance to the fake caller account. - from := statedb.GetOrNewStateObject(call.From) + from, err := statedb.GetOrNewStateObject(call.From) + if err != nil { + return nil, err + } from.SetBalance(uint256.NewInt(0).SetAllOne(), tracing.BalanceChangeUnspecified) // Execute the call. msg := callMsg{call} @@ -752,7 +758,10 @@ func (b *SimulatedBackend) SendTransaction(ctx context.Context, txn types.Transa if senderErr != nil { return fmt.Errorf("invalid transaction: %w", senderErr) } - nonce := b.pendingState.GetNonce(sender) + nonce, err := b.pendingState.GetNonce(sender) + if err != nil { + return err + } if txn.GetNonce() != nonce { return fmt.Errorf("invalid transaction nonce: got %d, want %d", txn.GetNonce(), nonce) } diff --git a/accounts/abi/bind/backends/simulated_test.go b/accounts/abi/bind/backends/simulated_test.go index aec8ebd32b9..252fc2f03cd 100644 --- a/accounts/abi/bind/backends/simulated_test.go +++ b/accounts/abi/bind/backends/simulated_test.go @@ -153,7 +153,10 @@ func TestNewSimulatedBackend(t *testing.T) { } statedb := sim.stateByBlockNumber(tx, new(big.Int).SetUint64(num+1)) - bal := statedb.GetBalance(testAddr) + bal, err := statedb.GetBalance(testAddr) + if err != nil { + t.Fatal(err) + } if !bal.Eq(expectedBal) { t.Errorf("expected balance for test address not received. expected: %v actual: %v", expectedBal, bal) } diff --git a/cl/beacon/handler/subscription.go b/cl/beacon/handler/subscription.go index 63e187fd79c..caa4041f32c 100644 --- a/cl/beacon/handler/subscription.go +++ b/cl/beacon/handler/subscription.go @@ -84,6 +84,7 @@ func (a *ApiHandler) PostEthV1ValidatorSyncCommitteeSubscriptions(w http.Respons http.Error(w, err.Error(), http.StatusInternalServerError) return } + //cn() } // subscribe to subnets diff --git a/cl/phase1/forkchoice/on_attestation.go b/cl/phase1/forkchoice/on_attestation.go index 7544509b311..deeb757442a 100644 --- a/cl/phase1/forkchoice/on_attestation.go +++ b/cl/phase1/forkchoice/on_attestation.go @@ -56,7 +56,6 @@ func (f *ForkChoiceStore) OnAttestation( return err } } - var attestationIndicies []uint64 var err error target := data.Target diff --git a/cl/phase1/forkchoice/on_attester_slashing.go b/cl/phase1/forkchoice/on_attester_slashing.go index 9879ffece91..38263819d06 100644 --- a/cl/phase1/forkchoice/on_attester_slashing.go +++ b/cl/phase1/forkchoice/on_attester_slashing.go @@ -60,7 +60,6 @@ func (f *ForkChoiceStore) onProcessAttesterSlashing(attesterSlashing *cltypes.At if !cltypes.IsSlashableAttestationData(attestation1.Data, attestation2.Data) { return errors.New("attestation data is not slashable") } - attestation1PublicKeys, err := getIndexedAttestationPublicKeys(s, attestation1) if err != nil { return err diff --git a/cl/phase1/network/services/block_service.go b/cl/phase1/network/services/block_service.go index ea1fe2d6597..8808111805d 100644 --- a/cl/phase1/network/services/block_service.go +++ b/cl/phase1/network/services/block_service.go @@ -155,7 +155,6 @@ func (b *blockService) ProcessMessage(ctx context.Context, _ *uint64, msg *cltyp if msg.Block.Body.BlobKzgCommitments.Len() > int(b.beaconCfg.MaxBlobsPerBlock) { return ErrInvalidCommitmentsCount } - b.publishBlockGossipEvent(msg) // the rest of the validation is done in the forkchoice store if err := b.processAndStoreBlock(ctx, msg); err != nil { diff --git a/cmd/state/exec3/state.go b/cmd/state/exec3/state.go index 75868c51130..43b12c7ea94 100644 --- a/cmd/state/exec3/state.go +++ b/cmd/state/exec3/state.go @@ -132,6 +132,7 @@ func (rw *Worker) ResetTx(chainTx kv.Tx) { func (rw *Worker) Run() error { for txTask, ok := rw.in.Next(rw.ctx); ok; txTask, ok = rw.in.Next(rw.ctx) { + //fmt.Println("RTX", txTask.BlockNum, txTask.TxIndex, txTask.TxNum, txTask.Final) rw.RunTxTask(txTask, rw.isMining) if err := rw.resultCh.Add(rw.ctx, txTask); err != nil { return err diff --git a/consensus/consensus.go b/consensus/consensus.go index 0429f57e335..0ed3552cfbd 100644 --- a/consensus/consensus.go +++ b/consensus/consensus.go @@ -205,9 +205,12 @@ type PoW interface { } // Transfer subtracts amount from sender and adds amount to recipient using the given Db -func Transfer(db evmtypes.IntraBlockState, sender, recipient libcommon.Address, amount *uint256.Int, bailout bool) { +func Transfer(db evmtypes.IntraBlockState, sender, recipient libcommon.Address, amount *uint256.Int, bailout bool) error { if !bailout { - db.SubBalance(sender, amount, tracing.BalanceChangeTransfer) + err := db.SubBalance(sender, amount, tracing.BalanceChangeTransfer) + if err != nil { + return err + } } - db.AddBalance(recipient, amount, tracing.BalanceChangeTransfer) + return db.AddBalance(recipient, amount, tracing.BalanceChangeTransfer) } diff --git a/consensus/misc/dao.go b/consensus/misc/dao.go index fd02f56bfdc..c5671bb08b6 100644 --- a/consensus/misc/dao.go +++ b/consensus/misc/dao.go @@ -73,15 +73,24 @@ func VerifyDAOHeaderExtraData(config *chain.Config, header *types.Header) error // ApplyDAOHardFork modifies the state database according to the DAO hard-fork // rules, transferring all balances of a set of DAO accounts to a single refund // contract. -func ApplyDAOHardFork(statedb *state.IntraBlockState) { +func ApplyDAOHardFork(statedb *state.IntraBlockState) error { // Retrieve the contract to refund balances into - if !statedb.Exist(params.DAORefundContract) { + exist, err := statedb.Exist(params.DAORefundContract) + if err != nil { + return err + } + if !exist { statedb.CreateAccount(params.DAORefundContract, false) } // Move every DAO account and extra-balance account funds into the refund contract for _, addr := range params.DAODrainList() { - statedb.AddBalance(params.DAORefundContract, statedb.GetBalance(addr), tracing.BalanceIncreaseDaoContract) + balance, err := statedb.GetBalance(addr) + if err != nil { + return err + } + statedb.AddBalance(params.DAORefundContract, balance, tracing.BalanceIncreaseDaoContract) statedb.SetBalance(addr, new(uint256.Int), tracing.BalanceDecreaseDaoAccount) } + return nil } diff --git a/consensus/misc/eip2935.go b/consensus/misc/eip2935.go index 460c95f4b39..de3078e0a34 100644 --- a/consensus/misc/eip2935.go +++ b/consensus/misc/eip2935.go @@ -29,21 +29,25 @@ import ( "github.com/erigontech/erigon/params" ) -func StoreBlockHashesEip2935(header *types.Header, state *state.IntraBlockState, config *chain.Config, headerReader consensus.ChainHeaderReader) { - if state.GetCodeSize(params.HistoryStorageAddress) == 0 { +func StoreBlockHashesEip2935(header *types.Header, state *state.IntraBlockState, config *chain.Config, headerReader consensus.ChainHeaderReader) error { + codeSize, err := state.GetCodeSize(params.HistoryStorageAddress) + if err != nil { + return err + } + if codeSize == 0 { log.Debug("[EIP-2935] No code deployed to HistoryStorageAddress before call to store EIP-2935 history") - return + return nil } headerNum := header.Number.Uint64() if headerNum == 0 { // Activation of fork at Genesis - return + return nil } - storeHash(headerNum-1, header.ParentHash, state) + return storeHash(headerNum-1, header.ParentHash, state) } -func storeHash(num uint64, hash libcommon.Hash, state *state.IntraBlockState) { +func storeHash(num uint64, hash libcommon.Hash, state *state.IntraBlockState) error { slotNum := num % params.BlockHashHistoryServeWindow storageSlot := libcommon.BytesToHash(uint256.NewInt(slotNum).Bytes()) parentHashInt := uint256.NewInt(0).SetBytes32(hash.Bytes()) - state.SetState(params.HistoryStorageAddress, &storageSlot, *parentHashInt) + return state.SetState(params.HistoryStorageAddress, &storageSlot, *parentHashInt) } diff --git a/core/chain_makers.go b/core/chain_makers.go index fde0aa3ccd5..4ce7ea744cc 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -176,10 +176,18 @@ func (b *BlockGen) AddUncheckedReceipt(receipt *types.Receipt) { // TxNonce returns the next valid transaction nonce for the // account at addr. It panics if the account does not exist. func (b *BlockGen) TxNonce(addr libcommon.Address) uint64 { - if !b.ibs.Exist(addr) { + exist, err := b.ibs.Exist(addr) + if err != nil { + panic(fmt.Sprintf("can't get account: %s", err)) + } + if !exist { panic("account does not exist") } - return b.ibs.GetNonce(addr) + nonce, err := b.ibs.GetNonce(addr) + if err != nil { + panic(fmt.Sprintf("can't get account: %s", err)) + } + return nonce } // AddUncle adds an uncle header to the generated block. diff --git a/core/evm.go b/core/evm.go index 34dcd500316..2f6dc320a5d 100644 --- a/core/evm.go +++ b/core/evm.go @@ -138,6 +138,10 @@ func GetHashFn(ref *types.Header, getHeader func(hash libcommon.Hash, number uin // CanTransfer checks whether there are enough funds in the address' account to make a transfer. // This does not take the necessary gas in to account to make the transfer valid. -func CanTransfer(db evmtypes.IntraBlockState, addr libcommon.Address, amount *uint256.Int) bool { - return !db.GetBalance(addr).Lt(amount) +func CanTransfer(db evmtypes.IntraBlockState, addr libcommon.Address, amount *uint256.Int) (bool, error) { + balance, err := db.GetBalance(addr) + if err != nil { + return false, err + } + return !balance.Lt(amount), nil } diff --git a/core/genesis_test.go b/core/genesis_test.go index 83c4820dfc9..413130ad026 100644 --- a/core/genesis_test.go +++ b/core/genesis_test.go @@ -155,9 +155,11 @@ func TestAllocConstructor(t *testing.T) { reader, err := rpchelper.CreateHistoryStateReader(tx, rawdbv3.TxNums, 1, 0, genSpec.Config.ChainName) require.NoError(err) state := state.New(reader) - balance := state.GetBalance(address) + balance, err := state.GetBalance(address) + assert.NoError(err) assert.Equal(funds, balance.ToBig()) - code := state.GetCode(address) + code, err := state.GetCode(address) + assert.NoError(err) assert.Equal(common.FromHex("5f355f55"), code) key0 := libcommon.HexToHash("0000000000000000000000000000000000000000000000000000000000000000") diff --git a/core/state/database_test.go b/core/state/database_test.go index 83d36886e5f..0e2b776c8bd 100644 --- a/core/state/database_test.go +++ b/core/state/database_test.go @@ -133,10 +133,14 @@ func TestCreate2Revive(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(address) { + if exist, err := st.Exist(address); err != nil { + t.Error(err) + } else if !exist { t.Error("expected account to exist") } - if st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if exist { t.Error("expected contractAddress to not exist before block 0", contractAddress.String()) } return nil @@ -150,7 +154,9 @@ func TestCreate2Revive(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if !exist { t.Error("expected contractAddress to exist at the block 1", contractAddress.String()) } return nil @@ -166,7 +172,9 @@ func TestCreate2Revive(t *testing.T) { var check2 uint256.Int err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(create2address) { + if exist, err := st.Exist(create2address); err != nil { + t.Error(err) + } else if !exist { t.Error("expected create2address to exist at the block 2", create2address.String()) } // We expect number 0x42 in the position [2], because it is the block number 2 @@ -185,7 +193,9 @@ func TestCreate2Revive(t *testing.T) { } err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if st.Exist(create2address) { + if exist, err := st.Exist(create2address); err != nil { + t.Error(err) + } else if exist { t.Error("expected create2address to be self-destructed at the block 3", create2address.String()) } return nil @@ -198,7 +208,9 @@ func TestCreate2Revive(t *testing.T) { } err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(create2address) { + if exist, err := st.Exist(create2address); err != nil { + t.Error(err) + } else if !exist { t.Error("expected create2address to exist at the block 2", create2address.String()) } // We expect number 0x42 in the position [4], because it is the block number 4 @@ -339,10 +351,14 @@ func TestCreate2Polymorth(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(address) { + if exist, err := st.Exist(address); err != nil { + t.Error(err) + } else if !exist { t.Error("expected account to exist") } - if st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if exist { t.Error("expected contractAddress to not exist before block 0", contractAddress.String()) } return nil @@ -355,9 +371,10 @@ func TestCreate2Polymorth(t *testing.T) { } err = m.DB.View(context.Background(), func(tx kv.Tx) error { - st := state.New(m.NewStateReader(tx)) - if !st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if !exist { t.Error("expected contractAddress to exist at the block 1", contractAddress.String()) } return nil @@ -371,15 +388,25 @@ func TestCreate2Polymorth(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(create2address) { + if exist, err := st.Exist(create2address); err != nil { + t.Error(err) + } else if !exist { t.Error("expected create2address to exist at the block 2", create2address.String()) } - if !bytes.Equal(st.GetCode(create2address), common.FromHex("6002ff")) { - t.Errorf("Expected CREATE2 deployed code 6002ff, got %x", st.GetCode(create2address)) + code, err := st.GetCode(create2address) + if err != nil { + return err + } + if !bytes.Equal(code, common.FromHex("6002ff")) { + t.Errorf("Expected CREATE2 deployed code 6002ff, got %x", code) } if !m.HistoryV3 { //AccountsDomain: has no "incarnation" concept - if st.GetIncarnation(create2address) != 1 { - t.Errorf("expected incarnation 1, got %d", st.GetIncarnation(create2address)) + incarnation, err := st.GetIncarnation(create2address) + if err != nil { + return err + } + if incarnation != 1 { + t.Errorf("expected incarnation 1, got %d", incarnation) } } return nil @@ -392,7 +419,9 @@ func TestCreate2Polymorth(t *testing.T) { } err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if st.Exist(create2address) { + if exist, err := st.Exist(create2address); err != nil { + t.Error(err) + } else if exist { t.Error("expected create2address to be self-destructed at the block 3", create2address.String()) } return nil @@ -405,15 +434,25 @@ func TestCreate2Polymorth(t *testing.T) { } err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(create2address) { + if exist, err := st.Exist(create2address); err != nil { + t.Error(err) + } else if !exist { t.Error("expected create2address to exist at the block 4", create2address.String()) } - if !bytes.Equal(st.GetCode(create2address), common.FromHex("6004ff")) { - t.Errorf("Expected CREATE2 deployed code 6004ff, got %x", st.GetCode(create2address)) + code, err := st.GetCode(create2address) + if err != nil { + return err + } + if !bytes.Equal(code, common.FromHex("6004ff")) { + t.Errorf("Expected CREATE2 deployed code 6004ff, got %x", code) } if !m.HistoryV3 { //AccountsDomain: has no "incarnation" concept - if st.GetIncarnation(create2address) != 2 { - t.Errorf("expected incarnation 2, got %d", st.GetIncarnation(create2address)) + incarnation, err := st.GetIncarnation(create2address) + if err != nil { + return err + } + if incarnation != 2 { + t.Errorf("expected incarnation 2, got %d", incarnation) } } return nil @@ -426,16 +465,26 @@ func TestCreate2Polymorth(t *testing.T) { } err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(create2address) { + if exist, err := st.Exist(create2address); err != nil { + t.Error(err) + } else if !exist { t.Error("expected create2address to exist at the block 5", create2address.String()) } - if !bytes.Equal(st.GetCode(create2address), common.FromHex("6005ff")) { - t.Errorf("Expected CREATE2 deployed code 6005ff, got %x", st.GetCode(create2address)) + code, err := st.GetCode(create2address) + if err != nil { + return err + } + if !bytes.Equal(code, common.FromHex("6005ff")) { + t.Errorf("Expected CREATE2 deployed code 6005ff, got %x", code) } if !m.HistoryV3 { //AccountsDomain: has no "incarnation" concept - if st.GetIncarnation(create2address) != 4 { - t.Errorf("expected incarnation 4 (two self-destructs and two-recreations within a block), got %d", st.GetIncarnation(create2address)) + incarnation, err := st.GetIncarnation(create2address) + if err != nil { + return err + } + if incarnation != 4 { + t.Errorf("expected incarnation 4 (two self-destructs and two-recreations within a block), got %d", incarnation) } } return nil @@ -532,10 +581,14 @@ func TestReorgOverSelfDestruct(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(address) { + if exist, err := st.Exist(address); err != nil { + t.Error(err) + } else if !exist { t.Error("expected account to exist") } - if st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if exist { t.Error("expected contractAddress to not exist before block 0", contractAddress.String()) } return nil @@ -550,7 +603,10 @@ func TestReorgOverSelfDestruct(t *testing.T) { var correctValueX uint256.Int err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if !exist { + t.Error("expected contractAddress to exist at the block 1", contractAddress.String()) } @@ -567,7 +623,9 @@ func TestReorgOverSelfDestruct(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if exist { t.Error("expected contractAddress to not exist at the block 3", contractAddress.String()) } return nil @@ -579,7 +637,9 @@ func TestReorgOverSelfDestruct(t *testing.T) { } err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if !exist { t.Error("expected contractAddress to exist at the block 4", contractAddress.String()) } var valueX uint256.Int @@ -672,10 +732,15 @@ func TestReorgOverStateChange(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(address) { + if exist, err := st.Exist(address); err != nil { + t.Error(err) + } else if !exist { t.Error("expected account to exist") } - if st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if exist { + t.Error("expected contractAddress to not exist before block 0", contractAddress.String()) } return nil @@ -691,7 +756,10 @@ func TestReorgOverStateChange(t *testing.T) { var correctValueX uint256.Int err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if !exist { + t.Error("expected contractAddress to exist at the block 1", contractAddress.String()) } @@ -712,7 +780,9 @@ func TestReorgOverStateChange(t *testing.T) { } err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if !exist { t.Error("expected contractAddress to exist at the block 4", contractAddress.String()) } @@ -802,7 +872,9 @@ func TestCreateOnExistingStorage(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(address) { + if exist, err := st.Exist(address); err != nil { + t.Error(err) + } else if !exist { t.Error("expected account to exist") } if contractAddress != contractAddr { @@ -821,7 +893,9 @@ func TestCreateOnExistingStorage(t *testing.T) { var check0 uint256.Int err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if !exist { t.Error("expected contractAddress to exist at the block 1", contractAddress.String()) } @@ -948,14 +1022,18 @@ func TestEip2200Gas(t *testing.T) { var balanceBefore *uint256.Int err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(address) { + if exist, err := st.Exist(address); err != nil { + t.Error(err) + } else if !exist { t.Error("expected account to exist") } - if st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if exist { t.Error("expected contractAddress to not exist before block 0", contractAddress.String()) } - balanceBefore = st.GetBalance(address) - return nil + balanceBefore, err = st.GetBalance(address) + return err }) require.NoError(t, err) @@ -966,10 +1044,15 @@ func TestEip2200Gas(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if !exist { t.Error("expected contractAddress to exist at the block 1", contractAddress.String()) } - balanceAfter := st.GetBalance(address) + balanceAfter, err := st.GetBalance(address) + if err != nil { + return err + } gasSpent := big.NewInt(0).Sub(balanceBefore.ToBig(), balanceAfter.ToBig()) expectedGasSpent := big.NewInt(190373) //(192245) // In the incorrect version, it is 179645 if gasSpent.Cmp(expectedGasSpent) != 0 { @@ -1036,10 +1119,14 @@ func TestWrongIncarnation(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(address) { + if exist, err := st.Exist(address); err != nil { + t.Error(err) + } else if !exist { t.Error("expected account to exist") } - if st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if exist { t.Error("expected contractAddress to not exist before block 0", contractAddress.String()) } return nil @@ -1066,7 +1153,9 @@ func TestWrongIncarnation(t *testing.T) { } st := state.New(stateReader) - if !st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if !exist { t.Error("expected contractAddress to exist at the block 1", contractAddress.String()) } return nil @@ -1186,7 +1275,9 @@ func TestWrongIncarnation2(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(address) { + if exist, err := st.Exist(address); err != nil { + t.Error(err) + } else if !exist { t.Error("expected account to exist") } return nil @@ -1205,7 +1296,9 @@ func TestWrongIncarnation2(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(contractAddress) { + if exist, err := st.Exist(contractAddress); err != nil { + t.Error(err) + } else if !exist { t.Error("expected contractAddress to exist at the block 1", contractAddress.String()) } @@ -1533,7 +1626,9 @@ func TestRecreateAndRewind(t *testing.T) { var check0 uint256.Int err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(phoenixAddress) { + if exist, err := st.Exist(phoenixAddress); err != nil { + t.Error(err) + } else if !exist { t.Errorf("expected phoenix %x to exist after first insert", phoenixAddress) } @@ -1552,7 +1647,9 @@ func TestRecreateAndRewind(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(phoenixAddress) { + if exist, err := st.Exist(phoenixAddress); err != nil { + t.Error(err) + } else if !exist { t.Errorf("expected phoenix %x to exist after second insert", phoenixAddress) } @@ -1570,7 +1667,9 @@ func TestRecreateAndRewind(t *testing.T) { } err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(phoenixAddress) { + if exist, err := st.Exist(phoenixAddress); err != nil { + t.Error(err) + } else if !exist { t.Errorf("expected phoenix %x to exist after second insert", phoenixAddress) } diff --git a/core/state/intra_block_state.go b/core/state/intra_block_state.go index 89a10a80e3a..854d1a733d7 100644 --- a/core/state/intra_block_state.go +++ b/core/state/intra_block_state.go @@ -126,12 +126,14 @@ func (sdb *IntraBlockState) SetTrace(trace bool) { } // setErrorUnsafe sets error but should be called in medhods that already have locks +// Deprecated: The IBS api now returns errors directly func (sdb *IntraBlockState) setErrorUnsafe(err error) { if sdb.savedErr == nil { sdb.savedErr = err } } +// Deprecated: The IBS api now returns errors directly func (sdb *IntraBlockState) Error() error { return sdb.savedErr } @@ -230,36 +232,47 @@ func (sdb *IntraBlockState) SubRefund(gas uint64) { // Exist reports whether the given account address exists in the state. // Notably this also returns true for suicided accounts. -func (sdb *IntraBlockState) Exist(addr libcommon.Address) bool { - s := sdb.getStateObject(addr) - return s != nil && !s.deleted +func (sdb *IntraBlockState) Exist(addr libcommon.Address) (bool, error) { + s, err := sdb.getStateObject(addr) + if err != nil { + return false, err + } + return s != nil && !s.deleted, err } // Empty returns whether the state object is either non-existent // or empty according to the EIP161 specification (balance = nonce = code = 0) -func (sdb *IntraBlockState) Empty(addr libcommon.Address) bool { - so := sdb.getStateObject(addr) - return so == nil || so.deleted || so.empty() +func (sdb *IntraBlockState) Empty(addr libcommon.Address) (bool, error) { + so, err := sdb.getStateObject(addr) + if err != nil { + return false, err + } + return so == nil || so.deleted || so.empty(), nil } // GetBalance retrieves the balance from the given address or 0 if object not found // DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account -func (sdb *IntraBlockState) GetBalance(addr libcommon.Address) *uint256.Int { - stateObject := sdb.getStateObject(addr) +func (sdb *IntraBlockState) GetBalance(addr libcommon.Address) (*uint256.Int, error) { + stateObject, err := sdb.getStateObject(addr) + if err != nil { + return nil, err + } if stateObject != nil && !stateObject.deleted { - return stateObject.Balance() + return stateObject.Balance(), nil } - return u256.Num0 + return u256.Num0, nil } // DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account -func (sdb *IntraBlockState) GetNonce(addr libcommon.Address) uint64 { - stateObject := sdb.getStateObject(addr) +func (sdb *IntraBlockState) GetNonce(addr libcommon.Address) (uint64, error) { + stateObject, err := sdb.getStateObject(addr) + if err != nil { + return 0, err + } if stateObject != nil && !stateObject.deleted { - return stateObject.Nonce() + return stateObject.Nonce(), nil } - - return 0 + return 0, nil } // TxIndex returns the current transaction index set by Prepare. @@ -268,117 +281,157 @@ func (sdb *IntraBlockState) TxnIndex() int { } // DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account -func (sdb *IntraBlockState) GetCode(addr libcommon.Address) []byte { - stateObject := sdb.getStateObject(addr) +func (sdb *IntraBlockState) GetCode(addr libcommon.Address) ([]byte, error) { + stateObject, err := sdb.getStateObject(addr) + if err != nil { + return nil, err + } if stateObject != nil && !stateObject.deleted { if sdb.trace { fmt.Printf("GetCode %x, returned %d\n", addr, len(stateObject.Code())) } - return stateObject.Code() + return stateObject.Code(), nil } if sdb.trace { fmt.Printf("GetCode %x, returned nil\n", addr) } - return nil + return nil, nil } // DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account -func (sdb *IntraBlockState) GetCodeSize(addr libcommon.Address) int { - stateObject := sdb.getStateObject(addr) +func (sdb *IntraBlockState) GetCodeSize(addr libcommon.Address) (int, error) { + stateObject, err := sdb.getStateObject(addr) + if err != nil { + return 0, err + } if stateObject == nil || stateObject.deleted { - return 0 + return 0, nil } if stateObject.code != nil { - return len(stateObject.code) + return len(stateObject.code), nil } l, err := sdb.stateReader.ReadAccountCodeSize(addr, stateObject.data.Incarnation, stateObject.data.CodeHash) if err != nil { sdb.setErrorUnsafe(err) + return l, err } - return l + return l, err } // DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account -func (sdb *IntraBlockState) GetCodeHash(addr libcommon.Address) libcommon.Hash { - stateObject := sdb.getStateObject(addr) +func (sdb *IntraBlockState) GetCodeHash(addr libcommon.Address) (libcommon.Hash, error) { + stateObject, err := sdb.getStateObject(addr) + if err != nil { + return libcommon.Hash{}, err + } if stateObject == nil || stateObject.deleted { - return libcommon.Hash{} + return libcommon.Hash{}, nil } - return stateObject.data.CodeHash + return stateObject.data.CodeHash, nil } -func (sdb *IntraBlockState) ResolveCodeHash(addr libcommon.Address) libcommon.Hash { +func (sdb *IntraBlockState) ResolveCodeHash(addr libcommon.Address) (libcommon.Hash, error) { // eip-7702 - if dd, ok := sdb.GetDelegatedDesignation(addr); ok { + dd, ok, err := sdb.GetDelegatedDesignation(addr) + + if ok { return sdb.GetCodeHash(dd) } + if err != nil { + return libcommon.Hash{}, err + } + return sdb.GetCodeHash(addr) } -func (sdb *IntraBlockState) ResolveCode(addr libcommon.Address) []byte { +func (sdb *IntraBlockState) ResolveCode(addr libcommon.Address) ([]byte, error) { // eip-7702 - if dd, ok := sdb.GetDelegatedDesignation(addr); ok { + dd, ok, err := sdb.GetDelegatedDesignation(addr) + if ok { return sdb.GetCode(dd) } - + if err != nil { + return nil, err + } return sdb.GetCode(addr) } -func (sdb *IntraBlockState) ResolveCodeSize(addr libcommon.Address) int { +func (sdb *IntraBlockState) ResolveCodeSize(addr libcommon.Address) (int, error) { // eip-7702 - size := sdb.GetCodeSize(addr) + size, err := sdb.GetCodeSize(addr) + if err != nil { + return 0, err + } if size == types.DelegateDesignationCodeSize { // might be delegated designation - return len(sdb.ResolveCode(addr)) + code, err := sdb.ResolveCode(addr) + if err != nil { + return 0, err + } + return len(code), nil } - return size + return size, nil } -func (sdb *IntraBlockState) GetDelegatedDesignation(addr libcommon.Address) (libcommon.Address, bool) { +func (sdb *IntraBlockState) GetDelegatedDesignation(addr libcommon.Address) (libcommon.Address, bool, error) { // eip-7702 - code := sdb.GetCode(addr) + code, err := sdb.GetCode(addr) + if err != nil { + return EmptyAddress, false, err + } if delegation, ok := types.ParseDelegation(code); ok { - return delegation, true + return delegation, true, nil } - return EmptyAddress, false + return EmptyAddress, false, nil } // GetState retrieves a value from the given account's storage trie. // DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account -func (sdb *IntraBlockState) GetState(addr libcommon.Address, key *libcommon.Hash, value *uint256.Int) { - stateObject := sdb.getStateObject(addr) +func (sdb *IntraBlockState) GetState(addr libcommon.Address, key *libcommon.Hash, value *uint256.Int) error { + stateObject, err := sdb.getStateObject(addr) + if err != nil { + return err + } if stateObject != nil && !stateObject.deleted { stateObject.GetState(key, value) } else { value.Clear() } + return nil } // GetCommittedState retrieves a value from the given account's committed storage trie. // DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account -func (sdb *IntraBlockState) GetCommittedState(addr libcommon.Address, key *libcommon.Hash, value *uint256.Int) { - stateObject := sdb.getStateObject(addr) +func (sdb *IntraBlockState) GetCommittedState(addr libcommon.Address, key *libcommon.Hash, value *uint256.Int) error { + stateObject, err := sdb.getStateObject(addr) + if err != nil { + return err + } if stateObject != nil && !stateObject.deleted { stateObject.GetCommittedState(key, value) } else { value.Clear() } + return nil } -func (sdb *IntraBlockState) HasSelfdestructed(addr libcommon.Address) bool { - stateObject := sdb.getStateObject(addr) +func (sdb *IntraBlockState) HasSelfdestructed(addr libcommon.Address) (bool, error) { + stateObject, err := sdb.getStateObject(addr) + if err != nil { + return false, err + } if stateObject == nil { - return false + return false, nil } if stateObject.deleted { - return false + return false, nil } if stateObject.createdContract { - return false + return false, nil } - return stateObject.selfdestructed + return stateObject.selfdestructed, nil } /* @@ -387,7 +440,7 @@ func (sdb *IntraBlockState) HasSelfdestructed(addr libcommon.Address) bool { // AddBalance adds amount to the account associated with addr. // DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account -func (sdb *IntraBlockState) AddBalance(addr libcommon.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) { +func (sdb *IntraBlockState) AddBalance(addr libcommon.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) error { if sdb.trace { fmt.Printf("AddBalance %x, %d\n", addr, amount) } @@ -424,82 +477,117 @@ func (sdb *IntraBlockState) AddBalance(addr libcommon.Address, amount *uint256.I bi.increase.Add(&bi.increase, amount) bi.count++ - return + return nil } - stateObject := sdb.GetOrNewStateObject(addr) + stateObject, err := sdb.GetOrNewStateObject(addr) + if err != nil { + return err + } stateObject.AddBalance(amount, reason) + return nil } // SubBalance subtracts amount from the account associated with addr. // DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account -func (sdb *IntraBlockState) SubBalance(addr libcommon.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) { +func (sdb *IntraBlockState) SubBalance(addr libcommon.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) error { if sdb.trace { fmt.Printf("SubBalance %x, %d\n", addr, amount) } - stateObject := sdb.GetOrNewStateObject(addr) + stateObject, err := sdb.GetOrNewStateObject(addr) + if err != nil { + return err + } if stateObject != nil { stateObject.SubBalance(amount, reason) } + return nil } // DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account -func (sdb *IntraBlockState) SetBalance(addr libcommon.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) { - stateObject := sdb.GetOrNewStateObject(addr) +func (sdb *IntraBlockState) SetBalance(addr libcommon.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) error { + stateObject, err := sdb.GetOrNewStateObject(addr) + if err != nil { + return err + } if stateObject != nil { stateObject.SetBalance(amount, reason) } + return nil } // DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account -func (sdb *IntraBlockState) SetNonce(addr libcommon.Address, nonce uint64) { - stateObject := sdb.GetOrNewStateObject(addr) +func (sdb *IntraBlockState) SetNonce(addr libcommon.Address, nonce uint64) error { + stateObject, err := sdb.GetOrNewStateObject(addr) + if err != nil { + return err + } if stateObject != nil { stateObject.SetNonce(nonce) } + return nil } // DESCRIBED: docs/programmers_guide/guide.md#code-hash // DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account -func (sdb *IntraBlockState) SetCode(addr libcommon.Address, code []byte) { - stateObject := sdb.GetOrNewStateObject(addr) +func (sdb *IntraBlockState) SetCode(addr libcommon.Address, code []byte) error { + stateObject, err := sdb.GetOrNewStateObject(addr) + if err != nil { + return err + } if stateObject != nil { stateObject.SetCode(crypto.Keccak256Hash(code), code) } + return nil } // DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account -func (sdb *IntraBlockState) SetState(addr libcommon.Address, key *libcommon.Hash, value uint256.Int) { - stateObject := sdb.GetOrNewStateObject(addr) +func (sdb *IntraBlockState) SetState(addr libcommon.Address, key *libcommon.Hash, value uint256.Int) error { + stateObject, err := sdb.GetOrNewStateObject(addr) + if err != nil { + return err + } if stateObject != nil { stateObject.SetState(key, value) } + return nil } // SetStorage replaces the entire storage for the specified account with given // storage. This function should only be used for debugging. -func (sdb *IntraBlockState) SetStorage(addr libcommon.Address, storage Storage) { - stateObject := sdb.GetOrNewStateObject(addr) +func (sdb *IntraBlockState) SetStorage(addr libcommon.Address, storage Storage) error { + stateObject, err := sdb.GetOrNewStateObject(addr) + if err != nil { + return err + } if stateObject != nil { stateObject.SetStorage(storage) } + return nil } // SetIncarnation sets incarnation for account if account exists -func (sdb *IntraBlockState) SetIncarnation(addr libcommon.Address, incarnation uint64) { - stateObject := sdb.GetOrNewStateObject(addr) +func (sdb *IntraBlockState) SetIncarnation(addr libcommon.Address, incarnation uint64) error { + stateObject, err := sdb.GetOrNewStateObject(addr) + if err != nil { + return err + } if stateObject != nil { stateObject.setIncarnation(incarnation) } + return nil } -func (sdb *IntraBlockState) GetIncarnation(addr libcommon.Address) uint64 { - stateObject := sdb.getStateObject(addr) +func (sdb *IntraBlockState) GetIncarnation(addr libcommon.Address) (uint64, error) { + stateObject, err := sdb.getStateObject(addr) + if err != nil { + return 0, err + } if stateObject != nil { - return stateObject.data.Incarnation + return stateObject.data.Incarnation, nil } - return 0 + return 0, nil } // Selfdestruct marks the given account as suicided. @@ -507,10 +595,13 @@ func (sdb *IntraBlockState) GetIncarnation(addr libcommon.Address) uint64 { // // The account's state object is still available until the state is committed, // getStateObject will return a non-nil account after Suicide. -func (sdb *IntraBlockState) Selfdestruct(addr libcommon.Address) bool { - stateObject := sdb.getStateObject(addr) +func (sdb *IntraBlockState) Selfdestruct(addr libcommon.Address) (bool, error) { + stateObject, err := sdb.getStateObject(addr) + if err != nil { + return false, err + } if stateObject == nil || stateObject.deleted { - return false + return false, nil } prevBalance := *stateObject.Balance() @@ -528,19 +619,27 @@ func (sdb *IntraBlockState) Selfdestruct(addr libcommon.Address) bool { stateObject.createdContract = false stateObject.data.Balance.Clear() - return true + return true, nil } -func (sdb *IntraBlockState) Selfdestruct6780(addr libcommon.Address) { - stateObject := sdb.getStateObject(addr) +func (sdb *IntraBlockState) Selfdestruct6780(addr libcommon.Address) error { + stateObject, err := sdb.getStateObject(addr) + if err != nil { + return err + } if stateObject == nil { - return + return nil } if stateObject.newlyCreated { - if _, ok := types.ParseDelegation(sdb.GetCode(addr)); !ok { + code, err := sdb.GetCode(addr) + if err != nil { + return err + } + if _, ok := types.ParseDelegation(code); !ok { sdb.Selfdestruct(addr) } } + return nil } // SetTransientState sets transient storage for a given account. It @@ -572,36 +671,36 @@ func (sdb *IntraBlockState) GetTransientState(addr libcommon.Address, key libcom return sdb.transientStorage.Get(addr, key) } -func (sdb *IntraBlockState) getStateObject(addr libcommon.Address) (stateObject *stateObject) { +func (sdb *IntraBlockState) getStateObject(addr libcommon.Address) (stateObject *stateObject, err error) { // Prefer 'live' objects. if obj := sdb.stateObjects[addr]; obj != nil { - return obj + return obj, nil } // Load the object from the database. if _, ok := sdb.nilAccounts[addr]; ok { if bi, ok := sdb.balanceInc[addr]; ok && !bi.transferred { - return sdb.createObject(addr, nil) + return sdb.createObject(addr, nil), nil } - return nil + return nil, nil } account, err := sdb.stateReader.ReadAccountData(addr) if err != nil { sdb.setErrorUnsafe(err) - return nil + return nil, err } if account == nil { sdb.nilAccounts[addr] = struct{}{} if bi, ok := sdb.balanceInc[addr]; ok && !bi.transferred { - return sdb.createObject(addr, nil) + return sdb.createObject(addr, nil), nil } - return nil + return nil, nil } // Insert into the live set. obj := newObject(sdb, addr, account, account) sdb.setStateObject(addr, obj) - return obj + return obj, nil } func (sdb *IntraBlockState) setStateObject(addr libcommon.Address, object *stateObject) { @@ -614,12 +713,15 @@ func (sdb *IntraBlockState) setStateObject(addr libcommon.Address, object *state } // Retrieve a state object or create a new state object if nil. -func (sdb *IntraBlockState) GetOrNewStateObject(addr libcommon.Address) *stateObject { - stateObject := sdb.getStateObject(addr) +func (sdb *IntraBlockState) GetOrNewStateObject(addr libcommon.Address) (*stateObject, error) { + stateObject, err := sdb.getStateObject(addr) + if err != nil { + return nil, err + } if stateObject == nil || stateObject.deleted { stateObject = sdb.createObject(addr, stateObject /* previous */) } - return stateObject + return stateObject, nil } // createObject creates a new state object. If there is an existing account with @@ -655,9 +757,12 @@ func (sdb *IntraBlockState) createObject(addr libcommon.Address, previous *state // 2. tx_create(sha(account ++ nonce)) (note that this gets the address of 1) // // Carrying over the balance ensures that Ether doesn't disappear. -func (sdb *IntraBlockState) CreateAccount(addr libcommon.Address, contractCreation bool) { +func (sdb *IntraBlockState) CreateAccount(addr libcommon.Address, contractCreation bool) error { var prevInc uint64 - previous := sdb.getStateObject(addr) + previous, err := sdb.getStateObject(addr) + if err != nil { + return err + } if previous != nil && previous.selfdestructed { prevInc = previous.data.Incarnation } else { @@ -665,6 +770,7 @@ func (sdb *IntraBlockState) CreateAccount(addr libcommon.Address, contractCreati prevInc = inc } else { sdb.savedErr = err + return err } } if previous != nil && prevInc < previous.data.PrevIncarnation { @@ -684,6 +790,7 @@ func (sdb *IntraBlockState) CreateAccount(addr libcommon.Address, contractCreati } else { newObj.selfdestructed = false } + return nil } // Snapshot returns an identifier for the current revision of the state. @@ -907,7 +1014,7 @@ func (sdb *IntraBlockState) clearJournalAndRefund() { // - Add authorities to access list (EIP-7702) // - Add delegated designation (if it exists for dst) to access list (EIP-7702) func (sdb *IntraBlockState) Prepare(rules *chain.Rules, sender, coinbase libcommon.Address, dst *libcommon.Address, - precompiles []libcommon.Address, list types.AccessList, authorities []libcommon.Address) { + precompiles []libcommon.Address, list types.AccessList, authorities []libcommon.Address) error { if sdb.trace { fmt.Printf("ibs.Prepare %x, %x, %x, %x, %v, %v, %v\n", sender, coinbase, dst, precompiles, list, rules, authorities) } @@ -942,13 +1049,18 @@ func (sdb *IntraBlockState) Prepare(rules *chain.Rules, sender, coinbase libcomm } if dst != nil { - if dd, ok := sdb.GetDelegatedDesignation(*dst); ok { + dd, ok, err := sdb.GetDelegatedDesignation(*dst) + if err != nil { + return err + } + if ok { sdb.AddAddressToAccessList(dd) } } } // Reset transient storage at the beginning of transaction execution sdb.transientStorage = newTransientStorage() + return nil } // AddAddressToAccessList adds the given address to the access list diff --git a/core/state/intra_block_state_logger_test.go b/core/state/intra_block_state_logger_test.go index 11c5023c940..cc5fed21804 100644 --- a/core/state/intra_block_state_logger_test.go +++ b/core/state/intra_block_state_logger_test.go @@ -86,7 +86,8 @@ func TestStateLogger(t *testing.T) { } } - so := stateDB.GetOrNewStateObject(libcommon.Address{}) + so, err := stateDB.GetOrNewStateObject(libcommon.Address{}) + require.NoError(t, err) if !reflect.DeepEqual(so.Balance(), uint256.NewInt(3)) { t.Errorf("Incorrect Balance for %s expectedBalance: %s, got:%s", libcommon.Address{}, uint256.NewInt(3), so.Balance()) } @@ -103,7 +104,8 @@ func TestStateLogger(t *testing.T) { state.SubBalance(libcommon.Address{}, uint256.NewInt(1), tracing.BalanceChangeUnspecified) }, checker: func(t *testing.T, stateDB *IntraBlockState) { - so := stateDB.GetOrNewStateObject(libcommon.Address{}) + so, err := stateDB.GetOrNewStateObject(libcommon.Address{}) + require.NoError(t, err) if !reflect.DeepEqual(so.Balance(), uint256.NewInt(1)) { t.Errorf("Incorrect Balance for %s expectedBalance: %s, got:%s", libcommon.Address{}, uint256.NewInt(1), so.Balance()) } diff --git a/core/state/intra_block_state_test.go b/core/state/intra_block_state_test.go index b2c1c5321e6..f7d0767015c 100644 --- a/core/state/intra_block_state_test.go +++ b/core/state/intra_block_state_test.go @@ -323,17 +323,77 @@ func (test *snapshotTest) checkEqual(state, checkstate *IntraBlockState) error { return true } // Check basic accessor methods. - if !checkeq("Exist", state.Exist(addr), checkstate.Exist(addr)) { + se, err := state.Exist(addr) + if err != nil { return err } - checkeq("HasSelfdestructed", state.HasSelfdestructed(addr), checkstate.HasSelfdestructed(addr)) - checkeqBigInt("GetBalance", state.GetBalance(addr).ToBig(), checkstate.GetBalance(addr).ToBig()) - checkeq("GetNonce", state.GetNonce(addr), checkstate.GetNonce(addr)) - checkeq("GetCode", state.GetCode(addr), checkstate.GetCode(addr)) - checkeq("GetCodeHash", state.GetCodeHash(addr), checkstate.GetCodeHash(addr)) - checkeq("GetCodeSize", state.GetCodeSize(addr), checkstate.GetCodeSize(addr)) + ce, err := checkstate.Exist(addr) + if err != nil { + return err + } + if !checkeq("Exist", se, ce) { + return err + } + ssd, err := state.HasSelfdestructed(addr) + if err != nil { + return err + } + csd, err := checkstate.HasSelfdestructed(addr) + if err != nil { + return err + } + checkeq("HasSelfdestructed", ssd, csd) + sb, err := state.GetBalance(addr) + if err != nil { + return err + } + cb, err := checkstate.GetBalance(addr) + if err != nil { + return err + } + checkeqBigInt("GetBalance", sb.ToBig(), cb.ToBig()) + sn, err := state.GetNonce(addr) + if err != nil { + return err + } + cn, err := checkstate.GetNonce(addr) + if err != nil { + return err + } + checkeq("GetNonce", sn, cn) + sc, err := state.GetCode(addr) + if err != nil { + return err + } + cc, err := checkstate.GetCode(addr) + if err != nil { + return err + } + checkeq("GetCode", sc, cc) + sch, err := state.GetCodeHash(addr) + if err != nil { + return err + } + cch, err := checkstate.GetCodeHash(addr) + if err != nil { + return err + } + checkeq("GetCodeHash", sch, cch) + scs, err := state.GetCodeSize(addr) + if err != nil { + return err + } + ccs, err := checkstate.GetCodeSize(addr) + if err != nil { + return err + } + checkeq("GetCodeSize", scs, ccs) // Check storage. - if obj := state.getStateObject(addr); obj != nil { + obj, err := state.getStateObject(addr) + if err != nil { + return err + } + if obj != nil { for key, value := range obj.dirtyStorage { var out uint256.Int checkstate.GetState(addr, &key, &out) @@ -342,7 +402,11 @@ func (test *snapshotTest) checkEqual(state, checkstate *IntraBlockState) error { } } } - if obj := checkstate.getStateObject(addr); obj != nil { + obj, err = checkstate.getStateObject(addr) + if err != nil { + return err + } + if obj != nil { for key, value := range obj.dirtyStorage { var out uint256.Int state.GetState(addr, &key, &out) diff --git a/core/state/journal.go b/core/state/journal.go index 663f70baeb9..fd7dc7fa13a 100644 --- a/core/state/journal.go +++ b/core/state/journal.go @@ -29,7 +29,7 @@ import ( // reverted on demand. type journalEntry interface { // revert undoes the changes introduced by this journal entry. - revert(*IntraBlockState) + revert(*IntraBlockState) error // dirtied returns the Ethereum address modified by this journal entry. dirtied() *libcommon.Address @@ -172,29 +172,35 @@ type ( // refundChange | addLogChange | touchChange | accessListAddAccountChange | accessListAddSlotChange | transientStorageChange //} -func (ch createObjectChange) revert(s *IntraBlockState) { +func (ch createObjectChange) revert(s *IntraBlockState) error { delete(s.stateObjects, *ch.account) delete(s.stateObjectsDirty, *ch.account) + return nil } func (ch createObjectChange) dirtied() *libcommon.Address { return ch.account } -func (ch resetObjectChange) revert(s *IntraBlockState) { +func (ch resetObjectChange) revert(s *IntraBlockState) error { s.setStateObject(*ch.account, ch.prev) + return nil } func (ch resetObjectChange) dirtied() *libcommon.Address { return nil } -func (ch selfdestructChange) revert(s *IntraBlockState) { - obj := s.getStateObject(*ch.account) +func (ch selfdestructChange) revert(s *IntraBlockState) error { + obj, err := s.getStateObject(*ch.account) + if err != nil { + return err + } if obj != nil { obj.selfdestructed = ch.prev obj.setBalance(&ch.prevbalance) } + return nil } func (ch selfdestructChange) dirtied() *libcommon.Address { @@ -203,22 +209,28 @@ func (ch selfdestructChange) dirtied() *libcommon.Address { var ripemd = libcommon.HexToAddress("0000000000000000000000000000000000000003") -func (ch touchChange) revert(s *IntraBlockState) { +func (ch touchChange) revert(s *IntraBlockState) error { + return nil } func (ch touchChange) dirtied() *libcommon.Address { return ch.account } -func (ch balanceChange) revert(s *IntraBlockState) { - s.getStateObject(*ch.account).setBalance(&ch.prev) +func (ch balanceChange) revert(s *IntraBlockState) error { + obj, err := s.getStateObject(*ch.account) + if err != nil { + return err + } + obj.setBalance(&ch.prev) + return nil } func (ch balanceChange) dirtied() *libcommon.Address { return ch.account } -func (ch balanceIncrease) revert(s *IntraBlockState) { +func (ch balanceIncrease) revert(s *IntraBlockState) error { if bi, ok := s.balanceInc[*ch.account]; ok { bi.increase.Sub(&bi.increase, &ch.increase) bi.count-- @@ -226,6 +238,7 @@ func (ch balanceIncrease) revert(s *IntraBlockState) { delete(s.balanceInc, *ch.account) } } + return nil } func (ch balanceIncrease) dirtied() *libcommon.Address { @@ -236,71 +249,95 @@ func (ch balanceIncreaseTransfer) dirtied() *libcommon.Address { return nil } -func (ch balanceIncreaseTransfer) revert(s *IntraBlockState) { +func (ch balanceIncreaseTransfer) revert(s *IntraBlockState) error { ch.bi.transferred = false + return nil } -func (ch nonceChange) revert(s *IntraBlockState) { - s.getStateObject(*ch.account).setNonce(ch.prev) +func (ch nonceChange) revert(s *IntraBlockState) error { + obj, err := s.getStateObject(*ch.account) + if err != nil { + return err + } + obj.setNonce(ch.prev) + return nil } func (ch nonceChange) dirtied() *libcommon.Address { return ch.account } -func (ch codeChange) revert(s *IntraBlockState) { - s.getStateObject(*ch.account).setCode(ch.prevhash, ch.prevcode) +func (ch codeChange) revert(s *IntraBlockState) error { + obj, err := s.getStateObject(*ch.account) + if err != nil { + return err + } + obj.setCode(ch.prevhash, ch.prevcode) + return nil } func (ch codeChange) dirtied() *libcommon.Address { return ch.account } -func (ch storageChange) revert(s *IntraBlockState) { - s.getStateObject(*ch.account).setState(&ch.key, ch.prevalue) +func (ch storageChange) revert(s *IntraBlockState) error { + obj, err := s.getStateObject(*ch.account) + if err != nil { + return err + } + obj.setState(&ch.key, ch.prevalue) + return nil } func (ch storageChange) dirtied() *libcommon.Address { return ch.account } -func (ch fakeStorageChange) revert(s *IntraBlockState) { - s.getStateObject(*ch.account).fakeStorage[ch.key] = ch.prevalue +func (ch fakeStorageChange) revert(s *IntraBlockState) error { + obj, err := s.getStateObject(*ch.account) + if err != nil { + return err + } + obj.fakeStorage[ch.key] = ch.prevalue + return nil } func (ch fakeStorageChange) dirtied() *libcommon.Address { return ch.account } -func (ch transientStorageChange) revert(s *IntraBlockState) { +func (ch transientStorageChange) revert(s *IntraBlockState) error { s.setTransientState(*ch.account, ch.key, ch.prevalue) + return nil } func (ch transientStorageChange) dirtied() *libcommon.Address { return nil } -func (ch refundChange) revert(s *IntraBlockState) { +func (ch refundChange) revert(s *IntraBlockState) error { s.refund = ch.prev + return nil } func (ch refundChange) dirtied() *libcommon.Address { return nil } -func (ch addLogChange) revert(s *IntraBlockState) { +func (ch addLogChange) revert(s *IntraBlockState) error { txnLogs := s.logs[ch.txIndex] s.logs[ch.txIndex] = txnLogs[:len(txnLogs)-1] // revert 1 log if len(s.logs[ch.txIndex]) == 0 { s.logs = s.logs[:len(s.logs)-1] // revert txn } s.logSize-- + return nil } func (ch addLogChange) dirtied() *libcommon.Address { return nil } -func (ch accessListAddAccountChange) revert(s *IntraBlockState) { +func (ch accessListAddAccountChange) revert(s *IntraBlockState) error { /* One important invariant here, is that whenever a (addr, slot) is added, if the addr is not already present, the add causes two journal entries: @@ -311,14 +348,16 @@ func (ch accessListAddAccountChange) revert(s *IntraBlockState) { a single (addr) change. */ s.accessList.DeleteAddress(*ch.address) + return nil } func (ch accessListAddAccountChange) dirtied() *libcommon.Address { return nil } -func (ch accessListAddSlotChange) revert(s *IntraBlockState) { +func (ch accessListAddSlotChange) revert(s *IntraBlockState) error { s.accessList.DeleteSlot(*ch.address, *ch.slot) + return nil } func (ch accessListAddSlotChange) dirtied() *libcommon.Address { diff --git a/core/state/state_test.go b/core/state/state_test.go index 6712c5b36b5..cacb01edd41 100644 --- a/core/state/state_test.go +++ b/core/state/state_test.go @@ -57,15 +57,18 @@ var _ = checker.Suite(&StateSuite{}) func (s *StateSuite) TestDump(c *checker.C) { // generate a few entries - obj1 := s.state.GetOrNewStateObject(toAddr([]byte{0x01})) + obj1, err := s.state.GetOrNewStateObject(toAddr([]byte{0x01})) + c.Check(err, checker.IsNil) obj1.AddBalance(uint256.NewInt(22), tracing.BalanceChangeUnspecified) - obj2 := s.state.GetOrNewStateObject(toAddr([]byte{0x01, 0x02})) + obj2, err := s.state.GetOrNewStateObject(toAddr([]byte{0x01, 0x02})) + c.Check(err, checker.IsNil) obj2.SetCode(crypto.Keccak256Hash([]byte{3, 3, 3, 3, 3, 3, 3}), []byte{3, 3, 3, 3, 3, 3, 3}) - obj3 := s.state.GetOrNewStateObject(toAddr([]byte{0x02})) + obj3, err := s.state.GetOrNewStateObject(toAddr([]byte{0x02})) + c.Check(err, checker.IsNil) obj3.SetBalance(uint256.NewInt(44), tracing.BalanceChangeUnspecified) // write some of them to the trie - err := s.w.UpdateAccountData(obj1.address, &obj1.data, new(accounts.Account)) + err = s.w.UpdateAccountData(obj1.address, &obj1.data, new(accounts.Account)) c.Check(err, checker.IsNil) err = s.w.UpdateAccountData(obj2.address, &obj2.data, new(accounts.Account)) c.Check(err, checker.IsNil) @@ -273,7 +276,10 @@ func TestSnapshot2(t *testing.T) { state.SetState(stateobjaddr1, &storageaddr, *data1) // db, trie are already non-empty values - so0 := state.getStateObject(stateobjaddr0) + so0, err := state.getStateObject(stateobjaddr0) + if err != nil { + t.Fatal("getting state", err) + } so0.SetBalance(uint256.NewInt(42), tracing.BalanceChangeUnspecified) so0.SetNonce(43) so0.SetCode(crypto.Keccak256Hash([]byte{'c', 'a', 'f', 'e'}), []byte{'c', 'a', 'f', 'e'}) @@ -292,7 +298,10 @@ func TestSnapshot2(t *testing.T) { } // and one with deleted == true - so1 := state.getStateObject(stateobjaddr1) + so1, err := state.getStateObject(stateobjaddr1) + if err != nil { + t.Fatal("getting state", err) + } so1.SetBalance(uint256.NewInt(52), tracing.BalanceChangeUnspecified) so1.SetNonce(53) so1.SetCode(crypto.Keccak256Hash([]byte{'c', 'a', 'f', 'e', '2'}), []byte{'c', 'a', 'f', 'e', '2'}) @@ -300,7 +309,10 @@ func TestSnapshot2(t *testing.T) { so1.deleted = true state.setStateObject(stateobjaddr1, so1) - so1 = state.getStateObject(stateobjaddr1) + so1, err = state.getStateObject(stateobjaddr1) + if err != nil { + t.Fatal("getting state", err) + } if so1 != nil && !so1.deleted { t.Fatalf("deleted object not nil when getting") } @@ -308,7 +320,10 @@ func TestSnapshot2(t *testing.T) { snapshot := state.Snapshot() state.RevertToSnapshot(snapshot) - so0Restored := state.getStateObject(stateobjaddr0) + so0Restored, err := state.getStateObject(stateobjaddr0) + if err != nil { + t.Fatal("getting restored state", err) + } // Update lazily-loaded values before comparing. var tmp uint256.Int so0Restored.GetState(&storageaddr, &tmp) @@ -317,7 +332,10 @@ func TestSnapshot2(t *testing.T) { compareStateObjects(so0Restored, so0, t) // deleted should be nil, both before and after restore of state copy - so1Restored := state.getStateObject(stateobjaddr1) + so1Restored, err := state.getStateObject(stateobjaddr1) + if err != nil { + t.Fatal("getting restored state", err) + } if so1Restored != nil && !so1Restored.deleted { t.Fatalf("deleted object not nil after restoring snapshot: %+v", so1Restored) } @@ -410,12 +428,15 @@ func TestDump(t *testing.T) { st := New(NewReaderV3(domains)) // generate a few entries - obj1 := st.GetOrNewStateObject(toAddr([]byte{0x01})) + obj1, err := st.GetOrNewStateObject(toAddr([]byte{0x01})) + require.NoError(t, err) obj1.AddBalance(uint256.NewInt(22), tracing.BalanceChangeUnspecified) - obj2 := st.GetOrNewStateObject(toAddr([]byte{0x01, 0x02})) + obj2, err := st.GetOrNewStateObject(toAddr([]byte{0x01, 0x02})) + require.NoError(t, err) obj2.SetCode(crypto.Keccak256Hash([]byte{3, 3, 3, 3, 3, 3, 3}), []byte{3, 3, 3, 3, 3, 3, 3}) obj2.setIncarnation(1) - obj3 := st.GetOrNewStateObject(toAddr([]byte{0x02})) + obj3, err := st.GetOrNewStateObject(toAddr([]byte{0x02})) + require.NoError(t, err) obj3.SetBalance(uint256.NewInt(44), tracing.BalanceChangeUnspecified) w := NewWriterV4(domains) diff --git a/core/state/txtask.go b/core/state/txtask.go index ff4a79feeb9..4fbb0819bbe 100644 --- a/core/state/txtask.go +++ b/core/state/txtask.go @@ -140,7 +140,7 @@ func (t *TxTask) createReceipt(cumulativeGasUsed uint64) *types.Receipt { //} return receipt } -func (t *TxTask) Reset() { +func (t *TxTask) Reset() *TxTask { t.BalanceIncreaseSet = nil returnReadList(t.ReadLists) t.ReadLists = nil @@ -149,6 +149,9 @@ func (t *TxTask) Reset() { t.Logs = nil t.TraceFroms = nil t.TraceTos = nil + t.Error = nil + t.Failed = false + return t } // TxTaskQueue non-thread-safe priority-queue diff --git a/core/state_transition.go b/core/state_transition.go index fdda38bd87c..feadff5e892 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -62,6 +62,9 @@ The state transitioning model does all the necessary work to work out a valid ne 5) Run Script section 6) Derive new state root */ + +var ErrStateTransitionFailed = errors.New("state transitaion failed") + type StateTransition struct { gp *GasPool msg Message @@ -209,7 +212,11 @@ func (st *StateTransition) buyGas(gasBailout bool) error { } } } - if have, want := st.state.GetBalance(st.msg.From()), balanceCheck; have.Cmp(want) < 0 { + balance, err := st.state.GetBalance(st.msg.From()) + if err != nil { + return err + } + if have, want := balance, balanceCheck; have.Cmp(want) < 0 { return fmt.Errorf("%w: address %v have %v want %v", ErrInsufficientFunds, st.msg.From().Hex(), have, want) } st.state.SubBalance(st.msg.From(), gasVal, tracing.BalanceDecreaseGasBuy) @@ -241,7 +248,10 @@ func CheckEip1559TxGasFeeCap(from libcommon.Address, gasFeeCap, tip, baseFee *ui func (st *StateTransition) preCheck(gasBailout bool) error { // Make sure this transaction's nonce is correct. if st.msg.CheckNonce() { - stNonce := st.state.GetNonce(st.msg.From()) + stNonce, err := st.state.GetNonce(st.msg.From()) + if err != nil { + return fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } if msgNonce := st.msg.Nonce(); stNonce < msgNonce { return fmt.Errorf("%w: address %v, tx: %d state: %d", ErrNonceTooHigh, st.msg.From().Hex(), msgNonce, stNonce) @@ -254,13 +264,21 @@ func (st *StateTransition) preCheck(gasBailout bool) error { } // Make sure the sender is an EOA (EIP-3607) - if codeHash := st.state.GetCodeHash(st.msg.From()); codeHash != emptyCodeHash && codeHash != (libcommon.Hash{}) { + codeHash, err := st.state.GetCodeHash(st.msg.From()) + if err != nil { + return fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } + if codeHash != emptyCodeHash && codeHash != (libcommon.Hash{}) { // libcommon.Hash{} means that the sender is not in the state. // Historically there were transactions with 0 gas price and non-existing sender, // so we have to allow that. // eip-7702 allows tx origination from accounts having delegated designation code. - if _, ok := st.state.GetDelegatedDesignation(st.msg.From()); !ok { + _, ok, err := st.state.GetDelegatedDesignation(st.msg.From()) + if err != nil { + return fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } + if ok { return fmt.Errorf("%w: address %v, codehash: %s", ErrSenderNoEOA, st.msg.From().Hex(), codeHash) } @@ -307,8 +325,16 @@ func (st *StateTransition) preCheck(gasBailout bool) error { // nil evm execution result. func (st *StateTransition) TransitionDb(refunds bool, gasBailout bool) (*evmtypes.ExecutionResult, error) { coinbase := st.evm.Context.Coinbase - senderInitBalance := st.state.GetBalance(st.msg.From()).Clone() - coinbaseInitBalance := st.state.GetBalance(coinbase).Clone() + senderInitBalance, err := st.state.GetBalance(st.msg.From()) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } + senderInitBalance = senderInitBalance.Clone() + coinbaseInitBalance, err := st.state.GetBalance(coinbase) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } + coinbaseInitBalance = coinbaseInitBalance.Clone() // First check this message satisfies all consensus rules before // applying the message. The rules include these clauses @@ -341,7 +367,11 @@ func (st *StateTransition) TransitionDb(refunds bool, gasBailout bool) (*evmtype if !contractCreation { // Increment the nonce for the next transaction - st.state.SetNonce(msg.From(), st.state.GetNonce(sender.Address())+1) + nonce, err := st.state.GetNonce(sender.Address()) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } + st.state.SetNonce(msg.From(), nonce+1) } // set code tx @@ -375,37 +405,57 @@ func (st *StateTransition) TransitionDb(refunds bool, gasBailout bool) (*evmtype // authority is added to accessed_address in prepare step // 4. authority code should be empty or already delegated - if codeHash := st.state.GetCodeHash(authority); codeHash != emptyCodeHash && codeHash != (libcommon.Hash{}) { + codeHash, err := st.state.GetCodeHash(authority) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } + if codeHash != emptyCodeHash && codeHash != (libcommon.Hash{}) { // check for delegation - if _, ok := st.state.GetDelegatedDesignation(authority); ok { - // noop: has delegated designation - } else { + _, ok, err := st.state.GetDelegatedDesignation(authority) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } + if !ok { log.Debug("authority code is not empty or not delegated, skipping", "auth index", i) continue } + // noop: has delegated designation } // 5. nonce check - authorityNonce := st.state.GetNonce(authority) + authorityNonce, err := st.state.GetNonce(authority) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } if authorityNonce != auth.Nonce { log.Debug("invalid nonce, skipping", "auth index", i) continue } // 6. Add PER_EMPTY_ACCOUNT_COST - PER_AUTH_BASE_COST gas to the global refund counter if authority exists in the trie. - if st.state.Exist(authority) { + exists, err := st.state.Exist(authority) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } + if exists { st.state.AddRefund(fixedgas.PerEmptyAccountCost - fixedgas.PerAuthBaseCost) } // 7. set authority code if auth.Address == (libcommon.Address{}) { - st.state.SetCode(authority, nil) + if err := st.state.SetCode(authority, nil); err != nil { + return nil, fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } } else { - st.state.SetCode(authority, types.AddressToDelegation(auth.Address)) + if err := st.state.SetCode(authority, types.AddressToDelegation(auth.Address)); err != nil { + return nil, fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } } // 8. increase the nonce of authority - st.state.SetNonce(authority, authorityNonce+1) + if err := st.state.SetNonce(authority, authorityNonce+1); err != nil { + return nil, fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } } } @@ -422,7 +472,11 @@ func (st *StateTransition) TransitionDb(refunds bool, gasBailout bool) (*evmtype var bailout bool // Gas bailout (for trace_call) should only be applied if there is not sufficient balance to perform value transfer if gasBailout { - if !msg.Value().IsZero() && !st.evm.Context.CanTransfer(st.state, msg.From(), msg.Value()) { + canTransfer, err := st.evm.Context.CanTransfer(st.state, msg.From(), msg.Value()) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } + if !msg.Value().IsZero() && !canTransfer { bailout = true } } @@ -435,8 +489,9 @@ func (st *StateTransition) TransitionDb(refunds bool, gasBailout bool) (*evmtype // Execute the preparatory steps for state transition which includes: // - prepare accessList(post-berlin; eip-7702) // - reset transient storage(eip 1153) - st.state.Prepare(rules, msg.From(), coinbase, msg.To(), vm.ActivePrecompiles(rules), accessTuples, verifiedAuthorities) - + if err = st.state.Prepare(rules, msg.From(), coinbase, msg.To(), vm.ActivePrecompiles(rules), accessTuples, verifiedAuthorities); err != nil { + return nil, fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } var ( ret []byte vmerr error // vm errors do not effect consensus and are therefore not assigned to err @@ -469,7 +524,9 @@ func (st *StateTransition) TransitionDb(refunds bool, gasBailout bool) (*evmtype } amount := new(uint256.Int).SetUint64(st.gasUsed()) amount.Mul(amount, effectiveTip) // gasUsed * effectiveTip = how much goes to the block producer (miner, validator) - st.state.AddBalance(coinbase, amount, tracing.BalanceIncreaseRewardTransactionFee) + if err := st.state.AddBalance(coinbase, amount, tracing.BalanceIncreaseRewardTransactionFee); err != nil { + return nil, fmt.Errorf("%w: %w", ErrStateTransitionFailed, err) + } if !msg.IsFree() && rules.IsLondon { burntContractAddress := st.evm.ChainConfig().GetBurntContract(st.evm.Context.BlockNumber) if burntContractAddress != nil { diff --git a/core/vm/eips.go b/core/vm/eips.go index e2d17673e21..0625ba8a8d5 100644 --- a/core/vm/eips.go +++ b/core/vm/eips.go @@ -95,7 +95,10 @@ func enable1884(jt *JumpTable) { } func opSelfBalance(pc *uint64, interpreter *EVMInterpreter, callContext *ScopeContext) ([]byte, error) { - balance := interpreter.evm.IntraBlockState().GetBalance(callContext.Contract.Address()) + balance, err := interpreter.evm.IntraBlockState().GetBalance(callContext.Contract.Address()) + if err != nil { + return nil, err + } callContext.Stack.Push(balance) return nil, nil } diff --git a/core/vm/errors.go b/core/vm/errors.go index ce8ff51f1eb..b8fbee9adc8 100644 --- a/core/vm/errors.go +++ b/core/vm/errors.go @@ -49,6 +49,10 @@ var ( // errStopToken is an internal token indicating interpreter loop termination, // never returned to outside callers. errStopToken = errors.New("stop token") + // + // ErrIntraBlockStateFailed indicates a fatal error when processing IBS + // requests + ErrIntraBlockStateFailed = errors.New("ibs fatal error") ) // ErrStackUnderflow wraps an evm error when the items on the stack less diff --git a/core/vm/evm.go b/core/vm/evm.go index 80812b97b05..7b09c92f98f 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -20,6 +20,7 @@ package vm import ( + "fmt" "sync/atomic" "github.com/holiman/uint256" @@ -189,7 +190,11 @@ func (evm *EVM) call(typ OpCode, caller ContractRef, addr libcommon.Address, inp } if typ == CALL || typ == CALLCODE { // Fail if we're trying to transfer more than the available balance - if !value.IsZero() && !evm.Context.CanTransfer(evm.intraBlockState, caller.Address(), value) { + canTransfer, err := evm.Context.CanTransfer(evm.intraBlockState, caller.Address(), value) + if err != nil { + return nil, 0, err + } + if !value.IsZero() && !canTransfer { if !bailout { return nil, gas, ErrInsufficientBalance } @@ -198,13 +203,20 @@ func (evm *EVM) call(typ OpCode, caller ContractRef, addr libcommon.Address, inp p, isPrecompile := evm.precompile(addr) var code []byte if !isPrecompile { - code = evm.intraBlockState.ResolveCode(addr) + code, err = evm.intraBlockState.ResolveCode(addr) + if err != nil { + return nil, 0, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err) + } } snapshot := evm.intraBlockState.Snapshot() if typ == CALL { - if !evm.intraBlockState.Exist(addr) { + exist, err := evm.intraBlockState.Exist(addr) + if err != nil { + return nil, 0, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err) + } + if !exist { if !isPrecompile && evm.chainRules.IsSpuriousDragon && value.IsZero() { if evm.config.Debug { v := value @@ -270,7 +282,11 @@ func (evm *EVM) call(typ OpCode, caller ContractRef, addr libcommon.Address, inp addrCopy := addr // Initialise a new contract and set the code that is to be used by the EVM. // The contract is a scoped environment for this execution context only. - codeHash := evm.intraBlockState.ResolveCodeHash(addrCopy) + var codeHash libcommon.Hash + codeHash, err = evm.intraBlockState.ResolveCodeHash(addrCopy) + if err != nil { + return nil, 0, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err) + } var contract *Contract if typ == CALLCODE { contract = NewContract(caller, caller.Address(), value, gas, evm.config.SkipAnalysis, evm.JumpDestCache) @@ -385,14 +401,21 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gasRemainin err = ErrDepth return nil, libcommon.Address{}, gasRemaining, err } - if !evm.Context.CanTransfer(evm.intraBlockState, caller.Address(), value) { + canTransfer, err := evm.Context.CanTransfer(evm.intraBlockState, caller.Address(), value) + if err != nil { + return nil, libcommon.Address{}, 0, err + } + if !canTransfer { if !bailout { err = ErrInsufficientBalance return nil, libcommon.Address{}, gasRemaining, err } } if incrementNonce { - nonce := evm.intraBlockState.GetNonce(caller.Address()) + nonce, err := evm.intraBlockState.GetNonce(caller.Address()) + if err != nil { + return nil, libcommon.Address{}, 0, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err) + } if nonce+1 < nonce { err = ErrNonceUintOverflow return nil, libcommon.Address{}, gasRemaining, err @@ -405,8 +428,15 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gasRemainin evm.intraBlockState.AddAddressToAccessList(address) } // Ensure there's no existing contract already at the designated address - contractHash := evm.intraBlockState.ResolveCodeHash(address) - if evm.intraBlockState.GetNonce(address) != 0 || (contractHash != (libcommon.Hash{}) && contractHash != trie.EmptyCodeHash) { + contractHash, err := evm.intraBlockState.ResolveCodeHash(address) + if err != nil { + return nil, libcommon.Address{}, 0, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err) + } + nonce, err := evm.intraBlockState.GetNonce(address) + if err != nil { + return nil, libcommon.Address{}, 0, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err) + } + if nonce != 0 || (contractHash != (libcommon.Hash{}) && contractHash != trie.EmptyCodeHash) { err = ErrContractAddressCollision return nil, libcommon.Address{}, 0, err } @@ -481,7 +511,11 @@ func (evm *EVM) maxCodeSize() int { // Create creates a new contract using code as deployment code. // DESCRIBED: docs/programmers_guide/guide.md#nonce func (evm *EVM) Create(caller ContractRef, code []byte, gasRemaining uint64, endowment *uint256.Int, bailout bool) (ret []byte, contractAddr libcommon.Address, leftOverGas uint64, err error) { - contractAddr = crypto.CreateAddress(caller.Address(), evm.intraBlockState.GetNonce(caller.Address())) + nonce, err := evm.intraBlockState.GetNonce(caller.Address()) + if err != nil { + return nil, libcommon.Address{}, 0, err + } + contractAddr = crypto.CreateAddress(caller.Address(), nonce) return evm.create(caller, &codeAndHash{code: code}, gasRemaining, endowment, contractAddr, CREATE, true /* incrementNonce */, bailout) } diff --git a/core/vm/evmtypes/evmtypes.go b/core/vm/evmtypes/evmtypes.go index 775c4600acd..8e1e46fd271 100644 --- a/core/vm/evmtypes/evmtypes.go +++ b/core/vm/evmtypes/evmtypes.go @@ -103,10 +103,10 @@ func (result *ExecutionResult) Revert() []byte { type ( // CanTransferFunc is the signature of a transfer guard function - CanTransferFunc func(IntraBlockState, common.Address, *uint256.Int) bool + CanTransferFunc func(IntraBlockState, common.Address, *uint256.Int) (bool, error) // TransferFunc is the signature of a transfer function - TransferFunc func(IntraBlockState, common.Address, common.Address, *uint256.Int, bool) + TransferFunc func(IntraBlockState, common.Address, common.Address, *uint256.Int, bool) error // GetHashFunc returns the nth block hash in the blockchain // and is used by the BLOCKHASH EVM op code. @@ -119,50 +119,50 @@ type ( // IntraBlockState is an EVM database for full state querying. type IntraBlockState interface { - CreateAccount(common.Address, bool) + CreateAccount(common.Address, bool) error - SubBalance(common.Address, *uint256.Int, tracing.BalanceChangeReason) - AddBalance(common.Address, *uint256.Int, tracing.BalanceChangeReason) - GetBalance(common.Address) *uint256.Int + SubBalance(common.Address, *uint256.Int, tracing.BalanceChangeReason) error + AddBalance(common.Address, *uint256.Int, tracing.BalanceChangeReason) error + GetBalance(common.Address) (*uint256.Int, error) - GetNonce(common.Address) uint64 - SetNonce(common.Address, uint64) + GetNonce(common.Address) (uint64, error) + SetNonce(common.Address, uint64) error - GetCodeHash(common.Address) common.Hash - GetCode(common.Address) []byte - SetCode(common.Address, []byte) - GetCodeSize(common.Address) int + GetCodeHash(common.Address) (common.Hash, error) + GetCode(common.Address) ([]byte, error) + SetCode(common.Address, []byte) error + GetCodeSize(common.Address) (int, error) // eip-7702; delegated designations - ResolveCodeHash(common.Address) common.Hash - ResolveCode(common.Address) []byte - ResolveCodeSize(common.Address) int - GetDelegatedDesignation(common.Address) (common.Address, bool) + ResolveCodeHash(common.Address) (common.Hash, error) + ResolveCode(common.Address) ([]byte, error) + ResolveCodeSize(common.Address) (int, error) + GetDelegatedDesignation(common.Address) (common.Address, bool, error) AddRefund(uint64) SubRefund(uint64) GetRefund() uint64 - GetCommittedState(common.Address, *common.Hash, *uint256.Int) - GetState(address common.Address, slot *common.Hash, outValue *uint256.Int) - SetState(common.Address, *common.Hash, uint256.Int) + GetCommittedState(common.Address, *common.Hash, *uint256.Int) error + GetState(address common.Address, slot *common.Hash, outValue *uint256.Int) error + SetState(common.Address, *common.Hash, uint256.Int) error GetTransientState(addr common.Address, key common.Hash) uint256.Int SetTransientState(addr common.Address, key common.Hash, value uint256.Int) - Selfdestruct(common.Address) bool - HasSelfdestructed(common.Address) bool - Selfdestruct6780(common.Address) + Selfdestruct(common.Address) (bool, error) + HasSelfdestructed(common.Address) (bool, error) + Selfdestruct6780(common.Address) error // Exist reports whether the given account exists in state. // Notably this should also return true for suicided accounts. - Exist(common.Address) bool + Exist(common.Address) (bool, error) // Empty returns whether the given account is empty. Empty // is defined according to EIP161 (balance = nonce = code = 0). - Empty(common.Address) bool + Empty(common.Address) (bool, error) Prepare(rules *chain.Rules, sender, coinbase common.Address, dest *common.Address, - precompiles []common.Address, txAccesses types.AccessList, authorities []common.Address) + precompiles []common.Address, txAccesses types.AccessList, authorities []common.Address) error AddressInAccessList(addr common.Address) bool // AddAddressToAccessList adds the given address to the access list. This operation is safe to perform diff --git a/core/vm/gas_table.go b/core/vm/gas_table.go index ef38856ccfc..7d98f49529c 100644 --- a/core/vm/gas_table.go +++ b/core/vm/gas_table.go @@ -391,11 +391,21 @@ func gasCall(evm *EVM, contract *Contract, stack *stack.Stack, mem *Memory, memo address = libcommon.Address(stack.Back(1).Bytes20()) ) if evm.ChainRules().IsSpuriousDragon { - if transfersValue && evm.IntraBlockState().Empty(address) { + empty, err := evm.IntraBlockState().Empty(address) + if err != nil { + return 0, err + } + if transfersValue && empty { + gas += params.CallNewAccountGas + } + } else { + exists, err := evm.IntraBlockState().Exist(address) + if err != nil { + return 0, err + } + if !exists { gas += params.CallNewAccountGas } - } else if !evm.IntraBlockState().Exist(address) { - gas += params.CallNewAccountGas } if transfersValue { gas += params.CallValueTransferGas @@ -499,15 +509,33 @@ func gasSelfdestruct(evm *EVM, contract *Contract, stack *stack.Stack, mem *Memo if evm.ChainRules().IsSpuriousDragon { // if empty and transfers value - if evm.IntraBlockState().Empty(address) && !evm.IntraBlockState().GetBalance(contract.Address()).IsZero() { + empty, err := evm.IntraBlockState().Empty(address) + if err != nil { + return 0, err + } + balance, err := evm.IntraBlockState().GetBalance(contract.Address()) + if err != nil { + return 0, err + } + if empty && !balance.IsZero() { + gas += params.CreateBySelfdestructGas + } + } else { + exist, err := evm.IntraBlockState().Exist(address) + if err != nil { + return 0, err + } + if !exist { gas += params.CreateBySelfdestructGas } - } else if !evm.IntraBlockState().Exist(address) { - gas += params.CreateBySelfdestructGas } } - if !evm.IntraBlockState().HasSelfdestructed(contract.Address()) { + hasSelfdestructed, err := evm.IntraBlockState().HasSelfdestructed(contract.Address()) + if err != nil { + return 0, err + } + if !hasSelfdestructed { evm.IntraBlockState().AddRefund(params.SelfdestructRefundGas) } return gas, nil diff --git a/core/vm/gas_table_test.go b/core/vm/gas_table_test.go index 4703b81f87f..fc33308a2eb 100644 --- a/core/vm/gas_table_test.go +++ b/core/vm/gas_table_test.go @@ -144,8 +144,10 @@ func TestEIP2200(t *testing.T) { _ = s.CommitBlock(params.AllProtocolChanges.Rules(0, 0), w) vmctx := evmtypes.BlockContext{ - CanTransfer: func(evmtypes.IntraBlockState, libcommon.Address, *uint256.Int) bool { return true }, - Transfer: func(evmtypes.IntraBlockState, libcommon.Address, libcommon.Address, *uint256.Int, bool) {}, + CanTransfer: func(evmtypes.IntraBlockState, libcommon.Address, *uint256.Int) (bool, error) { return true, nil }, + Transfer: func(evmtypes.IntraBlockState, libcommon.Address, libcommon.Address, *uint256.Int, bool) error { + return nil + }, } vmenv := vm.NewEVM(vmctx, evmtypes.TxContext{}, s, params.AllProtocolChanges, vm.Config{ExtraEips: []int{2200}}) @@ -207,8 +209,10 @@ func TestCreateGas(t *testing.T) { _ = s.CommitBlock(params.TestChainConfig.Rules(0, 0), stateWriter) vmctx := evmtypes.BlockContext{ - CanTransfer: func(evmtypes.IntraBlockState, libcommon.Address, *uint256.Int) bool { return true }, - Transfer: func(evmtypes.IntraBlockState, libcommon.Address, libcommon.Address, *uint256.Int, bool) {}, + CanTransfer: func(evmtypes.IntraBlockState, libcommon.Address, *uint256.Int) (bool, error) { return true, nil }, + Transfer: func(evmtypes.IntraBlockState, libcommon.Address, libcommon.Address, *uint256.Int, bool) error { + return nil + }, } config := vm.Config{} if tt.eip3860 { diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 17ccb4ae4ef..a3bb8d7a316 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -288,7 +288,11 @@ func opAddress(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([] func opBalance(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { slot := scope.Stack.Peek() address := libcommon.Address(slot.Bytes20()) - slot.Set(interpreter.evm.IntraBlockState().GetBalance(address)) + balance, err := interpreter.evm.IntraBlockState().GetBalance(address) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err) + } + slot.Set(balance) return nil, nil } @@ -372,7 +376,11 @@ func opReturnDataCopy(pc *uint64, interpreter *EVMInterpreter, scope *ScopeConte func opExtCodeSize(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { slot := scope.Stack.Peek() - slot.SetUint64(uint64(interpreter.evm.IntraBlockState().ResolveCodeSize(slot.Bytes20()))) + codeSize, err := interpreter.evm.IntraBlockState().ResolveCodeSize(slot.Bytes20()) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err) + } + slot.SetUint64(uint64(codeSize)) return nil, nil } @@ -409,7 +417,11 @@ func opExtCodeCopy(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) addr := libcommon.Address(a.Bytes20()) len64 := length.Uint64() - codeCopy := getDataBig(interpreter.evm.IntraBlockState().ResolveCode(addr), &codeOffset, len64) + code, err := interpreter.evm.IntraBlockState().ResolveCode(addr) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrIntraBlockStateFailed, err) + } + codeCopy := getDataBig(code, &codeOffset, len64) scope.Memory.Set(memOffset.Uint64(), len64, codeCopy) return nil, nil } @@ -455,10 +467,18 @@ func opExtCodeHash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) slot := scope.Stack.Peek() address := libcommon.Address(slot.Bytes20()) - if interpreter.evm.IntraBlockState().Empty(address) { + empty, err := interpreter.evm.IntraBlockState().Empty(address) + if err != nil { + return nil, err + } + if empty { slot.Clear() } else { - slot.SetBytes(interpreter.evm.IntraBlockState().ResolveCodeHash(address).Bytes()) + codeHash, err := interpreter.evm.IntraBlockState().ResolveCodeHash(address) + if err != nil { + return nil, err + } + slot.SetBytes(codeHash.Bytes()) } return nil, nil } @@ -560,8 +580,7 @@ func opMstore8(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([] func opSload(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { loc := scope.Stack.Peek() interpreter.hasherBuf = loc.Bytes32() - interpreter.evm.IntraBlockState().GetState(scope.Contract.Address(), &interpreter.hasherBuf, loc) - return nil, nil + return nil, interpreter.evm.IntraBlockState().GetState(scope.Contract.Address(), &interpreter.hasherBuf, loc) } func opSstore(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { @@ -571,8 +590,7 @@ func opSstore(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]b loc := scope.Stack.Pop() val := scope.Stack.Pop() interpreter.hasherBuf = loc.Bytes32() - interpreter.evm.IntraBlockState().SetState(scope.Contract.Address(), &interpreter.hasherBuf, val) - return nil, nil + return nil, interpreter.evm.IntraBlockState().SetState(scope.Contract.Address(), &interpreter.hasherBuf, val) } func opJump(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { @@ -880,7 +898,10 @@ func opSelfdestruct(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext beneficiary := scope.Stack.Pop() callerAddr := scope.Contract.Address() beneficiaryAddr := libcommon.Address(beneficiary.Bytes20()) - balance := interpreter.evm.IntraBlockState().GetBalance(callerAddr) + balance, err := interpreter.evm.IntraBlockState().GetBalance(callerAddr) + if err != nil { + return nil, err + } if interpreter.evm.Config().Debug { if interpreter.cfg.Debug { interpreter.cfg.Tracer.CaptureEnter(SELFDESTRUCT, callerAddr, beneficiaryAddr, false /* precompile */, false /* create */, []byte{}, 0, balance, nil /* code */) @@ -899,7 +920,11 @@ func opSelfdestruct6780(pc *uint64, interpreter *EVMInterpreter, scope *ScopeCon beneficiary := scope.Stack.Pop() callerAddr := scope.Contract.Address() beneficiaryAddr := libcommon.Address(beneficiary.Bytes20()) - balance := *interpreter.evm.IntraBlockState().GetBalance(callerAddr) + pbalance, err := interpreter.evm.IntraBlockState().GetBalance(callerAddr) + if err != nil { + return nil, err + } + balance := *pbalance interpreter.evm.IntraBlockState().SubBalance(callerAddr, &balance, tracing.BalanceDecreaseSelfdestruct) interpreter.evm.IntraBlockState().AddBalance(beneficiaryAddr, &balance, tracing.BalanceIncreaseSelfdestruct) interpreter.evm.IntraBlockState().Selfdestruct6780(callerAddr) diff --git a/core/vm/operations_acl.go b/core/vm/operations_acl.go index a8c3fec9b33..fe1817e8013 100644 --- a/core/vm/operations_acl.go +++ b/core/vm/operations_acl.go @@ -231,10 +231,22 @@ func makeSelfdestructGasFn(refundsEnabled bool) gasFunc { gas = params.ColdAccountAccessCostEIP2929 } // if empty and transfers value - if evm.IntraBlockState().Empty(address) && !evm.IntraBlockState().GetBalance(contract.Address()).IsZero() { + empty, err := evm.IntraBlockState().Empty(address) + if err != nil { + return 0, err + } + balance, err := evm.IntraBlockState().GetBalance(contract.Address()) + if err != nil { + return 0, err + } + if empty && !balance.IsZero() { gas += params.CreateBySelfdestructGas } - if refundsEnabled && !evm.IntraBlockState().HasSelfdestructed(contract.Address()) { + hasSelfdestructed, err := evm.IntraBlockState().HasSelfdestructed(contract.Address()) + if err != nil { + return 0, err + } + if refundsEnabled && !hasSelfdestructed { evm.IntraBlockState().AddRefund(params.SelfdestructRefundGas) } return gas, nil @@ -266,7 +278,11 @@ func makeCallVariantGasCallEIP7702(oldCalculator gasFunc) gasFunc { } // Check if code is a delegation and if so, charge for resolution. - if dd, ok := evm.intraBlockState.GetDelegatedDesignation(addr); ok { + dd, ok, err := evm.intraBlockState.GetDelegatedDesignation(addr) + if err != nil { + return 0, err + } + if ok { var ddCost uint64 if evm.intraBlockState.AddAddressToAccessList(dd) { ddCost = params.ColdAccountAccessCostEIP2929 @@ -311,8 +327,11 @@ func gasEip7702CodeCheck(evm *EVM, contract *Contract, stack *stack.Stack, mem * // Check if code is a delegation and if so, charge for resolution cost = params.ColdAccountAccessCostEIP2929 - params.WarmStorageReadCostEIP2929 } - - if dd, ok := evm.intraBlockState.GetDelegatedDesignation(addr); ok { + dd, ok, err := evm.intraBlockState.GetDelegatedDesignation(addr) + if err != nil { + return 0, err + } + if ok { if evm.intraBlockState.AddAddressToAccessList(dd) { cost += params.ColdAccountAccessCostEIP2929 } else { @@ -340,7 +359,11 @@ func gasExtCodeCopyEIP7702(evm *EVM, contract *Contract, stack *stack.Stack, mem } // Check if addr has a delegation and if so, charge for resolution - if dd, ok := evm.intraBlockState.GetDelegatedDesignation(addr); ok { + dd, ok, err := evm.intraBlockState.GetDelegatedDesignation(addr) + if err != nil { + return 0, err + } + if ok { var overflow bool if evm.intraBlockState.AddAddressToAccessList(dd) { if gas, overflow = math.SafeAdd(gas, params.ColdAccountAccessCostEIP2929); overflow { diff --git a/core/vm/runtime/runtime.go b/core/vm/runtime/runtime.go index 5515933f389..77748306170 100644 --- a/core/vm/runtime/runtime.go +++ b/core/vm/runtime/runtime.go @@ -244,7 +244,10 @@ func Call(address libcommon.Address, input []byte, cfg *Config) ([]byte, uint64, vmenv := NewEnv(cfg) - sender := cfg.State.GetOrNewStateObject(cfg.Origin) + sender, err := cfg.State.GetOrNewStateObject(cfg.Origin) + if err != nil { + return nil, 0, err + } statedb := cfg.State rules := vmenv.ChainRules() statedb.Prepare(rules, cfg.Origin, cfg.Coinbase, &address, vm.ActivePrecompiles(rules), nil, nil) diff --git a/eth/stagedsync/exec3.go b/eth/stagedsync/exec3.go index 3ccd0880007..2303490f3f4 100644 --- a/eth/stagedsync/exec3.go +++ b/eth/stagedsync/exec3.go @@ -132,6 +132,71 @@ func (p *Progress) Log(suffix string, rs *state.StateV3, in *state.QueueWithRetr p.prevRepeatCount = repeatCount } +// Cases: +// 1. Snapshots > ExecutionStage: snapshots can have half-block data `10.4`. Get right txNum from SharedDomains (after SeekCommitment) +// 2. ExecutionStage > Snapshots: no half-block data possible. Rely on DB. +func restoreTxNum(ctx context.Context, cfg *ExecuteBlockCfg, applyTx kv.Tx, doms *state2.SharedDomains, maxBlockNum uint64) ( + inputTxNum uint64, maxTxNum uint64, offsetFromBlockBeginning uint64, err error) { + + txNumsReader := rawdbv3.TxNums.WithCustomReadTxNumFunc(freezeblocks.ReadTxNumFuncFromBlockReader(ctx, cfg.blockReader)) + + inputTxNum = doms.TxNum() + + if nothing, err := nothingToExec(applyTx, txNumsReader, inputTxNum); err != nil { + return 0, 0, 0, err + } else if nothing { + return 0, 0, 0, err + } + + maxTxNum, err = txNumsReader.Max(applyTx, maxBlockNum) + if err != nil { + return 0, 0, 0, err + } + + ok, _blockNum, err := txNumsReader.FindBlockNum(applyTx, doms.TxNum()) + if err != nil { + return 0, 0, 0, err + } + if !ok { + _lb, _lt, _ := txNumsReader.Last(applyTx) + _fb, _ft, _ := txNumsReader.First(applyTx) + return 0, 0, 0, fmt.Errorf("seems broken TxNums index not filled. can't find blockNum of txNum=%d; in db: (%d-%d, %d-%d)", inputTxNum, _fb, _lb, _ft, _lt) + } + { + _max, _ := txNumsReader.Max(applyTx, _blockNum) + if doms.TxNum() == _max { + _blockNum++ + } + } + + _min, err := txNumsReader.Min(applyTx, _blockNum) + if err != nil { + return 0, 0, 0, err + } + + if doms.TxNum() > _min { + // if stopped in the middle of the block: start from beginning of block. + // first part will be executed in HistoryExecution mode + offsetFromBlockBeginning = doms.TxNum() - _min + } + + inputTxNum = _min + + //_max, _ := txNumsReader.Max(applyTx, blockNum) + //fmt.Printf("[commitment] found domain.txn %d, inputTxn %d, offset %d. DB found block %d {%d, %d}\n", doms.TxNum(), inputTxNum, offsetFromBlockBeginning, blockNum, _min, _max) + doms.SetBlockNum(_blockNum) + doms.SetTxNum(inputTxNum) + return inputTxNum, maxTxNum, offsetFromBlockBeginning, nil +} + +func nothingToExec(applyTx kv.Tx, txNumsReader rawdbv3.TxNumsReader, inputTxNum uint64) (bool, error) { + _, lastTxNum, err := txNumsReader.Last(applyTx) + if err != nil { + return false, err + } + return lastTxNum == inputTxNum, nil +} + func ExecV3(ctx context.Context, execStage *StageState, u Unwinder, workerCount int, cfg ExecuteBlockCfg, txc wrap.TxContainer, parallel bool, //nolint @@ -198,100 +263,17 @@ func ExecV3(ctx context.Context, } txNumInDB := doms.TxNum() - txNumsReader := rawdbv3.TxNums.WithCustomReadTxNumFunc(freezeblocks.ReadTxNumFuncFromBlockReader(ctx, cfg.blockReader)) - var ( - inputTxNum = doms.TxNum() - stageProgress = execStage.BlockNumber - outputTxNum = atomic.Uint64{} - blockComplete = atomic.Bool{} - + inputTxNum = doms.TxNum() + stageProgress = execStage.BlockNumber + outputTxNum = atomic.Uint64{} + blockComplete = atomic.Bool{} + outputBlockNum = stages.SyncMetrics[stages.Execution] + inputBlockNum = &atomic.Uint64{} offsetFromBlockBeginning uint64 blockNum, maxTxNum uint64 ) - blockComplete.Store(true) - nothingToExec := func(applyTx kv.Tx) (bool, error) { - _, lastTxNum, err := txNumsReader.Last(applyTx) - if err != nil { - return false, err - } - return lastTxNum == inputTxNum, nil - } - // Cases: - // 1. Snapshots > ExecutionStage: snapshots can have half-block data `10.4`. Get right txNum from SharedDomains (after SeekCommitment) - // 2. ExecutionStage > Snapshots: no half-block data possible. Rely on DB. - restoreTxNum := func(applyTx kv.Tx) error { - var err error - maxTxNum, err = txNumsReader.Max(applyTx, maxBlockNum) - if err != nil { - return err - } - ok, _blockNum, err := txNumsReader.FindBlockNum(applyTx, doms.TxNum()) - if err != nil { - return err - } - if !ok { - _lb, _lt, _ := txNumsReader.Last(applyTx) - _fb, _ft, _ := txNumsReader.First(applyTx) - return fmt.Errorf("seems broken TxNums index not filled. can't find blockNum of txNum=%d; in db: (%d-%d, %d-%d)", inputTxNum, _fb, _lb, _ft, _lt) - } - { - _max, _ := txNumsReader.Max(applyTx, _blockNum) - if doms.TxNum() == _max { - _blockNum++ - } - } - - _min, err := txNumsReader.Min(applyTx, _blockNum) - if err != nil { - return err - } - - if doms.TxNum() > _min { - // if stopped in the middle of the block: start from beginning of block. - // first part will be executed in HistoryExecution mode - offsetFromBlockBeginning = doms.TxNum() - _min - } - - inputTxNum = _min - outputTxNum.Store(inputTxNum) - - //_max, _ := txNumsReader.Max(applyTx, blockNum) - //fmt.Printf("[commitment] found domain.txn %d, inputTxn %d, offset %d. DB found block %d {%d, %d}\n", doms.TxNum(), inputTxNum, offsetFromBlockBeginning, blockNum, _min, _max) - doms.SetBlockNum(_blockNum) - doms.SetTxNum(inputTxNum) - return nil - } - if applyTx != nil { - if _nothing, err := nothingToExec(applyTx); err != nil { - return err - } else if _nothing { - return nil - } - - if err := restoreTxNum(applyTx); err != nil { - return err - } - } else { - var _nothing bool - if err := cfg.db.View(ctx, func(tx kv.Tx) (err error) { - if _nothing, err = nothingToExec(applyTx); err != nil { - return err - } else if _nothing { - return nil - } - - return restoreTxNum(applyTx) - }); err != nil { - return err - } - if _nothing { - return nil - } - } - - ts := time.Duration(0) blockNum = doms.BlockNum() outputTxNum.Store(doms.TxNum()) @@ -311,8 +293,6 @@ func ExecV3(ctx context.Context, agg.BuildFilesInBackground(outputTxNum.Load()) - var outputBlockNum = stages.SyncMetrics[stages.Execution] - inputBlockNum := &atomic.Uint64{} var count uint64 shouldReportToTxPool := cfg.notifications != nil && !isMining && maxBlockNum <= blockNum+64 @@ -329,22 +309,37 @@ func ExecV3(ctx context.Context, // Now rwLoop closing both (because applyLoop we completely restart) // Maybe need split channels? Maybe don't exit from ApplyLoop? Maybe current way is also ok? - // input queue - in := state.NewQueueWithRetry(100_000) - defer in.Close() + if applyTx != nil { + if inputTxNum, maxTxNum, offsetFromBlockBeginning, err = restoreTxNum(ctx, &cfg, applyTx, doms, maxBlockNum); err != nil { + return err + } + } else { + if err := cfg.db.View(ctx, func(tx kv.Tx) (err error) { + inputTxNum, maxTxNum, offsetFromBlockBeginning, err = restoreTxNum(ctx, &cfg, tx, doms, maxBlockNum) + return err + }); err != nil { + return err + } + } - rwsConsumed := make(chan struct{}, 1) - defer close(rwsConsumed) + if maxTxNum == 0 { + return nil + } applyWorker := cfg.applyWorker if isMining { applyWorker = cfg.applyWorkerMining } - applyWorker.ResetState(rs, accumulator) defer applyWorker.LogLRUStats() + applyWorker.ResetState(rs, accumulator) + commitThreshold := cfg.batchSize.Bytes() + + // TODO are these dups ? + processed := NewProgress(blockNum, commitThreshold, workerCount, true, execStage.LogPrefix(), logger) progress := NewProgress(blockNum, commitThreshold, workerCount, false, execStage.LogPrefix(), logger) + logEvery := time.NewTicker(20 * time.Second) defer logEvery.Stop() pruneEvery := time.NewTicker(2 * time.Second) @@ -352,27 +347,27 @@ func ExecV3(ctx context.Context, var logGas uint64 var stepsInDB float64 - - processed := NewProgress(blockNum, commitThreshold, workerCount, true, execStage.LogPrefix(), logger) - var executor executor if parallel { pe := ¶llelExecutor{ - execStage: execStage, - chainDb: cfg.db, - applyWorker: applyWorker, - applyTx: applyTx, - outputTxNum: &outputTxNum, - in: in, - rs: rs, - agg: agg, - rwsConsumed: rwsConsumed, - isMining: isMining, - inMemExec: inMemExec, + txExecutor: txExecutor{ + cfg: cfg, + execStage: execStage, + rs: rs, + doms: doms, + agg: agg, + accumulator: accumulator, + isMining: isMining, + inMemExec: inMemExec, + applyTx: applyTx, + applyWorker: applyWorker, + outputTxNum: &outputTxNum, + outputBlockNum: stages.SyncMetrics[stages.Execution], + logger: logger, + }, shouldGenerateChangesets: shouldGenerateChangesets, workerCount: workerCount, - accumulator: accumulator, pruneEvery: pruneEvery, logEvery: logEvery, progress: progress, @@ -382,7 +377,7 @@ func ExecV3(ctx context.Context, defer executorCancel() defer func() { - processed.Log("Done", executor.readState(), in, pe.rws, 0 /*txCount - TODO*/, logGas, inputBlockNum.Load(), outputBlockNum.GetValueUint64(), outputTxNum.Load(), mxExecRepeats.GetValueUint64(), stepsInDB, shouldGenerateChangesets, inMemExec) + processed.Log("Done", executor.readState(), nil, pe.rws, 0 /*txCount - TODO*/, logGas, inputBlockNum.Load(), outputBlockNum.GetValueUint64(), outputTxNum.Load(), mxExecRepeats.GetValueUint64(), stepsInDB, shouldGenerateChangesets, inMemExec) }() executor = pe @@ -391,31 +386,47 @@ func ExecV3(ctx context.Context, doms.SetTx(applyTx) se := &serialExecutor{ - cfg: cfg, - execStage: execStage, - rs: rs, - doms: doms, - agg: agg, - u: u, - isMining: isMining, - inMemExec: inMemExec, - applyTx: applyTx, - worker: applyWorker, - outputTxNum: &outputTxNum, - logger: logger, + txExecutor: txExecutor{ + cfg: cfg, + execStage: execStage, + rs: rs, + doms: doms, + agg: agg, + u: u, + isMining: isMining, + inMemExec: inMemExec, + applyTx: applyTx, + applyWorker: applyWorker, + outputTxNum: &outputTxNum, + outputBlockNum: stages.SyncMetrics[stages.Execution], + logger: logger, + }, } defer func() { - processed.Log("Done", executor.readState(), in, nil, se.txCount, logGas, inputBlockNum.Load(), outputBlockNum.GetValueUint64(), outputTxNum.Load(), mxExecRepeats.GetValueUint64(), stepsInDB, shouldGenerateChangesets, inMemExec) + processed.Log("Done", executor.readState(), nil, nil, se.txCount, logGas, inputBlockNum.Load(), outputBlockNum.GetValueUint64(), outputTxNum.Load(), mxExecRepeats.GetValueUint64(), stepsInDB, shouldGenerateChangesets, inMemExec) }() executor = se } - getHeaderFunc := func(hash common.Hash, number uint64) (h *types.Header) { - return executor.getHeader(ctx, hash, number) + blockComplete.Store(true) + + ts := time.Duration(0) + blockNum = executor.domains().BlockNum() + outputTxNum.Store(executor.domains().TxNum()) + + if maxBlockNum < blockNum { + return nil } + if maxBlockNum > blockNum+16 { + log.Info(fmt.Sprintf("[%s] starting", execStage.LogPrefix()), + "from", blockNum, "to", maxBlockNum, "fromTxNum", executor.domains().TxNum(), "offsetFromBlockBeginning", offsetFromBlockBeginning, "initialCycle", initialCycle, "useExternalTx", useExternalTx) + } + + agg.BuildFilesInBackground(outputTxNum.Load()) + var readAhead chan uint64 if !parallel { // snapshots are often stored on chaper drives. don't expect low-read-latency and manually read-ahead. @@ -478,13 +489,12 @@ Loop: skipAnalysis := core.SkipAnalysis(chainConfig, blockNum) signer := *types.MakeSigner(chainConfig, blockNum, header.Time) - f := core.GetHashFn(header, getHeaderFunc) getHashFnMute := &sync.Mutex{} - getHashFn := func(n uint64) common.Hash { + getHashFn := core.GetHashFn(header, func(hash common.Hash, number uint64) (h *types.Header) { getHashFnMute.Lock() defer getHashFnMute.Unlock() - return f(n) - } + return executor.getHeader(ctx, hash, number) + }) totalGasUsed += b.GasUsed() blockContext := core.NewEVMBlockContext(header, getHashFn, cfg.engine, cfg.author /* author */, chainConfig) // print type of engine @@ -492,7 +502,7 @@ Loop: if err := executor.status(ctx, commitThreshold); err != nil { return err } - } else if shouldReportToTxPool { + } else if accumulator != nil { txs, err := blockReader.RawTransactions(context.Background(), executor.tx(), b.NumberU64(), b.NumberU64()) if err != nil { return err @@ -610,9 +620,16 @@ Loop: aggTx := executor.tx().(state2.HasAggTx).AggTx().(*state2.AggregatorRoTx) aggTx.RestrictSubsetFileDeletions(true) start := time.Now() - if _, err := executor.domains().ComputeCommitment(ctx, true, blockNum, execStage.LogPrefix()); err != nil { + _ /*rh*/, err := executor.domains().ComputeCommitment(ctx, true, blockNum, execStage.LogPrefix()) + if err != nil { return err } + + //if !bytes.Equal(rh, header.Root.Bytes()) { + // logger.Error(fmt.Sprintf("[%s] Wrong trie root of block %d: %x, expected (from header): %x. Block hash: %x", execStage.LogPrefix(), header.Number.Uint64(), rh, header.Root.Bytes(), header.Hash())) + // return errors.New("wrong trie root") + //} + ts += time.Since(start) aggTx.RestrictSubsetFileDeletions(false) executor.domains().SavePastChangesetAccumulator(b.Hash(), blockNum, changeset) @@ -637,8 +654,6 @@ Loop: metrics2.UpdateBlockConsumerPostExecutionDelay(b.Time(), blockNum, logger) } - outputBlockNum.SetUint64(blockNum) - select { case <-logEvery.C: if inMemExec || isMining { @@ -646,7 +661,7 @@ Loop: } stepsInDB := rawdbhelpers.IdxStepsCountV3(executor.tx()) - progress.Log("", executor.readState(), in, nil, count, logGas, inputBlockNum.Load(), outputBlockNum.GetValueUint64(), outputTxNum.Load(), mxExecRepeats.GetValueUint64(), stepsInDB, shouldGenerateChangesets, inMemExec) + progress.Log("", executor.readState(), nil, nil, count, logGas, inputBlockNum.Load(), outputBlockNum.GetValueUint64(), outputTxNum.Load(), mxExecRepeats.GetValueUint64(), stepsInDB, shouldGenerateChangesets, inMemExec) //TODO: https://github.com/erigontech/erigon/issues/10724 //if executor.tx().(state2.HasAggTx).AggTx().(*state2.AggregatorRoTx).CanPrune(executor.tx(), outputTxNum.Load()) { @@ -712,6 +727,7 @@ Loop: //log.Info("Executed", "blocks", inputBlockNum.Load(), "txs", outputTxNum.Load(), "repeats", mxExecRepeats.GetValueUint64()) + //fmt.Println("WAIT") executor.wait() if u != nil && !u.HasUnwindPoint() { diff --git a/eth/stagedsync/exec3_parallel.go b/eth/stagedsync/exec3_parallel.go index 4ca19d50142..26d06c369f5 100644 --- a/eth/stagedsync/exec3_parallel.go +++ b/eth/stagedsync/exec3_parallel.go @@ -13,14 +13,16 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/metrics" state2 "github.com/erigontech/erigon-lib/state" "github.com/erigontech/erigon/cmd/state/exec3" "github.com/erigontech/erigon/consensus" + "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/rawdb/rawdbhelpers" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/eth/stagedsync/stages" + "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/turbo/shards" "golang.org/x/sync/errgroup" ) @@ -78,54 +80,48 @@ type executor interface { domains() *state2.SharedDomains } -type parallelExecutor struct { +type txExecutor struct { sync.RWMutex - rwLoopErrCh chan error - rwLoopG *errgroup.Group - applyLoopWg sync.WaitGroup - chainDb kv.RwDB - applyTx kv.RwTx - applyWorker *exec3.Worker - execWorkers []*exec3.Worker - stopWorkers func() - waitWorkers func() - execStage *StageState - cfg ExecuteBlockCfg - lastBlockNum atomic.Uint64 - outputTxNum *atomic.Uint64 - in *state.QueueWithRetry - rws *state.ResultsQueue - rs *state.StateV3 - doms *state2.SharedDomains - agg *state2.Aggregator - rwsConsumed chan struct{} - isMining bool - inMemExec bool - shouldGenerateChangesets bool - accumulator *shards.Accumulator - workerCount int - pruneEvery *time.Ticker - logEvery *time.Ticker - slowDownLimit *time.Ticker - progress *Progress + cfg ExecuteBlockCfg + execStage *StageState + agg *state2.Aggregator + rs *state.StateV3 + doms *state2.SharedDomains + accumulator *shards.Accumulator + u Unwinder + isMining bool + inMemExec bool + applyTx kv.RwTx + applyWorker *exec3.Worker + outputTxNum *atomic.Uint64 + outputBlockNum metrics.Gauge + logger log.Logger } -func (pe *parallelExecutor) tx() kv.RwTx { - return pe.applyTx +func (te *txExecutor) tx() kv.RwTx { + return te.applyTx } -func (pe *parallelExecutor) readState() *state.StateV3 { - return pe.rs +func (te *txExecutor) readState() *state.StateV3 { + return te.rs } -func (pe *parallelExecutor) domains() *state2.SharedDomains { - return pe.doms +func (te *txExecutor) domains() *state2.SharedDomains { + return te.doms } -func (pe *parallelExecutor) getHeader(ctx context.Context, hash common.Hash, number uint64) (h *types.Header) { +func (te *txExecutor) getHeader(ctx context.Context, hash common.Hash, number uint64) (h *types.Header) { var err error - if err = pe.chainDb.View(ctx, func(tx kv.Tx) error { - h, err = pe.cfg.blockReader.Header(ctx, tx, hash, number) + if te.applyTx != nil { + h, err = te.cfg.blockReader.Header(ctx, te.applyTx, hash, number) + if err != nil { + panic(err) + } + return h + } + + if err = te.cfg.db.View(ctx, func(tx kv.Tx) error { + h, err = te.cfg.blockReader.Header(ctx, tx, hash, number) if err != nil { return err } @@ -136,19 +132,39 @@ func (pe *parallelExecutor) getHeader(ctx context.Context, hash common.Hash, num return h } +type parallelExecutor struct { + txExecutor + rwLoopErrCh chan error + rwLoopG *errgroup.Group + applyLoopWg sync.WaitGroup + execWorkers []*exec3.Worker + stopWorkers func() + waitWorkers func() + lastBlockNum atomic.Uint64 + in *state.QueueWithRetry + rws *state.ResultsQueue + rwsConsumed chan struct{} + shouldGenerateChangesets bool + workerCount int + pruneEvery *time.Ticker + logEvery *time.Ticker + slowDownLimit *time.Ticker + progress *Progress +} + func (pe *parallelExecutor) applyLoop(ctx context.Context, maxTxNum uint64, blockComplete *atomic.Bool, errCh chan error) { defer pe.applyLoopWg.Done() defer func() { if rec := recover(); rec != nil { - log.Warn("[dbg] apply loop panic", "rec", rec) + pe.logger.Warn("[dbg] apply loop panic", "rec", rec) } - log.Warn("[dbg] apply loop exit") + pe.logger.Warn("[dbg] apply loop exit") }() - - outputBlockNum := stages.SyncMetrics[stages.Execution] + //fmt.Println("applyLoop started") + //defer fmt.Println("applyLoop done") applyLoopInner := func(ctx context.Context) error { - tx, err := pe.chainDb.BeginRo(ctx) + tx, err := pe.cfg.db.BeginRo(ctx) if err != nil { return err } @@ -161,18 +177,15 @@ func (pe *parallelExecutor) applyLoop(ctx context.Context, maxTxNum uint64, bloc return err } - processedTxNum, conflicts, triggers, processedBlockNum, stoppedAtBlockEnd, err := - pe.processResultQueue(ctx, pe.outputTxNum.Load(), tx, pe.rwsConsumed, true, false) + processedTxNum, conflicts, triggers, _ /*processedBlockNum*/, stoppedAtBlockEnd, err := + pe.processResultQueue(ctx, pe.outputTxNum.Load(), pe.rwsConsumed, true, false) if err != nil { return err } - + //fmt.Println("QR", processedTxNum, conflicts, triggers, processedBlockNum, stoppedAtBlockEnd, err) mxExecRepeats.AddInt(conflicts) mxExecTriggers.AddInt(triggers) - if processedBlockNum > pe.lastBlockNum.Load() { - outputBlockNum.SetUint64(processedBlockNum) - pe.lastBlockNum.Store(processedBlockNum) - } + if processedTxNum > 0 { pe.outputTxNum.Store(processedTxNum) blockComplete.Store(stoppedAtBlockEnd) @@ -195,11 +208,17 @@ func (pe *parallelExecutor) applyLoop(ctx context.Context, maxTxNum uint64, bloc // Maybe need split channels? Maybe don't exit from ApplyLoop? Maybe current way is also ok? func (pe *parallelExecutor) rwLoop(ctx context.Context, maxTxNum uint64, logger log.Logger) error { - tx, err := pe.chainDb.BeginRw(ctx) - if err != nil { - return err + //fmt.Println("rwLoop started", maxTxNum) + //defer fmt.Println("rwLoop done") + + tx := pe.applyTx + if tx == nil { + tx, err := pe.cfg.db.BeginRw(ctx) + if err != nil { + return err + } + defer tx.Rollback() } - defer tx.Rollback() pe.doms.SetTx(tx) @@ -213,8 +232,6 @@ func (pe *parallelExecutor) rwLoop(ctx context.Context, maxTxNum uint64, logger go pe.applyLoop(applyCtx, maxTxNum, &blockComplete, pe.rwLoopErrCh) - outputBlockNum := stages.SyncMetrics[stages.Execution] - for pe.outputTxNum.Load() <= maxTxNum { select { case <-ctx.Done(): @@ -222,16 +239,16 @@ func (pe *parallelExecutor) rwLoop(ctx context.Context, maxTxNum uint64, logger case <-pe.logEvery.C: stepsInDB := rawdbhelpers.IdxStepsCountV3(tx) - pe.progress.Log("", pe.rs, pe.in, pe.rws, pe.rs.DoneCount(), 0 /* TODO logGas*/, pe.lastBlockNum.Load(), outputBlockNum.GetValueUint64(), pe.outputTxNum.Load(), mxExecRepeats.GetValueUint64(), stepsInDB, pe.shouldGenerateChangesets, pe.inMemExec) + pe.progress.Log("", pe.rs, pe.in, pe.rws, pe.rs.DoneCount(), 0 /* TODO logGas*/, pe.lastBlockNum.Load(), pe.outputBlockNum.GetValueUint64(), pe.outputTxNum.Load(), mxExecRepeats.GetValueUint64(), stepsInDB, pe.shouldGenerateChangesets, pe.inMemExec) if pe.agg.HasBackgroundFilesBuild() { logger.Info(fmt.Sprintf("[%s] Background files build", pe.execStage.LogPrefix()), "progress", pe.agg.BackgroundProgress()) } case <-pe.pruneEvery.C: if pe.rs.SizeEstimate() < pe.cfg.batchSize.Bytes() { - if pe.doms.BlockNum() != outputBlockNum.GetValueUint64() { - panic(fmt.Errorf("%d != %d", pe.doms.BlockNum(), outputBlockNum.GetValueUint64())) + if pe.doms.BlockNum() != pe.outputBlockNum.GetValueUint64() { + panic(fmt.Errorf("%d != %d", pe.doms.BlockNum(), pe.outputBlockNum.GetValueUint64())) } - _, err := pe.doms.ComputeCommitment(ctx, true, outputBlockNum.GetValueUint64(), pe.execStage.LogPrefix()) + _, err := pe.doms.ComputeCommitment(ctx, true, pe.outputBlockNum.GetValueUint64(), pe.execStage.LogPrefix()) if err != nil { return err } @@ -264,7 +281,7 @@ func (pe *parallelExecutor) rwLoop(ctx context.Context, maxTxNum uint64, logger pe.applyWorker.ResetTx(tx) processedTxNum, conflicts, triggers, processedBlockNum, stoppedAtBlockEnd, err := - pe.processResultQueue(ctx, pe.outputTxNum.Load(), tx, nil, false, true) + pe.processResultQueue(ctx, pe.outputTxNum.Load(), nil, false, true) if err != nil { return err } @@ -272,7 +289,7 @@ func (pe *parallelExecutor) rwLoop(ctx context.Context, maxTxNum uint64, logger mxExecRepeats.AddInt(conflicts) mxExecTriggers.AddInt(triggers) if processedBlockNum > 0 { - outputBlockNum.SetUint64(processedBlockNum) + pe.outputBlockNum.SetUint64(processedBlockNum) } if processedTxNum > 0 { pe.outputTxNum.Store(processedTxNum) @@ -309,16 +326,16 @@ func (pe *parallelExecutor) rwLoop(ctx context.Context, maxTxNum uint64, logger pe.doms.ClearRam(true) t3 = time.Since(tt) - if err = pe.execStage.Update(tx, outputBlockNum.GetValueUint64()); err != nil { + if err := pe.execStage.Update(tx, pe.outputBlockNum.GetValueUint64()); err != nil { return err } - if _, err = rawdb.IncrementStateVersion(pe.applyTx); err != nil { + if _, err := rawdb.IncrementStateVersion(tx); err != nil { return fmt.Errorf("writing plain state version: %w", err) } tx.CollectMetrics() tt = time.Now() - if err = tx.Commit(); err != nil { + if err := tx.Commit(); err != nil { return err } t4 = time.Since(tt) @@ -330,7 +347,8 @@ func (pe *parallelExecutor) rwLoop(ctx context.Context, maxTxNum uint64, logger }(); err != nil { return err } - if tx, err = pe.chainDb.BeginRw(ctx); err != nil { + var err error + if tx, err = pe.cfg.db.BeginRw(ctx); err != nil { return err } defer tx.Rollback() @@ -344,29 +362,35 @@ func (pe *parallelExecutor) rwLoop(ctx context.Context, maxTxNum uint64, logger logger.Info("Committed", "time", time.Since(commitStart), "drain", t0, "drain_and_lock", t1, "rs.flush", t2, "agg.flush", t3, "tx.commit", t4) } } - if err = pe.doms.Flush(ctx, tx); err != nil { + if err := pe.doms.Flush(ctx, tx); err != nil { return err } - if err = pe.execStage.Update(tx, outputBlockNum.GetValueUint64()); err != nil { + if err := pe.execStage.Update(tx, pe.outputBlockNum.GetValueUint64()); err != nil { return err } - if err = tx.Commit(); err != nil { + if err := tx.Commit(); err != nil { return err } return nil } -func (pe *parallelExecutor) processResultQueue(ctx context.Context, inputTxNum uint64, applyTx kv.Tx, backPressure chan<- struct{}, canRetry, forceStopAtBlockEnd bool) (outputTxNum uint64, conflicts, triggers int, processedBlockNum uint64, stopedAtBlockEnd bool, err error) { +func (pe *parallelExecutor) processResultQueue(ctx context.Context, inputTxNum uint64, backPressure chan<- struct{}, canRetry, forceStopAtBlockEnd bool) (outputTxNum uint64, conflicts, triggers int, processedBlockNum uint64, stopedAtBlockEnd bool, err error) { rwsIt := pe.rws.Iter() defer rwsIt.Close() + //defer fmt.Println("PRQ", "Done") var i int outputTxNum = inputTxNum for rwsIt.HasNext(outputTxNum) { txTask := rwsIt.PopNext() + //fmt.Println("PRQ", txTask.BlockNum, txTask.TxIndex, txTask.TxNum) if txTask.Error != nil || !pe.rs.ReadsValid(txTask.ReadLists) { conflicts++ - + //fmt.Println(txTask.TxNum, txTask.Error) + if errors.Is(txTask.Error, vm.ErrIntraBlockStateFailed) || + errors.Is(txTask.Error, core.ErrStateTransitionFailed) { + return outputTxNum, conflicts, triggers, processedBlockNum, false, fmt.Errorf("%w: %v", consensus.ErrInvalidBlock, txTask.Error) + } if i > 0 && canRetry { //send to re-exex pe.rs.ReTry(txTask, pe.in) @@ -374,8 +398,9 @@ func (pe *parallelExecutor) processResultQueue(ctx context.Context, inputTxNum u } // resolve first conflict right here: it's faster and conflict-free - pe.applyWorker.RunTxTask(txTask, pe.isMining) + pe.applyWorker.RunTxTaskNoLock(txTask.Reset(), pe.isMining) if txTask.Error != nil { + //fmt.Println("RETRY", txTask.TxNum, txTask.Error) return outputTxNum, conflicts, triggers, processedBlockNum, false, fmt.Errorf("%w: %v", consensus.ErrInvalidBlock, txTask.Error) } if pe.cfg.syncCfg.ChaosMonkey { @@ -395,6 +420,11 @@ func (pe *parallelExecutor) processResultQueue(ctx context.Context, inputTxNum u if err != nil { return outputTxNum, conflicts, triggers, processedBlockNum, false, fmt.Errorf("StateV3.Apply: %w", err) } + + if processedBlockNum > pe.lastBlockNum.Load() { + pe.outputBlockNum.SetUint64(processedBlockNum) + pe.lastBlockNum.Store(processedBlockNum) + } //if !bytes.Equal(rh, txTask.BlockRoot[:]) { // log.Error("block hash mismatch", "rh", hex.EncodeToString(rh), "blockRoot", hex.EncodeToString(txTask.BlockRoot[:]), "bn", txTask.BlockNum, "txn", txTask.TxNum) // return outputTxNum, conflicts, triggers, processedBlockNum, false, fmt.Errorf("block hashk mismatch: %x != %x bn =%d, txn= %d", rh, txTask.BlockRoot[:], txTask.BlockNum, txTask.TxNum) @@ -412,7 +442,9 @@ func (pe *parallelExecutor) processResultQueue(ctx context.Context, inputTxNum u return outputTxNum, conflicts, triggers, processedBlockNum, false, fmt.Errorf("StateV3.Apply: %w", err) } processedBlockNum = txTask.BlockNum - stopedAtBlockEnd = txTask.Final + if !stopedAtBlockEnd { + stopedAtBlockEnd = txTask.Final + } if forceStopAtBlockEnd && txTask.Final { break } @@ -422,8 +454,12 @@ func (pe *parallelExecutor) processResultQueue(ctx context.Context, inputTxNum u func (pe *parallelExecutor) run(ctx context.Context, maxTxNum uint64, logger log.Logger) context.CancelFunc { pe.slowDownLimit = time.NewTicker(time.Second) + pe.rwsConsumed = make(chan struct{}, 1) + pe.rwLoopErrCh = make(chan error) + pe.in = state.NewQueueWithRetry(100_000) + pe.execWorkers, _, pe.rws, pe.stopWorkers, pe.waitWorkers = exec3.NewWorkersPool( - pe.RWMutex.RLocker(), pe.accumulator, logger, ctx, true, pe.chainDb, pe.rs, pe.in, + pe.RWMutex.RLocker(), pe.accumulator, logger, ctx, true, pe.cfg.db, pe.rs, pe.in, pe.cfg.blockReader, pe.cfg.chainConfig, pe.cfg.genesis, pe.cfg.engine, pe.workerCount+1, pe.cfg.dirs, pe.isMining) rwLoopCtx, rwLoopCtxCancel := context.WithCancel(ctx) @@ -433,7 +469,7 @@ func (pe *parallelExecutor) run(ctx context.Context, maxTxNum uint64, logger log defer pe.in.Close() defer pe.applyLoopWg.Wait() defer func() { - log.Warn("[dbg] rwloop exit") + logger.Warn("[dbg] rwloop exit") }() return pe.rwLoop(rwLoopCtx, maxTxNum, logger) }) @@ -443,6 +479,8 @@ func (pe *parallelExecutor) run(ctx context.Context, maxTxNum uint64, logger log pe.slowDownLimit.Stop() pe.wait() pe.stopWorkers() + close(pe.rwsConsumed) + pe.in.Close() } } diff --git a/eth/stagedsync/exec3_serial.go b/eth/stagedsync/exec3_serial.go index 2a59dc12099..cb271284533 100644 --- a/eth/stagedsync/exec3_serial.go +++ b/eth/stagedsync/exec3_serial.go @@ -4,40 +4,22 @@ import ( "context" "errors" "fmt" - "sync/atomic" "time" chaos_monkey "github.com/erigontech/erigon/tests/chaos-monkey" - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" state2 "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon/cmd/state/exec3" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/rawdb/rawtemporaldb" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" - "github.com/erigontech/erigon/turbo/shards" ) type serialExecutor struct { - cfg ExecuteBlockCfg - execStage *StageState - agg *state2.Aggregator - rs *state.StateV3 - doms *state2.SharedDomains - accumulator *shards.Accumulator - u Unwinder - isMining bool - inMemExec bool + txExecutor skipPostEvaluation bool - applyTx kv.RwTx - worker *exec3.Worker - outputTxNum *atomic.Uint64 - logger log.Logger - // outputs txCount uint64 usedGas uint64 @@ -58,7 +40,7 @@ func (se *serialExecutor) execute(ctx context.Context, tasks []*state.TxTask) (c return false, nil } - se.worker.RunTxTaskNoLock(txTask, se.isMining) + se.applyWorker.RunTxTaskNoLock(txTask, se.isMining) if err := func() error { if errors.Is(txTask.Error, context.Canceled) { return txTask.Error @@ -91,6 +73,8 @@ func (se *serialExecutor) execute(ctx context.Context, tasks []*state.TxTask) (c return fmt.Errorf("%w, txnIdx=%d, %v", consensus.ErrInvalidBlock, txTask.TxIndex, err) //same as in stage_exec.go } } + + se.outputBlockNum.SetUint64(txTask.BlockNum) } if se.cfg.syncCfg.ChaosMonkey { chaosErr := chaos_monkey.ThrowRandomConsensusError(se.execStage.CurrentSyncCycle.IsInitialCycle, txTask.TxIndex, se.cfg.badBlockHalt, txTask.Error) @@ -149,27 +133,6 @@ func (se *serialExecutor) execute(ctx context.Context, tasks []*state.TxTask) (c return true, nil } -func (se *serialExecutor) tx() kv.RwTx { - return se.applyTx -} - -func (se *serialExecutor) readState() *state.StateV3 { - return se.rs -} - -func (se *serialExecutor) domains() *state2.SharedDomains { - return se.doms -} - -func (se *serialExecutor) getHeader(ctx context.Context, hash common.Hash, number uint64) (h *types.Header) { - var err error - h, err = se.cfg.blockReader.Header(ctx, se.applyTx, hash, number) - if err != nil { - panic(err) - } - return h -} - func (se *serialExecutor) commit(ctx context.Context, txNum uint64, blockNum uint64, useExternalTx bool) (t2 time.Duration, err error) { se.doms.Close() if err = se.execStage.Update(se.applyTx, blockNum); err != nil { @@ -199,8 +162,8 @@ func (se *serialExecutor) commit(ctx context.Context, txNum uint64, blockNum uin se.doms.SetTxNum(txNum) se.rs = state.NewStateV3(se.doms, se.logger) - se.worker.ResetTx(se.applyTx) - se.worker.ResetState(se.rs, se.accumulator) + se.applyWorker.ResetTx(se.applyTx) + se.applyWorker.ResetState(se.rs, se.accumulator) return t2, nil } diff --git a/eth/tracers/js/goja.go b/eth/tracers/js/goja.go index e8f84ce44bf..ba223d598f9 100644 --- a/eth/tracers/js/goja.go +++ b/eth/tracers/js/goja.go @@ -676,8 +676,12 @@ func (do *dbObj) GetBalance(addrSlice goja.Value) goja.Value { return nil } addr := libcommon.BytesToAddress(a) - value := do.ibs.GetBalance(addr).ToBig() - res, err := do.toBig(do.vm, value.String()) + value, err := do.ibs.GetBalance(addr) + if err != nil { + do.vm.Interrupt(err) + return nil + } + res, err := do.toBig(do.vm, value.ToBig().String()) if err != nil { do.vm.Interrupt(err) return nil @@ -692,7 +696,12 @@ func (do *dbObj) GetNonce(addrSlice goja.Value) uint64 { return 0 } addr := libcommon.BytesToAddress(a) - return do.ibs.GetNonce(addr) + nonce, err := do.ibs.GetNonce(addr) + if err != nil { + do.vm.Interrupt(err) + return 0 + } + return nonce } func (do *dbObj) GetCode(addrSlice goja.Value) goja.Value { @@ -702,7 +711,11 @@ func (do *dbObj) GetCode(addrSlice goja.Value) goja.Value { return nil } addr := libcommon.BytesToAddress(a) - code := do.ibs.GetCode(addr) + code, err := do.ibs.GetCode(addr) + if err != nil { + do.vm.Interrupt(err) + return nil + } res, err := do.toBuf(do.vm, code) if err != nil { do.vm.Interrupt(err) @@ -741,7 +754,12 @@ func (do *dbObj) Exists(addrSlice goja.Value) bool { return false } addr := libcommon.BytesToAddress(a) - return do.ibs.Exist(addr) + exists, err := do.ibs.Exist(addr) + if err != nil { + do.vm.Interrupt(err) + return false + } + return exists } func (do *dbObj) setupObject() *goja.Object { diff --git a/eth/tracers/js/tracer_test.go b/eth/tracers/js/tracer_test.go index 96624bca385..8e43dd6a44a 100644 --- a/eth/tracers/js/tracer_test.go +++ b/eth/tracers/js/tracer_test.go @@ -56,8 +56,10 @@ type dummyStatedb struct { state.IntraBlockState } -func (*dummyStatedb) GetRefund() uint64 { return 1337 } -func (*dummyStatedb) GetBalance(addr libcommon.Address) *uint256.Int { return &uint256.Int{} } +func (*dummyStatedb) GetRefund() uint64 { return 1337 } +func (*dummyStatedb) GetBalance(addr libcommon.Address) (*uint256.Int, error) { + return &uint256.Int{}, nil +} type vmContext struct { blockCtx evmtypes.BlockContext diff --git a/eth/tracers/logger/access_list_tracer.go b/eth/tracers/logger/access_list_tracer.go index 882bb51955b..9dbfe7d8ebc 100644 --- a/eth/tracers/logger/access_list_tracer.go +++ b/eth/tracers/logger/access_list_tracer.go @@ -222,7 +222,7 @@ func (a *AccessListTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint6 if op == vm.CREATE { // contract address for CREATE can only be generated with state if a.state != nil { - nonce := a.state.GetNonce(caller) + nonce, _ := a.state.GetNonce(caller) addr := crypto.CreateAddress(caller, nonce) if _, ok := a.excl[addr]; !ok { a.createdContracts[addr] = struct{}{} @@ -240,7 +240,6 @@ func (a *AccessListTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint6 a.createdContracts[addr] = struct{}{} } } - } func (*AccessListTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error) { diff --git a/eth/tracers/native/prestate.go b/eth/tracers/native/prestate.go index e32084d263f..0a896748906 100644 --- a/eth/tracers/native/prestate.go +++ b/eth/tracers/native/prestate.go @@ -171,7 +171,7 @@ func (t *prestateTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, addr := libcommon.Address(stackData[stackLen-2].Bytes20()) t.lookupAccount(addr) case op == vm.CREATE: - nonce := t.env.IntraBlockState().GetNonce(caller) + nonce, _ := t.env.IntraBlockState().GetNonce(caller) addr := crypto.CreateAddress(caller, nonce) t.lookupAccount(addr) t.created[addr] = true @@ -203,12 +203,12 @@ func (t *prestateTracer) CaptureTxEnd(restGas uint64) { } modified := false postAccount := &account{Storage: make(map[libcommon.Hash]libcommon.Hash)} - newBalance := t.env.IntraBlockState().GetBalance(addr).ToBig() - newNonce := t.env.IntraBlockState().GetNonce(addr) + newBalance, _ := t.env.IntraBlockState().GetBalance(addr) + newNonce, _ := t.env.IntraBlockState().GetNonce(addr) - if newBalance.Cmp(t.pre[addr].Balance) != 0 { + if newBalance.ToBig().Cmp(t.pre[addr].Balance) != 0 { modified = true - postAccount.Balance = newBalance + postAccount.Balance = newBalance.ToBig() } if newNonce != t.pre[addr].Nonce { modified = true @@ -216,7 +216,7 @@ func (t *prestateTracer) CaptureTxEnd(restGas uint64) { } if !t.config.DisableCode { - newCode := t.env.IntraBlockState().GetCode(addr) + newCode, _ := t.env.IntraBlockState().GetCode(addr) if !bytes.Equal(newCode, t.pre[addr].Code) { modified = true postAccount.Code = newCode @@ -292,13 +292,17 @@ func (t *prestateTracer) lookupAccount(addr libcommon.Address) { return } + balance, _ := t.env.IntraBlockState().GetBalance(addr) + nonce, _ := t.env.IntraBlockState().GetNonce(addr) + code, _ := t.env.IntraBlockState().GetCode(addr) + t.pre[addr] = &account{ - Balance: t.env.IntraBlockState().GetBalance(addr).ToBig(), - Nonce: t.env.IntraBlockState().GetNonce(addr), + Balance: balance.ToBig(), + Nonce: nonce, } if !t.config.DisableCode { - t.pre[addr].Code = t.env.IntraBlockState().GetCode(addr) + t.pre[addr].Code = code } if !t.config.DisableStorage { t.pre[addr].Storage = make(map[libcommon.Hash]libcommon.Hash) diff --git a/polygon/bor/bor.go b/polygon/bor/bor.go index 4e6972beab5..3b5c8c9401e 100644 --- a/polygon/bor/bor.go +++ b/polygon/bor/bor.go @@ -1673,22 +1673,42 @@ func (c *Bor) getNextHeimdallSpanForTest( } // BorTransfer transfer in Bor -func BorTransfer(db evmtypes.IntraBlockState, sender, recipient libcommon.Address, amount *uint256.Int, bailout bool) { +func BorTransfer(db evmtypes.IntraBlockState, sender, recipient libcommon.Address, amount *uint256.Int, bailout bool) error { // get inputs before - input1 := db.GetBalance(sender).Clone() - input2 := db.GetBalance(recipient).Clone() - + input1, err := db.GetBalance(sender) + if err != nil { + return err + } + input1 = input1.Clone() + input2, err := db.GetBalance(recipient) + if err != nil { + return err + } + input2 = input2.Clone() if !bailout { - db.SubBalance(sender, amount, tracing.BalanceChangeTransfer) + err := db.SubBalance(sender, amount, tracing.BalanceChangeTransfer) + if err != nil { + return err + } + } + err = db.AddBalance(recipient, amount, tracing.BalanceChangeTransfer) + if err != nil { + return err } - db.AddBalance(recipient, amount, tracing.BalanceChangeTransfer) - // get outputs after - output1 := db.GetBalance(sender).Clone() - output2 := db.GetBalance(recipient).Clone() - + output1, err := db.GetBalance(sender) + if err != nil { + return err + } + output1 = output1.Clone() + output2, err := db.GetBalance(recipient) + if err != nil { + return err + } + output2 = output2.Clone() // add transfer log into state addTransferLog(db, transferLogSig, sender, recipient, amount, input1, input2, output1, output2) + return nil } func (c *Bor) GetTransferFunc() evmtypes.TransferFunc { diff --git a/tests/block_test_util.go b/tests/block_test_util.go index 079da8e4280..c7241381b04 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -320,9 +320,18 @@ func (bt *BlockTest) validatePostState(statedb *state.IntraBlockState) error { // validate post state accounts in test file against what we have in state db for addr, acct := range bt.json.Post { // address is indirectly verified by the other fields, as it's the db key - code2 := statedb.GetCode(addr) - balance2 := statedb.GetBalance(addr) - nonce2 := statedb.GetNonce(addr) + code2, err := statedb.GetCode(addr) + if err != nil { + return err + } + balance2, err := statedb.GetBalance(addr) + if err != nil { + return err + } + nonce2, err := statedb.GetNonce(addr) + if err != nil { + return err + } if nonce2 != acct.Nonce { return fmt.Errorf("account nonce mismatch for addr: %x want: %d have: %d", addr, acct.Nonce, nonce2) } diff --git a/tests/statedb_chain_test.go b/tests/statedb_chain_test.go index 7449ea92215..525b3c0f12c 100644 --- a/tests/statedb_chain_test.go +++ b/tests/statedb_chain_test.go @@ -105,10 +105,18 @@ func TestSelfDestructReceive(t *testing.T) { if err := m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(address) { + exist, err := st.Exist(address) + if err != nil { + return err + } + if !exist { t.Error("expected account to exist") } - if st.Exist(contractAddress) { + exist, err = st.Exist(contractAddress) + if err != nil { + return err + } + if exist { t.Error("expected contractAddress to not exist before block 0", contractAddress.String()) } return nil @@ -131,13 +139,25 @@ func TestSelfDestructReceive(t *testing.T) { // and that means that the state of the accounts written in the first block was correct. // This test checks that the storage root of the account is properly set to the root of the empty tree st := state.New(m.NewStateReader(tx)) - if !st.Exist(address) { + exist, err := st.Exist(address) + if err != nil { + t.Error(err) + } + if !exist { t.Error("expected account to exist") } - if !st.Exist(contractAddress) { + exist, err = st.Exist(contractAddress) + if err != nil { + t.Error(err) + } + if !exist { t.Error("expected contractAddress to exist at the block 2", contractAddress.String()) } - if len(st.GetCode(contractAddress)) != 0 { + code, err := st.GetCode(contractAddress) + if err != nil { + t.Error(err) + } + if len(code) != 0 { t.Error("expected empty code in contract at block 2", contractAddress.String()) } return nil diff --git a/tests/statedb_insert_chain_transaction_test.go b/tests/statedb_insert_chain_transaction_test.go index e9f28a610d2..a2d3eddd264 100644 --- a/tests/statedb_insert_chain_transaction_test.go +++ b/tests/statedb_insert_chain_transaction_test.go @@ -93,17 +93,33 @@ func TestInsertIncorrectStateRootDifferentAccounts(t *testing.T) { defer tx.Rollback() st := state.New(m.NewStateReader(tx)) - if !st.Exist(to) { + exist, err := st.Exist(to) + if err != nil { + t.Error(err) + } + if !exist { t.Error("expected account to exist") } - if balance := st.GetBalance(from); balance.Uint64() != 1000000000 { + balance, err := st.GetBalance(from) + if err != nil { + t.Error(err) + } + if balance.Uint64() != 1000000000 { t.Fatalf("got %v, expected %v", balance, 1000000000) } - if balance := st.GetBalance(data.addresses[1]); balance.Uint64() != 999995000 { + balance, err = st.GetBalance(data.addresses[1]) + if err != nil { + t.Error(err) + } + if balance.Uint64() != 999995000 { t.Fatalf("got %v, expected %v", balance, 999995000) } - if balance := st.GetBalance(to); balance.Uint64() != 5000 { + balance, err = st.GetBalance(to) + if err != nil { + t.Error(err) + } + if balance.Uint64() != 5000 { t.Fatalf("got %v, expected %v", balance, 5000) } } @@ -161,14 +177,26 @@ func TestInsertIncorrectStateRootSameAccount(t *testing.T) { defer tx.Rollback() st := state.New(m.NewStateReader(tx)) - if !st.Exist(to) { + exist, err := st.Exist(to) + if err != nil { + t.Error(err) + } + if !exist { t.Error("expected account to exist") } - if balance := st.GetBalance(from); balance.Uint64() != 999995000 { + balance, err := st.GetBalance(from) + if err != nil { + t.Error(err) + } + if balance.Uint64() != 999995000 { t.Fatalf("got %v, expected %v", balance, 999995000) } - if balance := st.GetBalance(to); balance.Uint64() != 5000 { + balance, err = st.GetBalance(to) + if err != nil { + t.Error(err) + } + if balance.Uint64() != 5000 { t.Fatalf("got %v, expected %v", balance, 5000) } } @@ -223,14 +251,26 @@ func TestInsertIncorrectStateRootSameAccountSameAmount(t *testing.T) { defer tx.Rollback() st := state.New(m.NewStateReader(tx)) - if !st.Exist(to) { + exist, err := st.Exist(to) + if err != nil { + t.Error(err) + } + if !exist { t.Error("expected account to exist") } - if balance := st.GetBalance(from); balance.Uint64() != 999999000 { + balance, err := st.GetBalance(from) + if err != nil { + t.Error(err) + } + if balance.Uint64() != 999999000 { t.Fatalf("got %v, expected %v", balance, 999999000) } - if balance := st.GetBalance(to); balance.Uint64() != 1000 { + balance, err = st.GetBalance(to) + if err != nil { + t.Error(err) + } + if balance.Uint64() != 1000 { t.Fatalf("got %v, expected %v", balance, 1000) } } @@ -285,14 +325,26 @@ func TestInsertIncorrectStateRootAllFundsRoot(t *testing.T) { defer tx.Rollback() st := state.New(m.NewStateReader(tx)) - if !st.Exist(to) { + exist, err := st.Exist(to) + if err != nil { + t.Error(err) + } + if !exist { t.Error("expected account to exist") } - if balance := st.GetBalance(from); balance.Uint64() != 2000 { + balance, err := st.GetBalance(from) + if err != nil { + t.Error(err) + } + if balance.Uint64() != 2000 { t.Fatalf("got %v, expected %v", balance, 2000) } - if balance := st.GetBalance(to); balance.Uint64() != 1000 { + balance, err = st.GetBalance(to) + if err != nil { + t.Error(err) + } + if balance.Uint64() != 1000 { t.Fatalf("got %v, expected %v", balance, 1000) } } @@ -347,14 +399,26 @@ func TestInsertIncorrectStateRootAllFunds(t *testing.T) { defer tx.Rollback() st := state.New(m.NewStateReader(tx)) - if !st.Exist(to) { + exist, err := st.Exist(to) + if err != nil { + t.Error(err) + } + if !exist { t.Error("expected account to exist") } - if balance := st.GetBalance(from); balance.Uint64() != 2000 { + balance, err := st.GetBalance(from) + if err != nil { + t.Error(err) + } + if balance.Uint64() != 2000 { t.Fatalf("got %v, expected %v", balance, 2000) } - if balance := st.GetBalance(to); balance.Uint64() != 1000 { + balance, err = st.GetBalance(to) + if err != nil { + t.Error(err) + } + if balance.Uint64() != 1000 { t.Fatalf("got %v, expected %v", balance, 1000) } } @@ -388,11 +452,18 @@ func TestAccountDeployIncorrectRoot(t *testing.T) { } err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(from) { + exist, err := st.Exist(from) + if err != nil { + return err + } + if !exist { t.Error("expected account to exist") } - - if st.Exist(contractAddress) { + exist, err = st.Exist(contractAddress) + if err != nil { + return err + } + if exist { t.Error("expected contractAddress to not exist at the block 0", contractAddress.Hash().String()) } return nil @@ -411,11 +482,19 @@ func TestAccountDeployIncorrectRoot(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(from) { + exist, err := st.Exist(from) + if err != nil { + return err + } + if !exist { t.Error("expected account to exist") } - if st.Exist(contractAddress) { + exist, err = st.Exist(contractAddress) + if err != nil { + return err + } + if exist { t.Error("expected contractAddress to not exist at the block 1", contractAddress.Hash().String()) } return nil @@ -429,11 +508,19 @@ func TestAccountDeployIncorrectRoot(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(from) { + exist, err := st.Exist(from) + if err != nil { + return err + } + if !exist { t.Error("expected account to exist") } - if !st.Exist(contractAddress) { + exist, err = st.Exist(contractAddress) + if err != nil { + return err + } + if !exist { t.Error("expected contractAddress to not exist at the block 1", contractAddress.Hash().String()) } return nil @@ -475,11 +562,19 @@ func TestAccountCreateIncorrectRoot(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(from) { + exist, err := st.Exist(from) + if err != nil { + return err + } + if !exist { t.Error("expected account to exist") } - if st.Exist(contractAddress) { + exist, err = st.Exist(contractAddress) + if err != nil { + return err + } + if exist { t.Error("expected contractAddress to not exist at the block 0", contractAddress.Hash().String()) } @@ -493,11 +588,19 @@ func TestAccountCreateIncorrectRoot(t *testing.T) { } err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(from) { + exist, err := st.Exist(from) + if err != nil { + return err + } + if !exist { t.Error("expected account to exist") } - if !st.Exist(contractAddress) { + exist, err = st.Exist(contractAddress) + if err != nil { + return err + } + if !exist { t.Error("expected contractAddress to exist at the block 2", contractAddress.Hash().String()) } @@ -559,11 +662,19 @@ func TestAccountUpdateIncorrectRoot(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(from) { + exist, err := st.Exist(from) + if err != nil { + return err + } + if !exist { t.Error("expected account to exist") } - if st.Exist(contractAddress) { + exist, err = st.Exist(contractAddress) + if err != nil { + return err + } + if exist { t.Error("expected contractAddress to not exist at the block 0", contractAddress.Hash().String()) } @@ -578,11 +689,19 @@ func TestAccountUpdateIncorrectRoot(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(from) { + exist, err := st.Exist(from) + if err != nil { + return err + } + if !exist { t.Error("expected account to exist") } - if !st.Exist(contractAddress) { + exist, err = st.Exist(contractAddress) + if err != nil { + return err + } + if !exist { t.Error("expected contractAddress to exist at the block 2", contractAddress.Hash().String()) } return nil @@ -648,11 +767,19 @@ func TestAccountDeleteIncorrectRoot(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(from) { + exist, err := st.Exist(from) + if err != nil { + return err + } + if !exist { t.Error("expected account to exist") } - if st.Exist(contractAddress) { + exist, err = st.Exist(contractAddress) + if err != nil { + return err + } + if exist { t.Error("expected contractAddress to not exist at the block 0", contractAddress.Hash().String()) } return nil @@ -666,11 +793,19 @@ func TestAccountDeleteIncorrectRoot(t *testing.T) { err = m.DB.View(context.Background(), func(tx kv.Tx) error { st := state.New(m.NewStateReader(tx)) - if !st.Exist(from) { + exist, err := st.Exist(from) + if err != nil { + return err + } + if !exist { t.Error("expected account to exist") } - if !st.Exist(contractAddress) { + exist, err = st.Exist(contractAddress) + if err != nil { + return err + } + if !exist { t.Error("expected contractAddress to exist at the block 1", contractAddress.Hash().String()) } return nil diff --git a/turbo/jsonrpc/eth_call.go b/turbo/jsonrpc/eth_call.go index 77df5853720..eb88d667f13 100644 --- a/turbo/jsonrpc/eth_call.go +++ b/turbo/jsonrpc/eth_call.go @@ -205,7 +205,10 @@ func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs return 0, errors.New("can't get the current state") } - balance := state.GetBalance(*args.From) // from can't be nil + balance, err := state.GetBalance(*args.From) // from can't be nil + if err != nil { + return 0, err + } available := balance.ToBig() if args.Value != nil { if args.Value.ToInt().Cmp(available) >= 0 { diff --git a/turbo/jsonrpc/eth_call_test.go b/turbo/jsonrpc/eth_call_test.go index c2580625b0a..b95a1228254 100644 --- a/turbo/jsonrpc/eth_call_test.go +++ b/turbo/jsonrpc/eth_call_test.go @@ -553,13 +553,17 @@ func chainWithDeployedContract(t *testing.T) (*mock.MockSentry, libcommon.Addres assert.NoError(t, err) st := state.New(stateReader) assert.NoError(t, err) - assert.False(t, st.Exist(contractAddr), "Contract should not exist at block #1") + exist, err := st.Exist(contractAddr) + assert.NoError(t, err) + assert.False(t, exist, "Contract should not exist at block #1") stateReader, err = rpchelper.CreateHistoryStateReader(tx, rawdbv3.TxNums, 2, 0, "") assert.NoError(t, err) st = state.New(stateReader) assert.NoError(t, err) - assert.True(t, st.Exist(contractAddr), "Contract should exist at block #2") + exist, err = st.Exist(contractAddr) + assert.NoError(t, err) + assert.True(t, exist, "Contract should exist at block #2") return m, bankAddress, contractAddr } diff --git a/turbo/jsonrpc/overlay_api.go b/turbo/jsonrpc/overlay_api.go index ba4e970f01b..dead2ff8405 100644 --- a/turbo/jsonrpc/overlay_api.go +++ b/turbo/jsonrpc/overlay_api.go @@ -237,7 +237,10 @@ func (api *OverlayAPIImpl) CallConstructor(ctx context.Context, address common.A if err != nil { return nil, err } - code := evm.IntraBlockState().GetCode(address) + code, err := evm.IntraBlockState().GetCode(address) + if err != nil { + return nil, err + } if len(code) > 0 { c := hexutility.Bytes(code) resultCode.Code = &c @@ -506,7 +509,16 @@ func (api *OverlayAPIImpl) replayBlock(ctx context.Context, blockNum uint64, sta if !contractCreation { // bump the nonce of the sender sender := vm.AccountRef(msg.From()) - statedb.SetNonce(msg.From(), statedb.GetNonce(sender.Address())+1) + nonce, err := statedb.GetNonce(sender.Address()) + if err != nil { + log.Error(err.Error()) + return nil, err + } + err = statedb.SetNonce(msg.From(), nonce+1) + if err != nil { + log.Error(err.Error()) + return nil, err + } continue } } diff --git a/turbo/jsonrpc/overlay_create_tracer.go b/turbo/jsonrpc/overlay_create_tracer.go index 29be53228a8..c80641a5465 100644 --- a/turbo/jsonrpc/overlay_create_tracer.go +++ b/turbo/jsonrpc/overlay_create_tracer.go @@ -55,7 +55,11 @@ func (ct *OverlayCreateTracer) CaptureEnter(typ vm.OpCode, from libcommon.Addres if err != nil { ct.err = err } else { - ct.resultCode = ct.evm.IntraBlockState().GetCode(ct.contractAddress) + if result, err := ct.evm.IntraBlockState().GetCode(ct.contractAddress); err != nil { + ct.resultCode = result + } else { + ct.err = err + } } } } diff --git a/turbo/jsonrpc/trace_adhoc.go b/turbo/jsonrpc/trace_adhoc.go index 57cf151420a..fdc5e8be790 100644 --- a/turbo/jsonrpc/trace_adhoc.go +++ b/turbo/jsonrpc/trace_adhoc.go @@ -662,16 +662,30 @@ func (sd *StateDiff) CreateContract(address libcommon.Address) error { } // CompareStates uses the addresses accumulated in the sdMap and compares balances, nonces, and codes of the accounts, and fills the rest of the sdMap -func (sd *StateDiff) CompareStates(initialIbs, ibs *state.IntraBlockState) { +func (sd *StateDiff) CompareStates(initialIbs, ibs *state.IntraBlockState) error { var toRemove []libcommon.Address for addr, accountDiff := range sd.sdMap { - initialExist := initialIbs.Exist(addr) - exist := ibs.Exist(addr) + initialExist, err := initialIbs.Exist(addr) + if err != nil { + return err + } + exist, err := ibs.Exist(addr) + if err != nil { + return err + } if initialExist { if exist { var allEqual = len(accountDiff.Storage) == 0 - fromBalance := initialIbs.GetBalance(addr).ToBig() - toBalance := ibs.GetBalance(addr).ToBig() + ifromBalance, err := initialIbs.GetBalance(addr) + if err != nil { + return err + } + fromBalance := ifromBalance.ToBig() + itoBalance, err := ibs.GetBalance(addr) + if err != nil { + return err + } + toBalance := itoBalance.ToBig() if fromBalance.Cmp(toBalance) == 0 { accountDiff.Balance = "=" } else { @@ -680,8 +694,14 @@ func (sd *StateDiff) CompareStates(initialIbs, ibs *state.IntraBlockState) { accountDiff.Balance = m allEqual = false } - fromCode := initialIbs.GetCode(addr) - toCode := ibs.GetCode(addr) + fromCode, err := initialIbs.GetCode(addr) + if err != nil { + return err + } + toCode, err := ibs.GetCode(addr) + if err != nil { + return err + } if bytes.Equal(fromCode, toCode) { accountDiff.Code = "=" } else { @@ -690,8 +710,14 @@ func (sd *StateDiff) CompareStates(initialIbs, ibs *state.IntraBlockState) { accountDiff.Code = m allEqual = false } - fromNonce := initialIbs.GetNonce(addr) - toNonce := ibs.GetNonce(addr) + fromNonce, err := initialIbs.GetNonce(addr) + if err != nil { + return err + } + toNonce, err := ibs.GetNonce(addr) + if err != nil { + return err + } if fromNonce == toNonce { accountDiff.Nonce = "=" } else { @@ -705,35 +731,59 @@ func (sd *StateDiff) CompareStates(initialIbs, ibs *state.IntraBlockState) { } } else { { + balance, err := initialIbs.GetBalance(addr) + if err != nil { + return err + } m := make(map[string]*hexutil.Big) - m["-"] = (*hexutil.Big)(initialIbs.GetBalance(addr).ToBig()) + m["-"] = (*hexutil.Big)(balance.ToBig()) accountDiff.Balance = m } { + code, err := initialIbs.GetCode(addr) + if err != nil { + return err + } m := make(map[string]hexutility.Bytes) - m["-"] = initialIbs.GetCode(addr) + m["-"] = code accountDiff.Code = m } { + nonce, err := initialIbs.GetNonce(addr) + if err != nil { + return err + } m := make(map[string]hexutil.Uint64) - m["-"] = hexutil.Uint64(initialIbs.GetNonce(addr)) + m["-"] = hexutil.Uint64(nonce) accountDiff.Nonce = m } } } else if exist { { + balance, err := ibs.GetBalance(addr) + if err != nil { + return err + } m := make(map[string]*hexutil.Big) - m["+"] = (*hexutil.Big)(ibs.GetBalance(addr).ToBig()) + m["+"] = (*hexutil.Big)(balance.ToBig()) accountDiff.Balance = m } { + code, err := ibs.GetCode(addr) + if err != nil { + return err + } m := make(map[string]hexutility.Bytes) - m["+"] = ibs.GetCode(addr) + m["+"] = code accountDiff.Code = m } { + nonce, err := ibs.GetNonce(addr) + if err != nil { + return err + } m := make(map[string]hexutil.Uint64) - m["+"] = hexutil.Uint64(ibs.GetNonce(addr)) + m["+"] = hexutil.Uint64(nonce) accountDiff.Nonce = m } // Transform storage @@ -749,6 +799,7 @@ func (sd *StateDiff) CompareStates(initialIbs, ibs *state.IntraBlockState) { for _, addr := range toRemove { delete(sd.sdMap, addr) } + return nil } func (api *TraceAPIImpl) ReplayTransaction(ctx context.Context, txHash libcommon.Hash, traceTypes []string, gasBailOut *bool, traceConfig *config.TraceConfig) (*TraceCallResult, error) { diff --git a/turbo/stages/blockchain_test.go b/turbo/stages/blockchain_test.go index 3c58f35a1b4..a37243413bc 100644 --- a/turbo/stages/blockchain_test.go +++ b/turbo/stages/blockchain_test.go @@ -1015,7 +1015,11 @@ func TestEIP161AccountRemoval(t *testing.T) { return } defer tx.Rollback() - if st := state.New(m.NewStateReader(tx)); !st.Exist(theAddr) { + exist, err := state.New(m.NewStateReader(tx)).Exist(theAddr) + if err != nil { + t.Fatal(err) + } + if !exist { t.Error("expected account to exist") } tx.Rollback() @@ -1025,7 +1029,11 @@ func TestEIP161AccountRemoval(t *testing.T) { t.Fatal(err) } if err = m.DB.View(m.Ctx, func(tx kv.Tx) error { - if st := state.New(m.NewStateReader(tx)); st.Exist(theAddr) { + exist, err := state.New(m.NewStateReader(tx)).Exist(theAddr) + if err != nil { + return err + } + if exist { t.Error("account should not exist") } return nil @@ -1038,7 +1046,11 @@ func TestEIP161AccountRemoval(t *testing.T) { t.Fatal(err) } if err = m.DB.View(m.Ctx, func(tx kv.Tx) error { - if st := state.New(m.NewStateReader(tx)); st.Exist(theAddr) { + exist, err := state.New(m.NewStateReader(tx)).Exist(theAddr) + if err != nil { + return err + } + if exist { t.Error("account should not exist") } return nil @@ -1104,19 +1116,27 @@ func TestDoubleAccountRemoval(t *testing.T) { st := state.New(m.NewStateReader(tx)) assert.NoError(t, err) - assert.False(t, st.Exist(theAddr), "Contract should've been removed") + exist, err := st.Exist(theAddr) + assert.NoError(t, err) + assert.False(t, exist, "Contract should've been removed") st = state.New(m.NewHistoryStateReader(1, tx)) assert.NoError(t, err) - assert.False(t, st.Exist(theAddr), "Contract should not exist at block #0") + exist, err = st.Exist(theAddr) + assert.NoError(t, err) + assert.False(t, exist, "Contract should not exist at block #0") st = state.New(m.NewHistoryStateReader(2, tx)) assert.NoError(t, err) - assert.True(t, st.Exist(theAddr), "Contract should exist at block #1") + exist, err = st.Exist(theAddr) + assert.NoError(t, err) + assert.True(t, exist, "Contract should exist at block #1") st = state.New(m.NewHistoryStateReader(3, tx)) assert.NoError(t, err) - assert.True(t, st.Exist(theAddr), "Contract should exist at block #2") + exist, err = st.Exist(theAddr) + assert.NoError(t, err) + assert.True(t, exist, "Contract should exist at block #2") } // This is a regression test (i.e. as weird as it is, don't delete it ever), which @@ -1608,7 +1628,10 @@ func TestCVE2020_26265(t *testing.T) { reader := m.NewHistoryStateReader(2, tx) statedb := state.New(reader) - got := statedb.GetBalance(aa) + got, err := statedb.GetBalance(aa) + if err != nil { + t.Fatal(err) + } if !got.Eq(new(uint256.Int).SetUint64(5)) { t.Errorf("got %x exp %x", got, 5) } @@ -1870,7 +1893,11 @@ func TestDeleteRecreateSlotsAcrossManyBlocks(t *testing.T) { } exp := expectations[i] if exp.exist { - if !statedb.Exist(aa) { + exist, err := statedb.Exist(aa) + if err != nil { + t.Fatal(err) + } + if !exist { t.Fatalf("block %d, expected %x to exist, it did not", blockNum, aa) } for slot, val := range exp.values { @@ -1882,7 +1909,11 @@ func TestDeleteRecreateSlotsAcrossManyBlocks(t *testing.T) { } } } else { - if statedb.Exist(aa) { + exist, err := statedb.Exist(aa) + if err != nil { + t.Fatal(err) + } + if exist { t.Fatalf("block %d, expected %x to not exist, it did", blockNum, aa) } } @@ -1988,7 +2019,11 @@ func TestInitThenFailCreateContract(t *testing.T) { // Import the canonical chain statedb := state.New(m.NewHistoryStateReader(2, tx)) - if got, exp := statedb.GetBalance(aa), uint64(100000); got.Uint64() != exp { + got, err := statedb.GetBalance(aa) + if err != nil { + return err + } + if exp := uint64(100000); got.Uint64() != exp { t.Fatalf("Genesis err, got %v exp %v", got, exp) } // First block tries to create, but fails @@ -1998,7 +2033,11 @@ func TestInitThenFailCreateContract(t *testing.T) { t.Fatalf("block %d: failed to insert into chain: %v", block.NumberU64(), err) } statedb = state.New(m.NewHistoryStateReader(1, tx)) - if got, exp := statedb.GetBalance(aa), uint64(100000); got.Uint64() != exp { + got, err := statedb.GetBalance(aa) + if err != nil { + return err + } + if exp := uint64(100000); got.Uint64() != exp { t.Fatalf("block %d: got %v exp %v", block.NumberU64(), got, exp) } } @@ -2198,7 +2237,10 @@ func TestEIP1559Transition(t *testing.T) { statedb := state.New(m.NewHistoryStateReader(1, tx)) // 3: Ensure that miner received only the tx's tip. - actual := statedb.GetBalance(block.Coinbase()) + actual, err := statedb.GetBalance(block.Coinbase()) + if err != nil { + return err + } expected := new(uint256.Int).Add( new(uint256.Int).SetUint64(block.GasUsed()*block.Transactions()[0].GetPrice().Uint64()), ethash.ConstantinopleBlockReward, @@ -2208,7 +2250,11 @@ func TestEIP1559Transition(t *testing.T) { } // 4: Ensure the txn sender paid for the gasUsed * (tip + block baseFee). - actual = new(uint256.Int).Sub(funds, statedb.GetBalance(addr1)) + balance, err := statedb.GetBalance(addr1) + if err != nil { + return err + } + actual = new(uint256.Int).Sub(funds, balance) expected = new(uint256.Int).SetUint64(block.GasUsed() * (block.Transactions()[0].GetPrice().Uint64() + block.BaseFee().Uint64())) if actual.Cmp(expected) != 0 { t.Fatalf("sender expenditure incorrect: expected %d, got %d", expected, actual) @@ -2240,7 +2286,10 @@ func TestEIP1559Transition(t *testing.T) { effectiveTip := block.Transactions()[0].GetPrice().Uint64() - block.BaseFee().Uint64() // 6+5: Ensure that miner received only the tx's effective tip. - actual := statedb.GetBalance(block.Coinbase()) + actual, err := statedb.GetBalance(block.Coinbase()) + if err != nil { + return err + } expected := new(uint256.Int).Add( new(uint256.Int).SetUint64(block.GasUsed()*effectiveTip), ethash.ConstantinopleBlockReward, @@ -2250,7 +2299,11 @@ func TestEIP1559Transition(t *testing.T) { } // 4: Ensure the txn sender paid for the gasUsed * (effectiveTip + block baseFee). - actual = new(uint256.Int).Sub(funds, statedb.GetBalance(addr2)) + balance, err := statedb.GetBalance(addr2) + if err != nil { + return err + } + actual = new(uint256.Int).Sub(funds, balance) expected = new(uint256.Int).SetUint64(block.GasUsed() * (effectiveTip + block.BaseFee().Uint64())) if actual.Cmp(expected) != 0 { t.Fatalf("sender balance incorrect: expected %d, got %d", expected, actual) diff --git a/turbo/stages/chain_makers_test.go b/turbo/stages/chain_makers_test.go index 08dcd772cc2..e33f34ef5dd 100644 --- a/turbo/stages/chain_makers_test.go +++ b/turbo/stages/chain_makers_test.go @@ -118,14 +118,26 @@ func TestGenerateChain(t *testing.T) { if big.NewInt(5).Cmp(current(m, tx).Number()) != 0 { t.Errorf("wrong block number: %d", current(m, tx).Number()) } - if !uint256.NewInt(989000).Eq(st.GetBalance(addr1)) { - t.Errorf("wrong balance of addr1: %s", st.GetBalance(addr1)) + balance, err := st.GetBalance(addr1) + if err != nil { + t.Error(err) + } + if !uint256.NewInt(989000).Eq(balance) { + t.Errorf("wrong balance of addr1: %s", balance) + } + balance, err = st.GetBalance(addr2) + if err != nil { + t.Error(err) + } + if !uint256.NewInt(10000).Eq(balance) { + t.Errorf("wrong balance of addr2: %s", balance) } - if !uint256.NewInt(10000).Eq(st.GetBalance(addr2)) { - t.Errorf("wrong balance of addr2: %s", st.GetBalance(addr2)) + balance, err = st.GetBalance(addr3) + if err != nil { + t.Error(err) } - if fmt.Sprintf("%s", st.GetBalance(addr3)) != "19687500000000001000" { //nolint - t.Errorf("wrong balance of addr3: %s", st.GetBalance(addr3)) + if fmt.Sprintf("%s", balance) != "19687500000000001000" { //nolint + t.Errorf("wrong balance of addr3: %s", balance) } if sentry_multi_client.EnableP2PReceipts { From 3e9f60b92627d940ffc8697f37ab8ed32bfe749f Mon Sep 17 00:00:00 2001 From: Ostroukhov Nikita Date: Sun, 1 Dec 2024 13:47:11 +0000 Subject: [PATCH 24/25] Added grafana dashboards for new metrics (#12927) --- cmd/prometheus/dashboards/erigon.json | 327 ++++++++++++++++++ .../dashboards/erigon_internals.json | 327 ++++++++++++++++++ 2 files changed, 654 insertions(+) diff --git a/cmd/prometheus/dashboards/erigon.json b/cmd/prometheus/dashboards/erigon.json index 78dc8885059..732cbe2338a 100644 --- a/cmd/prometheus/dashboards/erigon.json +++ b/cmd/prometheus/dashboards/erigon.json @@ -1199,6 +1199,333 @@ "title": "Block consume delay", "type": "row" }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 16, + "y": 25 + }, + "id": 201, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "pluginVersion": "11.2.0-74515", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "update_fork_choice{type=\"arrival_delay\",instance=~\"$instance\",quantile=\"$quantile\"}", + "hide": false, + "legendFormat": "arrival_delay: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "update_fork_choice{type=\"execution_duration\",instance=~\"$instance\",quantile=\"$quantile\"}", + "hide": false, + "legendFormat": "execution_duration: {{instance}}", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "wiggle_duration{instance=~\"$instance\",quantile=\"$quantile\"}", + "hide": false, + "legendFormat": "wiggle_duration: {{instance}}", + "range": true, + "refId": "C" + } + ], + "title": "Update fork delays", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 16, + "y": 25 + }, + "id": 201, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "pluginVersion": "11.2.0-74515", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "update_fork_choice{type=\"fork_depth\",instance=~\"$instance\",quantile=\"$quantile\"}", + "hide": false, + "legendFormat": "fork_depth: {{instance}}", + "range": true, + "refId": "A" + } + ], + "title": "Update fork depth", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 16, + "y": 25 + }, + "id": 201, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "pluginVersion": "11.2.0-74515", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "waypoint_length{type=\"checkpoint\",instance=~\"$instance\"}", + "hide": false, + "legendFormat": "checkpoint_length: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "waypoint_length{type=\"milestone\",instance=~\"$instance\"}", + "hide": false, + "legendFormat": "milestone_length: {{instance}}", + "range": true, + "refId": "B" + } + ], + "title": "Block finalisation", + "type": "timeseries" + }, { "datasource": { "type": "prometheus", diff --git a/cmd/prometheus/dashboards/erigon_internals.json b/cmd/prometheus/dashboards/erigon_internals.json index a38fa3565d3..1eda9d39e20 100644 --- a/cmd/prometheus/dashboards/erigon_internals.json +++ b/cmd/prometheus/dashboards/erigon_internals.json @@ -1453,6 +1453,333 @@ "title": "Block execution delays", "type": "timeseries" }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 16, + "y": 25 + }, + "id": 201, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "pluginVersion": "11.2.0-74515", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "update_fork_choice{type=\"arrival_delay\",instance=~\"$instance\",quantile=\"$quantile\"}", + "hide": false, + "legendFormat": "arrival_delay: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "update_fork_choice{type=\"execution_duration\",instance=~\"$instance\",quantile=\"$quantile\"}", + "hide": false, + "legendFormat": "execution_duration: {{instance}}", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "wiggle_duration{instance=~\"$instance\",quantile=\"$quantile\"}", + "hide": false, + "legendFormat": "wiggle_duration: {{instance}}", + "range": true, + "refId": "C" + } + ], + "title": "Update fork delays", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 16, + "y": 25 + }, + "id": 201, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "pluginVersion": "11.2.0-74515", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "update_fork_choice{type=\"fork_depth\",instance=~\"$instance\",quantile=\"$quantile\"}", + "hide": false, + "legendFormat": "fork_depth: {{instance}}", + "range": true, + "refId": "A" + } + ], + "title": "Update fork depth", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 16, + "y": 25 + }, + "id": 201, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "pluginVersion": "11.2.0-74515", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "waypoint_length{type=\"checkpoint\",instance=~\"$instance\"}", + "hide": false, + "legendFormat": "checkpoint_length: {{instance}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "waypoint_length{type=\"milestone\",instance=~\"$instance\"}", + "hide": false, + "legendFormat": "milestone_length: {{instance}}", + "range": true, + "refId": "B" + } + ], + "title": "Block finalisation", + "type": "timeseries" + }, { "datasource": { "type": "prometheus", From aa54d1d49a9745f1203cdc9501152f5732f0764e Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Mon, 2 Dec 2024 08:57:44 +0700 Subject: [PATCH 25/25] sd: modern go1.20+ cast from/to string (#12935) --- erigon-lib/state/domain_shared.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/erigon-lib/state/domain_shared.go b/erigon-lib/state/domain_shared.go index db42e834f82..9af26644f0c 100644 --- a/erigon-lib/state/domain_shared.go +++ b/erigon-lib/state/domain_shared.go @@ -620,7 +620,7 @@ func (sd *SharedDomains) updateAccountCode(addr, code, prevCode []byte, prevStep func (sd *SharedDomains) updateCommitmentData(prefix string, data, prev []byte, prevStep uint64) error { sd.put(kv.CommitmentDomain, prefix, data) - return sd.domainWriters[kv.CommitmentDomain].PutWithPrev([]byte(prefix), nil, data, prev, prevStep) + return sd.domainWriters[kv.CommitmentDomain].PutWithPrev(toBytesZeroCopy(prefix), nil, data, prev, prevStep) } func (sd *SharedDomains) deleteAccount(addr, prev []byte, prevStep uint64) error { @@ -818,7 +818,7 @@ func (sd *SharedDomains) IterateStoragePrefix(prefix []byte, it func(k []byte, v switch ci1.t { case RAM_CURSOR: if ci1.iter.Next() { - k = []byte(ci1.iter.Key()) + k = toBytesZeroCopy(ci1.iter.Key()) if k != nil && bytes.HasPrefix(k, prefix) { ci1.key = common.Copy(k) ci1.val = common.Copy(ci1.iter.Value().data) @@ -906,8 +906,8 @@ func (sd *SharedDomains) Close() { func (sd *SharedDomains) Flush(ctx context.Context, tx kv.RwTx) error { for key, changeset := range sd.pastChangesAccumulator { - blockNum := binary.BigEndian.Uint64([]byte(key[:8])) - blockHash := common.BytesToHash([]byte(key[8:])) + blockNum := binary.BigEndian.Uint64(toBytesZeroCopy(key[:8])) + blockHash := common.BytesToHash(toBytesZeroCopy(key[8:])) if err := WriteDiffSet(tx, blockNum, blockHash, changeset); err != nil { return err } @@ -1468,4 +1468,5 @@ func (sdc *SharedDomainsCommitmentContext) restorePatriciaState(value []byte) (u return cs.blockNum, cs.txNum, nil } -func toStringZeroCopy(v []byte) string { return *(*string)(unsafe.Pointer(&v)) } +func toStringZeroCopy(v []byte) string { return unsafe.String(&v[0], len(v)) } +func toBytesZeroCopy(s string) []byte { return unsafe.Slice(unsafe.StringData(s), len(s)) }