Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable ritual initialization #265

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading