Skip to content

Commit 4c01855

Browse files
s1nasadoci
authored andcommitted
internal: drop TestSignCliqueBlock (ethereum#24837)
1 parent 0080287 commit 4c01855

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
@@ -33,7 +33,6 @@ import (
3333
"github.com/ethereum/go-ethereum/common"
3434
"github.com/ethereum/go-ethereum/common/hexutil"
3535
"github.com/ethereum/go-ethereum/common/math"
36-
"github.com/ethereum/go-ethereum/consensus/clique"
3736
"github.com/ethereum/go-ethereum/consensus/ethash"
3837
"github.com/ethereum/go-ethereum/consensus/misc"
3938
"github.com/ethereum/go-ethereum/core"
@@ -1952,45 +1951,6 @@ func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (hexu
19521951
return rlp.EncodeToBytes(block)
19531952
}
19541953

1955-
// TestSignCliqueBlock fetches the given block number, and attempts to sign it as a clique header with the
1956-
// given address, returning the address of the recovered signature
1957-
//
1958-
// This is a temporary method to debug the externalsigner integration,
1959-
// TODO: Remove this method when the integration is mature
1960-
func (api *PublicDebugAPI) TestSignCliqueBlock(ctx context.Context, address common.Address, number uint64) (common.Address, error) {
1961-
block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number))
1962-
if block == nil {
1963-
return common.Address{}, fmt.Errorf("block #%d not found", number)
1964-
}
1965-
header := block.Header()
1966-
header.Extra = make([]byte, 32+65)
1967-
encoded := clique.CliqueRLP(header)
1968-
1969-
// Look up the wallet containing the requested signer
1970-
account := accounts.Account{Address: address}
1971-
wallet, err := api.b.AccountManager().Find(account)
1972-
if err != nil {
1973-
return common.Address{}, err
1974-
}
1975-
1976-
signature, err := wallet.SignData(account, accounts.MimetypeClique, encoded)
1977-
if err != nil {
1978-
return common.Address{}, err
1979-
}
1980-
sealHash := clique.SealHash(header).Bytes()
1981-
log.Info("test signing of clique block",
1982-
"Sealhash", fmt.Sprintf("%x", sealHash),
1983-
"signature", fmt.Sprintf("%x", signature))
1984-
pubkey, err := crypto.Ecrecover(sealHash, signature)
1985-
if err != nil {
1986-
return common.Address{}, err
1987-
}
1988-
var signer common.Address
1989-
copy(signer[:], crypto.Keccak256(pubkey[1:])[12:])
1990-
1991-
return signer, nil
1992-
}
1993-
19941954
// PrintBlock retrieves a block and returns its pretty printed form.
19951955
func (api *PublicDebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error) {
19961956
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
@@ -297,12 +297,6 @@ web3._extend({
297297
call: 'debug_getBlockRlp',
298298
params: 1
299299
}),
300-
new web3._extend.Method({
301-
name: 'testSignCliqueBlock',
302-
call: 'debug_testSignCliqueBlock',
303-
params: 2,
304-
inputFormatter: [web3._extend.formatters.inputAddressFormatter, null],
305-
}),
306300
new web3._extend.Method({
307301
name: 'setHead',
308302
call: 'debug_setHead',

0 commit comments

Comments
 (0)