Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
46e7c851
Commit
46e7c851
authored
Jul 06, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1395 from Gustav-Simonsson/fix_core_errors_in_apply_txs
Fix core errors in apply txs
parents
9c3db1be
0f04af59
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
54 deletions
+10
-54
block_processor.go
core/block_processor.go
+3
-2
error.go
core/error.go
+0
-22
execution.go
core/execution.go
+1
-1
state_transition.go
core/state_transition.go
+1
-1
errors.go
core/vm/errors.go
+3
-21
vm.go
core/vm/vm.go
+2
-2
init.go
tests/init.go
+0
-5
No files found.
core/block_processor.go
View file @
46e7c851
...
...
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
...
...
@@ -72,7 +73,7 @@ func (self *BlockProcessor) ApplyTransaction(coinbase *state.StateObject, stated
cb
:=
statedb
.
GetStateObject
(
coinbase
.
Address
())
_
,
gas
,
err
:=
ApplyMessage
(
NewEnv
(
statedb
,
self
.
bc
,
tx
,
header
),
tx
,
cb
)
if
err
!=
nil
&&
(
IsNonceErr
(
err
)
||
state
.
IsGasLimitErr
(
err
)
||
IsInvalidTxErr
(
err
))
{
if
err
!=
nil
&&
err
!=
vm
.
OutOfGasError
{
return
nil
,
nil
,
err
}
...
...
@@ -118,7 +119,7 @@ func (self *BlockProcessor) ApplyTransactions(coinbase *state.StateObject, state
statedb
.
StartRecord
(
tx
.
Hash
(),
block
.
Hash
(),
i
)
receipt
,
txGas
,
err
:=
self
.
ApplyTransaction
(
coinbase
,
statedb
,
header
,
tx
,
totalUsedGas
,
transientProcess
)
if
err
!=
nil
&&
(
IsNonceErr
(
err
)
||
state
.
IsGasLimitErr
(
err
)
||
IsInvalidTxErr
(
err
))
{
if
err
!=
nil
&&
err
!=
vm
.
OutOfGasError
{
return
nil
,
err
}
...
...
core/error.go
View file @
46e7c851
...
...
@@ -30,7 +30,6 @@ func ParentError(hash common.Hash) error {
func
IsParentErr
(
err
error
)
bool
{
_
,
ok
:=
err
.
(
*
ParentErr
)
return
ok
}
...
...
@@ -48,7 +47,6 @@ func UncleError(format string, v ...interface{}) error {
func
IsUncleErr
(
err
error
)
bool
{
_
,
ok
:=
err
.
(
*
UncleErr
)
return
ok
}
...
...
@@ -67,7 +65,6 @@ func ValidationError(format string, v ...interface{}) *ValidationErr {
func
IsValidationErr
(
err
error
)
bool
{
_
,
ok
:=
err
.
(
*
ValidationErr
)
return
ok
}
...
...
@@ -86,7 +83,6 @@ func NonceError(is, exp uint64) *NonceErr {
func
IsNonceErr
(
err
error
)
bool
{
_
,
ok
:=
err
.
(
*
NonceErr
)
return
ok
}
...
...
@@ -121,24 +117,6 @@ func InvalidTxError(err error) *InvalidTxErr {
func
IsInvalidTxErr
(
err
error
)
bool
{
_
,
ok
:=
err
.
(
*
InvalidTxErr
)
return
ok
}
type
OutOfGasErr
struct
{
Message
string
}
func
OutOfGasError
()
*
OutOfGasErr
{
return
&
OutOfGasErr
{
Message
:
"Out of gas"
}
}
func
(
self
*
OutOfGasErr
)
Error
()
string
{
return
self
.
Message
}
func
IsOutOfGasErr
(
err
error
)
bool
{
_
,
ok
:=
err
.
(
*
OutOfGasErr
)
return
ok
}
...
...
core/execution.go
View file @
46e7c851
...
...
@@ -53,7 +53,7 @@ func (self *Execution) exec(contextAddr *common.Address, code []byte, caller vm.
if
env
.
Depth
()
>
int
(
params
.
CallCreateDepth
.
Int64
())
{
caller
.
ReturnGas
(
self
.
Gas
,
self
.
price
)
return
nil
,
vm
.
DepthError
{}
return
nil
,
vm
.
DepthError
}
vsnapshot
:=
env
.
State
()
.
Copy
()
...
...
core/state_transition.go
View file @
46e7c851
...
...
@@ -122,7 +122,7 @@ func (self *StateTransition) To() *state.StateObject {
func
(
self
*
StateTransition
)
UseGas
(
amount
*
big
.
Int
)
error
{
if
self
.
gas
.
Cmp
(
amount
)
<
0
{
return
OutOfGasError
()
return
vm
.
OutOfGasError
}
self
.
gas
.
Sub
(
self
.
gas
,
amount
)
...
...
core/vm/errors.go
View file @
46e7c851
package
vm
import
(
"errors"
"fmt"
"github.com/ethereum/go-ethereum/params"
)
type
OutOfGasError
struct
{}
func
(
self
OutOfGasError
)
Error
()
string
{
return
"Out Of Gas"
}
func
IsOOGErr
(
err
error
)
bool
{
_
,
ok
:=
err
.
(
OutOfGasError
)
return
ok
}
var
OutOfGasError
=
errors
.
New
(
"Out of gas"
)
var
DepthError
=
fmt
.
Errorf
(
"Max call depth exceeded (%d)"
,
params
.
CallCreateDepth
)
type
StackError
struct
{
req
,
has
int
...
...
@@ -33,14 +26,3 @@ func IsStack(err error) bool {
_
,
ok
:=
err
.
(
StackError
)
return
ok
}
type
DepthError
struct
{}
func
(
self
DepthError
)
Error
()
string
{
return
fmt
.
Sprintf
(
"Max call depth exceeded (%d)"
,
params
.
CallCreateDepth
)
}
func
IsDepthErr
(
err
error
)
bool
{
_
,
ok
:=
err
.
(
DepthError
)
return
ok
}
core/vm/vm.go
View file @
46e7c851
...
...
@@ -116,7 +116,7 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) {
context
.
UseGas
(
context
.
Gas
)
return
context
.
Return
(
nil
),
OutOfGasError
{}
return
context
.
Return
(
nil
),
OutOfGasError
}
// Resize the memory calculated previously
mem
.
Resize
(
newMemSize
.
Uint64
())
...
...
@@ -789,7 +789,7 @@ func (self *Vm) RunPrecompiled(p *PrecompiledAccount, input []byte, context *Con
return
context
.
Return
(
ret
),
nil
}
else
{
return
nil
,
OutOfGasError
{}
return
nil
,
OutOfGasError
}
}
...
...
tests/init.go
View file @
46e7c851
...
...
@@ -20,11 +20,6 @@ var (
BlockSkipTests
=
[]
string
{
"SimpleTx3"
,
// these panic in block_processor.go:84 , see https://github.com/ethereum/go-ethereum/issues/1384
"TRANSCT_rvalue_TooShort"
,
"TRANSCT_rvalue_TooLarge"
,
"TRANSCT_svalue_TooLarge"
,
// TODO: check why these fail
"BLOCK__RandomByteAtTheEnd"
,
"TRANSCT__RandomByteAtTheEnd"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment