Check for marketplace contract up-to-date

This commit is contained in:
benbierens 2024-04-11 07:46:00 +02:00
parent 0224f17733
commit 4a0885cf2d
No known key found for this signature in database
GPG Key ID: 877D2C2E09A22F3A
3 changed files with 86 additions and 13 deletions

View File

@ -1,4 +1,5 @@
using KubernetesWorkflow; using CodexContractsPlugin.Marketplace;
using KubernetesWorkflow;
using KubernetesWorkflow.Types; using KubernetesWorkflow.Types;
using Logging; using Logging;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -53,7 +54,18 @@ namespace CodexContractsPlugin
var artifact = JObject.Parse(json); var artifact = JObject.Parse(json);
var abi = artifact["abi"]; var abi = artifact["abi"];
return abi!.ToString(Formatting.None); var byteCode = artifact["bytecode"];
var abiResult = abi!.ToString(Formatting.None);
var byteCodeResult = byteCode!.ToString(Formatting.None);
if (byteCodeResult
.ToLowerInvariant()
.Replace("\"", "") != MarketplaceDeploymentBase.BYTECODE.ToLowerInvariant())
{
throw new Exception("BYTECODE in CodexContractsPlugin does not match BYTECODE deployed by container. Update Marketplace.cs generated code?");
}
return abiResult;
} }
private static string Retry(Func<string> fetch) private static string Retry(Func<string> fetch)

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,8 @@ namespace TestNetRewarder
public ChainState(HistoricState historicState, ICodexContracts contracts, BlockInterval blockRange) public ChainState(HistoricState historicState, ICodexContracts contracts, BlockInterval blockRange)
{ {
this.historicState = historicState;
NewRequests = contracts.GetStorageRequests(blockRange); NewRequests = contracts.GetStorageRequests(blockRange);
historicState.CleanUpOldRequests(); historicState.CleanUpOldRequests();
historicState.ProcessNewRequests(NewRequests); historicState.ProcessNewRequests(NewRequests);
@ -23,7 +25,6 @@ namespace TestNetRewarder
RequestCancelledEvents = contracts.GetRequestCancelledEvents(blockRange); RequestCancelledEvents = contracts.GetRequestCancelledEvents(blockRange);
SlotFilledEvents = contracts.GetSlotFilledEvents(blockRange); SlotFilledEvents = contracts.GetSlotFilledEvents(blockRange);
SlotFreedEvents = contracts.GetSlotFreedEvents(blockRange); SlotFreedEvents = contracts.GetSlotFreedEvents(blockRange);
this.historicState = historicState;
} }
public Request[] NewRequests { get; } public Request[] NewRequests { get; }