Skip to content

Commit

Permalink
Merge pull request #1488 from 0chain/fix/delete-nodes
Browse files Browse the repository at this point in the history
Fix delete nodes
  • Loading branch information
dabasov authored Oct 24, 2024
2 parents de4f0f5 + 2a14a0a commit 317e9f6
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/0chain/blobber/code/go/0chain.net/core/common"
"github.com/0chain/blobber/code/go/0chain.net/core/logging"
"github.com/0chain/gosdk/constants"
"github.com/0chain/gosdk/core/client"
"github.com/0chain/gosdk/core/zcncrypto"
mocket "github.com/selvatico/go-mocket"
"go.uber.org/zap"
Expand All @@ -31,14 +30,14 @@ func TestBlobberCore_CopyFile(t *testing.T) {
sch := zcncrypto.NewSignatureScheme("bls0chain")
mnemonic := "expose culture dignity plastic digital couple promote best pool error" +
" brush upgrade correct art become lobster nature moment obtain trial multiply arch miss toe"
_, err := sch.RecoverKeys(mnemonic)
w, err := sch.RecoverKeys(mnemonic)
if err != nil {
t.Fatal(err)
}
ts := time.Now().Add(time.Hour)
alloc := makeTestAllocation(common.Timestamp(ts.Unix()))
alloc.OwnerPublicKey = sch.GetPublicKey()
alloc.OwnerID = client.Wallet().ClientID
alloc.OwnerID = w.ClientID

testCases := []struct {
name string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore"
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference"
"github.com/0chain/blobber/code/go/0chain.net/core/common"
"github.com/0chain/gosdk/core/client"
"github.com/0chain/gosdk/core/zcncrypto"
mocket "github.com/selvatico/go-mocket"
"github.com/stretchr/testify/assert"
Expand All @@ -25,14 +24,14 @@ func TestBlobberCore_DeleteFile(t *testing.T) {
sch := zcncrypto.NewSignatureScheme("bls0chain")
mnemonic := "expose culture dignity plastic digital couple promote best pool error" +
" brush upgrade correct art become lobster nature moment obtain trial multiply arch miss toe"
_, err := sch.RecoverKeys(mnemonic)
w, err := sch.RecoverKeys(mnemonic)
if err != nil {
t.Fatal(err)
}
ts := time.Now().Add(time.Hour)
alloc := makeTestAllocation(common.Timestamp(ts.Unix()))
alloc.OwnerPublicKey = sch.GetPublicKey()
alloc.OwnerID = client.Wallet().ClientID
alloc.OwnerID = w.ClientID
testCases := []struct {
name string
context metadata.MD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/0chain/blobber/code/go/0chain.net/core/encryption"
"github.com/0chain/blobber/code/go/0chain.net/core/logging"
"github.com/0chain/gosdk/constants"
"github.com/0chain/gosdk/core/client"
"github.com/0chain/gosdk/core/zcncrypto"
mocket "github.com/selvatico/go-mocket"
"go.uber.org/zap"
Expand All @@ -32,14 +31,14 @@ func init() {
func TestBlobberCore_FileChangerUpload(t *testing.T) {
sch := zcncrypto.NewSignatureScheme("bls0chain")
mnemonic := "expose culture dignity plastic digital couple promote best pool error brush upgrade correct art become lobster nature moment obtain trial multiply arch miss toe"
_, err := sch.RecoverKeys(mnemonic)
w, err := sch.RecoverKeys(mnemonic)
if err != nil {
t.Fatal(err)
}
ts := time.Now().Add(time.Hour)
alloc := makeTestAllocation(common.Timestamp(ts.Unix()))
alloc.OwnerPublicKey = sch.GetPublicKey()
alloc.OwnerID = client.Wallet().ClientID
alloc.OwnerID = w.ClientID

testCases := []struct {
name string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore"
"github.com/0chain/blobber/code/go/0chain.net/core/common"
"github.com/0chain/blobber/code/go/0chain.net/core/logging"
"github.com/0chain/gosdk/core/client"
"github.com/0chain/gosdk/core/zcncrypto"
"go.uber.org/zap"
"google.golang.org/grpc/metadata"
Expand All @@ -30,14 +29,14 @@ func TestBlobberCore_MoveFile(t *testing.T) {
sch := zcncrypto.NewSignatureScheme("bls0chain")
mnemonic := "expose culture dignity plastic digital couple promote best pool error" +
" brush upgrade correct art become lobster nature moment obtain trial multiply arch miss toe"
_, err := sch.RecoverKeys(mnemonic)
w, err := sch.RecoverKeys(mnemonic)
if err != nil {
t.Fatal(err)
}
ts := time.Now().Add(time.Hour)
alloc := makeTestAllocation(common.Timestamp(ts.Unix()))
alloc.OwnerPublicKey = sch.GetPublicKey()
alloc.OwnerID = client.Wallet().ClientID
alloc.OwnerID = w.ClientID

testCases := []struct {
name string
Expand Down
5 changes: 2 additions & 3 deletions code/go/0chain.net/blobbercore/allocation/multiop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore"
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference"
"github.com/0chain/blobber/code/go/0chain.net/core/common"
"github.com/0chain/gosdk/core/client"
"github.com/0chain/gosdk/core/zcncrypto"
mocket "github.com/selvatico/go-mocket"
"github.com/stretchr/testify/require"
Expand All @@ -23,14 +22,14 @@ func TestMultiOp(t *testing.T) {
sch := zcncrypto.NewSignatureScheme("bls0chain")
mnemonic := "expose culture dignity plastic digital couple promote best pool error" +
" brush upgrade correct art become lobster nature moment obtain trial multiply arch miss toe"
_, err := sch.RecoverKeys(mnemonic)
w, err := sch.RecoverKeys(mnemonic)
if err != nil {
t.Fatal(err)
}
ts := time.Now().Add(time.Hour)
alloc := makeTestAllocation(common.Timestamp(ts.Unix()))
alloc.OwnerPublicKey = sch.GetPublicKey()
alloc.OwnerID = client.Wallet().ClientID
alloc.OwnerID = w.ClientID
datastore.MocketTheStore(t, true)
ctx := datastore.GetStore().CreateTransaction(context.TODO())
setupDbMock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ func TestBlobberCore_RenameFile(t *testing.T) {

sch := zcncrypto.NewSignatureScheme("bls0chain")
mnemonic := "expose culture dignity plastic digital couple promote best pool error brush upgrade correct art become lobster nature moment obtain trial multiply arch miss toe"
_, err := sch.RecoverKeys(mnemonic)
w, err := sch.RecoverKeys(mnemonic)
if err != nil {
t.Fatal(err)
}
ts := time.Now().Add(time.Hour)
alloc := makeTestAllocation(common.Timestamp(ts.Unix()))
alloc.OwnerPublicKey = sch.GetPublicKey()
alloc.OwnerID = client.Wallet().ClientID
alloc.OwnerID = w.ClientID

testCases := []struct {
name string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/0chain/blobber/code/go/0chain.net/core/common"
"github.com/0chain/blobber/code/go/0chain.net/core/encryption"
"github.com/0chain/blobber/code/go/0chain.net/core/logging"
"github.com/0chain/gosdk/core/client"
"github.com/0chain/gosdk/core/zcncrypto"
mocket "github.com/selvatico/go-mocket"
"github.com/stretchr/testify/assert"
Expand All @@ -29,14 +28,14 @@ func TestBlobberCore_UpdateFile(t *testing.T) {

sch := zcncrypto.NewSignatureScheme("bls0chain")
mnemonic := "expose culture dignity plastic digital couple promote best pool error brush upgrade correct art become lobster nature moment obtain trial multiply arch miss toe"
_, err := sch.RecoverKeys(mnemonic)
w, err := sch.RecoverKeys(mnemonic)
if err != nil {
t.Fatal(err)
}
ts := time.Now().Add(time.Hour)
alloc := makeTestAllocation(common.Timestamp(ts.Unix()))
alloc.OwnerPublicKey = sch.GetPublicKey()
alloc.OwnerID = client.Wallet().ClientID
alloc.OwnerID = w.ClientID

testCases := []struct {
name string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ func (fsh *StorageHandler) CommitWriteV2(ctx context.Context, r *http.Request) (
elapsedSaveAllocation := time.Since(startTime) - elapsedAllocation - elapsedGetLock -
elapsedGetConnObj - elapsedVerifyWM - elapsedWritePreRedeem - elapsedMoveToFilestore - elapsedApplyChanges - elapsedTrieCommit

err = batcher.Commit(false)
err = batcher.Commit(true)
if err != nil {
return nil, common.NewError("trie_commit_error", "Error committing the trie")
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ toolchain go1.22.5

require (
github.com/0chain/errors v1.0.3
github.com/0chain/gosdk v1.18.0-RC6.0.20241023193003-8d5ec2f50067
github.com/0chain/gosdk v1.18.0-RC7.0.20241024081749-a7097fdb6f7c
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/didip/tollbooth/v6 v6.1.2
github.com/go-openapi/runtime v0.26.0
Expand Down Expand Up @@ -101,7 +101,7 @@ require (
)

require (
github.com/0chain/common v1.18.0
github.com/0chain/common v1.13.1-0.20241024063045-ca6853425ce5
github.com/Luzifer/go-openssl/v3 v3.1.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/btcsuite/btcd v0.23.4 // indirect
Expand Down
8 changes: 6 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/0chain/common v1.13.1-0.20241024063045-ca6853425ce5 h1:GyMZ3jdQnbFtPqrmO/XMy+yI1gd0qTYvPbZikcc2Jg4=
github.com/0chain/common v1.13.1-0.20241024063045-ca6853425ce5/go.mod h1:Lapu2Tj7z5Sm4r+X141e7vsz4NDODTEypeElYAP3iSw=
github.com/0chain/common v1.18.0 h1:vCkD869DR0zTZS4CDl5MMN3qixxyfTNxDDcHp7cTRrc=
github.com/0chain/common v1.18.0/go.mod h1:vHK9Q0/nz28PxmKsLSMLzEs5iK6QVgl1LxdDQdR7y6s=
github.com/0chain/errors v1.0.3 h1:QQZPFxTfnMcRdt32DXbzRQIfGWmBsKoEdszKQDb0rRM=
github.com/0chain/errors v1.0.3/go.mod h1:xymD6nVgrbgttWwkpSCfLLEJbFO6iHGQwk/yeSuYkIc=
github.com/0chain/gosdk v1.18.0-RC6.0.20241023193003-8d5ec2f50067 h1:4+Z1tC4/1vXABA2OS28qVNo3lu5knw6/uMHzhYOOKbA=
github.com/0chain/gosdk v1.18.0-RC6.0.20241023193003-8d5ec2f50067/go.mod h1:BJQPX/J6ShHV5ViGjh5aCooQD/aOhvBfnfkBOuSIFfQ=
github.com/0chain/gosdk v1.18.0-RC7 h1:cMqxvqPXThggZ7l1cSWvwknPs0dvYC5TFzfWscTVkI4=
github.com/0chain/gosdk v1.18.0-RC7/go.mod h1:BJQPX/J6ShHV5ViGjh5aCooQD/aOhvBfnfkBOuSIFfQ=
github.com/0chain/gosdk v1.18.0-RC7.0.20241024081749-a7097fdb6f7c h1:oHMzBnC7Fh9O63FlavM5o6Wqvw/grl2nHbHTXD6jnKk=
github.com/0chain/gosdk v1.18.0-RC7.0.20241024081749-a7097fdb6f7c/go.mod h1:0RNseQGWc3XmhjfPhQwmMm9yK6VulnU3hMiIwlhgGh4=
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.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
Expand Down

0 comments on commit 317e9f6

Please sign in to comment.