From 62e89c3d0e924810e2863d12c3b782cb5001889d Mon Sep 17 00:00:00 2001 From: Chalith Desaman Date: Thu, 4 Aug 2022 12:04:49 +0530 Subject: [PATCH] Missing config restructure changes for sample contracts (#369) --- examples/c_contract/hotpocket_contract.h | 4 ++-- examples/nodejs_contract/diagnostic_contract.js | 6 +++--- examples/nodejs_contract/package-lock.json | 14 +++++++------- examples/nodejs_contract/package.json | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/c_contract/hotpocket_contract.h b/examples/c_contract/hotpocket_contract.h index 4bbbb5bb..a0f29c97 100644 --- a/examples/c_contract/hotpocket_contract.h +++ b/examples/c_contract/hotpocket_contract.h @@ -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]; diff --git a/examples/nodejs_contract/diagnostic_contract.js b/examples/nodejs_contract/diagnostic_contract.js index 50cbd62b..a73ede44 100644 --- a/examples/nodejs_contract/diagnostic_contract.js +++ b/examples/nodejs_contract/diagnostic_contract.js @@ -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 { diff --git a/examples/nodejs_contract/package-lock.json b/examples/nodejs_contract/package-lock.json index 84d8a651..626f2333 100644 --- a/examples/nodejs_contract/package-lock.json +++ b/examples/nodejs_contract/package-lock.json @@ -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", diff --git a/examples/nodejs_contract/package.json b/examples/nodejs_contract/package.json index 22738578..25179058 100644 --- a/examples/nodejs_contract/package.json +++ b/examples/nodejs_contract/package.json @@ -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" }