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
bea85f76
Unverified
Commit
bea85f76
authored
Apr 24, 2023
by
protolambda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mipsevm: cleanup referenced contracts
parent
f629ad49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
30 deletions
+4
-30
evm.go
mipsevm/evm.go
+3
-27
evm_test.go
mipsevm/evm_test.go
+1
-3
No files found.
mipsevm/evm.go
View file @
bea85f76
...
...
@@ -27,18 +27,8 @@ func LoadContracts() (*Contracts, error) {
if
err
!=
nil
{
return
nil
,
err
}
mipsMem
,
err
:=
LoadContract
(
"MIPSMemory"
)
if
err
!=
nil
{
return
nil
,
err
}
challenge
,
err
:=
LoadContract
(
"Challenge"
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
Contracts
{
MIPS
:
mips
,
MIPSMemory
:
mipsMem
,
Challenge
:
challenge
,
MIPS
:
mips
,
},
nil
}
...
...
@@ -69,15 +59,11 @@ func (c *Contract) SourceMap(sourcePaths []string) (*SourceMap, error) {
}
type
Contracts
struct
{
MIPS
*
Contract
MIPSMemory
*
Contract
Challenge
*
Contract
MIPS
*
Contract
}
type
Addresses
struct
{
MIPS
common
.
Address
MIPSMemory
common
.
Address
Challenge
common
.
Address
MIPS
common
.
Address
}
func
NewEVMEnv
(
contracts
*
Contracts
,
addrs
*
Addresses
)
(
*
vm
.
EVM
,
*
state
.
StateDB
)
{
...
...
@@ -97,8 +83,6 @@ func NewEVMEnv(contracts *Contracts, addrs *Addresses) (*vm.EVM, *state.StateDB)
// pre-deploy the contracts
env
.
StateDB
.
SetCode
(
addrs
.
MIPS
,
contracts
.
MIPS
.
DeployedBytecode
.
Object
)
env
.
StateDB
.
SetCode
(
addrs
.
MIPSMemory
,
contracts
.
MIPSMemory
.
DeployedBytecode
.
Object
)
env
.
StateDB
.
SetCode
(
addrs
.
Challenge
,
contracts
.
Challenge
.
DeployedBytecode
.
Object
)
// TODO: any state to set, or immutables to replace, to link the contracts together?
return
env
,
state
}
...
...
@@ -133,11 +117,3 @@ func (d *testChain) GetHeader(h common.Hash, n uint64) *types.Header {
WithdrawalsHash
:
&
types
.
EmptyWithdrawalsHash
,
}
}
func
Calldata
(
st
*
State
,
accessList
[][
32
]
byte
)
[]
byte
{
input
:=
crypto
.
Keccak256Hash
([]
byte
(
"Steps(bytes32,uint256)"
))
.
Bytes
()[
:
4
]
input
=
append
(
input
,
common
.
BigToHash
(
common
.
Big0
)
.
Bytes
()
...
)
input
=
append
(
input
,
common
.
BigToHash
(
big
.
NewInt
(
int64
(
st
.
Step
)))
.
Bytes
()
...
)
return
input
}
mipsevm/evm_test.go
View file @
bea85f76
...
...
@@ -31,9 +31,7 @@ func TestEVM(t *testing.T) {
require
.
NoError
(
t
,
err
)
addrs
:=
&
Addresses
{
MIPS
:
common
.
Address
{
0
:
0xff
,
19
:
1
},
MIPSMemory
:
common
.
Address
{
0
:
0xff
,
19
:
2
},
Challenge
:
common
.
Address
{
0
:
0xff
,
19
:
3
},
MIPS
:
common
.
Address
{
0
:
0xff
,
19
:
1
},
}
sender
:=
common
.
Address
{
0x13
,
0x37
}
...
...
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