mirror of
https://github.com/status-im/op-geth.git
synced 2025-02-15 08:17:02 +00:00
This commit squashes the op-geth fork history into a more maintainable diff for rebasing upon upstream geth. reference-optimistic-geth changes (origins of op-geth in early Bedrock development stage): - Deposit TX Type - Enable deposit tx in EVM/tx pool - Change deposit nonce to not be the max nonce - Extend PayloadAttributesV1 with a Transactions field - Force deposits at the start of each L2 block - Fix height check - noTxPool flag, reproduce block in verifier mode without tx pool interference - Fix RPC json marshalling (ref op-geth PR 4) - Deposit txs block height check in block body validation (ref op-geth PR 5) - core: do not try to reinject deposit txs into tx-pool (ref-op-geth PR 6) - deposit source hash field instead of L2 block height and tx index combination - Include invalid deposits, rewind state, but always persist mint (#10) - Provide gas to Call/Create in deposit transactions (#12) - Add docker builds (ref-op-geth PR 16, 17) - Don't panic on deposit transaction signature values or chain ID (ref-op-geth PR 18) - core: Add version to DepositTx (ref-op-geth PR 19) - Enable Geth build/lint/test in CircleCI (ref-op-geth PR 23) - core: Include guaranteed gas in the gas pool (ref-op-geth PR 21) - core: handle base fee, l1 availability fee, tx fee (ref-op-geth PR 27) - fix: deposit tx hash - fix l1 fee cache, rpc, tracing and tx pool - core: remove deposit-tx sub-type (a.k.a. deposit version byte) - eth/catalyst: allow engine user to reorg own chain - miner: restore ability to reorg deep as block builder - params: print Optimism consensus type in banner - core/types: remove unused protected() method, see upstream PR 23376 - core: do not mutate original balance value in tx pool l1 cost adjustment - core: subtract deposit gas from pool, so other txs do not use the same gas. And fail tx processing if deposits reach gas limit - core/types: deposits do not tip, avoid basefee subtraction - Unmeter the L1 Attributes Transaction - miner: handle force tx errors as critical, clean up diff - ci: Switch branch - eth,miner: return STATUS_INVALID when failing to process forced transactions in request (ref-op-geth PR 40) - verifier: forward tx to sequencer based on flag - txpool: add flag to disable tx gossip (ref-op-geth PR 42) - Add op-geth version in addition to geth version (ref-op-geth PR 43) - ci: CircleCI improvements (ref-op-geth PR 44) - Rename to op-geth - Build latest tag on optimism branch op-geth changes: - Expose cache config in simulated backend (#2) - Add EIP-1559 parameters - eth/catalyst: update payload id computation (#1) - make eip1559 configurable (#4) - post-merge network should not log warnings about missing transition information (#5) - Make the simulator more configurable (#6) - fix OPB-6 - IsDepositTx check instead of artificial nonce value check (#7) - Simulated backend - enable proof of stake consensus type and fix performance issue (#8) - accounts: simulated backend consensus engine option and immediate tx indexing - consensus/beacon: recognize all blocks as reached TTD with 0 TTD in chain config - Add --rollup.historicalhttp CLI flag and fix backend iface - Flags and interfaces for historical RPC requests (#12) - Redirect historical RPC requests (#13) - Use the pre-existing ethereum.NotFound error (#18) - Add historical endpoint to TraceBlockByNumber and TraceBlockByHash (#19) - Add historical endpoint to TraceTransaction (#20) - Add historical endpoint to TraceCall (#21) - optimism: fee params from info txi, update l1 cost func GPO params read (#15) - add hardcoded addresses for fee payouts (#23) - dynamic gas limit via engine API (#22) Co-authored-by: Matthew Slipper <me@matthewslipper.com> Co-authored-by: Joshua Gutow <jgutow@oplabs.co> Co-authored-by: protolambda <proto@protolambda.com> Co-authored-by: Mark Tyneway <mark.tyneway@gmail.com> Co-authored-by: Maurelian <maurelian@protonmail.ch>
164 lines
5.0 KiB
Go
164 lines
5.0 KiB
Go
// Copyright 2016 The go-ethereum Authors
|
|
// This file is part of go-ethereum.
|
|
//
|
|
// go-ethereum is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// go-ethereum is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"runtime"
|
|
"strconv"
|
|
"strings"
|
|
|
|
"github.com/ethereum/go-ethereum/cmd/utils"
|
|
"github.com/ethereum/go-ethereum/consensus/ethash"
|
|
"github.com/ethereum/go-ethereum/internal/version"
|
|
"github.com/ethereum/go-ethereum/params"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
var (
|
|
VersionCheckUrlFlag = &cli.StringFlag{
|
|
Name: "check.url",
|
|
Usage: "URL to use when checking vulnerabilities",
|
|
Value: "https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities.json",
|
|
}
|
|
VersionCheckVersionFlag = &cli.StringFlag{
|
|
Name: "check.version",
|
|
Usage: "Version to check",
|
|
Value: version.ClientName(clientIdentifier),
|
|
}
|
|
makecacheCommand = &cli.Command{
|
|
Action: makecache,
|
|
Name: "makecache",
|
|
Usage: "Generate ethash verification cache (for testing)",
|
|
ArgsUsage: "<blockNum> <outputDir>",
|
|
Description: `
|
|
The makecache command generates an ethash cache in <outputDir>.
|
|
|
|
This command exists to support the system testing project.
|
|
Regular users do not need to execute it.
|
|
`,
|
|
}
|
|
makedagCommand = &cli.Command{
|
|
Action: makedag,
|
|
Name: "makedag",
|
|
Usage: "Generate ethash mining DAG (for testing)",
|
|
ArgsUsage: "<blockNum> <outputDir>",
|
|
Description: `
|
|
The makedag command generates an ethash DAG in <outputDir>.
|
|
|
|
This command exists to support the system testing project.
|
|
Regular users do not need to execute it.
|
|
`,
|
|
}
|
|
versionCommand = &cli.Command{
|
|
Action: printVersion,
|
|
Name: "version",
|
|
Usage: "Print version numbers",
|
|
ArgsUsage: " ",
|
|
Description: `
|
|
The output of this command is supposed to be machine-readable.
|
|
`,
|
|
}
|
|
versionCheckCommand = &cli.Command{
|
|
Action: versionCheck,
|
|
Flags: []cli.Flag{
|
|
VersionCheckUrlFlag,
|
|
VersionCheckVersionFlag,
|
|
},
|
|
Name: "version-check",
|
|
Usage: "Checks (online) for known Geth security vulnerabilities",
|
|
ArgsUsage: "<versionstring (optional)>",
|
|
Description: `
|
|
The version-check command fetches vulnerability-information from https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities.json,
|
|
and displays information about any security vulnerabilities that affect the currently executing version.
|
|
`,
|
|
}
|
|
licenseCommand = &cli.Command{
|
|
Action: license,
|
|
Name: "license",
|
|
Usage: "Display license information",
|
|
ArgsUsage: " ",
|
|
}
|
|
)
|
|
|
|
// makecache generates an ethash verification cache into the provided folder.
|
|
func makecache(ctx *cli.Context) error {
|
|
args := ctx.Args().Slice()
|
|
if len(args) != 2 {
|
|
utils.Fatalf(`Usage: geth makecache <block number> <outputdir>`)
|
|
}
|
|
block, err := strconv.ParseUint(args[0], 0, 64)
|
|
if err != nil {
|
|
utils.Fatalf("Invalid block number: %v", err)
|
|
}
|
|
ethash.MakeCache(block, args[1])
|
|
|
|
return nil
|
|
}
|
|
|
|
// makedag generates an ethash mining DAG into the provided folder.
|
|
func makedag(ctx *cli.Context) error {
|
|
args := ctx.Args().Slice()
|
|
if len(args) != 2 {
|
|
utils.Fatalf(`Usage: geth makedag <block number> <outputdir>`)
|
|
}
|
|
block, err := strconv.ParseUint(args[0], 0, 64)
|
|
if err != nil {
|
|
utils.Fatalf("Invalid block number: %v", err)
|
|
}
|
|
ethash.MakeDataset(block, args[1])
|
|
|
|
return nil
|
|
}
|
|
|
|
func printVersion(ctx *cli.Context) error {
|
|
git, _ := version.VCS()
|
|
|
|
fmt.Println(strings.Title(clientIdentifier))
|
|
fmt.Println("Version:", params.VersionWithMeta)
|
|
if git.Commit != "" {
|
|
fmt.Println("Git Commit:", git.Commit)
|
|
}
|
|
if git.Date != "" {
|
|
fmt.Println("Git Commit Date:", git.Date)
|
|
}
|
|
fmt.Println("Upstream Version:", params.GethVersionWithMeta)
|
|
fmt.Println("Architecture:", runtime.GOARCH)
|
|
fmt.Println("Go Version:", runtime.Version())
|
|
fmt.Println("Operating System:", runtime.GOOS)
|
|
fmt.Printf("GOPATH=%s\n", os.Getenv("GOPATH"))
|
|
fmt.Printf("GOROOT=%s\n", runtime.GOROOT())
|
|
return nil
|
|
}
|
|
|
|
func license(_ *cli.Context) error {
|
|
fmt.Println(`Geth is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
Geth is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with geth. If not, see <http://www.gnu.org/licenses/>.`)
|
|
return nil
|
|
}
|