Browse Source

refactored to remove dto usage, code cleaning

Gleb Urvanov 4 years ago
parent
commit
da3f638e7a

+ 1 - 1
tests/network-tests/package.json

@@ -4,7 +4,7 @@
   "license": "GPL-3.0-only",
   "scripts": {
     "build": "tsc --build tsconfig.json",
-    "test": "tap --files src/nicaea/tests/proposals/*Test.ts --files src/nicaea/tests/workingGroup/*Test.ts -T",
+    "test": "tap --files src/iznik/tests/proposals/*Test.ts --files src/iznik/tests/workingGroup/*Test.ts -T",
     "test-migration-constantinople": "tap --files src/rome/tests/romeRuntimeUpgradeTest.ts --files src/constantinople/tests/electingCouncilTest.ts -T",
     "test-migration-nicaea": "tap --files src/constantinople/tests/proposals/updateRuntimeTest.ts --files src/nicaea/tests/electingCouncilTest.ts -T",
     "debug": "tap --files src/iznik/tests/proposals/manageLeaderRoleTest.ts -T",

+ 0 - 255
tests/network-tests/src/iznik/dto/workingGroupOpening.ts

@@ -1,255 +0,0 @@
-import BN from 'bn.js'
-
-export class WorkingGroupOpening {
-  private activateAtBlock: BN | undefined
-  private maxActiveApplicants!: BN
-  private maxReviewPeriodLength!: BN
-  private applicationStakingPolicyAmount!: BN
-  private applicationCrowdedOutUnstakingPeriodLength!: BN
-  private applicationExpiredUnstakingPeriodLength!: BN
-  private roleStakingPolicyAmount!: BN
-  private roleCrowdedOutUnstakingPeriodLength!: BN
-  private roleExpiredUnstakingPeriodLength!: BN
-  private slashableMaxCount!: BN
-  private slashableMaxPercentPtsPerTime!: BN
-  private successfulApplicantApplicationStakeUnstakingPeriod!: BN
-  private failedApplicantApplicationStakeUnstakingPeriod!: BN
-  private failedApplicantRoleStakeUnstakingPeriod!: BN
-  private terminateApplicationStakeUnstakingPeriod!: BN
-  private terminateRoleStakeUnstakingPeriod!: BN
-  private exitRoleApplicationStakeUnstakingPeriod!: BN
-  private exitRoleStakeUnstakingPeriod!: BN
-  private text!: string
-  private openingType!: string
-
-  public getActivateAtBlock(): BN | undefined {
-    return this.activateAtBlock
-  }
-
-  public getMaxActiveApplicants(): BN {
-    return this.maxActiveApplicants
-  }
-
-  public getMaxReviewPeriodLength(): BN {
-    return this.maxReviewPeriodLength
-  }
-
-  public getApplicationStakingPolicyAmount(): BN {
-    return this.applicationStakingPolicyAmount
-  }
-
-  public getApplicationCrowdedOutUnstakingPeriodLength(): BN {
-    return this.applicationCrowdedOutUnstakingPeriodLength
-  }
-
-  public getApplicationExpiredUnstakingPeriodLength(): BN {
-    return this.applicationExpiredUnstakingPeriodLength
-  }
-
-  public getRoleStakingPolicyAmount(): BN {
-    return this.roleStakingPolicyAmount
-  }
-
-  public getRoleCrowdedOutUnstakingPeriodLength(): BN {
-    return this.roleCrowdedOutUnstakingPeriodLength
-  }
-
-  public getRoleExpiredUnstakingPeriodLength(): BN {
-    return this.roleExpiredUnstakingPeriodLength
-  }
-
-  public getSlashableMaxCount(): BN {
-    return this.slashableMaxCount
-  }
-
-  public getSlashableMaxPercentPtsPerTime(): BN {
-    return this.slashableMaxPercentPtsPerTime
-  }
-
-  public getSuccessfulApplicantApplicationStakeUnstakingPeriod(): BN {
-    return this.successfulApplicantApplicationStakeUnstakingPeriod
-  }
-
-  public getFailedApplicantApplicationStakeUnstakingPeriod(): BN {
-    return this.failedApplicantApplicationStakeUnstakingPeriod
-  }
-
-  public getFailedApplicantRoleStakeUnstakingPeriod(): BN {
-    return this.failedApplicantRoleStakeUnstakingPeriod
-  }
-
-  public getTerminateApplicationStakeUnstakingPeriod(): BN {
-    return this.terminateApplicationStakeUnstakingPeriod
-  }
-
-  public getTerminateRoleStakeUnstakingPeriod(): BN {
-    return this.terminateRoleStakeUnstakingPeriod
-  }
-
-  public getExitRoleApplicationStakeUnstakingPeriod(): BN {
-    return this.exitRoleApplicationStakeUnstakingPeriod
-  }
-
-  public getExitRoleStakeUnstakingPeriod(): BN {
-    return this.exitRoleStakeUnstakingPeriod
-  }
-
-  public getText(): string {
-    return this.text
-  }
-
-  public getOpeningType(): string {
-    return this.openingType
-  }
-
-  public setActivateAtBlock(value: BN | undefined): WorkingGroupOpening {
-    this.activateAtBlock = value
-    return this
-  }
-
-  public setMaxActiveApplicants(value: BN): WorkingGroupOpening {
-    this.maxActiveApplicants = value
-    return this
-  }
-
-  public setMaxReviewPeriodLength(value: BN): WorkingGroupOpening {
-    this.maxReviewPeriodLength = value
-    return this
-  }
-
-  public setApplicationStakingPolicyAmount(value: BN): WorkingGroupOpening {
-    this.applicationStakingPolicyAmount = value
-    return this
-  }
-
-  public setApplicationCrowdedOutUnstakingPeriodLength(value: BN): WorkingGroupOpening {
-    this.applicationCrowdedOutUnstakingPeriodLength = value
-    return this
-  }
-
-  public setApplicationExpiredUnstakingPeriodLength(value: BN): WorkingGroupOpening {
-    this.applicationExpiredUnstakingPeriodLength = value
-    return this
-  }
-
-  public setRoleStakingPolicyAmount(value: BN): WorkingGroupOpening {
-    this.roleStakingPolicyAmount = value
-    return this
-  }
-
-  public setRoleCrowdedOutUnstakingPeriodLength(value: BN): WorkingGroupOpening {
-    this.roleCrowdedOutUnstakingPeriodLength = value
-    return this
-  }
-
-  public setRoleExpiredUnstakingPeriodLength(value: BN): WorkingGroupOpening {
-    this.roleExpiredUnstakingPeriodLength = value
-    return this
-  }
-
-  public setSlashableMaxCount(value: BN): WorkingGroupOpening {
-    this.slashableMaxCount = value
-    return this
-  }
-
-  public setSlashableMaxPercentPtsPerTime(value: BN): WorkingGroupOpening {
-    this.slashableMaxPercentPtsPerTime = value
-    return this
-  }
-
-  public setSuccessfulApplicantApplicationStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
-    this.successfulApplicantApplicationStakeUnstakingPeriod = value
-    return this
-  }
-
-  public setFailedApplicantApplicationStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
-    this.failedApplicantApplicationStakeUnstakingPeriod = value
-    return this
-  }
-
-  public setFailedApplicantRoleStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
-    this.failedApplicantRoleStakeUnstakingPeriod = value
-    return this
-  }
-
-  public setTerminateApplicationStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
-    this.terminateApplicationStakeUnstakingPeriod = value
-    return this
-  }
-
-  public setTerminateRoleStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
-    this.terminateRoleStakeUnstakingPeriod = value
-    return this
-  }
-
-  public setExitRoleApplicationStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
-    this.exitRoleApplicationStakeUnstakingPeriod = value
-    return this
-  }
-
-  public setExitRoleStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
-    this.exitRoleStakeUnstakingPeriod = value
-    return this
-  }
-
-  public setText(value: string): WorkingGroupOpening {
-    this.text = value
-    return this
-  }
-
-  public setOpeningType(value: string): WorkingGroupOpening {
-    this.openingType = value
-    return this
-  }
-
-  constructor() {
-    return
-  }
-
-  public getActivateAt() {
-    return this.activateAtBlock === undefined ? 'CurrentBlock' : { ExactBlock: this.activateAtBlock }
-  }
-
-  public getCommitment() {
-    return {
-      'application_rationing_policy': { 'max_active_applicants': this.maxActiveApplicants },
-      'max_review_period_length': this.maxReviewPeriodLength,
-      'application_staking_policy': {
-        'amount': this.applicationStakingPolicyAmount,
-        'amount_mode': 'AtLeast',
-        'crowded_out_unstaking_period_length': this.applicationCrowdedOutUnstakingPeriodLength,
-        'review_period_expired_unstaking_period_length': this.applicationExpiredUnstakingPeriodLength,
-      },
-      'role_staking_policy': {
-        'amount': this.roleStakingPolicyAmount,
-        'amount_mode': 'AtLeast',
-        'crowded_out_unstaking_period_length': this.roleCrowdedOutUnstakingPeriodLength,
-        'review_period_expired_unstaking_period_length': this.roleExpiredUnstakingPeriodLength,
-      },
-      'role_slashing_terms': {
-        'Slashable': {
-          'max_count': this.slashableMaxCount,
-          'max_percent_pts_per_time': this.slashableMaxPercentPtsPerTime,
-        },
-      },
-      'fill_opening_successful_applicant_application_stake_unstaking_period': this
-        .successfulApplicantApplicationStakeUnstakingPeriod,
-      'fill_opening_failed_applicant_application_stake_unstaking_period': this
-        .failedApplicantApplicationStakeUnstakingPeriod,
-      'fill_opening_failed_applicant_role_stake_unstaking_period': this.failedApplicantRoleStakeUnstakingPeriod,
-      'terminate_application_stake_unstaking_period': this.terminateApplicationStakeUnstakingPeriod,
-      'terminate_role_stake_unstaking_period': this.terminateRoleStakeUnstakingPeriod,
-      'exit_role_application_stake_unstaking_period': this.exitRoleApplicationStakeUnstakingPeriod,
-      'exit_role_stake_unstaking_period': this.exitRoleStakeUnstakingPeriod,
-    }
-  }
-
-  public getAddOpeningParameters(workingGroup: string) {
-    return {
-      activate_at: this.getActivateAt(),
-      commitment: this.getCommitment(),
-      human_readable_text: this.getText(),
-      working_group: workingGroup,
-    }
-  }
-}

+ 43 - 23
tests/network-tests/src/iznik/tests/fixtures/proposalsModule.ts

@@ -2,14 +2,19 @@ import { KeyringPair } from '@polkadot/keyring/types'
 import { ApiWrapper, WorkingGroups } from '../../utils/apiWrapper'
 import { v4 as uuid } from 'uuid'
 import BN from 'bn.js'
-import { WorkingGroupOpening } from '../../dto/workingGroupOpening'
 import { FillOpeningParameters } from '@nicaea/types/proposals'
 import { Fixture } from './interfaces/fixture'
 import { Bytes, Option, u32 } from '@polkadot/types'
 import { Balance, BlockNumber } from '@polkadot/types/interfaces'
 import { assert } from 'chai'
-import { ApplicationId, OpeningId } from '@nicaea/types/hiring'
-import { RewardPolicy } from '@nicaea/types/working-group'
+import {
+  ActivateOpeningAt,
+  ApplicationId,
+  ApplicationRationingPolicy,
+  OpeningId,
+  StakingPolicy,
+} from '@nicaea/types/hiring'
+import { RewardPolicy, SlashingTerms, WorkingGroupOpeningPolicyCommitment } from '@nicaea/types/working-group'
 import { WorkingGroup } from '@nicaea/types/common'
 
 export class CreateWorkingGroupLeaderOpeningFixture implements Fixture {
@@ -53,25 +58,38 @@ export class CreateWorkingGroupLeaderOpeningFixture implements Fixture {
     await this.apiWrapper.transferBalance(this.sudo, this.m1KeyPairs[0].address, proposalFee.add(proposalStake))
 
     // Opening construction
-    const opening = new WorkingGroupOpening()
-      .setMaxActiveApplicants(new BN(this.m1KeyPairs.length))
-      .setMaxReviewPeriodLength(new BN(32))
-      .setApplicationStakingPolicyAmount(new BN(this.applicationStake))
-      .setApplicationCrowdedOutUnstakingPeriodLength(new BN(1))
-      .setApplicationExpiredUnstakingPeriodLength(new BN(1))
-      .setRoleStakingPolicyAmount(new BN(this.roleStake))
-      .setRoleCrowdedOutUnstakingPeriodLength(new BN(1))
-      .setRoleExpiredUnstakingPeriodLength(new BN(1))
-      .setSlashableMaxCount(new BN(1))
-      .setSlashableMaxPercentPtsPerTime(new BN(100))
-      .setSuccessfulApplicantApplicationStakeUnstakingPeriod(new BN(1))
-      .setFailedApplicantApplicationStakeUnstakingPeriod(new BN(1))
-      .setFailedApplicantRoleStakeUnstakingPeriod(new BN(1))
-      .setTerminateApplicationStakeUnstakingPeriod(new BN(1))
-      .setTerminateRoleStakeUnstakingPeriod(new BN(1))
-      .setExitRoleApplicationStakeUnstakingPeriod(new BN(1))
-      .setExitRoleStakeUnstakingPeriod(new BN(1))
-      .setText(uuid().substring(0, 8))
+    const activateAtBlock: ActivateOpeningAt = new ActivateOpeningAt('CurrentBlock')
+    const commitment: WorkingGroupOpeningPolicyCommitment = new WorkingGroupOpeningPolicyCommitment({
+      application_rationing_policy: new Option(ApplicationRationingPolicy, {
+        max_active_applicants: new BN(this.m1KeyPairs.length) as u32,
+      }),
+      max_review_period_length: new BN(32) as u32,
+      application_staking_policy: new Option(StakingPolicy, {
+        amount: this.applicationStake,
+        amount_mode: 'AtLeast',
+        crowded_out_unstaking_period_length: new BN(1),
+        review_period_expired_unstaking_period_length: new BN(1),
+      }),
+      role_staking_policy: new Option(StakingPolicy, {
+        amount: this.roleStake,
+        amount_mode: 'AtLeast',
+        crowded_out_unstaking_period_length: new BN(1),
+        review_period_expired_unstaking_period_length: new BN(1),
+      }),
+      role_slashing_terms: new SlashingTerms({
+        Slashable: {
+          max_count: new BN(1),
+          max_percent_pts_per_time: new BN(100),
+        },
+      }),
+      fill_opening_successful_applicant_application_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+      fill_opening_failed_applicant_application_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+      fill_opening_failed_applicant_role_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+      terminate_application_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+      terminate_role_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+      exit_role_application_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+      exit_role_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+    })
 
     // Proposal creation
     const proposalPromise = this.apiWrapper.expectProposalCreated()
@@ -80,7 +98,9 @@ export class CreateWorkingGroupLeaderOpeningFixture implements Fixture {
       proposalTitle,
       description,
       proposalStake,
-      opening,
+      activateAtBlock,
+      commitment,
+      uuid().substring(0, 8),
       this.workingGroup
     )
     const proposalNumber: BN = await proposalPromise

+ 111 - 55
tests/network-tests/src/iznik/tests/fixtures/workingGroupModule.ts

@@ -2,14 +2,25 @@ import BN from 'bn.js'
 import { assert } from 'chai'
 import { ApiWrapper, WorkingGroups } from '../../utils/apiWrapper'
 import { KeyringPair } from '@polkadot/keyring/types'
-import { Balance, Event } from '@polkadot/types/interfaces'
+import { Balance, BlockNumber, Event } from '@polkadot/types/interfaces'
 import { Keyring } from '@polkadot/api'
+import { Option, u32 } from '@polkadot/types'
 import { v4 as uuid } from 'uuid'
 import { RewardRelationship } from '@nicaea/types/recurring-rewards'
-import { Worker, ApplicationIdToWorkerIdMap, Application } from '@nicaea/types/working-group'
+import {
+  Application,
+  ApplicationIdToWorkerIdMap,
+  SlashingTerms,
+  Worker,
+  WorkingGroupOpeningPolicyCommitment,
+} from '@nicaea/types/working-group'
 import { Utils } from '../../utils/utils'
-import { Opening as HiringOpening } from '@nicaea/types/hiring'
-import { WorkingGroupOpening } from '../../dto/workingGroupOpening'
+import {
+  ActivateOpeningAt,
+  ApplicationRationingPolicy,
+  Opening as HiringOpening,
+  StakingPolicy,
+} from '@nicaea/types/hiring'
 import { Fixture } from './interfaces/fixture'
 
 export class AddWorkerOpeningFixture implements Fixture {
@@ -53,38 +64,64 @@ export class AddWorkerOpeningFixture implements Fixture {
 
   public async runner(expectFailure: boolean): Promise<void> {
     // Worker opening construction
-    const activateAtBlock: BN | undefined = this.activationDelay.eqn(0)
-      ? undefined
-      : (await this.apiWrapper.getBestBlock()).add(this.activationDelay)
-    const opening = new WorkingGroupOpening()
-      .setActivateAtBlock(activateAtBlock)
-      .setMaxActiveApplicants(new BN(this.membersKeyPairs.length))
-      .setMaxReviewPeriodLength(new BN(32))
-      .setApplicationStakingPolicyAmount(new BN(this.applicationStake))
-      .setApplicationCrowdedOutUnstakingPeriodLength(new BN(1))
-      .setApplicationExpiredUnstakingPeriodLength(new BN(1))
-      .setRoleStakingPolicyAmount(new BN(this.roleStake))
-      .setRoleCrowdedOutUnstakingPeriodLength(new BN(1))
-      .setRoleExpiredUnstakingPeriodLength(new BN(1))
-      .setSlashableMaxCount(new BN(1))
-      .setSlashableMaxPercentPtsPerTime(new BN(100))
-      .setSuccessfulApplicantApplicationStakeUnstakingPeriod(this.unstakingPeriod)
-      .setFailedApplicantApplicationStakeUnstakingPeriod(this.unstakingPeriod)
-      .setFailedApplicantRoleStakeUnstakingPeriod(this.unstakingPeriod)
-      .setTerminateApplicationStakeUnstakingPeriod(this.unstakingPeriod)
-      .setTerminateRoleStakeUnstakingPeriod(this.unstakingPeriod)
-      .setExitRoleApplicationStakeUnstakingPeriod(this.unstakingPeriod)
-      .setExitRoleStakeUnstakingPeriod(this.unstakingPeriod)
-      .setText(uuid().substring(0, 8))
-      .setOpeningType('Worker')
+    const activateAtBlock: ActivateOpeningAt = new ActivateOpeningAt(
+      this.activationDelay.eqn(0)
+        ? 'CurrentBlock'
+        : { ExactBlock: (await this.apiWrapper.getBestBlock()).add(this.activationDelay) }
+    )
+    const commitment: WorkingGroupOpeningPolicyCommitment = new WorkingGroupOpeningPolicyCommitment({
+      application_rationing_policy: new Option(ApplicationRationingPolicy, {
+        max_active_applicants: new BN(this.membersKeyPairs.length) as u32,
+      }),
+      max_review_period_length: new BN(32) as u32,
+      application_staking_policy: new Option(StakingPolicy, {
+        amount: this.applicationStake,
+        amount_mode: 'AtLeast',
+        crowded_out_unstaking_period_length: new BN(1),
+        review_period_expired_unstaking_period_length: new BN(1),
+      }),
+      role_staking_policy: new Option(StakingPolicy, {
+        amount: this.roleStake,
+        amount_mode: 'AtLeast',
+        crowded_out_unstaking_period_length: new BN(1),
+        review_period_expired_unstaking_period_length: new BN(1),
+      }),
+      role_slashing_terms: new SlashingTerms({
+        Slashable: {
+          max_count: new BN(1),
+          max_percent_pts_per_time: new BN(100),
+        },
+      }),
+      fill_opening_successful_applicant_application_stake_unstaking_period: new Option(
+        u32,
+        this.unstakingPeriod as BlockNumber
+      ),
+      fill_opening_failed_applicant_application_stake_unstaking_period: new Option(
+        u32,
+        this.unstakingPeriod as BlockNumber
+      ),
+      fill_opening_failed_applicant_role_stake_unstaking_period: new Option(u32, this.unstakingPeriod as BlockNumber),
+      terminate_application_stake_unstaking_period: new Option(u32, this.unstakingPeriod as BlockNumber),
+      terminate_role_stake_unstaking_period: new Option(u32, this.unstakingPeriod as BlockNumber),
+      exit_role_application_stake_unstaking_period: new Option(u32, this.unstakingPeriod as BlockNumber),
+      exit_role_stake_unstaking_period: new Option(u32, this.unstakingPeriod as BlockNumber),
+    })
 
     // Fee estimation and transfer
-    const addOpeningFee: BN = this.apiWrapper.estimateAddOpeningFee(opening, this.module)
+    const addOpeningFee: BN = this.apiWrapper.estimateAddOpeningFee(this.module)
     await this.apiWrapper.transferBalance(this.sudo, this.lead.address, addOpeningFee)
 
     // Worker opening creation
     const addOpeningPromise: Promise<Event> = this.apiWrapper.expectEvent('OpeningAdded')
-    await this.apiWrapper.addOpening(this.lead, opening, this.module, expectFailure)
+    await this.apiWrapper.addOpening(
+      this.lead,
+      activateAtBlock,
+      commitment,
+      uuid().substring(0, 8),
+      'Worker',
+      this.module,
+      expectFailure
+    )
     if (!expectFailure) {
       const openingId: BN = ((await addOpeningPromise).data[0] as unknown) as BN
       console.log('received opening id ' + openingId)
@@ -128,33 +165,52 @@ export class AddLeaderOpeningFixture implements Fixture {
 
   public async runner(expectFailure: boolean): Promise<void> {
     // Leader opening creation
-    const activateAtBlock: BN | undefined = this.activationDelay.eqn(0)
-      ? undefined
-      : (await this.apiWrapper.getBestBlock()).add(this.activationDelay)
-    const opening = new WorkingGroupOpening()
-      .setActivateAtBlock(activateAtBlock)
-      .setMaxActiveApplicants(new BN(this.membersKeyPairs.length))
-      .setMaxReviewPeriodLength(new BN(32))
-      .setApplicationStakingPolicyAmount(new BN(this.applicationStake))
-      .setApplicationCrowdedOutUnstakingPeriodLength(new BN(1))
-      .setApplicationExpiredUnstakingPeriodLength(new BN(1))
-      .setRoleStakingPolicyAmount(new BN(this.roleStake))
-      .setRoleCrowdedOutUnstakingPeriodLength(new BN(1))
-      .setRoleExpiredUnstakingPeriodLength(new BN(1))
-      .setSlashableMaxCount(new BN(1))
-      .setSlashableMaxPercentPtsPerTime(new BN(100))
-      .setSuccessfulApplicantApplicationStakeUnstakingPeriod(new BN(1))
-      .setFailedApplicantApplicationStakeUnstakingPeriod(new BN(1))
-      .setFailedApplicantRoleStakeUnstakingPeriod(new BN(1))
-      .setTerminateApplicationStakeUnstakingPeriod(new BN(1))
-      .setTerminateRoleStakeUnstakingPeriod(new BN(1))
-      .setExitRoleApplicationStakeUnstakingPeriod(new BN(1))
-      .setExitRoleStakeUnstakingPeriod(new BN(1))
-      .setText(uuid().substring(0, 8))
-      .setOpeningType('leader')
+    const activateAtBlock: ActivateOpeningAt = new ActivateOpeningAt(
+      this.activationDelay.eqn(0)
+        ? 'CurrentBlock'
+        : { ExactBlock: (await this.apiWrapper.getBestBlock()).add(this.activationDelay) }
+    )
+    const commitment: WorkingGroupOpeningPolicyCommitment = new WorkingGroupOpeningPolicyCommitment({
+      application_rationing_policy: new Option(ApplicationRationingPolicy, {
+        max_active_applicants: new BN(this.membersKeyPairs.length) as u32,
+      }),
+      max_review_period_length: new BN(32) as u32,
+      application_staking_policy: new Option(StakingPolicy, {
+        amount: this.applicationStake,
+        amount_mode: 'AtLeast',
+        crowded_out_unstaking_period_length: new BN(1),
+        review_period_expired_unstaking_period_length: new BN(1),
+      }),
+      role_staking_policy: new Option(StakingPolicy, {
+        amount: this.roleStake,
+        amount_mode: 'AtLeast',
+        crowded_out_unstaking_period_length: new BN(1),
+        review_period_expired_unstaking_period_length: new BN(1),
+      }),
+      role_slashing_terms: new SlashingTerms({
+        Slashable: {
+          max_count: new BN(1),
+          max_percent_pts_per_time: new BN(100),
+        },
+      }),
+      fill_opening_successful_applicant_application_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+      fill_opening_failed_applicant_application_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+      fill_opening_failed_applicant_role_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+      terminate_application_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+      terminate_role_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+      exit_role_application_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+      exit_role_stake_unstaking_period: new Option(u32, new BN(1) as BlockNumber),
+    })
 
     const addOpeningPromise: Promise<Event> = this.apiWrapper.expectEvent('OpeningAdded')
-    await this.apiWrapper.sudoAddOpening(this.sudo, opening, this.module)
+    await this.apiWrapper.sudoAddOpening(
+      this.sudo,
+      activateAtBlock,
+      commitment,
+      uuid().substring(0, 8),
+      'Leader',
+      this.module
+    )
     const openingId: BN = ((await addOpeningPromise).data[0] as unknown) as BN
     this.result = openingId
     if (expectFailure) {

+ 0 - 0
tests/network-tests/src/iznik/tests/proposals/updateRuntimet.ts → tests/network-tests/src/iznik/tests/proposals/updateRuntime.ts


+ 0 - 1
tests/network-tests/src/iznik/tests/workingGroup/atLeastValueBugTest.ts

@@ -70,7 +70,6 @@ tap.mocha.describe('Worker application happy case scenario', async () => {
     openingActivationDelay,
     WorkingGroups.StorageWorkingGroup
   )
-  // let leadOpenignId: BN
   tap.test('Add lead opening', async () => await addLeaderOpeningFixture.runner(false))
 
   let applyForLeaderOpeningFixture: ApplyForOpeningFixture

+ 0 - 1
tests/network-tests/src/iznik/tests/workingGroup/manageWorkerAsWorkerTest.ts

@@ -74,7 +74,6 @@ tap.mocha.describe('Manage worker as worker scenario', async () => {
     openingActivationDelay,
     WorkingGroups.StorageWorkingGroup
   )
-  // let leadOpenignId: BN
   tap.test('Add lead opening', async () => await addLeaderOpeningFixture.runner(false))
 
   let applyForLeaderOpeningFixture: ApplyForOpeningFixture

+ 0 - 1
tests/network-tests/src/iznik/tests/workingGroup/workerApplicationHappyCaseTest.ts

@@ -73,7 +73,6 @@ tap.mocha.describe('Worker application happy case scenario', async () => {
     openingActivationDelay,
     WorkingGroups.StorageWorkingGroup
   )
-  // let leadOpenignId: BN
   tap.test('Add lead opening', async () => await addLeaderOpeningFixture.runner(false))
 
   let applyForLeaderOpeningFixture: ApplyForOpeningFixture

+ 0 - 1
tests/network-tests/src/iznik/tests/workingGroup/workerApplicationRejectionCaseTest.ts

@@ -74,7 +74,6 @@ tap.mocha.describe('Worker application happy case scenario', async () => {
     leadOpeningActivationDelay,
     WorkingGroups.StorageWorkingGroup
   )
-  // let leadOpenignId: BN
   tap.test('Add lead opening', async () => await addLeaderOpeningFixture.runner(false))
 
   let applyForLeaderOpeningFixture: ApplyForOpeningFixture

+ 2 - 4
tests/network-tests/src/iznik/utils/apiWrapper.ts

@@ -9,10 +9,11 @@ import {
   Application,
   ApplicationIdToWorkerIdMap,
   Opening,
-  OpeningType,
   RewardPolicy,
+  SlashingTerms,
   Worker,
   WorkerId,
+  WorkingGroupOpeningPolicyCommitment,
 } from '@nicaea/types/working-group'
 import { RoleParameters } from '@nicaea/types/roles'
 import { Seat } from '@nicaea/types/council'
@@ -34,7 +35,6 @@ import {
 } from '@nicaea/types/hiring'
 import { FillOpeningParameters } from '@nicaea/types/proposals'
 import { WorkingGroup } from '@nicaea/types/common'
-import { SlashingTerms, WorkingGroupOpeningPolicyCommitment } from '@nicaea/types/working-group'
 
 export enum WorkingGroups {
   StorageWorkingGroup = 'storageWorkingGroup',
@@ -369,8 +369,6 @@ export class ApiWrapper {
   }
 
   public estimateProposeCreateWorkingGroupLeaderOpeningFee(): BN {
-
-
     const commitment: WorkingGroupOpeningPolicyCommitment = new WorkingGroupOpeningPolicyCommitment({
       application_rationing_policy: new Option(ApplicationRationingPolicy, {
         max_active_applicants: new BN(32) as u32,