From 4b34f8b3c707f6ceacbee6afe0d061b29645ce4b Mon Sep 17 00:00:00 2001 From: Rootul P Date: Thu, 5 Sep 2024 08:29:56 -0400 Subject: [PATCH] feat(tools): more examples for blocketa and blockheight (#3842) ## Description 1. Add more examples for both tools `blockheight` and `blocketa` 2. Use the times + heights for the v2 activation height on each network --- tools/blocketa/main.go | 11 +++++++++-- tools/blockheight/main.go | 26 ++++++++++++++++++++------ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/tools/blocketa/main.go b/tools/blocketa/main.go index 54c21c66a1..7706ffd431 100644 --- a/tools/blocketa/main.go +++ b/tools/blocketa/main.go @@ -14,7 +14,7 @@ const ( // blockTime is the observed average time between blocks. You can update this // value based on the block time on https://www.mintscan.io/celestia/block/ or // the output from the blocktime tool. - blockTime = 12.05 // seconds between blocks for Mocha + blockTime = 11.75 // seconds between blocks on Mainnet Beta. // exampleArabicaRPC is an example node RPC endpoint for the Arabica testnet. exampleArabicaRPC = "https://rpc.celestia-arabica-11.com:443" @@ -22,11 +22,17 @@ const ( // exampleMochaRPC is an example node RPC endpoint for the Mocha testnet. exampleMochaRPC = "https://celestia-mocha-rpc.publicnode.com:443" + // exampleMainnetHeight is an example node RPC endpoint for Mainnet Beta. + exampleMainnetRPC = "https://celestia-rpc.publicnode.com:443" + // exampleArabicaHeight is an example block height for the Arabica testnet. exampleArabicaHeight = 1751707 // exampleMochaHeight is an example block height for the Mocha testnet. exampleMochaHeight = 2585031 + + // exampleMainnetHeight is an example block height for Mainnet Beta. + exampleMainnetHeight = 2371495 ) func main() { @@ -40,6 +46,7 @@ func Run() error { fmt.Printf("Usage: %s \n", os.Args[0]) fmt.Printf("Example: %s %s %v\n", os.Args[0], exampleArabicaRPC, exampleArabicaHeight) fmt.Printf("Example: %s %s %v\n", os.Args[0], exampleMochaRPC, exampleMochaHeight) + fmt.Printf("Example: %s %s %v\n", os.Args[0], exampleMainnetRPC, exampleMainnetHeight) return nil } @@ -65,7 +72,7 @@ func Run() error { } diffInBlockHeight := targetBlockHeight - currentHeight diffInSeconds := blockTime * float64(diffInBlockHeight) - diffInTime, err := time.ParseDuration(fmt.Sprintf("%vs", diffInSeconds)) + diffInTime, err := time.ParseDuration(fmt.Sprintf("%.0fs", diffInSeconds)) if err != nil { return err } diff --git a/tools/blockheight/main.go b/tools/blockheight/main.go index c20342aec9..e309b29b6f 100644 --- a/tools/blockheight/main.go +++ b/tools/blockheight/main.go @@ -14,13 +14,25 @@ const ( // blockTime is the observed average time between blocks. You can update this // value based on the block time on https://www.mintscan.io/celestia/block/ or // the output from the blocktime tool. - blockTime = 11.30 // seconds between blocks for Arabica + blockTime = 11.75 // seconds between blocks on Mainnet Beta. - // exampleNodeRPC is an example node RPC endpoint for the Arabica testnet. - exampleNodeRPC = "https://rpc.celestia-arabica-11.com:443" + // exampleArabicaRPC is an example node RPC endpoint for the Arabica testnet. + exampleArabicaRPC = "https://rpc.celestia-arabica-11.com:443" - // targetTime is an example target time for the block height prediction. - targetTime = "2024-08-14T14:00:00" + // exampleMochaRPC is an example node RPC endpoint for the Mocha testnet. + exampleMochaRPC = "https://celestia-mocha-rpc.publicnode.com:443" + + // exampleMainnetHeight is an example node RPC endpoint for Mainnet Beta. + exampleMainnetRPC = "https://celestia-rpc.publicnode.com:443" + + // exampleArabicaTime is an example target time for the block height prediction. + exampleArabicaTime = "2024-08-19T14:00:00" + + // exampleMochaTime is an example target time for the block height prediction. + exampleMochaTime = "2024-08-28T14:00:00" + + // exampleMainnetTime is an example target time for the block height prediction. + exampleMainnetTime = "2024-09-18T14:00:00" // layout is the expected time format for targetTime. layout = "2006-01-02T15:04:05" @@ -35,7 +47,9 @@ func main() { func Run() error { if len(os.Args) < 3 { fmt.Printf("Usage: %s \n", os.Args[0]) - fmt.Printf("Example: %s %s %s\n", os.Args[0], exampleNodeRPC, targetTime) + fmt.Printf("Example: %s %s %s\n", os.Args[0], exampleArabicaRPC, exampleArabicaTime) + fmt.Printf("Example: %s %s %s\n", os.Args[0], exampleMochaRPC, exampleMochaTime) + fmt.Printf("Example: %s %s %s\n", os.Args[0], exampleMainnetRPC, exampleMainnetTime) return nil }