github.com/cryptotooltop/go-ethereum@v0.0.0-20231103184714-151d1922f3e5/cmd/checkpoint-admin/main.go (about) 1 // Copyright 2019 The go-ethereum Authors 2 // This file is part of go-ethereum. 3 // 4 // go-ethereum is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // go-ethereum is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. 16 17 // checkpoint-admin is a utility that can be used to query checkpoint information 18 // and register stable checkpoints into an oracle contract. 19 package main 20 21 import ( 22 "fmt" 23 "os" 24 25 "gopkg.in/urfave/cli.v1" 26 27 "github.com/scroll-tech/go-ethereum/common/fdlimit" 28 "github.com/scroll-tech/go-ethereum/internal/flags" 29 "github.com/scroll-tech/go-ethereum/log" 30 ) 31 32 var ( 33 // Git SHA1 commit hash of the release (set via linker flags) 34 gitCommit = "" 35 gitDate = "" 36 ) 37 38 var app *cli.App 39 40 func init() { 41 app = flags.NewApp(gitCommit, gitDate, "ethereum checkpoint helper tool") 42 app.Commands = []cli.Command{ 43 commandStatus, 44 commandDeploy, 45 commandSign, 46 commandPublish, 47 } 48 app.Flags = []cli.Flag{ 49 oracleFlag, 50 nodeURLFlag, 51 } 52 cli.CommandHelpTemplate = flags.OriginCommandHelpTemplate 53 } 54 55 // Commonly used command line flags. 56 var ( 57 indexFlag = cli.Int64Flag{ 58 Name: "index", 59 Usage: "Checkpoint index (query latest from remote node if not specified)", 60 } 61 hashFlag = cli.StringFlag{ 62 Name: "hash", 63 Usage: "Checkpoint hash (query latest from remote node if not specified)", 64 } 65 oracleFlag = cli.StringFlag{ 66 Name: "oracle", 67 Usage: "Checkpoint oracle address (query from remote node if not specified)", 68 } 69 thresholdFlag = cli.Int64Flag{ 70 Name: "threshold", 71 Usage: "Minimal number of signatures required to approve a checkpoint", 72 } 73 nodeURLFlag = cli.StringFlag{ 74 Name: "rpc", 75 Value: "http://localhost:8545", 76 Usage: "The rpc endpoint of a local or remote geth node", 77 } 78 clefURLFlag = cli.StringFlag{ 79 Name: "clef", 80 Value: "http://localhost:8550", 81 Usage: "The rpc endpoint of clef", 82 } 83 signerFlag = cli.StringFlag{ 84 Name: "signer", 85 Usage: "Signer address for clef signing", 86 } 87 signersFlag = cli.StringFlag{ 88 Name: "signers", 89 Usage: "Comma separated accounts of trusted checkpoint signers", 90 } 91 signaturesFlag = cli.StringFlag{ 92 Name: "signatures", 93 Usage: "Comma separated checkpoint signatures to submit", 94 } 95 ) 96 97 func main() { 98 log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true)))) 99 fdlimit.Raise(2048) 100 101 if err := app.Run(os.Args); err != nil { 102 fmt.Fprintln(os.Stderr, err) 103 os.Exit(1) 104 } 105 }