diff --git a/rhp/v4/encoding.go b/rhp/v4/encoding.go index 01c14bb..720baba 100644 --- a/rhp/v4/encoding.go +++ b/rhp/v4/encoding.go @@ -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) @@ -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) diff --git a/rhp/v4/rhp.go b/rhp/v4/rhp.go index 520971b..bba267a 100644 --- a/rhp/v4/rhp.go +++ b/rhp/v4/rhp.go @@ -16,6 +16,15 @@ const ( // the contract expires. ProofWindow = 144 // 24 hours + // TempSectorDuration is the number of blocks that temp sectors are expected to be stored + // before being removed + TempSectorDuration = 144 * 3 + + // MaxSectorBatchSize is the number of sector operations that can be batched into a single RPC. + // For example, the number of sectors appended to a contract within a single RPC append call or the + // number of sectors removed in a single RPC free call. + MaxSectorBatchSize = (1 << 40) / (SectorSize) + // SectorSize is the size of one sector in bytes. SectorSize = 1 << 22 // 4 MiB ) @@ -98,9 +107,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)), } } @@ -171,8 +180,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"`