mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
feat: allow at most 4 inputs for Bn256Pairing precompile (#581)
* feat: allow at most 4 inputs for `Bn256Pairing` precompile * mv core/vm/testdata/precompiles/bn256Pairing.json core/vm/testdata/precompiles/fail-bn256Pairing.json
This commit is contained in:
parent
563e36e542
commit
17bd8b2815
2 changed files with 4 additions and 0 deletions
|
|
@ -585,6 +585,10 @@ var (
|
||||||
// runBn256Pairing implements the Bn256Pairing precompile, referenced by both
|
// runBn256Pairing implements the Bn256Pairing precompile, referenced by both
|
||||||
// Byzantium and Istanbul operations.
|
// Byzantium and Istanbul operations.
|
||||||
func runBn256Pairing(input []byte) ([]byte, error) {
|
func runBn256Pairing(input []byte) ([]byte, error) {
|
||||||
|
// Allow at most 4 inputs
|
||||||
|
if len(input) > 4*192 {
|
||||||
|
return nil, errBadPairingInput
|
||||||
|
}
|
||||||
// Handle some corner cases cheaply
|
// Handle some corner cases cheaply
|
||||||
if len(input)%192 > 0 {
|
if len(input)%192 > 0 {
|
||||||
return nil, errBadPairingInput
|
return nil, errBadPairingInput
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue