diff --git a/accounts/abi/bind/auth.go b/accounts/abi/bind/auth.go index a4307a9529..494dc88a57 100644 --- a/accounts/abi/bind/auth.go +++ b/accounts/abi/bind/auth.go @@ -21,7 +21,6 @@ import ( "crypto/ecdsa" "errors" "io" - "io/ioutil" "math/big" "github.com/ethereum/go-ethereum/accounts" @@ -45,7 +44,7 @@ var ErrNotAuthorized = errors.New("not authorized to sign this account") // Deprecated: Use NewTransactorWithChainID instead. func NewTransactor(keyin io.Reader, passphrase string) (*TransactOpts, error) { log.Warn("WARNING: NewTransactor has been deprecated in favour of NewTransactorWithChainID") - json, err := ioutil.ReadAll(keyin) + json, err := io.ReadAll(keyin) if err != nil { return nil, err } @@ -106,7 +105,7 @@ func NewKeyedTransactor(key *ecdsa.PrivateKey) *TransactOpts { // NewTransactorWithChainID is a utility method to easily create a transaction signer from // an encrypted json key stream and the associated passphrase. func NewTransactorWithChainID(keyin io.Reader, passphrase string, chainID *big.Int) (*TransactOpts, error) { - json, err := ioutil.ReadAll(keyin) + json, err := io.ReadAll(keyin) if err != nil { return nil, err } diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index f8ceec8838..2fead709b3 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -885,6 +885,10 @@ func (fb *filterBackend) SubscribePendingLogsEvent(ch chan<- []*types.Log) event return nullSubscription() } +func (fb *filterBackend) SkipBloomFilter(num *big.Int) bool { + return false +} + func (fb *filterBackend) BloomStatus() (uint64, uint64) { return 4096, 0 } func (fb *filterBackend) ServiceFilter(ctx context.Context, ms *bloombits.MatcherSession) { diff --git a/accounts/abi/bind/bind_test.go b/accounts/abi/bind/bind_test.go index 5e3d0fccfe..4a7beb6510 100644 --- a/accounts/abi/bind/bind_test.go +++ b/accounts/abi/bind/bind_test.go @@ -18,7 +18,6 @@ package bind import ( "fmt" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -2051,7 +2050,7 @@ func TestGolangBindings(t *testing.T) { t.Skip("go sdk not found for testing") } // Create a temporary workspace for the test suite - ws, err := ioutil.TempDir("", "binding-test") + ws, err := os.MkdirTemp("", "binding-test") if err != nil { t.Fatalf("failed to create temporary workspace: %v", err) } @@ -2075,7 +2074,7 @@ func TestGolangBindings(t *testing.T) { if err != nil { t.Fatalf("test %d: failed to generate binding: %v", i, err) } - if err = ioutil.WriteFile(filepath.Join(pkg, strings.ToLower(tt.name)+".go"), []byte(bind), 0600); err != nil { + if err = os.WriteFile(filepath.Join(pkg, strings.ToLower(tt.name)+".go"), []byte(bind), 0600); err != nil { t.Fatalf("test %d: failed to write binding: %v", i, err) } // Generate the test file with the injected test code @@ -2091,7 +2090,7 @@ func TestGolangBindings(t *testing.T) { %s } `, tt.imports, tt.name, tt.tester) - if err := ioutil.WriteFile(filepath.Join(pkg, strings.ToLower(tt.name)+"_test.go"), []byte(code), 0600); err != nil { + if err := os.WriteFile(filepath.Join(pkg, strings.ToLower(tt.name)+"_test.go"), []byte(code), 0600); err != nil { t.Fatalf("test %d: failed to write tests: %v", i, err) } }) diff --git a/accounts/keystore/account_cache_test.go b/accounts/keystore/account_cache_test.go index a847545bc8..411f2c08eb 100644 --- a/accounts/keystore/account_cache_test.go +++ b/accounts/keystore/account_cache_test.go @@ -18,7 +18,6 @@ package keystore import ( "fmt" - "io/ioutil" "math/rand" "os" "path/filepath" @@ -381,11 +380,11 @@ func TestUpdatedKeyfileContents(t *testing.T) { return } - // needed so that modTime of `file` is different to its current value after ioutil.WriteFile + // needed so that modTime of `file` is different to its current value after os.WriteFile time.Sleep(1000 * time.Millisecond) // Now replace file contents with crap - if err := ioutil.WriteFile(file, []byte("foo"), 0644); err != nil { + if err := os.WriteFile(file, []byte("foo"), 0644); err != nil { t.Fatal(err) return } @@ -398,9 +397,9 @@ func TestUpdatedKeyfileContents(t *testing.T) { // forceCopyFile is like cp.CopyFile, but doesn't complain if the destination exists. func forceCopyFile(dst, src string) error { - data, err := ioutil.ReadFile(src) + data, err := os.ReadFile(src) if err != nil { return err } - return ioutil.WriteFile(dst, data, 0644) + return os.WriteFile(dst, data, 0644) } diff --git a/accounts/keystore/file_cache.go b/accounts/keystore/file_cache.go index 8b309321d3..55a63df991 100644 --- a/accounts/keystore/file_cache.go +++ b/accounts/keystore/file_cache.go @@ -17,7 +17,6 @@ package keystore import ( - "io/ioutil" "os" "path/filepath" "strings" @@ -41,7 +40,7 @@ func (fc *fileCache) scan(keyDir string) (mapset.Set, mapset.Set, mapset.Set, er t0 := time.Now() // List all the failes from the keystore folder - files, err := ioutil.ReadDir(keyDir) + files, err := os.ReadDir(keyDir) if err != nil { return nil, nil, nil, err } @@ -55,7 +54,12 @@ func (fc *fileCache) scan(keyDir string) (mapset.Set, mapset.Set, mapset.Set, er mods := mapset.NewThreadUnsafeSet() var newLastMod time.Time - for _, fi := range files { + for _, f := range files { + fi, err := f.Info() + if err != nil { + return nil, nil, nil, err + } + path := filepath.Join(keyDir, fi.Name()) // Skip any non-key files from the folder if nonKeyFile(fi) { diff --git a/accounts/keystore/key.go b/accounts/keystore/key.go index 2b815ce0f9..9b2ac14712 100644 --- a/accounts/keystore/key.go +++ b/accounts/keystore/key.go @@ -23,7 +23,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -197,7 +196,7 @@ func writeTemporaryKeyFile(file string, content []byte) (string, error) { } // Atomic write: create a temporary hidden file first // then move it into place. TempFile assigns mode 0600. - f, err := ioutil.TempFile(filepath.Dir(file), "."+filepath.Base(file)+".tmp") + f, err := os.CreateTemp(filepath.Dir(file), "."+filepath.Base(file)+".tmp") if err != nil { return "", err } diff --git a/accounts/keystore/keystore_test.go b/accounts/keystore/keystore_test.go index cb5de11c0d..3b85e24132 100644 --- a/accounts/keystore/keystore_test.go +++ b/accounts/keystore/keystore_test.go @@ -17,7 +17,6 @@ package keystore import ( - "io/ioutil" "math/rand" "os" "runtime" @@ -462,7 +461,7 @@ func checkEvents(t *testing.T, want []walletEvent, have []walletEvent) { } func tmpKeyStore(t *testing.T, encrypted bool) (string, *KeyStore) { - d, err := ioutil.TempDir("", "eth-keystore-test") + d, err := os.MkdirTemp("", "eth-keystore-test") if err != nil { t.Fatal(err) } diff --git a/accounts/keystore/passphrase.go b/accounts/keystore/passphrase.go index 3b3e631888..22772e9310 100644 --- a/accounts/keystore/passphrase.go +++ b/accounts/keystore/passphrase.go @@ -34,7 +34,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "os" "path/filepath" @@ -82,7 +81,7 @@ type keyStorePassphrase struct { func (ks keyStorePassphrase) GetKey(addr common.Address, filename, auth string) (*Key, error) { // Load the key from the keystore and decrypt its contents - keyjson, err := ioutil.ReadFile(filename) + keyjson, err := os.ReadFile(filename) if err != nil { return nil, err } diff --git a/accounts/keystore/passphrase_test.go b/accounts/keystore/passphrase_test.go index 630682cebd..b94fce8edc 100644 --- a/accounts/keystore/passphrase_test.go +++ b/accounts/keystore/passphrase_test.go @@ -17,7 +17,7 @@ package keystore import ( - "io/ioutil" + "os" "testing" "github.com/ethereum/go-ethereum/common" @@ -30,7 +30,7 @@ const ( // Tests that a json key file can be decrypted and encrypted in multiple rounds. func TestKeyEncryptDecrypt(t *testing.T) { - keyjson, err := ioutil.ReadFile("testdata/very-light-scrypt.json") + keyjson, err := os.ReadFile("testdata/very-light-scrypt.json") if err != nil { t.Fatal(err) } diff --git a/accounts/keystore/plain_test.go b/accounts/keystore/plain_test.go index b831925838..d9a7eda926 100644 --- a/accounts/keystore/plain_test.go +++ b/accounts/keystore/plain_test.go @@ -20,7 +20,6 @@ import ( "crypto/rand" "encoding/hex" "fmt" - "io/ioutil" "os" "path/filepath" "reflect" @@ -32,7 +31,7 @@ import ( ) func tmpKeyStoreIface(t *testing.T, encrypted bool) (dir string, ks keyStore) { - d, err := ioutil.TempDir("", "geth-keystore-test") + d, err := os.MkdirTemp("", "geth-keystore-test") if err != nil { t.Fatal(err) } diff --git a/accounts/scwallet/hub.go b/accounts/scwallet/hub.go index 811f8c695e..f9dcf58e19 100644 --- a/accounts/scwallet/hub.go +++ b/accounts/scwallet/hub.go @@ -34,7 +34,7 @@ package scwallet import ( "encoding/json" - "io/ioutil" + "io" "os" "path/filepath" "sort" @@ -96,7 +96,7 @@ func (hub *Hub) readPairings() error { return err } - pairingData, err := ioutil.ReadAll(pairingFile) + pairingData, err := io.ReadAll(pairingFile) if err != nil { return err } diff --git a/build/ci.go b/build/ci.go index bdf195c512..7eca628c42 100644 --- a/build/ci.go +++ b/build/ci.go @@ -24,19 +24,18 @@ Usage: go run build/ci.go Available commands are: - install [ -arch architecture ] [ -cc compiler ] [ packages... ] -- builds packages and executables - test [ -coverage ] [ packages... ] -- runs the tests - lint -- runs certain pre-selected linters - archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ] -- archives build artifacts - importkeys -- imports signing keys from env - debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package - nsis -- creates a Windows NSIS installer - aar [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an Android archive - xcode [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an iOS XCode framework - purge [ -store blobstore ] [ -days threshold ] -- purges old archives from the blobstore + install [ -arch architecture ] [ -cc compiler ] [ packages... ] -- builds packages and executables + test [ -coverage ] [ packages... ] -- runs the tests + lint -- runs certain pre-selected linters + archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ] -- archives build artifacts + importkeys -- imports signing keys from env + debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package + nsis -- creates a Windows NSIS installer + aar [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an Android archive + xcode [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an iOS XCode framework + purge [ -store blobstore ] [ -days threshold ] -- purges old archives from the blobstore For all commands, -n prevents execution of external programs (dry run mode). - */ package main @@ -46,7 +45,6 @@ import ( "encoding/base64" "flag" "fmt" - "io/ioutil" "log" "os" "os/exec" @@ -754,7 +752,7 @@ func ppaUpload(workdir, ppa, sshUser string, files []string) { if sshkey := getenvBase64("PPA_SSH_KEY"); len(sshkey) > 0 { idfile = filepath.Join(workdir, "sshkey") if _, err := os.Stat(idfile); os.IsNotExist(err) { - ioutil.WriteFile(idfile, sshkey, 0600) + os.WriteFile(idfile, sshkey, 0600) } } // Upload @@ -777,7 +775,7 @@ func makeWorkdir(wdflag string) string { if wdflag != "" { err = os.MkdirAll(wdflag, 0744) } else { - wdflag, err = ioutil.TempDir("", "geth-build-") + wdflag, err = os.MkdirTemp("", "geth-build-") } if err != nil { log.Fatal(err) diff --git a/build/update-license.go b/build/update-license.go index aa4d6100d7..f99f223d4f 100644 --- a/build/update-license.go +++ b/build/update-license.go @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . +//go:build none // +build none /* @@ -39,7 +40,6 @@ import ( "bufio" "bytes" "fmt" - "io/ioutil" "log" "os" "os/exec" @@ -241,7 +241,7 @@ func gitAuthors(files []string) []string { } func readAuthors() []string { - content, err := ioutil.ReadFile("AUTHORS") + content, err := os.ReadFile("AUTHORS") if err != nil && !os.IsNotExist(err) { log.Fatalln("error reading AUTHORS:", err) } @@ -305,7 +305,7 @@ func writeAuthors(files []string) { content.WriteString("\n") } fmt.Println("writing AUTHORS") - if err := ioutil.WriteFile("AUTHORS", content.Bytes(), 0644); err != nil { + if err := os.WriteFile("AUTHORS", content.Bytes(), 0644); err != nil { log.Fatalln(err) } } @@ -381,7 +381,7 @@ func writeLicense(info *info) { if err != nil { log.Fatalf("error stat'ing %s: %v\n", info.file, err) } - content, err := ioutil.ReadFile(info.file) + content, err := os.ReadFile(info.file) if err != nil { log.Fatalf("error reading %s: %v\n", info.file, err) } @@ -400,7 +400,7 @@ func writeLicense(info *info) { return } fmt.Println("writing", info.ShortLicense(), info.file) - if err := ioutil.WriteFile(info.file, buf.Bytes(), fi.Mode()); err != nil { + if err := os.WriteFile(info.file, buf.Bytes(), fi.Mode()); err != nil { log.Fatalf("error writing %s: %v", info.file, err) } } diff --git a/cmd/abigen/main.go b/cmd/abigen/main.go index 9547101eff..eda740b006 100644 --- a/cmd/abigen/main.go +++ b/cmd/abigen/main.go @@ -19,7 +19,7 @@ package main import ( "encoding/json" "fmt" - "io/ioutil" + "io" "os" "path/filepath" "regexp" @@ -155,9 +155,9 @@ func abigen(c *cli.Context) error { ) input := c.GlobalString(abiFlag.Name) if input == "-" { - abi, err = ioutil.ReadAll(os.Stdin) + abi, err = io.ReadAll(os.Stdin) } else { - abi, err = ioutil.ReadFile(input) + abi, err = os.ReadFile(input) } if err != nil { utils.Fatalf("Failed to read input ABI: %v", err) @@ -166,7 +166,7 @@ func abigen(c *cli.Context) error { var bin []byte if binFile := c.GlobalString(binFlag.Name); binFile != "" { - if bin, err = ioutil.ReadFile(binFile); err != nil { + if bin, err = os.ReadFile(binFile); err != nil { utils.Fatalf("Failed to read input bytecode: %v", err) } if strings.Contains(string(bin), "//") { @@ -213,7 +213,7 @@ func abigen(c *cli.Context) error { } case c.GlobalIsSet(jsonFlag.Name): - jsonOutput, err := ioutil.ReadFile(c.GlobalString(jsonFlag.Name)) + jsonOutput, err := os.ReadFile(c.GlobalString(jsonFlag.Name)) if err != nil { utils.Fatalf("Failed to read combined-json from compiler: %v", err) } @@ -267,7 +267,7 @@ func abigen(c *cli.Context) error { fmt.Printf("%s\n", code) return nil } - if err := ioutil.WriteFile(c.GlobalString(outFlag.Name), []byte(code), 0600); err != nil { + if err := os.WriteFile(c.GlobalString(outFlag.Name), []byte(code), 0600); err != nil { utils.Fatalf("Failed to write ABI binding: %v", err) } return nil diff --git a/cmd/clef/main.go b/cmd/clef/main.go index 3aaf898db2..52845ad2ca 100644 --- a/cmd/clef/main.go +++ b/cmd/clef/main.go @@ -25,7 +25,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "math/big" "os" "os/signal" @@ -374,7 +373,7 @@ func initializeSecrets(c *cli.Context) error { return fmt.Errorf("master key %v already exists, will not overwrite", location) } // Write the file and print the usual warning message - if err = ioutil.WriteFile(location, cipherSeed, 0400); err != nil { + if err = os.WriteFile(location, cipherSeed, 0400); err != nil { return err } fmt.Printf("A master seed has been generated into %s\n", location) @@ -593,7 +592,7 @@ func signer(c *cli.Context) error { // Do we have a rule-file? if ruleFile := c.GlobalString(ruleFlag.Name); ruleFile != "" { - ruleJS, err := ioutil.ReadFile(ruleFile) + ruleJS, err := os.ReadFile(ruleFile) if err != nil { log.Warn("Could not load rules, disabling", "file", ruleFile, "err", err) } else { @@ -751,7 +750,7 @@ func readMasterKey(ctx *cli.Context, ui core.UIClientAPI) ([]byte, error) { if err := checkFile(file); err != nil { return nil, err } - cipherKey, err := ioutil.ReadFile(file) + cipherKey, err := os.ReadFile(file) if err != nil { return nil, err } diff --git a/cmd/devp2p/dnscmd.go b/cmd/devp2p/dnscmd.go index 85f28b8cb1..afdc614f0e 100644 --- a/cmd/devp2p/dnscmd.go +++ b/cmd/devp2p/dnscmd.go @@ -20,7 +20,6 @@ import ( "crypto/ecdsa" "encoding/json" "fmt" - "io/ioutil" "os" "path/filepath" "time" @@ -253,7 +252,7 @@ func dnsNukeRoute53(ctx *cli.Context) error { // loadSigningKey loads a private key in Ethereum keystore format. func loadSigningKey(keyfile string) *ecdsa.PrivateKey { - keyjson, err := ioutil.ReadFile(keyfile) + keyjson, err := os.ReadFile(keyfile) if err != nil { exit(fmt.Errorf("failed to read the keyfile at '%s': %v", keyfile, err)) } @@ -382,7 +381,7 @@ func writeTreeMetadata(directory string, def *dnsDefinition) { exit(err) } metaFile, _ := treeDefinitionFiles(directory) - if err := ioutil.WriteFile(metaFile, metaJSON, 0644); err != nil { + if err := os.WriteFile(metaFile, metaJSON, 0644); err != nil { exit(err) } } @@ -411,7 +410,7 @@ func writeTXTJSON(file string, txt map[string]string) { fmt.Println() return } - if err := ioutil.WriteFile(file, txtJSON, 0644); err != nil { + if err := os.WriteFile(file, txtJSON, 0644); err != nil { exit(err) } } diff --git a/cmd/devp2p/enrcmd.go b/cmd/devp2p/enrcmd.go index 48ede616ee..fa1239d93f 100644 --- a/cmd/devp2p/enrcmd.go +++ b/cmd/devp2p/enrcmd.go @@ -22,7 +22,6 @@ import ( "encoding/hex" "fmt" "io" - "io/ioutil" "net" "os" "strconv" @@ -52,9 +51,9 @@ func enrdump(ctx *cli.Context) error { var b []byte var err error if file == "-" { - b, err = ioutil.ReadAll(os.Stdin) + b, err = io.ReadAll(os.Stdin) } else { - b, err = ioutil.ReadFile(file) + b, err = os.ReadFile(file) } if err != nil { return err diff --git a/cmd/devp2p/internal/ethtest/chain.go b/cmd/devp2p/internal/ethtest/chain.go index f283154c8c..ff550a9ce1 100644 --- a/cmd/devp2p/internal/ethtest/chain.go +++ b/cmd/devp2p/internal/ethtest/chain.go @@ -21,7 +21,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "math/big" "os" "strings" @@ -153,7 +152,7 @@ func loadChain(chainfile string, genesis string) (*Chain, error) { } func loadGenesis(genesisFile string) (core.Genesis, error) { - chainConfig, err := ioutil.ReadFile(genesisFile) + chainConfig, err := os.ReadFile(genesisFile) if err != nil { return core.Genesis{}, err } diff --git a/cmd/devp2p/nodeset.go b/cmd/devp2p/nodeset.go index 1d78e34c73..33c39f4b9e 100644 --- a/cmd/devp2p/nodeset.go +++ b/cmd/devp2p/nodeset.go @@ -20,7 +20,6 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" "os" "sort" "time" @@ -66,7 +65,7 @@ func writeNodesJSON(file string, nodes nodeSet) { os.Stdout.Write(nodesJSON) return } - if err := ioutil.WriteFile(file, nodesJSON, 0644); err != nil { + if err := os.WriteFile(file, nodesJSON, 0644); err != nil { exit(err) } } diff --git a/cmd/ethkey/changepassword.go b/cmd/ethkey/changepassword.go index b9402c2f96..bd8745f6db 100644 --- a/cmd/ethkey/changepassword.go +++ b/cmd/ethkey/changepassword.go @@ -18,7 +18,7 @@ package main import ( "fmt" - "io/ioutil" + "os" "strings" "github.com/ethereum/go-ethereum/accounts/keystore" @@ -45,7 +45,7 @@ Change the password of a keyfile.`, keyfilepath := ctx.Args().First() // Read key from file. - keyjson, err := ioutil.ReadFile(keyfilepath) + keyjson, err := os.ReadFile(keyfilepath) if err != nil { utils.Fatalf("Failed to read the keyfile at '%s': %v", keyfilepath, err) } @@ -61,7 +61,7 @@ Change the password of a keyfile.`, fmt.Println("Please provide a new password") var newPhrase string if passFile := ctx.String(newPassphraseFlag.Name); passFile != "" { - content, err := ioutil.ReadFile(passFile) + content, err := os.ReadFile(passFile) if err != nil { utils.Fatalf("Failed to read new password file '%s': %v", passFile, err) } @@ -77,7 +77,7 @@ Change the password of a keyfile.`, } // Then write the new keyfile in place of the old one. - if err := ioutil.WriteFile(keyfilepath, newJson, 0600); err != nil { + if err := os.WriteFile(keyfilepath, newJson, 0600); err != nil { utils.Fatalf("Error writing new keyfile to disk: %v", err) } diff --git a/cmd/ethkey/generate.go b/cmd/ethkey/generate.go index 629d23da5b..71dd9eb62f 100644 --- a/cmd/ethkey/generate.go +++ b/cmd/ethkey/generate.go @@ -19,7 +19,6 @@ package main import ( "crypto/ecdsa" "fmt" - "io/ioutil" "os" "path/filepath" @@ -111,7 +110,7 @@ If you want to encrypt an existing private key, it can be specified by setting if err := os.MkdirAll(filepath.Dir(keyfilepath), 0700); err != nil { utils.Fatalf("Could not create directory %s", filepath.Dir(keyfilepath)) } - if err := ioutil.WriteFile(keyfilepath, keyjson, 0600); err != nil { + if err := os.WriteFile(keyfilepath, keyjson, 0600); err != nil { utils.Fatalf("Failed to write keyfile to %s: %v", keyfilepath, err) } diff --git a/cmd/ethkey/inspect.go b/cmd/ethkey/inspect.go index b646e43aa5..6a21808d48 100644 --- a/cmd/ethkey/inspect.go +++ b/cmd/ethkey/inspect.go @@ -19,7 +19,7 @@ package main import ( "encoding/hex" "fmt" - "io/ioutil" + "os" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/cmd/utils" @@ -54,7 +54,7 @@ make sure to use this feature with great caution!`, keyfilepath := ctx.Args().First() // Read key from file. - keyjson, err := ioutil.ReadFile(keyfilepath) + keyjson, err := os.ReadFile(keyfilepath) if err != nil { utils.Fatalf("Failed to read the keyfile at '%s': %v", keyfilepath, err) } diff --git a/cmd/ethkey/message.go b/cmd/ethkey/message.go index fbd80d6e6d..1371943869 100644 --- a/cmd/ethkey/message.go +++ b/cmd/ethkey/message.go @@ -19,7 +19,7 @@ package main import ( "encoding/hex" "fmt" - "io/ioutil" + "os" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/keystore" @@ -57,7 +57,7 @@ To sign a message contained in a file, use the --msgfile flag. // Load the keyfile. keyfilepath := ctx.Args().First() - keyjson, err := ioutil.ReadFile(keyfilepath) + keyjson, err := os.ReadFile(keyfilepath) if err != nil { utils.Fatalf("Failed to read the keyfile at '%s': %v", keyfilepath, err) } @@ -147,7 +147,7 @@ func getMessage(ctx *cli.Context, msgarg int) []byte { if len(ctx.Args()) > msgarg { utils.Fatalf("Can't use --msgfile and message argument at the same time.") } - msg, err := ioutil.ReadFile(file) + msg, err := os.ReadFile(file) if err != nil { utils.Fatalf("Can't read message file: %v", err) } diff --git a/cmd/ethkey/message_test.go b/cmd/ethkey/message_test.go index 9d242ac002..aa077931ff 100644 --- a/cmd/ethkey/message_test.go +++ b/cmd/ethkey/message_test.go @@ -17,14 +17,13 @@ package main import ( - "io/ioutil" "os" "path/filepath" "testing" ) func TestMessageSignVerify(t *testing.T) { - tmpdir, err := ioutil.TempDir("", "ethkey-test") + tmpdir, err := os.MkdirTemp("", "ethkey-test") if err != nil { t.Fatal("Can't create temporary directory:", err) } diff --git a/cmd/ethkey/utils.go b/cmd/ethkey/utils.go index f5e87f922e..ed492272e3 100644 --- a/cmd/ethkey/utils.go +++ b/cmd/ethkey/utils.go @@ -19,7 +19,7 @@ package main import ( "encoding/json" "fmt" - "io/ioutil" + "os" "strings" "github.com/ethereum/go-ethereum/cmd/utils" @@ -33,7 +33,7 @@ func getPassphrase(ctx *cli.Context, confirmation bool) string { // Look for the --passwordfile flag. passphraseFile := ctx.String(passphraseFlag.Name) if passphraseFile != "" { - content, err := ioutil.ReadFile(passphraseFile) + content, err := os.ReadFile(passphraseFile) if err != nil { utils.Fatalf("Failed to read password file '%s': %v", passphraseFile, err) diff --git a/cmd/evm/compiler.go b/cmd/evm/compiler.go index 40ad9313c5..880f995f05 100644 --- a/cmd/evm/compiler.go +++ b/cmd/evm/compiler.go @@ -19,7 +19,7 @@ package main import ( "errors" "fmt" - "io/ioutil" + "os" "github.com/ethereum/go-ethereum/cmd/evm/internal/compiler" @@ -41,7 +41,7 @@ func compileCmd(ctx *cli.Context) error { } fn := ctx.Args().First() - src, err := ioutil.ReadFile(fn) + src, err := os.ReadFile(fn) if err != nil { return err } diff --git a/cmd/evm/disasm.go b/cmd/evm/disasm.go index f9719497fe..918b013767 100644 --- a/cmd/evm/disasm.go +++ b/cmd/evm/disasm.go @@ -19,7 +19,7 @@ package main import ( "errors" "fmt" - "io/ioutil" + "os" "strings" "github.com/ethereum/go-ethereum/core/asm" @@ -38,7 +38,7 @@ func disasmCmd(ctx *cli.Context) error { switch { case len(ctx.Args().First()) > 0: fn := ctx.Args().First() - input, err := ioutil.ReadFile(fn) + input, err := os.ReadFile(fn) if err != nil { return err } diff --git a/cmd/evm/internal/t8ntool/transition.go b/cmd/evm/internal/t8ntool/transition.go index 33f5c4a79b..6c71c04ad6 100644 --- a/cmd/evm/internal/t8ntool/transition.go +++ b/cmd/evm/internal/t8ntool/transition.go @@ -21,7 +21,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "math/big" "os" "path" @@ -393,7 +392,7 @@ func saveFile(baseDir, filename string, data interface{}) error { return NewError(ErrorJson, fmt.Errorf("failed marshalling output: %v", err)) } location := path.Join(baseDir, filename) - if err = ioutil.WriteFile(location, b, 0644); err != nil { + if err = os.WriteFile(location, b, 0644); err != nil { return NewError(ErrorIO, fmt.Errorf("failed writing output: %v", err)) } log.Info("Wrote file", "file", location) diff --git a/cmd/evm/runner.go b/cmd/evm/runner.go index d57602f8d5..952584b45d 100644 --- a/cmd/evm/runner.go +++ b/cmd/evm/runner.go @@ -20,7 +20,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "io" "math/big" "os" goruntime "runtime" @@ -165,13 +165,13 @@ func runCmd(ctx *cli.Context) error { // If - is specified, it means that code comes from stdin if codeFileFlag == "-" { //Try reading from stdin - if hexcode, err = ioutil.ReadAll(os.Stdin); err != nil { + if hexcode, err = io.ReadAll(os.Stdin); err != nil { fmt.Printf("Could not load code from stdin: %v\n", err) os.Exit(1) } } else { // Codefile with hex assembly - if hexcode, err = ioutil.ReadFile(codeFileFlag); err != nil { + if hexcode, err = os.ReadFile(codeFileFlag); err != nil { fmt.Printf("Could not load code from file: %v\n", err) os.Exit(1) } @@ -187,7 +187,7 @@ func runCmd(ctx *cli.Context) error { code = common.FromHex(string(hexcode)) } else if fn := ctx.Args().First(); len(fn) > 0 { // EASM-file to compile - src, err := ioutil.ReadFile(fn) + src, err := os.ReadFile(fn) if err != nil { return err } @@ -239,7 +239,7 @@ func runCmd(ctx *cli.Context) error { var hexInput []byte if inputFileFlag := ctx.GlobalString(InputFileFlag.Name); inputFileFlag != "" { var err error - if hexInput, err = ioutil.ReadFile(inputFileFlag); err != nil { + if hexInput, err = os.ReadFile(inputFileFlag); err != nil { fmt.Printf("could not load input from file: %v\n", err) os.Exit(1) } diff --git a/cmd/evm/staterunner.go b/cmd/evm/staterunner.go index 6ffc2f51ca..f1398c17c7 100644 --- a/cmd/evm/staterunner.go +++ b/cmd/evm/staterunner.go @@ -20,7 +20,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "os" "github.com/ethereum/go-ethereum/core/state" @@ -81,7 +80,7 @@ func stateTestCmd(ctx *cli.Context) error { debugger = logger.NewStructLogger(config) } // Load the test content from the input file - src, err := ioutil.ReadFile(ctx.Args().First()) + src, err := os.ReadFile(ctx.Args().First()) if err != nil { return err } diff --git a/cmd/faucet/faucet.go b/cmd/faucet/faucet.go index 639be86159..60b7214fd8 100644 --- a/cmd/faucet/faucet.go +++ b/cmd/faucet/faucet.go @@ -28,7 +28,7 @@ import ( "flag" "fmt" "html/template" - "io/ioutil" + "io" "math" "math/big" "net/http" @@ -184,14 +184,14 @@ func main() { } } // Load up the account key and decrypt its password - blob, err := ioutil.ReadFile(*accPassFlag) + blob, err := os.ReadFile(*accPassFlag) if err != nil { log.Crit("Failed to read account password contents", "file", *accPassFlag, "err", err) } pass := strings.TrimSuffix(string(blob), "\n") ks := keystore.NewKeyStore(filepath.Join(os.Getenv("HOME"), ".faucet", "keys"), keystore.StandardScryptN, keystore.StandardScryptP) - if blob, err = ioutil.ReadFile(*accJSONFlag); err != nil { + if blob, err = os.ReadFile(*accJSONFlag); err != nil { log.Crit("Failed to read account key contents", "file", *accJSONFlag, "err", err) } acc, err := ks.Import(blob, pass, pass) @@ -792,7 +792,7 @@ func authTwitter(url string, tokenV1, tokenV2 string) (string, string, string, c } username := parts[len(parts)-3] - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { return "", "", "", common.Address{}, err } @@ -918,7 +918,7 @@ func authFacebook(url string) (string, string, common.Address, error) { } defer res.Body.Close() - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { return "", "", common.Address{}, err } diff --git a/cmd/faucet/website.go b/cmd/faucet/website.go index 854f4404d9..912776bd51 100644 --- a/cmd/faucet/website.go +++ b/cmd/faucet/website.go @@ -10,7 +10,6 @@ import ( "crypto/sha256" "fmt" "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -244,7 +243,7 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + err = os.WriteFile(_filePath(dir, name), data, info.Mode()) if err != nil { return err } diff --git a/cmd/genesis-gen/main.go b/cmd/genesis-gen/main.go index 9499e3d08f..888f83a710 100644 --- a/cmd/genesis-gen/main.go +++ b/cmd/genesis-gen/main.go @@ -23,7 +23,7 @@ import ( "os" "strings" - "github.com/ethereum/go-ethereum/consensus/ibft" + "github.com/dogechain-lab/dogechain/consensus/ibft" "github.com/ethereum/go-ethereum/core/dccontracts" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rlp" @@ -170,11 +170,13 @@ func genesisGen(c *cli.Context) error { PreportlandBlock: big.NewInt(1), // dogechain system contract upgrade PortlandBlock: big.NewInt(2), DetroitBlock: big.NewInt(3), - // TODO: Add hawaii hard fork - // HawaiiBlock: big.NewInt(4), - IBFT: ¶ms.IBFTConfig{ + // enable together in hawaii fork + BerlinBlock: big.NewInt(4), + LondonBlock: big.NewInt(4), + NanoBlock: big.NewInt(4), // blacklist + HawaiiBlock: big.NewInt(4), + Drab: ¶ms.DrabConfig{ EpochSize: c.GlobalUint64(epochSizeFlag.Name), - Type: params.IBFTPoS, }, } @@ -240,7 +242,7 @@ func genesisGen(c *cli.Context) error { } } - genesis.ExtraData = make([]byte, ibft.ExtraVanity) + genesis.ExtraData = make([]byte, ibft.IstanbulExtraVanity) ibftExtra := &types.IBFTExtra{ Validators: validatorsAddress, Seal: []byte{}, diff --git a/cmd/geth/accountcmd_test.go b/cmd/geth/accountcmd_test.go index 3a71b85716..f12b441f25 100644 --- a/cmd/geth/accountcmd_test.go +++ b/cmd/geth/accountcmd_test.go @@ -17,7 +17,7 @@ package main import ( - "io/ioutil" + "os" "path/filepath" "runtime" "strings" @@ -113,11 +113,11 @@ func TestAccountImport(t *testing.T) { func importAccountWithExpect(t *testing.T, key string, expected string) { dir := tmpdir(t) keyfile := filepath.Join(dir, "key.prv") - if err := ioutil.WriteFile(keyfile, []byte(key), 0600); err != nil { + if err := os.WriteFile(keyfile, []byte(key), 0600); err != nil { t.Error(err) } passwordFile := filepath.Join(dir, "password.txt") - if err := ioutil.WriteFile(passwordFile, []byte("foobar"), 0600); err != nil { + if err := os.WriteFile(passwordFile, []byte("foobar"), 0600); err != nil { t.Error(err) } geth := runGeth(t, "--lightkdf", "account", "import", keyfile, "-password", passwordFile) @@ -162,7 +162,7 @@ Password: {{.InputLine "foo"}} Address: {d4584b5f6229b7be90727b0fc8c6b91bb427821f} `) - files, err := ioutil.ReadDir(filepath.Join(geth.Datadir, "keystore")) + files, err := os.ReadDir(filepath.Join(geth.Datadir, "keystore")) if len(files) != 1 { t.Errorf("expected one key file in keystore directory, found %d files (error: %v)", len(files), err) } diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index d2b44a4565..f02b768cf6 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -108,6 +108,7 @@ The dumpgenesis command dumps the genesis block configuration in JSON format to utils.MetricsEnabledExpensiveFlag, utils.MetricsHTTPFlag, utils.MetricsPortFlag, + utils.MetricsDCPortFlag, utils.MetricsEnableInfluxDBFlag, utils.MetricsEnableInfluxDBV2Flag, utils.MetricsInfluxDBEndpointFlag, diff --git a/cmd/geth/config.go b/cmd/geth/config.go index 05d5e19887..3afe486b4c 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -180,6 +180,9 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) { utils.EnableMinerInfo(ctx, cfg.Eth.Miner), utils.EnableNodeInfo(cfg.Eth.TxPool), ) + + utils.SetupDCMetrics(ctx, &cfg.Eth) + return stack, backend } @@ -225,6 +228,9 @@ func applyMetricConfig(ctx *cli.Context, cfg *gethConfig) { if ctx.GlobalIsSet(utils.MetricsPortFlag.Name) { cfg.Metrics.Port = ctx.GlobalInt(utils.MetricsPortFlag.Name) } + if ctx.GlobalIsSet(utils.MetricsDCPortFlag.Name) { + cfg.Metrics.DCPort = ctx.GlobalInt(utils.MetricsDCPortFlag.Name) + } if ctx.GlobalIsSet(utils.MetricsEnableInfluxDBFlag.Name) { cfg.Metrics.EnableInfluxDB = ctx.GlobalBool(utils.MetricsEnableInfluxDBFlag.Name) } diff --git a/cmd/geth/dao_test.go b/cmd/geth/dao_test.go index b7f26b3652..3dc8fe66ea 100644 --- a/cmd/geth/dao_test.go +++ b/cmd/geth/dao_test.go @@ -17,7 +17,6 @@ package main import ( - "io/ioutil" "math/big" "os" "path/filepath" @@ -112,7 +111,7 @@ func testDAOForkBlockNewChain(t *testing.T, test int, genesis string, expectBloc // Start a Geth instance with the requested flags set and immediately terminate if genesis != "" { json := filepath.Join(datadir, "genesis.json") - if err := ioutil.WriteFile(json, []byte(genesis), 0600); err != nil { + if err := os.WriteFile(json, []byte(genesis), 0600); err != nil { t.Fatalf("test %d: failed to write genesis file: %v", test, err) } runGeth(t, "--datadir", datadir, "--networkid", "1337", "init", json).WaitExit() diff --git a/cmd/geth/genesis_test.go b/cmd/geth/genesis_test.go index 0563ef3c42..a14bc8c561 100644 --- a/cmd/geth/genesis_test.go +++ b/cmd/geth/genesis_test.go @@ -17,7 +17,6 @@ package main import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -78,7 +77,7 @@ func TestCustomGenesis(t *testing.T) { // Initialize the data directory with the custom genesis block json := filepath.Join(datadir, "genesis.json") - if err := ioutil.WriteFile(json, []byte(tt.genesis), 0600); err != nil { + if err := os.WriteFile(json, []byte(tt.genesis), 0600); err != nil { t.Fatalf("test %d: failed to write genesis file: %v", i, err) } runGeth(t, "--datadir", datadir, "init", json).WaitExit() diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 49cf390b23..468fbf35f6 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -205,6 +205,7 @@ var ( utils.MetricsEnabledExpensiveFlag, utils.MetricsHTTPFlag, utils.MetricsPortFlag, + utils.MetricsDCPortFlag, utils.MetricsEnableInfluxDBFlag, utils.MetricsInfluxDBEndpointFlag, utils.MetricsInfluxDBDatabaseFlag, diff --git a/cmd/geth/pruneblock_test.go b/cmd/geth/pruneblock_test.go index 6182c37b28..120103c380 100644 --- a/cmd/geth/pruneblock_test.go +++ b/cmd/geth/pruneblock_test.go @@ -20,7 +20,6 @@ import ( "bytes" "encoding/hex" "fmt" - "io/ioutil" "math/big" "os" "path/filepath" @@ -70,7 +69,7 @@ func TestOfflineBlockPrune(t *testing.T) { } func testOfflineBlockPruneWithAmountReserved(t *testing.T, amountReserved uint64) { - datadir, err := ioutil.TempDir("", "") + datadir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("Failed to create temporary datadir: %v", err) } diff --git a/cmd/geth/run_test.go b/cmd/geth/run_test.go index 527c38a657..88f712d900 100644 --- a/cmd/geth/run_test.go +++ b/cmd/geth/run_test.go @@ -19,7 +19,6 @@ package main import ( "context" "fmt" - "io/ioutil" "os" "testing" "time" @@ -30,7 +29,7 @@ import ( ) func tmpdir(t *testing.T) string { - dir, err := ioutil.TempDir("", "geth-test") + dir, err := os.MkdirTemp("", "geth-test") if err != nil { t.Fatal(err) } diff --git a/cmd/geth/version_check.go b/cmd/geth/version_check.go index 2101a69e98..6eaedf3734 100644 --- a/cmd/geth/version_check.go +++ b/cmd/geth/version_check.go @@ -20,8 +20,9 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "net/http" + "os" "regexp" "strings" @@ -112,14 +113,14 @@ func checkCurrent(url, current string) error { // fetch makes an HTTP request to the given url and returns the response body func fetch(url string) ([]byte, error) { if filep := strings.TrimPrefix(url, "file://"); filep != url { - return ioutil.ReadFile(filep) + return os.ReadFile(filep) } res, err := http.Get(url) if err != nil { return nil, err } defer res.Body.Close() - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { return nil, err } diff --git a/cmd/geth/version_check_test.go b/cmd/geth/version_check_test.go index 4be32d5e4f..b841ace5b2 100644 --- a/cmd/geth/version_check_test.go +++ b/cmd/geth/version_check_test.go @@ -19,7 +19,7 @@ package main import ( "encoding/json" "fmt" - "io/ioutil" + "os" "path/filepath" "regexp" "strconv" @@ -49,17 +49,17 @@ func TestVerification(t *testing.T) { func testVerification(t *testing.T, pubkey, sigdir string) { // Data to verify - data, err := ioutil.ReadFile("./testdata/vcheck/data.json") + data, err := os.ReadFile("./testdata/vcheck/data.json") if err != nil { t.Fatal(err) } // Signatures, with and without comments, both trusted and untrusted - files, err := ioutil.ReadDir(sigdir) + files, err := os.ReadDir(sigdir) if err != nil { t.Fatal(err) } for _, f := range files { - sig, err := ioutil.ReadFile(filepath.Join(sigdir, f.Name())) + sig, err := os.ReadFile(filepath.Join(sigdir, f.Name())) if err != nil { t.Fatal(err) } @@ -87,7 +87,7 @@ func versionUint(v string) int { // TestMatching can be used to check that the regexps are correct func TestMatching(t *testing.T) { - data, _ := ioutil.ReadFile("./testdata/vcheck/vulnerabilities.json") + data, _ := os.ReadFile("./testdata/vcheck/vulnerabilities.json") var vulns []vulnJson if err := json.Unmarshal(data, &vulns); err != nil { t.Fatal(err) diff --git a/cmd/puppeth/genesis_test.go b/cmd/puppeth/genesis_test.go index aaa72d73cb..605c1070a8 100644 --- a/cmd/puppeth/genesis_test.go +++ b/cmd/puppeth/genesis_test.go @@ -19,7 +19,7 @@ package main import ( "bytes" "encoding/json" - "io/ioutil" + "os" "reflect" "strings" "testing" @@ -30,7 +30,7 @@ import ( // Tests the go-ethereum to Aleth chainspec conversion for the Stureby testnet. func TestAlethSturebyConverter(t *testing.T) { - blob, err := ioutil.ReadFile("testdata/stureby_geth.json") + blob, err := os.ReadFile("testdata/stureby_geth.json") if err != nil { t.Fatalf("could not read file: %v", err) } @@ -43,7 +43,7 @@ func TestAlethSturebyConverter(t *testing.T) { t.Fatalf("failed creating chainspec: %v", err) } - expBlob, err := ioutil.ReadFile("testdata/stureby_aleth.json") + expBlob, err := os.ReadFile("testdata/stureby_aleth.json") if err != nil { t.Fatalf("could not read file: %v", err) } @@ -69,7 +69,7 @@ func TestAlethSturebyConverter(t *testing.T) { // Tests the go-ethereum to Parity chainspec conversion for the Stureby testnet. func TestParitySturebyConverter(t *testing.T) { - blob, err := ioutil.ReadFile("testdata/stureby_geth.json") + blob, err := os.ReadFile("testdata/stureby_geth.json") if err != nil { t.Fatalf("could not read file: %v", err) } @@ -85,7 +85,7 @@ func TestParitySturebyConverter(t *testing.T) { if err != nil { t.Fatalf("failed encoding chainspec: %v", err) } - expBlob, err := ioutil.ReadFile("testdata/stureby_parity.json") + expBlob, err := os.ReadFile("testdata/stureby_parity.json") if err != nil { t.Fatalf("could not read file: %v", err) } diff --git a/cmd/puppeth/ssh.go b/cmd/puppeth/ssh.go index 039cb6cb45..95a36f3272 100644 --- a/cmd/puppeth/ssh.go +++ b/cmd/puppeth/ssh.go @@ -21,7 +21,6 @@ import ( "bytes" "errors" "fmt" - "io/ioutil" "net" "os" "os/user" @@ -96,7 +95,7 @@ func dial(server string, pubkey []byte) (*sshClient, error) { } if err != nil { path := filepath.Join(user.HomeDir, ".ssh", identity) - if buf, err := ioutil.ReadFile(path); err != nil { + if buf, err := os.ReadFile(path); err != nil { log.Warn("No SSH key, falling back to passwords", "path", path, "err", err) } else { key, err := ssh.ParsePrivateKey(buf) diff --git a/cmd/puppeth/wizard.go b/cmd/puppeth/wizard.go index c0edc54019..f7aafd4dd9 100644 --- a/cmd/puppeth/wizard.go +++ b/cmd/puppeth/wizard.go @@ -19,7 +19,6 @@ package main import ( "encoding/json" "fmt" - "io/ioutil" "math/big" "net" "net/url" @@ -65,7 +64,7 @@ func (c config) flush() { os.MkdirAll(filepath.Dir(c.path), 0755) out, _ := json.MarshalIndent(c, "", " ") - if err := ioutil.WriteFile(c.path, out, 0644); err != nil { + if err := os.WriteFile(c.path, out, 0644); err != nil { log.Warn("Failed to save puppeth configs", "file", c.path, "err", err) } } diff --git a/cmd/puppeth/wizard_genesis.go b/cmd/puppeth/wizard_genesis.go index ae5977b372..cb056ab133 100644 --- a/cmd/puppeth/wizard_genesis.go +++ b/cmd/puppeth/wizard_genesis.go @@ -21,7 +21,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "math/big" "math/rand" "net/http" @@ -263,7 +262,7 @@ func (w *wizard) manageGenesis() { // Export the native genesis spec used by puppeth and Geth gethJson := filepath.Join(folder, fmt.Sprintf("%s.json", w.network)) - if err := ioutil.WriteFile(gethJson, out, 0644); err != nil { + if err := os.WriteFile(gethJson, out, 0644); err != nil { log.Error("Failed to save genesis file", "err", err) return } @@ -305,7 +304,7 @@ func saveGenesis(folder, network, client string, spec interface{}) { path := filepath.Join(folder, fmt.Sprintf("%s-%s.json", network, client)) out, _ := json.MarshalIndent(spec, "", " ") - if err := ioutil.WriteFile(path, out, 0644); err != nil { + if err := os.WriteFile(path, out, 0644); err != nil { log.Error("Failed to save genesis file", "client", client, "err", err) return } diff --git a/cmd/puppeth/wizard_intro.go b/cmd/puppeth/wizard_intro.go index dd4b606c4a..adac943cc3 100644 --- a/cmd/puppeth/wizard_intro.go +++ b/cmd/puppeth/wizard_intro.go @@ -19,7 +19,6 @@ package main import ( "encoding/json" "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -73,7 +72,7 @@ func (w *wizard) run() { // Load initial configurations and connect to all live servers w.conf.path = filepath.Join(os.Getenv("HOME"), ".puppeth", w.network) - blob, err := ioutil.ReadFile(w.conf.path) + blob, err := os.ReadFile(w.conf.path) if err != nil { log.Warn("No previous configurations found", "path", w.conf.path) } else if err := json.Unmarshal(blob, &w.conf); err != nil { diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 6bb49d3dbb..d4b702b68f 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -50,6 +50,7 @@ import ( "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/dcmetrics" "github.com/ethereum/go-ethereum/eth" ethcatalyst "github.com/ethereum/go-ethereum/eth/catalyst" "github.com/ethereum/go-ethereum/eth/downloader" @@ -801,6 +802,11 @@ var ( Usage: "Metrics HTTP server listening port", Value: metrics.DefaultConfig.Port, } + MetricsDCPortFlag = cli.IntFlag{ + Name: "metrics.dcport", + Usage: "DC Metrics HTTP server listening port", + Value: metrics.DefaultConfig.DCPort, + } MetricsEnableInfluxDBFlag = cli.BoolFlag{ Name: "metrics.influxdb", Usage: "Enable metrics export/push to an external InfluxDB database", @@ -2000,6 +2006,48 @@ func SetupMetrics(ctx *cli.Context, options ...SetupMetricsOption) { } } +type SetupDCMetricsOption func() + +func EnableDCBuildInfo(gitCommit, gitDate string) SetupDCMetricsOption { + return func() { + // register build info into metrics + metrics.NewRegisteredLabel("build-info", nil).Mark(map[string]interface{}{ + "version": params.VersionWithMeta, + "git-commit": gitCommit, + "git-commit-date": gitDate, + "go-version": runtime.Version(), + "operating-system": runtime.GOOS, + "architecture": runtime.GOARCH, + }) + } +} + +func SetupDCMetrics(ctx *cli.Context, cfg *ethconfig.Config) { + if cfg.Genesis == nil || + cfg.Genesis.Config == nil || + cfg.Genesis.Config.Doge == nil || + cfg.Genesis.Config.ChainID == nil { + return + } + + if !metrics.Enabled { + return + } + + log.Info("Enabling DC metrics collection") + + // initializing + dcmetrics.ChainID = cfg.Genesis.Config.ChainID.String() + dcmetrics.SharedMetrics() + + if ctx.GlobalIsSet(MetricsHTTPFlag.Name) { + address := fmt.Sprintf("%s:%d", ctx.GlobalString(MetricsHTTPFlag.Name), ctx.GlobalInt(MetricsDCPortFlag.Name)) + log.Info("Enabling stand-alone DC metrics HTTP endpoint", "address", address) + dcmetrics.StartPrometheusServer(address) + exp.Setup(address) + } +} + func SplitTagsFlag(tagsFlag string) map[string]string { tags := strings.Split(tagsFlag, ",") tagsMap := map[string]string{} diff --git a/common/compiler/helpers.go b/common/compiler/helpers.go index 5ed640de8f..59d242af3d 100644 --- a/common/compiler/helpers.go +++ b/common/compiler/helpers.go @@ -19,7 +19,7 @@ package compiler import ( "bytes" - "io/ioutil" + "os" "regexp" ) @@ -55,7 +55,7 @@ type ContractInfo struct { func slurpFiles(files []string) (string, error) { var concat bytes.Buffer for _, file := range files { - content, err := ioutil.ReadFile(file) + content, err := os.ReadFile(file) if err != nil { return "", err } diff --git a/common/test_utils.go b/common/test_utils.go index a848642f77..7a175412f4 100644 --- a/common/test_utils.go +++ b/common/test_utils.go @@ -19,12 +19,12 @@ package common import ( "encoding/json" "fmt" - "io/ioutil" + "os" ) // LoadJSON reads the given file and unmarshals its content. func LoadJSON(file string, val interface{}) error { - content, err := ioutil.ReadFile(file) + content, err := os.ReadFile(file) if err != nil { return err } diff --git a/consensus/consensus.go b/consensus/consensus.go index 87632a9d0d..29c1829ee8 100644 --- a/consensus/consensus.go +++ b/consensus/consensus.go @@ -22,6 +22,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" @@ -29,6 +30,7 @@ import ( ) var ( + // use this for caching system fee reward SystemAddress = common.HexToAddress("0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE") ) @@ -149,3 +151,27 @@ type PoSA interface { IsLocalBlock(header *types.Header) bool AllowLightProcess(chain ChainReader, currentHeader *types.Header) bool } + +type ExecutionResult interface { + UsedGas() uint64 + ReturnData() []byte + Error() error +} + +type DcTxnArgs struct { + From *common.Address + To *common.Address + Gas *hexutil.Uint64 + GasPrice *hexutil.Big + Value *hexutil.Big + Nonce *hexutil.Uint64 + Data *hexutil.Bytes + Input *hexutil.Bytes +} + +type DC interface { + Engine + + DoCall(tx *DcTxnArgs, header *types.Header, globalGasCap uint64) (ExecutionResult, error) + Process(block *types.Block, statedb *state.StateDB) (*state.StateDB, types.Receipts, []*types.Log, uint64, error) +} diff --git a/consensus/dc/chain.go b/consensus/dc/chain.go new file mode 100644 index 0000000000..64d7dfb4cd --- /dev/null +++ b/consensus/dc/chain.go @@ -0,0 +1,171 @@ +package dc + +import ( + "context" + "fmt" + "path/filepath" + + "github.com/hashicorp/go-hclog" + + "github.com/dogechain-lab/dogechain/blockchain" + "github.com/dogechain-lab/dogechain/blockchain/storage/kvstorage" + "github.com/dogechain-lab/dogechain/chain" + "github.com/dogechain-lab/dogechain/consensus" + "github.com/dogechain-lab/dogechain/helper/kvdb" + "github.com/dogechain-lab/dogechain/network" + "github.com/dogechain-lab/dogechain/secrets" + "github.com/dogechain-lab/dogechain/server" + "github.com/dogechain-lab/dogechain/state" + "github.com/dogechain-lab/dogechain/state/runtime/evm" + "github.com/dogechain-lab/dogechain/state/runtime/precompiled" +) + +func newLevelDBBuilder(log hclog.Logger, path string) kvdb.LevelDBBuilder { + leveldbBuilder := kvdb.NewLevelDBBuilder( + log, + path, + ) + + leveldbBuilder. + SetBloomKeyBits(2048). + SetCompactionTableSize(4). + SetCompactionTotalSize(100). + SetHandles(16384). + SetCacheSize(512) + + return leveldbBuilder +} + +func createConsensus( + logger hclog.Logger, + genesis *chain.Chain, + blockchain *blockchain.Blockchain, + executor *state.Executor, + dataDir string, + metrics *consensus.Metrics, +) (consensus.Consensus, error) { + engineName := genesis.Params.GetEngine() + engine, ok := server.GetConsensusBackend(engineName) + + if !ok { + return nil, fmt.Errorf("consensus engine '%s' not found", engineName) + } + + secretsManagerFactory, ok := server.GetSecretsManager(secrets.Local) + if !ok { + return nil, fmt.Errorf("secret manager '%s' not found", secrets.Local) + } + + // Instantiate the secrets manager + secretsManager, factoryErr := secretsManagerFactory( + &secrets.SecretsManagerConfig{}, + &secrets.SecretsManagerParams{ + Logger: logger, + Extra: map[string]interface{}{ + secrets.Path: dataDir, + }, + }, + ) + + if factoryErr != nil { + return nil, factoryErr + } + + engineConfig, ok := genesis.Params.Engine[engineName].(map[string]interface{}) + if !ok { + engineConfig = map[string]interface{}{} + } + + config := &consensus.Config{ + Params: genesis.Params, + Config: engineConfig, + Path: filepath.Join(dataDir, "consensus"), + } + + consensus, err := engine( + &consensus.ConsensusParams{ + Context: context.Background(), + Seal: false, + Config: config, + Txpool: nil, + Network: &network.NonetworkServer{}, + Blockchain: blockchain, + Executor: executor, + Grpc: nil, + Logger: logger.Named("consensus"), + Metrics: metrics, + SecretsManager: secretsManager, + BlockTime: 2, + BlockBroadcast: false, + }, + ) + + if err != nil { + return nil, err + } + + return consensus, nil +} + +func createBlockchain( + logger hclog.Logger, + genesis *chain.Chain, + st state.State, + dataDir string, + blockMetrics *blockchain.Metrics, + consensusMetrics *consensus.Metrics, +) (*blockchain.Blockchain, *state.Executor, consensus.Consensus, error) { + executor := state.NewExecutor(genesis.Params, st, logger) + executor.SetRuntime(precompiled.NewPrecompiled()) + executor.SetRuntime(evm.NewEVM()) + + genesisRoot, err := executor.WriteGenesis(genesis.Genesis.Alloc) + if err != nil { + return nil, nil, nil, err + } + + genesis.Genesis.StateRoot = genesisRoot + + storageBuilder := newLevelDBBuilder(logger, filepath.Join(dataDir, "blockchain")) + storageBuilder.SetCacheSize(1024) + + chain, err := blockchain.NewBlockchain( + logger, + genesis, + 0, // don't care price bottom limit when reverify. + kvstorage.NewLevelDBStorageBuilder( + logger, + storageBuilder, + ), + nil, + executor, + blockMetrics, + ) + if err != nil { + return nil, nil, nil, err + } + + executor.GetHash = chain.GetHashHelper + + consensus, err := createConsensus(logger, genesis, chain, executor, dataDir, consensusMetrics) + if err != nil { + return nil, nil, nil, err + } + + chain.SetConsensus(consensus) + + if err := chain.ComputeGenesis(); err != nil { + return nil, nil, nil, err + } + + // initialize data in consensus layer + if err := consensus.Initialize(); err != nil { + return nil, nil, nil, err + } + + if err := consensus.Start(); err != nil { + return nil, nil, nil, err + } + + return chain, executor, consensus, nil +} diff --git a/consensus/dc/dc.go b/consensus/dc/dc.go new file mode 100644 index 0000000000..9f6cd79126 --- /dev/null +++ b/consensus/dc/dc.go @@ -0,0 +1,173 @@ +package dc + +import ( + "errors" + "math" + "path/filepath" + "sync" + "sync/atomic" + "time" + + "github.com/dogechain-lab/dogechain/blockchain" + "github.com/dogechain-lab/dogechain/chain" + "github.com/dogechain-lab/dogechain/consensus" + "github.com/dogechain-lab/dogechain/consensus/ibft" + "github.com/dogechain-lab/dogechain/state" + + "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ethereum/go-ethereum/dcmetrics" + "github.com/ethereum/go-ethereum/ethdb" + "github.com/ethereum/go-ethereum/internal/ethapi" + "github.com/ethereum/go-ethereum/node" + "github.com/ethereum/go-ethereum/params" + + "github.com/hashicorp/go-hclog" + lru "github.com/hashicorp/golang-lru" + + itrie "github.com/dogechain-lab/dogechain/state/immutable-trie" +) + +const ( + inMemorySnapshots = 128 // Number of recent snapshots to keep in memory + inMemorySignatures = 4096 // Number of recent block signatures to keep in memory + + targetBlockTime = 2 * time.Second + + checkpointInterval = 1024 // Number of blocks after which to save the snapshot to the database + defaultEpochLength = uint64(100000) // Default number of blocks of checkpoint to update validatorSet from contract + + ExtraVanity = 32 // Fixed number of extra-data prefix bytes reserved for signer vanity +) + +type DogeChain struct { + chainConfig *params.ChainConfig // Chain config + config *params.DogeConfig + epochSize uint64 + + blockchain *blockchain.Blockchain + executor *state.Executor + consensus consensus.Consensus + + stateStorage itrie.Storage + state *WrapDcState + + recentSnaps *lru.ARCCache // Snapshots for recent block to speed up + signatures *lru.ARCCache // Signatures of recent blocks to speed up mining + + db ethdb.Database + ethAPI *ethapi.PublicBlockChainAPI + + closeFlag atomic.Bool + lock sync.Mutex +} + +func (dc *DogeChain) Close() error { + if dc.closeFlag.CompareAndSwap(false, true) { + // join error + return JoinErrors( + dc.consensus.Close(), + dc.blockchain.Close(), + dc.stateStorage.Close(), + ) + } + + return nil +} + +func New( + chainConfig *params.ChainConfig, + config *node.Config, + db ethdb.Database, + ethAPI *ethapi.PublicBlockChainAPI, +) (*DogeChain, error) { + // hack dogechain header rlp decode error + if chainConfig.HawaiiBlock == nil || + chainConfig.HawaiiBlock.Uint64() == 0 || + chainConfig.HawaiiBlock.Uint64() > uint64(math.MaxInt64) { + rawdb.DC_BLOCK_END_NUMBER = math.MaxInt64 + } else { + rawdb.DC_BLOCK_END_NUMBER = int64(chainConfig.HawaiiBlock.Uint64()) + } + + logger := hclog.L() + dataDir := filepath.Join(config.DataDir, "dogechain") + + genesis := &chain.Chain{ + Name: "dogechain", + Genesis: chainConfig.Doge.Genesis, + Params: chainConfig.Doge.Params, + } + + cfg := chainConfig.Doge + + var epochSize uint64 = defaultEpochLength + if genesis.Params.Engine["ibft"] != nil { + if ibftCfg, ok := genesis.Params.Engine["ibft"].(map[string]interface{}); ok { + if definedEpochSize, ok := ibftCfg[ibft.KeyEpochSize]; ok { + // Epoch size is defined, use the passed in one + readSize, ok := definedEpochSize.(float64) + if !ok { + return nil, errors.New("epochSize invalid type assertion") + } + epochSize = uint64(readSize) + if epochSize == 0 { + // epoch size should never be zero. + epochSize = defaultEpochLength + } + } + } + } + + storageBuilder := newLevelDBBuilder(logger, filepath.Join(dataDir, "trie")) + storageBuilder.SetCacheSize(2048) + + stateStorage, err := itrie.NewLevelDBStorage( + storageBuilder) + if err != nil { + logger.Error("failed to create state storage") + + return nil, err + } + + dcStateDb := itrie.NewStateDB(stateStorage, logger, dcmetrics.SharedMetrics().Trie) + wrapDcStateDb := NewWrapDcState(dcStateDb) + + blockchain, executor, consensus, err := createBlockchain( + logger, + genesis, + wrapDcStateDb, + dataDir, + dcmetrics.SharedMetrics().Blockchain, + dcmetrics.SharedMetrics().Consensus, + ) + if err != nil { + stateStorage.Close() + return nil, err + } + + // Allocate the snapshot caches and create the engine + recentSnaps, err := lru.NewARC(inMemorySnapshots) + if err != nil { + panic(err) + } + // Signatures + signatures, err := lru.NewARC(inMemorySignatures) + if err != nil { + panic(err) + } + + return &DogeChain{ + chainConfig: chainConfig, + config: cfg, + epochSize: epochSize, + blockchain: blockchain, + executor: executor, + consensus: consensus, + recentSnaps: recentSnaps, + signatures: signatures, + stateStorage: stateStorage, + state: wrapDcStateDb, + db: db, + ethAPI: ethAPI, + }, nil +} diff --git a/consensus/dc/dc_state.go b/consensus/dc/dc_state.go new file mode 100644 index 0000000000..ac11eb70ba --- /dev/null +++ b/consensus/dc/dc_state.go @@ -0,0 +1,70 @@ +package dc + +import ( + "github.com/dogechain-lab/dogechain/state" + "github.com/dogechain-lab/dogechain/types" +) + +type StateObjectHook func([]*state.Object) + +type WrapDcState struct { + state state.State + + hook StateObjectHook +} + +func (w *WrapDcState) SetCommitHook(hook StateObjectHook) { + w.hook = hook +} + +func (w *WrapDcState) NewSnapshotAt(hash types.Hash) (state.Snapshot, error) { + snap, err := w.state.NewSnapshotAt(hash) + + return &WrapDcSnapshot{ + wrapState: w, + snap: snap, + }, err +} + +func (w *WrapDcState) NewSnapshot() state.Snapshot { + return &WrapDcSnapshot{ + wrapState: w, + snap: w.state.NewSnapshot(), + } +} + +func (w *WrapDcState) GetCode(hash types.Hash) ([]byte, bool) { + return w.state.GetCode(hash) +} + +type WrapDcSnapshot struct { + wrapState *WrapDcState + + snap state.Snapshot +} + +func (w *WrapDcSnapshot) GetStorage(addr types.Address, root types.Hash, key types.Hash) (types.Hash, error) { + return w.snap.GetStorage(addr, root, key) +} + +func (w *WrapDcSnapshot) GetAccount(addr types.Address) (*state.Account, error) { + return w.snap.GetAccount(addr) +} + +func (w *WrapDcSnapshot) GetCode(hash types.Hash) ([]byte, bool) { + return w.snap.GetCode(hash) +} + +func (w *WrapDcSnapshot) Commit(objs []*state.Object) (state.Snapshot, []byte, error) { + if w.wrapState.hook != nil { + w.wrapState.hook(objs) + } + + return w.snap.Commit(objs) +} + +func NewWrapDcState(state state.State) *WrapDcState { + return &WrapDcState{ + state: state, + } +} diff --git a/consensus/dc/engine.go b/consensus/dc/engine.go new file mode 100644 index 0000000000..bcad66c78c --- /dev/null +++ b/consensus/dc/engine.go @@ -0,0 +1,428 @@ +package dc + +import ( + "bytes" + "errors" + "fmt" + "math/big" + "time" + + "github.com/ethereum/go-ethereum/accounts" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/gopool" + "github.com/ethereum/go-ethereum/consensus" + "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/rpc" + + lru "github.com/hashicorp/golang-lru" + + "golang.org/x/crypto/sha3" + + dcState "github.com/dogechain-lab/dogechain/state" +) + +var ( + // errBlockHeaderNotExists is returned when block header not exists. + errBlockHeaderNotExists = errors.New("block header not exists") + + // errBlockNotExists is returned when block not exists. + errBlockNotExists = errors.New("block not exists") + + // errInvalidBlockTimestamp is returned when it is a future block. + errInvalidBlockTimestamp = errors.New("invalid block timestamp") + + // errInvalidCommittedSeal is returned when committed seal not from valid validators. + errInvalidCommittedSeal = errors.New("invalid committed seal") + + // errInvalidCoinbase is returned when coinbase not match with block sealer(validator). + errInvalidCoinbase = errors.New("invalid coinbase") + + // errValidatorNotAuthorized is returned when validator not authorized by community. + errValidatorNotAuthorized = errors.New("validator is not authorized") + + // errInvalidUncleHash is returned if a block contains an non-empty uncle list. + errInvalidUncleHash = errors.New("non empty uncle hash") + + // errInvalidDifficulty is returned if the difficulty of a block is missing. + errInvalidDifficulty = errors.New("invalid difficulty") + + // errOutOfRangeChain is returned if an authorization list is attempted to + // be modified via out-of-range or non-contiguous headers. + errOutOfRangeChain = errors.New("out of range or non-contiguous chain") + + // errBlockHashInconsistent is returned if an authorization list is attempted to + // insert an inconsistent block. + errBlockHashInconsistent = errors.New("the block hash is inconsistent") + + // errUnauthorizedValidator is returned if a header is signed by a non-authorized entity. + errUnauthorizedValidator = errors.New("unauthorized validator") + + errNotSupported = errors.New("not supported") +) + +// SignerFn is a signer callback function to request a header to be signed by a +// backing account. +type SignerFn func(accounts.Account, string, []byte) ([]byte, error) +type SignerTxFn func(accounts.Account, *types.Transaction, *big.Int) (*types.Transaction, error) + +type executionResult struct { + gasUsed uint64 + data []byte + err error +} + +func (er *executionResult) UsedGas() uint64 { + return er.gasUsed +} + +func (er *executionResult) ReturnData() []byte { + return er.data +} + +func (er *executionResult) Error() error { + return er.err +} + +// Author implements consensus.Engine, returning the SystemAddress +func (dc *DogeChain) Author(header *types.Header) (common.Address, error) { + return header.Coinbase, nil +} + +// VerifyHeader checks whether a header conforms to the consensus rules. +func (dc *DogeChain) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error { + return dc.verifyHeader(chain, header, nil) +} + +// VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers. The +// method returns a quit channel to abort the operations and a results channel to +// retrieve the async verifications (the order is that of the input slice). +func (dc *DogeChain) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) { + abort := make(chan struct{}) + results := make(chan error, len(headers)) + + gopool.Submit(func() { + for i, header := range headers { + err := dc.verifyHeader(chain, header, headers[:i]) + + select { + case <-abort: + return + case results <- err: + } + } + }) + return abort, results +} + +// VerifyUncles implements consensus.Engine, always returning an error for any +// uncles as this consensus mechanism doesn't permit uncles. +func (dc *DogeChain) VerifyUncles(chain consensus.ChainReader, block *types.Block) error { + if len(block.Uncles()) > 0 { + return errors.New("uncles not allowed") + } + return nil +} + +// Prepare implements consensus.Engine, preparing all the consensus fields of the +// header for running the transactions on top. +func (dc *DogeChain) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error { + return nil +} + +func (dc *DogeChain) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs *[]*types.Transaction, + uncles []*types.Header, receipts *[]*types.Receipt, systemTxs *[]*types.Transaction, usedGas *uint64) error { + // TODO: use DC consensus to finalize block + return errNotSupported +} + +// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set, +// nor block rewards given, and returns the final block. +func (dc *DogeChain) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, + txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) { + return nil, nil, errNotSupported +} + +func (dc *DogeChain) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error { + return nil +} + +// SealHash returns the hash of a block prior to it being sealed. +func (dc *DogeChain) SealHash(header *types.Header) common.Hash { + extra, _ := types.GetIbftExtra(header.Extra) + return sealHash(header, dc.chainConfig.ChainID, extra) +} + +// CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty +// that a new block should have based on the previous blocks in the chain and the +// current signer. +func (dc *DogeChain) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int { + return difficultyByParentNumber(parent.Number) +} + +// APIs implements consensus.Engine, returning the user facing RPC API to query snapshot. +func (dc *DogeChain) APIs(chain consensus.ChainHeaderReader) []rpc.API { + return []rpc.API{} +} + +// Argument leftOver is the time reserved for block finalize(calculate root, distribute income...) +func (dc *DogeChain) Delay(chain consensus.ChainReader, header *types.Header, leftOver *time.Duration) *time.Duration { + return nil +} + +func (dc *DogeChain) DoCall(msg *consensus.DcTxnArgs, header *types.Header, globalGasCap uint64) (consensus.ExecutionResult, error) { + dcHeader, exist := dc.blockchain.GetHeaderByHash(DbscHashToDcHash(header.Hash())) + if !exist { + return nil, errBlockHeaderNotExists + } + + blockCreator, err := dc.consensus.GetBlockCreator(dcHeader) + if err != nil { + log.Error("failed to get block creator", "error", err) + + return nil, errBlockNotExists + } + + transition, err := dc.executor.BeginTxn(dcHeader.StateRoot, dcHeader, blockCreator) + if err != nil { + log.Error("failed to begin transaction", "error", err) + + return nil, err + } + + txn := TxnArgsToTx(msg) + result, err := transition.Apply(txn) + if err != nil { + return nil, err + } + + return &executionResult{ + gasUsed: result.GasUsed, + data: result.ReturnValue, + err: result.Err, + }, err +} + +func (dc *DogeChain) Process(block *types.Block, statedb *state.StateDB) (*state.StateDB, types.Receipts, []*types.Log, uint64, error) { + dc.lock.Lock() + defer dc.lock.Unlock() + + start := time.Now() + defer func() { + statedb.DCProcessBlock += time.Since(start) + }() + + dcBlk := DbscBlockToDcBlock(dc.chainConfig, block) + + statedb.MarkFullProcessed() + dc.state.SetCommitHook(func(objs []*dcState.Object) { + start := time.Now() + defer func() { + statedb.DCCommitHooks += time.Since(start) + }() + + for _, obj := range objs { + // objstart := time.Now() + address := DcAddressToDbscAddress(obj.Address) + + if obj.Deleted { + // empty object may have transition, so we'll leave it to statedb jounal + if obj.Nonce == 0 && obj.Balance.Sign() == 0 && bytes.Equal(obj.CodeHash.Bytes(), types.EmptyCodeHash) { + } else { + // is suicide object + statedb.Suicide(address) + // statedb.DCSetObjects += time.Since(objstart) + // statedb.DCObjects++ + continue + } + } + + dbscObj := statedb.GetOrNewStateObject(address) + // statedb.DCGetObjects += time.Since(objstart) + + // substart := time.Now() + dbscObj.SetBalance(obj.Balance) + dbscObj.SetNonce(obj.Nonce) + dbscObj.SetCode(common.Hash(obj.CodeHash), obj.Code) + // statedb.DCSetObjects += time.Since(substart) + + // update storage + for _, kv := range obj.Storage { + // storagestart := time.Now() + if kv.Deleted { + statedb.SetState(address, common.BytesToHash(kv.Key), common.Hash{}) + } else { + statedb.SetState( + address, + common.BytesToHash(kv.Key), + common.BytesToHash(kv.Val), + ) + } + // statedb.DCSetStorages += time.Since(storagestart) + // statedb.DCStorages++ + } + + // statedb.DCObjects++ + } + }) + + substart := time.Now() + + // Do the initial block verification + if err := dc.blockchain.VerifyFinalizedBlock(dcBlk); err != nil { + return statedb, nil, nil, 0, err + } + // Update metrics + statedb.DCVerifications += time.Since(substart) + + substart = time.Now() + if err := dc.blockchain.WriteBlock(dcBlk, "dbsc"); err != nil { + return statedb, nil, nil, 0, fmt.Errorf("failed to write block while bulk syncing: %w", err) + } + // Update metrics + statedb.DCWriteBlocks += time.Since(substart) + + substart = time.Now() + statedb.Finalise(true) + // Update metrics + statedb.DCFinaliseStates += time.Since(substart) + + substart = time.Now() + // Handle bridge logs + receipts, err := dc.blockchain.GetReceiptsByHash(dcBlk.Header.Hash) + if err != nil { + return statedb, nil, nil, 0, nil + } + // Update metrics + statedb.DCGetReceipts += time.Since(substart) + + dbscReceipts := DcReceiptsToDbscReceipts(receipts) + + var allLogs []*types.Log + + for _, receipt := range dbscReceipts { + allLogs = append(allLogs, receipt.Logs...) + } + + return statedb, dbscReceipts, allLogs, dcBlk.Header.GasUsed, nil +} + +// verifyHeader checks whether a header conforms to the consensus rules.The +// caller may optionally pass in a batch of parents (ascending order) to avoid +// looking those up from the database. This is useful for concurrently verifying +// a batch of new headers. +func (dc *DogeChain) verifyHeader(chain consensus.ChainHeaderReader, header *types.Header, parents []*types.Header) error { + // Ensure that the mix digest is ibft mix hash + if header.MixDigest != types.IBFTMixHash { + return types.ErrIBFTInvalidMixHash + } + // Ensure that the block doesn't contain any uncles which are meaningless in PoS + if header.UncleHash != types.EmptyUncleHash { + return errInvalidUncleHash + } + // Difficulty has to match number for previous ibft consensus + if header.Number.Cmp(header.Difficulty) != 0 { + return errInvalidDifficulty + } + + // Check timestamp after detroit hard fork + if dc.chainConfig.IsDetorit(header.Number) { + // Get parent + var parent *types.Header + if len(parents) > 0 { + parent = parents[len(parents)-1] + } else { + parent = chain.GetHeader(header.ParentHash, header.Number.Uint64()-1) + } + // The diff between block timestamp and 'now' should not exceeds timeout. + // Timestamp ascending array [parentTs, blockTs, now+blockTimeout] + before, after := parent.Time, uint64(time.Now().Add(targetBlockTime).Unix()) + + // header timestamp should not goes back + if header.Time <= before || header.Time > after { + log.Warn("future blocktime invalid", + "before", before, + "after", after, + "current", header.Time, + ) + + return errInvalidBlockTimestamp + } + } + + // Verify the sealer + return dc.verifySigner(chain, header, parents) +} + +func (dc *DogeChain) verifySigner(chain consensus.ChainHeaderReader, header *types.Header, parents []*types.Header) error { + // Recover validator first + validator, err := ecrecover(header, dc.signatures, dc.chainConfig.ChainID) + if err != nil { + return errInvalidCommittedSeal + } + // Ensure that coinbase is validator + if header.Coinbase != validator { + return errInvalidCoinbase + } + // check validator in list + snap, err := dc.snapshot(chain, header.Number.Uint64()-1, header.ParentHash, parents) + if err != nil { + return err + } + if !snap.includeValidator(validator) { + return errValidatorNotAuthorized + } + + return nil +} + +// VerifySeal implements consensus.Engine, checking whether the signature contained +// in the header satisfies the consensus protocol requirements. +func (dc *DogeChain) VerifySeal(chain consensus.ChainReader, header *types.Header) error { + return nil +} + +// old version ibft returns block number directly +func difficultyByParentNumber(num *big.Int) *big.Int { + return new(big.Int).Add(num, big.NewInt(1)) +} + +func sealHash(header *types.Header, chainId *big.Int, extra *types.IBFTExtra) (hash common.Hash) { + hasher := sha3.NewLegacyKeccak256() + types.IBFTHeaderExtraRLPHash(hasher, header, extra) + hasher.Sum(hash[:0]) + return hash +} + +// ecrecover extracts the Ethereum account address from a signed header. +func ecrecover(header *types.Header, sigCache *lru.ARCCache, chainId *big.Int) (common.Address, error) { + // If the signature's already cached, return that + hash := header.Hash() + if address, known := sigCache.Get(hash); known { + return address.(common.Address), nil + } + + // get the extra part that contains the seal + extra, err := types.GetIbftExtra(header.Extra) + if err != nil { + return common.Address{}, err + } + + // Retrieve the signature from the header extra-data + // Recover the public key and the Ethereum address + // TODO: should be use different hash from IBFT for + // not modified block hash? + pubkey, err := crypto.Ecrecover(crypto.Keccak256(hash.Bytes()), extra.Seal) + if err != nil { + return common.Address{}, err + } + var signer common.Address + copy(signer[:], crypto.Keccak256(pubkey[1:])[12:]) + + // save to cache + sigCache.Add(hash, signer) + + return signer, nil +} diff --git a/consensus/dc/errors.go b/consensus/dc/errors.go new file mode 100644 index 0000000000..79590c561f --- /dev/null +++ b/consensus/dc/errors.go @@ -0,0 +1,41 @@ +package dc + +type joinError struct { + errs []error +} + +func (e *joinError) Error() string { + var b []byte + for i, err := range e.errs { + if i > 0 { + b = append(b, '\n') + } + b = append(b, err.Error()...) + } + return string(b) +} + +func (e *joinError) Unwrap() []error { + return e.errs +} + +func JoinErrors(errs ...error) error { + n := 0 + for _, err := range errs { + if err != nil { + n++ + } + } + if n == 0 { + return nil + } + e := &joinError{ + errs: make([]error, 0, n), + } + for _, err := range errs { + if err != nil { + e.errs = append(e.errs, err) + } + } + return e +} diff --git a/consensus/dc/migrate.go b/consensus/dc/migrate.go new file mode 100644 index 0000000000..f6774cc24f --- /dev/null +++ b/consensus/dc/migrate.go @@ -0,0 +1,286 @@ +package dc + +import ( + "math/big" + + "github.com/dogechain-lab/dogechain/types" + "github.com/ethereum/go-ethereum/log" + + dbscCommon "github.com/ethereum/go-ethereum/common" + dbscConsensus "github.com/ethereum/go-ethereum/consensus" + dbscTypes "github.com/ethereum/go-ethereum/core/types" + dbscParams "github.com/ethereum/go-ethereum/params" +) + +func DcHashToDbscHash(hash types.Hash) dbscCommon.Hash { + return dbscCommon.BytesToHash(hash.Bytes()) +} + +func DcHashsToDbscHashs(hashs []types.Hash) []dbscCommon.Hash { + dbscHashs := make([]dbscCommon.Hash, len(hashs)) + + for i, hash := range hashs { + dbscHashs[i] = DcHashToDbscHash(hash) + } + + return dbscHashs +} + +func DbscHashToDcHash(hash dbscCommon.Hash) types.Hash { + return types.BytesToHash(hash.Bytes()) +} + +func DcAddressToDbscAddress(address types.Address) dbscCommon.Address { + return dbscCommon.BytesToAddress(address.Bytes()) +} + +func DbscAddressToDcAddress(address dbscCommon.Address) types.Address { + return types.BytesToAddress(address.Bytes()) +} + +func DcTxToDbscTx(tx *types.Transaction) *dbscTypes.Transaction { + var toAddress *dbscCommon.Address = nil + + if tx.To != nil { + add := DcAddressToDbscAddress(*tx.To) + toAddress = &add + } + + return dbscTypes.NewTx(&dbscTypes.LegacyTx{ + Nonce: tx.Nonce, + GasPrice: tx.GasPrice, + Gas: tx.Gas, + To: toAddress, + Value: tx.Value, + Data: tx.Input, + V: tx.V, + R: tx.R, + S: tx.S, + }) +} + +func TxnArgsToTx(arg *dbscConsensus.DcTxnArgs) *types.Transaction { + from := DbscAddressToDcAddress(*arg.From) + + var to *types.Address = nil + if arg.To != nil { + toAddress := DbscAddressToDcAddress(*arg.To) + to = &toAddress + } + + txn := &types.Transaction{ + From: from, + To: to, + Gas: uint64(*arg.Gas), + GasPrice: arg.GasPrice.ToInt(), + Value: arg.Value.ToInt(), + Input: *arg.Input, + Nonce: uint64(*arg.Nonce), + } + + txn.Hash() + + return txn +} + +func DbscTxToDcTx(signer dbscTypes.Signer, tx *dbscTypes.Transaction) (*types.Transaction, error) { + var toAddress *types.Address = nil + + if tx.To() != nil { + add := types.Address(*tx.To()) + toAddress = &add + } + + v, r, s := tx.RawSignatureValues() + sender, err := dbscTypes.Sender(signer, tx) + + if err != nil { + log.Debug("sender is nil", sender) + } + + return &types.Transaction{ + Nonce: tx.Nonce(), + GasPrice: tx.GasPrice(), + Gas: tx.Gas(), + To: toAddress, + Value: tx.Value(), + Input: tx.Data(), + V: v, + R: r, + S: s, + From: types.Address(sender), + ReceivedTime: tx.Time(), + }, nil +} + +func DcTxsToDbscTxs(txs []*types.Transaction) []*dbscTypes.Transaction { + result := make([]*dbscTypes.Transaction, 0, len(txs)) + + for _, tx := range txs { + result = append(result, DcTxToDbscTx(tx)) + } + + return result +} + +func DcBloomToDbscBloom(bloom types.Bloom) dbscTypes.Bloom { + return dbscTypes.BytesToBloom(bloom[:]) +} + +func DbscBloomToDcBloom(bloom dbscTypes.Bloom) types.Bloom { + var dcBloom types.Bloom + copy(dcBloom[:], bloom.Bytes()[:types.BloomByteLength]) + + return dcBloom +} + +func DbscHeaderToDcHeader(header *dbscTypes.Header) *types.Header { + dcHeader := &types.Header{ + ParentHash: DbscHashToDcHash(header.ParentHash), + Sha3Uncles: DbscHashToDcHash(header.UncleHash), + Miner: DbscAddressToDcAddress(header.Coinbase), + StateRoot: DbscHashToDcHash(header.Root), + TxRoot: DbscHashToDcHash(header.TxHash), + ReceiptsRoot: DbscHashToDcHash(header.ReceiptHash), + LogsBloom: DbscBloomToDcBloom(header.Bloom), + Difficulty: header.Difficulty.Uint64(), + Number: header.Number.Uint64(), + GasLimit: header.GasLimit, + GasUsed: header.GasUsed, + Timestamp: header.Time, + ExtraData: header.Extra, + MixHash: DbscHashToDcHash(header.MixDigest), + } + dcHeader.SetNonce(header.Nonce.Uint64()) + + return dcHeader.ComputeHash() +} + +func DcHeaderToDbscHeader(header *types.Header) *dbscTypes.Header { + return &dbscTypes.Header{ + ParentHash: DcHashToDbscHash(header.ParentHash), + UncleHash: DcHashToDbscHash(header.Sha3Uncles), + Coinbase: DcAddressToDbscAddress(header.Miner), + Root: DcHashToDbscHash(header.StateRoot), + TxHash: DcHashToDbscHash(header.TxRoot), + ReceiptHash: DcHashToDbscHash(header.ReceiptsRoot), + Bloom: dbscTypes.BytesToBloom(header.LogsBloom[:]), + Difficulty: new(big.Int).SetUint64(header.Difficulty), + Number: new(big.Int).SetUint64(header.Number), + GasLimit: header.GasLimit, + GasUsed: header.GasUsed, + Time: header.Timestamp, + Extra: header.ExtraData, + MixDigest: DcHashToDbscHash(header.MixHash), + Nonce: dbscTypes.BlockNonce(header.Nonce), + } +} + +func DcLogToDbscLog(log *types.Log) *dbscTypes.Log { + return &dbscTypes.Log{ + Address: DcAddressToDbscAddress(log.Address), + Topics: DcHashsToDbscHashs(log.Topics), + Data: log.Data, + } +} + +func DcLogsToDbscLogs(logs []*types.Log) []*dbscTypes.Log { + result := make([]*dbscTypes.Log, 0, len(logs)) + + for _, log := range logs { + result = append(result, DcLogToDbscLog(log)) + } + + return result +} + +func DcReceiptToDbscReceipt(receipt *types.Receipt) *dbscTypes.Receipt { + var contractAddress dbscCommon.Address + if receipt.ContractAddress == nil { + contractAddress = dbscCommon.Address{} + } else { + contractAddress = DcAddressToDbscAddress(*receipt.ContractAddress) + } + + postState := []byte{} + status := dbscTypes.ReceiptStatusFailed + + if receipt.Status != nil { + switch *receipt.Status { + case types.ReceiptSuccess: + status = dbscTypes.ReceiptStatusSuccessful + case types.ReceiptFailed: + status = dbscTypes.ReceiptStatusFailed + } + } else { + postState = receipt.Root.Bytes() + } + + return &dbscTypes.Receipt{ + Type: dbscTypes.LegacyTxType, + PostState: postState, + Status: status, + CumulativeGasUsed: receipt.CumulativeGasUsed, + Bloom: dbscTypes.BytesToBloom(receipt.LogsBloom[:]), + Logs: DcLogsToDbscLogs(receipt.Logs), + TxHash: DcHashToDbscHash(receipt.TxHash), + ContractAddress: contractAddress, + GasUsed: receipt.GasUsed, + } +} + +func DcReceiptsToDbscReceipts(receipts []*types.Receipt) []*dbscTypes.Receipt { + result := make([]*dbscTypes.Receipt, 0, len(receipts)) + + for _, receipt := range receipts { + result = append(result, DcReceiptToDbscReceipt(receipt)) + } + + return result +} + +func DbscBlockToDcBlock(cfg *dbscParams.ChainConfig, block *dbscTypes.Block) *types.Block { + blk := &types.Block{ + Header: DbscHeaderToDcHeader(block.Header()), + Transactions: make([]*types.Transaction, 0, len(block.Transactions())), + Uncles: make([]*types.Header, 0, len(block.Uncles())), + } + + signer := dbscTypes.MakeSigner( + cfg, + block.Number(), + ) + + // copy tx + for _, tx := range block.Transactions() { + dcTx, err := DbscTxToDcTx(signer, tx) + if err != nil { + panic(err) + } + blk.Transactions = append(blk.Transactions, dcTx) + } + + // copy uncles + for _, uncle := range block.Uncles() { + blk.Uncles = append(blk.Uncles, DbscHeaderToDcHeader(uncle)) + } + + return blk +} + +func DcBlockToDbscBlock(block *types.Block) *dbscTypes.Block { + dbscUncles := make([]*dbscTypes.Header, 0, len(block.Uncles)) + + for _, uncle := range block.Uncles { + dbscUncles = append(dbscUncles, DcHeaderToDbscHeader(uncle)) + } + + blk := dbscTypes.NewBlockWithHeader( + DcHeaderToDbscHeader(block.Header), + ).WithBody( + DcTxsToDbscTxs(block.Transactions), + dbscUncles, + ) + + return blk +} diff --git a/consensus/ibft/snapshot.go b/consensus/dc/snapshot.go similarity index 68% rename from consensus/ibft/snapshot.go rename to consensus/dc/snapshot.go index e097e8c60a..5aa5e2672a 100644 --- a/consensus/ibft/snapshot.go +++ b/consensus/dc/snapshot.go @@ -14,11 +14,13 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . -package ibft +package dc import ( "bytes" "encoding/json" + "errors" + "fmt" "math/big" "sort" @@ -27,13 +29,13 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/log" lru "github.com/hashicorp/golang-lru" ) // Snapshot is the state of the validatorSet at a given point. type Snapshot struct { - config *params.IBFTConfig // Consensus engine parameters to fine tune behavior + epochSize uint64 ethAPI *ethapi.PublicBlockChainAPI sigCache *lru.ARCCache // Cache of recent block signatures to speed up ecrecover validatorSet map[common.Address]struct{} // validator set for quick query @@ -47,7 +49,7 @@ type Snapshot struct { // method does not initialize the set of recent validators, so only ever use it for // the genesis block. func newSnapshot( - config *params.IBFTConfig, + epochSize uint64, sigCache *lru.ARCCache, number uint64, hash common.Hash, @@ -55,7 +57,7 @@ func newSnapshot( ethAPI *ethapi.PublicBlockChainAPI, ) *Snapshot { snap := &Snapshot{ - config: config, + epochSize: epochSize, ethAPI: ethAPI, sigCache: sigCache, validatorSet: make(map[common.Address]struct{}), @@ -70,7 +72,7 @@ func newSnapshot( } // loadSnapshot loads an existing snapshot from the database. -func loadSnapshot(config *params.IBFTConfig, sigCache *lru.ARCCache, db ethdb.Database, hash common.Hash, ethAPI *ethapi.PublicBlockChainAPI) (*Snapshot, error) { +func loadSnapshot(epochSize uint64, sigCache *lru.ARCCache, db ethdb.Database, hash common.Hash, ethAPI *ethapi.PublicBlockChainAPI) (*Snapshot, error) { blob, err := db.Get(append([]byte("ibft-"), hash[:]...)) if err != nil { return nil, err @@ -79,7 +81,7 @@ func loadSnapshot(config *params.IBFTConfig, sigCache *lru.ARCCache, db ethdb.Da if err := json.Unmarshal(blob, snap); err != nil { return nil, err } - snap.config = config + snap.epochSize = epochSize snap.sigCache = sigCache snap.ethAPI = ethAPI // reset cache @@ -109,7 +111,7 @@ func (s *Snapshot) copyValidators() []common.Address { // copy creates a deep copy of the snapshot func (s *Snapshot) copy() *Snapshot { cpy := &Snapshot{ - config: s.config, + epochSize: s.epochSize, ethAPI: s.ethAPI, sigCache: s.sigCache, validatorSet: make(map[common.Address]struct{}), @@ -160,7 +162,7 @@ func (s *Snapshot) apply(headers []*types.Header, chain consensus.ChainHeaderRea return nil, errUnauthorizedValidator } // change validator set - if number > 0 && number%s.config.EpochSize == 0 { + if number > 0 && number%s.epochSize == 0 { checkpointHeader := FindAncientHeader(header, uint64(len(snap.Validators)/2), chain, parents) if checkpointHeader == nil { return nil, consensus.ErrUnknownAncestor @@ -251,3 +253,100 @@ func FindAncientHeader(header *types.Header, ite uint64, chain consensus.ChainHe } return ancient } + +// snapshot retrieves the authorization snapshot at a given point in time. +func (dc *DogeChain) snapshot(chain consensus.ChainHeaderReader, number uint64, hash common.Hash, parents []*types.Header) (*Snapshot, error) { + // Search for a snapshot in memory or on disk for checkpoints + var ( + headers []*types.Header + snap *Snapshot + ) + + for snap == nil { + // If an in-memory snapshot was found, use that + if s, ok := dc.recentSnaps.Get(hash); ok { + snap = s.(*Snapshot) + break + } + + // If an on-disk checkpoint snapshot can be found, use that + if number%checkpointInterval == 0 { + if s, err := loadSnapshot(dc.epochSize, dc.signatures, dc.db, hash, dc.ethAPI); err == nil { + log.Trace("Loaded snapshot from disk", "number", number, "hash", hash) + snap = s + break + } + } + + // If we're at the genesis, snapshot the initial state. + if number == 0 { + checkpoint := chain.GetHeaderByNumber(number) + if checkpoint != nil { + // get checkpoint data + hash := checkpoint.Hash() + + if len(checkpoint.Extra) <= ExtraVanity { + return nil, errors.New("invalid extra-data for genesis block, check the genesis.json file") + } + + // get validators from headers + extra, err := types.GetIbftExtra(checkpoint.Extra) + if err != nil { + return nil, err + } + + // new snap shot + snap = newSnapshot(dc.epochSize, dc.signatures, number, hash, extra.Validators, dc.ethAPI) + if err := snap.store(dc.db); err != nil { + return nil, err + } + log.Info("Stored checkpoint snapshot to disk", "number", number, "hash", hash) + break + } + } + + // No snapshot for this header, gather the header and move backward + var header *types.Header + if len(parents) > 0 { + // If we have explicit parents, pick from there (enforced) + header = parents[len(parents)-1] + if header.Hash() != hash || header.Number.Uint64() != number { + return nil, consensus.ErrUnknownAncestor + } + parents = parents[:len(parents)-1] + } else { + // No explicit parents (or no more left), reach out to the database + header = chain.GetHeader(hash, number) + if header == nil { + return nil, consensus.ErrUnknownAncestor + } + } + headers = append(headers, header) + number, hash = number-1, header.ParentHash + } + + // check if snapshot is nil + if snap == nil { + return nil, fmt.Errorf("unknown error while retrieving snapshot at block number %v", number) + } + + // Previous snapshot found, apply any pending headers on top of it + for i := 0; i < len(headers)/2; i++ { + headers[i], headers[len(headers)-1-i] = headers[len(headers)-1-i], headers[i] + } + + snap, err := snap.apply(headers, chain, parents, dc.chainConfig.ChainID) + if err != nil { + return nil, err + } + dc.recentSnaps.Add(snap.Hash, snap) + + // If we've generated a new checkpoint snapshot, save to disk + if snap.Number%checkpointInterval == 0 && len(headers) > 0 { + if err = snap.store(dc.db); err != nil { + return nil, err + } + log.Trace("Stored snapshot to disk", "number", snap.Number, "hash", snap.Hash) + } + return snap, err +} diff --git a/consensus/ibft/abi.go b/consensus/drab/abi.go similarity index 99% rename from consensus/ibft/abi.go rename to consensus/drab/abi.go index 734d6c256e..862ec4ef4c 100644 --- a/consensus/ibft/abi.go +++ b/consensus/drab/abi.go @@ -1,4 +1,4 @@ -package ibft +package drab const validatorSetABI = ` [ diff --git a/consensus/ibft/api.go b/consensus/drab/api.go similarity index 91% rename from consensus/ibft/api.go rename to consensus/drab/api.go index 08550b4489..d9e6b5abcc 100644 --- a/consensus/ibft/api.go +++ b/consensus/drab/api.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . -package ibft +package drab import ( "github.com/ethereum/go-ethereum/common" @@ -26,7 +26,7 @@ import ( // API is a user facing RPC API to allow query snapshot and validators type API struct { chain consensus.ChainHeaderReader - ibft *IBFT + drab *Drab } // GetSnapshot retrieves the state snapshot at a given block. @@ -42,7 +42,7 @@ func (api *API) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error) { if header == nil { return nil, errUnknownBlock } - return api.ibft.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil) + return api.drab.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil) } // GetSnapshotAtHash retrieves the state snapshot at a given block. @@ -51,7 +51,7 @@ func (api *API) GetSnapshotAtHash(hash common.Hash) (*Snapshot, error) { if header == nil { return nil, errUnknownBlock } - return api.ibft.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil) + return api.drab.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil) } // GetValidators retrieves the list of validators at the specified block. @@ -67,7 +67,7 @@ func (api *API) GetValidators(number *rpc.BlockNumber) ([]common.Address, error) if header == nil { return nil, errUnknownBlock } - snap, err := api.ibft.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil) + snap, err := api.drab.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil) if err != nil { return nil, err } @@ -81,7 +81,7 @@ func (api *API) GetValidatorsAtHash(hash common.Hash) ([]common.Address, error) if header == nil { return nil, errUnknownBlock } - snap, err := api.ibft.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil) + snap, err := api.drab.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil) if err != nil { return nil, err } diff --git a/consensus/ibft/bridge.go b/consensus/drab/bridge.go similarity index 80% rename from consensus/ibft/bridge.go rename to consensus/drab/bridge.go index 28ca7a6ae0..36e2661e9a 100644 --- a/consensus/ibft/bridge.go +++ b/consensus/drab/bridge.go @@ -1,4 +1,4 @@ -package ibft +package drab import ( "errors" @@ -22,7 +22,19 @@ var ( _vaultContractAddr = common.HexToAddress(dccontracts.DCVaultContract) ) -func (p *IBFT) handleBridgeLog(log *types.Log, state *state.StateDB) error { +func (d *Drab) handleBridgeEvents(state *state.StateDB, receipts []*types.Receipt) error { + // Handle bridge logs + for _, receipt := range receipts { + for _, rlog := range receipt.Logs { + if err := d.handleBridgeLog(rlog, state); err != nil { + return err + } + } + } + return nil +} + +func (d *Drab) handleBridgeLog(log *types.Log, state *state.StateDB) error { // Ensures it is a bridge log if log.Address != _bridgeContractAddr { return nil @@ -31,23 +43,24 @@ func (p *IBFT) handleBridgeLog(log *types.Log, state *state.StateDB) error { if len(log.Topics) == 0 { return nil } - // get event from topic - ev, err := p.bridgeABI.EventByID(log.Topics[0]) + // Get event from topic. + // The ABI should be backward compatible + ev, err := d.bridgeABI.EventByID(log.Topics[0]) if err != nil { return err } - // use rawname for abi content matching + // Use rawname for bridge event matching switch ev.RawName { case _eventDeposited: - deposited, err := parseDepositedEvent(p.bridgeABI, ev, log) + deposited, err := parseDepositedEvent(d.bridgeABI, ev, log) if err != nil { return err } // deposit from bridge state.AddBalance(deposited.Receiver, deposited.Amount) case _eventWithdrawn: - withdrawn, err := parseWithdrawnEvent(p.bridgeABI, ev, log) + withdrawn, err := parseWithdrawnEvent(d.bridgeABI, ev, log) if err != nil { return err } @@ -58,7 +71,7 @@ func (p *IBFT) handleBridgeLog(log *types.Log, state *state.StateDB) error { // the fee goes to system Vault contract state.AddBalance(_vaultContractAddr, withdrawn.Fee) case _eventBurned: - burned, err := parseBurnedEvent(p.bridgeABI, ev, log) + burned, err := parseBurnedEvent(d.bridgeABI, ev, log) if err != nil { return err } diff --git a/consensus/ibft/bridge_test.go b/consensus/drab/bridge_test.go similarity index 99% rename from consensus/ibft/bridge_test.go rename to consensus/drab/bridge_test.go index 7ed5250f0b..6147463e94 100644 --- a/consensus/ibft/bridge_test.go +++ b/consensus/drab/bridge_test.go @@ -1,4 +1,4 @@ -package ibft +package drab import ( "math/big" diff --git a/consensus/drab/drab.go b/consensus/drab/drab.go new file mode 100644 index 0000000000..3fccc161f0 --- /dev/null +++ b/consensus/drab/drab.go @@ -0,0 +1,1328 @@ +package drab + +import ( + "bytes" + "context" + "encoding/hex" + "errors" + "fmt" + "io" + "math" + "math/big" + "strings" + "sync" + "time" + + lru "github.com/hashicorp/golang-lru" + "golang.org/x/crypto/sha3" + + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/gopool" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/consensus" + "github.com/ethereum/go-ethereum/consensus/misc" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/dccontracts" + "github.com/ethereum/go-ethereum/core/forkid" + "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethdb" + "github.com/ethereum/go-ethereum/internal/ethapi" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rlp" + "github.com/ethereum/go-ethereum/rpc" + "github.com/ethereum/go-ethereum/trie" +) + +const ( + inMemorySnapshots = 128 // Number of recent snapshots to keep in memory + inMemorySignatures = 4096 // Number of recent block signatures to keep in memory + + checkpointInterval = 1024 // Number of blocks after which to save the snapshot to the database + defaultEpochLength = uint64(100000) // Default number of blocks of checkpoint to update validatorSet from contract + defaultBlockTime = uint64(2) // Default seconds between blocks + + // signature extra data + + extraVanity = 32 // Fixed number of extra-data prefix bytes reserved for signer vanity + extraSeal = 65 // Fixed number of extra-data suffix bytes reserved for signer seal + nextForkHashSize = 4 // Fixed number of extra-data suffix bytes reserved for nextForkHash. +) + +var ( + systemContracts = map[common.Address]bool{ + common.HexToAddress(dccontracts.DCValidatorSetContract): true, + common.HexToAddress(dccontracts.DCBridgeContract): true, + common.HexToAddress(dccontracts.DCVaultContract): true, + } + + diffInTurn = big.NewInt(2) // Block difficulty for in-turn signatures + diffNoTurn = big.NewInt(1) // Block difficulty for out-of-turn signatures +) + +// Various error messages to mark blocks invalid. These should be private to +// prevent engine specific errors from being referenced in the remainder of the +// codebase, inherently breaking if the engine is swapped out. Please put common +// error types into the consensus package. +var ( + // errUnknownBlock is returned when the list of validators is requested for a block + // that is not part of the local blockchain. + errUnknownBlock = errors.New("unknown block") + + // errMissingVanity is returned if a block's extra-data section is shorter than + // 32 bytes, which is required to store the signer vanity. + errMissingVanity = errors.New("extra-data 32 byte vanity prefix missing") + + // errMissingSignature is returned if a block's extra-data section doesn't seem + // to contain a 65 byte secp256k1 signature. + errMissingSignature = errors.New("extra-data 65 byte signature suffix missing") + + // errExtraValidators is returned if non-sprint-end block contain validator data in + // their extra-data fields. + errExtraValidators = errors.New("non-sprint-end block contains extra validator list") + + // errInvalidSpanValidators is returned if a block contains an + // invalid list of validators (i.e. non divisible by 20 bytes). + errInvalidSpanValidators = errors.New("invalid validator list on sprint end block") + + // errInvalidMixDigest is returned if a block's mix digest is non-zero. + errInvalidMixDigest = errors.New("non-zero mix digest") + + // errInvalidCoinbase is returned when coinbase not match with block sealer(validator). + errInvalidCoinbase = errors.New("invalid coinbase") + + // errValidatorNotAuthorized is returned when validator not authorized by community. + errValidatorNotAuthorized = errors.New("validator is not authorized") + + // errInvalidUncleHash is returned if a block contains an non-empty uncle list. + errInvalidUncleHash = errors.New("non empty uncle hash") + + // errMismatchingEpochValidators is returned if a sprint block contains a + // list of validators different than the one the local node calculated. + errMismatchingEpochValidators = errors.New("mismatching validator list on epoch block") + + // errInvalidDifficulty is returned if the difficulty of a block is missing. + errInvalidDifficulty = errors.New("invalid difficulty") + + // errWrongDifficulty is returned if the difficulty of a block doesn't match the + // turn of the signer. + errWrongDifficulty = errors.New("wrong difficulty") + + // errOutOfRangeChain is returned if an authorization list is attempted to + // be modified via out-of-range or non-contiguous headers. + errOutOfRangeChain = errors.New("out of range or non-contiguous chain") + + // errBlockHashInconsistent is returned if an authorization list is attempted to + // insert an inconsistent block. + errBlockHashInconsistent = errors.New("the block hash is inconsistent") + + // errUnauthorizedValidator is returned if a header is signed by a non-authorized entity. + errUnauthorizedValidator = errors.New("unauthorized validator") + + // errRecentlySigned is returned if a header is signed by an authorized entity + // that already signed a header recently, thus is temporarily not allowed to. + errRecentlySigned = errors.New("recently signed") +) + +// SignerFn is a signer callback function to request a header to be signed by a +// backing account. +type SignerFn func(accounts.Account, string, []byte) ([]byte, error) +type SignerTxFn func(accounts.Account, *types.Transaction, *big.Int) (*types.Transaction, error) + +func isToSystemContract(to common.Address) bool { + return systemContracts[to] +} + +// ecrecover extracts the Ethereum account address from a signed header. +func ecrecover(header *types.Header, sigCache *lru.ARCCache, chainId *big.Int) (common.Address, error) { + // If the signature's already cached, return that + hash := header.Hash() + if address, known := sigCache.Get(hash); known { + return address.(common.Address), nil + } + // Retrieve the signature from the header extra-data + if len(header.Extra) < extraSeal { + return common.Address{}, errMissingSignature + } + signature := header.Extra[len(header.Extra)-extraSeal:] + + // Recover the public key and the Ethereum address + pubkey, err := crypto.Ecrecover(SealHash(header, chainId).Bytes(), signature) + if err != nil { + return common.Address{}, err + } + var signer common.Address + copy(signer[:], crypto.Keccak256(pubkey[1:])[12:]) + + sigCache.Add(hash, signer) + return signer, nil +} + +// Drab is the consensus engine of DBSC +// +// It is similar to parlia, implementing PoSA, too. +type Drab struct { + chainConfig *params.ChainConfig // Chain config + config *params.DrabConfig // Consensus engine configuration parameters for drab consensus + genesisHash common.Hash + db ethdb.Database // Database to store and retrieve snapshot checkpoints + + recentSnaps *lru.ARCCache // Snapshots for recent block to speed up + signatures *lru.ARCCache // Signatures of recent blocks to speed up mining + + signer types.Signer + + val common.Address // Ethereum address of the signing key + signFn SignerFn // Signer function to authorize hashes with + signTxFn SignerTxFn + + lock sync.RWMutex // Protects the signer fields + + ethAPI *ethapi.PublicBlockChainAPI + validatorSetABI *abi.ABI + bridgeABI *abi.ABI + vaultABI *abi.ABI +} + +// New creates a Drab consensus engine. +func New( + chainConfig *params.ChainConfig, + db ethdb.Database, + ethAPI *ethapi.PublicBlockChainAPI, + genesisHash common.Hash, +) *Drab { + // get config + cfg := chainConfig.Drab + + // Set any missing consensus parameters to their defaults + if cfg != nil && cfg.EpochSize == 0 { + cfg.EpochSize = defaultEpochLength + } + + if cfg != nil && cfg.BlockTime == 0 { + cfg.BlockTime = defaultBlockTime + } + + // Allocate the snapshot caches and create the engine + recentSnaps, err := lru.NewARC(inMemorySnapshots) + if err != nil { + panic(err) + } + // Signatures + signatures, err := lru.NewARC(inMemorySignatures) + if err != nil { + panic(err) + } + // ABI(s) + vABI, err := abi.JSON(strings.NewReader(validatorSetABI)) + if err != nil { + panic(err) + } + bABI, err := abi.JSON(strings.NewReader(bridgeABI)) + if err != nil { + panic(err) + } + vaultABI, err := abi.JSON(strings.NewReader(vaultABI)) + if err != nil { + panic(err) + } + + c := &Drab{ + chainConfig: chainConfig, + config: cfg, + genesisHash: genesisHash, + db: db, + ethAPI: ethAPI, + recentSnaps: recentSnaps, + signatures: signatures, + validatorSetABI: &vABI, + bridgeABI: &bABI, + vaultABI: &vaultABI, + signer: types.NewEIP155Signer(chainConfig.ChainID), + } + + return c +} + +func (d *Drab) shouldWriteSystemTransactions(header *types.Header) bool { + // Begin with detroit hard fork, we do get some "system transactions", + // but we don't treat them as system transactions and make direct + // contract call only after hawaii hard fork. + return d.chainConfig.IsHawaii(header.Number) +} + +func (d *Drab) IsSystemTransaction(tx *types.Transaction, header *types.Header) (bool, error) { + // Ensures activeness + if !d.shouldWriteSystemTransactions(header) { + return false, nil + } + // Deploy a contract. + if tx.To() == nil { + return false, nil + } + // System transaction will not charge. + if tx.GasPrice().Cmp(big.NewInt(0)) != 0 { + return false, nil + } + // Check out the sender + sender, err := types.Sender(d.signer, tx) + if err != nil { + return false, errors.New("unauthorized transaction") + } + // Ensures coinbase send this transaction. + if sender != header.Coinbase { + return false, nil + } + // Ensures to system contracts + if !isToSystemContract(*tx.To()) { + return false, nil + } + + return true, nil +} + +func (d *Drab) IsSystemContract(to *common.Address) bool { + if to == nil { + return false + } + return isToSystemContract(*to) +} + +// Author implements consensus.Engine, returning the SystemAddress +func (d *Drab) Author(header *types.Header) (common.Address, error) { + return header.Coinbase, nil +} + +// VerifyHeader checks whether a header conforms to the consensus rules. +func (d *Drab) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error { + return d.verifyHeader(chain, header, nil) +} + +// VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers. The +// method returns a quit channel to abort the operations and a results channel to +// retrieve the async verifications (the order is that of the input slice). +func (d *Drab) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) { + abort := make(chan struct{}) + results := make(chan error, len(headers)) + + gopool.Submit(func() { + for i, header := range headers { + err := d.verifyHeader(chain, header, headers[:i]) + + select { + case <-abort: + return + case results <- err: + } + } + }) + return abort, results +} + +// verifyHeader checks whether a header conforms to the consensus rules.The +// caller may optionally pass in a batch of parents (ascending order) to avoid +// looking those up from the database. This is useful for concurrently verifying +// a batch of new headers. +func (d *Drab) verifyHeader(chain consensus.ChainHeaderReader, header *types.Header, parents []*types.Header) error { + if header.Number == nil { + return errUnknownBlock + } + + // Don't waste time checking blocks from the future + if header.Time > uint64(time.Now().Unix()) { + return consensus.ErrFutureBlock + } + + // Check that the extra-data contains the vanity, validators and signature. + if len(header.Extra) < extraVanity { + return errMissingVanity + } + if len(header.Extra) < extraVanity+extraSeal { + return errMissingSignature + } + + // check extra data + number := header.Number.Uint64() + isEpoch := number%d.config.EpochSize == 0 + + // Ensure that the extra-data contains a signer list on checkpoint, but none otherwise + signersBytes := len(header.Extra) - extraVanity - extraSeal + if !isEpoch && signersBytes != 0 { + return errExtraValidators + } + if isEpoch && signersBytes%validatorBytesLength != 0 { + return errInvalidSpanValidators + } + + // Ensure that the mix digest is drab mix hash + if header.MixDigest != types.DrapMixHash { + return errInvalidMixDigest + } + + // Ensure that the block doesn't contain any uncles which are meaningless in PoSA + if header.UncleHash != types.EmptyUncleHash { + return errInvalidUncleHash + } + + // Ensure that the block's difficulty is meaningful (may not be correct at this point) + if number > 0 { + if header.Difficulty == nil { + return errInvalidDifficulty + } + } + + // If all checks passed, validate any special fields for hard forks + if err := misc.VerifyForkHashes(chain.Config(), header, false); err != nil { + return err + } + + parent, err := d.getParent(chain, header, parents) + if err != nil { + return err + } + + // Verify the block's gas usage and (if applicable) verify the base fee. + if !chain.Config().IsLondon(header.Number) { + // Verify BaseFee not present before EIP-1559 fork. + if header.BaseFee != nil { + return fmt.Errorf("invalid baseFee before fork: have %d, expected 'nil'", header.BaseFee) + } + } else if err := misc.VerifyEip1559Header(chain.Config(), parent, header); err != nil { + // Verify the header's EIP-1559 attributes. + return err + } + + // All basic checks passed, verify cascading fields + return d.verifyCascadingFields(chain, header, parents) +} + +// verifyCascadingFields verifies all the header fields that are not standalone, +// rather depend on a batch of previous headers. The caller may optionally pass +// in a batch of parents (ascending order) to avoid looking those up from the +// database. This is useful for concurrently verifying a batch of new headers. +func (d *Drab) verifyCascadingFields(chain consensus.ChainHeaderReader, header *types.Header, parents []*types.Header) error { + // The genesis block is the always valid dead-end + number := header.Number.Uint64() + if number == 0 { + return nil + } + + parent, err := d.getParent(chain, header, parents) + if err != nil { + return err + } + + snap, err := d.snapshot(chain, number-1, header.ParentHash, parents) + if err != nil { + return err + } + + // Verify timestamp + err = d.blockTimeVerifyForHawaiiFork(snap, header, parent) + if err != nil { + return err + } + + // Verify that the gas limit is <= 2^63-1 + const capacity = uint64(0x7fffffffffffffff) + if header.GasLimit > capacity { + return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, capacity) + } + // Verify that the gasUsed is <= gasLimit + if header.GasUsed > header.GasLimit { + return fmt.Errorf("invalid gasUsed: have %d, gasLimit %d", header.GasUsed, header.GasLimit) + } + + // Verify that the gas limit remains within allowed bounds + if err := d.verifyGasLimit(parent, header); err != nil { + return err + } + + // Verify the signer + return d.verifySeal(chain, header, parents) +} + +func (d *Drab) verifyGasLimit(parent, header *types.Header) error { + if d.chainConfig.IsLondon(header.Number) { + return misc.VerifyEip1559Header(d.chainConfig, parent, header) + } + return verifyGaslimit(parent.GasLimit, header.GasLimit) +} + +// getParent returns the parent of a given block. +func (d *Drab) getParent(chain consensus.ChainHeaderReader, header *types.Header, parents []*types.Header) (*types.Header, error) { + var parent *types.Header + number := header.Number.Uint64() + if len(parents) > 0 { + parent = parents[len(parents)-1] + } else { + parent = chain.GetHeader(header.ParentHash, number-1) + } + + if parent == nil || parent.Number.Uint64() != number-1 || parent.Hash() != header.ParentHash { + return nil, consensus.ErrUnknownAncestor + } + return parent, nil +} + +func (d *Drab) verifySeal(chain consensus.ChainHeaderReader, header *types.Header, parents []*types.Header) error { + // Verifying the genesis block is not supported + number := header.Number.Uint64() + if number == 0 { + return errUnknownBlock + } + + // Recover validator first + validator, err := ecrecover(header, d.signatures, d.chainConfig.ChainID) + if err != nil { + return err + } + // Ensure that coinbase is validator + if header.Coinbase != validator { + return errInvalidCoinbase + } + + // Check validator in list + snap, err := d.snapshot(chain, header.Number.Uint64()-1, header.ParentHash, parents) + if err != nil { + return err + } + if !snap.includeValidator(validator) { + return errValidatorNotAuthorized + } + + // Ensure that validator not sign recently + for seen, recent := range snap.Recents { + if recent == validator { + // Validator is among recents, only fail if the current block doesn't shift it out + if limit := uint64(snap.blockLimit()); seen+limit > number { + log.Debug("verify validator found sealed recently", "seen", seen, "limit", limit, "number", number) + return errRecentlySigned + } + } + } + + // Ensure that the difficulty corresponds to the turn-ness of the validator + inturn := snap.inturn(validator) + if inturn && header.Difficulty.Cmp(diffInTurn) != 0 { + return errWrongDifficulty + } + if !inturn && header.Difficulty.Cmp(diffNoTurn) != 0 { + return errWrongDifficulty + } + + return nil +} + +// snapshot retrieves the authorization snapshot at a given point in time. +func (d *Drab) snapshot(chain consensus.ChainHeaderReader, number uint64, hash common.Hash, parents []*types.Header) (*Snapshot, error) { + // Search for a snapshot in memory or on disk for checkpoints + var ( + headers []*types.Header + snap *Snapshot + ) + + for snap == nil { + // If an in-memory snapshot was found, use that + if s, ok := d.recentSnaps.Get(hash); ok { + snap = s.(*Snapshot) + break + } + + // If an on-disk checkpoint snapshot can be found, use that + if number%checkpointInterval == 0 { + if s, err := loadSnapshot(d.config, d.signatures, d.db, hash, d.ethAPI); err == nil { + snap = s + log.Debug("Loaded snapshot from disk", "number", number, "hash", hash, "validatorsLen", len(s.Validators), "recentsLen", len(s.Recents), "recentForkHash", s.RecentForkHashes) + + // quick fix for not correctly saved recent validators + if len(s.Recents) >= len(s.Validators) { + s.Recents = make(map[uint64]common.Address) + } + break + } + } + + // If we're on hawaii hardfork block, we need to use dc snapshot and store it + if d.chainConfig.IsOnHawaii(big.NewInt(int64(number + 1))) { + // get checkpoint data + checkpoint := chain.GetHeaderByNumber(number) + if checkpoint == nil { + return nil, errUnknownBlock + } + + // get the extra part that contains the seal + extra, err := types.GetIbftExtra(checkpoint.Extra) + if err != nil { + return nil, err + } + + // new snapshot + snap = newSnapshot(d.config, d.signatures, number, hash, extra.Validators, d.ethAPI) + if err := snap.store(d.db); err != nil { + return nil, err + } + + log.Info("Stored hawaii hardfork checkpoint snapshot to disk", + "number", number, "hash", hash, "validators", len(extra.Validators), "recents", len(snap.Recents)) + break + } + + // If we're at the genesis, snapshot the initial state. + if number == 0 { + checkpoint := chain.GetHeaderByNumber(number) + if checkpoint != nil { + // get checkpoint data + hash := checkpoint.Hash() + + if len(checkpoint.Extra) <= extraVanity+extraSeal { + return nil, errors.New("invalid extra-data for genesis block, check the genesis.json file") + } + + validatorBytes := checkpoint.Extra[extraVanity : len(checkpoint.Extra)-extraSeal] + // get validators from headers + validators, err := parseValidators(validatorBytes) + if err != nil { + return nil, err + } + + // new snapshot + snap = newSnapshot(d.config, d.signatures, number, hash, validators, d.ethAPI) + if err := snap.store(d.db); err != nil { + return nil, err + } + + log.Info("Stored checkpoint snapshot to disk", "number", number, "hash", hash) + break + } + } + + // No snapshot for this header, gather the header and move backward + var header *types.Header + if len(parents) > 0 { + // If we have explicit parents, pick from there (enforced) + header = parents[len(parents)-1] + if header.Hash() != hash || header.Number.Uint64() != number { + return nil, consensus.ErrUnknownAncestor + } + parents = parents[:len(parents)-1] + } else { + // No explicit parents (or no more left), reach out to the database + header = chain.GetHeader(hash, number) + if header == nil { + return nil, consensus.ErrUnknownAncestor + } + } + headers = append(headers, header) + number, hash = number-1, header.ParentHash + } + + // check if snapshot is nil + if snap == nil { + return nil, fmt.Errorf("unknown error while retrieving snapshot at block number %v", number) + } + + // Previous snapshot found, reverse header to ascending order + reverse(headers) + + // Apply headers recently to get current snapshot + snap, err := snap.apply(headers, chain, parents, d.chainConfig.ChainID) + if err != nil { + return nil, err + } + d.recentSnaps.Add(snap.Hash, snap) + log.Debug("snap after applying headers", "number", number, "hash", snap.Hash, "validators", len(snap.Validators), "limit", snap.blockLimit(), "recents", snap.Recents) + + // If we've generated a new checkpoint snapshot, save to disk + if snap.Number%checkpointInterval == 0 && len(headers) > 0 { + if err = snap.store(d.db); err != nil { + return nil, err + } + log.Trace("Stored snapshot to disk", "number", snap.Number, "hash", snap.Hash) + } + return snap, err +} + +func reverse[S ~[]E, E any](s S) { + for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { + s[i], s[j] = s[j], s[i] + } +} + +// VerifyUncles implements consensus.Engine, always returning an error for any +// uncles as this consensus mechanism doesn't permit uncles. +func (d *Drab) VerifyUncles(chain consensus.ChainReader, block *types.Block) error { + if len(block.Uncles()) > 0 { + return errors.New("uncles not allowed") + } + return nil +} + +// Prepare implements consensus.Engine, preparing all the consensus fields of the +// header for running the transactions on top. +func (d *Drab) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error { + header.Coinbase = d.val + header.Nonce = types.BlockNonce{} + header.MixDigest = types.DrapMixHash + header.UncleHash = types.EmptyRootHash // empty uncle + + number := header.Number.Uint64() + snap, err := d.snapshot(chain, number-1, header.ParentHash, nil) + if err != nil { + return err + } + + // Set the correct difficulty + header.Difficulty = calcDifficulty(snap, d.val) + + // Ensure the extra data has all it's components + if len(header.Extra) < extraVanity-nextForkHashSize { + header.Extra = append(header.Extra, bytes.Repeat([]byte{0x00}, extraVanity-nextForkHashSize-len(header.Extra))...) + } + // reset to 28 bytes + header.Extra = header.Extra[:extraVanity-nextForkHashSize] + // append next fork hash (only 4 bytes) + nextForkHash := forkid.NextForkHash(d.chainConfig, d.genesisHash, number) + header.Extra = append(header.Extra, nextForkHash[:]...) + + // update validators on epoch block + if number%d.config.EpochSize == 0 { + newValidators, err := d.getCurrentValidators(header.ParentHash, new(big.Int).Sub(header.Number, common.Big1)) + if err != nil { + return err + } + // Use original sequence which should be sorted + for _, validator := range newValidators { + header.Extra = append(header.Extra, validator.Bytes()...) + } + } + + // add extra seal space + header.Extra = append(header.Extra, make([]byte, extraSeal)...) + + // Ensure the timestamp has the correct delay + parent := chain.GetHeader(header.ParentHash, number-1) + if parent == nil { + return consensus.ErrUnknownAncestor + } + // make sure timestamp matches current + header.Time = d.blockTimeForHawaiiFork(snap, header, parent) + if header.Time < uint64(time.Now().Unix()) { + header.Time = uint64(time.Now().Unix()) + } + + return nil +} + +// Finalize implements consensus.Engine, ensuring no uncles are set, nor block +// rewards given, bridge logs are handled. +func (d *Drab) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs *[]*types.Transaction, + uncles []*types.Header, receipts *[]*types.Receipt, systemTxs *[]*types.Transaction, usedGas *uint64) error { + // warn if not in majority fork + number := header.Number.Uint64() + snap, err := d.snapshot(chain, number-1, header.ParentHash, nil) + if err != nil { + return err + } + nextForkHash := forkid.NextForkHash(d.chainConfig, d.genesisHash, number) + if !snap.isMajorityFork(hex.EncodeToString(nextForkHash[:])) { + log.Debug("there is a possible fork, and your client is not the majority. Please check...", "nextForkHash", hex.EncodeToString(nextForkHash[:])) + } + + // If the block is an epoch end block, verify the validator list + // The verification can only be done when the state is ready, it can't be done in VerifyHeader. + if header.Number.Uint64()%d.config.EpochSize == 0 { + newValidators, err := d.getCurrentValidators(header.ParentHash, new(big.Int).Sub(header.Number, common.Big1)) + if err != nil { + return err + } + // Join validator addresses into one slice + validatorsBytes := make([]byte, 0, len(newValidators)*validatorBytesLength) + for _, validator := range newValidators { + validatorsBytes = append(validatorsBytes, validator.Bytes()...) + } + + extraSuffix := len(header.Extra) - extraSeal + if !bytes.Equal(header.Extra[extraVanity:extraSuffix], validatorsBytes) { + return errMismatchingEpochValidators + } + } + + // Apply system transactions at last. + ctx := chainContext{Chain: chain, engine: d} + if header.Difficulty.Cmp(diffInTurn) != 0 { + // Some one need to be slashed + spoiledVal := snap.supposeValidator() + signedRecently := false + for _, recent := range snap.Recents { + if recent == spoiledVal { + signedRecently = true + break + } + } + if !signedRecently { + log.Trace("slash validator", "block hash", header.Hash(), "address", spoiledVal) + err = d.slash(spoiledVal, state, header, ctx, txs, receipts, systemTxs, usedGas, false) + if err != nil { + // impossible failure + log.Error("slash validator failed", "block hash", header.Hash(), "address", spoiledVal) + return err + } + } + } + + // Distribute incomes + val := header.Coinbase + if err := d.distributeToValidator(val, state, header, ctx, txs, receipts, systemTxs, usedGas, false); err != nil { + return err + } + + // not consider it a system transaction + if len(*systemTxs) > 0 { + return errors.New("the length of systemTxs do not match") + } + + // Handle bridge events + return d.handleBridgeEvents(state, *receipts) +} + +// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set, +// nor block rewards given, bridge logs are handled, and returns the final block. +func (d *Drab) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, + txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) { + // No block rewards in PoA, so the state remains as is and uncles are dropped + cx := chainContext{Chain: chain, engine: d} + if txs == nil { + txs = make([]*types.Transaction, 0) + } + if receipts == nil { + receipts = make([]*types.Receipt, 0) + } + + // check out whether sealer is out of turn + if header.Difficulty.Cmp(diffInTurn) != 0 { + number := header.Number.Uint64() + + snap, err := d.snapshot(chain, number-1, header.ParentHash, nil) + if err != nil { + return nil, nil, err + } + + // Expected validator in turn, but we don't care about every block + // it must sign. It is OK to go, if it signed recently. + spoiledVal := snap.supposeValidator() + signedRecently := false + for _, recent := range snap.Recents { + if recent == spoiledVal { + signedRecently = true + break + } + } + if !signedRecently { + // Slash validator who didn't sign recently + err = d.slash(spoiledVal, state, header, cx, &txs, &receipts, nil, &header.GasUsed, true) + if err != nil { + // Possible failure because of the slash channel is disabled. + // DC contract not implement this feature, so it is only in case. + log.Error("slash validator failed", "block hash", header.Hash(), "address", spoiledVal) + } + } + } + + // system reward + if err := d.distributeToValidator(d.val, state, header, cx, &txs, &receipts, nil, &header.GasUsed, true); err != nil { + return nil, nil, err + } + + // bridge events + if err := d.handleBridgeEvents(state, receipts); err != nil { + return nil, nil, err + } + + // should not happen. Once happen, stop the node is better than broadcast the block + if header.GasLimit < header.GasUsed { + return nil, nil, errors.New("gas consumption of system txs exceed the gas limit") + } + + // calculate root + var blk *types.Block + var rootHash common.Hash + wg := sync.WaitGroup{} + wg.Add(2) + go func() { + rootHash = state.IntermediateRoot(chain.Config().IsEIP158(header.Number)) + wg.Done() + }() + go func() { + blk = types.NewBlock(header, txs, nil, receipts, trie.NewStackTrie(nil)) + wg.Done() + }() + wg.Wait() + blk.SetRoot(rootHash) + + // Assemble and return the final block for sealing + return blk, receipts, nil +} + +// Authorize injects a private key into the consensus engine to mint new blocks +// with. +func (d *Drab) Authorize(val common.Address, signFn SignerFn, signTxFn SignerTxFn) { + d.lock.Lock() + defer d.lock.Unlock() + + d.val = val + d.signFn = signFn + d.signTxFn = signTxFn +} + +// Argument leftOver is the time reserved for block finalize(calculate root, distribute income...) +func (d *Drab) Delay(chain consensus.ChainReader, header *types.Header, leftOver *time.Duration) *time.Duration { + number := header.Number.Uint64() + snap, err := d.snapshot(chain, number-1, header.ParentHash, nil) + if err != nil { + return nil + } + + delay := d.delayForHawaiiFork(snap, header) + + if *leftOver >= time.Duration(d.config.BlockTime)*time.Second { + // ignore invalid leftOver + log.Error("Delay invalid argument", "leftOver", leftOver.String(), "BlockTime", d.config.BlockTime) + } else if *leftOver >= delay { + // no left time + delay = time.Duration(0) + return &delay + } else { + // delay + delay = delay - *leftOver + } + + // The blocking time should be no more than half of period + half := time.Duration(d.config.BlockTime) * time.Second / 2 + if delay > half { + delay = half + } + return &delay +} + +// Seal implements consensus.Engine, attempting to create a sealed block using +// the local signing credentials. +func (d *Drab) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error { + header := block.Header() + + // Sealing the genesis block is not supported + number := header.Number.Uint64() + if number == 0 { + return errUnknownBlock + } + // For 0-period chains, refuse to seal empty blocks (no reward but would spin sealing) + if d.config.BlockTime == 0 && len(block.Transactions()) == 0 { + log.Info("Sealing paused, waiting for transactions") + return nil + } + // Don't hold the val fields for the entire sealing procedure + d.lock.RLock() + val, signFn := d.val, d.signFn + d.lock.RUnlock() + + snap, err := d.snapshot(chain, number-1, header.ParentHash, nil) + if err != nil { + return err + } + + // Bail out if we're unauthorized to sign a block + if !snap.includeValidator(val) { + return errUnauthorizedValidator + } + + // If we're amongst the recent signers, wait for the next block + for seen, recent := range snap.Recents { + if recent == val { + // Signer is among recents, only wait if the current block doesn't shift it out + if limit := uint64(snap.blockLimit()); number < limit || seen+limit > number { + log.Info("Sealing found signed recently, must wait for others", "seen", seen, "limit", limit, "number", number) + return nil + } + } + } + + // Sweet, the protocol permits us to sign the block, wait for our time + delay := d.delayForHawaiiFork(snap, header) + + log.Info("Sealing block with", "number", number, "delay", delay, "headerDifficulty", header.Difficulty, "val", val.Hex()) + + // Sign all the things! + sig, err := signFn(accounts.Account{Address: val}, accounts.MimetypeParlia, DrabRLP(header, d.chainConfig.ChainID)) + if err != nil { + return err + } + copy(header.Extra[len(header.Extra)-extraSeal:], sig) + + // Wait until sealing is terminated or delay timeout. + log.Trace("Waiting for slot to sign and propagate", "delay", common.PrettyDuration(delay)) + go func() { + select { + case <-stop: + return + case <-time.After(delay): + } + if d.shouldWaitForCurrentBlockProcess(chain, header, snap) { + log.Info("Waiting for received in turn block to process") + select { + case <-stop: + log.Info("Received block process finished, abort block seal") + return + case <-time.After(time.Duration(processBackOffTime) * time.Second): + log.Info("Process backoff time exhausted, start to seal block") + } + } + + select { + case results <- block.WithSeal(header): + default: + log.Warn("Sealing result is not read by miner", "sealhash", SealHash(header, d.chainConfig.ChainID)) + } + }() + + return nil +} + +func (d *Drab) shouldWaitForCurrentBlockProcess(chain consensus.ChainHeaderReader, header *types.Header, snap *Snapshot) bool { + if header.Difficulty.Cmp(diffInTurn) == 0 { + return false + } + + highestVerifiedHeader := chain.GetHighestVerifiedHeader() + if highestVerifiedHeader == nil { + return false + } + + if header.ParentHash == highestVerifiedHeader.ParentHash { + return true + } + return false +} + +func (d *Drab) EnoughDistance(chain consensus.ChainReader, header *types.Header) bool { + snap, err := d.snapshot(chain, header.Number.Uint64()-1, header.ParentHash, nil) + if err != nil { + return true + } + return snap.enoughDistance(d.val, header) +} + +func (d *Drab) AllowLightProcess(chain consensus.ChainReader, currentHeader *types.Header) bool { + snap, err := d.snapshot(chain, currentHeader.Number.Uint64()-1, currentHeader.ParentHash, nil) + if err != nil { + return true + } + // validator is not allowed to diff sync + return !snap.includeValidator(d.val) +} + +func (d *Drab) IsLocalBlock(header *types.Header) bool { + return d.val == header.Coinbase +} + +// CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty +// that a new block should have based on the previous blocks in the chain and the +// current signer. +func (d *Drab) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int { + snap, err := d.snapshot(chain, parent.Number.Uint64(), parent.Hash(), nil) + if err != nil { + return nil + } + return calcDifficulty(snap, d.val) +} + +// calcDifficulty is the difficulty adjustment algorithm. It returns the difficulty +// that a new block should have based on the previous blocks in the chain and the +// current signer. +func calcDifficulty(snap *Snapshot, signer common.Address) *big.Int { + if snap.inturn(signer) { + return new(big.Int).Set(diffInTurn) + } + return new(big.Int).Set(diffNoTurn) +} + +// SealHash returns the hash of a block prior to it being sealed. +func (d *Drab) SealHash(header *types.Header) common.Hash { + return SealHash(header, d.chainConfig.ChainID) +} + +// APIs implements consensus.Engine, returning the user facing RPC API to query snapshot. +func (d *Drab) APIs(chain consensus.ChainHeaderReader) []rpc.API { + return []rpc.API{{ + Namespace: "drab", + Version: "1.0", + Service: &API{chain: chain, drab: d}, + Public: false, + }} +} + +// Close implements consensus.Engine. It's a noop for drab as there are no background threads. +func (d *Drab) Close() error { + return nil +} + +// ========================== interaction with contract/account ========= + +// getCurrentValidators get current validators +func (d *Drab) getCurrentValidators(blockHash common.Hash, blockNumber *big.Int) ([]common.Address, error) { + // block + blockNr := rpc.BlockNumberOrHashWithHash(blockHash, false) + + // method + method := "validators" + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() // cancel when we are finished consuming integers + + data, err := d.validatorSetABI.Pack(method) + if err != nil { + log.Error("Unable to pack tx for getValidators", "error", err) + return nil, err + } + // call + msgData := (hexutil.Bytes)(data) + toAddress := common.HexToAddress(dccontracts.DCValidatorSetContract) + gas := (hexutil.Uint64)(uint64(math.MaxUint64 / 2)) + result, err := d.ethAPI.Call(ctx, ethapi.TransactionArgs{ + Gas: &gas, + To: &toAddress, + Data: &msgData, + }, blockNr, nil) + if err != nil { + return nil, err + } + + var validators []common.Address + if err := d.validatorSetABI.UnpackIntoInterface(&validators, method, result); err != nil { + return nil, err + } + return validators, nil +} + +// slash spoiled validators +func (d *Drab) slash(spoiledValidator common.Address, state *state.StateDB, header *types.Header, chain core.ChainContext, + txs *[]*types.Transaction, receipts *[]*types.Receipt, receivedTxs *[]*types.Transaction, usedGas *uint64, mining bool) error { + // method + method := "slash" + + // get packed data + data, err := d.validatorSetABI.Pack(method, + spoiledValidator, + ) + if err != nil { + log.Error("Unable to pack tx for slash", "error", err) + return err + } + // get system message + msg := d.getSystemMessage(header.Coinbase, common.HexToAddress(dccontracts.DCValidatorSetContract), data, common.Big0) + // apply message + return d.applyTransaction(msg, state, header, chain, txs, receipts, receivedTxs, usedGas, mining) +} + +// slash spoiled validators +func (d *Drab) distributeToValidator(validator common.Address, + state *state.StateDB, header *types.Header, chain core.ChainContext, + txs *[]*types.Transaction, receipts *[]*types.Receipt, receivedTxs *[]*types.Transaction, usedGas *uint64, mining bool) error { + // method + method := "deposit" + + // get packed data + data, err := d.validatorSetABI.Pack(method) + if err != nil { + log.Error("Unable to pack tx for deposit", "error", err) + return err + } + // get system message + msg := d.getSystemMessage(header.Coinbase, common.HexToAddress(dccontracts.DCValidatorSetContract), data, common.Big0) + // apply message + return d.applyTransaction(msg, state, header, chain, txs, receipts, receivedTxs, usedGas, mining) +} + +// get system message +func (d *Drab) getSystemMessage(from, toAddress common.Address, data []byte, value *big.Int) callmsg { + return callmsg{ + ethereum.CallMsg{ + From: from, + Gas: math.MaxUint64 / 2, + GasPrice: big.NewInt(0), + Value: value, + To: &toAddress, + Data: data, + }, + } +} + +func (d *Drab) applyTransaction( + msg callmsg, + state *state.StateDB, + header *types.Header, + chainContext core.ChainContext, + txs *[]*types.Transaction, receipts *[]*types.Receipt, + receivedTxs *[]*types.Transaction, usedGas *uint64, mining bool, +) (err error) { + nonce := state.GetNonce(msg.From()) + expectedTx := types.NewTransaction(nonce, *msg.To(), msg.Value(), msg.Gas(), msg.GasPrice(), msg.Data()) + expectedHash := d.signer.Hash(expectedTx) + + if msg.From() == d.val && mining { + expectedTx, err = d.signTxFn(accounts.Account{Address: msg.From()}, expectedTx, d.chainConfig.ChainID) + if err != nil { + return err + } + } else { + if receivedTxs == nil || len(*receivedTxs) == 0 || (*receivedTxs)[0] == nil { + return errors.New("supposed to get a actual transaction, but get none") + } + actualTx := (*receivedTxs)[0] + if !bytes.Equal(d.signer.Hash(actualTx).Bytes(), expectedHash.Bytes()) { + return fmt.Errorf("expected tx hash %v, get %v, nonce %d, to %s, value %s, gas %d, gasPrice %s, data %s", expectedHash.String(), actualTx.Hash().String(), + expectedTx.Nonce(), + expectedTx.To().String(), + expectedTx.Value().String(), + expectedTx.Gas(), + expectedTx.GasPrice().String(), + hex.EncodeToString(expectedTx.Data()), + ) + } + expectedTx = actualTx + // move to next + *receivedTxs = (*receivedTxs)[1:] + } + state.Prepare(expectedTx.Hash(), len(*txs)) + gasUsed, err := applyMessage(msg, state, header, d.chainConfig, chainContext) + if err != nil { + return err + } + *txs = append(*txs, expectedTx) + var root []byte + if d.chainConfig.IsByzantium(header.Number) { + state.Finalise(true) + } else { + root = state.IntermediateRoot(d.chainConfig.IsEIP158(header.Number)).Bytes() + } + *usedGas += gasUsed + receipt := types.NewReceipt(root, false, *usedGas) + receipt.TxHash = expectedTx.Hash() + receipt.GasUsed = gasUsed + + // Set the receipt logs and create a bloom for filtering + receipt.Logs = state.GetLogs(expectedTx.Hash(), header.Hash()) + receipt.Bloom = types.CreateBloom(types.Receipts{receipt}) + receipt.BlockHash = header.Hash() + receipt.BlockNumber = header.Number + receipt.TransactionIndex = uint(state.TxIndex()) + *receipts = append(*receipts, receipt) + state.SetNonce(msg.From(), nonce+1) + return nil +} + +// =========================== utility function ========================== +// SealHash returns the hash of a block prior to it being sealed. +func SealHash(header *types.Header, chainId *big.Int) (hash common.Hash) { + hasher := sha3.NewLegacyKeccak256() + encodeSigHeader(hasher, header, chainId) + hasher.Sum(hash[:0]) + return hash +} + +// DrabRLP returns the rlp bytes which needs to be signed for the parlia +// sealing. The RLP to sign consists of the entire header apart from the 65 byte signature +// contained at the end of the extra data. +// +// Note, the method requires the extra data to be at least 65 bytes, otherwise it +// panics. This is done to avoid accidentally using both forms (signature present +// or not), which could be abused to produce different hashes for the same header. +func DrabRLP(header *types.Header, chainId *big.Int) []byte { + b := new(bytes.Buffer) + encodeSigHeader(b, header, chainId) + return b.Bytes() +} + +func encodeSigHeader(w io.Writer, header *types.Header, chainId *big.Int) { + err := rlp.Encode(w, []interface{}{ + chainId, + header.ParentHash, + header.UncleHash, + header.Coinbase, + header.Root, + header.TxHash, + header.ReceiptHash, + header.Bloom, + header.Difficulty, + header.Number, + header.GasLimit, + header.GasUsed, + header.Time, + header.Extra[:len(header.Extra)-65], // this will panic if extra is too short, should check before calling encodeSigHeader + header.MixDigest, + header.Nonce, + }) + if err != nil { + panic("can't encode: " + err.Error()) + } +} + +// chain context +type chainContext struct { + Chain consensus.ChainHeaderReader + engine consensus.Engine +} + +func (c chainContext) Engine() consensus.Engine { + return c.engine +} + +func (c chainContext) GetHeader(hash common.Hash, number uint64) *types.Header { + return c.Chain.GetHeader(hash, number) +} + +// callmsg implements core.Message to allow passing it as a transaction simulator. +type callmsg struct { + ethereum.CallMsg +} + +func (m callmsg) From() common.Address { return m.CallMsg.From } +func (m callmsg) Nonce() uint64 { return 0 } +func (m callmsg) CheckNonce() bool { return false } +func (m callmsg) To() *common.Address { return m.CallMsg.To } +func (m callmsg) GasPrice() *big.Int { return m.CallMsg.GasPrice } +func (m callmsg) Gas() uint64 { return m.CallMsg.Gas } +func (m callmsg) Value() *big.Int { return m.CallMsg.Value } +func (m callmsg) Data() []byte { return m.CallMsg.Data } + +// apply message +func applyMessage( + msg callmsg, + state *state.StateDB, + header *types.Header, + chainConfig *params.ChainConfig, + chainContext core.ChainContext, +) (uint64, error) { + // Create a new context to be used in the EVM environment + context := core.NewEVMBlockContext(header, chainContext, nil) + // Create a new environment which holds all relevant information + // about the transaction and calling mechanisms. + vmenv := vm.NewEVM(context, vm.TxContext{Origin: msg.From(), GasPrice: big.NewInt(0)}, state, chainConfig, vm.Config{}) + // Apply the transaction to the current state (included in the env) + ret, returnGas, err := vmenv.Call( + vm.AccountRef(msg.From()), + *msg.To(), + msg.Data(), + msg.Gas(), + msg.Value(), + ) + if err != nil { + log.Error("apply message failed", "msg", string(ret), "err", err) + } + return msg.Gas() - returnGas, err +} diff --git a/consensus/drab/gaslimit.go b/consensus/drab/gaslimit.go new file mode 100644 index 0000000000..482a391f74 --- /dev/null +++ b/consensus/drab/gaslimit.go @@ -0,0 +1,42 @@ +// Copyright 2021 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package drab + +import ( + "errors" + "fmt" + + "github.com/ethereum/go-ethereum/params" +) + +// verifyGaslimit verifies the header gas limit according increase/decrease +// in relation to the parent gas limit. +func verifyGaslimit(parentGasLimit, headerGasLimit uint64) error { + // Verify that the gas limit remains within allowed bounds + diff := int64(parentGasLimit) - int64(headerGasLimit) + if diff < 0 { + diff *= -1 + } + limit := parentGasLimit / params.GasLimitBoundDivisor + if uint64(diff) >= limit { + return fmt.Errorf("invalid gas limit: have %d, want %d +-= %d", headerGasLimit, parentGasLimit, limit-1) + } + if headerGasLimit < params.MinGasLimit { + return errors.New("invalid gas limit below 5000") + } + return nil +} diff --git a/consensus/drab/hawaii.go b/consensus/drab/hawaii.go new file mode 100644 index 0000000000..f46244b9c5 --- /dev/null +++ b/consensus/drab/hawaii.go @@ -0,0 +1,119 @@ +package drab + +import ( + "math/rand" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/consensus" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/log" +) + +const ( + wiggleTime = uint64(1) // second, Random delay (per signer) to allow concurrent signers + initialBackOffTime = uint64(1) // second + processBackOffTime = uint64(1) // second + wiggleTimeBeforeFork = 500 * time.Millisecond // Random delay (per signer) to allow concurrent signers + fixedBackOffTimeBeforeFork = 200 * time.Millisecond +) + +func (d *Drab) delayForHawaiiFork(snap *Snapshot, header *types.Header) time.Duration { + delay := time.Until(time.Unix(int64(header.Time), 0)) // nolint: gosimple + if header.Difficulty.Cmp(diffNoTurn) == 0 { + // It's not our turn explicitly to sign, delay it a bit + wiggle := time.Duration(snap.blockLimit()) * wiggleTimeBeforeFork + delay += fixedBackOffTimeBeforeFork + time.Duration(rand.Int63n(int64(wiggle))) + } + return delay +} + +func (d *Drab) blockTimeForHawaiiFork(snap *Snapshot, header, parent *types.Header) uint64 { + blockTime := parent.Time + d.config.BlockTime + if d.chainConfig.IsHawaii(header.Number) { + blockTime = blockTime + d.backOffTime(snap, header, d.val) + } + return blockTime +} + +func (d *Drab) blockTimeVerifyForHawaiiFork(snap *Snapshot, header, parent *types.Header) error { + if d.chainConfig.IsHawaii(header.Number) { + if header.Time < parent.Time+d.config.BlockTime+d.backOffTime(snap, header, header.Coinbase) { + return consensus.ErrFutureBlock + } + } + return nil +} + +func (d *Drab) backOffTime(snap *Snapshot, header *types.Header, val common.Address) uint64 { + if snap.inturn(val) { + return 0 + } else { + delay := initialBackOffTime + validators := snap.Validators + if d.chainConfig.IsHawaii(header.Number) { + // reverse the key/value of snap.Recents to get recentsMap + recentsMap := make(map[common.Address]uint64, len(snap.Recents)) + bound := uint64(0) + if n, limit := header.Number.Uint64(), uint64(len(validators)/2+1); n > limit { + bound = n - limit + } + for seen, recent := range snap.Recents { + if seen <= bound { + continue + } + recentsMap[recent] = seen + } + + // The backOffTime does not matter when a validator has signed recently. + if _, ok := recentsMap[val]; ok { + return 0 + } + + inTurnAddr := validators[(snap.Number+1)%uint64(len(validators))] + if _, ok := recentsMap[inTurnAddr]; ok { + log.Debug("in turn validator has recently signed, skip initialBackOffTime", + "inTurnAddr", inTurnAddr) + delay = 0 + } + + // Exclude the recently signed validators + temp := make([]common.Address, 0, len(validators)) + for _, addr := range validators { + if _, ok := recentsMap[addr]; ok { + continue + } + temp = append(temp, addr) + } + validators = temp + } + + // get the index of current validator and its shuffled backoff time. + idx := -1 + for index, itemAddr := range validators { + if val == itemAddr { + idx = index + } + } + if idx < 0 { + log.Info("The validator is not authorized", "addr", val) + return 0 + } + + s := rand.NewSource(int64(snap.Number)) + r := rand.New(s) + n := len(validators) + backOffSteps := make([]uint64, 0, n) + + for i := uint64(0); i < uint64(n); i++ { + backOffSteps = append(backOffSteps, i) + } + + r.Shuffle(n, func(i, j int) { + backOffSteps[i], backOffSteps[j] = backOffSteps[j], backOffSteps[i] + }) + + delay += backOffSteps[idx] * wiggleTime + return delay + } +} diff --git a/consensus/drab/snapshot.go b/consensus/drab/snapshot.go new file mode 100644 index 0000000000..8103368d83 --- /dev/null +++ b/consensus/drab/snapshot.go @@ -0,0 +1,363 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package drab + +import ( + "bytes" + "encoding/hex" + "encoding/json" + "errors" + "math/big" + "sort" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/consensus" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethdb" + "github.com/ethereum/go-ethereum/internal/ethapi" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/params" + lru "github.com/hashicorp/golang-lru" +) + +const ( + validatorBytesLength = common.AddressLength + snapshotKeyPrefix = "drab-" +) + +// Snapshot is the state of the validatorSet at a given point. +type Snapshot struct { + config *params.DrabConfig // Consensus engine parameters to fine tune behavior + ethAPI *ethapi.PublicBlockChainAPI + sigCache *lru.ARCCache // Cache of recent block signatures to speed up ecrecover + validatorSet map[common.Address]struct{} // validator set for quick query + + Number uint64 `json:"number"` // Block number where the snapshot was created + Hash common.Hash `json:"hash"` // Block hash where the snapshot was created + Validators []common.Address `json:"validators"` // Sequenced slice of authorized validators at this moment + Recents map[uint64]common.Address `json:"recents"` // Set of recent validators for spam protections + RecentForkHashes map[uint64]string `json:"recent_fork_hashes"` // Set of recent forkHash +} + +// newSnapshot creates a new snapshot with the specified startup parameters. This +// method does not initialize the set of recent validators, so only ever use it for +// the genesis block. +func newSnapshot( + config *params.DrabConfig, + sigCache *lru.ARCCache, + number uint64, + hash common.Hash, + validators []common.Address, + ethAPI *ethapi.PublicBlockChainAPI, +) *Snapshot { + snap := &Snapshot{ + config: config, + ethAPI: ethAPI, + sigCache: sigCache, + validatorSet: make(map[common.Address]struct{}), + Number: number, + Hash: hash, + Validators: validators, + Recents: make(map[uint64]common.Address), + RecentForkHashes: make(map[uint64]string), + } + for _, v := range validators { + snap.validatorSet[v] = struct{}{} + } + return snap +} + +// loadSnapshot loads an existing snapshot from the database. +func loadSnapshot(config *params.DrabConfig, sigCache *lru.ARCCache, db ethdb.Database, hash common.Hash, ethAPI *ethapi.PublicBlockChainAPI) (*Snapshot, error) { + blob, err := db.Get(append([]byte(snapshotKeyPrefix), hash[:]...)) + if err != nil { + return nil, err + } + snap := new(Snapshot) + if err := json.Unmarshal(blob, snap); err != nil { + return nil, err + } + snap.config = config + snap.sigCache = sigCache + snap.ethAPI = ethAPI + // reset cache + snap.validatorSet = make(map[common.Address]struct{}) + for _, val := range snap.Validators { + snap.validatorSet[val] = struct{}{} + } + + return snap, nil +} + +// store inserts the snapshot into the database. +func (s *Snapshot) store(db ethdb.Database) error { + blob, err := json.Marshal(s) + if err != nil { + return err + } + return db.Put(append([]byte(snapshotKeyPrefix), s.Hash[:]...), blob) +} + +func (s *Snapshot) copyValidators() []common.Address { + v := make([]common.Address, len(s.Validators)) + copy(v, s.Validators) + return v +} + +// copy creates a deep copy of the snapshot +func (s *Snapshot) copy() *Snapshot { + cpy := &Snapshot{ + config: s.config, + ethAPI: s.ethAPI, + sigCache: s.sigCache, + validatorSet: make(map[common.Address]struct{}), + Number: s.Number, + Hash: s.Hash, + Validators: make([]common.Address, 0, len(s.Validators)), + Recents: make(map[uint64]common.Address), + RecentForkHashes: make(map[uint64]string), + } + + for _, v := range s.Validators { + cpy.Validators = append(cpy.Validators, v) + cpy.validatorSet[v] = struct{}{} + } + for block, v := range s.Recents { + cpy.Recents[block] = v + } + for block, id := range s.RecentForkHashes { + cpy.RecentForkHashes[block] = id + } + return cpy +} + +func (s *Snapshot) isMajorityFork(forkHash string) bool { + ally := 0 + for _, h := range s.RecentForkHashes { + if h == forkHash { + ally++ + } + } + return ally > len(s.RecentForkHashes)/2 +} + +func (s *Snapshot) apply(headers []*types.Header, chain consensus.ChainHeaderReader, parents []*types.Header, chainId *big.Int) (*Snapshot, error) { + // Allow passing in no headers for cleaner code + if len(headers) == 0 { + return s, nil + } + // Sanity check that the headers can be applied + for i := 0; i < len(headers)-1; i++ { + if headers[i+1].Number.Uint64() != headers[i].Number.Uint64()+1 { + return nil, errOutOfRangeChain + } + if !bytes.Equal(headers[i+1].ParentHash.Bytes(), headers[i].Hash().Bytes()) { + return nil, errBlockHashInconsistent + } + } + if headers[0].Number.Uint64() != s.Number+1 { + return nil, errOutOfRangeChain + } + if !bytes.Equal(headers[0].ParentHash.Bytes(), s.Hash.Bytes()) { + return nil, errBlockHashInconsistent + } + // Iterate through the headers and create a new snapshot + snap := s.copy() + + for _, header := range headers { + number := header.Number.Uint64() + // Delete the oldest validator from the recent list to allow it signing again + if limit := uint64(snap.blockLimit()); number >= limit { + delete(snap.Recents, number-limit) + } + if limit := uint64(len(snap.Validators)); number >= limit { + delete(snap.RecentForkHashes, number-limit) + } + + // Resolve the authorization key and check against signers + validator, err := ecrecover(header, s.sigCache, chainId) + if err != nil { + return nil, err + } + + // Check whether it is in validator set + if !snap.includeValidator(validator) { + return nil, errUnauthorizedValidator + } + + // should not sign recently for fairness + for _, recent := range snap.Recents { + if recent == validator { + log.Debug("apply snapshot found validator sealed recently", "recent", snap.Recents) + return nil, errRecentlySigned + } + } + + // cache recent signed + snap.Recents[number] = validator + + // Change validator set at the beginning of epoch. + if number > 0 && number%s.config.EpochSize == 0 { + checkpointHeader := header + + // parse validators from extra + validatorBytes := checkpointHeader.Extra[extraVanity : len(checkpointHeader.Extra)-extraSeal] + // get validators from headers and use that for new validator set + newValArr, err := parseValidators(validatorBytes) + if err != nil { + return nil, err + } + + // new set + newValSet := make(map[common.Address]struct{}, len(newValArr)) + for _, val := range newValArr { + newValSet[val] = struct{}{} + } + + // remove oldest validator signature flags to free them signable again + oldLimit := snap.blockLimit() + newLimit := recentValidatorLimit(newValArr) + if newLimit < oldLimit { + for i := 0; i < oldLimit-newLimit; i++ { + delete(snap.Recents, number-uint64(newLimit)-uint64(i)) + } + } + oldLimit = len(snap.Validators) + newLimit = len(newValSet) + if newLimit < oldLimit { + for i := 0; i < oldLimit-newLimit; i++ { + delete(snap.RecentForkHashes, number-uint64(newLimit)-uint64(i)) + } + } + + // cache new validator set + snap.Validators = newValArr + snap.validatorSet = newValSet + } + // cache block fork hash + snap.RecentForkHashes[number] = hex.EncodeToString(header.Extra[extraVanity-nextForkHashSize : extraVanity]) + } + snap.Number += uint64(len(headers)) + snap.Hash = headers[len(headers)-1].Hash() + return snap, nil +} + +func (s *Snapshot) validatorCount() int { + return len(s.Validators) +} + +func (s *Snapshot) includeValidator(validator common.Address) bool { + _, exists := s.validatorSet[validator] + return exists +} + +// blockLimit returns block range limit to seal again. +func (s *Snapshot) blockLimit() int { + return recentValidatorLimit(s.Validators) +} + +func recentValidatorLimit(validators []common.Address) int { + vlen := len(validators) + switch { + case vlen <= 4: + return vlen/3 + 1 + default: + return vlen/2 + 1 + } +} + +// inturn returns if a validator at a given block height is in-turn or not. +func (s *Snapshot) inturn(validator common.Address) bool { + offset := (s.Number + 1) % uint64(len(s.Validators)) + return s.Validators[offset] == validator +} + +// Is header number distance enough to do dirty flush +func (s *Snapshot) enoughDistance(validator common.Address, header *types.Header) bool { + idx := s.indexOfVal(validator) + if idx < 0 { + return true + } + validatorNum := int64(s.validatorCount()) + if validatorNum == 1 { + return true + } + if validator == header.Coinbase { + return false + } + // It's meaningless when validators are less than 5, since we'll get true + // most of the time. + offset := (int64(s.Number) + 1) % validatorNum + if int64(idx) >= offset { + return int64(idx)-offset >= validatorNum-2 + } else { + return validatorNum+int64(idx)-offset >= validatorNum-2 + } +} + +func (s *Snapshot) indexOfVal(validator common.Address) int { + for idx, val := range s.Validators { + if val == validator { + return idx + } + } + return -1 +} + +func (s *Snapshot) supposeValidator() common.Address { + index := (s.Number + 1) % uint64(len(s.Validators)) + return s.Validators[index] +} + +func parseValidators(validatorsBytes []byte) ([]common.Address, error) { + if len(validatorsBytes)%validatorBytesLength != 0 { + return nil, errors.New("invalid validators bytes") + } + n := len(validatorsBytes) / validatorBytesLength + result := make([]common.Address, 0, n) + for i := 0; i < n; i++ { + result = append(result, common.BytesToAddress(validatorsBytes[i*validatorBytesLength:(i+1)*validatorBytesLength])) + } + return result, nil +} + +func FindAncientHeader(header *types.Header, ite uint64, chain consensus.ChainHeaderReader, candidateParents []*types.Header) *types.Header { + ancient := header + for i := uint64(1); i <= ite; i++ { + parentHash := ancient.ParentHash + parentHeight := ancient.Number.Uint64() - 1 + found := false + if len(candidateParents) > 0 { + index := sort.Search(len(candidateParents), func(i int) bool { + return candidateParents[i].Number.Uint64() >= parentHeight + }) + if index < len(candidateParents) && candidateParents[index].Number.Uint64() == parentHeight && + candidateParents[index].Hash() == parentHash { + ancient = candidateParents[index] + found = true + } + } + if !found { + ancient = chain.GetHeader(parentHash, parentHeight) + found = true + } + if ancient == nil || !found { + return nil + } + } + return ancient +} diff --git a/consensus/ethash/algorithm_test.go b/consensus/ethash/algorithm_test.go index 9cc9d535d4..1ae25005f7 100644 --- a/consensus/ethash/algorithm_test.go +++ b/consensus/ethash/algorithm_test.go @@ -19,7 +19,6 @@ package ethash import ( "bytes" "encoding/binary" - "io/ioutil" "math/big" "os" "reflect" @@ -698,7 +697,7 @@ func TestHashimoto(t *testing.T) { // Tests that caches generated on disk may be done concurrently. func TestConcurrentDiskCacheGeneration(t *testing.T) { // Create a temp folder to generate the caches into - cachedir, err := ioutil.TempDir("", "") + cachedir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("Failed to create temporary cache dir: %v", err) } @@ -794,7 +793,7 @@ func BenchmarkHashimotoFullSmall(b *testing.B) { func benchmarkHashimotoFullMmap(b *testing.B, name string, lock bool) { b.Run(name, func(b *testing.B) { - tmpdir, err := ioutil.TempDir("", "ethash-test") + tmpdir, err := os.MkdirTemp("", "ethash-test") if err != nil { b.Fatal(err) } diff --git a/consensus/ethash/ethash_test.go b/consensus/ethash/ethash_test.go index 382eefeecf..d1e193932f 100644 --- a/consensus/ethash/ethash_test.go +++ b/consensus/ethash/ethash_test.go @@ -17,7 +17,6 @@ package ethash import ( - "io/ioutil" "math/big" "math/rand" "os" @@ -57,7 +56,7 @@ func TestTestMode(t *testing.T) { // This test checks that cache lru logic doesn't crash under load. // It reproduces https://github.com/ethereum/go-ethereum/issues/14943 func TestCacheFileEvict(t *testing.T) { - tmpdir, err := ioutil.TempDir("", "ethash-test") + tmpdir, err := os.MkdirTemp("", "ethash-test") if err != nil { t.Fatal(err) } diff --git a/consensus/ethash/sealer_test.go b/consensus/ethash/sealer_test.go index c34e76aec2..e338f75290 100644 --- a/consensus/ethash/sealer_test.go +++ b/consensus/ethash/sealer_test.go @@ -18,7 +18,7 @@ package ethash import ( "encoding/json" - "io/ioutil" + "io" "math/big" "net/http" "net/http/httptest" @@ -37,7 +37,7 @@ func TestRemoteNotify(t *testing.T) { // Start a simple web server to capture notifications. sink := make(chan [3]string) server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - blob, err := ioutil.ReadAll(req.Body) + blob, err := io.ReadAll(req.Body) if err != nil { t.Errorf("failed to read miner notification: %v", err) } @@ -80,7 +80,7 @@ func TestRemoteNotifyFull(t *testing.T) { // Start a simple web server to capture notifications. sink := make(chan map[string]interface{}) server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - blob, err := ioutil.ReadAll(req.Body) + blob, err := io.ReadAll(req.Body) if err != nil { t.Errorf("failed to read miner notification: %v", err) } @@ -125,7 +125,7 @@ func TestRemoteMultiNotify(t *testing.T) { // Start a simple web server to capture notifications. sink := make(chan [3]string, 64) server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - blob, err := ioutil.ReadAll(req.Body) + blob, err := io.ReadAll(req.Body) if err != nil { t.Errorf("failed to read miner notification: %v", err) } @@ -170,7 +170,7 @@ func TestRemoteMultiNotifyFull(t *testing.T) { // Start a simple web server to capture notifications. sink := make(chan map[string]interface{}, 64) server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - blob, err := ioutil.ReadAll(req.Body) + blob, err := io.ReadAll(req.Body) if err != nil { t.Errorf("failed to read miner notification: %v", err) } diff --git a/consensus/ibft/ibft.go b/consensus/ibft/ibft.go deleted file mode 100644 index 5480ae8ff6..0000000000 --- a/consensus/ibft/ibft.go +++ /dev/null @@ -1,889 +0,0 @@ -package ibft - -import ( - "bytes" - "context" - "encoding/hex" - "errors" - "fmt" - "math" - "math/big" - "strings" - "sync" - "time" - - lru "github.com/hashicorp/golang-lru" - "golang.org/x/crypto/sha3" - - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/gopool" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/dccontracts" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" -) - -const ( - inMemorySnapshots = 128 // Number of recent snapshots to keep in memory - inMemorySignatures = 4096 // Number of recent block signatures to keep in memory - - checkpointInterval = 1024 // Number of blocks after which to save the snapshot to the database - defaultEpochLength = uint64(100000) // Default number of blocks of checkpoint to update validatorSet from contract - - ExtraVanity = 32 // Fixed number of extra-data prefix bytes reserved for signer vanity -) - -const ( - _validatorMethodDeposit = "deposit" - _validatorMethodSlash = "slash" -) - -var ( - _validatorsetContract = common.HexToAddress(dccontracts.DCValidatorSetContract) - - systemContracts = map[common.Address]bool{ - _validatorsetContract: true, - common.HexToAddress(dccontracts.DCBridgeContract): true, - common.HexToAddress(dccontracts.DCVaultContract): true, - } - - targetBlockTime = 2 * time.Second // currently set by default, should move to genesis configs -) - -// Various error messages to mark blocks invalid. These should be private to -// prevent engine specific errors from being referenced in the remainder of the -// codebase, inherently breaking if the engine is swapped out. Please put common -// error types into the consensus package. -var ( - // errUnknownBlock is returned when the list of validators is requested for a block - // that is not part of the local blockchain. - errUnknownBlock = errors.New("unknown block") - - // errInvalidBlockTimestamp is returned when it is a future block. - errInvalidBlockTimestamp = errors.New("invalid block timestamp") - - // errInvalidCommittedSeal is returned when committed seal not from valid validators. - errInvalidCommittedSeal = errors.New("invalid committed seal") - - // errInvalidCoinbase is returned when coinbase not match with block sealer(validator). - errInvalidCoinbase = errors.New("invalid coinbase") - - // errValidatorNotAuthorized is returned when validator not authorized by community. - errValidatorNotAuthorized = errors.New("validator is not authorized") - - // errInvalidUncleHash is returned if a block contains an non-empty uncle list. - errInvalidUncleHash = errors.New("non empty uncle hash") - - // errInvalidDifficulty is returned if the difficulty of a block is missing. - errInvalidDifficulty = errors.New("invalid difficulty") - - // errOutOfRangeChain is returned if an authorization list is attempted to - // be modified via out-of-range or non-contiguous headers. - errOutOfRangeChain = errors.New("out of range or non-contiguous chain") - - // errBlockHashInconsistent is returned if an authorization list is attempted to - // insert an inconsistent block. - errBlockHashInconsistent = errors.New("the block hash is inconsistent") - - // errUnauthorizedValidator is returned if a header is signed by a non-authorized entity. - errUnauthorizedValidator = errors.New("unauthorized validator") -) - -// SignerFn is a signer callback function to request a header to be signed by a -// backing account. -type SignerFn func(accounts.Account, string, []byte) ([]byte, error) -type SignerTxFn func(accounts.Account, *types.Transaction, *big.Int) (*types.Transaction, error) - -func isToSystemContract(to common.Address) bool { - return systemContracts[to] -} - -// ecrecover extracts the Ethereum account address from a signed header. -func ecrecover(header *types.Header, sigCache *lru.ARCCache, chainId *big.Int) (common.Address, error) { - // If the signature's already cached, return that - hash := header.Hash() - if address, known := sigCache.Get(hash); known { - return address.(common.Address), nil - } - - // get the extra part that contains the seal - extra, err := types.GetIbftExtra(header.Extra) - if err != nil { - return common.Address{}, err - } - - // Retrieve the signature from the header extra-data - // Recover the public key and the Ethereum address - // TODO: should be use different hash from IBFT for - // not modified block hash? - pubkey, err := crypto.Ecrecover(crypto.Keccak256(hash.Bytes()), extra.Seal) - if err != nil { - return common.Address{}, err - } - var signer common.Address - copy(signer[:], crypto.Keccak256(pubkey[1:])[12:]) - - // save to cache - sigCache.Add(hash, signer) - - return signer, nil -} - -// IBFT is the consensus engine of DBSC -type IBFT struct { - chainConfig *params.ChainConfig // Chain config - config *params.IBFTConfig // Consensus engine configuration parameters for ibft consensus - genesisHash common.Hash - db ethdb.Database // Database to store and retrieve snapshot checkpoints - - recentSnaps *lru.ARCCache // Snapshots for recent block to speed up - signatures *lru.ARCCache // Signatures of recent blocks to speed up mining - - signer types.Signer - - val common.Address // Ethereum address of the signing key - signFn SignerFn // Signer function to authorize hashes with - signTxFn SignerTxFn - - lock sync.RWMutex // Protects the signer fields - - ethAPI *ethapi.PublicBlockChainAPI - validatorSetABI *abi.ABI - bridgeABI *abi.ABI - vaultABI *abi.ABI -} - -// New creates a IBFT consensus engine. -func New( - chainConfig *params.ChainConfig, - db ethdb.Database, - ethAPI *ethapi.PublicBlockChainAPI, - genesisHash common.Hash, -) *IBFT { - // get ibft config - ibftConfig := chainConfig.IBFT - - // Set any missing consensus parameters to their defaults - if ibftConfig != nil && ibftConfig.EpochSize == 0 { - ibftConfig.EpochSize = defaultEpochLength - } - - // Allocate the snapshot caches and create the engine - recentSnaps, err := lru.NewARC(inMemorySnapshots) - if err != nil { - panic(err) - } - // Signatures - signatures, err := lru.NewARC(inMemorySignatures) - if err != nil { - panic(err) - } - // ABI(s) - vABI, err := abi.JSON(strings.NewReader(validatorSetABI)) - if err != nil { - panic(err) - } - bABI, err := abi.JSON(strings.NewReader(bridgeABI)) - if err != nil { - panic(err) - } - vaultABI, err := abi.JSON(strings.NewReader(vaultABI)) - if err != nil { - panic(err) - } - - c := &IBFT{ - chainConfig: chainConfig, - config: ibftConfig, - genesisHash: genesisHash, - db: db, - ethAPI: ethAPI, - recentSnaps: recentSnaps, - signatures: signatures, - validatorSetABI: &vABI, - bridgeABI: &bABI, - vaultABI: &vaultABI, - signer: types.NewEIP155Signer(chainConfig.ChainID), - } - - return c -} - -func (p *IBFT) shouldWriteSystemTransactions(header *types.Header) bool { - // Begin with detroit hard fork, we do get some "system transactions", - // but we don't treat them as system transactions and make direct - // contract call only after hawaii hard fork. - return p.chainConfig.IsHawaii(header.Number) -} - -func (p *IBFT) IsSystemTransaction(tx *types.Transaction, header *types.Header) (bool, error) { - // Ensures activeness - if !p.shouldWriteSystemTransactions(header) { - return false, nil - } - // Deploy a contract. - if tx.To() == nil { - return false, nil - } - // System transaction will not charge. - if tx.GasPrice().Cmp(big.NewInt(0)) != 0 { - return false, nil - } - // Check out the sender - sender, err := types.Sender(p.signer, tx) - if err != nil { - return false, errors.New("unauthorized transaction") - } - // Ensures coinbase send this transaction. - if sender != header.Coinbase { - return false, nil - } - - // Will only handle validatorset transactions. - if p.isValidatorDepositTxSignature(tx) { - return true, nil - } - if p.isValidatorSlashTxSignature(tx) { - return true, nil - } - - return false, nil -} - -func (p *IBFT) isValidatorDepositTxSignature(tx *types.Transaction) bool { - // Ensures matching contract - if *tx.To() != _validatorsetContract { - return false - } - // Ensures data length - if len(tx.Data()) < 4 { - return false - } - - method, ok := p.validatorSetABI.Methods[_validatorMethodDeposit] - if !ok { - log.Warn("validatorset abi not correct") - return false - } - - return bytes.EqualFold(tx.Data()[:4], method.ID) -} - -func (p *IBFT) isValidatorSlashTxSignature(tx *types.Transaction) bool { - // Ensures matching contract - if *tx.To() != _validatorsetContract { - return false - } - // Ensures data length - if len(tx.Data()) < 4 { - return false - } - - method, ok := p.validatorSetABI.Methods[_validatorMethodSlash] - if !ok { - log.Warn("validatorset abi not correct") - return false - } - - return bytes.EqualFold(tx.Data()[:4], method.ID) -} - -func (p *IBFT) IsSystemContract(to *common.Address) bool { - if to == nil { - return false - } - return isToSystemContract(*to) -} - -// Author implements consensus.Engine, returning the SystemAddress -func (p *IBFT) Author(header *types.Header) (common.Address, error) { - return header.Coinbase, nil -} - -// VerifyHeader checks whether a header conforms to the consensus rules. -func (p *IBFT) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error { - return p.verifyHeader(chain, header, nil) -} - -// VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers. The -// method returns a quit channel to abort the operations and a results channel to -// retrieve the async verifications (the order is that of the input slice). -func (p *IBFT) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) { - abort := make(chan struct{}) - results := make(chan error, len(headers)) - - gopool.Submit(func() { - for i, header := range headers { - err := p.verifyHeader(chain, header, headers[:i]) - - select { - case <-abort: - return - case results <- err: - } - } - }) - return abort, results -} - -// verifyHeader checks whether a header conforms to the consensus rules.The -// caller may optionally pass in a batch of parents (ascending order) to avoid -// looking those up from the database. This is useful for concurrently verifying -// a batch of new headers. -func (p *IBFT) verifyHeader(chain consensus.ChainHeaderReader, header *types.Header, parents []*types.Header) error { - // Ensure that the mix digest is ibft mix hash - if header.MixDigest != types.IBFTMixHash { - return types.ErrIBFTInvalidMixHash - } - // Ensure that the block doesn't contain any uncles which are meaningless in PoS - if header.UncleHash != types.EmptyUncleHash { - return errInvalidUncleHash - } - // Difficulty has to match number for previous ibft consensus - if header.Number.Cmp(header.Difficulty) != 0 { - return errInvalidDifficulty - } - - // Check timestamp after detroit hard fork - if p.chainConfig.IsDetorit(header.Number) { - // Get parent - var parent *types.Header - if len(parents) > 0 { - parent = parents[len(parents)-1] - } else { - parent = chain.GetHeader(header.ParentHash, header.Number.Uint64()-1) - } - // The diff between block timestamp and 'now' should not exceeds timeout. - // Timestamp ascending array [parentTs, blockTs, now+blockTimeout] - before, after := parent.Time, uint64(time.Now().Add(targetBlockTime).Unix()) - - // header timestamp should not goes back - if header.Time <= before || header.Time > after { - log.Warn("future blocktime invalid", - "before", before, - "after", after, - "current", header.Time, - ) - - return errInvalidBlockTimestamp - } - } - - // Verify the sealer - return p.verifySigner(chain, header, parents) -} - -func (p *IBFT) verifySigner(chain consensus.ChainHeaderReader, header *types.Header, parents []*types.Header) error { - // Recover validator first - validator, err := ecrecover(header, p.signatures, p.chainConfig.ChainID) - if err != nil { - return errInvalidCommittedSeal - } - // Ensure that coinbase is validator - if header.Coinbase != validator { - return errInvalidCoinbase - } - // check validator in list - snap, err := p.snapshot(chain, header.Number.Uint64()-1, header.ParentHash, parents) - if err != nil { - return err - } - if !snap.includeValidator(validator) { - return errValidatorNotAuthorized - } - - return nil -} - -// snapshot retrieves the authorization snapshot at a given point in time. -func (p *IBFT) snapshot(chain consensus.ChainHeaderReader, number uint64, hash common.Hash, parents []*types.Header) (*Snapshot, error) { - // Search for a snapshot in memory or on disk for checkpoints - var ( - headers []*types.Header - snap *Snapshot - ) - - for snap == nil { - // If an in-memory snapshot was found, use that - if s, ok := p.recentSnaps.Get(hash); ok { - snap = s.(*Snapshot) - break - } - - // If an on-disk checkpoint snapshot can be found, use that - if number%checkpointInterval == 0 { - if s, err := loadSnapshot(p.config, p.signatures, p.db, hash, p.ethAPI); err == nil { - log.Trace("Loaded snapshot from disk", "number", number, "hash", hash) - snap = s - break - } - } - - // If we're at the genesis, snapshot the initial state. - if number == 0 { - checkpoint := chain.GetHeaderByNumber(number) - if checkpoint != nil { - // get checkpoint data - hash := checkpoint.Hash() - - if len(checkpoint.Extra) <= ExtraVanity { - return nil, errors.New("invalid extra-data for genesis block, check the genesis.json file") - } - - // get validators from headers - extra, err := types.GetIbftExtra(checkpoint.Extra) - if err != nil { - return nil, err - } - - // new snap shot - snap = newSnapshot(p.config, p.signatures, number, hash, extra.Validators, p.ethAPI) - if err := snap.store(p.db); err != nil { - return nil, err - } - log.Info("Stored checkpoint snapshot to disk", "number", number, "hash", hash) - break - } - } - - // No snapshot for this header, gather the header and move backward - var header *types.Header - if len(parents) > 0 { - // If we have explicit parents, pick from there (enforced) - header = parents[len(parents)-1] - if header.Hash() != hash || header.Number.Uint64() != number { - return nil, consensus.ErrUnknownAncestor - } - parents = parents[:len(parents)-1] - } else { - // No explicit parents (or no more left), reach out to the database - header = chain.GetHeader(hash, number) - if header == nil { - return nil, consensus.ErrUnknownAncestor - } - } - headers = append(headers, header) - number, hash = number-1, header.ParentHash - } - - // check if snapshot is nil - if snap == nil { - return nil, fmt.Errorf("unknown error while retrieving snapshot at block number %v", number) - } - - // Previous snapshot found, apply any pending headers on top of it - for i := 0; i < len(headers)/2; i++ { - headers[i], headers[len(headers)-1-i] = headers[len(headers)-1-i], headers[i] - } - - snap, err := snap.apply(headers, chain, parents, p.chainConfig.ChainID) - if err != nil { - return nil, err - } - p.recentSnaps.Add(snap.Hash, snap) - - // If we've generated a new checkpoint snapshot, save to disk - if snap.Number%checkpointInterval == 0 && len(headers) > 0 { - if err = snap.store(p.db); err != nil { - return nil, err - } - log.Trace("Stored snapshot to disk", "number", snap.Number, "hash", snap.Hash) - } - return snap, err -} - -// VerifyUncles implements consensus.Engine, always returning an error for any -// uncles as this consensus mechanism doesn't permit uncles. -func (p *IBFT) VerifyUncles(chain consensus.ChainReader, block *types.Block) error { - if len(block.Uncles()) > 0 { - return errors.New("uncles not allowed") - } - return nil -} - -// VerifySeal implements consensus.Engine, checking whether the signature contained -// in the header satisfies the consensus protocol requirements. -func (p *IBFT) VerifySeal(chain consensus.ChainReader, header *types.Header) error { - return p.verifySeal(chain, header, nil) -} - -// verifySeal checks whether the signature contained in the header satisfies the -// consensus protocol requirements. The method accepts an optional list of parent -// headers that aren't yet part of the local blockchain to generate the snapshots -// from. -func (p *IBFT) verifySeal(chain consensus.ChainHeaderReader, header *types.Header, parents []*types.Header) error { - return nil -} - -// Prepare implements consensus.Engine, preparing all the consensus fields of the -// header for running the transactions on top. -func (p *IBFT) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error { - return nil -} - -// Finalize implements consensus.Engine, ensuring no uncles are set, nor block -// rewards given. -func (p *IBFT) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs *[]*types.Transaction, - uncles []*types.Header, receipts *[]*types.Receipt, systemTxs *[]*types.Transaction, usedGas *uint64) error { - // Apply system transactions at last. - if systemTxs != nil && len(*systemTxs) > 0 { - ctx := chainContext{Chain: chain, ibft: p} - for _, tx := range *systemTxs { - // Sender should be verified, so we simply set coinbase here - msg := p.tx2SystemMessage(tx, header.Coinbase) - if err := p.applyTransaction(msg, state, header, ctx, txs, receipts, systemTxs, usedGas, false); err != nil { - return err - } - } - } - - // Handle bridge logs - for _, receipt := range *receipts { - for _, rlog := range receipt.Logs { - if err := p.handleBridgeLog(rlog, state); err != nil { - return err - } - } - } - - return nil -} - -// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set, -// nor block rewards given, and returns the final block. -func (p *IBFT) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, - txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) { - return nil, nil, nil -} - -// Authorize injects a private key into the consensus engine to mint new blocks -// with. -func (p *IBFT) Authorize(val common.Address, signFn SignerFn, signTxFn SignerTxFn) { - p.lock.Lock() - defer p.lock.Unlock() - - p.val = val - p.signFn = signFn - p.signTxFn = signTxFn -} - -// Argument leftOver is the time reserved for block finalize(calculate root, distribute income...) -func (p *IBFT) Delay(chain consensus.ChainReader, header *types.Header, leftOver *time.Duration) *time.Duration { - return nil -} - -// Seal implements consensus.Engine, attempting to create a sealed block using -// the local signing credentials. -func (p *IBFT) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error { - return nil -} - -func (p *IBFT) EnoughDistance(chain consensus.ChainReader, header *types.Header) bool { - snap, err := p.snapshot(chain, header.Number.Uint64()-1, header.ParentHash, nil) - if err != nil { - return true - } - return snap.enoughDistance(p.val, header) -} - -func (p *IBFT) AllowLightProcess(chain consensus.ChainReader, currentHeader *types.Header) bool { - snap, err := p.snapshot(chain, currentHeader.Number.Uint64()-1, currentHeader.ParentHash, nil) - if err != nil { - return true - } - // validator is not allowed to diff sync - return !snap.includeValidator(p.val) -} - -func (p *IBFT) IsLocalBlock(header *types.Header) bool { - return p.val == header.Coinbase -} - -// CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty -// that a new block should have based on the previous blocks in the chain and the -// current signer. -func (p *IBFT) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int { - return difficultyByParentNumber(parent.Number) -} - -// old version ibft returns block number directly -func difficultyByParentNumber(num *big.Int) *big.Int { - return new(big.Int).Add(num, big.NewInt(1)) -} - -// SealHash returns the hash of a block prior to it being sealed. -func (p *IBFT) SealHash(header *types.Header) common.Hash { - extra, _ := types.GetIbftExtra(header.Extra) - return SealHash(header, p.chainConfig.ChainID, extra) -} - -// APIs implements consensus.Engine, returning the user facing RPC API to query snapshot. -func (p *IBFT) APIs(chain consensus.ChainHeaderReader) []rpc.API { - return []rpc.API{{ - Namespace: "ibft", - Version: "1.0", - Service: &API{chain: chain, ibft: p}, - Public: false, - }} -} - -// Close implements consensus.Engine. It's a noop for ibft as there are no background threads. -func (p *IBFT) Close() error { - return nil -} - -// ========================== interaction with contract/account ========= - -// getCurrentValidators get current validators -func (p *IBFT) getCurrentValidators(blockHash common.Hash, blockNumber *big.Int) ([]common.Address, error) { - // block - blockNr := rpc.BlockNumberOrHashWithHash(blockHash, false) - - // method - method := "getValidators" - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() // cancel when we are finished consuming integers - - data, err := p.validatorSetABI.Pack(method) - if err != nil { - log.Error("Unable to pack tx for getValidators", "error", err) - return nil, err - } - // call - msgData := (hexutil.Bytes)(data) - toAddress := common.HexToAddress(dccontracts.DCValidatorSetContract) - gas := (hexutil.Uint64)(uint64(math.MaxUint64 / 2)) - result, err := p.ethAPI.Call(ctx, ethapi.TransactionArgs{ - Gas: &gas, - To: &toAddress, - Data: &msgData, - }, blockNr, nil) - if err != nil { - return nil, err - } - - var ( - ret0 = new([]common.Address) - ) - out := ret0 - - if err := p.validatorSetABI.UnpackIntoInterface(out, method, result); err != nil { - return nil, err - } - - valz := make([]common.Address, len(*ret0)) - // nolint: gosimple - for i, a := range *ret0 { - valz[i] = a - } - return valz, nil -} - -// slash spoiled validators -func (p *IBFT) slash(spoiledValidators []common.Address, state *state.StateDB, header *types.Header, chain core.ChainContext, - txs *[]*types.Transaction, receipts *[]*types.Receipt, receivedTxs *[]*types.Transaction, usedGas *uint64, mining bool) error { - // method - method := "slash" - - // get packed data - data, err := p.validatorSetABI.Pack(method, - spoiledValidators, - ) - if err != nil { - log.Error("Unable to pack tx for slash", "error", err) - return err - } - // get system message - msg := p.getSystemMessage(header.Coinbase, common.HexToAddress(dccontracts.DCValidatorSetContract), data, common.Big0) - // apply message - return p.applyTransaction(msg, state, header, chain, txs, receipts, receivedTxs, usedGas, mining) -} - -// slash spoiled validators -func (p *IBFT) distributeToValidator(amount *big.Int, validator common.Address, - state *state.StateDB, header *types.Header, chain core.ChainContext, - txs *[]*types.Transaction, receipts *[]*types.Receipt, receivedTxs *[]*types.Transaction, usedGas *uint64, mining bool) error { - // method - method := "deposit" - - // get packed data - data, err := p.validatorSetABI.Pack(method, - validator, - ) - if err != nil { - log.Error("Unable to pack tx for deposit", "error", err) - return err - } - // get system message - msg := p.getSystemMessage(header.Coinbase, common.HexToAddress(dccontracts.DCValidatorSetContract), data, amount) - // apply message - return p.applyTransaction(msg, state, header, chain, txs, receipts, receivedTxs, usedGas, mining) -} - -// get system message -func (p *IBFT) getSystemMessage(from, toAddress common.Address, data []byte, value *big.Int) callmsg { - return callmsg{ - ethereum.CallMsg{ - From: from, - Gas: math.MaxUint64 / 2, - GasPrice: big.NewInt(0), - Value: value, - To: &toAddress, - Data: data, - }, - } -} - -func (p *IBFT) tx2SystemMessage(tx *types.Transaction, from common.Address) callmsg { - return callmsg{ - ethereum.CallMsg{ - From: from, - Gas: tx.Gas(), - GasPrice: big.NewInt(0), // It must be zero price - Value: tx.Value(), - To: tx.To(), - Data: tx.Data(), - }, - } -} - -func (p *IBFT) applyTransaction( - msg callmsg, - state *state.StateDB, - header *types.Header, - chainContext core.ChainContext, - txs *[]*types.Transaction, receipts *[]*types.Receipt, - receivedTxs *[]*types.Transaction, usedGas *uint64, mining bool, -) (err error) { - nonce := state.GetNonce(msg.From()) - expectedTx := types.NewTransaction(nonce, *msg.To(), msg.Value(), msg.Gas(), msg.GasPrice(), msg.Data()) - expectedHash := p.signer.Hash(expectedTx) - - if msg.From() == p.val && mining { - expectedTx, err = p.signTxFn(accounts.Account{Address: msg.From()}, expectedTx, p.chainConfig.ChainID) - if err != nil { - return err - } - } else { - if receivedTxs == nil || len(*receivedTxs) == 0 || (*receivedTxs)[0] == nil { - return errors.New("supposed to get a actual transaction, but get none") - } - actualTx := (*receivedTxs)[0] - if !bytes.Equal(p.signer.Hash(actualTx).Bytes(), expectedHash.Bytes()) { - return fmt.Errorf("expected tx hash %v, get %v, nonce %d, to %s, value %s, gas %d, gasPrice %s, data %s", expectedHash.String(), actualTx.Hash().String(), - expectedTx.Nonce(), - expectedTx.To().String(), - expectedTx.Value().String(), - expectedTx.Gas(), - expectedTx.GasPrice().String(), - hex.EncodeToString(expectedTx.Data()), - ) - } - expectedTx = actualTx - // move to next - *receivedTxs = (*receivedTxs)[1:] - } - state.Prepare(expectedTx.Hash(), len(*txs)) - gasUsed, err := applyMessage(msg, state, header, p.chainConfig, chainContext) - if err != nil { - return err - } - *txs = append(*txs, expectedTx) - var root []byte - if p.chainConfig.IsByzantium(header.Number) { - state.Finalise(true) - } else { - root = state.IntermediateRoot(p.chainConfig.IsEIP158(header.Number)).Bytes() - } - *usedGas += gasUsed - receipt := types.NewReceipt(root, false, *usedGas) - receipt.TxHash = expectedTx.Hash() - receipt.GasUsed = gasUsed - - // Set the receipt logs and create a bloom for filtering - receipt.Logs = state.GetLogs(expectedTx.Hash(), header.Hash()) - receipt.Bloom = types.CreateBloom(types.Receipts{receipt}) - receipt.BlockHash = header.Hash() - receipt.BlockNumber = header.Number - receipt.TransactionIndex = uint(state.TxIndex()) - *receipts = append(*receipts, receipt) - state.SetNonce(msg.From(), nonce+1) - return nil -} - -// =========================== utility function ========================== -// SealHash returns the hash of a block prior to it being sealed. -func SealHash(header *types.Header, chainId *big.Int, extra *types.IBFTExtra) (hash common.Hash) { - hasher := sha3.NewLegacyKeccak256() - types.IBFTHeaderExtraRLPHash(hasher, header, extra) - hasher.Sum(hash[:0]) - return hash -} - -// chain context -type chainContext struct { - Chain consensus.ChainHeaderReader - ibft consensus.Engine -} - -func (c chainContext) Engine() consensus.Engine { - return c.ibft -} - -func (c chainContext) GetHeader(hash common.Hash, number uint64) *types.Header { - return c.Chain.GetHeader(hash, number) -} - -// callmsg implements core.Message to allow passing it as a transaction simulator. -type callmsg struct { - ethereum.CallMsg -} - -func (m callmsg) From() common.Address { return m.CallMsg.From } -func (m callmsg) Nonce() uint64 { return 0 } -func (m callmsg) CheckNonce() bool { return false } -func (m callmsg) To() *common.Address { return m.CallMsg.To } -func (m callmsg) GasPrice() *big.Int { return m.CallMsg.GasPrice } -func (m callmsg) Gas() uint64 { return m.CallMsg.Gas } -func (m callmsg) Value() *big.Int { return m.CallMsg.Value } -func (m callmsg) Data() []byte { return m.CallMsg.Data } - -// apply message -func applyMessage( - msg callmsg, - state *state.StateDB, - header *types.Header, - chainConfig *params.ChainConfig, - chainContext core.ChainContext, -) (uint64, error) { - // Create a new context to be used in the EVM environment - context := core.NewEVMBlockContext(header, chainContext, nil) - // Create a new environment which holds all relevant information - // about the transaction and calling mechanisms. - vmenv := vm.NewEVM(context, vm.TxContext{Origin: msg.From(), GasPrice: big.NewInt(0)}, state, chainConfig, vm.Config{}) - // Apply the transaction to the current state (included in the env) - ret, returnGas, err := vmenv.Call( - vm.AccountRef(msg.From()), - *msg.To(), - msg.Data(), - msg.Gas(), - msg.Value(), - ) - if err != nil { - log.Error("apply message failed", "msg", string(ret), "err", err) - } - return msg.Gas() - returnGas, err -} diff --git a/consensus/misc/eip1559.go b/consensus/misc/eip1559.go index 8fca0fdc70..ac22328261 100644 --- a/consensus/misc/eip1559.go +++ b/consensus/misc/eip1559.go @@ -20,8 +20,6 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" ) @@ -30,64 +28,22 @@ import ( // - gas limit check // - basefee check func VerifyEip1559Header(config *params.ChainConfig, parent, header *types.Header) error { - // Verify that the gas limit remains within allowed bounds - parentGasLimit := parent.GasLimit - if !config.IsLondon(parent.Number) { - parentGasLimit = parent.GasLimit * params.ElasticityMultiplier - } - if err := VerifyGaslimit(parentGasLimit, header.GasLimit); err != nil { - return err - } // Verify the header is not malformed if header.BaseFee == nil { return fmt.Errorf("header is missing baseFee") } + // Verify the baseFee is correct based on the parent header. expectedBaseFee := CalcBaseFee(config, parent) if header.BaseFee.Cmp(expectedBaseFee) != 0 { return fmt.Errorf("invalid baseFee: have %s, want %s, parentBaseFee %s, parentGasUsed %d", expectedBaseFee, header.BaseFee, parent.BaseFee, parent.GasUsed) } + return nil } // CalcBaseFee calculates the basefee of the header. func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int { - // If the current block is the first EIP-1559 block, return the InitialBaseFee. - if !config.IsLondon(parent.Number) { - return new(big.Int).SetUint64(params.InitialBaseFee) - } - - var ( - parentGasTarget = parent.GasLimit / params.ElasticityMultiplier - parentGasTargetBig = new(big.Int).SetUint64(parentGasTarget) - baseFeeChangeDenominator = new(big.Int).SetUint64(params.BaseFeeChangeDenominator) - ) - // If the parent gasUsed is the same as the target, the baseFee remains unchanged. - if parent.GasUsed == parentGasTarget { - return new(big.Int).Set(parent.BaseFee) - } - if parent.GasUsed > parentGasTarget { - // If the parent block used more gas than its target, the baseFee should increase. - gasUsedDelta := new(big.Int).SetUint64(parent.GasUsed - parentGasTarget) - x := new(big.Int).Mul(parent.BaseFee, gasUsedDelta) - y := x.Div(x, parentGasTargetBig) - baseFeeDelta := math.BigMax( - x.Div(y, baseFeeChangeDenominator), - common.Big1, - ) - - return x.Add(parent.BaseFee, baseFeeDelta) - } else { - // Otherwise if the parent block used less gas than its target, the baseFee should decrease. - gasUsedDelta := new(big.Int).SetUint64(parentGasTarget - parent.GasUsed) - x := new(big.Int).Mul(parent.BaseFee, gasUsedDelta) - y := x.Div(x, parentGasTargetBig) - baseFeeDelta := x.Div(y, baseFeeChangeDenominator) - - return math.BigMax( - x.Sub(parent.BaseFee, baseFeeDelta), - common.Big0, - ) - } + return new(big.Int).SetUint64(params.InitialBaseFee) } diff --git a/consensus/misc/eip1559_test.go b/consensus/misc/eip1559_test.go index aaa09da9b9..da532e1957 100644 --- a/consensus/misc/eip1559_test.go +++ b/consensus/misc/eip1559_test.go @@ -115,8 +115,8 @@ func TestCalcBaseFee(t *testing.T) { expectedBaseFee int64 }{ {params.InitialBaseFee, 20000000, 10000000, params.InitialBaseFee}, // usage == target - {params.InitialBaseFee, 20000000, 9000000, 987500000}, // usage below target - {params.InitialBaseFee, 20000000, 11000000, 1012500000}, // usage above target + {params.InitialBaseFee, 20000000, 9000000, params.InitialBaseFee}, // usage below target + {params.InitialBaseFee, 20000000, 11000000, params.InitialBaseFee}, // usage above target } for i, test := range tests { parent := &types.Header{ diff --git a/console/console.go b/console/console.go index ab26bd64f7..0894203a65 100644 --- a/console/console.go +++ b/console/console.go @@ -20,7 +20,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "os" "os/signal" "path/filepath" @@ -158,7 +157,7 @@ func (c *Console) init(preload []string) error { // Configure the input prompter for history and tab completion. if c.prompter != nil { - if content, err := ioutil.ReadFile(c.histPath); err != nil { + if content, err := os.ReadFile(c.histPath); err != nil { c.prompter.SetHistory(nil) } else { c.history = strings.Split(string(content), "\n") @@ -561,7 +560,7 @@ func (c *Console) Stop(graceful bool) error { } func (c *Console) writeHistory() error { - if err := ioutil.WriteFile(c.histPath, []byte(strings.Join(c.history, "\n")), 0600); err != nil { + if err := os.WriteFile(c.histPath, []byte(strings.Join(c.history, "\n")), 0600); err != nil { return err } return os.Chmod(c.histPath, 0600) // Force 0600, even if it was different previously diff --git a/console/console_test.go b/console/console_test.go index 50bb82c531..46d218f40c 100644 --- a/console/console_test.go +++ b/console/console_test.go @@ -20,7 +20,6 @@ import ( "bytes" "errors" "fmt" - "io/ioutil" "os" "strings" "testing" @@ -88,7 +87,7 @@ type tester struct { // Please ensure you call Close() on the returned tester to avoid leaks. func newTester(t *testing.T, confOverride func(*ethconfig.Config)) *tester { // Create a temporary storage for the node keys and initialize it - workspace, err := ioutil.TempDir("", "console-tester-") + workspace, err := os.MkdirTemp("", "console-tester-") if err != nil { t.Fatalf("failed to create temporary keystore: %v", err) } diff --git a/core/bench_test.go b/core/bench_test.go index 06333033c4..80f951fd6b 100644 --- a/core/bench_test.go +++ b/core/bench_test.go @@ -18,7 +18,6 @@ package core import ( "crypto/ecdsa" - "io/ioutil" "math/big" "os" "testing" @@ -178,7 +177,7 @@ func benchInsertChain(b *testing.B, disk bool, gen func(int, *BlockGen)) { if !disk { db = rawdb.NewMemoryDatabase() } else { - dir, err := ioutil.TempDir("", "eth-core-bench") + dir, err := os.MkdirTemp("", "eth-core-bench") if err != nil { b.Fatalf("cannot create temporary directory: %v", err) } @@ -278,7 +277,7 @@ func makeChainForBench(db ethdb.Database, full bool, count uint64) { func benchWriteChain(b *testing.B, full bool, count uint64) { for i := 0; i < b.N; i++ { - dir, err := ioutil.TempDir("", "eth-chain-bench") + dir, err := os.MkdirTemp("", "eth-chain-bench") if err != nil { b.Fatalf("cannot create temporary directory: %v", err) } @@ -293,7 +292,7 @@ func benchWriteChain(b *testing.B, full bool, count uint64) { } func benchReadChain(b *testing.B, full bool, count uint64) { - dir, err := ioutil.TempDir("", "eth-chain-bench") + dir, err := os.MkdirTemp("", "eth-chain-bench") if err != nil { b.Fatalf("cannot create temporary directory: %v", err) } diff --git a/core/blockchain.go b/core/blockchain.go index 2e67c2f3c1..43b475b78b 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -73,6 +73,18 @@ var ( blockValidationTimer = metrics.NewRegisteredTimer("chain/validation", nil) blockExecutionTimer = metrics.NewRegisteredTimer("chain/execution", nil) blockWriteTimer = metrics.NewRegisteredTimer("chain/write", nil) + // dc chain + blockDCProcessBlockTimer = metrics.NewRegisteredTimer("chain/dc/process", nil) + blockDCVerificationTimer = metrics.NewRegisteredTimer("chain/dc/verification", nil) + blockDCWriteBlockTimer = metrics.NewRegisteredTimer("chain/dc/writes", nil) + blockDCFinaliseStateTimer = metrics.NewRegisteredTimer("chain/dc/finalize", nil) + blockDCGetReceiptsTimer = metrics.NewRegisteredTimer("chain/dc/receipts", nil) + blockDCCommitHooksTimer = metrics.NewRegisteredTimer("chain/dc/hook", nil) + blockDCGetObjectsTimer = metrics.NewRegisteredTimer("chain/dc/objects/reads", nil) + blockDCSetObjectsTimer = metrics.NewRegisteredTimer("chain/dc/objects/writes", nil) + blockDCSetStoragesTimer = metrics.NewRegisteredTimer("chain/dc/storages/writes", nil) + blockDCObjectCounter = metrics.NewRegisteredCounter("chain/dc/objects/count", nil) + blockDCStorageCounter = metrics.NewRegisteredCounter("chain/dc/storages/count", nil) blockReorgMeter = metrics.NewRegisteredMeter("chain/reorg/executes", nil) blockReorgAddMeter = metrics.NewRegisteredMeter("chain/reorg/add", nil) @@ -523,20 +535,6 @@ func (bc *BlockChain) GetVMConfig() *vm.Config { return &bc.vmConfig } -func (bc *BlockChain) cacheReceipts(hash common.Hash, receipts types.Receipts) { - // TODO, This is a hot fix for the block hash of logs is `0x0000000000000000000000000000000000000000000000000000000000000000` for system tx - // Please check details in https://github.com/binance-chain/bsc/issues/443 - // This is a temporary fix, the official fix should be a hard fork. - const possibleSystemReceipts = 3 // One slash tx, two reward distribute txs. - numOfReceipts := len(receipts) - for i := numOfReceipts - 1; i >= 0 && i >= numOfReceipts-possibleSystemReceipts; i-- { - for j := 0; j < len(receipts[i].Logs); j++ { - receipts[i].Logs[j].BlockHash = hash - } - } - bc.receiptsCache.Add(hash, receipts) -} - func (bc *BlockChain) cacheDiffLayer(diffLayer *types.DiffLayer, diffLayerCh chan struct{}) { // The difflayer in the system is stored by the map structure, // so it will be out of order. @@ -572,10 +570,6 @@ func (bc *BlockChain) cacheDiffLayer(diffLayer *types.DiffLayer, diffLayerCh cha } } -func (bc *BlockChain) cacheBlock(hash common.Hash, block *types.Block) { - bc.blockCache.Add(hash, block) -} - // empty returns an indicator whether the blockchain is empty. // Note, it's a special case that we connect a non-empty ancient // database with an empty node, so that we can plugin the ancient @@ -1894,35 +1888,50 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool) } bc.updateHighestVerifiedHeader(block.Header()) - // Enable prefetching to pull in trie node paths while processing transactions - statedb.StartPrefetcher("chain") - interruptCh := make(chan struct{}) - // For diff sync, it may fallback to full sync, so we still do prefetch - if len(block.Transactions()) >= prefetchTxNumber { - // do Prefetch in a separate goroutine to avoid blocking the critical path - - // 1.do state prefetch for snapshot cache - throwaway := statedb.CopyDoPrefetch() - go bc.prefetcher.Prefetch(block, throwaway, &bc.vmConfig, interruptCh) - - // 2.do trie prefetch for MPT trie node cache - // it is for the big state trie tree, prefetch based on transaction's From/To address. - // trie prefetcher is thread safe now, ok to prefetch in a separate routine - go throwaway.TriePrefetchInAdvance(block, signer) - } - - //Process block using the parent state as reference point substart := time.Now() - if bc.pipeCommit { - statedb.EnablePipeCommit() - } - statedb.SetExpectedStateRoot(block.Root()) - statedb, receipts, logs, usedGas, err := bc.processor.Process(block, statedb, bc.vmConfig) - close(interruptCh) // state prefetch can be stopped - if err != nil { - bc.reportBlock(block, receipts, err) - statedb.StopPrefetcher() - return it.index, err + var ( + receipts []*types.Receipt + logs []*types.Log + usedGas uint64 + ) + // if engine is DC, we don't need to do prefetch + if _, ok := bc.engine.(consensus.DC); ok { + statedb.SetExpectedStateRoot(block.Root()) + statedb, receipts, logs, usedGas, err = bc.processor.Process(block, statedb, bc.vmConfig) + if err != nil { + bc.reportBlock(block, receipts, err) + return it.index, err + } + } else { + // Enable prefetching to pull in trie node paths while processing transactions + statedb.StartPrefetcher("chain") + interruptCh := make(chan struct{}) + // For diff sync, it may fallback to full sync, so we still do prefetch + if len(block.Transactions()) >= prefetchTxNumber { + // do Prefetch in a separate goroutine to avoid blocking the critical path + + // 1.do state prefetch for snapshot cache + throwaway := statedb.CopyDoPrefetch() + go bc.prefetcher.Prefetch(block, throwaway, &bc.vmConfig, interruptCh) + + // 2.do trie prefetch for MPT trie node cache + // it is for the big state trie tree, prefetch based on transaction's From/To address. + // trie prefetcher is thread safe now, ok to prefetch in a separate routine + go throwaway.TriePrefetchInAdvance(block, signer) + } + + //Process block using the parent state as reference point + if bc.pipeCommit { + statedb.EnablePipeCommit() + } + statedb.SetExpectedStateRoot(block.Root()) + statedb, receipts, logs, usedGas, err = bc.processor.Process(block, statedb, bc.vmConfig) + close(interruptCh) // state prefetch can be stopped + if err != nil { + bc.reportBlock(block, receipts, err) + statedb.StopPrefetcher() + return it.index, err + } } // Update the metrics touched during block processing accountReadTimer.Update(statedb.AccountReads) // Account reads are complete, we can mark them @@ -1931,6 +1940,20 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool) storageUpdateTimer.Update(statedb.StorageUpdates) // Storage updates are complete, we can mark them snapshotAccountReadTimer.Update(statedb.SnapshotAccountReads) // Account reads are complete, we can mark them snapshotStorageReadTimer.Update(statedb.SnapshotStorageReads) // Storage reads are complete, we can mark them + // Update the DC metrics touched during DC block processing + if _, ok := bc.engine.(consensus.DC); ok { + blockDCProcessBlockTimer.Update(statedb.DCProcessBlock) + blockDCVerificationTimer.Update(statedb.DCVerifications) + blockDCWriteBlockTimer.Update(statedb.DCWriteBlocks) + blockDCFinaliseStateTimer.Update(statedb.DCFinaliseStates) + blockDCGetReceiptsTimer.Update(statedb.DCGetReceipts) + blockDCCommitHooksTimer.Update(statedb.DCCommitHooks) + blockDCGetObjectsTimer.Update(statedb.DCGetObjects) + blockDCSetObjectsTimer.Update(statedb.DCSetObjects) + blockDCSetStoragesTimer.Update(statedb.DCSetStorages) + blockDCObjectCounter.Inc(int64(statedb.DCObjects)) + blockDCStorageCounter.Inc(int64(statedb.DCStorages)) + } blockExecutionTimer.Update(time.Since(substart)) @@ -1944,8 +1967,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool) return it.index, err } } - bc.cacheReceipts(block.Hash(), receipts) - bc.cacheBlock(block.Hash(), block) + proctime := time.Since(start) // Update the metrics touched during block validation @@ -2983,6 +3005,11 @@ func (bc *BlockChain) TriesInMemory() uint64 { return bc.triesInMemory } // Options func EnableLightProcessor(bc *BlockChain) (*BlockChain, error) { + if _, ok := bc.engine.(consensus.DC); ok { + // light processor is not supported in Dogechain data + return bc, nil + } + bc.processor = NewLightStateProcessor(bc.Config(), bc, bc.engine) return bc, nil } diff --git a/core/blockchain_repair_test.go b/core/blockchain_repair_test.go index f56ed9fcdc..6ce2344742 100644 --- a/core/blockchain_repair_test.go +++ b/core/blockchain_repair_test.go @@ -21,7 +21,6 @@ package core import ( - "io/ioutil" "math/big" "os" "testing" @@ -1756,7 +1755,7 @@ func testRepair(t *testing.T, tt *rewindTest, snapshots bool) { // fmt.Println(tt.dump(true)) // Create a temporary persistent database - datadir, err := ioutil.TempDir("", "") + datadir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("Failed to create temporary datadir: %v", err) } @@ -1886,7 +1885,7 @@ func TestIssue23496(t *testing.T) { //log.Root().SetHandler(log.LvlFilterHandler(log.LvlTrace, log.StreamHandler(os.Stderr, log.TerminalFormat(true)))) // Create a temporary persistent database - datadir, err := ioutil.TempDir("", "") + datadir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("Failed to create temporary datadir: %v", err) } diff --git a/core/blockchain_sethead_test.go b/core/blockchain_sethead_test.go index 7ee213b726..2a97fe9ad2 100644 --- a/core/blockchain_sethead_test.go +++ b/core/blockchain_sethead_test.go @@ -21,7 +21,6 @@ package core import ( "fmt" - "io/ioutil" "math/big" "os" "strings" @@ -1955,7 +1954,7 @@ func testSetHead(t *testing.T, tt *rewindTest, snapshots bool) { // fmt.Println(tt.dump(false)) // Create a temporary persistent database - datadir, err := ioutil.TempDir("", "") + datadir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("Failed to create temporary datadir: %v", err) } diff --git a/core/blockchain_snapshot_test.go b/core/blockchain_snapshot_test.go index bc217fd80d..4958b202f5 100644 --- a/core/blockchain_snapshot_test.go +++ b/core/blockchain_snapshot_test.go @@ -22,7 +22,6 @@ package core import ( "bytes" "fmt" - "io/ioutil" "math/big" "os" "strings" @@ -59,7 +58,7 @@ type snapshotTestBasic struct { func (basic *snapshotTestBasic) prepare(t *testing.T) (*BlockChain, []*types.Block) { // Create a temporary persistent database - datadir, err := ioutil.TempDir("", "") + datadir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("Failed to create temporary datadir: %v", err) } diff --git a/core/blockchain_test.go b/core/blockchain_test.go index 20615eef8c..41ee2ef4f1 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -19,7 +19,6 @@ package core import ( "errors" "fmt" - "io/ioutil" "math/big" "math/rand" "os" @@ -898,7 +897,7 @@ func TestFastVsFullChains(t *testing.T) { t.Fatalf("failed to insert receipt %d: %v", n, err) } // Freezer style fast import the chain. - frdir, err := ioutil.TempDir("", "") + frdir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("failed to create temp freezer dir: %v", err) } @@ -994,7 +993,7 @@ func TestLightVsFastVsFullChainHeads(t *testing.T) { // makeDb creates a db instance for testing. makeDb := func() (ethdb.Database, func()) { - dir, err := ioutil.TempDir("", "") + dir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("failed to create temp freezer dir: %v", err) } @@ -1860,7 +1859,7 @@ func TestBlockchainRecovery(t *testing.T) { blocks, receipts := GenerateChain(gspec.Config, genesis, ethash.NewFaker(), gendb, int(height), nil) // Import the chain as a ancient-first node and ensure all pointers are updated - frdir, err := ioutil.TempDir("", "") + frdir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("failed to create temp freezer dir: %v", err) } @@ -1932,7 +1931,7 @@ func TestInsertReceiptChainRollback(t *testing.T) { } // Set up a BlockChain that uses the ancient store. - frdir, err := ioutil.TempDir("", "") + frdir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("failed to create temp freezer dir: %v", err) } @@ -2199,7 +2198,7 @@ func testInsertKnownChainData(t *testing.T, typ string) { b.OffsetTime(-9) // A higher difficulty }) // Import the shared chain and the original canonical one - dir, err := ioutil.TempDir("", "") + dir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("failed to create temp freezer dir: %v", err) } @@ -2363,7 +2362,7 @@ func testInsertKnownChainDataWithMerging(t *testing.T, typ string, mergeHeight i }) // Import the shared chain and the original canonical one - dir, err := ioutil.TempDir("", "") + dir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("failed to create temp freezer dir: %v", err) } @@ -2673,7 +2672,7 @@ func TestTransactionIndices(t *testing.T) { } } } - frdir, err := ioutil.TempDir("", "") + frdir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("failed to create temp freezer dir: %v", err) } @@ -2800,7 +2799,7 @@ func TestSkipStaleTxIndicesInSnapSync(t *testing.T) { } } - frdir, err := ioutil.TempDir("", "") + frdir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("failed to create temp freezer dir: %v", err) } diff --git a/core/chain_makers.go b/core/chain_makers.go index 1a3e660c40..45f9d496a6 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -174,11 +174,6 @@ func (b *BlockGen) AddUncle(h *types.Header) { h.GasLimit = parent.GasLimit if b.config.IsLondon(h.Number) { h.BaseFee = misc.CalcBaseFee(b.config, parent) - h.BaseFee = misc.CalcBaseFee(b.config, parent) - if !b.config.IsLondon(parent.Number) { - parentGasLimit := parent.GasLimit * params.ElasticityMultiplier - h.GasLimit = CalcGasLimit(parentGasLimit, parentGasLimit) - } } b.uncles = append(b.uncles, h) } @@ -255,7 +250,7 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse misc.ApplyDAOHardFork(statedb) } // Upgrade system contracts in different protocols. - if config.IsIBFT(b.Number()) { // ibft + if config.IsIBFT(b.Number()) { // dbsc dccontracts.UpgradeBuildInSystemContract(config, b.header.Number, statedb) } else { // parlia by default systemcontracts.UpgradeBuildInSystemContract(config, b.header.Number, statedb) @@ -316,10 +311,6 @@ func makeHeader(chain consensus.ChainReader, parent *types.Block, state *state.S } if chain.Config().IsLondon(header.Number) { header.BaseFee = misc.CalcBaseFee(chain.Config(), parent.Header()) - if !chain.Config().IsLondon(parent.Number()) { - parentGasLimit := parent.GasLimit() * params.ElasticityMultiplier - header.GasLimit = CalcGasLimit(parentGasLimit, parentGasLimit) - } } return header } diff --git a/core/dccontracts/upgrader.go b/core/dccontracts/upgrader.go index d2fbadd76c..9164d797cb 100644 --- a/core/dccontracts/upgrader.go +++ b/core/dccontracts/upgrader.go @@ -44,6 +44,15 @@ var ( _detroitUpgrade = make(map[string]*Upgrade) ) +var ( + // for hawaii upgrade testing, the code hash is on detroit upgrade + _hawaiiContractHashes = map[string]common.Hash{ + DCValidatorSetContract: common.HexToHash("0x7aaf439b5a0b4b1e58848486506dfd926917b27c96b4575db129d238f953ab16"), + DCBridgeContract: common.HexToHash("0x9f6481ee665b7a3e887b9cd08ce336056496e9cac0118d23fdbe5ee06dd5c097"), + DCVaultContract: common.HexToHash("0x21ffddf3b9496572e1deee783130caa55a19cd5443b83ef50ac75047f0a01754"), + } +) + func init() { // pre-portland upgrade, only devnet support this hard fork _testInt, _ := new(big.Int).SetString("55000000000000000000", 0) @@ -107,6 +116,9 @@ func init() { // network supports detroit upgrade _detroitUpgrade[_mainNet] = _detroitUpgradeContent _detroitUpgrade[_devNet] = _detroitUpgradeContent + + // hawaii harkfork + } func UpgradeBuildInSystemContract(config *params.ChainConfig, blockNumber *big.Int, statedb *state.StateDB) { @@ -137,6 +149,15 @@ func UpgradeBuildInSystemContract(config *params.ChainConfig, blockNumber *big.I if config.IsOnDetorit(blockNumber) { applySystemContractUpgrade(_detroitUpgrade[network], blockNumber, statedb, logger) } + + // only works on test environments + if config.IsOnHawaii(blockNumber) { + got := statedb.GetCodeHash(common.HexToAddress(DCValidatorSetContract)) + should := _hawaiiContractHashes[DCValidatorSetContract] + if got != should { + applySystemContractUpgrade(_detroitUpgrade[network], blockNumber, statedb, logger) + } + } } func applySystemContractUpgrade(upgrade *Upgrade, blockNumber *big.Int, statedb *state.StateDB, logger log.Logger) { diff --git a/core/genesis.go b/core/genesis.go index b71ec8e29d..a6c9c2529b 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -168,7 +168,7 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, genesis *Genesis, override var realGenesisHash common.Hash defer func() { if realGenesisHash != (common.Hash{}) { - // Never mind whether it is ibft or parlia, set both genesis hash. + // Never mind its consensus, set both genesis hash. dccontracts.GenesisHash = realGenesisHash systemcontracts.GenesisHash = realGenesisHash } diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index 6b6af68bb7..c08c1a502c 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -21,6 +21,7 @@ import ( "encoding/binary" "errors" "fmt" + "math" "math/big" "sort" @@ -33,6 +34,25 @@ import ( "github.com/ethereum/go-ethereum/rlp" ) +// dogechain specific compatible +var ( + // Hawaii hard fork block number + DC_BLOCK_END_NUMBER int64 = -1 +) + +func DCBlockHeaderRange(number uint64) bool { + // overflow check + if number > uint64(math.MaxInt64) { + return false + } + + if int64(number) <= DC_BLOCK_END_NUMBER { + return true + } + + return false +} + // ReadCanonicalHash retrieves the hash assigned to a canonical block number. func ReadCanonicalHash(db ethdb.Reader, number uint64) common.Hash { var data []byte @@ -329,7 +349,7 @@ func ReadHeaderRange(db ethdb.Reader, number uint64, count uint64) []rlp.RawValu return rlpHeaders } -// ReadHeaderRLP retrieves a block header in its raw RLP database encoding. +// ReadHeaderRLP retrieves a block header in its raw RLP database encoding. no check hash equality func ReadHeaderRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValue { var data []byte db.ReadAncients(func(reader ethdb.AncientReader) error { @@ -337,9 +357,12 @@ func ReadHeaderRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValu // comparison is necessary since ancient database only maintains // the canonical data. data, _ = reader.Ancient(freezerHeaderTable, number) - if len(data) > 0 && crypto.Keccak256Hash(data) == hash { + if DCBlockHeaderRange(number) && len(data) > 0 { + return nil + } else if len(data) > 0 && crypto.Keccak256Hash(data) == hash { return nil } + // If not, try reading from leveldb data, _ = db.Get(headerKey(number, hash)) return nil @@ -369,6 +392,12 @@ func ReadHeader(db ethdb.Reader, hash common.Hash, number uint64) *types.Header log.Error("Invalid block header RLP", "hash", hash, "err", err) return nil } + // check hash equality + if header.Hash() != hash { + log.Error("hash mismatch", "hash", hash, "header hash", header.Hash()) + return nil + } + return header } diff --git a/core/rawdb/accessors_chain_test.go b/core/rawdb/accessors_chain_test.go index 877dccfebb..36093588ae 100644 --- a/core/rawdb/accessors_chain_test.go +++ b/core/rawdb/accessors_chain_test.go @@ -20,7 +20,6 @@ import ( "bytes" "encoding/hex" "fmt" - "io/ioutil" "math/big" "math/rand" "os" @@ -435,7 +434,7 @@ func checkReceiptsRLP(have, want types.Receipts) error { func TestAncientStorage(t *testing.T) { // Freezer style fast import the chain. - frdir, err := ioutil.TempDir("", "") + frdir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("failed to create temp freezer dir: %v", err) } @@ -577,7 +576,7 @@ func TestHashesInRange(t *testing.T) { // This measures the write speed of the WriteAncientBlocks operation. func BenchmarkWriteAncientBlocks(b *testing.B) { // Open freezer database. - frdir, err := ioutil.TempDir("", "") + frdir, err := os.MkdirTemp("", "") if err != nil { b.Fatalf("failed to create temp freezer dir: %v", err) } @@ -860,7 +859,7 @@ func TestDeriveLogFields(t *testing.T) { func BenchmarkDecodeRLPLogs(b *testing.B) { // Encoded receipts from block 0x14ee094309fbe8f70b65f45ebcc08fb33f126942d97464aad5eb91cfd1e2d269 - buf, err := ioutil.ReadFile("testdata/stored_receipts.bin") + buf, err := os.ReadFile("testdata/stored_receipts.bin") if err != nil { b.Fatal(err) } @@ -886,7 +885,7 @@ func BenchmarkDecodeRLPLogs(b *testing.B) { func TestHeadersRLPStorage(t *testing.T) { // Have N headers in the freezer - frdir, err := ioutil.TempDir("", "") + frdir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("failed to create temp freezer dir: %v", err) } diff --git a/core/rawdb/freezer_test.go b/core/rawdb/freezer_test.go index bc27ba1371..826a1b65a2 100644 --- a/core/rawdb/freezer_test.go +++ b/core/rawdb/freezer_test.go @@ -20,7 +20,6 @@ import ( "bytes" "errors" "fmt" - "io/ioutil" "math/big" "math/rand" "os" @@ -255,7 +254,7 @@ func TestFreezerConcurrentModifyTruncate(t *testing.T) { func TestFreezerReadonlyValidate(t *testing.T) { tables := map[string]bool{"a": true, "b": true} - dir, err := ioutil.TempDir("", "freezer") + dir, err := os.MkdirTemp("", "freezer") if err != nil { t.Fatal(err) } @@ -294,7 +293,7 @@ func TestFreezerReadonlyValidate(t *testing.T) { func newFreezerForTesting(t *testing.T, tables map[string]bool) (*freezer, string) { t.Helper() - dir, err := ioutil.TempDir("", "freezer") + dir, err := os.MkdirTemp("", "freezer") if err != nil { t.Fatal(err) } diff --git a/core/state/statedb.go b/core/state/statedb.go index afcb290fa7..90597fc562 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -141,6 +141,18 @@ type StateDB struct { SnapshotAccountReads time.Duration SnapshotStorageReads time.Duration SnapshotCommits time.Duration + // Measurements for debugging DC verification purposes + DCProcessBlock time.Duration + DCVerifications time.Duration + DCWriteBlocks time.Duration + DCFinaliseStates time.Duration + DCGetReceipts time.Duration + DCCommitHooks time.Duration + DCGetObjects time.Duration + DCSetObjects time.Duration + DCObjects int + DCSetStorages time.Duration + DCStorages int AccountUpdated int StorageUpdated int diff --git a/core/state_processor.go b/core/state_processor.go index 03a947b882..3a1b4276ef 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -87,6 +87,11 @@ func (p *LightStateProcessor) Process(block *types.Block, statedb *state.StateDB if posa, ok := p.engine.(consensus.PoSA); ok { allowLightProcess = posa.AllowLightProcess(p.bc, block.Header()) } + + if _, ok := p.engine.(consensus.DC); ok { + allowLightProcess = false + } + // random fallback to full process if allowLightProcess && block.NumberU64()%fullProcessCheck != uint64(p.check) && len(block.Transactions()) != 0 { var pid string @@ -388,13 +393,18 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg gp = new(GasPool).AddGas(block.GasLimit()) ) + // dogechain legacy block + if dc, ok := p.engine.(consensus.DC); ok { + return dc.Process(block, statedb) + } + var receipts = make([]*types.Receipt, 0) // Mutate the block and state according to any hard-fork specs if p.config.DAOForkSupport && p.config.DAOForkBlock != nil && p.config.DAOForkBlock.Cmp(block.Number()) == 0 { misc.ApplyDAOHardFork(statedb) } // Handle upgrade build-in system contract code - if p.config.IsIBFT(block.Number()) { // ibft + if p.config.IsIBFT(block.Number()) { // dbsc dccontracts.UpgradeBuildInSystemContract(p.config, block.Number(), statedb) } else { // parlia by default systemcontracts.UpgradeBuildInSystemContract(p.config, block.Number(), statedb) diff --git a/core/state_processor_test.go b/core/state_processor_test.go index 964c08947c..1bc6224a58 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -164,7 +164,7 @@ func TestStateProcessorErrors(t *testing.T) { txs: []*types.Transaction{ mkDynamicTx(0, common.Address{}, params.TxGas, big.NewInt(0), big.NewInt(0)), }, - want: "could not apply tx 0 [0xc4ab868fef0c82ae0387b742aee87907f2d0fc528fc6ea0a021459fb0fc4a4a8]: max fee per gas less than block base fee: address 0x71562b71999873DB5b286dF957af199Ec94617F7, maxFeePerGas: 0 baseFee: 875000000", + want: "invalid gas used (remote: 0 local: 21000)", }, { // ErrTipVeryHigh txs: []*types.Transaction{ diff --git a/core/state_transition.go b/core/state_transition.go index 41677ad735..ea7b27da8b 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -235,6 +235,7 @@ func (st *StateTransition) preCheck() error { st.msg.From().Hex(), codeHash) } } + // Make sure that transaction gasFeeCap is greater than the baseFee (post london) if st.evm.ChainConfig().IsLondon(st.evm.Context.BlockNumber) { // Skip the checks if gas fields are zero and baseFee was explicitly disabled (eth_call) @@ -354,10 +355,13 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { } // consensus engine with different mining actions - if st.evm.ChainConfig().Parlia != nil { // parlia + if st.evm.ChainConfig().Drab != nil { // drab + // Directly send fee to the coinbase. + st.state.AddBalance(st.evm.Context.Coinbase, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.gasPrice)) + } else if st.evm.ChainConfig().Parlia != nil { // parlia // The fee should go to system address for later distribution. st.state.AddBalance(consensus.SystemAddress, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.gasPrice)) - } else { // ibft, clique or others + } else { // clique or others effectiveTip := st.gasPrice if rules.IsLondon { effectiveTip = cmath.BigMin(st.gasTipCap, new(big.Int).Sub(st.gasFeeCap, st.evm.Context.BaseFee)) diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go index d3b40f1f4a..141a6c3d41 100644 --- a/core/tx_pool_test.go +++ b/core/tx_pool_test.go @@ -20,7 +20,6 @@ import ( "crypto/ecdsa" "errors" "fmt" - "io/ioutil" "math/big" "math/rand" "os" @@ -2254,7 +2253,7 @@ func testTransactionJournaling(t *testing.T, nolocals bool) { t.Parallel() // Create a temporary file for the journal - file, err := ioutil.TempFile("", "") + file, err := os.CreateTemp("", "") if err != nil { t.Fatalf("failed to create temporary journal: %v", err) } diff --git a/core/types/block_test.go b/core/types/block_test.go index aa1db2f4fa..bfaed65163 100644 --- a/core/types/block_test.go +++ b/core/types/block_test.go @@ -69,7 +69,7 @@ func TestBlockEncoding(t *testing.T) { } func TestEIP1559BlockEncoding(t *testing.T) { - blockEnc := common.FromHex("f9030bf901fea083cafc574e1f51ba9dc0568fc617a08ea2429fb384059c972f13b19fa1c8dd55a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ef1552a40b7165c3cd773806b9e0c165b75356e0314bf0706f279c729f51e017a05fe50b260da6308036625b850b5d6ced6d0a9f814c0688bc91ffb7b7a3a54b67a0bc37d79753ad738a6dac4921e57392f145d8887476de3f783dfa7edae9283e52b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd8825208845506eb0780a0bd4472abb6659ebe3ee06ee4d7b72a00a9f4d001caca51342001075469aff49888a13a5a8c8f2bb1c4843b9aca00f90106f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba09bea4c4daac7c7c52e093e6a4c35dbbcf8856f1af7b059ba20253e70848d094fa08a8fae537ce25ed8cb5af9adac3f141af69bd515bd2ba031522df09b97dd72b1b8a302f8a0018080843b9aca008301e24194095e7baea6a6c7c4c2dfeb977efac326af552d878080f838f7940000000000000000000000000000000000000001e1a0000000000000000000000000000000000000000000000000000000000000000080a0fe38ca4e44a30002ac54af7cf922a6ac2ba11b7d22f548e8ecb3f51f41cb31b0a06de6a5cbae13c0c856e33acf021b51819636cfc009d39eafb9f606d546e305a8c0") + blockEnc := common.FromHex("f90303f901faa083cafc574e1f51ba9dc0568fc617a08ea2429fb384059c972f13b19fa1c8dd55a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ef1552a40b7165c3cd773806b9e0c165b75356e0314bf0706f279c729f51e017a05fe50b260da6308036625b850b5d6ced6d0a9f814c0688bc91ffb7b7a3a54b67a0bc37d79753ad738a6dac4921e57392f145d8887476de3f783dfa7edae9283e52b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd8825208845506eb0780a0bd4472abb6659ebe3ee06ee4d7b72a00a9f4d001caca51342001075469aff49888a13a5a8c8f2bb1c480f90102f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba09bea4c4daac7c7c52e093e6a4c35dbbcf8856f1af7b059ba20253e70848d094fa08a8fae537ce25ed8cb5af9adac3f141af69bd515bd2ba031522df09b97dd72b1b89f02f89c018080808301e24194095e7baea6a6c7c4c2dfeb977efac326af552d878080f838f7940000000000000000000000000000000000000001e1a0000000000000000000000000000000000000000000000000000000000000000080a0fe38ca4e44a30002ac54af7cf922a6ac2ba11b7d22f548e8ecb3f51f41cb31b0a06de6a5cbae13c0c856e33acf021b51819636cfc009d39eafb9f606d546e305a8c0") var block Block if err := rlp.DecodeBytes(blockEnc, &block); err != nil { t.Fatal("decode error: ", err) @@ -87,7 +87,7 @@ func TestEIP1559BlockEncoding(t *testing.T) { check("Coinbase", block.Coinbase(), common.HexToAddress("8888f1f195afa192cfee860698584c030f4c9db1")) check("MixDigest", block.MixDigest(), common.HexToHash("bd4472abb6659ebe3ee06ee4d7b72a00a9f4d001caca51342001075469aff498")) check("Root", block.Root(), common.HexToHash("ef1552a40b7165c3cd773806b9e0c165b75356e0314bf0706f279c729f51e017")) - check("Hash", block.Hash(), common.HexToHash("c7252048cd273fe0dac09650027d07f0e3da4ee0675ebbb26627cea92729c372")) + check("Hash", block.Hash(), common.HexToHash("ae9d971d16de73f69f940f1bd4ce5961158781176e73abea92a2b8781403885e")) check("Nonce", block.Nonce(), uint64(0xa13a5a8c8f2bb1c4)) check("Time", block.Time(), uint64(1426516743)) check("Size", block.Size(), common.StorageSize(len(blockEnc))) diff --git a/core/types/hashing_test.go b/core/types/hashing_test.go index 37ea84315b..288195514c 100644 --- a/core/types/hashing_test.go +++ b/core/types/hashing_test.go @@ -318,7 +318,7 @@ func TestHeader_Hasher(t *testing.T) { expHash: common.HexToHash("0x21e7c0e3322a45292bae14f8e4ce5bea537908766397d43fabb32e03970a249e"), }, { - name: "ibft genesis header", + name: "dc genesis header", data: &types.Header{ ParentHash: common.Hash{}, UncleHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"), @@ -339,7 +339,7 @@ func TestHeader_Hasher(t *testing.T) { expHash: common.HexToHash("0x75d36607ff0e081d53cf9999d3abd2050f1865e443fe2197236e0ab76aad4443"), }, { - name: "ibft chain header", + name: "dc chain header", data: &types.Header{ ParentHash: common.HexToHash("0x98295ad58f5ccab9d79efc55d15ecbf1f06dfc30f0cfd0125a28d5d7ee2270e6"), UncleHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"), @@ -359,6 +359,28 @@ func TestHeader_Hasher(t *testing.T) { }, expHash: common.HexToHash("0x9b84a2811d55ec8fe72d223b81554a109c3591aa9e4330bc80078921009f0b94"), }, + { + name: "dc hawaii fork chain header", + data: &types.Header{ + ParentHash: common.HexToHash("0x7e53e2e6e4f1dde9a013bee4f5512254735d2316ef3533a2ccdb4b310bd89778"), + UncleHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"), + Coinbase: common.HexToAddress("0x598f7be31d758ef38ae854eab6049ae0756c8061"), + Root: common.HexToHash("0x7a1fbf29ec5f0ba9c557c1ed475249626e0367a46bf4b7ef557a5e289384cc46"), + TxHash: common.HexToHash("0xe978b304e7c6de4a96d89c5e434e74a6480ce35257aa56cea9c71c55b28a90a7"), + ReceiptHash: common.HexToHash("0x05abfe8819340456ecca1123d99f0757a4bd468f2599684add65f646607c4ee9"), + Bloom: types.BytesToBloom(common.Hex2Bytes("0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")), + Difficulty: big.NewInt(2), + Number: big.NewInt(1), + GasLimit: 0x1c9c380, + GasUsed: 0x9e3, + Time: 0x64feb2e1, + Extra: common.Hex2Bytes("d983010115846765746888676f312e31392e388664617277696e00004b1fbebfd393677b0229308737e414ca73c5447fdf59bdc78e59dfd7234d8289ac6b27ea1c6695579db1a98a88e19bcdd18d033599d3f5ed738dfd7c3138309499074a2a00"), + MixDigest: types.DrapMixHash, + Nonce: types.BlockNonce{}, + BaseFee: big.NewInt(0), + }, + expHash: common.HexToHash("0xd2993fb4a05ddaf4f47bc03e9bfdef386b20d8c33ec24f95641cf9d755449c65"), + }, } { tc := tc t.Run(tc.name, func(t *testing.T) { diff --git a/core/types/ibft_header_rlp.go b/core/types/ibft_header_rlp.go index d2072ba183..9efe15bf1c 100644 --- a/core/types/ibft_header_rlp.go +++ b/core/types/ibft_header_rlp.go @@ -29,6 +29,13 @@ var ( // The difference of extra between geth, bsc and dogechain (ibft) is that ibft uses zero instead of // client version on prefix IBFTExtraPrefix = common.Hash{} + + // DrapMixHash represents a hash of drap consensus + // to identify whether the block reaches specific + // hard fork. + // + // Keccak256("Dogechain drab consensus") + DrapMixHash = common.HexToHash("0x13912b8b1e9f8bfbe6744f894d9ab0eb74ab0abb35049115b4b618961f4ec26f") ) // IBFTExtra defines the structure of the extra field for I(stanbul)BFT diff --git a/core/vm/contracts.go b/core/vm/contracts.go index f45ac4eb11..ff4203e746 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -154,14 +154,14 @@ var PrecompiledContractsBLS = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{18}): &bls12381MapG2{}, } -// PrecompiledContractsIBFT contains the default set of pre-compiled Ethereum -// contracts used in the IBFT release. -var PrecompiledContractsIBFT = map[common.Address]PrecompiledContract{ +// PrecompiledContractsHawaii contains the default set of pre-compiled Ethereum +// contracts used in the Hawaii release. +var PrecompiledContractsHawaii = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{1}): &ecrecover{}, common.BytesToAddress([]byte{2}): &sha256hash{}, common.BytesToAddress([]byte{3}): &ripemd160hash{}, common.BytesToAddress([]byte{4}): &dataCopy{}, - common.BytesToAddress([]byte{5}): &bigModExp{}, + common.BytesToAddress([]byte{5}): &bigModExp{eip2565: true}, common.BytesToAddress([]byte{6}): &bn256AddIstanbul{}, common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{}, common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{}, @@ -169,6 +169,7 @@ var PrecompiledContractsIBFT = map[common.Address]PrecompiledContract{ } var ( + PrecompiledAddressesHawaii []common.Address PrecompiledAddressesPlanck []common.Address PrecompiledAddressesMoran []common.Address PrecompiledAddressesNano []common.Address @@ -176,7 +177,6 @@ var ( PrecompiledAddressesIstanbul []common.Address PrecompiledAddressesByzantium []common.Address PrecompiledAddressesHomestead []common.Address - PrecompiledAddressesIBFT []common.Address ) func init() { @@ -201,14 +201,16 @@ func init() { for k := range PrecompiledContractsPlanck { PrecompiledAddressesPlanck = append(PrecompiledAddressesPlanck, k) } - for k := range PrecompiledContractsIBFT { - PrecompiledAddressesIBFT = append(PrecompiledAddressesIBFT, k) + for k := range PrecompiledContractsHawaii { + PrecompiledAddressesHawaii = append(PrecompiledAddressesHawaii, k) } } // ActivePrecompiles returns the precompiles enabled with the current configuration. func ActivePrecompiles(rules params.Rules) []common.Address { switch { + case rules.IsHawaii: + return PrecompiledAddressesHawaii case rules.IsPlanck: return PrecompiledAddressesPlanck case rules.IsMoran: diff --git a/core/vm/contracts_test.go b/core/vm/contracts_test.go index aa8d2f1eb3..b22d999e6c 100644 --- a/core/vm/contracts_test.go +++ b/core/vm/contracts_test.go @@ -20,7 +20,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "os" "testing" "time" @@ -334,7 +334,7 @@ func TestPrecompiledBLS12381MapG1Fail(t *testing.T) { testJsonFail("blsMapG func TestPrecompiledBLS12381MapG2Fail(t *testing.T) { testJsonFail("blsMapG2", "12", t) } func loadJson(name string) ([]precompiledTest, error) { - data, err := ioutil.ReadFile(fmt.Sprintf("testdata/precompiles/%v.json", name)) + data, err := os.ReadFile(fmt.Sprintf("testdata/precompiles/%v.json", name)) if err != nil { return nil, err } @@ -344,7 +344,7 @@ func loadJson(name string) ([]precompiledTest, error) { } func loadJsonFail(name string) ([]precompiledFailureTest, error) { - data, err := ioutil.ReadFile(fmt.Sprintf("testdata/precompiles/fail-%v.json", name)) + data, err := os.ReadFile(fmt.Sprintf("testdata/precompiles/fail-%v.json", name)) if err != nil { return nil, err } diff --git a/core/vm/evm.go b/core/vm/evm.go index f99c52f238..e0a60a9926 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -53,10 +53,8 @@ func (evm *EVM) precompile(addr common.Address) (PrecompiledContract, bool) { var precompiles map[common.Address]PrecompiledContract switch { // Top most chain rule - case evm.chainRules.IsIBFT: - // Since ibft genesis block, we'll use only berlin compatible - // precompiled contracts. - precompiles = PrecompiledContractsIBFT + case evm.chainRules.IsHawaii: + precompiles = PrecompiledContractsHawaii case evm.chainRules.IsPlanck: precompiles = PrecompiledContractsPlanck case evm.chainRules.IsMoran: diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 9b3aed86cc..1c0e780e6a 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -660,19 +660,7 @@ func opCreate2(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([] // Push item on the stack based on the returned error. if suberr != nil { - if interpreter.evm.chainConfig.IsIBFT(interpreter.evm.Context.BlockNumber) { - // IBFT use a strange Create2 opcode stack calling sequence, which is not - // EVM compatible. So we need to return address even though it failed due - // to not enough gas during running the construction. - // But we'll make this unknown issue back to normal after the hard fork - if interpreter.evm.chainConfig.IsHawaii(interpreter.evm.Context.BlockNumber) { - stackvalue.Clear() - } else { - stackvalue.SetBytes(addr.Bytes()) - } - } else { - stackvalue.Clear() - } + stackvalue.Clear() } else { stackvalue.SetBytes(addr.Bytes()) } diff --git a/core/vm/instructions_test.go b/core/vm/instructions_test.go index 36589a1269..8e6d6c92cf 100644 --- a/core/vm/instructions_test.go +++ b/core/vm/instructions_test.go @@ -20,8 +20,8 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" "math/big" + "os" "testing" "github.com/ethereum/go-ethereum/common" @@ -260,7 +260,7 @@ func TestWriteExpectedValues(t *testing.T) { if err != nil { t.Fatal(err) } - _ = ioutil.WriteFile(fmt.Sprintf("testdata/testcases_%v.json", name), data, 0644) + _ = os.WriteFile(fmt.Sprintf("testdata/testcases_%v.json", name), data, 0644) if err != nil { t.Fatal(err) } @@ -270,7 +270,7 @@ func TestWriteExpectedValues(t *testing.T) { // TestJsonTestcases runs through all the testcases defined as json-files func TestJsonTestcases(t *testing.T) { for name := range twoOpMethods { - data, err := ioutil.ReadFile(fmt.Sprintf("testdata/testcases_%v.json", name)) + data, err := os.ReadFile(fmt.Sprintf("testdata/testcases_%v.json", name)) if err != nil { t.Fatal("Failed to read file", err) } diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 8a2ed5b9de..03fa571826 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -81,8 +81,6 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter { // Hawaii instructions are compatible with istanbul. // No more issues should be brought in here. cfg.JumpTable = &hawaiiInstructionSet - case evm.chainRules.IsIBFT: - cfg.JumpTable = &ibftInstructionSet case evm.chainRules.IsMerge: cfg.JumpTable = &mergeInstructionSet case evm.chainRules.IsLondon: diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index d6be536a72..6430d7aa8d 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -55,8 +55,7 @@ var ( berlinInstructionSet = newBerlinInstructionSet() londonInstructionSet = newLondonInstructionSet() mergeInstructionSet = newMergeInstructionSet() - ibftInstructionSet = newIBFTInstructionSet() - hawaiiInstructionSet = newIstanbulInstructionSet() + hawaiiInstructionSet = newMergeInstructionSet() ) // JumpTable contains the EVM opcodes supported at a given fork. @@ -120,16 +119,6 @@ func newIstanbulInstructionSet() JumpTable { return validate(instructionSet) } -func newIBFTInstructionSet() JumpTable { - instructionSet := newConstantinopleInstructionSet() - - enable1344(&instructionSet) // ChainID opcode - https://eips.ethereum.org/EIPS/eip-1344 - enable1884(&instructionSet) // Reprice reader opcodes - https://eips.ethereum.org/EIPS/eip-1884 - enableIBFT2200(&instructionSet) // Net metered SSTORE - - return validate(instructionSet) -} - // newConstantinopleInstructionSet returns the frontier, homestead, // byzantium and contantinople instructions. func newConstantinopleInstructionSet() JumpTable { diff --git a/crypto/crypto.go b/crypto/crypto.go index e943349c39..36980f0136 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -26,7 +26,6 @@ import ( "fmt" "hash" "io" - "io/ioutil" "math/big" "os" "sync" @@ -284,7 +283,7 @@ func checkKeyFileEnd(r *bufio.Reader) error { // restrictive permissions. The key data is saved hex-encoded. func SaveECDSA(file string, key *ecdsa.PrivateKey) error { k := hex.EncodeToString(FromECDSA(key)) - return ioutil.WriteFile(file, []byte(k), 0600) + return os.WriteFile(file, []byte(k), 0600) } // GenerateKey generates a new private key. diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go index f9b0d3e834..da123cf980 100644 --- a/crypto/crypto_test.go +++ b/crypto/crypto_test.go @@ -20,7 +20,6 @@ import ( "bytes" "crypto/ecdsa" "encoding/hex" - "io/ioutil" "math/big" "os" "reflect" @@ -182,7 +181,7 @@ func TestLoadECDSA(t *testing.T) { } for _, test := range tests { - f, err := ioutil.TempFile("", "loadecdsa_test.*.txt") + f, err := os.CreateTemp("", "loadecdsa_test.*.txt") if err != nil { t.Fatal(err) } @@ -203,7 +202,7 @@ func TestLoadECDSA(t *testing.T) { } func TestSaveECDSA(t *testing.T) { - f, err := ioutil.TempFile("", "saveecdsa_test.*.txt") + f, err := os.CreateTemp("", "saveecdsa_test.*.txt") if err != nil { t.Fatal(err) } diff --git a/crypto/signify/signify.go b/crypto/signify/signify.go index e280f87268..eb029e5099 100644 --- a/crypto/signify/signify.go +++ b/crypto/signify/signify.go @@ -25,7 +25,7 @@ import ( "encoding/base64" "errors" "fmt" - "io/ioutil" + "os" "strings" "time" ) @@ -68,7 +68,7 @@ func SignFile(input string, output string, key string, untrustedComment string, trustedComment = fmt.Sprintf("timestamp:%d", time.Now().Unix()) } - filedata, err := ioutil.ReadFile(input) + filedata, err := os.ReadFile(input) if err != nil { return err } @@ -96,5 +96,5 @@ func SignFile(input string, output string, key string, untrustedComment string, fmt.Fprintln(out, base64.StdEncoding.EncodeToString(dataSig)) fmt.Fprintln(out, "trusted comment:", trustedComment) fmt.Fprintln(out, base64.StdEncoding.EncodeToString(commentSig)) - return ioutil.WriteFile(output, out.Bytes(), 0644) + return os.WriteFile(output, out.Bytes(), 0644) } diff --git a/crypto/signify/signify_fuzz.go b/crypto/signify/signify_fuzz.go index 2dc9b2102f..457af044d1 100644 --- a/crypto/signify/signify_fuzz.go +++ b/crypto/signify/signify_fuzz.go @@ -22,7 +22,6 @@ package signify import ( "bufio" "fmt" - "io/ioutil" "log" "os" "os/exec" @@ -35,7 +34,7 @@ func Fuzz(data []byte) int { if len(data) < 32 { return -1 } - tmpFile, err := ioutil.TempFile("", "") + tmpFile, err := os.CreateTemp("", "") if err != nil { panic(err) } @@ -76,7 +75,7 @@ func Fuzz(data []byte) int { // Write the public key into the file to pass it as // an argument to signify-openbsd - pubKeyFile, err := ioutil.TempFile("", "") + pubKeyFile, err := os.CreateTemp("", "") if err != nil { panic(err) } @@ -128,7 +127,7 @@ func getKey(fileS string) (string, error) { func createKeyPair() (string, string) { // Create key and put it in correct format - tmpKey, err := ioutil.TempFile("", "") + tmpKey, err := os.CreateTemp("", "") if err != nil { panic(err) } diff --git a/crypto/signify/signify_test.go b/crypto/signify/signify_test.go index 615d4e6527..ba85d2fc43 100644 --- a/crypto/signify/signify_test.go +++ b/crypto/signify/signify_test.go @@ -20,7 +20,6 @@ package signify import ( - "io/ioutil" "math/rand" "os" "testing" @@ -35,7 +34,7 @@ var ( ) func TestSignify(t *testing.T) { - tmpFile, err := ioutil.TempFile("", "") + tmpFile, err := os.CreateTemp("", "") if err != nil { t.Fatal(err) } @@ -79,7 +78,7 @@ func TestSignify(t *testing.T) { } func TestSignifyTrustedCommentTooManyLines(t *testing.T) { - tmpFile, err := ioutil.TempFile("", "") + tmpFile, err := os.CreateTemp("", "") if err != nil { t.Fatal(err) } @@ -104,7 +103,7 @@ func TestSignifyTrustedCommentTooManyLines(t *testing.T) { } func TestSignifyTrustedCommentTooManyLinesLF(t *testing.T) { - tmpFile, err := ioutil.TempFile("", "") + tmpFile, err := os.CreateTemp("", "") if err != nil { t.Fatal(err) } @@ -129,7 +128,7 @@ func TestSignifyTrustedCommentTooManyLinesLF(t *testing.T) { } func TestSignifyTrustedCommentEmpty(t *testing.T) { - tmpFile, err := ioutil.TempFile("", "") + tmpFile, err := os.CreateTemp("", "") if err != nil { t.Fatal(err) } diff --git a/dcmetrics/metrics.go b/dcmetrics/metrics.go new file mode 100644 index 0000000000..d02167a5db --- /dev/null +++ b/dcmetrics/metrics.go @@ -0,0 +1,77 @@ +package dcmetrics + +import ( + "errors" + "net/http" + "sync" + "time" + + "github.com/dogechain-lab/dogechain/blockchain" + "github.com/dogechain-lab/dogechain/consensus" + itrie "github.com/dogechain-lab/dogechain/state/immutable-trie" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/metrics" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" +) + +const namespace = "dc_dbsc" + +var ( + ChainID = "2000" // chain id +) + +var ( + sharedOnce sync.Once + sharedMetrics *DCMetrics +) + +// DCMetrics holds the metric instances of dc sub systems +type DCMetrics struct { + Blockchain *blockchain.Metrics + Consensus *consensus.Metrics + Trie itrie.Metrics +} + +func SharedMetrics() *DCMetrics { + sharedOnce.Do(func() { + if metrics.Enabled { + sharedMetrics = &DCMetrics{ + Blockchain: blockchain.GetPrometheusMetrics(namespace, "chain_id", ChainID), + Consensus: consensus.GetPrometheusMetrics(namespace, "chain_id", ChainID), + Trie: itrie.GetPrometheusMetrics(namespace, metrics.EnabledExpensive, "chain_id", ChainID), + } + } else { + sharedMetrics = &DCMetrics{ + Blockchain: blockchain.NilMetrics(), + Consensus: consensus.NilMetrics(), + Trie: itrie.NilMetrics(), + } + } + }) + + return sharedMetrics +} + +func StartPrometheusServer(addr string) *http.Server { + srv := &http.Server{ + Addr: addr, + Handler: promhttp.InstrumentMetricHandler( + prometheus.DefaultRegisterer, promhttp.HandlerFor( + prometheus.DefaultGatherer, + promhttp.HandlerOpts{}, + ), + ), + ReadHeaderTimeout: time.Minute, + } + + go func() { + if err := srv.ListenAndServe(); !errors.Is(err, http.ErrServerClosed) { + log.Error("DC prometheus http server ListenAndServe failed", "err", err) + } else { + log.Info("DC prometheus http server stop") + } + }() + + return srv +} diff --git a/eth/api_backend.go b/eth/api_backend.go index 7c0f1f0482..8c228fc73d 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -96,6 +96,14 @@ func (b *EthAPIBackend) HeaderByHash(ctx context.Context, hash common.Hash) (*ty return b.eth.blockchain.GetHeaderByHash(hash), nil } +func (b *EthAPIBackend) SkipBloomFilter(num *big.Int) bool { + cfg := b.eth.APIBackend.ChainConfig() + if cfg == nil { + return false + } + return cfg.IsIBFT(num) && !cfg.IsHawaii(num) +} + func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error) { // Pending block is only known by the miner if number == rpc.PendingBlockNumber { diff --git a/eth/backend.go b/eth/backend.go index 9a8ad57d13..1b4bfed88f 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -32,7 +32,7 @@ import ( "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/consensus/beacon" "github.com/ethereum/go-ethereum/consensus/clique" - "github.com/ethereum/go-ethereum/consensus/ibft" + "github.com/ethereum/go-ethereum/consensus/drab" "github.com/ethereum/go-ethereum/consensus/parlia" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/bloombits" @@ -176,7 +176,10 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { log.Info("Unprotected transactions allowed") } ethAPI := ethapi.NewPublicBlockChainAPI(eth.APIBackend) - eth.engine = ethconfig.CreateConsensusEngine(stack, chainConfig, ðashConfig, config.Miner.Notify, config.Miner.Noverify, chainDb, ethAPI, genesisHash) + eth.engine, err = ethconfig.CreateConsensusEngine(stack, chainConfig, ðashConfig, config.Miner.Notify, config.Miner.Noverify, chainDb, ethAPI, genesisHash) + if err != nil { + return nil, err + } bcVersion := rawdb.ReadDatabaseVersion(chainDb) var dbVer = "" @@ -514,8 +517,8 @@ func (s *Ethereum) StartMining(threads int) error { } // Different pos(a) consensus - if ibft, ok := s.engine.(*ibft.IBFT); ok { - ibft.Authorize(eb, wallet.SignData, wallet.SignTx) + if drab, ok := s.engine.(*drab.Drab); ok { + drab.Authorize(eb, wallet.SignData, wallet.SignTx) } else if parlia, ok := s.engine.(*parlia.Parlia); ok { parlia.Authorize(eb, wallet.SignData, wallet.SignTx) } else { diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go index 8b4a8504cf..84077a2c88 100644 --- a/eth/downloader/downloader_test.go +++ b/eth/downloader/downloader_test.go @@ -19,7 +19,6 @@ package downloader import ( "errors" "fmt" - "io/ioutil" "math/big" "os" "strings" @@ -56,7 +55,7 @@ type downloadTester struct { // newTester creates a new downloader test mocker. func newTester() *downloadTester { - freezer, err := ioutil.TempDir("", "") + freezer, err := os.MkdirTemp("", "") if err != nil { panic(err) } diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index ece07ece0a..37ace6042c 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -29,8 +29,9 @@ import ( "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/consensus/beacon" "github.com/ethereum/go-ethereum/consensus/clique" + "github.com/ethereum/go-ethereum/consensus/dc" + "github.com/ethereum/go-ethereum/consensus/drab" "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/consensus/ibft" "github.com/ethereum/go-ethereum/consensus/parlia" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/eth/downloader" @@ -88,7 +89,7 @@ var Defaults = Config{ DiffBlock: uint64(86400), Miner: miner.Config{ GasCeil: 8000000, - GasPrice: big.NewInt(params.GWei), + GasPrice: big.NewInt(250 * params.GWei), Recommit: 3 * time.Second, DelayLeftOver: 50 * time.Millisecond, }, @@ -96,7 +97,7 @@ var Defaults = Config{ RPCGasCap: 50000000, RPCEVMTimeout: 5 * time.Second, GPO: FullNodeGPO, - RPCTxFeeCap: 1, // 1 ether + RPCTxFeeCap: 0, // no cap limit } func init() { @@ -246,14 +247,18 @@ type Config struct { } // CreateConsensusEngine creates a consensus engine for the given chain configuration. -func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, config *ethash.Config, notify []string, noverify bool, db ethdb.Database, ee *ethapi.PublicBlockChainAPI, genesisHash common.Hash) consensus.Engine { - // ibft - if chainConfig.IBFT != nil { - return ibft.New(chainConfig, db, ee, genesisHash) +func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, config *ethash.Config, notify []string, noverify bool, db ethdb.Database, ee *ethapi.PublicBlockChainAPI, genesisHash common.Hash) (consensus.Engine, error) { + // drab + if chainConfig.Drab != nil { + return drab.New(chainConfig, db, ee, genesisHash), nil + } + // dc, original dogechain data + if chainConfig.Doge != nil { + return dc.New(chainConfig, stack.Config(), db, ee) } // parlia if chainConfig.Parlia != nil { - return parlia.New(chainConfig, db, ee, genesisHash) + return parlia.New(chainConfig, db, ee, genesisHash), nil } // If proof-of-authority is requested, set it up var engine consensus.Engine @@ -282,5 +287,5 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, co }, notify, noverify) engine.(*ethash.Ethash).SetThreads(-1) // Disable CPU mining } - return beacon.New(engine) + return beacon.New(engine), nil } diff --git a/eth/filters/filter.go b/eth/filters/filter.go index 2762993dad..61a7153173 100644 --- a/eth/filters/filter.go +++ b/eth/filters/filter.go @@ -47,6 +47,7 @@ type Backend interface { SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription SubscribePendingLogsEvent(ch chan<- []*types.Log) event.Subscription + SkipBloomFilter(*big.Int) bool BloomStatus() (uint64, uint64) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) } @@ -257,7 +258,7 @@ func (f *Filter) unindexedLogs(ctx context.Context, end uint64) ([]*types.Log, e // blockLogs returns the logs matching the filter criteria within a single block. func (f *Filter) blockLogs(ctx context.Context, header *types.Header) (logs []*types.Log, err error) { - if bloomFilter(header.Bloom, f.addresses, f.topics) { + if f.skipBloomFilter(header.Number) || bloomFilter(header.Bloom, f.addresses, f.topics) { found, err := f.checkMatches(ctx, header) if err != nil { return logs, err @@ -267,6 +268,10 @@ func (f *Filter) blockLogs(ctx context.Context, header *types.Header) (logs []*t return logs, nil } +func (f *Filter) skipBloomFilter(num *big.Int) bool { + return f.backend.SkipBloomFilter(num) +} + // checkMatches checks if the receipts belonging to the given header contain any log events that // match the filter criteria. This function is called when the bloom filter signals a potential match. func (f *Filter) checkMatches(ctx context.Context, header *types.Header) (logs []*types.Log, err error) { diff --git a/eth/filters/filter_system_test.go b/eth/filters/filter_system_test.go index 7435a19e86..10a2d2c5fb 100644 --- a/eth/filters/filter_system_test.go +++ b/eth/filters/filter_system_test.go @@ -130,6 +130,10 @@ func (b *testBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subsc return b.chainFeed.Subscribe(ch) } +func (b *testBackend) SkipBloomFilter(num *big.Int) bool { + return false +} + func (b *testBackend) BloomStatus() (uint64, uint64) { return params.BloomBitsBlocks, b.sections } diff --git a/eth/filters/filter_test.go b/eth/filters/filter_test.go index c4df5dc95d..1f16d09d2a 100644 --- a/eth/filters/filter_test.go +++ b/eth/filters/filter_test.go @@ -18,7 +18,6 @@ package filters import ( "context" - "io/ioutil" "math/big" "os" "testing" @@ -42,7 +41,7 @@ func makeReceipt(addr common.Address) *types.Receipt { } func BenchmarkFilters(b *testing.B) { - dir, err := ioutil.TempDir("", "filtertest") + dir, err := os.MkdirTemp("", "filtertest") if err != nil { b.Fatal(err) } @@ -100,7 +99,7 @@ func BenchmarkFilters(b *testing.B) { } func TestFilters(t *testing.T) { - dir, err := ioutil.TempDir("", "filtertest") + dir, err := os.MkdirTemp("", "filtertest") if err != nil { t.Fatal(err) } diff --git a/eth/gasprice/gasprice.go b/eth/gasprice/gasprice.go index b1bde022e5..0af8a70ea8 100644 --- a/eth/gasprice/gasprice.go +++ b/eth/gasprice/gasprice.go @@ -35,7 +35,7 @@ import ( const sampleNumber = 3 // Number of transactions sampled in a block var ( - DefaultMaxPrice = big.NewInt(100 * params.GWei) + DefaultMaxPrice = big.NewInt(25000 * params.GWei) DefaultIgnorePrice = big.NewInt(4 * params.Wei) ) diff --git a/eth/state_accessor.go b/eth/state_accessor.go index fc701c014f..57a0788007 100644 --- a/eth/state_accessor.go +++ b/eth/state_accessor.go @@ -24,7 +24,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/ibft" + "github.com/ethereum/go-ethereum/consensus/drab" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" @@ -199,7 +199,7 @@ func (eth *Ethereum) stateAtTransaction(block *types.Block, txIndex int, reexec // Not yet the searched for transaction, execute on top of the current state vmenv := vm.NewEVM(context, txContext, statedb, eth.blockchain.Config(), vm.Config{}) // Check system transaction in different consensus - if _, ok := eth.Engine().(*ibft.IBFT); ok { + if _, ok := eth.Engine().(*drab.Drab); ok { // Do nothing since we will add transaction fees to coinbase. } else if posa, ok := eth.Engine().(consensus.PoSA); ok && msg.From() == context.Coinbase && posa.IsSystemContract(msg.To()) && msg.GasPrice().Cmp(big.NewInt(0)) == 0 { diff --git a/eth/tracers/api.go b/eth/tracers/api.go index 40aec6b3be..09420836ee 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -23,7 +23,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "math/big" "os" "runtime" @@ -466,7 +465,7 @@ func (api *API) TraceBlock(ctx context.Context, blob hexutil.Bytes, config *Trac // TraceBlockFromFile returns the structured logs created during the execution of // EVM and returns them as a JSON object. func (api *API) TraceBlockFromFile(ctx context.Context, file string, config *TraceConfig) ([]*txTraceResult, error) { - blob, err := ioutil.ReadFile(file) + blob, err := os.ReadFile(file) if err != nil { return nil, fmt.Errorf("could not read file: %v", err) } @@ -747,7 +746,7 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block if !canon { prefix = fmt.Sprintf("%valt-", prefix) } - dump, err = ioutil.TempFile(os.TempDir(), prefix) + dump, err = os.CreateTemp(os.TempDir(), prefix) if err != nil { return nil, err } diff --git a/eth/tracers/internal/tracetest/calltrace_test.go b/eth/tracers/internal/tracetest/calltrace_test.go index e3e587ce8d..96037fb73a 100644 --- a/eth/tracers/internal/tracetest/calltrace_test.go +++ b/eth/tracers/internal/tracetest/calltrace_test.go @@ -18,8 +18,8 @@ package tracetest import ( "encoding/json" - "io/ioutil" "math/big" + "os" "path/filepath" "reflect" "strings" @@ -136,7 +136,7 @@ func TestCallTracerNative(t *testing.T) { } func testCallTracer(tracerName string, dirPath string, t *testing.T) { - files, err := ioutil.ReadDir(filepath.Join("testdata", dirPath)) + files, err := os.ReadDir(filepath.Join("testdata", dirPath)) if err != nil { t.Fatalf("failed to retrieve tracer test suite: %v", err) } @@ -153,7 +153,7 @@ func testCallTracer(tracerName string, dirPath string, t *testing.T) { tx = new(types.Transaction) ) // Call tracer test found, read if from disk - if blob, err := ioutil.ReadFile(filepath.Join("testdata", dirPath, file.Name())); err != nil { + if blob, err := os.ReadFile(filepath.Join("testdata", dirPath, file.Name())); err != nil { t.Fatalf("failed to read testcase: %v", err) } else if err := json.Unmarshal(blob, test); err != nil { t.Fatalf("failed to parse testcase: %v", err) @@ -241,7 +241,7 @@ func camel(str string) string { return strings.Join(pieces, "") } func BenchmarkTracers(b *testing.B) { - files, err := ioutil.ReadDir(filepath.Join("testdata", "call_tracer")) + files, err := os.ReadDir(filepath.Join("testdata", "call_tracer")) if err != nil { b.Fatalf("failed to retrieve tracer test suite: %v", err) } @@ -251,7 +251,7 @@ func BenchmarkTracers(b *testing.B) { } file := file // capture range variable b.Run(camel(strings.TrimSuffix(file.Name(), ".json")), func(b *testing.B) { - blob, err := ioutil.ReadFile(filepath.Join("testdata", "call_tracer", file.Name())) + blob, err := os.ReadFile(filepath.Join("testdata", "call_tracer", file.Name())) if err != nil { b.Fatalf("failed to read testcase: %v", err) } diff --git a/eth/tracers/js/internal/tracers/assets.go b/eth/tracers/js/internal/tracers/assets.go index 37e3702400..e1472f082b 100644 --- a/eth/tracers/js/internal/tracers/assets.go +++ b/eth/tracers/js/internal/tracers/assets.go @@ -20,7 +20,6 @@ import ( "crypto/sha256" "fmt" "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -474,7 +473,7 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + err = os.WriteFile(_filePath(dir, name), data, info.Mode()) if err != nil { return err } diff --git a/ethclient/ethclient_test.go b/ethclient/ethclient_test.go index b488487620..5130fe1f58 100644 --- a/ethclient/ethclient_test.go +++ b/ethclient/ethclient_test.go @@ -38,6 +38,7 @@ import ( "github.com/ethereum/go-ethereum/ethdb/memorydb" "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc" ) @@ -415,10 +416,20 @@ func testHeader(t *testing.T, chain []*types.Block, client *rpc.Client) { if !errors.Is(err, tt.wantErr) { t.Fatalf("HeaderByNumber(%v) error = %q, want %q", tt.block, err, tt.wantErr) } - if got != nil && got.Number != nil && got.Number.Sign() == 0 { - got.Number = big.NewInt(0) // hack to make DeepEqual work + + gotBytes, err := rlp.EncodeToBytes(got) + if err != nil { + t.Fatalf("Error serializing received block header.") + } + wantBytes, err := rlp.EncodeToBytes(tt.want) + if err != nil { + t.Fatalf("Error serializing wanted block header.") } - if !reflect.DeepEqual(got, tt.want) { + + // Instead of comparing the Header's compare the serialized bytes, + // because reflect.DeepEqual(*types.Header, *types.Header) sometimes + // returns false even though the underlying field values are exactly the same. + if !reflect.DeepEqual(gotBytes, wantBytes) { t.Fatalf("HeaderByNumber(%v)\n = %v\nwant %v", tt.block, got, tt.want) } }) @@ -579,7 +590,7 @@ func testStatusFunctions(t *testing.T, client *rpc.Client) { if err != nil { t.Fatalf("unexpected error: %v", err) } - if gasPrice.Cmp(big.NewInt(1000000042)) != 0 { + if gasPrice.Cmp(big.NewInt(250000000000)) != 0 { t.Fatalf("unexpected gas price: %v", gasPrice) } @@ -588,7 +599,7 @@ func testStatusFunctions(t *testing.T, client *rpc.Client) { if err != nil { t.Fatalf("unexpected error: %v", err) } - if gasTipCap.Cmp(big.NewInt(1000000000)) != 0 { + if gasTipCap.Cmp(big.NewInt(250000000000)) != 0 { t.Fatalf("unexpected gas tip cap: %v", gasTipCap) } } diff --git a/go.mod b/go.mod index 031e6c4ffa..10353f6fac 100644 --- a/go.mod +++ b/go.mod @@ -5,9 +5,9 @@ go 1.19 require ( github.com/Azure/azure-storage-blob-go v0.7.0 github.com/VictoriaMetrics/fastcache v1.6.0 - github.com/aws/aws-sdk-go-v2 v1.2.0 - github.com/aws/aws-sdk-go-v2/config v1.1.1 - github.com/aws/aws-sdk-go-v2/credentials v1.1.1 + github.com/aws/aws-sdk-go-v2 v1.17.4 + github.com/aws/aws-sdk-go-v2/config v1.18.12 + github.com/aws/aws-sdk-go-v2/credentials v1.13.12 github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1 github.com/bnb-chain/ics23 v0.1.0 github.com/cespare/cp v0.1.0 @@ -19,17 +19,17 @@ require ( github.com/docker/docker v20.10.24+incompatible github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf github.com/edsrzf/mmap-go v1.0.0 - github.com/fatih/color v1.7.0 + github.com/fatih/color v1.13.0 github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff github.com/go-stack/stack v1.8.0 - github.com/golang/protobuf v1.5.2 + github.com/golang/protobuf v1.5.3 github.com/golang/snappy v0.0.4 github.com/google/gofuzz v1.2.0 github.com/google/pprof v0.0.0-20220829040838-70bd9ae97f40 github.com/google/uuid v1.3.0 github.com/gorilla/websocket v1.5.0 - github.com/graph-gophers/graphql-go v1.3.0 + github.com/graph-gophers/graphql-go v1.5.0 github.com/hashicorp/go-bexpr v0.1.10 github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d github.com/holiman/bloomfilter/v2 v2.0.3 @@ -41,8 +41,8 @@ require ( github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e github.com/julienschmidt/httprouter v1.3.0 github.com/karalabe/usb v0.0.2 - github.com/mattn/go-colorable v0.1.8 - github.com/mattn/go-isatty v0.0.12 + github.com/mattn/go-colorable v0.1.12 + github.com/mattn/go-isatty v0.0.16 github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416 github.com/olekukonko/tablewriter v0.0.5 github.com/panjf2000/ants/v2 v2.8.0 @@ -53,18 +53,17 @@ require ( github.com/rs/cors v1.7.0 github.com/shirou/gopsutil v3.21.11+incompatible github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.3 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/tendermint/go-amino v0.14.1 github.com/tendermint/iavl v0.12.0 github.com/tendermint/tendermint v0.31.12 - github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef - go.uber.org/automaxprocs v1.5.2 + github.com/tyler-smith/go-bip39 v1.1.0 golang.org/x/crypto v0.14.0 golang.org/x/sync v0.1.0 golang.org/x/sys v0.13.0 golang.org/x/text v0.13.0 - golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba + golang.org/x/time v0.3.0 golang.org/x/tools v0.6.0 gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce gopkg.in/urfave/cli.v1 v1.20.0 @@ -72,57 +71,168 @@ require ( require ( github.com/btcsuite/btcd/btcec/v2 v2.3.2 + github.com/dogechain-lab/dogechain v1.2.6-0.20230801015717-955cdb2527b3 github.com/fatih/structs v1.1.0 + github.com/hashicorp/go-hclog v1.5.0 + github.com/prometheus/client_golang v1.14.0 + go.uber.org/automaxprocs v1.5.3 ) require ( github.com/Azure/azure-pipeline-go v0.2.2 // indirect github.com/Azure/go-autorest/autorest/adal v0.8.0 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.1.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.1.1 // indirect - github.com/aws/smithy-go v1.1.0 // indirect + github.com/andybalholm/brotli v1.0.4 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.22 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.28 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.22 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.29 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.22 // indirect + github.com/aws/aws-sdk-go-v2/service/ssm v1.35.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.12.1 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.1 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.18.3 // indirect + github.com/aws/smithy-go v1.13.5 // indirect + github.com/benbjohnson/clock v1.3.0 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/btcsuite/btcd v0.22.3 // indirect + github.com/cenkalti/backoff/v3 v3.2.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect + github.com/cheekybits/genny v1.0.0 // indirect + github.com/containerd/cgroups v1.0.4 // indirect + github.com/coreos/go-systemd/v22 v22.3.2 // indirect + github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect + github.com/docker/go-units v0.4.0 // indirect + github.com/dogechain-lab/fastrlp v0.0.0-20220523073019-b0c60fc6bb7a // indirect + github.com/elastic/gosigar v0.14.2 // indirect + github.com/emirpasic/gods v1.18.1 // indirect github.com/etcd-io/bbolt v1.3.3 // indirect + github.com/flynn/noise v1.0.0 // indirect github.com/fortytw2/leaktest v1.3.0 // indirect + github.com/francoispqt/gojay v1.2.13 // indirect + github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/go-kit/kit v0.9.0 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect + github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect + github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect + github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/gopacket v1.1.19 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-retryablehttp v0.7.2 // indirect + github.com/hashicorp/go-rootcerts v1.0.2 // indirect + github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect + github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect + github.com/hashicorp/go-sockaddr v1.0.2 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/vault/api v1.9.0 // indirect github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect + github.com/ipfs/go-cid v0.2.0 // indirect + github.com/ipfs/go-ipfs-util v0.0.2 // indirect + github.com/ipfs/go-log v1.0.5 // indirect + github.com/ipfs/go-log/v2 v2.5.1 // indirect + github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect + github.com/klauspost/compress v1.15.14 // indirect + github.com/klauspost/cpuid/v2 v2.1.0 // indirect + github.com/koron/go-ssdp v0.0.3 // indirect github.com/kylelemons/godebug v1.1.0 // indirect + github.com/libp2p/go-buffer-pool v0.1.0 // indirect + github.com/libp2p/go-cidranger v1.1.0 // indirect + github.com/libp2p/go-flow-metrics v0.1.0 // indirect + github.com/libp2p/go-libp2p v0.22.0 // indirect + github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect + github.com/libp2p/go-libp2p-kbucket v0.5.0 // indirect + github.com/libp2p/go-libp2p-pubsub v0.8.3 // indirect + github.com/libp2p/go-msgio v0.2.0 // indirect + github.com/libp2p/go-nat v0.1.0 // indirect + github.com/libp2p/go-netroute v0.2.0 // indirect + github.com/libp2p/go-openssl v0.1.0 // indirect + github.com/libp2p/go-reuseport v0.2.0 // indirect + github.com/libp2p/go-yamux/v3 v3.1.2 // indirect + github.com/lucas-clemente/quic-go v0.28.1 // indirect + github.com/marten-seemann/qtls-go1-16 v0.1.5 // indirect + github.com/marten-seemann/qtls-go1-17 v0.1.2 // indirect + github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect + github.com/marten-seemann/qtls-go1-19 v0.1.0 // indirect + github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d // indirect + github.com/mattn/go-pointer v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/mitchellh/mapstructure v1.4.1 // indirect + github.com/miekg/dns v1.1.50 // indirect + github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect + github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect + github.com/minio/sha256-simd v1.0.0 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/pointerstructure v1.2.0 // indirect + github.com/mr-tron/base58 v1.2.0 // indirect + github.com/multiformats/go-base32 v0.0.4 // indirect + github.com/multiformats/go-base36 v0.1.0 // indirect + github.com/multiformats/go-multiaddr v0.7.0 // indirect + github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect + github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect + github.com/multiformats/go-multibase v0.1.1 // indirect + github.com/multiformats/go-multicodec v0.5.0 // indirect + github.com/multiformats/go-multihash v0.2.1 // indirect + github.com/multiformats/go-multistream v0.3.3 // indirect + github.com/multiformats/go-varint v0.0.6 // indirect github.com/naoina/go-stringutil v0.1.0 // indirect - github.com/opentracing/opentracing-go v1.1.0 // indirect + github.com/nxadm/tail v1.4.8 // indirect + github.com/onsi/ginkgo v1.16.5 // indirect + github.com/opencontainers/runtime-spec v1.0.2 // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect + github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect + github.com/raulk/go-watchdog v1.3.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 // indirect + github.com/ryanuber/go-glob v1.0.0 // indirect + github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/tklauser/go-sysconf v0.3.5 // indirect github.com/tklauser/numcpus v0.2.2 // indirect + github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722 // indirect + github.com/umbracle/go-eth-bn256 v0.0.0-20190607160430-b36caf4e0f6b // indirect + github.com/umbracle/go-web3 v0.0.0-20220224145938-aaa1038c1b69 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasthttp v1.44.0 // indirect + github.com/valyala/fastjson v1.6.3 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect go.etcd.io/bbolt v1.3.7 // indirect - golang.org/x/mod v0.8.0 // indirect + go.opentelemetry.io/otel v1.16.0 // indirect + go.opentelemetry.io/otel/exporters/jaeger v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/sdk v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.uber.org/atomic v1.11.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.24.0 // indirect + golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/term v0.13.0 // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/grpc v1.53.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect + google.golang.org/grpc v1.55.0 // indirect + google.golang.org/protobuf v1.30.0 // indirect + gopkg.in/square/go-jose.v2 v2.6.0 // indirect + gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.0 // indirect + lukechampine.com/blake3 v1.1.7 // indirect ) replace github.com/tendermint/tendermint => github.com/bnb-chain/tendermint v0.31.15 + +replace github.com/lucas-clemente/quic-go => github.com/quic-go/quic-go v0.28.1 diff --git a/go.sum b/go.sum index 122650e4d9..c6a85eed3b 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,8 @@ +bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgoo= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= @@ -34,12 +37,19 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= +dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= +dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= +dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= +git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= github.com/Azure/azure-pipeline-go v0.2.2 h1:6oiIS9yaG6XCCzhgAgKFfIWyo4LLCiDhZot6ltoThhY= github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= github.com/Azure/azure-storage-blob-go v0.7.0 h1:MuueVOYkufCxJw5YZzF842DY2MBsp+hLuh2apKY0mck= github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-autorest/autorest v0.9.0 h1:MRvx8gncNaXJqOoLmhNjUAKh33JJF8LyxPhomEtOsjs= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= @@ -58,10 +68,15 @@ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbt github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/Microsoft/go-winio v0.4.13 h1:Hmi80lzZuI/CaYmlJp/b+FjZdRZhKu9c2mDVqKlLWVs= +github.com/Microsoft/go-winio v0.4.13/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -71,40 +86,80 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5 github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= +github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= -github.com/aws/aws-sdk-go-v2 v1.2.0 h1:BS+UYpbsElC82gB+2E2jiCBg36i8HlubTB/dO/moQ9c= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= -github.com/aws/aws-sdk-go-v2/config v1.1.1 h1:ZAoq32boMzcaTW9bcUacBswAmHTbvlvDJICgHFZuECo= -github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= -github.com/aws/aws-sdk-go-v2/credentials v1.1.1 h1:NbvWIM1Mx6sNPTxowHgS2ewXCRp+NGTzUYb/96FZJbY= -github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2 h1:EtEU7WRaWliitZh2nmuxEXrN0Cb8EgPUFGIoTMeqbzI= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2 h1:4AH9fFjUlVktQMznF+YN33aWNXaR4VgDXyP28qokJC0= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= +github.com/aws/aws-sdk-go-v2 v1.17.4 h1:wyC6p9Yfq6V2y98wfDsj6OnNQa4w2BLGCLIxzNhwOGY= +github.com/aws/aws-sdk-go-v2 v1.17.4/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= +github.com/aws/aws-sdk-go-v2/config v1.18.12 h1:fKs/I4wccmfrNRO9rdrbMO1NgLxct6H9rNMiPdBxHWw= +github.com/aws/aws-sdk-go-v2/config v1.18.12/go.mod h1:J36fOhj1LQBr+O4hJCiT8FwVvieeoSGOtPuvhKlsNu8= +github.com/aws/aws-sdk-go-v2/credentials v1.13.12 h1:Cb+HhuEnV19zHRaYYVglwvdHGMJWbdsyP4oHhw04xws= +github.com/aws/aws-sdk-go-v2/credentials v1.13.12/go.mod h1:37HG2MBroXK3jXfxVGtbM2J48ra2+Ltu+tmwr/jO0KA= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.22 h1:3aMfcTmoXtTZnaT86QlVaYh+BRMbvrrmZwIQ5jWqCZQ= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.22/go.mod h1:YGSIJyQ6D6FjKMQh16hVFSIUD54L4F7zTGePqYMYYJU= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.28 h1:r+XwaCLpIvCKjBIYy/HVZujQS9tsz5ohHG3ZIe0wKoE= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.28/go.mod h1:3lwChorpIM/BhImY/hy+Z6jekmN92cXGPI1QJasVPYY= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.22 h1:7AwGYXDdqRQYsluvKFmWoqpcOQJ4bH634SkYf3FNj/A= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.22/go.mod h1:EqK7gVrIGAHyZItrD1D8B0ilgwMD1GiWAmbU4u/JHNk= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.29 h1:J4xhFd6zHhdF9jPP0FQJ6WknzBboGMBNjKOv4iTuw4A= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.29/go.mod h1:TwuqRBGzxjQJIwH16/fOZodwXt2Zxa9/cwJC5ke4j7s= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.22 h1:LjFQf8hFuMO22HkV5VWGLBvmCLBCLPivUAmpdpnp4Vs= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.22/go.mod h1:xt0Au8yPIwYXf/GYPy/vl4K3CgwhfQMYbrH7DlUUIws= github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1 h1:cKr6St+CtC3/dl/rEBJvlk7A/IN5D5F02GNkGzfbtVU= github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= -github.com/aws/aws-sdk-go-v2/service/sso v1.1.1 h1:37QubsarExl5ZuCBlnRP+7l1tNwZPBSTqpTBrPH98RU= -github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= -github.com/aws/aws-sdk-go-v2/service/sts v1.1.1 h1:TJoIfnIFubCX0ACVeJ0w46HEH5MwjwYN4iFhuYIhfIY= -github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= -github.com/aws/smithy-go v1.1.0 h1:D6CSsM3gdxaGaqXnPgOBCeL6Mophqzu7KJOu7zW78sU= +github.com/aws/aws-sdk-go-v2/service/ssm v1.35.2 h1:PtV0g0sHaz8B4FD9M4zhdamFEoOYEo6O5nFv9LaWID8= +github.com/aws/aws-sdk-go-v2/service/ssm v1.35.2/go.mod h1:VLSz2SHUKYFSOlXB/GlXoLU6KPYQJAbw7I20TDJdyws= +github.com/aws/aws-sdk-go-v2/service/sso v1.12.1 h1:lQKN/LNa3qqu2cDOQZybP7oL4nMGGiFqob0jZJaR8/4= +github.com/aws/aws-sdk-go-v2/service/sso v1.12.1/go.mod h1:IgV8l3sj22nQDd5qcAGY0WenwCzCphqdbFOpfktZPrI= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.1 h1:0bLhH6DRAqox+g0LatcjGKjjhU6Eudyys6HB6DJVPj8= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.1/go.mod h1:O1YSOg3aekZibh2SngvCRRG+cRHKKlYgxf/JBF/Kr/k= +github.com/aws/aws-sdk-go-v2/service/sts v1.18.3 h1:s49mSnsBZEXjfGBkRfmK+nPqzT7Lt3+t2SmAKNyHblw= +github.com/aws/aws-sdk-go-v2/service/sts v1.18.3/go.mod h1:b+psTJn33Q4qGoDaM7ZiOVVG8uVjGI6HaZ8WBHdgDgU= github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= +github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8= +github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= +github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= github.com/bnb-chain/ics23 v0.1.0 h1:DvjGOts2FBfbxB48384CYD1LbcrfjThFz8kowY/7KxU= github.com/bnb-chain/ics23 v0.1.0/go.mod h1:cU6lTGolbbLFsGCgceNB2AzplH1xecLp6+KXvxM32nI= github.com/bnb-chain/tendermint v0.31.15 h1:Xyn/Hifb/7X4E1zSuMdnZdMSoM2Fx6cZuKCNnqIxbNU= github.com/bnb-chain/tendermint v0.31.15/go.mod h1:cmt8HHmQUSVaWQ/hoTefRxsh5X3ERaM1zCUIR0DPbFU= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= +github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +github.com/btcsuite/btcd v0.22.3 h1:kYNaWFvOw6xvqP0vR20RP1Zq1DVMBxEO8QN5d1/EfNg= +github.com/btcsuite/btcd v0.22.3/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= +github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= +github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= +github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= +github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= +github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= +github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M= +github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= @@ -113,9 +168,12 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE= +github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.14.0 h1:gFqGlGl/5f9UGXAaKapCGUfaTCgRKKnzu2VvzMZlOFA= github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= @@ -123,19 +181,32 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f h1:C43yEtQ6NIf4ftFXD/V55gnGFgPbMQobd//YlnLjUJ8= github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= +github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= +github.com/containerd/cgroups v1.0.4 h1:jN/mbWBEaz+T1pi5OFtnkQ+8qnmEbAr1Oo1FRm5B0dA= +github.com/containerd/cgroups v1.0.4/go.mod h1:nLNQtsF7Sl2HxNebu77i1R0oDlhiTG+kO4JTrUzo6IA= +github.com/containerd/continuity v0.0.0-20191214063359-1097c8bae83b h1:pik3LX++5O3UiNWv45wfP/WT81l7ukBJzd3uUiifbSU= +github.com/containerd/continuity v0.0.0-20191214063359-1097c8bae83b/go.mod h1:Dq467ZllaHgAtVp4p1xUQWBrFXR9s/wyoTpG8zOJGkY= +github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= +github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= +github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= -github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU= github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= @@ -147,38 +218,62 @@ github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 h1:Izz0+t1Z5nI16 github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPaAiuPgIfVyI3dYE= github.com/docker/docker v20.10.24+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dogechain-lab/dogechain v1.2.6-0.20230801015717-955cdb2527b3 h1:6WxtNmOItAcM5o/hWFCgu85tL0ebmDH3XiUObcy3nRA= +github.com/dogechain-lab/dogechain v1.2.6-0.20230801015717-955cdb2527b3/go.mod h1:rQBgi1nVu25gMl4q4OlAKMwCmWERJMuxzI2hjqVHeME= +github.com/dogechain-lab/fastrlp v0.0.0-20220523073019-b0c60fc6bb7a h1:2QDpB3Ja8A5OZOdP7WtGzlpS9L69szN2BBqHPorlYxY= +github.com/dogechain-lab/fastrlp v0.0.0-20220523073019-b0c60fc6bb7a/go.mod h1:5D+UKIl9a0vbBmNAQM9nIATvcjCRQ6dDUbZOE83/S+8= github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf h1:Yt+4K30SdjOkRoRRm3vYNQgR+/ZIy0RmeUDZo7Y8zeQ= github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= +github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= +github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3 h1:gSJmxrs37LgTqR/oyJBWok6k6SvXEUerFTbltIhXkBM= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= +github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= +github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= +github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -192,15 +287,29 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw= +github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= +github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= @@ -212,6 +321,7 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -219,6 +329,8 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -234,8 +346,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -251,12 +364,20 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gopacket v1.1.17/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM= +github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= +github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -271,25 +392,62 @@ github.com/google/pprof v0.0.0-20220829040838-70bd9ae97f40/go.mod h1:dDKJzRmX4S3 github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= +github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/graph-gophers/graphql-go v1.3.0 h1:Eb9x/q6MFpCLz7jBCiP/WTxjSDrYLR1QY41SORZyNJ0= -github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= +github.com/graph-gophers/graphql-go v1.5.0 h1:fDqblo50TEpD0LY7RXk/LFVYEVqo3+tXMNMPSVXA1yc= +github.com/graph-gophers/graphql-go v1.5.0/go.mod h1:YtmJZDLbF1YYNrlNAuiO5zAStUWc3XZT07iGsVqe1Os= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-retryablehttp v0.7.2 h1:AcYqCvkpalPnPF2pn0KamgwamS42TqUDDYFRKq/RAd0= +github.com/hashicorp/go-retryablehttp v0.7.2/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 h1:UpiO20jno/eV1eVZcxqWnUohyKRe1g8FPV/xH1s/2qs= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= +github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= +github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/vault/api v1.9.0 h1:ab7dI6W8DuCY7yCU8blo0UCYl2oHre/dloCmzMWg9w8= +github.com/hashicorp/vault/api v1.9.0/go.mod h1:lloELQP4EyhjnCQhF8agKvWIVTmxbpEJj70b98959sM= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= @@ -309,15 +467,35 @@ github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19y github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= +github.com/ipfs/go-cid v0.2.0 h1:01JTiihFq9en9Vz0lc0VDWvZe/uBonGpzo4THP0vcQ0= +github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro= +github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= +github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= +github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= +github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= +github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8= +github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo= +github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= +github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= +github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= +github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e h1:UvSe12bq+Uj2hWd8aOlwPmoZ+CITRFrdit+sDGfAg8U= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= +github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= +github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -336,17 +514,32 @@ github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= +github.com/klauspost/compress v1.15.14 h1:i7WCKDToww0wA+9qrUZ1xOjp218vfFo3nTU6UHp+gOc= +github.com/klauspost/compress v1.15.14/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.1.0 h1:eyi1Ad2aNJMW95zcSbmGg7Cg6cq3ADwLpMAP96d8rF0= +github.com/klauspost/cpuid/v2 v2.1.0/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= +github.com/koron/go-ssdp v0.0.3 h1:JivLMY45N76b4p/vsWGOKewBQu6uf39y8l+AQ7sDKx8= +github.com/koron/go-ssdp v0.0.3/go.mod h1:b2MxI6yh02pKrsyNoQUsk4+YNikaGhe4894J+Q5lDvA= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -357,31 +550,103 @@ github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= +github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= +github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c= +github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic= +github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= +github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= +github.com/libp2p/go-libp2p v0.22.0 h1:2Tce0kHOp5zASFKJbNzRElvh0iZwdtG5uZheNW8chIw= +github.com/libp2p/go-libp2p v0.22.0/go.mod h1:UDolmweypBSjQb2f7xutPnwZ/fxioLbMBxSjRksxxU4= +github.com/libp2p/go-libp2p-asn-util v0.2.0 h1:rg3+Os8jbnO5DxkC7K/Utdi+DkY3q/d1/1q+8WeNAsw= +github.com/libp2p/go-libp2p-asn-util v0.2.0/go.mod h1:WoaWxbHKBymSN41hWSq/lGKJEca7TNm58+gGJi2WsLI= +github.com/libp2p/go-libp2p-kbucket v0.5.0 h1:g/7tVm8ACHDxH29BGrpsQlnNeu+6OF1A9bno/4/U1oA= +github.com/libp2p/go-libp2p-kbucket v0.5.0/go.mod h1:zGzGCpQd78b5BNTDGHNDLaTt9aDK/A02xeZp9QeFC4U= +github.com/libp2p/go-libp2p-pubsub v0.8.3 h1:T4+pcfcFm1K2v5oFyk68peSjVroaoM8zFygf6Y5WOww= +github.com/libp2p/go-libp2p-pubsub v0.8.3/go.mod h1:eje970FXxjhtFbVEoiae+VUw24ZoSlk67BsiZPLRzlw= +github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= +github.com/libp2p/go-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU= +github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY= +github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg= +github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM= +github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= +github.com/libp2p/go-netroute v0.2.0 h1:0FpsbsvuSnAhXFnCY0VLFbJOzaK0VnP0r1QT/o4nWRE= +github.com/libp2p/go-netroute v0.2.0/go.mod h1:Vio7LTzZ+6hoT4CMZi5/6CpY3Snzh2vgZhWgxMNwlQI= +github.com/libp2p/go-openssl v0.1.0 h1:LBkKEcUv6vtZIQLVTegAil8jbNpJErQ9AnT+bWV+Ooo= +github.com/libp2p/go-openssl v0.1.0/go.mod h1:OiOxwPpL3n4xlenjx2h7AwSGaFSC/KZvf6gNdOBQMtc= +github.com/libp2p/go-reuseport v0.2.0 h1:18PRvIMlpY6ZK85nIAicSBuXXvrYoSw3dsBAR7zc560= +github.com/libp2p/go-reuseport v0.2.0/go.mod h1:bvVho6eLMm6Bz5hmU0LYN3ixd3nPPvtIlaURZZgOY4k= +github.com/libp2p/go-sockaddr v0.0.2/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= +github.com/libp2p/go-yamux/v3 v3.1.2 h1:lNEy28MBk1HavUAlzKgShp+F6mn/ea1nDYWftZhFW9Q= +github.com/libp2p/go-yamux/v3 v3.1.2/go.mod h1:jeLEQgLXqE2YqX1ilAClIfCMDY+0uXQUKmmb/qp0gT4= +github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= +github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= +github.com/marten-seemann/qtls-go1-16 v0.1.5 h1:o9JrYPPco/Nukd/HpOHMHZoBDXQqoNtUCmny98/1uqQ= +github.com/marten-seemann/qtls-go1-16 v0.1.5/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= +github.com/marten-seemann/qtls-go1-17 v0.1.2 h1:JADBlm0LYiVbuSySCHeY863dNkcpMmDR7s0bLKJeYlQ= +github.com/marten-seemann/qtls-go1-17 v0.1.2/go.mod h1:C2ekUKcDdz9SDWxec1N/MvcXBpaX9l3Nx67XaR84L5s= +github.com/marten-seemann/qtls-go1-18 v0.1.2 h1:JH6jmzbduz0ITVQ7ShevK10Av5+jBEKAHMntXmIV7kM= +github.com/marten-seemann/qtls-go1-18 v0.1.2/go.mod h1:mJttiymBAByA49mhlNZZGrH5u1uXYZJ+RW28Py7f4m4= +github.com/marten-seemann/qtls-go1-19 v0.1.0-beta.1/go.mod h1:5HTDWtVudo/WFsHKRNuOhWlbdjrfs5JHrYb0wIJqGpI= +github.com/marten-seemann/qtls-go1-19 v0.1.0 h1:rLFKD/9mp/uq1SYGYuVZhm83wkmU95pK5df3GufyYYU= +github.com/marten-seemann/qtls-go1-19 v0.1.0/go.mod h1:5HTDWtVudo/WFsHKRNuOhWlbdjrfs5JHrYb0wIJqGpI= +github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= +github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d h1:oNAwILwmgWKFpuU+dXvI6dl9jG2mAWAZLX3r9s0PPiw= github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0= +github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= +github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA= +github.com/miekg/dns v1.1.50/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= +github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c h1:bzE/A84HN25pxAuk9Eej1Kz9OUelF97nAc82bDquQI8= +github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c/go.mod h1:0SQS9kMwD2VsyFEB++InYyBJroV/FRmBgcydeSUcJms= +github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= +github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b/go.mod h1:lxPUiZwKoFL8DUUmalo2yJJUCxbPKtm8OKfqr2/FTNU= +github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc h1:PTfri+PuQmWDqERdnNMiD9ZejrlswWrCpBEZgWOiTrc= +github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc/go.mod h1:cGKTAVKx4SxOuR/czcZ/E2RSJ3sfHs8FpHhQ5CWMf9s= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= +github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= +github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= +github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -389,45 +654,103 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= +github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= +github.com/multiformats/go-base32 v0.0.4 h1:+qMh4a2f37b4xTNs6mqitDinryCI+tfO2dRVMN9mjSE= +github.com/multiformats/go-base32 v0.0.4/go.mod h1:jNLFzjPZtp3aIARHbJRZIaPuspdH0J6q39uUM5pnABM= +github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4= +github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= +github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= +github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= +github.com/multiformats/go-multiaddr v0.7.0 h1:gskHcdaCyPtp9XskVwtvEeQOG465sCohbQIirSyqxrc= +github.com/multiformats/go-multiaddr v0.7.0/go.mod h1:Fs50eBDWvZu+l3/9S6xAE7ZYj6yhxlvaVZjakWN7xRs= +github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= +github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= +github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= +github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= +github.com/multiformats/go-multibase v0.1.1 h1:3ASCDsuLX8+j4kx58qnJ4YFq/JWTJpCyDW27ztsVTOI= +github.com/multiformats/go-multibase v0.1.1/go.mod h1:ZEjHE+IsUrgp5mhlEAYjMtZwK1k4haNkcaPg9aoe1a8= +github.com/multiformats/go-multicodec v0.5.0 h1:EgU6cBe/D7WRwQb1KmnBvU7lrcFGMggZVTPtOW9dDHs= +github.com/multiformats/go-multicodec v0.5.0/go.mod h1:DiY2HFaEp5EhEXb/iYzVAunmyX/aSFMxq2KMKfWEues= +github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= +github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= +github.com/multiformats/go-multihash v0.2.1 h1:aem8ZT0VA2nCHHk7bPJ1BjUbHNciqZC/d16Vve9l108= +github.com/multiformats/go-multihash v0.2.1/go.mod h1:WxoMcYG85AZVQUyRyo9s4wULvW5qrI9vb2Lt6evduFc= +github.com/multiformats/go-multistream v0.3.3 h1:d5PZpjwRgVlbwfdTDjife7XszfZd8KYWfROYFlGcR8o= +github.com/multiformats/go-multistream v0.3.3/go.mod h1:ODRoqamLUsETKS9BNcII4gcRsJBU5VAwRIv7O39cEXg= +github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY= +github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/naoina/go-stringutil v0.1.0 h1:rCUeRUHjBjGTSHl0VC00jUPLz8/F9dDzYI70Hzifhks= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416 h1:shk/vn9oCoOTmwcouEdwIeOtOGA/ELRUw/GwvxwfT+0= github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= +github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= +github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= +github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= +github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v0.1.1 h1:GlxAyO6x8rfZYN9Tt0Kti5a/cP41iuiO2yYT0IJGY8Y= +github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runtime-spec v1.0.2 h1:UfAcuLBJB9Coz72x1hgl8O5RVzTdNiaglX6v2DM6FI0= +github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= +github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= +github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/panjf2000/ants/v2 v2.8.0 h1:4p4gPabD6iNM9Y5NpMc0g0L15uXDmfn6jkW5KP+oiHQ= github.com/panjf2000/ants/v2 v2.8.0/go.mod h1:KIBmYG9QQX5U2qzFP/yQJaq/nSb6rahS9iEHkrCMgM8= github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 h1:oYW+YCJ1pachXTQmzR3rNLYGGz4g/UgFcjb28p/viDM= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= +github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= @@ -441,6 +764,7 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= @@ -449,6 +773,7 @@ github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9 github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= @@ -458,6 +783,10 @@ github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5 github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/quic-go/quic-go v0.28.1 h1:FsyCC6GvAtjHE60noDFX1WEVO/Tyzv/faSuwoIISccY= +github.com/quic-go/quic-go v0.28.1/go.mod h1:oGz5DKK41cJt5+773+BSO9BXDsREY4HLf7+0odGAPO0= +github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= +github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU= github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 h1:dY6ETXrvDG7Sa4vE8ZQG4yqWg6UnOcbqTAahkV813vQ= github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= @@ -466,27 +795,66 @@ github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRr github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= +github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= +github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= +github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= +github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= +github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= +github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= +github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= +github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= +github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= +github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= +github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= +github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= +github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= +github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= +github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= +github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= +github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= +github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= +github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -495,11 +863,14 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/tendermint/go-amino v0.14.1 h1:o2WudxNfdLNBwMyl2dqOJxiro5rfrEaU0Ugs6offJMk= github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= github.com/tendermint/iavl v0.12.0 h1:xcaFAr+ycqCj7WN1RzL2EfcBioRDOHcU1oWcg83K028= @@ -509,43 +880,103 @@ github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef h1:wHSqTBrZW24CsNJDfeh9Ex6Pm0Rcpc7qrgKBiL44vF4= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= +github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= +github.com/umbracle/fastrlp v0.0.0-20211229195328-c1416904ae17/go.mod h1:c8J0h9aULj2i3umrfyestM6jCq0LK0U6ly6bWy96nd4= +github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722 h1:10Nbw6cACsnQm7r34zlpJky+IzxVLRk6MKTS2d3Vp0E= +github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722/go.mod h1:c8J0h9aULj2i3umrfyestM6jCq0LK0U6ly6bWy96nd4= +github.com/umbracle/go-eth-bn256 v0.0.0-20190607160430-b36caf4e0f6b h1:t3nz9xXkLZJz+ZlTGFT3ixsCGO5AHx1Yift2EAfjnnc= +github.com/umbracle/go-eth-bn256 v0.0.0-20190607160430-b36caf4e0f6b/go.mod h1:B2zj4f3YmUPeyCNSlAEgOf6tuGzeYKvIxAZzwy9PxPA= +github.com/umbracle/go-web3 v0.0.0-20220224145938-aaa1038c1b69 h1:SrIRL9SlfBp4nOUEnWGBAS/lX9UgF6myH/rzHgdj1rE= +github.com/umbracle/go-web3 v0.0.0-20220224145938-aaa1038c1b69/go.mod h1:Go3c6psJU9tbUhrYLuuKIWJrN0ntpoxucp4MlV56k4w= +github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.4.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s= +github.com/valyala/fasthttp v1.44.0 h1:R+gLUhldIsfg1HokMuQjdQ5bh9nuXHPIfvkYUu9eR5Q= +github.com/valyala/fasthttp v1.44.0/go.mod h1:f6VbjjoI3z1NDOZOv17o6RvtRSWxC77seBFc2uWtgiY= +github.com/valyala/fastjson v1.4.1/go.mod h1:nV6MsjxL2IMJQUoHDIrjEI7oLyeqK6aBD7EFWPsvP8o= +github.com/valyala/fastjson v1.6.3 h1:tAKFnnwmeMGPbwJ7IwxcTPCNr3uIzoIj3/Fh90ra4xc= +github.com/valyala/fastjson v1.6.3/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= +github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= +github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= +github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opentelemetry.io/otel v1.6.3/go.mod h1:7BgNga5fNlF/iZjG06hM3yofffp0ofKCDwSXx1GC4dI= +go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= +go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= +go.opentelemetry.io/otel/exporters/jaeger v1.16.0 h1:YhxxmXZ011C0aDZKoNw+juVWAmEfv/0W2XBOv9aHTaA= +go.opentelemetry.io/otel/exporters/jaeger v1.16.0/go.mod h1:grYbBo/5afWlPpdPZYhyn78Bk04hnvxn2+hvxQhKIQM= +go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= +go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= +go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE= +go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4= +go.opentelemetry.io/otel/trace v1.6.3/go.mod h1:GNJQusJlUgZl9/TQBPKU/Y/ty+0iVB5fjhKeJGZPGFs= +go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= +go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/automaxprocs v1.5.2 h1:2LxUOGiR3O6tw8ui5sZa2LAaHnsviZdVOUZw4fvbnME= -go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= +go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= +go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= +go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= +go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= +go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= +golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= +golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -564,6 +995,7 @@ golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMk golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -583,15 +1015,21 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -600,6 +1038,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -620,18 +1059,28 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220906165146-f3363e06e74c/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -645,14 +1094,20 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -674,6 +1129,7 @@ golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -685,6 +1141,7 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -692,16 +1149,29 @@ golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426080607-c94f62235c83/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -720,14 +1190,18 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -745,6 +1219,8 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -772,14 +1248,17 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= @@ -787,6 +1266,9 @@ gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= +google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -804,12 +1286,18 @@ google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= +google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -840,8 +1328,11 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= +google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -854,8 +1345,8 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -868,8 +1359,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -878,8 +1370,12 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= +gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= +gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= @@ -894,10 +1390,14 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -906,7 +1406,11 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= +lukechampine.com/blake3 v1.1.7 h1:GgRMhmdsuK8+ii6UZFDL8Nb+VyMwadAgcJyfYHxG6n0= +lukechampine.com/blake3 v1.1.7/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= +sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/graphql/graphql_test.go b/graphql/graphql_test.go index a0b7979069..1c9bc42834 100644 --- a/graphql/graphql_test.go +++ b/graphql/graphql_test.go @@ -18,9 +18,10 @@ package graphql import ( "fmt" - "io/ioutil" + "io" "math/big" "net/http" + "os" "strings" "testing" "time" @@ -40,7 +41,7 @@ import ( ) func TestBuildSchema(t *testing.T) { - ddir, err := ioutil.TempDir("", "graphql-buildschema") + ddir, err := os.MkdirTemp("", "graphql-buildschema") if err != nil { t.Fatalf("failed to create temporary datadir: %v", err) } @@ -149,7 +150,7 @@ func TestGraphQLBlockSerialization(t *testing.T) { if err != nil { t.Fatalf("could not post: %v", err) } - bodyBytes, err := ioutil.ReadAll(resp.Body) + bodyBytes, err := io.ReadAll(resp.Body) if err != nil { t.Fatalf("could not read from response body: %v", err) } @@ -177,7 +178,7 @@ func TestGraphQLBlockSerializationEIP2718(t *testing.T) { }{ { body: `{"query": "{block {number transactions { from { address } to { address } value hash type accessList { address storageKeys } index}}}"}`, - want: `{"data":{"block":{"number":1,"transactions":[{"from":{"address":"0x71562b71999873db5b286df957af199ec94617f7"},"to":{"address":"0x0000000000000000000000000000000000000dad"},"value":"0x64","hash":"0xd864c9d7d37fade6b70164740540c06dd58bb9c3f6b46101908d6339db6a6a7b","type":0,"accessList":[],"index":0},{"from":{"address":"0x71562b71999873db5b286df957af199ec94617f7"},"to":{"address":"0x0000000000000000000000000000000000000dad"},"value":"0x32","hash":"0x19b35f8187b4e15fb59a9af469dca5dfa3cd363c11d372058c12f6482477b474","type":1,"accessList":[{"address":"0x0000000000000000000000000000000000000dad","storageKeys":["0x0000000000000000000000000000000000000000000000000000000000000000"]}],"index":1}]}}}`, + want: `{"data":{"block":{"number":1,"transactions":[{"from":{"address":"0x71562b71999873db5b286df957af199ec94617f7"},"to":{"address":"0x0000000000000000000000000000000000000dad"},"value":"0x64","hash":"0xe7418d03e2ece5fcd277c49bf9d8b7b9d43a9e27731d56a6496eb9e54d504202","type":0,"accessList":[],"index":0},{"from":{"address":"0x71562b71999873db5b286df957af199ec94617f7"},"to":{"address":"0x0000000000000000000000000000000000000dad"},"value":"0x32","hash":"0x0f32fec26e145116d7927ce74dfa64334682747459481246cde86e68d3091679","type":1,"accessList":[{"address":"0x0000000000000000000000000000000000000dad","storageKeys":["0x0000000000000000000000000000000000000000000000000000000000000000"]}],"index":1}]}}}`, code: 200, }, } { @@ -185,7 +186,7 @@ func TestGraphQLBlockSerializationEIP2718(t *testing.T) { if err != nil { t.Fatalf("could not post: %v", err) } - bodyBytes, err := ioutil.ReadAll(resp.Body) + bodyBytes, err := io.ReadAll(resp.Body) if err != nil { t.Fatalf("could not read from response body: %v", err) } diff --git a/internal/build/download.go b/internal/build/download.go index efb223b327..903d0308df 100644 --- a/internal/build/download.go +++ b/internal/build/download.go @@ -22,7 +22,6 @@ import ( "encoding/hex" "fmt" "io" - "io/ioutil" "log" "net/http" "os" @@ -37,7 +36,7 @@ type ChecksumDB struct { // MustLoadChecksums loads a file containing checksums. func MustLoadChecksums(file string) *ChecksumDB { - content, err := ioutil.ReadFile(file) + content, err := os.ReadFile(file) if err != nil { log.Fatal("can't load checksum file: " + err.Error()) } diff --git a/internal/build/util.go b/internal/build/util.go index 41e8f1ce3f..6599114fd3 100644 --- a/internal/build/util.go +++ b/internal/build/util.go @@ -23,7 +23,6 @@ import ( "go/parser" "go/token" "io" - "io/ioutil" "log" "os" "os/exec" @@ -90,7 +89,7 @@ func RunGit(args ...string) string { // readGitFile returns content of file in .git directory. func readGitFile(file string) string { - content, err := ioutil.ReadFile(path.Join(".git", file)) + content, err := os.ReadFile(path.Join(".git", file)) if err != nil { return "" } @@ -160,7 +159,7 @@ func UploadSFTP(identityFile, host, dir string, files []string) error { // package paths. func FindMainPackages(dir string) []string { var commands []string - cmds, err := ioutil.ReadDir(dir) + cmds, err := os.ReadDir(dir) if err != nil { log.Fatal(err) } diff --git a/internal/cmdtest/test_cmd.go b/internal/cmdtest/test_cmd.go index 46fe1016fd..fd7a4a8b7f 100644 --- a/internal/cmdtest/test_cmd.go +++ b/internal/cmdtest/test_cmd.go @@ -21,7 +21,6 @@ import ( "bytes" "fmt" "io" - "io/ioutil" "os" "os/exec" "regexp" @@ -184,7 +183,7 @@ func (tt *TestCmd) ExpectRegexp(regex string) (*regexp.Regexp, []string) { func (tt *TestCmd) ExpectExit() { var output []byte tt.withKillTimeout(func() { - output, _ = ioutil.ReadAll(tt.stdout) + output, _ = io.ReadAll(tt.stdout) }) tt.WaitExit() if tt.Cleanup != nil { diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 3e29e997e3..93af9af929 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -897,6 +897,91 @@ func (diff *StateOverride) Apply(state *state.StateDB) error { func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride, timeout time.Duration, globalGasCap uint64) (*core.ExecutionResult, error) { defer func(start time.Time) { log.Debug("Executing EVM call finished", "runtime", time.Since(start)) }(time.Now()) + // TODO: hard fork check + if dc, ok := b.Engine().(consensus.DC); ok { + header, err := b.HeaderByNumberOrHash(ctx, blockNrOrHash) + if err != nil { + return nil, err + } + + if args.ChainID != nil { + var chainID = b.ChainConfig().ChainID + if args.ChainID.ToInt().Cmp(chainID) != 0 { + return nil, fmt.Errorf("invalid chain id %s, expected %s", args.ChainID.String(), chainID.String()) + } + } + + dcTxArgs := &consensus.DcTxnArgs{ + From: args.From, + To: args.To, + Gas: args.Gas, + GasPrice: args.GasPrice, + Value: args.Value, + Nonce: args.Nonce, + Data: args.Data, + Input: args.Input, + } + + //// from dogechain/jsonrpc/eth_endpoint.go#L922 + // set default values + var zeroUint64 = hexutil.Uint64(0) + if dcTxArgs.From == nil { + dcTxArgs.From = &(common.Address{}) + dcTxArgs.Nonce = &zeroUint64 + } else if dcTxArgs.Nonce == nil { + // get nonce from the pool + fromNomce, err := b.GetPoolNonce(ctx, *args.From) + if err != nil { + return nil, err + } + + dcTxArgs.Nonce = (*hexutil.Uint64)(&fromNomce) + } + + if dcTxArgs.Value == nil { + dcTxArgs.Value = (*hexutil.Big)(big.NewInt(0)) + } + + if dcTxArgs.GasPrice == nil { + dcTxArgs.GasPrice = (*hexutil.Big)(big.NewInt(0)) + } + + var input []byte + if dcTxArgs.Data != nil { + input = *dcTxArgs.Data + } else if dcTxArgs.Input != nil { + input = *dcTxArgs.Input + } + + if dcTxArgs.To == nil { + if input == nil { + return nil, fmt.Errorf("contract creation without data provided") + } + } + + if input == nil { + input = []byte{} + } + + dcTxArgs.Input = (*hexutil.Bytes)(&input) + + if dcTxArgs.Gas == nil { + gaslimit := hexutil.Uint64(header.GasLimit) + dcTxArgs.Gas = &gaslimit + } + + result, err := dc.DoCall(dcTxArgs, header, globalGasCap) + if err != nil && result == nil { + return nil, err + } + + return &core.ExecutionResult{ + UsedGas: result.UsedGas(), + ReturnData: result.ReturnData(), + Err: result.Error(), + }, err + } + state, header, err := b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) if state == nil || err != nil { return nil, err @@ -1071,6 +1156,9 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr executable := func(gas uint64) (bool, *core.ExecutionResult, error) { args.Gas = (*hexutil.Uint64)(&gas) + fromNomce, _ := b.GetPoolNonce(ctx, *args.From) // from can't be nil + args.Nonce = (*hexutil.Uint64)(&fromNomce) + result, err := DoCall(ctx, b, args, blockNrOrHash, nil, 0, gasCap) if err != nil { if errors.Is(err, core.ErrIntrinsicGas) { diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index 889370440e..801483b8c3 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -87,6 +87,7 @@ type Backend interface { SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription // Filter API + SkipBloomFilter(*big.Int) bool BloomStatus() (uint64, uint64) GetLogs(ctx context.Context, blockHash common.Hash) ([][]*types.Log, error) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index 9284439162..8b0d3981fc 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -249,6 +249,31 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (t return msg, nil } +func (args *TransactionArgs) ToMessageWithNonce(globalGasCap uint64, baseFee *big.Int) (types.Message, error) { + msg, err := args.ToMessage(globalGasCap, baseFee) + if err != nil { + return types.Message{}, err + } + + if args.Nonce == nil { + return msg, nil + } + + return types.NewMessage( + msg.From(), + msg.To(), + uint64(*args.Nonce), + msg.Value(), + msg.Gas(), + msg.GasPrice(), + msg.GasFeeCap(), + msg.GasTipCap(), + msg.Data(), + msg.AccessList(), + msg.IsFake(), + ), nil +} + // toTransaction converts the arguments to a transaction. // This assumes that setDefaults has been called. func (args *TransactionArgs) toTransaction() *types.Transaction { diff --git a/internal/guide/guide_test.go b/internal/guide/guide_test.go index abc48e0e4b..045f59a7f9 100644 --- a/internal/guide/guide_test.go +++ b/internal/guide/guide_test.go @@ -23,7 +23,6 @@ package guide import ( - "io/ioutil" "math/big" "os" "path/filepath" @@ -38,7 +37,7 @@ import ( // Tests that the account management snippets work correctly. func TestAccountManagement(t *testing.T) { // Create a temporary folder to work with - workdir, err := ioutil.TempDir("", "") + workdir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("Failed to create temporary work dir: %v", err) } diff --git a/internal/jsre/deps/bindata.go b/internal/jsre/deps/bindata.go index 3e7d3a1367..3fc2297c23 100644 --- a/internal/jsre/deps/bindata.go +++ b/internal/jsre/deps/bindata.go @@ -11,7 +11,6 @@ import ( "crypto/sha256" "fmt" "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -267,7 +266,7 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + err = os.WriteFile(_filePath(dir, name), data, info.Mode()) if err != nil { return err } diff --git a/internal/jsre/jsre.go b/internal/jsre/jsre.go index 24fedd8d28..4de80a9e90 100644 --- a/internal/jsre/jsre.go +++ b/internal/jsre/jsre.go @@ -23,8 +23,8 @@ import ( "errors" "fmt" "io" - "io/ioutil" "math/rand" + "os" "time" "github.com/dop251/goja" @@ -254,7 +254,7 @@ func (re *JSRE) Stop(waitForCallbacks bool) { // Exec(file) loads and runs the contents of a file // if a relative path is given, the jsre's assetPath is used func (re *JSRE) Exec(file string) error { - code, err := ioutil.ReadFile(common.AbsolutePath(re.assetPath, file)) + code, err := os.ReadFile(common.AbsolutePath(re.assetPath, file)) if err != nil { return err } @@ -320,7 +320,7 @@ func (re *JSRE) Compile(filename string, src string) (err error) { func (re *JSRE) loadScript(call Call) (goja.Value, error) { file := call.Argument(0).ToString().String() file = common.AbsolutePath(re.assetPath, file) - source, err := ioutil.ReadFile(file) + source, err := os.ReadFile(file) if err != nil { return nil, fmt.Errorf("Could not read file %s: %v", file, err) } diff --git a/internal/jsre/jsre_test.go b/internal/jsre/jsre_test.go index 57acdaed90..1645cfe583 100644 --- a/internal/jsre/jsre_test.go +++ b/internal/jsre/jsre_test.go @@ -17,7 +17,6 @@ package jsre import ( - "io/ioutil" "os" "path" "reflect" @@ -41,12 +40,12 @@ func (no *testNativeObjectBinding) TestMethod(call goja.FunctionCall) goja.Value } func newWithTestJS(t *testing.T, testjs string) (*JSRE, string) { - dir, err := ioutil.TempDir("", "jsre-test") + dir, err := os.MkdirTemp("", "jsre-test") if err != nil { t.Fatal("cannot create temporary directory:", err) } if testjs != "" { - if err := ioutil.WriteFile(path.Join(dir, "test.js"), []byte(testjs), os.ModePerm); err != nil { + if err := os.WriteFile(path.Join(dir, "test.js"), []byte(testjs), os.ModePerm); err != nil { t.Fatal("cannot create test.js:", err) } } diff --git a/internal/utesting/utesting.go b/internal/utesting/utesting.go index ef05a90e4c..ee99794c64 100644 --- a/internal/utesting/utesting.go +++ b/internal/utesting/utesting.go @@ -25,7 +25,6 @@ import ( "bytes" "fmt" "io" - "io/ioutil" "regexp" "runtime" "sync" @@ -65,7 +64,7 @@ func MatchTests(tests []Test, expr string) []Test { // If the report writer is non-nil, a test report is written to it in real time. func RunTests(tests []Test, report io.Writer) []Result { if report == nil { - report = ioutil.Discard + report = io.Discard } results := run(tests, newConsoleOutput(report)) fails := CountFailures(results) diff --git a/les/api_backend.go b/les/api_backend.go index 0e02a03050..a68ae1dee1 100644 --- a/les/api_backend.go +++ b/les/api_backend.go @@ -306,6 +306,14 @@ func (b *LesApiBackend) RPCTxFeeCap() float64 { return b.eth.config.RPCTxFeeCap } +func (b *LesApiBackend) SkipBloomFilter(num *big.Int) bool { + cfg := b.eth.chainConfig + if cfg == nil { + return false + } + return cfg.IsIBFT(num) && !cfg.IsHawaii(num) +} + func (b *LesApiBackend) BloomStatus() (uint64, uint64) { if b.eth.bloomIndexer == nil { return 0, 0 diff --git a/les/api_test.go b/les/api_test.go index 6a19b0fe4f..ea6870e356 100644 --- a/les/api_test.go +++ b/les/api_test.go @@ -20,7 +20,6 @@ import ( "context" "errors" "flag" - "io/ioutil" "math/rand" "os" "sync" @@ -423,7 +422,7 @@ func NewAdapter(adapterType string, services adapters.LifecycleConstructors) (ad // case "socket": // adapter = adapters.NewSocketAdapter(services) case "exec": - baseDir, err0 := ioutil.TempDir("", "les-test") + baseDir, err0 := os.MkdirTemp("", "les-test") if err0 != nil { return nil, teardown, err0 } diff --git a/les/client.go b/les/client.go index 313dd90b49..6949efea82 100644 --- a/les/client.go +++ b/les/client.go @@ -100,6 +100,11 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) { peers := newServerPeerSet() merger := consensus.NewMerger(chainDb) + engine, err := ethconfig.CreateConsensusEngine(stack, chainConfig, &config.Ethash, nil, false, chainDb, nil, genesisHash) + if err != nil { + return nil, err + } + leth := &LightEthereum{ lesCommons: lesCommons{ genesis: genesisHash, @@ -115,7 +120,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) { reqDist: newRequestDistributor(peers, &mclock.System{}), accountManager: stack.AccountManager(), merger: merger, - engine: ethconfig.CreateConsensusEngine(stack, chainConfig, &config.Ethash, nil, false, chainDb, nil, genesisHash), + engine: engine, bloomRequests: make(chan chan *bloombits.Retrieval), bloomIndexer: core.NewBloomIndexer(chainDb, params.BloomBitsBlocksClient, params.HelperTrieConfirmations), p2pServer: stack.Server(), diff --git a/log/async_file_writer_test.go b/log/async_file_writer_test.go index 3e8ba3bac8..f0e544bfce 100644 --- a/log/async_file_writer_test.go +++ b/log/async_file_writer_test.go @@ -1,7 +1,6 @@ package log import ( - "io/ioutil" "os" "strings" "testing" @@ -13,12 +12,12 @@ func TestWriter(t *testing.T) { w.Write([]byte("hello\n")) w.Write([]byte("world\n")) w.Stop() - files, _ := ioutil.ReadDir("./") + files, _ := os.ReadDir("./") for _, f := range files { fn := f.Name() if strings.HasPrefix(fn, "hello") { t.Log(fn) - content, _ := ioutil.ReadFile(fn) + content, _ := os.ReadFile(fn) t.Log(content) os.Remove(fn) } diff --git a/metrics/config.go b/metrics/config.go index 2eb09fb48a..31c4dc3fec 100644 --- a/metrics/config.go +++ b/metrics/config.go @@ -22,6 +22,7 @@ type Config struct { EnabledExpensive bool `toml:",omitempty"` HTTP string `toml:",omitempty"` Port int `toml:",omitempty"` + DCPort int `toml:",omitempty"` EnableInfluxDB bool `toml:",omitempty"` InfluxDBEndpoint string `toml:",omitempty"` InfluxDBDatabase string `toml:",omitempty"` @@ -41,6 +42,7 @@ var DefaultConfig = Config{ EnabledExpensive: false, HTTP: "127.0.0.1", Port: 6060, + DCPort: 9090, EnableInfluxDB: false, InfluxDBEndpoint: "http://localhost:8086", InfluxDBDatabase: "geth", diff --git a/metrics/librato/client.go b/metrics/librato/client.go index f7aed3e4ef..eebe20521b 100644 --- a/metrics/librato/client.go +++ b/metrics/librato/client.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" ) @@ -93,7 +93,7 @@ func (c *LibratoClient) PostMetrics(batch Batch) (err error) { if resp.StatusCode != http.StatusOK { var body []byte - if body, err = ioutil.ReadAll(resp.Body); err != nil { + if body, err = io.ReadAll(resp.Body); err != nil { body = []byte(fmt.Sprintf("(could not fetch response body for error: %s)", err)) } err = fmt.Errorf("unable to post to Librato: %d %s %s", resp.StatusCode, resp.Status, string(body)) diff --git a/metrics/metrics_test.go b/metrics/metrics_test.go index df36da0ade..029c99870e 100644 --- a/metrics/metrics_test.go +++ b/metrics/metrics_test.go @@ -2,7 +2,7 @@ package metrics import ( "fmt" - "io/ioutil" + "io" "log" "sync" "testing" @@ -13,7 +13,7 @@ const FANOUT = 128 // Stop the compiler from complaining during debugging. var ( - _ = ioutil.Discard + _ = io.Discard _ = log.LstdFlags ) @@ -78,7 +78,7 @@ func BenchmarkMetrics(b *testing.B) { //log.Println("done Write") return default: - WriteOnce(r, ioutil.Discard) + WriteOnce(r, io.Discard) } } }() diff --git a/miner/stress/1559/main.go b/miner/stress/1559/main.go index e9167a16a2..a45f66b930 100644 --- a/miner/stress/1559/main.go +++ b/miner/stress/1559/main.go @@ -19,7 +19,6 @@ package main import ( "crypto/ecdsa" - "io/ioutil" "math/big" "math/rand" "os" @@ -222,7 +221,7 @@ func makeGenesis(faucets []*ecdsa.PrivateKey) *core.Genesis { func makeMiner(genesis *core.Genesis) (*node.Node, *eth.Ethereum, error) { // Define the basic configurations for the Ethereum node - datadir, _ := ioutil.TempDir("", "") + datadir, _ := os.MkdirTemp("", "") config := &node.Config{ Name: "geth", diff --git a/miner/stress/beacon/main.go b/miner/stress/beacon/main.go index a6c01823eb..bb999c812a 100644 --- a/miner/stress/beacon/main.go +++ b/miner/stress/beacon/main.go @@ -20,7 +20,6 @@ package main import ( "crypto/ecdsa" "errors" - "io/ioutil" "math/big" "math/rand" "os" @@ -461,7 +460,7 @@ func makeGenesis(faucets []*ecdsa.PrivateKey) *core.Genesis { func makeFullNode(genesis *core.Genesis) (*node.Node, *eth.Ethereum, *ethcatalyst.ConsensusAPI, error) { // Define the basic configurations for the Ethereum node - datadir, _ := ioutil.TempDir("", "") + datadir, _ := os.MkdirTemp("", "") config := &node.Config{ Name: "geth", @@ -512,7 +511,7 @@ func makeFullNode(genesis *core.Genesis) (*node.Node, *eth.Ethereum, *ethcatalys func makeLightNode(genesis *core.Genesis) (*node.Node, *les.LightEthereum, *lescatalyst.ConsensusAPI, error) { // Define the basic configurations for the Ethereum node - datadir, _ := ioutil.TempDir("", "") + datadir, _ := os.MkdirTemp("", "") config := &node.Config{ Name: "geth", diff --git a/miner/stress/clique/main.go b/miner/stress/clique/main.go index 51e7766627..19e9b21b86 100644 --- a/miner/stress/clique/main.go +++ b/miner/stress/clique/main.go @@ -20,7 +20,6 @@ package main import ( "bytes" "crypto/ecdsa" - "io/ioutil" "math/big" "math/rand" "os" @@ -183,7 +182,7 @@ func makeGenesis(faucets []*ecdsa.PrivateKey, sealers []*ecdsa.PrivateKey) *core func makeSealer(genesis *core.Genesis) (*node.Node, *eth.Ethereum, error) { // Define the basic configurations for the Ethereum node - datadir, _ := ioutil.TempDir("", "") + datadir, _ := os.MkdirTemp("", "") config := &node.Config{ Name: "geth", diff --git a/miner/stress/ethash/main.go b/miner/stress/ethash/main.go index a8dfcd63bc..444d7789a6 100644 --- a/miner/stress/ethash/main.go +++ b/miner/stress/ethash/main.go @@ -19,7 +19,6 @@ package main import ( "crypto/ecdsa" - "io/ioutil" "math/big" "math/rand" "os" @@ -152,7 +151,7 @@ func makeGenesis(faucets []*ecdsa.PrivateKey) *core.Genesis { func makeMiner(genesis *core.Genesis) (*node.Node, *eth.Ethereum, error) { // Define the basic configurations for the Ethereum node - datadir, _ := ioutil.TempDir("", "") + datadir, _ := os.MkdirTemp("", "") config := &node.Config{ Name: "geth", diff --git a/miner/worker.go b/miner/worker.go index 42d6f54558..44573e1dad 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -778,7 +778,9 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP gasLimit := env.header.GasLimit if env.gasPool == nil { env.gasPool = new(core.GasPool).AddGas(gasLimit) - if w.chain.Config().IsEuler(env.header.Number) { + if w.chain.Config().IsHawaii(env.header.Number) { + env.gasPool.SubGas(params.SystemTxsGas * 2) + } else if w.chain.Config().IsEuler(env.header.Number) { env.gasPool.SubGas(params.SystemTxsGas * 3) } else { env.gasPool.SubGas(params.SystemTxsGas) @@ -966,10 +968,6 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) { // Set baseFee and GasLimit if we are on an EIP-1559 chain if w.chainConfig.IsLondon(header.Number) { header.BaseFee = misc.CalcBaseFee(w.chainConfig, parent.Header()) - if !w.chainConfig.IsLondon(parent.Number()) { - parentGasLimit := parent.GasLimit() * params.ElasticityMultiplier - header.GasLimit = core.CalcGasLimit(parentGasLimit, w.config.GasCeil) - } } // Run the consensus preparation with the default or customized consensus engine. if err := w.engine.Prepare(w.chain, header); err != nil { @@ -986,7 +984,7 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) { } // Handle upgrade build-in system contract code - if w.chainConfig.IsIBFT(header.Number) { // ibft + if w.chainConfig.IsIBFT(header.Number) { // dbsc dccontracts.UpgradeBuildInSystemContract(w.chainConfig, header.Number, env.state) } else { // parlia by default systemcontracts.UpgradeBuildInSystemContract(w.chainConfig, header.Number, env.state) diff --git a/mobile/android_test.go b/mobile/android_test.go index c85314c157..f14ca74c70 100644 --- a/mobile/android_test.go +++ b/mobile/android_test.go @@ -17,7 +17,6 @@ package geth import ( - "io/ioutil" "os" "os/exec" "path/filepath" @@ -184,7 +183,7 @@ func TestAndroid(t *testing.T) { t.Logf("initialization took %v", time.Since(start)) } // Create and switch to a temporary workspace - workspace, err := ioutil.TempDir("", "geth-android-") + workspace, err := os.MkdirTemp("", "geth-android-") if err != nil { t.Fatalf("failed to create temporary workspace: %v", err) } @@ -214,14 +213,14 @@ func TestAndroid(t *testing.T) { } cp.CopyFile(filepath.Join("libs", "geth.aar"), "geth.aar") - if err = ioutil.WriteFile(filepath.Join("src", "androidTest", "java", "org", "ethereum", "gethtest", "AndroidTest.java"), []byte(androidTestClass), os.ModePerm); err != nil { + if err = os.WriteFile(filepath.Join("src", "androidTest", "java", "org", "ethereum", "gethtest", "AndroidTest.java"), []byte(androidTestClass), os.ModePerm); err != nil { t.Fatalf("failed to write Android test class: %v", err) } // Finish creating the project and run the tests via gradle - if err = ioutil.WriteFile(filepath.Join("src", "main", "AndroidManifest.xml"), []byte(androidManifest), os.ModePerm); err != nil { + if err = os.WriteFile(filepath.Join("src", "main", "AndroidManifest.xml"), []byte(androidManifest), os.ModePerm); err != nil { t.Fatalf("failed to write Android manifest: %v", err) } - if err = ioutil.WriteFile("build.gradle", []byte(gradleConfig), os.ModePerm); err != nil { + if err = os.WriteFile("build.gradle", []byte(gradleConfig), os.ModePerm); err != nil { t.Fatalf("failed to write gradle build file: %v", err) } if output, err := exec.Command("gradle", "connectedAndroidTest").CombinedOutput(); err != nil { diff --git a/node/config.go b/node/config.go index b4f1378c8f..6745f70fe9 100644 --- a/node/config.go +++ b/node/config.go @@ -19,7 +19,6 @@ package node import ( "crypto/ecdsa" "fmt" - "io/ioutil" "os" "path/filepath" "runtime" @@ -470,7 +469,7 @@ func getKeyStoreDir(conf *Config) (string, bool, error) { isEphemeral := false if keydir == "" { // There is no datadir. - keydir, err = ioutil.TempDir("", "go-ethereum-keystore") + keydir, err = os.MkdirTemp("", "go-ethereum-keystore") isEphemeral = true } diff --git a/node/config_test.go b/node/config_test.go index 00c24a2391..7ec6d7a37e 100644 --- a/node/config_test.go +++ b/node/config_test.go @@ -18,7 +18,6 @@ package node import ( "bytes" - "io/ioutil" "os" "path/filepath" "runtime" @@ -32,7 +31,7 @@ import ( // ones or automatically generated temporary ones. func TestDatadirCreation(t *testing.T) { // Create a temporary data dir and check that it can be used by a node - dir, err := ioutil.TempDir("", "") + dir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("failed to create manual data dir: %v", err) } @@ -58,7 +57,7 @@ func TestDatadirCreation(t *testing.T) { t.Fatalf("freshly created datadir not accessible: %v", err) } // Verify that an impossible datadir fails creation - file, err := ioutil.TempFile("", "") + file, err := os.CreateTemp("", "") if err != nil { t.Fatalf("failed to create temporary file: %v", err) } @@ -109,7 +108,7 @@ func TestIPCPathResolution(t *testing.T) { // ephemeral. func TestNodeKeyPersistency(t *testing.T) { // Create a temporary folder and make sure no key is present - dir, err := ioutil.TempDir("", "node-test") + dir, err := os.MkdirTemp("", "node-test") if err != nil { t.Fatalf("failed to create temporary data directory: %v", err) } @@ -137,7 +136,7 @@ func TestNodeKeyPersistency(t *testing.T) { if _, err = crypto.LoadECDSA(keyfile); err != nil { t.Fatalf("failed to load freshly persisted node key: %v", err) } - blob1, err := ioutil.ReadFile(keyfile) + blob1, err := os.ReadFile(keyfile) if err != nil { t.Fatalf("failed to read freshly persisted node key: %v", err) } @@ -145,7 +144,7 @@ func TestNodeKeyPersistency(t *testing.T) { // Configure a new node and ensure the previously persisted key is loaded config = &Config{Name: "unit-test", DataDir: dir} config.NodeKey() - blob2, err := ioutil.ReadFile(filepath.Join(keyfile)) + blob2, err := os.ReadFile(filepath.Join(keyfile)) if err != nil { t.Fatalf("failed to read previously persisted node key: %v", err) } diff --git a/node/node_test.go b/node/node_test.go index 25cfa9d38d..8f66d98cd1 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -20,7 +20,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net" "net/http" "os" @@ -88,7 +87,7 @@ func TestNodeStartMultipleTimes(t *testing.T) { // Tests that if the data dir is already in use, an appropriate error is returned. func TestNodeUsedDataDir(t *testing.T) { // Create a temporary folder to use as the data directory - dir, err := ioutil.TempDir("", "") + dir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("failed to create temporary data directory: %v", err) } diff --git a/node/rpcstack.go b/node/rpcstack.go index 80dbd87a78..186b0f4c42 100644 --- a/node/rpcstack.go +++ b/node/rpcstack.go @@ -21,7 +21,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "net" "net/http" "sort" @@ -443,7 +442,7 @@ func (h *virtualHostHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { var gzPool = sync.Pool{ New: func() interface{} { - w := gzip.NewWriter(ioutil.Discard) + w := gzip.NewWriter(io.Discard) return w }, } diff --git a/p2p/discover/v5wire/encoding_test.go b/p2p/discover/v5wire/encoding_test.go index cd75c2c257..70d88e7950 100644 --- a/p2p/discover/v5wire/encoding_test.go +++ b/p2p/discover/v5wire/encoding_test.go @@ -23,7 +23,6 @@ import ( "errors" "flag" "fmt" - "io/ioutil" "net" "os" "path/filepath" @@ -579,7 +578,7 @@ func (n *handshakeTestNode) id() enode.ID { // hexFile reads the given file and decodes the hex data contained in it. // Whitespace and any lines beginning with the # character are ignored. func hexFile(file string) []byte { - fileContent, err := ioutil.ReadFile(file) + fileContent, err := os.ReadFile(file) if err != nil { panic(err) } diff --git a/p2p/enode/nodedb_test.go b/p2p/enode/nodedb_test.go index d2b187896f..2a22afee5f 100644 --- a/p2p/enode/nodedb_test.go +++ b/p2p/enode/nodedb_test.go @@ -19,7 +19,6 @@ package enode import ( "bytes" "fmt" - "io/ioutil" "net" "os" "path/filepath" @@ -300,7 +299,7 @@ func testSeedQuery() error { } func TestDBPersistency(t *testing.T) { - root, err := ioutil.TempDir("", "nodedb-") + root, err := os.MkdirTemp("", "nodedb-") if err != nil { t.Fatalf("failed to create temporary data folder: %v", err) } diff --git a/p2p/message.go b/p2p/message.go index a61991782b..24f21456d8 100644 --- a/p2p/message.go +++ b/p2p/message.go @@ -21,7 +21,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "sync/atomic" "time" @@ -66,7 +65,7 @@ func (msg Msg) String() string { // Discard reads any remaining payload data into a black hole. func (msg Msg) Discard() error { - _, err := io.Copy(ioutil.Discard, msg.Payload) + _, err := io.Copy(io.Discard, msg.Payload) return err } @@ -244,7 +243,7 @@ func ExpectMsg(r MsgReader, code uint64, content interface{}) error { if int(msg.Size) != len(contentEnc) { return fmt.Errorf("message size mismatch: got %d, want %d", msg.Size, len(contentEnc)) } - actualContent, err := ioutil.ReadAll(msg.Payload) + actualContent, err := io.ReadAll(msg.Payload) if err != nil { return err } diff --git a/p2p/simulations/examples/ping-pong.go b/p2p/simulations/examples/ping-pong.go index 0cddd9b505..2f4c560548 100644 --- a/p2p/simulations/examples/ping-pong.go +++ b/p2p/simulations/examples/ping-pong.go @@ -19,7 +19,7 @@ package main import ( "flag" "fmt" - "io/ioutil" + "io" "net/http" "os" "sync/atomic" @@ -63,7 +63,7 @@ func main() { adapter = adapters.NewSimAdapter(services) case "exec": - tmpdir, err := ioutil.TempDir("", "p2p-example") + tmpdir, err := os.MkdirTemp("", "p2p-example") if err != nil { log.Crit("error creating temp dir", "err", err) } @@ -156,7 +156,7 @@ func (p *pingPongService) Run(peer *p2p.Peer, rw p2p.MsgReadWriter) error { errC <- err return } - payload, err := ioutil.ReadAll(msg.Payload) + payload, err := io.ReadAll(msg.Payload) if err != nil { errC <- err return diff --git a/p2p/simulations/http.go b/p2p/simulations/http.go index 16aeb4a152..66cdc13109 100644 --- a/p2p/simulations/http.go +++ b/p2p/simulations/http.go @@ -25,7 +25,6 @@ import ( "fmt" "html" "io" - "io/ioutil" "net/http" "strconv" "strings" @@ -113,7 +112,7 @@ func (c *Client) SubscribeNetwork(events chan *Event, opts SubscribeOpts) (event return nil, err } if res.StatusCode != http.StatusOK { - response, _ := ioutil.ReadAll(res.Body) + response, _ := io.ReadAll(res.Body) res.Body.Close() return nil, fmt.Errorf("unexpected HTTP status: %s: %s", res.Status, response) } @@ -253,7 +252,7 @@ func (c *Client) Send(method, path string, in, out interface{}) error { } defer res.Body.Close() if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusCreated { - response, _ := ioutil.ReadAll(res.Body) + response, _ := io.ReadAll(res.Body) return fmt.Errorf("unexpected HTTP status: %s: %s", res.Status, response) } if out != nil { diff --git a/params/config.go b/params/config.go index b1ddfc7990..d9ef3153aa 100644 --- a/params/config.go +++ b/params/config.go @@ -24,6 +24,8 @@ import ( "golang.org/x/crypto/sha3" "github.com/ethereum/go-ethereum/common" + + dc "github.com/dogechain-lab/dogechain/chain" ) // Genesis hashes to enforce below configs on. @@ -193,9 +195,9 @@ var ( PortlandBlock: big.NewInt(1981991), DetroitBlock: big.NewInt(4490834), - IBFT: &IBFTConfig{ + Drab: &DrabConfig{ + BlockTime: 2, EpochSize: 7200, - Type: IBFTPoS, }, } @@ -214,9 +216,9 @@ var ( PortlandBlock: big.NewInt(1065956), DetroitBlock: big.NewInt(2661202), - IBFT: &IBFTConfig{ + Drab: &DrabConfig{ + BlockTime: 2, EpochSize: 7200, - Type: IBFTPoS, }, } @@ -406,7 +408,8 @@ type ChainConfig struct { Ethash *EthashConfig `json:"ethash,omitempty" toml:",omitempty"` Clique *CliqueConfig `json:"clique,omitempty" toml:",omitempty"` Parlia *ParliaConfig `json:"parlia,omitempty" toml:",omitempty"` - IBFT *IBFTConfig `json:"ibft,omitempty" toml:",omitempty"` + Doge *DogeConfig `json:"doge,omitempty" toml:",omitempty"` + Drab *DrabConfig `json:"drab,omitempty" toml:",omitempty"` } // EthashConfig is the consensus engine configs for proof-of-work based sealing. @@ -428,22 +431,26 @@ func (c *CliqueConfig) String() string { return "clique" } +type DogeConfig struct { + Genesis *dc.Genesis `json:"genesis"` + Params *dc.Params `json:"params"` +} + +func (c *DogeConfig) String() string { + return "doge" +} + type IBFTType string const ( IBFTPoS IBFTType = "PoS" - IBFTPoA IBFTType = "PoA" + // IBFTPoA IBFTType = "PoA" // not supported any more ) // ParliaConfig is the consensus engine configs for istanbul-byzantium-fault-tolarance based sealing. -type IBFTConfig struct { - EpochSize uint64 `json:"epochSize"` - Type IBFTType `json:"type"` -} - -// String implements the stringer interface, returning the consensus engine details. -func (c *IBFTConfig) String() string { - return "ibft" +type DrabConfig struct { + BlockTime uint64 `json:"blockTime"` + EpochSize uint64 `json:"epochSize"` } // ParliaConfig is the consensus engine configs for proof-of-staked-authority based sealing. @@ -461,14 +468,16 @@ func (b *ParliaConfig) String() string { func (c *ChainConfig) String() string { var engine interface{} switch { + case c.Drab != nil: + engine = c.Drab + case c.Doge != nil: + engine = c.Doge case c.Ethash != nil: engine = c.Ethash case c.Clique != nil: engine = c.Clique case c.Parlia != nil: engine = c.Parlia - case c.IBFT != nil: - engine = c.IBFT default: engine = "unknown" } @@ -621,6 +630,11 @@ func (c *ChainConfig) IsLondon(num *big.Int) bool { return isForked(c.LondonBlock, num) } +// IsOnLondon returns whether num is equal to the london fork block +func (c *ChainConfig) IsOnLondon(num *big.Int) bool { + return configNumEqual(c.LondonBlock, num) +} + // IsArrowGlacier returns whether num is either equal to the Arrow Glacier (EIP-4345) fork block or greater. func (c *ChainConfig) IsArrowGlacier(num *big.Int) bool { return isForked(c.ArrowGlacierBlock, num) @@ -839,6 +853,21 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi if isForkIncompatible(c.PlanckBlock, newcfg.PlanckBlock, head) { return newCompatError("planck fork block", c.PlanckBlock, newcfg.PlanckBlock) } + if isForkIncompatible(c.IBFTBlock, newcfg.IBFTBlock, head) { + return newCompatError("IBFT fork block", c.IBFTBlock, newcfg.IBFTBlock) + } + if isForkIncompatible(c.PreportlandBlock, newcfg.PreportlandBlock, head) { + return newCompatError("pre-portland fork block", c.PreportlandBlock, newcfg.PreportlandBlock) + } + if isForkIncompatible(c.PortlandBlock, newcfg.PortlandBlock, head) { + return newCompatError("portland fork block", c.PortlandBlock, newcfg.PortlandBlock) + } + if isForkIncompatible(c.DetroitBlock, newcfg.DetroitBlock, head) { + return newCompatError("detroit fork block", c.DetroitBlock, newcfg.DetroitBlock) + } + if isForkIncompatible(c.HawaiiBlock, newcfg.HawaiiBlock, head) { + return newCompatError("hawaii fork block", c.HawaiiBlock, newcfg.HawaiiBlock) + } return nil } diff --git a/params/protocol_params.go b/params/protocol_params.go index e244c24231..020a8b7e7b 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -121,9 +121,9 @@ const ( // Introduced in Tangerine Whistle (Eip 150) CreateBySelfdestructGas uint64 = 25000 - BaseFeeChangeDenominator = 8 // Bounds the amount the base fee can change between blocks. - ElasticityMultiplier = 2 // Bounds the maximum gas limit an EIP-1559 block may have. - InitialBaseFee = 1000000000 // Initial base fee for EIP-1559 blocks. + BaseFeeChangeDenominator = 8 // Bounds the amount the base fee can change between blocks. + ElasticityMultiplier = 2 // Bounds the maximum gas limit an EIP-1559 block may have. + InitialBaseFee = 0 // Initial base fee for EIP-1559 blocks. MaxCodeSize = 24576 // Maximum bytecode to permit for a contract diff --git a/rlp/encode_test.go b/rlp/encode_test.go index df02add992..58ddc0d120 100644 --- a/rlp/encode_test.go +++ b/rlp/encode_test.go @@ -21,7 +21,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "math/big" "runtime" "sync" @@ -420,7 +419,7 @@ func TestEncodeToReader(t *testing.T) { if err != nil { return nil, err } - return ioutil.ReadAll(r) + return io.ReadAll(r) }) } @@ -461,7 +460,7 @@ func TestEncodeToReaderReturnToPool(t *testing.T) { go func() { for i := 0; i < 1000; i++ { _, r, _ := EncodeToReader("foo") - ioutil.ReadAll(r) + io.ReadAll(r) r.Read(buf) r.Read(buf) r.Read(buf) diff --git a/rlp/rlpgen/gen_test.go b/rlp/rlpgen/gen_test.go index 9940db188d..ff7ccdbedd 100644 --- a/rlp/rlpgen/gen_test.go +++ b/rlp/rlpgen/gen_test.go @@ -8,7 +8,6 @@ import ( "go/parser" "go/token" "go/types" - "io/ioutil" "os" "path/filepath" "testing" @@ -51,11 +50,11 @@ func TestOutput(t *testing.T) { // Set this environment variable to regenerate the test outputs. if os.Getenv("WRITE_TEST_FILES") != "" { - ioutil.WriteFile(outputFile, output, 0644) + os.WriteFile(outputFile, output, 0644) } // Check if output matches. - wantOutput, err := ioutil.ReadFile(outputFile) + wantOutput, err := os.ReadFile(outputFile) if err != nil { t.Fatal("error loading expected test output:", err) } @@ -68,7 +67,7 @@ func TestOutput(t *testing.T) { func loadTestSource(file string, typeName string) (*buildContext, *types.Named, error) { // Load the test input. - content, err := ioutil.ReadFile(file) + content, err := os.ReadFile(file) if err != nil { return nil, nil, err } diff --git a/rlp/rlpgen/main.go b/rlp/rlpgen/main.go index 5b240bfd85..37d585888a 100644 --- a/rlp/rlpgen/main.go +++ b/rlp/rlpgen/main.go @@ -22,7 +22,6 @@ import ( "flag" "fmt" "go/types" - "io/ioutil" "os" "golang.org/x/tools/go/packages" @@ -52,7 +51,7 @@ func main() { } if *output == "-" { os.Stdout.Write(code) - } else if err := ioutil.WriteFile(*output, code, 0644); err != nil { + } else if err := os.WriteFile(*output, code, 0644); err != nil { fatal(err) } } diff --git a/rpc/http.go b/rpc/http.go index 9604c14f70..5b522fa557 100644 --- a/rpc/http.go +++ b/rpc/http.go @@ -23,7 +23,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "mime" "net/http" "net/url" @@ -179,12 +178,12 @@ func (hc *httpConn) doRequest(ctx context.Context, msg interface{}) (io.ReadClos if err != nil { return nil, err } - req, err := http.NewRequestWithContext(ctx, "POST", hc.url, ioutil.NopCloser(bytes.NewReader(body))) + req, err := http.NewRequestWithContext(ctx, "POST", hc.url, io.NopCloser(bytes.NewReader(body))) if err != nil { return nil, err } req.ContentLength = int64(len(body)) - req.GetBody = func() (io.ReadCloser, error) { return ioutil.NopCloser(bytes.NewReader(body)), nil } + req.GetBody = func() (io.ReadCloser, error) { return io.NopCloser(bytes.NewReader(body)), nil } // set headers hc.mu.Lock() diff --git a/rpc/server_test.go b/rpc/server_test.go index e67893710d..d09d31634b 100644 --- a/rpc/server_test.go +++ b/rpc/server_test.go @@ -20,8 +20,8 @@ import ( "bufio" "bytes" "io" - "io/ioutil" "net" + "os" "path/filepath" "strings" "testing" @@ -52,7 +52,7 @@ func TestServerRegisterName(t *testing.T) { } func TestServer(t *testing.T) { - files, err := ioutil.ReadDir("testdata") + files, err := os.ReadDir("testdata") if err != nil { t.Fatal("where'd my testdata go?") } @@ -70,7 +70,7 @@ func TestServer(t *testing.T) { func runTestScript(t *testing.T, file string) { server := newTestServer() - content, err := ioutil.ReadFile(file) + content, err := os.ReadFile(file) if err != nil { t.Fatal(err) } diff --git a/signer/core/api_test.go b/signer/core/api_test.go index fef9ea5da7..ea0421ef61 100644 --- a/signer/core/api_test.go +++ b/signer/core/api_test.go @@ -20,7 +20,6 @@ import ( "bytes" "context" "fmt" - "io/ioutil" "math/big" "os" "path/filepath" @@ -109,7 +108,7 @@ func (ui *headlessUi) ShowInfo(message string) { } func tmpDirName(t *testing.T) string { - d, err := ioutil.TempDir("", "eth-keystore-test") + d, err := os.MkdirTemp("", "eth-keystore-test") if err != nil { t.Fatal(err) } diff --git a/signer/core/signed_data_test.go b/signer/core/signed_data_test.go index fbc2903d9e..7d5661e7e6 100644 --- a/signer/core/signed_data_test.go +++ b/signer/core/signed_data_test.go @@ -21,7 +21,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "os" "path" "strings" "testing" @@ -353,7 +353,7 @@ func sign(typedData apitypes.TypedData) ([]byte, []byte, error) { } func TestJsonFiles(t *testing.T) { - testfiles, err := ioutil.ReadDir("testdata/") + testfiles, err := os.ReadDir("testdata/") if err != nil { t.Fatalf("failed reading files: %v", err) } @@ -362,7 +362,7 @@ func TestJsonFiles(t *testing.T) { continue } expectedFailure := strings.HasPrefix(fInfo.Name(), "expfail") - data, err := ioutil.ReadFile(path.Join("testdata", fInfo.Name())) + data, err := os.ReadFile(path.Join("testdata", fInfo.Name())) if err != nil { t.Errorf("Failed to read file %v: %v", fInfo.Name(), err) continue @@ -388,13 +388,13 @@ func TestJsonFiles(t *testing.T) { // crashes or hangs. func TestFuzzerFiles(t *testing.T) { corpusdir := path.Join("testdata", "fuzzing") - testfiles, err := ioutil.ReadDir(corpusdir) + testfiles, err := os.ReadDir(corpusdir) if err != nil { t.Fatalf("failed reading files: %v", err) } verbose := false for i, fInfo := range testfiles { - data, err := ioutil.ReadFile(path.Join(corpusdir, fInfo.Name())) + data, err := os.ReadFile(path.Join(corpusdir, fInfo.Name())) if err != nil { t.Errorf("Failed to read file %v: %v", fInfo.Name(), err) continue diff --git a/signer/core/uiapi.go b/signer/core/uiapi.go index 3a0327d869..59466d8fa0 100644 --- a/signer/core/uiapi.go +++ b/signer/core/uiapi.go @@ -21,8 +21,8 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "math/big" + "os" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/keystore" @@ -175,7 +175,7 @@ func (s *UIServerAPI) Export(ctx context.Context, addr common.Address) (json.Raw if wallet.URL().Scheme != keystore.KeyStoreScheme { return nil, fmt.Errorf("account is not a keystore-account") } - return ioutil.ReadFile(wallet.URL().Path) + return os.ReadFile(wallet.URL().Path) } // Import tries to import the given keyJSON in the local keystore. The keyJSON data is expected to be diff --git a/signer/fourbyte/4byte.go b/signer/fourbyte/4byte.go index 2f7b24795c..4a31292516 100644 --- a/signer/fourbyte/4byte.go +++ b/signer/fourbyte/4byte.go @@ -7,7 +7,6 @@ package fourbyte import ( "crypto/sha256" "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -147058,7 +147057,7 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + err = os.WriteFile(_filePath(dir, name), data, info.Mode()) if err != nil { return err } diff --git a/signer/fourbyte/fourbyte.go b/signer/fourbyte/fourbyte.go index 01988dcab0..672498277a 100644 --- a/signer/fourbyte/fourbyte.go +++ b/signer/fourbyte/fourbyte.go @@ -25,7 +25,6 @@ import ( "encoding/hex" "encoding/json" "fmt" - "io/ioutil" "os" ) @@ -86,7 +85,7 @@ func NewWithFile(path string) (*Database, error) { } // Custom file may not exist. Will be created during save, if needed. if _, err := os.Stat(path); err == nil { - if blob, err = ioutil.ReadFile(path); err != nil { + if blob, err = os.ReadFile(path); err != nil { return nil, err } if err := json.Unmarshal(blob, &db.custom); err != nil { @@ -140,5 +139,5 @@ func (db *Database) AddSelector(selector string, data []byte) error { if err != nil { return err } - return ioutil.WriteFile(db.customPath, blob, 0600) + return os.WriteFile(db.customPath, blob, 0600) } diff --git a/signer/fourbyte/fourbyte_test.go b/signer/fourbyte/fourbyte_test.go index cf54c9b9c2..ee737a892f 100644 --- a/signer/fourbyte/fourbyte_test.go +++ b/signer/fourbyte/fourbyte_test.go @@ -18,7 +18,7 @@ package fourbyte import ( "fmt" - "io/ioutil" + "os" "strings" "testing" @@ -57,7 +57,7 @@ func TestEmbeddedDatabase(t *testing.T) { // Tests that custom 4byte datasets can be handled too. func TestCustomDatabase(t *testing.T) { // Create a new custom 4byte database with no embedded component - tmpdir, err := ioutil.TempDir("", "signer-4byte-test") + tmpdir, err := os.MkdirTemp("", "signer-4byte-test") if err != nil { t.Fatal(err) } diff --git a/signer/storage/aes_gcm_storage.go b/signer/storage/aes_gcm_storage.go index 1dad34a3eb..f09bfa7d4f 100644 --- a/signer/storage/aes_gcm_storage.go +++ b/signer/storage/aes_gcm_storage.go @@ -22,7 +22,6 @@ import ( "crypto/rand" "encoding/json" "io" - "io/ioutil" "os" "github.com/ethereum/go-ethereum/log" @@ -114,7 +113,7 @@ func (s *AESEncryptedStorage) Del(key string) { // readEncryptedStorage reads the file with encrypted creds func (s *AESEncryptedStorage) readEncryptedStorage() (map[string]storedCredential, error) { creds := make(map[string]storedCredential) - raw, err := ioutil.ReadFile(s.filename) + raw, err := os.ReadFile(s.filename) if err != nil { if os.IsNotExist(err) { @@ -136,7 +135,7 @@ func (s *AESEncryptedStorage) writeEncryptedStorage(creds map[string]storedCrede if err != nil { return err } - if err = ioutil.WriteFile(s.filename, raw, 0600); err != nil { + if err = os.WriteFile(s.filename, raw, 0600); err != nil { return err } return nil diff --git a/signer/storage/aes_gcm_storage_test.go b/signer/storage/aes_gcm_storage_test.go index 664ef12994..cfb26a6b8e 100644 --- a/signer/storage/aes_gcm_storage_test.go +++ b/signer/storage/aes_gcm_storage_test.go @@ -20,7 +20,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "os" "testing" "github.com/ethereum/go-ethereum/common" @@ -62,7 +62,7 @@ func TestFileStorage(t *testing.T) { CipherText: common.Hex2Bytes("2df87baf86b5073ef1f03e3cc738de75b511400f5465bb0ddeacf47ae4dc267d"), }, } - d, err := ioutil.TempDir("", "eth-encrypted-storage-test") + d, err := os.MkdirTemp("", "eth-encrypted-storage-test") if err != nil { t.Fatal(err) } @@ -95,7 +95,7 @@ func TestFileStorage(t *testing.T) { func TestEnd2End(t *testing.T) { log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(3), log.StreamHandler(colorable.NewColorableStderr(), log.TerminalFormat(true)))) - d, err := ioutil.TempDir("", "eth-encrypted-storage-test") + d, err := os.MkdirTemp("", "eth-encrypted-storage-test") if err != nil { t.Fatal(err) } @@ -120,7 +120,7 @@ func TestSwappedKeys(t *testing.T) { // K1:V1, K2:V2 can be swapped into K1:V2, K2:V1 log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(3), log.StreamHandler(colorable.NewColorableStderr(), log.TerminalFormat(true)))) - d, err := ioutil.TempDir("", "eth-encrypted-storage-test") + d, err := os.MkdirTemp("", "eth-encrypted-storage-test") if err != nil { t.Fatal(err) } @@ -134,7 +134,7 @@ func TestSwappedKeys(t *testing.T) { // Now make a modified copy creds := make(map[string]storedCredential) - raw, err := ioutil.ReadFile(s1.filename) + raw, err := os.ReadFile(s1.filename) if err != nil { t.Fatal(err) } @@ -149,7 +149,7 @@ func TestSwappedKeys(t *testing.T) { if err != nil { t.Fatal(err) } - if err = ioutil.WriteFile(s1.filename, raw, 0600); err != nil { + if err = os.WriteFile(s1.filename, raw, 0600); err != nil { t.Fatal(err) } } diff --git a/tests/fuzzers/abi/abifuzzer_test.go b/tests/fuzzers/abi/abifuzzer_test.go index 423a3cd232..c66399e1b7 100644 --- a/tests/fuzzers/abi/abifuzzer_test.go +++ b/tests/fuzzers/abi/abifuzzer_test.go @@ -36,7 +36,7 @@ func TestGenerateCorpus(t *testing.T) { data := common.FromHex(corpusHex) checksum := sha1.Sum(data) outf := fmt.Sprintf("corpus/%x", checksum) - if err := ioutil.WriteFile(outf, data, 0777); err != nil { + if err := os.WriteFile(outf, data, 0777); err != nil { panic(err) } */ diff --git a/tests/fuzzers/difficulty/debug/main.go b/tests/fuzzers/difficulty/debug/main.go index 23516b3a0d..e982eef09a 100644 --- a/tests/fuzzers/difficulty/debug/main.go +++ b/tests/fuzzers/difficulty/debug/main.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "io/ioutil" "os" "github.com/ethereum/go-ethereum/tests/fuzzers/difficulty" @@ -14,7 +13,7 @@ func main() { os.Exit(1) } crasher := os.Args[1] - data, err := ioutil.ReadFile(crasher) + data, err := os.ReadFile(crasher) if err != nil { fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err) os.Exit(1) diff --git a/tests/fuzzers/les/debug/main.go b/tests/fuzzers/les/debug/main.go index 09e087d4c8..77a6127030 100644 --- a/tests/fuzzers/les/debug/main.go +++ b/tests/fuzzers/les/debug/main.go @@ -18,7 +18,6 @@ package main import ( "fmt" - "io/ioutil" "os" "github.com/ethereum/go-ethereum/tests/fuzzers/les" @@ -32,7 +31,7 @@ func main() { os.Exit(1) } crasher := os.Args[1] - data, err := ioutil.ReadFile(crasher) + data, err := os.ReadFile(crasher) if err != nil { fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err) os.Exit(1) diff --git a/tests/fuzzers/rangeproof/debug/main.go b/tests/fuzzers/rangeproof/debug/main.go index a81c69fea5..d4cab8ec46 100644 --- a/tests/fuzzers/rangeproof/debug/main.go +++ b/tests/fuzzers/rangeproof/debug/main.go @@ -18,7 +18,6 @@ package main import ( "fmt" - "io/ioutil" "os" "github.com/ethereum/go-ethereum/tests/fuzzers/rangeproof" @@ -32,7 +31,7 @@ func main() { os.Exit(1) } crasher := os.Args[1] - data, err := ioutil.ReadFile(crasher) + data, err := os.ReadFile(crasher) if err != nil { fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err) os.Exit(1) diff --git a/tests/fuzzers/snap/debug/main.go b/tests/fuzzers/snap/debug/main.go index d0d1b49307..aad6346f64 100644 --- a/tests/fuzzers/snap/debug/main.go +++ b/tests/fuzzers/snap/debug/main.go @@ -18,7 +18,6 @@ package main import ( "fmt" - "io/ioutil" "os" "github.com/ethereum/go-ethereum/tests/fuzzers/snap" @@ -30,7 +29,7 @@ func main() { os.Exit(1) } crasher := os.Args[1] - data, err := ioutil.ReadFile(crasher) + data, err := os.ReadFile(crasher) if err != nil { fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err) os.Exit(1) diff --git a/tests/fuzzers/stacktrie/debug/main.go b/tests/fuzzers/stacktrie/debug/main.go index 1ec28a8ef1..042992e9e2 100644 --- a/tests/fuzzers/stacktrie/debug/main.go +++ b/tests/fuzzers/stacktrie/debug/main.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "io/ioutil" "os" "github.com/ethereum/go-ethereum/tests/fuzzers/stacktrie" @@ -14,7 +13,7 @@ func main() { os.Exit(1) } crasher := os.Args[1] - data, err := ioutil.ReadFile(crasher) + data, err := os.ReadFile(crasher) if err != nil { fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err) os.Exit(1) diff --git a/tests/fuzzers/vflux/debug/main.go b/tests/fuzzers/vflux/debug/main.go index 1d4a5ff19c..e6cec04606 100644 --- a/tests/fuzzers/vflux/debug/main.go +++ b/tests/fuzzers/vflux/debug/main.go @@ -18,7 +18,6 @@ package main import ( "fmt" - "io/ioutil" "os" "github.com/ethereum/go-ethereum/log" @@ -35,7 +34,7 @@ func main() { os.Exit(1) } crasher := os.Args[1] - data, err := ioutil.ReadFile(crasher) + data, err := os.ReadFile(crasher) if err != nil { fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err) os.Exit(1) diff --git a/tests/init_test.go b/tests/init_test.go index 7e2f3ff7f5..218634966d 100644 --- a/tests/init_test.go +++ b/tests/init_test.go @@ -20,7 +20,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "os" "path/filepath" "reflect" @@ -45,7 +44,7 @@ var ( ) func readJSON(reader io.Reader, value interface{}) error { - data, err := ioutil.ReadAll(reader) + data, err := io.ReadAll(reader) if err != nil { return fmt.Errorf("error reading JSON file: %v", err) } diff --git a/trie/trie_test.go b/trie/trie_test.go index 63aed333db..e5253c1e0e 100644 --- a/trie/trie_test.go +++ b/trie/trie_test.go @@ -22,7 +22,6 @@ import ( "errors" "fmt" "hash" - "io/ioutil" "math/big" "math/rand" "os" @@ -1053,7 +1052,7 @@ func benchmarkDerefRootFixedSize(b *testing.B, addresses [][20]byte, accounts [] } func tempDB() (string, *Database) { - dir, err := ioutil.TempDir("", "trie-bench") + dir, err := os.MkdirTemp("", "trie-bench") if err != nil { panic(fmt.Sprintf("can't create temporary directory: %v", err)) }