diff --git a/cmd/geth/main.go b/cmd/geth/main.go index f7a65e3e4e..b019b27cbb 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -115,6 +115,7 @@ var ( utils.CacheSnapshotFlag, utils.CacheNoPrefetchFlag, utils.CachePreimagesFlag, + utils.FDLimitFlag, utils.ListenPortFlag, utils.MaxPeersFlag, utils.MaxPendingPeersFlag, diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index 1b90c8ade4..6282464fa2 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -123,6 +123,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{ utils.CacheSnapshotFlag, utils.CacheNoPrefetchFlag, utils.CachePreimagesFlag, + utils.FDLimitFlag, }, }, { diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 99480dde17..fc90b8110e 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -437,6 +437,10 @@ var ( Name: "cache.preimages", Usage: "Enable recording the SHA3/keccak preimages of trie keys", } + FDLimitFlag = cli.IntFlag{ + Name: "fdlimit", + Usage: "Raise the open file descriptor resource limit (default = system fd limit)", + } // Miner settings MiningEnabledFlag = cli.BoolFlag{ Name: "mine", @@ -1359,11 +1363,24 @@ func setLes(ctx *cli.Context, cfg *ethconfig.Config) { // MakeDatabaseHandles raises out the number of allowed file handles per process // for Geth and returns half of the allowance to assign to the database. -func MakeDatabaseHandles() int { +func MakeDatabaseHandles(max int) int { limit, err := fdlimit.Maximum() if err != nil { Fatalf("Failed to retrieve file descriptor allowance: %v", err) } + switch { + case max == 0: + // User didn't specify a meaningful value, use system limits + case max < 128: + // User specified something unhealthy, just use system defaults + log.Error("File descriptor limit invalid (<128)", "had", max, "updated", limit) + case max > limit: + // User requested more than the OS allows, notify that we can't allocate it + log.Warn("Requested file descriptors denied by OS", "req", max, "limit", limit) + default: + // User limit is meaningful and within allowed range, use that + limit = max + } raised, err := fdlimit.Raise(uint64(limit)) if err != nil { Fatalf("Failed to raise file descriptor allowance: %v", err) @@ -2064,7 +2081,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheDatabaseFlag.Name) { cfg.DatabaseCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheDatabaseFlag.Name) / 100 } - cfg.DatabaseHandles = MakeDatabaseHandles() + cfg.DatabaseHandles = MakeDatabaseHandles(ctx.GlobalInt(FDLimitFlag.Name)) if ctx.GlobalIsSet(AncientFlag.Name) { cfg.DatabaseFreezer = ctx.GlobalString(AncientFlag.Name) } @@ -2440,7 +2457,7 @@ func SplitTagsFlag(tagsFlag string) map[string]string { func MakeChainDatabase(ctx *cli.Context, stack *node.Node, readonly bool) ethdb.Database { var ( cache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheDatabaseFlag.Name) / 100 - handles = MakeDatabaseHandles() + handles = MakeDatabaseHandles(ctx.GlobalInt(FDLimitFlag.Name)) err error chainDb ethdb.Database diff --git a/consensus/istanbul/ibft/core/commit.go b/consensus/istanbul/ibft/core/commit.go index 5fa979332d..6b640ec0f1 100644 --- a/consensus/istanbul/ibft/core/commit.go +++ b/consensus/istanbul/ibft/core/commit.go @@ -18,7 +18,7 @@ package core import ( "reflect" - + "fmt" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus/istanbul" istanbulcommon "github.com/ethereum/go-ethereum/consensus/istanbul/common" @@ -35,6 +35,7 @@ func (c *core) sendCommitForOldBlock(view *istanbul.View, digest common.Hash) { View: view, Digest: digest, } + c.logger.Debug(fmt.Sprintf("=====> Sending commmit for old block, address: %v, hash: %v, block round: %v, block sequence: %v", c.Address(), digest, view.Round, view.Sequence)) c.broadcastCommit(sub) } @@ -76,6 +77,7 @@ func (c *core) handleCommit(msg *ibfttypes.Message, src istanbul.Validator) erro // by committing the proposal without PREPARE messages. if c.current.Commits.Size() >= c.QuorumSize() && c.state.Cmp(ibfttypes.StateCommitted) < 0 { // Still need to call LockHash here since state can skip Prepared state and jump directly to the Committed state. + c.logger.Debug(fmt.Sprintf("=====> Committing to a proposal and locking hash due to 2f+1 commits msgs, address: %v, hash: %v, state: %v", c.Address(), commit.Digest, c.state.String())) c.current.LockHash() c.commit() } diff --git a/consensus/istanbul/ibft/core/core.go b/consensus/istanbul/ibft/core/core.go index c3761c8b02..83844aa73b 100644 --- a/consensus/istanbul/ibft/core/core.go +++ b/consensus/istanbul/ibft/core/core.go @@ -22,7 +22,7 @@ import ( "math/big" "sync" "time" - + "fmt" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus/istanbul" ibfttypes "github.com/ethereum/go-ethereum/consensus/istanbul/ibft/types" @@ -264,6 +264,8 @@ func (c *core) startNewRound(round *big.Int) { c.sendPreprepare(r) } else if c.current.pendingRequest != nil { c.sendPreprepare(c.current.pendingRequest) + } else { + logger.Info("=====> No locked proposal and pending request") } } c.newRoundChangeTimer() @@ -292,11 +294,14 @@ func (c *core) updateRoundState(view *istanbul.View, validatorSet istanbul.Valid // Lock only if both roundChange is true and it is locked if roundChange && c.current != nil { if c.current.IsHashLocked() { + c.logger.Debug(fmt.Sprintf("=====> Setting new round state with locked hash: %v, and pending request", c.current.GetLockedHash())) c.current = newRoundState(view, validatorSet, c.current.GetLockedHash(), c.current.Preprepare, c.current.pendingRequest, c.backend.HasBadProposal) } else { + c.logger.Debug(fmt.Sprintf("=====> Setting new round state with pending request")) c.current = newRoundState(view, validatorSet, common.Hash{}, nil, c.current.pendingRequest, c.backend.HasBadProposal) } } else { + c.logger.Debug(fmt.Sprintf("=====> Setting new round state with no pending request")) c.current = newRoundState(view, validatorSet, common.Hash{}, nil, nil, c.backend.HasBadProposal) } } diff --git a/consensus/istanbul/ibft/core/handler.go b/consensus/istanbul/ibft/core/handler.go index 69486b404a..f0a8b9e5a9 100644 --- a/consensus/istanbul/ibft/core/handler.go +++ b/consensus/istanbul/ibft/core/handler.go @@ -17,6 +17,7 @@ package core import ( + "fmt" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus/istanbul" istanbulcommon "github.com/ethereum/go-ethereum/consensus/istanbul/common" @@ -194,6 +195,7 @@ func (c *core) handleTimeoutMsg() { if !c.waitingForRoundChange { maxRound := c.roundChangeSet.MaxRound(c.valSet.F() + 1) if maxRound != nil && maxRound.Cmp(c.current.Round()) > 0 { + c.logger.Info(fmt.Sprintf("=====>catching up to max round, calling sendRoundChange. max round - %v, current round - %v, seq - %v", maxRound, c.current.Round(), c.current.Sequence())) c.sendRoundChange(maxRound) return } diff --git a/consensus/istanbul/ibft/core/prepare.go b/consensus/istanbul/ibft/core/prepare.go index 20047e89f0..583fc05baa 100644 --- a/consensus/istanbul/ibft/core/prepare.go +++ b/consensus/istanbul/ibft/core/prepare.go @@ -18,7 +18,7 @@ package core import ( "reflect" - + "fmt" "github.com/ethereum/go-ethereum/consensus/istanbul" istanbulcommon "github.com/ethereum/go-ethereum/consensus/istanbul/common" ibfttypes "github.com/ethereum/go-ethereum/consensus/istanbul/ibft/types" @@ -26,13 +26,13 @@ import ( func (c *core) sendPrepare() { logger := c.logger.New("state", c.state) - sub := c.current.Subject() encodedSubject, err := ibfttypes.Encode(sub) if err != nil { logger.Error("Failed to encode", "subject", sub) return } + logger.Debug(fmt.Sprintf("=====>Broadcast Prepare, address: %v", c.Address())) c.broadcast(&ibfttypes.Message{ Code: ibfttypes.MsgPrepare, Msg: encodedSubject, @@ -63,6 +63,7 @@ func (c *core) handlePrepare(msg *ibfttypes.Message, src istanbul.Validator) err // and we are in earlier state before Prepared state. if ((c.current.IsHashLocked() && prepare.Digest == c.current.GetLockedHash()) || c.current.GetPrepareOrCommitSize() >= c.QuorumSize()) && c.state.Cmp(ibfttypes.StatePrepared) < 0 { + c.logger.Debug(fmt.Sprintf("=====>Prepared, due to 2f+1 prepare or commit msgs, address: %v", c.Address())) c.current.LockHash() c.setState(ibfttypes.StatePrepared) c.sendCommit() diff --git a/consensus/istanbul/ibft/core/preprepare.go b/consensus/istanbul/ibft/core/preprepare.go index 487c5abf59..3d7dd1dd65 100644 --- a/consensus/istanbul/ibft/core/preprepare.go +++ b/consensus/istanbul/ibft/core/preprepare.go @@ -18,7 +18,7 @@ package core import ( "time" - + "fmt" "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/consensus/istanbul" istanbulcommon "github.com/ethereum/go-ethereum/consensus/istanbul/common" @@ -38,6 +38,7 @@ func (c *core) sendPreprepare(request *istanbul.Request) { logger.Error("Failed to encode", "view", curView) return } + logger.Debug(fmt.Sprintf("=====> Broadcast preprepare, address: %v", c.Address())) c.broadcast(&ibfttypes.Message{ Code: ibfttypes.MsgPreprepare, Msg: preprepare, @@ -105,17 +106,20 @@ func (c *core) handlePreprepare(msg *ibfttypes.Message, src istanbul.Validator) if c.current.IsHashLocked() { if preprepare.Proposal.Hash() == c.current.GetLockedHash() { // Broadcast COMMIT and enters Prepared state directly + logger.Debug(fmt.Sprintf("=====> Prepared, preprepare proposal == locked hash, address: %v, hash: %v", c.Address(), c.current.Proposal())) c.acceptPreprepare(preprepare) c.setState(ibfttypes.StatePrepared) c.sendCommit() } else { // Send round change + logger.Info(fmt.Sprintf("====>Pre-prepare: proposed hash not matching current locked hash. round - %v, seq - %v", c.current.Round(), c.current.Sequence())) c.sendNextRoundChange() } } else { // Either // 1. the locked proposal and the received proposal match // 2. we have no locked proposal + logger.Debug(fmt.Sprintf("=====> Prepared, no locked proposal, address: %v", c.Address())) c.acceptPreprepare(preprepare) c.setState(ibfttypes.StatePreprepared) c.sendPrepare() diff --git a/consensus/istanbul/ibft/core/roundchange.go b/consensus/istanbul/ibft/core/roundchange.go index 7379afa229..422459cd96 100644 --- a/consensus/istanbul/ibft/core/roundchange.go +++ b/consensus/istanbul/ibft/core/roundchange.go @@ -17,6 +17,7 @@ package core import ( + "fmt" "math/big" "sync" @@ -92,6 +93,7 @@ func (c *core) handleRoundChange(msg *ibfttypes.Message, src istanbul.Validator) return err } + logger.Debug(fmt.Sprintf("=====> Handling round change msg, current round: %v, current sequence: %v, total number of round change msg for the round %v, sequence %v, is %v, waiting for round change? %v, current F() is %v", cv.Round, cv.Sequence, roundView.Round, roundView.Sequence, num, c.waitingForRoundChange, c.valSet.F())) // Once we received f+1 ROUND CHANGE messages, those messages form a weak certificate. // If our round number is smaller than the certificate's round number, we would // try to catch up the round number. diff --git a/console/console.go b/console/console.go index d28b781da2..732d31e5fd 100644 --- a/console/console.go +++ b/console/console.go @@ -17,7 +17,6 @@ package console import ( - "context" "fmt" "io" "io/ioutil" @@ -354,26 +353,19 @@ func (c *Console) Welcome() { // Get the consensus mechanism that is in use func (c *Console) getConsensus() string { - - var nodeInfo struct { - Protocols struct { - Eth struct { // only partial of eth/handler.go#NodeInfo - Consensus string - } - Istanbul struct { // a bit different from others - Consensus string - } + if apis, err := c.client.SupportedModules(); err == nil { + _, raft := apis["raft"] + if raft { + return "raft" } + _, ibft := apis["istanbul"] + if ibft { + return "istanbul" + } + return "ethhash" } - - if err := c.client.CallContext(context.Background(), &nodeInfo, "admin_nodeInfo"); err != nil { - _, _ = fmt.Fprintf(c.printer, "WARNING: call to admin.getNodeInfo() failed, unable to determine consensus mechanism\n") - return "unknown" - } - if nodeInfo.Protocols.Istanbul.Consensus != "" { - return nodeInfo.Protocols.Istanbul.Consensus - } - return nodeInfo.Protocols.Eth.Consensus + _, _ = fmt.Fprintf(c.printer, "WARNING: call to rpc_modules() failed, unable to determine consensus mechanism\n") + return "unknown" } // Evaluate executes code and pretty prints the result to the specified output diff --git a/core/state_transition.go b/core/state_transition.go index 408d3ad431..4e0dca61e6 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -365,7 +365,6 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { ReturnData: nil, }, nil } - ret, leftoverGas, vmerr = evm.Call(sender, to, data, st.gas, st.value) } if vmerr != nil { diff --git a/core/tx_pool.go b/core/tx_pool.go index 52fada9dac..6e019bda9a 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -895,6 +895,7 @@ func (pool *TxPool) addTxs(txs []*types.Transaction, local, sync bool) []error { errs[nilSlot] = err nilSlot++ } + log.Trace("Filtered transactions with errors", "count", len(errs)) // Reorg the pool internals if needed and return done := pool.requestPromoteExecutables(dirtyAddrs) if sync { diff --git a/eth/protocols/eth/handshake.go b/eth/protocols/eth/handshake.go index 2898f2e242..9d1fe18a7e 100644 --- a/eth/protocols/eth/handshake.go +++ b/eth/protocols/eth/handshake.go @@ -69,7 +69,7 @@ func (p *Peer) Handshake(network uint64, td *big.Int, head common.Hash, genesis // TD at mainnet block #7753254 is 76 bits. If it becomes 100 million times // larger, it will still fit within 100 bits - if tdlen := p.td.BitLen(); tdlen > 100 { + if tdlen := p.td.BitLen(); tdlen > 200 { return fmt.Errorf("too large total difficulty: bitlen %d", tdlen) } return nil diff --git a/go.mod b/go.mod index 1e8a3a4041..45ce973b1d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ethereum/go-ethereum -go 1.15 +go 1.19 // Quorum - Replace Go modules that use modifications done by us replace github.com/coreos/etcd => github.com/Consensys/etcd v3.3.13-quorum197+incompatible @@ -9,10 +9,8 @@ replace github.com/coreos/etcd => github.com/Consensys/etcd v3.3.13-quorum197+in require ( github.com/Azure/azure-storage-blob-go v0.7.0 - github.com/Azure/go-autorest/autorest/adal v0.9.21 // indirect github.com/BurntSushi/toml v0.3.1 github.com/ConsenSys/quorum-qlight-token-manager-plugin-sdk-go v0.0.0-20220427130631-ecd75caa6e73 - github.com/StackExchange/wmi v1.2.1 // indirect github.com/VictoriaMetrics/fastcache v1.5.7 github.com/aws/aws-sdk-go-v2 v1.2.0 github.com/aws/aws-sdk-go-v2/config v1.1.1 @@ -23,23 +21,16 @@ require ( github.com/cloudflare/cloudflare-go v0.14.0 github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f github.com/coreos/etcd v3.3.20+incompatible - github.com/coreos/go-semver v0.3.0 // indirect - github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect - github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect github.com/davecgh/go-spew v1.1.1 github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea - github.com/dlclark/regexp2 v1.7.0 // indirect github.com/docker/docker v20.10.12+incompatible github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498 github.com/eapache/channels v1.1.0 - github.com/eapache/queue v1.1.0 // indirect github.com/edsrzf/mmap-go v1.0.0 github.com/fatih/color v1.7.0 github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff - github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-stack/stack v1.8.1 - github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.2 github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 @@ -61,14 +52,10 @@ require ( github.com/jpmorganchase/quorum-security-plugin-sdk-go v0.0.0-20200714173835-22a319bb78ce github.com/julienschmidt/httprouter v1.2.0 github.com/karalabe/usb v0.0.2 - github.com/kylelemons/godebug v1.1.0 // indirect github.com/mattn/go-colorable v0.1.4 github.com/mattn/go-isatty v0.0.14 - github.com/mitchellh/go-testing-interface v1.0.0 // indirect - github.com/naoina/go-stringutil v0.1.0 // indirect github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416 github.com/olekukonko/tablewriter v0.0.5 - github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222 github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 @@ -81,11 +68,10 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef - github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa golang.org/x/sync v0.0.0-20210220032951-036812b2e83c - golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 - golang.org/x/text v0.3.7 + golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f + golang.org/x/text v0.3.8 golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 google.golang.org/grpc v1.46.0 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c @@ -94,6 +80,51 @@ require ( gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6 gopkg.in/oleiade/lane.v1 v1.0.0 gopkg.in/urfave/cli.v1 v1.20.0 +) + +require ( + github.com/Azure/azure-pipeline-go v0.2.1 // indirect + github.com/Azure/go-autorest/autorest/adal v0.9.21 // indirect + github.com/StackExchange/wmi v1.2.1 // 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/beorn7/perks v1.0.0 // indirect + github.com/cespare/xxhash/v2 v2.1.1 // indirect + github.com/coreos/go-semver v0.3.0 // indirect + github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect + github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect + github.com/dlclark/regexp2 v1.7.0 // indirect + github.com/eapache/queue v1.1.0 // indirect + github.com/go-ole/go-ole v1.2.5 // indirect + github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect + github.com/kr/pretty v0.2.1 // indirect + github.com/kr/text v0.1.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/mitchellh/go-testing-interface v1.0.0 // indirect + github.com/naoina/go-stringutil v0.1.0 // indirect + github.com/oklog/run v1.0.0 // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_golang v1.0.0 // indirect + github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 // indirect + github.com/prometheus/common v0.6.0 // indirect + github.com/prometheus/procfs v0.0.2 // indirect + github.com/stretchr/objx v0.1.1 // indirect + github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect + golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect + google.golang.org/genproto v0.0.0-20220426171045-31bebdecfb46 // indirect + google.golang.org/protobuf v1.28.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect gotest.tools/v3 v3.1.0 // indirect ) diff --git a/go.sum b/go.sum index 13f1803377..2d5cfe18f0 100644 --- a/go.sum +++ b/go.sum @@ -28,7 +28,6 @@ github.com/Azure/go-autorest/autorest/adal v0.9.21 h1:jjQnVFXPfekaqb8vIsv2G1lxsh github.com/Azure/go-autorest/autorest/adal v0.9.21/go.mod h1:zua7mBUaCc5YnSLKYgGJR/w5ePdMDA6H56upLsHzA9U= github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw= github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= -github.com/Azure/go-autorest/autorest/mocks v0.4.1 h1:K0laFcLE6VLTOwNgSxaGbUcLPuGXlNkbVvq4cW4nIHk= github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg= github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= @@ -92,7 +91,6 @@ github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOC 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= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -580,8 +578,9 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc 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-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc= golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -592,8 +591,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= 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-20201208040808-7e3f01d25324 h1:Hir2P/De0WpUhtrKGGjvSb2YxUgyZ7EFOSLIcSSpiwE= diff --git a/raft/minter.go b/raft/minter.go index bdddedf854..691aa56a44 100644 --- a/raft/minter.go +++ b/raft/minter.go @@ -18,6 +18,7 @@ package raft import ( "fmt" + "math/big" "sync" "sync/atomic" "time" @@ -226,9 +227,9 @@ func throttle(rate time.Duration, f func()) func() { // This function spins continuously, blocking until a block should be created // (via requestMinting()). This is throttled by `minter.blockTime`: // -// 1. A block is guaranteed to be minted within `blockTime` of being -// requested. -// 2. We never mint a block more frequently than `blockTime`. +// 1. A block is guaranteed to be minted within `blockTime` of being +// requested. +// 2. We never mint a block more frequently than `blockTime`. func (minter *minter) mintingLoop() { throttledMintNewBlock := throttle(minter.blockTime, func() { if atomic.LoadInt32(&minter.minting) == 1 { @@ -272,7 +273,7 @@ func (minter *minter) createWork() *work { header := &types.Header{ ParentHash: parent.Hash(), Number: newBlockNumber, - Difficulty: ethash.CalcDifficulty(minter.config, uint64(tstamp), parent.Header()), + Difficulty: big.NewInt(1), GasLimit: minter.eth.calcGasLimitFunc(parent), GasUsed: 0, Coinbase: coinbase, diff --git a/raft/wal.go b/raft/wal.go index ca04d99472..31b0721a7e 100644 --- a/raft/wal.go +++ b/raft/wal.go @@ -1,8 +1,6 @@ package raft import ( - "os" - "github.com/coreos/etcd/raft/raftpb" "github.com/coreos/etcd/wal" "github.com/coreos/etcd/wal/walpb" @@ -11,9 +9,18 @@ import ( func (pm *ProtocolManager) openWAL(maybeRaftSnapshot *raftpb.Snapshot) *wal.WAL { if !wal.Exist(pm.waldir) { - if err := os.Mkdir(pm.waldir, 0750); err != nil { - fatalf("cannot create waldir: %s", err) - } + // On a CIFS filesytem we need to use the 'wal_windows' implementation in the + // version of Raft included in Quorum. This performs a rename of raft-wal.tmp + // to raft-wal as art of wal.Create() + // As of Go 1.8, in UNIX/Docker you cannot rename a directory to replace a directory + // see - https://golang.org/doc/go1.8 + // + // As such, we do not create the waldir in the Quorum layer, but rather leave + // it to the wal code itself to create it. + // + // if err := os.Mkdir(pm.waldir, 0750); err != nil { + // fatalf("cannot create waldir: %s", err) + // } wal, err := wal.Create(pm.waldir, nil) if err != nil {