Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'sprint-1.11' into feat/db-snapshot-migration
- Loading branch information
Showing
17 changed files
with
160 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
code/go/0chain.net/blobbercore/allocation/file_changer_upload_integration.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//go:build integration_tests | ||
// +build integration_tests | ||
|
||
package allocation | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" | ||
"github.com/0chain/blobber/code/go/0chain.net/conductor/conductrpc" | ||
"github.com/0chain/blobber/code/go/0chain.net/core/common" | ||
"github.com/0chain/blobber/code/go/0chain.net/core/node" | ||
) | ||
|
||
func (nf *UploadFileChanger) ApplyChange(ctx context.Context, rootRef *reference.Ref, change *AllocationChange, | ||
allocationRoot string, ts common.Timestamp, fileIDMeta map[string]string) (*reference.Ref, error) { | ||
|
||
state := conductrpc.Client().State() | ||
if state.FailUploadCommit != nil { | ||
for _, nodeId := range state.FailUploadCommit { | ||
if nodeId == node.Self.ID { | ||
return nil, errors.New("error directed by conductor") | ||
} | ||
} | ||
} | ||
return nf.applyChange(ctx, rootRef, change, allocationRoot, ts, fileIDMeta) | ||
} |
15 changes: 15 additions & 0 deletions
15
code/go/0chain.net/blobbercore/allocation/file_changer_upload_main.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//go:build !integration_tests | ||
// +build !integration_tests | ||
|
||
package allocation | ||
|
||
import ( | ||
"context" | ||
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" | ||
"github.com/0chain/blobber/code/go/0chain.net/core/common" | ||
) | ||
|
||
func (nf *UploadFileChanger) ApplyChange(ctx context.Context, rootRef *reference.Ref, change *AllocationChange, | ||
allocationRoot string, ts common.Timestamp, fileIDMeta map[string]string) (*reference.Ref, error) { | ||
return nf.applyChange(ctx, rootRef, change, allocationRoot, ts, fileIDMeta) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
code/go/0chain.net/blobbercore/filestore/tree_validation_integration_tests.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
//go:build integration_tests | ||
// +build integration_tests | ||
|
||
package filestore | ||
|
||
import ( | ||
"io" | ||
|
||
crpc "github.com/0chain/blobber/code/go/0chain.net/conductor/conductrpc" | ||
"github.com/0chain/blobber/code/go/0chain.net/core/logging" | ||
"go.uber.org/zap" | ||
) | ||
|
||
func (v *validationTreeProof) GetMerkleProofOfMultipleIndexes(r io.ReadSeeker, nodesSize int64, startInd, endInd int) ( | ||
[][][]byte, [][]int, error) { | ||
nodes, indexes, err := v.getMerkleProofOfMultipleIndexes(r, nodesSize, startInd, endInd) | ||
if err != nil { | ||
return nodes, indexes, err | ||
} | ||
|
||
state := crpc.Client().State() | ||
if state == nil { | ||
return nodes, indexes, err | ||
} | ||
|
||
logging.Logger.Debug("[conductor] just after getMerkleProofOfMultipleIndexes", | ||
zap.Bool("miss_up_download", state.MissUpDownload), | ||
zap.Int("start_ind", startInd), | ||
zap.Int("end_ind", endInd), | ||
zap.Int64("nodes_size", nodesSize), | ||
zap.Int("output_nodes_size", len(nodes)), | ||
zap.Int("output_indexes_size", len(indexes)), | ||
zap.Any("nodes", nodes), | ||
zap.Any("indexes", indexes), | ||
) | ||
|
||
if state.MissUpDownload { | ||
logging.Logger.Debug("miss up/download", | ||
zap.Bool("miss_up_download", state.MissUpDownload), | ||
zap.Int("start_ind", startInd), | ||
zap.Int("end_ind", endInd), | ||
zap.Int64("nodes_size", nodesSize), | ||
zap.Int("output_nodes_size", len(nodes)), | ||
zap.Int("output_indexes_size", len(indexes)), | ||
zap.Any("nodes", nodes), | ||
zap.Any("indexes", indexes), | ||
) | ||
|
||
for i := range nodes { | ||
nodes[i][0] = []byte("wrong data") | ||
} | ||
|
||
for i := range indexes { | ||
indexes[i][0] = 0 | ||
} | ||
} | ||
|
||
return nodes, indexes, err | ||
} |
11 changes: 11 additions & 0 deletions
11
code/go/0chain.net/blobbercore/filestore/tree_validation_main.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//go:build !integration_tests | ||
// +build !integration_tests | ||
|
||
package filestore | ||
|
||
import "io" | ||
|
||
func (v *validationTreeProof) GetMerkleProofOfMultipleIndexes(r io.ReadSeeker, nodesSize int64, startInd, endInd int) ( | ||
[][][]byte, [][]int, error) { | ||
return v.getMerkleProofOfMultipleIndexes(r, nodesSize, startInd, endInd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,7 @@ type ( | |
RoundName = config.RoundName | ||
Number = config.Number | ||
) | ||
|
||
type ValidtorTicket struct { | ||
ValidatorId string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters