mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-02 13:33:07 +00:00
Requires new contracts image with configurable marketplace config
This commit is contained in:
parent
275937a814
commit
e03f5982d3
@ -1,4 +1,5 @@
|
||||
using Utils;
|
||||
using System.Globalization;
|
||||
using Utils;
|
||||
|
||||
namespace KubernetesWorkflow.Recipe
|
||||
{
|
||||
@ -88,6 +89,11 @@ namespace KubernetesWorkflow.Recipe
|
||||
envVars.Add(factory.CreateEnvVar(name, value));
|
||||
}
|
||||
|
||||
protected void AddEnvVar(string name, int value)
|
||||
{
|
||||
envVars.Add(factory.CreateEnvVar(name, value.ToString(CultureInfo.InvariantCulture)));
|
||||
}
|
||||
|
||||
protected void AddEnvVar(string name, Port value)
|
||||
{
|
||||
envVars.Add(factory.CreateEnvVar(name, value.Number));
|
||||
|
||||
@ -9,6 +9,11 @@ namespace CodexContractsPlugin
|
||||
{
|
||||
public const string DeployedAddressesFilename = "/hardhat/ignition/deployments/chain-789988/deployed_addresses.json";
|
||||
public const string MarketplaceArtifactFilename = "/hardhat/artifacts/contracts/Marketplace.sol/Marketplace.json";
|
||||
|
||||
public const int PeriodSeconds = 60;
|
||||
public const int TimeoutSeconds = 30;
|
||||
public const int DowntimeSeconds = 128;
|
||||
|
||||
private readonly DebugInfoVersion versionInfo;
|
||||
|
||||
public override string AppName => "codex-contracts";
|
||||
@ -28,6 +33,22 @@ namespace CodexContractsPlugin
|
||||
SetSchedulingAffinity(notIn: "false");
|
||||
|
||||
AddEnvVar("DISTTEST_NETWORK_URL", address.ToString());
|
||||
|
||||
// Default values:
|
||||
AddEnvVar("DISTTEST_REPAIRREWARD", 10);
|
||||
AddEnvVar("DISTTEST_MAXSLASHES", 2);
|
||||
AddEnvVar("DISTTEST_SLASHPERCENTAGE", 20);
|
||||
AddEnvVar("DISTTEST_VALIDATORREWARD", 20);
|
||||
AddEnvVar("DISTTEST_DOWNTIMEPRODUCT", 67);
|
||||
AddEnvVar("DISTTEST_MAXRESERVATIONS", 3);
|
||||
AddEnvVar("DISTTEST_MAXDURATION", Convert.ToInt32(TimeSpan.FromDays(30).TotalSeconds));
|
||||
|
||||
// Customized values, required to operate in a network with
|
||||
// block frequency of 1.
|
||||
AddEnvVar("DISTTEST_PERIOD", PeriodSeconds);
|
||||
AddEnvVar("DISTTEST_TIMEOUT", TimeoutSeconds);
|
||||
AddEnvVar("DISTTEST_DOWNTIME", DowntimeSeconds);
|
||||
|
||||
AddEnvVar("HARDHAT_NETWORK", "codexdisttestnetwork");
|
||||
AddEnvVar("HARDHAT_IGNITION_CONFIRM_DEPLOYMENT", "false");
|
||||
AddEnvVar("KEEP_ALIVE", "1");
|
||||
|
||||
@ -92,12 +92,23 @@ namespace CodexContractsPlugin
|
||||
Log("Synced. Codex SmartContracts deployed. Getting configuration...");
|
||||
|
||||
var config = GetMarketplaceConfiguration(marketplaceAddress, gethNode);
|
||||
|
||||
Log("Got config: " + JsonConvert.SerializeObject(config));
|
||||
|
||||
ConfigShouldEqual(config.Proofs.Period, CodexContractsContainerRecipe.PeriodSeconds, "Period");
|
||||
ConfigShouldEqual(config.Proofs.Timeout, CodexContractsContainerRecipe.TimeoutSeconds, "Timeout");
|
||||
ConfigShouldEqual(config.Proofs.Downtime, CodexContractsContainerRecipe.DowntimeSeconds, "Downtime");
|
||||
|
||||
return new CodexContractsDeployment(config, marketplaceAddress, abi, tokenAddress);
|
||||
}
|
||||
|
||||
private void ConfigShouldEqual(ulong value, int expected, string name)
|
||||
{
|
||||
if (Convert.ToInt32(value) != expected)
|
||||
{
|
||||
throw new Exception($"Config value '{name}' should be deployed as '{expected}' but was '{value}'");
|
||||
}
|
||||
}
|
||||
|
||||
private MarketplaceConfig GetMarketplaceConfiguration(string marketplaceAddress, IGethNode gethNode)
|
||||
{
|
||||
var func = new ConfigurationFunctionBase();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user