2025-04-22 17:11:34 +02:00
|
|
|
|
using CodexClient;
|
|
|
|
|
|
using GethPlugin;
|
2023-10-23 15:28:20 +02:00
|
|
|
|
using KubernetesWorkflow;
|
2023-11-12 10:07:23 +01:00
|
|
|
|
using KubernetesWorkflow.Recipe;
|
2023-09-15 16:27:08 +02:00
|
|
|
|
|
|
|
|
|
|
namespace CodexContractsPlugin
|
|
|
|
|
|
{
|
|
|
|
|
|
public class CodexContractsContainerRecipe : ContainerRecipeFactory
|
|
|
|
|
|
{
|
2025-06-25 14:30:53 +02:00
|
|
|
|
public const string DeployedAddressesFilename = "/hardhat/ignition/deployments/chain-789988/deployed_addresses.json";
|
2023-09-15 16:27:08 +02:00
|
|
|
|
public const string MarketplaceArtifactFilename = "/hardhat/artifacts/contracts/Marketplace.sol/Marketplace.json";
|
2025-08-25 11:11:56 +02:00
|
|
|
|
|
|
|
|
|
|
public const int PeriodSeconds = 60;
|
|
|
|
|
|
public const int TimeoutSeconds = 30;
|
|
|
|
|
|
public const int DowntimeSeconds = 128;
|
|
|
|
|
|
|
2025-04-22 17:11:34 +02:00
|
|
|
|
private readonly DebugInfoVersion versionInfo;
|
2023-09-15 16:27:08 +02:00
|
|
|
|
|
|
|
|
|
|
public override string AppName => "codex-contracts";
|
2025-04-22 17:11:34 +02:00
|
|
|
|
public override string Image => GetContractsDockerImage();
|
2025-04-18 15:47:44 +02:00
|
|
|
|
|
2025-04-22 17:11:34 +02:00
|
|
|
|
public CodexContractsContainerRecipe(DebugInfoVersion versionInfo)
|
2025-04-18 15:47:44 +02:00
|
|
|
|
{
|
2025-04-22 17:11:34 +02:00
|
|
|
|
this.versionInfo = versionInfo;
|
2025-04-18 15:47:44 +02:00
|
|
|
|
}
|
2023-09-15 16:27:08 +02:00
|
|
|
|
|
|
|
|
|
|
protected override void Initialize(StartupConfig startupConfig)
|
|
|
|
|
|
{
|
|
|
|
|
|
var config = startupConfig.Get<CodexContractsContainerConfig>();
|
|
|
|
|
|
|
2024-09-23 10:52:12 +02:00
|
|
|
|
var address = config.GethNode.StartResult.Container.GetAddress(GethContainerRecipe.HttpPortTag);
|
2023-10-23 15:28:20 +02:00
|
|
|
|
|
2023-11-27 19:06:04 +02:00
|
|
|
|
SetSchedulingAffinity(notIn: "false");
|
2023-11-14 10:16:00 +01:00
|
|
|
|
|
2023-10-23 16:12:45 +02:00
|
|
|
|
AddEnvVar("DISTTEST_NETWORK_URL", address.ToString());
|
2025-08-25 11:11:56 +02:00
|
|
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
2023-09-15 16:27:08 +02:00
|
|
|
|
AddEnvVar("HARDHAT_NETWORK", "codexdisttestnetwork");
|
2025-05-23 08:35:52 +02:00
|
|
|
|
AddEnvVar("HARDHAT_IGNITION_CONFIRM_DEPLOYMENT", "false");
|
2023-09-15 16:27:08 +02:00
|
|
|
|
AddEnvVar("KEEP_ALIVE", "1");
|
|
|
|
|
|
}
|
2025-04-22 17:11:34 +02:00
|
|
|
|
|
|
|
|
|
|
private string GetContractsDockerImage()
|
|
|
|
|
|
{
|
|
|
|
|
|
return $"codexstorage/codex-contracts-eth:sha-{versionInfo.Contracts}-dist-tests";
|
|
|
|
|
|
}
|
2023-09-15 16:27:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|