@@ -28,7 +28,7 @@ export function withNodes(
2828 options : {
2929 promiseExpect : PromiseExpect ;
3030 validators : ValidatorConfig [ ] ;
31- overrideParams ?: Partial < typeof defaultParams > ;
31+ overrideParams ?: Partial < CommonParams > ;
3232 onBeforeEnable ?: ( nodes : CodeChain [ ] ) => Promise < void > ;
3333 }
3434) {
@@ -82,7 +82,7 @@ export function findNode(nodes: CodeChain[], signer: Signer) {
8282async function createNodes ( options : {
8383 promiseExpect : PromiseExpect ;
8484 validators : ValidatorConfig [ ] ;
85- initialParams : typeof defaultParams ;
85+ initialParams : CommonParams ;
8686 onBeforeEnable ?: ( nodes : CodeChain [ ] ) => Promise < void > ;
8787} ) : Promise < CodeChain [ ] > {
8888 const chain = `${ __dirname } /../scheme/tendermint-dynval.json` ;
@@ -347,12 +347,14 @@ export const defaultParams = {
347347 maxCandidateMetadataSize : 128
348348} ;
349349
350- export async function changeParams (
351- node : CodeChain ,
352- metadataSeq : number ,
353- params : typeof defaultParams
354- ) {
355- const newParams : any [ ] = [
350+ interface EraCommonParams {
351+ era : number ;
352+ }
353+
354+ type CommonParams = typeof defaultParams & Partial < EraCommonParams > ;
355+
356+ function encodeParams ( params : CommonParams ) : any [ ] {
357+ const result = [
356358 params . maxExtraDataSize ,
357359 params . maxAssetSchemeMetadataSize ,
358360 params . maxTransferMetadataSize ,
@@ -386,12 +388,23 @@ export async function changeParams(
386388 params . minDeposit ,
387389 params . maxCandidateMetadataSize
388390 ] ;
391+ if ( params . era ) {
392+ result . push ( params . era ) ;
393+ }
394+ return result ;
395+ }
396+
397+ export async function changeParams (
398+ node : CodeChain ,
399+ metadataSeq : number ,
400+ params : CommonParams
401+ ) {
389402 const changeParamsActionRlp : [
390403 number ,
391404 number ,
392405 ( number | string ) [ ] ,
393406 ...string [ ]
394- ] = [ 0xff , metadataSeq , newParams ] ;
407+ ] = [ 0xff , metadataSeq , encodeParams ( params ) ] ;
395408 const message = blake256 ( RLP . encode ( changeParamsActionRlp ) . toString ( "hex" ) ) ;
396409 changeParamsActionRlp . push (
397410 `0x${ SDK . util . signEcdsa ( message , faucetSecret ) } `
0 commit comments