|
|
@ -247,7 +247,7 @@ func makeGasLog(n uint64) gasFunc { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func gasSha3(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) { |
|
|
|
func gasKeccak256(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) { |
|
|
|
gas, err := memoryGasCost(mem, memorySize) |
|
|
|
gas, err := memoryGasCost(mem, memorySize) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
return 0, err |
|
|
@ -256,7 +256,7 @@ func gasSha3(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize |
|
|
|
if overflow { |
|
|
|
if overflow { |
|
|
|
return 0, ErrGasUintOverflow |
|
|
|
return 0, ErrGasUintOverflow |
|
|
|
} |
|
|
|
} |
|
|
|
if wordGas, overflow = math.SafeMul(toWordSize(wordGas), params.Sha3WordGas); overflow { |
|
|
|
if wordGas, overflow = math.SafeMul(toWordSize(wordGas), params.Keccak256WordGas); overflow { |
|
|
|
return 0, ErrGasUintOverflow |
|
|
|
return 0, ErrGasUintOverflow |
|
|
|
} |
|
|
|
} |
|
|
|
if gas, overflow = math.SafeAdd(gas, wordGas); overflow { |
|
|
|
if gas, overflow = math.SafeAdd(gas, wordGas); overflow { |
|
|
@ -290,7 +290,7 @@ func gasCreate2(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memoryS |
|
|
|
if overflow { |
|
|
|
if overflow { |
|
|
|
return 0, ErrGasUintOverflow |
|
|
|
return 0, ErrGasUintOverflow |
|
|
|
} |
|
|
|
} |
|
|
|
if wordGas, overflow = math.SafeMul(toWordSize(wordGas), params.Sha3WordGas); overflow { |
|
|
|
if wordGas, overflow = math.SafeMul(toWordSize(wordGas), params.Keccak256WordGas); overflow { |
|
|
|
return 0, ErrGasUintOverflow |
|
|
|
return 0, ErrGasUintOverflow |
|
|
|
} |
|
|
|
} |
|
|
|
if gas, overflow = math.SafeAdd(gas, wordGas); overflow { |
|
|
|
if gas, overflow = math.SafeAdd(gas, wordGas); overflow { |
|
|
|