-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2946 from Joystream/staging
Release Stabilisation Bugfixing 4
- Loading branch information
Showing
203 changed files
with
21,471 additions
and
12,717 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { performance } from 'perf_hooks' | ||
|
||
import { ApiPromise, ApiRx } from '@polkadot/api' | ||
import { firstValueFrom, Observable } from 'rxjs' | ||
|
||
import { benchmark } from '../../src/common/utils/benchmark' | ||
import { ALICE } from '../node-mocks/data/addresses' | ||
import { withPromiseApi, withRxApi } from '../node-mocks/lib/api' | ||
|
||
const ENDPOINT = 'wss://rpc.joystream.org:9944' // TODO pass as a parameter | ||
const DEFAULT_DURATION = 5_000 | ||
|
||
export const apiBenchmarking = { | ||
command: 'api-benchmarking', | ||
describe: 'Benchmark the chain api', | ||
handler: () => | ||
benchmarkApi.rxjs( | ||
{ | ||
title: 'PaymentInfo', | ||
operation: (api) => api.tx.members.confirmStakingAccount(0, ALICE).paymentInfo(ALICE), | ||
}, | ||
{ | ||
title: 'voteExistsByProposalByVoter', | ||
operation: (api) => api.query.proposalsEngine.voteExistsByProposalByVoter.size(0, 0), | ||
} | ||
), | ||
} | ||
|
||
interface Operation<Api, R> { | ||
title: string | ||
operation: (api: Api, count: number) => R | ||
duration?: number | ||
} | ||
|
||
const benchmarkApi = { | ||
promise: (...operations: Operation<ApiPromise, Promise<any>>[]) => | ||
withPromiseApi(ENDPOINT)(async (api) => { | ||
for (const { title, operation, duration = DEFAULT_DURATION } of operations) | ||
await benchmark(title, (count) => operation(api, count), duration, performance) | ||
}), | ||
|
||
rxjs: (...operations: Operation<ApiRx, Observable<any>>[]) => | ||
withRxApi(ENDPOINT)(async (api) => { | ||
for (const { title, operation, duration = DEFAULT_DURATION } of operations) | ||
await benchmark(title, (count) => firstValueFrom(operation(api, count)), duration, performance) | ||
}), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { ApplicationMetadata } from '@joystream/metadata-protobuf' | ||
import { AnyNumber } from '@polkadot/types/types' | ||
|
||
import { getDataFromEvent, metadataToBytes } from '../../../../src/common/model/JoystreamNode' | ||
import memberData from '../../../../src/mocks/data/raw/members.json' | ||
import { GroupIdName } from '../../../../src/working-groups/types' | ||
import { signAndSend, withApi } from '../../lib/api' | ||
|
||
const GROUP = 'membershipWorkingGroup' | ||
|
||
interface Params { | ||
openingId?: AnyNumber | ||
group?: GroupIdName | ||
} | ||
|
||
export const applyOnOpeningCommand = async ({ openingId = 0, group = GROUP }: Params = {}) => | ||
await withApi(async (api) => { | ||
const alice = memberData[0] | ||
|
||
const tx = api.tx[GROUP].applyOnOpening({ | ||
member_id: alice.id, | ||
opening_id: openingId, | ||
role_account_id: alice.controllerAccount, | ||
reward_account_id: alice.controllerAccount, | ||
description: metadataToBytes(ApplicationMetadata, {}), | ||
stake_parameters: { | ||
stake: api.consts[group].minimumApplicationStake, | ||
staking_account_id: alice.controllerAccount, | ||
}, | ||
}) | ||
|
||
const events = await signAndSend(tx, alice.controllerAccount) | ||
|
||
return String(getDataFromEvent(events, group, 'AppliedOnOpening', 1)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,46 @@ | ||
/* eslint-disable no-console */ | ||
import { OpeningMetadata } from '@joystream/metadata-protobuf' | ||
|
||
import { metadataToBytes } from '../../../../src/common/model/JoystreamNode' | ||
import { getDataFromEvent, metadataToBytes } from '../../../../src/common/model/JoystreamNode' | ||
import { GroupIdName } from '../../../../src/working-groups/types' | ||
import { getSudoAccount } from '../../data/addresses' | ||
import { signAndSend, withApi } from '../../lib/api' | ||
|
||
const opening = async () => { | ||
await withApi(async (api) => { | ||
const tx = api.tx.membershipWorkingGroup.addOpening( | ||
metadataToBytes(OpeningMetadata, { | ||
title: 'Test opening', | ||
shortDescription: 'Test opening', | ||
description: '# Test opening', | ||
expectedEndingTimestamp: new Date().getTime() + 10000, | ||
hiringLimit: 1, | ||
applicationDetails: 'Details', | ||
applicationFormQuestions: [ | ||
{ question: 'Question 1?', type: OpeningMetadata.ApplicationFormQuestion.InputType.TEXT }, | ||
{ question: 'Question 2?', type: OpeningMetadata.ApplicationFormQuestion.InputType.TEXTAREA }, | ||
], | ||
}), | ||
const GROUP = 'membershipWorkingGroup' // TODO pass as a parameter | ||
|
||
export const addOpeningCommand = async ({ group = GROUP }: { group?: GroupIdName } = {}) => { | ||
const title = `Test ${group} opening` | ||
|
||
const openingMetadata = { | ||
title, | ||
shortDescription: title, | ||
description: `# ${title}`, | ||
expectedEndingTimestamp: new Date().getTime() + 10000, | ||
hiringLimit: 1, | ||
applicationDetails: 'Details', | ||
applicationFormQuestions: [ | ||
{ question: 'Question 1?', type: OpeningMetadata.ApplicationFormQuestion.InputType.TEXT }, | ||
{ question: 'Question 2?', type: OpeningMetadata.ApplicationFormQuestion.InputType.TEXTAREA }, | ||
], | ||
} | ||
|
||
return await withApi(async (api) => { | ||
const tx = api.tx[group].addOpening( | ||
metadataToBytes(OpeningMetadata, openingMetadata), | ||
'Leader', | ||
{ stake_amount: 10_000, leaving_unstaking_period: 360_000 }, | ||
{ stake_amount: api.consts[group].minimumApplicationStake, leaving_unstaking_period: 360_000 }, | ||
'1337' | ||
) | ||
|
||
await signAndSend(api.tx.sudo.sudo(tx), getSudoAccount()) | ||
const events = await signAndSend(api.tx.sudo.sudo(tx), getSudoAccount()) | ||
|
||
return String(getDataFromEvent(events, group, 'OpeningAdded')) | ||
}) | ||
} | ||
|
||
export const createOpeningModule = { | ||
command: 'opening:create', | ||
describe: 'Create new opening in Membership Working Group', | ||
handler: opening, | ||
describe: 'Create new opening', | ||
handler: async () => { | ||
await addOpeningCommand() | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
6799dce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
dao – ./
dao.joystream.org
dao-joystream.vercel.app
dao-git-olympia-joystream.vercel.app