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
b10bcd92
Commit
b10bcd92
authored
Nov 14, 2016
by
Zsolt Felfoldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/types: turn off nonce checking for Call messages
parent
d8e2e9a4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
22 deletions
+25
-22
api.go
common/registrar/ethreg/api.go
+1
-1
transaction.go
core/types/transaction.go
+18
-15
api.go
internal/ethapi/api.go
+1
-1
odr_test.go
les/odr_test.go
+2
-2
odr_test.go
light/odr_test.go
+2
-2
state_test_util.go
tests/state_test_util.go
+1
-1
No files found.
common/registrar/ethreg/api.go
View file @
b10bcd92
...
...
@@ -187,7 +187,7 @@ func (be *registryAPIBackend) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr
if
gasPrice
.
BitLen
()
==
0
{
gasPrice
=
new
(
big
.
Int
)
.
Mul
(
big
.
NewInt
(
50
),
common
.
Shannon
)
}
msg
:=
types
.
NewMessage
(
from
.
Address
(),
to
,
0
,
common
.
Big
(
valueStr
),
gas
,
gasPrice
,
common
.
FromHex
(
dataStr
))
msg
:=
types
.
NewMessage
(
from
.
Address
(),
to
,
0
,
common
.
Big
(
valueStr
),
gas
,
gasPrice
,
common
.
FromHex
(
dataStr
)
,
false
)
header
:=
be
.
bc
.
CurrentBlock
()
.
Header
()
vmenv
:=
core
.
NewEnv
(
statedb
,
be
.
config
,
be
.
bc
,
msg
,
header
,
vm
.
Config
{})
...
...
core/types/transaction.go
View file @
b10bcd92
...
...
@@ -321,12 +321,13 @@ func (tx *Transaction) SignatureValues() (v byte, r *big.Int, s *big.Int, err er
// XXX Rename message to something less arbitrary?
func
(
tx
*
Transaction
)
AsMessage
(
s
Signer
)
(
Message
,
error
)
{
msg
:=
Message
{
nonce
:
tx
.
data
.
AccountNonce
,
price
:
new
(
big
.
Int
)
.
Set
(
tx
.
data
.
Price
),
gasLimit
:
new
(
big
.
Int
)
.
Set
(
tx
.
data
.
GasLimit
),
to
:
tx
.
data
.
Recipient
,
amount
:
tx
.
data
.
Amount
,
data
:
tx
.
data
.
Payload
,
nonce
:
tx
.
data
.
AccountNonce
,
price
:
new
(
big
.
Int
)
.
Set
(
tx
.
data
.
Price
),
gasLimit
:
new
(
big
.
Int
)
.
Set
(
tx
.
data
.
GasLimit
),
to
:
tx
.
data
.
Recipient
,
amount
:
tx
.
data
.
Amount
,
data
:
tx
.
data
.
Payload
,
checkNonce
:
true
,
}
var
err
error
...
...
@@ -535,17 +536,19 @@ type Message struct {
nonce
uint64
amount
,
price
,
gasLimit
*
big
.
Int
data
[]
byte
checkNonce
bool
}
func
NewMessage
(
from
common
.
Address
,
to
*
common
.
Address
,
nonce
uint64
,
amount
,
gasLimit
,
price
*
big
.
Int
,
data
[]
byte
)
Message
{
func
NewMessage
(
from
common
.
Address
,
to
*
common
.
Address
,
nonce
uint64
,
amount
,
gasLimit
,
price
*
big
.
Int
,
data
[]
byte
,
checkNonce
bool
)
Message
{
return
Message
{
from
:
from
,
to
:
to
,
nonce
:
nonce
,
amount
:
amount
,
price
:
price
,
gasLimit
:
gasLimit
,
data
:
data
,
from
:
from
,
to
:
to
,
nonce
:
nonce
,
amount
:
amount
,
price
:
price
,
gasLimit
:
gasLimit
,
data
:
data
,
checkNonce
:
checkNonce
,
}
}
...
...
@@ -556,4 +559,4 @@ func (m Message) Value() *big.Int { return m.amount }
func
(
m
Message
)
Gas
()
*
big
.
Int
{
return
m
.
gasLimit
}
func
(
m
Message
)
Nonce
()
uint64
{
return
m
.
nonce
}
func
(
m
Message
)
Data
()
[]
byte
{
return
m
.
data
}
func
(
m
Message
)
CheckNonce
()
bool
{
return
tru
e
}
func
(
m
Message
)
CheckNonce
()
bool
{
return
m
.
checkNonc
e
}
internal/ethapi/api.go
View file @
b10bcd92
...
...
@@ -545,7 +545,7 @@ func (s *PublicBlockChainAPI) doCall(ctx context.Context, args CallArgs, blockNr
if
gasPrice
.
Cmp
(
common
.
Big0
)
==
0
{
gasPrice
=
new
(
big
.
Int
)
.
Mul
(
big
.
NewInt
(
50
),
common
.
Shannon
)
}
msg
:=
types
.
NewMessage
(
addr
,
args
.
To
,
0
,
args
.
Value
.
BigInt
(),
gas
,
gasPrice
,
common
.
FromHex
(
args
.
Data
))
msg
:=
types
.
NewMessage
(
addr
,
args
.
To
,
0
,
args
.
Value
.
BigInt
(),
gas
,
gasPrice
,
common
.
FromHex
(
args
.
Data
)
,
false
)
// Execute the call and return
vmenv
,
vmError
,
err
:=
s
.
b
.
GetVMEnv
(
ctx
,
msg
,
state
,
header
)
...
...
les/odr_test.go
View file @
b10bcd92
...
...
@@ -119,7 +119,7 @@ func odrContractCall(ctx context.Context, db ethdb.Database, config *params.Chai
from
:=
statedb
.
GetOrNewStateObject
(
testBankAddress
)
from
.
SetBalance
(
common
.
MaxBig
)
msg
:=
callmsg
{
types
.
NewMessage
(
from
.
Address
(),
&
testContractAddr
,
0
,
new
(
big
.
Int
),
big
.
NewInt
(
100000
),
new
(
big
.
Int
),
data
)}
msg
:=
callmsg
{
types
.
NewMessage
(
from
.
Address
(),
&
testContractAddr
,
0
,
new
(
big
.
Int
),
big
.
NewInt
(
100000
),
new
(
big
.
Int
),
data
,
false
)}
vmenv
:=
core
.
NewEnv
(
statedb
,
config
,
bc
,
msg
,
header
,
vm
.
Config
{})
gp
:=
new
(
core
.
GasPool
)
.
AddGas
(
common
.
MaxBig
)
ret
,
_
,
_
:=
core
.
ApplyMessage
(
vmenv
,
msg
,
gp
)
...
...
@@ -132,7 +132,7 @@ func odrContractCall(ctx context.Context, db ethdb.Database, config *params.Chai
if
err
==
nil
{
from
.
SetBalance
(
common
.
MaxBig
)
msg
:=
callmsg
{
types
.
NewMessage
(
from
.
Address
(),
&
testContractAddr
,
0
,
new
(
big
.
Int
),
big
.
NewInt
(
100000
),
new
(
big
.
Int
),
data
)}
msg
:=
callmsg
{
types
.
NewMessage
(
from
.
Address
(),
&
testContractAddr
,
0
,
new
(
big
.
Int
),
big
.
NewInt
(
100000
),
new
(
big
.
Int
),
data
,
false
)}
vmenv
:=
light
.
NewEnv
(
ctx
,
state
,
config
,
lc
,
msg
,
header
,
vm
.
Config
{})
gp
:=
new
(
core
.
GasPool
)
.
AddGas
(
common
.
MaxBig
)
...
...
light/odr_test.go
View file @
b10bcd92
...
...
@@ -167,7 +167,7 @@ func odrContractCall(ctx context.Context, db ethdb.Database, bc *core.BlockChain
from
:=
statedb
.
GetOrNewStateObject
(
testBankAddress
)
from
.
SetBalance
(
common
.
MaxBig
)
msg
:=
callmsg
{
types
.
NewMessage
(
from
.
Address
(),
&
testContractAddr
,
0
,
new
(
big
.
Int
),
big
.
NewInt
(
1000000
),
new
(
big
.
Int
),
data
)}
msg
:=
callmsg
{
types
.
NewMessage
(
from
.
Address
(),
&
testContractAddr
,
0
,
new
(
big
.
Int
),
big
.
NewInt
(
1000000
),
new
(
big
.
Int
),
data
,
false
)}
vmenv
:=
core
.
NewEnv
(
statedb
,
testChainConfig
(),
bc
,
msg
,
header
,
vm
.
Config
{})
gp
:=
new
(
core
.
GasPool
)
.
AddGas
(
common
.
MaxBig
)
ret
,
_
,
_
:=
core
.
ApplyMessage
(
vmenv
,
msg
,
gp
)
...
...
@@ -180,7 +180,7 @@ func odrContractCall(ctx context.Context, db ethdb.Database, bc *core.BlockChain
if
err
==
nil
{
from
.
SetBalance
(
common
.
MaxBig
)
msg
:=
callmsg
{
types
.
NewMessage
(
from
.
Address
(),
&
testContractAddr
,
0
,
new
(
big
.
Int
),
big
.
NewInt
(
1000000
),
new
(
big
.
Int
),
data
)}
msg
:=
callmsg
{
types
.
NewMessage
(
from
.
Address
(),
&
testContractAddr
,
0
,
new
(
big
.
Int
),
big
.
NewInt
(
1000000
),
new
(
big
.
Int
),
data
,
false
)}
vmenv
:=
NewEnv
(
ctx
,
state
,
testChainConfig
(),
lc
,
msg
,
header
,
vm
.
Config
{})
gp
:=
new
(
core
.
GasPool
)
.
AddGas
(
common
.
MaxBig
)
ret
,
_
,
_
:=
core
.
ApplyMessage
(
vmenv
,
msg
,
gp
)
...
...
tests/state_test_util.go
View file @
b10bcd92
...
...
@@ -226,7 +226,7 @@ func RunState(chainConfig *params.ChainConfig, statedb *state.StateDB, env, tx m
key
,
_
:=
hex
.
DecodeString
(
tx
[
"secretKey"
])
addr
:=
crypto
.
PubkeyToAddress
(
crypto
.
ToECDSA
(
key
)
.
PublicKey
)
message
:=
types
.
NewMessage
(
addr
,
to
,
nonce
,
value
,
gas
,
price
,
data
)
message
:=
types
.
NewMessage
(
addr
,
to
,
nonce
,
value
,
gas
,
price
,
data
,
true
)
vmenv
:=
NewEnvFromMap
(
chainConfig
,
statedb
,
env
,
tx
)
vmenv
.
origin
=
addr
...
...
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