Skip to content

Commit

Permalink
Merge pull request #120 from Chomtana/main
Browse files Browse the repository at this point in the history
fix progress.sh and upgrade op-node version
  • Loading branch information
Chomtana authored Feb 1, 2024
2 parents 042bd55 + 7b8516a commit de82b8d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ Run progress.sh to estimate remaining sync time and speed.
./progress.sh
```

This will show the sync speed in blocks per minute and the time until sync is completed.

```
Chain ID: 10
Please wait
Blocks per minute: ...
Hours until sync completed: ...
```

### Grafana dashboard

Grafana is exposed at [http://localhost:3000](http://localhost:3000) and comes with one pre-loaded dashboard ("Simple Node Dashboard").
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ services:
- ${PORT__OP_GETH_WS:-9994}:8546

op-node:
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:v1.4.1
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:v1.4.3
restart: unless-stopped
stop_grace_period: 5m
entrypoint: /scripts/start-op-node.sh
Expand Down
27 changes: 18 additions & 9 deletions progress.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/usr/bin/bash

export ETH_RPC_URL=http://localhost:8545
# Load Environment Variables
if [ -f .env ]; then
export $(cat .env | grep -v '#' | sed 's/\r$//' | awk '/=/ {print $1}' )
fi

export ETH_RPC_URL=http://localhost:${PORT__OP_GETH_HTTP:-9993}
CHAIN_ID=`cast chain-id`
echo Chain ID: $CHAIN_ID
echo Please wait
Expand All @@ -19,8 +24,9 @@ if [ $CHAIN_ID -eq 11155420 ]; then
L2_URL=https://sepolia.optimism.io
fi

T0=`cast block-number --rpc-url $ETH_RPC_URL` ; sleep 60 ; T1=`cast block-number --rpc-url $ETH_RPC_URL`
T0=`cast block-number --rpc-url $ETH_RPC_URL` ; sleep 10 ; T1=`cast block-number --rpc-url $ETH_RPC_URL`
PER_MIN=`expr $T1 - $T0`
PER_MIN=`expr $PER_MIN \* 6`
echo Blocks per minute: $PER_MIN


Expand All @@ -29,19 +35,22 @@ if [ $PER_MIN -eq 0 ]; then
exit;
fi

# During that minute the head of the chain progressed by thirty blocks
PROGRESS_PER_MIN=`expr $PER_MIN - 30`
echo Progress per minute: $PROGRESS_PER_MIN


# How many more blocks do we need?
HEAD=`cast block-number --rpc-url $L2_URL`
BEHIND=`expr $HEAD - $T1`
MINUTES=`expr $BEHIND / $PROGRESS_PER_MIN`
MINUTES=`expr $BEHIND / $PER_MIN`
HOURS=`expr $MINUTES / 60`
echo Hours until sync completed: $HOURS

if [ $MINUTES -le 60 ] ; then
echo Minutes until sync completed: $MINUTES
fi

if [ $MINUTES -gt 60 ] ; then
echo Hours until sync completed: $HOURS
fi

if [ $HOURS -gt 24 ] ; then
DAYS=`expr $HOURS / 24`
echo Days until sync complete: $DAYS
fi
fi

0 comments on commit de82b8d

Please sign in to comment.