mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-07 16:03:07 +00:00
Updates to hardhat ignition
This commit is contained in:
parent
52f6941244
commit
30610b7f20
@ -7,7 +7,7 @@ namespace CodexContractsPlugin
|
|||||||
{
|
{
|
||||||
public class CodexContractsContainerRecipe : ContainerRecipeFactory
|
public class CodexContractsContainerRecipe : ContainerRecipeFactory
|
||||||
{
|
{
|
||||||
public const string MarketplaceAddressFilename = "/hardhat/deployments/codexdisttestnetwork/Marketplace.json";
|
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 string MarketplaceArtifactFilename = "/hardhat/artifacts/contracts/Marketplace.sol/Marketplace.json";
|
||||||
private readonly DebugInfoVersion versionInfo;
|
private readonly DebugInfoVersion versionInfo;
|
||||||
|
|
||||||
|
|||||||
@ -74,11 +74,16 @@ namespace CodexContractsPlugin
|
|||||||
|
|
||||||
var extractor = new ContractsContainerInfoExtractor(tools.GetLog(), workflow, container);
|
var extractor = new ContractsContainerInfoExtractor(tools.GetLog(), workflow, container);
|
||||||
var marketplaceAddress = extractor.ExtractMarketplaceAddress();
|
var marketplaceAddress = extractor.ExtractMarketplaceAddress();
|
||||||
|
if (string.IsNullOrEmpty(marketplaceAddress)) throw new Exception("Marketplace address not received.");
|
||||||
var (abi, bytecode) = extractor.ExtractMarketplaceAbiAndByteCode();
|
var (abi, bytecode) = extractor.ExtractMarketplaceAbiAndByteCode();
|
||||||
|
if (string.IsNullOrEmpty(abi)) throw new Exception("ABI not received.");
|
||||||
|
if (string.IsNullOrEmpty(bytecode)) throw new Exception("bytecode not received.");
|
||||||
EnsureCompatbility(abi, bytecode);
|
EnsureCompatbility(abi, bytecode);
|
||||||
|
|
||||||
var interaction = new ContractInteractions(tools.GetLog(), gethNode);
|
var interaction = new ContractInteractions(tools.GetLog(), gethNode);
|
||||||
var tokenAddress = interaction.GetTokenAddress(marketplaceAddress);
|
var tokenAddress = interaction.GetTokenAddress(marketplaceAddress);
|
||||||
|
if (string.IsNullOrEmpty(tokenAddress)) throw new Exception("Token address not received.");
|
||||||
|
Log("TokenAddress: " + tokenAddress);
|
||||||
|
|
||||||
Log("Extract completed. Checking sync...");
|
Log("Extract completed. Checking sync...");
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ namespace CodexContractsPlugin
|
|||||||
var marketplaceAddress = Retry(FetchMarketplaceAddress);
|
var marketplaceAddress = Retry(FetchMarketplaceAddress);
|
||||||
if (string.IsNullOrEmpty(marketplaceAddress)) throw new InvalidOperationException("Unable to fetch marketplace account from codex-contracts node. Test infra failure.");
|
if (string.IsNullOrEmpty(marketplaceAddress)) throw new InvalidOperationException("Unable to fetch marketplace account from codex-contracts node. Test infra failure.");
|
||||||
|
|
||||||
log.Debug("Got MarketplaceAddress: " + marketplaceAddress);
|
log.Log("MarketplaceAddress: " + marketplaceAddress);
|
||||||
return marketplaceAddress;
|
return marketplaceAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,9 +43,10 @@ namespace CodexContractsPlugin
|
|||||||
|
|
||||||
private string FetchMarketplaceAddress()
|
private string FetchMarketplaceAddress()
|
||||||
{
|
{
|
||||||
var json = workflow.ExecuteCommand(container, "cat", CodexContractsContainerRecipe.MarketplaceAddressFilename);
|
var json = workflow.ExecuteCommand(container, "cat", CodexContractsContainerRecipe.DeployedAddressesFilename);
|
||||||
var marketplace = JsonConvert.DeserializeObject<MarketplaceJson>(json);
|
json = json.Replace("#", "_");
|
||||||
return marketplace!.address;
|
var addresses = JsonConvert.DeserializeObject<DeployedAddressesJson>(json);
|
||||||
|
return addresses!.Marketplace_Marketplace;
|
||||||
}
|
}
|
||||||
|
|
||||||
private (string, string) FetchMarketplaceAbiAndByteCode()
|
private (string, string) FetchMarketplaceAbiAndByteCode()
|
||||||
@ -67,8 +68,10 @@ namespace CodexContractsPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MarketplaceJson
|
public class DeployedAddressesJson
|
||||||
{
|
{
|
||||||
public string address { get; set; } = string.Empty;
|
public string Token_TestToken { get; set; } = string.Empty;
|
||||||
|
public string Verifier_Groth16Verifier { get; set; } = string.Empty;
|
||||||
|
public string Marketplace_Marketplace { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -92,5 +92,57 @@ namespace CodexReleaseTests.DataTests
|
|||||||
Assert.That(cleanupSpace.QuotaUsedBytes, Is.EqualTo(startSpace.QuotaUsedBytes));
|
Assert.That(cleanupSpace.QuotaUsedBytes, Is.EqualTo(startSpace.QuotaUsedBytes));
|
||||||
Assert.That(cleanupSpace.FreeBytes, Is.EqualTo(startSpace.FreeBytes));
|
Assert.That(cleanupSpace.FreeBytes, Is.EqualTo(startSpace.FreeBytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void StorageRequestsKeepManifests()
|
||||||
|
{
|
||||||
|
var blockTtl = TimeSpan.FromMinutes(1.0);
|
||||||
|
|
||||||
|
var bootstrapNode = StartCodex();
|
||||||
|
var geth = StartGethNode(s => s.IsMiner());
|
||||||
|
var contracts = Ci.StartCodexContracts(geth, bootstrapNode.Version);
|
||||||
|
var client = StartCodex(s => s
|
||||||
|
.WithBootstrapNode(bootstrapNode)
|
||||||
|
.EnableMarketplace(geth, contracts, m => m.WithInitial(100.Eth(), 100.Tst()))
|
||||||
|
.WithBlockTTL(blockTtl)
|
||||||
|
.WithBlockMaintenanceInterval(TimeSpan.FromSeconds(10.0))
|
||||||
|
.WithBlockMaintenanceNumber(100000)
|
||||||
|
);
|
||||||
|
|
||||||
|
var hosts = StartCodex(3, s => s
|
||||||
|
.WithBootstrapNode(bootstrapNode)
|
||||||
|
.EnableMarketplace(geth, contracts, m => m.AsStorageNode().WithInitial(100.Eth(), 100.Tst()))
|
||||||
|
.WithBlockTTL(blockTtl)
|
||||||
|
.WithBlockMaintenanceInterval(TimeSpan.FromSeconds(10.0))
|
||||||
|
.WithBlockMaintenanceNumber(100000)
|
||||||
|
);
|
||||||
|
foreach (var host in hosts) host.Marketplace.MakeStorageAvailable(new CodexClient.CreateStorageAvailability(
|
||||||
|
totalSpace: 2.GB(),
|
||||||
|
maxDuration: TimeSpan.FromDays(2.0),
|
||||||
|
minPricePerBytePerSecond: 1.TstWei(),
|
||||||
|
totalCollateral: 10.Tst()));
|
||||||
|
|
||||||
|
var uploadCid = client.UploadFile(GenerateTestFile(1.MB()));
|
||||||
|
var request = client.Marketplace.RequestStorage(new CodexClient.StoragePurchaseRequest(uploadCid)
|
||||||
|
{
|
||||||
|
CollateralPerByte = 1.TstWei(),
|
||||||
|
Duration = TimeSpan.FromDays(1.0),
|
||||||
|
Expiry = TimeSpan.FromHours(1.0),
|
||||||
|
MinRequiredNumberOfNodes = 3,
|
||||||
|
NodeFailureTolerance = 1,
|
||||||
|
PricePerBytePerSecond = 1.Tst(),
|
||||||
|
ProofProbability = 99999
|
||||||
|
});
|
||||||
|
request.WaitForStorageContractStarted();
|
||||||
|
var storeCid = request.ContentId;
|
||||||
|
|
||||||
|
client.Stop(waitTillStopped: true);
|
||||||
|
|
||||||
|
Thread.Sleep(blockTtl * 2.0);
|
||||||
|
|
||||||
|
var checker = StartCodex(s => s.WithBootstrapNode(bootstrapNode));
|
||||||
|
var manifest = checker.DownloadManifestOnly(storeCid);
|
||||||
|
Assert.That(manifest.Manifest.Protected, Is.True);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user