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
b91851e0
Commit
b91851e0
authored
Oct 12, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't delete from ram trie
parent
71c33ceb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
15 deletions
+19
-15
compare_test.go
mipsevm/compare_test.go
+11
-7
mipsevm.go
mipsevm/mipsevm.go
+1
-5
unicorn.go
mipsevm/unicorn.go
+7
-3
No files found.
mipsevm/compare_test.go
View file @
b91851e0
...
@@ -32,12 +32,16 @@ func TestCompare(t *testing.T) {
...
@@ -32,12 +32,16 @@ func TestCompare(t *testing.T) {
cevm
:=
make
(
chan
[]
uint32
,
1
)
cevm
:=
make
(
chan
[]
uint32
,
1
)
cuni
:=
make
(
chan
[]
uint32
,
1
)
cuni
:=
make
(
chan
[]
uint32
,
1
)
ram
:=
make
(
map
[
uint32
](
uint32
))
evm
ram
:=
make
(
map
[
uint32
](
uint32
))
LoadMappedFile
(
fn
,
ram
,
0
)
LoadMappedFile
(
fn
,
evm
ram
,
0
)
inputFile
:=
fmt
.
Sprintf
(
"/tmp/eth/%d"
,
13284469
)
inputFile
:=
fmt
.
Sprintf
(
"/tmp/eth/%d"
,
13284469
)
LoadMappedFile
(
inputFile
,
ram
,
0xB0000000
)
LoadMappedFile
(
inputFile
,
evmram
,
0xB0000000
)
// init registers to 0 in evm
for
i
:=
uint32
(
0xC0000000
);
i
<
0xC0000000
+
36
*
4
;
i
+=
4
{
WriteRam
(
evmram
,
i
,
0
)
}
go
RunWithRam
(
ram
,
steps
,
0
,
func
(
step
int
,
ram
map
[
uint32
](
uint32
))
{
go
RunWithRam
(
evm
ram
,
steps
,
0
,
func
(
step
int
,
ram
map
[
uint32
](
uint32
))
{
//fmt.Printf("%d evm %x\n", step, ram[0xc0000080])
//fmt.Printf("%d evm %x\n", step, ram[0xc0000080])
cevm
<-
RegSerialize
(
ram
)
cevm
<-
RegSerialize
(
ram
)
done
.
Lock
()
done
.
Lock
()
...
@@ -76,9 +80,9 @@ func TestCompare(t *testing.T) {
...
@@ -76,9 +80,9 @@ func TestCompare(t *testing.T) {
// final ram check
// final ram check
done
.
Lock
()
done
.
Lock
()
time
.
Sleep
(
100
*
time
.
Millisecond
)
time
.
Sleep
(
100
*
time
.
Millisecond
)
for
k
,
v
:=
range
ram
{
for
k
,
v
:=
range
uni
ram
{
if
uniram
[
k
]
!=
v
{
if
val
,
ok
:=
evmram
[
k
];
!
ok
||
val
!=
v
{
fmt
.
Printf
(
"ram mismatch at %x, evm %x != uni %x
\n
"
,
k
,
v
,
uniram
[
k
])
fmt
.
Printf
(
"ram mismatch at %x, evm %x != uni %x
\n
"
,
k
,
evmram
[
k
]
,
uniram
[
k
])
mismatch
=
true
mismatch
=
true
}
}
}
}
...
...
mipsevm/mipsevm.go
View file @
b91851e0
...
@@ -145,11 +145,7 @@ func (s *StateDB) SetState(fakeaddr common.Address, key, value common.Hash) {
...
@@ -145,11 +145,7 @@ func (s *StateDB) SetState(fakeaddr common.Address, key, value common.Hash) {
fmt
.
Println
(
"HOOKED WRITE! "
,
fmt
.
Sprintf
(
"%x = %x (at step %d)"
,
addr
,
dat
,
pcCount
))
fmt
.
Println
(
"HOOKED WRITE! "
,
fmt
.
Sprintf
(
"%x = %x (at step %d)"
,
addr
,
dat
,
pcCount
))
}
}
if
dat
==
0
{
WriteRam
(
ram
,
addr
,
dat
)
delete
(
ram
,
addr
)
}
else
{
ram
[
addr
]
=
dat
}
}
}
func
(
s
*
StateDB
)
SlotInAccessList
(
addr
common
.
Address
,
slot
common
.
Hash
)
(
addressPresent
bool
,
slotPresent
bool
)
{
func
(
s
*
StateDB
)
SlotInAccessList
(
addr
common
.
Address
,
slot
common
.
Hash
)
(
addressPresent
bool
,
slotPresent
bool
)
{
return
true
,
true
return
true
,
true
...
...
mipsevm/unicorn.go
View file @
b91851e0
...
@@ -33,10 +33,14 @@ func WriteBytes(fd int, bytes []byte) {
...
@@ -33,10 +33,14 @@ func WriteBytes(fd int, bytes []byte) {
}
}
func
WriteRam
(
ram
map
[
uint32
](
uint32
),
addr
uint32
,
value
uint32
)
{
func
WriteRam
(
ram
map
[
uint32
](
uint32
),
addr
uint32
,
value
uint32
)
{
if
value
!=
0
{
// we no longer delete from ram, since deleting from tries is hard
ram
[
addr
]
=
value
if
value
==
0
&&
false
{
}
else
{
delete
(
ram
,
addr
)
delete
(
ram
,
addr
)
}
else
{
/*if addr < 0xc0000000 {
fmt.Printf("store %x = %x\n", addr, value)
}*/
ram
[
addr
]
=
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