Skip to content

Commit 5b46f1d

Browse files
authored
internal: drop TestSignCliqueBlock (#24837)
1 parent 7caa2d8 commit 5b46f1d

File tree

2 files changed

+0
-46
lines changed

2 files changed

+0
-46
lines changed

internal/ethapi/api.go

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import (
3232
"github.com/ethereum/go-ethereum/common"
3333
"github.com/ethereum/go-ethereum/common/hexutil"
3434
"github.com/ethereum/go-ethereum/common/math"
35-
"github.com/ethereum/go-ethereum/consensus/clique"
3635
"github.com/ethereum/go-ethereum/consensus/ethash"
3736
"github.com/ethereum/go-ethereum/consensus/misc"
3837
"github.com/ethereum/go-ethereum/core"
@@ -1875,45 +1874,6 @@ func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (hexu
18751874
return rlp.EncodeToBytes(block)
18761875
}
18771876

1878-
// TestSignCliqueBlock fetches the given block number, and attempts to sign it as a clique header with the
1879-
// given address, returning the address of the recovered signature
1880-
//
1881-
// This is a temporary method to debug the externalsigner integration,
1882-
// TODO: Remove this method when the integration is mature
1883-
func (api *PublicDebugAPI) TestSignCliqueBlock(ctx context.Context, address common.Address, number uint64) (common.Address, error) {
1884-
block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number))
1885-
if block == nil {
1886-
return common.Address{}, fmt.Errorf("block #%d not found", number)
1887-
}
1888-
header := block.Header()
1889-
header.Extra = make([]byte, 32+65)
1890-
encoded := clique.CliqueRLP(header)
1891-
1892-
// Look up the wallet containing the requested signer
1893-
account := accounts.Account{Address: address}
1894-
wallet, err := api.b.AccountManager().Find(account)
1895-
if err != nil {
1896-
return common.Address{}, err
1897-
}
1898-
1899-
signature, err := wallet.SignData(account, accounts.MimetypeClique, encoded)
1900-
if err != nil {
1901-
return common.Address{}, err
1902-
}
1903-
sealHash := clique.SealHash(header).Bytes()
1904-
log.Info("test signing of clique block",
1905-
"Sealhash", fmt.Sprintf("%x", sealHash),
1906-
"signature", fmt.Sprintf("%x", signature))
1907-
pubkey, err := crypto.Ecrecover(sealHash, signature)
1908-
if err != nil {
1909-
return common.Address{}, err
1910-
}
1911-
var signer common.Address
1912-
copy(signer[:], crypto.Keccak256(pubkey[1:])[12:])
1913-
1914-
return signer, nil
1915-
}
1916-
19171877
// PrintBlock retrieves a block and returns its pretty printed form.
19181878
func (api *PublicDebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error) {
19191879
block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number))

internal/web3ext/web3ext.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,6 @@ web3._extend({
233233
call: 'debug_getBlockRlp',
234234
params: 1
235235
}),
236-
new web3._extend.Method({
237-
name: 'testSignCliqueBlock',
238-
call: 'debug_testSignCliqueBlock',
239-
params: 2,
240-
inputFormatter: [web3._extend.formatters.inputAddressFormatter, null],
241-
}),
242236
new web3._extend.Method({
243237
name: 'setHead',
244238
call: 'debug_setHead',

0 commit comments

Comments
 (0)