• Jeffrey Wilcke's avatar
    core/vm: improved EVM run loop & instruction calling (#3378) · bbc4ea4a
    Jeffrey Wilcke authored
    The run loop, which previously contained custom opcode executes have been
    removed and has been simplified to a few checks.
    
    Each operation consists of 4 elements: execution function, gas cost function,
    stack validation function and memory size function. The execution function
    implements the operation's runtime behaviour, the gas cost function implements
    the operation gas costs function and greatly depends on the memory and stack,
    the stack validation function validates the stack and makes sure that enough
    items can be popped off and pushed on and the memory size function calculates
    the memory required for the operation and returns it.
    
    This commit also allows the EVM to go unmetered. This is helpful for offline
    operations such as contract calls.
    bbc4ea4a
errors.go 1.16 KB
// Copyright 2014 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

package vm

import "errors"

var (
	ErrOutOfGas            = errors.New("out of gas")
	ErrCodeStoreOutOfGas   = errors.New("contract creation code storage out of gas")
	ErrDepth               = errors.New("max call depth exceeded")
	ErrTraceLimitReached   = errors.New("the number of logs reached the specified limit")
	ErrInsufficientBalance = errors.New("insufficient balance for transfer")
)