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
57f989f2
Commit
57f989f2
authored
Sep 25, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
this should fix CI
parent
21f5e0fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
6 deletions
+53
-6
embedded_mips.go
minigeth/oracle/embedded_mips.go
+35
-0
prefetch.go
minigeth/oracle/prefetch.go
+17
-5
run.py
risc/run.py
+1
-1
No files found.
minigeth/oracle/embedded_mips.go
View file @
57f989f2
...
...
@@ -8,12 +8,47 @@ import (
"io/ioutil"
"math/big"
"os"
"strconv"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
)
var
preimages
=
make
(
map
[
common
.
Hash
][]
byte
)
var
inputs
[
6
]
common
.
Hash
var
inputsLoaded
bool
=
false
func
Input
(
index
int
)
common
.
Hash
{
if
index
<
0
||
index
>
5
{
panic
(
"bad input index"
)
}
if
!
inputsLoaded
{
blockNumber
,
_
:=
strconv
.
Atoi
(
os
.
Args
[
1
])
f
,
err
:=
os
.
Open
(
fmt
.
Sprintf
(
"/tmp/eth/%d"
,
blockNumber
))
if
err
!=
nil
{
panic
(
"missing inputs"
)
}
defer
f
.
Close
()
ret
,
err
:=
ioutil
.
ReadAll
(
f
)
for
i
:=
0
;
i
<
len
(
inputs
);
i
++
{
inputs
[
i
]
=
common
.
BytesToHash
(
ret
[
i
*
0x20
:
i
*
0x20
+
0x20
])
}
inputsLoaded
=
true
}
return
inputs
[
index
]
}
func
Output
(
output
common
.
Hash
)
{
if
output
==
inputs
[
5
]
{
fmt
.
Println
(
"good transition"
)
}
else
{
fmt
.
Println
(
output
,
"!="
,
inputs
[
5
])
panic
(
"BAD transition :(("
)
}
}
func
Preimage
(
hash
common
.
Hash
)
[]
byte
{
val
,
ok
:=
preimages
[
hash
]
...
...
minigeth/oracle/prefetch.go
View file @
57f989f2
...
...
@@ -159,18 +159,20 @@ func PrefetchCode(blockNumber *big.Int, addrHash common.Hash) {
preimages
[
hash
]
=
ret
}
var
inputs
[
5
]
common
.
Hash
var
realoutput
common
.
Hash
var
inputs
[
6
]
common
.
Hash
func
Input
(
index
int
)
common
.
Hash
{
if
index
<
0
||
index
>
5
{
panic
(
"bad input index"
)
}
return
inputs
[
index
]
}
func
Output
(
output
common
.
Hash
)
{
if
output
==
realoutput
{
if
output
==
inputs
[
5
]
{
fmt
.
Println
(
"good transition"
)
}
else
{
fmt
.
Println
(
output
,
"!="
,
realoutput
)
fmt
.
Println
(
output
,
"!="
,
inputs
[
5
]
)
panic
(
"BAD transition :(("
)
}
}
...
...
@@ -211,7 +213,17 @@ func PrefetchBlock(blockNumber *big.Int, startBlock bool, hasher types.TrieHashe
inputs
[
2
]
=
blockHeader
.
Coinbase
.
Hash
()
inputs
[
3
]
=
blockHeader
.
UncleHash
inputs
[
4
]
=
common
.
BigToHash
(
big
.
NewInt
(
int64
(
blockHeader
.
GasLimit
)))
realoutput
=
blockHeader
.
Root
// secret input
inputs
[
5
]
=
blockHeader
.
Root
// save the inputs
saveinput
:=
make
([]
byte
,
0
)
for
i
:=
0
;
i
<
len
(
inputs
);
i
++
{
saveinput
=
append
(
saveinput
,
inputs
[
i
]
.
Bytes
()[
:
]
...
)
}
key
:=
fmt
.
Sprintf
(
"/tmp/eth/%d"
,
blockNumber
.
Uint64
()
-
1
)
ioutil
.
WriteFile
(
key
,
saveinput
,
0644
)
txs
:=
make
([]
*
types
.
Transaction
,
len
(
jr
.
Result
.
Transactions
))
for
i
:=
0
;
i
<
len
(
jr
.
Result
.
Transactions
);
i
++
{
...
...
risc/run.py
View file @
57f989f2
...
...
@@ -286,7 +286,7 @@ mu.mem_write(SIZE-0x2000, struct.pack(">IIIIIIIII",
_AT_PAGESZ
,
0x1000
,
0
))
# auxv
# block
mu
.
mem_write
(
SIZE
-
0x800
,
b
"132844
91
\x00
"
)
mu
.
mem_write
(
SIZE
-
0x800
,
b
"132844
69
\x00
"
)
#mu.mem_write(SIZE-0x800, b"13284469\x00")
mu
.
mem_write
(
SIZE
-
0x400
,
b
"GOGC=off
\x00
"
)
...
...
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