Skip to content

Commit

Permalink
Merge pull request #25 from ian0371/klaytn-signature
Browse files Browse the repository at this point in the history
Remove klaytn from ecrecover error
  • Loading branch information
blukat29 authored Jul 2, 2024
2 parents 7730774 + ad5cbbf commit 7e292c7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Please put an x in the boxes related to your change.

## Checklist

*Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.*
_Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._

- [ ] I have read the [ ] I have read the [CONTRIBUTING GUIDELINES](https://github.com/kaiachain/kaia/blob/main/CONTRIBUTING.md) doc
- [ ] I have read the [CLA](https://gist.github.com/kaiachain-dev/bbf65cc330275c057463c4c94ce787a6) and signed by comment ```I have read the CLA Document and I hereby sign the CLA``` in first time contribute
- [ ] I have read the [CONTRIBUTING GUIDELINES](https://github.com/kaiachain/kaia/blob/main/CONTRIBUTING.md) doc
- [ ] I have read the [CLA](https://gist.github.com/kaiachain-dev/bbf65cc330275c057463c4c94ce787a6) and signed by comment `I have read the CLA Document and I hereby sign the CLA` in first time contribute
- [ ] Lint and unit tests pass locally with my changes (`$ make test`)
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)
Expand Down
2 changes: 1 addition & 1 deletion api/api_private_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ func (s *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Byt
return common.Address{}, errors.New("signature must be 65 bytes long")
}
if sig[crypto.RecoveryIDOffset] != 27 && sig[crypto.RecoveryIDOffset] != 28 {
return common.Address{}, errors.New("invalid Klaytn signature (V is not 27 or 28)")
return common.Address{}, errors.New("invalid signature (V is not 27 or 28)")
}

// Transform yellow paper V from 27/28 to 0/1
Expand Down
4 changes: 2 additions & 2 deletions api/api_public_transaction_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,10 +601,10 @@ func (s *PublicTransactionPoolAPI) RecoverFromMessage(
ctx context.Context, address common.Address, data, sig hexutil.Bytes, blockNumber rpc.BlockNumber,
) (common.Address, error) {
if len(sig) != crypto.SignatureLength {
return common.Address{}, fmt.Errorf("signature must be 65 bytes long")
return common.Address{}, errors.New("signature must be 65 bytes long")
}
if sig[crypto.RecoveryIDOffset] != 27 && sig[crypto.RecoveryIDOffset] != 28 {
return common.Address{}, fmt.Errorf("invalid Klaytn signature (V is not 27 or 28)")
return common.Address{}, errors.New("invalid signature (V is not 27 or 28)")
}

// Transform yellow paper V from 27/28 to 0/1
Expand Down

0 comments on commit 7e292c7

Please sign in to comment.