2
0
mirror of synced 2025-02-13 08:56:30 +00:00

Merge branch 'master' into feature/containerless-codex

# Conflicts:
#	Tools/AutoClient/CodexInstance.cs
This commit is contained in:
ThatBen 2025-01-25 14:07:41 +01:00
commit 951da1888d
No known key found for this signature in database
GPG Key ID: 62C543548433D43E
14 changed files with 94 additions and 94 deletions

View File

@ -58,8 +58,8 @@ namespace CodexClient
return new CodexOpenApi.SalesAvailabilityCREATE return new CodexOpenApi.SalesAvailabilityCREATE
{ {
Duration = ToDecInt(availability.MaxDuration.TotalSeconds), Duration = ToDecInt(availability.MaxDuration.TotalSeconds),
MinPrice = ToDecInt(availability.MinPriceForTotalSpace), MinPricePerBytePerSecond = ToDecInt(availability.MinPricePerBytePerSecond),
MaxCollateral = ToDecInt(availability.MaxCollateral), TotalCollateral = ToDecInt(availability.TotalCollateral),
TotalSize = ToDecInt(availability.TotalSpace.SizeInBytes) TotalSize = ToDecInt(availability.TotalSpace.SizeInBytes)
}; };
} }
@ -70,8 +70,8 @@ namespace CodexClient
{ {
Duration = ToDecInt(purchase.Duration.TotalSeconds), Duration = ToDecInt(purchase.Duration.TotalSeconds),
ProofProbability = ToDecInt(purchase.ProofProbability), ProofProbability = ToDecInt(purchase.ProofProbability),
Reward = ToDecInt(purchase.PricePerSlotPerSecond), PricePerBytePerSecond = ToDecInt(purchase.PricePerBytePerSecond),
Collateral = ToDecInt(purchase.RequiredCollateral), CollateralPerByte = ToDecInt(purchase.CollateralPerByte),
Expiry = ToDecInt(purchase.Expiry.TotalSeconds), Expiry = ToDecInt(purchase.Expiry.TotalSeconds),
Nodes = Convert.ToInt32(purchase.MinRequiredNumberOfNodes), Nodes = Convert.ToInt32(purchase.MinRequiredNumberOfNodes),
Tolerance = Convert.ToInt32(purchase.NodeFailureTolerance) Tolerance = Convert.ToInt32(purchase.NodeFailureTolerance)
@ -89,8 +89,8 @@ namespace CodexClient
( (
ToByteSize(availability.TotalSize), ToByteSize(availability.TotalSize),
ToTimespan(availability.Duration), ToTimespan(availability.Duration),
new TestToken(ToBigIng(availability.MinPrice)), new TestToken(ToBigIng(availability.MinPricePerBytePerSecond)),
new TestToken(ToBigIng(availability.MaxCollateral)) new TestToken(ToBigIng(availability.TotalCollateral))
) )
{ {
Id = availability.Id, Id = availability.Id,

View File

@ -11,8 +11,8 @@ namespace CodexClient
} }
public ContentId ContentId { get; set; } public ContentId ContentId { get; set; }
public TestToken PricePerSlotPerSecond { get; set; } = 1.TstWei(); public TestToken PricePerBytePerSecond { get; set; } = 1.TstWei();
public TestToken RequiredCollateral { get; set; } = 1.TstWei(); public TestToken CollateralPerByte { get; set; } = 1.TstWei();
public uint MinRequiredNumberOfNodes { get; set; } public uint MinRequiredNumberOfNodes { get; set; }
public uint NodeFailureTolerance { get; set; } public uint NodeFailureTolerance { get; set; }
public int ProofProbability { get; set; } public int ProofProbability { get; set; }
@ -22,8 +22,8 @@ namespace CodexClient
public void Log(ILog log) public void Log(ILog log)
{ {
log.Log($"Requesting storage for: {ContentId.Id}... (" + log.Log($"Requesting storage for: {ContentId.Id}... (" +
$"pricePerSlotPerSecond: {PricePerSlotPerSecond}, " + $"pricePerBytePerSecond: {PricePerBytePerSecond}, " +
$"requiredCollateral: {RequiredCollateral}, " + $"collateralPerByte: {CollateralPerByte}, " +
$"minRequiredNumberOfNodes: {MinRequiredNumberOfNodes}, " + $"minRequiredNumberOfNodes: {MinRequiredNumberOfNodes}, " +
$"nodeFailureTolerance: {NodeFailureTolerance}, " + $"nodeFailureTolerance: {NodeFailureTolerance}, " +
$"proofProbability: {ProofProbability}, " + $"proofProbability: {ProofProbability}, " +
@ -74,19 +74,19 @@ namespace CodexClient
public class StorageAvailability public class StorageAvailability
{ {
public StorageAvailability(ByteSize totalSpace, TimeSpan maxDuration, TestToken minPriceForTotalSpace, TestToken maxCollateral) public StorageAvailability(ByteSize totalSpace, TimeSpan maxDuration, TestToken minPricePerBytePerSecond, TestToken totalCollateral)
{ {
TotalSpace = totalSpace; TotalSpace = totalSpace;
MaxDuration = maxDuration; MaxDuration = maxDuration;
MinPriceForTotalSpace = minPriceForTotalSpace; MinPricePerBytePerSecond = minPricePerBytePerSecond;
MaxCollateral = maxCollateral; TotalCollateral = totalCollateral;
} }
public string Id { get; set; } = string.Empty; public string Id { get; set; } = string.Empty;
public ByteSize TotalSpace { get; } public ByteSize TotalSpace { get; }
public TimeSpan MaxDuration { get; } public TimeSpan MaxDuration { get; }
public TestToken MinPriceForTotalSpace { get; } public TestToken MinPricePerBytePerSecond { get; }
public TestToken MaxCollateral { get; } public TestToken TotalCollateral { get; }
public ByteSize FreeSpace { get; set; } = ByteSize.Zero; public ByteSize FreeSpace { get; set; } = ByteSize.Zero;
public void Log(ILog log) public void Log(ILog log)
@ -94,8 +94,8 @@ namespace CodexClient
log.Log($"Storage Availability: (" + log.Log($"Storage Availability: (" +
$"totalSize: {TotalSpace}, " + $"totalSize: {TotalSpace}, " +
$"maxDuration: {Time.FormatDuration(MaxDuration)}, " + $"maxDuration: {Time.FormatDuration(MaxDuration)}, " +
$"minPriceForTotalSpace: {MinPriceForTotalSpace}, " + $"minPricePerBytePerSecond: {MinPricePerBytePerSecond}, " +
$"maxCollateral: {MaxCollateral})"); $"totalCollateral: {TotalCollateral})");
} }
} }
} }

View File

@ -6,7 +6,7 @@ info:
description: "List of endpoints and interfaces available to Codex API users" description: "List of endpoints and interfaces available to Codex API users"
security: security:
- { } - {}
components: components:
schemas: schemas:
@ -50,9 +50,9 @@ components:
type: string type: string
description: Address of Ethereum address description: Address of Ethereum address
Reward: PricePerBytePerSecond:
type: string type: string
description: The maximum amount of tokens paid per second per slot to hosts the client is willing to pay description: The amount of tokens paid per byte per second per slot to hosts the client is willing to pay
Duration: Duration:
type: string type: string
@ -157,12 +157,12 @@ components:
description: Total size of availability's storage in bytes as decimal string description: Total size of availability's storage in bytes as decimal string
duration: duration:
$ref: "#/components/schemas/Duration" $ref: "#/components/schemas/Duration"
minPrice: minPricePerBytePerSecond:
type: string type: string
description: Minimal price paid (in amount of tokens) for the whole hosted request's slot for the request's duration as decimal string description: Minimal price per byte per second paid (in amount of tokens) for the hosted request's slot for the request's duration as decimal string
maxCollateral: totalCollateral:
type: string type: string
description: Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string description: Total collateral (in amount of tokens) that can be used for matching requests
SalesAvailabilityREAD: SalesAvailabilityREAD:
allOf: allOf:
@ -178,8 +178,8 @@ components:
- $ref: "#/components/schemas/SalesAvailability" - $ref: "#/components/schemas/SalesAvailability"
- required: - required:
- totalSize - totalSize
- minPrice - minPricePerBytePerSecond
- maxCollateral - totalCollateral
- duration - duration
Slot: Slot:
@ -243,16 +243,16 @@ components:
StorageRequestCreation: StorageRequestCreation:
type: object type: object
required: required:
- reward - pricePerBytePerSecond
- duration - duration
- proofProbability - proofProbability
- collateral - collateralPerByte
- expiry - expiry
properties: properties:
duration: duration:
$ref: "#/components/schemas/Duration" $ref: "#/components/schemas/Duration"
reward: pricePerBytePerSecond:
$ref: "#/components/schemas/Reward" $ref: "#/components/schemas/PricePerBytePerSecond"
proofProbability: proofProbability:
$ref: "#/components/schemas/ProofProbability" $ref: "#/components/schemas/ProofProbability"
nodes: nodes:
@ -263,16 +263,16 @@ components:
description: Additional number of nodes on top of the `nodes` property that can be lost before pronouncing the content lost description: Additional number of nodes on top of the `nodes` property that can be lost before pronouncing the content lost
type: integer type: integer
default: 0 default: 0
collateral: collateralPerByte:
type: string type: string
description: Number as decimal string that represents how much collateral is asked from hosts that wants to fill a slots description: Number as decimal string that represents how much collateral per byte is asked from hosts that wants to fill a slots
expiry: expiry:
type: string type: string
description: Number as decimal string that represents expiry threshold in seconds from when the Request is submitted. When the threshold is reached and the Request does not find requested amount of nodes to host the data, the Request is voided. The number of seconds can not be higher then the Request's duration itself. description: Number as decimal string that represents expiry threshold in seconds from when the Request is submitted. When the threshold is reached and the Request does not find requested amount of nodes to host the data, the Request is voided. The number of seconds can not be higher then the Request's duration itself.
StorageAsk: StorageAsk:
type: object type: object
required: required:
- reward - pricePerBytePerSecond
properties: properties:
slots: slots:
description: Number of slots (eq. hosts) that the Request want to have the content spread over description: Number of slots (eq. hosts) that the Request want to have the content spread over
@ -284,8 +284,8 @@ components:
$ref: "#/components/schemas/Duration" $ref: "#/components/schemas/Duration"
proofProbability: proofProbability:
$ref: "#/components/schemas/ProofProbability" $ref: "#/components/schemas/ProofProbability"
reward: pricePerBytePerSecond:
$ref: "#/components/schemas/Reward" $ref: "#/components/schemas/PricePerBytePerSecond"
maxSlotLoss: maxSlotLoss:
type: integer type: integer
description: Max slots that can be lost without data considered to be lost description: Max slots that can be lost without data considered to be lost
@ -418,14 +418,14 @@ paths:
description: | description: |
If `addrs` param is supplied, it will be used to dial the peer, otherwise the `peerId` is used If `addrs` param is supplied, it will be used to dial the peer, otherwise the `peerId` is used
to invoke peer discovery, if it succeeds the returned addresses will be used to dial. to invoke peer discovery, if it succeeds the returned addresses will be used to dial.
tags: [ Node ] tags: [Node]
operationId: connectPeer operationId: connectPeer
parameters: parameters:
- in: path - in: path
name: peerId name: peerId
required: true required: true
schema: schema:
$ref: "#/components/schemas/PeerId" $ref: "#/components/schemas/PeerId"
description: Peer that should be dialed. description: Peer that should be dialed.
- in: query - in: query
name: addrs name: addrs
@ -448,7 +448,7 @@ paths:
"/data": "/data":
get: get:
summary: "Lists manifest CIDs stored locally in node." summary: "Lists manifest CIDs stored locally in node."
tags: [ Data ] tags: [Data]
operationId: listData operationId: listData
responses: responses:
"200": "200":
@ -468,7 +468,7 @@ paths:
description: Well it was bad-bad description: Well it was bad-bad
post: post:
summary: "Upload a file in a streaming manner. Once finished, the file is stored in the node and can be retrieved by any node in the network using the returned CID." summary: "Upload a file in a streaming manner. Once finished, the file is stored in the node and can be retrieved by any node in the network using the returned CID."
tags: [ Data ] tags: [Data]
operationId: upload operationId: upload
parameters: parameters:
- name: content-type - name: content-type
@ -484,7 +484,7 @@ paths:
description: The content disposition used to send the filename. description: The content disposition used to send the filename.
schema: schema:
type: string type: string
example: "attachment; filename=\"codex.png\"" example: 'attachment; filename="codex.png"'
requestBody: requestBody:
content: content:
application/octet-stream: application/octet-stream:
@ -504,14 +504,14 @@ paths:
"/data/{cid}": "/data/{cid}":
get: get:
summary: "Download a file from the local node in a streaming manner. If the file is not available locally, a 404 is returned." summary: "Download a file from the local node in a streaming manner. If the file is not available locally, a 404 is returned."
tags: [ Data ] tags: [Data]
operationId: downloadLocal operationId: downloadLocal
parameters: parameters:
- in: path - in: path
name: cid name: cid
required: true required: true
schema: schema:
$ref: "#/components/schemas/Cid" $ref: "#/components/schemas/Cid"
description: File to be downloaded. description: File to be downloaded.
responses: responses:
@ -532,14 +532,14 @@ paths:
"/data/{cid}/network": "/data/{cid}/network":
post: post:
summary: "Download a file from the network to the local node if it's not available locally. Note: Download is performed async. Call can return before download is completed." summary: "Download a file from the network to the local node if it's not available locally. Note: Download is performed async. Call can return before download is completed."
tags: [ Data ] tags: [Data]
operationId: downloadNetwork operationId: downloadNetwork
parameters: parameters:
- in: path - in: path
name: cid name: cid
required: true required: true
schema: schema:
$ref: "#/components/schemas/Cid" $ref: "#/components/schemas/Cid"
description: "File to be downloaded." description: "File to be downloaded."
responses: responses:
"200": "200":
@ -558,14 +558,14 @@ paths:
"/data/{cid}/network/stream": "/data/{cid}/network/stream":
get: get:
summary: "Download a file from the network in a streaming manner. If the file is not available locally, it will be retrieved from other nodes in the network if able." summary: "Download a file from the network in a streaming manner. If the file is not available locally, it will be retrieved from other nodes in the network if able."
tags: [ Data ] tags: [Data]
operationId: downloadNetworkStream operationId: downloadNetworkStream
parameters: parameters:
- in: path - in: path
name: cid name: cid
required: true required: true
schema: schema:
$ref: "#/components/schemas/Cid" $ref: "#/components/schemas/Cid"
description: "File to be downloaded." description: "File to be downloaded."
responses: responses:
"200": "200":
@ -585,14 +585,14 @@ paths:
"/data/{cid}/network/manifest": "/data/{cid}/network/manifest":
get: get:
summary: "Download only the dataset manifest from the network to the local node if it's not available locally." summary: "Download only the dataset manifest from the network to the local node if it's not available locally."
tags: [ Data ] tags: [Data]
operationId: downloadNetworkManifest operationId: downloadNetworkManifest
parameters: parameters:
- in: path - in: path
name: cid name: cid
required: true required: true
schema: schema:
$ref: "#/components/schemas/Cid" $ref: "#/components/schemas/Cid"
description: "File for which the manifest is to be downloaded." description: "File for which the manifest is to be downloaded."
responses: responses:
"200": "200":
@ -611,7 +611,7 @@ paths:
"/space": "/space":
get: get:
summary: "Gets a summary of the storage space allocation of the node." summary: "Gets a summary of the storage space allocation of the node."
tags: [ Data ] tags: [Data]
operationId: space operationId: space
responses: responses:
"200": "200":
@ -627,7 +627,7 @@ paths:
"/sales/slots": "/sales/slots":
get: get:
summary: "Returns active slots" summary: "Returns active slots"
tags: [ Marketplace ] tags: [Marketplace]
operationId: getActiveSlots operationId: getActiveSlots
responses: responses:
"200": "200":
@ -645,7 +645,7 @@ paths:
"/sales/slots/{slotId}": "/sales/slots/{slotId}":
get: get:
summary: "Returns active slot with id {slotId} for the host" summary: "Returns active slot with id {slotId} for the host"
tags: [ Marketplace ] tags: [Marketplace]
operationId: getActiveSlotById operationId: getActiveSlotById
parameters: parameters:
- in: path - in: path
@ -674,7 +674,7 @@ paths:
"/sales/availability": "/sales/availability":
get: get:
summary: "Returns storage that is for sale" summary: "Returns storage that is for sale"
tags: [ Marketplace ] tags: [Marketplace]
operationId: getAvailabilities operationId: getAvailabilities
responses: responses:
"200": "200":
@ -693,7 +693,7 @@ paths:
post: post:
summary: "Offers storage for sale" summary: "Offers storage for sale"
operationId: offerStorage operationId: offerStorage
tags: [ Marketplace ] tags: [Marketplace]
requestBody: requestBody:
content: content:
application/json: application/json:
@ -721,7 +721,7 @@ paths:
The new parameters will be only considered for new requests. The new parameters will be only considered for new requests.
Existing Requests linked to this Availability will continue as is. Existing Requests linked to this Availability will continue as is.
operationId: updateOfferedStorage operationId: updateOfferedStorage
tags: [ Marketplace ] tags: [Marketplace]
parameters: parameters:
- in: path - in: path
name: id name: id
@ -753,7 +753,7 @@ paths:
summary: "Get availability's reservations" summary: "Get availability's reservations"
description: Return's list of Reservations for ongoing Storage Requests that the node hosts. description: Return's list of Reservations for ongoing Storage Requests that the node hosts.
operationId: getReservations operationId: getReservations
tags: [ Marketplace ] tags: [Marketplace]
parameters: parameters:
- in: path - in: path
name: id name: id
@ -782,7 +782,7 @@ paths:
"/storage/request/{cid}": "/storage/request/{cid}":
post: post:
summary: "Creates a new Request for storage" summary: "Creates a new Request for storage"
tags: [ Marketplace ] tags: [Marketplace]
operationId: createStorageRequest operationId: createStorageRequest
parameters: parameters:
- in: path - in: path
@ -813,7 +813,7 @@ paths:
"/storage/purchases": "/storage/purchases":
get: get:
summary: "Returns list of purchase IDs" summary: "Returns list of purchase IDs"
tags: [ Marketplace ] tags: [Marketplace]
operationId: getPurchases operationId: getPurchases
responses: responses:
"200": "200":
@ -830,7 +830,7 @@ paths:
"/storage/purchases/{id}": "/storage/purchases/{id}":
get: get:
summary: "Returns purchase details" summary: "Returns purchase details"
tags: [ Marketplace ] tags: [Marketplace]
operationId: getPurchase operationId: getPurchase
parameters: parameters:
- in: path - in: path
@ -857,7 +857,7 @@ paths:
get: get:
summary: "Get Node's SPR" summary: "Get Node's SPR"
operationId: getSPR operationId: getSPR
tags: [ Node ] tags: [Node]
responses: responses:
"200": "200":
description: Node's SPR description: Node's SPR
@ -875,7 +875,7 @@ paths:
get: get:
summary: "Get Node's PeerID" summary: "Get Node's PeerID"
operationId: getPeerId operationId: getPeerId
tags: [ Node ] tags: [Node]
responses: responses:
"200": "200":
description: Node's Peer ID description: Node's Peer ID
@ -890,7 +890,7 @@ paths:
"/debug/chronicles/loglevel": "/debug/chronicles/loglevel":
post: post:
summary: "Set log level at run time" summary: "Set log level at run time"
tags: [ Debug ] tags: [Debug]
operationId: setDebugLogLevel operationId: setDebugLogLevel
parameters: parameters:
@ -912,7 +912,7 @@ paths:
get: get:
summary: "Gets node information" summary: "Gets node information"
operationId: getDebugInfo operationId: getDebugInfo
tags: [ Debug ] tags: [Debug]
responses: responses:
"200": "200":
description: Node's information description: Node's information

View File

@ -10,7 +10,7 @@ namespace CodexPlugin
public class ApiChecker public class ApiChecker
{ {
// <INSERT-OPENAPI-YAML-HASH> // <INSERT-OPENAPI-YAML-HASH>
private const string OpenApiYamlHash = "13-5A-2D-11-AD-A8-4B-72-95-5E-72-50-05-26-08-C4-53-AA-E9-FA-14-54-F8-1B-A7-C2-7C-2D-C6-4D-5D-F0"; private const string OpenApiYamlHash = "6E-0D-3F-26-51-3B-C0-16-1A-A4-81-86-80-CA-08-BC-CB-6C-8A-2C-49-4B-30-CB-75-D8-0F-EA-9D-57-D6-8A";
private const string OpenApiFilePath = "/codex/openapi.yaml"; private const string OpenApiFilePath = "/codex/openapi.yaml";
private const string DisableEnvironmentVariable = "CODEXPLUGIN_DISABLE_APICHECK"; private const string DisableEnvironmentVariable = "CODEXPLUGIN_DISABLE_APICHECK";

View File

@ -11,7 +11,7 @@ namespace CodexReleaseTests.MarketTests
protected override int NumberOfClients => 1; protected override int NumberOfClients => 1;
protected override ByteSize HostAvailabilitySize => 1.GB(); protected override ByteSize HostAvailabilitySize => 1.GB();
protected override TimeSpan HostAvailabilityMaxDuration => TimeSpan.FromDays(1.0); protected override TimeSpan HostAvailabilityMaxDuration => TimeSpan.FromDays(1.0);
private readonly TestToken pricePerSlotPerSecond = 10.TstWei(); private readonly TestToken pricePerBytePerSecond = 10.TstWei();
[Test] [Test]
[Ignore("Disabled for now: Test is unstable.")] [Ignore("Disabled for now: Test is unstable.")]
@ -96,9 +96,9 @@ namespace CodexReleaseTests.MarketTests
Expiry = TimeSpan.FromHours(0.2), Expiry = TimeSpan.FromHours(0.2),
MinRequiredNumberOfNodes = (uint)NumberOfHosts, MinRequiredNumberOfNodes = (uint)NumberOfHosts,
NodeFailureTolerance = (uint)(NumberOfHosts / 2), NodeFailureTolerance = (uint)(NumberOfHosts / 2),
PricePerSlotPerSecond = pricePerSlotPerSecond, PricePerBytePerSecond = pricePerBytePerSecond,
ProofProbability = 1, // Require a proof every period ProofProbability = 1, // Require a proof every period
RequiredCollateral = 1.Tst() CollateralPerByte = 1.Tst()
}); });
} }
} }

View File

@ -13,7 +13,7 @@ namespace CodexReleaseTests.MarketTests
protected override int NumberOfClients => 1; protected override int NumberOfClients => 1;
protected override ByteSize HostAvailabilitySize => (5 * FilesizeMb).MB(); protected override ByteSize HostAvailabilitySize => (5 * FilesizeMb).MB();
protected override TimeSpan HostAvailabilityMaxDuration => Get8TimesConfiguredPeriodDuration(); protected override TimeSpan HostAvailabilityMaxDuration => Get8TimesConfiguredPeriodDuration();
private readonly TestToken pricePerSlotPerSecond = 10.TstWei(); private readonly TestToken pricePerBytePerSecond = 10.TstWei();
[Test] [Test]
public void ContractSuccessful() public void ContractSuccessful()
@ -31,8 +31,8 @@ namespace CodexReleaseTests.MarketTests
request.WaitForStorageContractFinished(); request.WaitForStorageContractFinished();
AssertClientHasPaidForContract(pricePerSlotPerSecond, client, request, hosts); AssertClientHasPaidForContract(pricePerBytePerSecond, client, request, hosts);
AssertHostsWerePaidForContract(pricePerSlotPerSecond, request, hosts); AssertHostsWerePaidForContract(pricePerBytePerSecond, request, hosts);
AssertHostsCollateralsAreUnchanged(hosts); AssertHostsCollateralsAreUnchanged(hosts);
} }
@ -49,9 +49,9 @@ namespace CodexReleaseTests.MarketTests
// When it's resolved, we can reduce the number of hosts and slim down this test. // When it's resolved, we can reduce the number of hosts and slim down this test.
MinRequiredNumberOfNodes = 3, MinRequiredNumberOfNodes = 3,
NodeFailureTolerance = 1, NodeFailureTolerance = 1,
PricePerSlotPerSecond = pricePerSlotPerSecond, PricePerBytePerSecond = pricePerBytePerSecond,
ProofProbability = 20, ProofProbability = 20,
RequiredCollateral = 1.Tst() CollateralPerByte = 1.Tst()
}); });
} }

View File

@ -71,8 +71,8 @@ namespace CodexReleaseTests.MarketTests
host.Marketplace.MakeStorageAvailable(new StorageAvailability( host.Marketplace.MakeStorageAvailable(new StorageAvailability(
totalSpace: HostAvailabilitySize, totalSpace: HostAvailabilitySize,
maxDuration: HostAvailabilityMaxDuration, maxDuration: HostAvailabilityMaxDuration,
minPriceForTotalSpace: 1.TstWei(), minPricePerBytePerSecond: 1.TstWei(),
maxCollateral: 999999.Tst()) totalCollateral: 999999.Tst())
); );
} }
return hosts; return hosts;

View File

@ -13,7 +13,7 @@ namespace CodexReleaseTests.MarketTests
protected override int NumberOfClients => 3; protected override int NumberOfClients => 3;
protected override ByteSize HostAvailabilitySize => (5 * FilesizeMb).MB(); protected override ByteSize HostAvailabilitySize => (5 * FilesizeMb).MB();
protected override TimeSpan HostAvailabilityMaxDuration => Get8TimesConfiguredPeriodDuration(); protected override TimeSpan HostAvailabilityMaxDuration => Get8TimesConfiguredPeriodDuration();
private readonly TestToken pricePerSlotPerSecond = 10.TstWei(); private readonly TestToken pricePerBytePerSecond = 10.TstWei();
[Test] [Test]
[Ignore("TODO - Test where multiple successful contracts are run simultaenously")] [Ignore("TODO - Test where multiple successful contracts are run simultaenously")]
@ -64,9 +64,9 @@ namespace CodexReleaseTests.MarketTests
Expiry = GetContractExpiry(), Expiry = GetContractExpiry(),
MinRequiredNumberOfNodes = (uint)NumberOfHosts, MinRequiredNumberOfNodes = (uint)NumberOfHosts,
NodeFailureTolerance = (uint)(NumberOfHosts / 2), NodeFailureTolerance = (uint)(NumberOfHosts / 2),
PricePerSlotPerSecond = pricePerSlotPerSecond, PricePerBytePerSecond = pricePerBytePerSecond,
ProofProbability = 20, ProofProbability = 20,
RequiredCollateral = 1.Tst() CollateralPerByte = 1.Tst()
}); });
} }

View File

@ -52,8 +52,8 @@ namespace CodexTests.BasicTests
var availability = new StorageAvailability( var availability = new StorageAvailability(
totalSpace: 10.GB(), totalSpace: 10.GB(),
maxDuration: TimeSpan.FromMinutes(30), maxDuration: TimeSpan.FromMinutes(30),
minPriceForTotalSpace: 1.TstWei(), minPricePerBytePerSecond: 1.TstWei(),
maxCollateral: 20.TstWei() totalCollateral: 20.TstWei()
); );
host.Marketplace.MakeStorageAvailable(availability); host.Marketplace.MakeStorageAvailable(availability);
} }
@ -71,8 +71,8 @@ namespace CodexTests.BasicTests
var purchase = new StoragePurchaseRequest(uploadCid) var purchase = new StoragePurchaseRequest(uploadCid)
{ {
PricePerSlotPerSecond = 2.TstWei(), PricePerBytePerSecond = 2.TstWei(),
RequiredCollateral = 10.TstWei(), CollateralPerByte = 10.TstWei(),
MinRequiredNumberOfNodes = 5, MinRequiredNumberOfNodes = 5,
NodeFailureTolerance = 2, NodeFailureTolerance = 2,
ProofProbability = 5, ProofProbability = 5,

View File

@ -119,8 +119,8 @@ namespace CodexTests.UtilityTests
var contentId = client.UploadFile(testFile); var contentId = client.UploadFile(testFile);
var purchase = new StoragePurchaseRequest(contentId) var purchase = new StoragePurchaseRequest(contentId)
{ {
PricePerSlotPerSecond = 2.TstWei(), PricePerBytePerSecond = 2.TstWei(),
RequiredCollateral = 10.TstWei(), CollateralPerByte = 10.TstWei(),
MinRequiredNumberOfNodes = GetNumberOfRequiredHosts(), MinRequiredNumberOfNodes = GetNumberOfRequiredHosts(),
NodeFailureTolerance = 2, NodeFailureTolerance = 2,
ProofProbability = 5, ProofProbability = 5,
@ -200,8 +200,8 @@ namespace CodexTests.UtilityTests
var availability = new StorageAvailability( var availability = new StorageAvailability(
totalSpace: Mult(GetMinFileSize(), GetNumberOfLiveHosts()), totalSpace: Mult(GetMinFileSize(), GetNumberOfLiveHosts()),
maxDuration: TimeSpan.FromMinutes(30), maxDuration: TimeSpan.FromMinutes(30),
minPriceForTotalSpace: 1.TstWei(), minPricePerBytePerSecond: 1.TstWei(),
maxCollateral: hostInitialBalance totalCollateral: hostInitialBalance
); );
foreach (var host in hosts) foreach (var host in hosts)

View File

@ -29,11 +29,11 @@ namespace AutoClient
[Uniform("num-hosts-tolerance", "nt", "NUMTOL", false, "Number of host tolerance for contract. (default 5)")] [Uniform("num-hosts-tolerance", "nt", "NUMTOL", false, "Number of host tolerance for contract. (default 5)")]
public int HostTolerance { get; set; } = 1; public int HostTolerance { get; set; } = 1;
[Uniform("price","p", "PRICE", false, "Price of contract. (default 10)")] [Uniform("price","p", "PRICE", false, "Price per byte per second in TSTWEI. (default 1000)")]
public int Price { get; set; } = 1000; public int PricePerBytePerSecond { get; set; } = 1000;
[Uniform("collateral", "c", "COLLATERAL", false, "Required collateral. (default 1)")] [Uniform("collateral", "c", "COLLATERAL", false, "Required collateral per byte in TSTWEI. (default 1)")]
public int RequiredCollateral { get; set; } = 1; public int CollateralPerByte { get; set; } = 1;
[Uniform("filesizemb", "smb", "FILESIZEMB", false, "When greater than zero, size of file generated and uploaded. When zero, random images are used instead.")] [Uniform("filesizemb", "smb", "FILESIZEMB", false, "When greater than zero, size of file generated and uploaded. When zero, random images are used instead.")]
public int FileSizeMb { get; set; } = 0; public int FileSizeMb { get; set; } = 0;

View File

@ -72,8 +72,8 @@ namespace CodexNetDeployer
var availability = new StorageAvailability( var availability = new StorageAvailability(
totalSpace: config.StorageSell!.Value.MB(), totalSpace: config.StorageSell!.Value.MB(),
maxDuration: TimeSpan.FromSeconds(config.MaxDuration), maxDuration: TimeSpan.FromSeconds(config.MaxDuration),
minPriceForTotalSpace: config.MinPrice.TstWei(), minPricePerBytePerSecond: config.MinPricePerBytePerSecond.TstWei(),
maxCollateral: config.MaxCollateral.TstWei() totalCollateral: config.MaxCollateral.TstWei()
); );
var response = codexNode.Marketplace.MakeStorageAvailable(availability); var response = codexNode.Marketplace.MakeStorageAvailable(availability);

View File

@ -56,8 +56,8 @@ namespace CodexNetDeployer
[Uniform("test-tokens", "tt", "TESTTOKENS", false, "Initial amount of test-tokens minted for each Codex node.")] [Uniform("test-tokens", "tt", "TESTTOKENS", false, "Initial amount of test-tokens minted for each Codex node.")]
public int InitialTestTokens { get; set; } public int InitialTestTokens { get; set; }
[Uniform("min-price", "mp", "MINPRICE", false, "Minimum price for the storage space for which contracts will be accepted.")] [Uniform("min-price", "mp", "MINPRICE", false, "Minimum price per byte per second in TSTWEI for the storage space for which contracts will be accepted.")]
public int MinPrice { get; set; } public int MinPricePerBytePerSecond { get; set; }
[Uniform("max-collateral", "mc", "MAXCOLLATERAL", false, "Maximum collateral that will be placed for the total storage space.")] [Uniform("max-collateral", "mc", "MAXCOLLATERAL", false, "Maximum collateral that will be placed for the total storage space.")]
public int MaxCollateral { get; set; } public int MaxCollateral { get; set; }
@ -144,7 +144,7 @@ namespace CodexNetDeployer
{ {
IntIsOverZero(nameof(StorageSell), StorageSell, errors); IntIsOverZero(nameof(StorageSell), StorageSell, errors);
IntIsOverZero(nameof(InitialTestTokens), InitialTestTokens, errors); IntIsOverZero(nameof(InitialTestTokens), InitialTestTokens, errors);
IntIsOverZero(nameof(MinPrice), MinPrice, errors); IntIsOverZero(nameof(MinPricePerBytePerSecond), MinPricePerBytePerSecond, errors);
IntIsOverZero(nameof(MaxCollateral), MaxCollateral, errors); IntIsOverZero(nameof(MaxCollateral), MaxCollateral, errors);
IntIsOverZero(nameof(MaxDuration), MaxDuration, errors); IntIsOverZero(nameof(MaxDuration), MaxDuration, errors);
} }

View File

@ -236,7 +236,7 @@ namespace CodexNetDeployer
storageQuotaMB: config.StorageQuota!.Value, storageQuotaMB: config.StorageQuota!.Value,
codexLogLevel: config.CodexLogLevel, codexLogLevel: config.CodexLogLevel,
initialTestTokens: config.InitialTestTokens, initialTestTokens: config.InitialTestTokens,
minPrice: config.MinPrice, minPrice: config.MinPricePerBytePerSecond,
maxCollateral: config.MaxCollateral, maxCollateral: config.MaxCollateral,
maxDuration: config.MaxDuration, maxDuration: config.MaxDuration,
blockTTL: config.BlockTTL, blockTTL: config.BlockTTL,