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
8a1b51c7
Commit
8a1b51c7
authored
Jan 12, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated tests
parent
75cd9cd2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
317 additions
and
18 deletions
+317
-18
201501121323MULMOD_GO.json
tests/files/VMTests/RandomTests/201501121323MULMOD_GO.json
+54
-0
201501121328MULMOD_GO.json
tests/files/VMTests/RandomTests/201501121328MULMOD_GO.json
+47
-0
201501121329MULMODGO.json
tests/files/VMTests/RandomTests/201501121329MULMODGO.json
+47
-0
201501121402CALL_GO.json
tests/files/VMTests/RandomTests/201501121402CALL_GO.json
+53
-0
201501121408ADDMOD_GO.json
tests/files/VMTests/RandomTests/201501121408ADDMOD_GO.json
+47
-0
201501121416ADDMOD_GO.json
tests/files/VMTests/RandomTests/201501121416ADDMOD_GO.json
+47
-0
vm_debug.go
vm/vm_debug.go
+22
-18
No files found.
tests/files/VMTests/RandomTests/201501121323MULMOD_GO.json
0 → 100644
View file @
8a1b51c7
{
"randomVMtest"
:
{
"callcreates"
:
[
],
"env"
:
{
"currentCoinbase"
:
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
,
"currentDifficulty"
:
"115792089237316195423570985008687907853269984665640564039457584007913129639935"
,
"currentGasLimit"
:
"1000000"
,
"currentNumber"
:
"0"
,
"currentTimestamp"
:
"2"
,
"previousHash"
:
"5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x414341424443850659a055450955"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"0"
,
"logs"
:
[
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"bloom"
:
"00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000"
,
"data"
:
"0x"
,
"topics"
:
[
]
}
],
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x414341424443850659a055450955"
,
"nonce"
:
"0"
,
"storage"
:
{
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
:
"0x02"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x414341424443850659a055450955"
,
"nonce"
:
"0"
,
"storage"
:
{
}
}
}
}
}
tests/files/VMTests/RandomTests/201501121328MULMOD_GO.json
0 → 100644
View file @
8a1b51c7
{
"randomVMtest"
:
{
"callcreates"
:
[
],
"env"
:
{
"currentCoinbase"
:
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
,
"currentDifficulty"
:
"115792089237316195423570985008687907853269984665640564039457584007913129639935"
,
"currentGasLimit"
:
"1000000"
,
"currentNumber"
:
"0"
,
"currentTimestamp"
:
"2"
,
"previousHash"
:
"5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x424341434541904255151409a29a9c55"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"0"
,
"logs"
:
[
],
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x424341434541904255151409a29a9c55"
,
"nonce"
:
"0"
,
"storage"
:
{
"0x02"
:
"0x0f4240"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x424341434541904255151409a29a9c55"
,
"nonce"
:
"0"
,
"storage"
:
{
}
}
}
}
}
tests/files/VMTests/RandomTests/201501121329MULMODGO.json
0 → 100644
View file @
8a1b51c7
{
"randomVMtest"
:
{
"callcreates"
:
[
],
"env"
:
{
"currentCoinbase"
:
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
,
"currentDifficulty"
:
"115792089237316195423570985008687907853269984665640564039457584007913129639935"
,
"currentGasLimit"
:
"1000000"
,
"currentNumber"
:
"0"
,
"currentTimestamp"
:
"2"
,
"previousHash"
:
"5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x444443424444554380330955"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"0"
,
"logs"
:
[
],
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x444443424444554380330955"
,
"nonce"
:
"0"
,
"storage"
:
{
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
:
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x444443424444554380330955"
,
"nonce"
:
"0"
,
"storage"
:
{
}
}
}
}
}
tests/files/VMTests/RandomTests/201501121402CALL_GO.json
0 → 100644
View file @
8a1b51c7
{
"randomVMtest"
:
{
"callcreates"
:
[
{
"data"
:
"0x0000"
,
"destination"
:
"0000000000000000000000000000000000000002"
,
"gasLimit"
:
"0"
,
"value"
:
"0"
}
],
"env"
:
{
"currentCoinbase"
:
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
,
"currentDifficulty"
:
"115792089237316195423570985008687907853269984665640564039457584007913129639935"
,
"currentGasLimit"
:
"1000000"
,
"currentNumber"
:
"0"
,
"currentTimestamp"
:
"2"
,
"previousHash"
:
"5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x4243434242434243f14555"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"9670"
,
"logs"
:
[
],
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x4243434242434243f14555"
,
"nonce"
:
"0"
,
"storage"
:
{
"0x0f4240"
:
"0x01"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x4243434242434243f14555"
,
"nonce"
:
"0"
,
"storage"
:
{
}
}
}
}
}
tests/files/VMTests/RandomTests/201501121408ADDMOD_GO.json
0 → 100644
View file @
8a1b51c7
{
"randomVMtest"
:
{
"callcreates"
:
[
],
"env"
:
{
"currentCoinbase"
:
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
,
"currentDifficulty"
:
"115792089237316195423570985008687907853269984665640564039457584007913129639935"
,
"currentGasLimit"
:
"1000000"
,
"currentNumber"
:
"0"
,
"currentTimestamp"
:
"2"
,
"previousHash"
:
"5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x4241455544414443385908069c9e8955"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"0"
,
"logs"
:
[
],
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x4241455544414443385908069c9e8955"
,
"nonce"
:
"0"
,
"storage"
:
{
"0x0f4240"
:
"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x4241455544414443385908069c9e8955"
,
"nonce"
:
"0"
,
"storage"
:
{
}
}
}
}
}
tests/files/VMTests/RandomTests/201501121416ADDMOD_GO.json
0 → 100644
View file @
8a1b51c7
{
"randomVMtest"
:
{
"callcreates"
:
[
],
"env"
:
{
"currentCoinbase"
:
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
,
"currentDifficulty"
:
"115792089237316195423570985008687907853269984665640564039457584007913129639935"
,
"currentGasLimit"
:
"1000000"
,
"currentNumber"
:
"0"
,
"currentTimestamp"
:
"2"
,
"previousHash"
:
"5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec"
:
{
"address"
:
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
,
"caller"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"code"
:
"0x4341434543454542559313088e55"
,
"data"
:
"0x"
,
"gas"
:
"10000"
,
"gasPrice"
:
"100000000000000"
,
"origin"
:
"cd1722f3947def4cf144679da39c4c32bdc35681"
,
"value"
:
"1000000000000000000"
},
"gas"
:
"0"
,
"logs"
:
[
],
"out"
:
"0x"
,
"post"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x4341434543454542559313088e55"
,
"nonce"
:
"0"
,
"storage"
:
{
"0x02"
:
"0x0f4240"
}
}
},
"pre"
:
{
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6"
:
{
"balance"
:
"1000000000000000000"
,
"code"
:
"0x4341434543454542559313088e55"
,
"nonce"
:
"0"
,
"storage"
:
{
}
}
}
}
}
vm/vm_debug.go
View file @
8a1b51c7
...
...
@@ -48,6 +48,12 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price *
})
context
:=
NewContext
(
caller
,
me
,
code
,
gas
,
price
)
vmlogger
.
Debugf
(
"(%d) (%x) %x (code=%d) gas: %v (d) %x
\n
"
,
self
.
env
.
Depth
(),
caller
.
Address
()[
:
4
],
context
.
Address
(),
len
(
code
),
context
.
Gas
,
callData
)
if
p
:=
Precompiled
[
string
(
me
.
Address
())];
p
!=
nil
{
return
self
.
RunPrecompiled
(
p
,
callData
,
context
)
}
if
self
.
Recoverable
{
// Recover from any require exception
defer
func
()
{
...
...
@@ -64,10 +70,6 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price *
}()
}
if
p
:=
Precompiled
[
string
(
me
.
Address
())];
p
!=
nil
{
return
self
.
RunPrecompiled
(
p
,
callData
,
context
)
}
var
(
op
OpCode
...
...
@@ -94,8 +96,6 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price *
}
)
vmlogger
.
Debugf
(
"(%d) (%x) %x (code=%d) gas: %v (d) %x
\n
"
,
self
.
env
.
Depth
(),
caller
.
Address
()[
:
4
],
context
.
Address
(),
len
(
code
),
context
.
Gas
,
callData
)
// Don't bother with the execution if there's no code.
if
len
(
code
)
==
0
{
return
context
.
Return
(
nil
),
nil
...
...
@@ -368,12 +368,14 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price *
y
:=
stack
.
Pop
()
z
:=
stack
.
Pop
()
base
.
Add
(
x
,
y
)
base
.
Mod
(
base
,
z
)
add
:=
new
(
big
.
Int
)
.
Add
(
x
,
y
)
if
len
(
z
.
Bytes
())
>
0
{
// NOT 0x0
base
.
Mod
(
add
,
z
)
U256
(
base
)
U256
(
base
)
}
self
.
Printf
(
"
= %v"
,
base
)
self
.
Printf
(
"
%v + %v %% %v = %v"
,
x
,
y
,
z
,
base
)
stack
.
Push
(
base
)
case
MULMOD
:
...
...
@@ -382,12 +384,14 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price *
y
:=
stack
.
Pop
()
z
:=
stack
.
Pop
()
base
.
Mul
(
x
,
y
)
base
.
Mod
(
base
,
z
)
mul
:=
new
(
big
.
Int
)
.
Mul
(
x
,
y
)
if
len
(
z
.
Bytes
())
>
0
{
// NOT 0x0
base
.
Mod
(
mul
,
z
)
U256
(
base
)
U256
(
base
)
}
self
.
Printf
(
"
= %v"
,
base
)
self
.
Printf
(
"
%v + %v %% %v = %v"
,
x
,
y
,
z
,
base
)
stack
.
Push
(
base
)
...
...
@@ -541,6 +545,8 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price *
self
.
Printf
(
" => 0x%x"
,
difficulty
.
Bytes
())
case
GASLIMIT
:
self
.
Printf
(
" => %v"
,
self
.
env
.
GasLimit
())
stack
.
Push
(
self
.
env
.
GasLimit
())
// 0x50 range
...
...
@@ -933,13 +939,11 @@ func (self *DebugVm) RunPrecompiled(p *PrecompiledAccount, callData []byte, cont
return
context
.
Return
(
ret
),
nil
}
else
{
self
.
Endl
()
self
.
Printf
(
"NATIVE_FUNC => failed"
)
.
Endl
()
tmp
:=
new
(
big
.
Int
)
.
Set
(
context
.
Gas
)
context
.
UseGas
(
context
.
Gas
)
return
context
.
Return
(
nil
),
OOG
(
gas
,
tmp
)
panic
(
OOG
(
gas
,
tmp
)
.
Error
())
}
}
...
...
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