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
b54ae1e0
Commit
b54ae1e0
authored
Sep 26, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
both kinds of test
parent
3e1e76a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
evm.sh
mipsevm/evm.sh
+1
-1
main.go
mipsevm/main.go
+15
-11
No files found.
mipsevm/evm.sh
View file @
b54ae1e0
#!/bin/bash
(
cd
../
&&
npx hardhat compile
)
&&
go build
&&
./mipsevm
(
cd
../
&&
npx hardhat compile
)
&&
go build
&&
./mipsevm
$1
mipsevm/main.go
View file @
b54ae1e0
...
...
@@ -7,6 +7,7 @@ import (
"io/ioutil"
"log"
"math/big"
"os"
"time"
"github.com/ethereum/go-ethereum/common"
...
...
@@ -134,7 +135,8 @@ func opStaticCall(pc *uint64, interpreter *vm.EVMInterpreter, scope *vm.ScopeCon
scope
.
Memory
.
Set
(
retOffset
.
Uint64
(),
retSize
.
Uint64
(),
args
[
0x4
:
0x24
])
}
scope
.
Contract
.
Gas
+=
returnGas
// ram access is free here
scope
.
Contract
.
Gas
=
returnGas
// what is the return value here?
return
common
.
Hash
{}
.
Bytes
(),
nil
}
...
...
@@ -156,7 +158,7 @@ func runTest(fn string, steps int, interpreter *vm.EVMInterpreter, bytecode []by
input
:=
[]
byte
{
0xdb
,
0x7d
,
0xf5
,
0x98
}
// Steps(bytes32, uint256)
input
=
append
(
input
,
common
.
BigToHash
(
common
.
Big0
)
.
Bytes
()
...
)
input
=
append
(
input
,
common
.
BigToHash
(
big
.
NewInt
(
int64
(
steps
)))
.
Bytes
()
...
)
contract
:=
vm
.
NewContract
(
vm
.
AccountRef
(
from
),
vm
.
AccountRef
(
to
),
common
.
Big0
,
20
000000
)
contract
:=
vm
.
NewContract
(
vm
.
AccountRef
(
from
),
vm
.
AccountRef
(
to
),
common
.
Big0
,
1
000000
)
//fmt.Println(bytecodehash, bytecode)
contract
.
SetCallCode
(
&
to
,
crypto
.
Keccak256Hash
(
bytecode
),
bytecode
)
...
...
@@ -214,15 +216,17 @@ func main() {
//steps := 1000000
//debug = true
files
,
err
:=
ioutil
.
ReadDir
(
"test/bin"
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
for
_
,
f
:=
range
files
{
runTest
(
"test/bin/"
+
f
.
Name
(),
100
,
interpreter
,
bytecode
)
if
len
(
os
.
Args
)
>
1
{
debug
=
true
runTest
(
os
.
Args
[
1
],
20
,
interpreter
,
bytecode
)
}
else
{
files
,
err
:=
ioutil
.
ReadDir
(
"test/bin"
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
for
_
,
f
:=
range
files
{
runTest
(
"test/bin/"
+
f
.
Name
(),
100
,
interpreter
,
bytecode
)
}
}
/*debug = true
runTest("test/bin/add.bin", 20, interpreter, bytecode)*/
}
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