git.delta.rocks / unique-network / refs/commits / 1fd293482053

difftreelog

tests(preimage + maintenance)

Fahrrader2023-02-21parent: #79c3b73.patch.diff
in: master

6 files changed

modifiedtests/package.jsondiffbeforeafterboth
82 "testSetOffchainSchema": "mocha --timeout 9999999 -r ts-node/register ./**/setOffchainSchema.test.ts",82 "testSetOffchainSchema": "mocha --timeout 9999999 -r ts-node/register ./**/setOffchainSchema.test.ts",
83 "testNextSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/nextSponsoring.test.ts",83 "testNextSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/nextSponsoring.test.ts",
84 "testOverflow": "mocha --timeout 9999999 -r ts-node/register ./**/overflow.test.ts",84 "testOverflow": "mocha --timeout 9999999 -r ts-node/register ./**/overflow.test.ts",
85 "testMaintenance": "mocha --timeout 9999999 -r ts-node/register ./**/maintenanceMode.seqtest.ts",85 "testMaintenance": "mocha --timeout 9999999 -r ts-node/register ./**/maintenance.seqtest.ts",
86 "testInflation": "mocha --timeout 9999999 -r ts-node/register ./**/inflation.seqtest.ts",86 "testInflation": "mocha --timeout 9999999 -r ts-node/register ./**/inflation.seqtest.ts",
87 "testScheduler": "mocha --timeout 9999999 -r ts-node/register ./**/scheduler.seqtest.ts",87 "testScheduler": "mocha --timeout 9999999 -r ts-node/register ./**/scheduler.seqtest.ts",
88 "testSchedulingEVM": "mocha --timeout 9999999 -r ts-node/register ./**/eth/scheduling.test.ts",88 "testSchedulingEVM": "mocha --timeout 9999999 -r ts-node/register ./**/eth/scheduling.test.ts",
addedtests/src/maintenance.seqtest.tsdiffbeforeafterboth

no changes

deletedtests/src/maintenanceMode.seqtest.tsdiffbeforeafterboth

no changes

modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
66 const foreignAssets = 'foreignassets';66 const foreignAssets = 'foreignassets';
67 const appPromotion = 'apppromotion';67 const appPromotion = 'apppromotion';
68 const collatorSelection = ['authorship', 'session', 'collatorselection', 'identity'];68 const collatorSelection = ['authorship', 'session', 'collatorselection', 'identity'];
69 const governance = ['preimage'];
69 const testUtils = 'testutils';70 const testUtils = 'testutils';
7071
71 if (chain.eq('OPAL by UNIQUE')) {72 if (chain.eq('OPAL by UNIQUE')) {
75 appPromotion,76 appPromotion,
76 testUtils,77 testUtils,
77 ...collatorSelection,78 ...collatorSelection,
79 ...governance,
78 );80 );
79 } else if (chain.eq('QUARTZ by UNIQUE') || chain.eq('SAPPHIRE by UNIQUE')) {81 } else if (chain.eq('QUARTZ by UNIQUE') || chain.eq('SAPPHIRE by UNIQUE')) {
80 requiredPallets.push(82 requiredPallets.push(
81 refungible,83 refungible,
82 appPromotion,84 appPromotion,
83 foreignAssets,85 foreignAssets,
84 ...collatorSelection,86 ...collatorSelection,
87 ...governance,
85 );88 );
86 } else if (chain.eq('UNIQUE')) {89 } else if (chain.eq('UNIQUE')) {
87 // Insert Unique additional pallets here90 // Insert Unique additional pallets here
modifiedtests/src/util/index.tsdiffbeforeafterboth
114 CollatorSelection = 'collatorselection',114 CollatorSelection = 'collatorselection',
115 Session = 'session',115 Session = 'session',
116 Identity = 'identity',116 Identity = 'identity',
117 Preimage = 'preimage',
118 Maintenance = 'maintenance',
117 TestUtils = 'testutils',119 TestUtils = 'testutils',
118}120}
119121
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
2869 }2869 }
2870}2870}
2871
2872class PreimageGroup extends HelperGroup<UniqueHelper> {
2873 async getPreimageInfo(h256: string) {
2874 return (await this.helper.callRpc('api.query.preimage.statusFor', [h256])).toJSON();
2875 }
2876
2877 /**
2878 * Create a preimage with a hex or a byte array.
2879 * @param signer keyring of the signer.
2880 * @param bytes preimage encoded in hex or a byte array, e.g. an extrinsic call.
2881 * @example await notePreimage(preimageMaker,
2882 * helper.constructApiCall('api.tx.identity.forceInsertIdentities', [identitiesToAdd]).method.toHex()
2883 * );
2884 * @returns promise of extrinsic execution.
2885 */
2886 notePreimage(signer: TSigner, bytes: string | Uint8Array) {
2887 return this.helper.executeExtrinsic(signer, 'api.tx.preimage.notePreimage', [bytes]);
2888 }
2889
2890 /**
2891 * Delete an existing preimage and return the deposit.
2892 * @param signer keyring of the signer - either the owner or the preimage manager (sudo).
2893 * @param h256 hash of the preimage.
2894 * @returns promise of extrinsic execution.
2895 */
2896 unnotePreimage(signer: TSigner, h256: string) {
2897 return this.helper.executeExtrinsic(signer, 'api.tx.preimage.unnotePreimage', [h256]);
2898 }
2899
2900 /**
2901 * Request a preimage be uploaded to the chain without paying any fees or deposits.
2902 * @param signer keyring of the signer - either the owner or the preimage manager (sudo).
2903 * @param h256 hash of the preimage.
2904 * @returns promise of extrinsic execution.
2905 */
2906 requestPreimage(signer: TSigner, h256: string) {
2907 return this.helper.executeExtrinsic(signer, 'api.tx.preimage.requestPreimage', [h256]);
2908 }
2909
2910 /**
2911 * Clear a previously made request for a preimage.
2912 * @param signer keyring of the signer - either the owner or the preimage manager (sudo).
2913 * @param h256 hash of the preimage.
2914 * @returns promise of extrinsic execution.
2915 */
2916 unrequestPreimage(signer: TSigner, h256: string) {
2917 return this.helper.executeExtrinsic(signer, 'api.tx.preimage.unrequestPreimage', [h256]);
2918 }
2919}
28712920
2872class ForeignAssetsGroup extends HelperGroup<UniqueHelper> {2921class ForeignAssetsGroup extends HelperGroup<UniqueHelper> {
2873 async register(signer: TSigner, ownerAddress: TSubstrateAccount, location: any, metadata: IForeignAssetMetadata) {2922 async register(signer: TSigner, ownerAddress: TSubstrateAccount, location: any, metadata: IForeignAssetMetadata) {
3094 staking: StakingGroup;3143 staking: StakingGroup;
3095 scheduler: SchedulerGroup;3144 scheduler: SchedulerGroup;
3096 collatorSelection: CollatorSelectionGroup;3145 collatorSelection: CollatorSelectionGroup;
3146 preimage: PreimageGroup;
3097 foreignAssets: ForeignAssetsGroup;3147 foreignAssets: ForeignAssetsGroup;
3098 xcm: XcmGroup<UniqueHelper>;3148 xcm: XcmGroup<UniqueHelper>;
3099 xTokens: XTokensGroup<UniqueHelper>;3149 xTokens: XTokensGroup<UniqueHelper>;
3110 this.staking = new StakingGroup(this);3160 this.staking = new StakingGroup(this);
3111 this.scheduler = new SchedulerGroup(this);3161 this.scheduler = new SchedulerGroup(this);
3112 this.collatorSelection = new CollatorSelectionGroup(this);3162 this.collatorSelection = new CollatorSelectionGroup(this);
3163 this.preimage = new PreimageGroup(this);
3113 this.foreignAssets = new ForeignAssetsGroup(this);3164 this.foreignAssets = new ForeignAssetsGroup(this);
3114 this.xcm = new XcmGroup(this, 'polkadotXcm');3165 this.xcm = new XcmGroup(this, 'polkadotXcm');
3115 this.xTokens = new XTokensGroup(this);3166 this.xTokens = new XTokensGroup(this);