Skip to content

Commit 9c40d91

Browse files
Merge pull request #1229 from 0chain/fix/update-gosdk
Update gosdk
2 parents 60317da + 95dba05 commit 9c40d91

File tree

8 files changed

+10
-24
lines changed

8 files changed

+10
-24
lines changed

code/go/0chain.net/blobber/config.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ func reloadConfig() error {
117117

118118
config.Configuration.Capacity = viper.GetInt64("capacity")
119119

120-
config.Configuration.MinLockDemand = viper.GetFloat64("min_lock_demand")
121120
config.Configuration.NumDelegates = viper.GetInt("num_delegates")
122121
config.Configuration.ReadPrice = viper.GetFloat64("read_price")
123122
config.Configuration.ServiceCharge = viper.GetFloat64("service_charge")

code/go/0chain.net/blobbercore/config/config.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@ type Config struct {
9090

9191
HealthCheckWorkerFreq time.Duration
9292

93-
ReadPrice float64
94-
WritePrice float64
95-
PriceInUSD bool
96-
MinLockDemand float64
93+
ReadPrice float64
94+
WritePrice float64
95+
PriceInUSD bool
9796

9897
// WriteMarkerLockTimeout lock is released automatically if it is timeout
9998
WriteMarkerLockTimeout time.Duration

code/go/0chain.net/blobbercore/config/settings.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const TableNameSettings = "settings"
1919
type Settings struct {
2020
ID string `gorm:"column:id;size:10;primaryKey"`
2121
Capacity int64 `gorm:"column:capacity;not null;default:0"`
22-
MinLockDemand float64 `gorm:"column:min_lock_demand;not null;default:0"`
2322
NumDelegates int `gorm:"column:num_delegates;not null;default:100"`
2423
ReadPrice float64 `gorm:"column:read_price;not null;default:0"`
2524
WritePrice float64 `gorm:"column:write_price;not null;default:0"`
@@ -40,7 +39,6 @@ func (s *Settings) CopyTo(c *Config) error {
4039

4140
c.Capacity = s.Capacity
4241

43-
c.MinLockDemand = s.MinLockDemand
4442
c.NumDelegates = s.NumDelegates
4543
c.ReadPrice = s.ReadPrice
4644
c.ServiceCharge = s.ServiceCharge
@@ -56,7 +54,6 @@ func (s *Settings) CopyFrom(c *Config) error {
5654
}
5755

5856
s.Capacity = c.Capacity
59-
s.MinLockDemand = c.MinLockDemand
6057
s.NumDelegates = c.NumDelegates
6158
s.ReadPrice = c.ReadPrice
6259
s.ServiceCharge = c.ServiceCharge
@@ -118,8 +115,7 @@ func ReloadFromChain(ctx context.Context, db *gorm.DB) (*zcncore.Blobber, error)
118115
}
119116

120117
Configuration.Capacity = int64(b.Capacity)
121-
Configuration.MinLockDemand = b.Terms.MinLockDemand
122-
Configuration.NumDelegates = b.StakePoolSettings.NumDelegates
118+
Configuration.NumDelegates = *b.StakePoolSettings.NumDelegates
123119

124120
if token, err := b.Terms.ReadPrice.ToToken(); err != nil {
125121
return nil, err
@@ -133,6 +129,6 @@ func ReloadFromChain(ctx context.Context, db *gorm.DB) (*zcncore.Blobber, error)
133129
Configuration.WritePrice = token
134130
}
135131

136-
Configuration.ServiceCharge = b.StakePoolSettings.ServiceCharge
132+
Configuration.ServiceCharge = *b.StakePoolSettings.ServiceCharge
137133
return b, Update(ctx, db)
138134
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func BenchmarkUploadFileWithDisk(b *testing.B) {
6767
hasher := sdk.CreateHasher(int64(bm.ChunkSize))
6868
isFinal := false
6969

70-
body, formData, _ := formBuilder.Build(fileMeta, hasher, strconv.FormatInt(time.Now().UnixNano(), 10), int64(bm.ChunkSize), 0, 0, isFinal, "", [][]byte{chunkBytes}, nil)
70+
body, formData, _ := formBuilder.Build(fileMeta, hasher, strconv.FormatInt(time.Now().UnixNano(), 10), int64(bm.ChunkSize), 0, 0, isFinal, "", "", [][]byte{chunkBytes}, nil, 0)
7171

7272
req, err := blobber.NewRequest(http.MethodPost, "http://127.0.0.1:5051/v1/file/upload/benchmark_upload", body)
7373

@@ -160,7 +160,7 @@ func BenchmarkUploadFileWithNoDisk(b *testing.B) {
160160
hasher := sdk.CreateHasher(int64(bm.ChunkSize))
161161
isFinal := false
162162

163-
body, formData, _ := formBuilder.Build(fileMeta, hasher, strconv.FormatInt(time.Now().UnixNano(), 10), int64(bm.ChunkSize), 0, 0, isFinal, "", [][]byte{chunkBytes}, nil)
163+
body, formData, _ := formBuilder.Build(fileMeta, hasher, strconv.FormatInt(time.Now().UnixNano(), 10), int64(bm.ChunkSize), 0, 0, isFinal, "", "", [][]byte{chunkBytes}, nil, 0)
164164

165165
req, err := blobber.NewRequest(http.MethodPost, "http://127.0.0.1:5051/v1/file/upload/benchmark_upload", body)
166166

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ func getStorageNode() (*transaction.StorageNode, error) {
6464
}
6565
sn.Terms.ReadPrice = zcncore.ConvertToValue(readPrice)
6666
sn.Terms.WritePrice = zcncore.ConvertToValue(writePrice)
67-
sn.Terms.MinLockDemand = config.Configuration.MinLockDemand
6867

6968
sn.StakePoolSettings.DelegateWallet = config.Configuration.DelegateWallet
7069
sn.StakePoolSettings.NumDelegates = config.Configuration.NumDelegates

code/go/0chain.net/blobbercore/stats/blobberstats.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ type BlobberStats struct {
7272
AllocationListPagination *Pagination `json:"allocation_list_pagination,omitempty"`
7373

7474
// configurations
75-
Capacity int64 `json:"capacity"`
76-
ReadPrice float64 `json:"read_price"`
77-
WritePrice float64 `json:"write_price"`
78-
MinLockDemand float64 `json:"min_lock_demand"`
75+
Capacity int64 `json:"capacity"`
76+
ReadPrice float64 `json:"read_price"`
77+
WritePrice float64 `json:"write_price"`
7978

8079
AllocationStats []*AllocationStats `json:"-"`
8180

@@ -106,7 +105,6 @@ func (bs *BlobberStats) loadBasicStats(ctx context.Context) {
106105
bs.Capacity = config.Configuration.Capacity
107106
bs.ReadPrice = config.Configuration.ReadPrice
108107
bs.WritePrice = config.Configuration.WritePrice
109-
bs.MinLockDemand = config.Configuration.MinLockDemand
110108
//
111109
du := filestore.GetFileStore().GetTotalFilesSize()
112110

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ const tpl = `
135135
<tr><td>Capacity</td><td>{{ byte_count_in_string .Capacity }}</td></tr>
136136
<tr><td>Read price</td><td>{{ .ReadPrice }}</td></tr>
137137
<tr><td>Write price</td><td>{{ .WritePrice }}</td></tr>
138-
<tr><td>Min lock demand</td><td>{{ .MinLockDemand }}</td></tr>
139138
</table>
140139
</td>
141140
<td valign='top'>

code/go/0chain.net/core/transaction/entity.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ type Terms struct {
4848
// WritePrice is price for reading. Token / GB. Also,
4949
// it used to calculate min_lock_demand value.
5050
WritePrice uint64 `json:"write_price"`
51-
// MinLockDemand in number in [0; 1] range. It represents part of
52-
// allocation should be locked for the blobber rewards even if
53-
// user never write something to the blobber.
54-
MinLockDemand float64 `json:"min_lock_demand"`
5551
}
5652

5753
type StakePoolSettings struct {

0 commit comments

Comments
 (0)