@@ -945,7 +945,7 @@ describe("ChangeParams", function() {
945945 ) . rejectedWith ( / r e l e a s e p e r i o d / ) ;
946946 } ) ;
947947
948- it ( "The maximum number of candidates cannot be equal to the minimum number of candidates " , async function ( ) {
948+ it ( "A release period cannot be equal to a custody period " , async function ( ) {
949949 const newParams = [
950950 0x20 , // maxExtraDataSize
951951 0x0400 , // maxAssetSchemeMetadataSize
@@ -1011,264 +1011,6 @@ describe("ChangeParams", function() {
10111011 expect ( err . message ) . contains ( "custody period" ) ;
10121012 }
10131013 } ) ;
1014- } ) ;
1015-
1016- describe ( "with stake parameters" , async function ( ) {
1017- it ( "change" , async function ( ) {
1018- const newParams = [
1019- 0x20 , // maxExtraDataSize
1020- 0x0400 , // maxAssetSchemeMetadataSize
1021- 0x0100 , // maxTransferMetadataSize
1022- 0x0200 , // maxTextContentSize
1023- "tc" , // networkID
1024- 11 , // minPayCost
1025- 10 , // minSetRegularKeyCost
1026- 10 , // minCreateShardCost
1027- 10 , // minSetShardOwnersCost
1028- 10 , // minSetShardUsersCost
1029- 10 , // minWrapCccCost
1030- 10 , // minCustomCost
1031- 10 , // minStoreCost
1032- 10 , // minRemoveCost
1033- 10 , // minMintAssetCost
1034- 10 , // minTransferAssetCost
1035- 10 , // minChangeAssetSchemeCost
1036- 10 , // minIncreaseAssetSupplyCost
1037- 10 , // minComposeAssetCost
1038- 10 , // minDecomposeAssetCost
1039- 10 , // minUnwrapCccCost
1040- 4194304 , // maxBodySize
1041- 16384 // snapshotPeriod
1042- ] ;
1043- const changeParams : ( number | string | ( number | string ) [ ] ) [ ] = [
1044- 0xff ,
1045- 0 ,
1046- newParams
1047- ] ;
1048- const message = blake256 ( RLP . encode ( changeParams ) . toString ( "hex" ) ) ;
1049- changeParams . push (
1050- `0x${ node . sdk . util . signEcdsa ( message , aliceSecret ) } `
1051- ) ;
1052- changeParams . push (
1053- `0x${ node . sdk . util . signEcdsa ( message , carolSecret ) } `
1054- ) ;
1055-
1056- {
1057- const hash = await node . sdk . rpc . chain . sendSignedTransaction (
1058- node . sdk . core
1059- . createCustomTransaction ( {
1060- handlerId : stakeActionHandlerId ,
1061- bytes : RLP . encode ( changeParams )
1062- } )
1063- . sign ( {
1064- secret : faucetSecret ,
1065- seq : await node . sdk . rpc . chain . getSeq ( faucetAddress ) ,
1066- fee : 10
1067- } )
1068- ) ;
1069- expect ( await node . sdk . rpc . chain . containsTransaction ( hash ) ) . be
1070- . true ;
1071- }
1072-
1073- await expect ( node . sendPayTx ( { fee : 10 } ) ) . rejectedWith (
1074- / T o o L o w F e e /
1075- ) ;
1076-
1077- const params = await node . sdk . rpc . sendRpcRequest (
1078- "chain_getCommonParams" ,
1079- [ null ]
1080- ) ;
1081- expect ( U64 . ensure ( params . minPayCost ) ) . to . be . deep . equal ( new U64 ( 11 ) ) ;
1082- } ) ;
1083-
1084- it ( "nomination expiration cannot be zero" , async function ( ) {
1085- const newParams = [
1086- 0x20 , // maxExtraDataSize
1087- 0x0400 , // maxAssetSchemeMetadataSize
1088- 0x0100 , // maxTransferMetadataSize
1089- 0x0200 , // maxTextContentSize
1090- "tc" , // networkID
1091- 10 , // minPayCost
1092- 10 , // minSetRegularKeyCost
1093- 10 , // minCreateShardCost
1094- 10 , // minSetShardOwnersCost
1095- 10 , // minSetShardUsersCost
1096- 10 , // minWrapCccCost
1097- 10 , // minCustomCost
1098- 10 , // minStoreCost
1099- 10 , // minRemoveCost
1100- 10 , // minMintAssetCost
1101- 10 , // minTransferAssetCost
1102- 10 , // minChangeAssetSchemeCost
1103- 10 , // minIncreaseAssetSupplyCost
1104- 10 , // minComposeAssetCost
1105- 10 , // minDecomposeAssetCost
1106- 10 , // minUnwrapCccCost
1107- 4194304 , // maxBodySize
1108- 16384 , // snapshotPeriod
1109- 100 , // termSeconds
1110- 0 , // nominationExpiration
1111- 10 , // custodyPeriod
1112- 30 , // releasePeriod
1113- 101 , // maxNumOfValidators
1114- 100 , // minNumOfValidators
1115- 4 , // delegationThreshold
1116- 1000 , // minDeposit
1117- 128 // maxCandidateMetadataSize
1118- ] ;
1119- const changeParams : ( number | string | ( number | string ) [ ] ) [ ] = [
1120- 0xff ,
1121- 0 ,
1122- newParams
1123- ] ;
1124- const message = blake256 ( RLP . encode ( changeParams ) . toString ( "hex" ) ) ;
1125- changeParams . push (
1126- `0x${ node . sdk . util . signEcdsa ( message , aliceSecret ) } `
1127- ) ;
1128- changeParams . push (
1129- `0x${ node . sdk . util . signEcdsa ( message , carolSecret ) } `
1130- ) ;
1131-
1132- const tx = node . sdk . core
1133- . createCustomTransaction ( {
1134- handlerId : stakeActionHandlerId ,
1135- bytes : RLP . encode ( changeParams )
1136- } )
1137- . sign ( {
1138- secret : faucetSecret ,
1139- seq : await node . sdk . rpc . chain . getSeq ( faucetAddress ) ,
1140- fee : 10
1141- } ) ;
1142- await expect (
1143- node . sdk . rpc . chain . sendSignedTransaction ( tx )
1144- ) . rejectedWith ( / n o m i n a t i o n e x p i r a t i o n / ) ;
1145- } ) ;
1146-
1147- it ( "custody period cannot be zero" , async function ( ) {
1148- const newParams = [
1149- 0x20 , // maxExtraDataSize
1150- 0x0400 , // maxAssetSchemeMetadataSize
1151- 0x0100 , // maxTransferMetadataSize
1152- 0x0200 , // maxTextContentSize
1153- "tc" , // networkID
1154- 10 , // minPayCost
1155- 10 , // minSetRegularKeyCost
1156- 10 , // minCreateShardCost
1157- 10 , // minSetShardOwnersCost
1158- 10 , // minSetShardUsersCost
1159- 10 , // minWrapCccCost
1160- 10 , // minCustomCost
1161- 10 , // minStoreCost
1162- 10 , // minRemoveCost
1163- 10 , // minMintAssetCost
1164- 10 , // minTransferAssetCost
1165- 10 , // minChangeAssetSchemeCost
1166- 10 , // minIncreaseAssetSupplyCost
1167- 10 , // minComposeAssetCost
1168- 10 , // minDecomposeAssetCost
1169- 10 , // minUnwrapCccCost
1170- 4194304 , // maxBodySize
1171- 16384 , // snapshotPeriod
1172- 100 , // termSeconds
1173- 10 , // nominationExpiration
1174- 0 , // custodyPeriod
1175- 30 , // releasePeriod
1176- 101 , // maxNumOfValidators
1177- 100 , // minNumOfValidators
1178- 4 , // delegationThreshold
1179- 1000 , // minDeposit
1180- 128 // maxCandidateMetadataSize
1181- ] ;
1182- const changeParams : ( number | string | ( number | string ) [ ] ) [ ] = [
1183- 0xff ,
1184- 0 ,
1185- newParams
1186- ] ;
1187- const message = blake256 ( RLP . encode ( changeParams ) . toString ( "hex" ) ) ;
1188- changeParams . push (
1189- `0x${ node . sdk . util . signEcdsa ( message , aliceSecret ) } `
1190- ) ;
1191- changeParams . push (
1192- `0x${ node . sdk . util . signEcdsa ( message , carolSecret ) } `
1193- ) ;
1194-
1195- const tx = node . sdk . core
1196- . createCustomTransaction ( {
1197- handlerId : stakeActionHandlerId ,
1198- bytes : RLP . encode ( changeParams )
1199- } )
1200- . sign ( {
1201- secret : faucetSecret ,
1202- seq : await node . sdk . rpc . chain . getSeq ( faucetAddress ) ,
1203- fee : 10
1204- } ) ;
1205- await expect (
1206- node . sdk . rpc . chain . sendSignedTransaction ( tx )
1207- ) . rejectedWith ( / c u s t o d y p e r i o d / ) ;
1208- } ) ;
1209-
1210- it ( "release period cannot be zero" , async function ( ) {
1211- const newParams = [
1212- 0x20 , // maxExtraDataSize
1213- 0x0400 , // maxAssetSchemeMetadataSize
1214- 0x0100 , // maxTransferMetadataSize
1215- 0x0200 , // maxTextContentSize
1216- "tc" , // networkID
1217- 10 , // minPayCost
1218- 10 , // minSetRegularKeyCost
1219- 10 , // minCreateShardCost
1220- 10 , // minSetShardOwnersCost
1221- 10 , // minSetShardUsersCost
1222- 10 , // minWrapCccCost
1223- 10 , // minCustomCost
1224- 10 , // minStoreCost
1225- 10 , // minRemoveCost
1226- 10 , // minMintAssetCost
1227- 10 , // minTransferAssetCost
1228- 10 , // minChangeAssetSchemeCost
1229- 10 , // minIncreaseAssetSupplyCost
1230- 10 , // minComposeAssetCost
1231- 10 , // minDecomposeAssetCost
1232- 10 , // minUnwrapCccCost
1233- 4194304 , // maxBodySize
1234- 16384 , // snapshotPeriod
1235- 100 , // termSeconds
1236- 10 , // nominationExpiration
1237- 10 , // custodyPeriod
1238- 0 , // releasePeriod
1239- 101 , // maxNumOfValidators
1240- 100 , // minNumOfValidators
1241- 4 , // delegationThreshold
1242- 1000 , // minDeposit
1243- 128 // maxCandidateMetadataSize
1244- ] ;
1245- const changeParams : ( number | string | ( number | string ) [ ] ) [ ] = [
1246- 0xff ,
1247- 0 ,
1248- newParams
1249- ] ;
1250- const message = blake256 ( RLP . encode ( changeParams ) . toString ( "hex" ) ) ;
1251- changeParams . push (
1252- `0x${ node . sdk . util . signEcdsa ( message , aliceSecret ) } `
1253- ) ;
1254- changeParams . push (
1255- `0x${ node . sdk . util . signEcdsa ( message , carolSecret ) } `
1256- ) ;
1257-
1258- const tx = node . sdk . core
1259- . createCustomTransaction ( {
1260- handlerId : stakeActionHandlerId ,
1261- bytes : RLP . encode ( changeParams )
1262- } )
1263- . sign ( {
1264- secret : faucetSecret ,
1265- seq : await node . sdk . rpc . chain . getSeq ( faucetAddress ) ,
1266- fee : 10
1267- } ) ;
1268- await expect (
1269- node . sdk . rpc . chain . sendSignedTransaction ( tx )
1270- ) . rejectedWith ( / r e l e a s e p e r i o d / ) ;
1271- } ) ;
12721014
12731015 it ( "min deposit cannot be zero" , async function ( ) {
12741016 const newParams = [
0 commit comments