mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
core vm: Revert calls when balance > 128bits
This commit is contained in:
parent
ccec71b3ff
commit
ac0f688edd
2 changed files with 7 additions and 2 deletions
|
|
@ -109,7 +109,6 @@ func (in *InterpreterEWASM) Run(contract *Contract, input []byte, ro bool) ([]by
|
||||||
|
|
||||||
in.contract = contract
|
in.contract = contract
|
||||||
in.contract.Input = input
|
in.contract.Input = input
|
||||||
initialGas := contract.Gas
|
|
||||||
|
|
||||||
module, err := wasm.ReadModule(bytes.NewReader(contract.Code), WrappedModuleResolver(in))
|
module, err := wasm.ReadModule(bytes.NewReader(contract.Code), WrappedModuleResolver(in))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -131,7 +130,6 @@ func (in *InterpreterEWASM) Run(contract *Contract, input []byte, ro bool) ([]by
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check input and output types
|
// Check input and output types
|
||||||
sig := module.FunctionIndexSpace[mainIndex].Sig
|
sig := module.FunctionIndexSpace[mainIndex].Sig
|
||||||
if len(sig.ParamTypes) == 0 && len(sig.ReturnTypes) == 0 {
|
if len(sig.ParamTypes) == 0 && len(sig.ReturnTypes) == 0 {
|
||||||
|
|
|
||||||
|
|
@ -439,6 +439,13 @@ func call(p *exec.Process, in *InterpreterEWASM, gas int64, addressOffset int32,
|
||||||
return ErrEEICallFailure
|
return ErrEEICallFailure
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fail if the account's balance is greater than 128bits as discussed
|
||||||
|
// in https://github.com/ewasm/hera/issues/456
|
||||||
|
if in.StateDB.GetBalance(contract.Address()).Cmp(check128bits) > 0 {
|
||||||
|
in.gasAccounting(contract.Gas)
|
||||||
|
return ErrEEICallRevert
|
||||||
|
}
|
||||||
|
|
||||||
if in.staticMode == true && value.Cmp(big.NewInt(0)) != 0 {
|
if in.staticMode == true && value.Cmp(big.NewInt(0)) != 0 {
|
||||||
in.gasAccounting(in.contract.Gas)
|
in.gasAccounting(in.contract.Gas)
|
||||||
return ErrEEICallFailure
|
return ErrEEICallFailure
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue