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
6c9e503e
Commit
6c9e503e
authored
Nov 11, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed all implicit logging. Fixed gas issues and jump errors
parent
75ee3b3f
Changes
24
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
3871 additions
and
225 deletions
+3871
-225
chain_manager.go
chain/chain_manager.go
+1
-1
state_transition.go
chain/state_transition.go
+4
-5
vm_env.go
chain/vm_env.go
+1
-1
main.go
cmd/evm/main.go
+3
-2
main.go
cmd/mist/main.go
+1
-1
vm_env.go
cmd/utils/vm_env.go
+1
-1
peer.go
peer.go
+1
-1
log.go
state/log.go
+5
-5
state.go
state/state.go
+1
-1
genesishashestest.json
tests/files/BasicTests/genesishashestest.json
+3
-3
stExample.json
tests/files/StateTests/stExample.json
+3
-3
stPreCompiledContracts.json
tests/files/StateTests/stPreCompiledContracts.json
+1408
-0
stSystemOperationsTest.json
tests/files/StateTests/stSystemOperationsTest.json
+2330
-0
vmArithmeticTest.json
tests/files/VMTests/vmArithmeticTest.json
+35
-28
vmIOandFlowOperationsTest.json
tests/files/VMTests/vmIOandFlowOperationsTest.json
+45
-3
vmNamecoin.json
tests/files/VMTests/vmNamecoin.json
+0
-55
vmPushDupSwapTest.json
tests/files/VMTests/vmPushDupSwapTest.json
+2
-2
index.js
tests/files/index.js
+21
-20
201410211705.json
tests/files/randomTests/201410211705.json
+0
-45
201410211708.json
tests/files/randomTests/201410211708.json
+0
-44
gh_test.go
tests/vm/gh_test.go
+1
-1
environment.go
vm/environment.go
+1
-1
vm_debug.go
vm/vm_debug.go
+3
-1
vm_env.go
xeth/vm_env.go
+1
-1
No files found.
chain/chain_manager.go
View file @
6c9e503e
...
...
@@ -328,8 +328,8 @@ func (self *ChainManager) InsertChain(chain *BlockChain) {
for
e
:=
chain
.
Front
();
e
!=
nil
;
e
=
e
.
Next
()
{
link
:=
e
.
Value
.
(
*
link
)
self
.
SetTotalDifficulty
(
link
.
td
)
self
.
add
(
link
.
block
)
self
.
SetTotalDifficulty
(
link
.
td
)
self
.
Ethereum
.
EventMux
()
.
Post
(
NewBlockEvent
{
link
.
block
})
self
.
Ethereum
.
EventMux
()
.
Post
(
link
.
messages
)
}
...
...
chain/state_transition.go
View file @
6c9e503e
...
...
@@ -4,7 +4,6 @@ import (
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
)
...
...
@@ -229,13 +228,13 @@ func (self *StateTransition) TransitionState() (err error) {
}
msg
.
Output
=
ret
}
else
{
// Add default LOG. Default = big(sender.addr) + 1
addr
:=
ethutil
.
BigD
(
receiver
.
Address
())
self
.
state
.
AddLog
(
state
.
Log
{
sender
.
Address
(),
[][]
byte
{
ethutil
.
U256
(
addr
.
Add
(
addr
,
ethutil
.
Big1
))
.
Bytes
()},
nil
})
}
}
// Add default LOG. Default = big(sender.addr) + 1
//addr := ethutil.BigD(receiver.Address())
//self.state.AddLog(&state.Log{ethutil.U256(addr.Add(addr, ethutil.Big1)).Bytes(), [][]byte{sender.Address()}, nil})
return
}
...
...
chain/vm_env.go
View file @
6c9e503e
...
...
@@ -31,7 +31,7 @@ func (self *VMEnv) BlockHash() []byte { return self.block.Hash() }
func
(
self
*
VMEnv
)
Value
()
*
big
.
Int
{
return
self
.
tx
.
Value
}
func
(
self
*
VMEnv
)
State
()
*
state
.
State
{
return
self
.
state
}
func
(
self
*
VMEnv
)
GasLimit
()
*
big
.
Int
{
return
self
.
block
.
GasLimit
}
func
(
self
*
VMEnv
)
AddLog
(
log
state
.
Log
)
{
func
(
self
*
VMEnv
)
AddLog
(
log
*
state
.
Log
)
{
self
.
state
.
AddLog
(
log
)
}
func
(
self
*
VMEnv
)
Transfer
(
from
,
to
vm
.
Account
,
amount
*
big
.
Int
)
error
{
...
...
cmd/evm/main.go
View file @
6c9e503e
...
...
@@ -46,6 +46,7 @@ var (
gas
=
flag
.
String
(
"gas"
,
"1000000"
,
"gas amount"
)
price
=
flag
.
String
(
"price"
,
"0"
,
"gas price"
)
dump
=
flag
.
Bool
(
"dump"
,
false
,
"dump state after run"
)
data
=
flag
.
String
(
"data"
,
""
,
"data"
)
)
func
perr
(
v
...
interface
{})
{
...
...
@@ -66,7 +67,7 @@ func main() {
tstart
:=
time
.
Now
()
env
:=
NewVmEnv
()
ret
,
_
,
e
:=
closure
.
Call
(
vm
.
New
(
env
,
vm
.
DebugVmTy
),
nil
)
ret
,
_
,
e
:=
closure
.
Call
(
vm
.
New
(
env
,
vm
.
DebugVmTy
),
ethutil
.
Hex2Bytes
(
*
data
)
)
logger
.
Flush
()
if
e
!=
nil
{
...
...
@@ -110,7 +111,7 @@ func (VmEnv) GasLimit() *big.Int { return nil }
func
(
VmEnv
)
Difficulty
()
*
big
.
Int
{
return
nil
}
func
(
VmEnv
)
Value
()
*
big
.
Int
{
return
nil
}
func
(
self
*
VmEnv
)
State
()
*
state
.
State
{
return
self
.
state
}
func
(
VmEnv
)
AddLog
(
state
.
Log
)
{}
func
(
VmEnv
)
AddLog
(
*
state
.
Log
)
{}
func
(
VmEnv
)
Transfer
(
from
,
to
vm
.
Account
,
amount
*
big
.
Int
)
error
{
return
nil
}
cmd/mist/main.go
View file @
6c9e503e
...
...
@@ -29,7 +29,7 @@ import (
const
(
ClientIdentifier
=
"Mist"
Version
=
"0.7.
3
"
Version
=
"0.7.
4
"
)
var
ethereum
*
eth
.
Ethereum
...
...
cmd/utils/vm_env.go
View file @
6c9e503e
...
...
@@ -35,7 +35,7 @@ func (self *VMEnv) BlockHash() []byte { return self.block.Hash() }
func
(
self
*
VMEnv
)
Value
()
*
big
.
Int
{
return
self
.
value
}
func
(
self
*
VMEnv
)
State
()
*
state
.
State
{
return
self
.
state
}
func
(
self
*
VMEnv
)
GasLimit
()
*
big
.
Int
{
return
self
.
block
.
GasLimit
}
func
(
self
*
VMEnv
)
AddLog
(
state
.
Log
)
{}
func
(
self
*
VMEnv
)
AddLog
(
*
state
.
Log
)
{}
func
(
self
*
VMEnv
)
Transfer
(
from
,
to
vm
.
Account
,
amount
*
big
.
Int
)
error
{
return
vm
.
Transfer
(
from
,
to
,
amount
)
}
peer.go
View file @
6c9e503e
...
...
@@ -24,7 +24,7 @@ const (
// The size of the output buffer for writing messages
outputBufferSize
=
50
// Current protocol version
ProtocolVersion
=
39
ProtocolVersion
=
40
// Current P2P version
P2PVersion
=
2
// Ethereum network version
...
...
state/log.go
View file @
6c9e503e
...
...
@@ -13,8 +13,8 @@ type Log struct {
Data
[]
byte
}
func
NewLogFromValue
(
decoder
*
ethutil
.
Value
)
Log
{
log
:=
Log
{
func
NewLogFromValue
(
decoder
*
ethutil
.
Value
)
*
Log
{
log
:=
&
Log
{
Address
:
decoder
.
Get
(
0
)
.
Bytes
(),
Data
:
decoder
.
Get
(
2
)
.
Bytes
(),
}
...
...
@@ -27,15 +27,15 @@ func NewLogFromValue(decoder *ethutil.Value) Log {
return
log
}
func
(
self
Log
)
RlpData
()
interface
{}
{
func
(
self
*
Log
)
RlpData
()
interface
{}
{
return
[]
interface
{}{
self
.
Address
,
ethutil
.
ByteSliceToInterface
(
self
.
Topics
),
self
.
Data
}
}
func
(
self
Log
)
String
()
string
{
func
(
self
*
Log
)
String
()
string
{
return
fmt
.
Sprintf
(
`log: %x %x %x`
,
self
.
Address
,
self
.
Topics
,
self
.
Data
)
}
type
Logs
[]
Log
type
Logs
[]
*
Log
func
(
self
Logs
)
RlpData
()
interface
{}
{
data
:=
make
([]
interface
{},
len
(
self
))
...
...
state/state.go
View file @
6c9e503e
...
...
@@ -37,7 +37,7 @@ func (self *State) EmptyLogs() {
self
.
logs
=
nil
}
func
(
self
*
State
)
AddLog
(
log
Log
)
{
func
(
self
*
State
)
AddLog
(
log
*
Log
)
{
self
.
logs
=
append
(
self
.
logs
,
log
)
}
...
...
tests/files/BasicTests/genesishashestest.json
View file @
6c9e503e
{
"genesis_rlp_hex"
:
"f
8abf8a7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a008bf6a98374f333b84e7d063d607696ac7cbbd409bd20fbe6a741c2dfc0eb2858
0830200008080830f4240808080a004994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829c0c0"
,
"genesis_state_root"
:
"
08bf6a98374f333b84e7d063d607696ac7cbbd409bd20fbe6a741c2dfc0eb285
"
,
"genesis_rlp_hex"
:
"f
9012ff9012aa00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0c67c70f5d7d3049337d1dcc0503a249881120019a8e7322774dbfe57b463718ca056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b8400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0830200008080830f4240808080a004994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829c0c0"
,
"genesis_state_root"
:
"
c67c70f5d7d3049337d1dcc0503a249881120019a8e7322774dbfe57b463718c
"
,
"initial_alloc"
:
{
"51ba59315b3a95761d0863b05ccc7a7f54703d99"
:
"1606938044258990275541962092341162602522202993782792835301376"
,
"e4157b34ea9615cfbde6b4fda419828124b70c78"
:
"1606938044258990275541962092341162602522202993782792835301376"
,
...
...
@@ -11,5 +11,5 @@
"e6716f9544a56c530d868e4bfbacb172315bdead"
:
"1606938044258990275541962092341162602522202993782792835301376"
,
"1a26338f0d905e295fccb71fa9ea849ffa12aaf4"
:
"1606938044258990275541962092341162602522202993782792835301376"
},
"genesis_hash"
:
"
f68067286ddb7245c2203b18135456de1fc4ed6a24a2d9014195faa7900025bf
"
"genesis_hash"
:
"
955f36d073ccb026b78ab3424c15cf966a7563aa270413859f78702b9e8e22cb
"
}
tests/files/StateTests/stExample.json
View file @
6c9e503e
...
...
@@ -37,14 +37,14 @@
"095e7baea6a6c7c4c2dfeb977efac326af552d87"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x6001600101600055"
,
"nonce"
:
0
,
"nonce"
:
"0"
,
"storage"
:
{
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
""
,
"nonce"
:
0
,
"code"
:
"
0x
"
,
"nonce"
:
"0"
,
"storage"
:
{
}
}
...
...
tests/files/StateTests/stPreCompiledContracts.json
0 → 100644
View file @
6c9e503e
This diff is collapsed.
Click to expand it.
tests/files/StateTests/stSystemOperationsTest.json
0 → 100644
View file @
6c9e503e
This diff is collapsed.
Click to expand it.
tests/files/VMTests/vmArithmeticTest.json
View file @
6c9e503e
...
...
@@ -2142,28 +2142,29 @@
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x62126af46050
16600057
"
,
"code"
:
"0x62126af46050
0b600055
"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"
0
"
,
"gas"
:
"
9696
"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x62126af46050
16600057
"
,
"code"
:
"0x62126af46050
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
"0x"
:
"0x126af4"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x62126af46050
16600057
"
,
"code"
:
"0x62126af46050
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
}
...
...
@@ -2355,28 +2356,29 @@
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x60ff68f00000000000000001
16600057
"
,
"code"
:
"0x60ff68f00000000000000001
0b600055
"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"
0
"
,
"gas"
:
"
9696
"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x60ff68f00000000000000001
16600057
"
,
"code"
:
"0x60ff68f00000000000000001
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
"0x"
:
"0xff"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x60ff68f00000000000000001
16600057
"
,
"code"
:
"0x60ff68f00000000000000001
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
}
...
...
@@ -2439,28 +2441,29 @@
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x62122f6a6000
16600057
"
,
"code"
:
"0x62122f6a6000
0b600055
"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"9
995
"
,
"gas"
:
"9
696
"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x62122f6a6000
16600057
"
,
"code"
:
"0x62122f6a6000
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
"0x"
:
"0x6a"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x62122f6a6000
16600057
"
,
"code"
:
"0x62122f6a6000
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
}
...
...
@@ -2481,28 +2484,29 @@
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x62126af46001
16600057
"
,
"code"
:
"0x62126af46001
0b600055
"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"9
995
"
,
"gas"
:
"9
696
"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x62126af46001
16600057
"
,
"code"
:
"0x62126af46001
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
"0x"
:
"0x6af4"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x62126af46001
16600057
"
,
"code"
:
"0x62126af46001
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
}
...
...
@@ -2523,28 +2527,29 @@
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x6212faf46001
16600057
"
,
"code"
:
"0x6212faf46001
0b600055
"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"9
995
"
,
"gas"
:
"9
696
"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x6212faf46001
16600057
"
,
"code"
:
"0x6212faf46001
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
"0x"
:
"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf4"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x6212faf46001
16600057
"
,
"code"
:
"0x6212faf46001
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
}
...
...
@@ -2565,28 +2570,29 @@
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x66f000000000000161ffff
16600057
"
,
"code"
:
"0x66f000000000000161ffff
0b600055
"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"
0
"
,
"gas"
:
"
9696
"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x66f000000000000161ffff
16600057
"
,
"code"
:
"0x66f000000000000161ffff
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
"0x"
:
"0xf0000000000001"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x66f000000000000161ffff
16600057
"
,
"code"
:
"0x66f000000000000161ffff
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
}
...
...
@@ -2607,28 +2613,29 @@
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x62122ff46000
16600057
"
,
"code"
:
"0x62122ff46000
0b600055
"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"9
995
"
,
"gas"
:
"9
696
"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x62122ff46000
16600057
"
,
"code"
:
"0x62122ff46000
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
"0x"
:
"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff4"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x62122ff46000
16600057
"
,
"code"
:
"0x62122ff46000
0b600055
"
,
"nonce"
:
"0"
,
"storage"
:
{
}
...
...
tests/files/VMTests/vmIOandFlowOperationsTest.json
View file @
6c9e503e
...
...
@@ -363,7 +363,7 @@
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"
9995
"
,
"gas"
:
"
0
"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
...
...
@@ -384,6 +384,48 @@
}
}
},
"jump1"
:
{
"callcreates"
:
[
],
"env"
:
{
"currentCoinbase"
:
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
,
"currentDifficulty"
:
"256"
,
"currentGasLimit"
:
"1000000"
,
"currentNumber"
:
"0"
,
"currentTimestamp"
:
"1"
,
"previousHash"
:
"5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x620fffff620fffff0156"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"0"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x620fffff620fffff0156"
,
"nonce"
:
"0"
,
"storage"
:
{
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x620fffff620fffff0156"
,
"nonce"
:
"0"
,
"storage"
:
{
}
}
}
},
"jumpi0"
:
{
"callcreates"
:
[
],
...
...
@@ -1301,7 +1343,7 @@
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"
1000
0"
,
"gas"
:
"0"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
...
...
@@ -1479,7 +1521,7 @@
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"
9995
"
,
"gas"
:
"
0
"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
...
...
tests/files/VMTests/vmNamecoin.json
deleted
100644 → 0
View file @
75ee3b3f
{
"namecoin"
:
{
"pre"
:
{
"82a978b3f5962a5b0957d9ee9eef472ee55b42f1"
:
{
"nonce"
:
"1"
,
"balance"
:
"2500000000000000000"
,
"storage"
:
{},
"code"
:
"0x"
},
"c305c901078781c232a2a521c2af7980f8385ee9"
:
{
"nonce"
:
"0"
,
"balance"
:
"0"
,
"storage"
:
{},
"code"
:
"0x600035560f0f601d5960203560003557600160005460206000f2602758600060205460206020f2"
}
},
"exec"
:
{
"origin"
:
"82a978b3f5962a5b0957d9ee9eef472ee55b42f1"
,
"code"
:
"0x600035560f0f601d5960203560003557600160005460206000f2602758600060205460206020f2"
,
"value"
:
"0"
,
"address"
:
"c305c901078781c232a2a521c2af7980f8385ee9"
,
"gas"
:
"10000"
,
"caller"
:
"82a978b3f5962a5b0957d9ee9eef472ee55b42f1"
,
"data"
:
"0x000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000004e"
,
"gasPrice"
:
"1000000000000"
},
"callcreates"
:
[],
"gas"
:
"9663"
,
"env"
:
{
"currentTimestamp"
:
"1405282164"
,
"currentGasLimit"
:
"999023"
,
"previousHash"
:
"112a6e7995fcb66376f44e52f011c38d328a9ed3a1dac6eebb1376fccd055fad"
,
"currentCoinbase"
:
"82a978b3f5962a5b0957d9ee9eef472ee55b42f1"
,
"currentDifficulty"
:
"4190208"
,
"currentNumber"
:
"1"
},
"post"
:
{
"82a978b3f5962a5b0957d9ee9eef472ee55b42f1"
:
{
"nonce"
:
"1"
,
"balance"
:
"2500000000000000000"
,
"storage"
:
{},
"code"
:
"0x"
},
"c305c901078781c232a2a521c2af7980f8385ee9"
:
{
"nonce"
:
"0"
,
"balance"
:
"0"
,
"storage"
:
{
"0x2d"
:
"0x4e"
},
"code"
:
"0x600035560f0f601d5960203560003557600160005460206000f2602758600060205460206020f2"
}
},
"out"
:
"0x0000000000000000000000000000000000000000000000000000000000000001"
}
}
tests/files/VMTests/vmPushDupSwapTest.json
View file @
6c9e503e
...
...
@@ -407,7 +407,7 @@
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"
9999
"
,
"gas"
:
"
0
"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
...
...
@@ -2597,7 +2597,7 @@
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"
9998
"
,
"gas"
:
"
0
"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
...
...
tests/files/index.js
View file @
6c9e503e
module
.
exports
=
{
blockgenesis
:
require
(
'./blockgenesistest'
),
genesishashes
:
require
(
'./genesishashestest'
),
hexencode
:
require
(
'./hexencodetest'
),
keyaddrtests
:
require
(
'./keyaddrtest'
),
namecoin
:
require
(
'./namecoin'
),
rlptest
:
require
(
'./rlptest'
),
trietest
:
require
(
'./trietest'
),
trietestnextprev
:
require
(
'./trietestnextprev'
),
txtest
:
require
(
'./txtest'
),
vmtests
:
{
random
:
require
(
'./vmtests/random'
),
vmArithmeticTest
:
require
(
'./vmtests/vmArithmeticTest'
),
vmBitwiseLogicOperationTest
:
require
(
'./vmtests/vmBitwiseLogicOperationTest'
),
vmBlockInfoTest
:
require
(
'./vmtests/vmBlockInfoTest'
),
vmEnvironmentalInfoTest
:
require
(
'./vmtests/vmEnvironmentalInfoTest'
),
vmIOandFlowOperationsTest
:
require
(
'./vmtests/vmIOandFlowOperationsTest'
),
vmPushDupSwapTest
:
require
(
'./vmtests/vmPushDupSwapTest'
),
vmSha3Test
:
require
(
'./vmtests/vmSha3Test'
),
vmSystemOperationsTest
:
require
(
'./vmtests/vmSystemOperationsTest'
),
vmtests
:
require
(
'./vmtests/vmtests'
)
blockgenesis
:
require
(
'./BasicTests/blockgenesistest'
),
genesishashes
:
require
(
'./BasicTests/genesishashestest'
),
hexencode
:
require
(
'./BasicTests/hexencodetest'
),
keyaddrtests
:
require
(
'./BasicTests/keyaddrtest'
),
rlptest
:
require
(
'./BasicTests/rlptest'
),
trietest
:
require
(
'./TrieTests/trietest'
),
trietestnextprev
:
require
(
'./TrieTests/trietestnextprev'
),
txtest
:
require
(
'./BasicTests/txtest'
),
StateTests
:
{
stPreCompiledContracts
:
require
(
'./StateTests/stPreCompiledContracts'
),
stSystemOperationsTest
:
require
(
'./StateTests/stSystemOperationsTest'
),
},
VMTests
:
{
vmArithmeticTest
:
require
(
'./VMTests/vmArithmeticTest'
),
vmBitwiseLogicOperationTest
:
require
(
'./VMTests/vmBitwiseLogicOperationTest'
),
vmBlockInfoTest
:
require
(
'./VMTests/vmBlockInfoTest'
),
vmEnvironmentalInfoTest
:
require
(
'./VMTests/vmEnvironmentalInfoTest'
),
vmIOandFlowOperationsTest
:
require
(
'./VMTests/vmIOandFlowOperationsTest'
),
vmPushDupSwapTest
:
require
(
'./VMTests/vmPushDupSwapTest'
),
vmSha3Test
:
require
(
'./VMTests/vmSha3Test'
),
vmtestst
:
require
(
'./VMTests/vmtests'
),
}
};
tests/files/randomTests/201410211705.json
deleted
100644 → 0
View file @
75ee3b3f
{
"randomVMtest"
:
{
"callcreates"
:
[
],
"env"
:
{
"currentCoinbase"
:
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
,
"currentDifficulty"
:
"256"
,
"currentGasLimit"
:
"1000000"
,
"currentNumber"
:
"0"
,
"currentTimestamp"
:
"1"
,
"previousHash"
:
"5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x33410c45815741f394"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"9794"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x33410c45815741f394"
,
"nonce"
:
"0"
,
"storage"
:
{
"0x01"
:
"0x0f4240"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x33410c45815741f394"
,
"nonce"
:
"0"
,
"storage"
:
{
}
}
}
}
}
tests/files/randomTests/201410211708.json
deleted
100644 → 0
View file @
75ee3b3f
{
"randomVMtest"
:
{
"callcreates"
:
[
],
"env"
:
{
"currentCoinbase"
:
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
,
"currentDifficulty"
:
"256"
,
"currentGasLimit"
:
"1000000"
,
"currentNumber"
:
"0"
,
"currentTimestamp"
:
"1"
,
"previousHash"
:
"5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x7d"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"9999"
,
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x7d"
,
"nonce"
:
"0"
,
"storage"
:
{
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x7d"
,
"nonce"
:
"0"
,
"storage"
:
{
}
}
}
}
}
tests/vm/gh_test.go
View file @
6c9e503e
...
...
@@ -113,7 +113,7 @@ func TestEnvironmentalInfo(t *testing.T) {
}
func
TestFlowOperation
(
t
*
testing
.
T
)
{
//
helper.Logger.SetLogLevel(5)
helper
.
Logger
.
SetLogLevel
(
5
)
const
fn
=
"../files/vmtests/vmIOandFlowOperationsTest.json"
RunVmTest
(
fn
,
t
)
}
...
...
vm/environment.go
View file @
6c9e503e
...
...
@@ -20,7 +20,7 @@ type Environment interface {
BlockHash
()
[]
byte
GasLimit
()
*
big
.
Int
Transfer
(
from
,
to
Account
,
amount
*
big
.
Int
)
error
AddLog
(
state
.
Log
)
AddLog
(
*
state
.
Log
)
}
type
Object
interface
{
...
...
vm/vm_debug.go
View file @
6c9e503e
...
...
@@ -47,6 +47,8 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
if
r
:=
recover
();
r
!=
nil
{
self
.
Endl
()
closure
.
UseGas
(
closure
.
Gas
)
ret
=
closure
.
Return
(
nil
)
err
=
fmt
.
Errorf
(
"%v"
,
r
)
...
...
@@ -735,7 +737,7 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
for
i
:=
0
;
i
<
n
;
i
++
{
topics
[
i
]
=
stack
.
Pop
()
.
Bytes
()
}
self
.
env
.
AddLog
(
state
.
Log
{
closure
.
Address
(),
topics
,
data
})
self
.
env
.
AddLog
(
&
state
.
Log
{
closure
.
Address
(),
topics
,
data
})
case
MLOAD
:
offset
:=
stack
.
Pop
()
val
:=
ethutil
.
BigD
(
mem
.
Get
(
offset
.
Int64
(),
32
))
...
...
xeth/vm_env.go
View file @
6c9e503e
...
...
@@ -34,7 +34,7 @@ func (self *VMEnv) BlockHash() []byte { return self.block.Hash() }
func
(
self
*
VMEnv
)
Value
()
*
big
.
Int
{
return
self
.
value
}
func
(
self
*
VMEnv
)
State
()
*
state
.
State
{
return
self
.
state
}
func
(
self
*
VMEnv
)
GasLimit
()
*
big
.
Int
{
return
self
.
block
.
GasLimit
}
func
(
self
*
VMEnv
)
AddLog
(
state
.
Log
)
{}
func
(
self
*
VMEnv
)
AddLog
(
*
state
.
Log
)
{}
func
(
self
*
VMEnv
)
Transfer
(
from
,
to
vm
.
Account
,
amount
*
big
.
Int
)
error
{
return
vm
.
Transfer
(
from
,
to
,
amount
)
}
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