Optimistic Rollups: Testing & Deployment - lukso-network/network-optimism-integration-test GitHub Wiki
Deployment
L14 deployed Optimism contracts list:
{
"Proxy__OVM_L2CrossDomainMessenger": "0xa822D0B441Fe16Dc7Fca7000C76Eb6065DB58035",
"OVM_L2CrossDomainMessenger": "0x24ACb5b9f4DEEBE52382d8F6d475bD81A3b0858A",
"Proxy__OVM_L1CrossDomainMessenger": "0x7d7017d278ca6c1bf0254a0942fC42ff478d69Eb",
"OVM_L1CrossDomainMessenger": "0x7301F6Fe8539c066c125045dF50D09194493843f",
"Proxy__Proxy__OVM_L1CrossDomainMessenger": "0xbBA27A567456956e9e13dB7Ac124AC8Cd8Ac3531",
"Proxy__OVM_CanonicalTransactionChain": "0x918bc4DA93bF4D3DA00E6e10Bd8e42d00B5d0B09",
"OVM_CanonicalTransactionChain": "0xF69f69B3aF47c034E44be5C352e5F9d7b69bEeA3",
"Proxy__OVM_StateCommitmentChain": "0xC0921704706CDED9a946936B1492dCC955dB926f",
"OVM_StateCommitmentChain": "0x22465115A627f6829bA4E746FF94bF9a5f6F73C7",
"Proxy__OVM_DeployerWhitelist": "0xFf46B724B0D0d4803e12F85389343F9E76e36aD1",
"OVM_DeployerWhitelist": "0x5F0A9F18EFB52c8A97E3B83AeB8AAb04729f6018",
"Proxy__OVM_L1MessageSender": "0xB82765d5D49cc1293C259e1EA2D7048d532f4487",
"OVM_L1MessageSender": "0x17A475915874F8b11F040F40929E6B5C641cE81F",
"Proxy__OVM_L2ToL1MessagePasser": "0xA8d6B8DaD78364700ff5624a81F26312b9792f9F",
"OVM_L2ToL1MessagePasser": "0xCF68003BA7CF1C351C8ce79e9D0CD56c3fa0F68a",
"Proxy__OVM_SafetyChecker": "0xa414e4F8E00901bCBB47aC17D1B92dacebAA1fc0",
"OVM_SafetyChecker": "0x1C2649b3d912b74a8E507Ad1c4Cb7d570FEE40B6",
"Proxy__OVM_ExecutionManager": "0xa6a26b4E1123E247d590570D3980071aFEb6997b",
"OVM_ExecutionManager": "0xc4D3B25Be1D97940f077D8edC4136C5E47Ec3284",
"Proxy__OVM_StateManager": "0xcF06f346Ebae0d7Ab9Df2932C09CC8d0B5eAef3a",
"OVM_StateManager": "0x679594Dd8FC803e9499750eAe0EedD2dc2519fF3",
"Proxy__OVM_StateManagerFactory": "0xc30f7eC892A981949EECE052898fd80C7F982765",
"OVM_StateManagerFactory": "0xE05E8EcF5926362E23eF0f227919b228C4692897",
"Proxy__OVM_FraudVerifier": "0xB49F0eBc66350749014c7b891e70825882668D84",
"OVM_FraudVerifier": "0x0AE582C2741CFB23Be165C4F07b6Ef99154c5460",
"Proxy__OVM_StateTransitionerFactory": "0x2ee9E6AcBF5Ff17f9a968b0145f22E7636d5DB35",
"OVM_StateTransitionerFactory": "0x0a85763A92390c3503F20c200064d1B4e359D459",
"Proxy__OVM_ECDSAContractAccount": "0xdf337323D08AD3F8e5fb09E961970629Bf1Dff0D",
"OVM_ECDSAContractAccount": "0x82207A14D55B42F53aBc61801B95257406A2598d",
"Proxy__OVM_SequencerEntrypoint": "0xbe16fA586f9210674e639EC216E0B2dBccC7d376",
"OVM_SequencerEntrypoint": "0x3f04848bC30046ed56998F32666994cD05dc891E",
"Proxy__OVM_ProxySequencerEntrypoint": "0x3Fe4ae9088fC3082D94b343736a5c110B8AF5CD3",
"OVM_ProxySequencerEntrypoint": "0x078C2dB1E331dd8A6F294cD228F5c2dB72BBf322",
"Proxy__mockOVM_ECDSAContractAccount": "0xb3ed4BCc38582C291B53d6b516F0f59E30385504",
"mockOVM_ECDSAContractAccount": "0x59B469d085255a76b6eD39D901656C04AE0585F7"
}
Deployed accounts list:
"AddressManager": "0xC3C339A6DeA7810751151de2a4129AA101698b23",
"OVM_Sequencer": "0xb2Eb7c9aB57C2187A1BB2Dec12F8B8B6d8574388",
"Deployer": "0xC7f81d6171b6a4409524b810c7E87786e0Ed0618"
Hardhat configs
Repository for our Hardhat: https://github.com/silesiacoin/hardhat
Hardhat l14-testnet
config:
module.exports = {
solidity: "0.7.3",
networks: {
hardhat: {
forking: {
url: "https://rpc.l14.lukso.network"
},
}
}
};
Known issues
Transaction gas price supplied is too low. There is another transaction with same nonce in the queue. Try increasing the gas price or incrementing the nonce.
comes from https://github.com/ethereum-optimism/contracts-v2/blob/master/bin/deploy.js
deploy script and:
- suggestion is that there is some missing async/await;
- solution is to implement manual nonce increaser - not sure because Hardhat (builder) or truffle uses
auto
there; - Also these lines https://github.com/ethereum-optimism/contracts-v2/blob/525477144ecc6fc019e0ada225b85f322c6b5fbc/src/contract-deployment/deploy.ts#L42-L47 they are not waiting the tx to be mined as ethers factory.deploy function return a "to be mined" contract if I remember correctly;
Solutions
Successfully deployed contracts to l14
network using my modifications:
https://github.com/silesiacoin/optimism-contracts-v2/tree/deployment2
Tests
Test scenarious
- ✓ should send eth_sendRawEthSignTransaction (2778ms)
- ✓ should sendTransaction (1743ms)
- ✓ gas price should be 0 (496ms)
- ✓ should estimate gas (806ms)
- ✓ should get correct chainid
- ✓ should get transaction (l2 metadata) (1759ms)
- ✓ should get block with transactions (524ms)
Test repositories
Used code repository: https://github.com/silesiacoin/optimism-integration-tests/tree/feature/l14-tests-branch
Output
Example contract call to Proxy__OVM_CanonicalTransactionChain
: https://blockscout.com/lukso/l14/tx/0x404115463f303d6205f4c08f280eb5ae295dbfd45eb0c14190b37145e5244e6f/internal-transactions
There are 5 contract calls for every test run. For example one test run is calling:
and then
- https://blockscout.com/lukso/l14/tx/0x4bbbbe19457856518b166814ea22ade2dbb6e74d83d116052d3f81970b65a6c5/internal-transactions
- https://blockscout.com/lukso/l14/tx/0x58195b2eec5dd610a11d52221da87260ca2bf1a51ad66c64bb3a52f6538461ce/internal-transactions
- https://blockscout.com/lukso/l14/tx/0x03b7e4418abf250e9f0466e21d968b163ddfe82acbc1dfc07e708aaae857cba3/internal-transactions
- https://blockscout.com/lukso/l14/tx/0xfc0c942beb0e863474f7b2b1b5523c96efdbe65f55e2765591b096150e646989/internal-transactions
There are internal transactions between contracts Proxy__OVM_CanonicalTransactionChain
and OVM_CanonicalTransactionChain
: https://blockscout.com/lukso/l14/address/0x918bc4DA93bF4D3DA00E6e10Bd8e42d00B5d0B09/internal-transactions
Internal transaction example: https://blockscout.com/lukso/l14/tx/0xfc0c942beb0e863474f7b2b1b5523c96efdbe65f55e2765591b096150e646989/internal-transactions
Known issues
During integration-tests
the batch submitter output was:
batch_submitter_1 | 2020-12-02T14:39:36.648Z error:oe:batch-submitter:init Error submitting batch {"reason":"cannot estimate gas; transaction may fail or may require manual gas limit","code":"UNPREDICTABLE_GAS_LIMIT","error":{"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32016,\"message\":\"The execution failed due to an exception.\",\"data\":\"Reverted\"},\"id\":59}\n","error":{"code":-32016,"data":"Reverted"},"requestBody":"{\"method\":\"eth_estimateGas\",\"params\":[{\"gasPrice\":\"0x3339059800\",\"from\":\"0xb2eb7c9ab57c2187a1bb2dec12f8b8b6d8574388\",\"to\":\"0x918bc4da93bf4d3da00e6e10bd8e42d00b5d0b09\",\"data\":\"0xfacdc5da0000000000000000000000000000000000000000000000000000000005f5e0ff\"}],\"id\":59,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"http://34.78.227.45:8545"},"tx":{"data":"0xfacdc5da0000000000000000000000000000000000000000000000000000000005f5e0ff","to":{},"from":"0xb2Eb7c9aB57C2187A1BB2Dec12F8B8B6d8574388","gasPrice":{},"nonce":{},"gasLimit":{},"chainId":{}}}
It's because 0x918bc4da93bf4d3da00e6e10bd8e42d00b5d0b09
is a contract address and we can't estimate gas there:
curl --location --request POST 'http://34.78.227.45:8545' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [
{
"gasPrice": "0x3339059800",
"from": "0xb2eb7c9ab57c2187a1bb2dec12f8b8b6d8574388",
"to": "0x918bc4da93bf4d3da00e6e10bd8e42d00b5d0b09"
}
],
"id": 999
}'
And the response is:
{"jsonrpc":"2.0","error":{"code":-32016,"message":"The execution failed due to an exception.","data":"Reverted"},"id":999}
Some fixes
- I've setted up the
chainId
to420
in integration tests because in theparams/config.go
there is hardcoded id (HERE).