Skip to content

Commit de2f983

Browse files
committed
TODO: commented out missing datastructure
1 parent 7982665 commit de2f983

File tree

2 files changed

+46
-42
lines changed

2 files changed

+46
-42
lines changed

cmd/getallocation.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ var getallocationCmd = &cobra.Command{
120120
fmt.Println(" challenge_reward:", common.Balance(d.ChallengeReward), "(on challenge passed)")
121121
fmt.Println(" final_reward: ", common.Balance(d.FinalReward), "(if finalized)")
122122
fmt.Println(" terms: (allocation related terms)")
123-
fmt.Println(" read_price: ", d.Terms.ReadPrice, "tok / GB (by 64KB chunks)")
124-
fmt.Println(" write_price: ", d.Terms.WritePrice, "tok / GB")
123+
fmt.Println(" read_price: ", d.Terms.ReadPrice, "/ GB (by 64KB chunks)")
124+
fmt.Println(" write_price: ", d.Terms.WritePrice, "/ GB")
125125
fmt.Println(" min_lock_demand: ", d.Terms.MinLockDemand*100, "%")
126126
fmt.Println(" max_offer_duration: ", d.Terms.MaxOfferDuration)
127127
fmt.Println(" challenge_completion_time:", d.Terms.ChallengeCompletionTime)
@@ -160,9 +160,9 @@ var getallocationCmd = &cobra.Command{
160160

161161
fmt.Println(" price:")
162162
fmt.Println(" time_unit: ", alloc.TimeUnit)
163-
fmt.Println(" read_price: ", downloadCostFor1GB(alloc), "tok / GB (by 64KB)")
163+
fmt.Println(" read_price: ", downloadCostFor1GB(alloc), "/ GB (by 64KB)")
164164
fmt.Println(" write_price:", uploadCostFor1GB(alloc),
165-
fmt.Sprintf("tok / GB / %s", alloc.TimeUnit))
165+
fmt.Sprintf("/ GB / %s", alloc.TimeUnit))
166166
return
167167
},
168168
}

cmd/storage.go

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,40 @@ import (
1212
"github.com/spf13/cobra"
1313
)
1414

15-
func printStorageSCConfig(conf *sdk.StorageSCConfig) {
16-
fmt.Println("min_alloc_size: ", conf.MinAllocSize)
17-
fmt.Println("min_alloc_duration: ", conf.MinAllocDuration)
18-
fmt.Println("max_challenge_completion_time:", conf.MaxChallengeCompletionTime)
19-
fmt.Println("min_offer_duration: ", conf.MinOfferDuration)
20-
fmt.Println("min_blobber_capacity: ", conf.MinBlobberCapacity)
21-
fmt.Println("max_delegates: ", conf.MaxDelegates)
22-
fmt.Println("max_charge: ", conf.MaxCharge*100, "%")
23-
fmt.Println("readpool:")
24-
fmt.Println(" min_lock:", conf.ReadPool.MinLock, "tok")
25-
fmt.Println(" min_lock_period:", conf.ReadPool.MinLockPeriod)
26-
fmt.Println(" max_lock_period:", conf.ReadPool.MaxLockPeriod)
27-
fmt.Println("writepool:")
28-
fmt.Println(" min_lock:", conf.WritePool.MinLock, "tok")
29-
fmt.Println(" min_lock_period:", conf.WritePool.MinLockPeriod)
30-
fmt.Println(" max_lock_period:", conf.WritePool.MaxLockPeriod)
31-
fmt.Println("stakepool:")
32-
fmt.Println(" min_lock:", conf.StakePool.MinLock, "tok")
33-
fmt.Println(" interest_rate:", conf.StakePool.InterestRate)
34-
fmt.Println(" interest_interval:", conf.StakePool.InterestInterval)
35-
fmt.Println("validator_reward: ", conf.ValidatorReward)
36-
fmt.Println("blobber_slash: ", conf.BlobberSlash)
37-
fmt.Println("max_read_price: ", conf.MaxReadPrice, "tok / GB")
38-
fmt.Println("max_write_price: ", conf.MaxWritePrice, "tok / GB / time_unit")
39-
fmt.Println("time_unit: ", conf.TimeUnit)
40-
fmt.Println("failed_challenges_to_cancel: ", conf.FailedChallengesToCancel)
41-
fmt.Println("failed_challenges_to_revoke_min_lock:", conf.FailedChallengesToRevokeMinLock)
42-
fmt.Println("challenge_enabled: ", conf.ChallengeEnabled)
43-
fmt.Println("max_challenges_per_generation: ", conf.MaxChallengesPerGeneration)
44-
fmt.Println("challenge_rate_per_mb_min: ", conf.ChallengeGenerationRate)
45-
}
15+
// TODO: @Piers: update print logic sc-config; using datastructure might make sense instead of
16+
// InputMap because some fields have specific type (like Balance) which includes formatting logic
17+
18+
// func printStorageSCConfig(conf *sdk.StorageSCConfig) {
19+
// fmt.Println("min_alloc_size: ", conf.MinAllocSize)
20+
// fmt.Println("min_alloc_duration: ", conf.MinAllocDuration)
21+
// fmt.Println("max_challenge_completion_time:", conf.MaxChallengeCompletionTime)
22+
// fmt.Println("min_offer_duration: ", conf.MinOfferDuration)
23+
// fmt.Println("min_blobber_capacity: ", conf.MinBlobberCapacity)
24+
// fmt.Println("max_delegates: ", conf.MaxDelegates)
25+
// fmt.Println("max_charge: ", conf.MaxCharge*100, "%")
26+
// fmt.Println("readpool:")
27+
// fmt.Println(" min_lock:", conf.ReadPool.MinLock)
28+
// fmt.Println(" min_lock_period:", conf.ReadPool.MinLockPeriod)
29+
// fmt.Println(" max_lock_period:", conf.ReadPool.MaxLockPeriod)
30+
// fmt.Println("writepool:")
31+
// fmt.Println(" min_lock:", conf.WritePool.MinLock)
32+
// fmt.Println(" min_lock_period:", conf.WritePool.MinLockPeriod)
33+
// fmt.Println(" max_lock_period:", conf.WritePool.MaxLockPeriod)
34+
// fmt.Println("stakepool:")
35+
// fmt.Println(" min_lock:", conf.StakePool.MinLock)
36+
// fmt.Println(" interest_rate:", conf.StakePool.InterestRate)
37+
// fmt.Println(" interest_interval:", conf.StakePool.InterestInterval)
38+
// fmt.Println("validator_reward: ", conf.ValidatorReward)
39+
// fmt.Println("blobber_slash: ", conf.BlobberSlash)
40+
// fmt.Println("max_read_price: ", conf.MaxReadPrice, "/ GB")
41+
// fmt.Println("max_write_price: ", conf.MaxWritePrice, "/ GB / time_unit")
42+
// fmt.Println("time_unit: ", conf.TimeUnit)
43+
// fmt.Println("failed_challenges_to_cancel: ", conf.FailedChallengesToCancel)
44+
// fmt.Println("failed_challenges_to_revoke_min_lock:", conf.FailedChallengesToRevokeMinLock)
45+
// fmt.Println("challenge_enabled: ", conf.ChallengeEnabled)
46+
// fmt.Println("max_challenges_per_generation: ", conf.MaxChallengesPerGeneration)
47+
// fmt.Println("challenge_rate_per_mb_min: ", conf.ChallengeGenerationRate)
48+
// }
4649

4750
// scConfig shows SC configurations
4851
var scConfig = &cobra.Command{
@@ -60,7 +63,8 @@ var scConfig = &cobra.Command{
6063
util.PrintJSON(conf)
6164
return
6265
}
63-
printStorageSCConfig(conf)
66+
util.PrintJSON(conf.Fields)
67+
// printStorageSCConfig(conf)
6468
},
6569
}
6670

@@ -76,8 +80,8 @@ func printBlobbers(nodes []*sdk.Blobber) {
7680
val.Capacity.String())
7781
fmt.Println(" last_health_check: ", val.LastHealthCheck)
7882
fmt.Println(" terms:")
79-
fmt.Println(" read_price: ", val.Terms.ReadPrice.String(), "tok / GB")
80-
fmt.Println(" write_price: ", val.Terms.WritePrice.String(), "tok / GB / time_unit")
83+
fmt.Println(" read_price: ", val.Terms.ReadPrice.String(), "/ GB")
84+
fmt.Println(" write_price: ", val.Terms.WritePrice.String(), "/ GB / time_unit")
8185
fmt.Println(" min_lock_demand: ", val.Terms.MinLockDemand)
8286
fmt.Println(" cct: ", val.Terms.ChallengeCompletionTime.String())
8387
fmt.Println(" max_offer_duration: ", val.Terms.MaxOfferDuration.String())
@@ -168,15 +172,15 @@ var blobberInfoCmd = &cobra.Command{
168172
fmt.Println("last_health_check:", blob.LastHealthCheck.ToTime())
169173
fmt.Println("capacity_used: ", blob.Used)
170174
fmt.Println("terms:")
171-
fmt.Println(" read_price: ", blob.Terms.ReadPrice, "tok / GB")
172-
fmt.Println(" write_price: ", blob.Terms.WritePrice, "tok / GB")
175+
fmt.Println(" read_price: ", blob.Terms.ReadPrice, "/ GB")
176+
fmt.Println(" write_price: ", blob.Terms.WritePrice, "/ GB")
173177
fmt.Println(" min_lock_demand: ", blob.Terms.MinLockDemand*100.0, "%")
174178
fmt.Println(" max_offer_duration:", blob.Terms.MaxOfferDuration)
175179
fmt.Println(" cct: ", blob.Terms.ChallengeCompletionTime)
176180
fmt.Println("settings:")
177181
fmt.Println(" delegate_wallet:", blob.StakePoolSettings.DelegateWallet)
178-
fmt.Println(" min_stake: ", blob.StakePoolSettings.MinStake, "tok")
179-
fmt.Println(" max_stake: ", blob.StakePoolSettings.MaxStake, "tok")
182+
fmt.Println(" min_stake: ", blob.StakePoolSettings.MinStake)
183+
fmt.Println(" max_stake: ", blob.StakePoolSettings.MaxStake)
180184
fmt.Println(" num_delegates: ", blob.StakePoolSettings.NumDelegates)
181185
fmt.Println(" service_charge: ", blob.StakePoolSettings.ServiceCharge*100, "%")
182186
},

0 commit comments

Comments
 (0)