Updates codex api
This commit is contained in:
parent
8ef190baad
commit
caa0423bd5
@ -10,7 +10,7 @@ namespace CodexPlugin
|
||||
public class ApiChecker
|
||||
{
|
||||
// <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 DisableEnvironmentVariable = "CODEXPLUGIN_DISABLE_APICHECK";
|
||||
|
||||
|
@ -60,8 +60,8 @@ namespace CodexPlugin
|
||||
return new CodexOpenApi.SalesAvailabilityCREATE
|
||||
{
|
||||
Duration = ToDecInt(availability.MaxDuration.TotalSeconds),
|
||||
MinPrice = ToDecInt(availability.MinPriceForTotalSpace),
|
||||
MaxCollateral = ToDecInt(availability.MaxCollateral),
|
||||
MinPricePerBytePerSecond = ToDecInt(availability.MinPricePerBytePerSecond),
|
||||
TotalCollateral = ToDecInt(availability.TotalCollateral),
|
||||
TotalSize = ToDecInt(availability.TotalSpace.SizeInBytes)
|
||||
};
|
||||
}
|
||||
@ -72,8 +72,8 @@ namespace CodexPlugin
|
||||
{
|
||||
Duration = ToDecInt(purchase.Duration.TotalSeconds),
|
||||
ProofProbability = ToDecInt(purchase.ProofProbability),
|
||||
Reward = ToDecInt(purchase.PricePerSlotPerSecond),
|
||||
Collateral = ToDecInt(purchase.RequiredCollateral),
|
||||
PricePerBytePerSecond = ToDecInt(purchase.PricePerBytePerSecond),
|
||||
CollateralPerByte = ToDecInt(purchase.CollateralPerByte),
|
||||
Expiry = ToDecInt(purchase.Expiry.TotalSeconds),
|
||||
Nodes = Convert.ToInt32(purchase.MinRequiredNumberOfNodes),
|
||||
Tolerance = Convert.ToInt32(purchase.NodeFailureTolerance)
|
||||
@ -91,8 +91,8 @@ namespace CodexPlugin
|
||||
(
|
||||
ToByteSize(availability.TotalSize),
|
||||
ToTimespan(availability.Duration),
|
||||
new TestToken(ToBigIng(availability.MinPrice)),
|
||||
new TestToken(ToBigIng(availability.MaxCollateral))
|
||||
new TestToken(ToBigIng(availability.MinPricePerBytePerSecond)),
|
||||
new TestToken(ToBigIng(availability.TotalCollateral))
|
||||
)
|
||||
{
|
||||
Id = availability.Id,
|
||||
|
@ -12,8 +12,8 @@ namespace CodexPlugin
|
||||
}
|
||||
|
||||
public ContentId ContentId { get; set; }
|
||||
public TestToken PricePerSlotPerSecond { get; set; } = 1.TstWei();
|
||||
public TestToken RequiredCollateral { get; set; } = 1.TstWei();
|
||||
public TestToken PricePerBytePerSecond { get; set; } = 1.TstWei();
|
||||
public TestToken CollateralPerByte { get; set; } = 1.TstWei();
|
||||
public uint MinRequiredNumberOfNodes { get; set; }
|
||||
public uint NodeFailureTolerance { get; set; }
|
||||
public int ProofProbability { get; set; }
|
||||
@ -23,8 +23,8 @@ namespace CodexPlugin
|
||||
public void Log(ILog log)
|
||||
{
|
||||
log.Log($"Requesting storage for: {ContentId.Id}... (" +
|
||||
$"pricePerSlotPerSecond: {PricePerSlotPerSecond}, " +
|
||||
$"requiredCollateral: {RequiredCollateral}, " +
|
||||
$"pricePerBytePerSecond: {PricePerBytePerSecond}, " +
|
||||
$"collateralPerByte: {CollateralPerByte}, " +
|
||||
$"minRequiredNumberOfNodes: {MinRequiredNumberOfNodes}, " +
|
||||
$"nodeFailureTolerance: {NodeFailureTolerance}, " +
|
||||
$"proofProbability: {ProofProbability}, " +
|
||||
@ -75,19 +75,19 @@ namespace CodexPlugin
|
||||
|
||||
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;
|
||||
MaxDuration = maxDuration;
|
||||
MinPriceForTotalSpace = minPriceForTotalSpace;
|
||||
MaxCollateral = maxCollateral;
|
||||
MinPricePerBytePerSecond = minPricePerBytePerSecond;
|
||||
TotalCollateral = totalCollateral;
|
||||
}
|
||||
|
||||
public string Id { get; set; } = string.Empty;
|
||||
public ByteSize TotalSpace { get; }
|
||||
public TimeSpan MaxDuration { get; }
|
||||
public TestToken MinPriceForTotalSpace { get; }
|
||||
public TestToken MaxCollateral { get; }
|
||||
public TestToken MinPricePerBytePerSecond { get; }
|
||||
public TestToken TotalCollateral { get; }
|
||||
public ByteSize FreeSpace { get; set; } = ByteSize.Zero;
|
||||
|
||||
public void Log(ILog log)
|
||||
@ -95,8 +95,8 @@ namespace CodexPlugin
|
||||
log.Log($"Storage Availability: (" +
|
||||
$"totalSize: {TotalSpace}, " +
|
||||
$"maxDuration: {Time.FormatDuration(MaxDuration)}, " +
|
||||
$"minPriceForTotalSpace: {MinPriceForTotalSpace}, " +
|
||||
$"maxCollateral: {MaxCollateral})");
|
||||
$"minPricePerBytePerSecond: {MinPricePerBytePerSecond}, " +
|
||||
$"totalCollateral: {TotalCollateral})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ info:
|
||||
description: "List of endpoints and interfaces available to Codex API users"
|
||||
|
||||
security:
|
||||
- { }
|
||||
- {}
|
||||
|
||||
components:
|
||||
schemas:
|
||||
@ -50,9 +50,9 @@ components:
|
||||
type: string
|
||||
description: Address of Ethereum address
|
||||
|
||||
Reward:
|
||||
PricePerBytePerSecond:
|
||||
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:
|
||||
type: string
|
||||
@ -157,12 +157,12 @@ components:
|
||||
description: Total size of availability's storage in bytes as decimal string
|
||||
duration:
|
||||
$ref: "#/components/schemas/Duration"
|
||||
minPrice:
|
||||
minPricePerBytePerSecond:
|
||||
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
|
||||
maxCollateral:
|
||||
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
|
||||
totalCollateral:
|
||||
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:
|
||||
allOf:
|
||||
@ -178,8 +178,8 @@ components:
|
||||
- $ref: "#/components/schemas/SalesAvailability"
|
||||
- required:
|
||||
- totalSize
|
||||
- minPrice
|
||||
- maxCollateral
|
||||
- minPricePerBytePerSecond
|
||||
- totalCollateral
|
||||
- duration
|
||||
|
||||
Slot:
|
||||
@ -243,16 +243,16 @@ components:
|
||||
StorageRequestCreation:
|
||||
type: object
|
||||
required:
|
||||
- reward
|
||||
- pricePerBytePerSecond
|
||||
- duration
|
||||
- proofProbability
|
||||
- collateral
|
||||
- collateralPerByte
|
||||
- expiry
|
||||
properties:
|
||||
duration:
|
||||
$ref: "#/components/schemas/Duration"
|
||||
reward:
|
||||
$ref: "#/components/schemas/Reward"
|
||||
pricePerBytePerSecond:
|
||||
$ref: "#/components/schemas/PricePerBytePerSecond"
|
||||
proofProbability:
|
||||
$ref: "#/components/schemas/ProofProbability"
|
||||
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
|
||||
type: integer
|
||||
default: 0
|
||||
collateral:
|
||||
collateralPerByte:
|
||||
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:
|
||||
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.
|
||||
StorageAsk:
|
||||
type: object
|
||||
required:
|
||||
- reward
|
||||
- pricePerBytePerSecond
|
||||
properties:
|
||||
slots:
|
||||
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"
|
||||
proofProbability:
|
||||
$ref: "#/components/schemas/ProofProbability"
|
||||
reward:
|
||||
$ref: "#/components/schemas/Reward"
|
||||
pricePerBytePerSecond:
|
||||
$ref: "#/components/schemas/PricePerBytePerSecond"
|
||||
maxSlotLoss:
|
||||
type: integer
|
||||
description: Max slots that can be lost without data considered to be lost
|
||||
@ -418,14 +418,14 @@ paths:
|
||||
description: |
|
||||
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.
|
||||
tags: [ Node ]
|
||||
tags: [Node]
|
||||
operationId: connectPeer
|
||||
parameters:
|
||||
- in: path
|
||||
name: peerId
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/components/schemas/PeerId"
|
||||
$ref: "#/components/schemas/PeerId"
|
||||
description: Peer that should be dialed.
|
||||
- in: query
|
||||
name: addrs
|
||||
@ -448,7 +448,7 @@ paths:
|
||||
"/data":
|
||||
get:
|
||||
summary: "Lists manifest CIDs stored locally in node."
|
||||
tags: [ Data ]
|
||||
tags: [Data]
|
||||
operationId: listData
|
||||
responses:
|
||||
"200":
|
||||
@ -468,7 +468,7 @@ paths:
|
||||
description: Well it was bad-bad
|
||||
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."
|
||||
tags: [ Data ]
|
||||
tags: [Data]
|
||||
operationId: upload
|
||||
parameters:
|
||||
- name: content-type
|
||||
@ -484,7 +484,7 @@ paths:
|
||||
description: The content disposition used to send the filename.
|
||||
schema:
|
||||
type: string
|
||||
example: "attachment; filename=\"codex.png\""
|
||||
example: 'attachment; filename="codex.png"'
|
||||
requestBody:
|
||||
content:
|
||||
application/octet-stream:
|
||||
@ -504,14 +504,14 @@ paths:
|
||||
"/data/{cid}":
|
||||
get:
|
||||
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
|
||||
parameters:
|
||||
- in: path
|
||||
name: cid
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/components/schemas/Cid"
|
||||
$ref: "#/components/schemas/Cid"
|
||||
description: File to be downloaded.
|
||||
|
||||
responses:
|
||||
@ -532,14 +532,14 @@ paths:
|
||||
"/data/{cid}/network":
|
||||
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."
|
||||
tags: [ Data ]
|
||||
tags: [Data]
|
||||
operationId: downloadNetwork
|
||||
parameters:
|
||||
- in: path
|
||||
name: cid
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/components/schemas/Cid"
|
||||
$ref: "#/components/schemas/Cid"
|
||||
description: "File to be downloaded."
|
||||
responses:
|
||||
"200":
|
||||
@ -558,14 +558,14 @@ paths:
|
||||
"/data/{cid}/network/stream":
|
||||
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."
|
||||
tags: [ Data ]
|
||||
tags: [Data]
|
||||
operationId: downloadNetworkStream
|
||||
parameters:
|
||||
- in: path
|
||||
name: cid
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/components/schemas/Cid"
|
||||
$ref: "#/components/schemas/Cid"
|
||||
description: "File to be downloaded."
|
||||
responses:
|
||||
"200":
|
||||
@ -585,14 +585,14 @@ paths:
|
||||
"/data/{cid}/network/manifest":
|
||||
get:
|
||||
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
|
||||
parameters:
|
||||
- in: path
|
||||
name: cid
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/components/schemas/Cid"
|
||||
$ref: "#/components/schemas/Cid"
|
||||
description: "File for which the manifest is to be downloaded."
|
||||
responses:
|
||||
"200":
|
||||
@ -611,7 +611,7 @@ paths:
|
||||
"/space":
|
||||
get:
|
||||
summary: "Gets a summary of the storage space allocation of the node."
|
||||
tags: [ Data ]
|
||||
tags: [Data]
|
||||
operationId: space
|
||||
responses:
|
||||
"200":
|
||||
@ -627,7 +627,7 @@ paths:
|
||||
"/sales/slots":
|
||||
get:
|
||||
summary: "Returns active slots"
|
||||
tags: [ Marketplace ]
|
||||
tags: [Marketplace]
|
||||
operationId: getActiveSlots
|
||||
responses:
|
||||
"200":
|
||||
@ -645,7 +645,7 @@ paths:
|
||||
"/sales/slots/{slotId}":
|
||||
get:
|
||||
summary: "Returns active slot with id {slotId} for the host"
|
||||
tags: [ Marketplace ]
|
||||
tags: [Marketplace]
|
||||
operationId: getActiveSlotById
|
||||
parameters:
|
||||
- in: path
|
||||
@ -674,7 +674,7 @@ paths:
|
||||
"/sales/availability":
|
||||
get:
|
||||
summary: "Returns storage that is for sale"
|
||||
tags: [ Marketplace ]
|
||||
tags: [Marketplace]
|
||||
operationId: getAvailabilities
|
||||
responses:
|
||||
"200":
|
||||
@ -693,7 +693,7 @@ paths:
|
||||
post:
|
||||
summary: "Offers storage for sale"
|
||||
operationId: offerStorage
|
||||
tags: [ Marketplace ]
|
||||
tags: [Marketplace]
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
@ -721,7 +721,7 @@ paths:
|
||||
The new parameters will be only considered for new requests.
|
||||
Existing Requests linked to this Availability will continue as is.
|
||||
operationId: updateOfferedStorage
|
||||
tags: [ Marketplace ]
|
||||
tags: [Marketplace]
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
@ -753,7 +753,7 @@ paths:
|
||||
summary: "Get availability's reservations"
|
||||
description: Return's list of Reservations for ongoing Storage Requests that the node hosts.
|
||||
operationId: getReservations
|
||||
tags: [ Marketplace ]
|
||||
tags: [Marketplace]
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
@ -782,7 +782,7 @@ paths:
|
||||
"/storage/request/{cid}":
|
||||
post:
|
||||
summary: "Creates a new Request for storage"
|
||||
tags: [ Marketplace ]
|
||||
tags: [Marketplace]
|
||||
operationId: createStorageRequest
|
||||
parameters:
|
||||
- in: path
|
||||
@ -813,7 +813,7 @@ paths:
|
||||
"/storage/purchases":
|
||||
get:
|
||||
summary: "Returns list of purchase IDs"
|
||||
tags: [ Marketplace ]
|
||||
tags: [Marketplace]
|
||||
operationId: getPurchases
|
||||
responses:
|
||||
"200":
|
||||
@ -830,7 +830,7 @@ paths:
|
||||
"/storage/purchases/{id}":
|
||||
get:
|
||||
summary: "Returns purchase details"
|
||||
tags: [ Marketplace ]
|
||||
tags: [Marketplace]
|
||||
operationId: getPurchase
|
||||
parameters:
|
||||
- in: path
|
||||
@ -857,7 +857,7 @@ paths:
|
||||
get:
|
||||
summary: "Get Node's SPR"
|
||||
operationId: getSPR
|
||||
tags: [ Node ]
|
||||
tags: [Node]
|
||||
responses:
|
||||
"200":
|
||||
description: Node's SPR
|
||||
@ -875,7 +875,7 @@ paths:
|
||||
get:
|
||||
summary: "Get Node's PeerID"
|
||||
operationId: getPeerId
|
||||
tags: [ Node ]
|
||||
tags: [Node]
|
||||
responses:
|
||||
"200":
|
||||
description: Node's Peer ID
|
||||
@ -890,7 +890,7 @@ paths:
|
||||
"/debug/chronicles/loglevel":
|
||||
post:
|
||||
summary: "Set log level at run time"
|
||||
tags: [ Debug ]
|
||||
tags: [Debug]
|
||||
operationId: setDebugLogLevel
|
||||
|
||||
parameters:
|
||||
@ -912,7 +912,7 @@ paths:
|
||||
get:
|
||||
summary: "Gets node information"
|
||||
operationId: getDebugInfo
|
||||
tags: [ Debug ]
|
||||
tags: [Debug]
|
||||
responses:
|
||||
"200":
|
||||
description: Node's information
|
||||
|
@ -18,7 +18,7 @@ namespace CodexReleaseTests.MarketTests
|
||||
protected override int NumberOfClients => 1;
|
||||
protected override ByteSize HostAvailabilitySize => 1.GB();
|
||||
protected override TimeSpan HostAvailabilityMaxDuration => TimeSpan.FromDays(1.0);
|
||||
private readonly TestToken pricePerSlotPerSecond = 10.TstWei();
|
||||
private readonly TestToken pricePerBytePerSecond = 10.TstWei();
|
||||
|
||||
[Test]
|
||||
[Ignore("Disabled for now: Test is unstable.")]
|
||||
@ -103,9 +103,9 @@ namespace CodexReleaseTests.MarketTests
|
||||
Expiry = TimeSpan.FromHours(0.2),
|
||||
MinRequiredNumberOfNodes = (uint)NumberOfHosts,
|
||||
NodeFailureTolerance = (uint)(NumberOfHosts / 2),
|
||||
PricePerSlotPerSecond = pricePerSlotPerSecond,
|
||||
PricePerBytePerSecond = pricePerBytePerSecond,
|
||||
ProofProbability = 1, // Require a proof every period
|
||||
RequiredCollateral = 1.Tst()
|
||||
CollateralPerByte = 1.Tst()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace CodexReleaseTests.MarketTests
|
||||
protected override int NumberOfClients => 1;
|
||||
protected override ByteSize HostAvailabilitySize => (5 * FilesizeMb).MB();
|
||||
protected override TimeSpan HostAvailabilityMaxDuration => Get8TimesConfiguredPeriodDuration();
|
||||
private readonly TestToken pricePerSlotPerSecond = 10.TstWei();
|
||||
private readonly TestToken pricePerBytePerSecond = 10.TstWei();
|
||||
|
||||
[Test]
|
||||
public void ContractSuccessful()
|
||||
@ -33,8 +33,8 @@ namespace CodexReleaseTests.MarketTests
|
||||
|
||||
request.WaitForStorageContractFinished(GetContracts());
|
||||
|
||||
AssertClientHasPaidForContract(pricePerSlotPerSecond, client, request, hosts);
|
||||
AssertHostsWerePaidForContract(pricePerSlotPerSecond, request, hosts);
|
||||
AssertClientHasPaidForContract(pricePerBytePerSecond, client, request, hosts);
|
||||
AssertHostsWerePaidForContract(pricePerBytePerSecond, request, hosts);
|
||||
AssertHostsCollateralsAreUnchanged(hosts);
|
||||
}
|
||||
|
||||
@ -51,9 +51,9 @@ namespace CodexReleaseTests.MarketTests
|
||||
// When it's resolved, we can reduce the number of hosts and slim down this test.
|
||||
MinRequiredNumberOfNodes = 3,
|
||||
NodeFailureTolerance = 1,
|
||||
PricePerSlotPerSecond = pricePerSlotPerSecond,
|
||||
PricePerBytePerSecond = pricePerBytePerSecond,
|
||||
ProofProbability = 20,
|
||||
RequiredCollateral = 1.Tst()
|
||||
CollateralPerByte = 1.Tst()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,8 @@ namespace CodexReleaseTests.MarketTests
|
||||
host.Marketplace.MakeStorageAvailable(new CodexPlugin.StorageAvailability(
|
||||
totalSpace: HostAvailabilitySize,
|
||||
maxDuration: HostAvailabilityMaxDuration,
|
||||
minPriceForTotalSpace: 1.TstWei(),
|
||||
maxCollateral: 999999.Tst())
|
||||
minPricePerBytePerSecond: 1.TstWei(),
|
||||
totalCollateral: 999999.Tst())
|
||||
);
|
||||
}
|
||||
return hosts;
|
||||
|
@ -15,7 +15,7 @@ namespace CodexReleaseTests.MarketTests
|
||||
protected override int NumberOfClients => 3;
|
||||
protected override ByteSize HostAvailabilitySize => (5 * FilesizeMb).MB();
|
||||
protected override TimeSpan HostAvailabilityMaxDuration => Get8TimesConfiguredPeriodDuration();
|
||||
private readonly TestToken pricePerSlotPerSecond = 10.TstWei();
|
||||
private readonly TestToken pricePerBytePerSecond = 10.TstWei();
|
||||
|
||||
[Test]
|
||||
[Ignore("TODO - Test where multiple successful contracts are run simultaenously")]
|
||||
@ -58,9 +58,9 @@ namespace CodexReleaseTests.MarketTests
|
||||
Expiry = GetContractExpiry(),
|
||||
MinRequiredNumberOfNodes = (uint)NumberOfHosts,
|
||||
NodeFailureTolerance = (uint)(NumberOfHosts / 2),
|
||||
PricePerSlotPerSecond = pricePerSlotPerSecond,
|
||||
PricePerBytePerSecond = pricePerBytePerSecond,
|
||||
ProofProbability = 20,
|
||||
RequiredCollateral = 1.Tst()
|
||||
CollateralPerByte = 1.Tst()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,8 @@ namespace CodexTests.BasicTests
|
||||
var availability = new StorageAvailability(
|
||||
totalSpace: 10.GB(),
|
||||
maxDuration: TimeSpan.FromMinutes(30),
|
||||
minPriceForTotalSpace: 1.TstWei(),
|
||||
maxCollateral: 20.TstWei()
|
||||
minPricePerBytePerSecond: 1.TstWei(),
|
||||
totalCollateral: 20.TstWei()
|
||||
);
|
||||
host.Marketplace.MakeStorageAvailable(availability);
|
||||
}
|
||||
@ -70,8 +70,8 @@ namespace CodexTests.BasicTests
|
||||
|
||||
var purchase = new StoragePurchaseRequest(uploadCid)
|
||||
{
|
||||
PricePerSlotPerSecond = 2.TstWei(),
|
||||
RequiredCollateral = 10.TstWei(),
|
||||
PricePerBytePerSecond = 2.TstWei(),
|
||||
CollateralPerByte = 10.TstWei(),
|
||||
MinRequiredNumberOfNodes = 5,
|
||||
NodeFailureTolerance = 2,
|
||||
ProofProbability = 5,
|
||||
|
@ -109,8 +109,8 @@ namespace CodexTests.UtilityTests
|
||||
var contentId = client.UploadFile(testFile);
|
||||
var purchase = new StoragePurchaseRequest(contentId)
|
||||
{
|
||||
PricePerSlotPerSecond = 2.TstWei(),
|
||||
RequiredCollateral = 10.TstWei(),
|
||||
PricePerBytePerSecond = 2.TstWei(),
|
||||
CollateralPerByte = 10.TstWei(),
|
||||
MinRequiredNumberOfNodes = GetNumberOfRequiredHosts(),
|
||||
NodeFailureTolerance = 2,
|
||||
ProofProbability = 5,
|
||||
@ -190,8 +190,8 @@ namespace CodexTests.UtilityTests
|
||||
var availability = new StorageAvailability(
|
||||
totalSpace: Mult(GetMinFileSize(), GetNumberOfLiveHosts()),
|
||||
maxDuration: TimeSpan.FromMinutes(30),
|
||||
minPriceForTotalSpace: 1.TstWei(),
|
||||
maxCollateral: hostInitialBalance
|
||||
minPricePerBytePerSecond: 1.TstWei(),
|
||||
totalCollateral: hostInitialBalance
|
||||
);
|
||||
|
||||
foreach (var host in hosts)
|
||||
|
@ -87,11 +87,11 @@ namespace AutoClient
|
||||
app.Log.Debug("Requesting storage for " + cid.Id);
|
||||
var result = await codex.Codex.CreateStorageRequestAsync(cid.Id, new StorageRequestCreation()
|
||||
{
|
||||
Collateral = app.Config.RequiredCollateral.ToString(),
|
||||
CollateralPerByte = app.Config.CollateralPerByte.ToString(),
|
||||
Duration = (app.Config.ContractDurationMinutes * 60).ToString(),
|
||||
Expiry = (app.Config.ContractExpiryMinutes * 60).ToString(),
|
||||
Nodes = app.Config.NumHosts,
|
||||
Reward = app.Config.Price.ToString(),
|
||||
PricePerBytePerSecond = app.Config.PricePerBytePerSecond.ToString(),
|
||||
ProofProbability = "15",
|
||||
Tolerance = app.Config.HostTolerance
|
||||
}, app.Cts.Token);
|
||||
|
@ -29,11 +29,11 @@ namespace AutoClient
|
||||
[Uniform("num-hosts-tolerance", "nt", "NUMTOL", false, "Number of host tolerance for contract. (default 5)")]
|
||||
public int HostTolerance { get; set; } = 1;
|
||||
|
||||
[Uniform("price","p", "PRICE", false, "Price of contract. (default 10)")]
|
||||
public int Price { get; set; } = 1000;
|
||||
[Uniform("price","p", "PRICE", false, "Price per byte per second in TSTWEI. (default 1000)")]
|
||||
public int PricePerBytePerSecond { get; set; } = 1000;
|
||||
|
||||
[Uniform("collateral", "c", "COLLATERAL", false, "Required collateral. (default 1)")]
|
||||
public int RequiredCollateral { get; set; } = 1;
|
||||
[Uniform("collateral", "c", "COLLATERAL", false, "Required collateral per byte in TSTWEI. (default 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.")]
|
||||
public int FileSizeMb { get; set; } = 0;
|
||||
|
@ -71,8 +71,8 @@ namespace CodexNetDeployer
|
||||
var availability = new StorageAvailability(
|
||||
totalSpace: config.StorageSell!.Value.MB(),
|
||||
maxDuration: TimeSpan.FromSeconds(config.MaxDuration),
|
||||
minPriceForTotalSpace: config.MinPrice.TstWei(),
|
||||
maxCollateral: config.MaxCollateral.TstWei()
|
||||
minPricePerBytePerSecond: config.MinPricePerBytePerSecond.TstWei(),
|
||||
totalCollateral: config.MaxCollateral.TstWei()
|
||||
);
|
||||
|
||||
var response = codexNode.Marketplace.MakeStorageAvailable(availability);
|
||||
|
@ -56,8 +56,8 @@ namespace CodexNetDeployer
|
||||
[Uniform("test-tokens", "tt", "TESTTOKENS", false, "Initial amount of test-tokens minted for each Codex node.")]
|
||||
public int InitialTestTokens { get; set; }
|
||||
|
||||
[Uniform("min-price", "mp", "MINPRICE", false, "Minimum price for the storage space for which contracts will be accepted.")]
|
||||
public int MinPrice { get; set; }
|
||||
[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 MinPricePerBytePerSecond { get; set; }
|
||||
|
||||
[Uniform("max-collateral", "mc", "MAXCOLLATERAL", false, "Maximum collateral that will be placed for the total storage space.")]
|
||||
public int MaxCollateral { get; set; }
|
||||
@ -144,7 +144,7 @@ namespace CodexNetDeployer
|
||||
{
|
||||
IntIsOverZero(nameof(StorageSell), StorageSell, errors);
|
||||
IntIsOverZero(nameof(InitialTestTokens), InitialTestTokens, errors);
|
||||
IntIsOverZero(nameof(MinPrice), MinPrice, errors);
|
||||
IntIsOverZero(nameof(MinPricePerBytePerSecond), MinPricePerBytePerSecond, errors);
|
||||
IntIsOverZero(nameof(MaxCollateral), MaxCollateral, errors);
|
||||
IntIsOverZero(nameof(MaxDuration), MaxDuration, errors);
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ namespace CodexNetDeployer
|
||||
storageQuotaMB: config.StorageQuota!.Value,
|
||||
codexLogLevel: config.CodexLogLevel,
|
||||
initialTestTokens: config.InitialTestTokens,
|
||||
minPrice: config.MinPrice,
|
||||
minPrice: config.MinPricePerBytePerSecond,
|
||||
maxCollateral: config.MaxCollateral,
|
||||
maxDuration: config.MaxDuration,
|
||||
blockTTL: config.BlockTTL,
|
||||
|
Loading…
x
Reference in New Issue
Block a user