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
5af95462
Commit
5af95462
authored
Dec 07, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oracle test works
parent
6a3f7ac9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
11 deletions
+41
-11
minievm.go
mipsevm/minievm.go
+6
-2
mips_evm_test.go
mipsevm/mips_evm_test.go
+1
-1
oracle.bin
mipsevm/test/bin/oracle.bin
+0
-0
oracle.asm
mipsevm/test/oracle.asm
+33
-8
0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad
...5a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad
+1
-0
No files found.
mipsevm/minievm.go
View file @
5af95462
...
...
@@ -127,11 +127,15 @@ func (s *StateDB) GetState(fakeaddr common.Address, hash common.Hash) common.Has
binary
.
BigEndian
.
PutUint32
(
oracle_hash
[
i
:
i
+
4
],
ram
[
0x30001000
+
i
])
}
hash
:=
common
.
BytesToHash
(
oracle_hash
)
if
s
.
root
==
""
{
log
.
Fatal
(
"need root if using
hash oracle"
)
log
.
Fatal
(
"need root if using
oracle for "
,
hash
)
}
key
:=
fmt
.
Sprintf
(
"%s/%s"
,
s
.
root
,
hash
)
value
,
_
:=
ioutil
.
ReadFile
(
key
)
value
,
err
:=
ioutil
.
ReadFile
(
key
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
WriteRam
(
ram
,
0x31000000
,
uint32
(
len
(
value
)))
value
=
append
(
value
,
0
,
0
,
0
)
...
...
mipsevm/mips_evm_test.go
View file @
5af95462
...
...
@@ -27,7 +27,7 @@ func TestSimpleEVM(t *testing.T) {
LoadMappedFile
(
fn
,
ram
,
0
)
start
:=
time
.
Now
()
remainingGas
,
err
:=
RunWithRam
(
ram
,
100
,
0
,
""
,
nil
)
remainingGas
,
err
:=
RunWithRam
(
ram
,
100
,
0
,
"
testoracle/
"
,
nil
)
elapsed
:=
time
.
Now
()
.
Sub
(
start
)
fmt
.
Println
(
err
,
remainingGas
,
elapsed
,
...
...
mipsevm/test/bin/oracle.bin
View file @
5af95462
No preview for this file type
mipsevm/test/oracle.asm
View file @
5af95462
...
...
@@ -5,21 +5,46 @@
.
ent
test
#
load
hash
at
0x30001000
#
0x47173285
a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa25
4cb01fad
=
"hello world"
#
0x47173285
a8d7341e
5
e972fc6
77286384
f802f8ef
42
a5ec5f
03
bbfa25
4
cb01fad
=
"hello world"
test
:
lui
$
s0
,
0x3000
ori
$
s0
,
0x1000
li
$
t0
,
0x4717
sh
$
t0
,
0
(
$
s0
)
li
$
t0
,
0x3285
sh
$
t0
,
1
(
$
s0
)
lui
$
t0
,
0x4717
ori
$
t0
,
0x3285
sw
$
t0
,
0
(
$
s0
)
lui
$
t0
,
0xa8d7
ori
$
t0
,
0x341e
sw
$
t0
,
4
(
$
s0
)
lui
$
t0
,
0x5e97
ori
$
t0
,
0x2fc6
sw
$
t0
,
8
(
$
s0
)
lui
$
t0
,
0x7728
ori
$
t0
,
0x6384
sw
$
t0
,
0xc
(
$
s0
)
lui
$
t0
,
0xf802
ori
$
t0
,
0xf8ef
sw
$
t0
,
0x10
(
$
s0
)
lui
$
t0
,
0x42a5
ori
$
t0
,
0xec5f
sw
$
t0
,
0x14
(
$
s0
)
lui
$
t0
,
0x03bb
ori
$
t0
,
0xfa25
sw
$
t0
,
0x18
(
$
s0
)
lui
$
t0
,
0x4cb0
ori
$
t0
,
0x1fad
sw
$
t0
,
0x1c
(
$
s0
)
#
syscall
4020
to
trigger
li
$
v0
,
4020
syscall
#
length
at
0x31000000
lui
$
s1
,
0x3100
lw
$
s1
,
0
(
$
t0
)
lw
$
t0
,
0
(
$
s1
)
#
should
be
9
li
$
t4
,
9
#
should
be
len
(
"hello world"
)
==
11
li
$
t4
,
11
subu
$
t5
,
$
t0
,
$
t4
sltiu
$
v0
,
$
t5
,
1
...
...
mipsevm/testoracle/0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad
0 → 100644
View file @
5af95462
hello world
\ No newline at end of file
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