Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #154 from ethereum-optimism/jg/e2e_test
Browse files Browse the repository at this point in the history
Adds an end to end system test that runs an L1 node, a rollup node, and a L2 node.
It then submits a deposit and then verifies that the result of the deposit shows up on Layer 2.
  • Loading branch information
trianglesphere committed Jan 27, 2022
2 parents d5932c6 + 4500ed5 commit ee0b610
Show file tree
Hide file tree
Showing 13 changed files with 1,553 additions and 3 deletions.
24 changes: 23 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/ethereum/go-ethereum v1.10.13
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
github.com/holiman/uint256 v1.2.0
github.com/miguelmota/go-ethereum-hdwallet v0.1.1
github.com/protolambda/ask v0.1.3
github.com/stretchr/testify v1.7.0
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
Expand All @@ -14,27 +15,48 @@ require (
require (
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
github.com/btcsuite/btcd v0.20.1-beta // indirect
github.com/btcsuite/btcd v0.21.0-beta // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.1.5 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hashicorp/go-bexpr v0.1.10 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/huin/goupnp v1.0.2 // indirect
github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/tsdb v0.7.1 // indirect
github.com/rjeczalik/notify v0.9.1 // indirect
github.com/rs/cors v1.7.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 // indirect
github.com/stretchr/objx v0.1.1 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef // indirect
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912 // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/urfave/cli.v1 v1.20.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)

Expand Down
33 changes: 31 additions & 2 deletions go.sum

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions opnode/contracts/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
SHELL := /bin/bash

CONTRACTS_PATH := "../../packages/contracts/artifacts/contracts"

binding: abi
$(eval temp := $(shell mktemp))

cat abis/DepositFeed.json \
| jq -r .bytecode > $(temp)

cat abis/DepositFeed.json \
| jq .abi \
| abigen --pkg deposit \
--abi - \
--out deposit/deposit_feed_raw.go \
--type deposit \
--bin $(temp)

$(eval deployedBytecode := $(shell cat abis/DepositFeed.json | jq -r .deployedBytecode))
echo "// Code generated - DO NOT EDIT." > deposit/deposit_feed_deployed.go
echo "// This file is a generated binding and any manual changes will be lost." >> deposit/deposit_feed_deployed.go
echo "package deposit" >> deposit/deposit_feed_deployed.go
echo "var DepositDeployedBin = \"$(deployedBytecode)\"" >> deposit/deposit_feed_deployed.go
gofmt -s -w deposit/deposit_feed_deployed.go

rm $(temp)

$(eval temp := $(shell mktemp))

cat abis/L1Block.json \
| jq -r .bytecode > $(temp)

cat abis/L1Block.json \
| jq .abi \
| abigen --pkg l1block \
--abi - \
--out l1block/l1_block_info_raw.go \
--type l1block \
--bin $(temp)

$(eval deployedBytecode := $(shell cat abis/L1Block.json | jq -r .deployedBytecode))
echo "// Code generated - DO NOT EDIT." > l1block/l1_block_info_deployed.go
echo "// This file is a generated binding and any manual changes will be lost." >> l1block/l1_block_info_deployed.go
echo "package l1block" >> l1block/l1_block_info_deployed.go
echo "var L1blockDeployedBin = \"$(deployedBytecode)\"" >> l1block/l1_block_info_deployed.go
gofmt -s -w l1block/l1_block_info_deployed.go

rm $(temp)

abi:
cat $(CONTRACTS_PATH)/L1/DepositFeed.sol/DepositFeed.json \
| jq '{abi,bytecode,deployedBytecode}' \
> abis/DepositFeed.json
cat $(CONTRACTS_PATH)/L2/L1Block.sol/L1Block.json \
| jq '{abi,bytecode,deployedBytecode}' \
> abis/L1Block.json
93 changes: 93 additions & 0 deletions opnode/contracts/abis/DepositFeed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"abi": [
{
"inputs": [],
"name": "NonZeroCreationTarget",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "mint",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "gasLimit",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bool",
"name": "isCreation",
"type": "bool"
},
{
"indexed": false,
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "TransactionDeposited",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "_to",
"type": "address"
},
{
"internalType": "uint256",
"name": "_value",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_gasLimit",
"type": "uint256"
},
{
"internalType": "bool",
"name": "_isCreation",
"type": "bool"
},
{
"internalType": "bytes",
"name": "_data",
"type": "bytes"
}
],
"name": "depositTransaction",
"outputs": [],
"stateMutability": "payable",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b5061056a806100206000396000f3fe60806040526004361061001e5760003560e01c8063fa92670c14610023575b600080fd5b61003d6004803603810190610038919061039d565b61003f565b005b8180156100795750600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b156100b0576040517ff98844ef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60003390503273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461010257731111000000000000000000000000000000001111330190505b8573ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f26137a5e34446f63aa9ea28797a0e70c3987720913879898802dd60b944615ad34888888886040516101679594939291906104da565b60405180910390a3505050505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101b68261018b565b9050919050565b6101c6816101ab565b81146101d157600080fd5b50565b6000813590506101e3816101bd565b92915050565b6000819050919050565b6101fc816101e9565b811461020757600080fd5b50565b600081359050610219816101f3565b92915050565b60008115159050919050565b6102348161021f565b811461023f57600080fd5b50565b6000813590506102518161022b565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6102aa82610261565b810181811067ffffffffffffffff821117156102c9576102c8610272565b5b80604052505050565b60006102dc610177565b90506102e882826102a1565b919050565b600067ffffffffffffffff82111561030857610307610272565b5b61031182610261565b9050602081019050919050565b82818337600083830152505050565b600061034061033b846102ed565b6102d2565b90508281526020810184848401111561035c5761035b61025c565b5b61036784828561031e565b509392505050565b600082601f83011261038457610383610257565b5b813561039484826020860161032d565b91505092915050565b600080600080600060a086880312156103b9576103b8610181565b5b60006103c7888289016101d4565b95505060206103d88882890161020a565b94505060406103e98882890161020a565b93505060606103fa88828901610242565b925050608086013567ffffffffffffffff81111561041b5761041a610186565b5b6104278882890161036f565b9150509295509295909350565b61043d816101e9565b82525050565b61044c8161021f565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561048c578082015181840152602081019050610471565b8381111561049b576000848401525b50505050565b60006104ac82610452565b6104b6818561045d565b93506104c681856020860161046e565b6104cf81610261565b840191505092915050565b600060a0820190506104ef6000830188610434565b6104fc6020830187610434565b6105096040830186610434565b6105166060830185610443565b818103608083015261052881846104a1565b9050969550505050505056fea264697066735822122025140b7451be29e927d33c9ad0e2dd3744f824f592e16cb35f009b57442e2c9364736f6c634300080a0033",
"deployedBytecode": "0x60806040526004361061001e5760003560e01c8063fa92670c14610023575b600080fd5b61003d6004803603810190610038919061039d565b61003f565b005b8180156100795750600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b156100b0576040517ff98844ef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60003390503273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461010257731111000000000000000000000000000000001111330190505b8573ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f26137a5e34446f63aa9ea28797a0e70c3987720913879898802dd60b944615ad34888888886040516101679594939291906104da565b60405180910390a3505050505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101b68261018b565b9050919050565b6101c6816101ab565b81146101d157600080fd5b50565b6000813590506101e3816101bd565b92915050565b6000819050919050565b6101fc816101e9565b811461020757600080fd5b50565b600081359050610219816101f3565b92915050565b60008115159050919050565b6102348161021f565b811461023f57600080fd5b50565b6000813590506102518161022b565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6102aa82610261565b810181811067ffffffffffffffff821117156102c9576102c8610272565b5b80604052505050565b60006102dc610177565b90506102e882826102a1565b919050565b600067ffffffffffffffff82111561030857610307610272565b5b61031182610261565b9050602081019050919050565b82818337600083830152505050565b600061034061033b846102ed565b6102d2565b90508281526020810184848401111561035c5761035b61025c565b5b61036784828561031e565b509392505050565b600082601f83011261038457610383610257565b5b813561039484826020860161032d565b91505092915050565b600080600080600060a086880312156103b9576103b8610181565b5b60006103c7888289016101d4565b95505060206103d88882890161020a565b94505060406103e98882890161020a565b93505060606103fa88828901610242565b925050608086013567ffffffffffffffff81111561041b5761041a610186565b5b6104278882890161036f565b9150509295509295909350565b61043d816101e9565b82525050565b61044c8161021f565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561048c578082015181840152602081019050610471565b8381111561049b576000848401525b50505050565b60006104ac82610452565b6104b6818561045d565b93506104c681856020860161046e565b6104cf81610261565b840191505092915050565b600060a0820190506104ef6000830188610434565b6104fc6020830187610434565b6105096040830186610434565b6105166060830185610443565b818103608083015261052881846104a1565b9050969550505050505056fea264697066735822122025140b7451be29e927d33c9ad0e2dd3744f824f592e16cb35f009b57442e2c9364736f6c634300080a0033"
}
104 changes: 104 additions & 0 deletions opnode/contracts/abis/L1Block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"abi": [
{
"inputs": [],
"name": "OnlyDepositor",
"type": "error"
},
{
"inputs": [],
"name": "DEPOSITOR_ACCOUNT",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "basefee",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "hash",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "number",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_number",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_timestamp",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_basefee",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "_hash",
"type": "bytes32"
}
],
"name": "setL1BlockValues",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "timestamp",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b506103a2806100206000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806309bd5a60146100675780635cf24969146100855780638381f58a146100a3578063b80777ea146100c1578063c03ba43e146100df578063e591b282146100fb575b600080fd5b61006f610119565b60405161007c91906101fd565b60405180910390f35b61008d61011f565b60405161009a9190610231565b60405180910390f35b6100ab610125565b6040516100b89190610231565b60405180910390f35b6100c961012b565b6040516100d69190610231565b60405180910390f35b6100f960048036038101906100f491906102a9565b610131565b005b6101036101cc565b6040516101109190610351565b60405180910390f35b60035481565b60025481565b60005481565b60015481565b73deaddeaddeaddeaddeaddeaddeaddeaddead000173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101aa576040517fce8c104800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8360008190555082600181905550816002819055508060038190555050505050565b73deaddeaddeaddeaddeaddeaddeaddeaddead000181565b6000819050919050565b6101f7816101e4565b82525050565b600060208201905061021260008301846101ee565b92915050565b6000819050919050565b61022b81610218565b82525050565b60006020820190506102466000830184610222565b92915050565b600080fd5b61025a81610218565b811461026557600080fd5b50565b60008135905061027781610251565b92915050565b610286816101e4565b811461029157600080fd5b50565b6000813590506102a38161027d565b92915050565b600080600080608085870312156102c3576102c261024c565b5b60006102d187828801610268565b94505060206102e287828801610268565b93505060406102f387828801610268565b925050606061030487828801610294565b91505092959194509250565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061033b82610310565b9050919050565b61034b81610330565b82525050565b60006020820190506103666000830184610342565b9291505056fea2646970667358221220cdaea4f1ee477c3fe7f1b3caa2283ad58d53d6a652006ec9e6f6bf22354b258264736f6c634300080a0033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100625760003560e01c806309bd5a60146100675780635cf24969146100855780638381f58a146100a3578063b80777ea146100c1578063c03ba43e146100df578063e591b282146100fb575b600080fd5b61006f610119565b60405161007c91906101fd565b60405180910390f35b61008d61011f565b60405161009a9190610231565b60405180910390f35b6100ab610125565b6040516100b89190610231565b60405180910390f35b6100c961012b565b6040516100d69190610231565b60405180910390f35b6100f960048036038101906100f491906102a9565b610131565b005b6101036101cc565b6040516101109190610351565b60405180910390f35b60035481565b60025481565b60005481565b60015481565b73deaddeaddeaddeaddeaddeaddeaddeaddead000173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101aa576040517fce8c104800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8360008190555082600181905550816002819055508060038190555050505050565b73deaddeaddeaddeaddeaddeaddeaddeaddead000181565b6000819050919050565b6101f7816101e4565b82525050565b600060208201905061021260008301846101ee565b92915050565b6000819050919050565b61022b81610218565b82525050565b60006020820190506102466000830184610222565b92915050565b600080fd5b61025a81610218565b811461026557600080fd5b50565b60008135905061027781610251565b92915050565b610286816101e4565b811461029157600080fd5b50565b6000813590506102a38161027d565b92915050565b600080600080608085870312156102c3576102c261024c565b5b60006102d187828801610268565b94505060206102e287828801610268565b93505060406102f387828801610268565b925050606061030487828801610294565b91505092959194509250565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061033b82610310565b9050919050565b61034b81610330565b82525050565b60006020820190506103666000830184610342565b9291505056fea2646970667358221220cdaea4f1ee477c3fe7f1b3caa2283ad58d53d6a652006ec9e6f6bf22354b258264736f6c634300080a0033"
}
Loading

0 comments on commit ee0b610

Please sign in to comment.