Make EVMError Catchable and only catch CatchableError in the execPrecompiles
This commit is contained in:
parent
f6d784c8b0
commit
1a3a29c419
|
@ -6,7 +6,7 @@
|
||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
type
|
type
|
||||||
EVMError* = object of Exception
|
EVMError* = object of CatchableError
|
||||||
## Base error class for all evm errors.
|
## Base error class for all evm errors.
|
||||||
|
|
||||||
BlockNotFound* = object of EVMError
|
BlockNotFound* = object of EVMError
|
||||||
|
|
|
@ -233,7 +233,7 @@ proc modExp*(computation: BaseComputation) =
|
||||||
elif maxBytes <= 1024:
|
elif maxBytes <= 1024:
|
||||||
computation.modExpInternal(base_len, exp_len, mod_len, StUint[8192])
|
computation.modExpInternal(base_len, exp_len, mod_len, StUint[8192])
|
||||||
else:
|
else:
|
||||||
raise newException(ValueError, "The Nimbus VM doesn't support modular exponentiation with numbers larger than uint8192")
|
raise newException(EVMError, "The Nimbus VM doesn't support modular exponentiation with numbers larger than uint8192")
|
||||||
|
|
||||||
proc bn256ecAdd*(computation: BaseComputation) =
|
proc bn256ecAdd*(computation: BaseComputation) =
|
||||||
computation.gasMeter.consumeGas(GasECAdd, reason = "ecAdd Precompile")
|
computation.gasMeter.consumeGas(GasECAdd, reason = "ecAdd Precompile")
|
||||||
|
@ -335,7 +335,7 @@ proc execPrecompiles*(computation: BaseComputation, fork: Fork): bool {.inline.}
|
||||||
let msg = getCurrentExceptionMsg()
|
let msg = getCurrentExceptionMsg()
|
||||||
# cannot use setError here, cyclic dependency
|
# cannot use setError here, cyclic dependency
|
||||||
computation.error = Error(info: msg, burnsGas: true)
|
computation.error = Error(info: msg, burnsGas: true)
|
||||||
except:
|
except CatchableError:
|
||||||
let msg = getCurrentExceptionMsg()
|
let msg = getCurrentExceptionMsg()
|
||||||
if fork >= FKByzantium and precompile > paIdentity:
|
if fork >= FKByzantium and precompile > paIdentity:
|
||||||
computation.error = Error(info: msg, burnsGas: true)
|
computation.error = Error(info: msg, burnsGas: true)
|
||||||
|
|
Loading…
Reference in New Issue