Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
exchain
nebula
Commits
808fc18a
Commit
808fc18a
authored
Oct 27, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add unicorn minigeth test
parent
fed882d2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
6 deletions
+14
-6
compare_evmchain_test.go
mipsevm/compare_evmchain_test.go
+1
-1
compare_unievm_test.go
mipsevm/compare_unievm_test.go
+1
-1
main.go
mipsevm/main.go
+1
-1
run_unicorn_minigeth_test.go
mipsevm/run_unicorn_minigeth_test.go
+10
-0
unicorn.go
mipsevm/unicorn.go
+1
-3
No files found.
mipsevm/compare_evmchain_test.go
View file @
808fc18a
...
...
@@ -26,7 +26,7 @@ func LoadRam() map[uint32](uint32) {
// go test -run TestCompareUnicornChain
func
TestCompare
Unicorn
Chain
(
t
*
testing
.
T
)
{
func
TestCompare
Evm
Chain
(
t
*
testing
.
T
)
{
totalSteps
:=
20
cchain
:=
make
(
chan
common
.
Hash
,
1
)
...
...
mipsevm/compare_unievm_test.go
View file @
808fc18a
...
...
@@ -49,7 +49,7 @@ func TestCompareUnicornEvm(t *testing.T) {
})
uniram
:=
make
(
map
[
uint32
](
uint32
))
go
RunUnicorn
(
fn
,
uniram
,
steps
,
func
(
step
int
,
mu
uc
.
Unicorn
,
ram
map
[
uint32
](
uint32
))
{
go
RunUnicorn
(
fn
,
uniram
,
steps
,
true
,
func
(
step
int
,
mu
uc
.
Unicorn
,
ram
map
[
uint32
](
uint32
))
{
SyncRegs
(
mu
,
ram
)
cuni
<-
RegSerialize
(
ram
)
done
.
Lock
()
...
...
mipsevm/main.go
View file @
808fc18a
...
...
@@ -66,7 +66,7 @@ func main() {
RunMinigeth
(
os
.
Args
[
1
],
steps
,
debug
)
}
else
if
os
.
Args
[
1
]
==
"unicorn"
{
uniram
:=
make
(
map
[
uint32
](
uint32
))
RunUnicorn
(
os
.
Args
[
2
],
uniram
,
steps
,
nil
)
RunUnicorn
(
os
.
Args
[
2
],
uniram
,
steps
,
false
,
nil
)
}
else
{
runTest
(
os
.
Args
[
1
],
20
,
2
)
}
...
...
mipsevm/run_unicorn_minigeth_test.go
0 → 100644
View file @
808fc18a
package
main
import
(
"testing"
)
func
TestMinigethUnicorn
(
t
*
testing
.
T
)
{
uniram
:=
make
(
map
[
uint32
](
uint32
))
RunUnicorn
(
"../mipigo/minigeth.bin"
,
uniram
,
-
1
,
false
,
nil
)
}
mipsevm/unicorn.go
View file @
808fc18a
...
...
@@ -70,7 +70,7 @@ func SyncRegs(mu uc.Unicorn, ram map[uint32](uint32)) {
}
// reimplement simple.py in go
func
RunUnicorn
(
fn
string
,
ram
map
[
uint32
](
uint32
),
totalSteps
int
,
callback
func
(
int
,
uc
.
Unicorn
,
map
[
uint32
](
uint32
)))
{
func
RunUnicorn
(
fn
string
,
ram
map
[
uint32
](
uint32
),
totalSteps
int
,
slowMode
bool
,
callback
func
(
int
,
uc
.
Unicorn
,
map
[
uint32
](
uint32
)))
{
mu
,
err
:=
uc
.
NewUnicorn
(
uc
.
ARCH_MIPS
,
uc
.
MODE_32
|
uc
.
MODE_BIG_ENDIAN
)
check
(
err
)
...
...
@@ -125,8 +125,6 @@ func RunUnicorn(fn string, ram map[uint32](uint32), totalSteps int, callback fun
mu
.
RegWrite
(
uc
.
MIPS_REG_A3
,
0
)
},
0
,
0
)
slowMode
:=
true
if
slowMode
{
mu
.
HookAdd
(
uc
.
HOOK_MEM_WRITE
,
func
(
mu
uc
.
Unicorn
,
access
int
,
addr64
uint64
,
size
int
,
value
int64
)
{
rt
:=
value
...
...
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