Skip to content

Commit

Permalink
rhp4: hard code temp sector duration
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Nov 15, 2024
1 parent a6327d7 commit 5010190
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 0 additions & 4 deletions rhp/v4/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ func (hs HostSettings) EncodeTo(e *types.Encoder) {
e.WriteBool(hs.AcceptingContracts)
types.V2Currency(hs.MaxCollateral).EncodeTo(e)
e.WriteUint64(hs.MaxContractDuration)
e.WriteUint64(hs.MaxSectorDuration)
e.WriteUint64(hs.MaxSectorBatchSize)
e.WriteUint64(hs.RemainingStorage)
e.WriteUint64(hs.TotalStorage)
hs.Prices.EncodeTo(e)
Expand All @@ -67,8 +65,6 @@ func (hs *HostSettings) DecodeFrom(d *types.Decoder) {
hs.AcceptingContracts = d.ReadBool()
(*types.V2Currency)(&hs.MaxCollateral).DecodeFrom(d)
hs.MaxContractDuration = d.ReadUint64()
hs.MaxSectorDuration = d.ReadUint64()
hs.MaxSectorBatchSize = d.ReadUint64()
hs.RemainingStorage = d.ReadUint64()
hs.TotalStorage = d.ReadUint64()
hs.Prices.DecodeFrom(d)
Expand Down
9 changes: 5 additions & 4 deletions rhp/v4/rhp.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const (
// the contract expires.
ProofWindow = 144 // 24 hours

TempSectorDuration = 144 * 3

Check failure on line 19 in rhp/v4/rhp.go

View workflow job for this annotation

GitHub Actions / test / test (1.23, ubuntu-latest)

exported: exported const TempSectorDuration should have comment (or a comment on this block) or be unexported (revive)
MaxSectorBatchSize = (1 << 40) / (SectorSize)

// SectorSize is the size of one sector in bytes.
SectorSize = 1 << 22 // 4 MiB
)
Expand Down Expand Up @@ -98,9 +101,9 @@ func (hp HostPrices) RPCReadSectorCost(length uint64) Usage {

// RPCWriteSectorCost returns the cost of executing the WriteSector RPC with the
// given sector length and duration.
func (hp HostPrices) RPCWriteSectorCost(sectorLength uint64, duration uint64) Usage {
func (hp HostPrices) RPCWriteSectorCost(sectorLength uint64) Usage {
return Usage{
Storage: hp.StoragePrice.Mul64(SectorSize).Mul64(duration),
Storage: hp.StoragePrice.Mul64(SectorSize).Mul64(TempSectorDuration),
Ingress: hp.IngressPrice.Mul64(round4KiB(sectorLength)),
}
}
Expand Down Expand Up @@ -171,8 +174,6 @@ type HostSettings struct {
AcceptingContracts bool `json:"acceptingContracts"`
MaxCollateral types.Currency `json:"maxCollateral"`
MaxContractDuration uint64 `json:"maxContractDuration"`
MaxSectorDuration uint64 `json:"maxSectorDuration"`
MaxSectorBatchSize uint64 `json:"maxSectorBatchSize"`
RemainingStorage uint64 `json:"remainingStorage"`
TotalStorage uint64 `json:"totalStorage"`
Prices HostPrices `json:"prices"`
Expand Down

0 comments on commit 5010190

Please sign in to comment.