From 26fdf9169d27489baeaa990253ab3b539d873138 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Tue, 25 Oct 2022 09:58:25 +0700 Subject: [PATCH] move all packages from "internal" folder - to simplify users live (#5857) --- cmd/abigen/main.go | 4 +-- cmd/bootnode/main.go | 2 +- cmd/downloader/main.go | 8 ++--- cmd/erigon/main.go | 2 +- cmd/evm/main.go | 4 +-- cmd/evm/t8n_test.go | 2 +- cmd/hack/hack.go | 4 +-- cmd/integration/commands/root.go | 4 +-- cmd/observer/observer/command.go | 4 +-- cmd/rpcdaemon/cli/config.go | 4 +-- cmd/rpcdaemon/commands/debug_api.go | 2 +- cmd/rpcdaemon/commands/debug_api_test.go | 2 +- cmd/rpcdaemon/commands/erigon_block.go | 4 +-- cmd/rpcdaemon/commands/eth_api.go | 8 ++--- cmd/rpcdaemon/commands/eth_api_test.go | 2 +- cmd/rpcdaemon/commands/eth_call.go | 14 ++++---- cmd/rpcdaemon/commands/eth_callMany.go | 5 ++- cmd/rpcdaemon/commands/eth_callMany_test.go | 2 +- cmd/rpcdaemon/commands/eth_call_test.go | 12 +++---- cmd/rpcdaemon/commands/tracing.go | 2 +- cmd/rpcdaemon/main.go | 2 +- cmd/sentry/main.go | 8 ++--- cmd/state/commands/erigon2.go | 2 +- cmd/state/commands/erigon23.go | 2 +- cmd/state/commands/root.go | 4 +-- cmd/txpool/main.go | 8 ++--- cmd/utils/cmd.go | 2 +- consensus/ethash/sealer_test.go | 2 +- core/vm/evm_test.go | 4 +-- eth/tracers/api.go | 2 +- go.mod | 10 +++--- go.sum | 19 ++++++----- node/rpcstack_test.go | 2 +- p2p/dial_test.go | 2 +- p2p/discover/v4_udp_test.go | 2 +- p2p/discover/v5_udp_test.go | 2 +- p2p/dnsdisc/client_test.go | 2 +- p2p/server_test.go | 2 +- {internal => turbo/adapter}/ethapi/api.go | 6 ++-- {internal => turbo/adapter}/ethapi/backend.go | 0 .../adapter}/ethapi/get_proof.go | 0 turbo/adapter/ethapi/internal.go | 34 ++----------------- .../adapter}/ethapi/state_overrides.go | 0 turbo/app/make_app.go | 7 ++-- turbo/app/snapshots.go | 4 +-- turbo/cli/default_flags.go | 2 +- {internal/flags => turbo/cli}/helpers.go | 2 +- {internal => turbo}/cmdtest/test_cmd.go | 0 {internal => turbo}/debug/api.go | 0 {internal => turbo}/debug/flags.go | 2 +- {internal => turbo}/debug/loudpanic.go | 0 .../debug/loudpanic_fallback.go | 0 {internal => turbo}/debug/signal.go | 0 {internal => turbo}/debug/signal_windows.go | 0 {internal => turbo}/debug/trace.go | 0 {internal => turbo}/debug/trace_fallback.go | 0 {internal => turbo}/logging/flags.go | 0 {internal => turbo}/logging/logging.go | 0 {internal => turbo}/testlog/testlog.go | 0 turbo/transactions/call.go | 6 ++-- 60 files changed, 100 insertions(+), 131 deletions(-) rename {internal => turbo/adapter}/ethapi/api.go (99%) rename {internal => turbo/adapter}/ethapi/backend.go (100%) rename {internal => turbo/adapter}/ethapi/get_proof.go (100%) rename {internal => turbo/adapter}/ethapi/state_overrides.go (100%) rename {internal/flags => turbo/cli}/helpers.go (99%) rename {internal => turbo}/cmdtest/test_cmd.go (100%) rename {internal => turbo}/debug/api.go (100%) rename {internal => turbo}/debug/flags.go (99%) rename {internal => turbo}/debug/loudpanic.go (100%) rename {internal => turbo}/debug/loudpanic_fallback.go (100%) rename {internal => turbo}/debug/signal.go (100%) rename {internal => turbo}/debug/signal_windows.go (100%) rename {internal => turbo}/debug/trace.go (100%) rename {internal => turbo}/debug/trace_fallback.go (100%) rename {internal => turbo}/logging/flags.go (100%) rename {internal => turbo}/logging/logging.go (100%) rename {internal => turbo}/testlog/testlog.go (100%) diff --git a/cmd/abigen/main.go b/cmd/abigen/main.go index 1f749c98b..97ef5405a 100644 --- a/cmd/abigen/main.go +++ b/cmd/abigen/main.go @@ -30,8 +30,8 @@ import ( "github.com/ledgerwatch/erigon/cmd/utils" "github.com/ledgerwatch/erigon/common/compiler" "github.com/ledgerwatch/erigon/crypto" - "github.com/ledgerwatch/erigon/internal/flags" "github.com/ledgerwatch/erigon/params" + cli2 "github.com/ledgerwatch/erigon/turbo/cli" "github.com/ledgerwatch/log/v3" "github.com/urfave/cli" ) @@ -98,7 +98,7 @@ var ( ) func init() { - app = flags.NewApp(params.GitCommit, "", "ethereum checkpoint helper tool") + app = cli2.NewApp(params.GitCommit, "", "ethereum checkpoint helper tool") app.Flags = []cli.Flag{ abiFlag, binFlag, diff --git a/cmd/bootnode/main.go b/cmd/bootnode/main.go index a2f8f9972..2d400b1f8 100644 --- a/cmd/bootnode/main.go +++ b/cmd/bootnode/main.go @@ -25,10 +25,10 @@ import ( "os" "github.com/ledgerwatch/erigon-lib/common" + "github.com/ledgerwatch/erigon/turbo/logging" "github.com/ledgerwatch/erigon/cmd/utils" "github.com/ledgerwatch/erigon/crypto" - "github.com/ledgerwatch/erigon/internal/logging" "github.com/ledgerwatch/erigon/p2p/discover" "github.com/ledgerwatch/erigon/p2p/enode" "github.com/ledgerwatch/erigon/p2p/nat" diff --git a/cmd/downloader/main.go b/cmd/downloader/main.go index 42a32ba24..aa1cbaa1c 100644 --- a/cmd/downloader/main.go +++ b/cmd/downloader/main.go @@ -18,10 +18,10 @@ import ( "github.com/ledgerwatch/erigon/cmd/downloader/downloader/downloadercfg" "github.com/ledgerwatch/erigon/cmd/utils" "github.com/ledgerwatch/erigon/common/paths" - "github.com/ledgerwatch/erigon/internal/debug" - "github.com/ledgerwatch/erigon/internal/logging" "github.com/ledgerwatch/erigon/node/nodecfg/datadir" "github.com/ledgerwatch/erigon/p2p/nat" + "github.com/ledgerwatch/erigon/turbo/debug" + logging2 "github.com/ledgerwatch/erigon/turbo/logging" "github.com/ledgerwatch/log/v3" "github.com/pelletier/go-toml/v2" "github.com/spf13/cobra" @@ -49,7 +49,7 @@ var ( ) func init() { - utils.CobraFlags(rootCmd, debug.Flags, utils.MetricFlags, logging.Flags) + utils.CobraFlags(rootCmd, debug.Flags, utils.MetricFlags, logging2.Flags) withDataDir(rootCmd) @@ -104,7 +104,7 @@ var rootCmd = &cobra.Command{ debug.Exit() }, RunE: func(cmd *cobra.Command, args []string) error { - _ = logging.GetLoggerCmd("downloader", cmd) + _ = logging2.GetLoggerCmd("downloader", cmd) if err := Downloader(cmd.Context()); err != nil { log.Error("Downloader", "err", err) return nil diff --git a/cmd/erigon/main.go b/cmd/erigon/main.go index e56b4f9ff..407494521 100644 --- a/cmd/erigon/main.go +++ b/cmd/erigon/main.go @@ -8,13 +8,13 @@ import ( "reflect" "strings" + "github.com/ledgerwatch/erigon/turbo/logging" "github.com/pelletier/go-toml" "github.com/urfave/cli" "gopkg.in/yaml.v2" "github.com/ledgerwatch/erigon-lib/common/dbg" "github.com/ledgerwatch/erigon/cmd/utils" - "github.com/ledgerwatch/erigon/internal/logging" "github.com/ledgerwatch/erigon/params" erigonapp "github.com/ledgerwatch/erigon/turbo/app" erigoncli "github.com/ledgerwatch/erigon/turbo/cli" diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 3c95823ac..c9aa8f566 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -22,17 +22,17 @@ import ( "math/big" "os" + cli2 "github.com/ledgerwatch/erigon/turbo/cli" "github.com/ledgerwatch/log/v3" "github.com/ledgerwatch/erigon/cmd/evm/internal/t8ntool" "github.com/ledgerwatch/erigon/cmd/utils" - "github.com/ledgerwatch/erigon/internal/flags" "github.com/ledgerwatch/erigon/params" "github.com/urfave/cli" ) var ( - app = flags.NewApp(params.GitCommit, "", "the evm command line interface") + app = cli2.NewApp(params.GitCommit, "", "the evm command line interface") DebugFlag = cli.BoolFlag{ Name: "debug", diff --git a/cmd/evm/t8n_test.go b/cmd/evm/t8n_test.go index 4e2ad027e..e5bd4ab19 100644 --- a/cmd/evm/t8n_test.go +++ b/cmd/evm/t8n_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/docker/docker/pkg/reexec" - "github.com/ledgerwatch/erigon/internal/cmdtest" + "github.com/ledgerwatch/erigon/turbo/cmdtest" ) func TestMain(m *testing.M) { diff --git a/cmd/hack/hack.go b/cmd/hack/hack.go index d62465431..dda8c3597 100644 --- a/cmd/hack/hack.go +++ b/cmd/hack/hack.go @@ -25,6 +25,8 @@ import ( "github.com/ledgerwatch/erigon-lib/kv/mdbx" "github.com/ledgerwatch/erigon-lib/recsplit" "github.com/ledgerwatch/erigon-lib/recsplit/eliasfano32" + "github.com/ledgerwatch/erigon/turbo/debug" + "github.com/ledgerwatch/erigon/turbo/logging" "golang.org/x/exp/slices" hackdb "github.com/ledgerwatch/erigon/cmd/hack/db" @@ -43,8 +45,6 @@ import ( "github.com/ledgerwatch/erigon/eth/stagedsync/stages" "github.com/ledgerwatch/erigon/ethdb" "github.com/ledgerwatch/erigon/ethdb/cbor" - "github.com/ledgerwatch/erigon/internal/debug" - "github.com/ledgerwatch/erigon/internal/logging" "github.com/ledgerwatch/erigon/params" "github.com/ledgerwatch/erigon/rlp" "github.com/ledgerwatch/erigon/turbo/snapshotsync" diff --git a/cmd/integration/commands/root.go b/cmd/integration/commands/root.go index 85f16307b..a5b76e262 100644 --- a/cmd/integration/commands/root.go +++ b/cmd/integration/commands/root.go @@ -8,9 +8,9 @@ import ( "github.com/ledgerwatch/erigon-lib/kv" kv2 "github.com/ledgerwatch/erigon-lib/kv/mdbx" "github.com/ledgerwatch/erigon/cmd/utils" - "github.com/ledgerwatch/erigon/internal/debug" - "github.com/ledgerwatch/erigon/internal/logging" "github.com/ledgerwatch/erigon/migrations" + "github.com/ledgerwatch/erigon/turbo/debug" + "github.com/ledgerwatch/erigon/turbo/logging" "github.com/ledgerwatch/log/v3" "github.com/spf13/cobra" "github.com/torquem-ch/mdbx-go/mdbx" diff --git a/cmd/observer/observer/command.go b/cmd/observer/observer/command.go index 20a2c5314..825af48a7 100644 --- a/cmd/observer/observer/command.go +++ b/cmd/observer/observer/command.go @@ -7,8 +7,8 @@ import ( "time" "github.com/ledgerwatch/erigon/cmd/utils" - "github.com/ledgerwatch/erigon/internal/debug" - "github.com/ledgerwatch/erigon/internal/logging" + "github.com/ledgerwatch/erigon/turbo/debug" + "github.com/ledgerwatch/erigon/turbo/logging" "github.com/spf13/cobra" "github.com/urfave/cli" ) diff --git a/cmd/rpcdaemon/cli/config.go b/cmd/rpcdaemon/cli/config.go index 7e9192bb3..9bc02d3c9 100644 --- a/cmd/rpcdaemon/cli/config.go +++ b/cmd/rpcdaemon/cli/config.go @@ -17,6 +17,8 @@ import ( libstate "github.com/ledgerwatch/erigon-lib/state" "github.com/ledgerwatch/erigon/eth/ethconfig" "github.com/ledgerwatch/erigon/rpc/rpccfg" + "github.com/ledgerwatch/erigon/turbo/debug" + "github.com/ledgerwatch/erigon/turbo/logging" "github.com/ledgerwatch/erigon-lib/direct" "github.com/ledgerwatch/erigon-lib/gointerfaces" @@ -36,8 +38,6 @@ import ( "github.com/ledgerwatch/erigon/common/hexutil" "github.com/ledgerwatch/erigon/common/paths" "github.com/ledgerwatch/erigon/core/rawdb" - "github.com/ledgerwatch/erigon/internal/debug" - "github.com/ledgerwatch/erigon/internal/logging" "github.com/ledgerwatch/erigon/node" "github.com/ledgerwatch/erigon/node/nodecfg" "github.com/ledgerwatch/erigon/node/nodecfg/datadir" diff --git a/cmd/rpcdaemon/commands/debug_api.go b/cmd/rpcdaemon/commands/debug_api.go index a3c5debbd..e394ff6f8 100644 --- a/cmd/rpcdaemon/commands/debug_api.go +++ b/cmd/rpcdaemon/commands/debug_api.go @@ -15,8 +15,8 @@ import ( "github.com/ledgerwatch/erigon/core/types" "github.com/ledgerwatch/erigon/eth/stagedsync/stages" "github.com/ledgerwatch/erigon/eth/tracers" - "github.com/ledgerwatch/erigon/internal/ethapi" "github.com/ledgerwatch/erigon/rpc" + "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" "github.com/ledgerwatch/erigon/turbo/transactions" "github.com/ledgerwatch/log/v3" ) diff --git a/cmd/rpcdaemon/commands/debug_api_test.go b/cmd/rpcdaemon/commands/debug_api_test.go index 5a0d8581b..f974f8b1a 100644 --- a/cmd/rpcdaemon/commands/debug_api_test.go +++ b/cmd/rpcdaemon/commands/debug_api_test.go @@ -11,9 +11,9 @@ import ( "github.com/ledgerwatch/erigon/cmd/rpcdaemon/rpcdaemontest" "github.com/ledgerwatch/erigon/common" "github.com/ledgerwatch/erigon/eth/tracers" - "github.com/ledgerwatch/erigon/internal/ethapi" "github.com/ledgerwatch/erigon/rpc" "github.com/ledgerwatch/erigon/rpc/rpccfg" + "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" "github.com/ledgerwatch/erigon/turbo/snapshotsync" ) diff --git a/cmd/rpcdaemon/commands/erigon_block.go b/cmd/rpcdaemon/commands/erigon_block.go index b017e38a5..8b09e0aba 100644 --- a/cmd/rpcdaemon/commands/erigon_block.go +++ b/cmd/rpcdaemon/commands/erigon_block.go @@ -16,8 +16,8 @@ import ( "github.com/ledgerwatch/erigon/core/rawdb" "github.com/ledgerwatch/erigon/core/types" "github.com/ledgerwatch/erigon/core/types/accounts" - "github.com/ledgerwatch/erigon/internal/ethapi" "github.com/ledgerwatch/erigon/rpc" + "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" "github.com/ledgerwatch/erigon/turbo/rpchelper" ) @@ -164,7 +164,7 @@ func buildBlockResponse(db kv.Tx, blockNum uint64, fullTx bool) (map[string]inte return nil, nil } - response, err := ethapi.RPCMarshalBlock(block, true, fullTx) + response, err := ethapi.RPCMarshalBlockDeprecated(block, true, fullTx) if err == nil && rpc.BlockNumber(block.NumberU64()) == rpc.PendingBlockNumber { // Pending blocks need to nil out a few fields diff --git a/cmd/rpcdaemon/commands/eth_api.go b/cmd/rpcdaemon/commands/eth_api.go index aa05c310c..07b15d4fa 100644 --- a/cmd/rpcdaemon/commands/eth_api.go +++ b/cmd/rpcdaemon/commands/eth_api.go @@ -20,9 +20,9 @@ import ( "github.com/ledgerwatch/erigon/core/rawdb" "github.com/ledgerwatch/erigon/core/types" ethFilters "github.com/ledgerwatch/erigon/eth/filters" - "github.com/ledgerwatch/erigon/internal/ethapi" "github.com/ledgerwatch/erigon/params" "github.com/ledgerwatch/erigon/rpc" + ethapi2 "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" "github.com/ledgerwatch/erigon/turbo/rpchelper" "github.com/ledgerwatch/erigon/turbo/services" "github.com/ledgerwatch/log/v3" @@ -77,14 +77,14 @@ type EthAPI interface { GasPrice(_ context.Context) (*hexutil.Big, error) // Sending related (see ./eth_call.go) - Call(ctx context.Context, args ethapi.CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *ethapi.StateOverrides) (hexutil.Bytes, error) - EstimateGas(ctx context.Context, argsOrNil *ethapi.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) + Call(ctx context.Context, args ethapi2.CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *ethapi2.StateOverrides) (hexutil.Bytes, error) + EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) SendRawTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error) SendTransaction(_ context.Context, txObject interface{}) (common.Hash, error) Sign(ctx context.Context, _ common.Address, _ hexutil.Bytes) (hexutil.Bytes, error) SignTransaction(_ context.Context, txObject interface{}) (common.Hash, error) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNr rpc.BlockNumber) (*interface{}, error) - CreateAccessList(ctx context.Context, args ethapi.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash, optimizeGas *bool) (*accessListResult, error) + CreateAccessList(ctx context.Context, args ethapi2.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash, optimizeGas *bool) (*accessListResult, error) // Mining related (see ./eth_mining.go) Coinbase(ctx context.Context) (common.Address, error) diff --git a/cmd/rpcdaemon/commands/eth_api_test.go b/cmd/rpcdaemon/commands/eth_api_test.go index 66c69eae6..dac274308 100644 --- a/cmd/rpcdaemon/commands/eth_api_test.go +++ b/cmd/rpcdaemon/commands/eth_api_test.go @@ -8,9 +8,9 @@ import ( "github.com/holiman/uint256" "github.com/ledgerwatch/erigon/common/hexutil" "github.com/ledgerwatch/erigon/core" - "github.com/ledgerwatch/erigon/internal/ethapi" "github.com/ledgerwatch/erigon/rpc" "github.com/ledgerwatch/erigon/rpc/rpccfg" + "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" "github.com/ledgerwatch/erigon/turbo/snapshotsync" "github.com/stretchr/testify/assert" diff --git a/cmd/rpcdaemon/commands/eth_call.go b/cmd/rpcdaemon/commands/eth_call.go index d78b56f2c..a527aa576 100644 --- a/cmd/rpcdaemon/commands/eth_call.go +++ b/cmd/rpcdaemon/commands/eth_call.go @@ -10,6 +10,7 @@ import ( "github.com/ledgerwatch/erigon-lib/gointerfaces" txpool_proto "github.com/ledgerwatch/erigon-lib/gointerfaces/txpool" "github.com/ledgerwatch/erigon-lib/kv" + ethapi2 "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" "github.com/ledgerwatch/log/v3" "google.golang.org/grpc" @@ -21,7 +22,6 @@ import ( "github.com/ledgerwatch/erigon/core/vm" "github.com/ledgerwatch/erigon/crypto" "github.com/ledgerwatch/erigon/eth/tracers/logger" - "github.com/ledgerwatch/erigon/internal/ethapi" "github.com/ledgerwatch/erigon/params" "github.com/ledgerwatch/erigon/rpc" "github.com/ledgerwatch/erigon/turbo/rpchelper" @@ -29,7 +29,7 @@ import ( ) // Call implements eth_call. Executes a new message call immediately without creating a transaction on the block chain. -func (api *APIImpl) Call(ctx context.Context, args ethapi.CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *ethapi.StateOverrides) (hexutil.Bytes, error) { +func (api *APIImpl) Call(ctx context.Context, args ethapi2.CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *ethapi2.StateOverrides) (hexutil.Bytes, error) { tx, err := api.db.BeginRo(ctx) if err != nil { return nil, err @@ -68,7 +68,7 @@ func (api *APIImpl) Call(ctx context.Context, args ethapi.CallArgs, blockNrOrHas // If the result contains a revert reason, try to unpack and return it. if len(result.Revert()) > 0 { - return nil, ethapi.NewRevertError(result) + return nil, ethapi2.NewRevertError(result) } return result.Return(), result.Err @@ -89,8 +89,8 @@ func headerByNumberOrHash(ctx context.Context, tx kv.Tx, blockNrOrHash rpc.Block } // EstimateGas implements eth_estimateGas. Returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. -func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) { - var args ethapi.CallArgs +func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) { + var args ethapi2.CallArgs // if we actually get CallArgs here, we use them if argsOrNil != nil { args = *argsOrNil @@ -263,7 +263,7 @@ func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi.CallArgs, if failed { if result != nil && !errors.Is(result.Err, vm.ErrOutOfGas) { if len(result.Revert()) > 0 { - return 0, ethapi.NewRevertError(result) + return 0, ethapi2.NewRevertError(result) } return 0, result.Err } @@ -292,7 +292,7 @@ type accessListResult struct { // CreateAccessList implements eth_createAccessList. It creates an access list for the given transaction. // If the accesslist creation fails an error is returned. // If the transaction itself fails, an vmErr is returned. -func (api *APIImpl) CreateAccessList(ctx context.Context, args ethapi.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash, optimizeGas *bool) (*accessListResult, error) { +func (api *APIImpl) CreateAccessList(ctx context.Context, args ethapi2.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash, optimizeGas *bool) (*accessListResult, error) { bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber) if blockNrOrHash != nil { bNrOrHash = *blockNrOrHash diff --git a/cmd/rpcdaemon/commands/eth_callMany.go b/cmd/rpcdaemon/commands/eth_callMany.go index b445eb200..305e460f9 100644 --- a/cmd/rpcdaemon/commands/eth_callMany.go +++ b/cmd/rpcdaemon/commands/eth_callMany.go @@ -16,7 +16,6 @@ import ( "github.com/ledgerwatch/erigon/core/state" "github.com/ledgerwatch/erigon/core/types" "github.com/ledgerwatch/erigon/core/vm" - rpcapi "github.com/ledgerwatch/erigon/internal/ethapi" "github.com/ledgerwatch/erigon/rpc" "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" "github.com/ledgerwatch/erigon/turbo/rpchelper" @@ -34,7 +33,7 @@ type BlockOverrides struct { } type Bundle struct { - Transactions []rpcapi.CallArgs + Transactions []ethapi.CallArgs BlockOverride BlockOverrides } @@ -69,7 +68,7 @@ func blockHeaderOverride(blockCtx *vm.BlockContext, blockOverride BlockOverrides } } -func (api *APIImpl) CallMany(ctx context.Context, bundles []Bundle, simulateContext StateContext, stateOverride *rpcapi.StateOverrides, timeoutMilliSecondsPtr *int64) ([][]map[string]interface{}, error) { +func (api *APIImpl) CallMany(ctx context.Context, bundles []Bundle, simulateContext StateContext, stateOverride *ethapi.StateOverrides, timeoutMilliSecondsPtr *int64) ([][]map[string]interface{}, error) { var ( hash common.Hash replayTransactions types.Transactions diff --git a/cmd/rpcdaemon/commands/eth_callMany_test.go b/cmd/rpcdaemon/commands/eth_callMany_test.go index 750e08533..c6f73433b 100644 --- a/cmd/rpcdaemon/commands/eth_callMany_test.go +++ b/cmd/rpcdaemon/commands/eth_callMany_test.go @@ -15,10 +15,10 @@ import ( "github.com/ledgerwatch/erigon/common/hexutil" "github.com/ledgerwatch/erigon/core" "github.com/ledgerwatch/erigon/crypto" - "github.com/ledgerwatch/erigon/internal/ethapi" "github.com/ledgerwatch/erigon/params" "github.com/ledgerwatch/erigon/rpc" "github.com/ledgerwatch/erigon/rpc/rpccfg" + "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" ) // block 1 contains 3 Transactions diff --git a/cmd/rpcdaemon/commands/eth_call_test.go b/cmd/rpcdaemon/commands/eth_call_test.go index beb8cf884..1cc28adf2 100644 --- a/cmd/rpcdaemon/commands/eth_call_test.go +++ b/cmd/rpcdaemon/commands/eth_call_test.go @@ -8,6 +8,7 @@ import ( "time" "github.com/ledgerwatch/erigon/rpc/rpccfg" + "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" "github.com/holiman/uint256" "github.com/stretchr/testify/assert" @@ -24,7 +25,6 @@ import ( "github.com/ledgerwatch/erigon/core/state" "github.com/ledgerwatch/erigon/core/types" "github.com/ledgerwatch/erigon/crypto" - "github.com/ledgerwatch/erigon/internal/ethapi" "github.com/ledgerwatch/erigon/params" "github.com/ledgerwatch/erigon/rpc" "github.com/ledgerwatch/erigon/turbo/rpchelper" @@ -110,7 +110,7 @@ func TestGetBlockByTimestampLatestTime(t *testing.T) { api := NewErigonAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout), m.DB, nil) latestBlock := rawdb.ReadCurrentBlock(tx) - response, err := ethapi.RPCMarshalBlock(latestBlock, true, false) + response, err := ethapi.RPCMarshalBlockDeprecated(latestBlock, true, false) if err != nil { t.Error("couldn't get the rpc marshal block") @@ -152,7 +152,7 @@ func TestGetBlockByTimestampOldestTime(t *testing.T) { t.Error("couldn't retrieve oldest block") } - response, err := ethapi.RPCMarshalBlock(oldestBlock, true, false) + response, err := ethapi.RPCMarshalBlockDeprecated(oldestBlock, true, false) if err != nil { t.Error("couldn't get the rpc marshal block") @@ -191,7 +191,7 @@ func TestGetBlockByTimeHigherThanLatestBlock(t *testing.T) { latestBlock := rawdb.ReadCurrentBlock(tx) - response, err := ethapi.RPCMarshalBlock(latestBlock, true, false) + response, err := ethapi.RPCMarshalBlockDeprecated(latestBlock, true, false) if err != nil { t.Error("couldn't get the rpc marshal block") @@ -243,7 +243,7 @@ func TestGetBlockByTimeMiddle(t *testing.T) { t.Error("couldn't retrieve middle block") } - response, err := ethapi.RPCMarshalBlock(middleBlock, true, false) + response, err := ethapi.RPCMarshalBlockDeprecated(middleBlock, true, false) if err != nil { t.Error("couldn't get the rpc marshal block") @@ -289,7 +289,7 @@ func TestGetBlockByTimestamp(t *testing.T) { if pickedBlock == nil { t.Error("couldn't retrieve picked block") } - response, err := ethapi.RPCMarshalBlock(pickedBlock, true, false) + response, err := ethapi.RPCMarshalBlockDeprecated(pickedBlock, true, false) if err != nil { t.Error("couldn't get the rpc marshal block") diff --git a/cmd/rpcdaemon/commands/tracing.go b/cmd/rpcdaemon/commands/tracing.go index 7ff0707b4..4ae620acd 100644 --- a/cmd/rpcdaemon/commands/tracing.go +++ b/cmd/rpcdaemon/commands/tracing.go @@ -18,8 +18,8 @@ import ( "github.com/ledgerwatch/erigon/core/types" "github.com/ledgerwatch/erigon/core/vm" "github.com/ledgerwatch/erigon/eth/tracers" - "github.com/ledgerwatch/erigon/internal/ethapi" "github.com/ledgerwatch/erigon/rpc" + "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" "github.com/ledgerwatch/erigon/turbo/rpchelper" "github.com/ledgerwatch/erigon/turbo/transactions" "github.com/ledgerwatch/log/v3" diff --git a/cmd/rpcdaemon/main.go b/cmd/rpcdaemon/main.go index b528ea48b..7be5cae56 100644 --- a/cmd/rpcdaemon/main.go +++ b/cmd/rpcdaemon/main.go @@ -6,7 +6,7 @@ import ( "github.com/ledgerwatch/erigon-lib/common" "github.com/ledgerwatch/erigon/cmd/rpcdaemon/cli" "github.com/ledgerwatch/erigon/cmd/rpcdaemon/commands" - "github.com/ledgerwatch/erigon/internal/logging" + "github.com/ledgerwatch/erigon/turbo/logging" "github.com/ledgerwatch/log/v3" "github.com/spf13/cobra" ) diff --git a/cmd/sentry/main.go b/cmd/sentry/main.go index 13ad56522..d3318f3c0 100644 --- a/cmd/sentry/main.go +++ b/cmd/sentry/main.go @@ -8,9 +8,9 @@ import ( "github.com/ledgerwatch/erigon/cmd/sentry/sentry" "github.com/ledgerwatch/erigon/cmd/utils" "github.com/ledgerwatch/erigon/common/paths" - "github.com/ledgerwatch/erigon/internal/debug" - "github.com/ledgerwatch/erigon/internal/logging" "github.com/ledgerwatch/erigon/node/nodecfg/datadir" + "github.com/ledgerwatch/erigon/turbo/debug" + logging2 "github.com/ledgerwatch/erigon/turbo/logging" node2 "github.com/ledgerwatch/erigon/turbo/node" "github.com/spf13/cobra" ) @@ -35,7 +35,7 @@ var ( ) func init() { - utils.CobraFlags(rootCmd, debug.Flags, utils.MetricFlags, logging.Flags) + utils.CobraFlags(rootCmd, debug.Flags, utils.MetricFlags, logging2.Flags) rootCmd.Flags().StringVar(&sentryAddr, "sentry.api.addr", "localhost:9091", "grpc addresses") rootCmd.Flags().StringVar(&datadirCli, utils.DataDirFlag.Name, paths.DefaultDataDir(), utils.DataDirFlag.Usage) @@ -87,7 +87,7 @@ var rootCmd = &cobra.Command{ return err } - _ = logging.GetLoggerCmd("sentry", cmd) + _ = logging2.GetLoggerCmd("sentry", cmd) return sentry.Sentry(cmd.Context(), dirs, sentryAddr, discoveryDNS, p2pConfig, uint(protocol), healthCheck) }, } diff --git a/cmd/state/commands/erigon2.go b/cmd/state/commands/erigon2.go index 93106090a..7cd5f6572 100644 --- a/cmd/state/commands/erigon2.go +++ b/cmd/state/commands/erigon2.go @@ -23,7 +23,7 @@ import ( "github.com/ledgerwatch/erigon-lib/kv/mdbx" kv2 "github.com/ledgerwatch/erigon-lib/kv/mdbx" "github.com/ledgerwatch/erigon/eth/ethconsensusconfig" - "github.com/ledgerwatch/erigon/internal/logging" + "github.com/ledgerwatch/erigon/turbo/logging" "github.com/ledgerwatch/erigon/turbo/services" "github.com/ledgerwatch/log/v3" "github.com/spf13/cobra" diff --git a/cmd/state/commands/erigon23.go b/cmd/state/commands/erigon23.go index e81d7c523..9acc2c1a1 100644 --- a/cmd/state/commands/erigon23.go +++ b/cmd/state/commands/erigon23.go @@ -29,9 +29,9 @@ import ( "github.com/ledgerwatch/erigon/core/types/accounts" "github.com/ledgerwatch/erigon/core/vm" "github.com/ledgerwatch/erigon/eth/ethconfig" - "github.com/ledgerwatch/erigon/internal/logging" datadir2 "github.com/ledgerwatch/erigon/node/nodecfg/datadir" "github.com/ledgerwatch/erigon/params" + "github.com/ledgerwatch/erigon/turbo/logging" "github.com/ledgerwatch/erigon/turbo/services" "github.com/ledgerwatch/erigon/turbo/snapshotsync" "github.com/ledgerwatch/log/v3" diff --git a/cmd/state/commands/root.go b/cmd/state/commands/root.go index b72c13838..05c902ce8 100644 --- a/cmd/state/commands/root.go +++ b/cmd/state/commands/root.go @@ -7,12 +7,12 @@ import ( "path/filepath" "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon/internal/logging" + "github.com/ledgerwatch/erigon/turbo/debug" + "github.com/ledgerwatch/erigon/turbo/logging" "github.com/spf13/cobra" "github.com/ledgerwatch/erigon/cmd/utils" "github.com/ledgerwatch/erigon/core" - "github.com/ledgerwatch/erigon/internal/debug" "github.com/ledgerwatch/erigon/params" ) diff --git a/cmd/txpool/main.go b/cmd/txpool/main.go index 37b215696..7a0329963 100644 --- a/cmd/txpool/main.go +++ b/cmd/txpool/main.go @@ -23,9 +23,9 @@ import ( common2 "github.com/ledgerwatch/erigon/common" "github.com/ledgerwatch/erigon/common/paths" "github.com/ledgerwatch/erigon/ethdb/privateapi" - "github.com/ledgerwatch/erigon/internal/debug" - "github.com/ledgerwatch/erigon/internal/logging" "github.com/ledgerwatch/erigon/node/nodecfg/datadir" + "github.com/ledgerwatch/erigon/turbo/debug" + logging2 "github.com/ledgerwatch/erigon/turbo/logging" "github.com/ledgerwatch/log/v3" "github.com/spf13/cobra" ) @@ -51,7 +51,7 @@ var ( ) func init() { - utils.CobraFlags(rootCmd, debug.Flags, utils.MetricFlags, logging.Flags) + utils.CobraFlags(rootCmd, debug.Flags, utils.MetricFlags, logging2.Flags) rootCmd.Flags().StringSliceVar(&sentryAddr, "sentry.api.addr", []string{"localhost:9091"}, "comma separated sentry addresses ':,:'") rootCmd.Flags().StringVar(&privateApiAddr, "private.api.addr", "localhost:9090", "execution service :") rootCmd.Flags().StringVar(&txpoolApiAddr, "txpool.api.addr", "localhost:9094", "txpool service :") @@ -82,7 +82,7 @@ var rootCmd = &cobra.Command{ debug.Exit() }, RunE: func(cmd *cobra.Command, args []string) error { - _ = logging.GetLoggerCmd("txpool", cmd) + _ = logging2.GetLoggerCmd("txpool", cmd) ctx := cmd.Context() creds, err := grpcutil.TLS(TLSCACert, TLSCertfile, TLSKeyFile) if err != nil { diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index a2d507c3a..e9f544301 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -23,8 +23,8 @@ import ( "os" "runtime" - "github.com/ledgerwatch/erigon/internal/debug" "github.com/ledgerwatch/erigon/node" + "github.com/ledgerwatch/erigon/turbo/debug" ) // Fatalf formats a message to standard error and exits the program. diff --git a/consensus/ethash/sealer_test.go b/consensus/ethash/sealer_test.go index 75caecb9d..b51b62d19 100644 --- a/consensus/ethash/sealer_test.go +++ b/consensus/ethash/sealer_test.go @@ -26,10 +26,10 @@ import ( "time" "github.com/goccy/go-json" + "github.com/ledgerwatch/erigon/turbo/testlog" "github.com/ledgerwatch/erigon/common" "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/internal/testlog" "github.com/ledgerwatch/log/v3" ) diff --git a/core/vm/evm_test.go b/core/vm/evm_test.go index 39aac4b3c..2e1b18786 100644 --- a/core/vm/evm_test.go +++ b/core/vm/evm_test.go @@ -14,8 +14,8 @@ func TestInterpreterReadonly(t *testing.T) { rapid.Check(t, func(t *rapid.T) { env := NewEVM(BlockContext{}, TxContext{}, &dummyStatedb{}, params.TestChainConfig, Config{}) - isEVMSliceTest := rapid.SliceOfN(rapid.Bool(), 1, -1).Draw(t, "tevm").([]bool) - readOnlySliceTest := rapid.SliceOfN(rapid.Bool(), len(isEVMSliceTest), len(isEVMSliceTest)).Draw(t, "readonly").([]bool) + isEVMSliceTest := rapid.SliceOfN(rapid.Bool(), 1, -1).Draw(t, "tevm") + readOnlySliceTest := rapid.SliceOfN(rapid.Bool(), len(isEVMSliceTest), len(isEVMSliceTest)).Draw(t, "readonly") isEVMCalled := make([]bool, len(isEVMSliceTest)) readOnlies := make([]*readOnlyState, len(readOnlySliceTest)) diff --git a/eth/tracers/api.go b/eth/tracers/api.go index 6187022f3..c1854e36d 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -2,7 +2,7 @@ package tracers import ( "github.com/ledgerwatch/erigon/core/vm" - "github.com/ledgerwatch/erigon/internal/ethapi" + "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" ) // TraceConfig holds extra parameters to trace functions. diff --git a/go.mod b/go.mod index feebf8a27..96bfad0e8 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c github.com/goccy/go-json v0.9.7 github.com/gofrs/flock v0.8.1 - github.com/golang-jwt/jwt/v4 v4.4.1 + github.com/golang-jwt/jwt/v4 v4.4.2 github.com/golang/snappy v0.0.4 github.com/google/btree v1.1.2 github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa @@ -74,7 +74,7 @@ require ( github.com/xsleonard/go-merkle v1.1.0 go.uber.org/atomic v1.10.0 go.uber.org/zap v1.23.0 - golang.org/x/crypto v0.0.0-20221012134737-56aed061732a + golang.org/x/crypto v0.1.0 golang.org/x/exp v0.0.0-20221018221608-02f3b879a704 golang.org/x/sync v0.1.0 golang.org/x/sys v0.1.0 @@ -85,7 +85,7 @@ require ( gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c gopkg.in/yaml.v2 v2.4.0 modernc.org/sqlite v1.19.2 - pgregory.net/rapid v0.4.7 + pgregory.net/rapid v0.5.3 ) require ( @@ -235,8 +235,8 @@ require ( github.com/valyala/histogram v1.2.0 // indirect go.etcd.io/bbolt v1.3.6 // indirect golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect - golang.org/x/net v0.0.0-20220920183852-bf014ff85ad5 // indirect - golang.org/x/text v0.3.7 // indirect + golang.org/x/net v0.1.0 // indirect + golang.org/x/text v0.4.0 // indirect golang.org/x/tools v0.1.12 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect diff --git a/go.sum b/go.sum index e88a4c19b..bf76cf60e 100644 --- a/go.sum +++ b/go.sum @@ -346,8 +346,8 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v4 v4.4.1 h1:pC5DB52sCeK48Wlb9oPcdhnjkz1TKt1D/P7WKJ0kUcQ= -github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= +github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -1034,8 +1034,8 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220516162934-403b01795ae8/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20221012134737-56aed061732a h1:NmSIgad6KjE6VvHciPZuNRTKxGhlPfD6OA87W/PLkqg= -golang.org/x/crypto v0.0.0-20221012134737-56aed061732a/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1129,8 +1129,8 @@ golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220401154927-543a649e0bdd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220920183852-bf014ff85ad5 h1:KafLifaRFIuSJ5C+7CyFJOF9haxKNC1CEIDk8GX6X0k= -golang.org/x/net v0.0.0-20220920183852-bf014ff85ad5/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1239,8 +1239,9 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1482,8 +1483,8 @@ modernc.org/tcl v1.15.0 h1:oY+JeD11qVVSgVvodMJsu7Edf8tr5E/7tuhF5cNYz34= modernc.org/token v1.0.1 h1:A3qvTqOwexpfZZeyI0FeGPDlSWX5pjZu9hF4lU+EKWg= modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/z v1.7.0 h1:xkDw/KepgEjeizO2sNco+hqYkU12taxQFqPEmgm1GWE= -pgregory.net/rapid v0.4.7 h1:MTNRktPuv5FNqOO151TM9mDTa+XHcX6ypYeISDVD14g= -pgregory.net/rapid v0.4.7/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= +pgregory.net/rapid v0.5.3 h1:163N50IHFqr1phZens4FQOdPgfJscR7a562mjQqeo4M= +pgregory.net/rapid v0.5.3/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/node/rpcstack_test.go b/node/rpcstack_test.go index c07779c03..8aa76c85b 100644 --- a/node/rpcstack_test.go +++ b/node/rpcstack_test.go @@ -27,9 +27,9 @@ import ( "testing" "github.com/gorilla/websocket" - "github.com/ledgerwatch/erigon/internal/testlog" "github.com/ledgerwatch/erigon/rpc" "github.com/ledgerwatch/erigon/rpc/rpccfg" + "github.com/ledgerwatch/erigon/turbo/testlog" "github.com/ledgerwatch/log/v3" "github.com/stretchr/testify/assert" diff --git a/p2p/dial_test.go b/p2p/dial_test.go index 9bafb293f..5c158d5d9 100644 --- a/p2p/dial_test.go +++ b/p2p/dial_test.go @@ -28,9 +28,9 @@ import ( "time" "github.com/ledgerwatch/erigon/common/mclock" - "github.com/ledgerwatch/erigon/internal/testlog" "github.com/ledgerwatch/erigon/p2p/enode" "github.com/ledgerwatch/erigon/p2p/netutil" + "github.com/ledgerwatch/erigon/turbo/testlog" "github.com/ledgerwatch/log/v3" ) diff --git a/p2p/discover/v4_udp_test.go b/p2p/discover/v4_udp_test.go index 6199b9a9e..4753c9103 100644 --- a/p2p/discover/v4_udp_test.go +++ b/p2p/discover/v4_udp_test.go @@ -32,9 +32,9 @@ import ( "testing" "time" + "github.com/ledgerwatch/erigon/turbo/testlog" "github.com/ledgerwatch/log/v3" - "github.com/ledgerwatch/erigon/internal/testlog" "github.com/ledgerwatch/erigon/p2p/discover/v4wire" "github.com/ledgerwatch/erigon/p2p/enode" "github.com/ledgerwatch/erigon/p2p/enr" diff --git a/p2p/discover/v5_udp_test.go b/p2p/discover/v5_udp_test.go index 753404918..e10d21c51 100644 --- a/p2p/discover/v5_udp_test.go +++ b/p2p/discover/v5_udp_test.go @@ -29,9 +29,9 @@ import ( "testing" "time" + "github.com/ledgerwatch/erigon/turbo/testlog" "github.com/ledgerwatch/log/v3" - "github.com/ledgerwatch/erigon/internal/testlog" "github.com/ledgerwatch/erigon/p2p/discover/v5wire" "github.com/ledgerwatch/erigon/p2p/enode" "github.com/ledgerwatch/erigon/p2p/enr" diff --git a/p2p/dnsdisc/client_test.go b/p2p/dnsdisc/client_test.go index a98a1e06a..9c1cf87cf 100644 --- a/p2p/dnsdisc/client_test.go +++ b/p2p/dnsdisc/client_test.go @@ -28,9 +28,9 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/ledgerwatch/erigon/common/mclock" "github.com/ledgerwatch/erigon/crypto" - "github.com/ledgerwatch/erigon/internal/testlog" "github.com/ledgerwatch/erigon/p2p/enode" "github.com/ledgerwatch/erigon/p2p/enr" + "github.com/ledgerwatch/erigon/turbo/testlog" "github.com/ledgerwatch/log/v3" ) diff --git a/p2p/server_test.go b/p2p/server_test.go index 40ef5c2c6..37bc3f8af 100644 --- a/p2p/server_test.go +++ b/p2p/server_test.go @@ -29,10 +29,10 @@ import ( "time" "github.com/ledgerwatch/erigon/crypto" - "github.com/ledgerwatch/erigon/internal/testlog" "github.com/ledgerwatch/erigon/p2p/enode" "github.com/ledgerwatch/erigon/p2p/enr" "github.com/ledgerwatch/erigon/p2p/rlpx" + "github.com/ledgerwatch/erigon/turbo/testlog" "github.com/ledgerwatch/log/v3" ) diff --git a/internal/ethapi/api.go b/turbo/adapter/ethapi/api.go similarity index 99% rename from internal/ethapi/api.go rename to turbo/adapter/ethapi/api.go index 2c8d96ad5..f5b2a51b6 100644 --- a/internal/ethapi/api.go +++ b/turbo/adapter/ethapi/api.go @@ -282,11 +282,11 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} { // RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are // returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain // transaction hashes. -func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) { - return RPCMarshalBlockEx(block, inclTx, fullTx, nil, common.Hash{}) +func RPCMarshalBlockDeprecated(block *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) { + return RPCMarshalBlockExDeprecated(block, inclTx, fullTx, nil, common.Hash{}) } -func RPCMarshalBlockEx(block *types.Block, inclTx bool, fullTx bool, borTx types.Transaction, borTxHash common.Hash) (map[string]interface{}, error) { +func RPCMarshalBlockExDeprecated(block *types.Block, inclTx bool, fullTx bool, borTx types.Transaction, borTxHash common.Hash) (map[string]interface{}, error) { fields := RPCMarshalHeader(block.Header()) fields["size"] = hexutil.Uint64(block.Size()) if _, ok := fields["transactions"]; !ok { diff --git a/internal/ethapi/backend.go b/turbo/adapter/ethapi/backend.go similarity index 100% rename from internal/ethapi/backend.go rename to turbo/adapter/ethapi/backend.go diff --git a/internal/ethapi/get_proof.go b/turbo/adapter/ethapi/get_proof.go similarity index 100% rename from internal/ethapi/get_proof.go rename to turbo/adapter/ethapi/get_proof.go diff --git a/turbo/adapter/ethapi/internal.go b/turbo/adapter/ethapi/internal.go index 0c90fcc7b..96af26017 100644 --- a/turbo/adapter/ethapi/internal.go +++ b/turbo/adapter/ethapi/internal.go @@ -3,37 +3,12 @@ package ethapi // This file stores proxy-objects for `internal` package import ( "github.com/ledgerwatch/erigon/common" - "github.com/ledgerwatch/erigon/core" "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/internal/ethapi" ) -// This package provides copy-paste and proxy objects to "internal/ethapi" package - -func NewRevertError(result *core.ExecutionResult) *RevertError { - return &RevertError{ethapi.NewRevertError(result)} -} - -type RevertError struct { - *ethapi.RevertError -} - -type CallArgs struct { - *ethapi.CallArgs -} - -type ExecutionResult struct { - *ethapi.ExecutionResult -} - -// nolint -func RPCMarshalHeader(head *types.Header) map[string]interface{} { - return ethapi.RPCMarshalHeader(head) -} - // nolint func RPCMarshalBlock(b *types.Block, inclTx bool, fullTx bool, additional map[string]interface{}) (map[string]interface{}, error) { - fields, err := ethapi.RPCMarshalBlock(b, inclTx, fullTx) + fields, err := RPCMarshalBlockDeprecated(b, inclTx, fullTx) if err != nil { return nil, err } @@ -47,7 +22,7 @@ func RPCMarshalBlock(b *types.Block, inclTx bool, fullTx bool, additional map[st // nolint func RPCMarshalBlockEx(b *types.Block, inclTx bool, fullTx bool, borTx types.Transaction, borTxHash common.Hash, additional map[string]interface{}) (map[string]interface{}, error) { - fields, err := ethapi.RPCMarshalBlockEx(b, inclTx, fullTx, borTx, borTxHash) + fields, err := RPCMarshalBlockExDeprecated(b, inclTx, fullTx, borTx, borTxHash) if err != nil { return nil, err } @@ -58,8 +33,3 @@ func RPCMarshalBlockEx(b *types.Block, inclTx bool, fullTx bool, borTx types.Tra return fields, err } - -// nolint -type RPCTransaction struct { - *ethapi.RPCTransaction -} diff --git a/internal/ethapi/state_overrides.go b/turbo/adapter/ethapi/state_overrides.go similarity index 100% rename from internal/ethapi/state_overrides.go rename to turbo/adapter/ethapi/state_overrides.go diff --git a/turbo/app/make_app.go b/turbo/app/make_app.go index 81b9e688d..d7d36db25 100644 --- a/turbo/app/make_app.go +++ b/turbo/app/make_app.go @@ -3,13 +3,12 @@ package app import ( "github.com/ledgerwatch/erigon/cmd/utils" - "github.com/ledgerwatch/erigon/internal/debug" - "github.com/ledgerwatch/erigon/internal/flags" "github.com/ledgerwatch/erigon/node" "github.com/ledgerwatch/erigon/node/nodecfg" "github.com/ledgerwatch/erigon/node/nodecfg/datadir" "github.com/ledgerwatch/erigon/params" - + cli2 "github.com/ledgerwatch/erigon/turbo/cli" + "github.com/ledgerwatch/erigon/turbo/debug" "github.com/urfave/cli" ) @@ -19,7 +18,7 @@ import ( // * action: the main function for the application. receives `*cli.Context` with parsed command-line flags. Returns no error, if some error could not be recovered from write to the log or panic. // * cliFlags: the list of flags `cli.Flag` that the app should set and parse. By default, use `DefaultFlags()`. If you want to specify your own flag, use `append(DefaultFlags(), myFlag)` for this parameter. func MakeApp(action func(*cli.Context), cliFlags []cli.Flag) *cli.App { - app := flags.NewApp(params.GitCommit, "", "erigon experimental cli") + app := cli2.NewApp(params.GitCommit, "", "erigon experimental cli") app.Action = action app.Flags = append(cliFlags, debug.Flags...) // debug flags are required app.Before = func(ctx *cli.Context) error { diff --git a/turbo/app/snapshots.go b/turbo/app/snapshots.go index f0993a5ed..592209183 100644 --- a/turbo/app/snapshots.go +++ b/turbo/app/snapshots.go @@ -26,10 +26,10 @@ import ( "github.com/ledgerwatch/erigon/core/rawdb" "github.com/ledgerwatch/erigon/eth/ethconfig" "github.com/ledgerwatch/erigon/eth/ethconfig/estimate" - "github.com/ledgerwatch/erigon/internal/debug" - "github.com/ledgerwatch/erigon/internal/logging" "github.com/ledgerwatch/erigon/node/nodecfg/datadir" "github.com/ledgerwatch/erigon/params" + "github.com/ledgerwatch/erigon/turbo/debug" + "github.com/ledgerwatch/erigon/turbo/logging" "github.com/ledgerwatch/erigon/turbo/snapshotsync" "github.com/ledgerwatch/erigon/turbo/snapshotsync/snap" "github.com/ledgerwatch/log/v3" diff --git a/turbo/cli/default_flags.go b/turbo/cli/default_flags.go index 1cf4ffcee..bcada1247 100644 --- a/turbo/cli/default_flags.go +++ b/turbo/cli/default_flags.go @@ -2,7 +2,7 @@ package cli import ( "github.com/ledgerwatch/erigon/cmd/utils" - "github.com/ledgerwatch/erigon/internal/logging" + "github.com/ledgerwatch/erigon/turbo/logging" "github.com/urfave/cli" ) diff --git a/internal/flags/helpers.go b/turbo/cli/helpers.go similarity index 99% rename from internal/flags/helpers.go rename to turbo/cli/helpers.go index e7545d01d..0bd76c348 100644 --- a/internal/flags/helpers.go +++ b/turbo/cli/helpers.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with go-ethereum. If not, see . -package flags +package cli import ( "os" diff --git a/internal/cmdtest/test_cmd.go b/turbo/cmdtest/test_cmd.go similarity index 100% rename from internal/cmdtest/test_cmd.go rename to turbo/cmdtest/test_cmd.go diff --git a/internal/debug/api.go b/turbo/debug/api.go similarity index 100% rename from internal/debug/api.go rename to turbo/debug/api.go diff --git a/internal/debug/flags.go b/turbo/debug/flags.go similarity index 99% rename from internal/debug/flags.go rename to turbo/debug/flags.go index 83e1785fb..2b53fd06d 100644 --- a/internal/debug/flags.go +++ b/turbo/debug/flags.go @@ -23,9 +23,9 @@ import ( metrics2 "github.com/VictoriaMetrics/metrics" "github.com/ledgerwatch/erigon/common/fdlimit" - "github.com/ledgerwatch/erigon/internal/logging" "github.com/ledgerwatch/erigon/metrics" "github.com/ledgerwatch/erigon/metrics/exp" + "github.com/ledgerwatch/erigon/turbo/logging" "github.com/ledgerwatch/log/v3" "github.com/spf13/cobra" "github.com/urfave/cli" diff --git a/internal/debug/loudpanic.go b/turbo/debug/loudpanic.go similarity index 100% rename from internal/debug/loudpanic.go rename to turbo/debug/loudpanic.go diff --git a/internal/debug/loudpanic_fallback.go b/turbo/debug/loudpanic_fallback.go similarity index 100% rename from internal/debug/loudpanic_fallback.go rename to turbo/debug/loudpanic_fallback.go diff --git a/internal/debug/signal.go b/turbo/debug/signal.go similarity index 100% rename from internal/debug/signal.go rename to turbo/debug/signal.go diff --git a/internal/debug/signal_windows.go b/turbo/debug/signal_windows.go similarity index 100% rename from internal/debug/signal_windows.go rename to turbo/debug/signal_windows.go diff --git a/internal/debug/trace.go b/turbo/debug/trace.go similarity index 100% rename from internal/debug/trace.go rename to turbo/debug/trace.go diff --git a/internal/debug/trace_fallback.go b/turbo/debug/trace_fallback.go similarity index 100% rename from internal/debug/trace_fallback.go rename to turbo/debug/trace_fallback.go diff --git a/internal/logging/flags.go b/turbo/logging/flags.go similarity index 100% rename from internal/logging/flags.go rename to turbo/logging/flags.go diff --git a/internal/logging/logging.go b/turbo/logging/logging.go similarity index 100% rename from internal/logging/logging.go rename to turbo/logging/logging.go diff --git a/internal/testlog/testlog.go b/turbo/testlog/testlog.go similarity index 100% rename from internal/testlog/testlog.go rename to turbo/testlog/testlog.go diff --git a/turbo/transactions/call.go b/turbo/transactions/call.go index 20fc0b47b..b2cc0c9a9 100644 --- a/turbo/transactions/call.go +++ b/turbo/transactions/call.go @@ -13,18 +13,18 @@ import ( "github.com/ledgerwatch/erigon/core/state" "github.com/ledgerwatch/erigon/core/types" "github.com/ledgerwatch/erigon/core/vm" - "github.com/ledgerwatch/erigon/internal/ethapi" "github.com/ledgerwatch/erigon/params" "github.com/ledgerwatch/erigon/rpc" + ethapi2 "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" "github.com/ledgerwatch/erigon/turbo/services" "github.com/ledgerwatch/log/v3" ) func DoCall( ctx context.Context, - args ethapi.CallArgs, + args ethapi2.CallArgs, tx kv.Tx, blockNrOrHash rpc.BlockNumberOrHash, - block *types.Block, overrides *ethapi.StateOverrides, + block *types.Block, overrides *ethapi2.StateOverrides, gasCap uint64, chainConfig *params.ChainConfig, stateReader state.StateReader,