Skip to content

Commit

Permalink
Disable ritual initialization (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec authored Aug 14, 2023
2 parents 75fa0f0 + 7447664 commit 88c4614
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
29 changes: 15 additions & 14 deletions src/sdk/strategy/cbd-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,22 @@ export class CbdStrategy {
}

public async deploy(
provider: ethers.providers.Web3Provider,
ritualId?: number
web3Provider: ethers.providers.Web3Provider,
ritualId: number
): Promise<DeployedCbdStrategy> {
if (ritualId === undefined) {
ritualId = await DkgClient.initializeRitual(
provider,
this.cohort.ursulaAddresses,
true
);
}
if (ritualId === undefined) {
// Given that we just initialized the ritual, this should never happen
throw new Error('Ritual ID is undefined');
}
const dkgRitual = await DkgClient.getExistingRitual(provider, ritualId);
// TODO(#264): Enable ritual initialization
// if (ritualId === undefined) {
// ritualId = await DkgClient.initializeRitual(
// web3Provider,
// this.cohort.ursulaAddresses,
// true
// );
// }
// if (ritualId === undefined) {
// // Given that we just initialized the ritual, this should never happen
// throw new Error('Ritual ID is undefined');
// }
const dkgRitual = await DkgClient.getExistingRitual(web3Provider, ritualId);
return DeployedCbdStrategy.create(dkgRitual, this.cohort.porterUri);
}

Expand Down
5 changes: 1 addition & 4 deletions test/unit/cbd-strategy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
mockGetExistingRitual,
mockGetParticipants,
mockGetUrsulas,
mockInitializeRitual,
mockRandomSessionStaticSecret,
} from '../utils';

Expand Down Expand Up @@ -55,12 +54,10 @@ async function makeDeployedCbdStrategy() {
const mockedDkgRitual = fakeDkgRitual(mockedDkg);
const web3Provider = fakeWeb3Provider(aliceSecretKey.toBEBytes());
const getUrsulasSpy = mockGetUrsulas(ursulas);
const initializeRitualSpy = mockInitializeRitual(ritualId);
const getExistingRitualSpy = mockGetExistingRitual(mockedDkgRitual);
const deployedStrategy = await strategy.deploy(web3Provider);
const deployedStrategy = await strategy.deploy(web3Provider, ritualId);

expect(getUrsulasSpy).toHaveBeenCalled();
expect(initializeRitualSpy).toHaveBeenCalled();
expect(getExistingRitualSpy).toHaveBeenCalled();

return { mockedDkg, deployedStrategy };
Expand Down

1 comment on commit 88c4614

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bundled size for the package is listed below:

build/module/src/kits: 19.53 KB
build/module/src/characters: 74.22 KB
build/module/src/policies: 19.53 KB
build/module/src/agents: 39.06 KB
build/module/src/conditions/predefined: 19.53 KB
build/module/src/conditions/base: 54.69 KB
build/module/src/conditions/context: 42.97 KB
build/module/src/conditions: 156.25 KB
build/module/src/sdk/strategy: 31.25 KB
build/module/src/sdk: 42.97 KB
build/module/src: 425.78 KB
build/module/types/ethers-contracts/factories: 82.03 KB
build/module/types/ethers-contracts: 152.34 KB
build/module/types: 156.25 KB
build/module: 636.72 KB
build/main/src/kits: 19.53 KB
build/main/src/characters: 74.22 KB
build/main/src/policies: 19.53 KB
build/main/src/agents: 39.06 KB
build/main/src/conditions/predefined: 19.53 KB
build/main/src/conditions/base: 54.69 KB
build/main/src/conditions/context: 42.97 KB
build/main/src/conditions: 156.25 KB
build/main/src/sdk/strategy: 35.16 KB
build/main/src/sdk: 46.88 KB
build/main/src: 433.59 KB
build/main/types/ethers-contracts/factories: 82.03 KB
build/main/types/ethers-contracts: 152.34 KB
build/main/types: 156.25 KB
build/main: 644.53 KB
build: 1.26 MB

Please sign in to comment.