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
3782c561
Unverified
Commit
3782c561
authored
Jun 22, 2023
by
inphi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cannon: Remove unicorn references
parent
cbae9e68
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
16 deletions
+5
-16
README.md
cannon/docs/README.md
+2
-3
evm_test.go
cannon/mipsevm/evm_test.go
+2
-2
memory.go
cannon/mipsevm/memory.go
+1
-2
mips.go
cannon/mipsevm/mips.go
+0
-9
No files found.
cannon/docs/README.md
View file @
3782c561
...
@@ -32,9 +32,8 @@ And as it executes each step, it can optionally produce the witness data for the
...
@@ -32,9 +32,8 @@ And as it executes each step, it can optionally produce the witness data for the
The Cannon CLI is used to load a program into an initial state,
The Cannon CLI is used to load a program into an initial state,
transition it N steps quickly without witness generation, and 1 step while producing a witness.
transition it N steps quickly without witness generation, and 1 step while producing a witness.
`mipsevm`
is backed by the Unicorn emulator, but instrumented for proof generation,
`mipsevm`
is instrumented for proof generation and handles delay-slots by isolating each individual instruction
and handles delay-slots by isolating each individual instruction and tracking
`nextPC`
and tracking
`nextPC`
to emulate the delayed
`PC`
changes after delay-slot execution.
to emulate the delayed
`PC`
changes after delay-slot execution.
## Witness Data
## Witness Data
...
...
cannon/mipsevm/evm_test.go
View file @
3782c561
...
@@ -108,7 +108,7 @@ func TestEVM(t *testing.T) {
...
@@ -108,7 +108,7 @@ func TestEVM(t *testing.T) {
// TODO: maybe more readable to decode the evmPost state, and do attribute-wise comparison.
// TODO: maybe more readable to decode the evmPost state, and do attribute-wise comparison.
uniPost
:=
us
.
state
.
EncodeWitness
()
uniPost
:=
us
.
state
.
EncodeWitness
()
require
.
Equal
(
t
,
hexutil
.
Bytes
(
uniPost
)
.
String
(),
hexutil
.
Bytes
(
evmPost
)
.
String
(),
require
.
Equal
(
t
,
hexutil
.
Bytes
(
uniPost
)
.
String
(),
hexutil
.
Bytes
(
evmPost
)
.
String
(),
"
unicorn
produced different state than EVM"
)
"
mipsevm
produced different state than EVM"
)
}
}
require
.
Equal
(
t
,
uint32
(
endAddr
),
state
.
PC
,
"must reach end"
)
require
.
Equal
(
t
,
uint32
(
endAddr
),
state
.
PC
,
"must reach end"
)
// inspect test result
// inspect test result
...
@@ -175,7 +175,7 @@ func TestHelloEVM(t *testing.T) {
...
@@ -175,7 +175,7 @@ func TestHelloEVM(t *testing.T) {
// TODO: maybe more readable to decode the evmPost state, and do attribute-wise comparison.
// TODO: maybe more readable to decode the evmPost state, and do attribute-wise comparison.
uniPost
:=
us
.
state
.
EncodeWitness
()
uniPost
:=
us
.
state
.
EncodeWitness
()
require
.
Equal
(
t
,
hexutil
.
Bytes
(
uniPost
)
.
String
(),
hexutil
.
Bytes
(
evmPost
)
.
String
(),
require
.
Equal
(
t
,
hexutil
.
Bytes
(
uniPost
)
.
String
(),
hexutil
.
Bytes
(
evmPost
)
.
String
(),
"
unicorn
produced different state than EVM"
)
"
mipsevm
produced different state than EVM"
)
}
}
end
:=
time
.
Now
()
end
:=
time
.
Now
()
delta
:=
end
.
Sub
(
start
)
delta
:=
end
.
Sub
(
start
)
...
...
cannon/mipsevm/memory.go
View file @
3782c561
...
@@ -11,8 +11,7 @@ import (
...
@@ -11,8 +11,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
)
)
// Note: 2**12 = 4 KiB, the minimum page-size in Unicorn for mmap
// Note: 2**12 = 4 KiB, the min phys page size in the Go runtime.
// as well as the Go runtime min phys page size.
const
(
const
(
PageAddrSize
=
12
PageAddrSize
=
12
PageKeySize
=
32
-
PageAddrSize
PageKeySize
=
32
-
PageAddrSize
...
...
cannon/mipsevm/mips.go
View file @
3782c561
...
@@ -56,15 +56,6 @@ func (m *InstrumentedState) handleSyscall() error {
...
@@ -56,15 +56,6 @@ func (m *InstrumentedState) handleSyscall() error {
v0
=
a0
v0
=
a0
//fmt.Printf("mmap hint 0x%x size 0x%x\n", v0, sz)
//fmt.Printf("mmap hint 0x%x size 0x%x\n", v0, sz)
}
}
// Go does this thing where it first gets memory with PROT_NONE,
// and then mmaps with a hint with prot=3 (PROT_READ|WRITE).
// We can ignore the NONE case, to avoid duplicate/overlapping mmap calls to unicorn.
//prot := a2
//if prot != 0 {
// if err := mu.MemMap(uint64(v0), uint64(sz)); err != nil {
// log.Fatalf("mmap fail: %v", err)
// }
//}
case
4045
:
// brk
case
4045
:
// brk
v0
=
0x40000000
v0
=
0x40000000
case
4120
:
// clone (not supported)
case
4120
:
// clone (not supported)
...
...
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