Commit bea85f76 authored by protolambda's avatar protolambda

mipsevm: cleanup referenced contracts

parent f629ad49
...@@ -27,18 +27,8 @@ func LoadContracts() (*Contracts, error) { ...@@ -27,18 +27,8 @@ func LoadContracts() (*Contracts, error) {
if err != nil { if err != nil {
return nil, err 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{ return &Contracts{
MIPS: mips, MIPS: mips,
MIPSMemory: mipsMem,
Challenge: challenge,
}, nil }, nil
} }
...@@ -69,15 +59,11 @@ func (c *Contract) SourceMap(sourcePaths []string) (*SourceMap, error) { ...@@ -69,15 +59,11 @@ func (c *Contract) SourceMap(sourcePaths []string) (*SourceMap, error) {
} }
type Contracts struct { type Contracts struct {
MIPS *Contract MIPS *Contract
MIPSMemory *Contract
Challenge *Contract
} }
type Addresses struct { type Addresses struct {
MIPS common.Address MIPS common.Address
MIPSMemory common.Address
Challenge common.Address
} }
func NewEVMEnv(contracts *Contracts, addrs *Addresses) (*vm.EVM, *state.StateDB) { func NewEVMEnv(contracts *Contracts, addrs *Addresses) (*vm.EVM, *state.StateDB) {
...@@ -97,8 +83,6 @@ 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 // pre-deploy the contracts
env.StateDB.SetCode(addrs.MIPS, contracts.MIPS.DeployedBytecode.Object) 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? // TODO: any state to set, or immutables to replace, to link the contracts together?
return env, state return env, state
} }
...@@ -133,11 +117,3 @@ func (d *testChain) GetHeader(h common.Hash, n uint64) *types.Header { ...@@ -133,11 +117,3 @@ func (d *testChain) GetHeader(h common.Hash, n uint64) *types.Header {
WithdrawalsHash: &types.EmptyWithdrawalsHash, 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
}
...@@ -31,9 +31,7 @@ func TestEVM(t *testing.T) { ...@@ -31,9 +31,7 @@ func TestEVM(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
addrs := &Addresses{ addrs := &Addresses{
MIPS: common.Address{0: 0xff, 19: 1}, MIPS: common.Address{0: 0xff, 19: 1},
MIPSMemory: common.Address{0: 0xff, 19: 2},
Challenge: common.Address{0: 0xff, 19: 3},
} }
sender := common.Address{0x13, 0x37} sender := common.Address{0x13, 0x37}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment