From 273019619f0ab67ae05be7d7a8050ce016d5373b Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi <1591639+s1na@users.noreply.github.com> Date: Tue, 10 May 2022 10:46:26 +0200 Subject: [PATCH] internal: drop TestSignCliqueBlock (#24837) --- internal/ethapi/api.go | 40 ------------------------------------- internal/web3ext/web3ext.go | 6 ------ 2 files changed, 46 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index a4d1d7e7612a..abe68537b648 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -33,7 +33,6 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/consensus/clique" "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/consensus/misc" "github.com/ethereum/go-ethereum/core" @@ -1952,45 +1951,6 @@ func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (hexu return rlp.EncodeToBytes(block) } -// TestSignCliqueBlock fetches the given block number, and attempts to sign it as a clique header with the -// given address, returning the address of the recovered signature -// -// This is a temporary method to debug the externalsigner integration, -// TODO: Remove this method when the integration is mature -func (api *PublicDebugAPI) TestSignCliqueBlock(ctx context.Context, address common.Address, number uint64) (common.Address, error) { - block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number)) - if block == nil { - return common.Address{}, fmt.Errorf("block #%d not found", number) - } - header := block.Header() - header.Extra = make([]byte, 32+65) - encoded := clique.CliqueRLP(header) - - // Look up the wallet containing the requested signer - account := accounts.Account{Address: address} - wallet, err := api.b.AccountManager().Find(account) - if err != nil { - return common.Address{}, err - } - - signature, err := wallet.SignData(account, accounts.MimetypeClique, encoded) - if err != nil { - return common.Address{}, err - } - sealHash := clique.SealHash(header).Bytes() - log.Info("test signing of clique block", - "Sealhash", fmt.Sprintf("%x", sealHash), - "signature", fmt.Sprintf("%x", signature)) - pubkey, err := crypto.Ecrecover(sealHash, signature) - if err != nil { - return common.Address{}, err - } - var signer common.Address - copy(signer[:], crypto.Keccak256(pubkey[1:])[12:]) - - return signer, nil -} - // PrintBlock retrieves a block and returns its pretty printed form. func (api *PublicDebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error) { block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number)) diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index 6a9c47658000..6c2d3340225e 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -297,12 +297,6 @@ web3._extend({ call: 'debug_getBlockRlp', params: 1 }), - new web3._extend.Method({ - name: 'testSignCliqueBlock', - call: 'debug_testSignCliqueBlock', - params: 2, - inputFormatter: [web3._extend.formatters.inputAddressFormatter, null], - }), new web3._extend.Method({ name: 'setHead', call: 'debug_setHead',