Skip to content

Commit 1ba6e48

Browse files
authored
Revert "Session key"
1 parent 3da56c1 commit 1ba6e48

File tree

17 files changed

+54
-144
lines changed

17 files changed

+54
-144
lines changed

code/go/0chain.net/blobbercore/allocation/entity.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ type Allocation struct {
6262
TimeUnit time.Duration `gorm:"column:time_unit;not null;default:172800000000000"`
6363
StartTime common.Timestamp `gorm:"column:start_time;not null"`
6464
// Ending and cleaning
65-
CleanedUp bool `gorm:"column:cleaned_up;not null;default:false"`
66-
Finalized bool `gorm:"column:finalized;not null;default:false"`
67-
OwnerSigningPublicKey string `gorm:"column:owner_signing_public_key;size:512;not null" json:"owner_signing_public_key"`
65+
CleanedUp bool `gorm:"column:cleaned_up;not null;default:false"`
66+
Finalized bool `gorm:"column:finalized;not null;default:false"`
6867

6968
// FileOptions to define file restrictions on an allocation for third-parties
7069
// default 00000000 for all crud operations suggesting only owner has the below listed abilities.

code/go/0chain.net/blobbercore/allocation/file_changer_base.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ type BaseFileChanger struct {
5252
EncryptedKeyPoint string `json:"encrypted_key_point,omitempty"`
5353
CustomMeta string `json:"custom_meta,omitempty"`
5454

55-
ChunkSize int64 `json:"chunk_size,omitempty"` // the size of achunk. 64*1024 is default
56-
IsFinal bool `json:"is_final,omitempty"` // current chunk is last or not
57-
SignatureVersion int `json:"signature_version,omitempty"`
55+
ChunkSize int64 `json:"chunk_size,omitempty"` // the size of achunk. 64*1024 is default
56+
IsFinal bool `json:"is_final,omitempty"` // current chunk is last or not
5857

5958
ChunkStartIndex int `json:"chunk_start_index,omitempty"` // start index of chunks.
6059
ChunkEndIndex int `json:"chunk_end_index,omitempty"` // end index of chunks. all chunks MUST be uploaded one by one because of CompactMerkleTree

code/go/0chain.net/blobbercore/allocation/file_changer_update.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ func (nf *UpdateFileChanger) ApplyChange(ctx context.Context, rootRef *reference
106106
fileRef.ChunkSize = nf.ChunkSize
107107
fileRef.IsPrecommit = true
108108
fileRef.FilestoreVersion = filestore.VERSION
109-
fileRef.SignatureVersion = nf.SignatureVersion
110109

111110
return rootRef, nil
112111
}
@@ -174,7 +173,6 @@ func (nf *UpdateFileChanger) ApplyChangeV2(ctx context.Context, allocationRoot,
174173
PathLevel: len(strings.Split(strings.TrimRight(nf.Path, "/"), "/")),
175174
NumBlocks: int64(math.Ceil(float64(nf.Size*1.0) / float64(nf.ChunkSize))),
176175
NumUpdates: refResult.NumUpdates + 1,
177-
SignatureVersion: nf.SignatureVersion,
178176
}
179177
nf.storageVersion = 1
180178
newFile.FileMetaHash = encryption.Hash(newFile.GetFileMetaHashDataV2())

code/go/0chain.net/blobbercore/allocation/file_changer_upload.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ func (nf *UploadFileChanger) applyChange(ctx context.Context, rootRef *reference
130130
HashToBeComputed: true,
131131
IsPrecommit: true,
132132
FilestoreVersion: filestore.VERSION,
133-
SignatureVersion: nf.SignatureVersion,
134133
}
135134

136135
fileID, ok := fileIDMeta[newFile.Path]
@@ -198,7 +197,6 @@ func (nf *UploadFileChanger) ApplyChangeV2(ctx context.Context, allocationRoot,
198197
PathLevel: len(strings.Split(strings.TrimRight(nf.Path, "/"), "/")),
199198
NumBlocks: int64(math.Ceil(float64(nf.Size*1.0) / float64(nf.ChunkSize))),
200199
NumUpdates: 1,
201-
SignatureVersion: nf.SignatureVersion,
202200
}
203201
nf.storageVersion = 1
204202
newFile.FileMetaHash = encryption.Hash(newFile.GetFileMetaHashDataV2())

code/go/0chain.net/blobbercore/allocation/protocol.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ func FetchAllocationFromEventsDB(ctx context.Context, allocationID string, alloc
110110
a.TimeUnit = sa.TimeUnit
111111
a.FileOptions = sa.FileOptions
112112
a.StartTime = sa.StartTime
113+
// Only for testing purpose
113114
a.StorageVersion = uint8(sa.StorageVersion)
114-
a.OwnerSigningPublicKey = sa.OwnerSigningPublicKey
115115

116116
m := map[string]interface{}{
117117
"allocation_id": a.ID,

code/go/0chain.net/blobbercore/allocation/workers.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ func updateAllocationInDB(ctx context.Context, a *Allocation, sa *transaction.St
246246
a.Tx = sa.Tx
247247
a.OwnerID = sa.OwnerID
248248
a.OwnerPublicKey = sa.OwnerPublicKey
249-
a.OwnerSigningPublicKey = sa.OwnerSigningPublicKey
250249

251250
// // update fields
252251
a.Expiration = sa.Expiration
@@ -264,7 +263,6 @@ func updateAllocationInDB(ctx context.Context, a *Allocation, sa *transaction.St
264263
updateMap["finalized"] = a.Finalized
265264
updateMap["file_options"] = a.FileOptions
266265
updateMap["blobber_size"] = a.BlobberSize
267-
updateMap["owner_signing_public_key"] = a.OwnerSigningPublicKey
268266

269267
updateOption := func(alloc *Allocation) {
270268
alloc.Tx = a.Tx
@@ -275,7 +273,6 @@ func updateAllocationInDB(ctx context.Context, a *Allocation, sa *transaction.St
275273
alloc.Finalized = a.Finalized
276274
alloc.FileOptions = a.FileOptions
277275
alloc.BlobberSize = a.BlobberSize
278-
alloc.OwnerSigningPublicKey = a.OwnerSigningPublicKey
279276
}
280277

281278
// update terms

code/go/0chain.net/blobbercore/allocation/zcn.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ func SyncAllocation(allocationId string) (*Allocation, error) {
5252
alloc.Finalized = sa.Finalized
5353
alloc.TimeUnit = sa.TimeUnit
5454
alloc.FileOptions = sa.FileOptions
55-
alloc.StorageVersion = uint8(sa.StorageVersion)
56-
alloc.OwnerSigningPublicKey = sa.OwnerSigningPublicKey
5755

5856
// related terms
5957
terms := make([]*Terms, 0, len(sa.BlobberDetails))

code/go/0chain.net/blobbercore/challenge/protocol.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ import (
55
"encoding/hex"
66
"encoding/json"
77
"errors"
8+
"github.com/0chain/blobber/code/go/0chain.net/core/transaction"
9+
coreTxn "github.com/0chain/gosdk/core/transaction"
810
"math/rand"
911
"strings"
1012
"sync"
1113
"time"
1214

13-
"github.com/0chain/blobber/code/go/0chain.net/core/transaction"
14-
coreTxn "github.com/0chain/gosdk/core/transaction"
15-
1615
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation"
1716
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore"
1817
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore"
@@ -367,7 +366,6 @@ func (cr *ChallengeEntity) getPostDataV2(ctx context.Context, allocationObj *all
367366
FixedMerkleRoot: ref.FixedMerkleRoot,
368367
Size: ref.Size,
369368
FileMetaHash: ref.FileMetaHash,
370-
SignatureVersion: ref.SignatureVersion,
371369
}
372370
postData["meta"] = metaRef
373371
}

code/go/0chain.net/blobbercore/handler/file_command_update.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,7 @@ func (cmd *UpdateFileCommand) ProcessContent(ctx context.Context, allocationObj
155155
hashData := fmt.Sprintf("%s:%s:%s:%s", cmd.fileChanger.ActualHash, cmd.fileChanger.ValidationRoot, cmd.fileChanger.FixedMerkleRoot, node.Self.ID)
156156
hash = encryption.Hash(hashData)
157157
}
158-
var (
159-
err error
160-
verify bool
161-
)
162-
if cmd.fileChanger.SignatureVersion == reference.SignatureV2 {
163-
verify, err = encryption.VerifyEd25519(allocationObj.OwnerSigningPublicKey, cmd.fileChanger.ValidationRootSignature, hash)
164-
} else {
165-
verify, err = encryption.Verify(allocationObj.OwnerPublicKey, cmd.fileChanger.ValidationRootSignature, hash)
166-
}
158+
verify, err := encryption.Verify(allocationObj.OwnerPublicKey, cmd.fileChanger.ValidationRootSignature, hash)
167159
if err != nil || !verify {
168160
logging.Logger.Error("UpdateFileCommand.VerifySignature", zap.Error(err))
169161
return result, common.NewError("update_error", "Failed to verify validation root signature. ")

code/go/0chain.net/blobbercore/handler/file_command_upload.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,7 @@ func (cmd *UploadFileCommand) ProcessContent(ctx context.Context, allocationObj
167167
hashData := fmt.Sprintf("%s:%s:%s:%s", cmd.fileChanger.ActualHash, cmd.fileChanger.ValidationRoot, cmd.fileChanger.FixedMerkleRoot, node.Self.ID)
168168
hash = encryption.Hash(hashData)
169169
}
170-
var (
171-
err error
172-
verify bool
173-
)
174-
if cmd.fileChanger.SignatureVersion == reference.SignatureV2 {
175-
verify, err = encryption.VerifyEd25519(allocationObj.OwnerSigningPublicKey, cmd.fileChanger.ValidationRootSignature, hash)
176-
} else {
177-
verify, err = encryption.Verify(allocationObj.OwnerPublicKey, cmd.fileChanger.ValidationRootSignature, hash)
178-
}
170+
verify, err := encryption.Verify(allocationObj.OwnerPublicKey, cmd.fileChanger.ValidationRootSignature, hash)
179171
if err != nil || !verify {
180172
logging.Logger.Error("UploadFileCommand.VerifySignature", zap.Error(err))
181173
return result, common.NewError("upload_error", "Failed to verify validation root signature. ")

0 commit comments

Comments
 (0)