Skip to content

Commit 5d980a0

Browse files
s1naunclezoro
authored andcommitted
internal: drop TestSignCliqueBlock (ethereum#24837)
1 parent e8b9338 commit 5d980a0

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
@@ -35,7 +35,6 @@ import (
3535
"github.com/ethereum/go-ethereum/common/hexutil"
3636
"github.com/ethereum/go-ethereum/common/math"
3737
"github.com/ethereum/go-ethereum/consensus"
38-
"github.com/ethereum/go-ethereum/consensus/clique"
3938
"github.com/ethereum/go-ethereum/consensus/ethash"
4039
"github.com/ethereum/go-ethereum/consensus/misc"
4140
"github.com/ethereum/go-ethereum/core"
@@ -2312,45 +2311,6 @@ func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (hexu
23122311
return rlp.EncodeToBytes(block)
23132312
}
23142313

2315-
// TestSignCliqueBlock fetches the given block number, and attempts to sign it as a clique header with the
2316-
// given address, returning the address of the recovered signature
2317-
//
2318-
// This is a temporary method to debug the externalsigner integration,
2319-
// TODO: Remove this method when the integration is mature
2320-
func (api *PublicDebugAPI) TestSignCliqueBlock(ctx context.Context, address common.Address, number uint64) (common.Address, error) {
2321-
block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number))
2322-
if block == nil {
2323-
return common.Address{}, fmt.Errorf("block #%d not found", number)
2324-
}
2325-
header := block.Header()
2326-
header.Extra = make([]byte, 32+65)
2327-
encoded := clique.CliqueRLP(header)
2328-
2329-
// Look up the wallet containing the requested signer
2330-
account := accounts.Account{Address: address}
2331-
wallet, err := api.b.AccountManager().Find(account)
2332-
if err != nil {
2333-
return common.Address{}, err
2334-
}
2335-
2336-
signature, err := wallet.SignData(account, accounts.MimetypeClique, encoded)
2337-
if err != nil {
2338-
return common.Address{}, err
2339-
}
2340-
sealHash := clique.SealHash(header).Bytes()
2341-
log.Info("test signing of clique block",
2342-
"Sealhash", fmt.Sprintf("%x", sealHash),
2343-
"signature", fmt.Sprintf("%x", signature))
2344-
pubkey, err := crypto.Ecrecover(sealHash, signature)
2345-
if err != nil {
2346-
return common.Address{}, err
2347-
}
2348-
var signer common.Address
2349-
copy(signer[:], crypto.Keccak256(pubkey[1:])[12:])
2350-
2351-
return signer, nil
2352-
}
2353-
23542314
// PrintBlock retrieves a block and returns its pretty printed form.
23552315
func (api *PublicDebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error) {
23562316
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)