77 lines
17 KiB
C#
Raw Normal View History

2025-05-20 10:19:07 +02:00
namespace TraceContract
{
public class Config
{
public string RpcEndpoint { get; } = "https://rpc.testnet.codex.storage";
public int GethPort { get; } = 443;
public string MarketplaceAddress { get; } = "0x5378a4EA5dA2a548ce22630A3AE74b052000C62D";
2025-05-20 10:19:07 +02:00
public string TokenAddress { get; } = "0x34a22f3911De437307c6f4485931779670f78764";
public string Abi { get; } = @"[{""inputs"":[{""components"":[{""components"":[{""internalType"":""uint8"",""name"":""repairRewardPercentage"",""type"":""uint8""},{""internalType"":""uint8"",""name"":""maxNumberOfSlashes"",""type"":""uint8""},{""internalType"":""uint16"",""name"":""slashCriterion"",""type"":""uint16""},{""internalType"":""uint8"",""name"":""slashPercentage"",""type"":""uint8""}],""internalType"":""struct CollateralConfig"",""name"":""collateral"",""type"":""tuple""},{""components"":[{""internalType"":""uint256"",""name"":""period"",""type"":""uint256""},{""internalType"":""uint256"",""name"":""timeout"",""type"":""uint256""},{""internalType"":""uint8"",""name"":""downtime"",""type"":""uint8""},{""internalType"":""string"",""name"":""zkeyHash"",""type"":""string""}],""internalType"":""struct ProofConfig"",""name"":""proofs"",""type"":""tuple""}],""internalType"":""struct MarketplaceConfig"",""name"":""configuration"",""type"":""tuple""},{""internalType"":""contract IERC20"",""name"":""token_"",""type"":""address""},{""internalType"":""contract IGroth16Verifier"",""name"":""verifier"",""type"":""address""}],""stateMutability"":""nonpayable"",""type"":""constructor""},{""anonymous"":false,""inputs"":[{""indexed"":false,""internalType"":""SlotId"",""name"":""id"",""type"":""bytes32""}],""name"":""ProofSubmitted"",""type"":""event""},{""anonymous"":false,""inputs"":[{""indexed"":true,""internalType"":""RequestId"",""name"":""requestId"",""type"":""bytes32""}],""name"":""RequestCancelled"",""type"":""event""},{""anonymous"":false,""inputs"":[{""indexed"":true,""internalType"":""RequestId"",""name"":""requestId"",""type"":""bytes32""}],""name"":""RequestFailed"",""type"":""event""},{""anonymous"":false,""inputs"":[{""indexed"":true,""internalType"":""RequestId"",""name"":""requestId"",""type"":""bytes32""}],""name"":""RequestFulfilled"",""type"":""event""},{""anonymous"":false,""inputs"":[{""indexed"":true,""internalType"":""RequestId"",""name"":""requestId"",""type"":""bytes32""},{""indexed"":false,""internalType"":""uint256"",""name"":""slotIndex"",""type"":""uint256""}],""name"":""SlotFilled"",""type"":""event""},{""anonymous"":false,""inputs"":[{""indexed"":true,""internalType"":""RequestId"",""name"":""requestId"",""type"":""bytes32""},{""indexed"":false,""internalType"":""uint256"",""name"":""slotIndex"",""type"":""uint256""}],""name"":""SlotFreed"",""type"":""event""},{""anonymous"":false,""inputs"":[{""indexed"":false,""internalType"":""RequestId"",""name"":""requestId"",""type"":""bytes32""},{""components"":[{""internalType"":""uint64"",""name"":""slots"",""type"":""uint64""},{""internalType"":""uint256"",""name"":""slotSize"",""type"":""uint256""},{""internalType"":""uint256"",""name"":""duration"",""type"":""uint256""},{""internalType"":""uint256"",""name"":""proofProbability"",""type"":""uint256""},{""internalType"":""uint256"",""name"":""reward"",""type"":""uint256""},{""internalType"":""uint256"",""name"":""collateral"",""type"":""uint256""},{""internalType"":""uint64"",""name"":""maxSlotLoss"",""type"":""uint64""}],""indexed"":false,""internalType"":""struct Ask"",""name"":""ask"",""type"":""tuple""},{""indexed"":false,""internalType"":""uint256"",""name"":""expiry"",""type"":""uint256""}],""name"":""StorageRequested"",""type"":""event""},{""inputs"":[],""name"":""config"",""outputs"":[{""components"":[{""components"":[{""internalType"":""uint8"",""name"":""repairRewardPercentage"",""type"":""uint8""},{""internalType"":""uint8"",""name"":""maxNumberOfSlashes"",""type"":""uint8""},{""internalType"":""uint16"",""name"":""slashCriterion"",""type"":""uint16""},{""internalType"":""uint8"",""name"":""slashPercentage"",""type"":""uint8""}],""internalType"":""struct CollateralConfig"",""name"":""collateral"",""type"":""tuple""},{""components"":[{""internalType"":""uint256"",""name"":""period"",""type"":""uint256""},{""internalType"":""uint256"",""name"":""timeout"",""type"":""uint256""},{""internalType"":""uint8"",""name"":""downtime"",""type"":""uint8""},{""internalType"":""string"",""name"":""
2025-05-20 14:16:33 +02:00
/// <summary>
/// Naming things is hard.
/// If the storage request is created at T=0, then fetching of the
/// storage node logs will begin from T=0 minus 'LogStartBeforeStorageContractStarts'.
/// </summary>
public TimeSpan LogStartBeforeStorageContractStarts { get; } = TimeSpan.FromMinutes(1.0);
2025-05-20 15:56:06 +02:00
public string ElasticSearchUrl
{
get
{
return GetEnvVar("ES_HOST", "es_host");
}
}
2025-05-20 15:42:03 +02:00
public string[] StorageNodesKubernetesPodNames = [
2025-05-20 14:16:33 +02:00
"codex-1-1",
2025-05-20 14:41:33 +02:00
"codex-2-1",
"codex-3-1",
"codex-4-1",
"codex-5-1",
"codex-6-1",
"codex-7-1",
"codex-8-1",
"codex-9-1",
2025-05-20 14:16:33 +02:00
"codex-10-1",
// "codex-validator-1-1",
];
public Dictionary<string, string> LogReplacements = new()
{
2025-06-03 11:34:34 +02:00
{ "0x3620ec38d88e9f0cf7feceebf97864f27676aa3e", "codex-01" },
{ "0xd80dc50af2a826f2cddc13840d05aed4ee6536c3", "codex-02" },
{ "0x2d1cd0fa0c7e0d29e7b2482b9ff87d5e7b76b905", "codex-03" },
{ "0xd47063bb6e56c9a6edb7612d33ad7d49eeb55ee0", "codex-04" },
{ "0x069da63e29b12a3828984379fcbd7dd3ee3774aa", "codex-05" },
{ "0x43fcceb2a9ce4761ccaa4c9f8d390c7581c190aa", "codex-06" },
{ "0x1a30cef06dbbf8ec25062e4e8d22e8df292f5054", "codex-07" },
{ "0xe169b5dcbae9a7392072323aaf5a677a33d67ecd", "codex-08" },
{ "0x21f7428619ef9f53addc5dab6723c822a8a96b42", "codex-09" },
{ "0xf9bd20512de2d5ca0dcfd8d3cd08a2821917797a", "codex-10" }
2025-05-20 14:16:33 +02:00
};
2025-05-20 14:41:33 +02:00
public string GetElasticSearchUsername()
{
return GetEnvVar("ES_USERNAME", "username");
}
public string GetElasticSearchPassword()
{
return GetEnvVar("ES_PASSWORD", "password");
}
2025-05-20 15:09:38 +02:00
public string GetOuputFolder()
{
2025-05-21 07:57:26 +02:00
return GetEnvVar("OUTPUT_FOLDER", "/output");
2025-05-20 15:09:38 +02:00
}
2025-05-20 14:41:33 +02:00
private string GetEnvVar(string name, string defaultValue)
{
var v = Environment.GetEnvironmentVariable(name);
if (string.IsNullOrEmpty(v)) return defaultValue;
return v;
}
2025-05-20 10:19:07 +02:00
}
}