mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 15:47:21 +00:00
core/vm: refactor to use bitutil.TestBytes (#32434)
This commit is contained in:
parent
a002a6c03f
commit
ccf684f1ba
2 changed files with 2 additions and 10 deletions
|
|
@ -84,12 +84,3 @@ func toWordSize(size uint64) uint64 {
|
||||||
|
|
||||||
return (size + 31) / 32
|
return (size + 31) / 32
|
||||||
}
|
}
|
||||||
|
|
||||||
func allZero(b []byte) bool {
|
|
||||||
for _, byte := range b {
|
|
||||||
if byte != 0 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import (
|
||||||
"github.com/consensys/gnark-crypto/ecc/bls12-381/fp"
|
"github.com/consensys/gnark-crypto/ecc/bls12-381/fp"
|
||||||
"github.com/consensys/gnark-crypto/ecc/bls12-381/fr"
|
"github.com/consensys/gnark-crypto/ecc/bls12-381/fr"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
"github.com/ethereum/go-ethereum/common/bitutil"
|
||||||
"github.com/ethereum/go-ethereum/core/tracing"
|
"github.com/ethereum/go-ethereum/core/tracing"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/crypto/blake2b"
|
"github.com/ethereum/go-ethereum/crypto/blake2b"
|
||||||
|
|
@ -289,7 +290,7 @@ func (c *ecrecover) Run(input []byte) ([]byte, error) {
|
||||||
v := input[63] - 27
|
v := input[63] - 27
|
||||||
|
|
||||||
// tighter sig s values input homestead only apply to tx sigs
|
// tighter sig s values input homestead only apply to tx sigs
|
||||||
if !allZero(input[32:63]) || !crypto.ValidateSignatureValues(v, r, s, false) {
|
if bitutil.TestBytes(input[32:63]) || !crypto.ValidateSignatureValues(v, r, s, false) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
// We must make sure not to modify the 'input', so placing the 'v' along with
|
// We must make sure not to modify the 'input', so placing the 'v' along with
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue