From c25007a4cc2477610a8c30c122c580ea7ac91369 Mon Sep 17 00:00:00 2001 From: ucwong Date: Wed, 9 Aug 2023 04:52:55 +0800 Subject: [PATCH 1/7] Mercury ver upgrade --- consensus/cuckoo/consensus.go | 24 ++++++++++++++++++---- consensus/cuckoo/consensus_test.go | 10 +++++----- consensus/cuckoo/sealer.go | 2 +- core/cvm.go | 11 ++++++++++ core/types/block.go | 8 ++++++++ core/vm/interpreter.go | 2 ++ core/vm/jump_table.go | 10 +++++++++- params/config.go | 32 ++++++++++++++++++++++-------- params/protocol_params.go | 2 ++ 9 files changed, 82 insertions(+), 19 deletions(-) diff --git a/consensus/cuckoo/consensus.go b/consensus/cuckoo/consensus.go index aac4dcc888..933d94d8ff 100644 --- a/consensus/cuckoo/consensus.go +++ b/consensus/cuckoo/consensus.go @@ -19,7 +19,7 @@ package cuckoo import ( "encoding/binary" // "encoding/hex" - // "bytes" + "bytes" "errors" "fmt" "math/big" @@ -278,7 +278,8 @@ func (cuckoo *Cuckoo) verifyHeader(chain consensus.ChainHeaderReader, header, pa return fmt.Errorf("invalid gasUsed: have %d, gasLimit %d", header.GasUsed, header.GasLimit) } - validate := checkGasLimit(parent.GasUsed, parent.GasLimit, header.GasLimit) + //validate := checkGasLimit(parent.GasUsed, parent.GasLimit, header.GasLimit, chain.Config(), header.Number) + validate := gasCheck(chain, parent, header) if !validate { return fmt.Errorf("invalid gas limit trend: have %d, want %d used %d", header.GasLimit, parent.GasLimit, parent.GasUsed) } @@ -369,7 +370,10 @@ func CalcDifficulty(config *params.ChainConfig, time uint64, parent *types.Heade } // important add gas limit to consensus -func checkGasLimit(gasUsed, gasLimit, currentGasLimit uint64) bool { +func gasCheck(chain consensus.ChainHeaderReader, parent, header *types.Header) bool { + return checkGasLimit(parent.GasUsed, parent.GasLimit, header.GasLimit, chain.Config(), header.Number) +} +func checkGasLimit(gasUsed, gasLimit, currentGasLimit uint64, config *params.ChainConfig, num *big.Int) bool { contrib := (gasUsed + gasUsed/2) / params.GasLimitBoundDivisor decay := gasLimit/params.GasLimitBoundDivisor - 1 @@ -391,7 +395,10 @@ func checkGasLimit(gasUsed, gasLimit, currentGasLimit uint64) bool { } } - // TODO + if config != nil && config.IsMercury(num) { + return limit <= currentGasLimit + } + return limit == currentGasLimit } @@ -677,6 +684,15 @@ func (cuckoo *Cuckoo) VerifySeal(chain consensus.ChainHeaderReader, header *type return errInvalidDifficulty } + // Verify the calculated values against the ones provided in the header + if chain.Config().IsMercury(header.Number) { + log.Trace("Mix digest verify", "number", header.Number, "mix", header.Solution.Hash(), "header", header.MixDigest) + digest := header.Solution.Hash().Bytes() + if !bytes.Equal(header.MixDigest[:], digest) { + return errInvalidMixDigest + } + } + var ( result = header.Solution nonce uint64 = uint64(header.Nonce.Uint64()) diff --git a/consensus/cuckoo/consensus_test.go b/consensus/cuckoo/consensus_test.go index cdce422c8c..94e3126eaf 100644 --- a/consensus/cuckoo/consensus_test.go +++ b/consensus/cuckoo/consensus_test.go @@ -71,23 +71,23 @@ func randSlice(min, max uint32) []byte { } func TestGasLimitCheck(t *testing.T) { - if validate := checkGasLimit(0, 7992189, 8000000); !validate { + if validate := checkGasLimit(0, 7992189, 8000000, nil, nil); !validate { t.Fatalf("failed") } - if validate := checkGasLimit(7992189, 7992189, 8000000); !validate { + if validate := checkGasLimit(7992189, 7992189, 8000000, nil, nil); !validate { t.Fatalf("failed") } - if validate := checkGasLimit(0, 8000000, 7992189); validate { + if validate := checkGasLimit(0, 8000000, 7992189, nil, nil); validate { t.Fatalf("failed") } - if validate := checkGasLimit(7980000, 8000000, 8003878); !validate { + if validate := checkGasLimit(7980000, 8000000, 8003878, nil, nil); !validate { t.Fatalf("failed") } - if validate := checkGasLimit(7980000, 8000000, 8003879); validate { + if validate := checkGasLimit(7980000, 8000000, 8003879, nil, nil); validate { t.Fatalf("failed") } } diff --git a/consensus/cuckoo/sealer.go b/consensus/cuckoo/sealer.go index 55d7378aca..c154cb291f 100644 --- a/consensus/cuckoo/sealer.go +++ b/consensus/cuckoo/sealer.go @@ -207,7 +207,7 @@ func (cuckoo *Cuckoo) remote() { // Verify the correctness of submitted result. header := block.Header() header.Nonce = nonce - //header.MixDigest = mixDigest + header.MixDigest = sol.Hash() header.Solution = sol if err := cuckoo.VerifySeal(nil, header); err != nil { log.Warn("Invalid proof-of-work submitted", "hash", hash, "err", err) diff --git a/core/cvm.go b/core/cvm.go index 7097b79a7f..8e93852a10 100644 --- a/core/cvm.go +++ b/core/cvm.go @@ -24,6 +24,7 @@ import ( "github.com/CortexFoundation/CortexTheseus/core/types" "github.com/CortexFoundation/CortexTheseus/core/vm" "github.com/CortexFoundation/CortexTheseus/log" + "github.com/CortexFoundation/CortexTheseus/params" ) // ChainContext supports retrieving headers and consensus parameters from the @@ -48,9 +49,19 @@ func NewCVMBlockContext(header *types.Header, chain ChainContext, author *common } else { beneficiary = *author } + + log.Info("Random", "number", header.Number, "mix", header.MixDigest, "parent", header.ParentHash, "mercury", params.MERCURY_MAINNET) + + // TODO auto invoked by PoS (IsMerge Version) op random, set when mining work commit, it will not happen by PoW if header.Difficulty.Cmp(common.Big0) == 0 { random = &header.MixDigest + } else { + // TODO fake random only for random op pass, used carefully, check block number + if params.MERCURY_MAINNET != nil && header.Number.Cmp(params.MERCURY_MAINNET) >= 0 { + random = &header.ParentHash + } } + return vm.BlockContext{ CanTransfer: CanTransfer, Transfer: Transfer, diff --git a/core/types/block.go b/core/types/block.go index dd1184b664..81345c2cbd 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -63,6 +63,14 @@ func (n *BlockNonce) UnmarshalText(input []byte) error { return hexutil.UnmarshalFixedText("BlockNonce", input, n[:]) } +func (s *BlockSolution) Hash() common.Hash { + b, e := s.MarshalText() + if e != nil { + return common.EmptyHash + } + return common.BytesToHash(b) +} + func (s *BlockSolution) Uint32() []uint32 { return s[:] } func (s *BlockSolution) MarshalText() ([]byte, error) { diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 7058dfb69d..aae74741f7 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -89,6 +89,8 @@ func NewCVMInterpreter(cvm *CVM) *CVMInterpreter { // If jump table was not initialised we set the default one. var table *JumpTable switch { + case cvm.chainRules.IsMercury: + table = &mercuryInstructionSet case cvm.chainRules.IsMerge: table = &mergeInstructionSet case cvm.chainRules.IsNeo: diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index 315392dd03..6ee5cfbe9f 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -53,6 +53,8 @@ var ( neoInstructionSet = newNeoInstructionSet() mergeInstructionSet = newMergeInstructionSet() + + mercuryInstructionSet = newMercuryInstructionSet() ) // JumpTable contains the CVM opcodes supported at a given fork. @@ -67,6 +69,13 @@ func validate(jt JumpTable) JumpTable { return jt } +func newMercuryInstructionSet() JumpTable { + instructionSet := newMergeInstructionSet() + enable5656(&instructionSet) // EIP-5656 (MCOPY opcode) + + return validate(instructionSet) +} + func newMergeInstructionSet() JumpTable { instructionSet := newNeoInstructionSet() instructionSet[RANDOM] = &operation{ @@ -74,7 +83,6 @@ func newMergeInstructionSet() JumpTable { gasCost: constGasFunc(GasQuickStep), validateStack: makeStackFunc(0, 1), } - enable5656(&instructionSet) // EIP-5656 (MCOPY opcode) return validate(instructionSet) } diff --git a/params/config.go b/params/config.go index 2bd1c85d48..fa09e0542e 100644 --- a/params/config.go +++ b/params/config.go @@ -131,6 +131,7 @@ var ( PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(3_230_000), NeoBlock: big.NewInt(4_650_000), + MercuryBlock: MERCURY_MAINNET, TerminalTotalDifficulty: nil, TerminalTotalDifficultyPassed: false, Cuckoo: new(CuckooConfig), @@ -151,6 +152,7 @@ var ( PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), NeoBlock: big.NewInt(5_000_000), + MercuryBlock: nil, TerminalTotalDifficulty: nil, TerminalTotalDifficultyPassed: false, Clique: &CliqueConfig{ @@ -174,6 +176,7 @@ var ( PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), NeoBlock: big.NewInt(0), + MercuryBlock: nil, TerminalTotalDifficulty: nil, TerminalTotalDifficultyPassed: false, Cuckoo: new(CuckooConfig), @@ -194,6 +197,7 @@ var ( PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), NeoBlock: big.NewInt(0), + MercuryBlock: nil, TerminalTotalDifficulty: nil, TerminalTotalDifficultyPassed: false, Clique: &CliqueConfig{ @@ -221,6 +225,7 @@ var ( PetersburgBlock: big.NewInt(0), IstanbulBlock: nil, NeoBlock: nil, + MercuryBlock: nil, TerminalTotalDifficulty: nil, TerminalTotalDifficultyPassed: false, Cuckoo: new(CuckooConfig), @@ -231,9 +236,9 @@ var ( // // This configuration is intentionally not using keyed fields to force anyone // adding flags to the config to also have to set these fields. - AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, false, nil, &CliqueConfig{Period: 0, Epoch: 30000}} + AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, nil, false, nil, &CliqueConfig{Period: 0, Epoch: 30000}} - TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, false, new(CuckooConfig), nil} + TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, nil, false, new(CuckooConfig), nil} TestRules = TestChainConfig.Rules(new(big.Int), false, 0) ) @@ -269,6 +274,7 @@ type ChainConfig struct { PetersburgBlock *big.Int `json:"petersburgBlock,omitempty"` // Petersburg switch block (nil = same as Constantinople) IstanbulBlock *big.Int `json:"istanbulBlock,omitempty"` // Istanbul switch block (nil = no fork, 0 = already on istanbul) NeoBlock *big.Int `json:"neoBlock,omitempty"` + MercuryBlock *big.Int `json:"mercuryBlock,omitempty"` // TerminalTotalDifficulty is the amount of total difficulty reached by // the network that triggers the consensus upgrade. TerminalTotalDifficulty *big.Int `json:"terminalTotalDifficulty,omitempty"` @@ -311,7 +317,7 @@ func (c *ChainConfig) String() string { default: engine = "unknown" } - return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v TangerineWhistle(EIP150): %v SpuriousDragon(EIP155): %v SpuriousDragon(EIP158): %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v Neo:%v Engine: %v}", + return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v TangerineWhistle(EIP150): %v SpuriousDragon(EIP155): %v SpuriousDragon(EIP158): %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v Neo:%v Mercury:%v Engine: %v}", c.ChainID, c.HomesteadBlock, c.DAOForkBlock, @@ -324,6 +330,7 @@ func (c *ChainConfig) String() string { c.PetersburgBlock, c.IstanbulBlock, c.NeoBlock, + c.MercuryBlock, engine, ) } @@ -378,6 +385,10 @@ func (c *ChainConfig) IsNeo(num *big.Int) bool { return isForked(c.NeoBlock, num) } +func (c *ChainConfig) IsMercury(num *big.Int) bool { + return isForked(c.MercuryBlock, num) +} + // IsTerminalPoWBlock returns whether the given block is the last block of PoW stage. func (c *ChainConfig) IsTerminalPoWBlock(parentTotalDiff *big.Int, totalDiff *big.Int) bool { if c.TerminalTotalDifficulty == nil { @@ -442,6 +453,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error { {name: "petersburgBlock", block: c.PetersburgBlock}, {name: "istanbulBlock", block: c.IstanbulBlock}, {name: "neoBlock", block: c.NeoBlock}, + {name: "mercuryBlock", block: c.MercuryBlock}, } { if lastFork.name != "" { // Next one must be higher number @@ -505,6 +517,10 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi if isForkIncompatible(c.NeoBlock, newcfg.NeoBlock, head) { return newCompatError("Neo fork block", c.NeoBlock, newcfg.NeoBlock) } + + if isForkIncompatible(c.MercuryBlock, newcfg.MercuryBlock, head) { + return newCompatError("Mercury fork block", c.MercuryBlock, newcfg.MercuryBlock) + } return nil } @@ -622,10 +638,10 @@ func (err *ConfigCompatError) Error() string { // Rules is a one time interface meaning that it shouldn't be used in between transition // phases. type Rules struct { - ChainID *big.Int - IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool - IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul, IsNeo bool - IsMerge bool + ChainID *big.Int + IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool + IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul, IsNeo, IsMercury bool + IsMerge bool } // Rules ensures c's ChainID is not nil. @@ -634,7 +650,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules if chainID == nil { chainID = new(big.Int) } - return Rules{ChainID: new(big.Int).Set(chainID), IsHomestead: c.IsHomestead(num), IsEIP150: c.IsEIP150(num), IsEIP155: c.IsEIP155(num), IsEIP158: c.IsEIP158(num), IsByzantium: c.IsByzantium(num), IsPetersburg: c.IsPetersburg(num), IsIstanbul: c.IsIstanbul(num), IsNeo: c.IsNeo(num), IsMerge: isMerge} + return Rules{ChainID: new(big.Int).Set(chainID), IsHomestead: c.IsHomestead(num), IsEIP150: c.IsEIP150(num), IsEIP155: c.IsEIP155(num), IsEIP158: c.IsEIP158(num), IsByzantium: c.IsByzantium(num), IsPetersburg: c.IsPetersburg(num), IsIstanbul: c.IsIstanbul(num), IsNeo: c.IsNeo(num), IsMercury: c.IsMercury(num), IsMerge: isMerge} } // Get Mature Block diff --git a/params/protocol_params.go b/params/protocol_params.go index 7cd9efcdf7..a4684a318b 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -190,6 +190,8 @@ var ( CTXC_F1 = big.NewInt(0).Mul(big.NewInt(20_486_540), big.NewInt(1000000000000000000)) CTXC_F2 = big.NewInt(0).Mul(big.NewInt(21_285_544), big.NewInt(1000000000000000000)) + + MERCURY_MAINNET *big.Int = nil //big.NewInt(0) ) const ( From 516119a9ae08c1300e0e10ded0b93e5303a31fae Mon Sep 17 00:00:00 2001 From: ucwong Date: Wed, 9 Aug 2023 14:52:20 +0800 Subject: [PATCH 2/7] fix --- core/cvm.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/cvm.go b/core/cvm.go index 8e93852a10..938be6ffe1 100644 --- a/core/cvm.go +++ b/core/cvm.go @@ -50,7 +50,7 @@ func NewCVMBlockContext(header *types.Header, chain ChainContext, author *common beneficiary = *author } - log.Info("Random", "number", header.Number, "mix", header.MixDigest, "parent", header.ParentHash, "mercury", params.MERCURY_MAINNET) + log.Trace("Random", "number", header.Number, "mix", header.MixDigest, "parent", header.ParentHash, "mercury", params.MERCURY_MAINNET) // TODO auto invoked by PoS (IsMerge Version) op random, set when mining work commit, it will not happen by PoW if header.Difficulty.Cmp(common.Big0) == 0 { From 9a7565671e52e666460afb0c7acda274fd298b8a Mon Sep 17 00:00:00 2001 From: ucwong Date: Fri, 11 Aug 2023 15:26:35 +0800 Subject: [PATCH 3/7] mix digest test added --- consensus/cuckoo/consensus_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/consensus/cuckoo/consensus_test.go b/consensus/cuckoo/consensus_test.go index 94e3126eaf..0c2ca9aa38 100644 --- a/consensus/cuckoo/consensus_test.go +++ b/consensus/cuckoo/consensus_test.go @@ -1,6 +1,7 @@ package cuckoo import ( + "bytes" "encoding/binary" "math/big" "math/rand" @@ -91,3 +92,13 @@ func TestGasLimitCheck(t *testing.T) { t.Fatalf("failed") } } + +func TestMixDigest(t *testing.T) { + sol := &types.BlockSolution{36552774, 57703112, 69439022, 71282429, 117293109, 186862362, 271815245, 283711993, 301666096, 321610391, 345111432, 376920806, 469608283, 480776867, 488279241, 490162501, 496690146, 516943318, 548320772, 575755973, 584516346, 590932588, 594672482, 596315856, 611820183, 626014278, 668956240, 724642732, 737723908, 761956873, 772529653, 781328833, 782613854, 804339063, 838293864, 852149620, 875286932, 888462575, 905024013, 993378264, 1039286741, 1068794681} + mix := sol.Hash() + + t.Log("sol:", sol, "mix:", mix) + if !bytes.Equal(mix[:], sol.Hash().Bytes()) { + t.Fatalf("failed") + } +} From 5b05dd4df01e9ca5be1ef5a8f141d6c975d3297b Mon Sep 17 00:00:00 2001 From: ucwong Date: Sat, 16 Sep 2023 15:23:55 +0800 Subject: [PATCH 4/7] latest sync --- go.mod | 12 ++--- go.sum | 24 ++++----- .../anacrolix/torrent/metainfo/metainfo.go | 5 +- .../cockroachdb/pebble/vfs/mem_fs.go | 49 +++++++++++++++++-- vendor/github.com/nutsdb/nutsdb/db.go | 9 ++-- .../github.com/ucwong/filecache/filecache.go | 5 +- vendor/modules.txt | 14 +++--- 7 files changed, 84 insertions(+), 34 deletions(-) diff --git a/go.mod b/go.mod index ecad10d893..b54cdf3aef 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.4.1 github.com/CortexFoundation/inference v1.0.2-0.20230307032835-9197d586a4e8 github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66 - github.com/CortexFoundation/torrentfs v1.0.54-0.20230915085716-6cbd302e0627 + github.com/CortexFoundation/torrentfs v1.0.54-0.20230916065909-9be746583ead github.com/VictoriaMetrics/fastcache v1.12.1 github.com/arsham/figurine v1.3.0 github.com/aws/aws-sdk-go-v2 v1.19.0 @@ -17,7 +17,7 @@ require ( github.com/cespare/cp v1.1.1 github.com/charmbracelet/bubbletea v0.24.2 github.com/cloudflare/cloudflare-go v0.57.1 - github.com/cockroachdb/pebble v0.0.0-20230915084130-336c99798a6d + github.com/cockroachdb/pebble v0.0.0-20230915152238-6d6570bf1e25 github.com/consensys/gnark-crypto v0.11.1 github.com/crate-crypto/go-kzg-4844 v0.3.0 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc @@ -101,7 +101,7 @@ require ( github.com/anacrolix/multiless v0.3.1-0.20221221005021-2d12701f83f7 // indirect github.com/anacrolix/stm v0.5.0 // indirect github.com/anacrolix/sync v0.4.0 // indirect - github.com/anacrolix/torrent v1.52.6-0.20230914125831-4fb12d06b31b // indirect + github.com/anacrolix/torrent v1.52.6-0.20230916034836-b84b19cc4c45 // indirect github.com/anacrolix/upnp v0.1.3-0.20220123035249-922794e51c96 // indirect github.com/anacrolix/utp v0.2.0 // indirect github.com/antlabs/stl v0.0.1 // indirect @@ -178,7 +178,7 @@ require ( github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/naoina/go-stringutil v0.1.0 // indirect - github.com/nutsdb/nutsdb v0.14.1-0.20230907051708-51c9f276ec7b // indirect + github.com/nutsdb/nutsdb v0.14.1-0.20230915093218-a1a81e6a48a8 // indirect github.com/otiai10/copy v1.12.0 // indirect github.com/pion/datachannel v1.5.5 // indirect github.com/pion/dtls/v2 v2.2.7 // indirect @@ -217,9 +217,9 @@ require ( github.com/tidwall/hashmap v1.8.1 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.1 // indirect - github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd // indirect + github.com/ucwong/filecache v1.0.6-0.20230916065457-63847b20001a // indirect github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb // indirect - github.com/ucwong/golang-kv v1.0.23-0.20230915085246-c67539220a59 // indirect + github.com/ucwong/golang-kv v1.0.23-0.20230916064351-555db8b6f0e1 // indirect github.com/ucwong/shard v1.0.1-0.20230902205521-676c0c9c1dd2 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect github.com/xujiajun/mmap-go v1.0.1 // indirect diff --git a/go.sum b/go.sum index 4ff53ab80d..b65d92cad3 100644 --- a/go.sum +++ b/go.sum @@ -67,8 +67,8 @@ github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66/go.mod h1: github.com/CortexFoundation/torrentfs v1.0.13-0.20200623060705-ce027f43f2f8/go.mod h1:Ma+tGhPPvz4CEZHaqEJQMOEGOfHeQBiAoNd1zyc/w3Q= github.com/CortexFoundation/torrentfs v1.0.14-0.20200703071639-3fcabcabf274/go.mod h1:qnb3YlIJmuetVBtC6Lsejr0Xru+1DNmDCdTqnwy7lhk= github.com/CortexFoundation/torrentfs v1.0.20-0.20200810031954-d36d26f82fcc/go.mod h1:N5BsicP5ynjXIi/Npl/SRzlJ630n1PJV2sRj0Z0t2HA= -github.com/CortexFoundation/torrentfs v1.0.54-0.20230915085716-6cbd302e0627 h1:vULTDqs/5d2WC1A9EkFQw6ajDGWZ1GE2r914eMWIj2w= -github.com/CortexFoundation/torrentfs v1.0.54-0.20230915085716-6cbd302e0627/go.mod h1:Y6GlMai90VF/Ql47VA3Ko3eUHiXq7XNwrVFCv/btoVs= +github.com/CortexFoundation/torrentfs v1.0.54-0.20230916065909-9be746583ead h1:Em6LOwIDEYxE/CJjOf5CJCgvRLqbIOxBSyzHbLgki6c= +github.com/CortexFoundation/torrentfs v1.0.54-0.20230916065909-9be746583ead/go.mod h1:o1dBuhnsPWEhooQMnGEw2jOwnPqAT5zFtyT0FkAnbpA= github.com/CortexFoundation/wormhole v0.0.0-20230908085523-44aea02f16f8 h1:Cvtqm62iaQx0KBC2ZuEseIsuBh3v1BvIpcHvwIe4yq8= github.com/CortexFoundation/wormhole v0.0.0-20230908085523-44aea02f16f8/go.mod h1:62dTMtfdf0W71ZfM7xDFJTFdzMfaKeYUrx7fB5/iQ1s= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= @@ -211,8 +211,8 @@ github.com/anacrolix/torrent v1.15.0/go.mod h1:MFc6KcbpAyfwGqOyRkdarUK9QnKA/FkVg github.com/anacrolix/torrent v1.15.1-0.20200504230043-cc5d2abe18e5/go.mod h1:QlOfgrCz5kbvhOz8M58dUwHY5SfZ9VbIvReZ0z0MdIk= github.com/anacrolix/torrent v1.15.1-0.20200619022403-dd51e99b88cc/go.mod h1:wuopQPC5+/M+zHYvhcA2vp5UCTm9rUc+VqjyBa882Q8= github.com/anacrolix/torrent v1.15.1-0.20200715061614-dd906f8fa72e/go.mod h1:XWo/fJN1oKgcjgxM+pUZpvalHfqHDs27BY5mBZjIQWo= -github.com/anacrolix/torrent v1.52.6-0.20230914125831-4fb12d06b31b h1:Asaf/ETwCIEIYya0+oX2ZCIhHsV6Zt77VGHCP82fchA= -github.com/anacrolix/torrent v1.52.6-0.20230914125831-4fb12d06b31b/go.mod h1:6lKyJNzkkY68p+LeSfv62auyyceWn12Uji+kme5cpaI= +github.com/anacrolix/torrent v1.52.6-0.20230916034836-b84b19cc4c45 h1:kdVm5twSlYXonHcLG17LC/D42UhPUDfLOm/F21kslmk= +github.com/anacrolix/torrent v1.52.6-0.20230916034836-b84b19cc4c45/go.mod h1:6lKyJNzkkY68p+LeSfv62auyyceWn12Uji+kme5cpaI= github.com/anacrolix/upnp v0.1.1/go.mod h1:LXsbsp5h+WGN7YR+0A7iVXm5BL1LYryDev1zuJMWYQo= github.com/anacrolix/upnp v0.1.2-0.20200416075019-5e9378ed1425/go.mod h1:Pz94W3kl8rf+wxH3IbCa9Sq+DTJr8OSbV2Q3/y51vYs= github.com/anacrolix/upnp v0.1.3-0.20220123035249-922794e51c96 h1:QAVZ3pN/J4/UziniAhJR2OZ9Ox5kOY2053tBbbqUPYA= @@ -348,8 +348,8 @@ github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+ github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v0.0.0-20230915084130-336c99798a6d h1:mjzaC4nhcXdT14czQqI4klj/+aExMh3g5pb1EQHbwys= -github.com/cockroachdb/pebble v0.0.0-20230915084130-336c99798a6d/go.mod h1:nindLFinxeDPjP4qI9LtVHAwDef57/0s5KMfWgdktQc= +github.com/cockroachdb/pebble v0.0.0-20230915152238-6d6570bf1e25 h1:3TmXZ906ySGZMwTAS0YWzP8hNg4gUIeDmXvu5gEU2PQ= +github.com/cockroachdb/pebble v0.0.0-20230915152238-6d6570bf1e25/go.mod h1:nindLFinxeDPjP4qI9LtVHAwDef57/0s5KMfWgdktQc= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= @@ -906,8 +906,8 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= 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/nutsdb/nutsdb v0.14.1-0.20230907051708-51c9f276ec7b h1:Cz94VoQgH9wij7+UTkB81JiYa6s807BrhRjg9OfRaUw= -github.com/nutsdb/nutsdb v0.14.1-0.20230907051708-51c9f276ec7b/go.mod h1:6inOji9rFBporXeHDjJny4g50RpQbkjSK5jI1hht0j8= +github.com/nutsdb/nutsdb v0.14.1-0.20230915093218-a1a81e6a48a8 h1:bxFzrNeR1wVipILPw2IHsuXulG3k79o9RNW+fsbYQSg= +github.com/nutsdb/nutsdb v0.14.1-0.20230915093218-a1a81e6a48a8/go.mod h1:6inOji9rFBporXeHDjJny4g50RpQbkjSK5jI1hht0j8= 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= @@ -1251,12 +1251,12 @@ github.com/ucwong/color v1.10.1-0.20200504093835-6ffe517dac74/go.mod h1:ctQ7afqe github.com/ucwong/color v1.10.1-0.20200518131954-915014f7ee11/go.mod h1:v1b0ANLmRpK9Q+qquVwSF2eELmmrF/IafbyK0UgrmEA= github.com/ucwong/color v1.10.1-0.20200624105241-fba1e010fe1e h1:HvK1iHNK69zvKCmoMPGt5SvCFf3BZ1LE7Yhi+1+t8v0= github.com/ucwong/color v1.10.1-0.20200624105241-fba1e010fe1e/go.mod h1:/b4wmbSWmKYSHQQC4tshp/xGngyZwSOrjkfWZ2XEMZU= -github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd h1:gBtlvLAsgLk+WcCXQ6K26u+POLm4oV0fiZ2UyBEQ0QU= -github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd/go.mod h1:ddwX+NCjMZPdpzcGh1fcEbNTUTCtKgt2hC2rqvmLKgA= +github.com/ucwong/filecache v1.0.6-0.20230916065457-63847b20001a h1:MkUqY4r4iTzEn4JwbGOmE04a6Wsgw54UOjR1AXFmpQ4= +github.com/ucwong/filecache v1.0.6-0.20230916065457-63847b20001a/go.mod h1:ddwX+NCjMZPdpzcGh1fcEbNTUTCtKgt2hC2rqvmLKgA= github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb h1:dVZH3AH9f7zB3VBmsjn25B7lfcAyMP4QxdFYTrfj7tg= github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb/go.mod h1:3yswsBsVuwsOjDvFfC5Na9XSEf4HC7mj3W3g6jvSY/s= -github.com/ucwong/golang-kv v1.0.23-0.20230915085246-c67539220a59 h1:fMcvIaopvpEZ07oc05KEzOruRT9eTx/oaZLd7i1HhqM= -github.com/ucwong/golang-kv v1.0.23-0.20230915085246-c67539220a59/go.mod h1:0jx7UE8mJhqH6YmhJ++055ctsw4TJIorapX049ps750= +github.com/ucwong/golang-kv v1.0.23-0.20230916064351-555db8b6f0e1 h1:ZHBPIPa+q/lpiH3tOz0Ak3BdU/lbq41rWZWzYxDMU74= +github.com/ucwong/golang-kv v1.0.23-0.20230916064351-555db8b6f0e1/go.mod h1:E+x62Cm9qBTpqfq7yehoYVWC1Hva9Q5WvU/+siyOa6k= github.com/ucwong/golang-set v1.8.1-0.20200419153428-d7b0b1ac2d43/go.mod h1:xu0FaiQFGbBcFZj2o7udZ5rbA8jRTsv47hkPoG5qQNM= github.com/ucwong/goleveldb v1.0.3-0.20200508074755-578cba616f37/go.mod h1:dgJUTtDxq/ne6/JzZhHzF24OL/uqILz9IWk8HmT4V2g= github.com/ucwong/goleveldb v1.0.3-0.20200618184106-f1c6bc3a428b/go.mod h1:7Sq6w7AfEZuB/a6mrlvHCSXCSkqojCMMrM3Ei12QAT0= diff --git a/vendor/github.com/anacrolix/torrent/metainfo/metainfo.go b/vendor/github.com/anacrolix/torrent/metainfo/metainfo.go index fbf48671d4..93f9103b96 100644 --- a/vendor/github.com/anacrolix/torrent/metainfo/metainfo.go +++ b/vendor/github.com/anacrolix/torrent/metainfo/metainfo.go @@ -1,6 +1,7 @@ package metainfo import ( + "bufio" "io" "net/url" "os" @@ -43,7 +44,9 @@ func LoadFromFile(filename string) (*MetaInfo, error) { return nil, err } defer f.Close() - return Load(f) + var buf bufio.Reader + buf.Reset(f) + return Load(&buf) } func (mi MetaInfo) UnmarshalInfo() (info Info, err error) { diff --git a/vendor/github.com/cockroachdb/pebble/vfs/mem_fs.go b/vendor/github.com/cockroachdb/pebble/vfs/mem_fs.go index bb9440a0da..ef6c87d7c7 100644 --- a/vendor/github.com/cockroachdb/pebble/vfs/mem_fs.go +++ b/vendor/github.com/cockroachdb/pebble/vfs/mem_fs.go @@ -14,6 +14,7 @@ import ( "strings" "sync" "sync/atomic" + "syscall" "time" "github.com/cockroachdb/errors" @@ -78,6 +79,11 @@ type MemFS struct { mu sync.Mutex root *memNode + // lockFiles holds a map of open file locks. Presence in this map indicates + // a file lock is currently held. Keys are strings holding the path of the + // locked file. The stored value is untyped and unused; only presence of + // the key within the map is significant. + lockedFiles sync.Map strict bool ignoreSyncs bool // Windows has peculiar semantics with respect to hard links and deleting @@ -457,9 +463,31 @@ func (y *MemFS) MkdirAll(dirname string, perm os.FileMode) error { // Lock implements FS.Lock. func (y *MemFS) Lock(fullname string) (io.Closer, error) { // FS.Lock excludes other processes, but other processes cannot see this - // process' memory. We translate Lock into Create so that have the normal - // detection of non-existent directory paths. - return y.Create(fullname) + // process' memory. However some uses (eg, Cockroach tests) may open and + // close the same MemFS-backed database multiple times. We want mutual + // exclusion in this case too. See cockroachdb/cockroach#110645. + _, loaded := y.lockedFiles.Swap(fullname, nil /* the value itself is insignificant */) + if loaded { + // This file lock has already been acquired. On unix, this results in + // either EACCES or EAGAIN so we mimic. + return nil, syscall.EAGAIN + } + // Otherwise, we successfully acquired the lock. Locks are visible in the + // parent directory listing, and they also must be created under an existent + // directory. Create the path so that we have the normal detection of + // non-existent directory paths, and make the lock visible when listing + // directory entries. + f, err := y.Create(fullname) + if err != nil { + // "Release" the lock since we failed. + y.lockedFiles.Delete(fullname) + return nil, err + } + return &memFileLock{ + y: y, + f: f, + fullname: fullname, + }, nil } // List implements FS.List. @@ -787,3 +815,18 @@ func (f *memFile) Fd() uintptr { func (f *memFile) Flush() error { return nil } + +type memFileLock struct { + y *MemFS + f File + fullname string +} + +func (l *memFileLock) Close() error { + if l.y == nil { + return nil + } + l.y.lockedFiles.Delete(l.fullname) + l.y = nil + return l.f.Close() +} diff --git a/vendor/github.com/nutsdb/nutsdb/db.go b/vendor/github.com/nutsdb/nutsdb/db.go index 9551bf9442..3bcc5c9f79 100644 --- a/vendor/github.com/nutsdb/nutsdb/db.go +++ b/vendor/github.com/nutsdb/nutsdb/db.go @@ -659,14 +659,15 @@ func (db *DB) getRecordCount() (int64, error) { func (db *DB) buildBTreeIdx(r *Record) { db.resetRecordByMode(r) + bucket, key, meta := r.Bucket, r.H.Key, r.H.Meta + b := db.Index.bTree.getWithDefault(bucket) + if r.IsExpired() { + db.tm.del(bucket, string(key)) + b.Delete(key) return } - bucket, key, meta := r.Bucket, r.H.Key, r.H.Meta - - b := db.Index.bTree.getWithDefault(bucket) - if meta.Flag == DataDeleteFlag { db.tm.del(bucket, string(key)) b.Delete(key) diff --git a/vendor/github.com/ucwong/filecache/filecache.go b/vendor/github.com/ucwong/filecache/filecache.go index aa86afe607..8b34c70866 100644 --- a/vendor/github.com/ucwong/filecache/filecache.go +++ b/vendor/github.com/ucwong/filecache/filecache.go @@ -1,6 +1,7 @@ package filecache import ( + "bufio" "fmt" "io" "os" @@ -327,7 +328,9 @@ func (cache *FileCache) WriteFile(w io.Writer, name string) (err error) { return } defer file.Close() - _, err = io.Copy(w, file) + var buf bufio.Reader + buf.Reset(file) + _, err = io.Copy(w, &buf) } return } diff --git a/vendor/modules.txt b/vendor/modules.txt index 6278ea5f4e..2f5c950c1c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -43,7 +43,7 @@ github.com/CortexFoundation/robot/backend # github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66 ## explicit; go 1.16 github.com/CortexFoundation/statik -# github.com/CortexFoundation/torrentfs v1.0.54-0.20230915085716-6cbd302e0627 +# github.com/CortexFoundation/torrentfs v1.0.54-0.20230916065909-9be746583ead ## explicit; go 1.21 github.com/CortexFoundation/torrentfs github.com/CortexFoundation/torrentfs/backend @@ -137,7 +137,7 @@ github.com/anacrolix/stm/stmutil # github.com/anacrolix/sync v0.4.0 ## explicit; go 1.13 github.com/anacrolix/sync -# github.com/anacrolix/torrent v1.52.6-0.20230914125831-4fb12d06b31b +# github.com/anacrolix/torrent v1.52.6-0.20230916034836-b84b19cc4c45 ## explicit; go 1.20 github.com/anacrolix/torrent github.com/anacrolix/torrent/analysis @@ -338,7 +338,7 @@ github.com/cockroachdb/errors/withstack # github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b ## explicit; go 1.16 github.com/cockroachdb/logtags -# github.com/cockroachdb/pebble v0.0.0-20230915084130-336c99798a6d +# github.com/cockroachdb/pebble v0.0.0-20230915152238-6d6570bf1e25 ## explicit; go 1.19 github.com/cockroachdb/pebble github.com/cockroachdb/pebble/bloom @@ -753,7 +753,7 @@ github.com/naoina/go-stringutil ## explicit github.com/naoina/toml github.com/naoina/toml/ast -# github.com/nutsdb/nutsdb v0.14.1-0.20230907051708-51c9f276ec7b +# github.com/nutsdb/nutsdb v0.14.1-0.20230915093218-a1a81e6a48a8 ## explicit; go 1.18 github.com/nutsdb/nutsdb # github.com/olekukonko/tablewriter v0.0.5 @@ -967,14 +967,14 @@ github.com/tklauser/numcpus # github.com/ucwong/color v1.10.1-0.20200624105241-fba1e010fe1e ## explicit; go 1.14 github.com/ucwong/color -# github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd +# github.com/ucwong/filecache v1.0.6-0.20230916065457-63847b20001a ## explicit; go 1.20 github.com/ucwong/filecache # github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb ## explicit; go 1.19 github.com/ucwong/go-ttlmap -# github.com/ucwong/golang-kv v1.0.23-0.20230915085246-c67539220a59 -## explicit; go 1.20 +# github.com/ucwong/golang-kv v1.0.23-0.20230916064351-555db8b6f0e1 +## explicit; go 1.21 github.com/ucwong/golang-kv github.com/ucwong/golang-kv/badger github.com/ucwong/golang-kv/bolt From 59740d03c57283ec6afdd08c83d46ff60ed83a97 Mon Sep 17 00:00:00 2001 From: ucwong Date: Sun, 24 Sep 2023 21:38:45 +0800 Subject: [PATCH 5/7] fix --- go.sum | 22 ---------------------- vendor/modules.txt | 16 ---------------- 2 files changed, 38 deletions(-) diff --git a/go.sum b/go.sum index 45287e5692..4a822f5d28 100644 --- a/go.sum +++ b/go.sum @@ -67,17 +67,10 @@ github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66/go.mod h1: github.com/CortexFoundation/torrentfs v1.0.13-0.20200623060705-ce027f43f2f8/go.mod h1:Ma+tGhPPvz4CEZHaqEJQMOEGOfHeQBiAoNd1zyc/w3Q= github.com/CortexFoundation/torrentfs v1.0.14-0.20200703071639-3fcabcabf274/go.mod h1:qnb3YlIJmuetVBtC6Lsejr0Xru+1DNmDCdTqnwy7lhk= github.com/CortexFoundation/torrentfs v1.0.20-0.20200810031954-d36d26f82fcc/go.mod h1:N5BsicP5ynjXIi/Npl/SRzlJ630n1PJV2sRj0Z0t2HA= -<<<<<<< HEAD -github.com/CortexFoundation/torrentfs v1.0.54-0.20230916065909-9be746583ead h1:Em6LOwIDEYxE/CJjOf5CJCgvRLqbIOxBSyzHbLgki6c= -github.com/CortexFoundation/torrentfs v1.0.54-0.20230916065909-9be746583ead/go.mod h1:o1dBuhnsPWEhooQMnGEw2jOwnPqAT5zFtyT0FkAnbpA= -github.com/CortexFoundation/wormhole v0.0.0-20230908085523-44aea02f16f8 h1:Cvtqm62iaQx0KBC2ZuEseIsuBh3v1BvIpcHvwIe4yq8= -github.com/CortexFoundation/wormhole v0.0.0-20230908085523-44aea02f16f8/go.mod h1:62dTMtfdf0W71ZfM7xDFJTFdzMfaKeYUrx7fB5/iQ1s= -======= github.com/CortexFoundation/torrentfs v1.0.55-0.20230922084717-9017900eb0e6 h1:yGbtvNoG6mdSfsBuvt9g+OB+Q4upm7qdkkMYxen1jCY= github.com/CortexFoundation/torrentfs v1.0.55-0.20230922084717-9017900eb0e6/go.mod h1:k6ha+y83D8ninS62dFTZ422hTESzfywLqn0x9qFjOaM= github.com/CortexFoundation/wormhole v0.0.2-0.20230922082251-f97b53242e48 h1:EDrk6U+GjSJ1FdbTrtRDe3LA/Ot6E3xu/HpXAio99B4= github.com/CortexFoundation/wormhole v0.0.2-0.20230922082251-f97b53242e48/go.mod h1:a2ynt5IqAlGTWLQY0pILqkxYe4AzHLNd+bPmK/r03oE= ->>>>>>> master github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/zstd v1.5.6-0.20230622172052-ea68dcab66c0 h1:ye3LRgDs6Og7SKC1wBQH8oMaGczhCRpPpnU74l4rma8= github.com/DataDog/zstd v1.5.6-0.20230622172052-ea68dcab66c0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= @@ -355,13 +348,8 @@ github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+ github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -<<<<<<< HEAD -github.com/cockroachdb/pebble v0.0.0-20230915152238-6d6570bf1e25 h1:3TmXZ906ySGZMwTAS0YWzP8hNg4gUIeDmXvu5gEU2PQ= -github.com/cockroachdb/pebble v0.0.0-20230915152238-6d6570bf1e25/go.mod h1:nindLFinxeDPjP4qI9LtVHAwDef57/0s5KMfWgdktQc= -======= github.com/cockroachdb/pebble v0.0.0-20230922034545-d038189d72d9 h1:WqK8Tqr3cp6/QsJ2wmAFF+YPLKq1HnxX7TN7tBCHZdg= github.com/cockroachdb/pebble v0.0.0-20230922034545-d038189d72d9/go.mod h1:nindLFinxeDPjP4qI9LtVHAwDef57/0s5KMfWgdktQc= ->>>>>>> master github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= @@ -917,13 +905,8 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= 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= -<<<<<<< HEAD -github.com/nutsdb/nutsdb v0.14.1-0.20230915093218-a1a81e6a48a8 h1:bxFzrNeR1wVipILPw2IHsuXulG3k79o9RNW+fsbYQSg= -github.com/nutsdb/nutsdb v0.14.1-0.20230915093218-a1a81e6a48a8/go.mod h1:6inOji9rFBporXeHDjJny4g50RpQbkjSK5jI1hht0j8= -======= github.com/nutsdb/nutsdb v0.14.2-0.20230920145144-f8fd5522a634 h1:Wp9O6lIr6+knVsBouC1JYCf3RNd0wQ9Mc6f+K1wf19I= github.com/nutsdb/nutsdb v0.14.2-0.20230920145144-f8fd5522a634/go.mod h1:6inOji9rFBporXeHDjJny4g50RpQbkjSK5jI1hht0j8= ->>>>>>> master 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= @@ -1269,13 +1252,8 @@ github.com/ucwong/filecache v1.0.6-0.20230916065457-63847b20001a h1:MkUqY4r4iTzE github.com/ucwong/filecache v1.0.6-0.20230916065457-63847b20001a/go.mod h1:ddwX+NCjMZPdpzcGh1fcEbNTUTCtKgt2hC2rqvmLKgA= github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb h1:dVZH3AH9f7zB3VBmsjn25B7lfcAyMP4QxdFYTrfj7tg= github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb/go.mod h1:3yswsBsVuwsOjDvFfC5Na9XSEf4HC7mj3W3g6jvSY/s= -<<<<<<< HEAD -github.com/ucwong/golang-kv v1.0.23-0.20230916064351-555db8b6f0e1 h1:ZHBPIPa+q/lpiH3tOz0Ak3BdU/lbq41rWZWzYxDMU74= -github.com/ucwong/golang-kv v1.0.23-0.20230916064351-555db8b6f0e1/go.mod h1:E+x62Cm9qBTpqfq7yehoYVWC1Hva9Q5WvU/+siyOa6k= -======= github.com/ucwong/golang-kv v1.0.23-0.20230922081610-18db1b66e400 h1:ijNlzGwvSJ9B4wUe1nv8fuwOsNL1eXJ5qEiud32cIWc= github.com/ucwong/golang-kv v1.0.23-0.20230922081610-18db1b66e400/go.mod h1:TzguJtw69OVSVxtLpfQzYFdsA2j3MstA8vIuGSI7U9g= ->>>>>>> master github.com/ucwong/golang-set v1.8.1-0.20200419153428-d7b0b1ac2d43/go.mod h1:xu0FaiQFGbBcFZj2o7udZ5rbA8jRTsv47hkPoG5qQNM= github.com/ucwong/goleveldb v1.0.3-0.20200508074755-578cba616f37/go.mod h1:dgJUTtDxq/ne6/JzZhHzF24OL/uqILz9IWk8HmT4V2g= github.com/ucwong/goleveldb v1.0.3-0.20200618184106-f1c6bc3a428b/go.mod h1:7Sq6w7AfEZuB/a6mrlvHCSXCSkqojCMMrM3Ei12QAT0= diff --git a/vendor/modules.txt b/vendor/modules.txt index 50ade3fccf..1782c2aeaa 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -43,11 +43,7 @@ github.com/CortexFoundation/robot/backend # github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66 ## explicit; go 1.16 github.com/CortexFoundation/statik -<<<<<<< HEAD -# github.com/CortexFoundation/torrentfs v1.0.54-0.20230916065909-9be746583ead -======= # github.com/CortexFoundation/torrentfs v1.0.55-0.20230922084717-9017900eb0e6 ->>>>>>> master ## explicit; go 1.21 github.com/CortexFoundation/torrentfs github.com/CortexFoundation/torrentfs/backend @@ -345,11 +341,7 @@ github.com/cockroachdb/errors/withstack # github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b ## explicit; go 1.16 github.com/cockroachdb/logtags -<<<<<<< HEAD -# github.com/cockroachdb/pebble v0.0.0-20230915152238-6d6570bf1e25 -======= # github.com/cockroachdb/pebble v0.0.0-20230922034545-d038189d72d9 ->>>>>>> master ## explicit; go 1.19 github.com/cockroachdb/pebble github.com/cockroachdb/pebble/bloom @@ -761,11 +753,7 @@ github.com/naoina/go-stringutil ## explicit github.com/naoina/toml github.com/naoina/toml/ast -<<<<<<< HEAD -# github.com/nutsdb/nutsdb v0.14.1-0.20230915093218-a1a81e6a48a8 -======= # github.com/nutsdb/nutsdb v0.14.2-0.20230920145144-f8fd5522a634 ->>>>>>> master ## explicit; go 1.18 github.com/nutsdb/nutsdb # github.com/olekukonko/tablewriter v0.0.5 @@ -982,11 +970,7 @@ github.com/ucwong/filecache # github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb ## explicit; go 1.19 github.com/ucwong/go-ttlmap -<<<<<<< HEAD -# github.com/ucwong/golang-kv v1.0.23-0.20230916064351-555db8b6f0e1 -======= # github.com/ucwong/golang-kv v1.0.23-0.20230922081610-18db1b66e400 ->>>>>>> master ## explicit; go 1.21 github.com/ucwong/golang-kv github.com/ucwong/golang-kv/badger From 0d9611c0fbdde2440a300acd6180887d0e4bd7a8 Mon Sep 17 00:00:00 2001 From: ucwong Date: Sun, 24 Sep 2023 21:40:19 +0800 Subject: [PATCH 6/7] fix --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d35c6112ef..7ee768ebc0 100644 --- a/go.mod +++ b/go.mod @@ -216,7 +216,7 @@ require ( github.com/tidwall/hashmap v1.8.1 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.1 // indirect - github.com/ucwong/filecache v1.0.6-0.20230916065457-63847b20001a // indirect + github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd // indirect github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb // indirect github.com/ucwong/golang-kv v1.0.23-0.20230922081610-18db1b66e400 // indirect github.com/ucwong/shard v1.0.1-0.20230902205521-676c0c9c1dd2 // indirect diff --git a/go.sum b/go.sum index 4a822f5d28..9c3ef84ded 100644 --- a/go.sum +++ b/go.sum @@ -1248,8 +1248,8 @@ github.com/ucwong/color v1.10.1-0.20200504093835-6ffe517dac74/go.mod h1:ctQ7afqe github.com/ucwong/color v1.10.1-0.20200518131954-915014f7ee11/go.mod h1:v1b0ANLmRpK9Q+qquVwSF2eELmmrF/IafbyK0UgrmEA= github.com/ucwong/color v1.10.1-0.20200624105241-fba1e010fe1e h1:HvK1iHNK69zvKCmoMPGt5SvCFf3BZ1LE7Yhi+1+t8v0= github.com/ucwong/color v1.10.1-0.20200624105241-fba1e010fe1e/go.mod h1:/b4wmbSWmKYSHQQC4tshp/xGngyZwSOrjkfWZ2XEMZU= -github.com/ucwong/filecache v1.0.6-0.20230916065457-63847b20001a h1:MkUqY4r4iTzEn4JwbGOmE04a6Wsgw54UOjR1AXFmpQ4= -github.com/ucwong/filecache v1.0.6-0.20230916065457-63847b20001a/go.mod h1:ddwX+NCjMZPdpzcGh1fcEbNTUTCtKgt2hC2rqvmLKgA= +github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd h1:gBtlvLAsgLk+WcCXQ6K26u+POLm4oV0fiZ2UyBEQ0QU= +github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd/go.mod h1:ddwX+NCjMZPdpzcGh1fcEbNTUTCtKgt2hC2rqvmLKgA= github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb h1:dVZH3AH9f7zB3VBmsjn25B7lfcAyMP4QxdFYTrfj7tg= github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb/go.mod h1:3yswsBsVuwsOjDvFfC5Na9XSEf4HC7mj3W3g6jvSY/s= github.com/ucwong/golang-kv v1.0.23-0.20230922081610-18db1b66e400 h1:ijNlzGwvSJ9B4wUe1nv8fuwOsNL1eXJ5qEiud32cIWc= From 3b24d20c151dff7edadf45c6b297fa9af1974cf2 Mon Sep 17 00:00:00 2001 From: ucwong Date: Sun, 24 Sep 2023 21:41:24 +0800 Subject: [PATCH 7/7] fix --- vendor/github.com/ucwong/filecache/filecache.go | 5 +---- vendor/modules.txt | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/vendor/github.com/ucwong/filecache/filecache.go b/vendor/github.com/ucwong/filecache/filecache.go index 8b34c70866..aa86afe607 100644 --- a/vendor/github.com/ucwong/filecache/filecache.go +++ b/vendor/github.com/ucwong/filecache/filecache.go @@ -1,7 +1,6 @@ package filecache import ( - "bufio" "fmt" "io" "os" @@ -328,9 +327,7 @@ func (cache *FileCache) WriteFile(w io.Writer, name string) (err error) { return } defer file.Close() - var buf bufio.Reader - buf.Reset(file) - _, err = io.Copy(w, &buf) + _, err = io.Copy(w, file) } return } diff --git a/vendor/modules.txt b/vendor/modules.txt index 1782c2aeaa..6c6238b993 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -964,7 +964,7 @@ github.com/tklauser/numcpus # github.com/ucwong/color v1.10.1-0.20200624105241-fba1e010fe1e ## explicit; go 1.14 github.com/ucwong/color -# github.com/ucwong/filecache v1.0.6-0.20230916065457-63847b20001a +# github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd ## explicit; go 1.20 github.com/ucwong/filecache # github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb