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
e986fbdb
Commit
e986fbdb
authored
Oct 04, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
500khz with nothing
parent
69cdd192
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
MIPS.sol
contracts/MIPS.sol
+3
-0
main.go
mipsevm/main.go
+6
-0
No files found.
contracts/MIPS.sol
View file @
e986fbdb
...
...
@@ -42,6 +42,7 @@ contract MIPS {
// TODO: this is actually doing an SLOAD first
sstore(addr, value)
}
return stateHash;
}
}
...
...
@@ -76,6 +77,8 @@ contract MIPS {
if (pc == 0xdead0000) {
return stateHash;
}
/*stateHash = WriteMemory(stateHash, REG_PC, pc+4);
return stateHash;*/
return stepNextPC(stateHash, pc, pc+4);
}
...
...
mipsevm/main.go
View file @
e986fbdb
...
...
@@ -126,8 +126,11 @@ func (jst *Tracer) CaptureStart(env *vm.EVM, from common.Address, to common.Addr
}
// CaptureState implements the Tracer interface to trace a single step of VM execution.
var
evmInsCount
uint64
=
0
func
(
jst
*
Tracer
)
CaptureState
(
env
*
vm
.
EVM
,
pc
uint64
,
op
vm
.
OpCode
,
gas
,
cost
uint64
,
scope
*
vm
.
ScopeContext
,
rData
[]
byte
,
depth
int
,
err
error
)
{
//fmt.Println(pc, op, gas)
evmInsCount
+=
1
}
// CaptureFault implements the Tracer interface to trace an execution fault
...
...
@@ -190,6 +193,7 @@ func RunMinigeth(fn string, interpreter *vm.EVMInterpreter, bytecode []byte, ste
ram
[
0xc0000008
]
=
0
ram
[
0xc0000000
+
7
*
4
]
=
0
}
fmt
.
Println
(
"evm ins count"
,
evmInsCount
)
}
func
runTest
(
fn
string
,
steps
int
,
interpreter
*
vm
.
EVMInterpreter
,
bytecode
[]
byte
,
gas
uint64
)
(
uint32
,
uint64
)
{
...
...
@@ -235,9 +239,11 @@ func GetInterpreterAndBytecode() (*vm.EVMInterpreter, []byte) {
blockContext
:=
core
.
NewEVMBlockContext
(
&
header
,
bc
,
&
author
)
txContext
:=
vm
.
TxContext
{}
config
:=
vm
.
Config
{}
/*config.Debug = true
tracer := Tracer{}
config.Tracer = &tracer*/
evm
:=
vm
.
NewEVM
(
blockContext
,
txContext
,
statedb
,
params
.
MainnetChainConfig
,
config
)
interpreter
:=
vm
.
NewEVMInterpreter
(
evm
,
config
)
...
...
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