From 8227e4c53817ba89addb6d6a0a335df508c06993 Mon Sep 17 00:00:00 2001 From: crStiv Date: Fri, 31 Jan 2025 14:05:44 +0100 Subject: [PATCH 01/16] fix: improve net_listening implementation (#13387) Replace hardcoded value with actual network state check. **The method now properly reflects network connectivity status by checking if the node can communicate with the network.** --- turbo/jsonrpc/net_api.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/turbo/jsonrpc/net_api.go b/turbo/jsonrpc/net_api.go index 45784b2156a..223b4b399ca 100644 --- a/turbo/jsonrpc/net_api.go +++ b/turbo/jsonrpc/net_api.go @@ -46,8 +46,17 @@ func NewNetAPIImpl(eth rpchelper.ApiBackend) *NetAPIImpl { } // Listening implements net_listening. Returns true if client is actively listening for network connections. -// TODO: Remove hard coded value -func (api *NetAPIImpl) Listening(_ context.Context) (bool, error) { +func (api *NetAPIImpl) Listening(ctx context.Context) (bool, error) { + if api.ethBackend == nil { + // We're running in --datadir mode or otherwise cannot get the backend + return false, fmt.Errorf(NotAvailableChainData, "net_listening") + } + + // If we can get peers info, it means the network interface is up and listening + _, err := api.ethBackend.Peers(ctx) + if err != nil { + return false, nil + } return true, nil } From a6799826bf448b76f1246f59f67c32a42f8b782f Mon Sep 17 00:00:00 2001 From: Shoham Chakraborty Date: Fri, 31 Jan 2025 21:49:41 +0800 Subject: [PATCH 02/16] rpcdaemon: Fix `net_listening` (#13637) --- turbo/jsonrpc/net_api.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/turbo/jsonrpc/net_api.go b/turbo/jsonrpc/net_api.go index 223b4b399ca..922f3c90e92 100644 --- a/turbo/jsonrpc/net_api.go +++ b/turbo/jsonrpc/net_api.go @@ -46,13 +46,8 @@ func NewNetAPIImpl(eth rpchelper.ApiBackend) *NetAPIImpl { } // Listening implements net_listening. Returns true if client is actively listening for network connections. +// If we can get peers info, it means the network interface is up and listening func (api *NetAPIImpl) Listening(ctx context.Context) (bool, error) { - if api.ethBackend == nil { - // We're running in --datadir mode or otherwise cannot get the backend - return false, fmt.Errorf(NotAvailableChainData, "net_listening") - } - - // If we can get peers info, it means the network interface is up and listening _, err := api.ethBackend.Peers(ctx) if err != nil { return false, nil From dcb4ec21f6b0dbcf21405f6a1c366b6439985023 Mon Sep 17 00:00:00 2001 From: milen <94537774+taratorio@users.noreply.github.com> Date: Fri, 31 Jan 2025 14:36:44 +0000 Subject: [PATCH 03/16] polygon/sync: retry ufc on busy response (#13640) a user on discord flagged the following issue (discord [link](https://discord.com/channels/687972960811745322/983710221308416010/1334851657355235358)): ``` [INFO] [01-31|10:44:40.015] [sync] update fork choice done in=807.13624ms [INFO] [01-31|10:44:40.022] [sync] update fork choice block=67365147 hash=0xb697ef9de67d61f300fda27367617ec270d9bcd15e9a7c73facdc253b6fc0273 age=3s [EROR] [01-31|10:44:40.022] failed to update fork choice latestValidHash=0x0000000000000000000000000000000000000000000000000000000000000000 err="fork choice update failure: status=5, validationErr=''" [EROR] [01-31|10:44:40.038] runPostForkchoiceInBackground error="[1/6 OtterSync] db closed" [EROR] [01-31|10:44:43.029] polygon sync crashed - stopping node err="pos sync failed: fork choice update failure: status=5, validationErr=''" ``` Note: `status=5` means `ExecutionStatus_Busy` This can happen because there is a possibility that `runPostForkchoiceInBackground` acquires the execution engine semaphore after a successful UFC (line which says `update fork choice done in=807.13624ms`) to do pruning. But very shortly after that there is another call to UFC (in this case 7ms after - line which says `update fork choice block=67365147`) which then fails with a `Busy` response since it can't acquire the semaphore (take by `runPostForkchoiceInBackground` for pruning). This PR fixes this situation by adding retries on `Busy` response when calling UFC. Such a retry already existed when calling `InsertBlocks` so this is something that just got missed. --- polygon/sync/execution_client.go | 101 ++++++++++++++++++------------- polygon/sync/service.go | 2 +- 2 files changed, 61 insertions(+), 42 deletions(-) diff --git a/polygon/sync/execution_client.go b/polygon/sync/execution_client.go index 5dd27281acd..705f88f1d2b 100644 --- a/polygon/sync/execution_client.go +++ b/polygon/sync/execution_client.go @@ -23,17 +23,20 @@ import ( "math/big" "time" + "github.com/cenkalti/backoff/v4" "google.golang.org/protobuf/types/known/emptypb" "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/gointerfaces" "github.com/erigontech/erigon-lib/gointerfaces/executionproto" + "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/core/types" eth1utils "github.com/erigontech/erigon/turbo/execution/eth1/eth1_utils" ) var ErrForkChoiceUpdateFailure = errors.New("fork choice update failure") var ErrForkChoiceUpdateBadBlock = errors.New("fork choice update bad block") +var ErrExecutionClientBusy = errors.New("execution client busy") type ExecutionClient interface { Prepare(ctx context.Context) error @@ -44,11 +47,15 @@ type ExecutionClient interface { GetTd(ctx context.Context, blockNum uint64, blockHash common.Hash) (*big.Int, error) } -func newExecutionClient(client executionproto.ExecutionClient) *executionClient { - return &executionClient{client} +func newExecutionClient(logger log.Logger, client executionproto.ExecutionClient) *executionClient { + return &executionClient{ + logger: logger, + client: client, + } } type executionClient struct { + logger log.Logger client executionproto.ExecutionClient } @@ -71,7 +78,7 @@ func (e *executionClient) InsertBlocks(ctx context.Context, blocks []*types.Bloc Blocks: eth1utils.ConvertBlocksToRPC(blocks), } - for { + return e.retryBusy(ctx, "insertBlocks", func() error { response, err := e.client.InsertBlocks(ctx, request) if err != nil { return err @@ -82,20 +89,11 @@ func (e *executionClient) InsertBlocks(ctx context.Context, blocks []*types.Bloc case executionproto.ExecutionStatus_Success: return nil case executionproto.ExecutionStatus_Busy: - // retry after sleep - func() { - delayTimer := time.NewTimer(100 * time.Millisecond) - defer delayTimer.Stop() - - select { - case <-delayTimer.C: - case <-ctx.Done(): - } - }() + return ErrExecutionClientBusy // gets retried default: - return fmt.Errorf("executionClient.InsertBlocks failed with response status: %s", status.String()) + return fmt.Errorf("executionClient.InsertBlocks failure status: %s", status.String()) } - } + }) } func (e *executionClient) UpdateForkChoice(ctx context.Context, tip *types.Header, finalizedHeader *types.Header) (common.Hash, error) { @@ -108,34 +106,30 @@ func (e *executionClient) UpdateForkChoice(ctx context.Context, tip *types.Heade Timeout: 0, } - response, err := e.client.UpdateForkChoice(ctx, &request) - if err != nil { - return common.Hash{}, err - } - var latestValidHash common.Hash - if response.LatestValidHash != nil { - latestValidHash = gointerfaces.ConvertH256ToHash(response.LatestValidHash) - } + err := e.retryBusy(ctx, "updateForkChoice", func() error { + r, err := e.client.UpdateForkChoice(ctx, &request) + if err != nil { + return err + } - switch response.Status { - case executionproto.ExecutionStatus_Success: - return latestValidHash, nil - case executionproto.ExecutionStatus_BadBlock: - return latestValidHash, fmt.Errorf( - "%w: status=%d, validationErr='%s'", - ErrForkChoiceUpdateBadBlock, - response.Status, - response.ValidationError, - ) - default: - return latestValidHash, fmt.Errorf( - "%w: status=%d, validationErr='%s'", - ErrForkChoiceUpdateFailure, - response.Status, - response.ValidationError, - ) - } + if r.LatestValidHash != nil { + latestValidHash = gointerfaces.ConvertH256ToHash(r.LatestValidHash) + } + + switch r.Status { + case executionproto.ExecutionStatus_Success: + return nil + case executionproto.ExecutionStatus_BadBlock: + return fmt.Errorf("%w: status=%d, validationErr='%s'", ErrForkChoiceUpdateBadBlock, r.Status, r.ValidationError) + case executionproto.ExecutionStatus_Busy: + return ErrExecutionClientBusy // gets retried + default: + return fmt.Errorf("%w: status=%d, validationErr='%s'", ErrForkChoiceUpdateFailure, r.Status, r.ValidationError) + } + }) + + return latestValidHash, err } func (e *executionClient) CurrentHeader(ctx context.Context) (*types.Header, error) { @@ -179,3 +173,28 @@ func (e *executionClient) GetTd(ctx context.Context, blockNum uint64, blockHash return eth1utils.ConvertBigIntFromRpc(response.GetTd()), nil } + +func (e *executionClient) retryBusy(ctx context.Context, label string, f func() error) error { + backOff := 50 * time.Millisecond + logEvery := 5 * time.Second + logEveryXAttempt := int64(logEvery / backOff) + attempt := int64(1) + operation := func() error { + err := f() + if err == nil { + return nil + } + + if errors.Is(err, ErrExecutionClientBusy) { + if attempt%logEveryXAttempt == 1 { + e.logger.Debug("execution client busy - retrying", "in", backOff, "label", label, "attempt", attempt) + } + attempt++ + return err + } + + return backoff.Permanent(err) + } + + return backoff.Retry(operation, backoff.WithContext(backoff.NewConstantBackOff(backOff), ctx)) +} diff --git a/polygon/sync/service.go b/polygon/sync/service.go index 06406b7c111..d71a60e1c7e 100644 --- a/polygon/sync/service.go +++ b/polygon/sync/service.go @@ -54,7 +54,7 @@ func NewService( milestoneVerifier := VerifyMilestoneHeaders blocksVerifier := VerifyBlocks p2pService := p2p.NewService(logger, maxPeers, sentryClient, statusDataProvider.GetStatusData) - execution := newExecutionClient(executionClient) + execution := newExecutionClient(logger, executionClient) signaturesCache, err := lru.NewARC[common.Hash, common.Address](InMemorySignatures) if err != nil { From a1449e1542ca4ac46d5dd3b2797a3467e250304d Mon Sep 17 00:00:00 2001 From: Somnath Date: Fri, 31 Jan 2025 18:52:11 +0400 Subject: [PATCH 04/16] RPC-compat hive fixes (#13617) Set of minor changes to align with hive's `rpc-compat` tests Also reverts https://github.com/erigontech/erigon/pull/8337 --- ChangeLog.md | 8 +++++++- turbo/jsonrpc/eth_accounts.go | 8 ++++++++ turbo/jsonrpc/eth_api_test.go | 14 +++++++------- turbo/jsonrpc/eth_call.go | 2 +- turbo/jsonrpc/eth_receipts.go | 3 +++ turbo/rpchelper/helper.go | 10 +++++++++- 6 files changed, 35 insertions(+), 10 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 4f013df6b0a..1d6ec2adff6 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,7 +1,13 @@ ChangeLog --------- -## v3.0.0-beta1 (in development) +## v3.0.0-beta2 (in development) + +### Breaking changes +- Reverts Optimize gas by default in eth_createAccessList #8337 + + +## v3.0.0-beta1 ### Breaking changes diff --git a/turbo/jsonrpc/eth_accounts.go b/turbo/jsonrpc/eth_accounts.go index 3717c3e3e75..7d1fc20f2bf 100644 --- a/turbo/jsonrpc/eth_accounts.go +++ b/turbo/jsonrpc/eth_accounts.go @@ -18,6 +18,7 @@ package jsonrpc import ( "context" + "errors" "fmt" "math/big" @@ -120,6 +121,13 @@ func (api *APIImpl) GetCode(ctx context.Context, address libcommon.Address, bloc // GetStorageAt implements eth_getStorageAt. Returns the value from a storage position at a given address. func (api *APIImpl) GetStorageAt(ctx context.Context, address libcommon.Address, index string, blockNrOrHash rpc.BlockNumberOrHash) (string, error) { var empty []byte + indexBytes := hexutility.FromHex(index) + if len(indexBytes) < 32 { + return "", errors.New("unable to decode storage key: hex string invalid") + } + if len(indexBytes) > 32 { + return "", errors.New("unable to decode storage key: hex string too long, want at most 32 bytes") + } tx, err1 := api.db.BeginTemporalRo(ctx) if err1 != nil { diff --git a/turbo/jsonrpc/eth_api_test.go b/turbo/jsonrpc/eth_api_test.go index 0aac7ea64b8..69fbb4b180c 100644 --- a/turbo/jsonrpc/eth_api_test.go +++ b/turbo/jsonrpc/eth_api_test.go @@ -96,7 +96,7 @@ func TestGetStorageAt_ByBlockNumber_WithRequireCanonicalDefault(t *testing.T) { api := NewEthAPI(newBaseApiForTest(m), m.DB, nil, nil, nil, 5000000, ethconfig.Defaults.RPCTxFeeCap, 100_000, false, 100_000, 128, log.New()) addr := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7") - result, err := api.GetStorageAt(context.Background(), addr, "0x0", rpc.BlockNumberOrHashWithNumber(0)) + result, err := api.GetStorageAt(context.Background(), addr, common.HexToHash("0x0").String(), rpc.BlockNumberOrHashWithNumber(0)) if err != nil { t.Errorf("calling GetStorageAt: %v", err) } @@ -110,7 +110,7 @@ func TestGetStorageAt_ByBlockHash_WithRequireCanonicalDefault(t *testing.T) { api := NewEthAPI(newBaseApiForTest(m), m.DB, nil, nil, nil, 5000000, ethconfig.Defaults.RPCTxFeeCap, 100_000, false, 100_000, 128, log.New()) addr := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7") - result, err := api.GetStorageAt(context.Background(), addr, "0x0", rpc.BlockNumberOrHashWithHash(m.Genesis.Hash(), false)) + result, err := api.GetStorageAt(context.Background(), addr, common.HexToHash("0x0").String(), rpc.BlockNumberOrHashWithHash(m.Genesis.Hash(), false)) if err != nil { t.Errorf("calling GetStorageAt: %v", err) } @@ -124,7 +124,7 @@ func TestGetStorageAt_ByBlockHash_WithRequireCanonicalTrue(t *testing.T) { api := NewEthAPI(newBaseApiForTest(m), m.DB, nil, nil, nil, 5000000, ethconfig.Defaults.RPCTxFeeCap, 100_000, false, 100_000, 128, log.New()) addr := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7") - result, err := api.GetStorageAt(context.Background(), addr, "0x0", rpc.BlockNumberOrHashWithHash(m.Genesis.Hash(), true)) + result, err := api.GetStorageAt(context.Background(), addr, common.HexToHash("0x0").String(), rpc.BlockNumberOrHashWithHash(m.Genesis.Hash(), true)) if err != nil { t.Errorf("calling GetStorageAt: %v", err) } @@ -144,7 +144,7 @@ func TestGetStorageAt_ByBlockHash_WithRequireCanonicalDefault_BlockNotFoundError } offChainBlock := offChain.Blocks[0] - if _, err := api.GetStorageAt(context.Background(), addr, "0x0", rpc.BlockNumberOrHashWithHash(offChainBlock.Hash(), false)); err != nil { + if _, err := api.GetStorageAt(context.Background(), addr, common.HexToHash("0x0").String(), rpc.BlockNumberOrHashWithHash(offChainBlock.Hash(), false)); err != nil { if fmt.Sprintf("%v", err) != fmt.Sprintf("block %s not found", offChainBlock.Hash().String()[2:]) { t.Errorf("wrong error: %v", err) } @@ -165,7 +165,7 @@ func TestGetStorageAt_ByBlockHash_WithRequireCanonicalTrue_BlockNotFoundError(t } offChainBlock := offChain.Blocks[0] - if _, err := api.GetStorageAt(context.Background(), addr, "0x0", rpc.BlockNumberOrHashWithHash(offChainBlock.Hash(), true)); err != nil { + if _, err := api.GetStorageAt(context.Background(), addr, common.HexToHash("0x0").String(), rpc.BlockNumberOrHashWithHash(offChainBlock.Hash(), true)); err != nil { if fmt.Sprintf("%v", err) != fmt.Sprintf("block %s not found", offChainBlock.Hash().String()[2:]) { t.Errorf("wrong error: %v", err) } @@ -182,7 +182,7 @@ func TestGetStorageAt_ByBlockHash_WithRequireCanonicalDefault_NonCanonicalBlock( orphanedBlock := orphanedChain[0].Blocks[0] - result, err := api.GetStorageAt(context.Background(), addr, "0x0", rpc.BlockNumberOrHashWithHash(orphanedBlock.Hash(), false)) + result, err := api.GetStorageAt(context.Background(), addr, common.HexToHash("0x0").String(), rpc.BlockNumberOrHashWithHash(orphanedBlock.Hash(), false)) if err != nil { if fmt.Sprintf("%v", err) != fmt.Sprintf("hash %s is not currently canonical", orphanedBlock.Hash().String()[2:]) { t.Errorf("wrong error: %v", err) @@ -201,7 +201,7 @@ func TestGetStorageAt_ByBlockHash_WithRequireCanonicalTrue_NonCanonicalBlock(t * orphanedBlock := orphanedChain[0].Blocks[0] - if _, err := api.GetStorageAt(context.Background(), addr, "0x0", rpc.BlockNumberOrHashWithHash(orphanedBlock.Hash(), true)); err != nil { + if _, err := api.GetStorageAt(context.Background(), addr, common.HexToHash("0x0").String(), rpc.BlockNumberOrHashWithHash(orphanedBlock.Hash(), true)); err != nil { if fmt.Sprintf("%v", err) != fmt.Sprintf("hash %s is not currently canonical", orphanedBlock.Hash().String()[2:]) { t.Errorf("wrong error: %v", err) } diff --git a/turbo/jsonrpc/eth_call.go b/turbo/jsonrpc/eth_call.go index 249ae4bed26..2167899b705 100644 --- a/turbo/jsonrpc/eth_call.go +++ b/turbo/jsonrpc/eth_call.go @@ -870,7 +870,7 @@ func (api *APIImpl) CreateAccessList(ctx context.Context, args ethapi2.CallArgs, errString = res.Err.Error() } accessList := &accessListResult{Accesslist: &accessList, Error: errString, GasUsed: hexutil.Uint64(res.UsedGas)} - if optimizeGas == nil || *optimizeGas { // optimize gas unless explicitly told not to + if optimizeGas != nil && *optimizeGas { optimizeWarmAddrInAccessList(accessList, *args.From) optimizeWarmAddrInAccessList(accessList, to) optimizeWarmAddrInAccessList(accessList, header.Coinbase) diff --git a/turbo/jsonrpc/eth_receipts.go b/turbo/jsonrpc/eth_receipts.go index d70b9379042..41e64f5094c 100644 --- a/turbo/jsonrpc/eth_receipts.go +++ b/turbo/jsonrpc/eth_receipts.go @@ -515,6 +515,9 @@ func (api *APIImpl) GetBlockReceipts(ctx context.Context, numberOrHash rpc.Block defer tx.Rollback() blockNum, blockHash, _, err := rpchelper.GetBlockNumber(ctx, numberOrHash, tx, api._blockReader, api.filters) if err != nil { + if errors.Is(err, rpchelper.BlockNotFoundErr{Hash: blockHash}) { + return nil, nil + } return nil, err } block, err := api.blockWithSenders(ctx, tx, blockHash, blockNum) diff --git a/turbo/rpchelper/helper.go b/turbo/rpchelper/helper.go index b83bfe2462a..470ada3168c 100644 --- a/turbo/rpchelper/helper.go +++ b/turbo/rpchelper/helper.go @@ -47,6 +47,14 @@ func (e nonCanonocalHashError) Error() string { return fmt.Sprintf("hash %x is not currently canonical", e.hash) } +type BlockNotFoundErr struct { + Hash libcommon.Hash +} + +func (e BlockNotFoundErr) Error() string { + return fmt.Sprintf("block %x not found", e.Hash) +} + func GetBlockNumber(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, tx kv.Tx, br services.FullBlockReader, filters *Filters) (uint64, libcommon.Hash, bool, error) { bn, bh, latest, _, err := _GetBlockNumber(ctx, blockNrOrHash.RequireCanonical, blockNrOrHash, tx, br, filters) return bn, bh, latest, err @@ -121,7 +129,7 @@ func _GetBlockNumber(ctx context.Context, requireCanonical bool, blockNrOrHash r return 0, libcommon.Hash{}, false, false, err } if number == nil { - return 0, libcommon.Hash{}, false, false, fmt.Errorf("block %x not found", hash) + return 0, libcommon.Hash{}, false, false, BlockNotFoundErr{Hash: hash} } blockNumber = *number From 1728ef17948299db96186d5bf59c8b4786bca7c8 Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Fri, 31 Jan 2025 16:59:56 +0100 Subject: [PATCH 05/16] qa-tests: (temporarily) disable rpc tests that fail after PR #13617 (#13643) --- .github/workflows/scripts/run_rpc_tests.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/scripts/run_rpc_tests.sh b/.github/workflows/scripts/run_rpc_tests.sh index 1d9259e1887..3389a1b9599 100755 --- a/.github/workflows/scripts/run_rpc_tests.sh +++ b/.github/workflows/scripts/run_rpc_tests.sh @@ -4,6 +4,22 @@ set +e # Disable exit on error # Array of disabled tests disabled_tests=( + # Failing after the PR https://github.com/erigontech/erigon/pull/13617 that fixed this incompatibility + # issues https://hive.pectra-devnet-5.ethpandaops.io/suite.html?suiteid=1738266984-51ae1a2f376e5de5e9ba68f034f80e32.json&suitename=rpc-compat + eth_createAccessList/test_07.json + eth_createAccessList/test_08.json + eth_createAccessList/test_09.json + eth_createAccessList/test_10.json + eth_createAccessList/test_12.json + eth_createAccessList/test_14.json + eth_createAccessList/test_17.json + eth_getStorageAt/test_01.json + eth_getStorageAt/test_02.json + eth_getStorageAt/test_03.json + eth_getStorageAt/test_04.json + eth_getStorageAt/test_05.json + eth_getStorageAt/test_06.json + net_listening/test_1.json # Erigon2 and Erigon3 never supported this api methods trace_rawTransaction debug_getRawTransaction From 76904e76d833e2e901e0030ddabb6a887fa281be Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Fri, 31 Jan 2025 23:16:18 +0700 Subject: [PATCH 06/16] `eth_estimateGas`: support historical blocks (#13635) seems we already support - but 1 check used "latest state reader" --- ChangeLog.md | 35 ++++++++++++++-------- turbo/jsonrpc/eth_call.go | 62 ++++++++++++++++++--------------------- 2 files changed, 51 insertions(+), 46 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 1d6ec2adff6..2d04c776c06 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -6,37 +6,46 @@ ChangeLog ### Breaking changes - Reverts Optimize gas by default in eth_createAccessList #8337 +### Improvements: -## v3.0.0-beta1 - -### Breaking changes - -- Bor chains: enable our internal Consensus Layer by default (name: Astrid) - - The process should auto upgrade - in which case you may find that it starts creating new snapshots for checkpoints and milestones. - - This may however fail, as there are a number of potential edge cases. If this happens the process will likely stop with a failure message. - - In this situation you will need to do a clean sync, in which case the complete snapshot set will be downloaded and astrid will sync. - - If you want to prevent this and retain the old behaviour start erigon with --polygon.sync=false +- `eth_estimateGas`: StateOverrides and HistoricalBlocks support ### TODO -- milestone: https://github.com/erigontech/erigon/milestone/5 +- milestone: https://github.com/erigontech/erigon/milestone/28 - Known problem: - external CL support - `erigon_getLatestLogs` not implemented ### Acknowledgements: +## v3.0.0-beta1 + +### Breaking changes + +- Bor chains: enable our internal Consensus Layer by default (name: Astrid) + - The process should auto upgrade - in which case you may find that it starts creating new snapshots for checkpoints + and milestones. + - This may however fail, as there are a number of potential edge cases. If this happens the process will likely stop + with a failure message. + - In this situation you will need to do a clean sync, in which case the complete snapshot set will be downloaded and + astrid will sync. + - If you want to prevent this and retain the old behaviour start erigon with --polygon.sync=false + +### Acknowledgements: + ## v3.0.0-alpha7 ### Improvements: -- Faster eth_getTransactionReceipt with "txn-granularity cache" in https://github.com/erigontech/erigon/pull/13134 and "executing only 1 txn" https://github.com/erigontech/erigon/pull/12424 +- Faster eth_getTransactionReceipt with "txn-granularity cache" in https://github.com/erigontech/erigon/pull/13134 and " + executing only 1 txn" https://github.com/erigontech/erigon/pull/12424 - Return PrunedError when trying to read unavailable historical data in https://github.com/erigontech/erigon/pull/13014 ### Fixes: -- Fix trace_block returning "insufficient funds" (Issues #12525 and similar) with standalone rpcdaemon in https://github.com/erigontech/erigon/pull/13129 - +- Fix trace_block returning "insufficient funds" (Issues #12525 and similar) with standalone rpcdaemon + in https://github.com/erigontech/erigon/pull/13129 ### Acknowledgements: diff --git a/turbo/jsonrpc/eth_call.go b/turbo/jsonrpc/eth_call.go index 2167899b705..6796af3ac24 100644 --- a/turbo/jsonrpc/eth_call.go +++ b/turbo/jsonrpc/eth_call.go @@ -151,6 +151,35 @@ func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs } defer dbtx.Rollback() + chainConfig, err := api.chainConfig(ctx, dbtx) + if err != nil { + return 0, err + } + engine := api.engine() + + latestCanBlockNumber, latestCanHash, isLatest, err := rpchelper.GetCanonicalBlockNumber(ctx, latestNumOrHash, dbtx, api._blockReader, api.filters) // DoCall cannot be executed on non-canonical blocks + if err != nil { + return 0, err + } + + // try and get the block from the lru cache first then try DB before failing + block := api.tryBlockFromLru(latestCanHash) + if block == nil { + block, err = api.blockWithSenders(ctx, dbtx, latestCanHash, latestCanBlockNumber) + if err != nil { + return 0, err + } + } + if block == nil { + return 0, errors.New("could not find latest block in cache or db") + } + + txNumsReader := rawdbv3.TxNums.WithCustomReadTxNumFunc(freezeblocks.ReadTxNumFuncFromBlockReader(ctx, api._blockReader)) + stateReader, err := rpchelper.CreateStateReaderFromBlockNumber(ctx, dbtx, txNumsReader, latestCanBlockNumber, isLatest, 0, api.stateCache, chainConfig.ChainName) + if err != nil { + return 0, err + } + // Binary search the gas requirement, as it may be higher than the amount used var ( lo = params.TxGas - 1 @@ -206,11 +235,6 @@ func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs } // Recap the highest gas limit with account's available balance. if feeCap.Sign() != 0 { - cacheView, err := api.stateCache.View(ctx, dbtx) - if err != nil { - return 0, err - } - stateReader := rpchelper.CreateLatestCachedStateReader(cacheView, dbtx) state := state.New(stateReader) if state == nil { return 0, errors.New("can't get the current state") @@ -248,34 +272,6 @@ func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs } gasCap = hi - chainConfig, err := api.chainConfig(ctx, dbtx) - if err != nil { - return 0, err - } - engine := api.engine() - - latestCanBlockNumber, latestCanHash, isLatest, err := rpchelper.GetCanonicalBlockNumber(ctx, latestNumOrHash, dbtx, api._blockReader, api.filters) // DoCall cannot be executed on non-canonical blocks - if err != nil { - return 0, err - } - - // try and get the block from the lru cache first then try DB before failing - block := api.tryBlockFromLru(latestCanHash) - if block == nil { - block, err = api.blockWithSenders(ctx, dbtx, latestCanHash, latestCanBlockNumber) - if err != nil { - return 0, err - } - } - if block == nil { - return 0, errors.New("could not find latest block in cache or db") - } - - txNumsReader := rawdbv3.TxNums.WithCustomReadTxNumFunc(freezeblocks.ReadTxNumFuncFromBlockReader(ctx, api._blockReader)) - stateReader, err := rpchelper.CreateStateReaderFromBlockNumber(ctx, dbtx, txNumsReader, latestCanBlockNumber, isLatest, 0, api.stateCache, chainConfig.ChainName) - if err != nil { - return 0, err - } header := block.HeaderNoCopy() caller, err := transactions.NewReusableCaller(engine, stateReader, overrides, header, args, api.GasCap, latestNumOrHash, dbtx, api._blockReader, chainConfig, api.evmCallTimeout) From 9caab255bc72fcf812c9b38fb5914033baee02a6 Mon Sep 17 00:00:00 2001 From: milen <94537774+taratorio@users.noreply.github.com> Date: Fri, 31 Jan 2025 16:48:06 +0000 Subject: [PATCH 07/16] polygon/sync: add missed log prefix in prev commit (#13644) forgot to add log prefix in prev PR https://github.com/erigontech/erigon/pull/13640 --- polygon/sync/execution_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polygon/sync/execution_client.go b/polygon/sync/execution_client.go index 705f88f1d2b..585271b52f7 100644 --- a/polygon/sync/execution_client.go +++ b/polygon/sync/execution_client.go @@ -187,7 +187,7 @@ func (e *executionClient) retryBusy(ctx context.Context, label string, f func() if errors.Is(err, ErrExecutionClientBusy) { if attempt%logEveryXAttempt == 1 { - e.logger.Debug("execution client busy - retrying", "in", backOff, "label", label, "attempt", attempt) + e.logger.Debug(syncLogPrefix("execution client busy - retrying"), "in", backOff, "label", label, "attempt", attempt) } attempt++ return err From b5c0e2154137830f7c82e9cb5e9cf3948e4cabd5 Mon Sep 17 00:00:00 2001 From: milen <94537774+taratorio@users.noreply.github.com> Date: Sat, 1 Feb 2025 02:49:52 +0000 Subject: [PATCH 08/16] changelog: update with astrid fixes (#13645) --- ChangeLog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 2d04c776c06..2b5ae20b844 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -9,6 +9,9 @@ ChangeLog ### Improvements: - `eth_estimateGas`: StateOverrides and HistoricalBlocks support +- fixes sporadic crashes on Polygon with new default flow (Astrid) + - `nonsequential block in bridge processing` - should be fixed + - `pos sync failed: fork choice update failure: status=5, validationErr=''` - should be fixed ### TODO From 55dcac01f61c8a32cb06c0b27df104a54ec85ea6 Mon Sep 17 00:00:00 2001 From: milen <94537774+taratorio@users.noreply.github.com> Date: Sat, 1 Feb 2025 03:29:30 +0000 Subject: [PATCH 09/16] execution: fix and simplify block consumer exec delays (#13641) Now that we are using Astrid by default it means that all of our block consumers for all chains (Ethereum/Gnosis/Polygon) use the same flow for execution - UpdateForkChoice. This means we can simplify when/where we call `UpdateBlockConsumerPreExecutionDelay` and `UpdateBlockConsumerPostExecutionDelay`. This should also resolve the inconsistencies that @mriccobene has seen between Polygon/Ethereum. --- eth/stagedsync/exec3.go | 11 ----------- turbo/execution/eth1/forkchoice.go | 2 ++ 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/eth/stagedsync/exec3.go b/eth/stagedsync/exec3.go index aeff5268f06..cb5977476ec 100644 --- a/eth/stagedsync/exec3.go +++ b/eth/stagedsync/exec3.go @@ -31,7 +31,6 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/cmp" "github.com/erigontech/erigon-lib/common/dbg" - metrics2 "github.com/erigontech/erigon-lib/common/metrics" "github.com/erigontech/erigon-lib/config3" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/rawdbv3" @@ -490,11 +489,6 @@ Loop: return fmt.Errorf("nil block %d", blockNum) } - if execStage.SyncMode() == stages.ModeApplyingBlocks || - execStage.SyncMode() == stages.ModeForkValidation { - metrics2.UpdateBlockConsumerPreExecutionDelay(b.Time(), blockNum, logger) - } - txs := b.Transactions() header := b.HeaderNoCopy() skipAnalysis := core.SkipAnalysis(chainConfig, blockNum) @@ -649,11 +643,6 @@ Loop: // MA commitTx if !parallel { - if execStage.SyncMode() == stages.ModeApplyingBlocks || - execStage.SyncMode() == stages.ModeForkValidation { - metrics2.UpdateBlockConsumerPostExecutionDelay(b.Time(), blockNum, logger) - } - select { case <-logEvery.C: if inMemExec || isMining { diff --git a/turbo/execution/eth1/forkchoice.go b/turbo/execution/eth1/forkchoice.go index d31d46b3150..6da592bd324 100644 --- a/turbo/execution/eth1/forkchoice.go +++ b/turbo/execution/eth1/forkchoice.go @@ -244,6 +244,8 @@ func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, original } UpdateForkChoiceArrivalDelay(fcuHeader.Time) + metrics.UpdateBlockConsumerPreExecutionDelay(fcuHeader.Time, fcuHeader.Number.Uint64(), e.logger) + defer metrics.UpdateBlockConsumerPostExecutionDelay(fcuHeader.Time, fcuHeader.Number.Uint64(), e.logger) limitedBigJump := e.syncCfg.LoopBlockLimit > 0 && finishProgressBefore > 0 && fcuHeader.Number.Uint64()-finishProgressBefore > uint64(e.syncCfg.LoopBlockLimit-2) isSynced := finishProgressBefore > 0 && finishProgressBefore > e.blockReader.FrozenBlocks() && finishProgressBefore == headersProgressBefore From a3170914aa594b4a1d616621d5dd88f652481202 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Sat, 1 Feb 2025 17:15:19 +0700 Subject: [PATCH 10/16] ReceiptDomain: interity check (#13650) fixing https://github.com/erigontech/erigon/issues/13367 (will take couple days to gen and release new files) --------- Co-authored-by: JkLondon --- cmd/state/exec3/historical_trace_worker.go | 14 +-- core/state/txtask.go | 17 ++-- erigon-lib/kv/kv_interface.go | 1 - erigon-lib/state/domain.go | 22 ++++- erigon-lib/state/inverted_index.go | 3 +- eth/integrity/integrity_action_type.go | 3 +- eth/integrity/receipts_no_duplicates.go | 103 +++++++++++++++++++++ eth/stagedsync/exec3_serial.go | 2 +- eth/stagedsync/stage_custom_trace.go | 101 ++++++++++++++++++-- turbo/app/snapshots_cmd.go | 18 +++- 10 files changed, 248 insertions(+), 36 deletions(-) create mode 100644 eth/integrity/receipts_no_duplicates.go diff --git a/cmd/state/exec3/historical_trace_worker.go b/cmd/state/exec3/historical_trace_worker.go index 8d784be41ea..146807802b9 100644 --- a/cmd/state/exec3/historical_trace_worker.go +++ b/cmd/state/exec3/historical_trace_worker.go @@ -281,9 +281,8 @@ func doHistoryReduce(consumer TraceConsumer, db kv.TemporalRoDB, ctx context.Con } defer tx.Rollback() - var rwsClosed bool - for outputTxNum.Load() <= toTxNum && !rwsClosed { - rwsClosed, err = rws.DrainNonBlocking(ctx) + for outputTxNum.Load() <= toTxNum { + err = rws.DrainNonBlocking(ctx) if err != nil { return err } @@ -296,6 +295,9 @@ func doHistoryReduce(consumer TraceConsumer, db kv.TemporalRoDB, ctx context.Con outputTxNum.Store(processedTxNum) } } + //if outputTxNum.Load() != toTxNum { + // return fmt.Errorf("not all txnums proceeded: toTxNum=%d, outputTxNum=%d", toTxNum, outputTxNum.Load()) + //} return nil } func doHistoryMap(consumer TraceConsumer, cfg *ExecArgs, ctx context.Context, in *state.QueueWithRetry, workerCount int, rws *state.ResultsQueue, logger log.Logger) error { @@ -333,9 +335,7 @@ func processResultQueueHistorical(consumer TraceConsumer, rws *state.ResultsQueu return outputTxNum, false, txTask.Error } - if txTask.TxIndex >= 0 && !txTask.Final { - txTask.CreateReceipt(tx) - } + txTask.CreateReceipt(tx) if err := consumer.Reduce(txTask, tx); err != nil { return outputTxNum, false, err } @@ -348,7 +348,6 @@ func processResultQueueHistorical(consumer TraceConsumer, rws *state.ResultsQueu } func CustomTraceMapReduce(fromBlock, toBlock uint64, consumer TraceConsumer, ctx context.Context, tx kv.TemporalTx, cfg *ExecArgs, logger log.Logger) (err error) { - log.Info("[Receipt] batch start", "fromBlock", fromBlock, "toBlock", toBlock, "workers", cfg.Workers) br := cfg.BlockReader chainConfig := cfg.ChainConfig if chainConfig.ChainName == networkname.Gnosis { @@ -379,6 +378,7 @@ func CustomTraceMapReduce(fromBlock, toBlock uint64, consumer TraceConsumer, ctx WorkerCount = cfg.Workers } + log.Info("[Receipt] batch start", "fromBlock", fromBlock, "toBlock", toBlock, "workers", cfg.Workers, "toTxNum", toTxNum) getHeaderFunc := func(hash common.Hash, number uint64) (h *types.Header) { if tx != nil && WorkerCount == 1 { h, _ = cfg.BlockReader.Header(ctx, tx, hash, number) diff --git a/core/state/txtask.go b/core/state/txtask.go index 61bd90d132a..af38e935e2a 100644 --- a/core/state/txtask.go +++ b/core/state/txtask.go @@ -375,7 +375,7 @@ func (q *ResultsQueue) Add(ctx context.Context, task *TxTask) error { } return nil } -func (q *ResultsQueue) drainNoBlock(ctx context.Context, task *TxTask) (closed bool, err error) { +func (q *ResultsQueue) drainNoBlock(ctx context.Context, task *TxTask) (err error) { q.m.Lock() defer q.m.Unlock() if task != nil { @@ -385,20 +385,21 @@ func (q *ResultsQueue) drainNoBlock(ctx context.Context, task *TxTask) (closed b for { select { case <-ctx.Done(): - return q.closed, ctx.Err() + return ctx.Err() case txTask, ok := <-q.resultCh: if !ok { - return q.closed, nil + //log.Warn("[dbg] closed1") + return nil } if txTask == nil { continue } heap.Push(q.results, txTask) if q.results.Len() > q.limit { - return q.closed, nil + return nil } default: // we are inside mutex section, can't block here - return q.closed, nil + return nil } } } @@ -431,7 +432,7 @@ func (q *ResultsQueue) Drain(ctx context.Context) error { if !ok { return nil } - if _, err := q.drainNoBlock(ctx, txTask); err != nil { + if err := q.drainNoBlock(ctx, txTask); err != nil { return err } case <-q.ticker.C: @@ -448,7 +449,7 @@ func (q *ResultsQueue) Drain(ctx context.Context) error { } // DrainNonBlocking - does drain batch of results to heap. Immediately stops at `q.limit` or if nothing to drain -func (q *ResultsQueue) DrainNonBlocking(ctx context.Context) (closed bool, err error) { +func (q *ResultsQueue) DrainNonBlocking(ctx context.Context) (err error) { return q.drainNoBlock(ctx, nil) } @@ -477,6 +478,8 @@ Loop: } func (q *ResultsQueue) Close() { + q.m.Lock() + defer q.m.Unlock() if q.closed { return } diff --git a/erigon-lib/kv/kv_interface.go b/erigon-lib/kv/kv_interface.go index 6d1cf2a3663..4f4a3ffd562 100644 --- a/erigon-lib/kv/kv_interface.go +++ b/erigon-lib/kv/kv_interface.go @@ -507,7 +507,6 @@ type TemporalPutDel interface { // Optimizations: // - user can prvide `prevVal != nil` - then it will not read prev value from storage // - user can append k2 into k1, then underlying methods will not preform append - // - if `val == nil` it will call DomainDel DomainPut(domain Domain, k1, k2 []byte, val, prevVal []byte, prevStep uint64) error // DomainDel diff --git a/erigon-lib/state/domain.go b/erigon-lib/state/domain.go index 4a2282ea9bf..270071d876a 100644 --- a/erigon-lib/state/domain.go +++ b/erigon-lib/state/domain.go @@ -51,6 +51,12 @@ var sortableBuffersPoolForPruning = sync.Pool{ }, } +func sortableBufferForPruning() etl.Buffer { + sortableBuffer := sortableBuffersPoolForPruning.Get().(etl.Buffer) + sortableBuffer.Reset() + return sortableBuffer +} + var ( asserts = dbg.EnvBool("AGG_ASSERTS", false) traceFileLife = dbg.EnvString("AGG_TRACE_FILE_LIFE", "") @@ -1531,10 +1537,19 @@ func (dt *DomainRoTx) GetAsOf(key []byte, txNum uint64, roTx kv.Tx) ([]byte, boo } return v, v != nil, nil } - v, _, _, err = dt.GetLatest(key, roTx) + + var ok bool + v, _, ok, err = dt.GetLatest(key, roTx) if err != nil { return nil, false, err } + if traceGetAsOf == dt.d.filenameBase { + if ok { + fmt.Printf("DomainGetAsOf(%s, %x, %d) -> found in latest state\n", dt.d.filenameBase, key, txNum) + } else { + fmt.Printf("DomainGetAsOf(%s, %x, %d) -> not found in latest state\n", dt.d.filenameBase, key, txNum) + } + } return v, v != nil, nil } @@ -1874,8 +1889,7 @@ func (dt *DomainRoTx) Prune(ctx context.Context, rwTx kv.RwTx, step, txFrom, txT var valsCursor kv.RwCursor - sortableBuffer := sortableBuffersPoolForPruning.Get().(etl.Buffer) - sortableBuffer.Reset() + sortableBuffer := sortableBufferForPruning() defer sortableBuffersPoolForPruning.Put(sortableBuffer) ancientDomainValsCollector := etl.NewCollector(dt.name.String()+".domain.collate", dt.d.dirs.Tmp, sortableBuffer, dt.d.logger).LogLvl(log.LvlTrace) @@ -2021,3 +2035,5 @@ func (dt *DomainRoTx) Files() (res []string) { return append(res, dt.ht.Files()...) } func (dt *DomainRoTx) Name() kv.Domain { return dt.name } + +func (dt *DomainRoTx) DbgMaxTxNumInDB(tx kv.Tx) uint64 { return dt.ht.iit.ii.maxTxNumInDB(tx) } diff --git a/erigon-lib/state/inverted_index.go b/erigon-lib/state/inverted_index.go index 3068307a165..6310755f77c 100644 --- a/erigon-lib/state/inverted_index.go +++ b/erigon-lib/state/inverted_index.go @@ -852,8 +852,7 @@ func (iit *InvertedIndexRoTx) Prune(ctx context.Context, rwTx kv.RwTx, txFrom, t } defer idxDelCursor.Close() - sortableBuffer := sortableBuffersPoolForPruning.Get().(etl.Buffer) - sortableBuffer.Reset() + sortableBuffer := sortableBufferForPruning() defer sortableBuffersPoolForPruning.Put(sortableBuffer) collector := etl.NewCollector(ii.filenameBase+".prune.ii", ii.dirs.Tmp, sortableBuffer, ii.logger) diff --git a/eth/integrity/integrity_action_type.go b/eth/integrity/integrity_action_type.go index f7acb21dde2..2c207e079a8 100644 --- a/eth/integrity/integrity_action_type.go +++ b/eth/integrity/integrity_action_type.go @@ -24,8 +24,9 @@ const ( InvertedIndex Check = "InvertedIndex" HistoryNoSystemTxs Check = "HistoryNoSystemTxs" NoBorEventGaps Check = "NoBorEventGaps" + ReceiptsNoDups Check = "ReceiptsNoDups" ) var AllChecks = []Check{ - Blocks, BlocksTxnID, InvertedIndex, HistoryNoSystemTxs, NoBorEventGaps, + Blocks, BlocksTxnID, InvertedIndex, HistoryNoSystemTxs, NoBorEventGaps, ReceiptsNoDups, } diff --git a/eth/integrity/receipts_no_duplicates.go b/eth/integrity/receipts_no_duplicates.go new file mode 100644 index 00000000000..cdef0b17824 --- /dev/null +++ b/eth/integrity/receipts_no_duplicates.go @@ -0,0 +1,103 @@ +package integrity + +import ( + "context" + "fmt" + "time" + + "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/state" + "github.com/erigontech/erigon/core/rawdb/rawtemporaldb" + "github.com/erigontech/erigon/eth/stagedsync/stages" + "github.com/erigontech/erigon/turbo/services" + "github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks" +) + +func ReceiptsNoDuplicates(ctx context.Context, db kv.TemporalRoDB, blockReader services.FullBlockReader, failFast bool) (err error) { + defer func() { + log.Info("[integrity] ReceiptsNoDuplicates: done", "err", err) + }() + + logEvery := time.NewTicker(10 * time.Second) + defer logEvery.Stop() + + tx, err := db.BeginTemporalRo(ctx) + if err != nil { + return err + } + defer tx.Rollback() + + fromBlock := uint64(1) + stageExecProgress, err := stages.GetStageProgress(tx, stages.Execution) + if err != nil { + return err + } + toBlock := stageExecProgress + + txNumsReader := rawdbv3.TxNums.WithCustomReadTxNumFunc(freezeblocks.ReadTxNumFuncFromBlockReader(ctx, blockReader)) + fromTxNum, err := txNumsReader.Min(tx, fromBlock) + if err != nil { + return err + } + if toBlock > 0 { + toBlock-- // [fromBlock,toBlock) + } + + ac := tx.(state.HasAggTx).AggTx().(*state.AggregatorRoTx) + //toTxNum := ac.DbgDomain(kv.ReceiptDomain).DbgMaxTxNumInDB(tx) + toTxNum, err := txNumsReader.Max(tx, toBlock) + if err != nil { + return err + } + prevCumGasUsed := -1 + prevBN := uint64(1) + log.Info("[integrity] ReceiptsNoDuplicates starting", "fromTxNum", fromTxNum, "toTxNum", toTxNum) + + { + receiptProgress := ac.DbgDomain(kv.ReceiptDomain).DbgMaxTxNumInDB(tx) + accProgress := ac.DbgDomain(kv.AccountsDomain).DbgMaxTxNumInDB(tx) + if accProgress != receiptProgress { + err := fmt.Errorf("[integrity] ReceiptDomain=%d is behind AccountDomain=%d", receiptProgress, accProgress) + log.Warn(err.Error()) + } + } + + var cumGasUsed uint64 + for txNum := fromTxNum; txNum <= toTxNum; txNum++ { + cumGasUsed, _, _, err = rawtemporaldb.ReceiptAsOf(tx, txNum) + if err != nil { + return err + } + //_, blockNum, _ := txNumsReader.FindBlockNum(tx, txNum) + blockNum := badFoundBlockNum(tx, prevBN-1, txNumsReader, txNum) + //fmt.Printf("[dbg] cumGasUsed=%d, txNum=%d, blockNum=%d, prevCumGasUsed=%d\n", cumGasUsed, txNum, blockNum, prevCumGasUsed) + if int(cumGasUsed) == prevCumGasUsed && cumGasUsed != 0 && blockNum == prevBN { + err := fmt.Errorf("bad receipt at txnum: %d, block: %d, cumGasUsed=%d, prevCumGasUsed=%d", txNum, blockNum, cumGasUsed, prevCumGasUsed) + panic(err) + } + prevCumGasUsed = int(cumGasUsed) + prevBN = blockNum + + select { + case <-ctx.Done(): + return + case <-logEvery.C: + log.Info("[integrity] ReceiptsNoDuplicates", "progress", fmt.Sprintf("%dk/%dk", blockNum/1_000, toBlock/1_000)) + default: + } + } + + return nil +} + +func badFoundBlockNum(tx kv.Tx, fromBlock uint64, txNumsReader rawdbv3.TxNumsReader, curTxNum uint64) uint64 { + txNumMax, _ := txNumsReader.Max(tx, fromBlock) + i := uint64(0) + for txNumMax < curTxNum { + i++ + txNumMax, _ = txNumsReader.Max(tx, fromBlock+i) + } + return fromBlock + i +} diff --git a/eth/stagedsync/exec3_serial.go b/eth/stagedsync/exec3_serial.go index cb271284533..9fc62f3d96c 100644 --- a/eth/stagedsync/exec3_serial.go +++ b/eth/stagedsync/exec3_serial.go @@ -114,7 +114,7 @@ func (se *serialExecutor) execute(ctx context.Context, tasks []*state.TxTask) (c if !txTask.Final { var receipt *types.Receipt - if txTask.TxIndex >= 0 && !txTask.Final { + if txTask.TxIndex >= 0 { receipt = txTask.BlockReceipts[txTask.TxIndex] } if err := rawtemporaldb.AppendReceipt(se.doms, receipt, se.blobGasUsed); err != nil { diff --git a/eth/stagedsync/stage_custom_trace.go b/eth/stagedsync/stage_custom_trace.go index 6f8c2e4f0b1..f7f41f25f7e 100644 --- a/eth/stagedsync/stage_custom_trace.go +++ b/eth/stagedsync/stage_custom_trace.go @@ -85,8 +85,7 @@ func SpawnCustomTrace(cfg CustomTraceCfg, ctx context.Context, logger log.Logger } txNum = ac.DbgDomain(kv.ReceiptDomain).FirstStepNotInFiles() * stepSize - log.Info("SpawnCustomTrace", "recpStep", ac.DbgDomain(kv.ReceiptDomain).FirstStepNotInFiles(), "accDomain", ac.DbgDomain(kv.AccountsDomain).FirstStepNotInFiles()) - log.Info("SpawnCustomTrace", "files", ac.DbgDomain(kv.ReceiptDomain).Name(), "recp", fmt.Sprintf("%+v", ac.DbgDomain(kv.ReceiptDomain)), "files", ac.DbgDomain(kv.ReceiptDomain).Files()) + log.Info("[dbg] SpawnCustomTrace", "accountsDomainProgress", ac.DbgDomain(kv.AccountsDomain).DbgMaxTxNumInDB(tx), "receiptDomainProgress", ac.DbgDomain(kv.ReceiptDomain).DbgMaxTxNumInDB(tx), "receiptDomainFiles", ac.DbgDomain(kv.ReceiptDomain).Files()) ok, startBlock, err = txNumsReader.FindBlockNum(tx, txNum) if err != nil { return fmt.Errorf("getting last executed block: %w", err) @@ -109,6 +108,20 @@ func SpawnCustomTrace(cfg CustomTraceCfg, ctx context.Context, logger log.Logger } } + log.Info("SpawnCustomTrace finish") + if err := cfg.db.View(ctx, func(tx kv.Tx) error { + ac := tx.(state2.HasAggTx).AggTx().(*state2.AggregatorRoTx) + receiptProgress := ac.DbgDomain(kv.ReceiptDomain).DbgMaxTxNumInDB(tx) + accProgress := ac.DbgDomain(kv.AccountsDomain).DbgMaxTxNumInDB(tx) + if accProgress != receiptProgress { + err := fmt.Errorf("[integrity] ReceiptDomain=%d is behind AccountDomain=%d", receiptProgress, accProgress) + log.Warn(err.Error()) + return nil + } + return nil + }); err != nil { + return err + } return nil } @@ -125,10 +138,18 @@ func customTraceBatchProduce(ctx context.Context, cfg *exec3.ExecArgs, db kv.RwD if err := customTraceBatch(ctx, cfg, ttx, doms, fromBlock, toBlock, logPrefix, logger); err != nil { return err } + doms.SetTx(tx) if err := doms.Flush(ctx, tx); err != nil { return err } + + { //assert + if err = AssertReceipts(ctx, cfg, ttx, fromBlock, toBlock); err != nil { + return err + } + } + lastTxNum = doms.TxNum() if err := tx.Commit(); err != nil { return err @@ -137,6 +158,7 @@ func customTraceBatchProduce(ctx context.Context, cfg *exec3.ExecArgs, db kv.RwD }); err != nil { return err } + agg := db.(state2.HasAgg).Agg().(*state2.Aggregator) var fromStep, toStep uint64 if lastTxNum/agg.StepSize() > 0 { @@ -165,17 +187,78 @@ func customTraceBatchProduce(ctx context.Context, cfg *exec3.ExecArgs, db kv.RwD return nil } +func AssertReceipts(ctx context.Context, cfg *exec3.ExecArgs, tx kv.TemporalRwTx, fromBlock, toBlock uint64) (err error) { + logEvery := time.NewTicker(10 * time.Second) + defer logEvery.Stop() + + txNumsReader := rawdbv3.TxNums.WithCustomReadTxNumFunc(freezeblocks.ReadTxNumFuncFromBlockReader(ctx, cfg.BlockReader)) + fromTxNum, err := txNumsReader.Min(tx, fromBlock) + if err != nil { + return err + } + if fromTxNum < 2 { + fromTxNum = 2 //i don't remember why need this + } + + if toBlock > 0 { + toBlock-- // [fromBlock,toBlock) + } + toTxNum, err := txNumsReader.Max(tx, toBlock) + if err != nil { + return err + } + prevCumGasUsed := -1 + prevBN := uint64(1) + for txNum := fromTxNum; txNum <= toTxNum; txNum++ { + cumGasUsed, _, _, err := rawtemporaldb.ReceiptAsOf(tx, txNum) + if err != nil { + return err + } + blockNum := badFoundBlockNum(tx, prevBN-1, txNumsReader, txNum) + //fmt.Printf("[dbg.integrity] cumGasUsed=%d, txNum=%d, blockNum=%d, prevCumGasUsed=%d\n", cumGasUsed, txNum, blockNum, prevCumGasUsed) + if int(cumGasUsed) == prevCumGasUsed && cumGasUsed != 0 && blockNum == prevBN { + _min, _ := txNumsReader.Min(tx, blockNum) + _max, _ := txNumsReader.Max(tx, blockNum) + err := fmt.Errorf("bad receipt at txnum: %d, block: %d(%d-%d), cumGasUsed=%d, prevCumGasUsed=%d", txNum, blockNum, _min, _max, cumGasUsed, prevCumGasUsed) + log.Warn(err.Error()) + return err + //panic(err) + } + prevCumGasUsed = int(cumGasUsed) + prevBN = blockNum + + select { + case <-ctx.Done(): + return ctx.Err() + case <-logEvery.C: + log.Info("[integrity] ReceiptsNoDuplicates", "progress", fmt.Sprintf("%dk/%dk", txNum/1_000, toTxNum/1_000)) + default: + } + } + return nil +} + +func badFoundBlockNum(tx kv.Tx, fromBlock uint64, txNumsReader rawdbv3.TxNumsReader, curTxNum uint64) uint64 { + txNumMax, _ := txNumsReader.Max(tx, fromBlock) + i := uint64(0) + for txNumMax < curTxNum { + i++ + txNumMax, _ = txNumsReader.Max(tx, fromBlock+i) + } + return fromBlock + i +} + func customTraceBatch(ctx context.Context, cfg *exec3.ExecArgs, tx kv.TemporalRwTx, doms *state2.SharedDomains, fromBlock, toBlock uint64, logPrefix string, logger log.Logger) error { const logPeriod = 5 * time.Second logEvery := time.NewTicker(logPeriod) defer logEvery.Stop() var cumulativeBlobGasUsedInBlock uint64 - //var cumulativeGasUsedTotal = uint256.NewInt(0) - //TODO: new tracer may get tracer from pool, maybe add it to TxTask field - /// maybe need startTxNum/endTxNum - var prevTxNumLog = fromBlock + txNumsReader := rawdbv3.TxNums.WithCustomReadTxNumFunc(freezeblocks.ReadTxNumFuncFromBlockReader(ctx, cfg.BlockReader)) + fromTxNum, _ := txNumsReader.Min(tx, fromBlock) + prevTxNumLog := fromTxNum + var m runtime.MemStats if err := exec3.CustomTraceMapReduce(fromBlock, toBlock, exec3.TraceConsumer{ NewTracer: func() exec3.GenericTracer { return nil }, @@ -187,9 +270,6 @@ func customTraceBatch(ctx context.Context, cfg *exec3.ExecArgs, tx kv.TemporalRw if txTask.Tx != nil { cumulativeBlobGasUsedInBlock += txTask.Tx.GetBlobGas() } - //if txTask.Final { - // cumulativeGasUsedTotal.AddUint64(cumulativeGasUsedTotal, cumulativeGasUsedInBlock) - //} if txTask.Final { // TODO: move asserts to 1 level higher if txTask.Header.BlobGasUsed != nil && *txTask.Header.BlobGasUsed != cumulativeBlobGasUsedInBlock { @@ -200,9 +280,10 @@ func customTraceBatch(ctx context.Context, cfg *exec3.ExecArgs, tx kv.TemporalRw doms.SetTx(tx) doms.SetTxNum(txTask.TxNum) + if !txTask.Final { var receipt *types.Receipt - if txTask.TxIndex >= 0 && !txTask.Final { + if txTask.TxIndex >= 0 { receipt = txTask.BlockReceipts[txTask.TxIndex] } if err := rawtemporaldb.AppendReceipt(doms, receipt, cumulativeBlobGasUsedInBlock); err != nil { diff --git a/turbo/app/snapshots_cmd.go b/turbo/app/snapshots_cmd.go index 8d4d83d18c9..468af598840 100644 --- a/turbo/app/snapshots_cmd.go +++ b/turbo/app/snapshots_cmd.go @@ -542,6 +542,12 @@ func doIntegrity(cliCtx *cli.Context) error { } defer clean() + db, err := temporal.New(chainDB, agg) + if err != nil { + return err + } + defer db.Close() + blockReader, _ := blockRetire.IO() for _, chk := range integrity.AllChecks { if requestedCheck != "" && requestedCheck != chk { @@ -553,19 +559,23 @@ func doIntegrity(cliCtx *cli.Context) error { return err } case integrity.Blocks: - if err := integrity.SnapBlocksRead(ctx, chainDB, blockReader, 0, 0, failFast); err != nil { + if err := integrity.SnapBlocksRead(ctx, db, blockReader, 0, 0, failFast); err != nil { return err } case integrity.InvertedIndex: - if err := integrity.E3EfFiles(ctx, chainDB, agg, failFast, fromStep); err != nil { + if err := integrity.E3EfFiles(ctx, db, agg, failFast, fromStep); err != nil { return err } case integrity.HistoryNoSystemTxs: - if err := integrity.E3HistoryNoSystemTxs(ctx, chainDB, blockReader, agg); err != nil { + if err := integrity.E3HistoryNoSystemTxs(ctx, db, blockReader, agg); err != nil { return err } case integrity.NoBorEventGaps: - if err := integrity.NoGapsInBorEvents(ctx, chainDB, blockReader, 0, 0, failFast); err != nil { + if err := integrity.NoGapsInBorEvents(ctx, db, blockReader, 0, 0, failFast); err != nil { + return err + } + case integrity.ReceiptsNoDups: + if err := integrity.ReceiptsNoDuplicates(ctx, db, blockReader, failFast); err != nil { return err } From 490b5fe45f4b788c74bea02939195555b957dd42 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Sat, 1 Feb 2025 17:15:23 +0700 Subject: [PATCH 11/16] parent nil ptr fix (#13648) ``` [DBUG] [01-31|15:55:48.356] Inserted block hash=0x3ba1f6f721c32def207c318dc049e765eeb87d1e4b81c78a8e6574bb200057b9 number=7611267 panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x2a8 pc=0x1184f4f] goroutine 270390026 [running]: github.com/erigontech/erigon/core/types.(*Header).Hash(0x0) github.com/erigontech/erigon/core/types/block.go:584 +0x2f github.com/erigontech/erigon/turbo/execution/eth1.(*EthereumExecutionModule).unwindToCommonCanonical(0xc000c043c0, {0x34c19c0, 0xc1c1982780}, 0xc0862da2c8) github.com/erigontech/erigon/turbo/execution/eth1/ethereum_execution.go:175 +0x425 github.com/erigontech/erigon/turbo/execution/eth1.(*EthereumExecutionModule).ValidateChain.func2({0x34c19c0?, 0xc1c1982780?}) github.com/erigontech/erigon/turbo/execution/eth1/ethereum_execution.go:240 +0x31 github.com/erigontech/erigon-lib/kv/temporal.(*DB).Update(0xc000bb0510?, {0x348d478?, 0xc00334a230?}, 0xc2a2755a58) github.com/erigontech/erigon-lib@v0.0.0-00010101000000-000000000000/kv/temporal/kv_temporal.go:124 +0xb5 github.com/erigontech/erigon/turbo/execution/eth1.(*EthereumExecutionModule).ValidateChain( github.com/erigontech/erigon/turbo/execution/eth1/ethereum_execution.go:239 +0x52b github.com/erigontech/erigon-lib/direct.(*ExecutionClientDirect).ValidateChain(0xc060ba0ae0?, {0x348d478?, 0xc00334a230?}, 0xc000c043c0?, {0x348d478?, 0xc00334a230?, 0x1?}) github.com/erigontech/erigon-lib@v0.0.0-00010101000000-000000000000/direct/execution_client.go:63 +0x28 github.com/erigontech/erigon/turbo/execution/eth1/eth1_chain_reader.ChainReaderWriterEth1.ValidateChain( ``` --- turbo/execution/eth1/ethereum_execution.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/turbo/execution/eth1/ethereum_execution.go b/turbo/execution/eth1/ethereum_execution.go index 82c25f19e73..5fd3d876150 100644 --- a/turbo/execution/eth1/ethereum_execution.go +++ b/turbo/execution/eth1/ethereum_execution.go @@ -167,12 +167,13 @@ func (e *EthereumExecutionModule) unwindToCommonCanonical(tx kv.RwTx, header *ty currentHeader := header for isCanonical, err := e.isCanonicalHash(e.bacgroundCtx, tx, currentHeader.Hash()); !isCanonical && err == nil; isCanonical, err = e.isCanonicalHash(e.bacgroundCtx, tx, currentHeader.Hash()) { - currentHeader, err = e.getHeader(e.bacgroundCtx, tx, currentHeader.ParentHash, currentHeader.Number.Uint64()-1) + parentBlockHash, parentBlockNum := currentHeader.ParentHash, currentHeader.Number.Uint64()-1 + currentHeader, err = e.getHeader(e.bacgroundCtx, tx, parentBlockHash, parentBlockNum) if err != nil { return err } if currentHeader == nil { - return fmt.Errorf("header %v not found", currentHeader.Hash()) + return fmt.Errorf("header %d, %x not found", parentBlockNum, parentBlockHash) } } if err := e.hook.BeforeRun(tx, true); err != nil { From f1f235fec31eab6f977230eaa9245ada90e1d361 Mon Sep 17 00:00:00 2001 From: Ilya Mikheev <54912776+JkLondon@users.noreply.github.com> Date: Sat, 1 Feb 2025 11:36:24 +0100 Subject: [PATCH 12/16] Serializing and Deserializing to V3 (#13390) closes #12480 --------- Co-authored-by: JkLondon Co-authored-by: alex.sharov --- core/state/rw_v3.go | 3 +- core/test/domains_restart_test.go | 9 +- erigon-lib/commitment/commitment.go | 28 ++-- erigon-lib/kv/kvcache/cache_test.go | 16 +- erigon-lib/state/aggregator_fuzz_test.go | 20 ++- erigon-lib/state/aggregator_test.go | 96 +++++++++--- erigon-lib/state/domain_shared.go | 16 +- erigon-lib/state/domain_shared_test.go | 19 ++- erigon-lib/state/domain_test.go | 18 ++- erigon-lib/state/squeeze_test.go | 11 +- erigon-lib/types/account.go | 126 --------------- erigon-lib/types/accounts/account.go | 36 +++++ .../types/accounts/account_benchmark_test.go | 25 ++- erigon-lib/types/accounts/account_test.go | 146 +++++++----------- txnprovider/txpool/pool_test.go | 117 +++++++++++--- txnprovider/txpool/senders.go | 51 +----- 16 files changed, 384 insertions(+), 353 deletions(-) delete mode 100644 erigon-lib/types/account.go diff --git a/core/state/rw_v3.go b/core/state/rw_v3.go index 80e8694ec3a..ef5c3f9af12 100644 --- a/core/state/rw_v3.go +++ b/core/state/rw_v3.go @@ -258,8 +258,7 @@ func (rs *StateV3) Unwind(ctx context.Context, tx kv.RwTx, blockUnwindTo, txUnwi var address common.Address copy(address[:], k) - newV := make([]byte, acc.EncodingLengthForStorage()) - acc.EncodeForStorage(newV) + newV := accounts.SerialiseV3(&acc) if accumulator != nil { accumulator.ChangeAccount(address, acc.Incarnation, newV) } diff --git a/core/test/domains_restart_test.go b/core/test/domains_restart_test.go index d5ae4a7f3dd..cb542d46b18 100644 --- a/core/test/domains_restart_test.go +++ b/core/test/domains_restart_test.go @@ -43,7 +43,6 @@ import ( "github.com/erigontech/erigon-lib/kv/temporal" "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" @@ -491,7 +490,13 @@ func TestCommit(t *testing.T) { require.NoError(t, err) defer domains.Close() - buf := types2.EncodeAccountBytesV3(0, uint256.NewInt(7), nil, 1) + acc := accounts.Account{ + Nonce: 0, + Balance: *uint256.NewInt(7), + CodeHash: libcommon.Hash{}, + Incarnation: 1, + } + buf := accounts.SerialiseV3(&acc) addr := libcommon.Hex2Bytes("8e5476fc5990638a4fb0b5fd3f61bb4b5c5f395e") loc := libcommon.Hex2Bytes("24f3a02dc65eda502dbf75919e795458413d3c45b38bb35b51235432707900ed") diff --git a/erigon-lib/commitment/commitment.go b/erigon-lib/commitment/commitment.go index ad6a5d183dd..a6a6d61d2af 100644 --- a/erigon-lib/commitment/commitment.go +++ b/erigon-lib/commitment/commitment.go @@ -22,6 +22,7 @@ import ( "encoding/binary" "errors" "fmt" + "github.com/erigontech/erigon-lib/types/accounts" "math/bits" "sort" "strings" @@ -34,12 +35,10 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/cryptozerocopy" - "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/metrics" - "github.com/erigontech/erigon-lib/types" - "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/etl" + "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon-lib/metrics" ) var ( @@ -1060,21 +1059,26 @@ func (t *Updates) TouchAccount(c *KeyUpdate, val []byte) { if c.update.Flags&DeleteUpdate != 0 { c.update.Flags = 0 // also could invert with ^ but 0 is just a reset } - nonce, balance, chash := types.DecodeAccountBytesV3(val) - if c.update.Nonce != nonce { - c.update.Nonce = nonce + + acc := accounts.Account{} + err := accounts.DeserialiseV3(&acc, val) + if err != nil { + panic(err) + } + if c.update.Nonce != acc.Nonce { + c.update.Nonce = acc.Nonce c.update.Flags |= NonceUpdate } - if !c.update.Balance.Eq(balance) { - c.update.Balance.Set(balance) + if !c.update.Balance.Eq(&acc.Balance) { + c.update.Balance.Set(&acc.Balance) c.update.Flags |= BalanceUpdate } - if !bytes.Equal(chash, c.update.CodeHash[:]) { - if len(chash) == 0 { + if !bytes.Equal(acc.CodeHash.Bytes(), c.update.CodeHash[:]) { + if len(acc.CodeHash.Bytes()) == 0 { copy(c.update.CodeHash[:], EmptyCodeHash) } else { c.update.Flags |= CodeUpdate - copy(c.update.CodeHash[:], chash) + copy(c.update.CodeHash[:], acc.CodeHash.Bytes()) } } } diff --git a/erigon-lib/kv/kvcache/cache_test.go b/erigon-lib/kv/kvcache/cache_test.go index 5915d95ca81..eb0cc41bb05 100644 --- a/erigon-lib/kv/kvcache/cache_test.go +++ b/erigon-lib/kv/kvcache/cache_test.go @@ -20,6 +20,7 @@ import ( "context" "encoding/binary" "fmt" + "github.com/erigontech/erigon-lib/types/accounts" "runtime" "sync" "sync/atomic" @@ -37,7 +38,6 @@ import ( "github.com/erigontech/erigon-lib/kv/temporal/temporaltest" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/state" - "github.com/erigontech/erigon-lib/types" ) func TestEvictionInUnexpectedOrder(t *testing.T) { @@ -179,9 +179,17 @@ func TestAPI(t *testing.T) { c := New(DefaultCoherentConfig) k1, k2 := [20]byte{1}, [20]byte{2} db, _ := temporaltest.NewTestDB(t, datadir.New(t.TempDir())) - account1Enc := types.EncodeAccountBytesV3(1, uint256.NewInt(11), make([]byte, 32), 2) - account2Enc := types.EncodeAccountBytesV3(1, uint256.NewInt(11), make([]byte, 32), 3) - account4Enc := types.EncodeAccountBytesV3(1, uint256.NewInt(11), make([]byte, 32), 5) + acc := accounts.Account{ + Nonce: 1, + Balance: *uint256.NewInt(11), + CodeHash: common.Hash{}, + Incarnation: 2, + } + account1Enc := accounts.SerialiseV3(&acc) + acc.Incarnation = 3 + account2Enc := accounts.SerialiseV3(&acc) + acc.Incarnation = 5 + account4Enc := accounts.SerialiseV3(&acc) get := func(key [20]byte, expectTxnID uint64) (res [1]chan []byte) { diff --git a/erigon-lib/state/aggregator_fuzz_test.go b/erigon-lib/state/aggregator_fuzz_test.go index 659dbed084d..470aa21fe23 100644 --- a/erigon-lib/state/aggregator_fuzz_test.go +++ b/erigon-lib/state/aggregator_fuzz_test.go @@ -21,6 +21,7 @@ package state import ( "context" "encoding/binary" + "github.com/erigontech/erigon-lib/types/accounts" "testing" "time" @@ -31,7 +32,6 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/mdbx" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/types" "github.com/holiman/uint256" "github.com/stretchr/testify/require" @@ -96,8 +96,13 @@ func Fuzz_AggregatorV3_Merge(f *testing.F) { } for txNum := uint64(1); txNum <= txs; txNum++ { domains.SetTxNum(txNum) - - buf := types.EncodeAccountBytesV3(1, uint256.NewInt(0), nil, 0) + acc := accounts.Account{ + Nonce: 1, + Balance: *uint256.NewInt(0), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts.SerialiseV3(&acc) err = domains.DomainPut(kv.AccountsDomain, addrs[txNum].Bytes(), nil, buf, nil, 0) require.NoError(t, err) @@ -215,8 +220,13 @@ func Fuzz_AggregatorV3_MergeValTransform(f *testing.F) { } for txNum := uint64(1); txNum <= txs; txNum++ { domains.SetTxNum(txNum) - - buf := types.EncodeAccountBytesV3(1, uint256.NewInt(txNum*1e6), nil, 0) + acc := accounts.Account{ + Nonce: 1, + Balance: *uint256.NewInt(txNum * 1e6), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts.SerialiseV3(&acc) err = domains.DomainPut(kv.AccountsDomain, addrs[txNum].Bytes(), nil, buf, nil, 0) require.NoError(t, err) diff --git a/erigon-lib/state/aggregator_test.go b/erigon-lib/state/aggregator_test.go index 273d6a70fa5..f120961bad7 100644 --- a/erigon-lib/state/aggregator_test.go +++ b/erigon-lib/state/aggregator_test.go @@ -22,6 +22,7 @@ import ( "encoding/binary" "encoding/hex" "fmt" + "github.com/erigontech/erigon-lib/types/accounts" "math" "math/rand" "os" @@ -48,7 +49,6 @@ import ( "github.com/erigontech/erigon-lib/kv/stream" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/seg" - "github.com/erigontech/erigon-lib/types" "github.com/holiman/uint256" "github.com/stretchr/testify/require" ) @@ -93,8 +93,13 @@ func TestAggregatorV3_Merge(t *testing.T) { n, err = rnd.Read(loc) require.NoError(t, err) require.EqualValues(t, length.Hash, n) - - buf := types.EncodeAccountBytesV3(1, uint256.NewInt(0), nil, 0) + acc := accounts.Account{ + Nonce: 1, + Balance: *uint256.NewInt(0), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts.SerialiseV3(&acc) err = domains.DomainPut(kv.AccountsDomain, addr, nil, buf, nil, 0) require.NoError(t, err) @@ -208,8 +213,13 @@ func TestAggregatorV3_MergeValTransform(t *testing.T) { n, err = rnd.Read(loc) require.NoError(t, err) require.EqualValues(t, length.Hash, n) - - buf := types.EncodeAccountBytesV3(1, uint256.NewInt(txNum*1e6), nil, 0) + acc := accounts.Account{ + Nonce: 1, + Balance: *uint256.NewInt(txNum * 1e6), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts.SerialiseV3(&acc) err = domains.DomainPut(kv.AccountsDomain, addr, nil, buf, nil, 0) require.NoError(t, err) @@ -335,8 +345,13 @@ func aggregatorV3_RestartOnDatadir(t *testing.T, rc runCfg) { require.NoError(t, err) require.EqualValues(t, length.Hash, n) //keys[txNum-1] = append(addr, loc...) - - buf := types.EncodeAccountBytesV3(1, uint256.NewInt(rnd.Uint64()), nil, 0) + acc := accounts.Account{ + Nonce: 1, + Balance: *uint256.NewInt(rnd.Uint64()), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts.SerialiseV3(&acc) err = domains.DomainPut(kv.AccountsDomain, addr, nil, buf, nil, 0) require.NoError(t, err) @@ -678,7 +693,13 @@ func generateSharedDomainsUpdatesForTx(t *testing.T, domains *SharedDomains, txN r := rnd.IntN(101) switch { case r <= 33: - buf := types.EncodeAccountBytesV3(txNum, uint256.NewInt(txNum*100_000), nil, 0) + acc := accounts.Account{ + Nonce: txNum, + Balance: *uint256.NewInt(txNum * 100_000), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts.SerialiseV3(&acc) prev, step, err := domains.GetLatest(kv.AccountsDomain, key) require.NoError(t, err) @@ -723,7 +744,13 @@ func generateSharedDomainsUpdatesForTx(t *testing.T, domains *SharedDomains, txN require.NoError(t, err) if prev == nil { usedKeys[string(key)] = struct{}{} - buf := types.EncodeAccountBytesV3(txNum, uint256.NewInt(txNum*100_000), nil, 0) + acc := accounts.Account{ + Nonce: txNum, + Balance: *uint256.NewInt(txNum * 100_000), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts.SerialiseV3(&acc) err = domains.DomainPut(kv.AccountsDomain, key, nil, buf, prev, step) require.NoError(t, err) } @@ -788,7 +815,13 @@ func TestAggregatorV3_RestartOnFiles(t *testing.T) { require.NoError(t, err) require.EqualValues(t, length.Hash, n) - buf := types.EncodeAccountBytesV3(txNum, uint256.NewInt(1000000000000), nil, 0) + acc := accounts.Account{ + Nonce: txNum, + Balance: *uint256.NewInt(1000000000000), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts.SerialiseV3(&acc) err = domains.DomainPut(kv.AccountsDomain, addr, nil, buf[:], nil, 0) require.NoError(t, err) @@ -853,9 +886,11 @@ func TestAggregatorV3_RestartOnFiles(t *testing.T) { //fmt.Printf("%x [%d/%d]", key, miss, i+1) // txnum starts from 1 continue } - nonce, _, _ := types.DecodeAccountBytesV3(stored) + acc := accounts.Account{} + err = accounts.DeserialiseV3(&acc, stored) + require.NoError(t, err) - require.EqualValues(t, i+1, int(nonce)) + require.EqualValues(t, i+1, int(acc.Nonce)) storedV, _, found, err := ac.GetLatest(kv.StorageDomain, key, newTx) require.NoError(t, err) @@ -929,7 +964,13 @@ func TestAggregatorV3_ReplaceCommittedKeys(t *testing.T) { require.EqualValues(t, length.Hash, n) keys[txNum-1] = append(addr, loc...) - buf := types.EncodeAccountBytesV3(1, uint256.NewInt(0), nil, 0) + acc := accounts.Account{ + Nonce: 1, + Balance: *uint256.NewInt(0), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts.SerialiseV3(&acc) err = domains.DomainPut(kv.AccountsDomain, addr, nil, buf, prev1, 0) require.NoError(t, err) @@ -1161,7 +1202,13 @@ func TestAggregatorV3_SharedDomains(t *testing.T) { } for j := 0; j < len(keys); j++ { - buf := types.EncodeAccountBytesV3(uint64(i), uint256.NewInt(uint64(i*100_000)), nil, 0) + acc := accounts.Account{ + Nonce: uint64(i), + Balance: *uint256.NewInt(uint64(i * 100_000)), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts.SerialiseV3(&acc) prev, step, err := domains.GetLatest(kv.AccountsDomain, keys[j]) require.NoError(t, err) @@ -1196,7 +1243,13 @@ func TestAggregatorV3_SharedDomains(t *testing.T) { domains.SetTxNum(uint64(i)) for j := 0; j < len(keys); j++ { - buf := types.EncodeAccountBytesV3(uint64(i), uint256.NewInt(uint64(i*100_000)), nil, 0) + acc := accounts.Account{ + Nonce: uint64(i), + Balance: *uint256.NewInt(uint64(i * 100_000)), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts.SerialiseV3(&acc) prev, step, _, err := mc.GetLatest(kv.AccountsDomain, keys[j], rwTx) require.NoError(t, err) @@ -1233,7 +1286,13 @@ func TestAggregatorV3_SharedDomains(t *testing.T) { domains.SetTxNum(uint64(i)) for j := 0; j < len(keys); j++ { - buf := types.EncodeAccountBytesV3(uint64(i), uint256.NewInt(uint64(i*100_000)), nil, 0) + acc := accounts.Account{ + Nonce: uint64(i), + Balance: *uint256.NewInt(uint64(i * 100_000)), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts.SerialiseV3(&acc) prev, step, _, err := mc.GetLatest(kv.AccountsDomain, keys[j], rwTx) require.NoError(t, err) @@ -1256,8 +1315,9 @@ func Test_helper_decodeAccountv3Bytes(t *testing.T) { input, err := hex.DecodeString("000114000101") require.NoError(t, err) - n, b, ch := types.DecodeAccountBytesV3(input) - fmt.Printf("input %x nonce %d balance %d codeHash %d\n", input, n, b.Uint64(), ch) + acc := accounts.Account{} + _ = accounts.DeserialiseV3(&acc, input) + fmt.Printf("input %x nonce %d balance %d codeHash %d\n", input, acc.Nonce, acc.Balance.Uint64(), acc.CodeHash.Bytes()) } func TestAggregator_RebuildCommitmentBasedOnFiles(t *testing.T) { diff --git a/erigon-lib/state/domain_shared.go b/erigon-lib/state/domain_shared.go index 6fece4d4b8b..b0578ab0290 100644 --- a/erigon-lib/state/domain_shared.go +++ b/erigon-lib/state/domain_shared.go @@ -23,6 +23,7 @@ import ( "encoding/binary" "encoding/hex" "fmt" + "github.com/erigontech/erigon-lib/types/accounts" "math" "path/filepath" "runtime" @@ -48,7 +49,6 @@ import ( "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/types" ) var ErrBehindCommitment = errors.New("behind commitment") @@ -1226,14 +1226,18 @@ func (sdc *SharedDomainsCommitmentContext) Account(plainKey []byte) (u *commitme u = &commitment.Update{CodeHash: commitment.EmptyCodeHashArray} if len(encAccount) > 0 { - nonce, balance, chash := types.DecodeAccountBytesV3(encAccount) + acc := accounts.Account{} + err = accounts.DeserialiseV3(&acc, encAccount) + if err != nil { + return nil, err + } u.Flags |= commitment.NonceUpdate - u.Nonce = nonce + u.Nonce = acc.Nonce u.Flags |= commitment.BalanceUpdate - u.Balance.Set(balance) - if len(chash) > 0 { + u.Balance.Set(&acc.Balance) + if len(acc.CodeHash.Bytes()) > 0 { u.Flags |= commitment.CodeUpdate - copy(u.CodeHash[:], chash) + copy(u.CodeHash[:], acc.CodeHash.Bytes()) } } if u.CodeHash == commitment.EmptyCodeHashArray { diff --git a/erigon-lib/state/domain_shared_test.go b/erigon-lib/state/domain_shared_test.go index 29018977b48..7fa9ea86e3a 100644 --- a/erigon-lib/state/domain_shared_test.go +++ b/erigon-lib/state/domain_shared_test.go @@ -20,6 +20,8 @@ import ( "context" "encoding/binary" "fmt" + "github.com/erigontech/erigon-lib/common" + accounts3 "github.com/erigontech/erigon-lib/types/accounts" "testing" "time" @@ -30,7 +32,6 @@ 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" ) func TestSharedDomain_CommitmentKeyReplacement(t *testing.T) { @@ -155,7 +156,13 @@ Loop: for ; i < int(maxTx); i++ { domains.SetTxNum(uint64(i)) for accs := 0; accs < 256; accs++ { - v := types.EncodeAccountBytesV3(uint64(i), uint256.NewInt(uint64(i*10e6)+uint64(accs*10e2)), nil, 0) + acc := accounts3.Account{ + Nonce: uint64(i), + Balance: *uint256.NewInt(uint64(i*10e6) + uint64(accs*10e2)), + CodeHash: common.Hash{}, + Incarnation: 0, + } + v := accounts3.SerialiseV3(&acc) k0[0] = byte(accs) pv, step, err := domains.GetLatest(kv.AccountsDomain, k0) require.NoError(t, err) @@ -416,7 +423,13 @@ func TestSharedDomain_StorageIter(t *testing.T) { for ; i < int(maxTx); i++ { domains.SetTxNum(uint64(i)) for accs := 0; accs < accounts; accs++ { - v := types.EncodeAccountBytesV3(uint64(i), uint256.NewInt(uint64(i*10e6)+uint64(accs*10e2)), nil, 0) + acc := accounts3.Account{ + Nonce: uint64(i), + Balance: *uint256.NewInt(uint64(i*10e6) + uint64(accs*10e2)), + CodeHash: common.Hash{}, + Incarnation: 0, + } + v := accounts3.SerialiseV3(&acc) k0[0] = byte(accs) pv, step, err := domains.GetLatest(kv.AccountsDomain, k0) diff --git a/erigon-lib/state/domain_test.go b/erigon-lib/state/domain_test.go index aa3c4e4d1c3..aae504cdaef 100644 --- a/erigon-lib/state/domain_test.go +++ b/erigon-lib/state/domain_test.go @@ -22,6 +22,7 @@ import ( "encoding/binary" "encoding/hex" "fmt" + accounts3 "github.com/erigontech/erigon-lib/types/accounts" "io/fs" "math" randOld "math/rand" @@ -46,7 +47,6 @@ import ( "github.com/erigontech/erigon-lib/kv/stream" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/seg" - "github.com/erigontech/erigon-lib/types" "github.com/holiman/uint256" "github.com/stretchr/testify/require" ) @@ -1184,7 +1184,13 @@ func TestDomainContext_getFromFiles(t *testing.T) { writer.SetTxNum(uint64(i)) for j := 0; j < len(keys); j++ { - buf := types.EncodeAccountBytesV3(uint64(i), uint256.NewInt(uint64(i*100_000)), nil, 0) + acc := accounts3.Account{ + Nonce: uint64(i), + Balance: *uint256.NewInt(uint64(i * 100_000)), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts3.SerialiseV3(&acc) err = writer.PutWithPrev(keys[j], nil, buf, prev, 0) require.NoError(t, err) @@ -1395,7 +1401,13 @@ func generateAccountUpdates(r *rndGen, totalTx, keyTxsLimit uint64) []upd { for i := uint64(0); i < keyTxsLimit; i++ { txNum := generateRandomTxNum(r, totalTx, usedTxNums) jitter := r.IntN(10e7) - value := types.EncodeAccountBytesV3(i, uint256.NewInt(i*10e4+uint64(jitter)), nil, 0) + acc := accounts3.Account{ + Nonce: i, + Balance: *uint256.NewInt(i*10e4 + uint64(jitter)), + CodeHash: common.Hash{}, + Incarnation: 0, + } + value := accounts3.SerialiseV3(&acc) updates = append(updates, upd{txNum: txNum, value: value}) usedTxNums[txNum] = true diff --git a/erigon-lib/state/squeeze_test.go b/erigon-lib/state/squeeze_test.go index c95dc881414..e5529f378d4 100644 --- a/erigon-lib/state/squeeze_test.go +++ b/erigon-lib/state/squeeze_test.go @@ -2,6 +2,8 @@ package state import ( "context" + "github.com/erigontech/erigon-lib/common" + accounts3 "github.com/erigontech/erigon-lib/types/accounts" "math" "testing" @@ -9,7 +11,6 @@ import ( "github.com/erigontech/erigon-lib/common/length" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" - "github.com/erigontech/erigon-lib/types" "github.com/holiman/uint256" "github.com/stretchr/testify/require" ) @@ -49,7 +50,13 @@ func testDbAggregatorWithFiles(tb testing.TB, cfg *testAggConfig) (kv.RwDB, *Agg domains.SetTxNum(uint64(i)) for j := 0; j < len(keys); j++ { - buf := types.EncodeAccountBytesV3(uint64(i), uint256.NewInt(uint64(i*100_000)), nil, 0) + acc := accounts3.Account{ + Nonce: uint64(i), + Balance: *uint256.NewInt(uint64(i * 100_000)), + CodeHash: common.Hash{}, + Incarnation: 0, + } + buf := accounts3.SerialiseV3(&acc) prev, step, err := domains.GetLatest(kv.AccountsDomain, keys[j]) require.NoError(tb, err) diff --git a/erigon-lib/types/account.go b/erigon-lib/types/account.go deleted file mode 100644 index cc194845d45..00000000000 --- a/erigon-lib/types/account.go +++ /dev/null @@ -1,126 +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 types - -import ( - "fmt" - "math/bits" - - "github.com/holiman/uint256" - - "github.com/erigontech/erigon-lib/common" - "github.com/erigontech/erigon-lib/common/length" -) - -// TODO move to erigon/core/types/accounts once erigon-lib is further unpacked into erigon/ -func DecodeAccountBytesV3(enc []byte) (nonce uint64, balance *uint256.Int, hash []byte) { - if len(enc) == 0 { - return - } - pos := 0 - nonceBytes := int(enc[pos]) - balance = &uint256.Int{} - pos++ - if nonceBytes > 0 { - nonce = common.BytesToUint64(enc[pos : pos+nonceBytes]) - pos += nonceBytes - } - balanceBytes := int(enc[pos]) - pos++ - if balanceBytes > 0 { - balance.SetBytes(enc[pos : pos+balanceBytes]) - pos += balanceBytes - } - codeHashBytes := int(enc[pos]) - pos++ - if codeHashBytes == length.Hash { - hash = make([]byte, codeHashBytes) - copy(hash, enc[pos:pos+codeHashBytes]) - pos += codeHashBytes - } - if pos >= len(enc) { - panic(fmt.Errorf("deserialse2: %d >= %d ", pos, len(enc))) - } - return -} - -// TODO move to erigon/core/types/accounts once erigon-lib is further unpacked into erigon/ -func EncodeAccountBytesV3(nonce uint64, balance *uint256.Int, hash []byte, incarnation uint64) []byte { - l := 1 - if nonce > 0 { - l += common.BitLenToByteLen(bits.Len64(nonce)) - } - l++ - if !balance.IsZero() { - l += balance.ByteLen() - } - l++ - if len(hash) == length.Hash { - l += 32 - } - l++ - if incarnation > 0 { - l += common.BitLenToByteLen(bits.Len64(incarnation)) - } - value := make([]byte, l) - pos := 0 - - if nonce == 0 { - value[pos] = 0 - pos++ - } else { - nonceBytes := common.BitLenToByteLen(bits.Len64(nonce)) - value[pos] = byte(nonceBytes) - var nonce = nonce - for i := nonceBytes; i > 0; i-- { - value[pos+i] = byte(nonce) - nonce >>= 8 - } - pos += nonceBytes + 1 - } - if balance.IsZero() { - value[pos] = 0 - pos++ - } else { - balanceBytes := balance.ByteLen() - value[pos] = byte(balanceBytes) - pos++ - balance.WriteToSlice(value[pos : pos+balanceBytes]) - pos += balanceBytes - } - if len(hash) == 0 { - value[pos] = 0 - pos++ - } else { - value[pos] = 32 - pos++ - copy(value[pos:pos+32], hash) - pos += 32 - } - if incarnation == 0 { - value[pos] = 0 - } else { - incBytes := common.BitLenToByteLen(bits.Len64(incarnation)) - value[pos] = byte(incBytes) - var inc = incarnation - for i := incBytes; i > 0; i-- { - value[pos+i] = byte(inc) - inc >>= 8 - } - } - return value -} diff --git a/erigon-lib/types/accounts/account.go b/erigon-lib/types/accounts/account.go index 3ce4ec02023..61f4da233f6 100644 --- a/erigon-lib/types/accounts/account.go +++ b/erigon-lib/types/accounts/account.go @@ -791,3 +791,39 @@ func SerialiseV3To(a *Account, value []byte) { } } } + +// Decode the sender's balance and nonce from encoded byte-slice +func DecodeSender(enc []byte) (nonce uint64, balance uint256.Int, err error) { + if len(enc) == 0 { + return + } + + var fieldSet = enc[0] + var pos = 1 + + if fieldSet&1 > 0 { + decodeLength := int(enc[pos]) + + if len(enc) < pos+decodeLength+1 { + return nonce, balance, fmt.Errorf( + "malformed CBOR for Account.Nonce: %s, Length %d", + enc[pos+1:], decodeLength) + } + + nonce = libcommon.BytesToUint64(enc[pos+1 : pos+decodeLength+1]) + pos += decodeLength + 1 + } + + if fieldSet&2 > 0 { + decodeLength := int(enc[pos]) + + if len(enc) < pos+decodeLength+1 { + return nonce, balance, fmt.Errorf( + "malformed CBOR for Account.Nonce: %s, Length %d", + enc[pos+1:], decodeLength) + } + + (&balance).SetBytes(enc[pos+1 : pos+decodeLength+1]) + } + return +} diff --git a/erigon-lib/types/accounts/account_benchmark_test.go b/erigon-lib/types/accounts/account_benchmark_test.go index e749e7b84bb..4ed43cd9a71 100644 --- a/erigon-lib/types/accounts/account_benchmark_test.go +++ b/erigon-lib/types/accounts/account_benchmark_test.go @@ -175,10 +175,11 @@ func BenchmarkEncodingAccountForStorage(b *testing.B) { for _, test := range accountCases { test := test - buf := make([]byte, test.acc.EncodingLengthForStorage()) + //buf := make([]byte, test.acc.EncodingLengthForStorage()) b.Run(fmt.Sprint(test.name), func(b *testing.B) { for i := 0; i < b.N; i++ { - test.acc.EncodeForStorage(buf) + SerialiseV3(test.acc) + //test.acc.EncodeForStorage(buf) performance has degraded a bit because we are not using the same buf now } }) } @@ -286,17 +287,16 @@ func BenchmarkDecodingAccount(b *testing.B) { test := test b.Run(fmt.Sprint(test.name), func(b *testing.B) { for i := 0; i < b.N; i++ { + println(test.name, i, b.N) //TODO: it just stucks w/o that print b.StopTimer() test.acc.Nonce = uint64(i) test.acc.Balance.SetUint64(uint64(i)) - encodedAccount := make([]byte, test.acc.EncodingLengthForStorage()) - - test.acc.EncodeForStorage(encodedAccount) + encodedAccount := SerialiseV3(test.acc) b.StartTimer() var decodedAccount Account - if err := decodedAccount.DecodeForStorage(encodedAccount); err != nil { + if err := DeserialiseV3(&decodedAccount, encodedAccount); err != nil { b.Fatal("cant decode the account", err, encodedAccount) } @@ -314,7 +314,7 @@ func BenchmarkDecodingAccount(b *testing.B) { } } -func BenchmarkDecodingIncarnation(b *testing.B) { +func BenchmarkDecodingIncarnation(b *testing.B) { // V2 version of bench was a panic one accountCases := []struct { name string acc *Account @@ -354,25 +354,24 @@ func BenchmarkDecodingIncarnation(b *testing.B) { b.ResetTimer() for _, test := range accountCases { test := test - encodedAccount := make([]byte, test.acc.EncodingLengthForStorage()) b.Run(fmt.Sprint(test.name), func(b *testing.B) { for i := 0; i < b.N; i++ { + println(test.name, i, b.N) //TODO: it just stucks w/o that print b.StopTimer() test.acc.Nonce = uint64(i) test.acc.Balance.SetUint64(uint64(i)) - test.acc.EncodeForStorage(encodedAccount) + encodedAccount := SerialiseV3(test.acc) b.StartTimer() - if _, err := DecodeIncarnationFromStorage(encodedAccount); err != nil { + decodedAcc := Account{} + if err := DeserialiseV3(&decodedAcc, encodedAccount); err != nil { b.Fatal("can't decode the incarnation", err, encodedAccount) } - decodedIncarnation, _ := DecodeIncarnationFromStorage(encodedAccount) - b.StopTimer() - decodedIncarnations = append(decodedIncarnations, decodedIncarnation) + decodedIncarnations = append(decodedIncarnations, decodedAcc.Incarnation) b.StartTimer() } diff --git a/erigon-lib/types/accounts/account_test.go b/erigon-lib/types/accounts/account_test.go index 4f8d5087583..c039e8ea5f9 100644 --- a/erigon-lib/types/accounts/account_test.go +++ b/erigon-lib/types/accounts/account_test.go @@ -36,28 +36,28 @@ func TestEmptyAccount(t *testing.T) { Incarnation: 5, } - encodedAccount := make([]byte, a.EncodingLengthForStorage()) - a.EncodeForStorage(encodedAccount) + encodedAccount := SerialiseV3(&a) - var decodedAccount Account - if err := decodedAccount.DecodeForStorage(encodedAccount); err != nil { - t.Fatal("cant decode the account", err, encodedAccount) + decodedAcc := Account{} + if err := DeserialiseV3(&decodedAcc, encodedAccount); err != nil { + t.Fatal("Can't decode the incarnation", err, encodedAccount) } - isAccountsEqual(t, a, decodedAccount) + isIncarnationEqual(t, a.Incarnation, decodedAcc.Incarnation) } func TestEmptyAccount2(t *testing.T) { t.Parallel() - encodedAccount := Account{} + emptyAcc := Account{} - b := make([]byte, encodedAccount.EncodingLengthForStorage()) - encodedAccount.EncodeForStorage(b) + encodedAccount := SerialiseV3(&emptyAcc) - var decodedAccount Account - if err := decodedAccount.DecodeForStorage(b); err != nil { - t.Fatal("cant decode the account", err, encodedAccount) + decodedAcc := Account{} + if err := DeserialiseV3(&decodedAcc, encodedAccount); err != nil { + t.Fatal("Can't decode the incarnation", err, encodedAccount) } + + isIncarnationEqual(t, emptyAcc.Incarnation, decodedAcc.Incarnation) } // fails if run package tests @@ -66,13 +66,14 @@ func TestEmptyAccount_BufferStrangeBehaviour(t *testing.T) { t.Parallel() a := Account{} - encodedAccount := make([]byte, a.EncodingLengthForStorage()) - a.EncodeForStorage(encodedAccount) + encodedAccount := SerialiseV3(&a) - var decodedAccount Account - if err := decodedAccount.DecodeForStorage(encodedAccount); err != nil { - t.Fatal("cant decode the account", err, encodedAccount) + decodedAcc := Account{} + if err := DeserialiseV3(&decodedAcc, encodedAccount); err != nil { + t.Fatal("Can't decode the incarnation", err, encodedAccount) } + + isIncarnationEqual(t, a.Incarnation, decodedAcc.Incarnation) } func TestAccountEncodeWithCode(t *testing.T) { @@ -86,16 +87,14 @@ func TestAccountEncodeWithCode(t *testing.T) { Incarnation: 4, } - encodedLen := a.EncodingLengthForStorage() - encodedAccount := make([]byte, encodedLen) - a.EncodeForStorage(encodedAccount) + encodedAccount := SerialiseV3(&a) - var decodedAccount Account - if err := decodedAccount.DecodeForStorage(encodedAccount); err != nil { - t.Fatal("cant decode the account", err, encodedAccount) + decodedAcc := Account{} + if err := DeserialiseV3(&decodedAcc, encodedAccount); err != nil { + t.Fatal("Can't decode the incarnation", err, encodedAccount) } - isAccountsEqual(t, a, decodedAccount) + isIncarnationEqual(t, a.Incarnation, decodedAcc.Incarnation) } func TestAccountEncodeWithCodeWithStorageSizeHack(t *testing.T) { @@ -109,16 +108,14 @@ func TestAccountEncodeWithCodeWithStorageSizeHack(t *testing.T) { Incarnation: 5, } - encodedLen := a.EncodingLengthForStorage() - encodedAccount := make([]byte, encodedLen) - a.EncodeForStorage(encodedAccount) + encodedAccount := SerialiseV3(&a) - var decodedAccount Account - if err := decodedAccount.DecodeForStorage(encodedAccount); err != nil { - t.Fatal("cant decode the account", err, encodedAccount) + decodedAcc := Account{} + if err := DeserialiseV3(&decodedAcc, encodedAccount); err != nil { + t.Fatal("Can't decode the incarnation", err, encodedAccount) } - isAccountsEqual(t, a, decodedAccount) + isIncarnationEqual(t, a.Incarnation, decodedAcc.Incarnation) } func TestAccountEncodeWithoutCode(t *testing.T) { @@ -132,16 +129,14 @@ func TestAccountEncodeWithoutCode(t *testing.T) { Incarnation: 5, } - encodedLen := a.EncodingLengthForStorage() - encodedAccount := make([]byte, encodedLen) - a.EncodeForStorage(encodedAccount) + encodedAccount := SerialiseV3(&a) - var decodedAccount Account - if err := decodedAccount.DecodeForStorage(encodedAccount); err != nil { - t.Fatal("cant decode the account", err, encodedAccount) + decodedAcc := Account{} + if err := DeserialiseV3(&decodedAcc, encodedAccount); err != nil { + t.Fatal("Can't decode the incarnation", err, encodedAccount) } - isAccountsEqual(t, a, decodedAccount) + isIncarnationEqual(t, a.Incarnation, decodedAcc.Incarnation) } func TestEncodeAccountWithEmptyBalanceNonNilContractAndNotZeroIncarnation(t *testing.T) { @@ -154,16 +149,14 @@ func TestEncodeAccountWithEmptyBalanceNonNilContractAndNotZeroIncarnation(t *tes CodeHash: libcommon.HexToHash("123"), Incarnation: 1, } - encodedLen := a.EncodingLengthForStorage() - encodedAccount := make([]byte, encodedLen) - a.EncodeForStorage(encodedAccount) + encodedAccount := SerialiseV3(&a) - var decodedAccount Account - if err := decodedAccount.DecodeForStorage(encodedAccount); err != nil { - t.Fatal("cant decode the account", err, encodedAccount) + decodedAcc := Account{} + if err := DeserialiseV3(&decodedAcc, encodedAccount); err != nil { + t.Fatal("Can't decode the incarnation", err, encodedAccount) } - isAccountsEqual(t, a, decodedAccount) + isIncarnationEqual(t, a.Incarnation, decodedAcc.Incarnation) } func TestEncodeAccountWithEmptyBalanceAndNotZeroIncarnation(t *testing.T) { t.Parallel() @@ -173,13 +166,11 @@ func TestEncodeAccountWithEmptyBalanceAndNotZeroIncarnation(t *testing.T) { Balance: *uint256.NewInt(0), Incarnation: 1, } - encodedLen := a.EncodingLengthForStorage() - encodedAccount := make([]byte, encodedLen) - a.EncodeForStorage(encodedAccount) + encodedAccount := SerialiseV3(&a) - var decodedAccount Account - if err := decodedAccount.DecodeForStorage(encodedAccount); err != nil { - t.Fatal("cant decode the account", err, encodedAccount) + decodedAccount := Account{} + if err := DeserialiseV3(&decodedAccount, encodedAccount); err != nil { + t.Fatal("Can't decode the incarnation", err, encodedAccount) } if a.Incarnation != decodedAccount.Incarnation { @@ -226,38 +217,28 @@ func TestIncarnationForEmptyAccount(t *testing.T) { Incarnation: 4, } - encodedAccount := make([]byte, a.EncodingLengthForStorage()) - a.EncodeForStorage(encodedAccount) + encodedAccount := SerialiseV3(&a) - if _, err := DecodeIncarnationFromStorage(encodedAccount); err != nil { + decodedAcc := Account{} + if err := DeserialiseV3(&decodedAcc, encodedAccount); err != nil { t.Fatal("Can't decode the incarnation", err, encodedAccount) } - decodedIncarnation, err := DecodeIncarnationFromStorage(encodedAccount) - if err != nil { - t.Fatal("Can't decode the incarnation", err, encodedAccount) - } - - isIncarnationEqual(t, a.Incarnation, decodedIncarnation) + isIncarnationEqual(t, a.Incarnation, decodedAcc.Incarnation) } func TestEmptyIncarnationForEmptyAccount2(t *testing.T) { t.Parallel() a := Account{} - encodedAccount := make([]byte, a.EncodingLengthForStorage()) - a.EncodeForStorage(encodedAccount) - - if _, err := DecodeIncarnationFromStorage(encodedAccount); err != nil { - t.Fatal("Can't decode the incarnation", err, encodedAccount) - } + encodedAccount := SerialiseV3(&a) - decodedIncarnation, err := DecodeIncarnationFromStorage(encodedAccount) - if err != nil { + decodedAcc := Account{} + if err := DeserialiseV3(&decodedAcc, encodedAccount); err != nil { t.Fatal("Can't decode the incarnation", err, encodedAccount) } - isIncarnationEqual(t, a.Incarnation, decodedIncarnation) + isIncarnationEqual(t, a.Incarnation, decodedAcc.Incarnation) } @@ -272,20 +253,14 @@ func TestIncarnationWithNonEmptyAccount(t *testing.T) { Incarnation: 4, } - encodedAccount := make([]byte, a.EncodingLengthForStorage()) - a.EncodeForStorage(encodedAccount) + encodedAccount := SerialiseV3(&a) - if _, err := DecodeIncarnationFromStorage(encodedAccount); err != nil { + decodedAcc := Account{} + if err := DeserialiseV3(&decodedAcc, encodedAccount); err != nil { t.Fatal("Can't decode the incarnation", err, encodedAccount) } - decodedIncarnation, err := DecodeIncarnationFromStorage(encodedAccount) - if err != nil { - t.Fatal("Can't decode the incarnation", err, encodedAccount) - } - - isIncarnationEqual(t, a.Incarnation, decodedIncarnation) - + isIncarnationEqual(t, a.Incarnation, decodedAcc.Incarnation) } func TestIncarnationWithNoIncarnation(t *testing.T) { @@ -299,19 +274,14 @@ func TestIncarnationWithNoIncarnation(t *testing.T) { Incarnation: 0, } - encodedAccount := make([]byte, a.EncodingLengthForStorage()) - a.EncodeForStorage(encodedAccount) - - if _, err := DecodeIncarnationFromStorage(encodedAccount); err != nil { - t.Fatal("Can't decode the incarnation", err, encodedAccount) - } + encodedAccount := SerialiseV3(&a) - decodedIncarnation, err := DecodeIncarnationFromStorage(encodedAccount) - if err != nil { + decodedAcc := Account{} + if err := DeserialiseV3(&decodedAcc, encodedAccount); err != nil { t.Fatal("Can't decode the incarnation", err, encodedAccount) } - isIncarnationEqual(t, a.Incarnation, decodedIncarnation) + isIncarnationEqual(t, a.Incarnation, decodedAcc.Incarnation) } diff --git a/txnprovider/txpool/pool_test.go b/txnprovider/txpool/pool_test.go index b5c659cd53f..456e2da0b4c 100644 --- a/txnprovider/txpool/pool_test.go +++ b/txnprovider/txpool/pool_test.go @@ -20,6 +20,8 @@ import ( "bytes" "context" "fmt" + "github.com/erigontech/erigon-lib/state" + accounts3 "github.com/erigontech/erigon-lib/types/accounts" "math" "math/big" "testing" @@ -43,7 +45,6 @@ import ( "github.com/erigontech/erigon-lib/kv/temporal/temporaltest" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/rlp" - types2 "github.com/erigontech/erigon-lib/types" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/core/types/typestest" "github.com/erigontech/erigon/params" @@ -76,7 +77,13 @@ func TestNonceFromAddress(t *testing.T) { } var addr [20]byte addr[0] = 1 - v := types2.EncodeAccountBytesV3(2, uint256.NewInt(1*common.Ether), make([]byte, 32), 1) + acc := accounts3.Account{ + Nonce: 2, + Balance: *uint256.NewInt(1 * common.Ether), + CodeHash: common.Hash{}, + Incarnation: 1, + } + v := accounts3.SerialiseV3(&acc) change.ChangeBatch[0].Changes = append(change.ChangeBatch[0].Changes, &remote.AccountChange{ Action: remote.Action_UPSERT, Address: gointerfaces.ConvertAddressToH160(addr), @@ -203,7 +210,13 @@ func TestMultipleAuthorizations(t *testing.T) { var addr1, addr2 [20]byte addr2[0] = 1 - v := types2.EncodeAccountBytesV3(0, uint256.NewInt(1*common.Ether), make([]byte, 32), 1) + acc := accounts3.Account{ + Nonce: 0, + Balance: *uint256.NewInt(1 * common.Ether), + CodeHash: common.Hash{}, + Incarnation: 1, + } + v := accounts3.SerialiseV3(&acc) change.ChangeBatch[0].Changes = append(change.ChangeBatch[0].Changes, &remote.AccountChange{ Action: remote.Action_UPSERT, Address: gointerfaces.ConvertAddressToH160(addr1), @@ -448,7 +461,13 @@ func TestReplaceWithHigherFee(t *testing.T) { } var addr [20]byte addr[0] = 1 - v := types2.EncodeAccountBytesV3(2, uint256.NewInt(1*common.Ether), make([]byte, 32), 1) + acc := accounts3.Account{ + Nonce: 2, + Balance: *uint256.NewInt(1 * common.Ether), + CodeHash: common.Hash{}, + Incarnation: 1, + } + v := accounts3.SerialiseV3(&acc) change.ChangeBatch[0].Changes = append(change.ChangeBatch[0].Changes, &remote.AccountChange{ Action: remote.Action_UPSERT, Address: gointerfaces.ConvertAddressToH160(addr), @@ -565,7 +584,13 @@ func TestReverseNonces(t *testing.T) { } var addr [20]byte addr[0] = 1 - v := types2.EncodeAccountBytesV3(2, uint256.NewInt(1*common.Ether), make([]byte, 32), 1) + acc := accounts3.Account{ + Nonce: 2, + Balance: *uint256.NewInt(1 * common.Ether), + CodeHash: common.Hash{}, + Incarnation: 1, + } + v := accounts3.SerialiseV3(&acc) change.ChangeBatch[0].Changes = append(change.ChangeBatch[0].Changes, &remote.AccountChange{ Action: remote.Action_UPSERT, Address: gointerfaces.ConvertAddressToH160(addr), @@ -689,7 +714,13 @@ func TestTxnPoke(t *testing.T) { } var addr [20]byte addr[0] = 1 - v := types2.EncodeAccountBytesV3(2, uint256.NewInt(1*common.Ether), make([]byte, 32), 1) + acc := accounts3.Account{ + Nonce: 2, + Balance: *uint256.NewInt(1 * common.Ether), + CodeHash: common.Hash{}, + Incarnation: 1, + } + v := accounts3.SerialiseV3(&acc) change.ChangeBatch[0].Changes = append(change.ChangeBatch[0].Changes, &remote.AccountChange{ Action: remote.Action_UPSERT, Address: gointerfaces.ConvertAddressToH160(addr), @@ -896,17 +927,22 @@ func TestShanghaiValidateTxn(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) t.Cleanup(cancel) - cache := &kvcache.DummyCache{} + tx, err := coreDB.BeginTemporalRw(ctx) + defer tx.Rollback() + asrt.NoError(err) + sd, err := state.NewSharedDomains(tx, logger) + asrt.NoError(err) + defer sd.Close() + cache := kvcache.NewDummy() pool, err := New(ctx, ch, nil, coreDB, cfg, cache, *u256.N1, shanghaiTime, nil /* agraBlock */, nil /* cancunTime */, nil, nil, nil, nil, func() {}, nil, logger, WithFeeCalculator(nil)) asrt.NoError(err) - tx, err := coreDB.BeginRw(ctx) - defer tx.Rollback() + + sndr := accounts3.Account{Nonce: 0, Balance: *uint256.NewInt(math.MaxUint64)} + sndrBytes := accounts3.SerialiseV3(&sndr) + err = sd.DomainPut(kv.AccountsDomain, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, nil, sndrBytes, nil, 0) asrt.NoError(err) - sndr := sender{nonce: 0, balance: *uint256.NewInt(math.MaxUint64)} - sndrBytes := make([]byte, EncodeSenderLengthForStorage(sndr.nonce, sndr.balance)) - EncodeSender(sndr.nonce, sndr.balance, sndrBytes) - err = tx.Put(kv.PlainState, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, sndrBytes) + err = sd.Flush(ctx, tx) asrt.NoError(err) txn := &TxnSlot{ @@ -961,7 +997,13 @@ func TestTooHighGasLimitTxnValidation(t *testing.T) { } var addr [20]byte addr[0] = 1 - v := types2.EncodeAccountBytesV3(2, uint256.NewInt(1*common.Ether), make([]byte, 32), 1) + acc := accounts3.Account{ + Nonce: 2, + Balance: *uint256.NewInt(1 * common.Ether), + CodeHash: common.Hash{}, + Incarnation: 1, + } + v := accounts3.SerialiseV3(&acc) change.ChangeBatch[0].Changes = append(change.ChangeBatch[0].Changes, &remote.AccountChange{ Action: remote.Action_UPSERT, Address: gointerfaces.ConvertAddressToH160(addr), @@ -1001,7 +1043,7 @@ func TestSetCodeTxnValidationWithLargeAuthorizationValues(t *testing.T) { coreDB, _ := temporaltest.NewTestDB(t, datadir.New(t.TempDir())) cfg := txpoolcfg.DefaultConfig chainID := *maxUint256 - cache := &kvcache.DummyCache{} + cache := kvcache.NewDummy() logger := log.New() pool, err := New(ctx, ch, nil, coreDB, cfg, cache, chainID, common.Big0 /* shanghaiTime */, nil, /* agraBlock */ common.Big0 /* cancunTime */, common.Big0 /* pragueTime */, nil, nil, nil, func() {}, nil, logger, WithFeeCalculator(nil)) @@ -1010,11 +1052,16 @@ func TestSetCodeTxnValidationWithLargeAuthorizationValues(t *testing.T) { tx, err := coreDB.BeginRw(ctx) defer tx.Rollback() assert.NoError(t, err) + sd, err := state.NewSharedDomains(tx, logger) + assert.NoError(t, err) + defer sd.Close() + + sndr := accounts3.Account{Nonce: 0, Balance: *uint256.NewInt(math.MaxUint64)} + sndrBytes := accounts3.SerialiseV3(&sndr) + err = sd.DomainPut(kv.AccountsDomain, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, nil, sndrBytes, nil, 0) + assert.NoError(t, err) - sndr := sender{nonce: 0, balance: *uint256.NewInt(math.MaxUint64)} - sndrBytes := make([]byte, EncodeSenderLengthForStorage(sndr.nonce, sndr.balance)) - EncodeSender(sndr.nonce, sndr.balance, sndrBytes) - err = tx.Put(kv.PlainState, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, sndrBytes) + err = sd.Flush(ctx, tx) assert.NoError(t, err) txn := &TxnSlot{ @@ -1072,7 +1119,13 @@ func TestBlobTxnReplacement(t *testing.T) { addr[0] = 1 // Add 1 eth to the user account, as a part of change - v := types2.EncodeAccountBytesV3(2, uint256.NewInt(1*common.Ether), make([]byte, 32), 1) + acc := accounts3.Account{ + Nonce: 2, + Balance: *uint256.NewInt(1 * common.Ether), + CodeHash: common.Hash{}, + Incarnation: 1, + } + v := accounts3.SerialiseV3(&acc) change.ChangeBatch[0].Changes = append(change.ChangeBatch[0].Changes, &remote.AccountChange{ Action: remote.Action_UPSERT, @@ -1251,7 +1304,13 @@ func TestDropRemoteAtNoGossip(t *testing.T) { } var addr [20]byte addr[0] = 1 - v := types2.EncodeAccountBytesV3(2, uint256.NewInt(1*common.Ether), make([]byte, 32), 1) + acc := accounts3.Account{ + Nonce: 2, + Balance: *uint256.NewInt(1 * common.Ether), + CodeHash: common.Hash{}, + Incarnation: 1, + } + v := accounts3.SerialiseV3(&acc) change.ChangeBatch[0].Changes = append(change.ChangeBatch[0].Changes, &remote.AccountChange{ Action: remote.Action_UPSERT, Address: gointerfaces.ConvertAddressToH160(addr), @@ -1353,7 +1412,13 @@ func TestBlobSlots(t *testing.T) { var addr [20]byte // Add 1 eth to the user account, as a part of change - v := types2.EncodeAccountBytesV3(0, uint256.NewInt(1*common.Ether), make([]byte, 32), 1) + acc := accounts3.Account{ + Nonce: 0, + Balance: *uint256.NewInt(1 * common.Ether), + CodeHash: common.Hash{}, + Incarnation: 1, + } + v := accounts3.SerialiseV3(&acc) for i := 0; i < 11; i++ { addr[0] = uint8(i + 1) @@ -1418,7 +1483,13 @@ func TestGasLimitChanged(t *testing.T) { h1 := gointerfaces.ConvertHashToH256([32]byte{}) var addr [20]byte addr[0] = 1 - v := types2.EncodeAccountBytesV3(0, uint256.NewInt(1*common.Ether), make([]byte, 32), 1) + acc := accounts3.Account{ + Nonce: 0, + Balance: *uint256.NewInt(1 * common.Ether), + CodeHash: common.Hash{}, + Incarnation: 1, + } + v := accounts3.SerialiseV3(&acc) tx, err := db.BeginRw(ctx) require.NoError(err) defer tx.Rollback() diff --git a/txnprovider/txpool/senders.go b/txnprovider/txpool/senders.go index 4b0ad0a4170..f81beacf5f5 100644 --- a/txnprovider/txpool/senders.go +++ b/txnprovider/txpool/senders.go @@ -18,6 +18,7 @@ package txpool import ( "fmt" + "github.com/erigontech/erigon-lib/types/accounts" "math" "math/bits" @@ -29,7 +30,6 @@ import ( remote "github.com/erigontech/erigon-lib/gointerfaces/remoteproto" "github.com/erigontech/erigon-lib/kv/kvcache" "github.com/erigontech/erigon-lib/log/v3" - types2 "github.com/erigontech/erigon-lib/types" "github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg" ) @@ -222,7 +222,7 @@ func (sc *sendersBatch) getOrCreateID(addr common.Address, logger log.Logger) (u return id, traced } -func (sc *sendersBatch) info(cacheView kvcache.CacheView, id uint64) (nonce uint64, balance uint256.Int, err error) { +func (sc *sendersBatch) info(cacheView kvcache.CacheView, id uint64) (uint64, uint256.Int, error) { addr, ok := sc.senderID2Addr[id] if !ok { panic("must not happen") @@ -234,17 +234,12 @@ func (sc *sendersBatch) info(cacheView kvcache.CacheView, id uint64) (nonce uint if len(encoded) == 0 { return 0, uint256.Int{}, nil } - if cacheView.StateV3() { - var bp *uint256.Int - nonce, bp, _ = types2.DecodeAccountBytesV3(encoded) - balance = *bp - } else { - nonce, balance, err = DecodeSender(encoded) - } + acc := accounts.Account{} + err = accounts.DeserialiseV3(&acc, encoded) if err != nil { return 0, uint256.Int{}, err } - return nonce, balance, nil + return acc.Nonce, acc.Balance, nil } func (sc *sendersBatch) registerNewSenders(newTxns *TxnSlots, logger log.Logger) (err error) { @@ -311,39 +306,3 @@ func EncodeSender(nonce uint64, balance uint256.Int, buffer []byte) { buffer[0] = byte(fieldSet) } - -// Decode the sender's balance and nonce from encoded byte-slice -func DecodeSender(enc []byte) (nonce uint64, balance uint256.Int, err error) { - if len(enc) == 0 { - return - } - - var fieldSet = enc[0] - var pos = 1 - - if fieldSet&1 > 0 { - decodeLength := int(enc[pos]) - - if len(enc) < pos+decodeLength+1 { - return nonce, balance, fmt.Errorf( - "malformed CBOR for Account.Nonce: %s, Length %d", - enc[pos+1:], decodeLength) - } - - nonce = common.BytesToUint64(enc[pos+1 : pos+decodeLength+1]) - pos += decodeLength + 1 - } - - if fieldSet&2 > 0 { - decodeLength := int(enc[pos]) - - if len(enc) < pos+decodeLength+1 { - return nonce, balance, fmt.Errorf( - "malformed CBOR for Account.Nonce: %s, Length %d", - enc[pos+1:], decodeLength) - } - - (&balance).SetBytes(enc[pos+1 : pos+decodeLength+1]) - } - return -} From f2efd04ce8bd8e24a8420f16da789e5ad9b4bcb3 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Sat, 1 Feb 2025 17:55:40 +0700 Subject: [PATCH 13/16] TxLookup stage: allow TxNum=0 (#13654) it's valid txnum of genesis block --- eth/stagedsync/stage_txlookup.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/eth/stagedsync/stage_txlookup.go b/eth/stagedsync/stage_txlookup.go index a198ffff997..51102bd220a 100644 --- a/eth/stagedsync/stage_txlookup.go +++ b/eth/stagedsync/stage_txlookup.go @@ -152,11 +152,6 @@ func txnLookupTransform(logPrefix string, tx kv.RwTx, blockFrom, blockTo uint64, return err } - if firstTxNumInBlock == 0 { - log.Warn(fmt.Sprintf("[%s] transform: empty txnum %d, hash %x", logPrefix, firstTxNumInBlock, v)) - return nil - } - binary.BigEndian.PutUint64(data[:8], blocknum) for i, txn := range body.Transactions { From c5fbca37ba70c04c070019e451c60b67c1cecf63 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Mon, 3 Feb 2025 12:40:20 +0700 Subject: [PATCH 14/16] grpc version up (#13535) --- .../mock_services/synced_data_mock.go | 57 +- .../aggregate_and_proof_service_mock.go | 9 +- .../mock_services/attestation_service_mock.go | 9 +- .../blob_sidecars_service_mock.go | 9 +- .../mock_services/block_service_mock.go | 9 +- .../bls_to_execution_change_service_mock.go | 9 +- .../proposer_slashing_service_mock.go | 9 +- .../sync_committee_messages_service_mock.go | 9 +- .../sync_contribution_service_mock.go | 9 +- .../voluntary_exit_service_mock.go | 9 +- erigon-lib/Makefile | 2 +- erigon-lib/direct/sentry_client_mock.go | 20 +- erigon-lib/go.mod | 27 +- erigon-lib/go.sum | 58 +- .../downloaderproto/downloader.pb.go | 291 ++--- .../downloaderproto/downloader_client_mock.go | 10 +- .../downloaderproto/downloader_grpc.pb.go | 71 +- .../executionproto/execution.pb.go | 854 ++++---------- .../executionproto/execution_grpc.pb.go | 27 +- erigon-lib/gointerfaces/remoteproto/bor.pb.go | 227 +--- .../gointerfaces/remoteproto/bor_grpc.pb.go | 46 +- .../gointerfaces/remoteproto/ethbackend.pb.go | 1013 ++++------------- .../remoteproto/ethbackend_grpc.pb.go | 129 +-- erigon-lib/gointerfaces/remoteproto/kv.pb.go | 724 ++++-------- .../remoteproto/kv_client_mock.go | 20 +- .../gointerfaces/remoteproto/kv_grpc.pb.go | 129 +-- .../kv_state_changes_client_mock.go | 128 +-- .../gointerfaces/sentinelproto/sentinel.pb.go | 440 ++----- .../sentinelproto/sentinel_grpc.pb.go | 71 +- .../gointerfaces/sentryproto/sentry.pb.go | 702 +++--------- .../sentryproto/sentry_client_mock.go | 20 +- .../sentryproto/sentry_grpc.pb.go | 115 +- .../sentryproto/sentry_server_mock.go | 13 +- .../gointerfaces/txpoolproto/mining.pb.go | 466 ++------ .../txpoolproto/mining_grpc.pb.go | 159 +-- .../gointerfaces/txpoolproto/txpool.pb.go | 477 ++------ .../txpoolproto/txpool_grpc.pb.go | 71 +- .../gointerfaces/typesproto/types.pb.go | 539 +++------ go.mod | 19 +- go.sum | 42 +- polygon/p2p/peer_event_registrar_mock.go | 1 + txnprovider/txpool/fetch_test.go | 2 +- 42 files changed, 2079 insertions(+), 4972 deletions(-) diff --git a/cl/beacon/synced_data/mock_services/synced_data_mock.go b/cl/beacon/synced_data/mock_services/synced_data_mock.go index 6eebd97dbf0..e67b2acffdf 100644 --- a/cl/beacon/synced_data/mock_services/synced_data_mock.go +++ b/cl/beacon/synced_data/mock_services/synced_data_mock.go @@ -23,6 +23,7 @@ import ( type MockSyncedData struct { ctrl *gomock.Controller recorder *MockSyncedDataMockRecorder + isgomock struct{} } // MockSyncedDataMockRecorder is the mock recorder for MockSyncedData. @@ -43,17 +44,17 @@ func (m *MockSyncedData) EXPECT() *MockSyncedDataMockRecorder { } // CommitteeCount mocks base method. -func (m *MockSyncedData) CommitteeCount(arg0 uint64) uint64 { +func (m *MockSyncedData) CommitteeCount(epoch uint64) uint64 { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CommitteeCount", arg0) + ret := m.ctrl.Call(m, "CommitteeCount", epoch) ret0, _ := ret[0].(uint64) return ret0 } // CommitteeCount indicates an expected call of CommitteeCount. -func (mr *MockSyncedDataMockRecorder) CommitteeCount(arg0 any) *MockSyncedDataCommitteeCountCall { +func (mr *MockSyncedDataMockRecorder) CommitteeCount(epoch any) *MockSyncedDataCommitteeCountCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitteeCount", reflect.TypeOf((*MockSyncedData)(nil).CommitteeCount), arg0) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitteeCount", reflect.TypeOf((*MockSyncedData)(nil).CommitteeCount), epoch) return &MockSyncedDataCommitteeCountCall{Call: call} } @@ -157,18 +158,18 @@ func (c *MockSyncedDataHeadSlotCall) DoAndReturn(f func() uint64) *MockSyncedDat } // HistoricalRootElementAtIndex mocks base method. -func (m *MockSyncedData) HistoricalRootElementAtIndex(arg0 int) (common.Hash, error) { +func (m *MockSyncedData) HistoricalRootElementAtIndex(index int) (common.Hash, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HistoricalRootElementAtIndex", arg0) + ret := m.ctrl.Call(m, "HistoricalRootElementAtIndex", index) ret0, _ := ret[0].(common.Hash) ret1, _ := ret[1].(error) return ret0, ret1 } // HistoricalRootElementAtIndex indicates an expected call of HistoricalRootElementAtIndex. -func (mr *MockSyncedDataMockRecorder) HistoricalRootElementAtIndex(arg0 any) *MockSyncedDataHistoricalRootElementAtIndexCall { +func (mr *MockSyncedDataMockRecorder) HistoricalRootElementAtIndex(index any) *MockSyncedDataHistoricalRootElementAtIndexCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HistoricalRootElementAtIndex", reflect.TypeOf((*MockSyncedData)(nil).HistoricalRootElementAtIndex), arg0) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HistoricalRootElementAtIndex", reflect.TypeOf((*MockSyncedData)(nil).HistoricalRootElementAtIndex), index) return &MockSyncedDataHistoricalRootElementAtIndexCall{Call: call} } @@ -196,18 +197,18 @@ func (c *MockSyncedDataHistoricalRootElementAtIndexCall) DoAndReturn(f func(int) } // HistoricalSummaryElementAtIndex mocks base method. -func (m *MockSyncedData) HistoricalSummaryElementAtIndex(arg0 int) (*cltypes.HistoricalSummary, error) { +func (m *MockSyncedData) HistoricalSummaryElementAtIndex(index int) (*cltypes.HistoricalSummary, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HistoricalSummaryElementAtIndex", arg0) + ret := m.ctrl.Call(m, "HistoricalSummaryElementAtIndex", index) ret0, _ := ret[0].(*cltypes.HistoricalSummary) ret1, _ := ret[1].(error) return ret0, ret1 } // HistoricalSummaryElementAtIndex indicates an expected call of HistoricalSummaryElementAtIndex. -func (mr *MockSyncedDataMockRecorder) HistoricalSummaryElementAtIndex(arg0 any) *MockSyncedDataHistoricalSummaryElementAtIndexCall { +func (mr *MockSyncedDataMockRecorder) HistoricalSummaryElementAtIndex(index any) *MockSyncedDataHistoricalSummaryElementAtIndexCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HistoricalSummaryElementAtIndex", reflect.TypeOf((*MockSyncedData)(nil).HistoricalSummaryElementAtIndex), arg0) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HistoricalSummaryElementAtIndex", reflect.TypeOf((*MockSyncedData)(nil).HistoricalSummaryElementAtIndex), index) return &MockSyncedDataHistoricalSummaryElementAtIndexCall{Call: call} } @@ -235,17 +236,17 @@ func (c *MockSyncedDataHistoricalSummaryElementAtIndexCall) DoAndReturn(f func(i } // OnHeadState mocks base method. -func (m *MockSyncedData) OnHeadState(arg0 *state.CachingBeaconState) error { +func (m *MockSyncedData) OnHeadState(newState *state.CachingBeaconState) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "OnHeadState", arg0) + ret := m.ctrl.Call(m, "OnHeadState", newState) ret0, _ := ret[0].(error) return ret0 } // OnHeadState indicates an expected call of OnHeadState. -func (mr *MockSyncedDataMockRecorder) OnHeadState(arg0 any) *MockSyncedDataOnHeadStateCall { +func (mr *MockSyncedDataMockRecorder) OnHeadState(newState any) *MockSyncedDataOnHeadStateCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnHeadState", reflect.TypeOf((*MockSyncedData)(nil).OnHeadState), arg0) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnHeadState", reflect.TypeOf((*MockSyncedData)(nil).OnHeadState), newState) return &MockSyncedDataOnHeadStateCall{Call: call} } @@ -347,9 +348,9 @@ func (c *MockSyncedDataUnsetHeadStateCall) DoAndReturn(f func()) *MockSyncedData } // ValidatorIndexByPublicKey mocks base method. -func (m *MockSyncedData) ValidatorIndexByPublicKey(arg0 common.Bytes48) (uint64, bool, error) { +func (m *MockSyncedData) ValidatorIndexByPublicKey(pubkey common.Bytes48) (uint64, bool, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ValidatorIndexByPublicKey", arg0) + ret := m.ctrl.Call(m, "ValidatorIndexByPublicKey", pubkey) ret0, _ := ret[0].(uint64) ret1, _ := ret[1].(bool) ret2, _ := ret[2].(error) @@ -357,9 +358,9 @@ func (m *MockSyncedData) ValidatorIndexByPublicKey(arg0 common.Bytes48) (uint64, } // ValidatorIndexByPublicKey indicates an expected call of ValidatorIndexByPublicKey. -func (mr *MockSyncedDataMockRecorder) ValidatorIndexByPublicKey(arg0 any) *MockSyncedDataValidatorIndexByPublicKeyCall { +func (mr *MockSyncedDataMockRecorder) ValidatorIndexByPublicKey(pubkey any) *MockSyncedDataValidatorIndexByPublicKeyCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorIndexByPublicKey", reflect.TypeOf((*MockSyncedData)(nil).ValidatorIndexByPublicKey), arg0) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorIndexByPublicKey", reflect.TypeOf((*MockSyncedData)(nil).ValidatorIndexByPublicKey), pubkey) return &MockSyncedDataValidatorIndexByPublicKeyCall{Call: call} } @@ -387,18 +388,18 @@ func (c *MockSyncedDataValidatorIndexByPublicKeyCall) DoAndReturn(f func(common. } // ValidatorPublicKeyByIndex mocks base method. -func (m *MockSyncedData) ValidatorPublicKeyByIndex(arg0 int) (common.Bytes48, error) { +func (m *MockSyncedData) ValidatorPublicKeyByIndex(index int) (common.Bytes48, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ValidatorPublicKeyByIndex", arg0) + ret := m.ctrl.Call(m, "ValidatorPublicKeyByIndex", index) ret0, _ := ret[0].(common.Bytes48) ret1, _ := ret[1].(error) return ret0, ret1 } // ValidatorPublicKeyByIndex indicates an expected call of ValidatorPublicKeyByIndex. -func (mr *MockSyncedDataMockRecorder) ValidatorPublicKeyByIndex(arg0 any) *MockSyncedDataValidatorPublicKeyByIndexCall { +func (mr *MockSyncedDataMockRecorder) ValidatorPublicKeyByIndex(index any) *MockSyncedDataValidatorPublicKeyByIndexCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorPublicKeyByIndex", reflect.TypeOf((*MockSyncedData)(nil).ValidatorPublicKeyByIndex), arg0) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorPublicKeyByIndex", reflect.TypeOf((*MockSyncedData)(nil).ValidatorPublicKeyByIndex), index) return &MockSyncedDataValidatorPublicKeyByIndexCall{Call: call} } @@ -426,17 +427,17 @@ func (c *MockSyncedDataValidatorPublicKeyByIndexCall) DoAndReturn(f func(int) (c } // ViewHeadState mocks base method. -func (m *MockSyncedData) ViewHeadState(arg0 synced_data.ViewHeadStateFn) error { +func (m *MockSyncedData) ViewHeadState(fn synced_data.ViewHeadStateFn) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ViewHeadState", arg0) + ret := m.ctrl.Call(m, "ViewHeadState", fn) ret0, _ := ret[0].(error) return ret0 } // ViewHeadState indicates an expected call of ViewHeadState. -func (mr *MockSyncedDataMockRecorder) ViewHeadState(arg0 any) *MockSyncedDataViewHeadStateCall { +func (mr *MockSyncedDataMockRecorder) ViewHeadState(fn any) *MockSyncedDataViewHeadStateCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ViewHeadState", reflect.TypeOf((*MockSyncedData)(nil).ViewHeadState), arg0) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ViewHeadState", reflect.TypeOf((*MockSyncedData)(nil).ViewHeadState), fn) return &MockSyncedDataViewHeadStateCall{Call: call} } diff --git a/cl/phase1/network/services/mock_services/aggregate_and_proof_service_mock.go b/cl/phase1/network/services/mock_services/aggregate_and_proof_service_mock.go index 7eb06d711f5..2f06689b9ee 100644 --- a/cl/phase1/network/services/mock_services/aggregate_and_proof_service_mock.go +++ b/cl/phase1/network/services/mock_services/aggregate_and_proof_service_mock.go @@ -21,6 +21,7 @@ import ( type MockAggregateAndProofService struct { ctrl *gomock.Controller recorder *MockAggregateAndProofServiceMockRecorder + isgomock struct{} } // MockAggregateAndProofServiceMockRecorder is the mock recorder for MockAggregateAndProofService. @@ -41,17 +42,17 @@ func (m *MockAggregateAndProofService) EXPECT() *MockAggregateAndProofServiceMoc } // ProcessMessage mocks base method. -func (m *MockAggregateAndProofService) ProcessMessage(arg0 context.Context, arg1 *uint64, arg2 *services.SignedAggregateAndProofForGossip) error { +func (m *MockAggregateAndProofService) ProcessMessage(ctx context.Context, subnet *uint64, msg *services.SignedAggregateAndProofForGossip) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProcessMessage", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ProcessMessage", ctx, subnet, msg) ret0, _ := ret[0].(error) return ret0 } // ProcessMessage indicates an expected call of ProcessMessage. -func (mr *MockAggregateAndProofServiceMockRecorder) ProcessMessage(arg0, arg1, arg2 any) *MockAggregateAndProofServiceProcessMessageCall { +func (mr *MockAggregateAndProofServiceMockRecorder) ProcessMessage(ctx, subnet, msg any) *MockAggregateAndProofServiceProcessMessageCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockAggregateAndProofService)(nil).ProcessMessage), arg0, arg1, arg2) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockAggregateAndProofService)(nil).ProcessMessage), ctx, subnet, msg) return &MockAggregateAndProofServiceProcessMessageCall{Call: call} } diff --git a/cl/phase1/network/services/mock_services/attestation_service_mock.go b/cl/phase1/network/services/mock_services/attestation_service_mock.go index 87b15ca5232..f5593a2b204 100644 --- a/cl/phase1/network/services/mock_services/attestation_service_mock.go +++ b/cl/phase1/network/services/mock_services/attestation_service_mock.go @@ -21,6 +21,7 @@ import ( type MockAttestationService struct { ctrl *gomock.Controller recorder *MockAttestationServiceMockRecorder + isgomock struct{} } // MockAttestationServiceMockRecorder is the mock recorder for MockAttestationService. @@ -41,17 +42,17 @@ func (m *MockAttestationService) EXPECT() *MockAttestationServiceMockRecorder { } // ProcessMessage mocks base method. -func (m *MockAttestationService) ProcessMessage(arg0 context.Context, arg1 *uint64, arg2 *services.AttestationForGossip) error { +func (m *MockAttestationService) ProcessMessage(ctx context.Context, subnet *uint64, msg *services.AttestationForGossip) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProcessMessage", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ProcessMessage", ctx, subnet, msg) ret0, _ := ret[0].(error) return ret0 } // ProcessMessage indicates an expected call of ProcessMessage. -func (mr *MockAttestationServiceMockRecorder) ProcessMessage(arg0, arg1, arg2 any) *MockAttestationServiceProcessMessageCall { +func (mr *MockAttestationServiceMockRecorder) ProcessMessage(ctx, subnet, msg any) *MockAttestationServiceProcessMessageCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockAttestationService)(nil).ProcessMessage), arg0, arg1, arg2) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockAttestationService)(nil).ProcessMessage), ctx, subnet, msg) return &MockAttestationServiceProcessMessageCall{Call: call} } diff --git a/cl/phase1/network/services/mock_services/blob_sidecars_service_mock.go b/cl/phase1/network/services/mock_services/blob_sidecars_service_mock.go index ee82d59319a..1445222c060 100644 --- a/cl/phase1/network/services/mock_services/blob_sidecars_service_mock.go +++ b/cl/phase1/network/services/mock_services/blob_sidecars_service_mock.go @@ -21,6 +21,7 @@ import ( type MockBlobSidecarsService struct { ctrl *gomock.Controller recorder *MockBlobSidecarsServiceMockRecorder + isgomock struct{} } // MockBlobSidecarsServiceMockRecorder is the mock recorder for MockBlobSidecarsService. @@ -41,17 +42,17 @@ func (m *MockBlobSidecarsService) EXPECT() *MockBlobSidecarsServiceMockRecorder } // ProcessMessage mocks base method. -func (m *MockBlobSidecarsService) ProcessMessage(arg0 context.Context, arg1 *uint64, arg2 *cltypes.BlobSidecar) error { +func (m *MockBlobSidecarsService) ProcessMessage(ctx context.Context, subnet *uint64, msg *cltypes.BlobSidecar) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProcessMessage", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ProcessMessage", ctx, subnet, msg) ret0, _ := ret[0].(error) return ret0 } // ProcessMessage indicates an expected call of ProcessMessage. -func (mr *MockBlobSidecarsServiceMockRecorder) ProcessMessage(arg0, arg1, arg2 any) *MockBlobSidecarsServiceProcessMessageCall { +func (mr *MockBlobSidecarsServiceMockRecorder) ProcessMessage(ctx, subnet, msg any) *MockBlobSidecarsServiceProcessMessageCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockBlobSidecarsService)(nil).ProcessMessage), arg0, arg1, arg2) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockBlobSidecarsService)(nil).ProcessMessage), ctx, subnet, msg) return &MockBlobSidecarsServiceProcessMessageCall{Call: call} } diff --git a/cl/phase1/network/services/mock_services/block_service_mock.go b/cl/phase1/network/services/mock_services/block_service_mock.go index 056061874a9..52ae2370c10 100644 --- a/cl/phase1/network/services/mock_services/block_service_mock.go +++ b/cl/phase1/network/services/mock_services/block_service_mock.go @@ -21,6 +21,7 @@ import ( type MockBlockService struct { ctrl *gomock.Controller recorder *MockBlockServiceMockRecorder + isgomock struct{} } // MockBlockServiceMockRecorder is the mock recorder for MockBlockService. @@ -41,17 +42,17 @@ func (m *MockBlockService) EXPECT() *MockBlockServiceMockRecorder { } // ProcessMessage mocks base method. -func (m *MockBlockService) ProcessMessage(arg0 context.Context, arg1 *uint64, arg2 *cltypes.SignedBeaconBlock) error { +func (m *MockBlockService) ProcessMessage(ctx context.Context, subnet *uint64, msg *cltypes.SignedBeaconBlock) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProcessMessage", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ProcessMessage", ctx, subnet, msg) ret0, _ := ret[0].(error) return ret0 } // ProcessMessage indicates an expected call of ProcessMessage. -func (mr *MockBlockServiceMockRecorder) ProcessMessage(arg0, arg1, arg2 any) *MockBlockServiceProcessMessageCall { +func (mr *MockBlockServiceMockRecorder) ProcessMessage(ctx, subnet, msg any) *MockBlockServiceProcessMessageCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockBlockService)(nil).ProcessMessage), arg0, arg1, arg2) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockBlockService)(nil).ProcessMessage), ctx, subnet, msg) return &MockBlockServiceProcessMessageCall{Call: call} } diff --git a/cl/phase1/network/services/mock_services/bls_to_execution_change_service_mock.go b/cl/phase1/network/services/mock_services/bls_to_execution_change_service_mock.go index e8f396b0878..2a45088bc6f 100644 --- a/cl/phase1/network/services/mock_services/bls_to_execution_change_service_mock.go +++ b/cl/phase1/network/services/mock_services/bls_to_execution_change_service_mock.go @@ -21,6 +21,7 @@ import ( type MockBLSToExecutionChangeService struct { ctrl *gomock.Controller recorder *MockBLSToExecutionChangeServiceMockRecorder + isgomock struct{} } // MockBLSToExecutionChangeServiceMockRecorder is the mock recorder for MockBLSToExecutionChangeService. @@ -41,17 +42,17 @@ func (m *MockBLSToExecutionChangeService) EXPECT() *MockBLSToExecutionChangeServ } // ProcessMessage mocks base method. -func (m *MockBLSToExecutionChangeService) ProcessMessage(arg0 context.Context, arg1 *uint64, arg2 *services.SignedBLSToExecutionChangeForGossip) error { +func (m *MockBLSToExecutionChangeService) ProcessMessage(ctx context.Context, subnet *uint64, msg *services.SignedBLSToExecutionChangeForGossip) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProcessMessage", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ProcessMessage", ctx, subnet, msg) ret0, _ := ret[0].(error) return ret0 } // ProcessMessage indicates an expected call of ProcessMessage. -func (mr *MockBLSToExecutionChangeServiceMockRecorder) ProcessMessage(arg0, arg1, arg2 any) *MockBLSToExecutionChangeServiceProcessMessageCall { +func (mr *MockBLSToExecutionChangeServiceMockRecorder) ProcessMessage(ctx, subnet, msg any) *MockBLSToExecutionChangeServiceProcessMessageCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockBLSToExecutionChangeService)(nil).ProcessMessage), arg0, arg1, arg2) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockBLSToExecutionChangeService)(nil).ProcessMessage), ctx, subnet, msg) return &MockBLSToExecutionChangeServiceProcessMessageCall{Call: call} } diff --git a/cl/phase1/network/services/mock_services/proposer_slashing_service_mock.go b/cl/phase1/network/services/mock_services/proposer_slashing_service_mock.go index ee9c87ab65b..9be17ca5202 100644 --- a/cl/phase1/network/services/mock_services/proposer_slashing_service_mock.go +++ b/cl/phase1/network/services/mock_services/proposer_slashing_service_mock.go @@ -21,6 +21,7 @@ import ( type MockProposerSlashingService struct { ctrl *gomock.Controller recorder *MockProposerSlashingServiceMockRecorder + isgomock struct{} } // MockProposerSlashingServiceMockRecorder is the mock recorder for MockProposerSlashingService. @@ -41,17 +42,17 @@ func (m *MockProposerSlashingService) EXPECT() *MockProposerSlashingServiceMockR } // ProcessMessage mocks base method. -func (m *MockProposerSlashingService) ProcessMessage(arg0 context.Context, arg1 *uint64, arg2 *cltypes.ProposerSlashing) error { +func (m *MockProposerSlashingService) ProcessMessage(ctx context.Context, subnet *uint64, msg *cltypes.ProposerSlashing) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProcessMessage", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ProcessMessage", ctx, subnet, msg) ret0, _ := ret[0].(error) return ret0 } // ProcessMessage indicates an expected call of ProcessMessage. -func (mr *MockProposerSlashingServiceMockRecorder) ProcessMessage(arg0, arg1, arg2 any) *MockProposerSlashingServiceProcessMessageCall { +func (mr *MockProposerSlashingServiceMockRecorder) ProcessMessage(ctx, subnet, msg any) *MockProposerSlashingServiceProcessMessageCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockProposerSlashingService)(nil).ProcessMessage), arg0, arg1, arg2) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockProposerSlashingService)(nil).ProcessMessage), ctx, subnet, msg) return &MockProposerSlashingServiceProcessMessageCall{Call: call} } diff --git a/cl/phase1/network/services/mock_services/sync_committee_messages_service_mock.go b/cl/phase1/network/services/mock_services/sync_committee_messages_service_mock.go index c2bb9a141a8..bb43a41659e 100644 --- a/cl/phase1/network/services/mock_services/sync_committee_messages_service_mock.go +++ b/cl/phase1/network/services/mock_services/sync_committee_messages_service_mock.go @@ -21,6 +21,7 @@ import ( type MockSyncCommitteeMessagesService struct { ctrl *gomock.Controller recorder *MockSyncCommitteeMessagesServiceMockRecorder + isgomock struct{} } // MockSyncCommitteeMessagesServiceMockRecorder is the mock recorder for MockSyncCommitteeMessagesService. @@ -41,17 +42,17 @@ func (m *MockSyncCommitteeMessagesService) EXPECT() *MockSyncCommitteeMessagesSe } // ProcessMessage mocks base method. -func (m *MockSyncCommitteeMessagesService) ProcessMessage(arg0 context.Context, arg1 *uint64, arg2 *services.SyncCommitteeMessageForGossip) error { +func (m *MockSyncCommitteeMessagesService) ProcessMessage(ctx context.Context, subnet *uint64, msg *services.SyncCommitteeMessageForGossip) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProcessMessage", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ProcessMessage", ctx, subnet, msg) ret0, _ := ret[0].(error) return ret0 } // ProcessMessage indicates an expected call of ProcessMessage. -func (mr *MockSyncCommitteeMessagesServiceMockRecorder) ProcessMessage(arg0, arg1, arg2 any) *MockSyncCommitteeMessagesServiceProcessMessageCall { +func (mr *MockSyncCommitteeMessagesServiceMockRecorder) ProcessMessage(ctx, subnet, msg any) *MockSyncCommitteeMessagesServiceProcessMessageCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockSyncCommitteeMessagesService)(nil).ProcessMessage), arg0, arg1, arg2) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockSyncCommitteeMessagesService)(nil).ProcessMessage), ctx, subnet, msg) return &MockSyncCommitteeMessagesServiceProcessMessageCall{Call: call} } diff --git a/cl/phase1/network/services/mock_services/sync_contribution_service_mock.go b/cl/phase1/network/services/mock_services/sync_contribution_service_mock.go index a33930a9bb0..de22653c605 100644 --- a/cl/phase1/network/services/mock_services/sync_contribution_service_mock.go +++ b/cl/phase1/network/services/mock_services/sync_contribution_service_mock.go @@ -21,6 +21,7 @@ import ( type MockSyncContributionService struct { ctrl *gomock.Controller recorder *MockSyncContributionServiceMockRecorder + isgomock struct{} } // MockSyncContributionServiceMockRecorder is the mock recorder for MockSyncContributionService. @@ -41,17 +42,17 @@ func (m *MockSyncContributionService) EXPECT() *MockSyncContributionServiceMockR } // ProcessMessage mocks base method. -func (m *MockSyncContributionService) ProcessMessage(arg0 context.Context, arg1 *uint64, arg2 *services.SignedContributionAndProofForGossip) error { +func (m *MockSyncContributionService) ProcessMessage(ctx context.Context, subnet *uint64, msg *services.SignedContributionAndProofForGossip) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProcessMessage", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ProcessMessage", ctx, subnet, msg) ret0, _ := ret[0].(error) return ret0 } // ProcessMessage indicates an expected call of ProcessMessage. -func (mr *MockSyncContributionServiceMockRecorder) ProcessMessage(arg0, arg1, arg2 any) *MockSyncContributionServiceProcessMessageCall { +func (mr *MockSyncContributionServiceMockRecorder) ProcessMessage(ctx, subnet, msg any) *MockSyncContributionServiceProcessMessageCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockSyncContributionService)(nil).ProcessMessage), arg0, arg1, arg2) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockSyncContributionService)(nil).ProcessMessage), ctx, subnet, msg) return &MockSyncContributionServiceProcessMessageCall{Call: call} } diff --git a/cl/phase1/network/services/mock_services/voluntary_exit_service_mock.go b/cl/phase1/network/services/mock_services/voluntary_exit_service_mock.go index 5d8bc87194e..4f325d0a1f3 100644 --- a/cl/phase1/network/services/mock_services/voluntary_exit_service_mock.go +++ b/cl/phase1/network/services/mock_services/voluntary_exit_service_mock.go @@ -21,6 +21,7 @@ import ( type MockVoluntaryExitService struct { ctrl *gomock.Controller recorder *MockVoluntaryExitServiceMockRecorder + isgomock struct{} } // MockVoluntaryExitServiceMockRecorder is the mock recorder for MockVoluntaryExitService. @@ -41,17 +42,17 @@ func (m *MockVoluntaryExitService) EXPECT() *MockVoluntaryExitServiceMockRecorde } // ProcessMessage mocks base method. -func (m *MockVoluntaryExitService) ProcessMessage(arg0 context.Context, arg1 *uint64, arg2 *services.SignedVoluntaryExitForGossip) error { +func (m *MockVoluntaryExitService) ProcessMessage(ctx context.Context, subnet *uint64, msg *services.SignedVoluntaryExitForGossip) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProcessMessage", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ProcessMessage", ctx, subnet, msg) ret0, _ := ret[0].(error) return ret0 } // ProcessMessage indicates an expected call of ProcessMessage. -func (mr *MockVoluntaryExitServiceMockRecorder) ProcessMessage(arg0, arg1, arg2 any) *MockVoluntaryExitServiceProcessMessageCall { +func (mr *MockVoluntaryExitServiceMockRecorder) ProcessMessage(ctx, subnet, msg any) *MockVoluntaryExitServiceProcessMessageCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockVoluntaryExitService)(nil).ProcessMessage), arg0, arg1, arg2) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockVoluntaryExitService)(nil).ProcessMessage), ctx, subnet, msg) return &MockVoluntaryExitServiceProcessMessageCall{Call: call} } diff --git a/erigon-lib/Makefile b/erigon-lib/Makefile index 1b8e304b0e2..eb26cacfd22 100644 --- a/erigon-lib/Makefile +++ b/erigon-lib/Makefile @@ -39,7 +39,7 @@ $(GOBINREL): $(GOBINREL)/protoc: | $(GOBINREL) $(eval PROTOC_TMP := $(shell mktemp -d)) - curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v27.1/protoc-27.1-$(PROTOC_OS)-$(ARCH).zip -o "$(PROTOC_TMP)/protoc.zip" + curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v29.3/protoc-29.3-$(PROTOC_OS)-$(ARCH).zip -o "$(PROTOC_TMP)/protoc.zip" cd "$(PROTOC_TMP)" && unzip protoc.zip cp "$(PROTOC_TMP)/bin/protoc" "$(GOBIN)" mkdir -p "$(PROTOC_INCLUDE)" diff --git a/erigon-lib/direct/sentry_client_mock.go b/erigon-lib/direct/sentry_client_mock.go index 3aaf0f72d28..a8921c4a2dc 100644 --- a/erigon-lib/direct/sentry_client_mock.go +++ b/erigon-lib/direct/sentry_client_mock.go @@ -169,14 +169,14 @@ func (c *MockSentryClientMarkDisconnectedCall) DoAndReturn(f func()) *MockSentry } // Messages mocks base method. -func (m *MockSentryClient) Messages(ctx context.Context, in *sentryproto.MessagesRequest, opts ...grpc.CallOption) (sentryproto.Sentry_MessagesClient, error) { +func (m *MockSentryClient) Messages(ctx context.Context, in *sentryproto.MessagesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[sentryproto.InboundMessage], error) { m.ctrl.T.Helper() varargs := []any{ctx, in} for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "Messages", varargs...) - ret0, _ := ret[0].(sentryproto.Sentry_MessagesClient) + ret0, _ := ret[0].(grpc.ServerStreamingClient[sentryproto.InboundMessage]) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -195,19 +195,19 @@ type MockSentryClientMessagesCall struct { } // Return rewrite *gomock.Call.Return -func (c *MockSentryClientMessagesCall) Return(arg0 sentryproto.Sentry_MessagesClient, arg1 error) *MockSentryClientMessagesCall { +func (c *MockSentryClientMessagesCall) Return(arg0 grpc.ServerStreamingClient[sentryproto.InboundMessage], arg1 error) *MockSentryClientMessagesCall { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *MockSentryClientMessagesCall) Do(f func(context.Context, *sentryproto.MessagesRequest, ...grpc.CallOption) (sentryproto.Sentry_MessagesClient, error)) *MockSentryClientMessagesCall { +func (c *MockSentryClientMessagesCall) Do(f func(context.Context, *sentryproto.MessagesRequest, ...grpc.CallOption) (grpc.ServerStreamingClient[sentryproto.InboundMessage], error)) *MockSentryClientMessagesCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockSentryClientMessagesCall) DoAndReturn(f func(context.Context, *sentryproto.MessagesRequest, ...grpc.CallOption) (sentryproto.Sentry_MessagesClient, error)) *MockSentryClientMessagesCall { +func (c *MockSentryClientMessagesCall) DoAndReturn(f func(context.Context, *sentryproto.MessagesRequest, ...grpc.CallOption) (grpc.ServerStreamingClient[sentryproto.InboundMessage], error)) *MockSentryClientMessagesCall { c.Call = c.Call.DoAndReturn(f) return c } @@ -345,14 +345,14 @@ func (c *MockSentryClientPeerCountCall) DoAndReturn(f func(context.Context, *sen } // PeerEvents mocks base method. -func (m *MockSentryClient) PeerEvents(ctx context.Context, in *sentryproto.PeerEventsRequest, opts ...grpc.CallOption) (sentryproto.Sentry_PeerEventsClient, error) { +func (m *MockSentryClient) PeerEvents(ctx context.Context, in *sentryproto.PeerEventsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[sentryproto.PeerEvent], error) { m.ctrl.T.Helper() varargs := []any{ctx, in} for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "PeerEvents", varargs...) - ret0, _ := ret[0].(sentryproto.Sentry_PeerEventsClient) + ret0, _ := ret[0].(grpc.ServerStreamingClient[sentryproto.PeerEvent]) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -371,19 +371,19 @@ type MockSentryClientPeerEventsCall struct { } // Return rewrite *gomock.Call.Return -func (c *MockSentryClientPeerEventsCall) Return(arg0 sentryproto.Sentry_PeerEventsClient, arg1 error) *MockSentryClientPeerEventsCall { +func (c *MockSentryClientPeerEventsCall) Return(arg0 grpc.ServerStreamingClient[sentryproto.PeerEvent], arg1 error) *MockSentryClientPeerEventsCall { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *MockSentryClientPeerEventsCall) Do(f func(context.Context, *sentryproto.PeerEventsRequest, ...grpc.CallOption) (sentryproto.Sentry_PeerEventsClient, error)) *MockSentryClientPeerEventsCall { +func (c *MockSentryClientPeerEventsCall) Do(f func(context.Context, *sentryproto.PeerEventsRequest, ...grpc.CallOption) (grpc.ServerStreamingClient[sentryproto.PeerEvent], error)) *MockSentryClientPeerEventsCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockSentryClientPeerEventsCall) DoAndReturn(f func(context.Context, *sentryproto.PeerEventsRequest, ...grpc.CallOption) (sentryproto.Sentry_PeerEventsClient, error)) *MockSentryClientPeerEventsCall { +func (c *MockSentryClientPeerEventsCall) DoAndReturn(f func(context.Context, *sentryproto.PeerEventsRequest, ...grpc.CallOption) (grpc.ServerStreamingClient[sentryproto.PeerEvent], error)) *MockSentryClientPeerEventsCall { c.Call = c.Call.DoAndReturn(f) return c } diff --git a/erigon-lib/go.mod b/erigon-lib/go.mod index cc872b20533..3ce98a76342 100644 --- a/erigon-lib/go.mod +++ b/erigon-lib/go.mod @@ -17,7 +17,7 @@ require ( ) require ( - github.com/RoaringBitmap/roaring/v2 v2.4.2 + github.com/RoaringBitmap/roaring/v2 v2.4.3 github.com/anacrolix/dht/v2 v2.21.1 github.com/anacrolix/go-libutp v1.3.1 github.com/anacrolix/log v0.15.2 @@ -47,18 +47,18 @@ require ( github.com/quasilyte/go-ruleguard/dsl v0.3.22 github.com/shirou/gopsutil/v4 v4.24.8 github.com/spaolacci/murmur3 v1.1.0 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.10.0 github.com/tidwall/btree v1.6.0 github.com/ugorji/go/codec v1.2.12 go.uber.org/mock v0.5.0 golang.org/x/crypto v0.32.0 - golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c + golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c golang.org/x/sync v0.10.0 golang.org/x/sys v0.29.0 golang.org/x/time v0.9.0 - google.golang.org/grpc v1.65.0 - google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0 - google.golang.org/protobuf v1.36.3 + google.golang.org/grpc v1.69.4 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 + google.golang.org/protobuf v1.36.4 ) require ( @@ -70,9 +70,10 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/opencontainers/runtime-spec v1.2.0 // indirect github.com/pion/udp v0.1.4 // indirect - golang.org/x/mod v0.21.0 // indirect - golang.org/x/tools v0.26.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect + go.opentelemetry.io/otel/metric v1.31.0 // indirect + golang.org/x/mod v0.22.0 // indirect + golang.org/x/tools v0.29.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect modernc.org/libc v1.55.3 // indirect modernc.org/memory v1.8.0 // indirect modernc.org/sqlite v1.33.1 // indirect @@ -110,7 +111,7 @@ require ( github.com/gballet/go-verkle v0.0.0-20221121182333-31427a1f2d35 github.com/go-llsqlite/adapter v0.0.0-20230927005056-7f5ce7f0c916 // indirect github.com/go-llsqlite/crawshaw v0.5.2-0.20240425034140-f30eb7704568 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/godbus/dbus/v5 v5.0.4 // indirect @@ -151,10 +152,10 @@ require ( github.com/tklauser/numcpus v0.8.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.etcd.io/bbolt v1.3.6 // indirect - go.opentelemetry.io/otel v1.8.0 // indirect - go.opentelemetry.io/otel/trace v1.8.0 // indirect + go.opentelemetry.io/otel v1.31.0 // indirect + go.opentelemetry.io/otel/trace v1.31.0 // indirect go.uber.org/goleak v1.3.0 // indirect - golang.org/x/net v0.33.0 + golang.org/x/net v0.34.0 golang.org/x/text v0.21.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect modernc.org/mathutil v1.6.0 // indirect diff --git a/erigon-lib/go.sum b/erigon-lib/go.sum index e575b20cd0c..d0a525ba414 100644 --- a/erigon-lib/go.sum +++ b/erigon-lib/go.sum @@ -14,8 +14,8 @@ github.com/RoaringBitmap/roaring v0.4.17/go.mod h1:D3qVegWTmfCaX4Bl5CrBE9hfrSrrX github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= github.com/RoaringBitmap/roaring v1.9.4 h1:yhEIoH4YezLYT04s1nHehNO64EKFTop/wBhxv2QzDdQ= github.com/RoaringBitmap/roaring v1.9.4/go.mod h1:6AXUsoIEzDTFFQCe1RbGA6uFONMhvejWj5rqITANK90= -github.com/RoaringBitmap/roaring/v2 v2.4.2 h1:ew/INI7HLRyYK+dCbF6FcUwoe2Q0q5HCV7WafY9ljBk= -github.com/RoaringBitmap/roaring/v2 v2.4.2/go.mod h1:FiJcsfkGje/nZBZgCu0ZxCPOKD/hVXDS2dXi7/eUFE0= +github.com/RoaringBitmap/roaring/v2 v2.4.3 h1:McS6DMZVPnu6N0KnVFwSanU4LPBCTqmclXDqbsO49vw= +github.com/RoaringBitmap/roaring/v2 v2.4.3/go.mod h1:FiJcsfkGje/nZBZgCu0ZxCPOKD/hVXDS2dXi7/eUFE0= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/ajwerner/btree v0.0.0-20211221152037-f427b3e689c0 h1:byYvvbfSo3+9efR4IeReh77gVs4PnNDR3AMOE9NJ7a0= @@ -190,8 +190,8 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= @@ -468,8 +468,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= @@ -493,10 +493,16 @@ go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/otel v1.8.0 h1:zcvBFizPbpa1q7FehvFiHbQwGzmPILebO0tyqIR5Djg= -go.opentelemetry.io/otel v1.8.0/go.mod h1:2pkj+iMj0o03Y+cW6/m8Y4WkRdYN3AvCXCnzRMp9yvM= -go.opentelemetry.io/otel/trace v1.8.0 h1:cSy0DF9eGI5WIfNwZ1q2iUyGj00tGzP24dE1lOlHrfY= -go.opentelemetry.io/otel/trace v1.8.0/go.mod h1:0Bt3PXY8w+3pheS3hQUt+wow8b1ojPaTBoTCh2zIFI4= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= +go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= +go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= +go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= +go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -517,8 +523,8 @@ golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY= -golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= +golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c h1:KL/ZBHXgKGVmuZBZ01Lt57yE5ws8ZPSkkihmEyq7FXc= +golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -527,8 +533,8 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= -golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -557,8 +563,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= -golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -640,8 +646,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= -golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= +golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE= +golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -654,8 +660,8 @@ google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -663,10 +669,10 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0 h1:9SxA29VM43MF5Z9dQu694wmY5t8E/Gxr7s+RSxiIDmc= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0/go.mod h1:yZOK5zhQMiALmuweVdIVoQPa6eIJyXn2B9g5dJDhqX4= +google.golang.org/grpc v1.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A= +google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -675,8 +681,8 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU= -google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM= +google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/erigon-lib/gointerfaces/downloaderproto/downloader.pb.go b/erigon-lib/gointerfaces/downloaderproto/downloader.pb.go index f759c4ba0d7..15aa720b3c1 100644 --- a/erigon-lib/gointerfaces/downloaderproto/downloader.pb.go +++ b/erigon-lib/gointerfaces/downloaderproto/downloader.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.1 +// protoc-gen-go v1.36.3 +// protoc v5.29.3 // source: downloader/downloader.proto package downloaderproto @@ -26,21 +26,18 @@ const ( // - if Erigon created new snapshot and want seed it // - if Erigon wnat download files - it fills only "torrent_hash" field type AddItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + TorrentHash *typesproto.H160 `protobuf:"bytes,2,opt,name=torrent_hash,json=torrentHash,proto3" json:"torrent_hash,omitempty"` // will be resolved as magnet link unknownFields protoimpl.UnknownFields - - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - TorrentHash *typesproto.H160 `protobuf:"bytes,2,opt,name=torrent_hash,json=torrentHash,proto3" json:"torrent_hash,omitempty"` // will be resolved as magnet link + sizeCache protoimpl.SizeCache } func (x *AddItem) Reset() { *x = AddItem{} - if protoimpl.UnsafeEnabled { - mi := &file_downloader_downloader_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_downloader_downloader_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AddItem) String() string { @@ -51,7 +48,7 @@ func (*AddItem) ProtoMessage() {} func (x *AddItem) ProtoReflect() protoreflect.Message { mi := &file_downloader_downloader_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -81,20 +78,17 @@ func (x *AddItem) GetTorrentHash() *typesproto.H160 { } type AddRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Items []*AddItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` // single hash will be resolved as magnet link unknownFields protoimpl.UnknownFields - - Items []*AddItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` // single hash will be resolved as magnet link + sizeCache protoimpl.SizeCache } func (x *AddRequest) Reset() { *x = AddRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_downloader_downloader_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_downloader_downloader_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AddRequest) String() string { @@ -105,7 +99,7 @@ func (*AddRequest) ProtoMessage() {} func (x *AddRequest) ProtoReflect() protoreflect.Message { mi := &file_downloader_downloader_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -129,20 +123,17 @@ func (x *AddRequest) GetItems() []*AddItem { // DeleteRequest: stop seeding, delete file, delete .torrent type DeleteRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Paths []string `protobuf:"bytes,1,rep,name=paths,proto3" json:"paths,omitempty"` unknownFields protoimpl.UnknownFields - - Paths []string `protobuf:"bytes,1,rep,name=paths,proto3" json:"paths,omitempty"` + sizeCache protoimpl.SizeCache } func (x *DeleteRequest) Reset() { *x = DeleteRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_downloader_downloader_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_downloader_downloader_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteRequest) String() string { @@ -153,7 +144,7 @@ func (*DeleteRequest) ProtoMessage() {} func (x *DeleteRequest) ProtoReflect() protoreflect.Message { mi := &file_downloader_downloader_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -176,18 +167,16 @@ func (x *DeleteRequest) GetPaths() []string { } type VerifyRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *VerifyRequest) Reset() { *x = VerifyRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_downloader_downloader_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_downloader_downloader_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *VerifyRequest) String() string { @@ -198,7 +187,7 @@ func (*VerifyRequest) ProtoMessage() {} func (x *VerifyRequest) ProtoReflect() protoreflect.Message { mi := &file_downloader_downloader_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -214,20 +203,17 @@ func (*VerifyRequest) Descriptor() ([]byte, []int) { } type ProhibitNewDownloadsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ProhibitNewDownloadsRequest) Reset() { *x = ProhibitNewDownloadsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_downloader_downloader_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_downloader_downloader_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ProhibitNewDownloadsRequest) String() string { @@ -238,7 +224,7 @@ func (*ProhibitNewDownloadsRequest) ProtoMessage() {} func (x *ProhibitNewDownloadsRequest) ProtoReflect() protoreflect.Message { mi := &file_downloader_downloader_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -262,20 +248,17 @@ func (x *ProhibitNewDownloadsRequest) GetType() string { // SetLogPrefixRequest: set downloader log prefix type SetLogPrefixRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Prefix string `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"` unknownFields protoimpl.UnknownFields - - Prefix string `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SetLogPrefixRequest) Reset() { *x = SetLogPrefixRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_downloader_downloader_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_downloader_downloader_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SetLogPrefixRequest) String() string { @@ -286,7 +269,7 @@ func (*SetLogPrefixRequest) ProtoMessage() {} func (x *SetLogPrefixRequest) ProtoReflect() protoreflect.Message { mi := &file_downloader_downloader_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -309,18 +292,16 @@ func (x *SetLogPrefixRequest) GetPrefix() string { } type CompletedRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CompletedRequest) Reset() { *x = CompletedRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_downloader_downloader_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_downloader_downloader_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CompletedRequest) String() string { @@ -331,7 +312,7 @@ func (*CompletedRequest) ProtoMessage() {} func (x *CompletedRequest) ProtoReflect() protoreflect.Message { mi := &file_downloader_downloader_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -348,20 +329,17 @@ func (*CompletedRequest) Descriptor() ([]byte, []int) { // CompletedReply: return true if download is completed type CompletedReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Completed bool `protobuf:"varint,1,opt,name=completed,proto3" json:"completed,omitempty"` unknownFields protoimpl.UnknownFields - - Completed bool `protobuf:"varint,1,opt,name=completed,proto3" json:"completed,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CompletedReply) Reset() { *x = CompletedReply{} - if protoimpl.UnsafeEnabled { - mi := &file_downloader_downloader_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_downloader_downloader_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CompletedReply) String() string { @@ -372,7 +350,7 @@ func (*CompletedReply) ProtoMessage() {} func (x *CompletedReply) ProtoReflect() protoreflect.Message { mi := &file_downloader_downloader_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -395,18 +373,16 @@ func (x *CompletedReply) GetCompleted() bool { } type TorrentCompletedRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *TorrentCompletedRequest) Reset() { *x = TorrentCompletedRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_downloader_downloader_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_downloader_downloader_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TorrentCompletedRequest) String() string { @@ -417,7 +393,7 @@ func (*TorrentCompletedRequest) ProtoMessage() {} func (x *TorrentCompletedRequest) ProtoReflect() protoreflect.Message { mi := &file_downloader_downloader_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -434,21 +410,18 @@ func (*TorrentCompletedRequest) Descriptor() ([]byte, []int) { // Message: downloaded file data type TorrentCompletedReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Hash *typesproto.H160 `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Hash *typesproto.H160 `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` + sizeCache protoimpl.SizeCache } func (x *TorrentCompletedReply) Reset() { *x = TorrentCompletedReply{} - if protoimpl.UnsafeEnabled { - mi := &file_downloader_downloader_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_downloader_downloader_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TorrentCompletedReply) String() string { @@ -459,7 +432,7 @@ func (*TorrentCompletedReply) ProtoMessage() {} func (x *TorrentCompletedReply) ProtoReflect() protoreflect.Message { mi := &file_downloader_downloader_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -621,128 +594,6 @@ func file_downloader_downloader_proto_init() { if File_downloader_downloader_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_downloader_downloader_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*AddItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_downloader_downloader_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*AddRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_downloader_downloader_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*DeleteRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_downloader_downloader_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*VerifyRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_downloader_downloader_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*ProhibitNewDownloadsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_downloader_downloader_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*SetLogPrefixRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_downloader_downloader_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*CompletedRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_downloader_downloader_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*CompletedReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_downloader_downloader_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*TorrentCompletedRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_downloader_downloader_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*TorrentCompletedReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/erigon-lib/gointerfaces/downloaderproto/downloader_client_mock.go b/erigon-lib/gointerfaces/downloaderproto/downloader_client_mock.go index 3cd573a9862..b548297e568 100644 --- a/erigon-lib/gointerfaces/downloaderproto/downloader_client_mock.go +++ b/erigon-lib/gointerfaces/downloaderproto/downloader_client_mock.go @@ -263,14 +263,14 @@ func (c *MockDownloaderClientSetLogPrefixCall) DoAndReturn(f func(context.Contex } // TorrentCompleted mocks base method. -func (m *MockDownloaderClient) TorrentCompleted(ctx context.Context, in *TorrentCompletedRequest, opts ...grpc.CallOption) (Downloader_TorrentCompletedClient, error) { +func (m *MockDownloaderClient) TorrentCompleted(ctx context.Context, in *TorrentCompletedRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[TorrentCompletedReply], error) { m.ctrl.T.Helper() varargs := []any{ctx, in} for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "TorrentCompleted", varargs...) - ret0, _ := ret[0].(Downloader_TorrentCompletedClient) + ret0, _ := ret[0].(grpc.ServerStreamingClient[TorrentCompletedReply]) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -289,19 +289,19 @@ type MockDownloaderClientTorrentCompletedCall struct { } // Return rewrite *gomock.Call.Return -func (c *MockDownloaderClientTorrentCompletedCall) Return(arg0 Downloader_TorrentCompletedClient, arg1 error) *MockDownloaderClientTorrentCompletedCall { +func (c *MockDownloaderClientTorrentCompletedCall) Return(arg0 grpc.ServerStreamingClient[TorrentCompletedReply], arg1 error) *MockDownloaderClientTorrentCompletedCall { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *MockDownloaderClientTorrentCompletedCall) Do(f func(context.Context, *TorrentCompletedRequest, ...grpc.CallOption) (Downloader_TorrentCompletedClient, error)) *MockDownloaderClientTorrentCompletedCall { +func (c *MockDownloaderClientTorrentCompletedCall) Do(f func(context.Context, *TorrentCompletedRequest, ...grpc.CallOption) (grpc.ServerStreamingClient[TorrentCompletedReply], error)) *MockDownloaderClientTorrentCompletedCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockDownloaderClientTorrentCompletedCall) DoAndReturn(f func(context.Context, *TorrentCompletedRequest, ...grpc.CallOption) (Downloader_TorrentCompletedClient, error)) *MockDownloaderClientTorrentCompletedCall { +func (c *MockDownloaderClientTorrentCompletedCall) DoAndReturn(f func(context.Context, *TorrentCompletedRequest, ...grpc.CallOption) (grpc.ServerStreamingClient[TorrentCompletedReply], error)) *MockDownloaderClientTorrentCompletedCall { c.Call = c.Call.DoAndReturn(f) return c } diff --git a/erigon-lib/gointerfaces/downloaderproto/downloader_grpc.pb.go b/erigon-lib/gointerfaces/downloaderproto/downloader_grpc.pb.go index 6edd355c798..e08814eb67e 100644 --- a/erigon-lib/gointerfaces/downloaderproto/downloader_grpc.pb.go +++ b/erigon-lib/gointerfaces/downloaderproto/downloader_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.1 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 // source: downloader/downloader.proto package downloaderproto @@ -16,8 +16,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Downloader_ProhibitNewDownloads_FullMethodName = "/downloader.Downloader/ProhibitNewDownloads" @@ -47,7 +47,7 @@ type DownloaderClient interface { SetLogPrefix(ctx context.Context, in *SetLogPrefixRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) // Get is download completed Completed(ctx context.Context, in *CompletedRequest, opts ...grpc.CallOption) (*CompletedReply, error) - TorrentCompleted(ctx context.Context, in *TorrentCompletedRequest, opts ...grpc.CallOption) (Downloader_TorrentCompletedClient, error) + TorrentCompleted(ctx context.Context, in *TorrentCompletedRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[TorrentCompletedReply], error) } type downloaderClient struct { @@ -118,13 +118,13 @@ func (c *downloaderClient) Completed(ctx context.Context, in *CompletedRequest, return out, nil } -func (c *downloaderClient) TorrentCompleted(ctx context.Context, in *TorrentCompletedRequest, opts ...grpc.CallOption) (Downloader_TorrentCompletedClient, error) { +func (c *downloaderClient) TorrentCompleted(ctx context.Context, in *TorrentCompletedRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[TorrentCompletedReply], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Downloader_ServiceDesc.Streams[0], Downloader_TorrentCompleted_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &downloaderTorrentCompletedClient{ClientStream: stream} + x := &grpc.GenericClientStream[TorrentCompletedRequest, TorrentCompletedReply]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -134,26 +134,12 @@ func (c *downloaderClient) TorrentCompleted(ctx context.Context, in *TorrentComp return x, nil } -type Downloader_TorrentCompletedClient interface { - Recv() (*TorrentCompletedReply, error) - grpc.ClientStream -} - -type downloaderTorrentCompletedClient struct { - grpc.ClientStream -} - -func (x *downloaderTorrentCompletedClient) Recv() (*TorrentCompletedReply, error) { - m := new(TorrentCompletedReply) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Downloader_TorrentCompletedClient = grpc.ServerStreamingClient[TorrentCompletedReply] // DownloaderServer is the server API for Downloader service. // All implementations must embed UnimplementedDownloaderServer -// for forward compatibility +// for forward compatibility. type DownloaderServer interface { // Erigon "download once" - means restart/upgrade/downgrade will not download files (and will be fast) // After "download once" - Erigon will produce and seed new files @@ -169,13 +155,16 @@ type DownloaderServer interface { SetLogPrefix(context.Context, *SetLogPrefixRequest) (*emptypb.Empty, error) // Get is download completed Completed(context.Context, *CompletedRequest) (*CompletedReply, error) - TorrentCompleted(*TorrentCompletedRequest, Downloader_TorrentCompletedServer) error + TorrentCompleted(*TorrentCompletedRequest, grpc.ServerStreamingServer[TorrentCompletedReply]) error mustEmbedUnimplementedDownloaderServer() } -// UnimplementedDownloaderServer must be embedded to have forward compatible implementations. -type UnimplementedDownloaderServer struct { -} +// UnimplementedDownloaderServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedDownloaderServer struct{} func (UnimplementedDownloaderServer) ProhibitNewDownloads(context.Context, *ProhibitNewDownloadsRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method ProhibitNewDownloads not implemented") @@ -195,10 +184,11 @@ func (UnimplementedDownloaderServer) SetLogPrefix(context.Context, *SetLogPrefix func (UnimplementedDownloaderServer) Completed(context.Context, *CompletedRequest) (*CompletedReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Completed not implemented") } -func (UnimplementedDownloaderServer) TorrentCompleted(*TorrentCompletedRequest, Downloader_TorrentCompletedServer) error { +func (UnimplementedDownloaderServer) TorrentCompleted(*TorrentCompletedRequest, grpc.ServerStreamingServer[TorrentCompletedReply]) error { return status.Errorf(codes.Unimplemented, "method TorrentCompleted not implemented") } func (UnimplementedDownloaderServer) mustEmbedUnimplementedDownloaderServer() {} +func (UnimplementedDownloaderServer) testEmbeddedByValue() {} // UnsafeDownloaderServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to DownloaderServer will @@ -208,6 +198,13 @@ type UnsafeDownloaderServer interface { } func RegisterDownloaderServer(s grpc.ServiceRegistrar, srv DownloaderServer) { + // If the following call pancis, it indicates UnimplementedDownloaderServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Downloader_ServiceDesc, srv) } @@ -324,21 +321,11 @@ func _Downloader_TorrentCompleted_Handler(srv interface{}, stream grpc.ServerStr if err := stream.RecvMsg(m); err != nil { return err } - return srv.(DownloaderServer).TorrentCompleted(m, &downloaderTorrentCompletedServer{ServerStream: stream}) -} - -type Downloader_TorrentCompletedServer interface { - Send(*TorrentCompletedReply) error - grpc.ServerStream + return srv.(DownloaderServer).TorrentCompleted(m, &grpc.GenericServerStream[TorrentCompletedRequest, TorrentCompletedReply]{ServerStream: stream}) } -type downloaderTorrentCompletedServer struct { - grpc.ServerStream -} - -func (x *downloaderTorrentCompletedServer) Send(m *TorrentCompletedReply) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Downloader_TorrentCompletedServer = grpc.ServerStreamingServer[TorrentCompletedReply] // Downloader_ServiceDesc is the grpc.ServiceDesc for Downloader service. // It's only intended for direct use with grpc.RegisterService, diff --git a/erigon-lib/gointerfaces/executionproto/execution.pb.go b/erigon-lib/gointerfaces/executionproto/execution.pb.go index cfe85f25a80..0001a7edf8e 100644 --- a/erigon-lib/gointerfaces/executionproto/execution.pb.go +++ b/erigon-lib/gointerfaces/executionproto/execution.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.1 +// protoc-gen-go v1.36.3 +// protoc v5.29.3 // source: execution/execution.proto package executionproto @@ -81,22 +81,19 @@ func (ExecutionStatus) EnumDescriptor() ([]byte, []int) { } type ForkChoiceReceipt struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status ExecutionStatus `protobuf:"varint,1,opt,name=status,proto3,enum=execution.ExecutionStatus" json:"status,omitempty"` - LatestValidHash *typesproto.H256 `protobuf:"bytes,2,opt,name=latest_valid_hash,json=latestValidHash,proto3" json:"latest_valid_hash,omitempty"` // Return latest valid hash in case of halt of execution. - ValidationError string `protobuf:"bytes,3,opt,name=validation_error,json=validationError,proto3" json:"validation_error,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Status ExecutionStatus `protobuf:"varint,1,opt,name=status,proto3,enum=execution.ExecutionStatus" json:"status,omitempty"` + LatestValidHash *typesproto.H256 `protobuf:"bytes,2,opt,name=latest_valid_hash,json=latestValidHash,proto3" json:"latest_valid_hash,omitempty"` // Return latest valid hash in case of halt of execution. + ValidationError string `protobuf:"bytes,3,opt,name=validation_error,json=validationError,proto3" json:"validation_error,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ForkChoiceReceipt) Reset() { *x = ForkChoiceReceipt{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ForkChoiceReceipt) String() string { @@ -107,7 +104,7 @@ func (*ForkChoiceReceipt) ProtoMessage() {} func (x *ForkChoiceReceipt) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -145,22 +142,19 @@ func (x *ForkChoiceReceipt) GetValidationError() string { // Result we receive after validation type ValidationReceipt struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ValidationStatus ExecutionStatus `protobuf:"varint,1,opt,name=validation_status,json=validationStatus,proto3,enum=execution.ExecutionStatus" json:"validation_status,omitempty"` - LatestValidHash *typesproto.H256 `protobuf:"bytes,2,opt,name=latest_valid_hash,json=latestValidHash,proto3" json:"latest_valid_hash,omitempty"` - ValidationError string `protobuf:"bytes,3,opt,name=validation_error,json=validationError,proto3" json:"validation_error,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + ValidationStatus ExecutionStatus `protobuf:"varint,1,opt,name=validation_status,json=validationStatus,proto3,enum=execution.ExecutionStatus" json:"validation_status,omitempty"` + LatestValidHash *typesproto.H256 `protobuf:"bytes,2,opt,name=latest_valid_hash,json=latestValidHash,proto3" json:"latest_valid_hash,omitempty"` + ValidationError string `protobuf:"bytes,3,opt,name=validation_error,json=validationError,proto3" json:"validation_error,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ValidationReceipt) Reset() { *x = ValidationReceipt{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ValidationReceipt) String() string { @@ -171,7 +165,7 @@ func (*ValidationReceipt) ProtoMessage() {} func (x *ValidationReceipt) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -208,20 +202,17 @@ func (x *ValidationReceipt) GetValidationError() string { } type IsCanonicalResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Canonical bool `protobuf:"varint,1,opt,name=canonical,proto3" json:"canonical,omitempty"` // Whether hash is canonical or not. unknownFields protoimpl.UnknownFields - - Canonical bool `protobuf:"varint,1,opt,name=canonical,proto3" json:"canonical,omitempty"` // Whether hash is canonical or not. + sizeCache protoimpl.SizeCache } func (x *IsCanonicalResponse) Reset() { *x = IsCanonicalResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *IsCanonicalResponse) String() string { @@ -232,7 +223,7 @@ func (*IsCanonicalResponse) ProtoMessage() {} func (x *IsCanonicalResponse) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -256,44 +247,41 @@ func (x *IsCanonicalResponse) GetCanonical() bool { // Header is a header for execution type Header struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ParentHash *typesproto.H256 `protobuf:"bytes,1,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` - Coinbase *typesproto.H160 `protobuf:"bytes,2,opt,name=coinbase,proto3" json:"coinbase,omitempty"` - StateRoot *typesproto.H256 `protobuf:"bytes,3,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` - ReceiptRoot *typesproto.H256 `protobuf:"bytes,4,opt,name=receipt_root,json=receiptRoot,proto3" json:"receipt_root,omitempty"` - LogsBloom *typesproto.H2048 `protobuf:"bytes,5,opt,name=logs_bloom,json=logsBloom,proto3" json:"logs_bloom,omitempty"` - PrevRandao *typesproto.H256 `protobuf:"bytes,6,opt,name=prev_randao,json=prevRandao,proto3" json:"prev_randao,omitempty"` - BlockNumber uint64 `protobuf:"varint,7,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` - GasLimit uint64 `protobuf:"varint,8,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` - GasUsed uint64 `protobuf:"varint,9,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` - Timestamp uint64 `protobuf:"varint,10,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Nonce uint64 `protobuf:"varint,11,opt,name=nonce,proto3" json:"nonce,omitempty"` - ExtraData []byte `protobuf:"bytes,12,opt,name=extra_data,json=extraData,proto3" json:"extra_data,omitempty"` - Difficulty *typesproto.H256 `protobuf:"bytes,13,opt,name=difficulty,proto3" json:"difficulty,omitempty"` - BlockHash *typesproto.H256 `protobuf:"bytes,14,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` // We keep this so that we can validate it - OmmerHash *typesproto.H256 `protobuf:"bytes,15,opt,name=ommer_hash,json=ommerHash,proto3" json:"ommer_hash,omitempty"` - TransactionHash *typesproto.H256 `protobuf:"bytes,16,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash,omitempty"` - BaseFeePerGas *typesproto.H256 `protobuf:"bytes,17,opt,name=base_fee_per_gas,json=baseFeePerGas,proto3,oneof" json:"base_fee_per_gas,omitempty"` - WithdrawalHash *typesproto.H256 `protobuf:"bytes,18,opt,name=withdrawal_hash,json=withdrawalHash,proto3,oneof" json:"withdrawal_hash,omitempty"` // added in Shapella (EIP-4895) - BlobGasUsed *uint64 `protobuf:"varint,19,opt,name=blob_gas_used,json=blobGasUsed,proto3,oneof" json:"blob_gas_used,omitempty"` // added in Dencun (EIP-4844) - ExcessBlobGas *uint64 `protobuf:"varint,20,opt,name=excess_blob_gas,json=excessBlobGas,proto3,oneof" json:"excess_blob_gas,omitempty"` // added in Dencun (EIP-4844) - ParentBeaconBlockRoot *typesproto.H256 `protobuf:"bytes,21,opt,name=parent_beacon_block_root,json=parentBeaconBlockRoot,proto3,oneof" json:"parent_beacon_block_root,omitempty"` // added in Dencun (EIP-4788) - RequestsHash *typesproto.H256 `protobuf:"bytes,22,opt,name=requests_hash,json=requestsHash,proto3,oneof" json:"requests_hash,omitempty"` // added in Pectra (EIP-7685) + state protoimpl.MessageState `protogen:"open.v1"` + ParentHash *typesproto.H256 `protobuf:"bytes,1,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` + Coinbase *typesproto.H160 `protobuf:"bytes,2,opt,name=coinbase,proto3" json:"coinbase,omitempty"` + StateRoot *typesproto.H256 `protobuf:"bytes,3,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` + ReceiptRoot *typesproto.H256 `protobuf:"bytes,4,opt,name=receipt_root,json=receiptRoot,proto3" json:"receipt_root,omitempty"` + LogsBloom *typesproto.H2048 `protobuf:"bytes,5,opt,name=logs_bloom,json=logsBloom,proto3" json:"logs_bloom,omitempty"` + PrevRandao *typesproto.H256 `protobuf:"bytes,6,opt,name=prev_randao,json=prevRandao,proto3" json:"prev_randao,omitempty"` + BlockNumber uint64 `protobuf:"varint,7,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + GasLimit uint64 `protobuf:"varint,8,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` + GasUsed uint64 `protobuf:"varint,9,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` + Timestamp uint64 `protobuf:"varint,10,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Nonce uint64 `protobuf:"varint,11,opt,name=nonce,proto3" json:"nonce,omitempty"` + ExtraData []byte `protobuf:"bytes,12,opt,name=extra_data,json=extraData,proto3" json:"extra_data,omitempty"` + Difficulty *typesproto.H256 `protobuf:"bytes,13,opt,name=difficulty,proto3" json:"difficulty,omitempty"` + BlockHash *typesproto.H256 `protobuf:"bytes,14,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` // We keep this so that we can validate it + OmmerHash *typesproto.H256 `protobuf:"bytes,15,opt,name=ommer_hash,json=ommerHash,proto3" json:"ommer_hash,omitempty"` + TransactionHash *typesproto.H256 `protobuf:"bytes,16,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash,omitempty"` + BaseFeePerGas *typesproto.H256 `protobuf:"bytes,17,opt,name=base_fee_per_gas,json=baseFeePerGas,proto3,oneof" json:"base_fee_per_gas,omitempty"` + WithdrawalHash *typesproto.H256 `protobuf:"bytes,18,opt,name=withdrawal_hash,json=withdrawalHash,proto3,oneof" json:"withdrawal_hash,omitempty"` // added in Shapella (EIP-4895) + BlobGasUsed *uint64 `protobuf:"varint,19,opt,name=blob_gas_used,json=blobGasUsed,proto3,oneof" json:"blob_gas_used,omitempty"` // added in Dencun (EIP-4844) + ExcessBlobGas *uint64 `protobuf:"varint,20,opt,name=excess_blob_gas,json=excessBlobGas,proto3,oneof" json:"excess_blob_gas,omitempty"` // added in Dencun (EIP-4844) + ParentBeaconBlockRoot *typesproto.H256 `protobuf:"bytes,21,opt,name=parent_beacon_block_root,json=parentBeaconBlockRoot,proto3,oneof" json:"parent_beacon_block_root,omitempty"` // added in Dencun (EIP-4788) + RequestsHash *typesproto.H256 `protobuf:"bytes,22,opt,name=requests_hash,json=requestsHash,proto3,oneof" json:"requests_hash,omitempty"` // added in Pectra (EIP-7685) // AuRa - AuraStep *uint64 `protobuf:"varint,23,opt,name=aura_step,json=auraStep,proto3,oneof" json:"aura_step,omitempty"` - AuraSeal []byte `protobuf:"bytes,24,opt,name=aura_seal,json=auraSeal,proto3,oneof" json:"aura_seal,omitempty"` + AuraStep *uint64 `protobuf:"varint,23,opt,name=aura_step,json=auraStep,proto3,oneof" json:"aura_step,omitempty"` + AuraSeal []byte `protobuf:"bytes,24,opt,name=aura_seal,json=auraSeal,proto3,oneof" json:"aura_seal,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Header) Reset() { *x = Header{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Header) String() string { @@ -304,7 +292,7 @@ func (*Header) ProtoMessage() {} func (x *Header) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -489,25 +477,22 @@ func (x *Header) GetAuraSeal() []byte { // Body is a block body for execution type BlockBody struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - BlockHash *typesproto.H256 `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - BlockNumber uint64 `protobuf:"varint,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + BlockHash *typesproto.H256 `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + BlockNumber uint64 `protobuf:"varint,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` // Raw transactions in byte format. - Transactions [][]byte `protobuf:"bytes,3,rep,name=transactions,proto3" json:"transactions,omitempty"` - Uncles []*Header `protobuf:"bytes,4,rep,name=uncles,proto3" json:"uncles,omitempty"` - Withdrawals []*typesproto.Withdrawal `protobuf:"bytes,5,rep,name=withdrawals,proto3" json:"withdrawals,omitempty"` // added in Shapella (EIP-4895) + Transactions [][]byte `protobuf:"bytes,3,rep,name=transactions,proto3" json:"transactions,omitempty"` + Uncles []*Header `protobuf:"bytes,4,rep,name=uncles,proto3" json:"uncles,omitempty"` + Withdrawals []*typesproto.Withdrawal `protobuf:"bytes,5,rep,name=withdrawals,proto3" json:"withdrawals,omitempty"` // added in Shapella (EIP-4895) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *BlockBody) Reset() { *x = BlockBody{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BlockBody) String() string { @@ -518,7 +503,7 @@ func (*BlockBody) ProtoMessage() {} func (x *BlockBody) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -569,21 +554,18 @@ func (x *BlockBody) GetWithdrawals() []*typesproto.Withdrawal { } type Block struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Body *BlockBody `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` unknownFields protoimpl.UnknownFields - - Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - Body *BlockBody `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Block) Reset() { *x = Block{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Block) String() string { @@ -594,7 +576,7 @@ func (*Block) ProtoMessage() {} func (x *Block) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -624,20 +606,17 @@ func (x *Block) GetBody() *BlockBody { } type GetHeaderResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Header *Header `protobuf:"bytes,1,opt,name=header,proto3,oneof" json:"header,omitempty"` unknownFields protoimpl.UnknownFields - - Header *Header `protobuf:"bytes,1,opt,name=header,proto3,oneof" json:"header,omitempty"` + sizeCache protoimpl.SizeCache } func (x *GetHeaderResponse) Reset() { *x = GetHeaderResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetHeaderResponse) String() string { @@ -648,7 +627,7 @@ func (*GetHeaderResponse) ProtoMessage() {} func (x *GetHeaderResponse) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -671,20 +650,17 @@ func (x *GetHeaderResponse) GetHeader() *Header { } type GetTDResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Td *typesproto.H256 `protobuf:"bytes,1,opt,name=td,proto3,oneof" json:"td,omitempty"` unknownFields protoimpl.UnknownFields - - Td *typesproto.H256 `protobuf:"bytes,1,opt,name=td,proto3,oneof" json:"td,omitempty"` + sizeCache protoimpl.SizeCache } func (x *GetTDResponse) Reset() { *x = GetTDResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetTDResponse) String() string { @@ -695,7 +671,7 @@ func (*GetTDResponse) ProtoMessage() {} func (x *GetTDResponse) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -718,20 +694,17 @@ func (x *GetTDResponse) GetTd() *typesproto.H256 { } type GetBodyResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Body *BlockBody `protobuf:"bytes,1,opt,name=body,proto3,oneof" json:"body,omitempty"` unknownFields protoimpl.UnknownFields - - Body *BlockBody `protobuf:"bytes,1,opt,name=body,proto3,oneof" json:"body,omitempty"` + sizeCache protoimpl.SizeCache } func (x *GetBodyResponse) Reset() { *x = GetBodyResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetBodyResponse) String() string { @@ -742,7 +715,7 @@ func (*GetBodyResponse) ProtoMessage() {} func (x *GetBodyResponse) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -765,20 +738,17 @@ func (x *GetBodyResponse) GetBody() *BlockBody { } type GetHeaderHashNumberResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + BlockNumber *uint64 `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3,oneof" json:"block_number,omitempty"` // null if not found. unknownFields protoimpl.UnknownFields - - BlockNumber *uint64 `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3,oneof" json:"block_number,omitempty"` // null if not found. + sizeCache protoimpl.SizeCache } func (x *GetHeaderHashNumberResponse) Reset() { *x = GetHeaderHashNumberResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetHeaderHashNumberResponse) String() string { @@ -789,7 +759,7 @@ func (*GetHeaderHashNumberResponse) ProtoMessage() {} func (x *GetHeaderHashNumberResponse) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -812,22 +782,19 @@ func (x *GetHeaderHashNumberResponse) GetBlockNumber() uint64 { } type GetSegmentRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // Get headers/body by number or hash, invalid if none set. - BlockNumber *uint64 `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3,oneof" json:"block_number,omitempty"` - BlockHash *typesproto.H256 `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3,oneof" json:"block_hash,omitempty"` + BlockNumber *uint64 `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3,oneof" json:"block_number,omitempty"` + BlockHash *typesproto.H256 `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3,oneof" json:"block_hash,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GetSegmentRequest) Reset() { *x = GetSegmentRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetSegmentRequest) String() string { @@ -838,7 +805,7 @@ func (*GetSegmentRequest) ProtoMessage() {} func (x *GetSegmentRequest) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -868,20 +835,17 @@ func (x *GetSegmentRequest) GetBlockHash() *typesproto.H256 { } type InsertBlocksRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Blocks []*Block `protobuf:"bytes,1,rep,name=blocks,proto3" json:"blocks,omitempty"` unknownFields protoimpl.UnknownFields - - Blocks []*Block `protobuf:"bytes,1,rep,name=blocks,proto3" json:"blocks,omitempty"` + sizeCache protoimpl.SizeCache } func (x *InsertBlocksRequest) Reset() { *x = InsertBlocksRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *InsertBlocksRequest) String() string { @@ -892,7 +856,7 @@ func (*InsertBlocksRequest) ProtoMessage() {} func (x *InsertBlocksRequest) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -915,23 +879,20 @@ func (x *InsertBlocksRequest) GetBlocks() []*Block { } type ForkChoice struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - HeadBlockHash *typesproto.H256 `protobuf:"bytes,1,opt,name=head_block_hash,json=headBlockHash,proto3" json:"head_block_hash,omitempty"` - Timeout uint64 `protobuf:"varint,2,opt,name=timeout,proto3" json:"timeout,omitempty"` // Timeout in milliseconds for fcu before it becomes async. - FinalizedBlockHash *typesproto.H256 `protobuf:"bytes,3,opt,name=finalized_block_hash,json=finalizedBlockHash,proto3,oneof" json:"finalized_block_hash,omitempty"` - SafeBlockHash *typesproto.H256 `protobuf:"bytes,4,opt,name=safe_block_hash,json=safeBlockHash,proto3,oneof" json:"safe_block_hash,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + HeadBlockHash *typesproto.H256 `protobuf:"bytes,1,opt,name=head_block_hash,json=headBlockHash,proto3" json:"head_block_hash,omitempty"` + Timeout uint64 `protobuf:"varint,2,opt,name=timeout,proto3" json:"timeout,omitempty"` // Timeout in milliseconds for fcu before it becomes async. + FinalizedBlockHash *typesproto.H256 `protobuf:"bytes,3,opt,name=finalized_block_hash,json=finalizedBlockHash,proto3,oneof" json:"finalized_block_hash,omitempty"` + SafeBlockHash *typesproto.H256 `protobuf:"bytes,4,opt,name=safe_block_hash,json=safeBlockHash,proto3,oneof" json:"safe_block_hash,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ForkChoice) Reset() { *x = ForkChoice{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ForkChoice) String() string { @@ -942,7 +903,7 @@ func (*ForkChoice) ProtoMessage() {} func (x *ForkChoice) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -986,20 +947,17 @@ func (x *ForkChoice) GetSafeBlockHash() *typesproto.H256 { } type InsertionResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Result ExecutionStatus `protobuf:"varint,1,opt,name=result,proto3,enum=execution.ExecutionStatus" json:"result,omitempty"` unknownFields protoimpl.UnknownFields - - Result ExecutionStatus `protobuf:"varint,1,opt,name=result,proto3,enum=execution.ExecutionStatus" json:"result,omitempty"` + sizeCache protoimpl.SizeCache } func (x *InsertionResult) Reset() { *x = InsertionResult{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *InsertionResult) String() string { @@ -1010,7 +968,7 @@ func (*InsertionResult) ProtoMessage() {} func (x *InsertionResult) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1033,21 +991,18 @@ func (x *InsertionResult) GetResult() ExecutionStatus { } type ValidationRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Hash *typesproto.H256 `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + Number uint64 `protobuf:"varint,2,opt,name=number,proto3" json:"number,omitempty"` unknownFields protoimpl.UnknownFields - - Hash *typesproto.H256 `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - Number uint64 `protobuf:"varint,2,opt,name=number,proto3" json:"number,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ValidationRequest) Reset() { *x = ValidationRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ValidationRequest) String() string { @@ -1058,7 +1013,7 @@ func (*ValidationRequest) ProtoMessage() {} func (x *ValidationRequest) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1088,25 +1043,22 @@ func (x *ValidationRequest) GetNumber() uint64 { } type AssembleBlockRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` ParentHash *typesproto.H256 `protobuf:"bytes,1,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` PrevRandao *typesproto.H256 `protobuf:"bytes,3,opt,name=prev_randao,json=prevRandao,proto3" json:"prev_randao,omitempty"` SuggestedFeeRecipient *typesproto.H160 `protobuf:"bytes,4,opt,name=suggested_fee_recipient,json=suggestedFeeRecipient,proto3" json:"suggested_fee_recipient,omitempty"` Withdrawals []*typesproto.Withdrawal `protobuf:"bytes,5,rep,name=withdrawals,proto3" json:"withdrawals,omitempty"` // added in Shapella (EIP-4895) ParentBeaconBlockRoot *typesproto.H256 `protobuf:"bytes,6,opt,name=parent_beacon_block_root,json=parentBeaconBlockRoot,proto3,oneof" json:"parent_beacon_block_root,omitempty"` // added in Dencun (EIP-4788) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AssembleBlockRequest) Reset() { *x = AssembleBlockRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AssembleBlockRequest) String() string { @@ -1117,7 +1069,7 @@ func (*AssembleBlockRequest) ProtoMessage() {} func (x *AssembleBlockRequest) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1175,21 +1127,18 @@ func (x *AssembleBlockRequest) GetParentBeaconBlockRoot() *typesproto.H256 { } type AssembleBlockResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Busy bool `protobuf:"varint,2,opt,name=busy,proto3" json:"busy,omitempty"` unknownFields protoimpl.UnknownFields - - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Busy bool `protobuf:"varint,2,opt,name=busy,proto3" json:"busy,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AssembleBlockResponse) Reset() { *x = AssembleBlockResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AssembleBlockResponse) String() string { @@ -1200,7 +1149,7 @@ func (*AssembleBlockResponse) ProtoMessage() {} func (x *AssembleBlockResponse) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1230,20 +1179,17 @@ func (x *AssembleBlockResponse) GetBusy() bool { } type GetAssembledBlockRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` unknownFields protoimpl.UnknownFields - - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *GetAssembledBlockRequest) Reset() { *x = GetAssembledBlockRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetAssembledBlockRequest) String() string { @@ -1254,7 +1200,7 @@ func (*GetAssembledBlockRequest) ProtoMessage() {} func (x *GetAssembledBlockRequest) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1277,23 +1223,20 @@ func (x *GetAssembledBlockRequest) GetId() uint64 { } type AssembledBlockData struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` ExecutionPayload *typesproto.ExecutionPayload `protobuf:"bytes,1,opt,name=execution_payload,json=executionPayload,proto3" json:"execution_payload,omitempty"` BlockValue *typesproto.H256 `protobuf:"bytes,2,opt,name=block_value,json=blockValue,proto3" json:"block_value,omitempty"` BlobsBundle *typesproto.BlobsBundleV1 `protobuf:"bytes,3,opt,name=blobs_bundle,json=blobsBundle,proto3" json:"blobs_bundle,omitempty"` Requests *typesproto.RequestsBundle `protobuf:"bytes,4,opt,name=requests,proto3" json:"requests,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AssembledBlockData) Reset() { *x = AssembledBlockData{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AssembledBlockData) String() string { @@ -1304,7 +1247,7 @@ func (*AssembledBlockData) ProtoMessage() {} func (x *AssembledBlockData) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1348,21 +1291,18 @@ func (x *AssembledBlockData) GetRequests() *typesproto.RequestsBundle { } type GetAssembledBlockResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Data *AssembledBlockData `protobuf:"bytes,1,opt,name=data,proto3,oneof" json:"data,omitempty"` + Busy bool `protobuf:"varint,2,opt,name=busy,proto3" json:"busy,omitempty"` unknownFields protoimpl.UnknownFields - - Data *AssembledBlockData `protobuf:"bytes,1,opt,name=data,proto3,oneof" json:"data,omitempty"` - Busy bool `protobuf:"varint,2,opt,name=busy,proto3" json:"busy,omitempty"` + sizeCache protoimpl.SizeCache } func (x *GetAssembledBlockResponse) Reset() { *x = GetAssembledBlockResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetAssembledBlockResponse) String() string { @@ -1373,7 +1313,7 @@ func (*GetAssembledBlockResponse) ProtoMessage() {} func (x *GetAssembledBlockResponse) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1403,20 +1343,17 @@ func (x *GetAssembledBlockResponse) GetBusy() bool { } type GetBodiesBatchResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Bodies []*BlockBody `protobuf:"bytes,1,rep,name=bodies,proto3" json:"bodies,omitempty"` unknownFields protoimpl.UnknownFields - - Bodies []*BlockBody `protobuf:"bytes,1,rep,name=bodies,proto3" json:"bodies,omitempty"` + sizeCache protoimpl.SizeCache } func (x *GetBodiesBatchResponse) Reset() { *x = GetBodiesBatchResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetBodiesBatchResponse) String() string { @@ -1427,7 +1364,7 @@ func (*GetBodiesBatchResponse) ProtoMessage() {} func (x *GetBodiesBatchResponse) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1450,20 +1387,17 @@ func (x *GetBodiesBatchResponse) GetBodies() []*BlockBody { } type GetBodiesByHashesRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Hashes []*typesproto.H256 `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` unknownFields protoimpl.UnknownFields - - Hashes []*typesproto.H256 `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` + sizeCache protoimpl.SizeCache } func (x *GetBodiesByHashesRequest) Reset() { *x = GetBodiesByHashesRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetBodiesByHashesRequest) String() string { @@ -1474,7 +1408,7 @@ func (*GetBodiesByHashesRequest) ProtoMessage() {} func (x *GetBodiesByHashesRequest) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1497,21 +1431,18 @@ func (x *GetBodiesByHashesRequest) GetHashes() []*typesproto.H256 { } type GetBodiesByRangeRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Start uint64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` + Count uint64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` unknownFields protoimpl.UnknownFields - - Start uint64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` - Count uint64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` + sizeCache protoimpl.SizeCache } func (x *GetBodiesByRangeRequest) Reset() { *x = GetBodiesByRangeRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetBodiesByRangeRequest) String() string { @@ -1522,7 +1453,7 @@ func (*GetBodiesByRangeRequest) ProtoMessage() {} func (x *GetBodiesByRangeRequest) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1552,20 +1483,17 @@ func (x *GetBodiesByRangeRequest) GetCount() uint64 { } type ReadyResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Ready bool `protobuf:"varint,1,opt,name=ready,proto3" json:"ready,omitempty"` unknownFields protoimpl.UnknownFields - - Ready bool `protobuf:"varint,1,opt,name=ready,proto3" json:"ready,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ReadyResponse) Reset() { *x = ReadyResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ReadyResponse) String() string { @@ -1576,7 +1504,7 @@ func (*ReadyResponse) ProtoMessage() {} func (x *ReadyResponse) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1599,21 +1527,18 @@ func (x *ReadyResponse) GetReady() bool { } type FrozenBlocksResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + FrozenBlocks uint64 `protobuf:"varint,1,opt,name=frozen_blocks,json=frozenBlocks,proto3" json:"frozen_blocks,omitempty"` + HasGap bool `protobuf:"varint,2,opt,name=has_gap,json=hasGap,proto3" json:"has_gap,omitempty"` unknownFields protoimpl.UnknownFields - - FrozenBlocks uint64 `protobuf:"varint,1,opt,name=frozen_blocks,json=frozenBlocks,proto3" json:"frozen_blocks,omitempty"` - HasGap bool `protobuf:"varint,2,opt,name=has_gap,json=hasGap,proto3" json:"has_gap,omitempty"` + sizeCache protoimpl.SizeCache } func (x *FrozenBlocksResponse) Reset() { *x = FrozenBlocksResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FrozenBlocksResponse) String() string { @@ -1624,7 +1549,7 @@ func (*FrozenBlocksResponse) ProtoMessage() {} func (x *FrozenBlocksResponse) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1654,20 +1579,17 @@ func (x *FrozenBlocksResponse) GetHasGap() bool { } type HasBlockResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + HasBlock bool `protobuf:"varint,1,opt,name=has_block,json=hasBlock,proto3" json:"has_block,omitempty"` unknownFields protoimpl.UnknownFields - - HasBlock bool `protobuf:"varint,1,opt,name=has_block,json=hasBlock,proto3" json:"has_block,omitempty"` + sizeCache protoimpl.SizeCache } func (x *HasBlockResponse) Reset() { *x = HasBlockResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_execution_execution_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_execution_execution_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *HasBlockResponse) String() string { @@ -1678,7 +1600,7 @@ func (*HasBlockResponse) ProtoMessage() {} func (x *HasBlockResponse) ProtoReflect() protoreflect.Message { mi := &file_execution_execution_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2199,320 +2121,6 @@ func file_execution_execution_proto_init() { if File_execution_execution_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_execution_execution_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*ForkChoiceReceipt); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*ValidationReceipt); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*IsCanonicalResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*Header); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*BlockBody); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*Block); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*GetHeaderResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*GetTDResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*GetBodyResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*GetHeaderHashNumberResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*GetSegmentRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*InsertBlocksRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*ForkChoice); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*InsertionResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*ValidationRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[15].Exporter = func(v any, i int) any { - switch v := v.(*AssembleBlockRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[16].Exporter = func(v any, i int) any { - switch v := v.(*AssembleBlockResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[17].Exporter = func(v any, i int) any { - switch v := v.(*GetAssembledBlockRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[18].Exporter = func(v any, i int) any { - switch v := v.(*AssembledBlockData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[19].Exporter = func(v any, i int) any { - switch v := v.(*GetAssembledBlockResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[20].Exporter = func(v any, i int) any { - switch v := v.(*GetBodiesBatchResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[21].Exporter = func(v any, i int) any { - switch v := v.(*GetBodiesByHashesRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[22].Exporter = func(v any, i int) any { - switch v := v.(*GetBodiesByRangeRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[23].Exporter = func(v any, i int) any { - switch v := v.(*ReadyResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[24].Exporter = func(v any, i int) any { - switch v := v.(*FrozenBlocksResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_execution_execution_proto_msgTypes[25].Exporter = func(v any, i int) any { - switch v := v.(*HasBlockResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } file_execution_execution_proto_msgTypes[3].OneofWrappers = []any{} file_execution_execution_proto_msgTypes[6].OneofWrappers = []any{} file_execution_execution_proto_msgTypes[7].OneofWrappers = []any{} diff --git a/erigon-lib/gointerfaces/executionproto/execution_grpc.pb.go b/erigon-lib/gointerfaces/executionproto/execution_grpc.pb.go index ad4a2316bc6..9525b1b5f5a 100644 --- a/erigon-lib/gointerfaces/executionproto/execution_grpc.pb.go +++ b/erigon-lib/gointerfaces/executionproto/execution_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.1 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 // source: execution/execution.proto package executionproto @@ -17,8 +17,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Execution_InsertBlocks_FullMethodName = "/execution.Execution/InsertBlocks" @@ -253,7 +253,7 @@ func (c *executionClient) FrozenBlocks(ctx context.Context, in *emptypb.Empty, o // ExecutionServer is the server API for Execution service. // All implementations must embed UnimplementedExecutionServer -// for forward compatibility +// for forward compatibility. type ExecutionServer interface { // Chain Putters. InsertBlocks(context.Context, *InsertBlocksRequest) (*InsertionResult, error) @@ -285,9 +285,12 @@ type ExecutionServer interface { mustEmbedUnimplementedExecutionServer() } -// UnimplementedExecutionServer must be embedded to have forward compatible implementations. -type UnimplementedExecutionServer struct { -} +// UnimplementedExecutionServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedExecutionServer struct{} func (UnimplementedExecutionServer) InsertBlocks(context.Context, *InsertBlocksRequest) (*InsertionResult, error) { return nil, status.Errorf(codes.Unimplemented, "method InsertBlocks not implemented") @@ -341,6 +344,7 @@ func (UnimplementedExecutionServer) FrozenBlocks(context.Context, *emptypb.Empty return nil, status.Errorf(codes.Unimplemented, "method FrozenBlocks not implemented") } func (UnimplementedExecutionServer) mustEmbedUnimplementedExecutionServer() {} +func (UnimplementedExecutionServer) testEmbeddedByValue() {} // UnsafeExecutionServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ExecutionServer will @@ -350,6 +354,13 @@ type UnsafeExecutionServer interface { } func RegisterExecutionServer(s grpc.ServiceRegistrar, srv ExecutionServer) { + // If the following call pancis, it indicates UnimplementedExecutionServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Execution_ServiceDesc, srv) } diff --git a/erigon-lib/gointerfaces/remoteproto/bor.pb.go b/erigon-lib/gointerfaces/remoteproto/bor.pb.go index a78af319caf..90b7abdab33 100644 --- a/erigon-lib/gointerfaces/remoteproto/bor.pb.go +++ b/erigon-lib/gointerfaces/remoteproto/bor.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.1 +// protoc-gen-go v1.36.3 +// protoc v5.29.3 // source: remote/bor.proto package remoteproto @@ -23,20 +23,17 @@ const ( ) type BorTxnLookupRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + BorTxHash *typesproto.H256 `protobuf:"bytes,1,opt,name=bor_tx_hash,json=borTxHash,proto3" json:"bor_tx_hash,omitempty"` unknownFields protoimpl.UnknownFields - - BorTxHash *typesproto.H256 `protobuf:"bytes,1,opt,name=bor_tx_hash,json=borTxHash,proto3" json:"bor_tx_hash,omitempty"` + sizeCache protoimpl.SizeCache } func (x *BorTxnLookupRequest) Reset() { *x = BorTxnLookupRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_bor_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_bor_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BorTxnLookupRequest) String() string { @@ -47,7 +44,7 @@ func (*BorTxnLookupRequest) ProtoMessage() {} func (x *BorTxnLookupRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_bor_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -70,21 +67,18 @@ func (x *BorTxnLookupRequest) GetBorTxHash() *typesproto.H256 { } type BorTxnLookupReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Present bool `protobuf:"varint,1,opt,name=present,proto3" json:"present,omitempty"` + BlockNumber uint64 `protobuf:"varint,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` unknownFields protoimpl.UnknownFields - - Present bool `protobuf:"varint,1,opt,name=present,proto3" json:"present,omitempty"` - BlockNumber uint64 `protobuf:"varint,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + sizeCache protoimpl.SizeCache } func (x *BorTxnLookupReply) Reset() { *x = BorTxnLookupReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_bor_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_bor_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BorTxnLookupReply) String() string { @@ -95,7 +89,7 @@ func (*BorTxnLookupReply) ProtoMessage() {} func (x *BorTxnLookupReply) ProtoReflect() protoreflect.Message { mi := &file_remote_bor_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -125,21 +119,18 @@ func (x *BorTxnLookupReply) GetBlockNumber() uint64 { } type BorEventsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + BlockNum uint64 `protobuf:"varint,1,opt,name=block_num,json=blockNum,proto3" json:"block_num,omitempty"` + BlockHash *typesproto.H256 `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` unknownFields protoimpl.UnknownFields - - BlockNum uint64 `protobuf:"varint,1,opt,name=block_num,json=blockNum,proto3" json:"block_num,omitempty"` - BlockHash *typesproto.H256 `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + sizeCache protoimpl.SizeCache } func (x *BorEventsRequest) Reset() { *x = BorEventsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_bor_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_bor_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BorEventsRequest) String() string { @@ -150,7 +141,7 @@ func (*BorEventsRequest) ProtoMessage() {} func (x *BorEventsRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_bor_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -180,21 +171,18 @@ func (x *BorEventsRequest) GetBlockHash() *typesproto.H256 { } type BorEventsReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - StateReceiverContractAddress string `protobuf:"bytes,1,opt,name=state_receiver_contract_address,json=stateReceiverContractAddress,proto3" json:"state_receiver_contract_address,omitempty"` - EventRlps [][]byte `protobuf:"bytes,2,rep,name=event_rlps,json=eventRlps,proto3" json:"event_rlps,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + StateReceiverContractAddress string `protobuf:"bytes,1,opt,name=state_receiver_contract_address,json=stateReceiverContractAddress,proto3" json:"state_receiver_contract_address,omitempty"` + EventRlps [][]byte `protobuf:"bytes,2,rep,name=event_rlps,json=eventRlps,proto3" json:"event_rlps,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *BorEventsReply) Reset() { *x = BorEventsReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_bor_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_bor_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BorEventsReply) String() string { @@ -205,7 +193,7 @@ func (*BorEventsReply) ProtoMessage() {} func (x *BorEventsReply) ProtoReflect() protoreflect.Message { mi := &file_remote_bor_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -235,20 +223,17 @@ func (x *BorEventsReply) GetEventRlps() [][]byte { } type BorProducersRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + BlockNum uint64 `protobuf:"varint,1,opt,name=block_num,json=blockNum,proto3" json:"block_num,omitempty"` unknownFields protoimpl.UnknownFields - - BlockNum uint64 `protobuf:"varint,1,opt,name=block_num,json=blockNum,proto3" json:"block_num,omitempty"` + sizeCache protoimpl.SizeCache } func (x *BorProducersRequest) Reset() { *x = BorProducersRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_bor_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_bor_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BorProducersRequest) String() string { @@ -259,7 +244,7 @@ func (*BorProducersRequest) ProtoMessage() {} func (x *BorProducersRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_bor_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -282,21 +267,18 @@ func (x *BorProducersRequest) GetBlockNum() uint64 { } type BorProducersResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Proposer *Validator `protobuf:"bytes,1,opt,name=proposer,proto3" json:"proposer,omitempty"` + Validators []*Validator `protobuf:"bytes,2,rep,name=validators,proto3" json:"validators,omitempty"` unknownFields protoimpl.UnknownFields - - Proposer *Validator `protobuf:"bytes,1,opt,name=proposer,proto3" json:"proposer,omitempty"` - Validators []*Validator `protobuf:"bytes,2,rep,name=validators,proto3" json:"validators,omitempty"` + sizeCache protoimpl.SizeCache } func (x *BorProducersResponse) Reset() { *x = BorProducersResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_bor_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_bor_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BorProducersResponse) String() string { @@ -307,7 +289,7 @@ func (*BorProducersResponse) ProtoMessage() {} func (x *BorProducersResponse) ProtoReflect() protoreflect.Message { mi := &file_remote_bor_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -337,23 +319,20 @@ func (x *BorProducersResponse) GetValidators() []*Validator { } type Validator struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Address *typesproto.H160 `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - VotingPower int64 `protobuf:"varint,3,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"` - ProposerPriority int64 `protobuf:"varint,4,opt,name=proposer_priority,json=proposerPriority,proto3" json:"proposer_priority,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Address *typesproto.H160 `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + VotingPower int64 `protobuf:"varint,3,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"` + ProposerPriority int64 `protobuf:"varint,4,opt,name=proposer_priority,json=proposerPriority,proto3" json:"proposer_priority,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Validator) Reset() { *x = Validator{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_bor_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_bor_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Validator) String() string { @@ -364,7 +343,7 @@ func (*Validator) ProtoMessage() {} func (x *Validator) ProtoReflect() protoreflect.Message { mi := &file_remote_bor_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -538,92 +517,6 @@ func file_remote_bor_proto_init() { if File_remote_bor_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_remote_bor_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*BorTxnLookupRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_bor_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*BorTxnLookupReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_bor_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*BorEventsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_bor_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*BorEventsReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_bor_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*BorProducersRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_bor_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*BorProducersResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_bor_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*Validator); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/erigon-lib/gointerfaces/remoteproto/bor_grpc.pb.go b/erigon-lib/gointerfaces/remoteproto/bor_grpc.pb.go index 1bedc1c5378..0f2e304fe0f 100644 --- a/erigon-lib/gointerfaces/remoteproto/bor_grpc.pb.go +++ b/erigon-lib/gointerfaces/remoteproto/bor_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.1 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 // source: remote/bor.proto package remoteproto @@ -17,8 +17,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( BridgeBackend_Version_FullMethodName = "/remote.BridgeBackend/Version" @@ -76,7 +76,7 @@ func (c *bridgeBackendClient) BorEvents(ctx context.Context, in *BorEventsReques // BridgeBackendServer is the server API for BridgeBackend service. // All implementations must embed UnimplementedBridgeBackendServer -// for forward compatibility +// for forward compatibility. type BridgeBackendServer interface { // Version returns the service version number Version(context.Context, *emptypb.Empty) (*typesproto.VersionReply, error) @@ -85,9 +85,12 @@ type BridgeBackendServer interface { mustEmbedUnimplementedBridgeBackendServer() } -// UnimplementedBridgeBackendServer must be embedded to have forward compatible implementations. -type UnimplementedBridgeBackendServer struct { -} +// UnimplementedBridgeBackendServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedBridgeBackendServer struct{} func (UnimplementedBridgeBackendServer) Version(context.Context, *emptypb.Empty) (*typesproto.VersionReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") @@ -99,6 +102,7 @@ func (UnimplementedBridgeBackendServer) BorEvents(context.Context, *BorEventsReq return nil, status.Errorf(codes.Unimplemented, "method BorEvents not implemented") } func (UnimplementedBridgeBackendServer) mustEmbedUnimplementedBridgeBackendServer() {} +func (UnimplementedBridgeBackendServer) testEmbeddedByValue() {} // UnsafeBridgeBackendServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to BridgeBackendServer will @@ -108,6 +112,13 @@ type UnsafeBridgeBackendServer interface { } func RegisterBridgeBackendServer(s grpc.ServiceRegistrar, srv BridgeBackendServer) { + // If the following call pancis, it indicates UnimplementedBridgeBackendServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&BridgeBackend_ServiceDesc, srv) } @@ -233,7 +244,7 @@ func (c *heimdallBackendClient) Producers(ctx context.Context, in *BorProducersR // HeimdallBackendServer is the server API for HeimdallBackend service. // All implementations must embed UnimplementedHeimdallBackendServer -// for forward compatibility +// for forward compatibility. type HeimdallBackendServer interface { // Version returns the service version number Version(context.Context, *emptypb.Empty) (*typesproto.VersionReply, error) @@ -241,9 +252,12 @@ type HeimdallBackendServer interface { mustEmbedUnimplementedHeimdallBackendServer() } -// UnimplementedHeimdallBackendServer must be embedded to have forward compatible implementations. -type UnimplementedHeimdallBackendServer struct { -} +// UnimplementedHeimdallBackendServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedHeimdallBackendServer struct{} func (UnimplementedHeimdallBackendServer) Version(context.Context, *emptypb.Empty) (*typesproto.VersionReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") @@ -252,6 +266,7 @@ func (UnimplementedHeimdallBackendServer) Producers(context.Context, *BorProduce return nil, status.Errorf(codes.Unimplemented, "method Producers not implemented") } func (UnimplementedHeimdallBackendServer) mustEmbedUnimplementedHeimdallBackendServer() {} +func (UnimplementedHeimdallBackendServer) testEmbeddedByValue() {} // UnsafeHeimdallBackendServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to HeimdallBackendServer will @@ -261,6 +276,13 @@ type UnsafeHeimdallBackendServer interface { } func RegisterHeimdallBackendServer(s grpc.ServiceRegistrar, srv HeimdallBackendServer) { + // If the following call pancis, it indicates UnimplementedHeimdallBackendServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&HeimdallBackend_ServiceDesc, srv) } diff --git a/erigon-lib/gointerfaces/remoteproto/ethbackend.pb.go b/erigon-lib/gointerfaces/remoteproto/ethbackend.pb.go index fbef7e8dd8f..f532eed81bc 100644 --- a/erigon-lib/gointerfaces/remoteproto/ethbackend.pb.go +++ b/erigon-lib/gointerfaces/remoteproto/ethbackend.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.1 +// protoc-gen-go v1.36.3 +// protoc v5.29.3 // source: remote/ethbackend.proto package remoteproto @@ -78,18 +78,16 @@ func (Event) EnumDescriptor() ([]byte, []int) { } type EtherbaseRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *EtherbaseRequest) Reset() { *x = EtherbaseRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EtherbaseRequest) String() string { @@ -100,7 +98,7 @@ func (*EtherbaseRequest) ProtoMessage() {} func (x *EtherbaseRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -116,20 +114,17 @@ func (*EtherbaseRequest) Descriptor() ([]byte, []int) { } type EtherbaseReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Address *typesproto.H160 `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` unknownFields protoimpl.UnknownFields - - Address *typesproto.H160 `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + sizeCache protoimpl.SizeCache } func (x *EtherbaseReply) Reset() { *x = EtherbaseReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EtherbaseReply) String() string { @@ -140,7 +135,7 @@ func (*EtherbaseReply) ProtoMessage() {} func (x *EtherbaseReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -163,18 +158,16 @@ func (x *EtherbaseReply) GetAddress() *typesproto.H160 { } type NetVersionRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *NetVersionRequest) Reset() { *x = NetVersionRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *NetVersionRequest) String() string { @@ -185,7 +178,7 @@ func (*NetVersionRequest) ProtoMessage() {} func (x *NetVersionRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -201,20 +194,17 @@ func (*NetVersionRequest) Descriptor() ([]byte, []int) { } type NetVersionReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` unknownFields protoimpl.UnknownFields - - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *NetVersionReply) Reset() { *x = NetVersionReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *NetVersionReply) String() string { @@ -225,7 +215,7 @@ func (*NetVersionReply) ProtoMessage() {} func (x *NetVersionReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -248,24 +238,21 @@ func (x *NetVersionReply) GetId() uint64 { } type SyncingReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` LastNewBlockSeen uint64 `protobuf:"varint,1,opt,name=last_new_block_seen,json=lastNewBlockSeen,proto3" json:"last_new_block_seen,omitempty"` FrozenBlocks uint64 `protobuf:"varint,2,opt,name=frozen_blocks,json=frozenBlocks,proto3" json:"frozen_blocks,omitempty"` CurrentBlock uint64 `protobuf:"varint,3,opt,name=current_block,json=currentBlock,proto3" json:"current_block,omitempty"` Syncing bool `protobuf:"varint,4,opt,name=syncing,proto3" json:"syncing,omitempty"` Stages []*SyncingReply_StageProgress `protobuf:"bytes,5,rep,name=stages,proto3" json:"stages,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *SyncingReply) Reset() { *x = SyncingReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncingReply) String() string { @@ -276,7 +263,7 @@ func (*SyncingReply) ProtoMessage() {} func (x *SyncingReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -327,18 +314,16 @@ func (x *SyncingReply) GetStages() []*SyncingReply_StageProgress { } type NetPeerCountRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *NetPeerCountRequest) Reset() { *x = NetPeerCountRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *NetPeerCountRequest) String() string { @@ -349,7 +334,7 @@ func (*NetPeerCountRequest) ProtoMessage() {} func (x *NetPeerCountRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -365,20 +350,17 @@ func (*NetPeerCountRequest) Descriptor() ([]byte, []int) { } type NetPeerCountReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` unknownFields protoimpl.UnknownFields - - Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + sizeCache protoimpl.SizeCache } func (x *NetPeerCountReply) Reset() { *x = NetPeerCountReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *NetPeerCountReply) String() string { @@ -389,7 +371,7 @@ func (*NetPeerCountReply) ProtoMessage() {} func (x *NetPeerCountReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -412,18 +394,16 @@ func (x *NetPeerCountReply) GetCount() uint64 { } type ProtocolVersionRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ProtocolVersionRequest) Reset() { *x = ProtocolVersionRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ProtocolVersionRequest) String() string { @@ -434,7 +414,7 @@ func (*ProtocolVersionRequest) ProtoMessage() {} func (x *ProtocolVersionRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -450,20 +430,17 @@ func (*ProtocolVersionRequest) Descriptor() ([]byte, []int) { } type ProtocolVersionReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` unknownFields protoimpl.UnknownFields - - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ProtocolVersionReply) Reset() { *x = ProtocolVersionReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ProtocolVersionReply) String() string { @@ -474,7 +451,7 @@ func (*ProtocolVersionReply) ProtoMessage() {} func (x *ProtocolVersionReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -497,18 +474,16 @@ func (x *ProtocolVersionReply) GetId() uint64 { } type ClientVersionRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ClientVersionRequest) Reset() { *x = ClientVersionRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ClientVersionRequest) String() string { @@ -519,7 +494,7 @@ func (*ClientVersionRequest) ProtoMessage() {} func (x *ClientVersionRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -535,20 +510,17 @@ func (*ClientVersionRequest) Descriptor() ([]byte, []int) { } type ClientVersionReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + NodeName string `protobuf:"bytes,1,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` unknownFields protoimpl.UnknownFields - - NodeName string `protobuf:"bytes,1,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ClientVersionReply) Reset() { *x = ClientVersionReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ClientVersionReply) String() string { @@ -559,7 +531,7 @@ func (*ClientVersionReply) ProtoMessage() {} func (x *ClientVersionReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -582,20 +554,17 @@ func (x *ClientVersionReply) GetNodeName() string { } type CanonicalHashRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + BlockNumber uint64 `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` unknownFields protoimpl.UnknownFields - - BlockNumber uint64 `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CanonicalHashRequest) Reset() { *x = CanonicalHashRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CanonicalHashRequest) String() string { @@ -606,7 +575,7 @@ func (*CanonicalHashRequest) ProtoMessage() {} func (x *CanonicalHashRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -629,20 +598,17 @@ func (x *CanonicalHashRequest) GetBlockNumber() uint64 { } type CanonicalHashReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Hash *typesproto.H256 `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` unknownFields protoimpl.UnknownFields - - Hash *typesproto.H256 `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CanonicalHashReply) Reset() { *x = CanonicalHashReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CanonicalHashReply) String() string { @@ -653,7 +619,7 @@ func (*CanonicalHashReply) ProtoMessage() {} func (x *CanonicalHashReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -676,20 +642,17 @@ func (x *CanonicalHashReply) GetHash() *typesproto.H256 { } type HeaderNumberRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Hash *typesproto.H256 `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` unknownFields protoimpl.UnknownFields - - Hash *typesproto.H256 `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + sizeCache protoimpl.SizeCache } func (x *HeaderNumberRequest) Reset() { *x = HeaderNumberRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *HeaderNumberRequest) String() string { @@ -700,7 +663,7 @@ func (*HeaderNumberRequest) ProtoMessage() {} func (x *HeaderNumberRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -723,20 +686,17 @@ func (x *HeaderNumberRequest) GetHash() *typesproto.H256 { } type HeaderNumberReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Number *uint64 `protobuf:"varint,1,opt,name=number,proto3,oneof" json:"number,omitempty"` unknownFields protoimpl.UnknownFields - - Number *uint64 `protobuf:"varint,1,opt,name=number,proto3,oneof" json:"number,omitempty"` + sizeCache protoimpl.SizeCache } func (x *HeaderNumberReply) Reset() { *x = HeaderNumberReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *HeaderNumberReply) String() string { @@ -747,7 +707,7 @@ func (*HeaderNumberReply) ProtoMessage() {} func (x *HeaderNumberReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -770,20 +730,17 @@ func (x *HeaderNumberReply) GetNumber() uint64 { } type CanonicalBodyForStorageRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + BlockNumber uint64 `protobuf:"varint,1,opt,name=blockNumber,proto3" json:"blockNumber,omitempty"` unknownFields protoimpl.UnknownFields - - BlockNumber uint64 `protobuf:"varint,1,opt,name=blockNumber,proto3" json:"blockNumber,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CanonicalBodyForStorageRequest) Reset() { *x = CanonicalBodyForStorageRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CanonicalBodyForStorageRequest) String() string { @@ -794,7 +751,7 @@ func (*CanonicalBodyForStorageRequest) ProtoMessage() {} func (x *CanonicalBodyForStorageRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -817,20 +774,17 @@ func (x *CanonicalBodyForStorageRequest) GetBlockNumber() uint64 { } type CanonicalBodyForStorageReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Body []byte `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` unknownFields protoimpl.UnknownFields - - Body []byte `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CanonicalBodyForStorageReply) Reset() { *x = CanonicalBodyForStorageReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CanonicalBodyForStorageReply) String() string { @@ -841,7 +795,7 @@ func (*CanonicalBodyForStorageReply) ProtoMessage() {} func (x *CanonicalBodyForStorageReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -864,20 +818,17 @@ func (x *CanonicalBodyForStorageReply) GetBody() []byte { } type SubscribeRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Type Event `protobuf:"varint,1,opt,name=type,proto3,enum=remote.Event" json:"type,omitempty"` unknownFields protoimpl.UnknownFields - - Type Event `protobuf:"varint,1,opt,name=type,proto3,enum=remote.Event" json:"type,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SubscribeRequest) Reset() { *x = SubscribeRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SubscribeRequest) String() string { @@ -888,7 +839,7 @@ func (*SubscribeRequest) ProtoMessage() {} func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -911,21 +862,18 @@ func (x *SubscribeRequest) GetType() Event { } type SubscribeReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Type Event `protobuf:"varint,1,opt,name=type,proto3,enum=remote.Event" json:"type,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // serialized data unknownFields protoimpl.UnknownFields - - Type Event `protobuf:"varint,1,opt,name=type,proto3,enum=remote.Event" json:"type,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // serialized data + sizeCache protoimpl.SizeCache } func (x *SubscribeReply) Reset() { *x = SubscribeReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SubscribeReply) String() string { @@ -936,7 +884,7 @@ func (*SubscribeReply) ProtoMessage() {} func (x *SubscribeReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -966,23 +914,20 @@ func (x *SubscribeReply) GetData() []byte { } type LogsFilterRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + AllAddresses bool `protobuf:"varint,1,opt,name=all_addresses,json=allAddresses,proto3" json:"all_addresses,omitempty"` + Addresses []*typesproto.H160 `protobuf:"bytes,2,rep,name=addresses,proto3" json:"addresses,omitempty"` + AllTopics bool `protobuf:"varint,3,opt,name=all_topics,json=allTopics,proto3" json:"all_topics,omitempty"` + Topics []*typesproto.H256 `protobuf:"bytes,4,rep,name=topics,proto3" json:"topics,omitempty"` unknownFields protoimpl.UnknownFields - - AllAddresses bool `protobuf:"varint,1,opt,name=all_addresses,json=allAddresses,proto3" json:"all_addresses,omitempty"` - Addresses []*typesproto.H160 `protobuf:"bytes,2,rep,name=addresses,proto3" json:"addresses,omitempty"` - AllTopics bool `protobuf:"varint,3,opt,name=all_topics,json=allTopics,proto3" json:"all_topics,omitempty"` - Topics []*typesproto.H256 `protobuf:"bytes,4,rep,name=topics,proto3" json:"topics,omitempty"` + sizeCache protoimpl.SizeCache } func (x *LogsFilterRequest) Reset() { *x = LogsFilterRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *LogsFilterRequest) String() string { @@ -993,7 +938,7 @@ func (*LogsFilterRequest) ProtoMessage() {} func (x *LogsFilterRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1037,28 +982,25 @@ func (x *LogsFilterRequest) GetTopics() []*typesproto.H256 { } type SubscribeLogsReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Address *typesproto.H160 `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - BlockHash *typesproto.H256 `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - BlockNumber uint64 `protobuf:"varint,3,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` - Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` - LogIndex uint64 `protobuf:"varint,5,opt,name=log_index,json=logIndex,proto3" json:"log_index,omitempty"` - Topics []*typesproto.H256 `protobuf:"bytes,6,rep,name=topics,proto3" json:"topics,omitempty"` - TransactionHash *typesproto.H256 `protobuf:"bytes,7,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash,omitempty"` - TransactionIndex uint64 `protobuf:"varint,8,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index,omitempty"` - Removed bool `protobuf:"varint,9,opt,name=removed,proto3" json:"removed,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Address *typesproto.H160 `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + BlockHash *typesproto.H256 `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + BlockNumber uint64 `protobuf:"varint,3,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + LogIndex uint64 `protobuf:"varint,5,opt,name=log_index,json=logIndex,proto3" json:"log_index,omitempty"` + Topics []*typesproto.H256 `protobuf:"bytes,6,rep,name=topics,proto3" json:"topics,omitempty"` + TransactionHash *typesproto.H256 `protobuf:"bytes,7,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash,omitempty"` + TransactionIndex uint64 `protobuf:"varint,8,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index,omitempty"` + Removed bool `protobuf:"varint,9,opt,name=removed,proto3" json:"removed,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *SubscribeLogsReply) Reset() { *x = SubscribeLogsReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SubscribeLogsReply) String() string { @@ -1069,7 +1011,7 @@ func (*SubscribeLogsReply) ProtoMessage() {} func (x *SubscribeLogsReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1148,21 +1090,18 @@ func (x *SubscribeLogsReply) GetRemoved() bool { } type BlockRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + BlockHash *typesproto.H256 `protobuf:"bytes,3,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` unknownFields protoimpl.UnknownFields - - BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` - BlockHash *typesproto.H256 `protobuf:"bytes,3,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + sizeCache protoimpl.SizeCache } func (x *BlockRequest) Reset() { *x = BlockRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BlockRequest) String() string { @@ -1173,7 +1112,7 @@ func (*BlockRequest) ProtoMessage() {} func (x *BlockRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1203,21 +1142,18 @@ func (x *BlockRequest) GetBlockHash() *typesproto.H256 { } type BlockReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + BlockRlp []byte `protobuf:"bytes,1,opt,name=block_rlp,json=blockRlp,proto3" json:"block_rlp,omitempty"` + Senders []byte `protobuf:"bytes,2,opt,name=senders,proto3" json:"senders,omitempty"` unknownFields protoimpl.UnknownFields - - BlockRlp []byte `protobuf:"bytes,1,opt,name=block_rlp,json=blockRlp,proto3" json:"block_rlp,omitempty"` - Senders []byte `protobuf:"bytes,2,opt,name=senders,proto3" json:"senders,omitempty"` + sizeCache protoimpl.SizeCache } func (x *BlockReply) Reset() { *x = BlockReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BlockReply) String() string { @@ -1228,7 +1164,7 @@ func (*BlockReply) ProtoMessage() {} func (x *BlockReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1258,20 +1194,17 @@ func (x *BlockReply) GetSenders() []byte { } type TxnLookupRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + TxnHash *typesproto.H256 `protobuf:"bytes,1,opt,name=txn_hash,json=txnHash,proto3" json:"txn_hash,omitempty"` unknownFields protoimpl.UnknownFields - - TxnHash *typesproto.H256 `protobuf:"bytes,1,opt,name=txn_hash,json=txnHash,proto3" json:"txn_hash,omitempty"` + sizeCache protoimpl.SizeCache } func (x *TxnLookupRequest) Reset() { *x = TxnLookupRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TxnLookupRequest) String() string { @@ -1282,7 +1215,7 @@ func (*TxnLookupRequest) ProtoMessage() {} func (x *TxnLookupRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1305,21 +1238,18 @@ func (x *TxnLookupRequest) GetTxnHash() *typesproto.H256 { } type TxnLookupReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + BlockNumber uint64 `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + TxNumber uint64 `protobuf:"varint,2,opt,name=tx_number,json=txNumber,proto3" json:"tx_number,omitempty"` unknownFields protoimpl.UnknownFields - - BlockNumber uint64 `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` - TxNumber uint64 `protobuf:"varint,2,opt,name=tx_number,json=txNumber,proto3" json:"tx_number,omitempty"` + sizeCache protoimpl.SizeCache } func (x *TxnLookupReply) Reset() { *x = TxnLookupReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TxnLookupReply) String() string { @@ -1330,7 +1260,7 @@ func (*TxnLookupReply) ProtoMessage() {} func (x *TxnLookupReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1360,20 +1290,17 @@ func (x *TxnLookupReply) GetTxNumber() uint64 { } type NodesInfoRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Limit uint32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` unknownFields protoimpl.UnknownFields - - Limit uint32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` + sizeCache protoimpl.SizeCache } func (x *NodesInfoRequest) Reset() { *x = NodesInfoRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *NodesInfoRequest) String() string { @@ -1384,7 +1311,7 @@ func (*NodesInfoRequest) ProtoMessage() {} func (x *NodesInfoRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1407,20 +1334,17 @@ func (x *NodesInfoRequest) GetLimit() uint32 { } type AddPeerRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AddPeerRequest) Reset() { *x = AddPeerRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AddPeerRequest) String() string { @@ -1431,7 +1355,7 @@ func (*AddPeerRequest) ProtoMessage() {} func (x *AddPeerRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1454,20 +1378,17 @@ func (x *AddPeerRequest) GetUrl() string { } type NodesInfoReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + NodesInfo []*typesproto.NodeInfoReply `protobuf:"bytes,1,rep,name=nodes_info,json=nodesInfo,proto3" json:"nodes_info,omitempty"` unknownFields protoimpl.UnknownFields - - NodesInfo []*typesproto.NodeInfoReply `protobuf:"bytes,1,rep,name=nodes_info,json=nodesInfo,proto3" json:"nodes_info,omitempty"` + sizeCache protoimpl.SizeCache } func (x *NodesInfoReply) Reset() { *x = NodesInfoReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *NodesInfoReply) String() string { @@ -1478,7 +1399,7 @@ func (*NodesInfoReply) ProtoMessage() {} func (x *NodesInfoReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1501,20 +1422,17 @@ func (x *NodesInfoReply) GetNodesInfo() []*typesproto.NodeInfoReply { } type PeersReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Peers []*typesproto.PeerInfo `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"` unknownFields protoimpl.UnknownFields - - Peers []*typesproto.PeerInfo `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PeersReply) Reset() { *x = PeersReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeersReply) String() string { @@ -1525,7 +1443,7 @@ func (*PeersReply) ProtoMessage() {} func (x *PeersReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1548,20 +1466,17 @@ func (x *PeersReply) GetPeers() []*typesproto.PeerInfo { } type AddPeerReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` unknownFields protoimpl.UnknownFields - - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AddPeerReply) Reset() { *x = AddPeerReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AddPeerReply) String() string { @@ -1572,7 +1487,7 @@ func (*AddPeerReply) ProtoMessage() {} func (x *AddPeerReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1595,20 +1510,17 @@ func (x *AddPeerReply) GetSuccess() bool { } type PendingBlockReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + BlockRlp []byte `protobuf:"bytes,1,opt,name=block_rlp,json=blockRlp,proto3" json:"block_rlp,omitempty"` unknownFields protoimpl.UnknownFields - - BlockRlp []byte `protobuf:"bytes,1,opt,name=block_rlp,json=blockRlp,proto3" json:"block_rlp,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PendingBlockReply) Reset() { *x = PendingBlockReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PendingBlockReply) String() string { @@ -1619,7 +1531,7 @@ func (*PendingBlockReply) ProtoMessage() {} func (x *PendingBlockReply) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1642,20 +1554,17 @@ func (x *PendingBlockReply) GetBlockRlp() []byte { } type EngineGetPayloadBodiesByHashV1Request struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Hashes []*typesproto.H256 `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` unknownFields protoimpl.UnknownFields - - Hashes []*typesproto.H256 `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` + sizeCache protoimpl.SizeCache } func (x *EngineGetPayloadBodiesByHashV1Request) Reset() { *x = EngineGetPayloadBodiesByHashV1Request{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EngineGetPayloadBodiesByHashV1Request) String() string { @@ -1666,7 +1575,7 @@ func (*EngineGetPayloadBodiesByHashV1Request) ProtoMessage() {} func (x *EngineGetPayloadBodiesByHashV1Request) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1689,21 +1598,18 @@ func (x *EngineGetPayloadBodiesByHashV1Request) GetHashes() []*typesproto.H256 { } type EngineGetPayloadBodiesByRangeV1Request struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Start uint64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` + Count uint64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` unknownFields protoimpl.UnknownFields - - Start uint64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` - Count uint64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` + sizeCache protoimpl.SizeCache } func (x *EngineGetPayloadBodiesByRangeV1Request) Reset() { *x = EngineGetPayloadBodiesByRangeV1Request{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EngineGetPayloadBodiesByRangeV1Request) String() string { @@ -1714,7 +1620,7 @@ func (*EngineGetPayloadBodiesByRangeV1Request) ProtoMessage() {} func (x *EngineGetPayloadBodiesByRangeV1Request) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1744,21 +1650,18 @@ func (x *EngineGetPayloadBodiesByRangeV1Request) GetCount() uint64 { } type SyncingReply_StageProgress struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + StageName string `protobuf:"bytes,1,opt,name=stage_name,json=stageName,proto3" json:"stage_name,omitempty"` + BlockNumber uint64 `protobuf:"varint,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` unknownFields protoimpl.UnknownFields - - StageName string `protobuf:"bytes,1,opt,name=stage_name,json=stageName,proto3" json:"stage_name,omitempty"` - BlockNumber uint64 `protobuf:"varint,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SyncingReply_StageProgress) Reset() { *x = SyncingReply_StageProgress{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_ethbackend_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncingReply_StageProgress) String() string { @@ -1769,7 +1672,7 @@ func (*SyncingReply_StageProgress) ProtoMessage() {} func (x *SyncingReply_StageProgress) ProtoReflect() protoreflect.Message { mi := &file_remote_ethbackend_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2185,416 +2088,6 @@ func file_remote_ethbackend_proto_init() { return } file_remote_bor_proto_init() - if !protoimpl.UnsafeEnabled { - file_remote_ethbackend_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*EtherbaseRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*EtherbaseReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*NetVersionRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*NetVersionReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*SyncingReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*NetPeerCountRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*NetPeerCountReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*ProtocolVersionRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*ProtocolVersionReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*ClientVersionRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*ClientVersionReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*CanonicalHashRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*CanonicalHashReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*HeaderNumberRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*HeaderNumberReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[15].Exporter = func(v any, i int) any { - switch v := v.(*CanonicalBodyForStorageRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[16].Exporter = func(v any, i int) any { - switch v := v.(*CanonicalBodyForStorageReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[17].Exporter = func(v any, i int) any { - switch v := v.(*SubscribeRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[18].Exporter = func(v any, i int) any { - switch v := v.(*SubscribeReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[19].Exporter = func(v any, i int) any { - switch v := v.(*LogsFilterRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[20].Exporter = func(v any, i int) any { - switch v := v.(*SubscribeLogsReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[21].Exporter = func(v any, i int) any { - switch v := v.(*BlockRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[22].Exporter = func(v any, i int) any { - switch v := v.(*BlockReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[23].Exporter = func(v any, i int) any { - switch v := v.(*TxnLookupRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[24].Exporter = func(v any, i int) any { - switch v := v.(*TxnLookupReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[25].Exporter = func(v any, i int) any { - switch v := v.(*NodesInfoRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[26].Exporter = func(v any, i int) any { - switch v := v.(*AddPeerRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[27].Exporter = func(v any, i int) any { - switch v := v.(*NodesInfoReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[28].Exporter = func(v any, i int) any { - switch v := v.(*PeersReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[29].Exporter = func(v any, i int) any { - switch v := v.(*AddPeerReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[30].Exporter = func(v any, i int) any { - switch v := v.(*PendingBlockReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[31].Exporter = func(v any, i int) any { - switch v := v.(*EngineGetPayloadBodiesByHashV1Request); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[32].Exporter = func(v any, i int) any { - switch v := v.(*EngineGetPayloadBodiesByRangeV1Request); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_ethbackend_proto_msgTypes[33].Exporter = func(v any, i int) any { - switch v := v.(*SyncingReply_StageProgress); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } file_remote_ethbackend_proto_msgTypes[14].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ diff --git a/erigon-lib/gointerfaces/remoteproto/ethbackend_grpc.pb.go b/erigon-lib/gointerfaces/remoteproto/ethbackend_grpc.pb.go index a6b3dae3b42..5288876e170 100644 --- a/erigon-lib/gointerfaces/remoteproto/ethbackend_grpc.pb.go +++ b/erigon-lib/gointerfaces/remoteproto/ethbackend_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.1 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 // source: remote/ethbackend.proto package remoteproto @@ -17,8 +17,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( ETHBACKEND_Etherbase_FullMethodName = "/remote.ETHBACKEND/Etherbase" @@ -58,9 +58,9 @@ type ETHBACKENDClient interface { ProtocolVersion(ctx context.Context, in *ProtocolVersionRequest, opts ...grpc.CallOption) (*ProtocolVersionReply, error) // ClientVersion returns the Ethereum client version string using node name convention (e.g. TurboGeth/v2021.03.2-alpha/Linux). ClientVersion(ctx context.Context, in *ClientVersionRequest, opts ...grpc.CallOption) (*ClientVersionReply, error) - Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (ETHBACKEND_SubscribeClient, error) + Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SubscribeReply], error) // Only one subscription is needed to serve all the users, LogsFilterRequest allows to dynamically modifying the subscription - SubscribeLogs(ctx context.Context, opts ...grpc.CallOption) (ETHBACKEND_SubscribeLogsClient, error) + SubscribeLogs(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[LogsFilterRequest, SubscribeLogsReply], error) // High-level method - can read block from db, snapshots or apply any other logic // it doesn't provide consistency // Request fields are optional - it's ok to request block only by hash or only by number @@ -163,13 +163,13 @@ func (c *eTHBACKENDClient) ClientVersion(ctx context.Context, in *ClientVersionR return out, nil } -func (c *eTHBACKENDClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (ETHBACKEND_SubscribeClient, error) { +func (c *eTHBACKENDClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SubscribeReply], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, ÐBACKEND_ServiceDesc.Streams[0], ETHBACKEND_Subscribe_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &eTHBACKENDSubscribeClient{ClientStream: stream} + x := &grpc.GenericClientStream[SubscribeRequest, SubscribeReply]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -179,54 +179,21 @@ func (c *eTHBACKENDClient) Subscribe(ctx context.Context, in *SubscribeRequest, return x, nil } -type ETHBACKEND_SubscribeClient interface { - Recv() (*SubscribeReply, error) - grpc.ClientStream -} - -type eTHBACKENDSubscribeClient struct { - grpc.ClientStream -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ETHBACKEND_SubscribeClient = grpc.ServerStreamingClient[SubscribeReply] -func (x *eTHBACKENDSubscribeClient) Recv() (*SubscribeReply, error) { - m := new(SubscribeReply) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *eTHBACKENDClient) SubscribeLogs(ctx context.Context, opts ...grpc.CallOption) (ETHBACKEND_SubscribeLogsClient, error) { +func (c *eTHBACKENDClient) SubscribeLogs(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[LogsFilterRequest, SubscribeLogsReply], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, ÐBACKEND_ServiceDesc.Streams[1], ETHBACKEND_SubscribeLogs_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &eTHBACKENDSubscribeLogsClient{ClientStream: stream} + x := &grpc.GenericClientStream[LogsFilterRequest, SubscribeLogsReply]{ClientStream: stream} return x, nil } -type ETHBACKEND_SubscribeLogsClient interface { - Send(*LogsFilterRequest) error - Recv() (*SubscribeLogsReply, error) - grpc.ClientStream -} - -type eTHBACKENDSubscribeLogsClient struct { - grpc.ClientStream -} - -func (x *eTHBACKENDSubscribeLogsClient) Send(m *LogsFilterRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *eTHBACKENDSubscribeLogsClient) Recv() (*SubscribeLogsReply, error) { - m := new(SubscribeLogsReply) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ETHBACKEND_SubscribeLogsClient = grpc.BidiStreamingClient[LogsFilterRequest, SubscribeLogsReply] func (c *eTHBACKENDClient) Block(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (*BlockReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -340,7 +307,7 @@ func (c *eTHBACKENDClient) BorEvents(ctx context.Context, in *BorEventsRequest, // ETHBACKENDServer is the server API for ETHBACKEND service. // All implementations must embed UnimplementedETHBACKENDServer -// for forward compatibility +// for forward compatibility. type ETHBACKENDServer interface { Etherbase(context.Context, *EtherbaseRequest) (*EtherbaseReply, error) NetVersion(context.Context, *NetVersionRequest) (*NetVersionReply, error) @@ -353,9 +320,9 @@ type ETHBACKENDServer interface { ProtocolVersion(context.Context, *ProtocolVersionRequest) (*ProtocolVersionReply, error) // ClientVersion returns the Ethereum client version string using node name convention (e.g. TurboGeth/v2021.03.2-alpha/Linux). ClientVersion(context.Context, *ClientVersionRequest) (*ClientVersionReply, error) - Subscribe(*SubscribeRequest, ETHBACKEND_SubscribeServer) error + Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[SubscribeReply]) error // Only one subscription is needed to serve all the users, LogsFilterRequest allows to dynamically modifying the subscription - SubscribeLogs(ETHBACKEND_SubscribeLogsServer) error + SubscribeLogs(grpc.BidiStreamingServer[LogsFilterRequest, SubscribeLogsReply]) error // High-level method - can read block from db, snapshots or apply any other logic // it doesn't provide consistency // Request fields are optional - it's ok to request block only by hash or only by number @@ -381,9 +348,12 @@ type ETHBACKENDServer interface { mustEmbedUnimplementedETHBACKENDServer() } -// UnimplementedETHBACKENDServer must be embedded to have forward compatible implementations. -type UnimplementedETHBACKENDServer struct { -} +// UnimplementedETHBACKENDServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedETHBACKENDServer struct{} func (UnimplementedETHBACKENDServer) Etherbase(context.Context, *EtherbaseRequest) (*EtherbaseReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Etherbase not implemented") @@ -406,10 +376,10 @@ func (UnimplementedETHBACKENDServer) ProtocolVersion(context.Context, *ProtocolV func (UnimplementedETHBACKENDServer) ClientVersion(context.Context, *ClientVersionRequest) (*ClientVersionReply, error) { return nil, status.Errorf(codes.Unimplemented, "method ClientVersion not implemented") } -func (UnimplementedETHBACKENDServer) Subscribe(*SubscribeRequest, ETHBACKEND_SubscribeServer) error { +func (UnimplementedETHBACKENDServer) Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[SubscribeReply]) error { return status.Errorf(codes.Unimplemented, "method Subscribe not implemented") } -func (UnimplementedETHBACKENDServer) SubscribeLogs(ETHBACKEND_SubscribeLogsServer) error { +func (UnimplementedETHBACKENDServer) SubscribeLogs(grpc.BidiStreamingServer[LogsFilterRequest, SubscribeLogsReply]) error { return status.Errorf(codes.Unimplemented, "method SubscribeLogs not implemented") } func (UnimplementedETHBACKENDServer) Block(context.Context, *BlockRequest) (*BlockReply, error) { @@ -446,6 +416,7 @@ func (UnimplementedETHBACKENDServer) BorEvents(context.Context, *BorEventsReques return nil, status.Errorf(codes.Unimplemented, "method BorEvents not implemented") } func (UnimplementedETHBACKENDServer) mustEmbedUnimplementedETHBACKENDServer() {} +func (UnimplementedETHBACKENDServer) testEmbeddedByValue() {} // UnsafeETHBACKENDServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ETHBACKENDServer will @@ -455,6 +426,13 @@ type UnsafeETHBACKENDServer interface { } func RegisterETHBACKENDServer(s grpc.ServiceRegistrar, srv ETHBACKENDServer) { + // If the following call pancis, it indicates UnimplementedETHBACKENDServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(ÐBACKEND_ServiceDesc, srv) } @@ -589,47 +567,18 @@ func _ETHBACKEND_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) er if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ETHBACKENDServer).Subscribe(m, &eTHBACKENDSubscribeServer{ServerStream: stream}) -} - -type ETHBACKEND_SubscribeServer interface { - Send(*SubscribeReply) error - grpc.ServerStream + return srv.(ETHBACKENDServer).Subscribe(m, &grpc.GenericServerStream[SubscribeRequest, SubscribeReply]{ServerStream: stream}) } -type eTHBACKENDSubscribeServer struct { - grpc.ServerStream -} - -func (x *eTHBACKENDSubscribeServer) Send(m *SubscribeReply) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ETHBACKEND_SubscribeServer = grpc.ServerStreamingServer[SubscribeReply] func _ETHBACKEND_SubscribeLogs_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ETHBACKENDServer).SubscribeLogs(&eTHBACKENDSubscribeLogsServer{ServerStream: stream}) -} - -type ETHBACKEND_SubscribeLogsServer interface { - Send(*SubscribeLogsReply) error - Recv() (*LogsFilterRequest, error) - grpc.ServerStream -} - -type eTHBACKENDSubscribeLogsServer struct { - grpc.ServerStream -} - -func (x *eTHBACKENDSubscribeLogsServer) Send(m *SubscribeLogsReply) error { - return x.ServerStream.SendMsg(m) + return srv.(ETHBACKENDServer).SubscribeLogs(&grpc.GenericServerStream[LogsFilterRequest, SubscribeLogsReply]{ServerStream: stream}) } -func (x *eTHBACKENDSubscribeLogsServer) Recv() (*LogsFilterRequest, error) { - m := new(LogsFilterRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ETHBACKEND_SubscribeLogsServer = grpc.BidiStreamingServer[LogsFilterRequest, SubscribeLogsReply] func _ETHBACKEND_Block_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(BlockRequest) diff --git a/erigon-lib/gointerfaces/remoteproto/kv.pb.go b/erigon-lib/gointerfaces/remoteproto/kv.pb.go index 0af2893c155..1d8bed85ac9 100644 --- a/erigon-lib/gointerfaces/remoteproto/kv.pb.go +++ b/erigon-lib/gointerfaces/remoteproto/kv.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.1 +// protoc-gen-go v1.36.3 +// protoc v5.29.3 // source: remote/kv.proto package remoteproto @@ -218,24 +218,21 @@ func (Direction) EnumDescriptor() ([]byte, []int) { } type Cursor struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Op Op `protobuf:"varint,1,opt,name=op,proto3,enum=remote.Op" json:"op,omitempty"` + BucketName string `protobuf:"bytes,2,opt,name=bucket_name,json=bucketName,proto3" json:"bucket_name,omitempty"` + Cursor uint32 `protobuf:"varint,3,opt,name=cursor,proto3" json:"cursor,omitempty"` + K []byte `protobuf:"bytes,4,opt,name=k,proto3" json:"k,omitempty"` + V []byte `protobuf:"bytes,5,opt,name=v,proto3" json:"v,omitempty"` unknownFields protoimpl.UnknownFields - - Op Op `protobuf:"varint,1,opt,name=op,proto3,enum=remote.Op" json:"op,omitempty"` - BucketName string `protobuf:"bytes,2,opt,name=bucket_name,json=bucketName,proto3" json:"bucket_name,omitempty"` - Cursor uint32 `protobuf:"varint,3,opt,name=cursor,proto3" json:"cursor,omitempty"` - K []byte `protobuf:"bytes,4,opt,name=k,proto3" json:"k,omitempty"` - V []byte `protobuf:"bytes,5,opt,name=v,proto3" json:"v,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Cursor) Reset() { *x = Cursor{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Cursor) String() string { @@ -246,7 +243,7 @@ func (*Cursor) ProtoMessage() {} func (x *Cursor) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -297,24 +294,21 @@ func (x *Cursor) GetV() []byte { } type Pair struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + K []byte `protobuf:"bytes,1,opt,name=k,proto3" json:"k,omitempty"` + V []byte `protobuf:"bytes,2,opt,name=v,proto3" json:"v,omitempty"` + CursorId uint32 `protobuf:"varint,3,opt,name=cursor_id,json=cursorId,proto3" json:"cursor_id,omitempty"` // send once after new cursor open + ViewId uint64 `protobuf:"varint,4,opt,name=view_id,json=viewId,proto3" json:"view_id,omitempty"` // return once after tx open. mdbx's tx.ViewID() - id of write transaction in db + TxId uint64 `protobuf:"varint,5,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // return once after tx open. internal identifier - use it in other methods - to achieve consistent DB view (to read data from same DB tx on server). unknownFields protoimpl.UnknownFields - - K []byte `protobuf:"bytes,1,opt,name=k,proto3" json:"k,omitempty"` - V []byte `protobuf:"bytes,2,opt,name=v,proto3" json:"v,omitempty"` - CursorId uint32 `protobuf:"varint,3,opt,name=cursor_id,json=cursorId,proto3" json:"cursor_id,omitempty"` // send once after new cursor open - ViewId uint64 `protobuf:"varint,4,opt,name=view_id,json=viewId,proto3" json:"view_id,omitempty"` // return once after tx open. mdbx's tx.ViewID() - id of write transaction in db - TxId uint64 `protobuf:"varint,5,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // return once after tx open. internal identifier - use it in other methods - to achieve consistent DB view (to read data from same DB tx on server). + sizeCache protoimpl.SizeCache } func (x *Pair) Reset() { *x = Pair{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Pair) String() string { @@ -325,7 +319,7 @@ func (*Pair) ProtoMessage() {} func (x *Pair) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -376,21 +370,18 @@ func (x *Pair) GetTxId() uint64 { } type StorageChange struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Location *typesproto.H256 `protobuf:"bytes,1,opt,name=location,proto3" json:"location,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` unknownFields protoimpl.UnknownFields - - Location *typesproto.H256 `protobuf:"bytes,1,opt,name=location,proto3" json:"location,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + sizeCache protoimpl.SizeCache } func (x *StorageChange) Reset() { *x = StorageChange{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StorageChange) String() string { @@ -401,7 +392,7 @@ func (*StorageChange) ProtoMessage() {} func (x *StorageChange) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -431,25 +422,22 @@ func (x *StorageChange) GetData() []byte { } type AccountChange struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Address *typesproto.H160 `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Incarnation uint64 `protobuf:"varint,2,opt,name=incarnation,proto3" json:"incarnation,omitempty"` - Action Action `protobuf:"varint,3,opt,name=action,proto3,enum=remote.Action" json:"action,omitempty"` - Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` // nil if there is no UPSERT in action - Code []byte `protobuf:"bytes,5,opt,name=code,proto3" json:"code,omitempty"` // nil if there is no CODE in action - StorageChanges []*StorageChange `protobuf:"bytes,6,rep,name=storage_changes,json=storageChanges,proto3" json:"storage_changes,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Address *typesproto.H160 `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Incarnation uint64 `protobuf:"varint,2,opt,name=incarnation,proto3" json:"incarnation,omitempty"` + Action Action `protobuf:"varint,3,opt,name=action,proto3,enum=remote.Action" json:"action,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` // nil if there is no UPSERT in action + Code []byte `protobuf:"bytes,5,opt,name=code,proto3" json:"code,omitempty"` // nil if there is no CODE in action + StorageChanges []*StorageChange `protobuf:"bytes,6,rep,name=storage_changes,json=storageChanges,proto3" json:"storage_changes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AccountChange) Reset() { *x = AccountChange{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AccountChange) String() string { @@ -460,7 +448,7 @@ func (*AccountChange) ProtoMessage() {} func (x *AccountChange) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -519,25 +507,22 @@ func (x *AccountChange) GetStorageChanges() []*StorageChange { // StateChangeBatch - list of StateDiff done in one DB transaction type StateChangeBatch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - StateVersionId uint64 `protobuf:"varint,1,opt,name=state_version_id,json=stateVersionId,proto3" json:"state_version_id,omitempty"` // mdbx's tx.ID() - id of write transaction in db - where this changes happened - ChangeBatch []*StateChange `protobuf:"bytes,2,rep,name=change_batch,json=changeBatch,proto3" json:"change_batch,omitempty"` - PendingBlockBaseFee uint64 `protobuf:"varint,3,opt,name=pending_block_base_fee,json=pendingBlockBaseFee,proto3" json:"pending_block_base_fee,omitempty"` // BaseFee of the next block to be produced - BlockGasLimit uint64 `protobuf:"varint,4,opt,name=block_gas_limit,json=blockGasLimit,proto3" json:"block_gas_limit,omitempty"` // GasLimit of the latest block - proxy for the gas limit of the next block to be produced - FinalizedBlock uint64 `protobuf:"varint,5,opt,name=finalized_block,json=finalizedBlock,proto3" json:"finalized_block,omitempty"` - PendingBlobFeePerGas uint64 `protobuf:"varint,6,opt,name=pending_blob_fee_per_gas,json=pendingBlobFeePerGas,proto3" json:"pending_blob_fee_per_gas,omitempty"` // Base Blob Fee for the next block to be produced + state protoimpl.MessageState `protogen:"open.v1"` + StateVersionId uint64 `protobuf:"varint,1,opt,name=state_version_id,json=stateVersionId,proto3" json:"state_version_id,omitempty"` // mdbx's tx.ID() - id of write transaction in db - where this changes happened + ChangeBatch []*StateChange `protobuf:"bytes,2,rep,name=change_batch,json=changeBatch,proto3" json:"change_batch,omitempty"` + PendingBlockBaseFee uint64 `protobuf:"varint,3,opt,name=pending_block_base_fee,json=pendingBlockBaseFee,proto3" json:"pending_block_base_fee,omitempty"` // BaseFee of the next block to be produced + BlockGasLimit uint64 `protobuf:"varint,4,opt,name=block_gas_limit,json=blockGasLimit,proto3" json:"block_gas_limit,omitempty"` // GasLimit of the latest block - proxy for the gas limit of the next block to be produced + FinalizedBlock uint64 `protobuf:"varint,5,opt,name=finalized_block,json=finalizedBlock,proto3" json:"finalized_block,omitempty"` + PendingBlobFeePerGas uint64 `protobuf:"varint,6,opt,name=pending_blob_fee_per_gas,json=pendingBlobFeePerGas,proto3" json:"pending_blob_fee_per_gas,omitempty"` // Base Blob Fee for the next block to be produced + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *StateChangeBatch) Reset() { *x = StateChangeBatch{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StateChangeBatch) String() string { @@ -548,7 +533,7 @@ func (*StateChangeBatch) ProtoMessage() {} func (x *StateChangeBatch) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -607,24 +592,21 @@ func (x *StateChangeBatch) GetPendingBlobFeePerGas() uint64 { // StateChange - changes done by 1 block or by 1 unwind type StateChange struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Direction Direction `protobuf:"varint,1,opt,name=direction,proto3,enum=remote.Direction" json:"direction,omitempty"` + BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + BlockHash *typesproto.H256 `protobuf:"bytes,3,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + Changes []*AccountChange `protobuf:"bytes,4,rep,name=changes,proto3" json:"changes,omitempty"` + Txs [][]byte `protobuf:"bytes,5,rep,name=txs,proto3" json:"txs,omitempty"` // enable by withTransactions=true unknownFields protoimpl.UnknownFields - - Direction Direction `protobuf:"varint,1,opt,name=direction,proto3,enum=remote.Direction" json:"direction,omitempty"` - BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` - BlockHash *typesproto.H256 `protobuf:"bytes,3,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - Changes []*AccountChange `protobuf:"bytes,4,rep,name=changes,proto3" json:"changes,omitempty"` - Txs [][]byte `protobuf:"bytes,5,rep,name=txs,proto3" json:"txs,omitempty"` // enable by withTransactions=true + sizeCache protoimpl.SizeCache } func (x *StateChange) Reset() { *x = StateChange{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StateChange) String() string { @@ -635,7 +617,7 @@ func (*StateChange) ProtoMessage() {} func (x *StateChange) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -686,21 +668,18 @@ func (x *StateChange) GetTxs() [][]byte { } type StateChangeRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - WithStorage bool `protobuf:"varint,1,opt,name=with_storage,json=withStorage,proto3" json:"with_storage,omitempty"` - WithTransactions bool `protobuf:"varint,2,opt,name=with_transactions,json=withTransactions,proto3" json:"with_transactions,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + WithStorage bool `protobuf:"varint,1,opt,name=with_storage,json=withStorage,proto3" json:"with_storage,omitempty"` + WithTransactions bool `protobuf:"varint,2,opt,name=with_transactions,json=withTransactions,proto3" json:"with_transactions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *StateChangeRequest) Reset() { *x = StateChangeRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StateChangeRequest) String() string { @@ -711,7 +690,7 @@ func (*StateChangeRequest) ProtoMessage() {} func (x *StateChangeRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -741,18 +720,16 @@ func (x *StateChangeRequest) GetWithTransactions() bool { } type SnapshotsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *SnapshotsRequest) Reset() { *x = SnapshotsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SnapshotsRequest) String() string { @@ -763,7 +740,7 @@ func (*SnapshotsRequest) ProtoMessage() {} func (x *SnapshotsRequest) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -779,21 +756,18 @@ func (*SnapshotsRequest) Descriptor() ([]byte, []int) { } type SnapshotsReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + BlocksFiles []string `protobuf:"bytes,1,rep,name=blocks_files,json=blocksFiles,proto3" json:"blocks_files,omitempty"` + HistoryFiles []string `protobuf:"bytes,2,rep,name=history_files,json=historyFiles,proto3" json:"history_files,omitempty"` unknownFields protoimpl.UnknownFields - - BlocksFiles []string `protobuf:"bytes,1,rep,name=blocks_files,json=blocksFiles,proto3" json:"blocks_files,omitempty"` - HistoryFiles []string `protobuf:"bytes,2,rep,name=history_files,json=historyFiles,proto3" json:"history_files,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SnapshotsReply) Reset() { *x = SnapshotsReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SnapshotsReply) String() string { @@ -804,7 +778,7 @@ func (*SnapshotsReply) ProtoMessage() {} func (x *SnapshotsReply) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -834,11 +808,8 @@ func (x *SnapshotsReply) GetHistoryFiles() []string { } type RangeReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TxId uint64 `protobuf:"varint,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // returned by .Tx() + state protoimpl.MessageState `protogen:"open.v1"` + TxId uint64 `protobuf:"varint,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // returned by .Tx() // query params Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"` FromPrefix []byte `protobuf:"bytes,3,opt,name=from_prefix,json=fromPrefix,proto3" json:"from_prefix,omitempty"` @@ -846,17 +817,17 @@ type RangeReq struct { OrderAscend bool `protobuf:"varint,5,opt,name=order_ascend,json=orderAscend,proto3" json:"order_ascend,omitempty"` Limit int64 `protobuf:"zigzag64,6,opt,name=limit,proto3" json:"limit,omitempty"` // <= 0 means no limit // pagination params - PageSize int32 `protobuf:"varint,7,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // <= 0 means server will choose - PageToken string `protobuf:"bytes,8,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + PageSize int32 `protobuf:"varint,7,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // <= 0 means server will choose + PageToken string `protobuf:"bytes,8,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RangeReq) Reset() { *x = RangeReq{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *RangeReq) String() string { @@ -867,7 +838,7 @@ func (*RangeReq) ProtoMessage() {} func (x *RangeReq) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -940,26 +911,23 @@ func (x *RangeReq) GetPageToken() string { // Temporal methods type GetLatestReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TxId uint64 `protobuf:"varint,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // returned by .Tx() + state protoimpl.MessageState `protogen:"open.v1"` + TxId uint64 `protobuf:"varint,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // returned by .Tx() // query params - Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"` - K []byte `protobuf:"bytes,3,opt,name=k,proto3" json:"k,omitempty"` - Ts uint64 `protobuf:"varint,4,opt,name=ts,proto3" json:"ts,omitempty"` - K2 []byte `protobuf:"bytes,5,opt,name=k2,proto3" json:"k2,omitempty"` - Latest bool `protobuf:"varint,6,opt,name=latest,proto3" json:"latest,omitempty"` // if true, then `ts` ignored and return latest state (without history lookup) + Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"` + K []byte `protobuf:"bytes,3,opt,name=k,proto3" json:"k,omitempty"` + Ts uint64 `protobuf:"varint,4,opt,name=ts,proto3" json:"ts,omitempty"` + K2 []byte `protobuf:"bytes,5,opt,name=k2,proto3" json:"k2,omitempty"` + Latest bool `protobuf:"varint,6,opt,name=latest,proto3" json:"latest,omitempty"` // if true, then `ts` ignored and return latest state (without history lookup) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GetLatestReq) Reset() { *x = GetLatestReq{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetLatestReq) String() string { @@ -970,7 +938,7 @@ func (*GetLatestReq) ProtoMessage() {} func (x *GetLatestReq) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1028,21 +996,18 @@ func (x *GetLatestReq) GetLatest() bool { } type GetLatestReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + V []byte `protobuf:"bytes,1,opt,name=v,proto3" json:"v,omitempty"` + Ok bool `protobuf:"varint,2,opt,name=ok,proto3" json:"ok,omitempty"` unknownFields protoimpl.UnknownFields - - V []byte `protobuf:"bytes,1,opt,name=v,proto3" json:"v,omitempty"` - Ok bool `protobuf:"varint,2,opt,name=ok,proto3" json:"ok,omitempty"` + sizeCache protoimpl.SizeCache } func (x *GetLatestReply) Reset() { *x = GetLatestReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetLatestReply) String() string { @@ -1053,7 +1018,7 @@ func (*GetLatestReply) ProtoMessage() {} func (x *GetLatestReply) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1083,23 +1048,20 @@ func (x *GetLatestReply) GetOk() bool { } type HistorySeekReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + TxId uint64 `protobuf:"varint,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // returned by .Tx() + Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"` + K []byte `protobuf:"bytes,3,opt,name=k,proto3" json:"k,omitempty"` + Ts uint64 `protobuf:"varint,4,opt,name=ts,proto3" json:"ts,omitempty"` unknownFields protoimpl.UnknownFields - - TxId uint64 `protobuf:"varint,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // returned by .Tx() - Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"` - K []byte `protobuf:"bytes,3,opt,name=k,proto3" json:"k,omitempty"` - Ts uint64 `protobuf:"varint,4,opt,name=ts,proto3" json:"ts,omitempty"` + sizeCache protoimpl.SizeCache } func (x *HistorySeekReq) Reset() { *x = HistorySeekReq{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *HistorySeekReq) String() string { @@ -1110,7 +1072,7 @@ func (*HistorySeekReq) ProtoMessage() {} func (x *HistorySeekReq) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1154,21 +1116,18 @@ func (x *HistorySeekReq) GetTs() uint64 { } type HistorySeekReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + V []byte `protobuf:"bytes,1,opt,name=v,proto3" json:"v,omitempty"` + Ok bool `protobuf:"varint,2,opt,name=ok,proto3" json:"ok,omitempty"` unknownFields protoimpl.UnknownFields - - V []byte `protobuf:"bytes,1,opt,name=v,proto3" json:"v,omitempty"` - Ok bool `protobuf:"varint,2,opt,name=ok,proto3" json:"ok,omitempty"` + sizeCache protoimpl.SizeCache } func (x *HistorySeekReply) Reset() { *x = HistorySeekReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *HistorySeekReply) String() string { @@ -1179,7 +1138,7 @@ func (*HistorySeekReply) ProtoMessage() {} func (x *HistorySeekReply) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1209,11 +1168,8 @@ func (x *HistorySeekReply) GetOk() bool { } type IndexRangeReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TxId uint64 `protobuf:"varint,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // returned by .Tx() + state protoimpl.MessageState `protogen:"open.v1"` + TxId uint64 `protobuf:"varint,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // returned by .Tx() // query params Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"` K []byte `protobuf:"bytes,3,opt,name=k,proto3" json:"k,omitempty"` @@ -1222,17 +1178,17 @@ type IndexRangeReq struct { OrderAscend bool `protobuf:"varint,6,opt,name=order_ascend,json=orderAscend,proto3" json:"order_ascend,omitempty"` Limit int64 `protobuf:"zigzag64,7,opt,name=limit,proto3" json:"limit,omitempty"` // <= 0 means no limit // pagination params - PageSize int32 `protobuf:"varint,8,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // <= 0 means server will choose - PageToken string `protobuf:"bytes,9,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + PageSize int32 `protobuf:"varint,8,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // <= 0 means server will choose + PageToken string `protobuf:"bytes,9,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *IndexRangeReq) Reset() { *x = IndexRangeReq{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *IndexRangeReq) String() string { @@ -1243,7 +1199,7 @@ func (*IndexRangeReq) ProtoMessage() {} func (x *IndexRangeReq) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1322,21 +1278,18 @@ func (x *IndexRangeReq) GetPageToken() string { } type IndexRangeReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Timestamps []uint64 `protobuf:"varint,1,rep,packed,name=timestamps,proto3" json:"timestamps,omitempty"` //TODO: it can be a bitmap + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` unknownFields protoimpl.UnknownFields - - Timestamps []uint64 `protobuf:"varint,1,rep,packed,name=timestamps,proto3" json:"timestamps,omitempty"` //TODO: it can be a bitmap - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + sizeCache protoimpl.SizeCache } func (x *IndexRangeReply) Reset() { *x = IndexRangeReply{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *IndexRangeReply) String() string { @@ -1347,7 +1300,7 @@ func (*IndexRangeReply) ProtoMessage() {} func (x *IndexRangeReply) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1377,11 +1330,8 @@ func (x *IndexRangeReply) GetNextPageToken() string { } type HistoryRangeReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TxId uint64 `protobuf:"varint,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // returned by .Tx() + state protoimpl.MessageState `protogen:"open.v1"` + TxId uint64 `protobuf:"varint,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // returned by .Tx() // query params Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"` FromTs int64 `protobuf:"zigzag64,4,opt,name=from_ts,json=fromTs,proto3" json:"from_ts,omitempty"` // -1 means Inf @@ -1389,17 +1339,17 @@ type HistoryRangeReq struct { OrderAscend bool `protobuf:"varint,6,opt,name=order_ascend,json=orderAscend,proto3" json:"order_ascend,omitempty"` Limit int64 `protobuf:"zigzag64,7,opt,name=limit,proto3" json:"limit,omitempty"` // <= 0 means no limit // pagination params - PageSize int32 `protobuf:"varint,8,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // <= 0 means server will choose - PageToken string `protobuf:"bytes,9,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + PageSize int32 `protobuf:"varint,8,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // <= 0 means server will choose + PageToken string `protobuf:"bytes,9,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *HistoryRangeReq) Reset() { *x = HistoryRangeReq{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *HistoryRangeReq) String() string { @@ -1410,7 +1360,7 @@ func (*HistoryRangeReq) ProtoMessage() {} func (x *HistoryRangeReq) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1482,11 +1432,8 @@ func (x *HistoryRangeReq) GetPageToken() string { } type RangeAsOfReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TxId uint64 `protobuf:"varint,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // returned by .Tx() + state protoimpl.MessageState `protogen:"open.v1"` + TxId uint64 `protobuf:"varint,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` // returned by .Tx() // query params Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"` FromKey []byte `protobuf:"bytes,3,opt,name=from_key,json=fromKey,proto3" json:"from_key,omitempty"` // nil means Inf @@ -1496,17 +1443,17 @@ type RangeAsOfReq struct { OrderAscend bool `protobuf:"varint,7,opt,name=order_ascend,json=orderAscend,proto3" json:"order_ascend,omitempty"` Limit int64 `protobuf:"zigzag64,8,opt,name=limit,proto3" json:"limit,omitempty"` // <= 0 means no limit // pagination params - PageSize int32 `protobuf:"varint,9,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // <= 0 means server will choose - PageToken string `protobuf:"bytes,10,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + PageSize int32 `protobuf:"varint,9,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // <= 0 means server will choose + PageToken string `protobuf:"bytes,10,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RangeAsOfReq) Reset() { *x = RangeAsOfReq{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *RangeAsOfReq) String() string { @@ -1517,7 +1464,7 @@ func (*RangeAsOfReq) ProtoMessage() {} func (x *RangeAsOfReq) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1603,22 +1550,19 @@ func (x *RangeAsOfReq) GetPageToken() string { } type Pairs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Keys [][]byte `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"` // TODO: replace by lengtsh+arena? Anyway on server we need copy (serialization happening outside tx) + Values [][]byte `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` + NextPageToken string `protobuf:"bytes,3,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` // uint32 estimateTotal = 3; // send once after stream creation unknownFields protoimpl.UnknownFields - - Keys [][]byte `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"` // TODO: replace by lengtsh+arena? Anyway on server we need copy (serialization happening outside tx) - Values [][]byte `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` - NextPageToken string `protobuf:"bytes,3,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` // uint32 estimateTotal = 3; // send once after stream creation + sizeCache protoimpl.SizeCache } func (x *Pairs) Reset() { *x = Pairs{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Pairs) String() string { @@ -1629,7 +1573,7 @@ func (*Pairs) ProtoMessage() {} func (x *Pairs) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1666,21 +1610,18 @@ func (x *Pairs) GetNextPageToken() string { } type PairsPagination struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + NextKey []byte `protobuf:"bytes,1,opt,name=next_key,json=nextKey,proto3" json:"next_key,omitempty"` + Limit int64 `protobuf:"zigzag64,2,opt,name=limit,proto3" json:"limit,omitempty"` unknownFields protoimpl.UnknownFields - - NextKey []byte `protobuf:"bytes,1,opt,name=next_key,json=nextKey,proto3" json:"next_key,omitempty"` - Limit int64 `protobuf:"zigzag64,2,opt,name=limit,proto3" json:"limit,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PairsPagination) Reset() { *x = PairsPagination{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PairsPagination) String() string { @@ -1691,7 +1632,7 @@ func (*PairsPagination) ProtoMessage() {} func (x *PairsPagination) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1721,21 +1662,18 @@ func (x *PairsPagination) GetLimit() int64 { } type IndexPagination struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + NextTimeStamp int64 `protobuf:"zigzag64,1,opt,name=next_time_stamp,json=nextTimeStamp,proto3" json:"next_time_stamp,omitempty"` + Limit int64 `protobuf:"zigzag64,2,opt,name=limit,proto3" json:"limit,omitempty"` unknownFields protoimpl.UnknownFields - - NextTimeStamp int64 `protobuf:"zigzag64,1,opt,name=next_time_stamp,json=nextTimeStamp,proto3" json:"next_time_stamp,omitempty"` - Limit int64 `protobuf:"zigzag64,2,opt,name=limit,proto3" json:"limit,omitempty"` + sizeCache protoimpl.SizeCache } func (x *IndexPagination) Reset() { *x = IndexPagination{} - if protoimpl.UnsafeEnabled { - mi := &file_remote_kv_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_remote_kv_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *IndexPagination) String() string { @@ -1746,7 +1684,7 @@ func (*IndexPagination) ProtoMessage() {} func (x *IndexPagination) ProtoReflect() protoreflect.Message { mi := &file_remote_kv_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2113,260 +2051,6 @@ func file_remote_kv_proto_init() { if File_remote_kv_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_remote_kv_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*Cursor); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*Pair); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*StorageChange); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*AccountChange); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*StateChangeBatch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*StateChange); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*StateChangeRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*SnapshotsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*SnapshotsReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*RangeReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*GetLatestReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*GetLatestReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*HistorySeekReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*HistorySeekReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*IndexRangeReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[15].Exporter = func(v any, i int) any { - switch v := v.(*IndexRangeReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[16].Exporter = func(v any, i int) any { - switch v := v.(*HistoryRangeReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[17].Exporter = func(v any, i int) any { - switch v := v.(*RangeAsOfReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[18].Exporter = func(v any, i int) any { - switch v := v.(*Pairs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[19].Exporter = func(v any, i int) any { - switch v := v.(*PairsPagination); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_remote_kv_proto_msgTypes[20].Exporter = func(v any, i int) any { - switch v := v.(*IndexPagination); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/erigon-lib/gointerfaces/remoteproto/kv_client_mock.go b/erigon-lib/gointerfaces/remoteproto/kv_client_mock.go index ae80abfd688..ec6878eea3a 100644 --- a/erigon-lib/gointerfaces/remoteproto/kv_client_mock.go +++ b/erigon-lib/gointerfaces/remoteproto/kv_client_mock.go @@ -352,14 +352,14 @@ func (c *MockKVClientSnapshotsCall) DoAndReturn(f func(context.Context, *Snapsho } // StateChanges mocks base method. -func (m *MockKVClient) StateChanges(ctx context.Context, in *StateChangeRequest, opts ...grpc.CallOption) (KV_StateChangesClient, error) { +func (m *MockKVClient) StateChanges(ctx context.Context, in *StateChangeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StateChangeBatch], error) { m.ctrl.T.Helper() varargs := []any{ctx, in} for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "StateChanges", varargs...) - ret0, _ := ret[0].(KV_StateChangesClient) + ret0, _ := ret[0].(grpc.ServerStreamingClient[StateChangeBatch]) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -378,32 +378,32 @@ type MockKVClientStateChangesCall struct { } // Return rewrite *gomock.Call.Return -func (c *MockKVClientStateChangesCall) Return(arg0 KV_StateChangesClient, arg1 error) *MockKVClientStateChangesCall { +func (c *MockKVClientStateChangesCall) Return(arg0 grpc.ServerStreamingClient[StateChangeBatch], arg1 error) *MockKVClientStateChangesCall { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *MockKVClientStateChangesCall) Do(f func(context.Context, *StateChangeRequest, ...grpc.CallOption) (KV_StateChangesClient, error)) *MockKVClientStateChangesCall { +func (c *MockKVClientStateChangesCall) Do(f func(context.Context, *StateChangeRequest, ...grpc.CallOption) (grpc.ServerStreamingClient[StateChangeBatch], error)) *MockKVClientStateChangesCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockKVClientStateChangesCall) DoAndReturn(f func(context.Context, *StateChangeRequest, ...grpc.CallOption) (KV_StateChangesClient, error)) *MockKVClientStateChangesCall { +func (c *MockKVClientStateChangesCall) DoAndReturn(f func(context.Context, *StateChangeRequest, ...grpc.CallOption) (grpc.ServerStreamingClient[StateChangeBatch], error)) *MockKVClientStateChangesCall { c.Call = c.Call.DoAndReturn(f) return c } // Tx mocks base method. -func (m *MockKVClient) Tx(ctx context.Context, opts ...grpc.CallOption) (KV_TxClient, error) { +func (m *MockKVClient) Tx(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Cursor, Pair], error) { m.ctrl.T.Helper() varargs := []any{ctx} for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "Tx", varargs...) - ret0, _ := ret[0].(KV_TxClient) + ret0, _ := ret[0].(grpc.BidiStreamingClient[Cursor, Pair]) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -422,19 +422,19 @@ type MockKVClientTxCall struct { } // Return rewrite *gomock.Call.Return -func (c *MockKVClientTxCall) Return(arg0 KV_TxClient, arg1 error) *MockKVClientTxCall { +func (c *MockKVClientTxCall) Return(arg0 grpc.BidiStreamingClient[Cursor, Pair], arg1 error) *MockKVClientTxCall { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *MockKVClientTxCall) Do(f func(context.Context, ...grpc.CallOption) (KV_TxClient, error)) *MockKVClientTxCall { +func (c *MockKVClientTxCall) Do(f func(context.Context, ...grpc.CallOption) (grpc.BidiStreamingClient[Cursor, Pair], error)) *MockKVClientTxCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockKVClientTxCall) DoAndReturn(f func(context.Context, ...grpc.CallOption) (KV_TxClient, error)) *MockKVClientTxCall { +func (c *MockKVClientTxCall) DoAndReturn(f func(context.Context, ...grpc.CallOption) (grpc.BidiStreamingClient[Cursor, Pair], error)) *MockKVClientTxCall { c.Call = c.Call.DoAndReturn(f) return c } diff --git a/erigon-lib/gointerfaces/remoteproto/kv_grpc.pb.go b/erigon-lib/gointerfaces/remoteproto/kv_grpc.pb.go index 8179df4b950..95513469db1 100644 --- a/erigon-lib/gointerfaces/remoteproto/kv_grpc.pb.go +++ b/erigon-lib/gointerfaces/remoteproto/kv_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.1 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 // source: remote/kv.proto package remoteproto @@ -17,8 +17,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( KV_Version_FullMethodName = "/remote.KV/Version" @@ -46,8 +46,8 @@ type KVClient interface { // When tx open, client must receive 1 message from server with txID // When cursor open, client must receive 1 message from server with cursorID // Then only client can initiate messages from server - Tx(ctx context.Context, opts ...grpc.CallOption) (KV_TxClient, error) - StateChanges(ctx context.Context, in *StateChangeRequest, opts ...grpc.CallOption) (KV_StateChangesClient, error) + Tx(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Cursor, Pair], error) + StateChanges(ctx context.Context, in *StateChangeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StateChangeBatch], error) // Snapshots returns list of current snapshot files. Then client can just open all of them. Snapshots(ctx context.Context, in *SnapshotsRequest, opts ...grpc.CallOption) (*SnapshotsReply, error) // Range [from, to) @@ -81,45 +81,26 @@ func (c *kVClient) Version(ctx context.Context, in *emptypb.Empty, opts ...grpc. return out, nil } -func (c *kVClient) Tx(ctx context.Context, opts ...grpc.CallOption) (KV_TxClient, error) { +func (c *kVClient) Tx(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Cursor, Pair], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &KV_ServiceDesc.Streams[0], KV_Tx_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &kVTxClient{ClientStream: stream} + x := &grpc.GenericClientStream[Cursor, Pair]{ClientStream: stream} return x, nil } -type KV_TxClient interface { - Send(*Cursor) error - Recv() (*Pair, error) - grpc.ClientStream -} - -type kVTxClient struct { - grpc.ClientStream -} - -func (x *kVTxClient) Send(m *Cursor) error { - return x.ClientStream.SendMsg(m) -} - -func (x *kVTxClient) Recv() (*Pair, error) { - m := new(Pair) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type KV_TxClient = grpc.BidiStreamingClient[Cursor, Pair] -func (c *kVClient) StateChanges(ctx context.Context, in *StateChangeRequest, opts ...grpc.CallOption) (KV_StateChangesClient, error) { +func (c *kVClient) StateChanges(ctx context.Context, in *StateChangeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StateChangeBatch], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &KV_ServiceDesc.Streams[1], KV_StateChanges_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &kVStateChangesClient{ClientStream: stream} + x := &grpc.GenericClientStream[StateChangeRequest, StateChangeBatch]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -129,22 +110,8 @@ func (c *kVClient) StateChanges(ctx context.Context, in *StateChangeRequest, opt return x, nil } -type KV_StateChangesClient interface { - Recv() (*StateChangeBatch, error) - grpc.ClientStream -} - -type kVStateChangesClient struct { - grpc.ClientStream -} - -func (x *kVStateChangesClient) Recv() (*StateChangeBatch, error) { - m := new(StateChangeBatch) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type KV_StateChangesClient = grpc.ServerStreamingClient[StateChangeBatch] func (c *kVClient) Snapshots(ctx context.Context, in *SnapshotsRequest, opts ...grpc.CallOption) (*SnapshotsReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -218,7 +185,7 @@ func (c *kVClient) RangeAsOf(ctx context.Context, in *RangeAsOfReq, opts ...grpc // KVServer is the server API for KV service. // All implementations must embed UnimplementedKVServer -// for forward compatibility +// for forward compatibility. // // Provides methods to access key-value data type KVServer interface { @@ -229,8 +196,8 @@ type KVServer interface { // When tx open, client must receive 1 message from server with txID // When cursor open, client must receive 1 message from server with cursorID // Then only client can initiate messages from server - Tx(KV_TxServer) error - StateChanges(*StateChangeRequest, KV_StateChangesServer) error + Tx(grpc.BidiStreamingServer[Cursor, Pair]) error + StateChanges(*StateChangeRequest, grpc.ServerStreamingServer[StateChangeBatch]) error // Snapshots returns list of current snapshot files. Then client can just open all of them. Snapshots(context.Context, *SnapshotsRequest) (*SnapshotsReply, error) // Range [from, to) @@ -247,17 +214,20 @@ type KVServer interface { mustEmbedUnimplementedKVServer() } -// UnimplementedKVServer must be embedded to have forward compatible implementations. -type UnimplementedKVServer struct { -} +// UnimplementedKVServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedKVServer struct{} func (UnimplementedKVServer) Version(context.Context, *emptypb.Empty) (*typesproto.VersionReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") } -func (UnimplementedKVServer) Tx(KV_TxServer) error { +func (UnimplementedKVServer) Tx(grpc.BidiStreamingServer[Cursor, Pair]) error { return status.Errorf(codes.Unimplemented, "method Tx not implemented") } -func (UnimplementedKVServer) StateChanges(*StateChangeRequest, KV_StateChangesServer) error { +func (UnimplementedKVServer) StateChanges(*StateChangeRequest, grpc.ServerStreamingServer[StateChangeBatch]) error { return status.Errorf(codes.Unimplemented, "method StateChanges not implemented") } func (UnimplementedKVServer) Snapshots(context.Context, *SnapshotsRequest) (*SnapshotsReply, error) { @@ -282,6 +252,7 @@ func (UnimplementedKVServer) RangeAsOf(context.Context, *RangeAsOfReq) (*Pairs, return nil, status.Errorf(codes.Unimplemented, "method RangeAsOf not implemented") } func (UnimplementedKVServer) mustEmbedUnimplementedKVServer() {} +func (UnimplementedKVServer) testEmbeddedByValue() {} // UnsafeKVServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to KVServer will @@ -291,6 +262,13 @@ type UnsafeKVServer interface { } func RegisterKVServer(s grpc.ServiceRegistrar, srv KVServer) { + // If the following call pancis, it indicates UnimplementedKVServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&KV_ServiceDesc, srv) } @@ -313,51 +291,22 @@ func _KV_Version_Handler(srv interface{}, ctx context.Context, dec func(interfac } func _KV_Tx_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(KVServer).Tx(&kVTxServer{ServerStream: stream}) -} - -type KV_TxServer interface { - Send(*Pair) error - Recv() (*Cursor, error) - grpc.ServerStream -} - -type kVTxServer struct { - grpc.ServerStream -} - -func (x *kVTxServer) Send(m *Pair) error { - return x.ServerStream.SendMsg(m) + return srv.(KVServer).Tx(&grpc.GenericServerStream[Cursor, Pair]{ServerStream: stream}) } -func (x *kVTxServer) Recv() (*Cursor, error) { - m := new(Cursor) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type KV_TxServer = grpc.BidiStreamingServer[Cursor, Pair] func _KV_StateChanges_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(StateChangeRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(KVServer).StateChanges(m, &kVStateChangesServer{ServerStream: stream}) -} - -type KV_StateChangesServer interface { - Send(*StateChangeBatch) error - grpc.ServerStream -} - -type kVStateChangesServer struct { - grpc.ServerStream + return srv.(KVServer).StateChanges(m, &grpc.GenericServerStream[StateChangeRequest, StateChangeBatch]{ServerStream: stream}) } -func (x *kVStateChangesServer) Send(m *StateChangeBatch) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type KV_StateChangesServer = grpc.ServerStreamingServer[StateChangeBatch] func _KV_Snapshots_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SnapshotsRequest) diff --git a/erigon-lib/gointerfaces/remoteproto/kv_state_changes_client_mock.go b/erigon-lib/gointerfaces/remoteproto/kv_state_changes_client_mock.go index 01b9a4a304e..74ae0ec24ec 100644 --- a/erigon-lib/gointerfaces/remoteproto/kv_state_changes_client_mock.go +++ b/erigon-lib/gointerfaces/remoteproto/kv_state_changes_client_mock.go @@ -18,31 +18,31 @@ import ( ) // MockKV_StateChangesClient is a mock of KV_StateChangesClient interface. -type MockKV_StateChangesClient struct { +type MockKV_StateChangesClient[Res any] struct { ctrl *gomock.Controller - recorder *MockKV_StateChangesClientMockRecorder + recorder *MockKV_StateChangesClientMockRecorder[Res] isgomock struct{} } // MockKV_StateChangesClientMockRecorder is the mock recorder for MockKV_StateChangesClient. -type MockKV_StateChangesClientMockRecorder struct { - mock *MockKV_StateChangesClient +type MockKV_StateChangesClientMockRecorder[Res any] struct { + mock *MockKV_StateChangesClient[Res] } // NewMockKV_StateChangesClient creates a new mock instance. -func NewMockKV_StateChangesClient(ctrl *gomock.Controller) *MockKV_StateChangesClient { - mock := &MockKV_StateChangesClient{ctrl: ctrl} - mock.recorder = &MockKV_StateChangesClientMockRecorder{mock} +func NewMockKV_StateChangesClient[Res any](ctrl *gomock.Controller) *MockKV_StateChangesClient[Res] { + mock := &MockKV_StateChangesClient[Res]{ctrl: ctrl} + mock.recorder = &MockKV_StateChangesClientMockRecorder[Res]{mock} return mock } // EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockKV_StateChangesClient) EXPECT() *MockKV_StateChangesClientMockRecorder { +func (m *MockKV_StateChangesClient[Res]) EXPECT() *MockKV_StateChangesClientMockRecorder[Res] { return m.recorder } // CloseSend mocks base method. -func (m *MockKV_StateChangesClient) CloseSend() error { +func (m *MockKV_StateChangesClient[Res]) CloseSend() error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CloseSend") ret0, _ := ret[0].(error) @@ -50,37 +50,37 @@ func (m *MockKV_StateChangesClient) CloseSend() error { } // CloseSend indicates an expected call of CloseSend. -func (mr *MockKV_StateChangesClientMockRecorder) CloseSend() *MockKV_StateChangesClientCloseSendCall { +func (mr *MockKV_StateChangesClientMockRecorder[Res]) CloseSend() *MockKV_StateChangesClientCloseSendCall[Res] { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockKV_StateChangesClient)(nil).CloseSend)) - return &MockKV_StateChangesClientCloseSendCall{Call: call} + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockKV_StateChangesClient[Res])(nil).CloseSend)) + return &MockKV_StateChangesClientCloseSendCall[Res]{Call: call} } // MockKV_StateChangesClientCloseSendCall wrap *gomock.Call -type MockKV_StateChangesClientCloseSendCall struct { +type MockKV_StateChangesClientCloseSendCall[Res any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *MockKV_StateChangesClientCloseSendCall) Return(arg0 error) *MockKV_StateChangesClientCloseSendCall { +func (c *MockKV_StateChangesClientCloseSendCall[Res]) Return(arg0 error) *MockKV_StateChangesClientCloseSendCall[Res] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *MockKV_StateChangesClientCloseSendCall) Do(f func() error) *MockKV_StateChangesClientCloseSendCall { +func (c *MockKV_StateChangesClientCloseSendCall[Res]) Do(f func() error) *MockKV_StateChangesClientCloseSendCall[Res] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockKV_StateChangesClientCloseSendCall) DoAndReturn(f func() error) *MockKV_StateChangesClientCloseSendCall { +func (c *MockKV_StateChangesClientCloseSendCall[Res]) DoAndReturn(f func() error) *MockKV_StateChangesClientCloseSendCall[Res] { c.Call = c.Call.DoAndReturn(f) return c } // Context mocks base method. -func (m *MockKV_StateChangesClient) Context() context.Context { +func (m *MockKV_StateChangesClient[Res]) Context() context.Context { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Context") ret0, _ := ret[0].(context.Context) @@ -88,37 +88,37 @@ func (m *MockKV_StateChangesClient) Context() context.Context { } // Context indicates an expected call of Context. -func (mr *MockKV_StateChangesClientMockRecorder) Context() *MockKV_StateChangesClientContextCall { +func (mr *MockKV_StateChangesClientMockRecorder[Res]) Context() *MockKV_StateChangesClientContextCall[Res] { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockKV_StateChangesClient)(nil).Context)) - return &MockKV_StateChangesClientContextCall{Call: call} + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockKV_StateChangesClient[Res])(nil).Context)) + return &MockKV_StateChangesClientContextCall[Res]{Call: call} } // MockKV_StateChangesClientContextCall wrap *gomock.Call -type MockKV_StateChangesClientContextCall struct { +type MockKV_StateChangesClientContextCall[Res any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *MockKV_StateChangesClientContextCall) Return(arg0 context.Context) *MockKV_StateChangesClientContextCall { +func (c *MockKV_StateChangesClientContextCall[Res]) Return(arg0 context.Context) *MockKV_StateChangesClientContextCall[Res] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *MockKV_StateChangesClientContextCall) Do(f func() context.Context) *MockKV_StateChangesClientContextCall { +func (c *MockKV_StateChangesClientContextCall[Res]) Do(f func() context.Context) *MockKV_StateChangesClientContextCall[Res] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockKV_StateChangesClientContextCall) DoAndReturn(f func() context.Context) *MockKV_StateChangesClientContextCall { +func (c *MockKV_StateChangesClientContextCall[Res]) DoAndReturn(f func() context.Context) *MockKV_StateChangesClientContextCall[Res] { c.Call = c.Call.DoAndReturn(f) return c } // Header mocks base method. -func (m *MockKV_StateChangesClient) Header() (metadata.MD, error) { +func (m *MockKV_StateChangesClient[Res]) Header() (metadata.MD, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Header") ret0, _ := ret[0].(metadata.MD) @@ -127,37 +127,37 @@ func (m *MockKV_StateChangesClient) Header() (metadata.MD, error) { } // Header indicates an expected call of Header. -func (mr *MockKV_StateChangesClientMockRecorder) Header() *MockKV_StateChangesClientHeaderCall { +func (mr *MockKV_StateChangesClientMockRecorder[Res]) Header() *MockKV_StateChangesClientHeaderCall[Res] { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockKV_StateChangesClient)(nil).Header)) - return &MockKV_StateChangesClientHeaderCall{Call: call} + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockKV_StateChangesClient[Res])(nil).Header)) + return &MockKV_StateChangesClientHeaderCall[Res]{Call: call} } // MockKV_StateChangesClientHeaderCall wrap *gomock.Call -type MockKV_StateChangesClientHeaderCall struct { +type MockKV_StateChangesClientHeaderCall[Res any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *MockKV_StateChangesClientHeaderCall) Return(arg0 metadata.MD, arg1 error) *MockKV_StateChangesClientHeaderCall { +func (c *MockKV_StateChangesClientHeaderCall[Res]) Return(arg0 metadata.MD, arg1 error) *MockKV_StateChangesClientHeaderCall[Res] { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *MockKV_StateChangesClientHeaderCall) Do(f func() (metadata.MD, error)) *MockKV_StateChangesClientHeaderCall { +func (c *MockKV_StateChangesClientHeaderCall[Res]) Do(f func() (metadata.MD, error)) *MockKV_StateChangesClientHeaderCall[Res] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockKV_StateChangesClientHeaderCall) DoAndReturn(f func() (metadata.MD, error)) *MockKV_StateChangesClientHeaderCall { +func (c *MockKV_StateChangesClientHeaderCall[Res]) DoAndReturn(f func() (metadata.MD, error)) *MockKV_StateChangesClientHeaderCall[Res] { c.Call = c.Call.DoAndReturn(f) return c } // Recv mocks base method. -func (m *MockKV_StateChangesClient) Recv() (*StateChangeBatch, error) { +func (m *MockKV_StateChangesClient[Res]) Recv() (*StateChangeBatch, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Recv") ret0, _ := ret[0].(*StateChangeBatch) @@ -166,37 +166,37 @@ func (m *MockKV_StateChangesClient) Recv() (*StateChangeBatch, error) { } // Recv indicates an expected call of Recv. -func (mr *MockKV_StateChangesClientMockRecorder) Recv() *MockKV_StateChangesClientRecvCall { +func (mr *MockKV_StateChangesClientMockRecorder[Res]) Recv() *MockKV_StateChangesClientRecvCall[Res] { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockKV_StateChangesClient)(nil).Recv)) - return &MockKV_StateChangesClientRecvCall{Call: call} + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockKV_StateChangesClient[Res])(nil).Recv)) + return &MockKV_StateChangesClientRecvCall[Res]{Call: call} } // MockKV_StateChangesClientRecvCall wrap *gomock.Call -type MockKV_StateChangesClientRecvCall struct { +type MockKV_StateChangesClientRecvCall[Res any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *MockKV_StateChangesClientRecvCall) Return(arg0 *StateChangeBatch, arg1 error) *MockKV_StateChangesClientRecvCall { +func (c *MockKV_StateChangesClientRecvCall[Res]) Return(arg0 *StateChangeBatch, arg1 error) *MockKV_StateChangesClientRecvCall[Res] { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *MockKV_StateChangesClientRecvCall) Do(f func() (*StateChangeBatch, error)) *MockKV_StateChangesClientRecvCall { +func (c *MockKV_StateChangesClientRecvCall[Res]) Do(f func() (*StateChangeBatch, error)) *MockKV_StateChangesClientRecvCall[Res] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockKV_StateChangesClientRecvCall) DoAndReturn(f func() (*StateChangeBatch, error)) *MockKV_StateChangesClientRecvCall { +func (c *MockKV_StateChangesClientRecvCall[Res]) DoAndReturn(f func() (*StateChangeBatch, error)) *MockKV_StateChangesClientRecvCall[Res] { c.Call = c.Call.DoAndReturn(f) return c } // RecvMsg mocks base method. -func (m_2 *MockKV_StateChangesClient) RecvMsg(m any) error { +func (m_2 *MockKV_StateChangesClient[Res]) RecvMsg(m any) error { m_2.ctrl.T.Helper() ret := m_2.ctrl.Call(m_2, "RecvMsg", m) ret0, _ := ret[0].(error) @@ -204,37 +204,37 @@ func (m_2 *MockKV_StateChangesClient) RecvMsg(m any) error { } // RecvMsg indicates an expected call of RecvMsg. -func (mr *MockKV_StateChangesClientMockRecorder) RecvMsg(m any) *MockKV_StateChangesClientRecvMsgCall { +func (mr *MockKV_StateChangesClientMockRecorder[Res]) RecvMsg(m any) *MockKV_StateChangesClientRecvMsgCall[Res] { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockKV_StateChangesClient)(nil).RecvMsg), m) - return &MockKV_StateChangesClientRecvMsgCall{Call: call} + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockKV_StateChangesClient[Res])(nil).RecvMsg), m) + return &MockKV_StateChangesClientRecvMsgCall[Res]{Call: call} } // MockKV_StateChangesClientRecvMsgCall wrap *gomock.Call -type MockKV_StateChangesClientRecvMsgCall struct { +type MockKV_StateChangesClientRecvMsgCall[Res any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *MockKV_StateChangesClientRecvMsgCall) Return(arg0 error) *MockKV_StateChangesClientRecvMsgCall { +func (c *MockKV_StateChangesClientRecvMsgCall[Res]) Return(arg0 error) *MockKV_StateChangesClientRecvMsgCall[Res] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *MockKV_StateChangesClientRecvMsgCall) Do(f func(any) error) *MockKV_StateChangesClientRecvMsgCall { +func (c *MockKV_StateChangesClientRecvMsgCall[Res]) Do(f func(any) error) *MockKV_StateChangesClientRecvMsgCall[Res] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockKV_StateChangesClientRecvMsgCall) DoAndReturn(f func(any) error) *MockKV_StateChangesClientRecvMsgCall { +func (c *MockKV_StateChangesClientRecvMsgCall[Res]) DoAndReturn(f func(any) error) *MockKV_StateChangesClientRecvMsgCall[Res] { c.Call = c.Call.DoAndReturn(f) return c } // SendMsg mocks base method. -func (m_2 *MockKV_StateChangesClient) SendMsg(m any) error { +func (m_2 *MockKV_StateChangesClient[Res]) SendMsg(m any) error { m_2.ctrl.T.Helper() ret := m_2.ctrl.Call(m_2, "SendMsg", m) ret0, _ := ret[0].(error) @@ -242,37 +242,37 @@ func (m_2 *MockKV_StateChangesClient) SendMsg(m any) error { } // SendMsg indicates an expected call of SendMsg. -func (mr *MockKV_StateChangesClientMockRecorder) SendMsg(m any) *MockKV_StateChangesClientSendMsgCall { +func (mr *MockKV_StateChangesClientMockRecorder[Res]) SendMsg(m any) *MockKV_StateChangesClientSendMsgCall[Res] { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockKV_StateChangesClient)(nil).SendMsg), m) - return &MockKV_StateChangesClientSendMsgCall{Call: call} + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockKV_StateChangesClient[Res])(nil).SendMsg), m) + return &MockKV_StateChangesClientSendMsgCall[Res]{Call: call} } // MockKV_StateChangesClientSendMsgCall wrap *gomock.Call -type MockKV_StateChangesClientSendMsgCall struct { +type MockKV_StateChangesClientSendMsgCall[Res any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *MockKV_StateChangesClientSendMsgCall) Return(arg0 error) *MockKV_StateChangesClientSendMsgCall { +func (c *MockKV_StateChangesClientSendMsgCall[Res]) Return(arg0 error) *MockKV_StateChangesClientSendMsgCall[Res] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *MockKV_StateChangesClientSendMsgCall) Do(f func(any) error) *MockKV_StateChangesClientSendMsgCall { +func (c *MockKV_StateChangesClientSendMsgCall[Res]) Do(f func(any) error) *MockKV_StateChangesClientSendMsgCall[Res] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockKV_StateChangesClientSendMsgCall) DoAndReturn(f func(any) error) *MockKV_StateChangesClientSendMsgCall { +func (c *MockKV_StateChangesClientSendMsgCall[Res]) DoAndReturn(f func(any) error) *MockKV_StateChangesClientSendMsgCall[Res] { c.Call = c.Call.DoAndReturn(f) return c } // Trailer mocks base method. -func (m *MockKV_StateChangesClient) Trailer() metadata.MD { +func (m *MockKV_StateChangesClient[Res]) Trailer() metadata.MD { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Trailer") ret0, _ := ret[0].(metadata.MD) @@ -280,31 +280,31 @@ func (m *MockKV_StateChangesClient) Trailer() metadata.MD { } // Trailer indicates an expected call of Trailer. -func (mr *MockKV_StateChangesClientMockRecorder) Trailer() *MockKV_StateChangesClientTrailerCall { +func (mr *MockKV_StateChangesClientMockRecorder[Res]) Trailer() *MockKV_StateChangesClientTrailerCall[Res] { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockKV_StateChangesClient)(nil).Trailer)) - return &MockKV_StateChangesClientTrailerCall{Call: call} + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockKV_StateChangesClient[Res])(nil).Trailer)) + return &MockKV_StateChangesClientTrailerCall[Res]{Call: call} } // MockKV_StateChangesClientTrailerCall wrap *gomock.Call -type MockKV_StateChangesClientTrailerCall struct { +type MockKV_StateChangesClientTrailerCall[Res any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *MockKV_StateChangesClientTrailerCall) Return(arg0 metadata.MD) *MockKV_StateChangesClientTrailerCall { +func (c *MockKV_StateChangesClientTrailerCall[Res]) Return(arg0 metadata.MD) *MockKV_StateChangesClientTrailerCall[Res] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *MockKV_StateChangesClientTrailerCall) Do(f func() metadata.MD) *MockKV_StateChangesClientTrailerCall { +func (c *MockKV_StateChangesClientTrailerCall[Res]) Do(f func() metadata.MD) *MockKV_StateChangesClientTrailerCall[Res] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockKV_StateChangesClientTrailerCall) DoAndReturn(f func() metadata.MD) *MockKV_StateChangesClientTrailerCall { +func (c *MockKV_StateChangesClientTrailerCall[Res]) DoAndReturn(f func() metadata.MD) *MockKV_StateChangesClientTrailerCall[Res] { c.Call = c.Call.DoAndReturn(f) return c } diff --git a/erigon-lib/gointerfaces/sentinelproto/sentinel.pb.go b/erigon-lib/gointerfaces/sentinelproto/sentinel.pb.go index 5091a59a93b..52448fc1155 100644 --- a/erigon-lib/gointerfaces/sentinelproto/sentinel.pb.go +++ b/erigon-lib/gointerfaces/sentinelproto/sentinel.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.1 +// protoc-gen-go v1.36.3 +// protoc v5.29.3 // source: p2psentinel/sentinel.proto package sentinelproto @@ -22,18 +22,16 @@ const ( ) type EmptyMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *EmptyMessage) Reset() { *x = EmptyMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentinel_sentinel_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentinel_sentinel_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EmptyMessage) String() string { @@ -44,7 +42,7 @@ func (*EmptyMessage) ProtoMessage() {} func (x *EmptyMessage) ProtoReflect() protoreflect.Message { mi := &file_p2psentinel_sentinel_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -60,20 +58,17 @@ func (*EmptyMessage) Descriptor() ([]byte, []int) { } type SubscriptionData struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Filter *string `protobuf:"bytes,1,opt,name=filter,proto3,oneof" json:"filter,omitempty"` unknownFields protoimpl.UnknownFields - - Filter *string `protobuf:"bytes,1,opt,name=filter,proto3,oneof" json:"filter,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SubscriptionData) Reset() { *x = SubscriptionData{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentinel_sentinel_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentinel_sentinel_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SubscriptionData) String() string { @@ -84,7 +79,7 @@ func (*SubscriptionData) ProtoMessage() {} func (x *SubscriptionData) ProtoReflect() protoreflect.Message { mi := &file_p2psentinel_sentinel_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -107,25 +102,22 @@ func (x *SubscriptionData) GetFilter() string { } type Peer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Pid string `protobuf:"bytes,1,opt,name=pid,proto3" json:"pid,omitempty"` + State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` + Direction string `protobuf:"bytes,3,opt,name=direction,proto3" json:"direction,omitempty"` + Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"` + Enr string `protobuf:"bytes,5,opt,name=enr,proto3" json:"enr,omitempty"` + AgentVersion string `protobuf:"bytes,6,opt,name=agent_version,json=agentVersion,proto3" json:"agent_version,omitempty"` unknownFields protoimpl.UnknownFields - - Pid string `protobuf:"bytes,1,opt,name=pid,proto3" json:"pid,omitempty"` - State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` - Direction string `protobuf:"bytes,3,opt,name=direction,proto3" json:"direction,omitempty"` - Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"` - Enr string `protobuf:"bytes,5,opt,name=enr,proto3" json:"enr,omitempty"` - AgentVersion string `protobuf:"bytes,6,opt,name=agent_version,json=agentVersion,proto3" json:"agent_version,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Peer) Reset() { *x = Peer{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentinel_sentinel_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentinel_sentinel_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Peer) String() string { @@ -136,7 +128,7 @@ func (*Peer) ProtoMessage() {} func (x *Peer) ProtoReflect() protoreflect.Message { mi := &file_p2psentinel_sentinel_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -194,21 +186,18 @@ func (x *Peer) GetAgentVersion() string { } type PeersInfoRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Direction *string `protobuf:"bytes,1,opt,name=direction,proto3,oneof" json:"direction,omitempty"` + State *string `protobuf:"bytes,2,opt,name=state,proto3,oneof" json:"state,omitempty"` unknownFields protoimpl.UnknownFields - - Direction *string `protobuf:"bytes,1,opt,name=direction,proto3,oneof" json:"direction,omitempty"` - State *string `protobuf:"bytes,2,opt,name=state,proto3,oneof" json:"state,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PeersInfoRequest) Reset() { *x = PeersInfoRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentinel_sentinel_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentinel_sentinel_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeersInfoRequest) String() string { @@ -219,7 +208,7 @@ func (*PeersInfoRequest) ProtoMessage() {} func (x *PeersInfoRequest) ProtoReflect() protoreflect.Message { mi := &file_p2psentinel_sentinel_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -249,20 +238,17 @@ func (x *PeersInfoRequest) GetState() string { } type PeersInfoResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Peers []*Peer `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"` unknownFields protoimpl.UnknownFields - - Peers []*Peer `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PeersInfoResponse) Reset() { *x = PeersInfoResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentinel_sentinel_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentinel_sentinel_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeersInfoResponse) String() string { @@ -273,7 +259,7 @@ func (*PeersInfoResponse) ProtoMessage() {} func (x *PeersInfoResponse) ProtoReflect() protoreflect.Message { mi := &file_p2psentinel_sentinel_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -296,23 +282,20 @@ func (x *PeersInfoResponse) GetPeers() []*Peer { } type GossipData struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // SSZ encoded data + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Peer *Peer `protobuf:"bytes,3,opt,name=peer,proto3,oneof" json:"peer,omitempty"` + SubnetId *uint64 `protobuf:"varint,4,opt,name=subnet_id,json=subnetId,proto3,oneof" json:"subnet_id,omitempty"` unknownFields protoimpl.UnknownFields - - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // SSZ encoded data - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Peer *Peer `protobuf:"bytes,3,opt,name=peer,proto3,oneof" json:"peer,omitempty"` - SubnetId *uint64 `protobuf:"varint,4,opt,name=subnet_id,json=subnetId,proto3,oneof" json:"subnet_id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *GossipData) Reset() { *x = GossipData{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentinel_sentinel_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentinel_sentinel_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GossipData) String() string { @@ -323,7 +306,7 @@ func (*GossipData) ProtoMessage() {} func (x *GossipData) ProtoReflect() protoreflect.Message { mi := &file_p2psentinel_sentinel_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -367,24 +350,21 @@ func (x *GossipData) GetSubnetId() uint64 { } type Status struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ForkDigest uint32 `protobuf:"varint,1,opt,name=fork_digest,json=forkDigest,proto3" json:"fork_digest,omitempty"` // 4 bytes can be repressented in uint32. - FinalizedRoot *typesproto.H256 `protobuf:"bytes,2,opt,name=finalized_root,json=finalizedRoot,proto3" json:"finalized_root,omitempty"` - FinalizedEpoch uint64 `protobuf:"varint,3,opt,name=finalized_epoch,json=finalizedEpoch,proto3" json:"finalized_epoch,omitempty"` - HeadRoot *typesproto.H256 `protobuf:"bytes,4,opt,name=head_root,json=headRoot,proto3" json:"head_root,omitempty"` - HeadSlot uint64 `protobuf:"varint,5,opt,name=head_slot,json=headSlot,proto3" json:"head_slot,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + ForkDigest uint32 `protobuf:"varint,1,opt,name=fork_digest,json=forkDigest,proto3" json:"fork_digest,omitempty"` // 4 bytes can be repressented in uint32. + FinalizedRoot *typesproto.H256 `protobuf:"bytes,2,opt,name=finalized_root,json=finalizedRoot,proto3" json:"finalized_root,omitempty"` + FinalizedEpoch uint64 `protobuf:"varint,3,opt,name=finalized_epoch,json=finalizedEpoch,proto3" json:"finalized_epoch,omitempty"` + HeadRoot *typesproto.H256 `protobuf:"bytes,4,opt,name=head_root,json=headRoot,proto3" json:"head_root,omitempty"` + HeadSlot uint64 `protobuf:"varint,5,opt,name=head_slot,json=headSlot,proto3" json:"head_slot,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Status) Reset() { *x = Status{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentinel_sentinel_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentinel_sentinel_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Status) String() string { @@ -395,7 +375,7 @@ func (*Status) ProtoMessage() {} func (x *Status) ProtoReflect() protoreflect.Message { mi := &file_p2psentinel_sentinel_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -446,24 +426,21 @@ func (x *Status) GetHeadSlot() uint64 { } type PeerCount struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Active uint64 `protobuf:"varint,1,opt,name=active,proto3" json:"active,omitempty"` // Amount of peers that are active. + Connected uint64 `protobuf:"varint,2,opt,name=connected,proto3" json:"connected,omitempty"` + Disconnected uint64 `protobuf:"varint,3,opt,name=disconnected,proto3" json:"disconnected,omitempty"` + Connecting uint64 `protobuf:"varint,4,opt,name=connecting,proto3" json:"connecting,omitempty"` + Disconnecting uint64 `protobuf:"varint,5,opt,name=disconnecting,proto3" json:"disconnecting,omitempty"` unknownFields protoimpl.UnknownFields - - Active uint64 `protobuf:"varint,1,opt,name=active,proto3" json:"active,omitempty"` // Amount of peers that are active. - Connected uint64 `protobuf:"varint,2,opt,name=connected,proto3" json:"connected,omitempty"` - Disconnected uint64 `protobuf:"varint,3,opt,name=disconnected,proto3" json:"disconnected,omitempty"` - Connecting uint64 `protobuf:"varint,4,opt,name=connecting,proto3" json:"connecting,omitempty"` - Disconnecting uint64 `protobuf:"varint,5,opt,name=disconnecting,proto3" json:"disconnecting,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PeerCount) Reset() { *x = PeerCount{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentinel_sentinel_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentinel_sentinel_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeerCount) String() string { @@ -474,7 +451,7 @@ func (*PeerCount) ProtoMessage() {} func (x *PeerCount) ProtoReflect() protoreflect.Message { mi := &file_p2psentinel_sentinel_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -525,21 +502,18 @@ func (x *PeerCount) GetDisconnecting() uint64 { } type RequestData struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // SSZ encoded data + Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"` unknownFields protoimpl.UnknownFields - - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // SSZ encoded data - Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"` + sizeCache protoimpl.SizeCache } func (x *RequestData) Reset() { *x = RequestData{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentinel_sentinel_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentinel_sentinel_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *RequestData) String() string { @@ -550,7 +524,7 @@ func (*RequestData) ProtoMessage() {} func (x *RequestData) ProtoReflect() protoreflect.Message { mi := &file_p2psentinel_sentinel_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -580,22 +554,19 @@ func (x *RequestData) GetTopic() string { } type ResponseData struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // prefix-stripped SSZ encoded data + Error bool `protobuf:"varint,2,opt,name=error,proto3" json:"error,omitempty"` // did the peer encounter an error + Peer *Peer `protobuf:"bytes,3,opt,name=peer,proto3" json:"peer,omitempty"` unknownFields protoimpl.UnknownFields - - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // prefix-stripped SSZ encoded data - Error bool `protobuf:"varint,2,opt,name=error,proto3" json:"error,omitempty"` // did the peer encounter an error - Peer *Peer `protobuf:"bytes,3,opt,name=peer,proto3" json:"peer,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ResponseData) Reset() { *x = ResponseData{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentinel_sentinel_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentinel_sentinel_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ResponseData) String() string { @@ -606,7 +577,7 @@ func (*ResponseData) ProtoMessage() {} func (x *ResponseData) ProtoReflect() protoreflect.Message { mi := &file_p2psentinel_sentinel_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -643,22 +614,19 @@ func (x *ResponseData) GetPeer() *Peer { } type Metadata struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` + Attnets string `protobuf:"bytes,2,opt,name=attnets,proto3" json:"attnets,omitempty"` + Syncnets string `protobuf:"bytes,3,opt,name=syncnets,proto3" json:"syncnets,omitempty"` unknownFields protoimpl.UnknownFields - - Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` - Attnets string `protobuf:"bytes,2,opt,name=attnets,proto3" json:"attnets,omitempty"` - Syncnets string `protobuf:"bytes,3,opt,name=syncnets,proto3" json:"syncnets,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Metadata) Reset() { *x = Metadata{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentinel_sentinel_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentinel_sentinel_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Metadata) String() string { @@ -669,7 +637,7 @@ func (*Metadata) ProtoMessage() {} func (x *Metadata) ProtoReflect() protoreflect.Message { mi := &file_p2psentinel_sentinel_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -706,24 +674,21 @@ func (x *Metadata) GetSyncnets() string { } type IdentityResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Pid string `protobuf:"bytes,1,opt,name=pid,proto3" json:"pid,omitempty"` - Enr string `protobuf:"bytes,2,opt,name=enr,proto3" json:"enr,omitempty"` - P2PAddresses []string `protobuf:"bytes,3,rep,name=p2p_addresses,json=p2pAddresses,proto3" json:"p2p_addresses,omitempty"` - DiscoveryAddresses []string `protobuf:"bytes,4,rep,name=discovery_addresses,json=discoveryAddresses,proto3" json:"discovery_addresses,omitempty"` - Metadata *Metadata `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Pid string `protobuf:"bytes,1,opt,name=pid,proto3" json:"pid,omitempty"` + Enr string `protobuf:"bytes,2,opt,name=enr,proto3" json:"enr,omitempty"` + P2PAddresses []string `protobuf:"bytes,3,rep,name=p2p_addresses,json=p2pAddresses,proto3" json:"p2p_addresses,omitempty"` + DiscoveryAddresses []string `protobuf:"bytes,4,rep,name=discovery_addresses,json=discoveryAddresses,proto3" json:"discovery_addresses,omitempty"` + Metadata *Metadata `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *IdentityResponse) Reset() { *x = IdentityResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentinel_sentinel_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentinel_sentinel_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *IdentityResponse) String() string { @@ -734,7 +699,7 @@ func (*IdentityResponse) ProtoMessage() {} func (x *IdentityResponse) ProtoReflect() protoreflect.Message { mi := &file_p2psentinel_sentinel_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -785,21 +750,18 @@ func (x *IdentityResponse) GetMetadata() *Metadata { } type RequestSubscribeExpiry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` - ExpiryUnixSecs uint64 `protobuf:"varint,2,opt,name=expiry_unix_secs,json=expiryUnixSecs,proto3" json:"expiry_unix_secs,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` + ExpiryUnixSecs uint64 `protobuf:"varint,2,opt,name=expiry_unix_secs,json=expiryUnixSecs,proto3" json:"expiry_unix_secs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RequestSubscribeExpiry) Reset() { *x = RequestSubscribeExpiry{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentinel_sentinel_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentinel_sentinel_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *RequestSubscribeExpiry) String() string { @@ -810,7 +772,7 @@ func (*RequestSubscribeExpiry) ProtoMessage() {} func (x *RequestSubscribeExpiry) ProtoReflect() protoreflect.Message { mi := &file_p2psentinel_sentinel_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1060,164 +1022,6 @@ func file_p2psentinel_sentinel_proto_init() { if File_p2psentinel_sentinel_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_p2psentinel_sentinel_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*EmptyMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentinel_sentinel_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*SubscriptionData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentinel_sentinel_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*Peer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentinel_sentinel_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*PeersInfoRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentinel_sentinel_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*PeersInfoResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentinel_sentinel_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*GossipData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentinel_sentinel_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*Status); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentinel_sentinel_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*PeerCount); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentinel_sentinel_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*RequestData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentinel_sentinel_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*ResponseData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentinel_sentinel_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*Metadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentinel_sentinel_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*IdentityResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentinel_sentinel_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*RequestSubscribeExpiry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } file_p2psentinel_sentinel_proto_msgTypes[1].OneofWrappers = []any{} file_p2psentinel_sentinel_proto_msgTypes[3].OneofWrappers = []any{} file_p2psentinel_sentinel_proto_msgTypes[5].OneofWrappers = []any{} diff --git a/erigon-lib/gointerfaces/sentinelproto/sentinel_grpc.pb.go b/erigon-lib/gointerfaces/sentinelproto/sentinel_grpc.pb.go index eb3d26c3912..c5af7c2f68f 100644 --- a/erigon-lib/gointerfaces/sentinelproto/sentinel_grpc.pb.go +++ b/erigon-lib/gointerfaces/sentinelproto/sentinel_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.1 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 // source: p2psentinel/sentinel.proto package sentinelproto @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Sentinel_SetSubscribeExpiry_FullMethodName = "/sentinel.Sentinel/SetSubscribeExpiry" @@ -38,7 +38,7 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type SentinelClient interface { SetSubscribeExpiry(ctx context.Context, in *RequestSubscribeExpiry, opts ...grpc.CallOption) (*EmptyMessage, error) - SubscribeGossip(ctx context.Context, in *SubscriptionData, opts ...grpc.CallOption) (Sentinel_SubscribeGossipClient, error) + SubscribeGossip(ctx context.Context, in *SubscriptionData, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GossipData], error) SendRequest(ctx context.Context, in *RequestData, opts ...grpc.CallOption) (*ResponseData, error) SetStatus(ctx context.Context, in *Status, opts ...grpc.CallOption) (*EmptyMessage, error) GetPeers(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*PeerCount, error) @@ -69,13 +69,13 @@ func (c *sentinelClient) SetSubscribeExpiry(ctx context.Context, in *RequestSubs return out, nil } -func (c *sentinelClient) SubscribeGossip(ctx context.Context, in *SubscriptionData, opts ...grpc.CallOption) (Sentinel_SubscribeGossipClient, error) { +func (c *sentinelClient) SubscribeGossip(ctx context.Context, in *SubscriptionData, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GossipData], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Sentinel_ServiceDesc.Streams[0], Sentinel_SubscribeGossip_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &sentinelSubscribeGossipClient{ClientStream: stream} + x := &grpc.GenericClientStream[SubscriptionData, GossipData]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -85,22 +85,8 @@ func (c *sentinelClient) SubscribeGossip(ctx context.Context, in *SubscriptionDa return x, nil } -type Sentinel_SubscribeGossipClient interface { - Recv() (*GossipData, error) - grpc.ClientStream -} - -type sentinelSubscribeGossipClient struct { - grpc.ClientStream -} - -func (x *sentinelSubscribeGossipClient) Recv() (*GossipData, error) { - m := new(GossipData) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Sentinel_SubscribeGossipClient = grpc.ServerStreamingClient[GossipData] func (c *sentinelClient) SendRequest(ctx context.Context, in *RequestData, opts ...grpc.CallOption) (*ResponseData, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -204,10 +190,10 @@ func (c *sentinelClient) PeersInfo(ctx context.Context, in *PeersInfoRequest, op // SentinelServer is the server API for Sentinel service. // All implementations must embed UnimplementedSentinelServer -// for forward compatibility +// for forward compatibility. type SentinelServer interface { SetSubscribeExpiry(context.Context, *RequestSubscribeExpiry) (*EmptyMessage, error) - SubscribeGossip(*SubscriptionData, Sentinel_SubscribeGossipServer) error + SubscribeGossip(*SubscriptionData, grpc.ServerStreamingServer[GossipData]) error SendRequest(context.Context, *RequestData) (*ResponseData, error) SetStatus(context.Context, *Status) (*EmptyMessage, error) GetPeers(context.Context, *EmptyMessage) (*PeerCount, error) @@ -221,14 +207,17 @@ type SentinelServer interface { mustEmbedUnimplementedSentinelServer() } -// UnimplementedSentinelServer must be embedded to have forward compatible implementations. -type UnimplementedSentinelServer struct { -} +// UnimplementedSentinelServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSentinelServer struct{} func (UnimplementedSentinelServer) SetSubscribeExpiry(context.Context, *RequestSubscribeExpiry) (*EmptyMessage, error) { return nil, status.Errorf(codes.Unimplemented, "method SetSubscribeExpiry not implemented") } -func (UnimplementedSentinelServer) SubscribeGossip(*SubscriptionData, Sentinel_SubscribeGossipServer) error { +func (UnimplementedSentinelServer) SubscribeGossip(*SubscriptionData, grpc.ServerStreamingServer[GossipData]) error { return status.Errorf(codes.Unimplemented, "method SubscribeGossip not implemented") } func (UnimplementedSentinelServer) SendRequest(context.Context, *RequestData) (*ResponseData, error) { @@ -262,6 +251,7 @@ func (UnimplementedSentinelServer) PeersInfo(context.Context, *PeersInfoRequest) return nil, status.Errorf(codes.Unimplemented, "method PeersInfo not implemented") } func (UnimplementedSentinelServer) mustEmbedUnimplementedSentinelServer() {} +func (UnimplementedSentinelServer) testEmbeddedByValue() {} // UnsafeSentinelServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SentinelServer will @@ -271,6 +261,13 @@ type UnsafeSentinelServer interface { } func RegisterSentinelServer(s grpc.ServiceRegistrar, srv SentinelServer) { + // If the following call pancis, it indicates UnimplementedSentinelServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Sentinel_ServiceDesc, srv) } @@ -297,21 +294,11 @@ func _Sentinel_SubscribeGossip_Handler(srv interface{}, stream grpc.ServerStream if err := stream.RecvMsg(m); err != nil { return err } - return srv.(SentinelServer).SubscribeGossip(m, &sentinelSubscribeGossipServer{ServerStream: stream}) -} - -type Sentinel_SubscribeGossipServer interface { - Send(*GossipData) error - grpc.ServerStream + return srv.(SentinelServer).SubscribeGossip(m, &grpc.GenericServerStream[SubscriptionData, GossipData]{ServerStream: stream}) } -type sentinelSubscribeGossipServer struct { - grpc.ServerStream -} - -func (x *sentinelSubscribeGossipServer) Send(m *GossipData) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Sentinel_SubscribeGossipServer = grpc.ServerStreamingServer[GossipData] func _Sentinel_SendRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(RequestData) diff --git a/erigon-lib/gointerfaces/sentryproto/sentry.pb.go b/erigon-lib/gointerfaces/sentryproto/sentry.pb.go index 583cbde354f..b3408a33d3e 100644 --- a/erigon-lib/gointerfaces/sentryproto/sentry.pb.go +++ b/erigon-lib/gointerfaces/sentryproto/sentry.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.1 +// protoc-gen-go v1.36.3 +// protoc v5.29.3 // source: p2psentry/sentry.proto package sentryproto @@ -305,21 +305,18 @@ func (PeerEvent_PeerEventId) EnumDescriptor() ([]byte, []int) { } type OutboundMessageData struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Id MessageId `protobuf:"varint,1,opt,name=id,proto3,enum=sentry.MessageId" json:"id,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` unknownFields protoimpl.UnknownFields - - Id MessageId `protobuf:"varint,1,opt,name=id,proto3,enum=sentry.MessageId" json:"id,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + sizeCache protoimpl.SizeCache } func (x *OutboundMessageData) Reset() { *x = OutboundMessageData{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *OutboundMessageData) String() string { @@ -330,7 +327,7 @@ func (*OutboundMessageData) ProtoMessage() {} func (x *OutboundMessageData) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -360,22 +357,19 @@ func (x *OutboundMessageData) GetData() []byte { } type SendMessageByMinBlockRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Data *OutboundMessageData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + MinBlock uint64 `protobuf:"varint,2,opt,name=min_block,json=minBlock,proto3" json:"min_block,omitempty"` + MaxPeers uint64 `protobuf:"varint,3,opt,name=max_peers,json=maxPeers,proto3" json:"max_peers,omitempty"` unknownFields protoimpl.UnknownFields - - Data *OutboundMessageData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - MinBlock uint64 `protobuf:"varint,2,opt,name=min_block,json=minBlock,proto3" json:"min_block,omitempty"` - MaxPeers uint64 `protobuf:"varint,3,opt,name=max_peers,json=maxPeers,proto3" json:"max_peers,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SendMessageByMinBlockRequest) Reset() { *x = SendMessageByMinBlockRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SendMessageByMinBlockRequest) String() string { @@ -386,7 +380,7 @@ func (*SendMessageByMinBlockRequest) ProtoMessage() {} func (x *SendMessageByMinBlockRequest) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -423,21 +417,18 @@ func (x *SendMessageByMinBlockRequest) GetMaxPeers() uint64 { } type SendMessageByIdRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Data *OutboundMessageData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + PeerId *typesproto.H512 `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` unknownFields protoimpl.UnknownFields - - Data *OutboundMessageData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - PeerId *typesproto.H512 `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SendMessageByIdRequest) Reset() { *x = SendMessageByIdRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SendMessageByIdRequest) String() string { @@ -448,7 +439,7 @@ func (*SendMessageByIdRequest) ProtoMessage() {} func (x *SendMessageByIdRequest) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -478,21 +469,18 @@ func (x *SendMessageByIdRequest) GetPeerId() *typesproto.H512 { } type SendMessageToRandomPeersRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Data *OutboundMessageData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + MaxPeers uint64 `protobuf:"varint,2,opt,name=max_peers,json=maxPeers,proto3" json:"max_peers,omitempty"` unknownFields protoimpl.UnknownFields - - Data *OutboundMessageData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - MaxPeers uint64 `protobuf:"varint,2,opt,name=max_peers,json=maxPeers,proto3" json:"max_peers,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SendMessageToRandomPeersRequest) Reset() { *x = SendMessageToRandomPeersRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SendMessageToRandomPeersRequest) String() string { @@ -503,7 +491,7 @@ func (*SendMessageToRandomPeersRequest) ProtoMessage() {} func (x *SendMessageToRandomPeersRequest) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -533,20 +521,17 @@ func (x *SendMessageToRandomPeersRequest) GetMaxPeers() uint64 { } type SentPeers struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Peers []*typesproto.H512 `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"` unknownFields protoimpl.UnknownFields - - Peers []*typesproto.H512 `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SentPeers) Reset() { *x = SentPeers{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SentPeers) String() string { @@ -557,7 +542,7 @@ func (*SentPeers) ProtoMessage() {} func (x *SentPeers) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -580,21 +565,18 @@ func (x *SentPeers) GetPeers() []*typesproto.H512 { } type PenalizePeerRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + PeerId *typesproto.H512 `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + Penalty PenaltyKind `protobuf:"varint,2,opt,name=penalty,proto3,enum=sentry.PenaltyKind" json:"penalty,omitempty"` unknownFields protoimpl.UnknownFields - - PeerId *typesproto.H512 `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` - Penalty PenaltyKind `protobuf:"varint,2,opt,name=penalty,proto3,enum=sentry.PenaltyKind" json:"penalty,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PenalizePeerRequest) Reset() { *x = PenalizePeerRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PenalizePeerRequest) String() string { @@ -605,7 +587,7 @@ func (*PenalizePeerRequest) ProtoMessage() {} func (x *PenalizePeerRequest) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -635,21 +617,18 @@ func (x *PenalizePeerRequest) GetPenalty() PenaltyKind { } type PeerMinBlockRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + PeerId *typesproto.H512 `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + MinBlock uint64 `protobuf:"varint,2,opt,name=min_block,json=minBlock,proto3" json:"min_block,omitempty"` unknownFields protoimpl.UnknownFields - - PeerId *typesproto.H512 `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` - MinBlock uint64 `protobuf:"varint,2,opt,name=min_block,json=minBlock,proto3" json:"min_block,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PeerMinBlockRequest) Reset() { *x = PeerMinBlockRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeerMinBlockRequest) String() string { @@ -660,7 +639,7 @@ func (*PeerMinBlockRequest) ProtoMessage() {} func (x *PeerMinBlockRequest) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -690,20 +669,17 @@ func (x *PeerMinBlockRequest) GetMinBlock() uint64 { } type AddPeerRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AddPeerRequest) Reset() { *x = AddPeerRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AddPeerRequest) String() string { @@ -714,7 +690,7 @@ func (*AddPeerRequest) ProtoMessage() {} func (x *AddPeerRequest) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -737,22 +713,19 @@ func (x *AddPeerRequest) GetUrl() string { } type InboundMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Id MessageId `protobuf:"varint,1,opt,name=id,proto3,enum=sentry.MessageId" json:"id,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + PeerId *typesproto.H512 `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` unknownFields protoimpl.UnknownFields - - Id MessageId `protobuf:"varint,1,opt,name=id,proto3,enum=sentry.MessageId" json:"id,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - PeerId *typesproto.H512 `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *InboundMessage) Reset() { *x = InboundMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *InboundMessage) String() string { @@ -763,7 +736,7 @@ func (*InboundMessage) ProtoMessage() {} func (x *InboundMessage) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -800,22 +773,19 @@ func (x *InboundMessage) GetPeerId() *typesproto.H512 { } type Forks struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Genesis *typesproto.H256 `protobuf:"bytes,1,opt,name=genesis,proto3" json:"genesis,omitempty"` + HeightForks []uint64 `protobuf:"varint,2,rep,packed,name=height_forks,json=heightForks,proto3" json:"height_forks,omitempty"` + TimeForks []uint64 `protobuf:"varint,3,rep,packed,name=time_forks,json=timeForks,proto3" json:"time_forks,omitempty"` unknownFields protoimpl.UnknownFields - - Genesis *typesproto.H256 `protobuf:"bytes,1,opt,name=genesis,proto3" json:"genesis,omitempty"` - HeightForks []uint64 `protobuf:"varint,2,rep,packed,name=height_forks,json=heightForks,proto3" json:"height_forks,omitempty"` - TimeForks []uint64 `protobuf:"varint,3,rep,packed,name=time_forks,json=timeForks,proto3" json:"time_forks,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Forks) Reset() { *x = Forks{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Forks) String() string { @@ -826,7 +796,7 @@ func (*Forks) ProtoMessage() {} func (x *Forks) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -863,25 +833,22 @@ func (x *Forks) GetTimeForks() []uint64 { } type StatusData struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NetworkId uint64 `protobuf:"varint,1,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"` - TotalDifficulty *typesproto.H256 `protobuf:"bytes,2,opt,name=total_difficulty,json=totalDifficulty,proto3" json:"total_difficulty,omitempty"` - BestHash *typesproto.H256 `protobuf:"bytes,3,opt,name=best_hash,json=bestHash,proto3" json:"best_hash,omitempty"` - ForkData *Forks `protobuf:"bytes,4,opt,name=fork_data,json=forkData,proto3" json:"fork_data,omitempty"` - MaxBlockHeight uint64 `protobuf:"varint,5,opt,name=max_block_height,json=maxBlockHeight,proto3" json:"max_block_height,omitempty"` - MaxBlockTime uint64 `protobuf:"varint,6,opt,name=max_block_time,json=maxBlockTime,proto3" json:"max_block_time,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + NetworkId uint64 `protobuf:"varint,1,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"` + TotalDifficulty *typesproto.H256 `protobuf:"bytes,2,opt,name=total_difficulty,json=totalDifficulty,proto3" json:"total_difficulty,omitempty"` + BestHash *typesproto.H256 `protobuf:"bytes,3,opt,name=best_hash,json=bestHash,proto3" json:"best_hash,omitempty"` + ForkData *Forks `protobuf:"bytes,4,opt,name=fork_data,json=forkData,proto3" json:"fork_data,omitempty"` + MaxBlockHeight uint64 `protobuf:"varint,5,opt,name=max_block_height,json=maxBlockHeight,proto3" json:"max_block_height,omitempty"` + MaxBlockTime uint64 `protobuf:"varint,6,opt,name=max_block_time,json=maxBlockTime,proto3" json:"max_block_time,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *StatusData) Reset() { *x = StatusData{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StatusData) String() string { @@ -892,7 +859,7 @@ func (*StatusData) ProtoMessage() {} func (x *StatusData) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -950,18 +917,16 @@ func (x *StatusData) GetMaxBlockTime() uint64 { } type SetStatusReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *SetStatusReply) Reset() { *x = SetStatusReply{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SetStatusReply) String() string { @@ -972,7 +937,7 @@ func (*SetStatusReply) ProtoMessage() {} func (x *SetStatusReply) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -988,20 +953,17 @@ func (*SetStatusReply) Descriptor() ([]byte, []int) { } type HandShakeReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Protocol Protocol `protobuf:"varint,1,opt,name=protocol,proto3,enum=sentry.Protocol" json:"protocol,omitempty"` unknownFields protoimpl.UnknownFields - - Protocol Protocol `protobuf:"varint,1,opt,name=protocol,proto3,enum=sentry.Protocol" json:"protocol,omitempty"` + sizeCache protoimpl.SizeCache } func (x *HandShakeReply) Reset() { *x = HandShakeReply{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *HandShakeReply) String() string { @@ -1012,7 +974,7 @@ func (*HandShakeReply) ProtoMessage() {} func (x *HandShakeReply) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1035,20 +997,17 @@ func (x *HandShakeReply) GetProtocol() Protocol { } type MessagesRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Ids []MessageId `protobuf:"varint,1,rep,packed,name=ids,proto3,enum=sentry.MessageId" json:"ids,omitempty"` unknownFields protoimpl.UnknownFields - - Ids []MessageId `protobuf:"varint,1,rep,packed,name=ids,proto3,enum=sentry.MessageId" json:"ids,omitempty"` + sizeCache protoimpl.SizeCache } func (x *MessagesRequest) Reset() { *x = MessagesRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MessagesRequest) String() string { @@ -1059,7 +1018,7 @@ func (*MessagesRequest) ProtoMessage() {} func (x *MessagesRequest) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1082,20 +1041,17 @@ func (x *MessagesRequest) GetIds() []MessageId { } type PeersReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Peers []*typesproto.PeerInfo `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"` unknownFields protoimpl.UnknownFields - - Peers []*typesproto.PeerInfo `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PeersReply) Reset() { *x = PeersReply{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeersReply) String() string { @@ -1106,7 +1062,7 @@ func (*PeersReply) ProtoMessage() {} func (x *PeersReply) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1129,18 +1085,16 @@ func (x *PeersReply) GetPeers() []*typesproto.PeerInfo { } type PeerCountRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *PeerCountRequest) Reset() { *x = PeerCountRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeerCountRequest) String() string { @@ -1151,7 +1105,7 @@ func (*PeerCountRequest) ProtoMessage() {} func (x *PeerCountRequest) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1167,21 +1121,18 @@ func (*PeerCountRequest) Descriptor() ([]byte, []int) { } type PeerCountPerProtocol struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Protocol Protocol `protobuf:"varint,1,opt,name=protocol,proto3,enum=sentry.Protocol" json:"protocol,omitempty"` + Count uint64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` unknownFields protoimpl.UnknownFields - - Protocol Protocol `protobuf:"varint,1,opt,name=protocol,proto3,enum=sentry.Protocol" json:"protocol,omitempty"` - Count uint64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PeerCountPerProtocol) Reset() { *x = PeerCountPerProtocol{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeerCountPerProtocol) String() string { @@ -1192,7 +1143,7 @@ func (*PeerCountPerProtocol) ProtoMessage() {} func (x *PeerCountPerProtocol) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1222,21 +1173,18 @@ func (x *PeerCountPerProtocol) GetCount() uint64 { } type PeerCountReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` CountsPerProtocol []*PeerCountPerProtocol `protobuf:"bytes,2,rep,name=counts_per_protocol,json=countsPerProtocol,proto3" json:"counts_per_protocol,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *PeerCountReply) Reset() { *x = PeerCountReply{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeerCountReply) String() string { @@ -1247,7 +1195,7 @@ func (*PeerCountReply) ProtoMessage() {} func (x *PeerCountReply) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1277,20 +1225,17 @@ func (x *PeerCountReply) GetCountsPerProtocol() []*PeerCountPerProtocol { } type PeerByIdRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + PeerId *typesproto.H512 `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` unknownFields protoimpl.UnknownFields - - PeerId *typesproto.H512 `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PeerByIdRequest) Reset() { *x = PeerByIdRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeerByIdRequest) String() string { @@ -1301,7 +1246,7 @@ func (*PeerByIdRequest) ProtoMessage() {} func (x *PeerByIdRequest) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1324,20 +1269,17 @@ func (x *PeerByIdRequest) GetPeerId() *typesproto.H512 { } type PeerByIdReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Peer *typesproto.PeerInfo `protobuf:"bytes,1,opt,name=peer,proto3,oneof" json:"peer,omitempty"` unknownFields protoimpl.UnknownFields - - Peer *typesproto.PeerInfo `protobuf:"bytes,1,opt,name=peer,proto3,oneof" json:"peer,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PeerByIdReply) Reset() { *x = PeerByIdReply{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeerByIdReply) String() string { @@ -1348,7 +1290,7 @@ func (*PeerByIdReply) ProtoMessage() {} func (x *PeerByIdReply) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1371,18 +1313,16 @@ func (x *PeerByIdReply) GetPeer() *typesproto.PeerInfo { } type PeerEventsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *PeerEventsRequest) Reset() { *x = PeerEventsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeerEventsRequest) String() string { @@ -1393,7 +1333,7 @@ func (*PeerEventsRequest) ProtoMessage() {} func (x *PeerEventsRequest) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1409,21 +1349,18 @@ func (*PeerEventsRequest) Descriptor() ([]byte, []int) { } type PeerEvent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + PeerId *typesproto.H512 `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + EventId PeerEvent_PeerEventId `protobuf:"varint,2,opt,name=event_id,json=eventId,proto3,enum=sentry.PeerEvent_PeerEventId" json:"event_id,omitempty"` unknownFields protoimpl.UnknownFields - - PeerId *typesproto.H512 `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` - EventId PeerEvent_PeerEventId `protobuf:"varint,2,opt,name=event_id,json=eventId,proto3,enum=sentry.PeerEvent_PeerEventId" json:"event_id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PeerEvent) Reset() { *x = PeerEvent{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeerEvent) String() string { @@ -1434,7 +1371,7 @@ func (*PeerEvent) ProtoMessage() {} func (x *PeerEvent) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1464,20 +1401,17 @@ func (x *PeerEvent) GetEventId() PeerEvent_PeerEventId { } type AddPeerReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` unknownFields protoimpl.UnknownFields - - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AddPeerReply) Reset() { *x = AddPeerReply{} - if protoimpl.UnsafeEnabled { - mi := &file_p2psentry_sentry_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_p2psentry_sentry_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AddPeerReply) String() string { @@ -1488,7 +1422,7 @@ func (*AddPeerReply) ProtoMessage() {} func (x *AddPeerReply) ProtoReflect() protoreflect.Message { mi := &file_p2psentry_sentry_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1877,284 +1811,6 @@ func file_p2psentry_sentry_proto_init() { if File_p2psentry_sentry_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_p2psentry_sentry_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*OutboundMessageData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*SendMessageByMinBlockRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*SendMessageByIdRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*SendMessageToRandomPeersRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*SentPeers); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*PenalizePeerRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*PeerMinBlockRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*AddPeerRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*InboundMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*Forks); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*StatusData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*SetStatusReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*HandShakeReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*MessagesRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*PeersReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[15].Exporter = func(v any, i int) any { - switch v := v.(*PeerCountRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[16].Exporter = func(v any, i int) any { - switch v := v.(*PeerCountPerProtocol); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[17].Exporter = func(v any, i int) any { - switch v := v.(*PeerCountReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[18].Exporter = func(v any, i int) any { - switch v := v.(*PeerByIdRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[19].Exporter = func(v any, i int) any { - switch v := v.(*PeerByIdReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[20].Exporter = func(v any, i int) any { - switch v := v.(*PeerEventsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[21].Exporter = func(v any, i int) any { - switch v := v.(*PeerEvent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2psentry_sentry_proto_msgTypes[22].Exporter = func(v any, i int) any { - switch v := v.(*AddPeerReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } file_p2psentry_sentry_proto_msgTypes[19].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ diff --git a/erigon-lib/gointerfaces/sentryproto/sentry_client_mock.go b/erigon-lib/gointerfaces/sentryproto/sentry_client_mock.go index d5efb9900b5..38cc047ffca 100644 --- a/erigon-lib/gointerfaces/sentryproto/sentry_client_mock.go +++ b/erigon-lib/gointerfaces/sentryproto/sentry_client_mock.go @@ -132,14 +132,14 @@ func (c *MockSentryClientHandShakeCall) DoAndReturn(f func(context.Context, *emp } // Messages mocks base method. -func (m *MockSentryClient) Messages(ctx context.Context, in *MessagesRequest, opts ...grpc.CallOption) (Sentry_MessagesClient, error) { +func (m *MockSentryClient) Messages(ctx context.Context, in *MessagesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[InboundMessage], error) { m.ctrl.T.Helper() varargs := []any{ctx, in} for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "Messages", varargs...) - ret0, _ := ret[0].(Sentry_MessagesClient) + ret0, _ := ret[0].(grpc.ServerStreamingClient[InboundMessage]) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -158,19 +158,19 @@ type MockSentryClientMessagesCall struct { } // Return rewrite *gomock.Call.Return -func (c *MockSentryClientMessagesCall) Return(arg0 Sentry_MessagesClient, arg1 error) *MockSentryClientMessagesCall { +func (c *MockSentryClientMessagesCall) Return(arg0 grpc.ServerStreamingClient[InboundMessage], arg1 error) *MockSentryClientMessagesCall { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *MockSentryClientMessagesCall) Do(f func(context.Context, *MessagesRequest, ...grpc.CallOption) (Sentry_MessagesClient, error)) *MockSentryClientMessagesCall { +func (c *MockSentryClientMessagesCall) Do(f func(context.Context, *MessagesRequest, ...grpc.CallOption) (grpc.ServerStreamingClient[InboundMessage], error)) *MockSentryClientMessagesCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockSentryClientMessagesCall) DoAndReturn(f func(context.Context, *MessagesRequest, ...grpc.CallOption) (Sentry_MessagesClient, error)) *MockSentryClientMessagesCall { +func (c *MockSentryClientMessagesCall) DoAndReturn(f func(context.Context, *MessagesRequest, ...grpc.CallOption) (grpc.ServerStreamingClient[InboundMessage], error)) *MockSentryClientMessagesCall { c.Call = c.Call.DoAndReturn(f) return c } @@ -308,14 +308,14 @@ func (c *MockSentryClientPeerCountCall) DoAndReturn(f func(context.Context, *Pee } // PeerEvents mocks base method. -func (m *MockSentryClient) PeerEvents(ctx context.Context, in *PeerEventsRequest, opts ...grpc.CallOption) (Sentry_PeerEventsClient, error) { +func (m *MockSentryClient) PeerEvents(ctx context.Context, in *PeerEventsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[PeerEvent], error) { m.ctrl.T.Helper() varargs := []any{ctx, in} for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "PeerEvents", varargs...) - ret0, _ := ret[0].(Sentry_PeerEventsClient) + ret0, _ := ret[0].(grpc.ServerStreamingClient[PeerEvent]) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -334,19 +334,19 @@ type MockSentryClientPeerEventsCall struct { } // Return rewrite *gomock.Call.Return -func (c *MockSentryClientPeerEventsCall) Return(arg0 Sentry_PeerEventsClient, arg1 error) *MockSentryClientPeerEventsCall { +func (c *MockSentryClientPeerEventsCall) Return(arg0 grpc.ServerStreamingClient[PeerEvent], arg1 error) *MockSentryClientPeerEventsCall { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *MockSentryClientPeerEventsCall) Do(f func(context.Context, *PeerEventsRequest, ...grpc.CallOption) (Sentry_PeerEventsClient, error)) *MockSentryClientPeerEventsCall { +func (c *MockSentryClientPeerEventsCall) Do(f func(context.Context, *PeerEventsRequest, ...grpc.CallOption) (grpc.ServerStreamingClient[PeerEvent], error)) *MockSentryClientPeerEventsCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockSentryClientPeerEventsCall) DoAndReturn(f func(context.Context, *PeerEventsRequest, ...grpc.CallOption) (Sentry_PeerEventsClient, error)) *MockSentryClientPeerEventsCall { +func (c *MockSentryClientPeerEventsCall) DoAndReturn(f func(context.Context, *PeerEventsRequest, ...grpc.CallOption) (grpc.ServerStreamingClient[PeerEvent], error)) *MockSentryClientPeerEventsCall { c.Call = c.Call.DoAndReturn(f) return c } diff --git a/erigon-lib/gointerfaces/sentryproto/sentry_grpc.pb.go b/erigon-lib/gointerfaces/sentryproto/sentry_grpc.pb.go index 63fc1eee51d..cbc8550ee8b 100644 --- a/erigon-lib/gointerfaces/sentryproto/sentry_grpc.pb.go +++ b/erigon-lib/gointerfaces/sentryproto/sentry_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.1 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 // source: p2psentry/sentry.proto package sentryproto @@ -17,8 +17,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Sentry_SetStatus_FullMethodName = "/sentry.Sentry/SetStatus" @@ -56,12 +56,12 @@ type SentryClient interface { // Subscribe to receive messages. // Calling multiple times with a different set of ids starts separate streams. // It is possible to subscribe to the same set if ids more than once. - Messages(ctx context.Context, in *MessagesRequest, opts ...grpc.CallOption) (Sentry_MessagesClient, error) + Messages(ctx context.Context, in *MessagesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[InboundMessage], error) Peers(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PeersReply, error) PeerCount(ctx context.Context, in *PeerCountRequest, opts ...grpc.CallOption) (*PeerCountReply, error) PeerById(ctx context.Context, in *PeerByIdRequest, opts ...grpc.CallOption) (*PeerByIdReply, error) // Subscribe to notifications about connected or lost peers. - PeerEvents(ctx context.Context, in *PeerEventsRequest, opts ...grpc.CallOption) (Sentry_PeerEventsClient, error) + PeerEvents(ctx context.Context, in *PeerEventsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[PeerEvent], error) AddPeer(ctx context.Context, in *AddPeerRequest, opts ...grpc.CallOption) (*AddPeerReply, error) // NodeInfo returns a collection of metadata known about the host. NodeInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*typesproto.NodeInfoReply, error) @@ -155,13 +155,13 @@ func (c *sentryClient) SendMessageToAll(ctx context.Context, in *OutboundMessage return out, nil } -func (c *sentryClient) Messages(ctx context.Context, in *MessagesRequest, opts ...grpc.CallOption) (Sentry_MessagesClient, error) { +func (c *sentryClient) Messages(ctx context.Context, in *MessagesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[InboundMessage], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Sentry_ServiceDesc.Streams[0], Sentry_Messages_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &sentryMessagesClient{ClientStream: stream} + x := &grpc.GenericClientStream[MessagesRequest, InboundMessage]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -171,22 +171,8 @@ func (c *sentryClient) Messages(ctx context.Context, in *MessagesRequest, opts . return x, nil } -type Sentry_MessagesClient interface { - Recv() (*InboundMessage, error) - grpc.ClientStream -} - -type sentryMessagesClient struct { - grpc.ClientStream -} - -func (x *sentryMessagesClient) Recv() (*InboundMessage, error) { - m := new(InboundMessage) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Sentry_MessagesClient = grpc.ServerStreamingClient[InboundMessage] func (c *sentryClient) Peers(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PeersReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -218,13 +204,13 @@ func (c *sentryClient) PeerById(ctx context.Context, in *PeerByIdRequest, opts . return out, nil } -func (c *sentryClient) PeerEvents(ctx context.Context, in *PeerEventsRequest, opts ...grpc.CallOption) (Sentry_PeerEventsClient, error) { +func (c *sentryClient) PeerEvents(ctx context.Context, in *PeerEventsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[PeerEvent], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Sentry_ServiceDesc.Streams[1], Sentry_PeerEvents_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &sentryPeerEventsClient{ClientStream: stream} + x := &grpc.GenericClientStream[PeerEventsRequest, PeerEvent]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -234,22 +220,8 @@ func (c *sentryClient) PeerEvents(ctx context.Context, in *PeerEventsRequest, op return x, nil } -type Sentry_PeerEventsClient interface { - Recv() (*PeerEvent, error) - grpc.ClientStream -} - -type sentryPeerEventsClient struct { - grpc.ClientStream -} - -func (x *sentryPeerEventsClient) Recv() (*PeerEvent, error) { - m := new(PeerEvent) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Sentry_PeerEventsClient = grpc.ServerStreamingClient[PeerEvent] func (c *sentryClient) AddPeer(ctx context.Context, in *AddPeerRequest, opts ...grpc.CallOption) (*AddPeerReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -273,7 +245,7 @@ func (c *sentryClient) NodeInfo(ctx context.Context, in *emptypb.Empty, opts ... // SentryServer is the server API for Sentry service. // All implementations must embed UnimplementedSentryServer -// for forward compatibility +// for forward compatibility. type SentryServer interface { // SetStatus - force new ETH client state of sentry - network_id, max_block, etc... SetStatus(context.Context, *StatusData) (*SetStatusReply, error) @@ -289,21 +261,24 @@ type SentryServer interface { // Subscribe to receive messages. // Calling multiple times with a different set of ids starts separate streams. // It is possible to subscribe to the same set if ids more than once. - Messages(*MessagesRequest, Sentry_MessagesServer) error + Messages(*MessagesRequest, grpc.ServerStreamingServer[InboundMessage]) error Peers(context.Context, *emptypb.Empty) (*PeersReply, error) PeerCount(context.Context, *PeerCountRequest) (*PeerCountReply, error) PeerById(context.Context, *PeerByIdRequest) (*PeerByIdReply, error) // Subscribe to notifications about connected or lost peers. - PeerEvents(*PeerEventsRequest, Sentry_PeerEventsServer) error + PeerEvents(*PeerEventsRequest, grpc.ServerStreamingServer[PeerEvent]) error AddPeer(context.Context, *AddPeerRequest) (*AddPeerReply, error) // NodeInfo returns a collection of metadata known about the host. NodeInfo(context.Context, *emptypb.Empty) (*typesproto.NodeInfoReply, error) mustEmbedUnimplementedSentryServer() } -// UnimplementedSentryServer must be embedded to have forward compatible implementations. -type UnimplementedSentryServer struct { -} +// UnimplementedSentryServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSentryServer struct{} func (UnimplementedSentryServer) SetStatus(context.Context, *StatusData) (*SetStatusReply, error) { return nil, status.Errorf(codes.Unimplemented, "method SetStatus not implemented") @@ -329,7 +304,7 @@ func (UnimplementedSentryServer) SendMessageToRandomPeers(context.Context, *Send func (UnimplementedSentryServer) SendMessageToAll(context.Context, *OutboundMessageData) (*SentPeers, error) { return nil, status.Errorf(codes.Unimplemented, "method SendMessageToAll not implemented") } -func (UnimplementedSentryServer) Messages(*MessagesRequest, Sentry_MessagesServer) error { +func (UnimplementedSentryServer) Messages(*MessagesRequest, grpc.ServerStreamingServer[InboundMessage]) error { return status.Errorf(codes.Unimplemented, "method Messages not implemented") } func (UnimplementedSentryServer) Peers(context.Context, *emptypb.Empty) (*PeersReply, error) { @@ -341,7 +316,7 @@ func (UnimplementedSentryServer) PeerCount(context.Context, *PeerCountRequest) ( func (UnimplementedSentryServer) PeerById(context.Context, *PeerByIdRequest) (*PeerByIdReply, error) { return nil, status.Errorf(codes.Unimplemented, "method PeerById not implemented") } -func (UnimplementedSentryServer) PeerEvents(*PeerEventsRequest, Sentry_PeerEventsServer) error { +func (UnimplementedSentryServer) PeerEvents(*PeerEventsRequest, grpc.ServerStreamingServer[PeerEvent]) error { return status.Errorf(codes.Unimplemented, "method PeerEvents not implemented") } func (UnimplementedSentryServer) AddPeer(context.Context, *AddPeerRequest) (*AddPeerReply, error) { @@ -351,6 +326,7 @@ func (UnimplementedSentryServer) NodeInfo(context.Context, *emptypb.Empty) (*typ return nil, status.Errorf(codes.Unimplemented, "method NodeInfo not implemented") } func (UnimplementedSentryServer) mustEmbedUnimplementedSentryServer() {} +func (UnimplementedSentryServer) testEmbeddedByValue() {} // UnsafeSentryServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SentryServer will @@ -360,6 +336,13 @@ type UnsafeSentryServer interface { } func RegisterSentryServer(s grpc.ServiceRegistrar, srv SentryServer) { + // If the following call pancis, it indicates UnimplementedSentryServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Sentry_ServiceDesc, srv) } @@ -512,21 +495,11 @@ func _Sentry_Messages_Handler(srv interface{}, stream grpc.ServerStream) error { if err := stream.RecvMsg(m); err != nil { return err } - return srv.(SentryServer).Messages(m, &sentryMessagesServer{ServerStream: stream}) + return srv.(SentryServer).Messages(m, &grpc.GenericServerStream[MessagesRequest, InboundMessage]{ServerStream: stream}) } -type Sentry_MessagesServer interface { - Send(*InboundMessage) error - grpc.ServerStream -} - -type sentryMessagesServer struct { - grpc.ServerStream -} - -func (x *sentryMessagesServer) Send(m *InboundMessage) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Sentry_MessagesServer = grpc.ServerStreamingServer[InboundMessage] func _Sentry_Peers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(emptypb.Empty) @@ -587,21 +560,11 @@ func _Sentry_PeerEvents_Handler(srv interface{}, stream grpc.ServerStream) error if err := stream.RecvMsg(m); err != nil { return err } - return srv.(SentryServer).PeerEvents(m, &sentryPeerEventsServer{ServerStream: stream}) -} - -type Sentry_PeerEventsServer interface { - Send(*PeerEvent) error - grpc.ServerStream + return srv.(SentryServer).PeerEvents(m, &grpc.GenericServerStream[PeerEventsRequest, PeerEvent]{ServerStream: stream}) } -type sentryPeerEventsServer struct { - grpc.ServerStream -} - -func (x *sentryPeerEventsServer) Send(m *PeerEvent) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Sentry_PeerEventsServer = grpc.ServerStreamingServer[PeerEvent] func _Sentry_AddPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(AddPeerRequest) diff --git a/erigon-lib/gointerfaces/sentryproto/sentry_server_mock.go b/erigon-lib/gointerfaces/sentryproto/sentry_server_mock.go index 1773b34b54d..2590f5c0c4b 100644 --- a/erigon-lib/gointerfaces/sentryproto/sentry_server_mock.go +++ b/erigon-lib/gointerfaces/sentryproto/sentry_server_mock.go @@ -15,6 +15,7 @@ import ( typesproto "github.com/erigontech/erigon-lib/gointerfaces/typesproto" gomock "go.uber.org/mock/gomock" + grpc "google.golang.org/grpc" emptypb "google.golang.org/protobuf/types/known/emptypb" ) @@ -121,7 +122,7 @@ func (c *MockSentryServerHandShakeCall) DoAndReturn(f func(context.Context, *emp } // Messages mocks base method. -func (m *MockSentryServer) Messages(arg0 *MessagesRequest, arg1 Sentry_MessagesServer) error { +func (m *MockSentryServer) Messages(arg0 *MessagesRequest, arg1 grpc.ServerStreamingServer[InboundMessage]) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Messages", arg0, arg1) ret0, _ := ret[0].(error) @@ -147,13 +148,13 @@ func (c *MockSentryServerMessagesCall) Return(arg0 error) *MockSentryServerMessa } // Do rewrite *gomock.Call.Do -func (c *MockSentryServerMessagesCall) Do(f func(*MessagesRequest, Sentry_MessagesServer) error) *MockSentryServerMessagesCall { +func (c *MockSentryServerMessagesCall) Do(f func(*MessagesRequest, grpc.ServerStreamingServer[InboundMessage]) error) *MockSentryServerMessagesCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockSentryServerMessagesCall) DoAndReturn(f func(*MessagesRequest, Sentry_MessagesServer) error) *MockSentryServerMessagesCall { +func (c *MockSentryServerMessagesCall) DoAndReturn(f func(*MessagesRequest, grpc.ServerStreamingServer[InboundMessage]) error) *MockSentryServerMessagesCall { c.Call = c.Call.DoAndReturn(f) return c } @@ -276,7 +277,7 @@ func (c *MockSentryServerPeerCountCall) DoAndReturn(f func(context.Context, *Pee } // PeerEvents mocks base method. -func (m *MockSentryServer) PeerEvents(arg0 *PeerEventsRequest, arg1 Sentry_PeerEventsServer) error { +func (m *MockSentryServer) PeerEvents(arg0 *PeerEventsRequest, arg1 grpc.ServerStreamingServer[PeerEvent]) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "PeerEvents", arg0, arg1) ret0, _ := ret[0].(error) @@ -302,13 +303,13 @@ func (c *MockSentryServerPeerEventsCall) Return(arg0 error) *MockSentryServerPee } // Do rewrite *gomock.Call.Do -func (c *MockSentryServerPeerEventsCall) Do(f func(*PeerEventsRequest, Sentry_PeerEventsServer) error) *MockSentryServerPeerEventsCall { +func (c *MockSentryServerPeerEventsCall) Do(f func(*PeerEventsRequest, grpc.ServerStreamingServer[PeerEvent]) error) *MockSentryServerPeerEventsCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockSentryServerPeerEventsCall) DoAndReturn(f func(*PeerEventsRequest, Sentry_PeerEventsServer) error) *MockSentryServerPeerEventsCall { +func (c *MockSentryServerPeerEventsCall) DoAndReturn(f func(*PeerEventsRequest, grpc.ServerStreamingServer[PeerEvent]) error) *MockSentryServerPeerEventsCall { c.Call = c.Call.DoAndReturn(f) return c } diff --git a/erigon-lib/gointerfaces/txpoolproto/mining.pb.go b/erigon-lib/gointerfaces/txpoolproto/mining.pb.go index 1d7094bf2b4..d5ec261bc70 100644 --- a/erigon-lib/gointerfaces/txpoolproto/mining.pb.go +++ b/erigon-lib/gointerfaces/txpoolproto/mining.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.1 +// protoc-gen-go v1.36.3 +// protoc v5.29.3 // source: txpool/mining.proto package txpoolproto @@ -23,18 +23,16 @@ const ( ) type OnPendingBlockRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *OnPendingBlockRequest) Reset() { *x = OnPendingBlockRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *OnPendingBlockRequest) String() string { @@ -45,7 +43,7 @@ func (*OnPendingBlockRequest) ProtoMessage() {} func (x *OnPendingBlockRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -61,20 +59,17 @@ func (*OnPendingBlockRequest) Descriptor() ([]byte, []int) { } type OnPendingBlockReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + RplBlock []byte `protobuf:"bytes,1,opt,name=rpl_block,json=rplBlock,proto3" json:"rpl_block,omitempty"` unknownFields protoimpl.UnknownFields - - RplBlock []byte `protobuf:"bytes,1,opt,name=rpl_block,json=rplBlock,proto3" json:"rpl_block,omitempty"` + sizeCache protoimpl.SizeCache } func (x *OnPendingBlockReply) Reset() { *x = OnPendingBlockReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *OnPendingBlockReply) String() string { @@ -85,7 +80,7 @@ func (*OnPendingBlockReply) ProtoMessage() {} func (x *OnPendingBlockReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -108,18 +103,16 @@ func (x *OnPendingBlockReply) GetRplBlock() []byte { } type OnMinedBlockRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *OnMinedBlockRequest) Reset() { *x = OnMinedBlockRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *OnMinedBlockRequest) String() string { @@ -130,7 +123,7 @@ func (*OnMinedBlockRequest) ProtoMessage() {} func (x *OnMinedBlockRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -146,20 +139,17 @@ func (*OnMinedBlockRequest) Descriptor() ([]byte, []int) { } type OnMinedBlockReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + RplBlock []byte `protobuf:"bytes,1,opt,name=rpl_block,json=rplBlock,proto3" json:"rpl_block,omitempty"` unknownFields protoimpl.UnknownFields - - RplBlock []byte `protobuf:"bytes,1,opt,name=rpl_block,json=rplBlock,proto3" json:"rpl_block,omitempty"` + sizeCache protoimpl.SizeCache } func (x *OnMinedBlockReply) Reset() { *x = OnMinedBlockReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *OnMinedBlockReply) String() string { @@ -170,7 +160,7 @@ func (*OnMinedBlockReply) ProtoMessage() {} func (x *OnMinedBlockReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -193,18 +183,16 @@ func (x *OnMinedBlockReply) GetRplBlock() []byte { } type OnPendingLogsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *OnPendingLogsRequest) Reset() { *x = OnPendingLogsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *OnPendingLogsRequest) String() string { @@ -215,7 +203,7 @@ func (*OnPendingLogsRequest) ProtoMessage() {} func (x *OnPendingLogsRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -231,20 +219,17 @@ func (*OnPendingLogsRequest) Descriptor() ([]byte, []int) { } type OnPendingLogsReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + RplLogs []byte `protobuf:"bytes,1,opt,name=rpl_logs,json=rplLogs,proto3" json:"rpl_logs,omitempty"` unknownFields protoimpl.UnknownFields - - RplLogs []byte `protobuf:"bytes,1,opt,name=rpl_logs,json=rplLogs,proto3" json:"rpl_logs,omitempty"` + sizeCache protoimpl.SizeCache } func (x *OnPendingLogsReply) Reset() { *x = OnPendingLogsReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *OnPendingLogsReply) String() string { @@ -255,7 +240,7 @@ func (*OnPendingLogsReply) ProtoMessage() {} func (x *OnPendingLogsReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -278,18 +263,16 @@ func (x *OnPendingLogsReply) GetRplLogs() []byte { } type GetWorkRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GetWorkRequest) Reset() { *x = GetWorkRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetWorkRequest) String() string { @@ -300,7 +283,7 @@ func (*GetWorkRequest) ProtoMessage() {} func (x *GetWorkRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -316,23 +299,20 @@ func (*GetWorkRequest) Descriptor() ([]byte, []int) { } type GetWorkReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + HeaderHash string `protobuf:"bytes,1,opt,name=header_hash,json=headerHash,proto3" json:"header_hash,omitempty"` // 32 bytes hex encoded current block header pow-hash + SeedHash string `protobuf:"bytes,2,opt,name=seed_hash,json=seedHash,proto3" json:"seed_hash,omitempty"` // 32 bytes hex encoded seed hash used for DAG + Target string `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"` // 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty + BlockNumber string `protobuf:"bytes,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` // hex encoded block number unknownFields protoimpl.UnknownFields - - HeaderHash string `protobuf:"bytes,1,opt,name=header_hash,json=headerHash,proto3" json:"header_hash,omitempty"` // 32 bytes hex encoded current block header pow-hash - SeedHash string `protobuf:"bytes,2,opt,name=seed_hash,json=seedHash,proto3" json:"seed_hash,omitempty"` // 32 bytes hex encoded seed hash used for DAG - Target string `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"` // 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty - BlockNumber string `protobuf:"bytes,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` // hex encoded block number + sizeCache protoimpl.SizeCache } func (x *GetWorkReply) Reset() { *x = GetWorkReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetWorkReply) String() string { @@ -343,7 +323,7 @@ func (*GetWorkReply) ProtoMessage() {} func (x *GetWorkReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -387,22 +367,19 @@ func (x *GetWorkReply) GetBlockNumber() string { } type SubmitWorkRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + BlockNonce []byte `protobuf:"bytes,1,opt,name=block_nonce,json=blockNonce,proto3" json:"block_nonce,omitempty"` + PowHash []byte `protobuf:"bytes,2,opt,name=pow_hash,json=powHash,proto3" json:"pow_hash,omitempty"` + Digest []byte `protobuf:"bytes,3,opt,name=digest,proto3" json:"digest,omitempty"` unknownFields protoimpl.UnknownFields - - BlockNonce []byte `protobuf:"bytes,1,opt,name=block_nonce,json=blockNonce,proto3" json:"block_nonce,omitempty"` - PowHash []byte `protobuf:"bytes,2,opt,name=pow_hash,json=powHash,proto3" json:"pow_hash,omitempty"` - Digest []byte `protobuf:"bytes,3,opt,name=digest,proto3" json:"digest,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SubmitWorkRequest) Reset() { *x = SubmitWorkRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SubmitWorkRequest) String() string { @@ -413,7 +390,7 @@ func (*SubmitWorkRequest) ProtoMessage() {} func (x *SubmitWorkRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -450,20 +427,17 @@ func (x *SubmitWorkRequest) GetDigest() []byte { } type SubmitWorkReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` unknownFields protoimpl.UnknownFields - - Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SubmitWorkReply) Reset() { *x = SubmitWorkReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SubmitWorkReply) String() string { @@ -474,7 +448,7 @@ func (*SubmitWorkReply) ProtoMessage() {} func (x *SubmitWorkReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -497,21 +471,18 @@ func (x *SubmitWorkReply) GetOk() bool { } type SubmitHashRateRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Rate uint64 `protobuf:"varint,1,opt,name=rate,proto3" json:"rate,omitempty"` + Id []byte `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` unknownFields protoimpl.UnknownFields - - Rate uint64 `protobuf:"varint,1,opt,name=rate,proto3" json:"rate,omitempty"` - Id []byte `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SubmitHashRateRequest) Reset() { *x = SubmitHashRateRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SubmitHashRateRequest) String() string { @@ -522,7 +493,7 @@ func (*SubmitHashRateRequest) ProtoMessage() {} func (x *SubmitHashRateRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -552,20 +523,17 @@ func (x *SubmitHashRateRequest) GetId() []byte { } type SubmitHashRateReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` unknownFields protoimpl.UnknownFields - - Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SubmitHashRateReply) Reset() { *x = SubmitHashRateReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SubmitHashRateReply) String() string { @@ -576,7 +544,7 @@ func (*SubmitHashRateReply) ProtoMessage() {} func (x *SubmitHashRateReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -599,18 +567,16 @@ func (x *SubmitHashRateReply) GetOk() bool { } type HashRateRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *HashRateRequest) Reset() { *x = HashRateRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *HashRateRequest) String() string { @@ -621,7 +587,7 @@ func (*HashRateRequest) ProtoMessage() {} func (x *HashRateRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -637,20 +603,17 @@ func (*HashRateRequest) Descriptor() ([]byte, []int) { } type HashRateReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + HashRate uint64 `protobuf:"varint,1,opt,name=hash_rate,json=hashRate,proto3" json:"hash_rate,omitempty"` unknownFields protoimpl.UnknownFields - - HashRate uint64 `protobuf:"varint,1,opt,name=hash_rate,json=hashRate,proto3" json:"hash_rate,omitempty"` + sizeCache protoimpl.SizeCache } func (x *HashRateReply) Reset() { *x = HashRateReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *HashRateReply) String() string { @@ -661,7 +624,7 @@ func (*HashRateReply) ProtoMessage() {} func (x *HashRateReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -684,18 +647,16 @@ func (x *HashRateReply) GetHashRate() uint64 { } type MiningRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *MiningRequest) Reset() { *x = MiningRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MiningRequest) String() string { @@ -706,7 +667,7 @@ func (*MiningRequest) ProtoMessage() {} func (x *MiningRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -722,21 +683,18 @@ func (*MiningRequest) Descriptor() ([]byte, []int) { } type MiningReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` + Running bool `protobuf:"varint,2,opt,name=running,proto3" json:"running,omitempty"` unknownFields protoimpl.UnknownFields - - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - Running bool `protobuf:"varint,2,opt,name=running,proto3" json:"running,omitempty"` + sizeCache protoimpl.SizeCache } func (x *MiningReply) Reset() { *x = MiningReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_mining_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_mining_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MiningReply) String() string { @@ -747,7 +705,7 @@ func (*MiningReply) ProtoMessage() {} func (x *MiningReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_mining_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -939,200 +897,6 @@ func file_txpool_mining_proto_init() { if File_txpool_mining_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_txpool_mining_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*OnPendingBlockRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*OnPendingBlockReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*OnMinedBlockRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*OnMinedBlockReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*OnPendingLogsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*OnPendingLogsReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*GetWorkRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*GetWorkReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*SubmitWorkRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*SubmitWorkReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*SubmitHashRateRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*SubmitHashRateReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*HashRateRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*HashRateReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*MiningRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_mining_proto_msgTypes[15].Exporter = func(v any, i int) any { - switch v := v.(*MiningReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/erigon-lib/gointerfaces/txpoolproto/mining_grpc.pb.go b/erigon-lib/gointerfaces/txpoolproto/mining_grpc.pb.go index 78ca36551e9..457d50b1155 100644 --- a/erigon-lib/gointerfaces/txpoolproto/mining_grpc.pb.go +++ b/erigon-lib/gointerfaces/txpoolproto/mining_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.1 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 // source: txpool/mining.proto package txpoolproto @@ -17,8 +17,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Mining_Version_FullMethodName = "/txpool.Mining/Version" @@ -39,11 +39,11 @@ type MiningClient interface { // Version returns the service version number Version(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*typesproto.VersionReply, error) // subscribe to pending blocks event - OnPendingBlock(ctx context.Context, in *OnPendingBlockRequest, opts ...grpc.CallOption) (Mining_OnPendingBlockClient, error) + OnPendingBlock(ctx context.Context, in *OnPendingBlockRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[OnPendingBlockReply], error) // subscribe to mined blocks event - OnMinedBlock(ctx context.Context, in *OnMinedBlockRequest, opts ...grpc.CallOption) (Mining_OnMinedBlockClient, error) + OnMinedBlock(ctx context.Context, in *OnMinedBlockRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[OnMinedBlockReply], error) // subscribe to pending blocks event - OnPendingLogs(ctx context.Context, in *OnPendingLogsRequest, opts ...grpc.CallOption) (Mining_OnPendingLogsClient, error) + OnPendingLogs(ctx context.Context, in *OnPendingLogsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[OnPendingLogsReply], error) // GetWork returns a work package for external miner. // // The work package consists of 3 strings: @@ -88,13 +88,13 @@ func (c *miningClient) Version(ctx context.Context, in *emptypb.Empty, opts ...g return out, nil } -func (c *miningClient) OnPendingBlock(ctx context.Context, in *OnPendingBlockRequest, opts ...grpc.CallOption) (Mining_OnPendingBlockClient, error) { +func (c *miningClient) OnPendingBlock(ctx context.Context, in *OnPendingBlockRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[OnPendingBlockReply], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Mining_ServiceDesc.Streams[0], Mining_OnPendingBlock_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &miningOnPendingBlockClient{ClientStream: stream} + x := &grpc.GenericClientStream[OnPendingBlockRequest, OnPendingBlockReply]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -104,30 +104,16 @@ func (c *miningClient) OnPendingBlock(ctx context.Context, in *OnPendingBlockReq return x, nil } -type Mining_OnPendingBlockClient interface { - Recv() (*OnPendingBlockReply, error) - grpc.ClientStream -} - -type miningOnPendingBlockClient struct { - grpc.ClientStream -} - -func (x *miningOnPendingBlockClient) Recv() (*OnPendingBlockReply, error) { - m := new(OnPendingBlockReply) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Mining_OnPendingBlockClient = grpc.ServerStreamingClient[OnPendingBlockReply] -func (c *miningClient) OnMinedBlock(ctx context.Context, in *OnMinedBlockRequest, opts ...grpc.CallOption) (Mining_OnMinedBlockClient, error) { +func (c *miningClient) OnMinedBlock(ctx context.Context, in *OnMinedBlockRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[OnMinedBlockReply], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Mining_ServiceDesc.Streams[1], Mining_OnMinedBlock_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &miningOnMinedBlockClient{ClientStream: stream} + x := &grpc.GenericClientStream[OnMinedBlockRequest, OnMinedBlockReply]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -137,30 +123,16 @@ func (c *miningClient) OnMinedBlock(ctx context.Context, in *OnMinedBlockRequest return x, nil } -type Mining_OnMinedBlockClient interface { - Recv() (*OnMinedBlockReply, error) - grpc.ClientStream -} - -type miningOnMinedBlockClient struct { - grpc.ClientStream -} - -func (x *miningOnMinedBlockClient) Recv() (*OnMinedBlockReply, error) { - m := new(OnMinedBlockReply) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Mining_OnMinedBlockClient = grpc.ServerStreamingClient[OnMinedBlockReply] -func (c *miningClient) OnPendingLogs(ctx context.Context, in *OnPendingLogsRequest, opts ...grpc.CallOption) (Mining_OnPendingLogsClient, error) { +func (c *miningClient) OnPendingLogs(ctx context.Context, in *OnPendingLogsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[OnPendingLogsReply], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Mining_ServiceDesc.Streams[2], Mining_OnPendingLogs_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &miningOnPendingLogsClient{ClientStream: stream} + x := &grpc.GenericClientStream[OnPendingLogsRequest, OnPendingLogsReply]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -170,22 +142,8 @@ func (c *miningClient) OnPendingLogs(ctx context.Context, in *OnPendingLogsReque return x, nil } -type Mining_OnPendingLogsClient interface { - Recv() (*OnPendingLogsReply, error) - grpc.ClientStream -} - -type miningOnPendingLogsClient struct { - grpc.ClientStream -} - -func (x *miningOnPendingLogsClient) Recv() (*OnPendingLogsReply, error) { - m := new(OnPendingLogsReply) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Mining_OnPendingLogsClient = grpc.ServerStreamingClient[OnPendingLogsReply] func (c *miningClient) GetWork(ctx context.Context, in *GetWorkRequest, opts ...grpc.CallOption) (*GetWorkReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -239,16 +197,16 @@ func (c *miningClient) Mining(ctx context.Context, in *MiningRequest, opts ...gr // MiningServer is the server API for Mining service. // All implementations must embed UnimplementedMiningServer -// for forward compatibility +// for forward compatibility. type MiningServer interface { // Version returns the service version number Version(context.Context, *emptypb.Empty) (*typesproto.VersionReply, error) // subscribe to pending blocks event - OnPendingBlock(*OnPendingBlockRequest, Mining_OnPendingBlockServer) error + OnPendingBlock(*OnPendingBlockRequest, grpc.ServerStreamingServer[OnPendingBlockReply]) error // subscribe to mined blocks event - OnMinedBlock(*OnMinedBlockRequest, Mining_OnMinedBlockServer) error + OnMinedBlock(*OnMinedBlockRequest, grpc.ServerStreamingServer[OnMinedBlockReply]) error // subscribe to pending blocks event - OnPendingLogs(*OnPendingLogsRequest, Mining_OnPendingLogsServer) error + OnPendingLogs(*OnPendingLogsRequest, grpc.ServerStreamingServer[OnPendingLogsReply]) error // GetWork returns a work package for external miner. // // The work package consists of 3 strings: @@ -276,20 +234,23 @@ type MiningServer interface { mustEmbedUnimplementedMiningServer() } -// UnimplementedMiningServer must be embedded to have forward compatible implementations. -type UnimplementedMiningServer struct { -} +// UnimplementedMiningServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedMiningServer struct{} func (UnimplementedMiningServer) Version(context.Context, *emptypb.Empty) (*typesproto.VersionReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") } -func (UnimplementedMiningServer) OnPendingBlock(*OnPendingBlockRequest, Mining_OnPendingBlockServer) error { +func (UnimplementedMiningServer) OnPendingBlock(*OnPendingBlockRequest, grpc.ServerStreamingServer[OnPendingBlockReply]) error { return status.Errorf(codes.Unimplemented, "method OnPendingBlock not implemented") } -func (UnimplementedMiningServer) OnMinedBlock(*OnMinedBlockRequest, Mining_OnMinedBlockServer) error { +func (UnimplementedMiningServer) OnMinedBlock(*OnMinedBlockRequest, grpc.ServerStreamingServer[OnMinedBlockReply]) error { return status.Errorf(codes.Unimplemented, "method OnMinedBlock not implemented") } -func (UnimplementedMiningServer) OnPendingLogs(*OnPendingLogsRequest, Mining_OnPendingLogsServer) error { +func (UnimplementedMiningServer) OnPendingLogs(*OnPendingLogsRequest, grpc.ServerStreamingServer[OnPendingLogsReply]) error { return status.Errorf(codes.Unimplemented, "method OnPendingLogs not implemented") } func (UnimplementedMiningServer) GetWork(context.Context, *GetWorkRequest) (*GetWorkReply, error) { @@ -308,6 +269,7 @@ func (UnimplementedMiningServer) Mining(context.Context, *MiningRequest) (*Minin return nil, status.Errorf(codes.Unimplemented, "method Mining not implemented") } func (UnimplementedMiningServer) mustEmbedUnimplementedMiningServer() {} +func (UnimplementedMiningServer) testEmbeddedByValue() {} // UnsafeMiningServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to MiningServer will @@ -317,6 +279,13 @@ type UnsafeMiningServer interface { } func RegisterMiningServer(s grpc.ServiceRegistrar, srv MiningServer) { + // If the following call pancis, it indicates UnimplementedMiningServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Mining_ServiceDesc, srv) } @@ -343,63 +312,33 @@ func _Mining_OnPendingBlock_Handler(srv interface{}, stream grpc.ServerStream) e if err := stream.RecvMsg(m); err != nil { return err } - return srv.(MiningServer).OnPendingBlock(m, &miningOnPendingBlockServer{ServerStream: stream}) -} - -type Mining_OnPendingBlockServer interface { - Send(*OnPendingBlockReply) error - grpc.ServerStream + return srv.(MiningServer).OnPendingBlock(m, &grpc.GenericServerStream[OnPendingBlockRequest, OnPendingBlockReply]{ServerStream: stream}) } -type miningOnPendingBlockServer struct { - grpc.ServerStream -} - -func (x *miningOnPendingBlockServer) Send(m *OnPendingBlockReply) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Mining_OnPendingBlockServer = grpc.ServerStreamingServer[OnPendingBlockReply] func _Mining_OnMinedBlock_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(OnMinedBlockRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(MiningServer).OnMinedBlock(m, &miningOnMinedBlockServer{ServerStream: stream}) + return srv.(MiningServer).OnMinedBlock(m, &grpc.GenericServerStream[OnMinedBlockRequest, OnMinedBlockReply]{ServerStream: stream}) } -type Mining_OnMinedBlockServer interface { - Send(*OnMinedBlockReply) error - grpc.ServerStream -} - -type miningOnMinedBlockServer struct { - grpc.ServerStream -} - -func (x *miningOnMinedBlockServer) Send(m *OnMinedBlockReply) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Mining_OnMinedBlockServer = grpc.ServerStreamingServer[OnMinedBlockReply] func _Mining_OnPendingLogs_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(OnPendingLogsRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(MiningServer).OnPendingLogs(m, &miningOnPendingLogsServer{ServerStream: stream}) + return srv.(MiningServer).OnPendingLogs(m, &grpc.GenericServerStream[OnPendingLogsRequest, OnPendingLogsReply]{ServerStream: stream}) } -type Mining_OnPendingLogsServer interface { - Send(*OnPendingLogsReply) error - grpc.ServerStream -} - -type miningOnPendingLogsServer struct { - grpc.ServerStream -} - -func (x *miningOnPendingLogsServer) Send(m *OnPendingLogsReply) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Mining_OnPendingLogsServer = grpc.ServerStreamingServer[OnPendingLogsReply] func _Mining_GetWork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetWorkRequest) diff --git a/erigon-lib/gointerfaces/txpoolproto/txpool.pb.go b/erigon-lib/gointerfaces/txpoolproto/txpool.pb.go index c946971452d..9ce25d1be75 100644 --- a/erigon-lib/gointerfaces/txpoolproto/txpool.pb.go +++ b/erigon-lib/gointerfaces/txpoolproto/txpool.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.1 +// protoc-gen-go v1.36.3 +// protoc v5.29.3 // source: txpool/txpool.proto package txpoolproto @@ -130,20 +130,17 @@ func (AllReply_TxnType) EnumDescriptor() ([]byte, []int) { } type TxHashes struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Hashes []*typesproto.H256 `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` unknownFields protoimpl.UnknownFields - - Hashes []*typesproto.H256 `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` + sizeCache protoimpl.SizeCache } func (x *TxHashes) Reset() { *x = TxHashes{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TxHashes) String() string { @@ -154,7 +151,7 @@ func (*TxHashes) ProtoMessage() {} func (x *TxHashes) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -177,20 +174,17 @@ func (x *TxHashes) GetHashes() []*typesproto.H256 { } type AddRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + RlpTxs [][]byte `protobuf:"bytes,1,rep,name=rlp_txs,json=rlpTxs,proto3" json:"rlp_txs,omitempty"` unknownFields protoimpl.UnknownFields - - RlpTxs [][]byte `protobuf:"bytes,1,rep,name=rlp_txs,json=rlpTxs,proto3" json:"rlp_txs,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AddRequest) Reset() { *x = AddRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AddRequest) String() string { @@ -201,7 +195,7 @@ func (*AddRequest) ProtoMessage() {} func (x *AddRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -224,21 +218,18 @@ func (x *AddRequest) GetRlpTxs() [][]byte { } type AddReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Imported []ImportResult `protobuf:"varint,1,rep,packed,name=imported,proto3,enum=txpool.ImportResult" json:"imported,omitempty"` + Errors []string `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"` unknownFields protoimpl.UnknownFields - - Imported []ImportResult `protobuf:"varint,1,rep,packed,name=imported,proto3,enum=txpool.ImportResult" json:"imported,omitempty"` - Errors []string `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AddReply) Reset() { *x = AddReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AddReply) String() string { @@ -249,7 +240,7 @@ func (*AddReply) ProtoMessage() {} func (x *AddReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -279,20 +270,17 @@ func (x *AddReply) GetErrors() []string { } type TransactionsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Hashes []*typesproto.H256 `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` unknownFields protoimpl.UnknownFields - - Hashes []*typesproto.H256 `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` + sizeCache protoimpl.SizeCache } func (x *TransactionsRequest) Reset() { *x = TransactionsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TransactionsRequest) String() string { @@ -303,7 +291,7 @@ func (*TransactionsRequest) ProtoMessage() {} func (x *TransactionsRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -326,20 +314,17 @@ func (x *TransactionsRequest) GetHashes() []*typesproto.H256 { } type TransactionsReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + RlpTxs [][]byte `protobuf:"bytes,1,rep,name=rlp_txs,json=rlpTxs,proto3" json:"rlp_txs,omitempty"` unknownFields protoimpl.UnknownFields - - RlpTxs [][]byte `protobuf:"bytes,1,rep,name=rlp_txs,json=rlpTxs,proto3" json:"rlp_txs,omitempty"` + sizeCache protoimpl.SizeCache } func (x *TransactionsReply) Reset() { *x = TransactionsReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TransactionsReply) String() string { @@ -350,7 +335,7 @@ func (*TransactionsReply) ProtoMessage() {} func (x *TransactionsReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -373,18 +358,16 @@ func (x *TransactionsReply) GetRlpTxs() [][]byte { } type OnAddRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *OnAddRequest) Reset() { *x = OnAddRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *OnAddRequest) String() string { @@ -395,7 +378,7 @@ func (*OnAddRequest) ProtoMessage() {} func (x *OnAddRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -411,20 +394,17 @@ func (*OnAddRequest) Descriptor() ([]byte, []int) { } type OnAddReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + RplTxs [][]byte `protobuf:"bytes,1,rep,name=rpl_txs,json=rplTxs,proto3" json:"rpl_txs,omitempty"` unknownFields protoimpl.UnknownFields - - RplTxs [][]byte `protobuf:"bytes,1,rep,name=rpl_txs,json=rplTxs,proto3" json:"rpl_txs,omitempty"` + sizeCache protoimpl.SizeCache } func (x *OnAddReply) Reset() { *x = OnAddReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *OnAddReply) String() string { @@ -435,7 +415,7 @@ func (*OnAddReply) ProtoMessage() {} func (x *OnAddReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -458,18 +438,16 @@ func (x *OnAddReply) GetRplTxs() [][]byte { } type AllRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AllRequest) Reset() { *x = AllRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AllRequest) String() string { @@ -480,7 +458,7 @@ func (*AllRequest) ProtoMessage() {} func (x *AllRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -496,20 +474,17 @@ func (*AllRequest) Descriptor() ([]byte, []int) { } type AllReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Txs []*AllReply_Tx `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` unknownFields protoimpl.UnknownFields - - Txs []*AllReply_Tx `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AllReply) Reset() { *x = AllReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AllReply) String() string { @@ -520,7 +495,7 @@ func (*AllReply) ProtoMessage() {} func (x *AllReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -543,20 +518,17 @@ func (x *AllReply) GetTxs() []*AllReply_Tx { } type PendingReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Txs []*PendingReply_Tx `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` unknownFields protoimpl.UnknownFields - - Txs []*PendingReply_Tx `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PendingReply) Reset() { *x = PendingReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PendingReply) String() string { @@ -567,7 +539,7 @@ func (*PendingReply) ProtoMessage() {} func (x *PendingReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -590,18 +562,16 @@ func (x *PendingReply) GetTxs() []*PendingReply_Tx { } type StatusRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *StatusRequest) Reset() { *x = StatusRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StatusRequest) String() string { @@ -612,7 +582,7 @@ func (*StatusRequest) ProtoMessage() {} func (x *StatusRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -628,22 +598,19 @@ func (*StatusRequest) Descriptor() ([]byte, []int) { } type StatusReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + PendingCount uint32 `protobuf:"varint,1,opt,name=pending_count,json=pendingCount,proto3" json:"pending_count,omitempty"` + QueuedCount uint32 `protobuf:"varint,2,opt,name=queued_count,json=queuedCount,proto3" json:"queued_count,omitempty"` + BaseFeeCount uint32 `protobuf:"varint,3,opt,name=base_fee_count,json=baseFeeCount,proto3" json:"base_fee_count,omitempty"` unknownFields protoimpl.UnknownFields - - PendingCount uint32 `protobuf:"varint,1,opt,name=pending_count,json=pendingCount,proto3" json:"pending_count,omitempty"` - QueuedCount uint32 `protobuf:"varint,2,opt,name=queued_count,json=queuedCount,proto3" json:"queued_count,omitempty"` - BaseFeeCount uint32 `protobuf:"varint,3,opt,name=base_fee_count,json=baseFeeCount,proto3" json:"base_fee_count,omitempty"` + sizeCache protoimpl.SizeCache } func (x *StatusReply) Reset() { *x = StatusReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StatusReply) String() string { @@ -654,7 +621,7 @@ func (*StatusReply) ProtoMessage() {} func (x *StatusReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -691,20 +658,17 @@ func (x *StatusReply) GetBaseFeeCount() uint32 { } type NonceRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Address *typesproto.H160 `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` unknownFields protoimpl.UnknownFields - - Address *typesproto.H160 `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + sizeCache protoimpl.SizeCache } func (x *NonceRequest) Reset() { *x = NonceRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *NonceRequest) String() string { @@ -715,7 +679,7 @@ func (*NonceRequest) ProtoMessage() {} func (x *NonceRequest) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -738,21 +702,18 @@ func (x *NonceRequest) GetAddress() *typesproto.H160 { } type NonceReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Found bool `protobuf:"varint,1,opt,name=found,proto3" json:"found,omitempty"` + Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` unknownFields protoimpl.UnknownFields - - Found bool `protobuf:"varint,1,opt,name=found,proto3" json:"found,omitempty"` - Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` + sizeCache protoimpl.SizeCache } func (x *NonceReply) Reset() { *x = NonceReply{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *NonceReply) String() string { @@ -763,7 +724,7 @@ func (*NonceReply) ProtoMessage() {} func (x *NonceReply) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -793,22 +754,19 @@ func (x *NonceReply) GetNonce() uint64 { } type AllReply_Tx struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + TxnType AllReply_TxnType `protobuf:"varint,1,opt,name=txn_type,json=txnType,proto3,enum=txpool.AllReply_TxnType" json:"txn_type,omitempty"` + Sender *typesproto.H160 `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + RlpTx []byte `protobuf:"bytes,3,opt,name=rlp_tx,json=rlpTx,proto3" json:"rlp_tx,omitempty"` unknownFields protoimpl.UnknownFields - - TxnType AllReply_TxnType `protobuf:"varint,1,opt,name=txn_type,json=txnType,proto3,enum=txpool.AllReply_TxnType" json:"txn_type,omitempty"` - Sender *typesproto.H160 `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` - RlpTx []byte `protobuf:"bytes,3,opt,name=rlp_tx,json=rlpTx,proto3" json:"rlp_tx,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AllReply_Tx) Reset() { *x = AllReply_Tx{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AllReply_Tx) String() string { @@ -819,7 +777,7 @@ func (*AllReply_Tx) ProtoMessage() {} func (x *AllReply_Tx) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -856,22 +814,19 @@ func (x *AllReply_Tx) GetRlpTx() []byte { } type PendingReply_Tx struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Sender *typesproto.H160 `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + RlpTx []byte `protobuf:"bytes,2,opt,name=rlp_tx,json=rlpTx,proto3" json:"rlp_tx,omitempty"` + IsLocal bool `protobuf:"varint,3,opt,name=is_local,json=isLocal,proto3" json:"is_local,omitempty"` unknownFields protoimpl.UnknownFields - - Sender *typesproto.H160 `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - RlpTx []byte `protobuf:"bytes,2,opt,name=rlp_tx,json=rlpTx,proto3" json:"rlp_tx,omitempty"` - IsLocal bool `protobuf:"varint,3,opt,name=is_local,json=isLocal,proto3" json:"is_local,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PendingReply_Tx) Reset() { *x = PendingReply_Tx{} - if protoimpl.UnsafeEnabled { - mi := &file_txpool_txpool_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_txpool_txpool_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PendingReply_Tx) String() string { @@ -882,7 +837,7 @@ func (*PendingReply_Tx) ProtoMessage() {} func (x *PendingReply_Tx) ProtoReflect() protoreflect.Message { mi := &file_txpool_txpool_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1107,200 +1062,6 @@ func file_txpool_txpool_proto_init() { if File_txpool_txpool_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_txpool_txpool_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*TxHashes); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*AddRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*AddReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*TransactionsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*TransactionsReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*OnAddRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*OnAddReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*AllRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*AllReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*PendingReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*StatusRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*StatusReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*NonceRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*NonceReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*AllReply_Tx); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_txpool_txpool_proto_msgTypes[15].Exporter = func(v any, i int) any { - switch v := v.(*PendingReply_Tx); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/erigon-lib/gointerfaces/txpoolproto/txpool_grpc.pb.go b/erigon-lib/gointerfaces/txpoolproto/txpool_grpc.pb.go index d9ddb2d4cad..dffb62a0f02 100644 --- a/erigon-lib/gointerfaces/txpoolproto/txpool_grpc.pb.go +++ b/erigon-lib/gointerfaces/txpoolproto/txpool_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.1 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 // source: txpool/txpool.proto package txpoolproto @@ -17,8 +17,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Txpool_Version_FullMethodName = "/txpool.Txpool/Version" @@ -50,7 +50,7 @@ type TxpoolClient interface { // Returns all pending (processable) transactions, in ready-for-mining order Pending(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PendingReply, error) // subscribe to new transactions add event - OnAdd(ctx context.Context, in *OnAddRequest, opts ...grpc.CallOption) (Txpool_OnAddClient, error) + OnAdd(ctx context.Context, in *OnAddRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[OnAddReply], error) // returns high level status Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) // returns nonce for given account @@ -125,13 +125,13 @@ func (c *txpoolClient) Pending(ctx context.Context, in *emptypb.Empty, opts ...g return out, nil } -func (c *txpoolClient) OnAdd(ctx context.Context, in *OnAddRequest, opts ...grpc.CallOption) (Txpool_OnAddClient, error) { +func (c *txpoolClient) OnAdd(ctx context.Context, in *OnAddRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[OnAddReply], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Txpool_ServiceDesc.Streams[0], Txpool_OnAdd_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &txpoolOnAddClient{ClientStream: stream} + x := &grpc.GenericClientStream[OnAddRequest, OnAddReply]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -141,22 +141,8 @@ func (c *txpoolClient) OnAdd(ctx context.Context, in *OnAddRequest, opts ...grpc return x, nil } -type Txpool_OnAddClient interface { - Recv() (*OnAddReply, error) - grpc.ClientStream -} - -type txpoolOnAddClient struct { - grpc.ClientStream -} - -func (x *txpoolOnAddClient) Recv() (*OnAddReply, error) { - m := new(OnAddReply) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Txpool_OnAddClient = grpc.ServerStreamingClient[OnAddReply] func (c *txpoolClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -180,7 +166,7 @@ func (c *txpoolClient) Nonce(ctx context.Context, in *NonceRequest, opts ...grpc // TxpoolServer is the server API for Txpool service. // All implementations must embed UnimplementedTxpoolServer -// for forward compatibility +// for forward compatibility. type TxpoolServer interface { // Version returns the service version number Version(context.Context, *emptypb.Empty) (*typesproto.VersionReply, error) @@ -196,7 +182,7 @@ type TxpoolServer interface { // Returns all pending (processable) transactions, in ready-for-mining order Pending(context.Context, *emptypb.Empty) (*PendingReply, error) // subscribe to new transactions add event - OnAdd(*OnAddRequest, Txpool_OnAddServer) error + OnAdd(*OnAddRequest, grpc.ServerStreamingServer[OnAddReply]) error // returns high level status Status(context.Context, *StatusRequest) (*StatusReply, error) // returns nonce for given account @@ -204,9 +190,12 @@ type TxpoolServer interface { mustEmbedUnimplementedTxpoolServer() } -// UnimplementedTxpoolServer must be embedded to have forward compatible implementations. -type UnimplementedTxpoolServer struct { -} +// UnimplementedTxpoolServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedTxpoolServer struct{} func (UnimplementedTxpoolServer) Version(context.Context, *emptypb.Empty) (*typesproto.VersionReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") @@ -226,7 +215,7 @@ func (UnimplementedTxpoolServer) All(context.Context, *AllRequest) (*AllReply, e func (UnimplementedTxpoolServer) Pending(context.Context, *emptypb.Empty) (*PendingReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Pending not implemented") } -func (UnimplementedTxpoolServer) OnAdd(*OnAddRequest, Txpool_OnAddServer) error { +func (UnimplementedTxpoolServer) OnAdd(*OnAddRequest, grpc.ServerStreamingServer[OnAddReply]) error { return status.Errorf(codes.Unimplemented, "method OnAdd not implemented") } func (UnimplementedTxpoolServer) Status(context.Context, *StatusRequest) (*StatusReply, error) { @@ -236,6 +225,7 @@ func (UnimplementedTxpoolServer) Nonce(context.Context, *NonceRequest) (*NonceRe return nil, status.Errorf(codes.Unimplemented, "method Nonce not implemented") } func (UnimplementedTxpoolServer) mustEmbedUnimplementedTxpoolServer() {} +func (UnimplementedTxpoolServer) testEmbeddedByValue() {} // UnsafeTxpoolServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to TxpoolServer will @@ -245,6 +235,13 @@ type UnsafeTxpoolServer interface { } func RegisterTxpoolServer(s grpc.ServiceRegistrar, srv TxpoolServer) { + // If the following call pancis, it indicates UnimplementedTxpoolServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Txpool_ServiceDesc, srv) } @@ -361,21 +358,11 @@ func _Txpool_OnAdd_Handler(srv interface{}, stream grpc.ServerStream) error { if err := stream.RecvMsg(m); err != nil { return err } - return srv.(TxpoolServer).OnAdd(m, &txpoolOnAddServer{ServerStream: stream}) -} - -type Txpool_OnAddServer interface { - Send(*OnAddReply) error - grpc.ServerStream + return srv.(TxpoolServer).OnAdd(m, &grpc.GenericServerStream[OnAddRequest, OnAddReply]{ServerStream: stream}) } -type txpoolOnAddServer struct { - grpc.ServerStream -} - -func (x *txpoolOnAddServer) Send(m *OnAddReply) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Txpool_OnAddServer = grpc.ServerStreamingServer[OnAddReply] func _Txpool_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(StatusRequest) diff --git a/erigon-lib/gointerfaces/typesproto/types.pb.go b/erigon-lib/gointerfaces/typesproto/types.pb.go index e76f7a7001e..8d04788e6b0 100644 --- a/erigon-lib/gointerfaces/typesproto/types.pb.go +++ b/erigon-lib/gointerfaces/typesproto/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.1 +// protoc-gen-go v1.36.3 +// protoc v5.29.3 // source: types/types.proto package typesproto @@ -22,21 +22,18 @@ const ( ) type H128 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Hi uint64 `protobuf:"varint,1,opt,name=hi,proto3" json:"hi,omitempty"` + Lo uint64 `protobuf:"varint,2,opt,name=lo,proto3" json:"lo,omitempty"` unknownFields protoimpl.UnknownFields - - Hi uint64 `protobuf:"varint,1,opt,name=hi,proto3" json:"hi,omitempty"` - Lo uint64 `protobuf:"varint,2,opt,name=lo,proto3" json:"lo,omitempty"` + sizeCache protoimpl.SizeCache } func (x *H128) Reset() { *x = H128{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *H128) String() string { @@ -47,7 +44,7 @@ func (*H128) ProtoMessage() {} func (x *H128) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -77,21 +74,18 @@ func (x *H128) GetLo() uint64 { } type H160 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Hi *H128 `protobuf:"bytes,1,opt,name=hi,proto3" json:"hi,omitempty"` + Lo uint32 `protobuf:"varint,2,opt,name=lo,proto3" json:"lo,omitempty"` unknownFields protoimpl.UnknownFields - - Hi *H128 `protobuf:"bytes,1,opt,name=hi,proto3" json:"hi,omitempty"` - Lo uint32 `protobuf:"varint,2,opt,name=lo,proto3" json:"lo,omitempty"` + sizeCache protoimpl.SizeCache } func (x *H160) Reset() { *x = H160{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *H160) String() string { @@ -102,7 +96,7 @@ func (*H160) ProtoMessage() {} func (x *H160) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -132,21 +126,18 @@ func (x *H160) GetLo() uint32 { } type H256 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Hi *H128 `protobuf:"bytes,1,opt,name=hi,proto3" json:"hi,omitempty"` + Lo *H128 `protobuf:"bytes,2,opt,name=lo,proto3" json:"lo,omitempty"` unknownFields protoimpl.UnknownFields - - Hi *H128 `protobuf:"bytes,1,opt,name=hi,proto3" json:"hi,omitempty"` - Lo *H128 `protobuf:"bytes,2,opt,name=lo,proto3" json:"lo,omitempty"` + sizeCache protoimpl.SizeCache } func (x *H256) Reset() { *x = H256{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *H256) String() string { @@ -157,7 +148,7 @@ func (*H256) ProtoMessage() {} func (x *H256) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -187,21 +178,18 @@ func (x *H256) GetLo() *H128 { } type H512 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Hi *H256 `protobuf:"bytes,1,opt,name=hi,proto3" json:"hi,omitempty"` + Lo *H256 `protobuf:"bytes,2,opt,name=lo,proto3" json:"lo,omitempty"` unknownFields protoimpl.UnknownFields - - Hi *H256 `protobuf:"bytes,1,opt,name=hi,proto3" json:"hi,omitempty"` - Lo *H256 `protobuf:"bytes,2,opt,name=lo,proto3" json:"lo,omitempty"` + sizeCache protoimpl.SizeCache } func (x *H512) Reset() { *x = H512{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *H512) String() string { @@ -212,7 +200,7 @@ func (*H512) ProtoMessage() {} func (x *H512) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -242,21 +230,18 @@ func (x *H512) GetLo() *H256 { } type H1024 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Hi *H512 `protobuf:"bytes,1,opt,name=hi,proto3" json:"hi,omitempty"` + Lo *H512 `protobuf:"bytes,2,opt,name=lo,proto3" json:"lo,omitempty"` unknownFields protoimpl.UnknownFields - - Hi *H512 `protobuf:"bytes,1,opt,name=hi,proto3" json:"hi,omitempty"` - Lo *H512 `protobuf:"bytes,2,opt,name=lo,proto3" json:"lo,omitempty"` + sizeCache protoimpl.SizeCache } func (x *H1024) Reset() { *x = H1024{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *H1024) String() string { @@ -267,7 +252,7 @@ func (*H1024) ProtoMessage() {} func (x *H1024) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -297,21 +282,18 @@ func (x *H1024) GetLo() *H512 { } type H2048 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Hi *H1024 `protobuf:"bytes,1,opt,name=hi,proto3" json:"hi,omitempty"` + Lo *H1024 `protobuf:"bytes,2,opt,name=lo,proto3" json:"lo,omitempty"` unknownFields protoimpl.UnknownFields - - Hi *H1024 `protobuf:"bytes,1,opt,name=hi,proto3" json:"hi,omitempty"` - Lo *H1024 `protobuf:"bytes,2,opt,name=lo,proto3" json:"lo,omitempty"` + sizeCache protoimpl.SizeCache } func (x *H2048) Reset() { *x = H2048{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *H2048) String() string { @@ -322,7 +304,7 @@ func (*H2048) ProtoMessage() {} func (x *H2048) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -353,22 +335,19 @@ func (x *H2048) GetLo() *H1024 { // Reply message containing the current service version on the service side type VersionReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Major uint32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` + Minor uint32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` + Patch uint32 `protobuf:"varint,3,opt,name=patch,proto3" json:"patch,omitempty"` unknownFields protoimpl.UnknownFields - - Major uint32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` - Minor uint32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` - Patch uint32 `protobuf:"varint,3,opt,name=patch,proto3" json:"patch,omitempty"` + sizeCache protoimpl.SizeCache } func (x *VersionReply) Reset() { *x = VersionReply{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *VersionReply) String() string { @@ -379,7 +358,7 @@ func (*VersionReply) ProtoMessage() {} func (x *VersionReply) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -419,37 +398,34 @@ func (x *VersionReply) GetPatch() uint32 { // Engine API types // See https://github.com/ethereum/execution-apis/blob/main/src/engine type ExecutionPayload struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Version uint32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` // v1 - no withdrawals, v2 - with withdrawals, v3 - with blob gas + ParentHash *H256 `protobuf:"bytes,2,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` + Coinbase *H160 `protobuf:"bytes,3,opt,name=coinbase,proto3" json:"coinbase,omitempty"` + StateRoot *H256 `protobuf:"bytes,4,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` + ReceiptRoot *H256 `protobuf:"bytes,5,opt,name=receipt_root,json=receiptRoot,proto3" json:"receipt_root,omitempty"` + LogsBloom *H2048 `protobuf:"bytes,6,opt,name=logs_bloom,json=logsBloom,proto3" json:"logs_bloom,omitempty"` + PrevRandao *H256 `protobuf:"bytes,7,opt,name=prev_randao,json=prevRandao,proto3" json:"prev_randao,omitempty"` + BlockNumber uint64 `protobuf:"varint,8,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + GasLimit uint64 `protobuf:"varint,9,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` + GasUsed uint64 `protobuf:"varint,10,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` + Timestamp uint64 `protobuf:"varint,11,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + ExtraData []byte `protobuf:"bytes,12,opt,name=extra_data,json=extraData,proto3" json:"extra_data,omitempty"` + BaseFeePerGas *H256 `protobuf:"bytes,13,opt,name=base_fee_per_gas,json=baseFeePerGas,proto3" json:"base_fee_per_gas,omitempty"` + BlockHash *H256 `protobuf:"bytes,14,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + Transactions [][]byte `protobuf:"bytes,15,rep,name=transactions,proto3" json:"transactions,omitempty"` + Withdrawals []*Withdrawal `protobuf:"bytes,16,rep,name=withdrawals,proto3" json:"withdrawals,omitempty"` + BlobGasUsed *uint64 `protobuf:"varint,17,opt,name=blob_gas_used,json=blobGasUsed,proto3,oneof" json:"blob_gas_used,omitempty"` + ExcessBlobGas *uint64 `protobuf:"varint,18,opt,name=excess_blob_gas,json=excessBlobGas,proto3,oneof" json:"excess_blob_gas,omitempty"` unknownFields protoimpl.UnknownFields - - Version uint32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` // v1 - no withdrawals, v2 - with withdrawals, v3 - with blob gas - ParentHash *H256 `protobuf:"bytes,2,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` - Coinbase *H160 `protobuf:"bytes,3,opt,name=coinbase,proto3" json:"coinbase,omitempty"` - StateRoot *H256 `protobuf:"bytes,4,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` - ReceiptRoot *H256 `protobuf:"bytes,5,opt,name=receipt_root,json=receiptRoot,proto3" json:"receipt_root,omitempty"` - LogsBloom *H2048 `protobuf:"bytes,6,opt,name=logs_bloom,json=logsBloom,proto3" json:"logs_bloom,omitempty"` - PrevRandao *H256 `protobuf:"bytes,7,opt,name=prev_randao,json=prevRandao,proto3" json:"prev_randao,omitempty"` - BlockNumber uint64 `protobuf:"varint,8,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` - GasLimit uint64 `protobuf:"varint,9,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` - GasUsed uint64 `protobuf:"varint,10,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` - Timestamp uint64 `protobuf:"varint,11,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - ExtraData []byte `protobuf:"bytes,12,opt,name=extra_data,json=extraData,proto3" json:"extra_data,omitempty"` - BaseFeePerGas *H256 `protobuf:"bytes,13,opt,name=base_fee_per_gas,json=baseFeePerGas,proto3" json:"base_fee_per_gas,omitempty"` - BlockHash *H256 `protobuf:"bytes,14,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - Transactions [][]byte `protobuf:"bytes,15,rep,name=transactions,proto3" json:"transactions,omitempty"` - Withdrawals []*Withdrawal `protobuf:"bytes,16,rep,name=withdrawals,proto3" json:"withdrawals,omitempty"` - BlobGasUsed *uint64 `protobuf:"varint,17,opt,name=blob_gas_used,json=blobGasUsed,proto3,oneof" json:"blob_gas_used,omitempty"` - ExcessBlobGas *uint64 `protobuf:"varint,18,opt,name=excess_blob_gas,json=excessBlobGas,proto3,oneof" json:"excess_blob_gas,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ExecutionPayload) Reset() { *x = ExecutionPayload{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ExecutionPayload) String() string { @@ -460,7 +436,7 @@ func (*ExecutionPayload) ProtoMessage() {} func (x *ExecutionPayload) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -602,23 +578,20 @@ func (x *ExecutionPayload) GetExcessBlobGas() uint64 { } type Withdrawal struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` - ValidatorIndex uint64 `protobuf:"varint,2,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` - Address *H160 `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` - Amount uint64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + ValidatorIndex uint64 `protobuf:"varint,2,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` + Address *H160 `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + Amount uint64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Withdrawal) Reset() { *x = Withdrawal{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Withdrawal) String() string { @@ -629,7 +602,7 @@ func (*Withdrawal) ProtoMessage() {} func (x *Withdrawal) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -673,24 +646,21 @@ func (x *Withdrawal) GetAmount() uint64 { } type BlobsBundleV1 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // TODO(eip-4844): define a protobuf message for type KZGCommitment Commitments [][]byte `protobuf:"bytes,1,rep,name=commitments,proto3" json:"commitments,omitempty"` // TODO(eip-4844): define a protobuf message for type Blob - Blobs [][]byte `protobuf:"bytes,2,rep,name=blobs,proto3" json:"blobs,omitempty"` - Proofs [][]byte `protobuf:"bytes,3,rep,name=proofs,proto3" json:"proofs,omitempty"` + Blobs [][]byte `protobuf:"bytes,2,rep,name=blobs,proto3" json:"blobs,omitempty"` + Proofs [][]byte `protobuf:"bytes,3,rep,name=proofs,proto3" json:"proofs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *BlobsBundleV1) Reset() { *x = BlobsBundleV1{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BlobsBundleV1) String() string { @@ -701,7 +671,7 @@ func (*BlobsBundleV1) ProtoMessage() {} func (x *BlobsBundleV1) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -738,20 +708,17 @@ func (x *BlobsBundleV1) GetProofs() [][]byte { } type RequestsBundle struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Requests [][]byte `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"` unknownFields protoimpl.UnknownFields - - Requests [][]byte `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"` + sizeCache protoimpl.SizeCache } func (x *RequestsBundle) Reset() { *x = RequestsBundle{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *RequestsBundle) String() string { @@ -762,7 +729,7 @@ func (*RequestsBundle) ProtoMessage() {} func (x *RequestsBundle) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -785,21 +752,18 @@ func (x *RequestsBundle) GetRequests() [][]byte { } type NodeInfoPorts struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Discovery uint32 `protobuf:"varint,1,opt,name=discovery,proto3" json:"discovery,omitempty"` + Listener uint32 `protobuf:"varint,2,opt,name=listener,proto3" json:"listener,omitempty"` unknownFields protoimpl.UnknownFields - - Discovery uint32 `protobuf:"varint,1,opt,name=discovery,proto3" json:"discovery,omitempty"` - Listener uint32 `protobuf:"varint,2,opt,name=listener,proto3" json:"listener,omitempty"` + sizeCache protoimpl.SizeCache } func (x *NodeInfoPorts) Reset() { *x = NodeInfoPorts{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *NodeInfoPorts) String() string { @@ -810,7 +774,7 @@ func (*NodeInfoPorts) ProtoMessage() {} func (x *NodeInfoPorts) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -840,26 +804,23 @@ func (x *NodeInfoPorts) GetListener() uint32 { } type NodeInfoReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Enode string `protobuf:"bytes,3,opt,name=enode,proto3" json:"enode,omitempty"` + Enr string `protobuf:"bytes,4,opt,name=enr,proto3" json:"enr,omitempty"` + Ports *NodeInfoPorts `protobuf:"bytes,5,opt,name=ports,proto3" json:"ports,omitempty"` + ListenerAddr string `protobuf:"bytes,6,opt,name=listener_addr,json=listenerAddr,proto3" json:"listener_addr,omitempty"` + Protocols []byte `protobuf:"bytes,7,opt,name=protocols,proto3" json:"protocols,omitempty"` unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Enode string `protobuf:"bytes,3,opt,name=enode,proto3" json:"enode,omitempty"` - Enr string `protobuf:"bytes,4,opt,name=enr,proto3" json:"enr,omitempty"` - Ports *NodeInfoPorts `protobuf:"bytes,5,opt,name=ports,proto3" json:"ports,omitempty"` - ListenerAddr string `protobuf:"bytes,6,opt,name=listener_addr,json=listenerAddr,proto3" json:"listener_addr,omitempty"` - Protocols []byte `protobuf:"bytes,7,opt,name=protocols,proto3" json:"protocols,omitempty"` + sizeCache protoimpl.SizeCache } func (x *NodeInfoReply) Reset() { *x = NodeInfoReply{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *NodeInfoReply) String() string { @@ -870,7 +831,7 @@ func (*NodeInfoReply) ProtoMessage() {} func (x *NodeInfoReply) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -935,29 +896,26 @@ func (x *NodeInfoReply) GetProtocols() []byte { } type PeerInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Enode string `protobuf:"bytes,3,opt,name=enode,proto3" json:"enode,omitempty"` - Enr string `protobuf:"bytes,4,opt,name=enr,proto3" json:"enr,omitempty"` - Caps []string `protobuf:"bytes,5,rep,name=caps,proto3" json:"caps,omitempty"` - ConnLocalAddr string `protobuf:"bytes,6,opt,name=conn_local_addr,json=connLocalAddr,proto3" json:"conn_local_addr,omitempty"` - ConnRemoteAddr string `protobuf:"bytes,7,opt,name=conn_remote_addr,json=connRemoteAddr,proto3" json:"conn_remote_addr,omitempty"` - ConnIsInbound bool `protobuf:"varint,8,opt,name=conn_is_inbound,json=connIsInbound,proto3" json:"conn_is_inbound,omitempty"` - ConnIsTrusted bool `protobuf:"varint,9,opt,name=conn_is_trusted,json=connIsTrusted,proto3" json:"conn_is_trusted,omitempty"` - ConnIsStatic bool `protobuf:"varint,10,opt,name=conn_is_static,json=connIsStatic,proto3" json:"conn_is_static,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Enode string `protobuf:"bytes,3,opt,name=enode,proto3" json:"enode,omitempty"` + Enr string `protobuf:"bytes,4,opt,name=enr,proto3" json:"enr,omitempty"` + Caps []string `protobuf:"bytes,5,rep,name=caps,proto3" json:"caps,omitempty"` + ConnLocalAddr string `protobuf:"bytes,6,opt,name=conn_local_addr,json=connLocalAddr,proto3" json:"conn_local_addr,omitempty"` + ConnRemoteAddr string `protobuf:"bytes,7,opt,name=conn_remote_addr,json=connRemoteAddr,proto3" json:"conn_remote_addr,omitempty"` + ConnIsInbound bool `protobuf:"varint,8,opt,name=conn_is_inbound,json=connIsInbound,proto3" json:"conn_is_inbound,omitempty"` + ConnIsTrusted bool `protobuf:"varint,9,opt,name=conn_is_trusted,json=connIsTrusted,proto3" json:"conn_is_trusted,omitempty"` + ConnIsStatic bool `protobuf:"varint,10,opt,name=conn_is_static,json=connIsStatic,proto3" json:"conn_is_static,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *PeerInfo) Reset() { *x = PeerInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PeerInfo) String() string { @@ -968,7 +926,7 @@ func (*PeerInfo) ProtoMessage() {} func (x *PeerInfo) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1054,21 +1012,18 @@ func (x *PeerInfo) GetConnIsStatic() bool { } type ExecutionPayloadBodyV1 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Transactions [][]byte `protobuf:"bytes,1,rep,name=transactions,proto3" json:"transactions,omitempty"` + Withdrawals []*Withdrawal `protobuf:"bytes,2,rep,name=withdrawals,proto3" json:"withdrawals,omitempty"` unknownFields protoimpl.UnknownFields - - Transactions [][]byte `protobuf:"bytes,1,rep,name=transactions,proto3" json:"transactions,omitempty"` - Withdrawals []*Withdrawal `protobuf:"bytes,2,rep,name=withdrawals,proto3" json:"withdrawals,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ExecutionPayloadBodyV1) Reset() { *x = ExecutionPayloadBodyV1{} - if protoimpl.UnsafeEnabled { - mi := &file_types_types_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_types_types_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ExecutionPayloadBodyV1) String() string { @@ -1079,7 +1034,7 @@ func (*ExecutionPayloadBodyV1) ProtoMessage() {} func (x *ExecutionPayloadBodyV1) ProtoReflect() protoreflect.Message { mi := &file_types_types_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1378,188 +1333,6 @@ func file_types_types_proto_init() { if File_types_types_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_types_types_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*H128); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*H160); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*H256); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*H512); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*H1024); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*H2048); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*VersionReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*ExecutionPayload); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*Withdrawal); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*BlobsBundleV1); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*RequestsBundle); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*NodeInfoPorts); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*NodeInfoReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*PeerInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_types_types_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*ExecutionPayloadBodyV1); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } file_types_types_proto_msgTypes[7].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ diff --git a/go.mod b/go.mod index 267ff30d325..b4a36f84dd8 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/99designs/gqlgen v0.17.63 github.com/Giulio2002/bls v0.0.0-20241116091023-2ddcc8954ec0 github.com/Masterminds/sprig/v3 v3.2.3 - github.com/RoaringBitmap/roaring/v2 v2.4.2 + github.com/RoaringBitmap/roaring/v2 v2.4.3 github.com/alecthomas/kong v0.8.1 github.com/anacrolix/sync v0.5.1 github.com/anacrolix/torrent v1.52.6-0.20231201115409-7ea994b6bbd8 @@ -92,14 +92,14 @@ require ( go.uber.org/mock v0.5.0 go.uber.org/zap v1.27.0 golang.org/x/crypto v0.32.0 - golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c + golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c golang.org/x/net v0.34.0 golang.org/x/sync v0.10.0 golang.org/x/sys v0.29.0 golang.org/x/time v0.9.0 - google.golang.org/grpc v1.65.0 - google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0 - google.golang.org/protobuf v1.36.3 + google.golang.org/grpc v1.69.4 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 + google.golang.org/protobuf v1.36.4 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v2 v2.4.0 @@ -128,8 +128,9 @@ require ( github.com/tklauser/numcpus v0.8.0 // indirect github.com/wlynxg/anet v0.0.5 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect + go.opentelemetry.io/otel/metric v1.31.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect ) require ( @@ -276,8 +277,8 @@ require ( github.com/supranational/blst v0.3.13 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect go.etcd.io/bbolt v1.3.6 // indirect - go.opentelemetry.io/otel v1.8.0 // indirect - go.opentelemetry.io/otel/trace v1.8.0 // indirect + go.opentelemetry.io/otel v1.31.0 // indirect + go.opentelemetry.io/otel/trace v1.31.0 // indirect go.uber.org/dig v1.18.0 // indirect go.uber.org/fx v1.23.0 // indirect go.uber.org/multierr v1.11.0 // indirect diff --git a/go.sum b/go.sum index a63c1e0dfd9..6a263eacee9 100644 --- a/go.sum +++ b/go.sum @@ -72,8 +72,8 @@ github.com/RoaringBitmap/roaring v0.4.17/go.mod h1:D3qVegWTmfCaX4Bl5CrBE9hfrSrrX github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= github.com/RoaringBitmap/roaring v1.9.4 h1:yhEIoH4YezLYT04s1nHehNO64EKFTop/wBhxv2QzDdQ= github.com/RoaringBitmap/roaring v1.9.4/go.mod h1:6AXUsoIEzDTFFQCe1RbGA6uFONMhvejWj5rqITANK90= -github.com/RoaringBitmap/roaring/v2 v2.4.2 h1:ew/INI7HLRyYK+dCbF6FcUwoe2Q0q5HCV7WafY9ljBk= -github.com/RoaringBitmap/roaring/v2 v2.4.2/go.mod h1:FiJcsfkGje/nZBZgCu0ZxCPOKD/hVXDS2dXi7/eUFE0= +github.com/RoaringBitmap/roaring/v2 v2.4.3 h1:McS6DMZVPnu6N0KnVFwSanU4LPBCTqmclXDqbsO49vw= +github.com/RoaringBitmap/roaring/v2 v2.4.3/go.mod h1:FiJcsfkGje/nZBZgCu0ZxCPOKD/hVXDS2dXi7/eUFE0= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/agnivade/levenshtein v1.2.0 h1:U9L4IOT0Y3i0TIlUIDJ7rVUziKi/zPbrJGaFrtYH3SY= @@ -928,10 +928,16 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/otel v1.8.0 h1:zcvBFizPbpa1q7FehvFiHbQwGzmPILebO0tyqIR5Djg= -go.opentelemetry.io/otel v1.8.0/go.mod h1:2pkj+iMj0o03Y+cW6/m8Y4WkRdYN3AvCXCnzRMp9yvM= -go.opentelemetry.io/otel/trace v1.8.0 h1:cSy0DF9eGI5WIfNwZ1q2iUyGj00tGzP24dE1lOlHrfY= -go.opentelemetry.io/otel/trace v1.8.0/go.mod h1:0Bt3PXY8w+3pheS3hQUt+wow8b1ojPaTBoTCh2zIFI4= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= +go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= +go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= +go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= +go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/dig v1.18.0 h1:imUL1UiY0Mg4bqbFfsRQO5G4CGRBec/ZujWTvSVp3pw= go.uber.org/dig v1.18.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= @@ -982,8 +988,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY= -golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= +golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c h1:KL/ZBHXgKGVmuZBZ01Lt57yE5ws8ZPSkkihmEyq7FXc= +golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1326,10 +1332,10 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 h1:fVoAXEKA4+yufmbdVYv+SE73+cPZbbbe8paLsHfkK+U= +google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53/go.mod h1:riSXTwQ4+nqmPGtobMFyW5FqVAmIs0St6VPp4Ug7CE4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -1349,10 +1355,10 @@ google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0 h1:9SxA29VM43MF5Z9dQu694wmY5t8E/Gxr7s+RSxiIDmc= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0/go.mod h1:yZOK5zhQMiALmuweVdIVoQPa6eIJyXn2B9g5dJDhqX4= +google.golang.org/grpc v1.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A= +google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1363,8 +1369,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU= -google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM= +google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/polygon/p2p/peer_event_registrar_mock.go b/polygon/p2p/peer_event_registrar_mock.go index 189c9f3a03f..68747948ef8 100644 --- a/polygon/p2p/peer_event_registrar_mock.go +++ b/polygon/p2p/peer_event_registrar_mock.go @@ -22,6 +22,7 @@ import ( type MockpeerEventRegistrar struct { ctrl *gomock.Controller recorder *MockpeerEventRegistrarMockRecorder + isgomock struct{} } // MockpeerEventRegistrarMockRecorder is the mock recorder for MockpeerEventRegistrar. diff --git a/txnprovider/txpool/fetch_test.go b/txnprovider/txpool/fetch_test.go index 3f6f0e00f1a..865bf007030 100644 --- a/txnprovider/txpool/fetch_test.go +++ b/txnprovider/txpool/fetch_test.go @@ -233,7 +233,7 @@ func TestOnNewBlock(t *testing.T) { _, db := memdb.NewTestDB(t, kv.ChainDB), memdb.NewTestDB(t, kv.TxPoolDB) ctrl := gomock.NewController(t) - stream := remote.NewMockKV_StateChangesClient(ctrl) + stream := remote.NewMockKV_StateChangesClient[*remote.StateChangeBatch](ctrl) i := 0 stream.EXPECT(). Recv(). From d96f7122531ed8168ae923634956fb2911a41874 Mon Sep 17 00:00:00 2001 From: milen <94537774+taratorio@users.noreply.github.com> Date: Mon, 3 Feb 2025 11:21:03 +0000 Subject: [PATCH 15/16] shutter: add eon tracker (#13647) - part 1 of https://github.com/erigontech/erigon/issues/13384 (adding eon based validation of decryption keys) - part 2 will be to use the eon info to validate the keys - takes a chunk of changes out of bigger branch https://github.com/erigontech/erigon/pull/13553 --- eth/backend.go | 2 +- txnprovider/shutter/block_listener.go | 75 +++++ txnprovider/shutter/config.go | 13 +- .../shutter/decryption_keys_listener.go | 20 +- .../shutter/decryption_keys_validator.go | 96 +++++- .../shutter/decryption_keys_validator_test.go | 212 +++++++++++- txnprovider/shutter/eon_tracker.go | 304 ++++++++++++++++++ .../internal/testhelpers/eon_tracker_mock.go | 158 +++++++++ .../shutter/internal/testhelpers/mockgen.go | 29 ++ .../testhelpers/slot_calculator_mock.go | 156 +++++++++ txnprovider/shutter/pool.go | 14 +- txnprovider/shutter/slot_calculator.go | 64 ++++ txnprovider/shutter/state_changes_client.go | 29 ++ 13 files changed, 1137 insertions(+), 35 deletions(-) create mode 100644 txnprovider/shutter/block_listener.go create mode 100644 txnprovider/shutter/eon_tracker.go create mode 100644 txnprovider/shutter/internal/testhelpers/eon_tracker_mock.go create mode 100644 txnprovider/shutter/internal/testhelpers/mockgen.go create mode 100644 txnprovider/shutter/internal/testhelpers/slot_calculator_mock.go create mode 100644 txnprovider/shutter/slot_calculator.go create mode 100644 txnprovider/shutter/state_changes_client.go diff --git a/eth/backend.go b/eth/backend.go index b23183baf06..35a31b4560c 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -744,7 +744,7 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger ) contractBackend := contracts.NewDirectBackend(ethApi) secondaryTxnProvider := backend.txPool - backend.shutterPool = shutter.NewPool(logger, config.Shutter, secondaryTxnProvider, contractBackend) + backend.shutterPool = shutter.NewPool(logger, config.Shutter, secondaryTxnProvider, contractBackend, backend.stateDiffClient) txnProvider = backend.shutterPool } diff --git a/txnprovider/shutter/block_listener.go b/txnprovider/shutter/block_listener.go new file mode 100644 index 00000000000..1957c04cdfb --- /dev/null +++ b/txnprovider/shutter/block_listener.go @@ -0,0 +1,75 @@ +// Copyright 2025 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 shutter + +import ( + "context" + + "github.com/erigontech/erigon-lib/event" + "github.com/erigontech/erigon-lib/gointerfaces/remoteproto" + "github.com/erigontech/erigon-lib/log/v3" +) + +type BlockEvent struct { + BlockNum uint64 + Unwind bool +} + +type BlockListener struct { + logger log.Logger + stateChangesClient stateChangesClient + events *event.Observers[BlockEvent] +} + +func NewBlockListener(logger log.Logger, stateChangesClient stateChangesClient) BlockListener { + return BlockListener{ + logger: logger, + stateChangesClient: stateChangesClient, + events: event.NewObservers[BlockEvent](), + } +} + +func (bl BlockListener) RegisterObserver(o event.Observer[BlockEvent]) event.UnregisterFunc { + return bl.events.Register(o) +} + +func (bl BlockListener) Run(ctx context.Context) error { + bl.logger.Info("running block listener") + + sub, err := bl.stateChangesClient.StateChanges(ctx, &remoteproto.StateChangeRequest{}) + if err != nil { + return err + } + + // note the changes stream is ctx-aware so Recv should terminate with err if ctx gets done + var batch *remoteproto.StateChangeBatch + for batch, err = sub.Recv(); err != nil; batch, err = sub.Recv() { + if batch == nil || len(batch.ChangeBatch) == 0 { + continue + } + + latestChange := batch.ChangeBatch[len(batch.ChangeBatch)-1] + blockEvent := BlockEvent{ + BlockNum: latestChange.BlockHeight, + Unwind: latestChange.Direction == remoteproto.Direction_UNWIND, + } + + bl.events.NotifySync(blockEvent) + } + + return err +} diff --git a/txnprovider/shutter/config.go b/txnprovider/shutter/config.go index 9d41941d0a4..cd29dc0d0bc 100644 --- a/txnprovider/shutter/config.go +++ b/txnprovider/shutter/config.go @@ -1,4 +1,4 @@ -// Copyright 2024 The Erigon Authors +// Copyright 2025 The Erigon Authors // This file is part of Erigon. // // Erigon is free software: you can redistribute it and/or modify @@ -23,17 +23,21 @@ import ( "github.com/multiformats/go-multiaddr" "github.com/erigontech/erigon-lib/chain/networkname" + "github.com/erigontech/erigon/cl/clparams" ) type Config struct { P2pConfig Enabled bool InstanceId uint64 + BeaconChainGenesisTimestamp uint64 + SecondsPerSlot uint64 SequencerContractAddress string ValidatorRegistryContractAddress string KeyBroadcastContractAddress string KeyperSetManagerContractAddress string MaxNumKeysPerMessage uint64 + MaxRecentEons int } type P2pConfig struct { @@ -76,11 +80,14 @@ var ( chiadoConfig = Config{ Enabled: true, InstanceId: 102_000, + BeaconChainGenesisTimestamp: 1665396300, + SecondsPerSlot: clparams.BeaconConfigs[clparams.ChiadoNetwork].SecondsPerSlot, SequencerContractAddress: "0x2aD8E2feB0ED5b2EC8e700edB725f120576994ed", ValidatorRegistryContractAddress: "0xa9289A3Dd14FEBe10611119bE81E5d35eAaC3084", KeyBroadcastContractAddress: "0x9D31865BEffcE842FBd36CDA587aDDA8bef804B7", KeyperSetManagerContractAddress: "0xC4DE9FAf4ec882b33dA0162CBE628B0D8205D0c0", MaxNumKeysPerMessage: defaultMaxNumKeysPerMessage, + MaxRecentEons: defaultMaxRecentEons, P2pConfig: P2pConfig{ ListenPort: defaultP2PListenPort, BootstrapNodes: []string{ @@ -93,11 +100,14 @@ var ( gnosisConfig = Config{ Enabled: true, InstanceId: 1_000, + BeaconChainGenesisTimestamp: 1638993340, + SecondsPerSlot: clparams.BeaconConfigs[clparams.GnosisNetwork].SecondsPerSlot, SequencerContractAddress: "0xc5C4b277277A1A8401E0F039dfC49151bA64DC2E", ValidatorRegistryContractAddress: "0xefCC23E71f6bA9B22C4D28F7588141d44496A6D6", KeyBroadcastContractAddress: "0x626dB87f9a9aC47070016A50e802dd5974341301", KeyperSetManagerContractAddress: "0x7C2337f9bFce19d8970661DA50dE8DD7d3D34abb", MaxNumKeysPerMessage: defaultMaxNumKeysPerMessage, + MaxRecentEons: defaultMaxRecentEons, P2pConfig: P2pConfig{ ListenPort: defaultP2PListenPort, BootstrapNodes: []string{ @@ -111,4 +121,5 @@ var ( const ( defaultP2PListenPort = 23_102 defaultMaxNumKeysPerMessage = 500 + defaultMaxRecentEons = 100 ) diff --git a/txnprovider/shutter/decryption_keys_listener.go b/txnprovider/shutter/decryption_keys_listener.go index ee995f8a10d..f65a96d9de7 100644 --- a/txnprovider/shutter/decryption_keys_listener.go +++ b/txnprovider/shutter/decryption_keys_listener.go @@ -41,16 +41,20 @@ const ( ) type DecryptionKeysListener struct { - logger log.Logger - config Config - observers *event.Observers[*proto.DecryptionKeys] + logger log.Logger + config Config + slotCalculator SlotCalculator + eonTracker EonTracker + observers *event.Observers[*proto.DecryptionKeys] } -func NewDecryptionKeysListener(logger log.Logger, config Config) DecryptionKeysListener { +func NewDecryptionKeysListener(logger log.Logger, config Config, sc SlotCalculator, et EonTracker) DecryptionKeysListener { return DecryptionKeysListener{ - logger: logger, - config: config, - observers: event.NewObservers[*proto.DecryptionKeys](), + logger: logger, + config: config, + slotCalculator: sc, + eonTracker: et, + observers: event.NewObservers[*proto.DecryptionKeys](), } } @@ -207,7 +211,7 @@ func (dkl DecryptionKeysListener) connectBootstrapNodes(ctx context.Context, hos } func (dkl DecryptionKeysListener) listenLoop(ctx context.Context, pubSub *pubsub.PubSub) error { - topicValidator := NewDecryptionKeysP2pValidatorEx(dkl.logger, dkl.config) + topicValidator := NewDecryptionKeysP2pValidatorEx(dkl.logger, dkl.config, dkl.slotCalculator, dkl.eonTracker) err := pubSub.RegisterTopicValidator(DecryptionKeysTopic, topicValidator) if err != nil { return err diff --git a/txnprovider/shutter/decryption_keys_validator.go b/txnprovider/shutter/decryption_keys_validator.go index a2d4b79745a..65d5c330017 100644 --- a/txnprovider/shutter/decryption_keys_validator.go +++ b/txnprovider/shutter/decryption_keys_validator.go @@ -14,6 +14,8 @@ // You should have received a copy of the GNU Lesser General Public License // along with Erigon. If not, see . +//go:build !abigen + package shutter import ( @@ -33,19 +35,29 @@ var ( ErrInstanceIdMismatch = errors.New("instance id mismatch") ErrMissingGnosisExtraData = errors.New("missing gnosis extra data") ErrSlotTooLarge = errors.New("slot too large") + ErrSlotInThePast = errors.New("slot in the past") + ErrSlotInTheFuture = errors.New("slot in the future") ErrTxPointerTooLarge = errors.New("tx pointer too large") ErrEonTooLarge = errors.New("eon too large") + ErrCurrentEonUnavailable = errors.New("current eon unavailable") + ErrEonInThePast = errors.New("eon in the past") + ErrEonInTheFuture = errors.New("eon in the future") ErrEmptyKeys = errors.New("empty keys") ErrTooManyKeys = errors.New("too many keys") + ErrIgnoreMsg = errors.New("ignoring msg") ) type DecryptionKeysValidator struct { - config Config + config Config + slotCalculator SlotCalculator + eonTracker EonTracker } -func NewDecryptionKeysValidator(config Config) DecryptionKeysValidator { +func NewDecryptionKeysValidator(config Config, sc SlotCalculator, et EonTracker) DecryptionKeysValidator { return DecryptionKeysValidator{ - config: config, + config: config, + slotCalculator: sc, + eonTracker: et, } } @@ -54,23 +66,54 @@ func (v DecryptionKeysValidator) Validate(msg *proto.DecryptionKeys) error { return fmt.Errorf("%w: %d", ErrInstanceIdMismatch, msg.InstanceId) } + if err := v.validateExtraData(msg); err != nil { + return err + } + + if err := v.validateEonIndex(msg); err != nil { + return err + } + + return v.validateKeys(msg) +} + +func (v DecryptionKeysValidator) validateExtraData(msg *proto.DecryptionKeys) error { gnosisExtraData := msg.GetGnosis() if gnosisExtraData == nil { return ErrMissingGnosisExtraData } - if gnosisExtraData.Slot > math.MaxInt64 { - return fmt.Errorf("%w: %d", ErrSlotTooLarge, gnosisExtraData.Slot) + if err := v.validateSlot(msg); err != nil { + return err } if gnosisExtraData.TxPointer > math.MaxInt32 { return fmt.Errorf("%w: %d", ErrTxPointerTooLarge, gnosisExtraData.TxPointer) } - if msg.Eon > math.MaxInt64 { - return fmt.Errorf("%w: %d", ErrEonTooLarge, msg.Eon) + return nil +} + +func (v DecryptionKeysValidator) validateSlot(msg *proto.DecryptionKeys) error { + msgSlot := msg.GetGnosis().Slot + if msgSlot > math.MaxInt64 { + return fmt.Errorf("%w: %d", ErrSlotTooLarge, msgSlot) + } + + currentSlot := v.slotCalculator.CalcCurrentSlot() + if msgSlot < currentSlot { + return fmt.Errorf("%w: msgSlot=%d, currentSlot=%d", ErrSlotInThePast, msgSlot, currentSlot) + } + + if msgSlot > currentSlot+1 { + // msgSlot can be either for current slot or for the next one depending on timing, but not further ahead than that + return fmt.Errorf("%w: msgSlot=%d, currentSlot=%d", ErrSlotInTheFuture, msgSlot, currentSlot) } + return nil +} + +func (v DecryptionKeysValidator) validateKeys(msg *proto.DecryptionKeys) error { if len(msg.Keys) == 0 { return ErrEmptyKeys } @@ -81,15 +124,41 @@ func (v DecryptionKeysValidator) Validate(msg *proto.DecryptionKeys) error { // // TODO when we add the shcrypto library and smart contract state accessors: - // - add validation for signers and signatures based on keyper set and eon infos + // - add validation for signers and signatures based on keyper set and currentEon infos // - add DecryptionKeys.Validate() equivalent which checks the Key unmarshalling into shcrypto.EpochSecretKey // - add validation forVerifyEpochSecretKey: check if we should be doing this validation // + return nil } -func NewDecryptionKeysP2pValidatorEx(logger log.Logger, config Config) pubsub.ValidatorEx { - dkv := NewDecryptionKeysValidator(config) +func (v DecryptionKeysValidator) validateEonIndex(msg *proto.DecryptionKeys) error { + if msg.Eon > math.MaxInt64 { + return fmt.Errorf("%w: %d", ErrEonTooLarge, msg.Eon) + } + + msgEonIndex := EonIndex(msg.Eon) + currentEon, ok := v.eonTracker.CurrentEon() + if !ok { + // we're still syncing and are behind - ignore msg, without penalizing peer + return fmt.Errorf("%w: %w", ErrIgnoreMsg, ErrCurrentEonUnavailable) + } + + _, inRecent := v.eonTracker.RecentEon(msgEonIndex) + if msgEonIndex < currentEon.Index && !inRecent { + return fmt.Errorf("%w: msgEonIndex=%d, currentEonIndex=%d", ErrEonInThePast, msgEonIndex, currentEon.Index) + } + + if msgEonIndex > currentEon.Index && !inRecent { + // we may be lagging behind - ignore msg, without penalizing peer + return fmt.Errorf("%w: %w: msgEonIndex=%d, currentEonIndex=%d", ErrIgnoreMsg, ErrEonInTheFuture, msgEonIndex, currentEon.Index) + } + + return nil +} + +func NewDecryptionKeysP2pValidatorEx(logger log.Logger, config Config, sc SlotCalculator, et EonTracker) pubsub.ValidatorEx { + dkv := NewDecryptionKeysValidator(config, sc, et) return func(ctx context.Context, id peer.ID, msg *pubsub.Message) pubsub.ValidationResult { if topic := msg.GetTopic(); topic != DecryptionKeysTopic { logger.Debug("rejecting decryption keys msg due to topic mismatch", "topic", topic, "peer", id) @@ -104,7 +173,12 @@ func NewDecryptionKeysP2pValidatorEx(logger log.Logger, config Config) pubsub.Va err = dkv.Validate(decryptionKeys) if err != nil { - logger.Debug("rejecting decryption keys msg due to data validation error", "err", err, "peer", id) + if errors.Is(err, ErrIgnoreMsg) { + logger.Debug("ignoring decryption keys msg due to", "err", err, "peer", id) + return pubsub.ValidationIgnore + } + + logger.Debug("rejecting decryption keys msg due to", "err", err, "peer", id) return pubsub.ValidationReject } diff --git a/txnprovider/shutter/decryption_keys_validator_test.go b/txnprovider/shutter/decryption_keys_validator_test.go index fb384f42ffd..aac6564c1ba 100644 --- a/txnprovider/shutter/decryption_keys_validator_test.go +++ b/txnprovider/shutter/decryption_keys_validator_test.go @@ -23,6 +23,7 @@ import ( pubsub "github.com/libp2p/go-libp2p-pubsub" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/turbo/testlog" @@ -41,10 +42,11 @@ func TestDecryptionKeysValidator(t *testing.T) { msg, err := shutterproto.UnmarshallDecryptionKeys(tc.msg.Data) require.NoError(t, err) - validator := shutter.NewDecryptionKeysValidator(shutter.Config{ + config := shutter.Config{ InstanceId: testhelpers.TestInstanceId, MaxNumKeysPerMessage: testhelpers.TestMaxNumKeysPerMessage, - }) + } + validator := shutter.NewDecryptionKeysValidator(config, tc.slotCalculator(t), tc.eonTracker(t)) haveErr := validator.Validate(msg) require.ErrorIs(t, haveErr, tc.wantErr) }) @@ -64,10 +66,11 @@ func TestDecryptionKeysP2pValidatorEx(t *testing.T) { logHandler := testhelpers.NewCollectingLogHandler(logger.GetHandler()) logger.SetHandler(logHandler) - validator := shutter.NewDecryptionKeysP2pValidatorEx(logger, shutter.Config{ + config := shutter.Config{ InstanceId: testhelpers.TestInstanceId, MaxNumKeysPerMessage: testhelpers.TestMaxNumKeysPerMessage, - }) + } + validator := shutter.NewDecryptionKeysP2pValidatorEx(logger, config, tc.slotCalculator(t), tc.eonTracker(t)) haveValidationResult := validator(ctx, "peer1", tc.msg) require.Equal(t, tc.wantValidationResult, haveValidationResult) require.True( @@ -84,6 +87,8 @@ func TestDecryptionKeysP2pValidatorEx(t *testing.T) { type decryptionKeysValidationTestCase struct { name string msg *pubsub.Message + slotCalculator func(t *testing.T) shutter.SlotCalculator + eonTracker func(t *testing.T) shutter.EonTracker wantErr error wantValidationResult pubsub.ValidationResult wantValidationLogMsgs []string @@ -96,10 +101,12 @@ func decryptionKeysValidatorTestCases(t *testing.T) []decryptionKeysValidationTe msg: testhelpers.MockDecryptionKeysMsg(t, testhelpers.MockDecryptionKeysMsgOptions{ InstanceIdOverride: 999999, }), + slotCalculator: mockSlotCalculator(), + eonTracker: mockEonTracker(), wantErr: shutter.ErrInstanceIdMismatch, wantValidationResult: pubsub.ValidationReject, wantValidationLogMsgs: []string{ - "rejecting decryption keys msg due to data validation error", + "rejecting decryption keys msg due to", "instance id mismatch: 999999", }, }, @@ -108,10 +115,12 @@ func decryptionKeysValidatorTestCases(t *testing.T) []decryptionKeysValidationTe msg: testhelpers.MockDecryptionKeysMsg(t, testhelpers.MockDecryptionKeysMsgOptions{ NilExtra: true, }), + slotCalculator: mockSlotCalculator(), + eonTracker: mockEonTracker(), wantErr: shutter.ErrMissingGnosisExtraData, wantValidationResult: pubsub.ValidationReject, wantValidationLogMsgs: []string{ - "rejecting decryption keys msg due to data validation error", + "rejecting decryption keys msg due to", "missing gnosis extra data", }, }, @@ -120,60 +129,161 @@ func decryptionKeysValidatorTestCases(t *testing.T) []decryptionKeysValidationTe msg: testhelpers.MockDecryptionKeysMsg(t, testhelpers.MockDecryptionKeysMsgOptions{ Slot: math.MaxInt64 + 1, }), + slotCalculator: mockSlotCalculator(), + eonTracker: mockEonTracker(), wantErr: shutter.ErrSlotTooLarge, wantValidationResult: pubsub.ValidationReject, wantValidationLogMsgs: []string{ - "rejecting decryption keys msg due to data validation error", + "rejecting decryption keys msg due to", "slot too large: 9223372036854775808", }, }, + { + name: "slot in the past", + msg: testhelpers.MockDecryptionKeysMsg(t, testhelpers.MockDecryptionKeysMsgOptions{ + Slot: 15, + }), + slotCalculator: mockSlotCalculator(withCurrentSlotMock(16)), + eonTracker: mockEonTracker(), + wantErr: shutter.ErrSlotInThePast, + wantValidationResult: pubsub.ValidationReject, + wantValidationLogMsgs: []string{ + "rejecting decryption keys msg due to", + "slot in the past: msgSlot=15, currentSlot=16", + }, + }, + { + name: "slot in the future", + msg: testhelpers.MockDecryptionKeysMsg(t, testhelpers.MockDecryptionKeysMsgOptions{ + Slot: 18, + }), + slotCalculator: mockSlotCalculator(withCurrentSlotMock(16)), + eonTracker: mockEonTracker(), + wantErr: shutter.ErrSlotInTheFuture, + wantValidationResult: pubsub.ValidationReject, + wantValidationLogMsgs: []string{ + "rejecting decryption keys msg due to", + "slot in the future: msgSlot=18, currentSlot=16", + }, + }, { name: "tx pointer too large", msg: testhelpers.MockDecryptionKeysMsg(t, testhelpers.MockDecryptionKeysMsgOptions{ + Slot: 16, TxPointer: math.MaxInt32 + 1, }), + slotCalculator: mockSlotCalculator(withCurrentSlotMock(16)), + eonTracker: mockEonTracker(), wantErr: shutter.ErrTxPointerTooLarge, wantValidationResult: pubsub.ValidationReject, wantValidationLogMsgs: []string{ - "rejecting decryption keys msg due to data validation error", + "rejecting decryption keys msg due to", "tx pointer too large: 2147483648", }, }, { name: "eon too large", msg: testhelpers.MockDecryptionKeysMsg(t, testhelpers.MockDecryptionKeysMsgOptions{ - Eon: math.MaxInt64 + 1, + Slot: 16, + Eon: math.MaxInt64 + 1, }), + slotCalculator: mockSlotCalculator(withCurrentSlotMock(16)), + eonTracker: mockEonTracker(), wantErr: shutter.ErrEonTooLarge, wantValidationResult: pubsub.ValidationReject, wantValidationLogMsgs: []string{ - "rejecting decryption keys msg due to data validation error", + "rejecting decryption keys msg due to", "eon too large: 9223372036854775808", }, }, + { + name: "current eon unavailable", + msg: testhelpers.MockDecryptionKeysMsg(t, testhelpers.MockDecryptionKeysMsgOptions{ + Slot: 16, + Eon: 2, + }), + slotCalculator: mockSlotCalculator(withCurrentSlotMock(16)), + eonTracker: mockEonTracker(withCurrentEonMock(currentEonMock{eon: shutter.Eon{}, ok: false})), + wantErr: shutter.ErrCurrentEonUnavailable, + wantValidationResult: pubsub.ValidationIgnore, + wantValidationLogMsgs: []string{ + "ignoring decryption keys msg due to", + "current eon unavailable", + }, + }, + { + name: "eon in the past", + msg: testhelpers.MockDecryptionKeysMsg(t, testhelpers.MockDecryptionKeysMsgOptions{ + Slot: 16, + Eon: 1, + }), + slotCalculator: mockSlotCalculator(withCurrentSlotMock(16)), + eonTracker: mockEonTracker( + withCurrentEonMock(currentEonMock{eon: shutter.Eon{Index: 2}, ok: true}), + withRecentEonMock(recentEonMock{eon: shutter.Eon{}, ok: false}), + ), + wantErr: shutter.ErrEonInThePast, + wantValidationResult: pubsub.ValidationReject, + wantValidationLogMsgs: []string{ + "rejecting decryption keys msg due to", + "eon in the past: msgEonIndex=1, currentEonIndex=2", + }, + }, + { + name: "eon in the future", + msg: testhelpers.MockDecryptionKeysMsg(t, testhelpers.MockDecryptionKeysMsgOptions{ + Slot: 16, + Eon: 3, + }), + slotCalculator: mockSlotCalculator(withCurrentSlotMock(16)), + eonTracker: mockEonTracker( + withCurrentEonMock(currentEonMock{eon: shutter.Eon{Index: 2}, ok: true}), + withRecentEonMock(recentEonMock{eon: shutter.Eon{}, ok: false}), + ), + wantErr: shutter.ErrEonInTheFuture, + wantValidationResult: pubsub.ValidationIgnore, + wantValidationLogMsgs: []string{ + "ignoring decryption keys msg due to", + "eon in the future: msgEonIndex=3, currentEonIndex=2", + }, + }, { name: "empty keys", msg: testhelpers.MockDecryptionKeysMsg(t, testhelpers.MockDecryptionKeysMsgOptions{ + Slot: 16, + Eon: 2, Keys: [][]byte{}, IdentityPreimages: [][]byte{}, }), + slotCalculator: mockSlotCalculator(withCurrentSlotMock(16)), + eonTracker: mockEonTracker( + withCurrentEonMock(currentEonMock{eon: shutter.Eon{Index: 2}, ok: true}), + withRecentEonMock(recentEonMock{eon: shutter.Eon{Index: 2}, ok: true}), + ), wantErr: shutter.ErrEmptyKeys, wantValidationResult: pubsub.ValidationReject, wantValidationLogMsgs: []string{ - "rejecting decryption keys msg due to data validation error", + "rejecting decryption keys msg due to", "empty keys", }, }, { name: "too many keys", msg: testhelpers.MockDecryptionKeysMsg(t, testhelpers.MockDecryptionKeysMsgOptions{ + Slot: 16, + Eon: 2, Keys: [][]byte{[]byte("key1"), []byte("key2"), []byte("key3"), []byte("key4")}, IdentityPreimages: [][]byte{[]byte("id1"), []byte("id2"), []byte("id3"), []byte("id4")}, }), + slotCalculator: mockSlotCalculator(withCurrentSlotMock(16)), + eonTracker: mockEonTracker( + withCurrentEonMock(currentEonMock{eon: shutter.Eon{Index: 2}, ok: true}), + withRecentEonMock(recentEonMock{eon: shutter.Eon{Index: 2}, ok: true}), + ), wantErr: shutter.ErrTooManyKeys, wantValidationResult: pubsub.ValidationReject, wantValidationLogMsgs: []string{ - "rejecting decryption keys msg due to data validation error", + "rejecting decryption keys msg due to", "too many keys: 4", }, }, @@ -188,6 +298,8 @@ func decryptionKeysP2pValidatorExTestCases(t *testing.T) []decryptionKeysValidat msg: testhelpers.MockDecryptionKeysMsg(t, testhelpers.MockDecryptionKeysMsgOptions{ EnvelopeDataOverride: []byte("invalid"), }), + slotCalculator: mockSlotCalculator(), + eonTracker: mockEonTracker(), wantValidationResult: pubsub.ValidationReject, wantValidationLogMsgs: []string{ "rejecting decryption keys msg due to unmarshalling error", @@ -198,3 +310,79 @@ func decryptionKeysP2pValidatorExTestCases(t *testing.T) []decryptionKeysValidat decryptionKeysValidatorTestCases(t)..., ) } + +type mockSlotCalculatorOpt func(mock *testhelpers.MockSlotCalculator) + +func mockSlotCalculator(opts ...mockSlotCalculatorOpt) func(t *testing.T) shutter.SlotCalculator { + return func(t *testing.T) shutter.SlotCalculator { + ctrl := gomock.NewController(t) + sc := testhelpers.NewMockSlotCalculator(ctrl) + for _, opt := range opts { + opt(sc) + } + return sc + } +} + +func withCurrentSlotMock(vals ...uint64) mockSlotCalculatorOpt { + i := -1 + return func(sc *testhelpers.MockSlotCalculator) { + sc.EXPECT(). + CalcCurrentSlot(). + DoAndReturn(func() uint64 { + i++ + return vals[i] + }). + Times(len(vals)) + } +} + +type mockEonTracerOpt func(mock *testhelpers.MockEonTracker) + +func mockEonTracker(opts ...mockEonTracerOpt) func(t *testing.T) shutter.EonTracker { + return func(t *testing.T) shutter.EonTracker { + ctrl := gomock.NewController(t) + et := testhelpers.NewMockEonTracker(ctrl) + for _, opt := range opts { + opt(et) + } + + return et + } +} + +type currentEonMock struct { + eon shutter.Eon + ok bool +} + +func withCurrentEonMock(vals ...currentEonMock) mockEonTracerOpt { + i := -1 + return func(et *testhelpers.MockEonTracker) { + et.EXPECT(). + CurrentEon(). + DoAndReturn(func() (shutter.Eon, bool) { + i++ + return vals[i].eon, vals[i].ok + }). + Times(len(vals)) + } +} + +type recentEonMock struct { + eon shutter.Eon + ok bool +} + +func withRecentEonMock(vals ...recentEonMock) mockEonTracerOpt { + i := -1 + return func(et *testhelpers.MockEonTracker) { + et.EXPECT(). + RecentEon(gomock.Any()). + DoAndReturn(func(index shutter.EonIndex) (shutter.Eon, bool) { + i++ + return vals[i].eon, vals[i].ok + }). + Times(len(vals)) + } +} diff --git a/txnprovider/shutter/eon_tracker.go b/txnprovider/shutter/eon_tracker.go new file mode 100644 index 00000000000..14f04deb6c6 --- /dev/null +++ b/txnprovider/shutter/eon_tracker.go @@ -0,0 +1,304 @@ +// Copyright 2025 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 !abigen + +package shutter + +import ( + "context" + "fmt" + "math/big" + "sync/atomic" + "time" + + lru "github.com/hashicorp/golang-lru/v2" + "golang.org/x/sync/errgroup" + + libcommon "github.com/erigontech/erigon-lib/common" + "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/accounts/abi/bind" + "github.com/erigontech/erigon/txnprovider/shutter/internal/contracts" +) + +type EonTracker interface { + Run(ctx context.Context) error + CurrentEon() (Eon, bool) + RecentEon(index EonIndex) (Eon, bool) +} + +type EonIndex uint64 + +type Eon struct { + Index EonIndex + ActivationBlock uint64 + Key []byte + Threshold uint64 + Members []libcommon.Address +} + +type KsmEonTracker struct { + logger log.Logger + blockListener BlockListener + contractBackend bind.ContractBackend + ksmContract *contracts.KeyperSetManager + keyBroadcastContract *contracts.KeyBroadcastContract + currentEon atomic.Pointer[Eon] + recentEons *lru.Cache[EonIndex, Eon] + lastCleanupBlockNum uint64 +} + +func NewKsmEonTracker(config Config, blockListener BlockListener, contractBackend bind.ContractBackend) *KsmEonTracker { + ksmContractAddr := libcommon.HexToAddress(config.KeyperSetManagerContractAddress) + ksmContract, err := contracts.NewKeyperSetManager(ksmContractAddr, contractBackend) + if err != nil { + panic(fmt.Errorf("failed to create KeyperSetManager: %w", err)) + } + + keyBroadcastContractAddr := libcommon.HexToAddress(config.KeyBroadcastContractAddress) + keyBroadcastContract, err := contracts.NewKeyBroadcastContract(keyBroadcastContractAddr, contractBackend) + if err != nil { + panic(fmt.Errorf("failed to create KeyBroadcastContract: %w", err)) + } + + recentEons, err := lru.New[EonIndex, Eon](config.MaxRecentEons) + if err != nil { + panic(fmt.Errorf("failed to create recentEons LRU cache: %w", err)) + } + + return &KsmEonTracker{ + blockListener: blockListener, + contractBackend: contractBackend, + ksmContract: ksmContract, + keyBroadcastContract: keyBroadcastContract, + recentEons: recentEons, + } +} + +func (et *KsmEonTracker) Run(ctx context.Context) error { + et.logger.Info("running eon tracker") + + eg, ctx := errgroup.WithContext(ctx) + eg.Go(func() error { return et.trackCurrentEon(ctx) }) + eg.Go(func() error { return et.trackFutureEons(ctx) }) + return nil +} + +func (et *KsmEonTracker) CurrentEon() (Eon, bool) { + eon := et.currentEon.Load() + if eon == nil { + return Eon{}, false + } + + return *eon, true +} + +func (et *KsmEonTracker) RecentEon(index EonIndex) (Eon, bool) { + return et.recentEons.Peek(index) +} + +func (et *KsmEonTracker) trackCurrentEon(ctx context.Context) error { + blockEventC := make(chan BlockEvent) + unregisterBlockEventObserver := et.blockListener.RegisterObserver(func(blockEvent BlockEvent) { + select { + case <-ctx.Done(): // no-op + case blockEventC <- blockEvent: + } + }) + + defer unregisterBlockEventObserver() + for { + select { + case <-ctx.Done(): + return ctx.Err() + case blockEvent := <-blockEventC: + eon, err := et.readEonAtNewBlockEvent(blockEvent.BlockNum) + if err != nil { + return err + } + + et.currentEon.Store(&eon) + et.maybeCleanRecentEons(blockEvent.BlockNum) + } + } +} + +func (et *KsmEonTracker) readEonAtNewBlockEvent(blockNum uint64) (Eon, error) { + var err error + var cached bool + startTime := time.Now() + defer func() { + if err != nil { + return + } + + et.logger.Debug("readEonAtNewBlockEvent timing", "blockNum", blockNum, "cached", cached, "duration", time.Since(startTime)) + }() + + callOpts := &bind.CallOpts{BlockNumber: new(big.Int).SetUint64(blockNum)} + eonIndex, err := et.ksmContract.GetKeyperSetIndexByBlock(callOpts, blockNum) + if err != nil { + return Eon{}, err + } + if eon, ok := et.recentEons.Get(EonIndex(eonIndex)); ok { + cached = true + return eon, nil + } + + keyperSetAddress, err := et.ksmContract.GetKeyperSetAddress(&bind.CallOpts{}, eonIndex) + if err != nil { + return Eon{}, err + } + + keyperSet, err := contracts.NewKeyperSet(keyperSetAddress, et.contractBackend) + if err != nil { + return Eon{}, err + } + + threshold, err := keyperSet.GetThreshold(callOpts) + if err != nil { + return Eon{}, err + } + + members, err := keyperSet.GetMembers(callOpts) + if err != nil { + return Eon{}, err + } + + key, err := et.keyBroadcastContract.GetEonKey(callOpts, eonIndex) + if err != nil { + return Eon{}, err + } + + activationBlock, err := et.ksmContract.GetKeyperSetActivationBlock(callOpts, eonIndex) + if err != nil { + return Eon{}, err + } + if activationBlock < blockNum { + return Eon{}, fmt.Errorf("unexpected invalid activation block: %d < %d", activationBlock, blockNum) + } + + finalized, err := keyperSet.IsFinalized(callOpts) + if err != nil { + return Eon{}, err + } + if !finalized { + return Eon{}, fmt.Errorf("unexpected KeyperSet is not finalized: eon=%d, address=%s", eonIndex, keyperSetAddress) + } + + eon := Eon{ + Index: EonIndex(eonIndex), + ActivationBlock: activationBlock, + Key: key, + Threshold: threshold, + Members: members, + } + + return eon, nil +} + +func (et *KsmEonTracker) maybeCleanRecentEons(blockNum uint64) { + cleanupThreshold := uint64(128) // wait this many blocks before cleaning old eons + if blockNum < cleanupThreshold { + // protects from underflow + return + } + + if et.lastCleanupBlockNum == 0 { + // first time after startup + et.lastCleanupBlockNum = blockNum + return + } + + cleanUpTo := blockNum - cleanupThreshold + if cleanUpTo <= et.lastCleanupBlockNum { + // not enough blocks have passed since last cleanup + return + } + + currentEon := et.currentEon.Load() + var cleanedEons []EonIndex + for _, eon := range et.recentEons.Values() { + if eon.Index < currentEon.Index && eon.ActivationBlock < cleanUpTo { + cleanedEons = append(cleanedEons, eon.Index) + et.recentEons.Remove(eon.Index) + } + } + if len(cleanedEons) > 0 { + et.logger.Debug( + "cleaned recent eons", + "cleaned", cleanedEons, + "cleanUpTo", cleanUpTo, + "lastCleanupBlockNum", et.lastCleanupBlockNum, + "currentEon", currentEon.Index, + ) + } + + et.lastCleanupBlockNum = cleanUpTo +} + +func (et *KsmEonTracker) trackFutureEons(ctx context.Context) error { + keyperSetAddedEventC := make(chan *contracts.KeyperSetManagerKeyperSetAdded) + keyperSetAddedEventSub, err := et.ksmContract.WatchKeyperSetAdded(&bind.WatchOpts{}, keyperSetAddedEventC) + if err != nil { + return err + } + + defer keyperSetAddedEventSub.Unsubscribe() + for { + select { + case <-ctx.Done(): + return ctx.Err() + case err := <-keyperSetAddedEventSub.Err(): + return err + case event := <-keyperSetAddedEventC: + eonIndex := EonIndex(event.Eon) + if event.Raw.Removed { + et.recentEons.Remove(eonIndex) + continue + } + + eon, err := et.readEonAtKeyperSetAddedEvent(event) + if err != nil { + return err + } + + et.recentEons.Add(eonIndex, eon) + } + } +} + +func (et *KsmEonTracker) readEonAtKeyperSetAddedEvent(event *contracts.KeyperSetManagerKeyperSetAdded) (Eon, error) { + callOpts := &bind.CallOpts{ + BlockNumber: new(big.Int).SetUint64(event.Raw.BlockNumber), + } + + eonIndex := event.Eon + key, err := et.keyBroadcastContract.GetEonKey(callOpts, eonIndex) + if err != nil { + return Eon{}, err + } + + eon := Eon{ + Index: EonIndex(eonIndex), + ActivationBlock: event.ActivationBlock, + Key: key, + Threshold: event.Threshold, + Members: event.Members, + } + + return eon, nil +} diff --git a/txnprovider/shutter/internal/testhelpers/eon_tracker_mock.go b/txnprovider/shutter/internal/testhelpers/eon_tracker_mock.go new file mode 100644 index 00000000000..d44932fe45b --- /dev/null +++ b/txnprovider/shutter/internal/testhelpers/eon_tracker_mock.go @@ -0,0 +1,158 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/erigontech/erigon/txnprovider/shutter/internal/testhelpers (interfaces: EonTracker) +// +// Generated by this command: +// +// mockgen -typed=true -destination=./eon_tracker_mock.go -package=testhelpers . EonTracker +// + +// Package testhelpers is a generated GoMock package. +package testhelpers + +import ( + context "context" + reflect "reflect" + + shutter "github.com/erigontech/erigon/txnprovider/shutter" + gomock "go.uber.org/mock/gomock" +) + +// MockEonTracker is a mock of EonTracker interface. +type MockEonTracker struct { + ctrl *gomock.Controller + recorder *MockEonTrackerMockRecorder + isgomock struct{} +} + +// MockEonTrackerMockRecorder is the mock recorder for MockEonTracker. +type MockEonTrackerMockRecorder struct { + mock *MockEonTracker +} + +// NewMockEonTracker creates a new mock instance. +func NewMockEonTracker(ctrl *gomock.Controller) *MockEonTracker { + mock := &MockEonTracker{ctrl: ctrl} + mock.recorder = &MockEonTrackerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockEonTracker) EXPECT() *MockEonTrackerMockRecorder { + return m.recorder +} + +// CurrentEon mocks base method. +func (m *MockEonTracker) CurrentEon() (shutter.Eon, bool) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CurrentEon") + ret0, _ := ret[0].(shutter.Eon) + ret1, _ := ret[1].(bool) + return ret0, ret1 +} + +// CurrentEon indicates an expected call of CurrentEon. +func (mr *MockEonTrackerMockRecorder) CurrentEon() *MockEonTrackerCurrentEonCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentEon", reflect.TypeOf((*MockEonTracker)(nil).CurrentEon)) + return &MockEonTrackerCurrentEonCall{Call: call} +} + +// MockEonTrackerCurrentEonCall wrap *gomock.Call +type MockEonTrackerCurrentEonCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockEonTrackerCurrentEonCall) Return(arg0 shutter.Eon, arg1 bool) *MockEonTrackerCurrentEonCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockEonTrackerCurrentEonCall) Do(f func() (shutter.Eon, bool)) *MockEonTrackerCurrentEonCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockEonTrackerCurrentEonCall) DoAndReturn(f func() (shutter.Eon, bool)) *MockEonTrackerCurrentEonCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// RecentEon mocks base method. +func (m *MockEonTracker) RecentEon(index shutter.EonIndex) (shutter.Eon, bool) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RecentEon", index) + ret0, _ := ret[0].(shutter.Eon) + ret1, _ := ret[1].(bool) + return ret0, ret1 +} + +// RecentEon indicates an expected call of RecentEon. +func (mr *MockEonTrackerMockRecorder) RecentEon(index any) *MockEonTrackerRecentEonCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecentEon", reflect.TypeOf((*MockEonTracker)(nil).RecentEon), index) + return &MockEonTrackerRecentEonCall{Call: call} +} + +// MockEonTrackerRecentEonCall wrap *gomock.Call +type MockEonTrackerRecentEonCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockEonTrackerRecentEonCall) Return(arg0 shutter.Eon, arg1 bool) *MockEonTrackerRecentEonCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockEonTrackerRecentEonCall) Do(f func(shutter.EonIndex) (shutter.Eon, bool)) *MockEonTrackerRecentEonCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockEonTrackerRecentEonCall) DoAndReturn(f func(shutter.EonIndex) (shutter.Eon, bool)) *MockEonTrackerRecentEonCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Run mocks base method. +func (m *MockEonTracker) Run(ctx context.Context) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Run", ctx) + ret0, _ := ret[0].(error) + return ret0 +} + +// Run indicates an expected call of Run. +func (mr *MockEonTrackerMockRecorder) Run(ctx any) *MockEonTrackerRunCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockEonTracker)(nil).Run), ctx) + return &MockEonTrackerRunCall{Call: call} +} + +// MockEonTrackerRunCall wrap *gomock.Call +type MockEonTrackerRunCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockEonTrackerRunCall) Return(arg0 error) *MockEonTrackerRunCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockEonTrackerRunCall) Do(f func(context.Context) error) *MockEonTrackerRunCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockEonTrackerRunCall) DoAndReturn(f func(context.Context) error) *MockEonTrackerRunCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/txnprovider/shutter/internal/testhelpers/mockgen.go b/txnprovider/shutter/internal/testhelpers/mockgen.go new file mode 100644 index 00000000000..36c6ba01882 --- /dev/null +++ b/txnprovider/shutter/internal/testhelpers/mockgen.go @@ -0,0 +1,29 @@ +// Copyright 2025 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 testhelpers + +import "github.com/erigontech/erigon/txnprovider/shutter" + +//go:generate mockgen -typed=true -destination=./slot_calculator_mock.go -package=testhelpers . SlotCalculator +type SlotCalculator interface { + shutter.SlotCalculator +} + +//go:generate mockgen -typed=true -destination=./eon_tracker_mock.go -package=testhelpers . EonTracker +type EonTracker interface { + shutter.EonTracker +} diff --git a/txnprovider/shutter/internal/testhelpers/slot_calculator_mock.go b/txnprovider/shutter/internal/testhelpers/slot_calculator_mock.go new file mode 100644 index 00000000000..8bdee08a2a2 --- /dev/null +++ b/txnprovider/shutter/internal/testhelpers/slot_calculator_mock.go @@ -0,0 +1,156 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/erigontech/erigon/txnprovider/shutter/internal/testhelpers (interfaces: SlotCalculator) +// +// Generated by this command: +// +// mockgen -typed=true -destination=./slot_calculator_mock.go -package=testhelpers . SlotCalculator +// + +// Package testhelpers is a generated GoMock package. +package testhelpers + +import ( + reflect "reflect" + time "time" + + gomock "go.uber.org/mock/gomock" +) + +// MockSlotCalculator is a mock of SlotCalculator interface. +type MockSlotCalculator struct { + ctrl *gomock.Controller + recorder *MockSlotCalculatorMockRecorder + isgomock struct{} +} + +// MockSlotCalculatorMockRecorder is the mock recorder for MockSlotCalculator. +type MockSlotCalculatorMockRecorder struct { + mock *MockSlotCalculator +} + +// NewMockSlotCalculator creates a new mock instance. +func NewMockSlotCalculator(ctrl *gomock.Controller) *MockSlotCalculator { + mock := &MockSlotCalculator{ctrl: ctrl} + mock.recorder = &MockSlotCalculatorMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockSlotCalculator) EXPECT() *MockSlotCalculatorMockRecorder { + return m.recorder +} + +// CalcCurrentSlot mocks base method. +func (m *MockSlotCalculator) CalcCurrentSlot() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CalcCurrentSlot") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// CalcCurrentSlot indicates an expected call of CalcCurrentSlot. +func (mr *MockSlotCalculatorMockRecorder) CalcCurrentSlot() *MockSlotCalculatorCalcCurrentSlotCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalcCurrentSlot", reflect.TypeOf((*MockSlotCalculator)(nil).CalcCurrentSlot)) + return &MockSlotCalculatorCalcCurrentSlotCall{Call: call} +} + +// MockSlotCalculatorCalcCurrentSlotCall wrap *gomock.Call +type MockSlotCalculatorCalcCurrentSlotCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockSlotCalculatorCalcCurrentSlotCall) Return(arg0 uint64) *MockSlotCalculatorCalcCurrentSlotCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockSlotCalculatorCalcCurrentSlotCall) Do(f func() uint64) *MockSlotCalculatorCalcCurrentSlotCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockSlotCalculatorCalcCurrentSlotCall) DoAndReturn(f func() uint64) *MockSlotCalculatorCalcCurrentSlotCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// CalcSlot mocks base method. +func (m *MockSlotCalculator) CalcSlot(timestamp uint64) (uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CalcSlot", timestamp) + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CalcSlot indicates an expected call of CalcSlot. +func (mr *MockSlotCalculatorMockRecorder) CalcSlot(timestamp any) *MockSlotCalculatorCalcSlotCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalcSlot", reflect.TypeOf((*MockSlotCalculator)(nil).CalcSlot), timestamp) + return &MockSlotCalculatorCalcSlotCall{Call: call} +} + +// MockSlotCalculatorCalcSlotCall wrap *gomock.Call +type MockSlotCalculatorCalcSlotCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockSlotCalculatorCalcSlotCall) Return(arg0 uint64, arg1 error) *MockSlotCalculatorCalcSlotCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockSlotCalculatorCalcSlotCall) Do(f func(uint64) (uint64, error)) *MockSlotCalculatorCalcSlotCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockSlotCalculatorCalcSlotCall) DoAndReturn(f func(uint64) (uint64, error)) *MockSlotCalculatorCalcSlotCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// CalcSlotAge mocks base method. +func (m *MockSlotCalculator) CalcSlotAge(slot uint64) time.Duration { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CalcSlotAge", slot) + ret0, _ := ret[0].(time.Duration) + return ret0 +} + +// CalcSlotAge indicates an expected call of CalcSlotAge. +func (mr *MockSlotCalculatorMockRecorder) CalcSlotAge(slot any) *MockSlotCalculatorCalcSlotAgeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalcSlotAge", reflect.TypeOf((*MockSlotCalculator)(nil).CalcSlotAge), slot) + return &MockSlotCalculatorCalcSlotAgeCall{Call: call} +} + +// MockSlotCalculatorCalcSlotAgeCall wrap *gomock.Call +type MockSlotCalculatorCalcSlotAgeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockSlotCalculatorCalcSlotAgeCall) Return(arg0 time.Duration) *MockSlotCalculatorCalcSlotAgeCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockSlotCalculatorCalcSlotAgeCall) Do(f func(uint64) time.Duration) *MockSlotCalculatorCalcSlotAgeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockSlotCalculatorCalcSlotAgeCall) DoAndReturn(f func(uint64) time.Duration) *MockSlotCalculatorCalcSlotAgeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/txnprovider/shutter/pool.go b/txnprovider/shutter/pool.go index ffb8878d40c..60d672bc78b 100644 --- a/txnprovider/shutter/pool.go +++ b/txnprovider/shutter/pool.go @@ -1,4 +1,4 @@ -// Copyright 2024 The Erigon Authors +// Copyright 2025 The Erigon Authors // This file is part of Erigon. // // Erigon is free software: you can redistribute it and/or modify @@ -34,6 +34,8 @@ type Pool struct { logger log.Logger config Config secondaryTxnProvider txnprovider.TxnProvider + blockListener BlockListener + eonTracker EonTracker decryptionKeysListener DecryptionKeysListener decryptionKeysProcessor DecryptionKeysProcessor } @@ -43,13 +45,19 @@ func NewPool( config Config, secondaryTxnProvider txnprovider.TxnProvider, contractBackend bind.ContractBackend, + stateChangesClient stateChangesClient, ) *Pool { logger = logger.New("component", "shutter") - decryptionKeysListener := NewDecryptionKeysListener(logger, config) + slotCalculator := NewBeaconChainSlotCalculator(config.BeaconChainGenesisTimestamp, config.SecondsPerSlot) + blockListener := NewBlockListener(logger, stateChangesClient) + eonTracker := NewKsmEonTracker(config, blockListener, contractBackend) + decryptionKeysListener := NewDecryptionKeysListener(logger, config, slotCalculator, eonTracker) decryptionKeysProcessor := NewDecryptionKeysProcessor(logger) return &Pool{ logger: logger, config: config, + blockListener: blockListener, + eonTracker: eonTracker, secondaryTxnProvider: secondaryTxnProvider, decryptionKeysListener: decryptionKeysListener, decryptionKeysProcessor: decryptionKeysProcessor, @@ -65,6 +73,8 @@ func (p Pool) Run(ctx context.Context) error { defer unregisterDkpObserver() eg, ctx := errgroup.WithContext(ctx) + eg.Go(func() error { return p.blockListener.Run(ctx) }) + eg.Go(func() error { return p.eonTracker.Run(ctx) }) eg.Go(func() error { return p.decryptionKeysListener.Run(ctx) }) eg.Go(func() error { return p.decryptionKeysProcessor.Run(ctx) }) return eg.Wait() diff --git a/txnprovider/shutter/slot_calculator.go b/txnprovider/shutter/slot_calculator.go new file mode 100644 index 00000000000..67946607080 --- /dev/null +++ b/txnprovider/shutter/slot_calculator.go @@ -0,0 +1,64 @@ +// Copyright 2025 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 shutter + +import ( + "errors" + "time" +) + +var ErrTimestampBeforeGenesis = errors.New("timestamp before genesis") + +type SlotCalculator interface { + CalcSlot(timestamp uint64) (uint64, error) + CalcSlotAge(slot uint64) time.Duration + CalcCurrentSlot() uint64 +} + +type BeaconChainSlotCalculator struct { + genesisTimestamp uint64 + secondsPerSlot uint64 +} + +func NewBeaconChainSlotCalculator(genesisTimestamp uint64, secondsPerSlot uint64) BeaconChainSlotCalculator { + return BeaconChainSlotCalculator{ + genesisTimestamp: genesisTimestamp, + secondsPerSlot: secondsPerSlot, + } +} + +func (sc BeaconChainSlotCalculator) CalcSlot(timestamp uint64) (uint64, error) { + if sc.genesisTimestamp < timestamp { + return 0, ErrTimestampBeforeGenesis + } + + return (timestamp - sc.genesisTimestamp) / sc.secondsPerSlot, nil +} + +func (sc BeaconChainSlotCalculator) CalcSlotAge(slot uint64) time.Duration { + slotStartTimestamp := sc.genesisTimestamp + slot*sc.secondsPerSlot + return time.Since(time.Unix(int64(slotStartTimestamp), 0)) +} + +func (sc BeaconChainSlotCalculator) CalcCurrentSlot() uint64 { + slot, err := sc.CalcSlot(uint64(time.Now().Unix())) + if err != nil { + panic(err) + } + + return slot +} diff --git a/txnprovider/shutter/state_changes_client.go b/txnprovider/shutter/state_changes_client.go new file mode 100644 index 00000000000..a2bb6deffbf --- /dev/null +++ b/txnprovider/shutter/state_changes_client.go @@ -0,0 +1,29 @@ +// Copyright 2025 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 shutter + +import ( + "context" + + "google.golang.org/grpc" + + "github.com/erigontech/erigon-lib/gointerfaces/remoteproto" +) + +type stateChangesClient interface { + StateChanges(ctx context.Context, in *remoteproto.StateChangeRequest, opts ...grpc.CallOption) (remoteproto.KV_StateChangesClient, error) +} From 17447809ad59c93169beab36a17f2c3913765ba2 Mon Sep 17 00:00:00 2001 From: Ostroukhov Nikita Date: Mon, 3 Feb 2025 14:16:21 +0000 Subject: [PATCH 16/16] Supported flags for polygon single slot finality (#13618) --- cmd/integration/commands/stages.go | 4 +- cmd/utils/flags.go | 11 ++++++ eth/backend.go | 21 +++++++++- eth/ethconfig/config.go | 4 ++ eth/stagedsync/stage_polygon_sync.go | 5 +++ polygon/sync/block_downloader.go | 34 ++++++++++++++-- polygon/sync/block_downloader_test.go | 56 ++++++++++++++++++++++----- polygon/sync/service.go | 6 +++ polygon/sync/sync.go | 54 ++++++++++++++++++++++++-- turbo/cli/default_flags.go | 3 ++ turbo/engineapi/engine_server.go | 25 ++++++++++-- turbo/stages/stageloop.go | 4 ++ 12 files changed, 204 insertions(+), 23 deletions(-) diff --git a/cmd/integration/commands/stages.go b/cmd/integration/commands/stages.go index 8164de23eb6..81c44355106 100644 --- a/cmd/integration/commands/stages.go +++ b/cmd/integration/commands/stages.go @@ -931,8 +931,8 @@ func stagePolygonSync(db kv.TemporalRwDB, ctx context.Context, logger log.Logger } stageState := stage(stageSync, tx, nil, stages.PolygonSync) - cfg := stagedsync.NewPolygonSyncStageCfg(logger, chainConfig, nil, heimdallClient, - heimdallStore, bridgeStore, nil, 0, nil, blockReader, nil, 0, unwindTypes, nil /* notifications */) + cfg := stagedsync.NewPolygonSyncStageCfg(ðconfig.Defaults, logger, chainConfig, nil, heimdallClient, + heimdallStore, bridgeStore, nil, 0, nil, blockReader, nil, 0, unwindTypes, nil /* notifications */, nil) // we only need blockReader and blockWriter (blockWriter is constructed in NewPolygonSyncStageCfg) if unwind > 0 { u := stageSync.NewUnwindState(stageState.ID, stageState.BlockNumber-unwind, stageState.BlockNumber, true, false) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index c9c012937b2..cdaa37b68d0 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1113,6 +1113,14 @@ var ( Name: "shutter.p2p.listen.port", Usage: "Use to override the default p2p listen port (defaults to 23102)", } + PolygonPosSingleSlotFinalityFlag = cli.BoolFlag{ + Name: "polygon.pos.ssf", + Usage: "Enabling Polygon PoS Single Slot Finality", + } + PolygonPosSingleSlotFinalityBlockAtFlag = cli.Int64Flag{ + Name: "polygon.pos.ssf.block", + Usage: "Enabling Polygon PoS Single Slot Finality since block", + } ) var MetricFlags = []cli.Flag{&MetricsEnabledFlag, &MetricsHTTPFlag, &MetricsPortFlag, &DiagDisabledFlag, &DiagEndpointAddrFlag, &DiagEndpointPortFlag, &DiagSpeedTestFlag} @@ -1718,6 +1726,9 @@ func setBorConfig(ctx *cli.Context, cfg *ethconfig.Config, nodeConfig *nodecfg.C nodeConfig.P2P.MaxPeers = 100 logger.Info("Maximum peer count default sanitizing for bor", "total", nodeConfig.P2P.MaxPeers) } + + cfg.PolygonPosSingleSlotFinality = ctx.Bool(PolygonPosSingleSlotFinalityFlag.Name) + cfg.PolygonPosSingleSlotFinalityBlockAt = ctx.Uint64(PolygonPosSingleSlotFinalityBlockAtFlag.Name) } func setMiner(ctx *cli.Context, cfg *params.MiningConfig) { diff --git a/eth/backend.go b/eth/backend.go index 35a31b4560c..1f991d4133d 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -958,6 +958,7 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger p2pConfig.MaxPeers, statusDataProvider, backend.stopNode, + &engineAPISwitcher{backend: backend}, ) backend.syncUnwindOrder = stagedsync.PolygonSyncUnwindOrder backend.syncPruneOrder = stagedsync.PolygonSyncPruneOrder @@ -1018,7 +1019,9 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger backend.chainDB, chainConfig, tmpdir, config.Sync), config.InternalCL, // If the chain supports the engine API, then we should not make the server fail. false, - config.Miner.EnabledPOS) + config.Miner.EnabledPOS, + !config.PolygonPosSingleSlotFinality, + ) backend.engineBackendRPC = engineBackendRPC // If we choose not to run a consensus layer, run our embedded. if config.InternalCL && (clparams.EmbeddedSupported(config.NetworkID) || config.CaplinConfig.IsDevnet()) { @@ -1035,6 +1038,7 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger if chainConfig.Bor != nil && config.PolygonSync { backend.polygonSyncService = polygonsync.NewService( + config, logger, chainConfig, polygonSyncSentry(sentries), @@ -1045,6 +1049,7 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger polygonBridge, heimdallService, backend.notifications, + backend.engineBackendRPC, ) // we need to initiate download before the heimdall services start rather than @@ -1159,7 +1164,7 @@ func (s *Ethereum) Init(stack *node.Node, config *ethconfig.Config, chainConfig }() } - if chainConfig.Bor == nil { + if chainConfig.Bor == nil || config.PolygonPosSingleSlotFinality { go s.engineBackendRPC.Start(ctx, &httpRpcCfg, s.chainDB, s.blockReader, s.rpcFilters, s.rpcDaemonStateCache, s.engine, s.ethRpcClient, s.txPoolRpcClient, s.miningRpcClient) } @@ -1836,3 +1841,15 @@ func setBorDefaultTxPoolPriceLimit(chainConfig *chain.Config, config txpoolcfg.C func polygonSyncSentry(sentries []protosentry.SentryClient) protosentry.SentryClient { return libsentry.NewSentryMultiplexer(sentries) } + +type engineAPISwitcher struct { + backend *Ethereum +} + +func (e *engineAPISwitcher) SetConsuming(consuming bool) { + if e.backend.engineBackendRPC == nil { + return + } + + e.backend.engineBackendRPC.SetConsuming(consuming) +} diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index af4871915bc..04b3ec517f3 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -258,6 +258,10 @@ type Config struct { SilkwormRpcLogDumpResponse bool SilkwormRpcNumWorkers uint32 SilkwormRpcJsonCompatibility bool + + // PoS Single Slot finality + PolygonPosSingleSlotFinality bool + PolygonPosSingleSlotFinalityBlockAt uint64 } type Sync struct { diff --git a/eth/stagedsync/stage_polygon_sync.go b/eth/stagedsync/stage_polygon_sync.go index 06c1acec355..4c091b60196 100644 --- a/eth/stagedsync/stage_polygon_sync.go +++ b/eth/stagedsync/stage_polygon_sync.go @@ -39,6 +39,7 @@ import ( "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/eth/stagedsync/stages" "github.com/erigontech/erigon/p2p/sentry" "github.com/erigontech/erigon/polygon/bor/borcfg" @@ -55,6 +56,7 @@ import ( var errBreakPolygonSyncStage = errors.New("break polygon sync stage") func NewPolygonSyncStageCfg( + config *ethconfig.Config, logger log.Logger, chainConfig *chain.Config, db kv.RwDB, @@ -69,6 +71,7 @@ func NewPolygonSyncStageCfg( blockLimit uint, userUnwindTypeOverrides []string, notifications *shards.Notifications, + engineAPISwitcher sync.EngineAPISwitcher, ) PolygonSyncStageCfg { // using a buffered channel to preserve order of tx actions, // do not expect to ever have more than 50 goroutines blocking on this channel @@ -137,6 +140,7 @@ func NewPolygonSyncStageCfg( ) events := polygonsync.NewTipEvents(logger, p2pService, heimdallService) sync := polygonsync.NewSync( + config, logger, syncStore, executionEngine, @@ -150,6 +154,7 @@ func NewPolygonSyncStageCfg( events.Events(), notifications, sync.NewWiggleCalculator(borConfig, signaturesCache, heimdallService), + engineAPISwitcher, ) syncService := &polygonSyncStageService{ logger: logger, diff --git a/polygon/sync/block_downloader.go b/polygon/sync/block_downloader.go index f14344a9cfc..a12fc4feda1 100644 --- a/polygon/sync/block_downloader.go +++ b/polygon/sync/block_downloader.go @@ -89,16 +89,16 @@ type BlockDownloader struct { blockLimit uint } -func (d *BlockDownloader) DownloadBlocksUsingCheckpoints(ctx context.Context, start uint64) (*types.Header, error) { +func (d *BlockDownloader) DownloadBlocksUsingCheckpoints(ctx context.Context, start uint64, end *uint64) (*types.Header, error) { checkpoints, err := d.waypointReader.CheckpointsFromBlock(ctx, start) if err != nil { return nil, err } - return d.downloadBlocksUsingWaypoints(ctx, heimdall.AsWaypoints(checkpoints), d.checkpointVerifier) + return d.downloadBlocksUsingWaypoints(ctx, heimdall.AsWaypoints(checkpoints), d.checkpointVerifier, end) } -func (d *BlockDownloader) DownloadBlocksUsingMilestones(ctx context.Context, start uint64) (*types.Header, error) { +func (d *BlockDownloader) DownloadBlocksUsingMilestones(ctx context.Context, start uint64, end *uint64) (*types.Header, error) { milestones, err := d.waypointReader.MilestonesFromBlock(ctx, start) if err != nil { return nil, err @@ -124,19 +124,21 @@ func (d *BlockDownloader) DownloadBlocksUsingMilestones(ctx context.Context, sta milestones[0].Fields.StartBlock = new(big.Int).SetUint64(start) } - return d.downloadBlocksUsingWaypoints(ctx, heimdall.AsWaypoints(milestones), d.milestoneVerifier) + return d.downloadBlocksUsingWaypoints(ctx, heimdall.AsWaypoints(milestones), d.milestoneVerifier, end) } func (d *BlockDownloader) downloadBlocksUsingWaypoints( ctx context.Context, waypoints heimdall.Waypoints, verifier WaypointHeadersVerifier, + end *uint64, ) (*types.Header, error) { if len(waypoints) == 0 { return nil, nil } waypoints = d.limitWaypoints(waypoints) + waypoints = limitWaypointsEndBlock(waypoints, end) d.logger.Info( syncLogPrefix("downloading blocks using waypoints"), @@ -292,6 +294,15 @@ func (d *BlockDownloader) downloadBlocksUsingWaypoints( "blks/sec", float64(len(blocks))/math.Max(time.Since(batchFetchStartTime).Seconds(), 0.0001), ) + if end != nil { + for i := range blocks { + if blocks[i].Number().Uint64() > *end { + blocks = blocks[:i] + break + } + } + } + batchFetchStartTime = time.Now() // reset for next time d.logger.Info( @@ -388,3 +399,18 @@ func (d *BlockDownloader) limitWaypoints(waypoints []heimdall.Waypoint) []heimda return waypoints } + +func limitWaypointsEndBlock(waypoints []heimdall.Waypoint, end *uint64) []heimdall.Waypoint { + if end == nil { + return waypoints + } + + for i, waypoint := range waypoints { + if waypoint.StartBlock().Uint64() > *end { + waypoints = waypoints[:i] + break + } + } + + return waypoints +} diff --git a/polygon/sync/block_downloader_test.go b/polygon/sync/block_downloader_test.go index 14e0f404bd6..5c2efb04da5 100644 --- a/polygon/sync/block_downloader_test.go +++ b/polygon/sync/block_downloader_test.go @@ -280,7 +280,7 @@ func TestBlockDownloaderDownloadBlocksUsingMilestones(t *testing.T) { DoAndReturn(test.defaultInsertBlocksMock(&blocks)). Times(1) - tip, err := test.blockDownloader.DownloadBlocksUsingMilestones(context.Background(), 1) + tip, err := test.blockDownloader.DownloadBlocksUsingMilestones(context.Background(), 1, nil) require.NoError(t, err) require.Len(t, blocks, 48) // 4 milestones x 12 blocks each // check blocks are written in order @@ -292,6 +292,44 @@ func TestBlockDownloaderDownloadBlocksUsingMilestones(t *testing.T) { require.Equal(t, blocks[len(blocks)-1].Header(), tip) } +func TestBlockDownloaderDownloadBlocksUsingMilestonesLimitEndBlock(t *testing.T) { + test := newBlockDownloaderTest(t) + test.waypointReader.EXPECT(). + MilestonesFromBlock(gomock.Any(), gomock.Any()). + Return(test.fakeMilestones(4), nil). + Times(1) + test.p2pService.EXPECT(). + ListPeersMayHaveBlockNum(gomock.Any()). + Return(test.fakePeers(8)). + Times(1) + test.p2pService.EXPECT(). + FetchHeaders(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). + DoAndReturn(test.defaultFetchHeadersMock()). + Times(1) + test.p2pService.EXPECT(). + FetchBodies(gomock.Any(), gomock.Any(), gomock.Any()). + DoAndReturn(test.defaultFetchBodiesMock()). + Times(1) + var blocks []*types.Block + test.store.EXPECT(). + InsertBlocks(gomock.Any(), gomock.Any()). + DoAndReturn(test.defaultInsertBlocksMock(&blocks)). + Times(1) + + syncTo := uint64(10) + + tip, err := test.blockDownloader.DownloadBlocksUsingMilestones(context.Background(), 1, &syncTo) + require.NoError(t, err) + require.Len(t, blocks, 10) // 4 milestones x 12 blocks each but we limited it by 10 + // check blocks are written in order + require.Equal(t, uint64(1), blocks[0].Header().Number.Uint64()) + require.Equal(t, uint64(2), blocks[1].Header().Number.Uint64()) + require.Equal(t, uint64(3), blocks[2].Header().Number.Uint64()) + require.Equal(t, uint64(4), blocks[3].Header().Number.Uint64()) + require.Equal(t, uint64(10), blocks[9].Header().Number.Uint64()) + require.Equal(t, blocks[len(blocks)-1].Header(), tip) +} + func TestBlockDownloaderDownloadBlocksUsingMilestonesWhenStartIsBeforeFirstMilestone(t *testing.T) { test := newBlockDownloaderTest(t) // we skip milestone 1, only use 2,3,4 (3 milestones in total) with start=1 @@ -318,7 +356,7 @@ func TestBlockDownloaderDownloadBlocksUsingMilestonesWhenStartIsBeforeFirstMiles DoAndReturn(test.defaultInsertBlocksMock(&blocks)). Times(1) - tip, err := test.blockDownloader.DownloadBlocksUsingMilestones(context.Background(), 1) + tip, err := test.blockDownloader.DownloadBlocksUsingMilestones(context.Background(), 1, nil) require.NoError(t, err) // 3 milestones x 12 blocks each + 12 because we override milestones[0].StartBlock=1 to fill the gap require.Len(t, blocks, 48) @@ -353,7 +391,7 @@ func TestBlockDownloaderDownloadBlocksUsingCheckpoints(t *testing.T) { DoAndReturn(test.defaultInsertBlocksMock(&blocks)). Times(4) - tip, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1) + tip, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1, nil) require.NoError(t, err) require.Len(t, blocks, 8192) // 8 checkpoints x 1024 blocks each // check blocks are written in order @@ -429,7 +467,7 @@ func TestBlockDownloaderDownloadBlocksWhenInvalidHeadersThenPenalizePeerAndReDow Times(3), ) - _, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1) + _, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1, nil) require.NoError(t, err) require.Len(t, blocksBatch1, 1024) require.Len(t, blocksBatch2, 5120) @@ -467,7 +505,7 @@ func TestBlockDownloaderDownloadBlocksWhenZeroPeersTriesAgain(t *testing.T) { Times(4), ) - tip, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1) + tip, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1, nil) require.NoError(t, err) require.Len(t, blocks, 8192) require.Equal(t, blocks[len(blocks)-1].Header(), tip) @@ -533,7 +571,7 @@ func TestBlockDownloaderDownloadBlocksWhenInvalidBodiesThenPenalizePeerAndReDown Times(3), ) - _, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1) + _, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1, nil) require.NoError(t, err) require.Len(t, blocksBatch1, 1024) require.Len(t, blocksBatch2, 5120) @@ -600,7 +638,7 @@ func TestBlockDownloaderDownloadBlocksWhenMissingBodiesThenPenalizePeerAndReDown Times(3), ) - _, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1) + _, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1, nil) require.NoError(t, err) require.Len(t, blocksBatch1, 1024) require.Len(t, blocksBatch2, 5120) @@ -642,7 +680,7 @@ func TestBlockDownloaderDownloadBlocksRespectsMaxWorkers(t *testing.T) { // 100 peers // 2 waypoints // the downloader should fetch the 2 waypoints in 2 separate batches - _, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1) + _, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1, nil) require.NoError(t, err) require.Len(t, blocksBatch1, 1024) require.Len(t, blocksBatch2, 1024) @@ -716,7 +754,7 @@ func TestBlockDownloaderDownloadBlocksRespectsBlockLimit(t *testing.T) { DoAndReturn(test.defaultInsertBlocksMock(&insertedBlocks)). Times(1) - _, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1) + _, err := test.blockDownloader.DownloadBlocksUsingCheckpoints(context.Background(), 1, nil) require.NoError(t, err) require.Len(t, insertedBlocks, tc.wantNumInsertedBlocks) }) diff --git a/polygon/sync/service.go b/polygon/sync/service.go index d71a60e1c7e..e97228e9c3b 100644 --- a/polygon/sync/service.go +++ b/polygon/sync/service.go @@ -29,6 +29,7 @@ import ( "github.com/erigontech/erigon-lib/gointerfaces/executionproto" "github.com/erigontech/erigon-lib/gointerfaces/sentryproto" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/p2p/sentry" "github.com/erigontech/erigon/polygon/bor/borcfg" "github.com/erigontech/erigon/polygon/bridge" @@ -38,6 +39,7 @@ import ( ) func NewService( + config *ethconfig.Config, logger log.Logger, chainConfig *chain.Config, sentryClient sentryproto.SentryClient, @@ -48,6 +50,8 @@ func NewService( bridgeService *bridge.Service, heimdallService *heimdall.Service, notifications *shards.Notifications, + engineAPISwitcher EngineAPISwitcher, + ) *Service { borConfig := chainConfig.Bor.(*borcfg.BorConfig) checkpointVerifier := VerifyCheckpointHeaders @@ -75,6 +79,7 @@ func NewService( ccBuilderFactory := NewCanonicalChainBuilderFactory(chainConfig, borConfig, heimdallService, signaturesCache) events := NewTipEvents(logger, p2pService, heimdallService) sync := NewSync( + config, logger, store, execution, @@ -88,6 +93,7 @@ func NewService( events.Events(), notifications, NewWiggleCalculator(borConfig, signaturesCache, heimdallService), + engineAPISwitcher, ) return &Service{ logger: logger, diff --git a/polygon/sync/sync.go b/polygon/sync/sync.go index 6057141522d..15734f142a5 100644 --- a/polygon/sync/sync.go +++ b/polygon/sync/sync.go @@ -27,6 +27,7 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/core/types" + "github.com/erigontech/erigon/eth/ethconfig" "github.com/erigontech/erigon/polygon/heimdall" "github.com/erigontech/erigon/polygon/p2p" "github.com/erigontech/erigon/turbo/shards" @@ -50,7 +51,12 @@ type wiggleCalculator interface { CalculateWiggle(ctx context.Context, header *types.Header) (time.Duration, error) } +type EngineAPISwitcher interface { + SetConsuming(consuming bool) +} + func NewSync( + config *ethconfig.Config, logger log.Logger, store Store, execution ExecutionClient, @@ -64,6 +70,7 @@ func NewSync( events <-chan Event, notifications *shards.Notifications, wiggleCalculator wiggleCalculator, + engineAPISwitcher EngineAPISwitcher, ) *Sync { badBlocksLru, err := simplelru.NewLRU[common.Hash, struct{}](1024, nil) if err != nil { @@ -71,6 +78,7 @@ func NewSync( } return &Sync{ + config: config, logger: logger, store: store, execution: execution, @@ -85,10 +93,12 @@ func NewSync( badBlocks: badBlocksLru, notifications: notifications, wiggleCalculator: wiggleCalculator, + engineAPISwitcher: engineAPISwitcher, } } type Sync struct { + config *ethconfig.Config logger log.Logger store Store execution ExecutionClient @@ -103,6 +113,7 @@ type Sync struct { badBlocks *simplelru.LRU[common.Hash, struct{}] notifications *shards.Notifications wiggleCalculator wiggleCalculator + engineAPISwitcher EngineAPISwitcher } func (s *Sync) commitExecution(ctx context.Context, newTip *types.Header, finalizedHeader *types.Header) error { @@ -168,7 +179,13 @@ func (s *Sync) handleMilestoneTipMismatch(ctx context.Context, ccb *CanonicalCha return err } - newTip, err := s.blockDownloader.DownloadBlocksUsingMilestones(ctx, rootNum+1) + var syncTo *uint64 + + if s.config.PolygonPosSingleSlotFinality { + syncTo = &s.config.PolygonPosSingleSlotFinalityBlockAt + } + + newTip, err := s.blockDownloader.DownloadBlocksUsingMilestones(ctx, rootNum+1, syncTo) if err != nil { return err } @@ -678,6 +695,13 @@ func (s *Sync) Run(ctx context.Context) error { return err } + if s.config.PolygonPosSingleSlotFinality { + if result.latestTip.Number.Uint64() >= s.config.PolygonPosSingleSlotFinalityBlockAt { + s.engineAPISwitcher.SetConsuming(true) + return nil + } + } + ccBuilder, err := s.initialiseCcb(ctx, result) if err != nil { return err @@ -690,6 +714,18 @@ func (s *Sync) Run(ctx context.Context) error { for { select { case event := <-s.events: + if s.config.PolygonPosSingleSlotFinality { + block, err := s.execution.CurrentHeader(ctx) + if err != nil { + return err + } + + if block.Number.Uint64() >= s.config.PolygonPosSingleSlotFinalityBlockAt { + s.engineAPISwitcher.SetConsuming(true) + return nil + } + } + switch event.Type { case EventTypeNewMilestone: if err = s.applyNewMilestoneOnTip(ctx, event.AsNewMilestone(), ccBuilder); err != nil { @@ -818,7 +854,7 @@ func (s *Sync) syncToTipUsingMilestones(ctx context.Context, tip *types.Header) } type waypointSyncFunc func(ctx context.Context) (heimdall.Waypoint, error) -type blockDownloadFunc func(ctx context.Context, startBlockNum uint64) (*types.Header, error) +type blockDownloadFunc func(ctx context.Context, startBlockNum uint64, endBlockNum *uint64) (*types.Header, error) func (s *Sync) sync( ctx context.Context, @@ -829,6 +865,12 @@ func (s *Sync) sync( var waypoint heimdall.Waypoint var err error + var syncTo *uint64 + + if s.config.PolygonPosSingleSlotFinality { + syncTo = &s.config.PolygonPosSingleSlotFinalityBlockAt + } + for { waypoint, err = waypointSync(ctx) if err != nil { @@ -838,7 +880,7 @@ func (s *Sync) sync( // notify about latest waypoint end block so that eth_syncing API doesn't flicker on initial sync s.notifications.NewLastBlockSeen(waypoint.EndBlock().Uint64()) - newTip, err := blockDownload(ctx, tip.Number.Uint64()+1) + newTip, err := blockDownload(ctx, tip.Number.Uint64()+1, syncTo) if err != nil { return syncToTipResult{}, err } @@ -856,6 +898,12 @@ func (s *Sync) sync( } tip = newTip + + if s.config.PolygonPosSingleSlotFinality { + if newTip.Number.Uint64() >= s.config.PolygonPosSingleSlotFinalityBlockAt { + break + } + } } return syncToTipResult{latestTip: tip, latestWaypoint: waypoint}, nil diff --git a/turbo/cli/default_flags.go b/turbo/cli/default_flags.go index cf2772bee2f..c3644398397 100644 --- a/turbo/cli/default_flags.go +++ b/turbo/cli/default_flags.go @@ -241,4 +241,7 @@ var DefaultFlags = []cli.Flag{ &utils.ShutterEnabledFlag, &utils.ShutterP2pBootstrapNodesFlag, &utils.ShutterP2pListenPortFlag, + + &utils.PolygonPosSingleSlotFinalityFlag, + &utils.PolygonPosSingleSlotFinalityBlockAtFlag, } diff --git a/turbo/engineapi/engine_server.go b/turbo/engineapi/engine_server.go index 8bb2559aa3b..82e31a11238 100644 --- a/turbo/engineapi/engine_server.go +++ b/turbo/engineapi/engine_server.go @@ -22,6 +22,7 @@ import ( "fmt" "math/big" "sync" + "sync/atomic" "time" "github.com/erigontech/erigon-lib/chain" @@ -62,7 +63,9 @@ type EngineServer struct { blockDownloader *engine_block_downloader.EngineBlockDownloader config *chain.Config // Block proposing for proof-of-stake - proposing bool + proposing bool + // Block consuming for proof-of-stake + consuming atomic.Bool test bool caplin bool // we need to send errors for caplin. executionService execution.ExecutionClient @@ -78,9 +81,9 @@ const fcuTimeout = 1000 // according to mathematics: 1000 millisecods = 1 second func NewEngineServer(logger log.Logger, config *chain.Config, executionService execution.ExecutionClient, hd *headerdownload.HeaderDownload, - blockDownloader *engine_block_downloader.EngineBlockDownloader, caplin, test, proposing bool) *EngineServer { + blockDownloader *engine_block_downloader.EngineBlockDownloader, caplin, test, proposing, consuming bool) *EngineServer { chainRW := eth1_chain_reader.NewChainReaderEth1(config, executionService, fcuTimeout) - return &EngineServer{ + srv := &EngineServer{ logger: logger, config: config, executionService: executionService, @@ -91,6 +94,10 @@ func NewEngineServer(logger log.Logger, config *chain.Config, executionService e caplin: caplin, engineLogSpamer: engine_logs_spammer.NewEngineLogsSpammer(logger, config), } + + srv.consuming.Store(consuming) + + return srv } func (e *EngineServer) Start( @@ -155,6 +162,10 @@ func (s *EngineServer) checkRequestsPresence(version clparams.StateVersion, exec func (s *EngineServer) newPayload(ctx context.Context, req *engine_types.ExecutionPayload, expectedBlobHashes []libcommon.Hash, parentBeaconBlockRoot *libcommon.Hash, executionRequests []hexutility.Bytes, version clparams.StateVersion, ) (*engine_types.PayloadStatus, error) { + if !s.consuming.Load() { + return nil, errors.New("engine payload consumption is not enabled") + } + if s.caplin { s.logger.Crit(caplinEnabledLog) return nil, errCaplinEnabled @@ -517,6 +528,10 @@ func (s *EngineServer) getPayload(ctx context.Context, payloadId uint64, version // engineForkChoiceUpdated either states new block head or request the assembling of a new block func (s *EngineServer) forkchoiceUpdated(ctx context.Context, forkchoiceState *engine_types.ForkChoiceState, payloadAttributes *engine_types.PayloadAttributes, version clparams.StateVersion, ) (*engine_types.ForkChoiceUpdatedResponse, error) { + if !s.consuming.Load() { + return nil, errors.New("engine payload consumption is not enabled") + } + if s.caplin { s.logger.Crit("[NewPayload] caplin is enabled") return nil, errCaplinEnabled @@ -863,6 +878,10 @@ func (e *EngineServer) HandlesForkChoice( return payloadStatus, nil } +func (e *EngineServer) SetConsuming(consuming bool) { + e.consuming.Store(consuming) +} + func waitForStuff(waitCondnF func() (bool, error)) (bool, error) { shouldWait, err := waitCondnF() if err != nil || !shouldWait { diff --git a/turbo/stages/stageloop.go b/turbo/stages/stageloop.go index 79934ad14f9..a97088e67f2 100644 --- a/turbo/stages/stageloop.go +++ b/turbo/stages/stageloop.go @@ -53,6 +53,7 @@ import ( "github.com/erigontech/erigon/polygon/bor" "github.com/erigontech/erigon/polygon/bridge" "github.com/erigontech/erigon/polygon/heimdall" + "github.com/erigontech/erigon/polygon/sync" "github.com/erigontech/erigon/turbo/engineapi/engine_helpers" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/shards" @@ -784,6 +785,7 @@ func NewPolygonSyncStages( maxPeers int, statusDataProvider *sentry.StatusDataProvider, stopNode func() error, + engineAPISwitcher sync.EngineAPISwitcher, ) []*stagedsync.Stage { return stagedsync.PolygonSyncStages( ctx, @@ -803,6 +805,7 @@ func NewPolygonSyncStages( config.Prune, ), stagedsync.NewPolygonSyncStageCfg( + config, logger, chainConfig, db, @@ -817,6 +820,7 @@ func NewPolygonSyncStages( config.LoopBlockLimit, nil, /* userUnwindTypeOverrides */ notifications, + engineAPISwitcher, ), stagedsync.StageSendersCfg(db, chainConfig, config.Sync, false, config.Dirs.Tmp, config.Prune, blockReader, nil), stagedsync.StageExecuteBlocksCfg(db, config.Prune, config.BatchSize, chainConfig, consensusEngine, &vm.Config{}, notifications, config.StateStream, false, config.Dirs, blockReader, nil, config.Genesis, config.Sync, SilkwormForExecutionStage(silkworm, config)),