mirror of https://github.com/poanetwork/quorum.git
Require the addition of the extra intrinsic gas cost to remain under the
user input gas limit.
This commit is contained in:
parent
a872dd10c2
commit
e1e5fa0e8f
|
@ -783,10 +783,6 @@ func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (h
|
||||||
//still run
|
//still run
|
||||||
//This makes the return value a potential over-estimate of gas, rather than the exact cost to run right now
|
//This makes the return value a potential over-estimate of gas, rather than the exact cost to run right now
|
||||||
|
|
||||||
//There is still one edge case: if the transaction has a low intrinsic gas cost, but a high execution cost, then
|
|
||||||
//it the addition of the extra gas needed to make it private may push it over the maximum gas allowed, but this
|
|
||||||
//wouldn't matter since we weren't planning to make it private
|
|
||||||
|
|
||||||
//if the transaction has a value then it cannot be private, so we can skip this check
|
//if the transaction has a value then it cannot be private, so we can skip this check
|
||||||
if args.Value.ToInt().Cmp(big.NewInt(0)) == 0 {
|
if args.Value.ToInt().Cmp(big.NewInt(0)) == 0 {
|
||||||
|
|
||||||
|
@ -796,7 +792,7 @@ func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (h
|
||||||
|
|
||||||
if intrinsicGasPrivate > intrinsicGasPublic {
|
if intrinsicGasPrivate > intrinsicGasPublic {
|
||||||
if math.MaxUint64 - hi < intrinsicGasPrivate - intrinsicGasPublic {
|
if math.MaxUint64 - hi < intrinsicGasPrivate - intrinsicGasPublic {
|
||||||
return 0, fmt.Errorf("gas required exceeds allowance or always failing transaction")
|
return 0, fmt.Errorf("private intrinsic gas addition exceeds allowance")
|
||||||
}
|
}
|
||||||
return hexutil.Uint64(hi + (intrinsicGasPrivate - intrinsicGasPublic)), nil
|
return hexutil.Uint64(hi + (intrinsicGasPrivate - intrinsicGasPublic)), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue