mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
Update contracts.go
This commit is contained in:
parent
9caab0d8de
commit
51f8da1d6e
1 changed files with 4 additions and 3 deletions
|
|
@ -441,14 +441,15 @@ func (c *bigModExp) RequiredGas(input []byte) uint64 {
|
||||||
|
|
||||||
maxLenOver32 := gas.Cmp(big32) > 0
|
maxLenOver32 := gas.Cmp(big32) > 0
|
||||||
if c.eip2565 {
|
if c.eip2565 {
|
||||||
// EIP-2565 has three changes
|
// EIP-2565 (Berlin fork) has three changes:
|
||||||
|
//
|
||||||
// 1. Different multComplexity (inlined here)
|
// 1. Different multComplexity (inlined here)
|
||||||
// in EIP-2565 (https://eips.ethereum.org/EIPS/eip-2565):
|
// in EIP-2565 (https://eips.ethereum.org/EIPS/eip-2565):
|
||||||
//
|
//
|
||||||
// def mult_complexity(x):
|
// def mult_complexity(x):
|
||||||
// ceiling(x/8)^2
|
// ceiling(x/8)^2
|
||||||
//
|
//
|
||||||
//where is x is max(length_of_MODULUS, length_of_BASE)
|
// where is x is max(length_of_MODULUS, length_of_BASE)
|
||||||
gas.Add(gas, big7)
|
gas.Add(gas, big7)
|
||||||
gas.Rsh(gas, 3)
|
gas.Rsh(gas, 3)
|
||||||
gas.Mul(gas, gas)
|
gas.Mul(gas, gas)
|
||||||
|
|
@ -472,7 +473,7 @@ func (c *bigModExp) RequiredGas(input []byte) uint64 {
|
||||||
return max(minPrice, gas.Uint64())
|
return max(minPrice, gas.Uint64())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre-osaka logic.
|
// Pre-Berlin logic.
|
||||||
gas = modexpMultComplexity(gas)
|
gas = modexpMultComplexity(gas)
|
||||||
if adjExpLen.Cmp(big1) > 0 {
|
if adjExpLen.Cmp(big1) > 0 {
|
||||||
gas.Mul(gas, adjExpLen)
|
gas.Mul(gas, adjExpLen)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue