Missing config restructure changes for sample contracts (#369)

This commit is contained in:
Chalith Desaman
2022-08-04 12:04:49 +05:30
committed by GitHub
parent 6b871dafc5
commit 62e89c3d0e
4 changed files with 13 additions and 13 deletions

View File

@@ -788,7 +788,7 @@ int __hp_write_to_patch_file(const int fd, const struct hp_config *config)
" \"mode\": %s,\n \"roundtime\": %s,\n \"stage_slice\": %s,\n"
" \"threshold\": %s\n },\n";
char consensus_mode_str[9], roundtime_str[16], stage_slice_str[16], threshold_str[3];
char consensus_mode_str[10], roundtime_str[16], stage_slice_str[16], threshold_str[6];
sprintf(consensus_mode_str, "\"%s\"", config->consensus.mode == PUBLIC ? "public" : "private");
sprintf(roundtime_str, "%d", config->consensus.roundtime);
@@ -806,7 +806,7 @@ int __hp_write_to_patch_file(const int fd, const struct hp_config *config)
const char *npl_json = " \"npl\": {\n"
" \"mode\": %s\n },\n";
char npl_mode_str[9];
char npl_mode_str[10];
sprintf(npl_mode_str, "\"%s\"", config->npl.mode == PUBLIC ? "public" : "private");
const size_t npl_json_len = 37 + strlen(npl_mode_str);
char npl_buf[npl_json_len];

View File

@@ -89,14 +89,14 @@ const diagnosticContract = async (ctx) => {
if (!isNaN(param)) {
if (param >= 100) {
const config = await ctx.getConfig();
config.roundtime = param;
config.consensus.roundtime = param;
await ctx.updateConfig(config)
output = "Updated Roundtime to " + config.roundtime;
output = "Updated Roundtime to " + config.consensus.roundtime;
}
}
else {
const config = await ctx.getConfig();
output = "Roundtime: " + config.roundtime;
output = "Roundtime: " + config.consensus.roundtime;
}
}
else {

View File

@@ -6,7 +6,7 @@
"": {
"dependencies": {
"bson": "4.0.4",
"hotpocket-nodejs-contract": "0.5.4",
"hotpocket-nodejs-contract": "0.5.5",
"seedrandom": "3.0.5"
}
},
@@ -37,9 +37,9 @@
}
},
"node_modules/hotpocket-nodejs-contract": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/hotpocket-nodejs-contract/-/hotpocket-nodejs-contract-0.5.4.tgz",
"integrity": "sha512-3Qr8V6KurfmLe+UTnHWYwhO3a4ZTJq7HJ2G8GqMUVvCy7w3wRsxB1tGP9t3TEeFWIjLLA9d5Z4QbGAaIlUNONg=="
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/hotpocket-nodejs-contract/-/hotpocket-nodejs-contract-0.5.5.tgz",
"integrity": "sha512-eeBBILgSMU1Yx6ulH7QIvgwVIgFkOuXJFdR4PZ2BeMk4KKr2ixl1YrB/V9UB/cg7ObKJCOH+hsU7oxbxECcBmQ=="
},
"node_modules/ieee754": {
"version": "1.1.13",
@@ -82,9 +82,9 @@
}
},
"hotpocket-nodejs-contract": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/hotpocket-nodejs-contract/-/hotpocket-nodejs-contract-0.5.4.tgz",
"integrity": "sha512-3Qr8V6KurfmLe+UTnHWYwhO3a4ZTJq7HJ2G8GqMUVvCy7w3wRsxB1tGP9t3TEeFWIjLLA9d5Z4QbGAaIlUNONg=="
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/hotpocket-nodejs-contract/-/hotpocket-nodejs-contract-0.5.5.tgz",
"integrity": "sha512-eeBBILgSMU1Yx6ulH7QIvgwVIgFkOuXJFdR4PZ2BeMk4KKr2ixl1YrB/V9UB/cg7ObKJCOH+hsU7oxbxECcBmQ=="
},
"ieee754": {
"version": "1.1.13",

View File

@@ -5,7 +5,7 @@
"build-diag": "ncc build diagnostic_contract.js -o dist/diagnostic-contract"
},
"dependencies": {
"hotpocket-nodejs-contract": "0.5.4",
"hotpocket-nodejs-contract": "0.5.5",
"bson": "4.0.4",
"seedrandom": "3.0.5"
}