mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
core/vm: Fixed error in bn256Add
This commit is contained in:
parent
c3711a1f2c
commit
c5b2abc83d
1 changed files with 4 additions and 3 deletions
|
|
@ -231,11 +231,11 @@ func (c *bn256Add) Run(in []byte) ([]byte, error) {
|
||||||
return nil, errInvalidCurvePoint
|
return nil, errInvalidCurvePoint
|
||||||
}
|
}
|
||||||
|
|
||||||
y, onCurve := new(bn256.G1).Unmarshal(in[:64])
|
y, onCurve := new(bn256.G1).Unmarshal(in[64:128])
|
||||||
if !onCurve {
|
if !onCurve {
|
||||||
return nil, errNotOnCurve
|
return nil, errNotOnCurve
|
||||||
}
|
}
|
||||||
gx, gy, _, _ = x.CurvePoints()
|
gx, gy, _, _ = y.CurvePoints()
|
||||||
if gx.Cmp(bn256.P) >= 0 || gy.Cmp(bn256.P) >= 0 {
|
if gx.Cmp(bn256.P) >= 0 || gy.Cmp(bn256.P) >= 0 {
|
||||||
return nil, errInvalidCurvePoint
|
return nil, errInvalidCurvePoint
|
||||||
}
|
}
|
||||||
|
|
@ -278,7 +278,8 @@ type pairing struct{}
|
||||||
// This method does not require any overflow checking as the input size gas costs
|
// This method does not require any overflow checking as the input size gas costs
|
||||||
// required for anything significant is so high it's impossible to pay for.
|
// required for anything significant is so high it's impossible to pay for.
|
||||||
func (c *pairing) RequiredGas(input []byte) uint64 {
|
func (c *pairing) RequiredGas(input []byte) uint64 {
|
||||||
return 0 // TODO
|
//return 0 // TODO
|
||||||
|
return uint64(60000*len(input) + 40000)
|
||||||
}
|
}
|
||||||
|
|
||||||
const pairSize = 192
|
const pairSize = 192
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue