diff --git a/cmd/clef/extapi_changelog.md b/cmd/clef/extapi_changelog.md index 0cb5049417..fcb9fcf85f 100644 --- a/cmd/clef/extapi_changelog.md +++ b/cmd/clef/extapi_changelog.md @@ -1,5 +1,8 @@ ### Changelog for external API +#### 4.0.0 + +* The external `account_Ecrecover`-method was removed. #### 3.0.0 diff --git a/signer/core/api.go b/signer/core/api.go index 01a545e782..3e3ef3530d 100644 --- a/signer/core/api.go +++ b/signer/core/api.go @@ -46,8 +46,6 @@ type ExternalAPI interface { SignTransaction(ctx context.Context, args SendTxArgs, methodSelector *string) (*ethapi.SignTransactionResult, error) // Sign - request to sign the given data (plus prefix) Sign(ctx context.Context, addr common.MixedcaseAddress, data hexutil.Bytes) (hexutil.Bytes, error) - // EcRecover - request to perform ecrecover - EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error) // Export - request to export an account Export(ctx context.Context, addr common.Address) (json.RawMessage, error) // Import - request to import an account @@ -418,32 +416,6 @@ func (api *SignerAPI) Sign(ctx context.Context, addr common.MixedcaseAddress, da return signature, nil } -// EcRecover returns the address for the Account that was used to create the signature. -// Note, this function is compatible with eth_sign and personal_sign. As such it recovers -// the address of: -// hash = keccak256("\x19Ethereum Signed Message:\n"${message length}${message}) -// addr = ecrecover(hash, signature) -// -// Note, the signature must conform to the secp256k1 curve R, S and V values, where -// the V value must be 27 or 28 for legacy reasons. -// -// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecover -func (api *SignerAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error) { - if len(sig) != 65 { - return common.Address{}, fmt.Errorf("signature must be 65 bytes long") - } - if sig[64] != 27 && sig[64] != 28 { - return common.Address{}, fmt.Errorf("invalid Ethereum signature (V is not 27 or 28)") - } - sig[64] -= 27 // Transform yellow paper V from 27/28 to 0/1 - hash, _ := SignHash(data) - rpk, err := crypto.SigToPub(hash, sig) - if err != nil { - return common.Address{}, err - } - return crypto.PubkeyToAddress(*rpk), nil -} - // SignHash is a helper function that calculates a hash for the given message that can be // safely used to calculate a signature from. // diff --git a/signer/core/auditlog.go b/signer/core/auditlog.go index 1e6da0b0e2..1b9bca427a 100644 --- a/signer/core/auditlog.go +++ b/signer/core/auditlog.go @@ -71,14 +71,6 @@ func (l *AuditLogger) Sign(ctx context.Context, addr common.MixedcaseAddress, da return b, e } -func (l *AuditLogger) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error) { - l.log.Info("EcRecover", "type", "request", "metadata", MetadataFromContext(ctx).String(), - "data", common.Bytes2Hex(data)) - a, e := l.api.EcRecover(ctx, data, sig) - l.log.Info("EcRecover", "type", "response", "addr", a.String(), "error", e) - return a, e -} - func (l *AuditLogger) Export(ctx context.Context, addr common.Address) (json.RawMessage, error) { l.log.Info("Export", "type", "request", "metadata", MetadataFromContext(ctx).String(), "addr", addr.Hex())