Skip to content

Commit

Permalink
Merge pull request #5159 from kdembler/argo-types
Browse files Browse the repository at this point in the history
Argo types + QN support + package bumps
  • Loading branch information
kdembler authored Jun 5, 2024
2 parents 4bcc058 + ed71937 commit 7d5493c
Show file tree
Hide file tree
Showing 30 changed files with 771 additions and 507 deletions.
2 changes: 1 addition & 1 deletion chain-metadata.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@joystream/cli",
"description": "Command Line Interface for Joystream community and governance activities",
"version": "1.5.1",
"version": "1.5.2",
"author": "Leszek Wiesner",
"bin": {
"joystream-cli": "./bin/run"
Expand Down Expand Up @@ -57,7 +57,7 @@
"proper-lockfile": "^4.1.1",
"slug": "^2.1.1",
"tslib": "^1.11.1",
"@joystream/js": "^1.11.0"
"@joystream/js": "^1.12.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^1.21.4",
Expand Down
4 changes: 4 additions & 0 deletions distributor-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 2.1.2

- Bump @joystream/types to Petra version

### 2.1.1

- Bump deps @polkadot/api v10.7.1
Expand Down
4 changes: 2 additions & 2 deletions distributor-node/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@joystream/distributor-cli",
"description": "Joystream distributor node CLI",
"version": "2.1.1",
"version": "2.1.2",
"author": "Joystream contributors",
"bin": {
"joystream-distributor": "./bin/run"
Expand All @@ -13,7 +13,7 @@
"@joystream/metadata-protobuf": "^2.15.0",
"@joystream/opentelemetry": "1.0.0",
"@joystream/storage-node-client": "^4.0.0",
"@joystream/types": "^4.4.0",
"@joystream/types": "^4.6.0",
"@nerdwallet/apollo-cache-policies": "2.10.0",
"@oclif/command": "^1",
"@oclif/config": "^1",
Expand Down
4 changes: 4 additions & 0 deletions joystreamjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.12.0

- Bump @joystream/types to Petra version

### 1.7.0

- Update dependency on metadata protobuf to v2.13.0
Expand Down
4 changes: 2 additions & 2 deletions joystreamjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@joystream/js",
"version": "1.11.0",
"version": "1.12.0",
"license": "GPL-3.0-only",
"description": "Joystream JS package provides utilities required to work with Joystream network.",
"main": "lib/index.js",
Expand Down Expand Up @@ -42,7 +42,7 @@
},
"dependencies": {
"@joystream/metadata-protobuf": "^2.15.0",
"@joystream/types": "^4.4.0",
"@joystream/types": "^4.6.0",
"@polkadot/util-crypto": "^12.6.2",
"axios": "^1.2.1",
"buffer": "^6.0.3",
Expand Down
4 changes: 4 additions & 0 deletions query-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 2.4.0

- Bump @joystream/types to Petra version

### 2.2.1

- Bump deps @polkadot/api v10.7.1
Expand Down
1 change: 1 addition & 0 deletions query-node/chain-metadata/2004.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions query-node/mappings/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "query-node-mappings",
"version": "2.3.0",
"version": "2.4.0",
"description": "Mappings for hydra-processor",
"main": "lib/src/index.js",
"license": "MIT",
Expand All @@ -19,7 +19,7 @@
"@apollo/client": "^3.2.5",
"@joystream/hydra-common": "5.0.0-alpha.8",
"@joystream/hydra-db-utils": "5.0.0-alpha.8",
"@joystream/js": "^1.11.0",
"@joystream/js": "^1.12.0",
"@joystream/warthog": "^2.41.9",
"@polkadot/types": "10.7.1"
},
Expand Down
22 changes: 17 additions & 5 deletions query-node/mappings/src/proposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import {
SignalProposalDetails,
SlashWorkingGroupLeadProposalDetails,
TerminateWorkingGroupLeadProposalDetails,
UpdateArgoBridgeConstraintsProposalDetails,
UpdateChannelPayoutsProposalDetails,
UpdatePalletFrozenStatusProposalDetails,
UpdateGlobalNftLimitProposalDetails,
Expand All @@ -78,14 +79,14 @@ import {
} from './common'
import {
ProposalsCodex_ProposalCreatedEvent_V1001 as ProposalCreatedEvent_V1001,
ProposalsCodex_ProposalCreatedEvent_V2003 as ProposalCreatedEvent_V2003,
ProposalsCodex_ProposalCreatedEvent_V2004 as ProposalCreatedEvent_V2004,
ProposalsEngine_ProposalCancelledEvent_V1001 as ProposalCancelledEvent_V1001,
ProposalsEngine_ProposalDecisionMadeEvent_V1001 as ProposalDecisionMadeEvent_V1001,
ProposalsEngine_ProposalExecutedEvent_V1001 as ProposalExecutedEvent_V1001,
ProposalsEngine_ProposalStatusUpdatedEvent_V1001 as ProposalStatusUpdatedEvent_V1001,
ProposalsEngine_VotedEvent_V1001 as ProposalVotedEvent_V1001,
} from '../generated/types'
import { PalletProposalsCodexProposalDetails as RuntimeProposalDetails_V2003 } from '../generated/types/2003/types-lookup'
import { PalletProposalsCodexProposalDetails as RuntimeProposalDetails_V2004 } from '../generated/types/2004/types-lookup'

import { createWorkingGroupOpeningMetadata } from './workingGroups'

Expand All @@ -109,7 +110,7 @@ async function getOrCreateRuntimeWasmBytecode(store: DatabaseManager, bytecode:
async function parseProposalDetails(
event: SubstrateEvent,
store: DatabaseManager,
proposalDetails: RuntimeProposalDetails_V2003
proposalDetails: RuntimeProposalDetails_V2004
): Promise<typeof ProposalDetails> {
const eventTime = new Date(event.blockTimestamp)

Expand Down Expand Up @@ -353,6 +354,17 @@ async function parseProposalDetails(
const details = new SetEraPayoutDampingFactorProposalDetails()
details.dampingFactor = proposalDetails.asSetEraPayoutDampingFactor.toNumber()
return details
}
// UpdateArgoBridgeConstraintsProposalDetails
else if (proposalDetails.isUpdateArgoBridgeConstraints) {
const details = new UpdateArgoBridgeConstraintsProposalDetails()
const bridgeConstraints = proposalDetails.asUpdateArgoBridgeConstraints
details.operatorAccount = unwrap(bridgeConstraints.operatorAccount)?.toString()
details.pauserAccounts = unwrap(bridgeConstraints.pauserAccounts)?.map((a) => a.toString())
details.bridgingFee = whenDef(unwrap(bridgeConstraints.bridgingFee), asBN)
details.thawnDuration = unwrap(bridgeConstraints.thawnDuration)?.toNumber()
details.remoteChains = unwrap(bridgeConstraints.remoteChains)?.map((a) => a.toNumber())
return details
} else {
unimplementedError(`Unsupported proposal details type: ${proposalDetails.type}`)
}
Expand Down Expand Up @@ -393,13 +405,13 @@ export async function proposalsCodex_ProposalCreated({
const [proposalId, generalProposalParameters, runtimeProposalDetails, proposalThreadId] =
Number(specVersion) < 2001
? new ProposalCreatedEvent_V1001(event).params
: new ProposalCreatedEvent_V2003(event).params
: new ProposalCreatedEvent_V2004(event).params

const eventTime = new Date(event.blockTimestamp)
const proposalDetails = await parseProposalDetails(
event,
store,
runtimeProposalDetails as RuntimeProposalDetails_V2003
runtimeProposalDetails as RuntimeProposalDetails_V2004
)

const proposal = new Proposal({
Expand Down
2 changes: 1 addition & 1 deletion query-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "query-node-root",
"version": "2.3.0",
"version": "2.4.0",
"description": "GraphQL server and mappings. Generated with ♥ by Hydra-CLI",
"scripts": {
"build": "./build.sh",
Expand Down
9 changes: 9 additions & 0 deletions query-node/schemas/proposals.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,14 @@ type SetEraPayoutDampingFactorProposalDetails @variant {
dampingFactor: Int!
}

type UpdateArgoBridgeConstraintsProposalDetails @variant {
operatorAccount: String
pauserAccounts: [String]
bridgingFee: BigInt
thawnDuration: Int
remoteChains: [Int]
}

union ProposalDetails =
SignalProposalDetails
| RuntimeUpgradeProposalDetails
Expand Down Expand Up @@ -414,3 +422,4 @@ union ProposalDetails =
| DecreaseCouncilBudgetProposalDetails
| UpdateTokenPalletTokenConstraintsProposalDetails
| SetEraPayoutDampingFactorProposalDetails
| UpdateArgoBridgeConstraintsProposalDetails
2 changes: 1 addition & 1 deletion runtime-modules/argo-bridge/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ fn revert_outbound_transfer_with_bridge_paused() {
1u64,
account!(2),
joy!(100),
vec![],
vec![].try_into().unwrap(),
);
assert_err!(result, Error::<Test>::BridgeNotActive);
});
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,7 @@ parameter_types! {
// Make sure to stay below MAX_BLOCK_SIZE of substrate consensus of ~4MB
// The new compressed wasm format is much smaller in size ~ 1MB
pub const RuntimeUpgradeWasmProposalMaxLength: u32 = DispatchableCallCodeMaxLen::get();
pub const FundingRequestProposalMaxTotalAmount: Balance = joy!(1_000_000);
pub const FundingRequestProposalMaxTotalAmount: Balance = currency::BASE_UNIT_PER_JOY * 1_000_000;
pub const FundingRequestProposalMaxAccounts: u32 = 20;
pub const SetMaxValidatorCountProposalMaxValidators: u32 = 100;
}
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/proposals_configuration/defaults.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! This module contains default "production" parameters configuration for the runtime codex proposals.

use crate::{
currency, days, dollars, hours, joy, Balance, BlockNumber, CouncilSize, ExpectedBlockTime,
currency, days, dollars, hours, Balance, BlockNumber, CouncilSize, ExpectedBlockTime,
ProposalParameters,
};
use static_assertions::const_assert;
Expand Down Expand Up @@ -65,7 +65,7 @@ pub(crate) fn funding_request_proposal() -> ProposalParameters<BlockNumber, Bala
approval_threshold_percentage: TWO_OUT_OF_THREE,
slashing_quorum_percentage: ALL,
slashing_threshold_percentage: ALL,
required_stake: Some(joy!(3500)),
required_stake: Some(currency::BASE_UNIT_PER_JOY * 3_500),
constitutionality: 1,
}
}
Expand Down
7 changes: 0 additions & 7 deletions runtime/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,3 @@ macro_rules! monthly_dollars_to_per_block {
dollars!($a).saturating_div(Balance::from(days!(30)))
}};
}

#[macro_export]
macro_rules! joy {
($a: expr) => {
currency::BASE_UNIT_PER_JOY.saturating_mul($a).into()
};
}
4 changes: 4 additions & 0 deletions storage-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 4.1.2

- Bump @joystream/types to Petra version

### 4.1.1

- Bump deps @polkadot/api v10.7.1
Expand Down
4 changes: 2 additions & 2 deletions storage-node/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "storage-node",
"description": "Joystream storage subsystem.",
"version": "4.1.1",
"version": "4.1.2",
"author": "Joystream contributors",
"bin": {
"storage-node": "./bin/run"
Expand All @@ -12,7 +12,7 @@
"@elastic/ecs-winston-format": "^1.3.1",
"@joystream/metadata-protobuf": "^2.15.0",
"@joystream/opentelemetry": "1.0.0",
"@joystream/types": "^4.0.0",
"@joystream/types": "^4.6.0",
"@oclif/command": "^1",
"@oclif/config": "^1",
"@oclif/plugin-help": "^3",
Expand Down
2 changes: 1 addition & 1 deletion tests/network-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@apollo/client": "^3.2.5",
"@babel/helper-get-function-arity": "^7.16.7",
"@joystream/distributor-node-client": "^2.0.0",
"@joystream/js": "^1.6.0",
"@joystream/js": "^1.12.0",
"@polkadot/api": "10.7.1",
"@polkadot/keyring": "^12.6.2",
"@types/async-lock": "^1.1.3",
Expand Down
1 change: 1 addition & 0 deletions tests/network-tests/src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const proposalTypeToProposalParamsKey = {
'SetPalletFozenStatus': 'setPalletFozenStatusProposalParameters',
'SetEraPayoutDampingFactor': 'setEraPayoutDampingFactorProposalParameters',
'UpdateTokenPalletTokenConstraints': 'updateTokenPalletTokenConstraints',
'UpdateArgoBridgeConstraints': 'updateArgoBridgeConstraints',
} as const

type ProposalTypeToProposalParamsKeyMap = { [K in ProposalType]: keyof AugmentedConsts<'promise'>['proposalsCodex'] }
Expand Down
4 changes: 4 additions & 0 deletions types/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 2.3.0

- Bump @joystream/types to Petra version

### 2.1.0

- Bumped version for dependants version release to get the proper types version. [ref](https://github.com/Joystream/joystream/commit/f899922645013cd5aad6d8036aeae2180f123cf7)
Expand Down
2 changes: 1 addition & 1 deletion types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@joystream/types",
"version": "4.5.0",
"version": "4.6.0",
"description": "Types for Joystream Substrate Runtime - Nara release",
"main": "lib/cjs/index.js",
"types": "lib/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions types/src/augment/augment-api-consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,10 @@ declare module '@polkadot/api-base/types/consts' {
* Exports 'Terminate Working Group Lead' proposal parameters.
**/
terminateWorkingGroupLeadProposalParameters: PalletProposalsEngineProposalParameters & AugmentedConst<ApiType>;
/**
* Set Argo Bridge Constraints
**/
updateArgoBridgeConstraints: PalletProposalsEngineProposalParameters & AugmentedConst<ApiType>;
updateChannelPayoutsProposalParameters: PalletProposalsEngineProposalParameters & AugmentedConst<ApiType>;
updateGlobalNftLimitProposalParameters: PalletProposalsEngineProposalParameters & AugmentedConst<ApiType>;
/**
Expand Down
11 changes: 10 additions & 1 deletion types/src/augment/augment-api-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { ApiTypes, AugmentedEvent } from '@polkadot/api-base/types';
import type { BTreeMap, BTreeSet, Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, H256, Perbill, Percent, Permill } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportDispatchDispatchInfo, FrameSupportTokensMiscBalanceStatus, JoystreamNodeRuntimeProxyType, PalletBountyBountyActor, PalletBountyBountyParametersBTreeSet, PalletBountyOracleWorkEntryJudgment, PalletCommonBalanceKind, PalletCommonWorkingGroupIterableEnumsWorkingGroup, PalletContentChannelCreationParametersRecord, PalletContentChannelFundsDestination, PalletContentChannelRecord, PalletContentChannelUpdateParametersRecord, PalletContentIterableEnumsChannelActionPermission, PalletContentNftLimitPeriod, PalletContentNftTypesEnglishAuctionParamsRecord, PalletContentNftTypesNftIssuanceParametersRecord, PalletContentNftTypesOpenAuctionParamsRecord, PalletContentPendingTransfer, PalletContentPermissionsContentActor, PalletContentPermissionsCuratorGroupIterableEnumsContentModerationAction, PalletContentPermissionsCuratorGroupIterableEnumsPausableChannelFeature, PalletContentTransferCommitmentParametersBTreeMap, PalletContentUpdateChannelPayoutsParametersRecord, PalletContentVideoCreationParametersRecord, PalletContentVideoUpdateParametersRecord, PalletElectionProviderMultiPhaseElectionCompute, PalletElectionProviderMultiPhasePhase, PalletForumExtendedPostIdObject, PalletForumPrivilegedActor, PalletImOnlineSr25519AppSr25519Public, PalletMembershipBuyMembershipParameters, PalletMembershipCreateMemberParameters, PalletMembershipGiftMembershipParameters, PalletMembershipInviteMembershipParameters, PalletMultisigTimepoint, PalletProjectTokenAmmCurve, PalletProjectTokenTokenConstraints, PalletProjectTokenTokenIssuanceParameters, PalletProjectTokenTokenSale, PalletProjectTokenTransferPolicy, PalletProjectTokenTransfers, PalletProposalsCodexGeneralProposalParams, PalletProposalsCodexProposalDetails, PalletProposalsDiscussionThreadModeBTreeSet, PalletProposalsEngineProposalStatusesExecutionStatus, PalletProposalsEngineProposalStatusesProposalDecision, PalletProposalsEngineProposalStatusesProposalStatus, PalletProposalsEngineVoteKind, PalletReferendumOptionResult, PalletStakingExposure, PalletStakingForcing, PalletStakingValidatorPrefs, PalletStorageBagIdType, PalletStorageDistributionBucketIdRecord, PalletStorageDynBagCreationParametersRecord, PalletStorageDynamicBagIdType, PalletStorageDynamicBagType, PalletStorageUploadParametersRecord, PalletStorageVoucher, PalletVestingVestingInfo, PalletWorkingGroupApplyOnOpeningParams, PalletWorkingGroupOpeningType, PalletWorkingGroupRewardPaymentType, PalletWorkingGroupStakePolicy, SpConsensusGrandpaAppPublic, SpNposElectionsElectionScore, SpRuntimeDispatchError } from '@polkadot/types/lookup';
import type { FrameSupportDispatchDispatchInfo, FrameSupportTokensMiscBalanceStatus, JoystreamNodeRuntimeProxyType, PalletArgoBridgeBridgeConstraints, PalletArgoBridgeRemoteAccount, PalletArgoBridgeRemoteTransfer, PalletBountyBountyActor, PalletBountyBountyParametersBTreeSet, PalletBountyOracleWorkEntryJudgment, PalletCommonBalanceKind, PalletCommonWorkingGroupIterableEnumsWorkingGroup, PalletContentChannelCreationParametersRecord, PalletContentChannelFundsDestination, PalletContentChannelRecord, PalletContentChannelUpdateParametersRecord, PalletContentIterableEnumsChannelActionPermission, PalletContentNftLimitPeriod, PalletContentNftTypesEnglishAuctionParamsRecord, PalletContentNftTypesNftIssuanceParametersRecord, PalletContentNftTypesOpenAuctionParamsRecord, PalletContentPendingTransfer, PalletContentPermissionsContentActor, PalletContentPermissionsCuratorGroupIterableEnumsContentModerationAction, PalletContentPermissionsCuratorGroupIterableEnumsPausableChannelFeature, PalletContentTransferCommitmentParametersBTreeMap, PalletContentUpdateChannelPayoutsParametersRecord, PalletContentVideoCreationParametersRecord, PalletContentVideoUpdateParametersRecord, PalletElectionProviderMultiPhaseElectionCompute, PalletElectionProviderMultiPhasePhase, PalletForumExtendedPostIdObject, PalletForumPrivilegedActor, PalletImOnlineSr25519AppSr25519Public, PalletMembershipBuyMembershipParameters, PalletMembershipCreateMemberParameters, PalletMembershipGiftMembershipParameters, PalletMembershipInviteMembershipParameters, PalletMultisigTimepoint, PalletProjectTokenAmmCurve, PalletProjectTokenTokenConstraints, PalletProjectTokenTokenIssuanceParameters, PalletProjectTokenTokenSale, PalletProjectTokenTransferPolicy, PalletProjectTokenTransfers, PalletProposalsCodexGeneralProposalParams, PalletProposalsCodexProposalDetails, PalletProposalsDiscussionThreadModeBTreeSet, PalletProposalsEngineProposalStatusesExecutionStatus, PalletProposalsEngineProposalStatusesProposalDecision, PalletProposalsEngineProposalStatusesProposalStatus, PalletProposalsEngineVoteKind, PalletReferendumOptionResult, PalletStakingExposure, PalletStakingForcing, PalletStakingValidatorPrefs, PalletStorageBagIdType, PalletStorageDistributionBucketIdRecord, PalletStorageDynBagCreationParametersRecord, PalletStorageDynamicBagIdType, PalletStorageDynamicBagType, PalletStorageUploadParametersRecord, PalletStorageVoucher, PalletVestingVestingInfo, PalletWorkingGroupApplyOnOpeningParams, PalletWorkingGroupOpeningType, PalletWorkingGroupRewardPaymentType, PalletWorkingGroupStakePolicy, SpConsensusGrandpaAppPublic, SpNposElectionsElectionScore, SpRuntimeDispatchError } from '@polkadot/types/lookup';

export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;

Expand Down Expand Up @@ -204,6 +204,15 @@ declare module '@polkadot/api-base/types/events' {
**/
WorkingGroupBudgetFunded: AugmentedEvent<ApiType, [u64, u128, Bytes]>;
};
argoBridge: {
BridgeConfigUpdated: AugmentedEvent<ApiType, [PalletArgoBridgeBridgeConstraints]>;
BridgePaused: AugmentedEvent<ApiType, [AccountId32]>;
BridgeThawnFinished: AugmentedEvent<ApiType, []>;
BridgeThawnStarted: AugmentedEvent<ApiType, [AccountId32, u32]>;
InboundTransferFinalized: AugmentedEvent<ApiType, [PalletArgoBridgeRemoteTransfer, AccountId32, u128]>;
OutboundTransferRequested: AugmentedEvent<ApiType, [u64, AccountId32, PalletArgoBridgeRemoteAccount, u128, u128]>;
OutboundTransferReverted: AugmentedEvent<ApiType, [u64, AccountId32, u128, Bytes]>;
};
balances: {
/**
* A balance was set by root.
Expand Down
Loading

0 comments on commit 7d5493c

Please sign in to comment.