Skip to content

High-level declarative workload classes implementation issues #2

Description

@aklenik
  1. The DeclarativeWorkloadModuleBase should just simply extend the WorkloadModuleBase class, which performs most of the initialization. Then the initializeWorkloadModule function can be overridden to perform the extra init step (after calling the super init).
    class DeclarativeWorkloadModuleBase extends WorkloadModuleInterface {
  2. The following lines look "weird", not really the JS way. Simply use this.something = {}; instead

  3. The intention is cleaner and easier to read if you use for(const key of Object.keys(roundArguments)) { ... } to iterate through the keys of an object.
  4. You don't need to save this on the instance level, won't use it outside of this function:
  5. This doesn't enumerate the objects, only the key names (string), whatever those are for array entries. You need for(const contractObject of roundArguments.contracts) {...} (instead of in)
  6. You should pass the entire contract object for the constructor (plus some extra arguments) since you'll need the function selector part later:
    this.contracts[contractObject.name] = new Contract(contractObject, variables, parameters, valueProviderFactory);
    Instead of:
    this.contracts[contract.name] = new Contract(contract.functions);
  7. You don't need these, the Contract just passes them down the hierarchy:
    this.variables = variables;
    this.parameters = parameters;
  8. Instead of this:

    You need to construct an object for each function and store them:
    for (const functionObject of functions) {
        this.functions[functionObject.name] = new ContractFunction(functionObject, variables, parameters, valueProviderFactory);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions