Closed smartcontracts closed 2 years ago
Thanks! Useful feedback. I still need to properly test this. Had to get on a plane half way through writing this PR.
Gonna give this a run on a VM, will let you know how it pans out!
So I am doing this on a fresh Ubuntu VM with Docker installed. To confirm what @PierrickGT mentioned in his comment, I also had to make those changes he recommended (after which the L2 sync works 👍 ). If you don't do that you would notice these kind of logs from the dtl service:
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242700,"msg":"Service is starting..."}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242700,"msg":"Service is initializing..."}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242701,"msg":"Initializing L1 Data Transport Service..."}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242710,"msg":"L2 chain ID is: 10"}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242710,"msg":"BSS HF1 will activate at: 2824317"}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242715,"msg":"Service is initializing..."}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242718,"defaultBackend":"l1","l1GasPriceBackend":"l1","msg":"HTTP Server Options"}
simple-optimism-node-dtl-1 | {"level":40,"time":1669154242718,"msg":"HTTP Server L1 RPC Provider not initialized"}
simple-optimism-node-dtl-1 | {"level":40,"time":1669154242719,"msg":"HTTP Server L2 RPC Provider not initialized"}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242719,"msg":"Service has initialized."}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242719,"msg":"Service is initializing..."}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242719,"msg":"Service has initialized."}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242719,"msg":"Service has initialized."}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242719,"msg":"Service is starting..."}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242719,"msg":"Service is starting..."}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242721,"host":"0.0.0.0","port":7878,"msg":"Server started and listening"}
simple-optimism-node-dtl-1 | {"level":30,"time":1669154242721,"msg":"Cannot connect to L2, retrying 1/20"}
So basically, just make these changes along with the PR updates and you should be good:
In the .env
file:
SYNC_SOURCE
value to l2
DATA_TRANSPORT_LAYER__RPC_ENDPOINT
to an Alchemy Optimism endpoint.DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT
and DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT
and set their value to the same Alchemy Optimism endpoint mentioned above.DATA_TRANSPORT_LAYER__DEFAULT_BACKEND
to l2
.DATA_TRANSPORT_LAYER__L1_GAS_PRICE_BACKEND
to l2
.Think maybe adding this to the dtl-start.sh
script would fix the issue:
if [ $SYNC_SOURCE == "l2" ]; then
DATA_TRANSPORT_LAYER__SYNC_FROM_L1=false
DATA_TRANSPORT_LAYER__SYNC_FROM_L2=true
DATA_TRANSPORT_LAYER__DEFAULT_BACKEND=l2
DATA_TRANSPORT_LAYER__L1_GAS_PRICE_BACKEND=l2
fi
Then you don't even need to remove the DTL default backend and gas price backend from the dtl.env
file
Will try it out now
Let me know if it works!
@smartcontracts just ran it now on another machine and it works :)
Basically what I did was:
1) Left the dtl.env
untouched (didn't remove the fields as done in the PR)
2) Changed the dtl-start.sh
file to look like this:
#!/bin/sh
set -eou
# Setting both endpoints doesn't hurt
DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT=$DATA_TRANSPORT_LAYER__RPC_ENDPOINT
DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT=$DATA_TRANSPORT_LAYER__RPC_ENDPOINT
# Also tell the DTL to sync from the right place
if [ $SYNC_SOURCE == "l2" ]; then
DATA_TRANSPORT_LAYER__SYNC_FROM_L1=false
DATA_TRANSPORT_LAYER__SYNC_FROM_L2=true
DATA_TRANSPORT_LAYER__DEFAULT_BACKEND=l2
DATA_TRANSPORT_LAYER__L1_GAS_PRICE_BACKEND=l2
fi
# Run the DTL
exec node \
dist/src/services/run.js \
$@
Just some extra .env
info:
SYNC_SOURCE
set to l2
DATA_TRANSPORT_LAYER__RPC_ENDPOINT
set to Alchemy Optimism URLHEALTH_CHECK__REFERENCE_RPC_PROVIDER
set to Alchemy Optimism URLFAULT_DETECTOR__L1_RPC_PROVIDER
set to http://localhost:8545
(my own L1 full node)DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT
set to Alchemy Optimism URLDATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT
set to http://localhost:8545
(my own L1 full node) @smartcontracts This may be out of scope here, but I had to change my L1_RPC endpoint from my Ethereum full node running on my machine to an Alchemy endpoint because I kept getting this error from l2geth -> Fatal: No genesis block configured.
Looks like I just needed to add the export
keyword
Thanks for all the help here everyone! I think everything should be syncing ok now.
finnaly working thank you
I've managed to get this branch running but I feel like the
/scripts/dtl-start.sh
script is not working as intended. It may be because I didn't start with a fresh install but I had to declare the following variables in my.env
file to be able to sync from L2.Hope it helps.