From 64c3eb0fe0b5c5b3641145dd164adf2bf0747907 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Wed, 26 Feb 2020 21:13:10 +0100 Subject: [PATCH 01/97] Replace boot_node and whitelisted attrs with bitmask --- c/include/in3/client.h | 29 +++++++++++++++++++---------- c/src/core/client/cache.c | 17 +++++++++-------- c/src/core/client/client.h | 25 +++++++++++++++++-------- c/src/core/client/client_init.c | 4 ++-- c/src/core/client/nodelist.c | 27 ++++++++++++++------------- 5 files changed, 61 insertions(+), 41 deletions(-) diff --git a/c/include/in3/client.h b/c/include/in3/client.h index c7fb8d392..1b92eed63 100644 --- a/c/include/in3/client.h +++ b/c/include/in3/client.h @@ -148,24 +148,33 @@ typedef enum { FLAGS_AUTO_UPDATE_LIST = 0x2, /* the nodelist will be automaticly updated if the last_block is newer */ FLAGS_INCLUDE_CODE = 0x4, /* the code is included when sending eth_call-requests */ FLAGS_BINARY = 0x8, /* the client will use binary format */ - FLAGS_HTTP = 0x16, /* the client will try to use http instead of https */ - FLAGS_STATS = 0x32, /* nodes will keep track of the stats (default=true) */ + FLAGS_HTTP = 0x10, /* the client will try to use http instead of https */ + FLAGS_STATS = 0x20, /* nodes will keep track of the stats (default=true) */ } in3_flags_type_t; +/** + * a list of node attributes (mostly used internally) + */ +typedef enum { + ATTR_WHITELISTED = 1U, /**< indicates if node exists in whiteList */ + ATTR_BOOT_NODE = 2U, /**< used to avoid filtering manually added nodes before first nodeList update */ +} in3_node_attr_type_t; + +typedef uint8_t in3_node_attr_t; + /** incubed node-configuration. * * These information are read from the Registry contract and stored in this struct representing a server or node. */ typedef struct in3_node { - bytes_t* address; /**< address of the server */ - uint64_t deposit; /**< the deposit stored in the registry contract, which this would lose if it sends a wrong blockhash */ - uint32_t index; /**< index within the nodelist, also used in the contract as key */ - uint32_t capacity; /**< the maximal capacity able to handle */ - in3_node_props_t props; /**< used to identify the capabilities of the node. See in3_node_props_type_t in nodelist.h */ - char* url; /**< the url of the node */ - bool whitelisted; /**< boolean indicating if node exists in whiteList */ - bool boot_node; /**< internal - used to avoid filtering manually added nodes before first nodeList update */ + bytes_t* address; /**< address of the server */ + uint64_t deposit; /**< the deposit stored in the registry contract, which this would lose if it sends a wrong blockhash */ + uint32_t index; /**< index within the nodelist, also used in the contract as key */ + uint32_t capacity; /**< the maximal capacity able to handle */ + in3_node_props_t props; /**< used to identify the capabilities of the node. See in3_node_props_type_t in nodelist.h */ + char* url; /**< the url of the node */ + uint8_t attrs; /**< bitmask of internal attributes */ } in3_node_t; /** diff --git a/c/src/core/client/cache.c b/c/src/core/client/cache.c index 3a1e4080f..a98711785 100644 --- a/c/src/core/client/cache.c +++ b/c/src/core/client/cache.c @@ -33,6 +33,7 @@ *******************************************************************************/ #include "cache.h" +#include "../util/bitset.h" #include "../util/log.h" #include "../util/mem.h" #include "../util/utils.h" @@ -103,14 +104,14 @@ in3_ret_t in3_cache_update_nodelist(in3_t* c, in3_chain_t* chain) { pos += node_count * sizeof(in3_node_weight_t); for (int i = 0; i < node_count; i++) { - in3_node_t* n = chain->nodelist + i; - n->capacity = b_read_int(b, &pos); - n->index = b_read_int(b, &pos); - n->deposit = b_read_long(b, &pos); - n->props = b_read_long(b, &pos); - n->address = b_new_fixed_bytes(b, &pos, 20); - n->url = b_new_chars(b, &pos); - n->whitelisted = false; + in3_node_t* n = chain->nodelist + i; + n->capacity = b_read_int(b, &pos); + n->index = b_read_int(b, &pos); + n->deposit = b_read_long(b, &pos); + n->props = b_read_long(b, &pos); + n->address = b_new_fixed_bytes(b, &pos, 20); + n->url = b_new_chars(b, &pos); + BIT_CLEAR(n->attrs, ATTR_WHITELISTED); } // read verified hashes diff --git a/c/src/core/client/client.h b/c/src/core/client/client.h index a4ec21c78..8c7eff648 100644 --- a/c/src/core/client/client.h +++ b/c/src/core/client/client.h @@ -153,19 +153,28 @@ typedef enum { } in3_flags_type_t; +/** + * a list of node attributes (mostly used internally) + */ +typedef enum { + ATTR_WHITELISTED = 1U, /**< indicates if node exists in whiteList */ + ATTR_BOOT_NODE = 2U, /**< used to avoid filtering manually added nodes before first nodeList update */ +} in3_node_attr_type_t; + +typedef uint8_t in3_node_attr_t; + /** incubed node-configuration. * * These information are read from the Registry contract and stored in this struct representing a server or node. */ typedef struct in3_node { - bytes_t* address; /**< address of the server */ - uint64_t deposit; /**< the deposit stored in the registry contract, which this would lose if it sends a wrong blockhash */ - uint32_t index; /**< index within the nodelist, also used in the contract as key */ - uint32_t capacity; /**< the maximal capacity able to handle */ - in3_node_props_t props; /**< used to identify the capabilities of the node. See in3_node_props_type_t in nodelist.h */ - char* url; /**< the url of the node */ - bool whitelisted; /**< boolean indicating if node exists in whiteList */ - bool boot_node; /**< internal - used to avoid filtering manually added nodes before first nodeList update */ + bytes_t* address; /**< address of the server */ + uint64_t deposit; /**< the deposit stored in the registry contract, which this would lose if it sends a wrong blockhash */ + uint32_t index; /**< index within the nodelist, also used in the contract as key */ + uint32_t capacity; /**< the maximal capacity able to handle */ + in3_node_props_t props; /**< used to identify the capabilities of the node. See in3_node_props_type_t in nodelist.h */ + char* url; /**< the url of the node */ + uint8_t attrs; /**< bitmask of internal attributes */ } in3_node_t; /** diff --git a/c/src/core/client/client_init.c b/c/src/core/client/client_init.c index 18c95ed9d..c6473cc8e 100644 --- a/c/src/core/client/client_init.c +++ b/c/src/core/client/client_init.c @@ -157,8 +157,8 @@ static void initNode(in3_chain_t* chain, int node_index, char* address, char* ur node->deposit = 0; node->props = 0xFF; node->url = _malloc(strlen(url) + 1); + BIT_CLEAR(node->attrs, ATTR_WHITELISTED); memcpy(node->url, url, strlen(url) + 1); - node->whitelisted = false; in3_node_weight_t* weight = chain->weights + node_index; weight->blacklisted_until = 0; @@ -351,8 +351,8 @@ in3_ret_t in3_client_add_node(in3_t* c, chain_id_t chain_id, char* url, in3_node node->index = chain->nodelist_length; node->capacity = 1; node->deposit = 0; + BIT_CLEAR(node->attrs, ATTR_WHITELISTED); chain->nodelist_length++; - node->whitelisted = false; } else _free(node->url); diff --git a/c/src/core/client/nodelist.c b/c/src/core/client/nodelist.c index 80b84ffb4..0071f69cd 100644 --- a/c/src/core/client/nodelist.c +++ b/c/src/core/client/nodelist.c @@ -33,6 +33,7 @@ *******************************************************************************/ #include "nodelist.h" +#include "../util/bitset.h" #include "../util/data.h" #include "../util/debug.h" #include "../util/log.h" @@ -105,15 +106,14 @@ static in3_ret_t fill_chain(in3_chain_t* chain, in3_ctx_t* ctx, d_token_t* resul break; } - int old_index = i; - n->capacity = d_get_intkd(node, K_CAPACITY, 1); - n->index = d_get_intkd(node, K_INDEX, i); - n->deposit = d_get_longk(node, K_DEPOSIT); - n->props = d_get_longkd(node, K_PROPS, 65535); - n->url = d_get_stringk(node, K_URL); - n->address = d_get_byteskl(node, K_ADDRESS, 20); - n->boot_node = false; // nodes are considered boot nodes only until first nodeList update succeeds - const uint64_t register_time = d_get_longk(node, K_REGISTER_TIME); + int old_index = i; + n->capacity = d_get_intkd(node, K_CAPACITY, 1); + n->index = d_get_intkd(node, K_INDEX, i); + n->deposit = d_get_longk(node, K_DEPOSIT); + n->props = d_get_longkd(node, K_PROPS, 65535); + n->url = d_get_stringk(node, K_URL); + n->address = d_get_byteskl(node, K_ADDRESS, 20); + BIT_CLEAR(n->attrs, ATTR_BOOT_NODE); // nodes are considered boot nodes only until first nodeList update succeeds if (n->address) n->address = b_dup(n->address); // create a copy since the src will be freed. @@ -135,6 +135,7 @@ static in3_ret_t fill_chain(in3_chain_t* chain, in3_ctx_t* ctx, d_token_t* resul if (old_index >= 0) memcpy(weights + i, chain->weights + old_index, sizeof(in3_node_weight_t)); // if this is a newly registered node, we wait 24h before we use it, since this is the time where mallicous nodes may be unregistered. + const uint64_t register_time = d_get_longk(node, K_REGISTER_TIME); if (now && register_time + DAY > now && now > register_time) weights[i].blacklisted_until = register_time + DAY; @@ -167,12 +168,12 @@ void in3_client_run_chain_whitelisting(in3_chain_t* chain) { return; for (int j = 0; j < chain->nodelist_length; ++j) - chain->nodelist[j].whitelisted = false; + BIT_CLEAR(chain->nodelist[j].attrs, ATTR_WHITELISTED); for (size_t i = 0; i < chain->whitelist->addresses.len / 20; i += 20) { for (int j = 0; j < chain->nodelist_length; ++j) if (!memcmp(chain->whitelist->addresses.data + i, chain->nodelist[j].address, 20)) - chain->nodelist[j].whitelisted = true; + BIT_SET(chain->nodelist[j].attrs, ATTR_WHITELISTED); } } @@ -375,8 +376,8 @@ node_match_t* in3_node_list_fill_weight(in3_t* c, chain_id_t chain_id, in3_node_ nodeDef = all_nodes + i; weightDef = weights + i; - if (nodeDef->boot_node) goto SKIP_FILTERING; - if (chain->whitelist && !nodeDef->whitelisted) continue; + if (BIT_CHECK(nodeDef->attrs, ATTR_BOOT_NODE)) goto SKIP_FILTERING; + if (chain->whitelist && !BIT_CHECK(nodeDef->attrs, ATTR_WHITELISTED)) continue; if (nodeDef->deposit < c->min_deposit) continue; if (!in3_node_props_match(filter.props, nodeDef->props)) continue; if (filter.nodes != NULL) { From 9fc899c730429f3a3af0359620ae0396d6e826dc Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Wed, 26 Feb 2020 22:04:51 +0100 Subject: [PATCH 02/97] Realloc verified hashes if required --- c/src/core/client/client_init.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/c/src/core/client/client_init.c b/c/src/core/client/client_init.c index c6473cc8e..b3d365ee7 100644 --- a/c/src/core/client/client_init.c +++ b/c/src/core/client/client_init.c @@ -540,6 +540,14 @@ char* in3_configure(in3_t* c, const char* config) { c->max_code_cache = d_long(token); } else if (token->key == key("maxVerifiedHashes")) { EXPECT_TOK_U16(token); + in3_chain_t* chain = in3_find_chain(c, c->chain_id); + if (c->max_verified_hashes < d_long(token)) { + chain->verified_hashes = _realloc(chain->verified_hashes, + sizeof(in3_verified_hash_t) * d_long(token), + sizeof(in3_verified_hash_t) * c->max_verified_hashes); + // clear newly allocated memory + memset(chain->verified_hashes + c->max_verified_hashes, 0, (d_long(token) - c->max_verified_hashes) * sizeof(in3_verified_hash_t)); + } c->max_verified_hashes = d_long(token); } else if (token->key == key("timeout")) { EXPECT_TOK_U32(token); @@ -656,9 +664,12 @@ char* in3_configure(in3_t* c, const char* config) { } else if (cp.token->key == key("verifiedHashes")) { EXPECT_TOK_ARR(cp.token); EXPECT_TOK(cp.token, (unsigned) d_len(cp.token) <= c->max_verified_hashes, "expected array len <= maxVerifiedHashes"); - _free(chain->verified_hashes); - chain->verified_hashes = _calloc(c->max_verified_hashes, sizeof(in3_verified_hash_t)); - int i = 0; + if (!chain->verified_hashes) + chain->verified_hashes = _calloc(c->max_verified_hashes, sizeof(in3_verified_hash_t)); + else + // clear extra verified_hashes (preceding ones will be overwritten anyway) + memset(chain->verified_hashes + d_len(cp.token), 0, (c->max_verified_hashes - d_len(cp.token)) * sizeof(in3_verified_hash_t)); + int i = 0; for (d_iterator_t n = d_iter(cp.token); n.left; d_iter_next(&n), i++) { EXPECT_TOK_U64(d_get(n.token, key("block"))); EXPECT_TOK_B256(d_get(n.token, key("hash"))); From 487aa05c57ff8db551dba280483479616e1f75eb Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Thu, 27 Feb 2020 11:28:30 +0100 Subject: [PATCH 03/97] Mark boot nodes as such --- c/src/core/client/client_init.c | 5 ++++- c/test/unit_tests/test_request.c | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/c/src/core/client/client_init.c b/c/src/core/client/client_init.c index b3d365ee7..7ad676d72 100644 --- a/c/src/core/client/client_init.c +++ b/c/src/core/client/client_init.c @@ -158,6 +158,7 @@ static void initNode(in3_chain_t* chain, int node_index, char* address, char* ur node->props = 0xFF; node->url = _malloc(strlen(url) + 1); BIT_CLEAR(node->attrs, ATTR_WHITELISTED); + BIT_SET(node->attrs, ATTR_BOOT_NODE); memcpy(node->url, url, strlen(url) + 1); in3_node_weight_t* weight = chain->weights + node_index; @@ -679,7 +680,8 @@ char* in3_configure(in3_t* c, const char* config) { } else if (cp.token->key == key("nodeList")) { EXPECT_TOK_ARR(cp.token); if (in3_client_clear_nodes(c, chain_id) < 0) goto cleanup; - for (d_iterator_t n = d_iter(cp.token); n.left; d_iter_next(&n)) { + int i = 0; + for (d_iterator_t n = d_iter(cp.token); n.left; d_iter_next(&n), i++) { EXPECT_CFG(d_get(n.token, key("url")) && d_get(n.token, key("address")), "expected URL & address"); EXPECT_TOK_STR(d_get(n.token, key("url"))); EXPECT_TOK_ADDR(d_get(n.token, key("address"))); @@ -687,6 +689,7 @@ char* in3_configure(in3_t* c, const char* config) { d_get_longkd(n.token, key("props"), 65535), d_get_byteskl(n.token, key("address"), 20)->data) == IN3_OK, "add node failed"); + BIT_SET(chain->nodelist[i].attrs, ATTR_BOOT_NODE); } } else { EXPECT_TOK(cp.token, false, "unsupported config option!"); diff --git a/c/test/unit_tests/test_request.c b/c/test/unit_tests/test_request.c index 8c83a6aff..1f264213d 100644 --- a/c/test/unit_tests/test_request.c +++ b/c/test/unit_tests/test_request.c @@ -470,6 +470,10 @@ static void test_configure_validation() { TEST_ASSERT_EQUAL(7, chain->avg_block_time); + // test that all added nodes are marked as boot nodes + for (int i = 0; i < chain->nodelist_length; ++i) { + TEST_ASSERT_TRUE(!!(chain->nodelist[i].attrs & (1 << ATTR_BOOT_NODE))); + } in3_free(c); } From 0669f221934b846ab58470538db67514de5652b6 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Thu, 27 Feb 2020 11:28:39 +0100 Subject: [PATCH 04/97] Minor refactoring --- c/include/in3/client.h | 4 ++-- c/src/core/client/client.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/c/include/in3/client.h b/c/include/in3/client.h index 1b92eed63..a946e4d6f 100644 --- a/c/include/in3/client.h +++ b/c/include/in3/client.h @@ -157,8 +157,8 @@ typedef enum { * a list of node attributes (mostly used internally) */ typedef enum { - ATTR_WHITELISTED = 1U, /**< indicates if node exists in whiteList */ - ATTR_BOOT_NODE = 2U, /**< used to avoid filtering manually added nodes before first nodeList update */ + ATTR_WHITELISTED = 1, /**< indicates if node exists in whiteList */ + ATTR_BOOT_NODE = 2, /**< used to avoid filtering manually added nodes before first nodeList update */ } in3_node_attr_type_t; typedef uint8_t in3_node_attr_t; diff --git a/c/src/core/client/client.h b/c/src/core/client/client.h index 8c7eff648..990e205b2 100644 --- a/c/src/core/client/client.h +++ b/c/src/core/client/client.h @@ -157,8 +157,8 @@ typedef enum { * a list of node attributes (mostly used internally) */ typedef enum { - ATTR_WHITELISTED = 1U, /**< indicates if node exists in whiteList */ - ATTR_BOOT_NODE = 2U, /**< used to avoid filtering manually added nodes before first nodeList update */ + ATTR_WHITELISTED = 1, /**< indicates if node exists in whiteList */ + ATTR_BOOT_NODE = 2, /**< used to avoid filtering manually added nodes before first nodeList update */ } in3_node_attr_type_t; typedef uint8_t in3_node_attr_t; From 0b23c5fd890fd671824c900ce2e7d1fc91620d05 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 28 Feb 2020 22:12:00 +0100 Subject: [PATCH 05/97] Fix merge conflict --- c/src/core/client/client_init.c | 1 - 1 file changed, 1 deletion(-) diff --git a/c/src/core/client/client_init.c b/c/src/core/client/client_init.c index 73059474b..6feef4b8e 100644 --- a/c/src/core/client/client_init.c +++ b/c/src/core/client/client_init.c @@ -156,7 +156,6 @@ static void initNode(in3_chain_t* chain, int node_index, char* address, char* ur node->capacity = 1; node->deposit = 0; node->props = 0xFF; - node->boot_node = true; node->url = _malloc(strlen(url) + 1); BIT_CLEAR(node->attrs, ATTR_WHITELISTED); BIT_SET(node->attrs, ATTR_BOOT_NODE); From c1420f4067569358564f6d8c6a8507d63f2fc68c Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 3 Mar 2020 21:53:12 +0100 Subject: [PATCH 06/97] Use snake case for data and signer nodes JSON prop --- c/src/core/client/execute.c | 4 ++-- c/src/core/client/nodelist.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c/src/core/client/execute.c b/c/src/core/client/execute.c index 511a28bb3..281a694bf 100644 --- a/c/src/core/client/execute.c +++ b/c/src/core/client/execute.c @@ -122,7 +122,7 @@ static in3_ret_t configure_request(in3_ctx_t* ctx, in3_request_config_t* conf, d if (c->signature_count) { node_match_t* signer_nodes = NULL; in3_node_filter_t filter = NODE_FILTER_INIT; - filter.nodes = d_get(d_get(ctx->requests[0], K_IN3), key("signer_nodes")); + filter.nodes = d_get(d_get(ctx->requests[0], K_IN3), key("signerNodes")); filter.props = c->node_props | NODE_PROP_SIGNER; const in3_ret_t res = in3_node_list_pick_nodes(ctx, &signer_nodes, c->signature_count, filter); if (res < 0) @@ -703,7 +703,7 @@ in3_ret_t in3_ctx_execute(in3_ctx_t* ctx) { // if we don't have a nodelist, we try to get it. if (!ctx->raw_response && !ctx->nodes) { in3_node_filter_t filter = NODE_FILTER_INIT; - filter.nodes = d_get(d_get(ctx->requests[0], K_IN3), key("data_nodes")); + filter.nodes = d_get(d_get(ctx->requests[0], K_IN3), key("dataNodes")); filter.props = (ctx->client->node_props & 0xFFFFFFFF) | NODE_PROP_DATA | ((ctx->client->flags & FLAGS_HTTP) ? NODE_PROP_HTTP : 0) | (ctx->client->proof != PROOF_NONE ? NODE_PROP_PROOF : 0); if ((ret = in3_node_list_pick_nodes(ctx, &ctx->nodes, ctx->client->request_count, filter)) == IN3_OK) { for (int i = 0; i < ctx->len; i++) { diff --git a/c/src/core/client/nodelist.c b/c/src/core/client/nodelist.c index 11ddb7b35..e824abd94 100644 --- a/c/src/core/client/nodelist.c +++ b/c/src/core/client/nodelist.c @@ -263,7 +263,7 @@ static in3_ret_t update_nodelist(in3_t* c, in3_chain_t* chain, in3_ctx_t* parent sb_t* in3_sec = sb_new("{"); if (nodelist_not_first_upd8(chain)) { bytes_t addr_ = (bytes_t){.data = chain->nodelist_upd8_params->node, .len = 20}; - sb_add_bytes(in3_sec, "\"data_nodes\":", &addr_, 1, true); + sb_add_bytes(in3_sec, "\"dataNodes\":", &addr_, 1, true); } // create request From 5d18c4bcf8c42d800b365d86ffb1795b649807bb Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 3 Mar 2020 21:54:31 +0100 Subject: [PATCH 07/97] Always ask for proof & atleast one signature for nodeList req --- c/src/cmd/in3/main.c | 2 +- c/src/core/client/execute.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/c/src/cmd/in3/main.c b/c/src/cmd/in3/main.c index 76e644442..9bd5e4fbb 100644 --- a/c/src/cmd/in3/main.c +++ b/c/src/cmd/in3/main.c @@ -856,7 +856,7 @@ int main(int argc, char* argv[]) { char req[300]; char adr[41]; bytes_to_hex((chain->nodelist + i)->address->data, 20, adr); - sprintf(req, "{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"in3\":{\"data_nodes\":[\"0x%s\"]}}", adr); + sprintf(req, "{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"in3\":{\"dataNodes\":[\"0x%s\"]}}", adr); ctx = ctx_new(c, req); if (ctx) in3_send_ctx(ctx); } diff --git a/c/src/core/client/execute.c b/c/src/core/client/execute.c index 281a694bf..fe68f55ee 100644 --- a/c/src/core/client/execute.c +++ b/c/src/core/client/execute.c @@ -115,16 +115,20 @@ static in3_ret_t configure_request(in3_ctx_t* ctx, in3_request_config_t* conf, d conf->latest_block = c->replace_latest_block; conf->flags = c->flags; - if ((c->proof == PROOF_STANDARD || c->proof == PROOF_FULL)) { + if (c->proof == PROOF_STANDARD || c->proof == PROOF_FULL || ctx_is_method(ctx, "in3_nodeList")) { + // For nodeList request, we always ask for proof & atleast one signature + uint8_t total_sig_cnt = c->signature_count ? c->signature_count + : ctx_is_method(ctx, "in3_nodeList") ? 1 : 0; + conf->use_full_proof = c->proof == PROOF_FULL; conf->verification = VERIFICATION_PROOF; - if (c->signature_count) { + if (total_sig_cnt) { node_match_t* signer_nodes = NULL; in3_node_filter_t filter = NODE_FILTER_INIT; filter.nodes = d_get(d_get(ctx->requests[0], K_IN3), key("signerNodes")); filter.props = c->node_props | NODE_PROP_SIGNER; - const in3_ret_t res = in3_node_list_pick_nodes(ctx, &signer_nodes, c->signature_count, filter); + const in3_ret_t res = in3_node_list_pick_nodes(ctx, &signer_nodes, total_sig_cnt, filter); if (res < 0) return ctx_set_error(ctx, "Could not find any nodes for requesting signatures", res); const int node_count = ctx_nodes_len(signer_nodes); From 04fc5964ce92712eaa2afe97478cb0378be0118a Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 3 Mar 2020 21:54:47 +0100 Subject: [PATCH 08/97] Fix nodeList JSON test --- c/test/testdata/requests/in3_nodeList.json | 380 ++++++++++++--------- 1 file changed, 216 insertions(+), 164 deletions(-) diff --git a/c/test/testdata/requests/in3_nodeList.json b/c/test/testdata/requests/in3_nodeList.json index 9e541862f..7226136d6 100644 --- a/c/test/testdata/requests/in3_nodeList.json +++ b/c/test/testdata/requests/in3_nodeList.json @@ -1,168 +1,220 @@ [ - { - "descr": "in3_nodeList", - "chainId": "0x1", - "fuzzer": true, - "verification": "proof", - "request": { - "method": "in3_nodeList", - "params": [] - }, - "response": [ + { + "descr": "in3_nodeList", + "chainId": "0x5", + "fuzzer": true, + "verification": "proof", + "request": { + "method": "in3_nodeList", + "params": [ ], + "in3": { + "signer_nodes": [ + "0x1fe2e9bf29aa1938859af64c413361227d04059a" + ] + } + }, + "response": [ + { + "id": 1, + "result": { + "nodes": [ { - "id": 1, - "result": { - "nodes": [ - { - "url": "https://in3-v2.slock.it/mainnet/nd-1", - "address": "0x45d45e6ff99e6c34a235d263965910298985fcfe", - "index": 0, - "deposit": "0x2386f26fc10000", - "props": "0x6000001dd", - "timeout": 3456000, - "registerTime": 1576224418, - "weight": 2000 - }, - { - "url": "https://in3-v2.slock.it/mainnet/nd-2", - "address": "0x1fe2e9bf29aa1938859af64c413361227d04059a", - "index": 1, - "deposit": "0x2386f26fc10000", - "props": "0x6000001dd", - "timeout": 3456000, - "registerTime": 1576224531, - "weight": 2000 - }, - { - "url": "https://in3-v2.slock.it/mainnet/nd-3", - "address": "0x945f75c0408c0026a3cd204d36f5e47745182fd4", - "index": 2, - "deposit": "0x2386f26fc10000", - "props": "0x6000001dd", - "timeout": 3456000, - "registerTime": 1576224604, - "weight": 2000 - }, - { - "url": "https://in3-v2.slock.it/mainnet/nd-4", - "address": "0xc513a534de5a9d3f413152c41b09bd8116237fc8", - "index": 3, - "deposit": "0x2386f26fc10000", - "props": "0x6000001dd", - "timeout": 3456000, - "registerTime": 1576224650, - "weight": 2000 - }, - { - "url": "https://in3-v2.slock.it/mainnet/nd-5", - "address": "0xbcdf4e3e90cc7288b578329efd7bcc90655148d2", - "index": 4, - "deposit": "0x2386f26fc10000", - "props": "0x6000001dd", - "timeout": 3456000, - "registerTime": 1576224948, - "weight": 2000 - } - ], - "contract": "0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f", - "registryId": "0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb", - "lastBlockNumber": 9099052, - "totalServers": 5 - }, - "in3": { - "execTime": 0, - "lastValidatorChange": 0, - "proof": { - "type": "accountProof", - "block": "0xf90212a039a457a5a746711c0f6e64f57aabbdf42924a57605ff8ea1b78b2651b09cb905a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794005e288d713a5fb3d7c9cf1b43810a98688c7223a0f8453407021325a6933d1f9da83bc6ef20085de40408de2a32309db225a54652a03222553ef30c4753cc8f13bf757ab3977cba9c654a3cc09132d0aed791367357a0b97057261e99e23d1b544b1d82322da2ec36c4c8bfff7fc1b6bd13e323011387b90100804513a00c0b268f28a8264044160b1eea84c38051071724200418e04a02211c0ad88f208a144a0288e6c51f99e1017032b947f60f288a4f4336b3009ea19d00400a88a150a984a00b24918d448ee24042462a1f410818048e02f1650ac8c892195a9d120a27e4b49524400c90ca8ad284099005b8090d64124d8330581e50336400015f524c3248140403a04500009228c009480e43164b49c2b0c422798250439d200218cc503a748c228a389008654885000802001808ae3b2ba0bf09121805181062875040688c00146086a004640c120202830a2b9d08bd85e8486aa8102130b40e10a801aac080411084192083d9d2f8028163ed0d0e839e2d388050588708e71a1c2e4097838ad72c83979f9283976c61845df3491d91707079652d786e706f6f6c2e636e2f5834a0c2d3ec76c28b5e7801f9290a766816a5efcb6096fb12acfe1b6aee2193ca3f85887eddf3cc10123e2a", - "accounts": { - "0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f": { - "accountProof": [ - "0xf90211a0d614258daf776b50f82f5365476e959edede03f9683744a63db56f0b1a03954aa09cd8a52faabd6147633a2431fbe2c4a9e574e4aa8a075da40f03c9f7ab994c11a07460c2cc0f3d31773017d17824895b549b1a20ff54ecd79e5b6b648f1ea303eda0a8dbcb2fde20f7d26b25be821bafd7f9c730a8d70f46f6a3831b20cab2fcc6f0a0484b5f4c9fa13e23446558b3aeb2e601359ea2c02297009447759202d462444ea079437871c64f6aec4ad60bd16d51d450dee4e375ec18f86bb53938e1ca762c25a05f850d524c515ce47f03038c27cdd43ecc97ad514b18143e1a728ac2bcc039b3a0bd74a7cded05b74aef06d9353b0b6595e49bf02ef8e5a6fa367bee4d49663184a0aabfaa2bc3584f533e70114bf95afc6dfe997a096e6538adc206d2cd205adbeaa0ae575cc98a0e21d972bac6e2b23dc9aa5100bc22e23525262412083be93531fda0f1af2d52b3c3153c8b71b599b0ce258ab0011ad343d8e5c1ad634afa2e15b74aa026ec15ebeadfce95fd35c0d79f4411fa7ebae0e4560b95807407d4dee0a91550a054cc0f0aae8e2ef795c87163c43beab3ad6c13d222d6a6c329d5a8ae30569f3ea0c2096603ea2080f3d263b2d1d3d51bce6cad0d38572c2dbde72548f1f86229d4a03bd299e7dc8a41ff279e760691d469163a58e12a766458e9bac035292826dd33a0e780951f646d7940f17114b9e641ec4eabbf084aa189c7b1eaef6c7aa97d3d2480", - "0xf90211a0288269dc8912f4e9cdd431947f6bdfdccab55e244194a19ca283dd556dbd9202a0ddb9aa14f1d680360c46b8a0fc8ed6ce49c2ed3b7861ddd5235a0e6c6d10967ba098653093bb47afc04a5ab8d853ff1a2999bec7b2ccf8227fe1178103ff6ca7bba09c6fcacf3cd7497e72a676d744c578619600dff0d0864efcee28ae9209ee3fe1a07f5049f949b248a3a9c634c8acc62fcbe20d60fd45745cc8e80d3f15e4ad564da02fb2d3144b366a325f527182153b1c818450f27cf6b1d39a5eb45ad436976ca2a0b99cd820d09ad078ebe7e9b233fbda4b9b68700a02b30cd38b68c6dfbf8c19aaa0de46ea565b604d71ade490c02d190a9c1d5f48be7892b33132036882b0958ed9a067744df9e90191d628d79a5290b38fda3c8d892f8f9a52b54727737d85460e00a0203d42ee039f70942c0326dc36e223b293f706127842db42297cc6161d0010a9a06a2862929b3b228ed1b1ca64c4feda1566faf00861639e8264de387e00fdc880a02c4cb3f211881b861fccb4f9babe6cee688c6028c9b4c4cb05769097e875ed5ea0acee33bcd4e9a6fd8288f9f65090f07622c18e94beafe6e05eead1ff6ee64bd9a017a377e4689caa9735e9b609886ffcf40dae2b8a4c4c77cef5319b5df6ebb715a023fb8febb0dea4d15ab2c0c87713726abd19932ac6898a664f8585047d48e49ba0c0abc4409914489a3ff8da46335a482a23e96e5299a426d97deed16b71f8e63a80", - "0xf90211a063002da07e53539166363b7e6d0c149b30ac0779ffe1396d0e9bc1168882bde3a0796d44c28a0939aa88829e6b0b7c9bf5d5db53aa0879b14f6ef9feb95d764a7da0e7c2dd769ad3bbe96a5951cd79549808e71e426c5206063ee8388221bfe733cea0900456d32f1d2edb2ff3206d581f1dfb7c20526eb8f7e124b63dd0da3c925a7da006bf96ad11f6c93472935d60d7901029435634a2f8af39ababd8d52bfc5d0877a0bbdca1ab2ca28bbe0868e3c9cc911bf5acf8f3010c7363d672c30ecdc190998fa061fa7c165df38b3d5ae783147ebf2ca2558c3838fc042bb252cee7c73fad806aa088c072acf36eee6fb4f57f612c07e0450f4beabd6b86df76f75254beccc89c9fa04b292373878635b974ebec86b516f243dcd32dc13f3d0a3a6082ebabd79c2397a0354923afe7f8f50cc94ede59ad1a632d2139ee9fd7a8f8d408380dbd898adcb8a0ffb1d6382422a8b2dd21b0693c2ca9183b66ffc16df32e3059acb3e8b51d4323a064e1b306be55368e501624fdcae33ac0107639a22ed2c605a3bbe0a8d80d6d4ea019f3f91a1bd375c6f6fab445dc12533a30f9a74dcff7c01ee261049568e053a2a003e6120f9032134d6e5351e9afde9efc105f27d30616b7dc1a74a5f2387f1ba6a0b7ec72dab90143be294bbf08fbf133ef24221e0841f6b8033f6dfa0f46f3fa64a0bc0cf04257e9d9f5bbf4d73220a9f475be60c875c10d92f327c1c400e55e175d80", - "0xf90211a0f1590b1f733c761b3ba79005b264b399a2071d360a4f6153e93b1de6499e4271a0942916a74dd0ddd13782fe2547ee93ca379c9cb4260948802d6344b3f8116eb2a0b1ee70da81c6b7ae4ac94da374298f9efc2232753ea569271e939a654a921a8ca0d706d461b4b691af91af03d58b7b13710d1fb52accdfed52972f0b8fc4950256a0eca4f2a866a5d851d66f1d94a727f483a45145a338f7c0815d6cf6bf055465fda0540640c27876c8079c55ea20a8976d53e7cf6d6cf3bb2c0a8168650398f5cc0ea0ae8795e6635e89f63d862436189b4f89265fbd8957132c428fe9f7109f2a5594a0fb570faac69a569c9fab2d6bdd19cec4281564d1dc22e680a8fe42b1f2e5514ba03ab8a0826e7e6a27dca2dde62e765c66fddfd06481f31e65178de390b092e48ca0c03252bdfb5973fff085f8f6e6aa310faf56a303f7643e4f3cac6243cc7e50d8a0ca52077298db00310e4a7687437a96c70f28e42991a41a0b8d4cb24f33f1e751a0e364495efb11dd043ef2920cf49569b0405707fc11609835f28f363a7533025ca0a28efef3cbe05d3f83eac6355e31e79190c76509f18c24d46bcc85077df9a692a085d5e43de86e35c3b55d2f4f5498100a062b1a40f352506ba82ffd28473b96c0a056ebd7a1fd59e7bd7575521cd2fcfa2324ead65dbda5217f38ae9b7fc6964b37a09dd644e927bd6d0e787b7c4e0037223b02b455efe606df72af51b9d70254300c80", - "0xf90211a0616fd22d9da5cffb124b1f3d8b2869887dbfb5c75197b102490e085ef84aa260a08ea24e98550b823e7358873a1a1a5d8ec5fa1748ad8812aec06f82a7a104779ca0ca9ca551dd0fc2aaf7b3dd195e467e63675020ef9469e48f8fed349555a8fc94a0738ba8e0ae9ca1d5f04f95f9a932be5c088b4790df9465e230b3baaf90ecb421a079bdf4d535f78d13fe8a9464bfd874cc8215b34dbdd68c65779b3b4b7d3723a3a0cfb37efe579fbaaeee0c1583480bf944d1153ff4c0912f4a1816d26592317c6aa0c8631582a034bf4df34c1e08876186eb029ffb25b426301e658b10de246807d3a0c8a548bdd910784e73225619d14a95a5b3cbe476baeb28d21dbbcbb0fc8c3232a01ce9b201d9f6e1a0661fa09dbb439a08a8d66e2e390f007c6cb11473e75b8956a041de1fa2c05897b170c735d127fe3abfc9118acea86304817f9283f9dfaaad7fa0c26a601f76d7ab76f74c11254edc4735d15099ff718725d695cfe00ab9437192a02e4cf3074eda770d18104671715c5be10e0a2bb6173dd0bf0909cfe7357b7e37a0726f49394640f4c5da699c83189a09822cc22c06a3002df73955aee1146a9d20a0ee6b6998bd6d37d245753bb4bfdbfadb5e9af4a0416b643de590d218a6dd1a4da01b959aaa6d2d252cb9c1d3c39c07f19a0af927a4f87ee084d1c22d31ff630460a0ded4a3c16c0471af314daeacda2f79b0f430888f42cf9f73b82ddfcafd3ac84b80", - "0xf90211a0372a955b15f6a5614f772d142b7d0679a49d9e859d772f8287b30eb6ffca1924a0f1a510919c07d8539a9e7611453ac3f4b64e575355b8f0a1c58f3c54dc1531a8a05058a380b065612ea7cb9a7b45174068b6f71665fc21ebb73dafbd4570b6fa14a074aaf1d956b257164275fd8ddc3aa656c737d79dfc780dee474e8b39ee391d1fa0dccf7318665d89412fdffaa5a6741d11b9cb529afe504f770eb6c0c748a608d3a08b71dd67c9ff6ea323b5ec1302bd2d6437816d0a68bf4b29a48e162c8c61f7efa056faccf236db50c02c95f12542447fdf74e2aa5708b18533285951cf43d76b28a03c139dbd4ecbdca97e442ae535d642d7dd3f6d12ff1878d84f5d8375d3a8e517a03412ecb9bc8acdb503195da735e1ab9918d67638ce321eed7568a33f934d3677a0fd8cb9befe5c61a00a233231b498e4665720bdd4b5003b128a9b984aae4ef403a0ecd693ce49111897f432c05fb93299ca9d4d74a9b395ad022c4bb73213d17520a0f2cabb17d69bfb117c719ac9c0d0d83015bb8e7ae30a468097ebf31cd09b6b43a0e491286f657aa5ec57385603d1ffe3e9950b9aea68cdf78f1e1be2eda6e3cc9aa08117ba461f2f84429e9da4d3ee738ac42fa1ed8c5479f85b859b4528b4e8ff63a076fb23883502dc6328a20a5343f8f3c1595e702e176988d99fbe7d820d198090a08facbf8e7a4bc022e4f51b677be032d319146bbe87be591be92224501662079980", - "0xf8b18080a01a27c49a5a77e292b591767f76ddf2bfbdf1752a5b53c7f07c519d0868760d2ea0ad6cb523f73649d74c1213abb948c10037a7a342ede5cd373b6060061d79faf780808080808080a02dca1cd7f04d0fd9625b649903883a2faa52ea6cfcbda738e61f6ea6322328cd80a0a100cd6e729dee956ee0b30eacec39fd47e2f16f97708a2f09d99e4bcaaaf96aa0d327ffd4270f97c978c638645dc59c0a8ed42fc09bc538c9ad91eea990f543fd8080", - "0xf8669d3ad8a871b31cb3552080711d61fda45242133e0695c60218a95533aa2cb846f8440180a0fc228720956b856cf25332b9e78303cf625d32d2315575c74d47c7d3ee48ba6fa029140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1" - ], - "address": "0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f", - "balance": "0x0", - "codeHash": "0x29140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1", - "nonce": "0x1", - "storageHash": "0xfc228720956b856cf25332b9e78303cf625d32d2315575c74d47c7d3ee48ba6f", - "storageProof": [ - { - "key": "0x0", - "proof": [ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf891a0f881becd1a54ec2ac129979fbb7cc851f4245d372d588056b040ccae152793e8808080808080a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a081b7693d9ef9dea4b83b27e12fd4a86cfd861c266865545c3602ec6a1e43039da026056fdebd58e774617d2b76dfb0bd14f7863bf6abcf25ba1c76e8527d4d79c3808080808080", - "0xe2a0200decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56305" - ], - "value": "0x5" - }, - { - "key": "0x1", - "proof": [ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf85180a0cf1bb0975c1421732acd6e4355d4be5a5cabef4b1abd7ad1567c30acd41ab25b808080808080808080808080a0e204403832678df9883635c3a4eef3fff75806929e3a828e1c540376fac686048080", - "0xf843a0200e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6a1a023d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb" - ], - "value": "0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e567", - "proof": [ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf871a042d46bd6345c4aa97249751c507918f4c57bceddb0fe070587a414720d29fab38080808080808080808080a0a77fe674993bb40786c6b15a7a82652bd9ba134b70533bb5cc0834388eeccb6680a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", - "0xf843a020418048a637d1641c6d732dd38174732bbf7b47a1cf6d5f65895384518b07d9a1a00253294570fb0c7f0da5fa9b928ab8b13b9b3756b7f35a1a9679aeb65fc80200" - ], - "value": "0x253294570fb0c7f0da5fa9b928ab8b13b9b3756b7f35a1a9679aeb65fc80200" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56c", - "proof": [ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf8d18080a004086d122b3bd8d29156e97aacb81408ae87858145b9749f8f6c7bbf653d6ce38080a0f9c0b2156072e728e82a583460ac26e9b75f687388d79049d13a7ab29327771d8080a0998b4c87a8ca402a07093242127bd314af3bcf0fc00af2b1921d3e5b4e5b01a7a06633cf42917c5b16425df44ba19ca9ae58c1df7cd3038246724a4852e2b6599680a0a992e6dd730354f88103f2a04be2f93f7df0ee30d42b7c22b63890778050f37d80a08c1679d8cdc9ce14b68eeecf0172bed65e59f98f8bcf93021b0977f2cbb68941808080", - "0xf843a0205fcc8f73196524ea5f04c38888c2f09c6cbef411cb31e259d35b56e3d0047ba1a0562e5e2450e07504f981d9afff7cd7bdff456df99feeebed134055396100f554" - ], - "value": "0x562e5e2450e07504f981d9afff7cd7bdff456df99feeebed134055396100f554" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e571", - "proof": [ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf871a092d2467f9ba1680676edd8692a803254a61cdcf90c43d6b7548c981c1e65e5c38080a08fc2be5da195cb1833f87d242270084c2db8504a66ee7ecad3e0d81f0c5311ee808080808080a04a5be21f4f0c0f5e1fcccb140e7cb5b1ff2ce45bce977d8e23cc7320e8c7bdd0808080808080", - "0xf843a0206695c256a4a4a1b8ed004dc824e330f1747032632c0e6d88c1d84c330c1c5ca1a0aad4bd309785201be407f829fb4caf4d2755129801d7eddde9fb6185be37a614" - ], - "value": "0xaad4bd309785201be407f829fb4caf4d2755129801d7eddde9fb6185be37a614" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e576", - "proof": [ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf85180a0cf1bb0975c1421732acd6e4355d4be5a5cabef4b1abd7ad1567c30acd41ab25b808080808080808080808080a0e204403832678df9883635c3a4eef3fff75806929e3a828e1c540376fac686048080", - "0xf843a020257165ee8c7eae64faf81e97823d50dba1b6a2be88bccea1ac5d01256f0590a1a0bac5ca48e4744475a2d948a7971e73cafffe604f3a71ec98eda3260dafc8e7c9" - ], - "value": "0xbac5ca48e4744475a2d948a7971e73cafffe604f3a71ec98eda3260dafc8e7c9" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e57b", - "proof": [ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf871a042d46bd6345c4aa97249751c507918f4c57bceddb0fe070587a414720d29fab38080808080808080808080a0a77fe674993bb40786c6b15a7a82652bd9ba134b70533bb5cc0834388eeccb6680a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", - "0xf85180808080a0fae6b8484dccdec6b4ae5da10ddba033cc98da72665e01dcf1a2699204b48ad8808080808080808080a04083c8127572e64ae53476470e7a632258565a37b7f2066cb22ef228e679c24e8080", - "0xf8429f3d807394a26a5623e844d859daa1940d13cb7bda091582294562d688f4de00a1a0634a521ea3bb6908c905438f63e03c0d531792596113bcc9f858c8cc3a8eff18" - ], - "value": "0x634a521ea3bb6908c905438f63e03c0d531792596113bcc9f858c8cc3a8eff18" - } - ] - } - } - } - } + "url": "https://in3-v2.slock.it/goerli/nd-1", + "address": "0x45d45e6ff99e6c34a235d263965910298985fcfe", + "index": 0, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227711, + "weight": 2000 + }, + { + "url": "https://in3-v2.slock.it/goerli/nd-2", + "address": "0x1fe2e9bf29aa1938859af64c413361227d04059a", + "index": 1, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227741, + "weight": 2000 + }, + { + "url": "https://in3-v2.slock.it/goerli/nd-3", + "address": "0x945f75c0408c0026a3cd204d36f5e47745182fd4", + "index": 2, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227801, + "weight": 2000 + }, + { + "url": "https://in3-v2.slock.it/goerli/nd-4", + "address": "0xc513a534de5a9d3f413152c41b09bd8116237fc8", + "index": 3, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227831, + "weight": 2000 + }, + { + "url": "https://in3-v2.slock.it/goerli/nd-5", + "address": "0xbcdf4e3e90cc7288b578329efd7bcc90655148d2", + "index": 4, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227876, + "weight": 2000 + }, + { + "url": "https://tincubeth.komputing.org/", + "address": "0xf944d416ebdf7f6e22eaf79a5a53ad1a487ddd9a", + "index": 5, + "deposit": "0x2386f26fc10000", + "props": "0x1d7e0000000a", + "timeout": 3456000, + "registerTime": 1578947320, + "weight": 1 + }, + { + "url": "https://h5l45fkzz7oc3gmb.onion/", + "address": "0x56d986deb3b5d14cb230d0f39247cc32416020b6", + "index": 6, + "deposit": "0x2386f26fc10000", + "props": "0x21660000000a", + "timeout": 3456000, + "registerTime": 1578954071, + "weight": 1 } - ] - } + ], + "contract": "0x5f51e413581dd76759e9eed51e63d14c8d1379c8", + "registryId": "0x67c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea", + "lastBlockNumber": 2276348, + "totalServers": 7 + }, + "jsonrpc": "2.0", + "in3": { + "execTime": 126, + "lastValidatorChange": 0, + "proof": { + "type": "accountProof", + "block": "0xf9025ca05b15c4d9014a57f19c037563bba8f3e39733b6bbeb730be5a6bd9a8677011d1da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0b3edf0f8f66f2b10ea77fb77d6dc43e6bc99eddf51910dc8c79e135f0ba062f9a0697d4da49cf730d9502a6e9d418f0cd3842c86be0085de59d51c2237972aa16ea04dc4fe69fff1798d2a06d4ddd7087d69e850b6b0c2d7553f0f02991fcb862576b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010028322bbfc837a1200830111f4845e5d5b4db861f09f928e20407072796c616273206e6f64652d3020f09f928e00000000000000a7e5fe715a2bddc9892d1070f70de87e11b89bc3509c2614129110bb4d4f350a3d6a3e13948a53841251ff04c9ead54d2473cb1e42130bad8938e5913297c8c900a00000000000000000000000000000000000000000000000000000000000000000880000000000000000", + "accounts": { + "0x5f51e413581dd76759e9eed51e63d14c8d1379c8": { + "accountProof": [ + "0xf90211a0d0041802b39b0d8bd4378870fa197e5003b421ac2bc80584948b3b60b5494fcba06322ab1446b2e05a586551002aca2a54e69e2e43d39f5b7b6f70afb480a64b4ca0b4882ba72df3c3d1b7ca77b564ec48dbf4ab5a92a50d68defd661be4d7878a33a00bb6eac3bdca095e582ba5da8b2be578f80342f2c6a01f2042b1ccc60b85abbea09109537ad73d5b8f008b732bc534b15cd2236e6b766a50d8c618e66270fde61fa02e77b7a5fd2d67c43aa3ab8ff34210223a33a09b8a7edbded1c3c631092e66aba051581e21dcea914f421eeed20d2077a64378c49afac44d7e68cadc37e381ea25a0da5a4c2ac0ab47dfbe886e015a72f374f31d1e7eae477a7a9d6165b29cf8c96ca0126132bfe5dd60bd3bca3d38cb58f1c873f4e10b18ecb3edbeadb6a9e3c649e1a0625f574e3a0e5c5ef39d154b41d51a655501f6cb6b75478e75548ed80fc77cd6a06cc1bf23c495e44a53028fa80a3ff456dee8ac834d7e206402e1b4b10fca523da0a5193530b3367a31bdaef12b0d5c335de05b875ae8115789f02e1f3a9f4f8b29a0a0036923d8d622eb6d7d7074b06fb8560d65ee988bc9d3dfddd6e20108bc01bca0ecbc61e03b4a37cc986d554ff6e2bf3cb900d928172f16a0baeb3ca3b15567c7a01d8386e911112eced18f14c29a46e4ee7615310edecfc571189c2d1e69db9907a0faa4de346fd2ac4ec484486721bf616790ff4e78f8c7d278a82ce926c2004ca280", + "0xf90211a08d0d30992008df5380950d4a30bcb85fe4b5eeb5e9d47555c90ca2234c8fae28a09a302760d70f3f2fa0c734f158d450f923c60578c0d529f0d549d706c477bc11a0762865973e46fe93a0a685d314e44f2ab84cc59b492842450c36fa397fd62469a0de35caac9820b0794cf37106feb3bdb0ad7f5e2215827d37a41acea831d04a16a09f98e10d34e06fb1781b872e39c31340d4ffcb3d910008e8b51354eb6601fa11a0a2febd9de2b468d25b1ec2637ea3d39e91cd29bc3601bbb6fa34b0b9cb63e415a0f380f3c2b51b87f2b5e4286b3fcb16ff74e351518eb92a576948cb063821ba59a0a44e858b9a24c4f135a0f6a3abadcb22db4bd7a1078b0517ecb265a2851a6aeba0ae5e6314da5f1606c9645357f1386f0c9ce7c48d2eeb98ec13cda7221575158ea05727b21aa0b265667cbbdeb748a7cbd97f314b77264f10a9e69b371c48e65122a0141f1557dd2463e0c9543b33a232e48fd38480f71103c181f89c489cd1a8f8bfa0543d1abb6740c1b8a32d673dd3eb8f820acf19d474a90d6ed4882466388ce4f7a0e2414ea84085dd02f8ef08affca0176efe7441c7a2a621d764500fb2384f9780a08e6d9f028885ab7b4b89bcb301c9b063d7090428187b8b7f4863b0b700ba549ca097d06d96cda5e4c4b5751f84265e7dd2658877e617b83aaf5d03f19c6ad221b4a0e59cfab2feab060e26dc24f1028b391ddbd29ba95839f6b4daf15fe95c30b00b80", + "0xf90211a07141c17f9fa7951761d2bb4fd14657ee63c26fcac0f453edcc40b53077b8cb49a02b1ca5efd39e8a92c786d47afb8cfd3779be68c944e9801bc7ba4c929d85344da01d1283ee9b93563a4c902fcaa91b650f7e4f03b8a4ed17573f1579787ff61b80a0ae1a099c4db1b5200630a8c28e8f45e6c4f4225621d58731f741d33be08f66d2a017d364fed382f188095309fdc368673de02d2da42bc5a2359d6511165011ba43a0730866177275ebb899cb4ab75b14a88aadf750449dd31a2c08ad7e13b783be8aa093ef04e32e63ac2a0cde09ad847e6173b85237978859b2128efd43c5812540c7a0c84f94a4c4e3ea68de7100e4b28fe4dfb2e54047adb6a49badd774a10f24543aa0a0e318859f0a2607fc274087ac0429602dc4bceca9a607ba37ee49e3a231dda2a0a411c30ed2e578256d2e446418216b8f590ab5e5e55e220c0d468dce23e1f761a05b780600a7bd74ea0327bcabcd6c43e2f2d025451850dbf362ddbd3f22729ae4a09e95eb773b6f31faad66dc56e3bfe287e4ee69ece42a3b7f30fde8b036e3bbaca0c84c78fd76cb13e9c5a087f1f1044ceb746831831d7476b17194f7f57c239b5fa0b4a5b67caf37da52aaf4ef490874f790e37f9a6e9aea1fa473ace0c91c8ec325a09e6487086f9452e35b966b84ea5434580580004d54914716b9194263d3ec0802a0d65313ba3300ad622207f36a1241ac74e7b18d30b814c7074cd1c932caaeacfa80", + "0xf901b1a02691bcd5e32c39f4f36d5b6b03f091948eb9ca3df225ddad93eb31b8497e4c1aa08e5e2cd65a2ec84ffbc2ae1c2066139423cfe71c351a8dd42b471faeb4c05dd6a0bc2809c3a3720f2b0fae7dea4f7efedb4327a48c151b89b090ab99dee7bdcf4aa01f28521aec2d7a50a466f88281e6e827d5509bc5a77be74f3f704fd91079442da05ed7f0cf73f299255bfc2bdf20b31a709518fb71bdcaa9fb8fd488ad07af28ae80a03ecd2de48b44e54b5b892520291fd2601ddff191ba446997f3587d51e8f68ddfa097a4d6d7f15b05d96ed7511e39aae51032fc3648c15eb4d789ce8916f79a78a180a0bb081130c535bc8a46528bae3596200eb99d0b99bde40ad12b624e2466c7757ba0296c2142079e1c5b73bd703978eaa04e3b9123a240f7bc046a9cb701fd064435a04c35b4967661e70f5068aa326f3599c7393498e1b082b8b26062f98ffbb2e8f4a023d8b0cdfc5807cf338a56b1260118129ce2d1080dca624d02c1e7a44ef7255fa068665baa882f2e62da7897273881f510f3768c3d9878efdf097085ef3f0b5ac480a0d4524fcdca73a594f45be8e41613995cdd8bd38512c6932f04f6d6787ca4856380", + "0xf87180a05da0431ddcf9c0df5220e90991d6fafadcbb70ec9e51c042a743f4d1980df7c4a05e856a872504286cb6dbb11c85fab4ca263a72cbee0a785053fbbb4f2d6078738080808080a09922b3a2aac38c7bd2332ec05abd047f2fb7858f2d2ae4f6c49bce18b73eae948080808080808080", + "0xf8679e3860ace08b3156e1e8b3657a41748919bc942fd9e0f3de90d72f6e5bdfc3b846f8440180a0ee67942d4ba6f187e143ee4568896cf8db17df6298d91961b468176ef9e6ba0ba029140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1" + ], + "address": "0x5f51e413581dd76759e9eed51e63d14c8d1379c8", + "balance": "0x0", + "codeHash": "0x29140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1", + "nonce": "0x1", + "storageHash": "0xee67942d4ba6f187e143ee4568896cf8db17df6298d91961b468176ef9e6ba0b", + "storageProof": [ + { + "key": "0x0", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8d1a0f881becd1a54ec2ac129979fbb7cc851f4245d372d588056b040ccae152793e88080a028b34037d7d67765fa1cd15091337086eacdd8770b711a026d4ee0a839f8b3f2808080a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a0c9c743682962d9d06dd0f9ed6cb2620cce02f34a0a4f5d60a4e5d1e081a5b5fba0bf73b8437dc32850158814b8c0c28c9c76a22c373fa84a77c3fc2175317a6aa18080a0bd01265657739e1793ae1ad68a77f330e98f0d5d5a53235211faa848c3eea787808080", + "0xe2a0200decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56307" + ], + "value": "0x7" + }, + { + "key": "0x1", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf85180a0fb829ab79f00d7bab5aa54e5cfd67ae721eaf17d076bca3984477a72b5391c92808080808080808080808080a0f7fc12e7aa12b24609029780c05d852e0ddb7e1eceaf8671a2e2d3c1aa7bd8068080", + "0xf843a0200e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6a1a067c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea" + ], + "value": "0x67c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e567", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf891a031b20905ab02dba97c5a82079a50550a5a70d3f5e7f25cfe6c9e88b1c3768ae8808080808080a01b7ed3dd208fb30e8581d7e5278fb4581b99f960be8d08ff41759b10b537dfe080808080a03b77164a66693f214b5328da08b60566b0aeae3d719121004ed8c6d6e49ca5e580a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", + "0xf843a020418048a637d1641c6d732dd38174732bbf7b47a1cf6d5f65895384518b07d9a1a02b80cb1b568146d64e7a622d7b895925d06ef8582fa0166d8ec069f86070610a" + ], + "value": "0x2b80cb1b568146d64e7a622d7b895925d06ef8582fa0166d8ec069f86070610a" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56c", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8f18080a03c79db405090818f0b5b51e29d2ac7b67f6ff814b03e773af1975584a0dd1f908080a0a26c5f90f028898be4e12961969ae89f323a66586730f92b8fb2dd1ca0ba6f8a80a078c9aaa17553d7357d2014c0a75c9de51fdab46248846ddf03ea16d8cb790b0e80a04a0c4b948805886065449dad60fce7e1c7680a3bc4a235800fbd2edafac731e680a0c50523b8a14aff442da2ba7343c04f960e59083796de9ba7fcbbd592959515f180a0df910adad94453538847b694bdb134432b0a9e2cc829dce2346460720fd2ee5380a06e1a723ced013021ff250a9fdd129c3a7c1aa3970d955cd28688dbdff277174880", + "0xf843a0205fcc8f73196524ea5f04c38888c2f09c6cbef411cb31e259d35b56e3d0047ba1a00c2f5e53902cca915645c2f00ae6a6357ce4aafa18140db4be24d33f41709b6e" + ], + "value": "0xc2f5e53902cca915645c2f00ae6a6357ce4aafa18140db4be24d33f41709b6e" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e571", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8b1a0f3ab6aa3f0575916e985798d7ee01e8c75436765f043cdfba2ad10f36b47f6d48080a069a129011ab4666f131c1bdac7d923dcbb6f1047057a62d6ecede5d17057658280a064bde28657cfaa21b487ad660da11e94a06a1b7f46502263094cde0407dfd24380808080a04a5be21f4f0c0f5e1fcccb140e7cb5b1ff2ce45bce977d8e23cc7320e8c7bdd080a015cb29fd7064f1cbac8773177854799e563e10ba66e44c5adf25b31fa39a7d3980808080", + "0xf843a0206695c256a4a4a1b8ed004dc824e330f1747032632c0e6d88c1d84c330c1c5ca1a098d7a1f953e0805e2053a6ab062f8a16f1d35b9fc7bad41fd10eece87cc1b280" + ], + "value": "0x98d7a1f953e0805e2053a6ab062f8a16f1d35b9fc7bad41fd10eece87cc1b280" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e576", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf85180a0fb829ab79f00d7bab5aa54e5cfd67ae721eaf17d076bca3984477a72b5391c92808080808080808080808080a0f7fc12e7aa12b24609029780c05d852e0ddb7e1eceaf8671a2e2d3c1aa7bd8068080", + "0xf843a020257165ee8c7eae64faf81e97823d50dba1b6a2be88bccea1ac5d01256f0590a1a079c63d2302907690c944fa45f7405ac59b364089f366764025f13f2055511b43" + ], + "value": "0x79c63d2302907690c944fa45f7405ac59b364089f366764025f13f2055511b43" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e57b", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf891a031b20905ab02dba97c5a82079a50550a5a70d3f5e7f25cfe6c9e88b1c3768ae8808080808080a01b7ed3dd208fb30e8581d7e5278fb4581b99f960be8d08ff41759b10b537dfe080808080a03b77164a66693f214b5328da08b60566b0aeae3d719121004ed8c6d6e49ca5e580a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", + "0xf85180808080a0fe0a1c808c8e90225d5dcfad8bde23daee522b2905b605bc6eb5c39596018464808080808080808080a04083c8127572e64ae53476470e7a632258565a37b7f2066cb22ef228e679c24e8080", + "0xf8429f3d807394a26a5623e844d859daa1940d13cb7bda091582294562d688f4de00a1a0a7b2aa99ebb2a9e076a84dfd43cc1355ca060aea5b8bb1f1ee825e131125e462" + ], + "value": "0xa7b2aa99ebb2a9e076a84dfd43cc1355ca060aea5b8bb1f1ee825e131125e462" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e580", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8d1a0f881becd1a54ec2ac129979fbb7cc851f4245d372d588056b040ccae152793e88080a028b34037d7d67765fa1cd15091337086eacdd8770b711a026d4ee0a839f8b3f2808080a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a0c9c743682962d9d06dd0f9ed6cb2620cce02f34a0a4f5d60a4e5d1e081a5b5fba0bf73b8437dc32850158814b8c0c28c9c76a22c373fa84a77c3fc2175317a6aa18080a0bd01265657739e1793ae1ad68a77f330e98f0d5d5a53235211faa848c3eea787808080", + "0xf843a0202f0f7a7af9ed4f160d1c425f37d148d10bddb9c828e99d4145b150485711cea1a0ac8d18ba63b2e8486a3c5bd9915b9335d0df0862e5601476fadf568443a8cca0" + ], + "value": "0xac8d18ba63b2e8486a3c5bd9915b9335d0df0862e5601476fadf568443a8cca0" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e585", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8f18080a03c79db405090818f0b5b51e29d2ac7b67f6ff814b03e773af1975584a0dd1f908080a0a26c5f90f028898be4e12961969ae89f323a66586730f92b8fb2dd1ca0ba6f8a80a078c9aaa17553d7357d2014c0a75c9de51fdab46248846ddf03ea16d8cb790b0e80a04a0c4b948805886065449dad60fce7e1c7680a3bc4a235800fbd2edafac731e680a0c50523b8a14aff442da2ba7343c04f960e59083796de9ba7fcbbd592959515f180a0df910adad94453538847b694bdb134432b0a9e2cc829dce2346460720fd2ee5380a06e1a723ced013021ff250a9fdd129c3a7c1aa3970d955cd28688dbdff277174880", + "0xf843a0207c73e826b7dd131777470492494a9f14b451e947ae119760ac27c5aac4422ca1a01fae1104ad418c61c2e19407f6151fa634431da77d15469ffd1b993986fccc59" + ], + "value": "0x1fae1104ad418c61c2e19407f6151fa634431da77d15469ffd1b993986fccc59" + } + ] + } + }, + "signatures": [ + { + "blockHash": "0xb1ca57784055c67d58cf76924355e0ff2324237769efdcdb2cea6824896cb0a2", + "block": 2276348, + "r": "0x67ba22ce31bf6c6e06b55109e5cbe67633ba20c7275b89fa93819fde744e1c69", + "s": "0x46a77396374f817acac3ae0bfde5b3efbdfa33fd0e72516176e60dae8a1dc41b", + "v": 28, + "msgHash": "0x4e242053e85d8d3ef8bae15d6efdb24af2086f5047a371830083a9fce3ab01d1" + } + ] + } + } + } + ] + } ] \ No newline at end of file From 2561fea37c887248347b70eb023a8a193f91e2a2 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 3 Mar 2020 23:03:31 +0100 Subject: [PATCH 09/97] Expect in3 req section to be last param arg --- c/src/core/client/execute.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c/src/core/client/execute.c b/c/src/core/client/execute.c index fe68f55ee..b934c629d 100644 --- a/c/src/core/client/execute.c +++ b/c/src/core/client/execute.c @@ -126,7 +126,7 @@ static in3_ret_t configure_request(in3_ctx_t* ctx, in3_request_config_t* conf, d if (total_sig_cnt) { node_match_t* signer_nodes = NULL; in3_node_filter_t filter = NODE_FILTER_INIT; - filter.nodes = d_get(d_get(ctx->requests[0], K_IN3), key("signerNodes")); + filter.nodes = d_get(d_get(d_get_at(d_get(ctx->requests[0], K_PARAMS), d_len(d_get(ctx->requests[0], K_PARAMS)) - 1), K_IN3), key("signerNodes")); filter.props = c->node_props | NODE_PROP_SIGNER; const in3_ret_t res = in3_node_list_pick_nodes(ctx, &signer_nodes, total_sig_cnt, filter); if (res < 0) @@ -707,7 +707,7 @@ in3_ret_t in3_ctx_execute(in3_ctx_t* ctx) { // if we don't have a nodelist, we try to get it. if (!ctx->raw_response && !ctx->nodes) { in3_node_filter_t filter = NODE_FILTER_INIT; - filter.nodes = d_get(d_get(ctx->requests[0], K_IN3), key("dataNodes")); + filter.nodes = d_get(d_get(d_get_at(d_get(ctx->requests[0], K_PARAMS), d_len(d_get(ctx->requests[0], K_PARAMS)) - 1), K_IN3), key("dataNodes")); filter.props = (ctx->client->node_props & 0xFFFFFFFF) | NODE_PROP_DATA | ((ctx->client->flags & FLAGS_HTTP) ? NODE_PROP_HTTP : 0) | (ctx->client->proof != PROOF_NONE ? NODE_PROP_PROOF : 0); if ((ret = in3_node_list_pick_nodes(ctx, &ctx->nodes, ctx->client->request_count, filter)) == IN3_OK) { for (int i = 0; i < ctx->len; i++) { From ac93ff0a12f443b0d6c5522dc4e62115144411a6 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 3 Mar 2020 23:04:23 +0100 Subject: [PATCH 10/97] Filter nodes takes precedence over boot node exclusion in filtering --- c/src/core/client/nodelist.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/c/src/core/client/nodelist.c b/c/src/core/client/nodelist.c index e824abd94..56800b036 100644 --- a/c/src/core/client/nodelist.c +++ b/c/src/core/client/nodelist.c @@ -374,10 +374,7 @@ node_match_t* in3_node_list_fill_weight(in3_t* c, chain_id_t chain_id, in3_node_ for (int i = 0; i < len; i++) { nodeDef = all_nodes + i; weightDef = weights + i; - if (nodeDef->boot_node) goto SKIP_FILTERING; - if (chain->whitelist && !nodeDef->whitelisted) continue; - if (nodeDef->deposit < c->min_deposit) continue; - if (!in3_node_props_match(filter.props, nodeDef->props)) continue; + if (filter.nodes != NULL) { bool in_filter_nodes = false; for (d_iterator_t it = d_iter(filter.nodes); it.left; d_iter_next(&it)) { @@ -388,7 +385,11 @@ node_match_t* in3_node_list_fill_weight(in3_t* c, chain_id_t chain_id, in3_node_ } if (!in_filter_nodes) continue; - } + } else if (nodeDef->boot_node) + goto SKIP_FILTERING; + if (chain->whitelist && !nodeDef->whitelisted) continue; + if (nodeDef->deposit < c->min_deposit) continue; + if (!in3_node_props_match(filter.props, nodeDef->props)) continue; if (weightDef->blacklisted_until > (uint64_t) now) continue; SKIP_FILTERING: From 29c9a57fb2db93552a95f7bc96a9cbaadbd516f0 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 3 Mar 2020 23:04:52 +0100 Subject: [PATCH 11/97] Fix in3_nodeList.json test --- c/test/testdata/requests/in3_nodeList.json | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/c/test/testdata/requests/in3_nodeList.json b/c/test/testdata/requests/in3_nodeList.json index 7226136d6..fcb18057f 100644 --- a/c/test/testdata/requests/in3_nodeList.json +++ b/c/test/testdata/requests/in3_nodeList.json @@ -6,12 +6,15 @@ "verification": "proof", "request": { "method": "in3_nodeList", - "params": [ ], - "in3": { - "signer_nodes": [ - "0x1fe2e9bf29aa1938859af64c413361227d04059a" - ] - } + "params": [ + { + "in3": { + "signerNodes": [ + "0x1fe2e9bf29aa1938859af64c413361227d04059a" + ] + } + } + ] }, "response": [ { From 52e40578bbf596347f4b943e831658fa30a1fa83 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 3 Mar 2020 23:46:21 +0100 Subject: [PATCH 12/97] Implement d_get_in3_param() --- c/src/core/client/execute.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/c/src/core/client/execute.c b/c/src/core/client/execute.c index b934c629d..baf1e5b13 100644 --- a/c/src/core/client/execute.c +++ b/c/src/core/client/execute.c @@ -107,6 +107,13 @@ static void free_ctx_intern(in3_ctx_t* ctx, bool is_sub) { _free(ctx); } +static d_token_t* d_get_in3_param(d_token_t* params, const char* keystr) { + if (d_len(params) < 1) return NULL; + d_token_t* last_param = d_get_at(params, d_len(params) - 1); + if (d_type(last_param) != T_OBJECT) return NULL; + return d_get(d_get(last_param, K_IN3), key(keystr)); +} + static in3_ret_t configure_request(in3_ctx_t* ctx, in3_request_config_t* conf, d_token_t* request, in3_chain_t* chain) { const in3_t* c = ctx->client; @@ -126,7 +133,7 @@ static in3_ret_t configure_request(in3_ctx_t* ctx, in3_request_config_t* conf, d if (total_sig_cnt) { node_match_t* signer_nodes = NULL; in3_node_filter_t filter = NODE_FILTER_INIT; - filter.nodes = d_get(d_get(d_get_at(d_get(ctx->requests[0], K_PARAMS), d_len(d_get(ctx->requests[0], K_PARAMS)) - 1), K_IN3), key("signerNodes")); + filter.nodes = d_get_in3_param(d_get(ctx->requests[0], K_PARAMS), "signerNodes"); filter.props = c->node_props | NODE_PROP_SIGNER; const in3_ret_t res = in3_node_list_pick_nodes(ctx, &signer_nodes, total_sig_cnt, filter); if (res < 0) @@ -673,6 +680,7 @@ in3_ctx_state_t in3_ctx_state(in3_ctx_t* ctx) { void ctx_free(in3_ctx_t* ctx) { if (ctx) free_ctx_intern(ctx, false); } + in3_ret_t in3_ctx_execute(in3_ctx_t* ctx) { in3_ret_t ret; // if there is an error it does not make sense to execute. @@ -707,7 +715,7 @@ in3_ret_t in3_ctx_execute(in3_ctx_t* ctx) { // if we don't have a nodelist, we try to get it. if (!ctx->raw_response && !ctx->nodes) { in3_node_filter_t filter = NODE_FILTER_INIT; - filter.nodes = d_get(d_get(d_get_at(d_get(ctx->requests[0], K_PARAMS), d_len(d_get(ctx->requests[0], K_PARAMS)) - 1), K_IN3), key("dataNodes")); + filter.nodes = d_get_in3_param(d_get(ctx->requests[0], K_PARAMS), "dataNodes"); filter.props = (ctx->client->node_props & 0xFFFFFFFF) | NODE_PROP_DATA | ((ctx->client->flags & FLAGS_HTTP) ? NODE_PROP_HTTP : 0) | (ctx->client->proof != PROOF_NONE ? NODE_PROP_PROOF : 0); if ((ret = in3_node_list_pick_nodes(ctx, &ctx->nodes, ctx->client->request_count, filter)) == IN3_OK) { for (int i = 0; i < ctx->len; i++) { From b28f27a637b7af1abdb3c26732e9ef2edf38be56 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Wed, 4 Mar 2020 17:02:57 +0100 Subject: [PATCH 13/97] Fix partial nodeList JSON test --- .../requests/in3_nodeList_partial.json | 238 ++++++++++-------- 1 file changed, 129 insertions(+), 109 deletions(-) diff --git a/c/test/testdata/requests/in3_nodeList_partial.json b/c/test/testdata/requests/in3_nodeList_partial.json index 85f64b929..cb7003aed 100644 --- a/c/test/testdata/requests/in3_nodeList_partial.json +++ b/c/test/testdata/requests/in3_nodeList_partial.json @@ -1,114 +1,134 @@ [ - { - "descr": "partial in3 nodelist", - "chainId": "0x1", - "fuzzer": true, - "verification": "proof", - "request": { - "method": "in3_nodeList", - "params": [ - 2, - "0xd355433cb98bdc18c5a1a28a04e218650e349d47bc0bc15cb51f71a53d12620e" + { + "descr": "partial in3 nodelist", + "chainId": "0x1", + "verification": "proof", + "request": { + "method": "in3_nodeList", + "params": [ + "0x2", + "0xd355433cb98bdc18c5a1a28a04e218650e349d47bc0bc15cb51f71a53d12620e", + [], + { + "in3": { + "signerNodes": [ + "0x1fe2e9bf29aa1938859af64c413361227d04059a" ] - }, - "response": [ + } + } + ] + }, + "response": [ + { + "id": 1, + "result": { + "totalServers": 24, + "contract": "0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f", + "lastBlockNumber": 9591025, + "nodes": [ { - "id": 1, - "result": { - "totalServers": 5, - "contract": "0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f", - "lastBlockNumber": 9099052, - "nodes": [ - { - "url": "https://in3-v2.slock.it/mainnet/nd-3", - "address": "0x945f75c0408c0026a3cd204d36f5e47745182fd4", - "index": 2, - "deposit": "0x2386f26fc10000", - "props": "0x6000001dd", - "timeout": 3456000, - "registerTime": 1576224604, - "weight": 2000 - }, - { - "url": "https://in3-v2.slock.it/mainnet/nd-5", - "address": "0xbcdf4e3e90cc7288b578329efd7bcc90655148d2", - "index": 4, - "deposit": "0x2386f26fc10000", - "props": "0x6000001dd", - "timeout": 3456000, - "registerTime": 1576224948, - "weight": 2000 - } - ], - "registryId": "0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb" - }, - "in3": { - "execTime": 1, - "lastValidatorChange": 0, - "proof": { - "type": "accountProof", - "block": "0xf90212a039a457a5a746711c0f6e64f57aabbdf42924a57605ff8ea1b78b2651b09cb905a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794005e288d713a5fb3d7c9cf1b43810a98688c7223a0f8453407021325a6933d1f9da83bc6ef20085de40408de2a32309db225a54652a03222553ef30c4753cc8f13bf757ab3977cba9c654a3cc09132d0aed791367357a0b97057261e99e23d1b544b1d82322da2ec36c4c8bfff7fc1b6bd13e323011387b90100804513a00c0b268f28a8264044160b1eea84c38051071724200418e04a02211c0ad88f208a144a0288e6c51f99e1017032b947f60f288a4f4336b3009ea19d00400a88a150a984a00b24918d448ee24042462a1f410818048e02f1650ac8c892195a9d120a27e4b49524400c90ca8ad284099005b8090d64124d8330581e50336400015f524c3248140403a04500009228c009480e43164b49c2b0c422798250439d200218cc503a748c228a389008654885000802001808ae3b2ba0bf09121805181062875040688c00146086a004640c120202830a2b9d08bd85e8486aa8102130b40e10a801aac080411084192083d9d2f8028163ed0d0e839e2d388050588708e71a1c2e4097838ad72c83979f9283976c61845df3491d91707079652d786e706f6f6c2e636e2f5834a0c2d3ec76c28b5e7801f9290a766816a5efcb6096fb12acfe1b6aee2193ca3f85887eddf3cc10123e2a", - "accounts": { - "0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f": { - "accountProof": [ - "0xf90211a0d614258daf776b50f82f5365476e959edede03f9683744a63db56f0b1a03954aa09cd8a52faabd6147633a2431fbe2c4a9e574e4aa8a075da40f03c9f7ab994c11a07460c2cc0f3d31773017d17824895b549b1a20ff54ecd79e5b6b648f1ea303eda0a8dbcb2fde20f7d26b25be821bafd7f9c730a8d70f46f6a3831b20cab2fcc6f0a0484b5f4c9fa13e23446558b3aeb2e601359ea2c02297009447759202d462444ea079437871c64f6aec4ad60bd16d51d450dee4e375ec18f86bb53938e1ca762c25a05f850d524c515ce47f03038c27cdd43ecc97ad514b18143e1a728ac2bcc039b3a0bd74a7cded05b74aef06d9353b0b6595e49bf02ef8e5a6fa367bee4d49663184a0aabfaa2bc3584f533e70114bf95afc6dfe997a096e6538adc206d2cd205adbeaa0ae575cc98a0e21d972bac6e2b23dc9aa5100bc22e23525262412083be93531fda0f1af2d52b3c3153c8b71b599b0ce258ab0011ad343d8e5c1ad634afa2e15b74aa026ec15ebeadfce95fd35c0d79f4411fa7ebae0e4560b95807407d4dee0a91550a054cc0f0aae8e2ef795c87163c43beab3ad6c13d222d6a6c329d5a8ae30569f3ea0c2096603ea2080f3d263b2d1d3d51bce6cad0d38572c2dbde72548f1f86229d4a03bd299e7dc8a41ff279e760691d469163a58e12a766458e9bac035292826dd33a0e780951f646d7940f17114b9e641ec4eabbf084aa189c7b1eaef6c7aa97d3d2480", - "0xf90211a0288269dc8912f4e9cdd431947f6bdfdccab55e244194a19ca283dd556dbd9202a0ddb9aa14f1d680360c46b8a0fc8ed6ce49c2ed3b7861ddd5235a0e6c6d10967ba098653093bb47afc04a5ab8d853ff1a2999bec7b2ccf8227fe1178103ff6ca7bba09c6fcacf3cd7497e72a676d744c578619600dff0d0864efcee28ae9209ee3fe1a07f5049f949b248a3a9c634c8acc62fcbe20d60fd45745cc8e80d3f15e4ad564da02fb2d3144b366a325f527182153b1c818450f27cf6b1d39a5eb45ad436976ca2a0b99cd820d09ad078ebe7e9b233fbda4b9b68700a02b30cd38b68c6dfbf8c19aaa0de46ea565b604d71ade490c02d190a9c1d5f48be7892b33132036882b0958ed9a067744df9e90191d628d79a5290b38fda3c8d892f8f9a52b54727737d85460e00a0203d42ee039f70942c0326dc36e223b293f706127842db42297cc6161d0010a9a06a2862929b3b228ed1b1ca64c4feda1566faf00861639e8264de387e00fdc880a02c4cb3f211881b861fccb4f9babe6cee688c6028c9b4c4cb05769097e875ed5ea0acee33bcd4e9a6fd8288f9f65090f07622c18e94beafe6e05eead1ff6ee64bd9a017a377e4689caa9735e9b609886ffcf40dae2b8a4c4c77cef5319b5df6ebb715a023fb8febb0dea4d15ab2c0c87713726abd19932ac6898a664f8585047d48e49ba0c0abc4409914489a3ff8da46335a482a23e96e5299a426d97deed16b71f8e63a80", - "0xf90211a063002da07e53539166363b7e6d0c149b30ac0779ffe1396d0e9bc1168882bde3a0796d44c28a0939aa88829e6b0b7c9bf5d5db53aa0879b14f6ef9feb95d764a7da0e7c2dd769ad3bbe96a5951cd79549808e71e426c5206063ee8388221bfe733cea0900456d32f1d2edb2ff3206d581f1dfb7c20526eb8f7e124b63dd0da3c925a7da006bf96ad11f6c93472935d60d7901029435634a2f8af39ababd8d52bfc5d0877a0bbdca1ab2ca28bbe0868e3c9cc911bf5acf8f3010c7363d672c30ecdc190998fa061fa7c165df38b3d5ae783147ebf2ca2558c3838fc042bb252cee7c73fad806aa088c072acf36eee6fb4f57f612c07e0450f4beabd6b86df76f75254beccc89c9fa04b292373878635b974ebec86b516f243dcd32dc13f3d0a3a6082ebabd79c2397a0354923afe7f8f50cc94ede59ad1a632d2139ee9fd7a8f8d408380dbd898adcb8a0ffb1d6382422a8b2dd21b0693c2ca9183b66ffc16df32e3059acb3e8b51d4323a064e1b306be55368e501624fdcae33ac0107639a22ed2c605a3bbe0a8d80d6d4ea019f3f91a1bd375c6f6fab445dc12533a30f9a74dcff7c01ee261049568e053a2a003e6120f9032134d6e5351e9afde9efc105f27d30616b7dc1a74a5f2387f1ba6a0b7ec72dab90143be294bbf08fbf133ef24221e0841f6b8033f6dfa0f46f3fa64a0bc0cf04257e9d9f5bbf4d73220a9f475be60c875c10d92f327c1c400e55e175d80", - "0xf90211a0f1590b1f733c761b3ba79005b264b399a2071d360a4f6153e93b1de6499e4271a0942916a74dd0ddd13782fe2547ee93ca379c9cb4260948802d6344b3f8116eb2a0b1ee70da81c6b7ae4ac94da374298f9efc2232753ea569271e939a654a921a8ca0d706d461b4b691af91af03d58b7b13710d1fb52accdfed52972f0b8fc4950256a0eca4f2a866a5d851d66f1d94a727f483a45145a338f7c0815d6cf6bf055465fda0540640c27876c8079c55ea20a8976d53e7cf6d6cf3bb2c0a8168650398f5cc0ea0ae8795e6635e89f63d862436189b4f89265fbd8957132c428fe9f7109f2a5594a0fb570faac69a569c9fab2d6bdd19cec4281564d1dc22e680a8fe42b1f2e5514ba03ab8a0826e7e6a27dca2dde62e765c66fddfd06481f31e65178de390b092e48ca0c03252bdfb5973fff085f8f6e6aa310faf56a303f7643e4f3cac6243cc7e50d8a0ca52077298db00310e4a7687437a96c70f28e42991a41a0b8d4cb24f33f1e751a0e364495efb11dd043ef2920cf49569b0405707fc11609835f28f363a7533025ca0a28efef3cbe05d3f83eac6355e31e79190c76509f18c24d46bcc85077df9a692a085d5e43de86e35c3b55d2f4f5498100a062b1a40f352506ba82ffd28473b96c0a056ebd7a1fd59e7bd7575521cd2fcfa2324ead65dbda5217f38ae9b7fc6964b37a09dd644e927bd6d0e787b7c4e0037223b02b455efe606df72af51b9d70254300c80", - "0xf90211a0616fd22d9da5cffb124b1f3d8b2869887dbfb5c75197b102490e085ef84aa260a08ea24e98550b823e7358873a1a1a5d8ec5fa1748ad8812aec06f82a7a104779ca0ca9ca551dd0fc2aaf7b3dd195e467e63675020ef9469e48f8fed349555a8fc94a0738ba8e0ae9ca1d5f04f95f9a932be5c088b4790df9465e230b3baaf90ecb421a079bdf4d535f78d13fe8a9464bfd874cc8215b34dbdd68c65779b3b4b7d3723a3a0cfb37efe579fbaaeee0c1583480bf944d1153ff4c0912f4a1816d26592317c6aa0c8631582a034bf4df34c1e08876186eb029ffb25b426301e658b10de246807d3a0c8a548bdd910784e73225619d14a95a5b3cbe476baeb28d21dbbcbb0fc8c3232a01ce9b201d9f6e1a0661fa09dbb439a08a8d66e2e390f007c6cb11473e75b8956a041de1fa2c05897b170c735d127fe3abfc9118acea86304817f9283f9dfaaad7fa0c26a601f76d7ab76f74c11254edc4735d15099ff718725d695cfe00ab9437192a02e4cf3074eda770d18104671715c5be10e0a2bb6173dd0bf0909cfe7357b7e37a0726f49394640f4c5da699c83189a09822cc22c06a3002df73955aee1146a9d20a0ee6b6998bd6d37d245753bb4bfdbfadb5e9af4a0416b643de590d218a6dd1a4da01b959aaa6d2d252cb9c1d3c39c07f19a0af927a4f87ee084d1c22d31ff630460a0ded4a3c16c0471af314daeacda2f79b0f430888f42cf9f73b82ddfcafd3ac84b80", - "0xf90211a0372a955b15f6a5614f772d142b7d0679a49d9e859d772f8287b30eb6ffca1924a0f1a510919c07d8539a9e7611453ac3f4b64e575355b8f0a1c58f3c54dc1531a8a05058a380b065612ea7cb9a7b45174068b6f71665fc21ebb73dafbd4570b6fa14a074aaf1d956b257164275fd8ddc3aa656c737d79dfc780dee474e8b39ee391d1fa0dccf7318665d89412fdffaa5a6741d11b9cb529afe504f770eb6c0c748a608d3a08b71dd67c9ff6ea323b5ec1302bd2d6437816d0a68bf4b29a48e162c8c61f7efa056faccf236db50c02c95f12542447fdf74e2aa5708b18533285951cf43d76b28a03c139dbd4ecbdca97e442ae535d642d7dd3f6d12ff1878d84f5d8375d3a8e517a03412ecb9bc8acdb503195da735e1ab9918d67638ce321eed7568a33f934d3677a0fd8cb9befe5c61a00a233231b498e4665720bdd4b5003b128a9b984aae4ef403a0ecd693ce49111897f432c05fb93299ca9d4d74a9b395ad022c4bb73213d17520a0f2cabb17d69bfb117c719ac9c0d0d83015bb8e7ae30a468097ebf31cd09b6b43a0e491286f657aa5ec57385603d1ffe3e9950b9aea68cdf78f1e1be2eda6e3cc9aa08117ba461f2f84429e9da4d3ee738ac42fa1ed8c5479f85b859b4528b4e8ff63a076fb23883502dc6328a20a5343f8f3c1595e702e176988d99fbe7d820d198090a08facbf8e7a4bc022e4f51b677be032d319146bbe87be591be92224501662079980", - "0xf8b18080a01a27c49a5a77e292b591767f76ddf2bfbdf1752a5b53c7f07c519d0868760d2ea0ad6cb523f73649d74c1213abb948c10037a7a342ede5cd373b6060061d79faf780808080808080a02dca1cd7f04d0fd9625b649903883a2faa52ea6cfcbda738e61f6ea6322328cd80a0a100cd6e729dee956ee0b30eacec39fd47e2f16f97708a2f09d99e4bcaaaf96aa0d327ffd4270f97c978c638645dc59c0a8ed42fc09bc538c9ad91eea990f543fd8080", - "0xf8669d3ad8a871b31cb3552080711d61fda45242133e0695c60218a95533aa2cb846f8440180a0fc228720956b856cf25332b9e78303cf625d32d2315575c74d47c7d3ee48ba6fa029140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1" - ], - "address": "0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f", - "balance": "0x0", - "codeHash": "0x29140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1", - "nonce": "0x1", - "storageHash": "0xfc228720956b856cf25332b9e78303cf625d32d2315575c74d47c7d3ee48ba6f", - "storageProof": [ - { - "key": "0x0", - "proof": [ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf891a0f881becd1a54ec2ac129979fbb7cc851f4245d372d588056b040ccae152793e8808080808080a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a081b7693d9ef9dea4b83b27e12fd4a86cfd861c266865545c3602ec6a1e43039da026056fdebd58e774617d2b76dfb0bd14f7863bf6abcf25ba1c76e8527d4d79c3808080808080", - "0xe2a0200decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56305" - ], - "value": "0x5" - }, - { - "key": "0x1", - "proof": [ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf85180a0cf1bb0975c1421732acd6e4355d4be5a5cabef4b1abd7ad1567c30acd41ab25b808080808080808080808080a0e204403832678df9883635c3a4eef3fff75806929e3a828e1c540376fac686048080", - "0xf843a0200e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6a1a023d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb" - ], - "value": "0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e571", - "proof": [ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf871a092d2467f9ba1680676edd8692a803254a61cdcf90c43d6b7548c981c1e65e5c38080a08fc2be5da195cb1833f87d242270084c2db8504a66ee7ecad3e0d81f0c5311ee808080808080a04a5be21f4f0c0f5e1fcccb140e7cb5b1ff2ce45bce977d8e23cc7320e8c7bdd0808080808080", - "0xf843a0206695c256a4a4a1b8ed004dc824e330f1747032632c0e6d88c1d84c330c1c5ca1a0aad4bd309785201be407f829fb4caf4d2755129801d7eddde9fb6185be37a614" - ], - "value": "0xaad4bd309785201be407f829fb4caf4d2755129801d7eddde9fb6185be37a614" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e57b", - "proof": [ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf871a042d46bd6345c4aa97249751c507918f4c57bceddb0fe070587a414720d29fab38080808080808080808080a0a77fe674993bb40786c6b15a7a82652bd9ba134b70533bb5cc0834388eeccb6680a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", - "0xf85180808080a0fae6b8484dccdec6b4ae5da10ddba033cc98da72665e01dcf1a2699204b48ad8808080808080808080a04083c8127572e64ae53476470e7a632258565a37b7f2066cb22ef228e679c24e8080", - "0xf8429f3d807394a26a5623e844d859daa1940d13cb7bda091582294562d688f4de00a1a0634a521ea3bb6908c905438f63e03c0d531792596113bcc9f858c8cc3a8eff18" - ], - "value": "0x634a521ea3bb6908c905438f63e03c0d531792596113bcc9f858c8cc3a8eff18" - } - ] - } - } - } - } + "url": "https://in3-v2.slock.it/mainnet/nd-3", + "address": "0x945f75c0408c0026a3cd204d36f5e47745182fd4", + "index": 2, + "deposit": "0x45871874b4b50000", + "props": "0x6000001dd", + "timeout": 3456000, + "registerTime": 1576224604, + "weight": 2000 + }, + { + "url": "http://eth-mainnet-01.incubed-node.de:8500", + "address": "0xe9a1f583c6591566b0cda30dd2a647126d1ce0c2", + "index": 5, + "deposit": "0x3782dace9d90000", + "props": "0x6000001dd", + "timeout": 3456000, + "registerTime": 1578987329, + "weight": 2000 } - ] - } + ], + "registryId": "0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb" + }, + "jsonrpc": "2.0", + "in3": { + "execTime": 92, + "lastValidatorChange": 0, + "proof": { + "type": "accountProof", + "block": "0xf90215a0f6231cece95377c85968402a97c3660cd2437adae565c29f01ce823c548a596aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794ea674fdde714fd979de3edf0f56aa9716b898ec8a0ae71cd14a9513817ccbba4ef77588b9def8f354795ee61a0948804993d43d278a0674fe651f24d712f4e3ce46f27087635a81a936b90e78066fbeda89c8b76f2b6a02cdc8f441b15da7e0a83a8e4ad8dd45d42be6461a2d87dd1d5900c5f18ccc49fb9010000044888000020210008000020020414100002802a020000022a0340030000410443003202000e002000840000908900b811044000000410002030a080240330006800800408460804220c48204a00042a204940004c0005000001100a818010492010402b2441b5008100010040080040a0012a24041a0c4a140451c002022c524130d0000000004002801000480c000021000000d1040821441994021c2113e600185830a004047204008200a008002800009c200240100000090400a020012204288214004200080a04500104008400243000820880904100007004082080001419a08004100700001420a007080002003201030001280000c00400122c008707dfefae230528839258f183989677839879d8845e5cdb0094505059452d65746865726d696e652d6575312d31a0960ad883869b308fea67ec39dd9f448bb8cb910382188c24b507339d6bfda48f88f4b7840000e4ee7c", + "accounts": { + "0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f": { + "accountProof": [ + "0xf90211a024583159940136761fdf101a830370eb8717a7fa8613c0c58a6b8f2452b181d0a07ba17cc99af9b83e8150a7e3d5b13ab904cfeff9bba482d4605b86d1f3be3ab3a0ba7776909926548d2b0603cb6a83d71d574efb0932ab3191838b118e404a71a1a001976d41aec1879e5c9b2918127fbcc85f810f7822bc609e0669c232b74e89c5a02db613c8dbf22b4977434065dc97ac6bafe850689674a9c83124f1a3e93243d1a07636c3fffd0d5b8a25cd1668d632fce992017ea4c823aa7befe5793e57ef8bcca0053f2e87496e030cbe309bfdb31056887c6042d6056defc693200bb758ff165da043cf1b80b62133c21ae0b44f612ab711957ab49a292a8794676740f1f8df1baca0113bac93d54b1158f5354a309659e7694efe414af1dd08932e3977655d00b8fda012b182bf9517ad41f95faea93836267ecc9caac8be34d3734ac57eedd3ebaeb7a0cea71e27f0ec24c433203239bafcd011a2b42f6a42e96c9b18246ca46e2457b5a07683ce81a71025949e77a0d5fb1470492af3be2564af04842e75ceac16c7d936a01aa89ab5cc7b3b8d243809452e273d251f94bb3aaf9dccbb7a7bb180fc66ecf6a0c27eeba276def79f62fc0603544b924a232f30551e148902554ea6bbae524a40a0742f609e8910d5c5aa09b81ebd704c3ebd62677ae5d51c2b04e9c62f9b86b28ca00daf54759d2eea008f9af623099cf3d8b3fa839e9af1b6cfd47a32ad91c1ecda80", + "0xf90211a00971e7167f621d028e1f97ddfd74404cc3362787e8939beb48830c44b4863ecaa0ab82512b7c373684340fd63efd0007abee47cce20df7d86f4aeeb881da324e93a0e5806da01379d23cf07686c02c6dfeb902944adb2d6c071f1e5ccf3d5432b847a03fe41ae0a918a32ee9106e3212ca76d388833ad76e64d6ca4e7a4da04490c91ea01576bfe55d8ac777c98a8705bf81a81adcffc7ec63e68c1bd031b7a775518cd7a0fb3becb4551539140482cdbae629b5141989c4b3d6d844e3896249b0681f58a7a0e10a137e3abf2e91443cdc62d2f89ccf7792a227b95be17a1e8a6f18f7b5fa80a01aea68d8c0de6ab9a3a24447114400a68f5c782cd3dfde661bd01970fb61c0d0a02f0245617e50cb9270eda2cbb53914c9894e232d88792a2cc8f5dbe61ee8f0bea0e8190880c6a683694019a8f805b8ed1e747ab10e10e6b4b9fb41a914333d473ba0ef639592a6552d32e030d4699b1c537316d6873ce8b3b4f2c479d5ffa580be25a07be019d168148456835ea3c471898e865a631e78997eabebc8b8ad999451e268a0ed4552bb48fa721b9c60e3254d35428c5e8f6d75c988c77df69e8aa0fe9b816aa00e2c83914bc654da013d025262301ec53d82e05b86566b3f14a6291d4213fbf8a0274153e4752a0721d5b63de41d74b50f3cee49c854a71e92f5af7b7d4d58c590a067f4dcf9b6d572cc203ed7e6d11897ff5e2f82963f0042519a9cb8b18001e11980", + "0xf90211a0b7894845fd50c14786a99e6efd1419ae8233a52ca40ce4a1efd1387b948f98a7a0f10828e7d0592e5b7f380767fc8fbd829ff68a829a9326f8f3e07b05aac6e358a0418163db70ba5ef09bf2bab4e534f55f9df69152d995d65e2bda299b4266f93da0bf003104cc2e71a71c8e83f56cf32c3845bc681fa8e9a3714116e6a9791e9330a00e9ae9ad41b6802f662624bb8ef9feee93e1cf501af922193f2a0aaf0b6fa6a3a08a34e7cb4efad2353ae65116ac318bcece1e71aa9de1606f23fe74e1e94c272ca07e9dc7dcfb139c1123e821ef01400a108a0f72830092a891702213a44cd451f6a0a60f9aef38604d768437a0a3619225008ac834a704ec1498d77527158cb5fe7da0b4f63a4f09066004323c2c99f63b2c524df5eaff17494e2a0d09a0c969e19af9a08e41936d4c73db7e51583c58ecd207ffcbaa6996b32ea71908c3c89a3a78ed27a010689a7c738d8448d4bba85caed1eee3d76f12b056c755d9d466ed7023b9ee66a0ffd4351e2fb03b9438aa40b45a46a8d37a705a3937a6c017dea43784cf3a9e06a067fccd5ffebfa7dd3f6d04445d092ea73b026c84aa532aa4c8004596444432d9a0ec548048e263086cd891606235f96a6cfb94cef5ae916809ebc33e1d6cebc95da02deada398fd3533d2f7e351b29198b000c1f99b2724aa1e20b253cd60d6cb776a0e2ac81d4f362bb69bf28f3466cac67b4a501819c8544837894ab509258b7ba6480", + "0xf90211a0aecbfde2fd93d54de9d9e22363e3778a747641af38e2a7ce04ee3b446eb50690a05782ebbc21dcf76fd1f1c35c5d82bc7b4bd25343097a31c3c7298394d25c83b0a0b5770af278ca9328d52eeee0e52d0b91f64f6b9cf2d186b7c67d07d71cbdb8a2a0791fc463a46e831460ddc777213daead09c3d5cf6f3861cd6173dd4aca1e150da0b95367476ffb38abaacfb01e10d09596424b63083d8620d010c7baabef5e3e6ca051c83eb0e2334958b7085f1e18cffcb37d95a4caa3a2677f77fe12ea9a9fb1dda07758af7921c950b475972b82353026408b1442d2b74c0c0b3d99e7ede5b306f2a0178db1449a90d2fa46e06507e57225a8f42f5ed57bf9416387b62e22447fff9ba00201459c7f74b0a69dc3954868706c9b94f51ebc5937bea00f50f5325cf19c58a0dd4dcf242b02bc46c9bb121f5139d421fe183afd2997723c0ee0df566c888dc2a04d012287da24cc8ab6b0614f2dd966405065bfb96294266e856de0e1a520ee23a06f9c030cb75b1a513bc28a348c2daa0f3d21b03a7b21e93ab56601c48d746a99a04c37000b2c16645b8b65a2811e13c30b6f1a70d1b708bb5f2b3fe9de626637b2a059eb78cae44436149d36dfc0be4ed5e73b2593f57148f58e5cad37e3da72d134a05a0f5319579784976a94c99d33a3be1e94adf08c23f84c8801b74312e3b934bfa0f49121527a4b200bf92c7ab413dd3941c6a2d528b8c7e1a0ed7179b20cbfc9c580", + "0xf90211a0849a8d374df06edf8b38ca90acf91b3c8780c0c0ac682bf1c38ae39b6ae3b10ba0e0305cac35c98f9cb58af4e64127328247617e0d7f3b8eef445ff6cbeb89a846a0ba1779542a01190ad446a7107078961708b2fdb6c7823aa598f46cba83143b32a05682f587daef701ae28b361aa663347df487076d31958f0b9e40eef6917c01a6a04c0d2ad4c899731377e35cf80431fc3eddf35e86ddb27906bc73a03b3680f1cea0aa9ab43823660142d4109b7acd1a9f4422c4d26d330d2c46831dfa546a083645a07ec1b026ce57226db459f594939faaa14a921e8fa33b1853e4295c74000481f9a0f97feabdf3596c9d0e235db09c464569ffd21d7025863701da1e6e72c52318c9a044205a58a2630a0a4f15b968a4b50d253f66b3843c2f48f67a04c7948932d1b1a0dd579ba870e8be680609fe8e2596c526c5d43c65ef50fa7987db8239a992a81ca0505eaa35fc46616608eaea2cc8e6d47a83c719bb5cf64c3b49154e9a904eb12ca0ad9435516b10e42a8921f6d937558b73a5d9ebedccd1be330fca6f293e466e4aa0b2ec359076e0c0868432fe6ac30f659d446883163e43f43a7bc8b1b1bdc62089a05e63a9bba822e4f73aa25270d8692299731191dea773dc5162397f76b976703aa046ef598497ff8f489f17d37f26c767fc39db4e878d23623661f7d720b5cbbbc7a0e408bb60fdd4d3330fd330cb7e69a4c03b3cf2882db3fc22399ba343dced9e0580", + "0xf90211a0beab0b1e832468563994acb78058d76b9b8d7f3ef71aaaf05959f38aae21edcaa0f1a510919c07d8539a9e7611453ac3f4b64e575355b8f0a1c58f3c54dc1531a8a05058a380b065612ea7cb9a7b45174068b6f71665fc21ebb73dafbd4570b6fa14a0161a8b092e0de3bde9575afc5165d50e6d79efe224c409b3814afee7368c6c28a0dccf7318665d89412fdffaa5a6741d11b9cb529afe504f770eb6c0c748a608d3a08b71dd67c9ff6ea323b5ec1302bd2d6437816d0a68bf4b29a48e162c8c61f7efa060636537ffefd8e54031e7ae9200135a5ed7eb0b9984db03e14a51cbad677d8fa03c139dbd4ecbdca97e442ae535d642d7dd3f6d12ff1878d84f5d8375d3a8e517a03412ecb9bc8acdb503195da735e1ab9918d67638ce321eed7568a33f934d3677a062c5adc422d6393b0e5d69b4c313ee3cc342173e89ee610f8341aaef66b226a7a09ba8172f914aea9d85e552cf9db59247e4a9caeb9056bd0e1e09052c07f9d154a0f2cabb17d69bfb117c719ac9c0d0d83015bb8e7ae30a468097ebf31cd09b6b43a08543c8513396f35bfa383806ced4d41dd189a0bceb7e28f8cd630fadef56cb68a0399cd0904ea2242055795b194f1bff9450adc03241c9d55d8b15c322b047efd0a076fb23883502dc6328a20a5343f8f3c1595e702e176988d99fbe7d820d198090a0daaf0b307f1086d29fff4d31e3866d2a3068f7ccf79acf5c36fe38c5976919ea80", + "0xf8d18080a01a27c49a5a77e292b591767f76ddf2bfbdf1752a5b53c7f07c519d0868760d2ea0ad6cb523f73649d74c1213abb948c10037a7a342ede5cd373b6060061d79faf7808080808080a0d8825f40f808fd1d368ffd5381e2926d2263bbbcee3fee5a1aa7401328da3402a02dca1cd7f04d0fd9625b649903883a2faa52ea6cfcbda738e61f6ea6322328cd80a099fec790aed90a5f7cba13d2cb2d22c79c6e737b5673133796cb831629ac3cbba0d327ffd4270f97c978c638645dc59c0a8ed42fc09bc538c9ad91eea990f543fd8080", + "0xf8669d3ad8a871b31cb3552080711d61fda45242133e0695c60218a95533aa2cb846f8440180a08af15fe9c3fb8fbeb9952e1f0a3ca415821af2225ba7ce0a31c2d2f85cf53a28a029140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1" + ], + "address": "0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f", + "balance": "0x0", + "codeHash": "0x29140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1", + "nonce": "0x1", + "storageHash": "0x8af15fe9c3fb8fbeb9952e1f0a3ca415821af2225ba7ce0a31c2d2f85cf53a28", + "storageProof": [ + { + "key": "0x0", + "proof": [ + "0xf90211a0385ced5243cdf2896972bb9308e46e495cb2c03722aa10ab9391a01982a68969a061a54bf87d397f38ac356fd3cb5f95e043726e6b899da8d4cf82051fac6d5bb5a060009bef28f7e27a059c616ffb65b40952d1ef3da33a703b881408165b0d9d6ea06f38996fb3c789470e6ff6b4ba6a575d20e2fb7f604de607a4d5f9e416e95958a0884356315041d41798f53558a3d2b292b05e2a477632a1488337ab9f85a9781fa092cc1cc9804c55a1c254de5e327ecf3443db9ded678fab119e879748913c6ccda01cb4108edb3b23a09b5d9c61cd7740a915429b38ec76f398f562396625d4b045a088b23a9a79e1d944430302fb910575a76309d52e99eb5f78716e4d9cc91c4b98a0292456129fb7878da212fb91cee5248fdd8d54a747f3e7dba644351d5a541650a09a5bc559d679edda76ee1041a535354b507cdc763bb9c3f0d4ee2faf379790bfa0b03a80929005d5d7f1e5f93cb15e853d35582a6d0eb0c35030f7eb95000c4e1fa0580bcab639a165c7d8e463fe59d001e1595de288b18f822f8079635f39bae05aa007bd7fb0f32e306bfe70b62b27820d7e8c41836b689776d9fa958fec3c0b3b2fa06ff4ed4fb54b258464e426a03131f8f65c2a5d2368c61317ba9ca2ff2b35ea89a0aec7de8f376d67aca9c7a478b6f19eefaeea4075c5ebd6859b53cccb98c7ac08a063054e722a9091aa337f7ff8d717a60af0198e5a2103b31488fb498c83eab22a80", + "0xf90191a0625f8d33fc0be884a044b72b5d1e5540c8438ba229cfd1b3cb580012dcbfbf96a04cc155a7733da13a4178ac150af3aae5a546d5e852b88c7b2348995d26614cfd80a05873c62aaf91429469acbd060af360a0f8858aede4e7554e3289f171f2a79e158080a0905337c7334612fdb0e2bd6f5bbbe7844a5b2e68121bad742e449cc0b26c8bd2a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fda06ce2fb704d930c53524fbf883e483d598b6869cd479598391d8d9974b5bcdf97a0dfa06820b792d37d80969f0f46bf43fb698d499a92c3bb90f7df86da00456ab2a026056fdebd58e774617d2b76dfb0bd14f7863bf6abcf25ba1c76e8527d4d79c3a088606f96a26074bc1ddd07d867f6611662a0a90809339d57d25635382ac9dfeda01a803446fd04d71dca9cccbce730f278d71629c08a92b173b3f67806eed94121a0bed418af7fb2c79b05d23d46e280a7e6da507bc02babb0437bc8a8bedd76d32580a02ed77de2ba88f0af119aac155e22c23dd35fd1e6d35afb3a90ff6e0788855d2780", + "0xf851a07857fa9fae1428bc873b55cd9278c7389972f3a3e4be1b7ec97126ded1666be9808080a0a02d6b52757f7816acf5f459d06658b3af5d944bcadceaf803769ed1ab55fe63808080808080808080808080", + "0xe19f3decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56318" + ], + "value": "0x18" + }, + { + "key": "0x1", + "proof": [ + "0xf90211a0385ced5243cdf2896972bb9308e46e495cb2c03722aa10ab9391a01982a68969a061a54bf87d397f38ac356fd3cb5f95e043726e6b899da8d4cf82051fac6d5bb5a060009bef28f7e27a059c616ffb65b40952d1ef3da33a703b881408165b0d9d6ea06f38996fb3c789470e6ff6b4ba6a575d20e2fb7f604de607a4d5f9e416e95958a0884356315041d41798f53558a3d2b292b05e2a477632a1488337ab9f85a9781fa092cc1cc9804c55a1c254de5e327ecf3443db9ded678fab119e879748913c6ccda01cb4108edb3b23a09b5d9c61cd7740a915429b38ec76f398f562396625d4b045a088b23a9a79e1d944430302fb910575a76309d52e99eb5f78716e4d9cc91c4b98a0292456129fb7878da212fb91cee5248fdd8d54a747f3e7dba644351d5a541650a09a5bc559d679edda76ee1041a535354b507cdc763bb9c3f0d4ee2faf379790bfa0b03a80929005d5d7f1e5f93cb15e853d35582a6d0eb0c35030f7eb95000c4e1fa0580bcab639a165c7d8e463fe59d001e1595de288b18f822f8079635f39bae05aa007bd7fb0f32e306bfe70b62b27820d7e8c41836b689776d9fa958fec3c0b3b2fa06ff4ed4fb54b258464e426a03131f8f65c2a5d2368c61317ba9ca2ff2b35ea89a0aec7de8f376d67aca9c7a478b6f19eefaeea4075c5ebd6859b53cccb98c7ac08a063054e722a9091aa337f7ff8d717a60af0198e5a2103b31488fb498c83eab22a80", + "0xf90151a0e96607228720bed234b27bb0c37e50e491a8938bb805526555881c355488fff8a0cf1bb0975c1421732acd6e4355d4be5a5cabef4b1abd7ad1567c30acd41ab25ba0c8ddf6cc85a6db42ef4c698c4fafeba56c74bc420e7faebffc427f8629af5bbe80a0e48ac1fb66db5420c7589d28982875f6b00a01bf2550410419f57b1d5b2b8f5a80a093cfad45cd604cf4106e82ba40a6b52b55d97e5adcd18cce5cb2b2ce0e96edc8a00b70e702a028a1c36668a44a5737e4233057f7ad89cf96b20aad4dfb02c47db280a0be908080ee7e1bf33568ad4544dbacb39ca16330d86404c93ff9a2325842b633a0ba4f73ad2d3895debec7bffa1d095b66b3f86037d903e77fd3d6d09c601a73ffa0bd4e347cf4e458ce6fcfda1400aad6be52bf24776122cec6b81565875f7efa318080a089e93950ee646c6303858c03da4f679895f38946ddfecd12750b072b785d5b6c8080", + "0xf843a0200e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6a1a023d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb" + ], + "value": "0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e571", + "proof": [ + "0xf90211a0385ced5243cdf2896972bb9308e46e495cb2c03722aa10ab9391a01982a68969a061a54bf87d397f38ac356fd3cb5f95e043726e6b899da8d4cf82051fac6d5bb5a060009bef28f7e27a059c616ffb65b40952d1ef3da33a703b881408165b0d9d6ea06f38996fb3c789470e6ff6b4ba6a575d20e2fb7f604de607a4d5f9e416e95958a0884356315041d41798f53558a3d2b292b05e2a477632a1488337ab9f85a9781fa092cc1cc9804c55a1c254de5e327ecf3443db9ded678fab119e879748913c6ccda01cb4108edb3b23a09b5d9c61cd7740a915429b38ec76f398f562396625d4b045a088b23a9a79e1d944430302fb910575a76309d52e99eb5f78716e4d9cc91c4b98a0292456129fb7878da212fb91cee5248fdd8d54a747f3e7dba644351d5a541650a09a5bc559d679edda76ee1041a535354b507cdc763bb9c3f0d4ee2faf379790bfa0b03a80929005d5d7f1e5f93cb15e853d35582a6d0eb0c35030f7eb95000c4e1fa0580bcab639a165c7d8e463fe59d001e1595de288b18f822f8079635f39bae05aa007bd7fb0f32e306bfe70b62b27820d7e8c41836b689776d9fa958fec3c0b3b2fa06ff4ed4fb54b258464e426a03131f8f65c2a5d2368c61317ba9ca2ff2b35ea89a0aec7de8f376d67aca9c7a478b6f19eefaeea4075c5ebd6859b53cccb98c7ac08a063054e722a9091aa337f7ff8d717a60af0198e5a2103b31488fb498c83eab22a80", + "0xf90151a007c522ccc7cec8771c7e60104825e57a88fca9ef833a368cdfa592ddd17db1978080a0a3431507a80e92ed617c99a803bb36ab27f6d1085ad26fa4672ce91b5c81947ba00bb934ce449a830b198be4cc1fbb3efb43aaa12dfd15df18581e07a33fd2592da0dfec69d15bd73b0b06344b84e6e9cba847c7e2b1c2f19ea42f96563668661ca98080a0c046a31a3a76fb07795fec6bce8ee2d58d6da9e053eb196e6d99f0871dbb32c180a0d64c5137b3bf612119e481de1f286855ab03b5a89205e847295cbf7ece0943bfa0880ad135a503864e143431baf513e4da174b3827a1eea4ace002be0d4c15715aa01064dbbc60b97bb3006c07aa9e92982aac85f33b477863f2bffe3ec701fb981ea0e5e159a9aaa234f1b61d05b54844f17d3f28de3e8cbbf4f78bbe80ee5828c9e3a08ed0b40704167fb82194ea0cf45739a72b0f84f0f3e6c7be89ed220eafffd6ac8080", + "0xf851808080808080a04dd88bb04fac169bbf3c4a222c80b687a630117edaf83e52e13ca6cbbcefe1b980808080a0433788bc4a7a09b0d2faeb9c2d44f28b8124825722a7f23444f114f30ee369938080808080", + "0xf8429f3695c256a4a4a1b8ed004dc824e330f1747032632c0e6d88c1d84c330c1c5ca1a039b1cdf063f1c717d4a5450f1dbbc5683dc242cc8600ad7ec5ba0f7ddff664bd" + ], + "value": "0x39b1cdf063f1c717d4a5450f1dbbc5683dc242cc8600ad7ec5ba0f7ddff664bd" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e580", + "proof": [ + "0xf90211a0385ced5243cdf2896972bb9308e46e495cb2c03722aa10ab9391a01982a68969a061a54bf87d397f38ac356fd3cb5f95e043726e6b899da8d4cf82051fac6d5bb5a060009bef28f7e27a059c616ffb65b40952d1ef3da33a703b881408165b0d9d6ea06f38996fb3c789470e6ff6b4ba6a575d20e2fb7f604de607a4d5f9e416e95958a0884356315041d41798f53558a3d2b292b05e2a477632a1488337ab9f85a9781fa092cc1cc9804c55a1c254de5e327ecf3443db9ded678fab119e879748913c6ccda01cb4108edb3b23a09b5d9c61cd7740a915429b38ec76f398f562396625d4b045a088b23a9a79e1d944430302fb910575a76309d52e99eb5f78716e4d9cc91c4b98a0292456129fb7878da212fb91cee5248fdd8d54a747f3e7dba644351d5a541650a09a5bc559d679edda76ee1041a535354b507cdc763bb9c3f0d4ee2faf379790bfa0b03a80929005d5d7f1e5f93cb15e853d35582a6d0eb0c35030f7eb95000c4e1fa0580bcab639a165c7d8e463fe59d001e1595de288b18f822f8079635f39bae05aa007bd7fb0f32e306bfe70b62b27820d7e8c41836b689776d9fa958fec3c0b3b2fa06ff4ed4fb54b258464e426a03131f8f65c2a5d2368c61317ba9ca2ff2b35ea89a0aec7de8f376d67aca9c7a478b6f19eefaeea4075c5ebd6859b53cccb98c7ac08a063054e722a9091aa337f7ff8d717a60af0198e5a2103b31488fb498c83eab22a80", + "0xf90191a0625f8d33fc0be884a044b72b5d1e5540c8438ba229cfd1b3cb580012dcbfbf96a04cc155a7733da13a4178ac150af3aae5a546d5e852b88c7b2348995d26614cfd80a05873c62aaf91429469acbd060af360a0f8858aede4e7554e3289f171f2a79e158080a0905337c7334612fdb0e2bd6f5bbbe7844a5b2e68121bad742e449cc0b26c8bd2a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fda06ce2fb704d930c53524fbf883e483d598b6869cd479598391d8d9974b5bcdf97a0dfa06820b792d37d80969f0f46bf43fb698d499a92c3bb90f7df86da00456ab2a026056fdebd58e774617d2b76dfb0bd14f7863bf6abcf25ba1c76e8527d4d79c3a088606f96a26074bc1ddd07d867f6611662a0a90809339d57d25635382ac9dfeda01a803446fd04d71dca9cccbce730f278d71629c08a92b173b3f67806eed94121a0bed418af7fb2c79b05d23d46e280a7e6da507bc02babb0437bc8a8bedd76d32580a02ed77de2ba88f0af119aac155e22c23dd35fd1e6d35afb3a90ff6e0788855d2780", + "0xf8518080a0cddb6195608409ce1e3af7bcafb1438332c340b7ca526661a0cff52f7acab826808080808080a09a1a77e2ad05e8178da178bf660822cefdb0572bf5dd9dfda7caa1266003d84a80808080808080", + "0xf8429f3f0f7a7af9ed4f160d1c425f37d148d10bddb9c828e99d4145b150485711cea1a0a78b8e772e2235c3777d75526957ecb08bb0681b47f5ac2582bf0add4c004185" + ], + "value": "0xa78b8e772e2235c3777d75526957ecb08bb0681b47f5ac2582bf0add4c004185" + } + ] + } + }, + "signatures": [ + { + "blockHash": "0xc397545c6d161d2ec2d30d4a94376930de0b12de224056f51df5cab6c048af59", + "block": 9591025, + "r": "0xdcbad7d30a54cb7ebd9aa4c20a0615495588ad13535f3bdd57599bd8fc6dc41d", + "s": "0x3579f6eb0a600ee33614dbcf85d9fdaf0703761c6af48b35f3eda5c7379c1997", + "v": 27, + "msgHash": "0xdbaaa3d1df151b9d8079416e41ba3d5e30ce575e1cbee0a1b9fc0671ff185de1" + } + ] + } + } + } + ] + } ] \ No newline at end of file From a32e13d6e487186e40473117646223c22a978c5a Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Sun, 8 Mar 2020 20:27:52 +0100 Subject: [PATCH 14/97] Add flag FLAGS_NODE_LIST_NO_SIG --- c/src/core/client/client.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/src/core/client/client.h b/c/src/core/client/client.h index 1a10fd070..d0b990424 100644 --- a/c/src/core/client/client.h +++ b/c/src/core/client/client.h @@ -149,7 +149,7 @@ typedef enum { FLAGS_BINARY = 0x8, /**< the client will use binary format */ FLAGS_HTTP = 0x10, /**< the client will try to use http instead of https */ FLAGS_STATS = 0x20, /**< nodes will keep track of the stats (default=true) */ - + FLAGS_NODE_LIST_NO_SIG = 0x40 /**< nodelist update request will not automatically ask for signatures and proof */ } in3_flags_type_t; /** incubed node-configuration. From 437a12c9655675fcd5def26cf5d26db362388c64 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Sun, 8 Mar 2020 20:43:12 +0100 Subject: [PATCH 15/97] Rewrite configure request --- c/src/core/client/execute.c | 93 ++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/c/src/core/client/execute.c b/c/src/core/client/execute.c index baf1e5b13..ec3666d01 100644 --- a/c/src/core/client/execute.c +++ b/c/src/core/client/execute.c @@ -114,64 +114,63 @@ static d_token_t* d_get_in3_param(d_token_t* params, const char* keystr) { return d_get(d_get(last_param, K_IN3), key(keystr)); } +static bool auto_ask_sig(const in3_ctx_t* ctx) { + return (ctx_is_method(ctx, "in3_nodeList") && !(ctx->client->flags & FLAGS_NODE_LIST_NO_SIG)); +} + static in3_ret_t configure_request(in3_ctx_t* ctx, in3_request_config_t* conf, d_token_t* request, in3_chain_t* chain) { - const in3_t* c = ctx->client; + UNUSED_VAR(request); + const in3_t* c = ctx->client; conf->chain_id = c->chain_id; conf->finality = c->finality; conf->latest_block = c->replace_latest_block; conf->flags = c->flags; - if (c->proof == PROOF_STANDARD || c->proof == PROOF_FULL || ctx_is_method(ctx, "in3_nodeList")) { - // For nodeList request, we always ask for proof & atleast one signature - uint8_t total_sig_cnt = c->signature_count ? c->signature_count - : ctx_is_method(ctx, "in3_nodeList") ? 1 : 0; - - conf->use_full_proof = c->proof == PROOF_FULL; - conf->verification = VERIFICATION_PROOF; - - if (total_sig_cnt) { - node_match_t* signer_nodes = NULL; - in3_node_filter_t filter = NODE_FILTER_INIT; - filter.nodes = d_get_in3_param(d_get(ctx->requests[0], K_PARAMS), "signerNodes"); - filter.props = c->node_props | NODE_PROP_SIGNER; - const in3_ret_t res = in3_node_list_pick_nodes(ctx, &signer_nodes, total_sig_cnt, filter); - if (res < 0) - return ctx_set_error(ctx, "Could not find any nodes for requesting signatures", res); - const int node_count = ctx_nodes_len(signer_nodes); - conf->signers_length = node_count; - conf->signers = _malloc(sizeof(bytes_t) * node_count); - const node_match_t* w = signer_nodes; - for (int i = 0; i < node_count; i++) { - conf->signers[i].len = w->node->address->len; - conf->signers[i].data = w->node->address->data; - w = w->next; - } - in3_ctx_free_nodes(signer_nodes); - - if (chain->verified_hashes) { - conf->verified_hashes_length = ctx->client->max_verified_hashes; - for (int i = 0; i < conf->verified_hashes_length; i++) { - if (!chain->verified_hashes[i].block_number) { - conf->verified_hashes_length = i; - break; - } - } - if (conf->verified_hashes_length) { - conf->verified_hashes = _malloc(sizeof(bytes_t) * conf->verified_hashes_length); - for (int i = 0; i < conf->verified_hashes_length; i++) - conf->verified_hashes[i] = bytes(chain->verified_hashes[i].hash, 32); + if (c->proof == PROOF_NONE && !auto_ask_sig(ctx)) + return IN3_OK; + + // For nodeList request, we always ask for proof & atleast one signature + uint8_t total_sig_cnt = c->signature_count ? c->signature_count + : auto_ask_sig(ctx) ? 1 : 0; + + conf->use_full_proof = c->proof == PROOF_FULL; + conf->verification = VERIFICATION_PROOF; + + if (total_sig_cnt) { + node_match_t* signer_nodes = NULL; + in3_node_filter_t filter = NODE_FILTER_INIT; + filter.nodes = d_get_in3_param(d_get(ctx->requests[0], K_PARAMS), "signerNodes"); + filter.props = c->node_props | NODE_PROP_SIGNER; + const in3_ret_t res = in3_node_list_pick_nodes(ctx, &signer_nodes, total_sig_cnt, filter); + if (res < 0) + return ctx_set_error(ctx, "Could not find any nodes for requesting signatures", res); + const int node_count = ctx_nodes_len(signer_nodes); + conf->signers_length = node_count; + conf->signers = _malloc(sizeof(bytes_t) * node_count); + const node_match_t* w = signer_nodes; + for (int i = 0; i < node_count; i++) { + conf->signers[i].len = w->node->address->len; + conf->signers[i].data = w->node->address->data; + w = w->next; + } + in3_ctx_free_nodes(signer_nodes); + + if (chain->verified_hashes) { + conf->verified_hashes_length = ctx->client->max_verified_hashes; + for (int i = 0; i < conf->verified_hashes_length; i++) { + if (!chain->verified_hashes[i].block_number) { + conf->verified_hashes_length = i; + break; } } + if (conf->verified_hashes_length) { + conf->verified_hashes = _malloc(sizeof(bytes_t) * conf->verified_hashes_length); + for (int i = 0; i < conf->verified_hashes_length; i++) + conf->verified_hashes[i] = bytes(chain->verified_hashes[i].hash, 32); + } } } - - if (request) { - d_token_t* in3 = d_get(request, K_IN3); - if (in3 == NULL) return IN3_OK; - //TODO read config from request. This way we can test requests with preselected signers. - } - return IN3_OK; } From 35cedb6c2b7cf19a067e8b95a05ba17cf2b16b30 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Sun, 8 Mar 2020 20:43:23 +0100 Subject: [PATCH 16/97] Fix test cache --- c/test/unit_tests/test_cache.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/c/test/unit_tests/test_cache.c b/c/test/unit_tests/test_cache.c index 3cae0d945..2d4c0442b 100644 --- a/c/test/unit_tests/test_cache.c +++ b/c/test/unit_tests/test_cache.c @@ -50,8 +50,8 @@ #include #include -#define CONTRACT_ADDRS "0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f" -#define REGISTRY_ID "0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb" +#define CONTRACT_ADDRS "0x5f51e413581dd76759e9eed51e63d14c8d1379c8" +#define REGISTRY_ID "0x67c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea" #define WHITELIST_CONTRACT_ADDRS "0xdd80249a0631cf0f1593c7a9c9f9b8545e6c88ab" static in3_ret_t test_transport(in3_request_t* req) { @@ -129,11 +129,11 @@ static void test_cache() { in3_register_eth_nano(); - in3_t* c = in3_for_chain(0x1); + in3_t* c = in3_for_chain(ETH_CHAIN_ID_GOERLI); c->transport = test_transport; setup_test_cache(c); - in3_chain_t* chain = in3_find_chain(c, 0x1); + in3_chain_t* chain = in3_find_chain(c, ETH_CHAIN_ID_GOERLI); TEST_ASSERT_TRUE(chain != NULL); TEST_ASSERT_EQUAL_INT32(2, chain->nodelist_length); @@ -146,7 +146,7 @@ static void test_cache() { TEST_ASSERT_EQUAL(0, update_nodes(c, chain)); // the nodeList should have 5 nodes now - TEST_ASSERT_EQUAL_INT32(5, chain->nodelist_length); + TEST_ASSERT_EQUAL_INT32(7, chain->nodelist_length); // ..and the cache one entry TEST_ASSERT_TRUE(*((cache_t*) c->cache->cptr)->keys != NULL); @@ -155,14 +155,16 @@ static void test_cache() { c2->cache = c->cache; c2->transport = test_transport; c2->chain_id = c->chain_id; - in3_configure(c2, "{\"chainId\":\"0x1\"}"); - in3_chain_t* chain2 = in3_find_chain(c2, 0x1); + c2->flags |= FLAGS_AUTO_UPDATE_LIST | FLAGS_NODE_LIST_NO_SIG; + + in3_configure(c2, "{\"chainId\":\"0x5\"}"); + in3_chain_t* chain2 = in3_find_chain(c2, c2->chain_id); // the nodeList should have 2 nodes still TEST_ASSERT_EQUAL_INT32(2, chain2->nodelist_length); in3_cache_init(c2); // the nodeList should have 5 nodes now - TEST_ASSERT_EQUAL_INT32(5, chain2->nodelist_length); + TEST_ASSERT_EQUAL_INT32(7, chain2->nodelist_length); // test request in3_ctx_t* ctx = in3_client_rpc_ctx(c2, "in3_nodeList", "[]"); @@ -178,6 +180,7 @@ static void test_newchain() { in3_t* c = in3_for_chain(0); c->chain_id = 0x8; + c->flags |= FLAGS_AUTO_UPDATE_LIST | FLAGS_NODE_LIST_NO_SIG; setup_test_cache(c); in3_set_default_storage(c->cache); @@ -209,8 +212,8 @@ static void test_newchain() { // now we update the node (from testfiles) TEST_ASSERT_EQUAL(0, update_nodes(c, chain)); - // the nodeList should have 5 nodes now - TEST_ASSERT_EQUAL_INT32(5, chain->nodelist_length); + // the nodeList should have 7 nodes now + TEST_ASSERT_EQUAL_INT32(7, chain->nodelist_length); // ..and the cache one entry TEST_ASSERT_TRUE(*((cache_t*) c->cache->cptr)->keys != NULL); @@ -218,6 +221,7 @@ static void test_newchain() { in3_t* c2 = in3_for_chain(0); c2->chain_id = c->chain_id; c2->cache = c->cache; + in3_client_register_chain(c2, 0x8, CHAIN_ETH, contract, registry_id, 2, NULL); in3_chain_t* chain2 = NULL; for (int i = 0; i < c2->chains_length; i++) { @@ -227,11 +231,11 @@ static void test_newchain() { // the nodeList should have 2 nodes still TEST_ASSERT_EQUAL_INT32(0, chain2->nodelist_length); in3_cache_init(c2); - // the nodeList should have 5 nodes now - TEST_ASSERT_EQUAL_INT32(5, chain2->nodelist_length); + // the nodeList should have 7 nodes now + TEST_ASSERT_EQUAL_INT32(7, chain2->nodelist_length); in3_client_remove_node(c2, c2->chain_id, chain2->nodelist->address->data); - TEST_ASSERT_EQUAL_INT32(4, chain2->nodelist_length); + TEST_ASSERT_EQUAL_INT32(6, chain2->nodelist_length); in3_client_clear_nodes(c2, c2->chain_id); TEST_ASSERT_EQUAL_INT32(0, chain2->nodelist_length); } From 3aa3b61f629b6708bdc2e6b16abe45aa1713f60a Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Sun, 8 Mar 2020 20:43:33 +0100 Subject: [PATCH 17/97] Fix nodelist test --- c/test/unit_tests/test_nodelist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/test/unit_tests/test_nodelist.c b/c/test/unit_tests/test_nodelist.c index 331a65b69..bc061810a 100644 --- a/c/test/unit_tests/test_nodelist.c +++ b/c/test/unit_tests/test_nodelist.c @@ -226,7 +226,7 @@ static in3_t* in3_init_test(chain_id_t chain) { in3_t* in3 = in3_for_chain(chain); in3->chain_id = chain; in3->transport = test_transport; - in3->flags |= FLAGS_AUTO_UPDATE_LIST; + in3->flags |= FLAGS_AUTO_UPDATE_LIST | FLAGS_NODE_LIST_NO_SIG; return in3; } From ebf5cad7b3bd66f9d7d528bbd809f50b04863adc Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Sun, 8 Mar 2020 20:45:22 +0100 Subject: [PATCH 18/97] Rebuild headers --- c/include/in3/client.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/c/include/in3/client.h b/c/include/in3/client.h index 59c3d2014..cd8bcb8d2 100644 --- a/c/include/in3/client.h +++ b/c/include/in3/client.h @@ -114,7 +114,6 @@ typedef struct in3_request_config { uint8_t latest_block; /**< the last blocknumber the nodelistz changed */ uint16_t finality; /**< number of signatures( in percent) needed in order to reach finality. */ in3_verification_t verification; /**< Verification-type */ - bytes_t* client_signature; /**< the signature of the client with the client key */ bytes_t* signers; /**< the addresses of servers requested to sign the blockhash */ uint8_t signers_length; /**< number or addresses */ uint32_t time; /**< meassured time in ms for the request */ @@ -150,7 +149,7 @@ typedef enum { FLAGS_BINARY = 0x8, /**< the client will use binary format */ FLAGS_HTTP = 0x10, /**< the client will try to use http instead of https */ FLAGS_STATS = 0x20, /**< nodes will keep track of the stats (default=true) */ - + FLAGS_NODE_LIST_NO_SIG = 0x40 /**< nodelist update request will not automatically ask for signatures and proof */ } in3_flags_type_t; /** incubed node-configuration. @@ -407,8 +406,8 @@ typedef struct in3_t_ { /** the limit of nodes to store in the client. */ uint16_t node_limit; - /** the client key to sign requests */ - bytes_t* key; + /** the client key to sign requests (pointer to 32bytes private key seed) */ + void* key; /** number of max bytes used to cache the code in memory */ uint32_t max_code_cache; From 55139f1441e0deeefea38503cbbe7ed2e4c6d043 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Sun, 8 Mar 2020 20:57:00 +0100 Subject: [PATCH 19/97] Make chainspec.h priv --- c/include/in3/chainspec.h | 112 --------------------------- c/src/verifier/eth1/nano/chainspec.h | 1 - 2 files changed, 113 deletions(-) delete mode 100644 c/include/in3/chainspec.h diff --git a/c/include/in3/chainspec.h b/c/include/in3/chainspec.h deleted file mode 100644 index acf0808dc..000000000 --- a/c/include/in3/chainspec.h +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * This file is part of the Incubed project. - * Sources: https://github.com/slockit/in3-c - * - * Copyright (C) 2018-2019 slock.it GmbH, Blockchains LLC - * - * - * COMMERCIAL LICENSE USAGE - * - * Licensees holding a valid commercial license may use this file in accordance - * with the commercial license agreement provided with the Software or, alternatively, - * in accordance with the terms contained in a written agreement between you and - * slock.it GmbH/Blockchains LLC. For licensing terms and conditions or further - * information please contact slock.it at in3@slock.it. - * - * Alternatively, this file may be used under the AGPL license as follows: - * - * AGPL LICENSE USAGE - * - * This program is free software: you can redistribute it and/or modify it under the - * terms of the GNU Affero General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - * [Permissions of this strong copyleft license are conditioned on making available - * complete source code of licensed works and modifications, which include larger - * works using a licensed work, under the same license. Copyright and license notices - * must be preserved. Contributors provide an express grant of patent rights.] - * You should have received a copy of the GNU Affero General Public License along - * with this program. If not, see . - *******************************************************************************/ - -// @PUBLIC_HEADER -/** @file - * Ethereum chain specification - * */ - -#ifndef in3_eth_chainspec_h__ -#define in3_eth_chainspec_h__ -#include "client.h" -#include "data.h" -#include "error.h" -#include - -#define BLOCK_LATEST 0xFFFFFFFFFFFFFFFF - -/** - * defines the flags for the current activated EIPs. - * Since it does not make sense to support a evm defined before Homestead, homestead EIP is always turned on! - * - */ -typedef struct __attribute__((__packed__)) eip_ { - - unsigned int eip140 : 1; /**< REVERT instruction */ - unsigned int eip145 : 1; /**< Bitwise shifting instructions in EVM */ - unsigned int eip150 : 1; /**< Gas cost changes for IO-heavy operations */ - unsigned int eip155 : 1; /**< Simple replay attack protection */ - unsigned int eip160 : 1; /**< EXP cost increase */ - unsigned int eip170 : 1; /**< Contract code size limit */ - unsigned int eip196 : 1; /**< Precompiled contracts for addition and scalar multiplication on the elliptic curve alt_bn128 */ - unsigned int eip197 : 1; /**< Precompiled contracts for optimal ate pairing check on the elliptic curve alt_bn128 */ - unsigned int eip198 : 1; /**< Big integer modular exponentiation */ - unsigned int eip211 : 1; /**< New opcodes: RETURNDATASIZE and RETURNDATACOPY */ - unsigned int eip214 : 1; /**< New opcode STATICCALL */ - unsigned int eip658 : 1; /**< Embedding transaction status code in receipts */ - unsigned int eip1014 : 1; /**< Skinny CREATE2 */ - unsigned int eip1052 : 1; /**< EXTCODEHASH opcode */ - unsigned int eip1283 : 1; /**< Net gas metering for SSTORE without dirty maps */ - -} eip_t; - -/** the consensus type. - * -*/ -typedef enum { - ETH_POW = 0, /**< Pro of Work (Ethash) */ - ETH_POA_AURA = 1, /**< Proof of Authority using Aura */ - ETH_POA_CLIQUE = 2 /**< Proof of Authority using clique */ -} eth_consensus_type_t; - -typedef struct transition_eip_ { - uint64_t transition_block; - eip_t eips; -} eip_transition_t; - -typedef struct transition_consensus_ { - uint64_t transition_block; - eth_consensus_type_t type; - bytes_t validators; - uint8_t* contract; -} consensus_transition_t; - -typedef struct chainspec_ { - uint64_t network_id; - uint64_t account_start_nonce; - uint32_t eip_transitions_len; - eip_transition_t* eip_transitions; - uint32_t consensus_transitions_len; - consensus_transition_t* consensus_transitions; -} chainspec_t; - -chainspec_t* chainspec_create_from_json(d_token_t* data); -eip_t chainspec_get_eip(chainspec_t* spec, uint64_t block_number); -consensus_transition_t* chainspec_get_consensus(chainspec_t* spec, uint64_t block_number); -in3_ret_t chainspec_to_bin(chainspec_t* spec, bytes_builder_t* bb); -chainspec_t* chainspec_from_bin(void* raw); -chainspec_t* chainspec_get(chain_id_t chain_id); -void chainspec_put(chain_id_t chain_id, chainspec_t* spec); - -#endif // in3_eth_chainspec_h__ diff --git a/c/src/verifier/eth1/nano/chainspec.h b/c/src/verifier/eth1/nano/chainspec.h index 45dbf3bb4..777e28664 100644 --- a/c/src/verifier/eth1/nano/chainspec.h +++ b/c/src/verifier/eth1/nano/chainspec.h @@ -32,7 +32,6 @@ * with this program. If not, see . *******************************************************************************/ -// @PUBLIC_HEADER /** @file * Ethereum chain specification * */ From 053b39463b622927825ad3e3cee7349e07f1005e Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Sun, 8 Mar 2020 21:27:35 +0100 Subject: [PATCH 20/97] Rename api_utils_priv.c --- c/src/api/utils/{api_utils_priv.c => api_utils.c} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename c/src/api/utils/{api_utils_priv.c => api_utils.c} (100%) diff --git a/c/src/api/utils/api_utils_priv.c b/c/src/api/utils/api_utils.c similarity index 100% rename from c/src/api/utils/api_utils_priv.c rename to c/src/api/utils/api_utils.c index 3d4493e8f..c2a45dc53 100644 --- a/c/src/api/utils/api_utils_priv.c +++ b/c/src/api/utils/api_utils.c @@ -32,9 +32,9 @@ * with this program. If not, see . *******************************************************************************/ -#include "api_utils_priv.h" -#include "../../core/util/mem.h" #include "api_utils.h" +#include "../../core/util/mem.h" +#include "api_utils_priv.h" // forward decl void set_error(int err, const char* msg); From f5e3240a8edf875c714d975ddfeadf64712325bf Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Sun, 8 Mar 2020 21:31:49 +0100 Subject: [PATCH 21/97] Move helper API funcs to api_utils.h --- c/include/in3/api_utils.h | 20 ++++++++++++++++++++ c/include/in3/eth_api.h | 27 +++++++-------------------- c/src/api/eth1/eth_api.c | 26 -------------------------- c/src/api/eth1/eth_api.h | 29 ++++++++--------------------- c/src/api/utils/api_utils.c | 26 ++++++++++++++++++++++++++ c/src/api/utils/api_utils.h | 20 ++++++++++++++++++++ 6 files changed, 81 insertions(+), 67 deletions(-) diff --git a/c/include/in3/api_utils.h b/c/include/in3/api_utils.h index 888e7c66a..6b47b8aef 100644 --- a/c/include/in3/api_utils.h +++ b/c/include/in3/api_utils.h @@ -41,6 +41,26 @@ #ifndef IN3_API_UTILS_H #define IN3_API_UTILS_H +#include "client.h" + +/** + * a 32 byte long integer used to store ethereum-numbers. + * + * use the as_long() or as_double() to convert this to a useable number. +*/ +typedef struct { + uint8_t data[32]; +} uint256_t; + +// Helper functions +long double as_double(uint256_t d); /**< Converts a uint256_t in a long double. Important: since a long double stores max 16 byte, there is no guarantee to have the full precision. */ +uint64_t as_long(uint256_t d); /**< Converts a uint256_t in a long . Important: since a long double stores 8 byte, this will only use the last 8 byte of the value. */ +uint256_t to_uint256(uint64_t value); /**< Converts a uint64_t into its uint256_t representation. */ +in3_ret_t decrypt_key(d_token_t* key_data, char* password, bytes32_t dst); /**< Decrypts the private key from a json keystore file using PBKDF2 or SCRYPT (if enabled) */ + +// more helper +in3_ret_t to_checksum(address_t adr, chain_id_t chain_id, char out[43]); /**< converts the given address to a checksum address. If chain_id is passed, it will use the EIP1191 to include it as well. */ + /** * function to set error. Will only be called internally. * default implementation is NOT MT safe! diff --git a/c/include/in3/eth_api.h b/c/include/in3/eth_api.h index 0ba99d206..8f1830b23 100644 --- a/c/include/in3/eth_api.h +++ b/c/include/in3/eth_api.h @@ -55,15 +55,6 @@ /**< The current error or null if all is ok */ #define eth_last_error() api_last_error() -/** - * a 32 byte long integer used to store ethereum-numbers. - * - * use the as_long() or as_double() to convert this to a useable number. -*/ -typedef struct { - uint8_t data[32]; -} uint256_t; - /** Optional types */ DEFINE_OPTIONAL_T(uint64_t); DEFINE_OPTIONAL_T(bytes_t); @@ -186,16 +177,12 @@ bytes_t* eth_sendTransaction(in3_t* in3, address_t from, address_t to, bytes_t* eth_sendRawTransaction(in3_t* in3, bytes_t data); /**< Creates new message call transaction or a contract creation for signed transactions. Returns (32 Bytes) - the transaction hash, or the zero hash if the transaction is not yet available. Free after use with b_free(). */ eth_tx_receipt_t* eth_getTransactionReceipt(in3_t* in3, bytes32_t tx_hash); /**< Returns the receipt of a transaction by transaction hash. Free result after use with eth_tx_receipt_free() */ char* eth_wait_for_receipt(in3_t* in3, bytes32_t tx_hash); /**< Waits for receipt of a transaction requested by transaction hash. */ +void eth_log_free(eth_log_t* log); /**< Frees a eth_log_t object */ +void eth_tx_receipt_free(eth_tx_receipt_t* txr); /**< Frees a eth_tx_receipt_t object */ + +/** + * this function should only be called once and will register the eth-API verifier. + */ +void in3_register_eth_api(); -// Helper functions -long double as_double(uint256_t d); /**< Converts a uint256_t in a long double. Important: since a long double stores max 16 byte, there is no guarantee to have the full precision. */ -uint64_t as_long(uint256_t d); /**< Converts a uint256_t in a long . Important: since a long double stores 8 byte, this will only use the last 8 byte of the value. */ -uint256_t to_uint256(uint64_t value); /**< Converts a uint64_t into its uint256_t representation. */ -in3_ret_t decrypt_key(d_token_t* key_data, char* password, bytes32_t dst); /**< Decrypts the private key from a json keystore file using PBKDF2 or SCRYPT (if enabled) */ -void eth_log_free(eth_log_t* log); /**< Frees a eth_log_t object */ -void eth_tx_receipt_free(eth_tx_receipt_t* txr); /**< Frees a eth_tx_receipt_t object */ - -// more helper -in3_ret_t to_checksum(address_t adr, chain_id_t chain_id, char out[43]); /**< converts the given address to a checksum address. If chain_id is passed, it will use the EIP1191 to include it as well. */ -void in3_register_eth_api(); #endif diff --git a/c/src/api/eth1/eth_api.c b/c/src/api/eth1/eth_api.c index 78e6b1348..9360b2ac5 100644 --- a/c/src/api/eth1/eth_api.c +++ b/c/src/api/eth1/eth_api.c @@ -55,32 +55,6 @@ static void copy_fixed(uint8_t* dst, uint32_t len, bytes_t data) { memset(dst, 0, len); } -uint256_t to_uint256(uint64_t value) { - uint256_t data; - memset(data.data, 0, 32); - long_to_bytes(value, data.data + 24); - return data; -} - -/** converts a uint256 to a long double */ -long double as_double(uint256_t d) { - uint8_t* p = d.data; - int l = 32; - optimize_len(p, l); - if (l < 9) - return bytes_to_long(p, l); - else { - long double val = 6277101735386680763835789423207666416102355444464034512896.0L * bytes_to_long(d.data, 8); - val += 340282366920938463463374607431768211456.0L * bytes_to_long(d.data + 8, 8); - val += 18446744073709551616.0L * bytes_to_long(d.data + 16, 8); - return val + bytes_to_long(d.data + 24, 8); - } -} -/** converts a uint256_t to a int (by taking the last 8 bytes) */ -uint64_t as_long(uint256_t d) { - return bytes_to_long(d.data + 32 - 8, 8); -} - /** creates a uin256_t from a flexible byte */ static uint256_t uint256_from_bytes(bytes_t bytes) { uint256_t d; diff --git a/c/src/api/eth1/eth_api.h b/c/src/api/eth1/eth_api.h index 3a90b520f..e92564b64 100644 --- a/c/src/api/eth1/eth_api.h +++ b/c/src/api/eth1/eth_api.h @@ -55,15 +55,6 @@ /**< The current error or null if all is ok */ #define eth_last_error() api_last_error() -/** - * a 32 byte long integer used to store ethereum-numbers. - * - * use the as_long() or as_double() to convert this to a useable number. -*/ -typedef struct { - uint8_t data[32]; -} uint256_t; - /** Optional types */ DEFINE_OPTIONAL_T(uint64_t); DEFINE_OPTIONAL_T(bytes_t); @@ -186,16 +177,12 @@ bytes_t* eth_sendTransaction(in3_t* in3, address_t from, address_t to, bytes_t* eth_sendRawTransaction(in3_t* in3, bytes_t data); /**< Creates new message call transaction or a contract creation for signed transactions. Returns (32 Bytes) - the transaction hash, or the zero hash if the transaction is not yet available. Free after use with b_free(). */ eth_tx_receipt_t* eth_getTransactionReceipt(in3_t* in3, bytes32_t tx_hash); /**< Returns the receipt of a transaction by transaction hash. Free result after use with eth_tx_receipt_free() */ char* eth_wait_for_receipt(in3_t* in3, bytes32_t tx_hash); /**< Waits for receipt of a transaction requested by transaction hash. */ +void eth_log_free(eth_log_t* log); /**< Frees a eth_log_t object */ +void eth_tx_receipt_free(eth_tx_receipt_t* txr); /**< Frees a eth_tx_receipt_t object */ + +/** + * this function should only be called once and will register the eth-API verifier. + */ +void in3_register_eth_api(); -// Helper functions -long double as_double(uint256_t d); /**< Converts a uint256_t in a long double. Important: since a long double stores max 16 byte, there is no guarantee to have the full precision. */ -uint64_t as_long(uint256_t d); /**< Converts a uint256_t in a long . Important: since a long double stores 8 byte, this will only use the last 8 byte of the value. */ -uint256_t to_uint256(uint64_t value); /**< Converts a uint64_t into its uint256_t representation. */ -in3_ret_t decrypt_key(d_token_t* key_data, char* password, bytes32_t dst); /**< Decrypts the private key from a json keystore file using PBKDF2 or SCRYPT (if enabled) */ -void eth_log_free(eth_log_t* log); /**< Frees a eth_log_t object */ -void eth_tx_receipt_free(eth_tx_receipt_t* txr); /**< Frees a eth_tx_receipt_t object */ - -// more helper -in3_ret_t to_checksum(address_t adr, chain_id_t chain_id, char out[43]); /**< converts the given address to a checksum address. If chain_id is passed, it will use the EIP1191 to include it as well. */ -void in3_register_eth_api(); -#endif \ No newline at end of file +#endif diff --git a/c/src/api/utils/api_utils.c b/c/src/api/utils/api_utils.c index c2a45dc53..7d22d18a4 100644 --- a/c/src/api/utils/api_utils.c +++ b/c/src/api/utils/api_utils.c @@ -113,3 +113,29 @@ d_token_t* get_result(in3_ctx_t* ctx) { : (d_type(t) == T_OBJECT ? d_string(t) : d_get_stringk(t, K_MESSAGE))); return NULL; } + +uint256_t to_uint256(uint64_t value) { + uint256_t data; + memset(data.data, 0, 32); + long_to_bytes(value, data.data + 24); + return data; +} + +/** converts a uint256 to a long double */ +long double as_double(uint256_t d) { + uint8_t* p = d.data; + int l = 32; + optimize_len(p, l); + if (l < 9) + return bytes_to_long(p, l); + else { + long double val = 6277101735386680763835789423207666416102355444464034512896.0L * bytes_to_long(d.data, 8); + val += 340282366920938463463374607431768211456.0L * bytes_to_long(d.data + 8, 8); + val += 18446744073709551616.0L * bytes_to_long(d.data + 16, 8); + return val + bytes_to_long(d.data + 24, 8); + } +} +/** converts a uint256_t to a int (by taking the last 8 bytes) */ +uint64_t as_long(uint256_t d) { + return bytes_to_long(d.data + 32 - 8, 8); +} diff --git a/c/src/api/utils/api_utils.h b/c/src/api/utils/api_utils.h index 888e7c66a..59735ae00 100644 --- a/c/src/api/utils/api_utils.h +++ b/c/src/api/utils/api_utils.h @@ -41,6 +41,26 @@ #ifndef IN3_API_UTILS_H #define IN3_API_UTILS_H +#include "../../core/client/client.h" + +/** + * a 32 byte long integer used to store ethereum-numbers. + * + * use the as_long() or as_double() to convert this to a useable number. +*/ +typedef struct { + uint8_t data[32]; +} uint256_t; + +// Helper functions +long double as_double(uint256_t d); /**< Converts a uint256_t in a long double. Important: since a long double stores max 16 byte, there is no guarantee to have the full precision. */ +uint64_t as_long(uint256_t d); /**< Converts a uint256_t in a long . Important: since a long double stores 8 byte, this will only use the last 8 byte of the value. */ +uint256_t to_uint256(uint64_t value); /**< Converts a uint64_t into its uint256_t representation. */ +in3_ret_t decrypt_key(d_token_t* key_data, char* password, bytes32_t dst); /**< Decrypts the private key from a json keystore file using PBKDF2 or SCRYPT (if enabled) */ + +// more helper +in3_ret_t to_checksum(address_t adr, chain_id_t chain_id, char out[43]); /**< converts the given address to a checksum address. If chain_id is passed, it will use the EIP1191 to include it as well. */ + /** * function to set error. Will only be called internally. * default implementation is NOT MT safe! From e725356dada0e9a2950dc5614547d076eb90465b Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Sun, 8 Mar 2020 21:32:12 +0100 Subject: [PATCH 22/97] Fix build --- c/CMakeLists.txt | 1 + c/include/in3/eth_basic.h | 2 +- c/src/api/CMakeLists.txt | 3 ++- c/src/api/eth1/CMakeLists.txt | 4 ++-- c/src/api/ipfs/CMakeLists.txt | 2 +- c/src/verifier/eth1/basic/eth_basic.h | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index 907052c56..6256c307c 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -60,6 +60,7 @@ if (IN3_LIB) $ $ $ + $ ) # if we use curl, we include curl transport as well if (USE_CURL) diff --git a/c/include/in3/eth_basic.h b/c/include/in3/eth_basic.h index 5b40f50c7..f2c13bd5c 100644 --- a/c/include/in3/eth_basic.h +++ b/c/include/in3/eth_basic.h @@ -70,7 +70,7 @@ in3_ret_t eth_verify_account_proof(in3_vctx_t* vc); in3_ret_t eth_verify_eth_getBlock(in3_vctx_t* vc, bytes_t* block_hash, uint64_t blockNumber); /** - * this function should only be called once and will register the eth-nano verifier. + * this function should only be called once and will register the eth-basic verifier. */ void in3_register_eth_basic(); diff --git a/c/src/api/CMakeLists.txt b/c/src/api/CMakeLists.txt index 13e53e433..84084bc1c 100644 --- a/c/src/api/CMakeLists.txt +++ b/c/src/api/CMakeLists.txt @@ -34,7 +34,8 @@ IF (IN3API) - add_library(in3_api_utils STATIC utils/api_utils_priv.c) + add_library(api_utils_o OBJECT utils/api_utils.c) + add_library(api_utils STATIC $) add_subdirectory(eth1) add_subdirectory(usn) diff --git a/c/src/api/eth1/CMakeLists.txt b/c/src/api/eth1/CMakeLists.txt index f355d93d3..437342069 100644 --- a/c/src/api/eth1/CMakeLists.txt +++ b/c/src/api/eth1/CMakeLists.txt @@ -44,8 +44,8 @@ IF (USE_SCRYPT) ADD_DEFINITIONS(-DSCRYPT) endif() endif() -add_library(eth_api_o OBJECT eth_api.c abi.c key.c rpc_api.c ens.c ../utils/api_utils_priv.c) +add_library(eth_api_o OBJECT eth_api.c abi.c key.c rpc_api.c ens.c) target_compile_definitions(eth_api_o PRIVATE -D_POSIX_C_SOURCE=199309L) add_library(eth_api STATIC $) -target_link_libraries(eth_api eth_nano in3_api_utils ${LIBS}) \ No newline at end of file +target_link_libraries(eth_api eth_nano api_utils ${LIBS}) \ No newline at end of file diff --git a/c/src/api/ipfs/CMakeLists.txt b/c/src/api/ipfs/CMakeLists.txt index a28e01ce3..3504b3d2c 100644 --- a/c/src/api/ipfs/CMakeLists.txt +++ b/c/src/api/ipfs/CMakeLists.txt @@ -35,4 +35,4 @@ include("${PROJECT_SOURCE_DIR}/c/compiler.cmake") add_library(ipfs_api_o OBJECT ipfs_api.c) add_library(ipfs_api STATIC $) -target_link_libraries(ipfs_api core b64 in3_api_utils) \ No newline at end of file +target_link_libraries(ipfs_api core b64 api_utils) \ No newline at end of file diff --git a/c/src/verifier/eth1/basic/eth_basic.h b/c/src/verifier/eth1/basic/eth_basic.h index 5497f4b35..5795f3e90 100644 --- a/c/src/verifier/eth1/basic/eth_basic.h +++ b/c/src/verifier/eth1/basic/eth_basic.h @@ -70,7 +70,7 @@ in3_ret_t eth_verify_account_proof(in3_vctx_t* vc); in3_ret_t eth_verify_eth_getBlock(in3_vctx_t* vc, bytes_t* block_hash, uint64_t blockNumber); /** - * this function should only be called once and will register the eth-nano verifier. + * this function should only be called once and will register the eth-basic verifier. */ void in3_register_eth_basic(); From d536236d5dd8af699fd3e46f9285be1f9c79ac3e Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Mon, 9 Mar 2020 11:48:44 +0100 Subject: [PATCH 23/97] Add method in3_client_rpc_ctx_raw() --- c/include/in3/context.h | 3 +++ c/src/core/client/client.c | 23 ++++++++++++++--------- c/src/core/client/context.h | 11 +++++++++++ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/c/include/in3/context.h b/c/include/in3/context.h index 208a5e9ec..71e0811d1 100644 --- a/c/include/in3/context.h +++ b/c/include/in3/context.h @@ -407,6 +407,9 @@ in3_ctx_t* in3_client_rpc_ctx( char* params /**< [in] params as string. */ ); +in3_ctx_t* in3_client_rpc_ctx_raw(in3_t* c, /**< [in] the clientt config. */ + char* req /**< [in] rpc method. */); + /** * handles a failable context * diff --git a/c/src/core/client/client.c b/c/src/core/client/client.c index 150f9310e..4f6bddb29 100644 --- a/c/src/core/client/client.c +++ b/c/src/core/client/client.c @@ -42,20 +42,12 @@ #include #include -in3_ctx_t* in3_client_rpc_ctx(in3_t* c, char* method, char* params) { - // generate the rpc-request - const int max = strlen(method) + strlen(params) + 200; // determine the max length of the request string - const bool heap = max > 500; // if we need more than 500 bytes, we better put it in the heap - char* req = heap ? _malloc(max) : alloca(max); // allocate memory in heap or stack - if (!req) return NULL; // if we don't have the memory for a string, we stop here - snprintX(req, max, "{\"method\":\"%s\",\"jsonrpc\":\"2.0\",\"id\":1,\"params\":%s}", method, params); // create request - +in3_ctx_t* in3_client_rpc_ctx_raw(in3_t* c, char* req) { // create a new context by parsing the request in3_ctx_t* ctx = ctx_new(c, req); // this happens if the request is not parseable (JSON-error in params) if (ctx->error) { - if (heap) _free(req); // free request string if we created it in heap ctx->verification_state = IN3_EINVAL; return ctx; } @@ -69,6 +61,19 @@ in3_ctx_t* in3_client_rpc_ctx(in3_t* c, char* method, char* params) { } else ctx->verification_state = ret; + return ctx; // return context and hope the calle will clean it. +} + +in3_ctx_t* in3_client_rpc_ctx(in3_t* c, char* method, char* params) { + // generate the rpc-request + const int max = strlen(method) + strlen(params) + 200; // determine the max length of the request string + const bool heap = max > 500; // if we need more than 500 bytes, we better put it in the heap + char* req = heap ? _malloc(max) : alloca(max); // allocate memory in heap or stack + if (!req) return NULL; // if we don't have the memory for a string, we stop here + snprintX(req, max, "{\"method\":\"%s\",\"jsonrpc\":\"2.0\",\"id\":1,\"params\":%s}", method, params); // create request + + in3_ctx_t* ctx = in3_client_rpc_ctx_raw(c, req); + if (heap) _free(req); // free request string if we created it in heap return ctx; // return context and hope the calle will clean it. } diff --git a/c/src/core/client/context.h b/c/src/core/client/context.h index 1712c3ca0..72c1676fc 100644 --- a/c/src/core/client/context.h +++ b/c/src/core/client/context.h @@ -396,11 +396,22 @@ in3_ret_t ctx_get_error( in3_ctx_t* ctx, /**< [in] the current request context. */ int id /**< [in] the index of the request to check (if this is a batch-request, otherwise 0). */ ); + /** * sends a request and returns a context used to access the result or errors. * * This context *MUST* be freed with ctx_free(ctx) after usage to release the resources. */ +in3_ctx_t* in3_client_rpc_ctx_raw( + in3_t* c, /**< [in] the client config. */ + char* request /**< [in] rpc request. */ +); + +/** + * sends a request and returns a context used to access the result or errors. + * + * This context *MUST* be freed with ctx_free(ctx) after usage to release the resources. +*/ in3_ctx_t* in3_client_rpc_ctx( in3_t* c, /**< [in] the clientt config. */ char* method, /**< [in] rpc method. */ From c88e424caabd53744dd2608c1e34293c3a7f6259 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Mon, 9 Mar 2020 15:00:01 +0100 Subject: [PATCH 24/97] Add in3_client_rpc_raw() --- c/src/core/client/client.c | 18 +++++++++++++----- c/src/core/client/client.h | 7 +++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/c/src/core/client/client.c b/c/src/core/client/client.c index 4f6bddb29..556f9e1ee 100644 --- a/c/src/core/client/client.c +++ b/c/src/core/client/client.c @@ -78,13 +78,11 @@ in3_ctx_t* in3_client_rpc_ctx(in3_t* c, char* method, char* params) { return ctx; // return context and hope the calle will clean it. } -in3_ret_t in3_client_rpc(in3_t* c, char* method, char* params, char** result, char** error) { - if (!error) return IN3_EINVAL; +static in3_ret_t ctx_rpc(in3_ctx_t* ctx, char** result, char** error) { if (result) result[0] = 0; - *error = NULL; - in3_ctx_t* ctx = in3_client_rpc_ctx(c, method, params); - in3_ret_t res = ctx ? ctx->verification_state : IN3_ENOMEM; + *error = NULL; + in3_ret_t res = ctx ? ctx->verification_state : IN3_ENOMEM; if (!ctx) return res; // check parse-errors @@ -133,6 +131,16 @@ in3_ret_t in3_client_rpc(in3_t* c, char* method, char* params, char** result, ch return res; } +in3_ret_t in3_client_rpc(in3_t* c, char* method, char* params, char** result, char** error) { + if (!error) return IN3_EINVAL; + return ctx_rpc(in3_client_rpc_ctx(c, method, params), result, error); +} + +in3_ret_t in3_client_rpc_raw(in3_t* c, char* request, char** result, char** error) { + if (!error) return IN3_EINVAL; + return ctx_rpc(in3_client_rpc_ctx_raw(c, request), result, error); +} + static char* create_rpc_error(uint32_t id, int code, char* error) { char* res = _malloc(strlen(error) + 100); if (res) sprintf(res, "{\"id\":%d,\"jsonrpc\":\"2.0\",\"error\":{\"code\":%i,\"message\":\"%s\"}}", id, code, error); diff --git a/c/src/core/client/client.h b/c/src/core/client/client.h index d0b990424..0cf167d2f 100644 --- a/c/src/core/client/client.h +++ b/c/src/core/client/client.h @@ -558,6 +558,13 @@ in3_ret_t in3_client_rpc( char** result, /**< [in] pointer to string which will be set if the request was successfull. This will hold the result as json-rpc-string. (make sure you free this after use!) */ char** error /**< [in] pointer to a string containg the error-message. (make sure you free it after use!) */); +/** sends a request and stores the result in the provided buffer */ +in3_ret_t in3_client_rpc_raw( + in3_t* c, /**< [in] the pointer to the incubed client config. */ + char* request, /**< [in] the rpc request including method and params. */ + char** result, /**< [in] pointer to string which will be set if the request was successfull. This will hold the result as json-rpc-string. (make sure you free this after use!) */ + char** error /**< [in] pointer to a string containg the error-message. (make sure you free it after use!) */); + /** executes a request and returns result as string. in case of an error, the error-property of the result will be set. * The resulting string must be free by the the caller of this function! */ From 976fbdb68ec0912320fa5dc939ba566af12c2796 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Mon, 9 Mar 2020 15:00:17 +0100 Subject: [PATCH 25/97] Use in3_client_rpc_raw() in runner --- c/test/runner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/test/runner.c b/c/test/runner.c index c27cd8f2a..6ba964c43 100644 --- a/c/test/runner.c +++ b/c/test/runner.c @@ -241,7 +241,7 @@ int execRequest(in3_t* c, d_token_t* test, int must_fail) { // _tmp_response = response; int is_bin = d_get_int(test, "binaryFormat"); - in3_client_rpc(c, method, params, is_bin ? NULL : &res, &err); + in3_client_rpc_raw(c, d_string(request), is_bin ? NULL : &res, &err); if (res && intern) { json_ctx_t* actual_json = parse_json(res); From 0cc342f61053eac80a4634985c8e0d90a60b1691 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Mon, 9 Mar 2020 17:02:32 +0100 Subject: [PATCH 26/97] Move request in3 section out of params --- c/src/core/client/execute.c | 11 ++--------- c/src/core/client/keys.h | 4 +++- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/c/src/core/client/execute.c b/c/src/core/client/execute.c index ec3666d01..eaa528a2b 100644 --- a/c/src/core/client/execute.c +++ b/c/src/core/client/execute.c @@ -107,13 +107,6 @@ static void free_ctx_intern(in3_ctx_t* ctx, bool is_sub) { _free(ctx); } -static d_token_t* d_get_in3_param(d_token_t* params, const char* keystr) { - if (d_len(params) < 1) return NULL; - d_token_t* last_param = d_get_at(params, d_len(params) - 1); - if (d_type(last_param) != T_OBJECT) return NULL; - return d_get(d_get(last_param, K_IN3), key(keystr)); -} - static bool auto_ask_sig(const in3_ctx_t* ctx) { return (ctx_is_method(ctx, "in3_nodeList") && !(ctx->client->flags & FLAGS_NODE_LIST_NO_SIG)); } @@ -140,7 +133,7 @@ static in3_ret_t configure_request(in3_ctx_t* ctx, in3_request_config_t* conf, d if (total_sig_cnt) { node_match_t* signer_nodes = NULL; in3_node_filter_t filter = NODE_FILTER_INIT; - filter.nodes = d_get_in3_param(d_get(ctx->requests[0], K_PARAMS), "signerNodes"); + filter.nodes = d_get(d_get(ctx->requests[0], K_IN3), K_SIGNER_NODES); filter.props = c->node_props | NODE_PROP_SIGNER; const in3_ret_t res = in3_node_list_pick_nodes(ctx, &signer_nodes, total_sig_cnt, filter); if (res < 0) @@ -714,7 +707,7 @@ in3_ret_t in3_ctx_execute(in3_ctx_t* ctx) { // if we don't have a nodelist, we try to get it. if (!ctx->raw_response && !ctx->nodes) { in3_node_filter_t filter = NODE_FILTER_INIT; - filter.nodes = d_get_in3_param(d_get(ctx->requests[0], K_PARAMS), "dataNodes"); + filter.nodes = d_get(d_get(ctx->requests[0], K_IN3), K_DATA_NODES); filter.props = (ctx->client->node_props & 0xFFFFFFFF) | NODE_PROP_DATA | ((ctx->client->flags & FLAGS_HTTP) ? NODE_PROP_HTTP : 0) | (ctx->client->proof != PROOF_NONE ? NODE_PROP_PROOF : 0); if ((ret = in3_node_list_pick_nodes(ctx, &ctx->nodes, ctx->client->request_count, filter)) == IN3_OK) { for (int i = 0; i < ctx->len; i++) { diff --git a/c/src/core/client/keys.h b/c/src/core/client/keys.h index 0a604bb5a..22972c67e 100644 --- a/c/src/core/client/keys.h +++ b/c/src/core/client/keys.h @@ -156,4 +156,6 @@ #define K_REMOVED key("removed") #define K_FROM_BLOCK key("fromBlock") -#define K_TO_BLOCK key("toBlock") \ No newline at end of file +#define K_TO_BLOCK key("toBlock") +#define K_SIGNER_NODES key("signerNodes") +#define K_DATA_NODES key("dataNodes") From 2524d3c9d1b269aaa3ddd2ee1d50a192174e82e1 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Mon, 9 Mar 2020 17:02:41 +0100 Subject: [PATCH 27/97] Fix tests --- c/test/testdata/requests/in3_nodeList.json | 15 ++++++--------- .../testdata/requests/in3_nodeList_partial.json | 17 ++++++++--------- c/test/unit_tests/test_nodelist.c | 2 ++ 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/c/test/testdata/requests/in3_nodeList.json b/c/test/testdata/requests/in3_nodeList.json index fcb18057f..cffbea03f 100644 --- a/c/test/testdata/requests/in3_nodeList.json +++ b/c/test/testdata/requests/in3_nodeList.json @@ -6,15 +6,12 @@ "verification": "proof", "request": { "method": "in3_nodeList", - "params": [ - { - "in3": { - "signerNodes": [ - "0x1fe2e9bf29aa1938859af64c413361227d04059a" - ] - } - } - ] + "params": [ ], + "in3": { + "signerNodes": [ + "0x1fe2e9bf29aa1938859af64c413361227d04059a" + ] + } }, "response": [ { diff --git a/c/test/testdata/requests/in3_nodeList_partial.json b/c/test/testdata/requests/in3_nodeList_partial.json index cb7003aed..31564c304 100644 --- a/c/test/testdata/requests/in3_nodeList_partial.json +++ b/c/test/testdata/requests/in3_nodeList_partial.json @@ -1,6 +1,7 @@ [ { "descr": "partial in3 nodelist", + "fuzzer": true, "chainId": "0x1", "verification": "proof", "request": { @@ -8,15 +9,13 @@ "params": [ "0x2", "0xd355433cb98bdc18c5a1a28a04e218650e349d47bc0bc15cb51f71a53d12620e", - [], - { - "in3": { - "signerNodes": [ - "0x1fe2e9bf29aa1938859af64c413361227d04059a" - ] - } - } - ] + [ ] + ], + "in3": { + "signerNodes": [ + "0x1fe2e9bf29aa1938859af64c413361227d04059a" + ] + } }, "response": [ { diff --git a/c/test/unit_tests/test_nodelist.c b/c/test/unit_tests/test_nodelist.c index bc061810a..688d885a0 100644 --- a/c/test/unit_tests/test_nodelist.c +++ b/c/test/unit_tests/test_nodelist.c @@ -541,6 +541,8 @@ static void test_nodelist_update_6() { // reset rand to be deterministic s = 0; in3_rand(&s); + t = 3720; + in3_time(&t); c->proof = PROOF_NONE; From c46ed1576b1eafc1fa00ce23a88e8bd835294a9c Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Mon, 9 Mar 2020 17:28:10 +0100 Subject: [PATCH 28/97] Rebuild headers --- c/include/in3/client.h | 7 +++++++ c/include/in3/context.h | 14 +++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/c/include/in3/client.h b/c/include/in3/client.h index cd8bcb8d2..ff2e6a3c0 100644 --- a/c/include/in3/client.h +++ b/c/include/in3/client.h @@ -558,6 +558,13 @@ in3_ret_t in3_client_rpc( char** result, /**< [in] pointer to string which will be set if the request was successfull. This will hold the result as json-rpc-string. (make sure you free this after use!) */ char** error /**< [in] pointer to a string containg the error-message. (make sure you free it after use!) */); +/** sends a request and stores the result in the provided buffer */ +in3_ret_t in3_client_rpc_raw( + in3_t* c, /**< [in] the pointer to the incubed client config. */ + char* request, /**< [in] the rpc request including method and params. */ + char** result, /**< [in] pointer to string which will be set if the request was successfull. This will hold the result as json-rpc-string. (make sure you free this after use!) */ + char** error /**< [in] pointer to a string containg the error-message. (make sure you free it after use!) */); + /** executes a request and returns result as string. in case of an error, the error-property of the result will be set. * The resulting string must be free by the the caller of this function! */ diff --git a/c/include/in3/context.h b/c/include/in3/context.h index 71e0811d1..90b11d9a0 100644 --- a/c/include/in3/context.h +++ b/c/include/in3/context.h @@ -396,20 +396,28 @@ in3_ret_t ctx_get_error( in3_ctx_t* ctx, /**< [in] the current request context. */ int id /**< [in] the index of the request to check (if this is a batch-request, otherwise 0). */ ); + /** * sends a request and returns a context used to access the result or errors. * * This context *MUST* be freed with ctx_free(ctx) after usage to release the resources. */ +in3_ctx_t* in3_client_rpc_ctx_raw( + in3_t* c, /**< [in] the client config. */ + char* request /**< [in] rpc request. */ +); + +/** + * sends a request and returns a context used to access the result or errors. + * + * This context *MUST* be freed with ctx_free(ctx) after usage to release the resources. +*/ in3_ctx_t* in3_client_rpc_ctx( in3_t* c, /**< [in] the clientt config. */ char* method, /**< [in] rpc method. */ char* params /**< [in] params as string. */ ); -in3_ctx_t* in3_client_rpc_ctx_raw(in3_t* c, /**< [in] the clientt config. */ - char* req /**< [in] rpc method. */); - /** * handles a failable context * From d543cc1ab436fd93c972ea179c3ef4ce0e16c4f8 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Mon, 9 Mar 2020 17:42:32 +0100 Subject: [PATCH 29/97] Fix WASM test --- c/test/testdata/mock/in3_nodeList.json | 235 ++++++++++++++----------- 1 file changed, 131 insertions(+), 104 deletions(-) diff --git a/c/test/testdata/mock/in3_nodeList.json b/c/test/testdata/mock/in3_nodeList.json index 531e5a13d..4bde3c4eb 100644 --- a/c/test/testdata/mock/in3_nodeList.json +++ b/c/test/testdata/mock/in3_nodeList.json @@ -4,15 +4,14 @@ "id": 1, "jsonrpc": "2.0", "method": "in3_nodeList", - "params": [ - 0, - "0x02c99d25026be9917ab32fd40a09463b66e1d0a27348707218ce877f1f21af92", - [] - ], + "params": [ ], "in3": { "version": "2.1.0", "chainId": "0x5", - "verification": "proof" + "verification": "proof", + "signerNodes": [ + "0x1fe2e9bf29aa1938859af64c413361227d04059a" + ] } } ], @@ -23,170 +22,198 @@ "nodes": [ { "url": "https://in3-v2.slock.it/goerli/nd-1", - "address": "0x45d45e6Ff99E6c34A235d263965910298985fcFe", + "address": "0x45d45e6ff99e6c34a235d263965910298985fcfe", "index": 0, - "deposit": "10000000000000000", - "props": "29", - "chainIds": [ - "0x5" - ], - "timeout": "3600", - "registerTime": "1570106331", - "weight": "2000", - "proofHash": "e78f63f744ad929e2e8e5a56a2ece1910e2746468a4dded5051816b2c7f17cb1" + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227711, + "weight": 2000 }, { "url": "https://in3-v2.slock.it/goerli/nd-2", - "address": "0x1Fe2E9bf29aa1938859Af64C413361227d04059a", + "address": "0x1fe2e9bf29aa1938859af64c413361227d04059a", "index": 1, - "deposit": "10000000000000000", - "props": "29", - "chainIds": [ - "0x5" - ], - "timeout": "3600", - "registerTime": "1570106376", - "weight": "2000", - "proofHash": "75ee6ff4c60116898485089c7511cd927ac0797976b96bb3bf4e829606696257" + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227741, + "weight": 2000 }, { "url": "https://in3-v2.slock.it/goerli/nd-3", - "address": "0x945F75c0408C0026a3CD204d36f5e47745182fd4", + "address": "0x945f75c0408c0026a3cd204d36f5e47745182fd4", "index": 2, - "deposit": "10000000000000000", - "props": "29", - "chainIds": [ - "0x5" - ], - "timeout": "3600", - "registerTime": "1570106391", - "weight": "2000", - "proofHash": "0cd0c844682507c091d2e6c6713e11eb43edf24348a85e1666db47c8ab6bd2c9" + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227801, + "weight": 2000 }, { "url": "https://in3-v2.slock.it/goerli/nd-4", - "address": "0xC513A534De5A9d3F413152c41B09bd8116237fc8", + "address": "0xc513a534de5a9d3f413152c41b09bd8116237fc8", "index": 3, - "deposit": "10000000000000000", - "props": "29", - "chainIds": [ - "0x5" - ], - "timeout": "3600", - "registerTime": "1570106421", - "weight": "2000", - "proofHash": "6783698b37cf52b13768c0e92c978fcb6cc1b37bd8132dc8debde83f5e0da7ec" + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227831, + "weight": 2000 }, { "url": "https://in3-v2.slock.it/goerli/nd-5", - "address": "0xbcdF4E3e90cc7288b578329efd7bcC90655148d2", + "address": "0xbcdf4e3e90cc7288b578329efd7bcc90655148d2", "index": 4, - "deposit": "10000000000000000", - "props": "29", - "chainIds": [ - "0x5" - ], - "timeout": "3600", - "registerTime": "1570106451", - "weight": "2000", - "proofHash": "7fcf0ee638cfa8d38823d3a3b0616e71ff9c70e39918c31b22361b605dbbf3c2" + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227876, + "weight": 2000 + }, + { + "url": "https://tincubeth.komputing.org/", + "address": "0xf944d416ebdf7f6e22eaf79a5a53ad1a487ddd9a", + "index": 5, + "deposit": "0x2386f26fc10000", + "props": "0x1d7e0000000a", + "timeout": 3456000, + "registerTime": 1578947320, + "weight": 1 + }, + { + "url": "https://h5l45fkzz7oc3gmb.onion/", + "address": "0x56d986deb3b5d14cb230d0f39247cc32416020b6", + "index": 6, + "deposit": "0x2386f26fc10000", + "props": "0x21660000000a", + "timeout": 3456000, + "registerTime": 1578954071, + "weight": 1 } ], - "contract": "0xfea298b288d232a256ae0ad5941e5c890b1db691", - "registryId": "0xa551fe03f855370f0fca881f5f2f6b8f7731a92e371c4de5f5c610833881059c", - "lastBlockNumber": 1527136, - "totalServers": 5 + "contract": "0x5f51e413581dd76759e9eed51e63d14c8d1379c8", + "registryId": "0x67c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea", + "lastBlockNumber": 2276348, + "totalServers": 7 }, "jsonrpc": "2.0", "in3": { - "execTime": 0, - "lastValidatorChange": 1, + "execTime": 126, + "lastValidatorChange": 0, "proof": { "type": "accountProof", - "block": "0xf9025ca0d6a4bdeb6016d73558b6f0bd67784a8d3b906ad8bf72b8819bc3eb3482444a95a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a02bfb6f19923ae60281eb490d9b4eb491427df89ef1dc72d0149a3a982f9c5795a0a5ef12921adbcd68fd6251e2722b495fc05c29e56753181377d445c7cada88b5a0c9eb8d09410b298b8d67adb0db4f4366360b316e7049bd1e7e3a6b513f6acfd2b90100000000000000000000000000000000000000000000000000008000000000000000400000000010000000000000000000080000000200000000000000002020000000000000000000000000000000000000020000000000000000000000040004000000030000000000000000001000000000000000000000000000000000000000000010000000000000000000008000000080000000000000000040001000000200000000100000004000000000000000000000408000000000000000004000000000000000000000000000000000000000000000000000000000000000001000100000000000800000000000000000000000080000000000400000000000000283174d60837a120083034a94845db1af50b861d883010903846765746888676f312e31322e39856c696e757800000000000000a72f2e7b84fa4cfd9915034539914c04ef6feed94c5975b05cf69b116305f0174102a6a5233e05c5cb7ece06eafb62183a14f4eb96267382faa453f04f6457d101a00000000000000000000000000000000000000000000000000000000000000000880000000000000000", + "block": "0xf9025ca05b15c4d9014a57f19c037563bba8f3e39733b6bbeb730be5a6bd9a8677011d1da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0b3edf0f8f66f2b10ea77fb77d6dc43e6bc99eddf51910dc8c79e135f0ba062f9a0697d4da49cf730d9502a6e9d418f0cd3842c86be0085de59d51c2237972aa16ea04dc4fe69fff1798d2a06d4ddd7087d69e850b6b0c2d7553f0f02991fcb862576b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010028322bbfc837a1200830111f4845e5d5b4db861f09f928e20407072796c616273206e6f64652d3020f09f928e00000000000000a7e5fe715a2bddc9892d1070f70de87e11b89bc3509c2614129110bb4d4f350a3d6a3e13948a53841251ff04c9ead54d2473cb1e42130bad8938e5913297c8c900a00000000000000000000000000000000000000000000000000000000000000000880000000000000000", "accounts": { - "0xfea298b288d232a256ae0ad5941e5c890b1db691": { + "0x5f51e413581dd76759e9eed51e63d14c8d1379c8": { "accountProof": [ - "0xf90211a0749460f8bf961937eff7e2baa21decfbfc1db7462fc5f37604e3e1f59f50a534a097756d661783a6e34c5e2c960f3cb6ff60a34e7ee1c4a57cae95df322c05c7e4a0097c1d6b23d7ca155a52ce2a2d0988dbf0dc62b8918f6c2c40ad3da485b41043a054a770048544ec6c4cb3874fa0943e29817b6f9c4388920d6cebf012b7958991a01b083dbde94ebaa3b72b90db7f6367eb7c9df6c4b39a43165bbd55ff11f85675a0fa7c56ba8160dd7d063f6d4f43c53b1c33c4d9a5e32b52f76673c6a8fb87e7e6a0a0ef739becb5b45277913bf572f340d23eac9d254a3521f1b40b642e86c55f9ba0b0993abc41e2b6188d18da15430c7ecf9527c4961f62c484f0dd62dd4f1b3cd6a09675c438811dd8a1c2bda702e345897c0bf466e3d942ab425b525ac847ad1f06a032566243c5c67acf7305699a4d484ec9556588d8d318705fe3ed5ac766106882a06fb683b7f909c6f006cf9958e0fbc15e11d47d1c619ae43cf3b337f57f171dd5a0e49bff38b1d6bccd125fbc3589c2db48304716177b2eaa33f382b119a70cea92a08fdabae4c3cf8e210449079f952020d4eb1c2ca0f36c80451c4abce24f5c5075a0a9745e1d44ec68451f48aeb2304faf7c5759440295f5ef34b8fddf3435da69d3a089da4ea31076be1666c3840623273028c25c4c10606954178de5ca41ef869570a09b923826ec35fcf75c5ef76b68455b61bca795627bf19dc21a1356ee5e6dbfaa80", - "0xf90211a04c30a9bae4b0a847dc7eaab9646a954f157ca541f9bc20a2699dcad4ea39495aa00ac62ca4315ae8488c14eefc84fa58d42457548fc74d99de23369ace726e131ea0b188a5295a3ecd61b5a6f3c63e04f04eebfc305e461cb69b8f403db6ac0f252ba05f5ad0422cf210144958d7f805bd063ffc493e244fa23178955de1a1533890e9a0940e7fb8ffffc0cb07585611ead0dff8e2149889e428dfea4b2a1ae8fe4e3a0aa0bdbc3b4efdec9fccc361565f585de577bd3ea69d85db5e0afad2120602d72cc6a0b4d3587726c46c76d1216394c68fc9d00f89b15232c11705b406678d66dac770a0d82410a1d9d575385ca31fa1f49a2881c17a832f60661fde5d0444838a8965bda04bed067a4622c6702696d0c0d1c214f4f878178e2d4591bcdcc23264478d573ca0d6bb49603573e1868867fd87da2c53a49f275af765235596ac8ebf988b215b77a04b5dccd49f87c51d625cf1171d38dc9a12d5ff9321f6bb0389ef90b00f374e01a0d49c2f6c864272ccbc386c9505095a4fe3183694d7d445177344579815cdfd1ba06e4d5b4ece3c645bb08354ac92dec80bfda4217f594c768f1884aee914d808cda0a351cd1aed394dbdc87af2e5739db3ef82ffc55817a2c75b466a24a4337ed51fa0274efbf978d963c81b092f09807415babc0aba6a84837a9e3d0925d0663e9fe0a042540cb99124dbfeebfc83c1e6619df14a1bd05b83eda43c78c8938b5aec974a80", - "0xf90211a009151c652c6033ed9bbf10f9b8cc92788161db838b0bbb3851758303d56c04bfa0f6e737ff8648796d8d0e61721097f4a734189ccb053611fddcdfc6082ff3b8daa0a78dff9ff703df6b9f5754a80618bb651ac8f43d8d245cdf94e4fa01219c2b19a0d4e31da90f7bdbc5145f9a1396e66881235bbb70ca1158a449d8e0f008c56baaa07f53b174b9745634dd8410453db102a93cac22dbece0d0b00ffe9746fa6f8b9ea008ac4c9378d796469b408871f59ed464f5ff75ed4c63046d41ecf77dd2f309a1a021f118eb9d5c076a1f1079a2a6a2ebd45583b62d61d0dd2bf33947b3604962f7a07212c0c11e2dff67b7e1e372e36ae4b941ee74d05ac7fecf9ad608fd3e72e389a0d5351782e4bfca69910662bba03cdbdd5c69f07983ad980bea997632752ea6e5a04abde0b28829e68d738c2b6d6b92c939c050815c1abaf9a3e07a067ae1b6a89da01f5ecd014200d9f24155dbd5a658ccd534a48fd5e044f8042e5c968b3d9b1637a026353b9c7efb7d2e6c13291b514c93328e8daa9be1d6ddebe4e640c829d9b608a092863051e97ef0cca3f71c2ac37c7a3e297086c9d3acc8ea92a093131c11398fa04e12d34e3a51deff3eb16a5559a22f5d5767bb6488be5a92641bdf484f3d7125a0ab6819bca2911769da8ae3e2778eac229c3ab8aa8d6ee118df4bde6cb805bc68a0341550174c2b4ec5209cb57f8f4efbf83dc6d3902ba5dbbdc40977cb2a0b9a6b80", - "0xf90131a0b9bb974d9f0c0b72e6f82bbba279a6dbf5417860c21e6c9b193449af827b2ee2a082fc00e412f32e7be2ffbcd9c69835a70edb9a0c7bda8a622755f4a4a06ed259a07cdf188d265dc5b17e2d7070119c2407c522c8a9764e1a5318f6cb83abc2846aa076d8821b547c17586a14d1af0c0a605a6055870b23f670c86f7aba48a3e2fe40a0cd7b5724b56b7c50e6eaf23ec6314bf7772ca4ddb2e507b8ab8965a866543a3fa0306d757f7296570e83f891acd290fc0ed40e8cfe793b8eb415ee99ce342fea9380a00291ae87d7d705bd63043153313633ac6178985b4b53ccbf2353577e1b812191808080a0e5363f3a95924328352eb99d7a16a117d02f56df31ccacdb18d8e3231a2493568080a0803af6c7b851feb5ce95de1ad1f20a193aaf22180344bd52bafd6be172fbcb5b8080", - "0xf871a09177bc78872a9ff2e8aa0e60002516da752f746828a665f2aa73a217ee592523a013f59ff275fc403befe5f9f0ca98fc1c9a9e579e44dbc5bce71ede5a56eeead680808080808080a0026588aab189b285b432acf2f328c0fe8acb9b24c40de8f08281633fa5683f2b80808080808080", - "0xf86f9e310403e42f940f8a79d1ae23fe101b749f4ddba42b8fea1d7b30d32ad00eb84ef84c01880e92596fd6290000a012726ac82684c1d2af1ce5fbd4248303770f1c322d0363bdc99f78a6ca746493a018e64869905158477a607a68e9c0074d78f56a9dd5665a5254f456f89d5be398" + "0xf90211a0d0041802b39b0d8bd4378870fa197e5003b421ac2bc80584948b3b60b5494fcba06322ab1446b2e05a586551002aca2a54e69e2e43d39f5b7b6f70afb480a64b4ca0b4882ba72df3c3d1b7ca77b564ec48dbf4ab5a92a50d68defd661be4d7878a33a00bb6eac3bdca095e582ba5da8b2be578f80342f2c6a01f2042b1ccc60b85abbea09109537ad73d5b8f008b732bc534b15cd2236e6b766a50d8c618e66270fde61fa02e77b7a5fd2d67c43aa3ab8ff34210223a33a09b8a7edbded1c3c631092e66aba051581e21dcea914f421eeed20d2077a64378c49afac44d7e68cadc37e381ea25a0da5a4c2ac0ab47dfbe886e015a72f374f31d1e7eae477a7a9d6165b29cf8c96ca0126132bfe5dd60bd3bca3d38cb58f1c873f4e10b18ecb3edbeadb6a9e3c649e1a0625f574e3a0e5c5ef39d154b41d51a655501f6cb6b75478e75548ed80fc77cd6a06cc1bf23c495e44a53028fa80a3ff456dee8ac834d7e206402e1b4b10fca523da0a5193530b3367a31bdaef12b0d5c335de05b875ae8115789f02e1f3a9f4f8b29a0a0036923d8d622eb6d7d7074b06fb8560d65ee988bc9d3dfddd6e20108bc01bca0ecbc61e03b4a37cc986d554ff6e2bf3cb900d928172f16a0baeb3ca3b15567c7a01d8386e911112eced18f14c29a46e4ee7615310edecfc571189c2d1e69db9907a0faa4de346fd2ac4ec484486721bf616790ff4e78f8c7d278a82ce926c2004ca280", + "0xf90211a08d0d30992008df5380950d4a30bcb85fe4b5eeb5e9d47555c90ca2234c8fae28a09a302760d70f3f2fa0c734f158d450f923c60578c0d529f0d549d706c477bc11a0762865973e46fe93a0a685d314e44f2ab84cc59b492842450c36fa397fd62469a0de35caac9820b0794cf37106feb3bdb0ad7f5e2215827d37a41acea831d04a16a09f98e10d34e06fb1781b872e39c31340d4ffcb3d910008e8b51354eb6601fa11a0a2febd9de2b468d25b1ec2637ea3d39e91cd29bc3601bbb6fa34b0b9cb63e415a0f380f3c2b51b87f2b5e4286b3fcb16ff74e351518eb92a576948cb063821ba59a0a44e858b9a24c4f135a0f6a3abadcb22db4bd7a1078b0517ecb265a2851a6aeba0ae5e6314da5f1606c9645357f1386f0c9ce7c48d2eeb98ec13cda7221575158ea05727b21aa0b265667cbbdeb748a7cbd97f314b77264f10a9e69b371c48e65122a0141f1557dd2463e0c9543b33a232e48fd38480f71103c181f89c489cd1a8f8bfa0543d1abb6740c1b8a32d673dd3eb8f820acf19d474a90d6ed4882466388ce4f7a0e2414ea84085dd02f8ef08affca0176efe7441c7a2a621d764500fb2384f9780a08e6d9f028885ab7b4b89bcb301c9b063d7090428187b8b7f4863b0b700ba549ca097d06d96cda5e4c4b5751f84265e7dd2658877e617b83aaf5d03f19c6ad221b4a0e59cfab2feab060e26dc24f1028b391ddbd29ba95839f6b4daf15fe95c30b00b80", + "0xf90211a07141c17f9fa7951761d2bb4fd14657ee63c26fcac0f453edcc40b53077b8cb49a02b1ca5efd39e8a92c786d47afb8cfd3779be68c944e9801bc7ba4c929d85344da01d1283ee9b93563a4c902fcaa91b650f7e4f03b8a4ed17573f1579787ff61b80a0ae1a099c4db1b5200630a8c28e8f45e6c4f4225621d58731f741d33be08f66d2a017d364fed382f188095309fdc368673de02d2da42bc5a2359d6511165011ba43a0730866177275ebb899cb4ab75b14a88aadf750449dd31a2c08ad7e13b783be8aa093ef04e32e63ac2a0cde09ad847e6173b85237978859b2128efd43c5812540c7a0c84f94a4c4e3ea68de7100e4b28fe4dfb2e54047adb6a49badd774a10f24543aa0a0e318859f0a2607fc274087ac0429602dc4bceca9a607ba37ee49e3a231dda2a0a411c30ed2e578256d2e446418216b8f590ab5e5e55e220c0d468dce23e1f761a05b780600a7bd74ea0327bcabcd6c43e2f2d025451850dbf362ddbd3f22729ae4a09e95eb773b6f31faad66dc56e3bfe287e4ee69ece42a3b7f30fde8b036e3bbaca0c84c78fd76cb13e9c5a087f1f1044ceb746831831d7476b17194f7f57c239b5fa0b4a5b67caf37da52aaf4ef490874f790e37f9a6e9aea1fa473ace0c91c8ec325a09e6487086f9452e35b966b84ea5434580580004d54914716b9194263d3ec0802a0d65313ba3300ad622207f36a1241ac74e7b18d30b814c7074cd1c932caaeacfa80", + "0xf901b1a02691bcd5e32c39f4f36d5b6b03f091948eb9ca3df225ddad93eb31b8497e4c1aa08e5e2cd65a2ec84ffbc2ae1c2066139423cfe71c351a8dd42b471faeb4c05dd6a0bc2809c3a3720f2b0fae7dea4f7efedb4327a48c151b89b090ab99dee7bdcf4aa01f28521aec2d7a50a466f88281e6e827d5509bc5a77be74f3f704fd91079442da05ed7f0cf73f299255bfc2bdf20b31a709518fb71bdcaa9fb8fd488ad07af28ae80a03ecd2de48b44e54b5b892520291fd2601ddff191ba446997f3587d51e8f68ddfa097a4d6d7f15b05d96ed7511e39aae51032fc3648c15eb4d789ce8916f79a78a180a0bb081130c535bc8a46528bae3596200eb99d0b99bde40ad12b624e2466c7757ba0296c2142079e1c5b73bd703978eaa04e3b9123a240f7bc046a9cb701fd064435a04c35b4967661e70f5068aa326f3599c7393498e1b082b8b26062f98ffbb2e8f4a023d8b0cdfc5807cf338a56b1260118129ce2d1080dca624d02c1e7a44ef7255fa068665baa882f2e62da7897273881f510f3768c3d9878efdf097085ef3f0b5ac480a0d4524fcdca73a594f45be8e41613995cdd8bd38512c6932f04f6d6787ca4856380", + "0xf87180a05da0431ddcf9c0df5220e90991d6fafadcbb70ec9e51c042a743f4d1980df7c4a05e856a872504286cb6dbb11c85fab4ca263a72cbee0a785053fbbb4f2d6078738080808080a09922b3a2aac38c7bd2332ec05abd047f2fb7858f2d2ae4f6c49bce18b73eae948080808080808080", + "0xf8679e3860ace08b3156e1e8b3657a41748919bc942fd9e0f3de90d72f6e5bdfc3b846f8440180a0ee67942d4ba6f187e143ee4568896cf8db17df6298d91961b468176ef9e6ba0ba029140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1" ], - "address": "0xfea298b288d232a256ae0ad5941e5c890b1db691", - "balance": "0xe92596fd6290000", - "codeHash": "0x18e64869905158477a607a68e9c0074d78f56a9dd5665a5254f456f89d5be398", + "address": "0x5f51e413581dd76759e9eed51e63d14c8d1379c8", + "balance": "0x0", + "codeHash": "0x29140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1", "nonce": "0x1", - "storageHash": "0x12726ac82684c1d2af1ce5fbd4248303770f1c322d0363bdc99f78a6ca746493", + "storageHash": "0xee67942d4ba6f187e143ee4568896cf8db17df6298d91961b468176ef9e6ba0b", "storageProof": [ { "key": "0x0", "proof": [ - "0xf90211a0f83ba7c7041f00cc9a57d71422849ff304d969cbacb2111ec780c5e12c36cd97a085202daea26e230d442fb8b5c23b7f53360793438e88b37a1431605766c1766fa0998815bad877b238eb5e7515c28f775c6b9adc1f280dafebcfb14d5f75817093a00473a0971c98d903639bafc15c44c73f66887dc021189f8b079215688e8760f4a034e104914af1e4dcf07bb7d3eff58234fe7a24efc72d203f57a40b6c8947ccaba00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa024895232bf64ebae7aab895527e3f0e5da56dac14a0f0773a35802755c94b461a0a44272f59b6d76efa96d0332aef23002b31bf59c3f129d7adb1ef308b2d75f8ba07169965461e24e0573e7050b3087c6f01be8c293cc3382e033b602354fb2b039a0845dd889159d74c79901ae5d4018c03da5e3ffd814b1b30ab998a75796413584a04c403d9870c899a15fd6a91a77a432d026eab88d0156d7ecbe25dc960d2c4e23a02ae6a1a3aaf41586ce87878c5e45a7400370075cf08b41c1eefd64e78ea6503ea0e8f4d4a796a5f7eada01303cdf9168fd40d4d83a252394487433a5aa609a9f75a01d8b2a194aeacedef6268d6bf81d351fd0e2177ae007c5201ff7c10e9716d5c4a0659f7329087fdc36fbfd7926e2cfab1a21ded9670c048680f9d6d30ddc80eb09a01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf8d1a00630b605c0d15203bf5736e4d5b367d62b23c434892fb2c8ce1b7730c9fb96a98080808080a05c319d731d2d714368b54e3a9d841630b2592c7afc92ffe28a15225a639bd868a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a081b7693d9ef9dea4b83b27e12fd4a86cfd861c266865545c3602ec6a1e43039da0bf73b8437dc32850158814b8c0c28c9c76a22c373fa84a77c3fc2175317a6aa18080a0bd01265657739e1793ae1ad68a77f330e98f0d5d5a53235211faa848c3eea787808080", - "0xe2a0200decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56305" + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8d1a0f881becd1a54ec2ac129979fbb7cc851f4245d372d588056b040ccae152793e88080a028b34037d7d67765fa1cd15091337086eacdd8770b711a026d4ee0a839f8b3f2808080a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a0c9c743682962d9d06dd0f9ed6cb2620cce02f34a0a4f5d60a4e5d1e081a5b5fba0bf73b8437dc32850158814b8c0c28c9c76a22c373fa84a77c3fc2175317a6aa18080a0bd01265657739e1793ae1ad68a77f330e98f0d5d5a53235211faa848c3eea787808080", + "0xe2a0200decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56307" ], - "value": "0x5" + "value": "0x7" }, { "key": "0x1", "proof": [ - "0xf90211a0f83ba7c7041f00cc9a57d71422849ff304d969cbacb2111ec780c5e12c36cd97a085202daea26e230d442fb8b5c23b7f53360793438e88b37a1431605766c1766fa0998815bad877b238eb5e7515c28f775c6b9adc1f280dafebcfb14d5f75817093a00473a0971c98d903639bafc15c44c73f66887dc021189f8b079215688e8760f4a034e104914af1e4dcf07bb7d3eff58234fe7a24efc72d203f57a40b6c8947ccaba00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa024895232bf64ebae7aab895527e3f0e5da56dac14a0f0773a35802755c94b461a0a44272f59b6d76efa96d0332aef23002b31bf59c3f129d7adb1ef308b2d75f8ba07169965461e24e0573e7050b3087c6f01be8c293cc3382e033b602354fb2b039a0845dd889159d74c79901ae5d4018c03da5e3ffd814b1b30ab998a75796413584a04c403d9870c899a15fd6a91a77a432d026eab88d0156d7ecbe25dc960d2c4e23a02ae6a1a3aaf41586ce87878c5e45a7400370075cf08b41c1eefd64e78ea6503ea0e8f4d4a796a5f7eada01303cdf9168fd40d4d83a252394487433a5aa609a9f75a01d8b2a194aeacedef6268d6bf81d351fd0e2177ae007c5201ff7c10e9716d5c4a0659f7329087fdc36fbfd7926e2cfab1a21ded9670c048680f9d6d30ddc80eb09a01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf89180a03620059c5c478951a24d4c4310bd495d89eaf527ce1601a0109ad43402e93acf808080808080808080a0795697adb61728dfeff04aa6a5f3524da1397e77ad14dfa4648e1937163a267080a00e79eee6286d4b2dea5800c6bcef87fd4c67d92d5cf3da96b469baae1faa4ea1a0e96af414d3c47b2731b29595e48bac8943396d9074ebb97ad7c07eb8567d98cc8080", - "0xf843a0200e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6a1a0a551fe03f855370f0fca881f5f2f6b8f7731a92e371c4de5f5c610833881059c" + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf85180a0fb829ab79f00d7bab5aa54e5cfd67ae721eaf17d076bca3984477a72b5391c92808080808080808080808080a0f7fc12e7aa12b24609029780c05d852e0ddb7e1eceaf8671a2e2d3c1aa7bd8068080", + "0xf843a0200e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6a1a067c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea" ], - "value": "0xa551fe03f855370f0fca881f5f2f6b8f7731a92e371c4de5f5c610833881059c" + "value": "0x67c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea" }, { "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e567", "proof": [ - "0xf90211a0f83ba7c7041f00cc9a57d71422849ff304d969cbacb2111ec780c5e12c36cd97a085202daea26e230d442fb8b5c23b7f53360793438e88b37a1431605766c1766fa0998815bad877b238eb5e7515c28f775c6b9adc1f280dafebcfb14d5f75817093a00473a0971c98d903639bafc15c44c73f66887dc021189f8b079215688e8760f4a034e104914af1e4dcf07bb7d3eff58234fe7a24efc72d203f57a40b6c8947ccaba00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa024895232bf64ebae7aab895527e3f0e5da56dac14a0f0773a35802755c94b461a0a44272f59b6d76efa96d0332aef23002b31bf59c3f129d7adb1ef308b2d75f8ba07169965461e24e0573e7050b3087c6f01be8c293cc3382e033b602354fb2b039a0845dd889159d74c79901ae5d4018c03da5e3ffd814b1b30ab998a75796413584a04c403d9870c899a15fd6a91a77a432d026eab88d0156d7ecbe25dc960d2c4e23a02ae6a1a3aaf41586ce87878c5e45a7400370075cf08b41c1eefd64e78ea6503ea0e8f4d4a796a5f7eada01303cdf9168fd40d4d83a252394487433a5aa609a9f75a01d8b2a194aeacedef6268d6bf81d351fd0e2177ae007c5201ff7c10e9716d5c4a0659f7329087fdc36fbfd7926e2cfab1a21ded9670c048680f9d6d30ddc80eb09a01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf851a02422ff9734840a59b1aac5f7e633a0c167a45b503806ad359251d39293e7f3418080808080808080808080a087e86f8486d2a2f621f473faedf1cd6f1ed981d04c6dcf40b09e2d0575ca2aee80808080", - "0xf843a020418048a637d1641c6d732dd38174732bbf7b47a1cf6d5f65895384518b07d9a1a0e78f63f744ad929e2e8e5a56a2ece1910e2746468a4dded5051816b2c7f17cb1" + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf891a031b20905ab02dba97c5a82079a50550a5a70d3f5e7f25cfe6c9e88b1c3768ae8808080808080a01b7ed3dd208fb30e8581d7e5278fb4581b99f960be8d08ff41759b10b537dfe080808080a03b77164a66693f214b5328da08b60566b0aeae3d719121004ed8c6d6e49ca5e580a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", + "0xf843a020418048a637d1641c6d732dd38174732bbf7b47a1cf6d5f65895384518b07d9a1a02b80cb1b568146d64e7a622d7b895925d06ef8582fa0166d8ec069f86070610a" ], - "value": "0xe78f63f744ad929e2e8e5a56a2ece1910e2746468a4dded5051816b2c7f17cb1" + "value": "0x2b80cb1b568146d64e7a622d7b895925d06ef8582fa0166d8ec069f86070610a" }, { "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56c", "proof": [ - "0xf90211a0f83ba7c7041f00cc9a57d71422849ff304d969cbacb2111ec780c5e12c36cd97a085202daea26e230d442fb8b5c23b7f53360793438e88b37a1431605766c1766fa0998815bad877b238eb5e7515c28f775c6b9adc1f280dafebcfb14d5f75817093a00473a0971c98d903639bafc15c44c73f66887dc021189f8b079215688e8760f4a034e104914af1e4dcf07bb7d3eff58234fe7a24efc72d203f57a40b6c8947ccaba00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa024895232bf64ebae7aab895527e3f0e5da56dac14a0f0773a35802755c94b461a0a44272f59b6d76efa96d0332aef23002b31bf59c3f129d7adb1ef308b2d75f8ba07169965461e24e0573e7050b3087c6f01be8c293cc3382e033b602354fb2b039a0845dd889159d74c79901ae5d4018c03da5e3ffd814b1b30ab998a75796413584a04c403d9870c899a15fd6a91a77a432d026eab88d0156d7ecbe25dc960d2c4e23a02ae6a1a3aaf41586ce87878c5e45a7400370075cf08b41c1eefd64e78ea6503ea0e8f4d4a796a5f7eada01303cdf9168fd40d4d83a252394487433a5aa609a9f75a01d8b2a194aeacedef6268d6bf81d351fd0e2177ae007c5201ff7c10e9716d5c4a0659f7329087fdc36fbfd7926e2cfab1a21ded9670c048680f9d6d30ddc80eb09a01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf8918080808080a0a26c5f90f028898be4e12961969ae89f323a66586730f92b8fb2dd1ca0ba6f8a808080a04a0c4b948805886065449dad60fce7e1c7680a3bc4a235800fbd2edafac731e680a02067fa4bd77ffa67e6f84087f7534dd698190510064fa3c8d293f1bd531d092c80a06e763d18b94e23071c9cb26aa6ea0f34fd80f21f38c27cb494b12dc6fc3656eb808080", - "0xf843a0205fcc8f73196524ea5f04c38888c2f09c6cbef411cb31e259d35b56e3d0047ba1a075ee6ff4c60116898485089c7511cd927ac0797976b96bb3bf4e829606696257" + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8f18080a03c79db405090818f0b5b51e29d2ac7b67f6ff814b03e773af1975584a0dd1f908080a0a26c5f90f028898be4e12961969ae89f323a66586730f92b8fb2dd1ca0ba6f8a80a078c9aaa17553d7357d2014c0a75c9de51fdab46248846ddf03ea16d8cb790b0e80a04a0c4b948805886065449dad60fce7e1c7680a3bc4a235800fbd2edafac731e680a0c50523b8a14aff442da2ba7343c04f960e59083796de9ba7fcbbd592959515f180a0df910adad94453538847b694bdb134432b0a9e2cc829dce2346460720fd2ee5380a06e1a723ced013021ff250a9fdd129c3a7c1aa3970d955cd28688dbdff277174880", + "0xf843a0205fcc8f73196524ea5f04c38888c2f09c6cbef411cb31e259d35b56e3d0047ba1a00c2f5e53902cca915645c2f00ae6a6357ce4aafa18140db4be24d33f41709b6e" ], - "value": "0x75ee6ff4c60116898485089c7511cd927ac0797976b96bb3bf4e829606696257" + "value": "0xc2f5e53902cca915645c2f00ae6a6357ce4aafa18140db4be24d33f41709b6e" }, { "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e571", "proof": [ - "0xf90211a0f83ba7c7041f00cc9a57d71422849ff304d969cbacb2111ec780c5e12c36cd97a085202daea26e230d442fb8b5c23b7f53360793438e88b37a1431605766c1766fa0998815bad877b238eb5e7515c28f775c6b9adc1f280dafebcfb14d5f75817093a00473a0971c98d903639bafc15c44c73f66887dc021189f8b079215688e8760f4a034e104914af1e4dcf07bb7d3eff58234fe7a24efc72d203f57a40b6c8947ccaba00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa024895232bf64ebae7aab895527e3f0e5da56dac14a0f0773a35802755c94b461a0a44272f59b6d76efa96d0332aef23002b31bf59c3f129d7adb1ef308b2d75f8ba07169965461e24e0573e7050b3087c6f01be8c293cc3382e033b602354fb2b039a0845dd889159d74c79901ae5d4018c03da5e3ffd814b1b30ab998a75796413584a04c403d9870c899a15fd6a91a77a432d026eab88d0156d7ecbe25dc960d2c4e23a02ae6a1a3aaf41586ce87878c5e45a7400370075cf08b41c1eefd64e78ea6503ea0e8f4d4a796a5f7eada01303cdf9168fd40d4d83a252394487433a5aa609a9f75a01d8b2a194aeacedef6268d6bf81d351fd0e2177ae007c5201ff7c10e9716d5c4a0659f7329087fdc36fbfd7926e2cfab1a21ded9670c048680f9d6d30ddc80eb09a01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf891a09b482d8c7d5b5fd462d97aab641a4f0ed369df9bebb680477464629ddf482c0a8080a0dd47825627994f367c57228c1c56550557729d2c58a02417850b27865e3beba68080a0bd2bd91e446ae22e6dca05aa746d3fa6a4e4660af363301534d1d6ee13cf6b41808080a04a5be21f4f0c0f5e1fcccb140e7cb5b1ff2ce45bce977d8e23cc7320e8c7bdd0808080808080", - "0xf843a0206695c256a4a4a1b8ed004dc824e330f1747032632c0e6d88c1d84c330c1c5ca1a00cd0c844682507c091d2e6c6713e11eb43edf24348a85e1666db47c8ab6bd2c9" + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8b1a0f3ab6aa3f0575916e985798d7ee01e8c75436765f043cdfba2ad10f36b47f6d48080a069a129011ab4666f131c1bdac7d923dcbb6f1047057a62d6ecede5d17057658280a064bde28657cfaa21b487ad660da11e94a06a1b7f46502263094cde0407dfd24380808080a04a5be21f4f0c0f5e1fcccb140e7cb5b1ff2ce45bce977d8e23cc7320e8c7bdd080a015cb29fd7064f1cbac8773177854799e563e10ba66e44c5adf25b31fa39a7d3980808080", + "0xf843a0206695c256a4a4a1b8ed004dc824e330f1747032632c0e6d88c1d84c330c1c5ca1a098d7a1f953e0805e2053a6ab062f8a16f1d35b9fc7bad41fd10eece87cc1b280" ], - "value": "0xcd0c844682507c091d2e6c6713e11eb43edf24348a85e1666db47c8ab6bd2c9" + "value": "0x98d7a1f953e0805e2053a6ab062f8a16f1d35b9fc7bad41fd10eece87cc1b280" }, { "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e576", "proof": [ - "0xf90211a0f83ba7c7041f00cc9a57d71422849ff304d969cbacb2111ec780c5e12c36cd97a085202daea26e230d442fb8b5c23b7f53360793438e88b37a1431605766c1766fa0998815bad877b238eb5e7515c28f775c6b9adc1f280dafebcfb14d5f75817093a00473a0971c98d903639bafc15c44c73f66887dc021189f8b079215688e8760f4a034e104914af1e4dcf07bb7d3eff58234fe7a24efc72d203f57a40b6c8947ccaba00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa024895232bf64ebae7aab895527e3f0e5da56dac14a0f0773a35802755c94b461a0a44272f59b6d76efa96d0332aef23002b31bf59c3f129d7adb1ef308b2d75f8ba07169965461e24e0573e7050b3087c6f01be8c293cc3382e033b602354fb2b039a0845dd889159d74c79901ae5d4018c03da5e3ffd814b1b30ab998a75796413584a04c403d9870c899a15fd6a91a77a432d026eab88d0156d7ecbe25dc960d2c4e23a02ae6a1a3aaf41586ce87878c5e45a7400370075cf08b41c1eefd64e78ea6503ea0e8f4d4a796a5f7eada01303cdf9168fd40d4d83a252394487433a5aa609a9f75a01d8b2a194aeacedef6268d6bf81d351fd0e2177ae007c5201ff7c10e9716d5c4a0659f7329087fdc36fbfd7926e2cfab1a21ded9670c048680f9d6d30ddc80eb09a01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf89180a03620059c5c478951a24d4c4310bd495d89eaf527ce1601a0109ad43402e93acf808080808080808080a0795697adb61728dfeff04aa6a5f3524da1397e77ad14dfa4648e1937163a267080a00e79eee6286d4b2dea5800c6bcef87fd4c67d92d5cf3da96b469baae1faa4ea1a0e96af414d3c47b2731b29595e48bac8943396d9074ebb97ad7c07eb8567d98cc8080", - "0xf8518080a0203ef1918968ae19be582bd9104de7a1db340bf95e8cfd960f94e9c15d6f8782808080a08b3d5373dc61f8d7985657e68bf37c2203d37db3923097399eeca34e740206cb80808080808080808080", - "0xf8429f357165ee8c7eae64faf81e97823d50dba1b6a2be88bccea1ac5d01256f0590a1a06783698b37cf52b13768c0e92c978fcb6cc1b37bd8132dc8debde83f5e0da7ec" + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf85180a0fb829ab79f00d7bab5aa54e5cfd67ae721eaf17d076bca3984477a72b5391c92808080808080808080808080a0f7fc12e7aa12b24609029780c05d852e0ddb7e1eceaf8671a2e2d3c1aa7bd8068080", + "0xf843a020257165ee8c7eae64faf81e97823d50dba1b6a2be88bccea1ac5d01256f0590a1a079c63d2302907690c944fa45f7405ac59b364089f366764025f13f2055511b43" ], - "value": "0x6783698b37cf52b13768c0e92c978fcb6cc1b37bd8132dc8debde83f5e0da7ec" + "value": "0x79c63d2302907690c944fa45f7405ac59b364089f366764025f13f2055511b43" }, { "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e57b", "proof": [ - "0xf90211a0f83ba7c7041f00cc9a57d71422849ff304d969cbacb2111ec780c5e12c36cd97a085202daea26e230d442fb8b5c23b7f53360793438e88b37a1431605766c1766fa0998815bad877b238eb5e7515c28f775c6b9adc1f280dafebcfb14d5f75817093a00473a0971c98d903639bafc15c44c73f66887dc021189f8b079215688e8760f4a034e104914af1e4dcf07bb7d3eff58234fe7a24efc72d203f57a40b6c8947ccaba00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa024895232bf64ebae7aab895527e3f0e5da56dac14a0f0773a35802755c94b461a0a44272f59b6d76efa96d0332aef23002b31bf59c3f129d7adb1ef308b2d75f8ba07169965461e24e0573e7050b3087c6f01be8c293cc3382e033b602354fb2b039a0845dd889159d74c79901ae5d4018c03da5e3ffd814b1b30ab998a75796413584a04c403d9870c899a15fd6a91a77a432d026eab88d0156d7ecbe25dc960d2c4e23a02ae6a1a3aaf41586ce87878c5e45a7400370075cf08b41c1eefd64e78ea6503ea0e8f4d4a796a5f7eada01303cdf9168fd40d4d83a252394487433a5aa609a9f75a01d8b2a194aeacedef6268d6bf81d351fd0e2177ae007c5201ff7c10e9716d5c4a0659f7329087fdc36fbfd7926e2cfab1a21ded9670c048680f9d6d30ddc80eb09a01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf851a02422ff9734840a59b1aac5f7e633a0c167a45b503806ad359251d39293e7f3418080808080808080808080a087e86f8486d2a2f621f473faedf1cd6f1ed981d04c6dcf40b09e2d0575ca2aee80808080", - "0xf843a0204d807394a26a5623e844d859daa1940d13cb7bda091582294562d688f4de00a1a07fcf0ee638cfa8d38823d3a3b0616e71ff9c70e39918c31b22361b605dbbf3c2" + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf891a031b20905ab02dba97c5a82079a50550a5a70d3f5e7f25cfe6c9e88b1c3768ae8808080808080a01b7ed3dd208fb30e8581d7e5278fb4581b99f960be8d08ff41759b10b537dfe080808080a03b77164a66693f214b5328da08b60566b0aeae3d719121004ed8c6d6e49ca5e580a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", + "0xf85180808080a0fe0a1c808c8e90225d5dcfad8bde23daee522b2905b605bc6eb5c39596018464808080808080808080a04083c8127572e64ae53476470e7a632258565a37b7f2066cb22ef228e679c24e8080", + "0xf8429f3d807394a26a5623e844d859daa1940d13cb7bda091582294562d688f4de00a1a0a7b2aa99ebb2a9e076a84dfd43cc1355ca060aea5b8bb1f1ee825e131125e462" + ], + "value": "0xa7b2aa99ebb2a9e076a84dfd43cc1355ca060aea5b8bb1f1ee825e131125e462" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e580", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8d1a0f881becd1a54ec2ac129979fbb7cc851f4245d372d588056b040ccae152793e88080a028b34037d7d67765fa1cd15091337086eacdd8770b711a026d4ee0a839f8b3f2808080a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a0c9c743682962d9d06dd0f9ed6cb2620cce02f34a0a4f5d60a4e5d1e081a5b5fba0bf73b8437dc32850158814b8c0c28c9c76a22c373fa84a77c3fc2175317a6aa18080a0bd01265657739e1793ae1ad68a77f330e98f0d5d5a53235211faa848c3eea787808080", + "0xf843a0202f0f7a7af9ed4f160d1c425f37d148d10bddb9c828e99d4145b150485711cea1a0ac8d18ba63b2e8486a3c5bd9915b9335d0df0862e5601476fadf568443a8cca0" ], - "value": "0x7fcf0ee638cfa8d38823d3a3b0616e71ff9c70e39918c31b22361b605dbbf3c2" + "value": "0xac8d18ba63b2e8486a3c5bd9915b9335d0df0862e5601476fadf568443a8cca0" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e585", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8f18080a03c79db405090818f0b5b51e29d2ac7b67f6ff814b03e773af1975584a0dd1f908080a0a26c5f90f028898be4e12961969ae89f323a66586730f92b8fb2dd1ca0ba6f8a80a078c9aaa17553d7357d2014c0a75c9de51fdab46248846ddf03ea16d8cb790b0e80a04a0c4b948805886065449dad60fce7e1c7680a3bc4a235800fbd2edafac731e680a0c50523b8a14aff442da2ba7343c04f960e59083796de9ba7fcbbd592959515f180a0df910adad94453538847b694bdb134432b0a9e2cc829dce2346460720fd2ee5380a06e1a723ced013021ff250a9fdd129c3a7c1aa3970d955cd28688dbdff277174880", + "0xf843a0207c73e826b7dd131777470492494a9f14b451e947ae119760ac27c5aac4422ca1a01fae1104ad418c61c2e19407f6151fa634431da77d15469ffd1b993986fccc59" + ], + "value": "0x1fae1104ad418c61c2e19407f6151fa634431da77d15469ffd1b993986fccc59" } ] } - } + }, + "signatures": [ + { + "blockHash": "0xb1ca57784055c67d58cf76924355e0ff2324237769efdcdb2cea6824896cb0a2", + "block": 2276348, + "r": "0x67ba22ce31bf6c6e06b55109e5cbe67633ba20c7275b89fa93819fde744e1c69", + "s": "0x46a77396374f817acac3ae0bfde5b3efbdfa33fd0e72516176e60dae8a1dc41b", + "v": 28, + "msgHash": "0x4e242053e85d8d3ef8bae15d6efdb24af2086f5047a371830083a9fce3ab01d1" + } + ] } } } From aef4fe8157cda95712f806ce7a660e630e4c4bd7 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Mon, 9 Mar 2020 19:27:41 +0100 Subject: [PATCH 30/97] fix error-json --- wasm/src/wasm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasm/src/wasm.c b/wasm/src/wasm.c index 47a211fee..f3c96c312 100644 --- a/wasm/src/wasm.c +++ b/wasm/src/wasm.c @@ -131,7 +131,7 @@ char* EMSCRIPTEN_KEEPALIVE ctx_execute(in3_ctx_t* ctx) { p = p->required; } if (!last_waiting) { - sb_add_chars(sb, ",\"error\":\"could not find the last waiting context\""); + sb_add_chars(sb, "\"error\",\"error\":\"could not find the last waiting context\""); break; } else { ctx_handle_failable(last_waiting); From 70ec498eb6d9c14211e18ce7d3b996c945559e50 Mon Sep 17 00:00:00 2001 From: Camilo Soto Valenzuela Date: Tue, 10 Mar 2020 11:02:46 +0100 Subject: [PATCH 31/97] Enable static libscrypt --- CMakeLists.txt | 2 +- c/src/api/eth1/CMakeLists.txt | 12 - c/src/third-party/CMakeLists.txt | 4 +- c/src/third-party/libscrypt/CMakeLists.txt | 47 +++ c/src/third-party/libscrypt/LICENSE | 9 + c/src/third-party/libscrypt/Makefile | 58 +++ c/src/third-party/libscrypt/README.md | 109 +++++ c/src/third-party/libscrypt/b64.c | 313 ++++++++++++++ c/src/third-party/libscrypt/b64.h | 10 + c/src/third-party/libscrypt/crypto-mcf.c | 65 +++ .../libscrypt/crypto-scrypt-saltgen.c | 54 +++ .../libscrypt/crypto_scrypt-check.c | 105 +++++ .../libscrypt/crypto_scrypt-hash.c | 44 ++ .../libscrypt/crypto_scrypt-hexconvert.c | 35 ++ .../libscrypt/crypto_scrypt-hexconvert.h | 9 + .../libscrypt/crypto_scrypt-nosse.c | 342 +++++++++++++++ c/src/third-party/libscrypt/libscrypt.h | 77 ++++ c/src/third-party/libscrypt/libscrypt.version | 8 + c/src/third-party/libscrypt/main.c | 244 +++++++++++ c/src/third-party/libscrypt/sha256.c | 397 ++++++++++++++++++ c/src/third-party/libscrypt/sha256.h | 70 +++ c/src/third-party/libscrypt/slowequals.c | 26 ++ c/src/third-party/libscrypt/slowequals.h | 5 + c/src/third-party/libscrypt/sysendian.h | 144 +++++++ wasm/src/CMakeLists.txt | 8 +- 25 files changed, 2182 insertions(+), 15 deletions(-) create mode 100644 c/src/third-party/libscrypt/CMakeLists.txt create mode 100644 c/src/third-party/libscrypt/LICENSE create mode 100644 c/src/third-party/libscrypt/Makefile create mode 100644 c/src/third-party/libscrypt/README.md create mode 100644 c/src/third-party/libscrypt/b64.c create mode 100644 c/src/third-party/libscrypt/b64.h create mode 100644 c/src/third-party/libscrypt/crypto-mcf.c create mode 100644 c/src/third-party/libscrypt/crypto-scrypt-saltgen.c create mode 100644 c/src/third-party/libscrypt/crypto_scrypt-check.c create mode 100644 c/src/third-party/libscrypt/crypto_scrypt-hash.c create mode 100644 c/src/third-party/libscrypt/crypto_scrypt-hexconvert.c create mode 100644 c/src/third-party/libscrypt/crypto_scrypt-hexconvert.h create mode 100644 c/src/third-party/libscrypt/crypto_scrypt-nosse.c create mode 100644 c/src/third-party/libscrypt/libscrypt.h create mode 100644 c/src/third-party/libscrypt/libscrypt.version create mode 100644 c/src/third-party/libscrypt/main.c create mode 100644 c/src/third-party/libscrypt/sha256.c create mode 100644 c/src/third-party/libscrypt/sha256.h create mode 100644 c/src/third-party/libscrypt/slowequals.c create mode 100644 c/src/third-party/libscrypt/slowequals.h create mode 100644 c/src/third-party/libscrypt/sysendian.h diff --git a/CMakeLists.txt b/CMakeLists.txt index f0389e788..6d6d6de8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,7 @@ option(WASM_EMBED "embedds the wasm as base64-encoded into the js-file" ON) option(WASM_EMMALLOC "use ther smaller EMSCRIPTEN Malloc, which reduces the size about 10k, but may be a bit slower" ON) option(WASM_SYNC "intiaializes the WASM synchronisly, which allows to require and use it the same function, but this will not be supported by chrome (4k limit)" OFF) option(CODE_COVERAGE "Builds targets with code coverage instrumentation. (Requires GCC or Clang)" OFF) - +OPTION(USE_SCRYPT "if scrypt is installed, it will link dynamicly to the shared scrypt lib." ON) if (USE_PRECOMPUTED_EC) ADD_DEFINITIONS(-DUSE_PRECOMPUTED_CP=1) else() diff --git a/c/src/api/eth1/CMakeLists.txt b/c/src/api/eth1/CMakeLists.txt index 2a815d620..aeb43c92f 100644 --- a/c/src/api/eth1/CMakeLists.txt +++ b/c/src/api/eth1/CMakeLists.txt @@ -33,19 +33,7 @@ ############################################################################### include("${PROJECT_SOURCE_DIR}/c/compiler.cmake") -OPTION(USE_SCRYPT "if scrypt is installed, it will link dynamicly to the shared scrypt lib." OFF) -IF (USE_SCRYPT) - find_package(scrypt) - - if (${scrypt_FOUND}) - MESSAGE(STATUS "Found Scrypt in ${scrypt_INCLUDE_DIRS})") - include_directories(${scrypt_INCLUDE_DIRS}) - set(LIBS ${LIBS} ${scrypt_LIBRARIES}) - ADD_DEFINITIONS(-DSCRYPT) - endif() -endif() add_library(eth_api_o OBJECT eth_api.c abi.c key.c rpc_api.c ens.c ../utils/api_utils_priv.c) target_compile_definitions(eth_api_o PRIVATE -D_POSIX_C_SOURCE=199309L) - add_library(eth_api STATIC $) target_link_libraries(eth_api eth_nano in3_api_utils ${LIBS}) \ No newline at end of file diff --git a/c/src/third-party/CMakeLists.txt b/c/src/third-party/CMakeLists.txt index 201b28e26..b53ac0e1e 100644 --- a/c/src/third-party/CMakeLists.txt +++ b/c/src/third-party/CMakeLists.txt @@ -33,7 +33,9 @@ ############################################################################### add_subdirectory( crypto ) - +#if(USE_SCRYPT) + add_subdirectory( libscrypt ) +#endif() if (ETH_FULL) add_subdirectory( tommath ) endif() diff --git a/c/src/third-party/libscrypt/CMakeLists.txt b/c/src/third-party/libscrypt/CMakeLists.txt new file mode 100644 index 000000000..e2e831c20 --- /dev/null +++ b/c/src/third-party/libscrypt/CMakeLists.txt @@ -0,0 +1,47 @@ +############################################################################### +# This file is part of the Incubed project. +# Sources: https://github.com/slockit/in3-c +# +# Copyright (C) 2018-2020 slock.it GmbH, Blockchains LLC +# +# +# COMMERCIAL LICENSE USAGE +# +# Licensees holding a valid commercial license may use this file in accordance +# with the commercial license agreement provided with the Software or, alternatively, +# in accordance with the terms contained in a written agreement between you and +# slock.it GmbH/Blockchains LLC. For licensing terms and conditions or further +# information please contact slock.it at in3@slock.it. +# +# Alternatively, this file may be used under the AGPL license as follows: +# +# AGPL LICENSE USAGE +# +# This program is free software: you can redistribute it and/or modify it under the +# terms of the GNU Affero General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. +# [Permissions of this strong copyleft license are conditioned on making available +# complete source code of licensed works and modifications, which include larger +# works using a licensed work, under the same license. Copyright and license notices +# must be preserved. Contributors provide an express grant of patent rights.] +# You should have received a copy of the GNU Affero General Public License along +# with this program. If not, see . +############################################################################### +add_library(scrypt_o OBJECT + b64.c + crypto_scrypt-hexconvert.c + crypto-mcf.c + crypto_scrypt-check.c + crypto_scrypt-hash.c + crypto_scrypt-nosse.c + sha256.c + crypto_scrypt-hash.c + slowequals.c + ) +ADD_DEFINITIONS(-DSCRYPT) +target_compile_definitions(scrypt_o PRIVATE -D_POSIX_C_SOURCE=200112L) +add_library(scrypt STATIC $) \ No newline at end of file diff --git a/c/src/third-party/libscrypt/LICENSE b/c/src/third-party/libscrypt/LICENSE new file mode 100644 index 000000000..46a743175 --- /dev/null +++ b/c/src/third-party/libscrypt/LICENSE @@ -0,0 +1,9 @@ +Copyright (c) 2013, Joshua Small + All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/c/src/third-party/libscrypt/Makefile b/c/src/third-party/libscrypt/Makefile new file mode 100644 index 000000000..bb37d24a2 --- /dev/null +++ b/c/src/third-party/libscrypt/Makefile @@ -0,0 +1,58 @@ +PREFIX ?= /usr/local +LIBDIR ?= $(PREFIX)/lib +INCLUDEDIR ?= $(PREFIX)/include +MAKE_DIR ?= install -d +INSTALL_DATA ?= install + +CC?=gcc +CFLAGS?=$(CFLAGS_EXTRA) -D_FORTIFY_SOURCE=2 -fPIC +LDFLAGS?=$(LDFLAGS_EXTRA) -Wl,-soname,libscrypt.so.0 -Wl,--version-script=libscrypt.version +CFLAGS_EXTRA?=-Wl,-rpath=. -O2 -Wall -g -fstack-protector +LDFLAGS_EXTRA?=-Wl + +all: reference + +OBJS= crypto_scrypt-nosse.o sha256.o crypto-mcf.o b64.o crypto-scrypt-saltgen.o crypto_scrypt-check.o crypto_scrypt-hash.o slowequals.o + +libscrypt.so.0: $(OBJS) + $(CC) $(LDFLAGS) -shared -o libscrypt.so.0 $(OBJS) -lm -lc + ar rcs libscrypt.a $(OBJS) + +reference: libscrypt.so.0 main.o crypto_scrypt-hexconvert.o + ln -s -f libscrypt.so.0 libscrypt.so + $(CC) -o reference main.o b64.o crypto_scrypt-hexconvert.o $(CFLAGS) $(LDFLAGS_EXTRA) -L. -lscrypt + +clean: + rm -f *.o reference libscrypt.so* libscrypt.a endian.h + +check: all + LD_LIBRARY_PATH=. ./reference + +devtest: + splint crypto_scrypt-hexconvert.c + splint crypto-mcf.c crypto_scrypt-check.c crypto_scrypt-hash.c -unrecog + splint crypto-scrypt-saltgen.c +posixlib -compdef + valgrind ./reference + +asan: main.c + clang -O1 -g -fsanitize=address -fno-omit-frame-pointer *.c -o asantest + ./asantest + scan-build clang -O1 -g -fsanitize=undefined -fno-omit-frame-pointer *.c -o asantest + ./asantest + rm -f asantest + +install: libscrypt.so.0 + $(MAKE_DIR) $(DESTDIR) $(DESTDIR)$(PREFIX) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCLUDEDIR) + $(INSTALL_DATA) -pm 0755 libscrypt.so.0 $(DESTDIR)$(LIBDIR) + cd $(DESTDIR)$(LIBDIR) && ln -s -f libscrypt.so.0 $(DESTDIR)$(LIBDIR)/libscrypt.so + $(INSTALL_DATA) -pm 0644 libscrypt.h $(DESTDIR)$(INCLUDEDIR) + +install-osx: libscrypt.so.0 + $(MAKE_DIR) $(DESTDIR) $(DESTDIR)$(PREFIX) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCLUDEDIR) + $(INSTALL_DATA) -pm 0755 libscrypt.so.0 $(DESTDIR)$(LIBDIR)/libscrypt.0.dylib + cd $(DESTDIR)$(LIBDIR) && install_name_tool -id $(DESTDIR)$(LIBDIR)/libscrypt.0.dylib $(DESTDIR)$(LIBDIR)/libscrypt.0.dylib + cd $(DESTDIR)$(LIBDIR) && ln -s -f libscrypt.0.dylib $(DESTDIR)$(LIBDIR)/libscrypt.dylib + $(INSTALL_DATA) -pm 0644 libscrypt.h $(DESTDIR)$(INCLUDEDIR) + +install-static: libscrypt.a + $(INSTALL_DATA) -pm 0644 libscrypt.a $(DESTDIR)$(LIBDIR) diff --git a/c/src/third-party/libscrypt/README.md b/c/src/third-party/libscrypt/README.md new file mode 100644 index 000000000..05c893b14 --- /dev/null +++ b/c/src/third-party/libscrypt/README.md @@ -0,0 +1,109 @@ +libscrypt +========= +Linux scrypt shared library. + +Full credit to algorithm designer and example code from Colin Percival here: +http://www.tarsnap.com/scrypt.html + +Utilises BASE64 encoding library from ISC. + +Official project page, including stable tarballs found here: +http://www.lolware.net/libscrypt.html + +Simple hashing interface + +The (reference) internal hashing function can be directly called as follows: + + int libscrypt_scrypt(const uint8_t *passwd, size_t passwdlen, + const uint8_t *salt, size_t saltlen, uint64_t N, uint32_t r, + uint32_t p, /*@out@*/ uint8_t *buf, size_t buflen); + +Libscrypt's easier to use interface wraps this up to deal with the salt and produce BASE64 output as so: + + int libscrypt_hash(char *dst, char *passphrase, uint32_t N, uint8_t r, uint8_t p); + +Sane constants have been created for N, r and p so you can create a hash like this: + + libscrypt_hash(outbuf, "My cats's breath smells like cat food", SCRYPT_N, SCRYPT_r, SCRYPT_p); + +This function sets errno as required for any error conditions. + +Output stored in "outbuf" is stored in a standardised MCF form, which means includes the randomly created, 128 bit salt, all N, r and p values, and a BASE64 encoded version of the hash. The entire MCF can be stored in a database, and compared for use as below: + + retval = libscrypt_check(mcf, "pleasefailme"); + retval < 0 error + retval = 0 password incorrect + retval > 0 pass + +mcf should be defined as at least SCRYPT_MCF_LEN in size. + +Note that libscrypt_check needs to modify the mcf string and will not return it +to the original state. Pass it a copy if you need to keep the original mcf. + +A number of internal functions are exposed, and users wishing to create more complex use cases should consult the header file, which is aimed at documenting the API fully. + +The test reference is also aimed at providing a well documented use case. +Building +-------- + make + make check +Check the Makefile for advice on linking against your application. + +OSX +----- +Please compile and install with: + + make LDFLAGS= CFLAGS_EXTRA= + make install-osx + + +BUGS +---- +SCRYPT_* constants are probably a little high for something like a Raspberry pi. Using '1' as SCRYPT_p is acceptable from a security and performance standpoint if needed. +Experiments were performed with using memset() to zero out passwords as they were checked. This often caused issues with calling applications where the password based have been passed as a const*. We highly recommend implementing your own zeroing function the moment this library is called. + +There is apparently an issue when used on Samsung (and perhaps Android in general) devices. See [this issue](https://github.com/technion/libscrypt/issues/39) for more information. + +Notes on Code Development +------------------------ + +Code is now declared "stable", the master branch will always be "stable" and development will be done on branches. +The reference machines are Fedora, CentOS, FreeBSD and Raspbian, and the code is expected to compile and run on all of these before being moved to stable branch. +Full transparancy on the regular application of thorough testing can be found by reviewing recent test harness results here: +http://www.lolware.net/libscrypttesting.txt + +Please, no more pull requests for Windows compatibility. If it's important to you - fork the project. I have no intention of pulling an OpenSSL and becoming a maze of ifdefs for platforms I don't even have a build environment for. + +I utilise Facebook's "infer" static analyser, in addition to clang's analyzer. Command to run is: + + infer -- make + +Contact +------- +I can be contacted at: technion@lolware.net + +If required, my GPG key can be found at: https://lolware.net/technion-GPG-KEY + +Future releases will have the Git tag signed. + + +Changenotes +----------- +v1.1a: Single Makefile line change. I wouldn't ordinarily tag this as a new "release", but the purpose here is to assist with packaging in distributions. + +v1.12: The static library is built, but no longer installed by default. You can install it with "make install-static". This is because static libraries are not typically bundled in packages. + +v1.13: Minor packaging related update + +v1.15: Replaced the b64 libraries with more portable one from ISC. Now tested and verified on a wider variety of architectures. Note, libscrypt_b64_encrypt was originally an exported function. This is no longer the case as it is considered an internal function only. + +v1.18: God damnit Apple + +v1.19: Code safety cleanups. Now running Coverity. + +v1.20: Bigfixes involving large N values, return values on error + + + Coverity Scan Build Status + diff --git a/c/src/third-party/libscrypt/b64.c b/c/src/third-party/libscrypt/b64.c new file mode 100644 index 000000000..b797dd0d9 --- /dev/null +++ b/c/src/third-party/libscrypt/b64.c @@ -0,0 +1,313 @@ +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * Portions Copyright (c) 1995 by International Business Machines, Inc. + * + * International Business Machines, Inc. (hereinafter called IBM) grants + * permission under its copyrights to use, copy, modify, and distribute this + * Software with or without fee, provided that the above copyright notice and + * all paragraphs of this notice appear in all copies, and that the name of IBM + * not be used in connection with the marketing of any product incorporating + * the Software or modifications thereof, without specific, written prior + * permission. + * + * To the extent it has a right to do so, IBM grants an immunity from suit + * under its patents, if any, for the use, sale or manufacture of products to + * the extent that such products are used for performing Domain Name System + * dynamic updates in TCP/IP networks by means of the Software. No immunity is + * granted for any product per se or for any other function of any product. + * + * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, + * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN + * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +/* + * Base64 encode/decode functions from OpenBSD (src/lib/libc/net/base64.c). + */ +#include +#include +#include +#include +#include + +#include "b64.h" + + +static const char Base64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static const char Pad64 = '='; + +/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) + The following encoding technique is taken from RFC 1521 by Borenstein + and Freed. It is reproduced here in a slightly edited form for + convenience. + + A 65-character subset of US-ASCII is used, enabling 6 bits to be + represented per printable character. (The extra 65th character, "=", + is used to signify a special processing function.) + + The encoding process represents 24-bit groups of input bits as output + strings of 4 encoded characters. Proceeding from left to right, a + 24-bit input group is formed by concatenating 3 8-bit input groups. + These 24 bits are then treated as 4 concatenated 6-bit groups, each + of which is translated into a single digit in the base64 alphabet. + + Each 6-bit group is used as an index into an array of 64 printable + characters. The character referenced by the index is placed in the + output string. + + Table 1: The Base64 Alphabet + + Value Encoding Value Encoding Value Encoding Value Encoding + 0 A 17 R 34 i 51 z + 1 B 18 S 35 j 52 0 + 2 C 19 T 36 k 53 1 + 3 D 20 U 37 l 54 2 + 4 E 21 V 38 m 55 3 + 5 F 22 W 39 n 56 4 + 6 G 23 X 40 o 57 5 + 7 H 24 Y 41 p 58 6 + 8 I 25 Z 42 q 59 7 + 9 J 26 a 43 r 60 8 + 10 K 27 b 44 s 61 9 + 11 L 28 c 45 t 62 + + 12 M 29 d 46 u 63 / + 13 N 30 e 47 v + 14 O 31 f 48 w (pad) = + 15 P 32 g 49 x + 16 Q 33 h 50 y + + Special processing is performed if fewer than 24 bits are available + at the end of the data being encoded. A full encoding quantum is + always completed at the end of a quantity. When fewer than 24 input + bits are available in an input group, zero bits are added (on the + right) to form an integral number of 6-bit groups. Padding at the + end of the data is performed using the '=' character. + + Since all base64 input is an integral number of octets, only the + ------------------------------------------------- + following cases can arise: + + (1) the final quantum of encoding input is an integral + multiple of 24 bits; here, the final unit of encoded + output will be an integral multiple of 4 characters + with no "=" padding, + (2) the final quantum of encoding input is exactly 8 bits; + here, the final unit of encoded output will be two + characters followed by two "=" padding characters, or + (3) the final quantum of encoding input is exactly 16 bits; + here, the final unit of encoded output will be three + characters followed by one "=" padding character. +*/ + +int +libscrypt_b64_encode(src, srclength, target, targsize) + unsigned char const *src; + size_t srclength; + char *target; + size_t targsize; +{ + size_t datalength = 0; + unsigned char input[3]; + unsigned char output[4]; + unsigned int i; + + while (2 < srclength) { + input[0] = *src++; + input[1] = *src++; + input[2] = *src++; + srclength -= 3; + + output[0] = input[0] >> 2; + output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); + output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); + output[3] = input[2] & 0x3f; + + if (datalength + 4 > targsize) + return (-1); + target[datalength++] = Base64[output[0]]; + target[datalength++] = Base64[output[1]]; + target[datalength++] = Base64[output[2]]; + target[datalength++] = Base64[output[3]]; + } + + /* Now we worry about padding. */ + if (0 != srclength) { + /* Get what's left. */ + input[0] = input[1] = input[2] = '\0'; + for (i = 0; i < srclength; i++) + input[i] = *src++; + + output[0] = input[0] >> 2; + output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); + output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); + + if (datalength + 4 > targsize) + return (-1); + target[datalength++] = Base64[output[0]]; + target[datalength++] = Base64[output[1]]; + if (srclength == 1) + target[datalength++] = Pad64; + else + target[datalength++] = Base64[output[2]]; + target[datalength++] = Pad64; + } + if (datalength >= targsize) + return (-1); + target[datalength] = '\0'; /* Returned value doesn't count \0. */ + return (int)(datalength); +} + +/* skips all whitespace anywhere. + converts characters, four at a time, starting at (or after) + src from base - 64 numbers into three 8 bit bytes in the target area. + it returns the number of data bytes stored at the target, or -1 on error. + */ + +int +libscrypt_b64_decode(src, target, targsize) + char const *src; + unsigned char *target; + size_t targsize; +{ + int state, ch; + unsigned int tarindex; + unsigned char nextbyte; + char *pos; + + state = 0; + tarindex = 0; + + while ((ch = (unsigned char)*src++) != '\0') { + if (isspace(ch)) /* Skip whitespace anywhere. */ + continue; + + if (ch == Pad64) + break; + + pos = strchr(Base64, ch); + if (pos == 0) /* A non-base64 character. */ + return (-1); + + switch (state) { + case 0: + if (target) { + if (tarindex >= targsize) + return (-1); + target[tarindex] = (pos - Base64) << 2; + } + state = 1; + break; + case 1: + if (target) { + if (tarindex >= targsize) + return (-1); + target[tarindex] |= (pos - Base64) >> 4; + nextbyte = ((pos - Base64) & 0x0f) << 4; + if (tarindex + 1 < targsize) + target[tarindex+1] = nextbyte; + else if (nextbyte) + return (-1); + } + tarindex++; + state = 2; + break; + case 2: + if (target) { + if (tarindex >= targsize) + return (-1); + target[tarindex] |= (pos - Base64) >> 2; + nextbyte = ((pos - Base64) & 0x03) << 6; + if (tarindex + 1 < targsize) + target[tarindex+1] = nextbyte; + else if (nextbyte) + return (-1); + } + tarindex++; + state = 3; + break; + case 3: + if (target) { + if (tarindex >= targsize) + return (-1); + target[tarindex] |= (pos - Base64); + } + tarindex++; + state = 0; + break; + } + } + + /* + * We are done decoding Base-64 chars. Let's see if we ended + * on a byte boundary, and/or with erroneous trailing characters. + */ + + if (ch == Pad64) { /* We got a pad char. */ + ch = (unsigned char)*src++; /* Skip it, get next. */ + switch (state) { + case 0: /* Invalid = in first position */ + case 1: /* Invalid = in second position */ + return (-1); + + case 2: /* Valid, means one byte of info */ + /* Skip any number of spaces. */ + for (; ch != '\0'; ch = (unsigned char)*src++) + if (!isspace(ch)) + break; + /* Make sure there is another trailing = sign. */ + if (ch != Pad64) + return (-1); + ch = (unsigned char)*src++; /* Skip the = */ + /* Fall through to "single trailing =" case. */ + /* FALLTHROUGH */ + + case 3: /* Valid, means two bytes of info */ + /* + * We know this char is an =. Is there anything but + * whitespace after it? + */ + for (; ch != '\0'; ch = (unsigned char)*src++) + if (!isspace(ch)) + return (-1); + + /* + * Now make sure for cases 2 and 3 that the "extra" + * bits that slopped past the last full byte were + * zeros. If we don't check them, they become a + * subliminal channel. + */ + if (target && tarindex < targsize && + target[tarindex] != 0) + return (-1); + } + } else { + /* + * We ended by seeing the end of the string. Make sure we + * have no partial bytes lying around. + */ + if (state != 0) + return (-1); + } + + return (tarindex); +} diff --git a/c/src/third-party/libscrypt/b64.h b/c/src/third-party/libscrypt/b64.h new file mode 100644 index 000000000..dd77a1976 --- /dev/null +++ b/c/src/third-party/libscrypt/b64.h @@ -0,0 +1,10 @@ + +/* BASE64 libraries used internally - should not need to be packaged */ +#include +#define b64_encode_len(A) ((A+2)/3 * 4 + 1) +#define b64_decode_len(A) (A / 4 * 3 + 2) + +int libscrypt_b64_encode(unsigned char const *src, size_t srclength, + /*@out@*/ char *target, size_t targetsize); +int libscrypt_b64_decode(char const *src, /*@out@*/ unsigned char *target, + size_t targetsize); diff --git a/c/src/third-party/libscrypt/crypto-mcf.c b/c/src/third-party/libscrypt/crypto-mcf.c new file mode 100644 index 000000000..1b04e48f4 --- /dev/null +++ b/c/src/third-party/libscrypt/crypto-mcf.c @@ -0,0 +1,65 @@ +#include +#include +#include + +#include "libscrypt.h" + +/* ilog2 for powers of two */ +static uint32_t scrypt_ilog2(uint32_t n) +{ +#ifndef S_SPLINT_S + + /* Check for a valid power of two */ + if (n < 2 || (n & (n - 1))) + return -1; +#endif + uint32_t t = 1; + while (((uint32_t)1 << t) < n) + { + if(t > SCRYPT_SAFE_N) + return (uint32_t) -1; /* Check for insanity */ + t++; + } + + return t; +} + +#ifdef _MSC_VER + #define SNPRINTF _snprintf +#else + #define SNPRINTF snprintf +#endif + +int libscrypt_mcf(uint32_t N, uint32_t r, uint32_t p, const char *salt, + const char *hash, char *mcf) +{ + + uint32_t t, params; + int s; + + if(!mcf || !hash) + return 0; + /* Although larger values of r, p are valid in scrypt, this mcf format + * limits to 8 bits. If your number is larger, current computers will + * struggle + */ + if(r > (uint8_t)(-1) || p > (uint8_t)(-1)) + return 0; + + t = scrypt_ilog2(N); + if (t < 1) + return 0; + + params = (r << 8) + p; + params += (uint32_t)t << 16; + + /* Using snprintf - not checking for overflows. We've already + * determined that mcf should be defined as at least SCRYPT_MCF_LEN + * in length + */ + s = SNPRINTF(mcf, SCRYPT_MCF_LEN, SCRYPT_MCF_ID "$%06x$%s$%s", (unsigned int)params, salt, hash); + if (s >= SCRYPT_MCF_LEN) + return 0; + + return 1; +} diff --git a/c/src/third-party/libscrypt/crypto-scrypt-saltgen.c b/c/src/third-party/libscrypt/crypto-scrypt-saltgen.c new file mode 100644 index 000000000..e24aa3cbf --- /dev/null +++ b/c/src/third-party/libscrypt/crypto-scrypt-saltgen.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include + +/* Disable on Windows, there is no /dev/urandom. + Link-time error is better than runtime error. */ +#ifndef _WIN32 + +#ifndef S_SPLINT_S /* Including this here triggers a known bug in splint */ +#include +#endif + +#define RNGDEV "/dev/urandom" + +int libscrypt_salt_gen(uint8_t *salt, size_t len) +{ + unsigned char buf[len]; + size_t data_read = 0; + int urandom = open(RNGDEV, O_RDONLY); + + if (urandom < 0) + { + return -1; + } + + while (data_read < len) { + ssize_t result = read(urandom, buf + data_read, len - data_read); + + if (result < 0) + { + if (errno == EINTR || errno == EAGAIN) { + continue; + } + + else { + (void)close(urandom); + return -1; + } + } + + data_read += result; + } + + /* Failures on close() shouldn't occur with O_RDONLY */ + (void)close(urandom); + + memcpy(salt, buf, len); + + return 0; +} + +#endif diff --git a/c/src/third-party/libscrypt/crypto_scrypt-check.c b/c/src/third-party/libscrypt/crypto_scrypt-check.c new file mode 100644 index 000000000..8ea4519f5 --- /dev/null +++ b/c/src/third-party/libscrypt/crypto_scrypt-check.c @@ -0,0 +1,105 @@ +#include +#include +#include +#include + +#include "b64.h" +#include "slowequals.h" +#include "libscrypt.h" + +#ifdef _WIN32 +/* On windows, strtok uses a thread-local static variable in strtok to + * make strtok thread-safe. It also neglects to provide a strtok_r. */ +#define strtok_r(str, val, saveptr) strtok((str), (val)) +#endif + +int libscrypt_check(char *mcf, const char *password) +{ + /* Return values: + * <0 error + * == 0 password incorrect + * >0 correct password + */ + +#ifndef _WIN32 + char *saveptr = NULL; +#endif + uint32_t params; + uint64_t N; + uint8_t r, p; + int retval; + uint8_t hashbuf[64]; + char outbuf[128]; + uint8_t salt[32]; + char *tok; + + if(mcf == NULL) + { + return -1; + } + + if(memcmp(mcf, SCRYPT_MCF_ID, 3) != 0) + { + /* Only version 0 supported */ + return -1; + } + + tok = strtok_r(mcf, "$", &saveptr); + if ( !tok ) + return -1; + + tok = strtok_r(NULL, "$", &saveptr); + + if ( !tok ) + return -1; + + params = (uint32_t)strtoul(tok, NULL, 16); + if ( params == 0 ) + return -1; + + tok = strtok_r(NULL, "$", &saveptr); + + if ( !tok ) + return -1; + + p = params & 0xff; + r = (params >> 8) & 0xff; + N = params >> 16; + + if (N > SCRYPT_SAFE_N) + return -1; + + N = (uint64_t)1 << N; + + /* Useful debugging: + printf("We've obtained salt 'N' r p of '%s' %d %d %d\n", tok, N,r,p); + */ + + memset(salt, 0, sizeof(salt)); /* Keeps splint happy */ + retval = libscrypt_b64_decode(tok, (unsigned char*)salt, sizeof(salt)); + if (retval < 1) + return -1; + + retval = libscrypt_scrypt((uint8_t*)password, strlen(password), salt, + (uint32_t)retval, N, r, p, hashbuf, sizeof(hashbuf)); + + if (retval != 0) + return -1; + + retval = libscrypt_b64_encode((unsigned char*)hashbuf, sizeof(hashbuf), + outbuf, sizeof(outbuf)); + + if (retval == 0) + return -1; + + tok = strtok_r(NULL, "$", &saveptr); + + if ( !tok ) + return -1; + + if(slow_equals(tok, outbuf) == 0) + return 0; + + return 1; /* This is the "else" condition */ +} + diff --git a/c/src/third-party/libscrypt/crypto_scrypt-hash.c b/c/src/third-party/libscrypt/crypto_scrypt-hash.c new file mode 100644 index 000000000..4b41007db --- /dev/null +++ b/c/src/third-party/libscrypt/crypto_scrypt-hash.c @@ -0,0 +1,44 @@ +#include +#include +#include +#include + +#include "b64.h" +#include "libscrypt.h" + +int libscrypt_hash(char *dst, const char *passphrase, uint32_t N, uint8_t r, + uint8_t p) +{ + + int retval; + uint8_t salt[SCRYPT_SALT_LEN]; + uint8_t hashbuf[SCRYPT_HASH_LEN]; + char outbuf[256]; + char saltbuf[256]; + + if(libscrypt_salt_gen(salt, SCRYPT_SALT_LEN) == -1) + { + return 0; + } + + retval = libscrypt_scrypt((const uint8_t*)passphrase, strlen(passphrase), + (uint8_t*)salt, SCRYPT_SALT_LEN, N, r, p, hashbuf, sizeof(hashbuf)); + if(retval == -1) + return 0; + + retval = libscrypt_b64_encode((unsigned char*)hashbuf, sizeof(hashbuf), + outbuf, sizeof(outbuf)); + if(retval == -1) + return 0; + + retval = libscrypt_b64_encode((unsigned char *)salt, sizeof(salt), + saltbuf, sizeof(saltbuf)); + if(retval == -1) + return 0; + + retval = libscrypt_mcf(N, r, p, saltbuf, outbuf, dst); + if(retval != 1) + return 0; + + return 1; +} diff --git a/c/src/third-party/libscrypt/crypto_scrypt-hexconvert.c b/c/src/third-party/libscrypt/crypto_scrypt-hexconvert.c new file mode 100644 index 000000000..3df12a023 --- /dev/null +++ b/c/src/third-party/libscrypt/crypto_scrypt-hexconvert.c @@ -0,0 +1,35 @@ +#include +#include +#include +#include + +/* The hexconvert function is only used to test reference vectors against + * known answers. The contents of this file are therefore a component + * to assist with test harnesses only + */ + +int libscrypt_hexconvert(uint8_t *buf, size_t s, char *outbuf, size_t obs) +{ + + size_t i; + int len = 0; + + if (!buf || s < 1 || obs < (s * 2 + 1)) + return 0; + + memset(outbuf, 0, obs); + + + for(i=0; i<=(s-1); i++) + { + /* snprintf(outbuf, s,"%s...", outbuf....) has undefined results + * and can't be used. Using offests like this makes snprintf + * nontrivial. we therefore have use inescure sprintf() and + * lengths checked elsewhere (start of function) */ + /*@ -bufferoverflowhigh @*/ + len += sprintf(outbuf+len, "%02x", (unsigned int) buf[i]); + } + + return 1; +} + diff --git a/c/src/third-party/libscrypt/crypto_scrypt-hexconvert.h b/c/src/third-party/libscrypt/crypto_scrypt-hexconvert.h new file mode 100644 index 000000000..28a9e5d88 --- /dev/null +++ b/c/src/third-party/libscrypt/crypto_scrypt-hexconvert.h @@ -0,0 +1,9 @@ +#include +#include + +/** + * Converts a binary string to a hex representation of that string + * outbuf must have size of at least buf * 2 + 1. + */ +int libscrypt_hexconvert(const uint8_t *buf, size_t s, char *outbuf, + size_t obs); diff --git a/c/src/third-party/libscrypt/crypto_scrypt-nosse.c b/c/src/third-party/libscrypt/crypto_scrypt-nosse.c new file mode 100644 index 000000000..12c860f2d --- /dev/null +++ b/c/src/third-party/libscrypt/crypto_scrypt-nosse.c @@ -0,0 +1,342 @@ +/*- + * Copyright 2009 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file was originally written by Colin Percival as part of the Tarsnap + * online backup system. + */ + +#include +#ifndef _WIN32 +#include +#endif +#include +#include +#include +#include + +#include "sha256.h" +#include "sysendian.h" + +#include "libscrypt.h" + +static void blkcpy(void *, void *, size_t); +static void blkxor(void *, void *, size_t); +static void salsa20_8(uint32_t[16]); +static void blockmix_salsa8(uint32_t *, uint32_t *, uint32_t *, size_t); +static uint64_t integerify(void *, size_t); +static void smix(uint8_t *, size_t, uint64_t, uint32_t *, uint32_t *); + +static void +blkcpy(void * dest, void * src, size_t len) +{ + size_t * D = dest; + size_t * S = src; + size_t L = len / sizeof(size_t); + size_t i; + + for (i = 0; i < L; i++) + D[i] = S[i]; +} + +static void +blkxor(void * dest, void * src, size_t len) +{ + size_t * D = dest; + size_t * S = src; + size_t L = len / sizeof(size_t); + size_t i; + + for (i = 0; i < L; i++) + D[i] ^= S[i]; +} + +/** + * salsa20_8(B): + * Apply the salsa20/8 core to the provided block. + */ +static void +salsa20_8(uint32_t B[16]) +{ + uint32_t x[16]; + size_t i; + + blkcpy(x, B, 64); + for (i = 0; i < 8; i += 2) { +#define R(a,b) (((a) << (b)) | ((a) >> (32 - (b)))) + /* Operate on columns. */ + x[ 4] ^= R(x[ 0]+x[12], 7); x[ 8] ^= R(x[ 4]+x[ 0], 9); + x[12] ^= R(x[ 8]+x[ 4],13); x[ 0] ^= R(x[12]+x[ 8],18); + + x[ 9] ^= R(x[ 5]+x[ 1], 7); x[13] ^= R(x[ 9]+x[ 5], 9); + x[ 1] ^= R(x[13]+x[ 9],13); x[ 5] ^= R(x[ 1]+x[13],18); + + x[14] ^= R(x[10]+x[ 6], 7); x[ 2] ^= R(x[14]+x[10], 9); + x[ 6] ^= R(x[ 2]+x[14],13); x[10] ^= R(x[ 6]+x[ 2],18); + + x[ 3] ^= R(x[15]+x[11], 7); x[ 7] ^= R(x[ 3]+x[15], 9); + x[11] ^= R(x[ 7]+x[ 3],13); x[15] ^= R(x[11]+x[ 7],18); + + /* Operate on rows. */ + x[ 1] ^= R(x[ 0]+x[ 3], 7); x[ 2] ^= R(x[ 1]+x[ 0], 9); + x[ 3] ^= R(x[ 2]+x[ 1],13); x[ 0] ^= R(x[ 3]+x[ 2],18); + + x[ 6] ^= R(x[ 5]+x[ 4], 7); x[ 7] ^= R(x[ 6]+x[ 5], 9); + x[ 4] ^= R(x[ 7]+x[ 6],13); x[ 5] ^= R(x[ 4]+x[ 7],18); + + x[11] ^= R(x[10]+x[ 9], 7); x[ 8] ^= R(x[11]+x[10], 9); + x[ 9] ^= R(x[ 8]+x[11],13); x[10] ^= R(x[ 9]+x[ 8],18); + + x[12] ^= R(x[15]+x[14], 7); x[13] ^= R(x[12]+x[15], 9); + x[14] ^= R(x[13]+x[12],13); x[15] ^= R(x[14]+x[13],18); +#undef R + } + for (i = 0; i < 16; i++) + B[i] += x[i]; +} + +/** + * blockmix_salsa8(Bin, Bout, X, r): + * Compute Bout = BlockMix_{salsa20/8, r}(Bin). The input Bin must be 128r + * bytes in length; the output Bout must also be the same size. The + * temporary space X must be 64 bytes. + */ +static void +blockmix_salsa8(uint32_t * Bin, uint32_t * Bout, uint32_t * X, size_t r) +{ + size_t i; + + /* 1: X <-- B_{2r - 1} */ + blkcpy(X, &Bin[(2 * r - 1) * 16], 64); + + /* 2: for i = 0 to 2r - 1 do */ + for (i = 0; i < 2 * r; i += 2) { + /* 3: X <-- H(X \xor B_i) */ + blkxor(X, &Bin[i * 16], 64); + salsa20_8(X); + + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + blkcpy(&Bout[i * 8], X, 64); + + /* 3: X <-- H(X \xor B_i) */ + blkxor(X, &Bin[i * 16 + 16], 64); + salsa20_8(X); + + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + blkcpy(&Bout[i * 8 + r * 16], X, 64); + } +} + +/** + * integerify(B, r): + * Return the result of parsing B_{2r-1} as a little-endian integer. + */ +static uint64_t +integerify(void * B, size_t r) +{ + uint32_t * X = (void *)((uintptr_t)(B) + (2 * r - 1) * 64); + + return (((uint64_t)(X[1]) << 32) + X[0]); +} + +/** + * smix(B, r, N, V, XY): + * Compute B = SMix_r(B, N). The input B must be 128r bytes in length; + * the temporary storage V must be 128rN bytes in length; the temporary + * storage XY must be 256r + 64 bytes in length. The value N must be a + * power of 2 greater than 1. The arrays B, V, and XY must be aligned to a + * multiple of 64 bytes. + */ +static void +smix(uint8_t * B, size_t r, uint64_t N, uint32_t * V, uint32_t * XY) +{ + uint32_t * X = XY; + uint32_t * Y = &XY[32 * r]; + uint32_t * Z = &XY[64 * r]; + uint64_t i; + uint64_t j; + size_t k; + + /* 1: X <-- B */ + for (k = 0; k < 32 * r; k++) + X[k] = le32dec(&B[4 * k]); + + /* 2: for i = 0 to N - 1 do */ + for (i = 0; i < N; i += 2) { + /* 3: V_i <-- X */ + blkcpy(&V[i * (32 * r)], X, 128 * r); + + /* 4: X <-- H(X) */ + blockmix_salsa8(X, Y, Z, r); + + /* 3: V_i <-- X */ + blkcpy(&V[(i + 1) * (32 * r)], Y, 128 * r); + + /* 4: X <-- H(X) */ + blockmix_salsa8(Y, X, Z, r); + } + + /* 6: for i = 0 to N - 1 do */ + for (i = 0; i < N; i += 2) { + /* 7: j <-- Integerify(X) mod N */ + j = integerify(X, r) & (N - 1); + + /* 8: X <-- H(X \xor V_j) */ + blkxor(X, &V[j * (32 * r)], 128 * r); + blockmix_salsa8(X, Y, Z, r); + + /* 7: j <-- Integerify(X) mod N */ + j = integerify(Y, r) & (N - 1); + + /* 8: X <-- H(X \xor V_j) */ + blkxor(Y, &V[j * (32 * r)], 128 * r); + blockmix_salsa8(Y, X, Z, r); + } + + /* 10: B' <-- X */ + for (k = 0; k < 32 * r; k++) + le32enc(&B[4 * k], X[k]); +} + +/** + * crypto_scrypt(passwd, passwdlen, salt, saltlen, N, r, p, buf, buflen): + * Compute scrypt(passwd[0 .. passwdlen - 1], salt[0 .. saltlen - 1], N, r, + * p, buflen) and write the result into buf. The parameters r, p, and buflen + * must satisfy r * p < 2^30 and buflen <= (2^32 - 1) * 32. The parameter N + * must be a power of 2 greater than 1. + * + * Return 0 on success; or -1 on error + */ +int +libscrypt_scrypt(const uint8_t * passwd, size_t passwdlen, + const uint8_t * salt, size_t saltlen, uint64_t N, uint32_t r, uint32_t p, + uint8_t * buf, size_t buflen) +{ + void * B0, * V0, * XY0; + uint8_t * B; + uint32_t * V; + uint32_t * XY; + uint32_t i; + + /* Sanity-check parameters. */ +#if SIZE_MAX > UINT32_MAX + if (buflen > (((uint64_t)(1) << 32) - 1) * 32) { + errno = EFBIG; + goto err0; + } +#endif + if ((uint64_t)(r) * (uint64_t)(p) >= (1 << 30)) { + errno = EFBIG; + goto err0; + } + if (r == 0 || p == 0) { + errno = EINVAL; + goto err0; + } + if (((N & (N - 1)) != 0) || (N < 2)) { + errno = EINVAL; + goto err0; + } + if ((r > SIZE_MAX / 128 / p) || +#if SIZE_MAX / 256 <= UINT32_MAX + (r > SIZE_MAX / 256) || +#endif + (N > SIZE_MAX / 128 / r)) { + errno = ENOMEM; + goto err0; + } + + /* Allocate memory. */ +#ifdef HAVE_POSIX_MEMALIGN + if ((errno = posix_memalign(&B0, 64, 128 * r * p)) != 0) + goto err0; + B = (uint8_t *)(B0); + if ((errno = posix_memalign(&XY0, 64, 256 * r + 64)) != 0) + goto err1; + XY = (uint32_t *)(XY0); +#ifndef MAP_ANON + if ((errno = posix_memalign(&V0, 64, 128 * r * N)) != 0) + goto err2; + V = (uint32_t *)(V0); +#endif +#else + if ((B0 = malloc(128 * r * p + 63)) == NULL) + goto err0; + B = (uint8_t *)(((uintptr_t)(B0) + 63) & ~ (uintptr_t)(63)); + if ((XY0 = malloc(256 * r + 64 + 63)) == NULL) + goto err1; + XY = (uint32_t *)(((uintptr_t)(XY0) + 63) & ~ (uintptr_t)(63)); +#ifndef MAP_ANON + if ((V0 = malloc(128 * r * N + 63)) == NULL) + goto err2; + V = (uint32_t *)(((uintptr_t)(V0) + 63) & ~ (uintptr_t)(63)); +#endif +#endif +#ifdef MAP_ANON + if ((V0 = mmap(NULL, 128 * r * N, PROT_READ | PROT_WRITE, +#ifdef MAP_NOCORE + MAP_ANON | MAP_PRIVATE | MAP_NOCORE, +#else + MAP_ANON | MAP_PRIVATE, +#endif + -1, 0)) == MAP_FAILED) + goto err2; + V = (uint32_t *)(V0); +#endif + + /* 1: (B_0 ... B_{p-1}) <-- PBKDF2(P, S, 1, p * MFLen) */ + libscrypt_PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, 1, B, p * 128 * r); + + /* 2: for i = 0 to p - 1 do */ + for (i = 0; i < p; i++) { + /* 3: B_i <-- MF(B_i, N) */ + smix(&B[i * 128 * r], r, N, V, XY); + } + + /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */ + libscrypt_PBKDF2_SHA256(passwd, passwdlen, B, p * 128 * r, 1, buf, buflen); + + /* Free memory. */ +#ifdef MAP_ANON + if (munmap(V0, 128 * r * N)) + goto err2; +#else + free(V0); +#endif + free(XY0); + free(B0); + + /* Success! */ + return (0); + +err2: + free(XY0); +err1: + free(B0); +err0: + /* Failure! */ + return (-1); +} diff --git a/c/src/third-party/libscrypt/libscrypt.h b/c/src/third-party/libscrypt/libscrypt.h new file mode 100644 index 000000000..2ea31cb1a --- /dev/null +++ b/c/src/third-party/libscrypt/libscrypt.h @@ -0,0 +1,77 @@ +/*- + */ +#ifndef _CRYPTO_SCRYPT_H_ +#define _CRYPTO_SCRYPT_H_ + + +#include +#include +#ifdef __cplusplus +extern "C"{ +#endif + +/** + * crypto_scrypt(passwd, passwdlen, salt, saltlen, N, r, p, buf, buflen): + * Compute scrypt(passwd[0 .. passwdlen - 1], salt[0 .. saltlen - 1], N, r, + * p, buflen) and write the result into buf. The parameters r, p, and buflen + * must satisfy r * p < 2^30 and buflen <= (2^32 - 1) * 32. The parameter N + * must be a power of 2 greater than 1. + * + * libscrypt_scrypt(passwd, passwdlen, salt, saltlen, N, r, p, buf, buflen): + * password; duh + * N: CPU AND RAM cost (first modifier) + * r: RAM Cost + * p: CPU cost (parallelisation) + * In short, N is your main performance modifier. Values of r = 8, p = 1 are + * standard unless you want to modify the CPU/RAM ratio. + * Return 0 on success; or -1 on error. + */ +int libscrypt_scrypt(const uint8_t *, size_t, const uint8_t *, size_t, uint64_t, + uint32_t, uint32_t, /*@out@*/ uint8_t *, size_t); + +/* Converts a series of input parameters to a MCF form for storage */ +int libscrypt_mcf(uint32_t N, uint32_t r, uint32_t p, const char *salt, + const char *hash, char *mcf); + +#ifndef _MSC_VER +/* Generates a salt. Uses /dev/urandom/ + */ +int libscrypt_salt_gen(/*@out@*/ uint8_t *rand, size_t len); + +/* Creates a hash of a passphrase using a randomly generated salt */ +/* Returns >0 on success, or 0 for fail */ +int libscrypt_hash(char *dst, const char* passphrase, uint32_t N, uint8_t r, + uint8_t p); +#endif + +/* Checks a given MCF against a password */ +int libscrypt_check(char *mcf, const char *password); + +#ifdef __cplusplus +} +#endif + +/* Sane default values */ +#define SCRYPT_HASH_LEN 64 /* This can be user defined - + *but 64 is the reference size + */ +#define SCRYPT_SAFE_N 30 /* This is much higher than you want. It's just + * a blocker for insane defines + */ +#define SCRYPT_SALT_LEN 16 /* This is just a recommended size */ +/* Standard MCF is: + $s1 Identifier, three chars + $0e0810 Work order and separator, six chars + Formula for binary to base64 length = ceil(n/3)*4 + $pcL+DWle903AXcKJVwMffA== Salt is 16 bytes, or 24 in Base64 + $dn+9ujljVc5JTJMC2fYu1ZEHdJyqYkOurmcrBQbMHUfnD6qxbTmNiR075ohNBZjvp66E2aV1pfOrmyNHUefjMg== Hash is 64 bytes, or 88 in Base64. + Work order, salt and hash have separators (3) + 3 + 6 + 24 + 88 + 3 + null byte = 125 + This is rounded up to a multiple of four for alignment +*/ +#define SCRYPT_MCF_LEN 128 +#define SCRYPT_MCF_ID "$s1" +#define SCRYPT_N 16384 +#define SCRYPT_r 8 +#define SCRYPT_p 16 +#endif /* !_CRYPTO_SCRYPT_H_ */ diff --git a/c/src/third-party/libscrypt/libscrypt.version b/c/src/third-party/libscrypt/libscrypt.version new file mode 100644 index 000000000..9cc574db2 --- /dev/null +++ b/c/src/third-party/libscrypt/libscrypt.version @@ -0,0 +1,8 @@ +libscrypt { + global: libscrypt_check; +libscrypt_hash; +libscrypt_mcf; +libscrypt_salt_gen; +libscrypt_scrypt; + local: *; +}; diff --git a/c/src/third-party/libscrypt/main.c b/c/src/third-party/libscrypt/main.c new file mode 100644 index 000000000..ab5acecf2 --- /dev/null +++ b/c/src/third-party/libscrypt/main.c @@ -0,0 +1,244 @@ +#include +#include +#include +#include + +#include "b64.h" +#include "crypto_scrypt-hexconvert.h" +#include "libscrypt.h" + +#define REF1 "fdbabe1c9d3472007856e7190d01e9fe7c6ad7cbc8237830e77376634b3731622eaf30d92e22a3886ff109279d9830dac727afb94a83ee6d8360cbdfa2cc0640" + +#define REF2 "7023bdcb3afd7348461c06cd81fd38ebfda8fbba904f8e3ea9b543f6545da1f2d5432955613f0fcf62d49705242a9af9e61e85dc0d651e40dfcf017b45575887" + + +int main() +{ + uint8_t hashbuf[SCRYPT_HASH_LEN]; + char outbuf[132]; + char mcf[SCRYPT_MCF_LEN]; + char mcf2[SCRYPT_MCF_LEN]; + char saltbuf[64]; + int retval; + /** + * libscrypt_scrypt(passwd, passwdlen, salt, saltlen, N, r, p, buf, buflen): + * password; duh + * N: CPU AND RAM cost (first modifier) + * r: RAM Cost + * p: CPU cost (parallelisation) + * In short, N is your main performance modifier. Values of r = 8, p = 1 are + * standard unless you want to modify the CPU/RAM ratio. + int libscrypt_scrypt(const uint8_t *, size_t, const uint8_t *, size_t, uint64_t, + uint32_t, uint32_t, uint8_t *, size_t); +*/ + + printf("TEST ONE: Direct call to reference function with password 'password' and salt 'NaCL'\n"); + + retval = libscrypt_scrypt((uint8_t*)"password",strlen("password"), (uint8_t*)"NaCl", strlen("NaCl"), 1024, 8, 16, hashbuf, sizeof(hashbuf)); + + if(retval != 0) + { + printf("TEST ONE FAILED: Failed to create hash of \"password\"\\n"); + exit(EXIT_FAILURE); + } + + printf("TEST ONE: SUCCESSFUL\n"); + + printf("TEST ONE and a half: Review errno on invalid input\n"); + + retval = libscrypt_scrypt((uint8_t*)"password",strlen("password"), (uint8_t*)"NaCl", strlen("NaCl"), 47, 1, 1, hashbuf, sizeof(hashbuf)); + + if(retval != -1) + { + printf("TEST ONE FAILED: Failed to detect invalid input\n"); + exit(EXIT_FAILURE); + } + printf("TEST ONE and a half: Successfully failed on error: %s\n", strerror(errno)); + + /* Convert the binary string to hex representation. Outbuf must be + * at least sizeof(hashbuf) * 2 + 1 + * Returns 0 on fail, 1 on success + */ + printf("TEST TWO: Convert binary output to hex\n"); + retval = libscrypt_hexconvert(hashbuf, sizeof(hashbuf), outbuf, sizeof(outbuf)); + if(!retval) + { + printf("TEST TWO: FAILED\n"); + exit(EXIT_FAILURE); + } + printf("TEST TWO: SUCCESSFUL, Hex output is:\n%s\n", outbuf); + + printf("TEST THREE: Compare hex output to reference hash output\n"); + + /* REF1 is a reference vector from Colin's implementation. */ + if(strcmp(outbuf, REF1) != 0) + { + printf("TEST THREE: FAILED to match reference on hash\n"); + exit(EXIT_FAILURE); + } + else + { + printf("TEST THREE: SUCCESSUL, Test vector matched!\n"); + } + + printf("TEST FOUR: Direct call to reference function with pleaseletmein password and SodiumChloride as salt\n"); + + /* Tests 4-6 repeat tests 1-3 with a different reference vector */ + + retval = libscrypt_scrypt((uint8_t*)"pleaseletmein",strlen("pleaseletmein"), (uint8_t*)"SodiumChloride", strlen("SodiumChloride"), 16384, 8, 1, hashbuf, sizeof(hashbuf)); + + if(retval != 0) + { + printf("TEST FOUR FAILED: Failed to create hash of 'pleaseletmein'\n"); + exit(EXIT_FAILURE); + } + + printf("TEST FOUR: SUCCESSFUL\n"); + + /* Convert the binary string to hex representation. Outbuf must be + * at least sizeof(hashbuf) * 2 + 1 + */ + printf("TEST FIVE: Convert binary output to hex\n"); + retval = libscrypt_hexconvert(hashbuf, sizeof(hashbuf), outbuf, sizeof(outbuf)); + if(!retval) + { + printf("TEST FIVE: FAILED\n"); + exit(EXIT_FAILURE); + } + printf("TEST FIVE: SUCCESSFUL, Hex output is:\n%s\n", outbuf); + + printf("TEST SIX: Compare hex output to reference hash output\n"); + + if(strcmp(outbuf, REF2) != 0) + { + printf("TEST SIX: FAILED to match reference on hash\n"); + exit(EXIT_FAILURE); + } + else + { + printf("TEST SIX: SUCCESSUL, Test vector matched!\n"); + } + + /* This function will convert the binary output to BASE64. Although + * we converted to hex for the reference vectors, BASE64 is more useful. + * Returns -1 on error, else returns length. + * Correct buffer length can be determined using the below function if + retuired. + * char* dest = (char*) malloc(modp_b64_encode_len); + * Note that this is not an exported function + */ + + printf("TEST SEVEN: BASE64 encoding the salt and hash output\n"); + + retval = libscrypt_b64_encode(hashbuf, sizeof(hashbuf), outbuf, sizeof(outbuf)); + if(retval == -1) + { + printf("TEST SEVEN FAILED\n"); + exit(EXIT_FAILURE); + } + retval = libscrypt_b64_encode((unsigned char*)"SodiumChloride", strlen("SodiumChloride"), saltbuf, sizeof(saltbuf)); + if(retval == -1) + { + printf("TEST SEVEN FAILED\n"); + exit(EXIT_FAILURE); + } + + printf("TEST SEVEN: SUCCESSFUL\n"); + + printf("TEST EIGHT: Create an MCF format output\n"); + + /* Creates a standard format output + * int crypto_scrypt_mcf(uint32_t N, uint32_t r, uint32_t p, char *salt, char *hash, char *mcf); + * Returns 0 on error, most likely reason is log2(N) not an integer. + */ + retval = libscrypt_mcf(16384, 8, 1, saltbuf, outbuf, mcf); + if(!retval) + { + printf("TEST EIGHT FAILED\n"); + exit(EXIT_FAILURE); + } + + printf("TEST EIGHT: SUCCESSFUL, calculated mcf\n%s\n", mcf); + + /* Since later calls to scrypt_check() butcher mcf, make a second */ + strcpy(mcf2, mcf); + + /* Couldn't be simpler - for a given mcf, check is the password is valid + * Returns < 0 on failure to calculate hash + * 0 if password incorrect + * >1 if password correct + */ + + printf("TEST NINE: Password verify on given MCF\n"); + retval = libscrypt_check(mcf, "pleaseletmein"); + + if(retval < 0) + { + printf("TEST NINE: FAILED, hash failed to calculate\n"); + exit(EXIT_FAILURE); + } + if(retval == 0) + { + printf("TEST NINE: FAILED, claimed pleaseletmein hash claimed did not verify\n"); + exit(EXIT_FAILURE); + } + /* retval >0 is a success */ + printf("TEST NINE: SUCCESSFUL, tested pleaseletmein password\n"); + + printf("TEST TEN: Password verify on same MCF, incorrect password\n"); + retval = libscrypt_check(mcf2, "pleasefailme"); + + if(retval < 0) + { + printf("TEST TEN: FAILED, hash failed to calculate\n"); + exit(EXIT_FAILURE); + } + if(retval > 0) + { + printf("TEST TEN: FAILED, fail hash has passed\n"); + exit(EXIT_FAILURE); + } + + printf("TEST TEN: SUCCESSFUL, refused incorrect password\n"); + + printf("TEST ELEVEN: Testing salt generator\n"); + + retval = libscrypt_salt_gen((uint8_t*)saltbuf, SCRYPT_SALT_LEN); + if(retval == -1) + { + printf("TEST ELEVEN (salt generate) FAILED\n"); + exit(EXIT_FAILURE); + } + + retval = libscrypt_b64_encode((uint8_t*)saltbuf, SCRYPT_SALT_LEN, outbuf, sizeof(outbuf)); + if(retval == -1) + { + printf("TEST ELEVEN (b64 encode) FAILED\n"); + exit(EXIT_FAILURE); + } + printf("TEST ELEVEN: SUCCESSFUL, Generated %s\n", outbuf); + + printf("TEST TWELVE: Simple hash creation\n"); + + retval = libscrypt_hash(outbuf, "My cats's breath smells like cat food", SCRYPT_N, SCRYPT_r, SCRYPT_p); + if(!retval) + { + printf("TEST TWELVE: FAILED, Failed to create simple hash\n"); + exit(EXIT_FAILURE); + } + printf("TEST TWELVE: SUCCESSFUL. Received the following from simple hash:\n%s\n", outbuf); + + printf("TEST THIRTEEN: Verify test twelve's hash\n"); + + retval = libscrypt_check(outbuf, "My cats's breath smells like cat food"); + + if (retval != 1) { + printf("TEST THIRTEEN: FAILED, hash not verified\n"); + exit(EXIT_FAILURE); + } + + printf("TEST THIRTEEN: SUCCESSFUL\n"); + + return 0; +} + diff --git a/c/src/third-party/libscrypt/sha256.c b/c/src/third-party/libscrypt/sha256.c new file mode 100644 index 000000000..cae65db33 --- /dev/null +++ b/c/src/third-party/libscrypt/sha256.c @@ -0,0 +1,397 @@ +/*- + * Copyright 2005,2007,2009 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include + +#include "sysendian.h" + +#include "sha256.h" + +/* + * Encode a length len/4 vector of (uint32_t) into a length len vector of + * (unsigned char) in big-endian form. Assumes len is a multiple of 4. + */ +static void +be32enc_vect(unsigned char *dst, const uint32_t *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 4; i++) + be32enc(dst + i * 4, src[i]); +} + +/* + * Decode a big-endian length len vector of (unsigned char) into a length + * len/4 vector of (uint32_t). Assumes len is a multiple of 4. + */ +static void +be32dec_vect(uint32_t *dst, const unsigned char *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 4; i++) + dst[i] = be32dec(src + i * 4); +} + +/* Elementary functions used by SHA256 */ +#define Ch(x, y, z) ((x & (y ^ z)) ^ z) +#define Maj(x, y, z) ((x & (y | z)) | (y & z)) +#define SHR(x, n) (x >> n) +#define ROTR(x, n) ((x >> n) | (x << (32 - n))) +#define S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) +#define S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) +#define s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3)) +#define s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10)) + +/* SHA256 round function */ +#define RND(a, b, c, d, e, f, g, h, k) \ + t0 = h + S1(e) + Ch(e, f, g) + k; \ + t1 = S0(a) + Maj(a, b, c); \ + d += t0; \ + h = t0 + t1; + +/* Adjusted round function for rotating state */ +#define RNDr(S, W, i, k) \ + RND(S[(64 - i) % 8], S[(65 - i) % 8], \ + S[(66 - i) % 8], S[(67 - i) % 8], \ + S[(68 - i) % 8], S[(69 - i) % 8], \ + S[(70 - i) % 8], S[(71 - i) % 8], \ + W[i] + k) + +/* + * SHA256 block compression function. The 256-bit state is transformed via + * the 512-bit input block to produce a new state. + */ +static void +SHA256_Transform(uint32_t * state, const unsigned char block[64]) +{ + uint32_t W[64]; + uint32_t S[8]; + uint32_t t0, t1; + int i; + + /* 1. Prepare message schedule W. */ + be32dec_vect(W, block, 64); + for (i = 16; i < 64; i++) + W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; + + /* 2. Initialize working variables. */ + memcpy(S, state, 32); + + /* 3. Mix. */ + RNDr(S, W, 0, 0x428a2f98); + RNDr(S, W, 1, 0x71374491); + RNDr(S, W, 2, 0xb5c0fbcf); + RNDr(S, W, 3, 0xe9b5dba5); + RNDr(S, W, 4, 0x3956c25b); + RNDr(S, W, 5, 0x59f111f1); + RNDr(S, W, 6, 0x923f82a4); + RNDr(S, W, 7, 0xab1c5ed5); + RNDr(S, W, 8, 0xd807aa98); + RNDr(S, W, 9, 0x12835b01); + RNDr(S, W, 10, 0x243185be); + RNDr(S, W, 11, 0x550c7dc3); + RNDr(S, W, 12, 0x72be5d74); + RNDr(S, W, 13, 0x80deb1fe); + RNDr(S, W, 14, 0x9bdc06a7); + RNDr(S, W, 15, 0xc19bf174); + RNDr(S, W, 16, 0xe49b69c1); + RNDr(S, W, 17, 0xefbe4786); + RNDr(S, W, 18, 0x0fc19dc6); + RNDr(S, W, 19, 0x240ca1cc); + RNDr(S, W, 20, 0x2de92c6f); + RNDr(S, W, 21, 0x4a7484aa); + RNDr(S, W, 22, 0x5cb0a9dc); + RNDr(S, W, 23, 0x76f988da); + RNDr(S, W, 24, 0x983e5152); + RNDr(S, W, 25, 0xa831c66d); + RNDr(S, W, 26, 0xb00327c8); + RNDr(S, W, 27, 0xbf597fc7); + RNDr(S, W, 28, 0xc6e00bf3); + RNDr(S, W, 29, 0xd5a79147); + RNDr(S, W, 30, 0x06ca6351); + RNDr(S, W, 31, 0x14292967); + RNDr(S, W, 32, 0x27b70a85); + RNDr(S, W, 33, 0x2e1b2138); + RNDr(S, W, 34, 0x4d2c6dfc); + RNDr(S, W, 35, 0x53380d13); + RNDr(S, W, 36, 0x650a7354); + RNDr(S, W, 37, 0x766a0abb); + RNDr(S, W, 38, 0x81c2c92e); + RNDr(S, W, 39, 0x92722c85); + RNDr(S, W, 40, 0xa2bfe8a1); + RNDr(S, W, 41, 0xa81a664b); + RNDr(S, W, 42, 0xc24b8b70); + RNDr(S, W, 43, 0xc76c51a3); + RNDr(S, W, 44, 0xd192e819); + RNDr(S, W, 45, 0xd6990624); + RNDr(S, W, 46, 0xf40e3585); + RNDr(S, W, 47, 0x106aa070); + RNDr(S, W, 48, 0x19a4c116); + RNDr(S, W, 49, 0x1e376c08); + RNDr(S, W, 50, 0x2748774c); + RNDr(S, W, 51, 0x34b0bcb5); + RNDr(S, W, 52, 0x391c0cb3); + RNDr(S, W, 53, 0x4ed8aa4a); + RNDr(S, W, 54, 0x5b9cca4f); + RNDr(S, W, 55, 0x682e6ff3); + RNDr(S, W, 56, 0x748f82ee); + RNDr(S, W, 57, 0x78a5636f); + RNDr(S, W, 58, 0x84c87814); + RNDr(S, W, 59, 0x8cc70208); + RNDr(S, W, 60, 0x90befffa); + RNDr(S, W, 61, 0xa4506ceb); + RNDr(S, W, 62, 0xbef9a3f7); + RNDr(S, W, 63, 0xc67178f2); + + /* 4. Mix local working variables into global state */ + for (i = 0; i < 8; i++) + state[i] += S[i]; +} + +static unsigned char PAD[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* Add padding and terminating bit-count. */ +static void +SHA256_Pad(SHA256_CTX * ctx) +{ + unsigned char len[8]; + uint32_t r, plen; + + /* + * Convert length to a vector of bytes -- we do this now rather + * than later because the length will change after we pad. + */ + be32enc_vect(len, ctx->count, 8); + + /* Add 1--64 bytes so that the resulting length is 56 mod 64 */ + r = (ctx->count[1] >> 3) & 0x3f; + plen = (r < 56) ? (56 - r) : (120 - r); + libscrypt_SHA256_Update(ctx, PAD, (size_t)plen); + + /* Add the terminating bit-count */ + libscrypt_SHA256_Update(ctx, len, 8); +} + +/* SHA-256 initialization. Begins a SHA-256 operation. */ +void +libscrypt_SHA256_Init(SHA256_CTX * ctx) +{ + + /* Zero bits processed so far */ + ctx->count[0] = ctx->count[1] = 0; + + /* Magic initialization constants */ + ctx->state[0] = 0x6A09E667; + ctx->state[1] = 0xBB67AE85; + ctx->state[2] = 0x3C6EF372; + ctx->state[3] = 0xA54FF53A; + ctx->state[4] = 0x510E527F; + ctx->state[5] = 0x9B05688C; + ctx->state[6] = 0x1F83D9AB; + ctx->state[7] = 0x5BE0CD19; +} + +/* Add bytes into the hash */ +void +libscrypt_SHA256_Update(SHA256_CTX * ctx, const void *in, size_t len) +{ + uint32_t bitlen[2]; + uint32_t r; + const unsigned char *src = in; + + /* Number of bytes left in the buffer from previous updates */ + r = (ctx->count[1] >> 3) & 0x3f; + + /* Convert the length into a number of bits */ + bitlen[1] = ((uint32_t)len) << 3; + bitlen[0] = (uint32_t)(len >> 29); + + /* Update number of bits */ + if ((ctx->count[1] += bitlen[1]) < bitlen[1]) + ctx->count[0]++; + ctx->count[0] += bitlen[0]; + + /* Handle the case where we don't need to perform any transforms */ + if (len < 64 - r) { + memcpy(&ctx->buf[r], src, len); + return; + } + + /* Finish the current block */ + memcpy(&ctx->buf[r], src, 64 - r); + SHA256_Transform(ctx->state, ctx->buf); + src += 64 - r; + len -= 64 - r; + + /* Perform complete blocks */ + while (len >= 64) { + SHA256_Transform(ctx->state, src); + src += 64; + len -= 64; + } + + /* Copy left over data into buffer */ + memcpy(ctx->buf, src, len); +} + +/* + * SHA-256 finalization. Pads the input data, exports the hash value, + * and clears the context state. + */ +void +libscrypt_SHA256_Final(unsigned char digest[32], SHA256_CTX * ctx) +{ + + /* Add padding */ + SHA256_Pad(ctx); + + /* Write the hash */ + be32enc_vect(digest, ctx->state, 32); + + /* Clear the context state */ + memset((void *)ctx, 0, sizeof(*ctx)); +} + +/* Initialize an HMAC-SHA256 operation with the given key. */ +void +libscrypt_HMAC_SHA256_Init(HMAC_SHA256_CTX * ctx, const void * _K, size_t Klen) +{ + unsigned char pad[64]; + unsigned char khash[32]; + const unsigned char * K = _K; + size_t i; + + /* If Klen > 64, the key is really SHA256(K). */ + if (Klen > 64) { + libscrypt_SHA256_Init(&ctx->ictx); + libscrypt_SHA256_Update(&ctx->ictx, K, Klen); + libscrypt_SHA256_Final(khash, &ctx->ictx); + K = khash; + Klen = 32; + } + + /* Inner SHA256 operation is SHA256(K xor [block of 0x36] || data). */ + libscrypt_SHA256_Init(&ctx->ictx); + memset(pad, 0x36, 64); + for (i = 0; i < Klen; i++) + pad[i] ^= K[i]; + libscrypt_SHA256_Update(&ctx->ictx, pad, 64); + + /* Outer SHA256 operation is SHA256(K xor [block of 0x5c] || hash). */ + libscrypt_SHA256_Init(&ctx->octx); + memset(pad, 0x5c, 64); + for (i = 0; i < Klen; i++) + pad[i] ^= K[i]; + libscrypt_SHA256_Update(&ctx->octx, pad, 64); +} + +/* Add bytes to the HMAC-SHA256 operation. */ +void +libscrypt_HMAC_SHA256_Update(HMAC_SHA256_CTX * ctx, const void *in, size_t len) +{ + + /* Feed data to the inner SHA256 operation. */ + libscrypt_SHA256_Update(&ctx->ictx, in, len); +} + +/* Finish an HMAC-SHA256 operation. */ +void +libscrypt_HMAC_SHA256_Final(unsigned char digest[32], HMAC_SHA256_CTX * ctx) +{ + unsigned char ihash[32]; + + /* Finish the inner SHA256 operation. */ + libscrypt_SHA256_Final(ihash, &ctx->ictx); + + /* Feed the inner hash to the outer SHA256 operation. */ + libscrypt_SHA256_Update(&ctx->octx, ihash, 32); + + /* Finish the outer SHA256 operation. */ + libscrypt_SHA256_Final(digest, &ctx->octx); +} + +/** + * PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): + * Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and + * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1). + */ +void +libscrypt_PBKDF2_SHA256(const uint8_t * passwd, size_t passwdlen, const uint8_t * salt, + size_t saltlen, uint64_t c, uint8_t * buf, size_t dkLen) +{ + HMAC_SHA256_CTX PShctx, hctx; + size_t i; + uint8_t ivec[4]; + uint8_t U[32]; + uint8_t T[32]; + uint64_t j; + int k; + size_t clen; + + /* Compute HMAC state after processing P and S. */ + libscrypt_HMAC_SHA256_Init(&PShctx, passwd, passwdlen); + libscrypt_HMAC_SHA256_Update(&PShctx, salt, saltlen); + + /* Iterate through the blocks. */ + for (i = 0; i * 32 < dkLen; i++) { + /* Generate INT(i + 1). */ + be32enc(ivec, (uint32_t)(i + 1)); + + /* Compute U_1 = PRF(P, S || INT(i)). */ + memcpy(&hctx, &PShctx, sizeof(HMAC_SHA256_CTX)); + libscrypt_HMAC_SHA256_Update(&hctx, ivec, 4); + libscrypt_HMAC_SHA256_Final(U, &hctx); + + /* T_i = U_1 ... */ + memcpy(T, U, 32); + + for (j = 2; j <= c; j++) { + /* Compute U_j. */ + libscrypt_HMAC_SHA256_Init(&hctx, passwd, passwdlen); + libscrypt_HMAC_SHA256_Update(&hctx, U, 32); + libscrypt_HMAC_SHA256_Final(U, &hctx); + + /* ... xor U_j ... */ + for (k = 0; k < 32; k++) + T[k] ^= U[k]; + } + + /* Copy as many bytes as necessary into buf. */ + clen = dkLen - i * 32; + if (clen > 32) + clen = 32; + memcpy(&buf[i * 32], T, clen); + } +} diff --git a/c/src/third-party/libscrypt/sha256.h b/c/src/third-party/libscrypt/sha256.h new file mode 100644 index 000000000..f7138b417 --- /dev/null +++ b/c/src/third-party/libscrypt/sha256.h @@ -0,0 +1,70 @@ +/*- + * Copyright 2005,2007,2009 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libmd/sha256.h,v 1.2 2006/01/17 15:35:56 phk Exp $ + */ + +#ifndef _SHA256_H_ +#define _SHA256_H_ + +#include + +#include + +typedef struct libscrypt_SHA256Context { + uint32_t state[8]; + uint32_t count[2]; + unsigned char buf[64]; +} SHA256_CTX; + +typedef struct libscrypt_HMAC_SHA256Context { + SHA256_CTX ictx; + SHA256_CTX octx; +} HMAC_SHA256_CTX; + +void libscrypt_SHA256_Init(/*@out@*/ SHA256_CTX *); +void libscrypt_SHA256_Update(SHA256_CTX *, const void *, size_t); + +/* Original declaration: + * void SHA256_Final(unsigned char [32], SHA256_CTX *); +*/ +void libscrypt_SHA256_Final(/*@out@*/ unsigned char [], SHA256_CTX *); +void libscrypt_HMAC_SHA256_Init(HMAC_SHA256_CTX *, const void *, size_t); +void libscrypt_HMAC_SHA256_Update(HMAC_SHA256_CTX *, const void *, size_t); + +/* Original declaration: + * void HMAC_SHA256_Final(unsigned char [32], HMAC_SHA256_CTX *); +*/ +void libscrypt_HMAC_SHA256_Final(unsigned char [], HMAC_SHA256_CTX *); + +/** + * PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): + * Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and + * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1). + */ +void libscrypt_PBKDF2_SHA256(const uint8_t *, size_t, const uint8_t *, size_t, + uint64_t, uint8_t *, size_t); + +#endif /* !_SHA256_H_ */ diff --git a/c/src/third-party/libscrypt/slowequals.c b/c/src/third-party/libscrypt/slowequals.c new file mode 100644 index 000000000..48e488e4e --- /dev/null +++ b/c/src/third-party/libscrypt/slowequals.c @@ -0,0 +1,26 @@ +#include + +/* Implements a constant time version of strcmp() + * Will return 1 if a and b are equal, 0 if they are not */ +int slow_equals(const char* a, const char* b) +{ + size_t lena, lenb, diff, i; + lena = strlen(a); + lenb = strlen(b); + diff = strlen(a) ^ strlen(b); + + for(i=0; i we have isn't usable. */ +#if !HAVE_DECL_BE64ENC +#undef HAVE_SYS_ENDIAN_H +#endif + +#ifdef HAVE_SYS_ENDIAN_H + +#include + +#else + +#include +#ifdef _MSC_VER + #define INLINE __inline +#else + #define INLINE inline +#endif + +static INLINE uint32_t +be32dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + + return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) + + ((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24)); +} + +static INLINE void +be32enc(void *pp, uint32_t x) +{ + uint8_t * p = (uint8_t *)pp; + + p[3] = x & 0xff; + p[2] = (x >> 8) & 0xff; + p[1] = (x >> 16) & 0xff; + p[0] = (x >> 24) & 0xff; +} + +static INLINE uint64_t +be64dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + + return ((uint64_t)(p[7]) + ((uint64_t)(p[6]) << 8) + + ((uint64_t)(p[5]) << 16) + ((uint64_t)(p[4]) << 24) + + ((uint64_t)(p[3]) << 32) + ((uint64_t)(p[2]) << 40) + + ((uint64_t)(p[1]) << 48) + ((uint64_t)(p[0]) << 56)); +} + +static INLINE void +be64enc(void *pp, uint64_t x) +{ + uint8_t * p = (uint8_t *)pp; + + p[7] = x & 0xff; + p[6] = (x >> 8) & 0xff; + p[5] = (x >> 16) & 0xff; + p[4] = (x >> 24) & 0xff; + p[3] = (x >> 32) & 0xff; + p[2] = (x >> 40) & 0xff; + p[1] = (x >> 48) & 0xff; + p[0] = (x >> 56) & 0xff; +} + +static INLINE uint32_t +le32dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + + return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) + + ((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24)); +} + +static INLINE void +le32enc(void *pp, uint32_t x) +{ + uint8_t * p = (uint8_t *)pp; + + p[0] = x & 0xff; + p[1] = (x >> 8) & 0xff; + p[2] = (x >> 16) & 0xff; + p[3] = (x >> 24) & 0xff; +} + +static INLINE uint64_t +le64dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + + return ((uint64_t)(p[0]) + ((uint64_t)(p[1]) << 8) + + ((uint64_t)(p[2]) << 16) + ((uint64_t)(p[3]) << 24) + + ((uint64_t)(p[4]) << 32) + ((uint64_t)(p[5]) << 40) + + ((uint64_t)(p[6]) << 48) + ((uint64_t)(p[7]) << 56)); +} + +static INLINE void +le64enc(void *pp, uint64_t x) +{ + uint8_t * p = (uint8_t *)pp; + + p[0] = x & 0xff; + p[1] = (x >> 8) & 0xff; + p[2] = (x >> 16) & 0xff; + p[3] = (x >> 24) & 0xff; + p[4] = (x >> 32) & 0xff; + p[5] = (x >> 40) & 0xff; + p[6] = (x >> 48) & 0xff; + p[7] = (x >> 56) & 0xff; +} +#endif /* !HAVE_SYS_ENDIAN_H */ + +#endif /* !_SYSENDIAN_H_ */ diff --git a/wasm/src/CMakeLists.txt b/wasm/src/CMakeLists.txt index bdef7240c..fd75da31b 100644 --- a/wasm/src/CMakeLists.txt +++ b/wasm/src/CMakeLists.txt @@ -60,7 +60,13 @@ if (WASM_SYNC) endif(WASM_SYNC) add_executable(in3w wasm.c) -target_link_libraries(in3w ${IN3_VERIFIER} ${IN3_API}) + +if(USE_SCRYPT) + target_link_libraries(in3w ${IN3_VERIFIER} ${IN3_API} scrypt) +else(USE_SCRYPT) + target_link_libraries(in3w ${IN3_VERIFIER} ${IN3_API}) +endif(USE_SCRYPT) + set_target_properties(in3w PROPERTIES LINK_FLAGS "${EMC_PROPS}") add_custom_command(TARGET in3w From 0fb73cde87a6f35b87dfa650b0dee24738639fa9 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 10 Mar 2020 13:40:00 +0100 Subject: [PATCH 32/97] fixed release --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6c2353311..62a975942 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -669,8 +669,6 @@ release_mac_and_wasm: - IPFS_RESPONSE=$(curl -X POST https://api.pinata.cloud/pinning/pinFileToIPFS -H 'Content-Type:multipart/form-data' -H 'pinata_api_key:'"$PINATA_API_KEY" -H 'pinata_secret_api_key:'"$PINATA_SECRET_API_KEY" -F file=@in3_${CI_COMMIT_TAG}_mac.tar.gz -F 'pinataMetadata={"name":"in3_'${CI_COMMIT_TAG}'_mac.tar.gz","keyValues":{"version":"${CI_COMMIT_TAG}"}}' -F 'pinataOptions={"cidVersion":0}') - "IPFS_HASH=$(echo $IPFS_RESPONSE | sed -e 's/[{}]/''/g' | awk -v RS=',' -F: '/IpfsHash/ {print $2}')" - ghr -u slockIt -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_mac.tar.gz - - mv wasm/release-wasm . - - mv wasm/release-asmjs . - tar -zcv --exclude=in3-mac-wasm/python --exclude=in3-mac-wasm/java --exclude=in3-mac-wasm/bin --exclude=in3-mac-wasm/lib --exclude=*cmake* -f in3_${CI_COMMIT_TAG}_wasm.tar.gz in3-mac-wasm/ - IPFS_RESPONSE=$(curl -X POST https://api.pinata.cloud/pinning/pinFileToIPFS -H 'Content-Type:multipart/form-data' -H 'pinata_api_key:'"$PINATA_API_KEY" -H 'pinata_secret_api_key:'"$PINATA_SECRET_API_KEY" -F file=@in3_${CI_COMMIT_TAG}_wasm.tar.gz -F 'pinataMetadata={"name":"in3_'${CI_COMMIT_TAG}'_wasm.tar.gz","keyValues":{"version":"${CI_COMMIT_TAG}"}}' -F 'pinataOptions={"cidVersion":0}') - "IPFS_HASH=$(echo $IPFS_RESPONSE | sed -e 's/[{}]/''/g' | awk -v RS=',' -F: '/IpfsHash/ {print $2}')" From dd25579bc836224c2eec14da8b871702f2874cb6 Mon Sep 17 00:00:00 2001 From: Camilo Soto Valenzuela Date: Tue, 10 Mar 2020 16:01:15 +0100 Subject: [PATCH 33/97] Fix qemu with libscrypt disabled --- c/src/third-party/CMakeLists.txt | 4 ++-- c/test/qemu/CMakeLists.txt | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/c/src/third-party/CMakeLists.txt b/c/src/third-party/CMakeLists.txt index b53ac0e1e..a0c111730 100644 --- a/c/src/third-party/CMakeLists.txt +++ b/c/src/third-party/CMakeLists.txt @@ -33,9 +33,9 @@ ############################################################################### add_subdirectory( crypto ) -#if(USE_SCRYPT) +if(USE_SCRYPT) add_subdirectory( libscrypt ) -#endif() +endif() if (ETH_FULL) add_subdirectory( tommath ) endif() diff --git a/c/test/qemu/CMakeLists.txt b/c/test/qemu/CMakeLists.txt index 2e351811b..9c366b790 100644 --- a/c/test/qemu/CMakeLists.txt +++ b/c/test/qemu/CMakeLists.txt @@ -7,7 +7,7 @@ target_sources(app PRIVATE src/main.c) ADD_DEFINITIONS(-DTEST) ADD_DEFINITIONS(-DDEBUG) - +ADD_DEFINITIONS(-DUSE_SCRYPT=false) SET(CMAKE_BUILD_TYPE Debug) SET(CMAKE_VERBOSE_MAKEFILE ON) ADD_DEFINITIONS(-DZEPHYR_OS) @@ -21,14 +21,15 @@ ${IN3_SRC}/src/verifier/eth1/basic ${IN3_SRC}/src/verifier/eth1/nano ${IN3_SRC}/src/api/eth1 ${IN3_SRC}/src/api/utils -${IN3_SRC}/src/third-party +${IN3_SRC}/src/third-party/crypto +${IN3_SRC}/src/third-party/tommath ) foreach(dep ${IN3_DEPS}) file(GLOB files "${dep}/**/*.c") file(GLOB files2 "${dep}/*.c") - message("${files}") - message("${files2}") + #temp fix for building with a GLOB and not include all 3rd party libs + list(FILTER files EXCLUDE REGEX ".*aestst.c$") target_sources(app PRIVATE "${files}" "${files2}") include_directories ("${dep}") endforeach() From b4ad642830b640199b5b044306f6a8776df3ac77 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 10 Mar 2020 17:00:39 +0100 Subject: [PATCH 34/97] Fix WASM tests --- wasm/src/wasm.c | 2 +- wasm/test/testRunner.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wasm/src/wasm.c b/wasm/src/wasm.c index f3c96c312..26e08c84f 100644 --- a/wasm/src/wasm.c +++ b/wasm/src/wasm.c @@ -131,7 +131,7 @@ char* EMSCRIPTEN_KEEPALIVE ctx_execute(in3_ctx_t* ctx) { p = p->required; } if (!last_waiting) { - sb_add_chars(sb, "\"error\",\"error\":\"could not find the last waiting context\""); + sb_add_chars(sb, "\"error\",\"error\":\"could not find the last ignored context\""); break; } else { ctx_handle_failable(last_waiting); diff --git a/wasm/test/testRunner.js b/wasm/test/testRunner.js index 8a18c217b..69dad24b4 100644 --- a/wasm/test/testRunner.js +++ b/wasm/test/testRunner.js @@ -174,13 +174,13 @@ async function runSingleTest(test, c) { }, '0x5': { needsUpdate: false, - contract: '0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f', - registryId: '0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb' + contract: '0x5f51e413581dd76759e9eed51e63d14c8d1379c8', + registryId: '0x67c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea' }, '0x2a': { needsUpdate: false, - contract: '0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f', - registryId: '0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb' + contract: '0x4c396dcf50ac396e5fdea18163251699b5fcca25', + registryId: '0x92eb6ad5ed9068a24c1c85276cd7eb11eda1e8c50b17fbaffaf3e8396df4becf' }, '0x7d0': { needsUpdate: false, From 56c6117bbfe5e69e91e0ae240e7bcae3355748fd Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 10 Mar 2020 21:41:28 +0100 Subject: [PATCH 35/97] add scrypt --- c/CMakeLists.txt | 4 ++++ c/src/api/eth1/CMakeLists.txt | 8 +++++++- c/src/api/eth1/key.c | 2 +- wasm/src/CMakeLists.txt | 6 +----- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index c261eb242..a4559e5a9 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -69,6 +69,10 @@ if (IN3_LIB) set(IN3_LIBS ${IN3_LIBS} $) endif() + if (USE_SCRYPT) + set(IN3_LIBS ${IN3_LIBS} $) + endif() + # create the libraries add_library(in3_bundle STATIC ${IN3_LIBS} ) add_library(in3_lib SHARED ${IN3_LIBS} ) diff --git a/c/src/api/eth1/CMakeLists.txt b/c/src/api/eth1/CMakeLists.txt index aeb43c92f..65ec874ee 100644 --- a/c/src/api/eth1/CMakeLists.txt +++ b/c/src/api/eth1/CMakeLists.txt @@ -36,4 +36,10 @@ include("${PROJECT_SOURCE_DIR}/c/compiler.cmake") add_library(eth_api_o OBJECT eth_api.c abi.c key.c rpc_api.c ens.c ../utils/api_utils_priv.c) target_compile_definitions(eth_api_o PRIVATE -D_POSIX_C_SOURCE=199309L) add_library(eth_api STATIC $) -target_link_libraries(eth_api eth_nano in3_api_utils ${LIBS}) \ No newline at end of file +target_link_libraries(eth_api eth_nano in3_api_utils ${LIBS}) + + +if (USE_SCRYPT) + target_link_libraries(eth_api scrypt) + ADD_DEFINITIONS(-DSCRYPT) +endif() \ No newline at end of file diff --git a/c/src/api/eth1/key.c b/c/src/api/eth1/key.c index e570a4c61..810be3110 100644 --- a/c/src/api/eth1/key.c +++ b/c/src/api/eth1/key.c @@ -41,7 +41,7 @@ #ifdef SCRYPT // only if scrypt is installed we support it. -#include +#include "../../third-party/libscrypt/libscrypt.h" #endif in3_ret_t decrypt_key(d_token_t* key_data, char* password, bytes32_t dst) { diff --git a/wasm/src/CMakeLists.txt b/wasm/src/CMakeLists.txt index fd75da31b..309d49adc 100644 --- a/wasm/src/CMakeLists.txt +++ b/wasm/src/CMakeLists.txt @@ -61,11 +61,7 @@ endif(WASM_SYNC) add_executable(in3w wasm.c) -if(USE_SCRYPT) - target_link_libraries(in3w ${IN3_VERIFIER} ${IN3_API} scrypt) -else(USE_SCRYPT) - target_link_libraries(in3w ${IN3_VERIFIER} ${IN3_API}) -endif(USE_SCRYPT) +target_link_libraries(in3w ${IN3_VERIFIER} ${IN3_API}) set_target_properties(in3w PROPERTIES LINK_FLAGS "${EMC_PROPS}") From 5f1a1c20213d0eecc1761f75da7537cd74e71be3 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 10 Mar 2020 21:45:20 +0100 Subject: [PATCH 36/97] Update nodelist response in java JSON test --- java/resources/responses/in3_nodeList.json | 354 ++++++++++++--------- 1 file changed, 200 insertions(+), 154 deletions(-) diff --git a/java/resources/responses/in3_nodeList.json b/java/resources/responses/in3_nodeList.json index f52c5902e..ab38d134f 100644 --- a/java/resources/responses/in3_nodeList.json +++ b/java/resources/responses/in3_nodeList.json @@ -1,155 +1,201 @@ { - "id":1, - "result":{ - "nodes":[ - { - "url":"https://in3-v2.slock.it/mainnet/nd-1", - "address":"0x45d45e6ff99e6c34a235d263965910298985fcfe", - "index":0, - "deposit":"0x2386f26fc10000", - "props":"0x6000001dd", - "timeout":3456000, - "registerTime":1576224418, - "weight":2000 - }, - { - "url":"https://in3-v2.slock.it/mainnet/nd-2", - "address":"0x1fe2e9bf29aa1938859af64c413361227d04059a", - "index":1, - "deposit":"0x2386f26fc10000", - "props":"0x6000001dd", - "timeout":3456000, - "registerTime":1576224531, - "weight":2000 - }, - { - "url":"https://in3-v2.slock.it/mainnet/nd-3", - "address":"0x945f75c0408c0026a3cd204d36f5e47745182fd4", - "index":2, - "deposit":"0x2386f26fc10000", - "props":"0x6000001dd", - "timeout":3456000, - "registerTime":1576224604, - "weight":2000 - }, - { - "url":"https://in3-v2.slock.it/mainnet/nd-4", - "address":"0xc513a534de5a9d3f413152c41b09bd8116237fc8", - "index":3, - "deposit":"0x2386f26fc10000", - "props":"0x6000001dd", - "timeout":3456000, - "registerTime":1576224650, - "weight":2000 - }, - { - "url":"https://in3-v2.slock.it/mainnet/nd-5", - "address":"0xbcdf4e3e90cc7288b578329efd7bcc90655148d2", - "index":4, - "deposit":"0x2386f26fc10000", - "props":"0x6000001dd", - "timeout":3456000, - "registerTime":1576224948, - "weight":2000 - } - ], - "contract":"0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f", - "registryId":"0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb", - "lastBlockNumber":9115431, - "totalServers":5 - }, - "jsonrpc":"2.0", - "in3":{ - "execTime":0, - "lastValidatorChange":0, - "proof":{ - "type":"accountProof", - "block":"0xf90213a0d62b3e32fddeb60ec5fc3f99699dc4100bd5035471b4f0c52edf0f4a29e432e4a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794d224ca0c819e8e97ba0136b3b95ceff503b79f53a05f00ba6f5d3ff52464e148d6ce62412bc26ef49b948f002eb17590f591bb1c63a06e741b1e2cd9ffa7bcc25c87ab12435267a465c5c025233fed3a0a20cc5dc378a0d7fc7b9abdd2645d744f0cf2e6b1a99166a7b3148fa4ff46d17873885508fe6ab90100a94000a98981514554c40000688618b73814d3080902500190340353c20095726d98083bec04e9b9842d051294408d44163680ba2e2a813700aaee0a30250284c2c10050940b00c1fa1ca14b308a22adeb16246e8c97c1d06300c1660ac90c41104581d289000804c360d042200aa210102e6840739d14a8420829338101e56c260422dac050890041c881948c892651988204c521018207099238b448b211900305b4798b003c88ee88a0ca90d0886c82440804ce650a040a033221ae280920c49280e2e902081a96821211291f286d2c201380210b098c2619028201345100a632242015763263a8b060240920aea908245940a1410033c68a1e4e0d924600870a1474d3b371fc838b172783983730839818b3845df77056927575706f6f6c2e636e2d3134363630383435a02943a79e3e3c878cc7aae8b9059d8390c15815c82ac25633c680727cb35245e688e97a8928033c6542", - "accounts":{ - "0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f":{ - "accountProof":[ - "0xf90211a0314e214aa5ce41e37fa7ddccfc3149f8d55514d0ef7c954dc8fb1414dbeebf94a0afa9af27b1599a6026e738ed6da989b301bc2380faaf7e45977fe50c25eaaf46a0fff04580993c8a1fac755557bf84a0a952a1d8fcac6f5076a5d29302b9d32e85a0ded1477ef719a688f594b8e8a23e9d2db2951a6f7e39edc3a689f52d94db36b7a069a786f17c7eac2968ba18628568cd5a9061a2ca8d3c2d90313cdce715f63617a0921375ba39ecb3a121d655e796011dfd734c8f1f1b3bfbac79d08b4ec013c92da0cafdeec640049fda6f91bc549544a05a22a69c1078bbfa865d74b25cca681d44a04241e9e38e82dc1b1cc2c35ea7301fc64e45c1c36b786c6d3369723919f87310a04099b01fa3e990e97c38c15258a778c0fda02dc80989e954899846959e248796a07fe5f0c8d82868aac8be3be38eeb5d1786aa6135043c4d032c178e762e144167a094d07e1f18437b68e090ac69c240b4efaabf376cc10394d29915efcd32323ecca0dd5b0581882dcd375b5109bbb4a1762a7ccae4ebbc38db135b0991108454b893a0a8a343dd6c38504c06a7a80065640bb4183aafb9748802c654d8d283a109bd2ca02d45f8812cf24639800359adace4575f4384b8ef4da9636e6fd006fbebb3bc57a0b27e4defa8845ba47f743f71808fd18ccdae6503f6b647be009ebc80eeae4421a05ec845d9cf96137e3e4a59b4682c14d1918a7935cc426d93888c8a6454b4ddb780", - "0xf90211a0292a7e6d386d9d852a20a58aa5320a4663f8b8f64ac1283e52d96b060317f8aea02bcb5eca3284b8c9859a9c0e598de30c7ec78077e6ea335fb87b0dc7e4ff6f28a0da63bf8b5b42d8bf9a6f205bf9e519ec7d2b4a2dcfa71babf4d1c617d8669601a03e631923671ed6cec7b79d5454a5b31baec90f4012d5f02ec431a33360331c7da0e760722b604d804461a38da6825a3069a0cab1241f6cd7b2f51be150933fb3aea020ae53dad8b1ede6c04bdd0adab48d630df9db9b3401bd0a3ded626fc4e7915da09c19f933a9fc5a89814d69dcc155a59701814a2a1be1edadd6dfefd96bf6d67da038233be8bc7264ef88635ab34f2dee3d60c491542621a1d44d04ea342489ecd1a0828863328730e7fa5e412501b2671fcf01bbd08185fbeefe85e86b2f889cf775a060df98a646e6a1fec5908a420f37dc5eb7c47756f28043060a9ed53df14947c7a09760caa7dd03a7e9b2ab1216118bacf44bbd4a9f282a6a2ef2ccba4e70864ac3a00dace803f83824dbb643f6a479db29acc8674a6e685faf00a5aa8607a3ee4f43a0e70f828dea65186d62cd1e02953442fcdab68d59ca92796f7fa16f9ad39cfe2ca0bf554a2e025da5e3ed190f45e43a229a1bccd3606d3735796341f8d974837d38a0cde08c72a6992aa4e5e2d7e15390e076dc92c0eada45cc8511dd42aa04136a27a0e8f620f8faf813287f43b4ae0089d51308bb48044207a4c82454aad39653b97880", - "0xf90211a05cf9171704fba25c66fa9550b14c97193a45ff84ec6368702798e98429f75e45a0bd921ec1b4090a376232d6a88ce2ea1a05cb56cb64fe2440714771eae5474b0ba02dcc6732bc7aaf3f510dfe8b1e71fb34394f6dcd4156b4005b60249b38b33169a003b703bd8494e0e6ba88b1b50848b2f850c8689dc4dd3df909a40025f913a2eda00bea6259547f57ef8a8d02833ec0ad1b79578eb12e6ffcb2944ffa3242299031a034ba691439e76cf7a474d0e7f5cf6a818ae5639d0c7536db383cdc7a1b797e67a003cfa1892cab4d809b97f9fb9dab0dc9b92061ddd3a29a7fb480c1e4c58a54d6a0408657bc33553084aae03d2918d7b36dd58513ed46fa262024edc18974d85a8ca0d41f110cc7f91c9e5520529476a7af931291d52b2d2b7e9f9dd0ae0d11ca2ee2a0eb1ccfbb9f4925729cde0c92e6f44009777292e7c14f12e34ef425464b52361ea03203c5b09b5e25132658b5e86d64440206a89ac4a497eeac5d2b1e2f7cc910aaa07e1c3fb19728006b6519b4a916285e781e300b74a694835da4f1bd494b7ed1e1a09742cd056a2f93363ac22a93321372d8c497a8e694d204c98f8467de665076dba031ae191b426645ddd1226046137c94968aec5fb938b5b6a3e030896d798dc22ca0fb7192cca1bf077b4f06965c167864e3ae2be53b5c3e758324f1528953b98e9da0c7c8830a0fe30feeed1868496ea7fc4dc509e3ef5b069056c039a235970b155080", - "0xf90211a0ec2eae989bdda9b8d6ef9ff2451067a3027e2f225544e77a6556c897da400876a0e4daf694349b5c5454424b9b775eb32fa57615effdced868f123b554aa7f34aea0cca6db6e3ad8a25e7e8f592f13dc9f5a07b6aa59664987830ba4a5addfaa370ca03d31a80bdf0803d0645626c2d314007d079f5c91a5951cc40434d54e8e05fde0a029b13194ef48df01108088e20f119ff10ceddb41fbcede2bc26e97460b3a6ad2a0fc3167f46c1f3fb967dcf24e8045e08ad942147bdc4005d9fd4a8f33bb71f4dca03940e4a177fbe4890872dda414cd0aee51d283ab6c45e14b4453f8f1f71e6a3ba0fa3536651a9626ff9166ee5ea17ddc4bdf96429998cd0fb692a7c2899e431f49a00115d876dcf7a9810d506198c0aa68972921948fede254f261c507ecd6224292a05912c501f8c1a225ec8e07a46a695f50b00aafb54c74a83fa8f80a314b7cb9aea0fa785b4151a406eef05e9c5c9138a1b69aa58373c6fbc8b9bedb0b1c0ac874e6a0a046eca5ef8176d8b743ec9aa3cd1b2a6e2f98b4b883036e873df46bdd17d37da0ab64406c862b0c2320ce10fb0a24b36ce28aa9e93ce969fe7d328501149e42c8a045b74f740754066b9bc0cb7ff24def1e24b923f97a08f4bd66ea7af54a071ce8a0e55ace4eb7cf31619582b14a5c28a8866414241aa97fd0bce3384c71cf64410da06cce106683ff1e550c17b8e6a865f31e7f2f4be25aba3b5aa979d0d3aadc208080", - "0xf90211a0616fd22d9da5cffb124b1f3d8b2869887dbfb5c75197b102490e085ef84aa260a08ea24e98550b823e7358873a1a1a5d8ec5fa1748ad8812aec06f82a7a104779ca0ae5fe58a7c09aad959c99cffe1b77a0a92e409d07faaa046b3f3dd3a87c3a73ba0738ba8e0ae9ca1d5f04f95f9a932be5c088b4790df9465e230b3baaf90ecb421a079bdf4d535f78d13fe8a9464bfd874cc8215b34dbdd68c65779b3b4b7d3723a3a07a0509c394e3f592de4be61edbedc972be3d4219065f9e38ad622a1317802bc5a00da7cf076d3f98522fed577d1b5d7ee4aa24ac58651b295aee996a81d1cacc8ea0b4c1eb09537310449e565204dabc956781d07b4ab6906f138dca311f4cc14a6aa01ce9b201d9f6e1a0661fa09dbb439a08a8d66e2e390f007c6cb11473e75b8956a041de1fa2c05897b170c735d127fe3abfc9118acea86304817f9283f9dfaaad7fa0946f8b944d248312edfec984c9a57899f61347e67d4800d08286ac41f5840a0ea02e4cf3074eda770d18104671715c5be10e0a2bb6173dd0bf0909cfe7357b7e37a0e61f8d72cdc0852c34066e1bfdfa43e59dbcac8a5b9d426be5291d63f86914cda0ee6b6998bd6d37d245753bb4bfdbfadb5e9af4a0416b643de590d218a6dd1a4da01b959aaa6d2d252cb9c1d3c39c07f19a0af927a4f87ee084d1c22d31ff630460a0ded4a3c16c0471af314daeacda2f79b0f430888f42cf9f73b82ddfcafd3ac84b80", - "0xf90211a0372a955b15f6a5614f772d142b7d0679a49d9e859d772f8287b30eb6ffca1924a0f1a510919c07d8539a9e7611453ac3f4b64e575355b8f0a1c58f3c54dc1531a8a05058a380b065612ea7cb9a7b45174068b6f71665fc21ebb73dafbd4570b6fa14a074aaf1d956b257164275fd8ddc3aa656c737d79dfc780dee474e8b39ee391d1fa0dccf7318665d89412fdffaa5a6741d11b9cb529afe504f770eb6c0c748a608d3a08b71dd67c9ff6ea323b5ec1302bd2d6437816d0a68bf4b29a48e162c8c61f7efa060636537ffefd8e54031e7ae9200135a5ed7eb0b9984db03e14a51cbad677d8fa03c139dbd4ecbdca97e442ae535d642d7dd3f6d12ff1878d84f5d8375d3a8e517a03412ecb9bc8acdb503195da735e1ab9918d67638ce321eed7568a33f934d3677a0fd8cb9befe5c61a00a233231b498e4665720bdd4b5003b128a9b984aae4ef403a0a054cf97077fb57446844889034d9f5fccde6527bf2ed936e65d49b2f60cef50a0f2cabb17d69bfb117c719ac9c0d0d83015bb8e7ae30a468097ebf31cd09b6b43a0e491286f657aa5ec57385603d1ffe3e9950b9aea68cdf78f1e1be2eda6e3cc9aa08117ba461f2f84429e9da4d3ee738ac42fa1ed8c5479f85b859b4528b4e8ff63a076fb23883502dc6328a20a5343f8f3c1595e702e176988d99fbe7d820d198090a08facbf8e7a4bc022e4f51b677be032d319146bbe87be591be92224501662079980", - "0xf8b18080a01a27c49a5a77e292b591767f76ddf2bfbdf1752a5b53c7f07c519d0868760d2ea0ad6cb523f73649d74c1213abb948c10037a7a342ede5cd373b6060061d79faf780808080808080a02dca1cd7f04d0fd9625b649903883a2faa52ea6cfcbda738e61f6ea6322328cd80a0a100cd6e729dee956ee0b30eacec39fd47e2f16f97708a2f09d99e4bcaaaf96aa0d327ffd4270f97c978c638645dc59c0a8ed42fc09bc538c9ad91eea990f543fd8080", - "0xf8669d3ad8a871b31cb3552080711d61fda45242133e0695c60218a95533aa2cb846f8440180a0fc228720956b856cf25332b9e78303cf625d32d2315575c74d47c7d3ee48ba6fa029140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1" - ], - "address":"0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f", - "balance":"0x0", - "codeHash":"0x29140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1", - "nonce":"0x1", - "storageHash":"0xfc228720956b856cf25332b9e78303cf625d32d2315575c74d47c7d3ee48ba6f", - "storageProof":[ - { - "key":"0x0", - "proof":[ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf891a0f881becd1a54ec2ac129979fbb7cc851f4245d372d588056b040ccae152793e8808080808080a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a081b7693d9ef9dea4b83b27e12fd4a86cfd861c266865545c3602ec6a1e43039da026056fdebd58e774617d2b76dfb0bd14f7863bf6abcf25ba1c76e8527d4d79c3808080808080", - "0xe2a0200decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56305" - ], - "value":"0x5" - }, - { - "key":"0x1", - "proof":[ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf85180a0cf1bb0975c1421732acd6e4355d4be5a5cabef4b1abd7ad1567c30acd41ab25b808080808080808080808080a0e204403832678df9883635c3a4eef3fff75806929e3a828e1c540376fac686048080", - "0xf843a0200e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6a1a023d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb" - ], - "value":"0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb" - }, - { - "key":"0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e567", - "proof":[ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf871a042d46bd6345c4aa97249751c507918f4c57bceddb0fe070587a414720d29fab38080808080808080808080a0a77fe674993bb40786c6b15a7a82652bd9ba134b70533bb5cc0834388eeccb6680a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", - "0xf843a020418048a637d1641c6d732dd38174732bbf7b47a1cf6d5f65895384518b07d9a1a00253294570fb0c7f0da5fa9b928ab8b13b9b3756b7f35a1a9679aeb65fc80200" - ], - "value":"0x253294570fb0c7f0da5fa9b928ab8b13b9b3756b7f35a1a9679aeb65fc80200" - }, - { - "key":"0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56c", - "proof":[ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf8d18080a004086d122b3bd8d29156e97aacb81408ae87858145b9749f8f6c7bbf653d6ce38080a0f9c0b2156072e728e82a583460ac26e9b75f687388d79049d13a7ab29327771d8080a0998b4c87a8ca402a07093242127bd314af3bcf0fc00af2b1921d3e5b4e5b01a7a06633cf42917c5b16425df44ba19ca9ae58c1df7cd3038246724a4852e2b6599680a0a992e6dd730354f88103f2a04be2f93f7df0ee30d42b7c22b63890778050f37d80a08c1679d8cdc9ce14b68eeecf0172bed65e59f98f8bcf93021b0977f2cbb68941808080", - "0xf843a0205fcc8f73196524ea5f04c38888c2f09c6cbef411cb31e259d35b56e3d0047ba1a0562e5e2450e07504f981d9afff7cd7bdff456df99feeebed134055396100f554" - ], - "value":"0x562e5e2450e07504f981d9afff7cd7bdff456df99feeebed134055396100f554" - }, - { - "key":"0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e571", - "proof":[ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf871a092d2467f9ba1680676edd8692a803254a61cdcf90c43d6b7548c981c1e65e5c38080a08fc2be5da195cb1833f87d242270084c2db8504a66ee7ecad3e0d81f0c5311ee808080808080a04a5be21f4f0c0f5e1fcccb140e7cb5b1ff2ce45bce977d8e23cc7320e8c7bdd0808080808080", - "0xf843a0206695c256a4a4a1b8ed004dc824e330f1747032632c0e6d88c1d84c330c1c5ca1a0aad4bd309785201be407f829fb4caf4d2755129801d7eddde9fb6185be37a614" - ], - "value":"0xaad4bd309785201be407f829fb4caf4d2755129801d7eddde9fb6185be37a614" - }, - { - "key":"0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e576", - "proof":[ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf85180a0cf1bb0975c1421732acd6e4355d4be5a5cabef4b1abd7ad1567c30acd41ab25b808080808080808080808080a0e204403832678df9883635c3a4eef3fff75806929e3a828e1c540376fac686048080", - "0xf843a020257165ee8c7eae64faf81e97823d50dba1b6a2be88bccea1ac5d01256f0590a1a0bac5ca48e4744475a2d948a7971e73cafffe604f3a71ec98eda3260dafc8e7c9" - ], - "value":"0xbac5ca48e4744475a2d948a7971e73cafffe604f3a71ec98eda3260dafc8e7c9" - }, - { - "key":"0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e57b", - "proof":[ - "0xf90211a0d2725717b0dc0ad2c782d7f92e36b21b8054ce05b0df6227eb21c09909483e75a0eb1511485d0368e717ba162bb3cdd13933bc8b6299d52f1902958a1d42f73ca4a081446de294f6c00610a37af0dad90e23977892c778665ece595fbf35f3a2def3a0436b2e9e7b5d99132d389d049f229310acee0193cf90777619af076df6080bc5a08122bfaf4d5c3eccea4fa2eb0a7afbd7a4c2fa6e71a48d03b5b20a78b3e2fca7a02da6f733083d3f533764fa715660e2bc411ca96aa1d59251ad0ec88b3515862fa01653c820bc226b30ed86ea8de876b9f62db809042a04b867b488f199d14cc322a09f82d4a56e509b676d1925ee8ce2e7d7c373ba069a06774ddfaad33c8dfbc593a0cf7d43d47ddf7fa0a0e4c48c09098dc5c37270b64a235da410b91083eeba53c9a04626755b53b21357aa644d1d7b912fa015821c5c92a6b11df844eab18f5b7e7fa066783e2814f1bc7ba9597a35e0885fcd676779b489a234004410df576949ba20a016b062618466755d7bb13da623d10496c464de50ef1db084ec737ac40f2b24ada0d5e29411db3119d526e98b9f429036975526a8df0b906b6d7a719a1e9ac80646a047e949bf3c343a6f4f973d846265d225160337afbb83d4574bf3e3c459b6d17aa087c1dad57d3ed6cd8b65ab1279a87c0563b7921ce96fb56b08d959a5c4aa31aba01d6cc819b88e2433c90c9990aed9dc37c67c80729c88d583c96832b368b76d9b80", - "0xf871a042d46bd6345c4aa97249751c507918f4c57bceddb0fe070587a414720d29fab38080808080808080808080a0a77fe674993bb40786c6b15a7a82652bd9ba134b70533bb5cc0834388eeccb6680a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", - "0xf85180808080a0fae6b8484dccdec6b4ae5da10ddba033cc98da72665e01dcf1a2699204b48ad8808080808080808080a04083c8127572e64ae53476470e7a632258565a37b7f2066cb22ef228e679c24e8080", - "0xf8429f3d807394a26a5623e844d859daa1940d13cb7bda091582294562d688f4de00a1a0634a521ea3bb6908c905438f63e03c0d531792596113bcc9f858c8cc3a8eff18" - ], - "value":"0x634a521ea3bb6908c905438f63e03c0d531792596113bcc9f858c8cc3a8eff18" - } - ] - } - } - } - } - } \ No newline at end of file + "id": 1, + "result": { + "nodes": [ + { + "url": "https://in3-v2.slock.it/goerli/nd-1", + "address": "0x45d45e6ff99e6c34a235d263965910298985fcfe", + "index": 0, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227711, + "weight": 2000 + }, + { + "url": "https://in3-v2.slock.it/goerli/nd-2", + "address": "0x1fe2e9bf29aa1938859af64c413361227d04059a", + "index": 1, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227741, + "weight": 2000 + }, + { + "url": "https://in3-v2.slock.it/goerli/nd-3", + "address": "0x945f75c0408c0026a3cd204d36f5e47745182fd4", + "index": 2, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227801, + "weight": 2000 + }, + { + "url": "https://in3-v2.slock.it/goerli/nd-4", + "address": "0xc513a534de5a9d3f413152c41b09bd8116237fc8", + "index": 3, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227831, + "weight": 2000 + }, + { + "url": "https://in3-v2.slock.it/goerli/nd-5", + "address": "0xbcdf4e3e90cc7288b578329efd7bcc90655148d2", + "index": 4, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227876, + "weight": 2000 + }, + { + "url": "https://tincubeth.komputing.org/", + "address": "0xf944d416ebdf7f6e22eaf79a5a53ad1a487ddd9a", + "index": 5, + "deposit": "0x2386f26fc10000", + "props": "0x1d7e0000000a", + "timeout": 3456000, + "registerTime": 1578947320, + "weight": 1 + }, + { + "url": "https://h5l45fkzz7oc3gmb.onion/", + "address": "0x56d986deb3b5d14cb230d0f39247cc32416020b6", + "index": 6, + "deposit": "0x2386f26fc10000", + "props": "0x21660000000a", + "timeout": 3456000, + "registerTime": 1578954071, + "weight": 1 + } + ], + "contract": "0x5f51e413581dd76759e9eed51e63d14c8d1379c8", + "registryId": "0x67c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea", + "lastBlockNumber": 2276348, + "totalServers": 7 + }, + "jsonrpc": "2.0", + "in3": { + "execTime": 126, + "lastValidatorChange": 0, + "proof": { + "type": "accountProof", + "block": "0xf9025ca05b15c4d9014a57f19c037563bba8f3e39733b6bbeb730be5a6bd9a8677011d1da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0b3edf0f8f66f2b10ea77fb77d6dc43e6bc99eddf51910dc8c79e135f0ba062f9a0697d4da49cf730d9502a6e9d418f0cd3842c86be0085de59d51c2237972aa16ea04dc4fe69fff1798d2a06d4ddd7087d69e850b6b0c2d7553f0f02991fcb862576b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010028322bbfc837a1200830111f4845e5d5b4db861f09f928e20407072796c616273206e6f64652d3020f09f928e00000000000000a7e5fe715a2bddc9892d1070f70de87e11b89bc3509c2614129110bb4d4f350a3d6a3e13948a53841251ff04c9ead54d2473cb1e42130bad8938e5913297c8c900a00000000000000000000000000000000000000000000000000000000000000000880000000000000000", + "accounts": { + "0x5f51e413581dd76759e9eed51e63d14c8d1379c8": { + "accountProof": [ + "0xf90211a0d0041802b39b0d8bd4378870fa197e5003b421ac2bc80584948b3b60b5494fcba06322ab1446b2e05a586551002aca2a54e69e2e43d39f5b7b6f70afb480a64b4ca0b4882ba72df3c3d1b7ca77b564ec48dbf4ab5a92a50d68defd661be4d7878a33a00bb6eac3bdca095e582ba5da8b2be578f80342f2c6a01f2042b1ccc60b85abbea09109537ad73d5b8f008b732bc534b15cd2236e6b766a50d8c618e66270fde61fa02e77b7a5fd2d67c43aa3ab8ff34210223a33a09b8a7edbded1c3c631092e66aba051581e21dcea914f421eeed20d2077a64378c49afac44d7e68cadc37e381ea25a0da5a4c2ac0ab47dfbe886e015a72f374f31d1e7eae477a7a9d6165b29cf8c96ca0126132bfe5dd60bd3bca3d38cb58f1c873f4e10b18ecb3edbeadb6a9e3c649e1a0625f574e3a0e5c5ef39d154b41d51a655501f6cb6b75478e75548ed80fc77cd6a06cc1bf23c495e44a53028fa80a3ff456dee8ac834d7e206402e1b4b10fca523da0a5193530b3367a31bdaef12b0d5c335de05b875ae8115789f02e1f3a9f4f8b29a0a0036923d8d622eb6d7d7074b06fb8560d65ee988bc9d3dfddd6e20108bc01bca0ecbc61e03b4a37cc986d554ff6e2bf3cb900d928172f16a0baeb3ca3b15567c7a01d8386e911112eced18f14c29a46e4ee7615310edecfc571189c2d1e69db9907a0faa4de346fd2ac4ec484486721bf616790ff4e78f8c7d278a82ce926c2004ca280", + "0xf90211a08d0d30992008df5380950d4a30bcb85fe4b5eeb5e9d47555c90ca2234c8fae28a09a302760d70f3f2fa0c734f158d450f923c60578c0d529f0d549d706c477bc11a0762865973e46fe93a0a685d314e44f2ab84cc59b492842450c36fa397fd62469a0de35caac9820b0794cf37106feb3bdb0ad7f5e2215827d37a41acea831d04a16a09f98e10d34e06fb1781b872e39c31340d4ffcb3d910008e8b51354eb6601fa11a0a2febd9de2b468d25b1ec2637ea3d39e91cd29bc3601bbb6fa34b0b9cb63e415a0f380f3c2b51b87f2b5e4286b3fcb16ff74e351518eb92a576948cb063821ba59a0a44e858b9a24c4f135a0f6a3abadcb22db4bd7a1078b0517ecb265a2851a6aeba0ae5e6314da5f1606c9645357f1386f0c9ce7c48d2eeb98ec13cda7221575158ea05727b21aa0b265667cbbdeb748a7cbd97f314b77264f10a9e69b371c48e65122a0141f1557dd2463e0c9543b33a232e48fd38480f71103c181f89c489cd1a8f8bfa0543d1abb6740c1b8a32d673dd3eb8f820acf19d474a90d6ed4882466388ce4f7a0e2414ea84085dd02f8ef08affca0176efe7441c7a2a621d764500fb2384f9780a08e6d9f028885ab7b4b89bcb301c9b063d7090428187b8b7f4863b0b700ba549ca097d06d96cda5e4c4b5751f84265e7dd2658877e617b83aaf5d03f19c6ad221b4a0e59cfab2feab060e26dc24f1028b391ddbd29ba95839f6b4daf15fe95c30b00b80", + "0xf90211a07141c17f9fa7951761d2bb4fd14657ee63c26fcac0f453edcc40b53077b8cb49a02b1ca5efd39e8a92c786d47afb8cfd3779be68c944e9801bc7ba4c929d85344da01d1283ee9b93563a4c902fcaa91b650f7e4f03b8a4ed17573f1579787ff61b80a0ae1a099c4db1b5200630a8c28e8f45e6c4f4225621d58731f741d33be08f66d2a017d364fed382f188095309fdc368673de02d2da42bc5a2359d6511165011ba43a0730866177275ebb899cb4ab75b14a88aadf750449dd31a2c08ad7e13b783be8aa093ef04e32e63ac2a0cde09ad847e6173b85237978859b2128efd43c5812540c7a0c84f94a4c4e3ea68de7100e4b28fe4dfb2e54047adb6a49badd774a10f24543aa0a0e318859f0a2607fc274087ac0429602dc4bceca9a607ba37ee49e3a231dda2a0a411c30ed2e578256d2e446418216b8f590ab5e5e55e220c0d468dce23e1f761a05b780600a7bd74ea0327bcabcd6c43e2f2d025451850dbf362ddbd3f22729ae4a09e95eb773b6f31faad66dc56e3bfe287e4ee69ece42a3b7f30fde8b036e3bbaca0c84c78fd76cb13e9c5a087f1f1044ceb746831831d7476b17194f7f57c239b5fa0b4a5b67caf37da52aaf4ef490874f790e37f9a6e9aea1fa473ace0c91c8ec325a09e6487086f9452e35b966b84ea5434580580004d54914716b9194263d3ec0802a0d65313ba3300ad622207f36a1241ac74e7b18d30b814c7074cd1c932caaeacfa80", + "0xf901b1a02691bcd5e32c39f4f36d5b6b03f091948eb9ca3df225ddad93eb31b8497e4c1aa08e5e2cd65a2ec84ffbc2ae1c2066139423cfe71c351a8dd42b471faeb4c05dd6a0bc2809c3a3720f2b0fae7dea4f7efedb4327a48c151b89b090ab99dee7bdcf4aa01f28521aec2d7a50a466f88281e6e827d5509bc5a77be74f3f704fd91079442da05ed7f0cf73f299255bfc2bdf20b31a709518fb71bdcaa9fb8fd488ad07af28ae80a03ecd2de48b44e54b5b892520291fd2601ddff191ba446997f3587d51e8f68ddfa097a4d6d7f15b05d96ed7511e39aae51032fc3648c15eb4d789ce8916f79a78a180a0bb081130c535bc8a46528bae3596200eb99d0b99bde40ad12b624e2466c7757ba0296c2142079e1c5b73bd703978eaa04e3b9123a240f7bc046a9cb701fd064435a04c35b4967661e70f5068aa326f3599c7393498e1b082b8b26062f98ffbb2e8f4a023d8b0cdfc5807cf338a56b1260118129ce2d1080dca624d02c1e7a44ef7255fa068665baa882f2e62da7897273881f510f3768c3d9878efdf097085ef3f0b5ac480a0d4524fcdca73a594f45be8e41613995cdd8bd38512c6932f04f6d6787ca4856380", + "0xf87180a05da0431ddcf9c0df5220e90991d6fafadcbb70ec9e51c042a743f4d1980df7c4a05e856a872504286cb6dbb11c85fab4ca263a72cbee0a785053fbbb4f2d6078738080808080a09922b3a2aac38c7bd2332ec05abd047f2fb7858f2d2ae4f6c49bce18b73eae948080808080808080", + "0xf8679e3860ace08b3156e1e8b3657a41748919bc942fd9e0f3de90d72f6e5bdfc3b846f8440180a0ee67942d4ba6f187e143ee4568896cf8db17df6298d91961b468176ef9e6ba0ba029140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1" + ], + "address": "0x5f51e413581dd76759e9eed51e63d14c8d1379c8", + "balance": "0x0", + "codeHash": "0x29140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1", + "nonce": "0x1", + "storageHash": "0xee67942d4ba6f187e143ee4568896cf8db17df6298d91961b468176ef9e6ba0b", + "storageProof": [ + { + "key": "0x0", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8d1a0f881becd1a54ec2ac129979fbb7cc851f4245d372d588056b040ccae152793e88080a028b34037d7d67765fa1cd15091337086eacdd8770b711a026d4ee0a839f8b3f2808080a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a0c9c743682962d9d06dd0f9ed6cb2620cce02f34a0a4f5d60a4e5d1e081a5b5fba0bf73b8437dc32850158814b8c0c28c9c76a22c373fa84a77c3fc2175317a6aa18080a0bd01265657739e1793ae1ad68a77f330e98f0d5d5a53235211faa848c3eea787808080", + "0xe2a0200decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56307" + ], + "value": "0x7" + }, + { + "key": "0x1", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf85180a0fb829ab79f00d7bab5aa54e5cfd67ae721eaf17d076bca3984477a72b5391c92808080808080808080808080a0f7fc12e7aa12b24609029780c05d852e0ddb7e1eceaf8671a2e2d3c1aa7bd8068080", + "0xf843a0200e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6a1a067c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea" + ], + "value": "0x67c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e567", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf891a031b20905ab02dba97c5a82079a50550a5a70d3f5e7f25cfe6c9e88b1c3768ae8808080808080a01b7ed3dd208fb30e8581d7e5278fb4581b99f960be8d08ff41759b10b537dfe080808080a03b77164a66693f214b5328da08b60566b0aeae3d719121004ed8c6d6e49ca5e580a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", + "0xf843a020418048a637d1641c6d732dd38174732bbf7b47a1cf6d5f65895384518b07d9a1a02b80cb1b568146d64e7a622d7b895925d06ef8582fa0166d8ec069f86070610a" + ], + "value": "0x2b80cb1b568146d64e7a622d7b895925d06ef8582fa0166d8ec069f86070610a" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56c", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8f18080a03c79db405090818f0b5b51e29d2ac7b67f6ff814b03e773af1975584a0dd1f908080a0a26c5f90f028898be4e12961969ae89f323a66586730f92b8fb2dd1ca0ba6f8a80a078c9aaa17553d7357d2014c0a75c9de51fdab46248846ddf03ea16d8cb790b0e80a04a0c4b948805886065449dad60fce7e1c7680a3bc4a235800fbd2edafac731e680a0c50523b8a14aff442da2ba7343c04f960e59083796de9ba7fcbbd592959515f180a0df910adad94453538847b694bdb134432b0a9e2cc829dce2346460720fd2ee5380a06e1a723ced013021ff250a9fdd129c3a7c1aa3970d955cd28688dbdff277174880", + "0xf843a0205fcc8f73196524ea5f04c38888c2f09c6cbef411cb31e259d35b56e3d0047ba1a00c2f5e53902cca915645c2f00ae6a6357ce4aafa18140db4be24d33f41709b6e" + ], + "value": "0xc2f5e53902cca915645c2f00ae6a6357ce4aafa18140db4be24d33f41709b6e" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e571", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8b1a0f3ab6aa3f0575916e985798d7ee01e8c75436765f043cdfba2ad10f36b47f6d48080a069a129011ab4666f131c1bdac7d923dcbb6f1047057a62d6ecede5d17057658280a064bde28657cfaa21b487ad660da11e94a06a1b7f46502263094cde0407dfd24380808080a04a5be21f4f0c0f5e1fcccb140e7cb5b1ff2ce45bce977d8e23cc7320e8c7bdd080a015cb29fd7064f1cbac8773177854799e563e10ba66e44c5adf25b31fa39a7d3980808080", + "0xf843a0206695c256a4a4a1b8ed004dc824e330f1747032632c0e6d88c1d84c330c1c5ca1a098d7a1f953e0805e2053a6ab062f8a16f1d35b9fc7bad41fd10eece87cc1b280" + ], + "value": "0x98d7a1f953e0805e2053a6ab062f8a16f1d35b9fc7bad41fd10eece87cc1b280" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e576", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf85180a0fb829ab79f00d7bab5aa54e5cfd67ae721eaf17d076bca3984477a72b5391c92808080808080808080808080a0f7fc12e7aa12b24609029780c05d852e0ddb7e1eceaf8671a2e2d3c1aa7bd8068080", + "0xf843a020257165ee8c7eae64faf81e97823d50dba1b6a2be88bccea1ac5d01256f0590a1a079c63d2302907690c944fa45f7405ac59b364089f366764025f13f2055511b43" + ], + "value": "0x79c63d2302907690c944fa45f7405ac59b364089f366764025f13f2055511b43" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e57b", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf891a031b20905ab02dba97c5a82079a50550a5a70d3f5e7f25cfe6c9e88b1c3768ae8808080808080a01b7ed3dd208fb30e8581d7e5278fb4581b99f960be8d08ff41759b10b537dfe080808080a03b77164a66693f214b5328da08b60566b0aeae3d719121004ed8c6d6e49ca5e580a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", + "0xf85180808080a0fe0a1c808c8e90225d5dcfad8bde23daee522b2905b605bc6eb5c39596018464808080808080808080a04083c8127572e64ae53476470e7a632258565a37b7f2066cb22ef228e679c24e8080", + "0xf8429f3d807394a26a5623e844d859daa1940d13cb7bda091582294562d688f4de00a1a0a7b2aa99ebb2a9e076a84dfd43cc1355ca060aea5b8bb1f1ee825e131125e462" + ], + "value": "0xa7b2aa99ebb2a9e076a84dfd43cc1355ca060aea5b8bb1f1ee825e131125e462" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e580", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8d1a0f881becd1a54ec2ac129979fbb7cc851f4245d372d588056b040ccae152793e88080a028b34037d7d67765fa1cd15091337086eacdd8770b711a026d4ee0a839f8b3f2808080a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a0c9c743682962d9d06dd0f9ed6cb2620cce02f34a0a4f5d60a4e5d1e081a5b5fba0bf73b8437dc32850158814b8c0c28c9c76a22c373fa84a77c3fc2175317a6aa18080a0bd01265657739e1793ae1ad68a77f330e98f0d5d5a53235211faa848c3eea787808080", + "0xf843a0202f0f7a7af9ed4f160d1c425f37d148d10bddb9c828e99d4145b150485711cea1a0ac8d18ba63b2e8486a3c5bd9915b9335d0df0862e5601476fadf568443a8cca0" + ], + "value": "0xac8d18ba63b2e8486a3c5bd9915b9335d0df0862e5601476fadf568443a8cca0" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e585", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8f18080a03c79db405090818f0b5b51e29d2ac7b67f6ff814b03e773af1975584a0dd1f908080a0a26c5f90f028898be4e12961969ae89f323a66586730f92b8fb2dd1ca0ba6f8a80a078c9aaa17553d7357d2014c0a75c9de51fdab46248846ddf03ea16d8cb790b0e80a04a0c4b948805886065449dad60fce7e1c7680a3bc4a235800fbd2edafac731e680a0c50523b8a14aff442da2ba7343c04f960e59083796de9ba7fcbbd592959515f180a0df910adad94453538847b694bdb134432b0a9e2cc829dce2346460720fd2ee5380a06e1a723ced013021ff250a9fdd129c3a7c1aa3970d955cd28688dbdff277174880", + "0xf843a0207c73e826b7dd131777470492494a9f14b451e947ae119760ac27c5aac4422ca1a01fae1104ad418c61c2e19407f6151fa634431da77d15469ffd1b993986fccc59" + ], + "value": "0x1fae1104ad418c61c2e19407f6151fa634431da77d15469ffd1b993986fccc59" + } + ] + } + }, + "signatures": [ + { + "blockHash": "0xb1ca57784055c67d58cf76924355e0ff2324237769efdcdb2cea6824896cb0a2", + "block": 2276348, + "r": "0x67ba22ce31bf6c6e06b55109e5cbe67633ba20c7275b89fa93819fde744e1c69", + "s": "0x46a77396374f817acac3ae0bfde5b3efbdfa33fd0e72516176e60dae8a1dc41b", + "v": 28, + "msgHash": "0x4e242053e85d8d3ef8bae15d6efdb24af2086f5047a371830083a9fce3ab01d1" + } + ] + } + } +} \ No newline at end of file From e791a01c84956c5829db0fd61bfe17d54e7effd7 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 10 Mar 2020 21:46:41 +0100 Subject: [PATCH 37/97] Update java mock builder node config --- java/test/in3/IN3MockBuilder.java | 25 +++++++++++++------------ java/test/in3/IN3Test.java | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/java/test/in3/IN3MockBuilder.java b/java/test/in3/IN3MockBuilder.java index 8e8b84794..eb5ef5cae 100644 --- a/java/test/in3/IN3MockBuilder.java +++ b/java/test/in3/IN3MockBuilder.java @@ -2,6 +2,7 @@ import in3.config.ChainConfiguration; import in3.config.ClientConfiguration; +import in3.config.NodeConfiguration; public class IN3MockBuilder { private IN3 client; @@ -29,20 +30,20 @@ public void buildTransport(String[][] fileNameTuples) { public void buildConfig() { ClientConfiguration clientConfig = client.getConfig(); - ChainConfiguration nodeConfig1 = new ChainConfiguration(Chain.MAINNET, clientConfig); - nodeConfig1.setNeedsUpdate(false); - nodeConfig1.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f"); - nodeConfig1.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb"); + ChainConfiguration chainConfig1 = new ChainConfiguration(Chain.MAINNET, clientConfig); + chainConfig1.setNeedsUpdate(false); + chainConfig1.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f"); + chainConfig1.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb"); - ChainConfiguration nodeConfig2 = new ChainConfiguration(Chain.GOERLI, clientConfig); - nodeConfig2.setNeedsUpdate(false); - nodeConfig2.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f"); - nodeConfig2.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb"); + ChainConfiguration chainConfig2 = new ChainConfiguration(Chain.GOERLI, clientConfig); + chainConfig2.setNeedsUpdate(false); + chainConfig2.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f"); + chainConfig2.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb"); - ChainConfiguration nodeConfig3 = new ChainConfiguration(Chain.KOVAN, clientConfig); - nodeConfig3.setNeedsUpdate(false); - nodeConfig3.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f"); - nodeConfig3.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb"); + ChainConfiguration chainConfig3 = new ChainConfiguration(Chain.KOVAN, clientConfig); + chainConfig3.setNeedsUpdate(false); + chainConfig3.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f"); + chainConfig3.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb"); clientConfig.setRequestCount(1); clientConfig.setAutoUpdateList(false); diff --git a/java/test/in3/IN3Test.java b/java/test/in3/IN3Test.java index ddd19a8f2..0c750b621 100644 --- a/java/test/in3/IN3Test.java +++ b/java/test/in3/IN3Test.java @@ -12,7 +12,7 @@ public void setBuilder() { {"eth_call", "eth_call_2.json"}, {"in3_nodeList", "in3_nodeList.json"}, {"in3_sign", "in3_sign.json"}}; - IN3MockBuilder builder = new IN3MockBuilder(Chain.MAINNET); + IN3MockBuilder builder = new IN3MockBuilder(Chain.GOERLI); in3 = builder.constructClient(mockedResponses); } From e8f4d63a97427a6fac3c0e1a0a5f5b71f010ac4c Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 10 Mar 2020 21:48:05 +0100 Subject: [PATCH 38/97] Add node to java mock builder --- java/test/in3/IN3MockBuilder.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/java/test/in3/IN3MockBuilder.java b/java/test/in3/IN3MockBuilder.java index eb5ef5cae..4d726a7c1 100644 --- a/java/test/in3/IN3MockBuilder.java +++ b/java/test/in3/IN3MockBuilder.java @@ -40,6 +40,12 @@ public void buildConfig() { chainConfig2.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f"); chainConfig2.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb"); + // Necessary for nodelist test to pass + NodeConfiguration nodeConfig = new NodeConfiguration(chainConfig2); + nodeConfig.setUrl("https://in3-v2.slock.it/goerli/nd-2"); + nodeConfig.setAddress("0x1fe2e9bf29aa1938859af64c413361227d04059a"); + nodeConfig.setProps(0); + ChainConfiguration chainConfig3 = new ChainConfiguration(Chain.KOVAN, clientConfig); chainConfig3.setNeedsUpdate(false); chainConfig3.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f"); From 3d773e754533057f53d3f7facb768d02c6690a10 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 10 Mar 2020 21:48:13 +0100 Subject: [PATCH 39/97] add saltgen --- c/src/third-party/libscrypt/CMakeLists.txt | 1 + c/src/third-party/libscrypt/crypto-scrypt-saltgen.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/c/src/third-party/libscrypt/CMakeLists.txt b/c/src/third-party/libscrypt/CMakeLists.txt index e2e831c20..07509d1c1 100644 --- a/c/src/third-party/libscrypt/CMakeLists.txt +++ b/c/src/third-party/libscrypt/CMakeLists.txt @@ -40,6 +40,7 @@ add_library(scrypt_o OBJECT crypto_scrypt-nosse.c sha256.c crypto_scrypt-hash.c + crypto-scrypt-saltgen.c slowequals.c ) ADD_DEFINITIONS(-DSCRYPT) diff --git a/c/src/third-party/libscrypt/crypto-scrypt-saltgen.c b/c/src/third-party/libscrypt/crypto-scrypt-saltgen.c index e24aa3cbf..1c0086032 100644 --- a/c/src/third-party/libscrypt/crypto-scrypt-saltgen.c +++ b/c/src/third-party/libscrypt/crypto-scrypt-saltgen.c @@ -3,6 +3,13 @@ #include #include #include +#if defined(_MSC_VER) || defined(__MINGW32__) +#include // alloca +#else +#ifndef __ZEPHYR__ +#include // alloca +#endif +#endif /* Disable on Windows, there is no /dev/urandom. Link-time error is better than runtime error. */ @@ -16,7 +23,7 @@ int libscrypt_salt_gen(uint8_t *salt, size_t len) { - unsigned char buf[len]; + unsigned char *buf = alloca(len); size_t data_read = 0; int urandom = open(RNGDEV, O_RDONLY); From 70de917743e172df9d0aae672885abab912320db Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 10 Mar 2020 22:15:22 +0100 Subject: [PATCH 40/97] add scrypt-test --- c/test/testdata/requests/in3_keys.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/c/test/testdata/requests/in3_keys.json b/c/test/testdata/requests/in3_keys.json index eb8c762ad..f2bc9f66e 100644 --- a/c/test/testdata/requests/in3_keys.json +++ b/c/test/testdata/requests/in3_keys.json @@ -145,5 +145,24 @@ "jsonrpc": "2.0" } ] + }, + { + "descr": "in3_decryptKey scrypt", + "chainId": "0x1", + "intern": true, + "request": { + "method": "in3_decryptKey", + "params": [ + {"version":3,"id":"c6efce20-e867-4ced-914b-996480c31757","address":"50a5dda1e41c1858f771d3dac944b75d5626d1b2","crypto":{"ciphertext":"d13228a430d6ec1108a7e076ceed39102fb21b0b0fe53cadf5a0d0f7496c9ee0","cipherparams":{"iv":"0b7adca34fb47b1250bd1b7944cc94e9"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"d748c19fe9982fbc3c7f3cea203f3ed948f9a4eb07729bfe112fe5f647e1bca6","n":131072,"r":8,"p":1},"mac":"43aa4502be45f2679eb3a63971fb9f7e6fb2425e14099746a0c87076a8b729c4"}}, + "ABCabc123AB" + ] + }, + "response": [ + { + "id": 1, + "result": "0x7e455c36bba6b1083ea5ad1a414e2a047d143d828b035e19c4d697902b1c76b7", + "jsonrpc": "2.0" + } + ] } ] \ No newline at end of file From 426be59c958ba2997fc2cf646daba9bf7de9a62e Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 10 Mar 2020 22:21:06 +0100 Subject: [PATCH 41/97] Suppress false positive clang check --- c/src/core/client/client_init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/c/src/core/client/client_init.c b/c/src/core/client/client_init.c index 6feef4b8e..3d0e9bba0 100644 --- a/c/src/core/client/client_init.c +++ b/c/src/core/client/client_init.c @@ -689,7 +689,9 @@ char* in3_configure(in3_t* c, const char* config) { d_get_longkd(n.token, key("props"), 65535), d_get_byteskl(n.token, key("address"), 20)->data) == IN3_OK, "add node failed"); +#ifndef __clang_analyzer__ BIT_SET(chain->nodelist[i].attrs, ATTR_BOOT_NODE); +#endif } } else { EXPECT_TOK(cp.token, false, "unsupported config option!"); From 1644abf0b64aa704dbe4c85bce4ab45572f1730b Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 10 Mar 2020 22:29:20 +0100 Subject: [PATCH 42/97] fix scrypt for win --- c/src/third-party/libscrypt/crypto-scrypt-saltgen.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/c/src/third-party/libscrypt/crypto-scrypt-saltgen.c b/c/src/third-party/libscrypt/crypto-scrypt-saltgen.c index 1c0086032..2834395c8 100644 --- a/c/src/third-party/libscrypt/crypto-scrypt-saltgen.c +++ b/c/src/third-party/libscrypt/crypto-scrypt-saltgen.c @@ -57,5 +57,10 @@ int libscrypt_salt_gen(uint8_t *salt, size_t len) return 0; } +#else +int libscrypt_salt_gen(uint8_t *salt, size_t len) { + if (salt || len) return -1; + return -1; +} #endif From 20fa0483d894e2214f870126a8b33abc6594d3ba Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 10 Mar 2020 23:04:53 +0100 Subject: [PATCH 43/97] fix wasm --- .../libscrypt/crypto_scrypt-nosse.c | 445 +++++++++--------- c/test/testdata/requests/in3_keys.json | 22 +- 2 files changed, 249 insertions(+), 218 deletions(-) diff --git a/c/src/third-party/libscrypt/crypto_scrypt-nosse.c b/c/src/third-party/libscrypt/crypto_scrypt-nosse.c index 12c860f2d..afa4ff243 100644 --- a/c/src/third-party/libscrypt/crypto_scrypt-nosse.c +++ b/c/src/third-party/libscrypt/crypto_scrypt-nosse.c @@ -40,36 +40,37 @@ #include "sysendian.h" #include "libscrypt.h" +#ifdef __EMSCRIPTEN__ +#undef MAP_ANON +#endif -static void blkcpy(void *, void *, size_t); -static void blkxor(void *, void *, size_t); -static void salsa20_8(uint32_t[16]); -static void blockmix_salsa8(uint32_t *, uint32_t *, uint32_t *, size_t); -static uint64_t integerify(void *, size_t); -static void smix(uint8_t *, size_t, uint64_t, uint32_t *, uint32_t *); +static void blkcpy(void*, void*, size_t); +static void blkxor(void*, void*, size_t); +static void salsa20_8(uint32_t[16]); +static void blockmix_salsa8(uint32_t*, uint32_t*, uint32_t*, size_t); +static uint64_t integerify(void*, size_t); +static void smix(uint8_t*, size_t, uint64_t, uint32_t*, uint32_t*); static void -blkcpy(void * dest, void * src, size_t len) -{ - size_t * D = dest; - size_t * S = src; - size_t L = len / sizeof(size_t); - size_t i; - - for (i = 0; i < L; i++) - D[i] = S[i]; +blkcpy(void* dest, void* src, size_t len) { + size_t* D = dest; + size_t* S = src; + size_t L = len / sizeof(size_t); + size_t i; + + for (i = 0; i < L; i++) + D[i] = S[i]; } static void -blkxor(void * dest, void * src, size_t len) -{ - size_t * D = dest; - size_t * S = src; - size_t L = len / sizeof(size_t); - size_t i; - - for (i = 0; i < L; i++) - D[i] ^= S[i]; +blkxor(void* dest, void* src, size_t len) { + size_t* D = dest; + size_t* S = src; + size_t L = len / sizeof(size_t); + size_t i; + + for (i = 0; i < L; i++) + D[i] ^= S[i]; } /** @@ -77,43 +78,58 @@ blkxor(void * dest, void * src, size_t len) * Apply the salsa20/8 core to the provided block. */ static void -salsa20_8(uint32_t B[16]) -{ - uint32_t x[16]; - size_t i; - - blkcpy(x, B, 64); - for (i = 0; i < 8; i += 2) { -#define R(a,b) (((a) << (b)) | ((a) >> (32 - (b)))) - /* Operate on columns. */ - x[ 4] ^= R(x[ 0]+x[12], 7); x[ 8] ^= R(x[ 4]+x[ 0], 9); - x[12] ^= R(x[ 8]+x[ 4],13); x[ 0] ^= R(x[12]+x[ 8],18); - - x[ 9] ^= R(x[ 5]+x[ 1], 7); x[13] ^= R(x[ 9]+x[ 5], 9); - x[ 1] ^= R(x[13]+x[ 9],13); x[ 5] ^= R(x[ 1]+x[13],18); - - x[14] ^= R(x[10]+x[ 6], 7); x[ 2] ^= R(x[14]+x[10], 9); - x[ 6] ^= R(x[ 2]+x[14],13); x[10] ^= R(x[ 6]+x[ 2],18); - - x[ 3] ^= R(x[15]+x[11], 7); x[ 7] ^= R(x[ 3]+x[15], 9); - x[11] ^= R(x[ 7]+x[ 3],13); x[15] ^= R(x[11]+x[ 7],18); - - /* Operate on rows. */ - x[ 1] ^= R(x[ 0]+x[ 3], 7); x[ 2] ^= R(x[ 1]+x[ 0], 9); - x[ 3] ^= R(x[ 2]+x[ 1],13); x[ 0] ^= R(x[ 3]+x[ 2],18); - - x[ 6] ^= R(x[ 5]+x[ 4], 7); x[ 7] ^= R(x[ 6]+x[ 5], 9); - x[ 4] ^= R(x[ 7]+x[ 6],13); x[ 5] ^= R(x[ 4]+x[ 7],18); - - x[11] ^= R(x[10]+x[ 9], 7); x[ 8] ^= R(x[11]+x[10], 9); - x[ 9] ^= R(x[ 8]+x[11],13); x[10] ^= R(x[ 9]+x[ 8],18); - - x[12] ^= R(x[15]+x[14], 7); x[13] ^= R(x[12]+x[15], 9); - x[14] ^= R(x[13]+x[12],13); x[15] ^= R(x[14]+x[13],18); +salsa20_8(uint32_t B[16]) { + uint32_t x[16]; + size_t i; + + blkcpy(x, B, 64); + for (i = 0; i < 8; i += 2) { +#define R(a, b) (((a) << (b)) | ((a) >> (32 - (b)))) + /* Operate on columns. */ + x[4] ^= R(x[0] + x[12], 7); + x[8] ^= R(x[4] + x[0], 9); + x[12] ^= R(x[8] + x[4], 13); + x[0] ^= R(x[12] + x[8], 18); + + x[9] ^= R(x[5] + x[1], 7); + x[13] ^= R(x[9] + x[5], 9); + x[1] ^= R(x[13] + x[9], 13); + x[5] ^= R(x[1] + x[13], 18); + + x[14] ^= R(x[10] + x[6], 7); + x[2] ^= R(x[14] + x[10], 9); + x[6] ^= R(x[2] + x[14], 13); + x[10] ^= R(x[6] + x[2], 18); + + x[3] ^= R(x[15] + x[11], 7); + x[7] ^= R(x[3] + x[15], 9); + x[11] ^= R(x[7] + x[3], 13); + x[15] ^= R(x[11] + x[7], 18); + + /* Operate on rows. */ + x[1] ^= R(x[0] + x[3], 7); + x[2] ^= R(x[1] + x[0], 9); + x[3] ^= R(x[2] + x[1], 13); + x[0] ^= R(x[3] + x[2], 18); + + x[6] ^= R(x[5] + x[4], 7); + x[7] ^= R(x[6] + x[5], 9); + x[4] ^= R(x[7] + x[6], 13); + x[5] ^= R(x[4] + x[7], 18); + + x[11] ^= R(x[10] + x[9], 7); + x[8] ^= R(x[11] + x[10], 9); + x[9] ^= R(x[8] + x[11], 13); + x[10] ^= R(x[9] + x[8], 18); + + x[12] ^= R(x[15] + x[14], 7); + x[13] ^= R(x[12] + x[15], 9); + x[14] ^= R(x[13] + x[12], 13); + x[15] ^= R(x[14] + x[13], 18); #undef R - } - for (i = 0; i < 16; i++) - B[i] += x[i]; + } + for (i = 0; i < 16; i++) + B[i] += x[i]; } /** @@ -123,31 +139,30 @@ salsa20_8(uint32_t B[16]) * temporary space X must be 64 bytes. */ static void -blockmix_salsa8(uint32_t * Bin, uint32_t * Bout, uint32_t * X, size_t r) -{ - size_t i; - - /* 1: X <-- B_{2r - 1} */ - blkcpy(X, &Bin[(2 * r - 1) * 16], 64); - - /* 2: for i = 0 to 2r - 1 do */ - for (i = 0; i < 2 * r; i += 2) { - /* 3: X <-- H(X \xor B_i) */ - blkxor(X, &Bin[i * 16], 64); - salsa20_8(X); - - /* 4: Y_i <-- X */ - /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ - blkcpy(&Bout[i * 8], X, 64); - - /* 3: X <-- H(X \xor B_i) */ - blkxor(X, &Bin[i * 16 + 16], 64); - salsa20_8(X); - - /* 4: Y_i <-- X */ - /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ - blkcpy(&Bout[i * 8 + r * 16], X, 64); - } +blockmix_salsa8(uint32_t* Bin, uint32_t* Bout, uint32_t* X, size_t r) { + size_t i; + + /* 1: X <-- B_{2r - 1} */ + blkcpy(X, &Bin[(2 * r - 1) * 16], 64); + + /* 2: for i = 0 to 2r - 1 do */ + for (i = 0; i < 2 * r; i += 2) { + /* 3: X <-- H(X \xor B_i) */ + blkxor(X, &Bin[i * 16], 64); + salsa20_8(X); + + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + blkcpy(&Bout[i * 8], X, 64); + + /* 3: X <-- H(X \xor B_i) */ + blkxor(X, &Bin[i * 16 + 16], 64); + salsa20_8(X); + + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + blkcpy(&Bout[i * 8 + r * 16], X, 64); + } } /** @@ -155,11 +170,10 @@ blockmix_salsa8(uint32_t * Bin, uint32_t * Bout, uint32_t * X, size_t r) * Return the result of parsing B_{2r-1} as a little-endian integer. */ static uint64_t -integerify(void * B, size_t r) -{ - uint32_t * X = (void *)((uintptr_t)(B) + (2 * r - 1) * 64); +integerify(void* B, size_t r) { + uint32_t* X = (void*) ((uintptr_t)(B) + (2 * r - 1) * 64); - return (((uint64_t)(X[1]) << 32) + X[0]); + return (((uint64_t)(X[1]) << 32) + X[0]); } /** @@ -171,54 +185,53 @@ integerify(void * B, size_t r) * multiple of 64 bytes. */ static void -smix(uint8_t * B, size_t r, uint64_t N, uint32_t * V, uint32_t * XY) -{ - uint32_t * X = XY; - uint32_t * Y = &XY[32 * r]; - uint32_t * Z = &XY[64 * r]; - uint64_t i; - uint64_t j; - size_t k; - - /* 1: X <-- B */ - for (k = 0; k < 32 * r; k++) - X[k] = le32dec(&B[4 * k]); - - /* 2: for i = 0 to N - 1 do */ - for (i = 0; i < N; i += 2) { - /* 3: V_i <-- X */ - blkcpy(&V[i * (32 * r)], X, 128 * r); - - /* 4: X <-- H(X) */ - blockmix_salsa8(X, Y, Z, r); - - /* 3: V_i <-- X */ - blkcpy(&V[(i + 1) * (32 * r)], Y, 128 * r); - - /* 4: X <-- H(X) */ - blockmix_salsa8(Y, X, Z, r); - } - - /* 6: for i = 0 to N - 1 do */ - for (i = 0; i < N; i += 2) { - /* 7: j <-- Integerify(X) mod N */ - j = integerify(X, r) & (N - 1); - - /* 8: X <-- H(X \xor V_j) */ - blkxor(X, &V[j * (32 * r)], 128 * r); - blockmix_salsa8(X, Y, Z, r); - - /* 7: j <-- Integerify(X) mod N */ - j = integerify(Y, r) & (N - 1); - - /* 8: X <-- H(X \xor V_j) */ - blkxor(Y, &V[j * (32 * r)], 128 * r); - blockmix_salsa8(Y, X, Z, r); - } - - /* 10: B' <-- X */ - for (k = 0; k < 32 * r; k++) - le32enc(&B[4 * k], X[k]); +smix(uint8_t* B, size_t r, uint64_t N, uint32_t* V, uint32_t* XY) { + uint32_t* X = XY; + uint32_t* Y = &XY[32 * r]; + uint32_t* Z = &XY[64 * r]; + uint64_t i; + uint64_t j; + size_t k; + + /* 1: X <-- B */ + for (k = 0; k < 32 * r; k++) + X[k] = le32dec(&B[4 * k]); + + /* 2: for i = 0 to N - 1 do */ + for (i = 0; i < N; i += 2) { + /* 3: V_i <-- X */ + blkcpy(&V[i * (32 * r)], X, 128 * r); + + /* 4: X <-- H(X) */ + blockmix_salsa8(X, Y, Z, r); + + /* 3: V_i <-- X */ + blkcpy(&V[(i + 1) * (32 * r)], Y, 128 * r); + + /* 4: X <-- H(X) */ + blockmix_salsa8(Y, X, Z, r); + } + + /* 6: for i = 0 to N - 1 do */ + for (i = 0; i < N; i += 2) { + /* 7: j <-- Integerify(X) mod N */ + j = integerify(X, r) & (N - 1); + + /* 8: X <-- H(X \xor V_j) */ + blkxor(X, &V[j * (32 * r)], 128 * r); + blockmix_salsa8(X, Y, Z, r); + + /* 7: j <-- Integerify(X) mod N */ + j = integerify(Y, r) & (N - 1); + + /* 8: X <-- H(X \xor V_j) */ + blkxor(Y, &V[j * (32 * r)], 128 * r); + blockmix_salsa8(Y, X, Z, r); + } + + /* 10: B' <-- X */ + for (k = 0; k < 32 * r; k++) + le32enc(&B[4 * k], X[k]); } /** @@ -230,113 +243,111 @@ smix(uint8_t * B, size_t r, uint64_t N, uint32_t * V, uint32_t * XY) * * Return 0 on success; or -1 on error */ -int -libscrypt_scrypt(const uint8_t * passwd, size_t passwdlen, - const uint8_t * salt, size_t saltlen, uint64_t N, uint32_t r, uint32_t p, - uint8_t * buf, size_t buflen) -{ - void * B0, * V0, * XY0; - uint8_t * B; - uint32_t * V; - uint32_t * XY; - uint32_t i; - - /* Sanity-check parameters. */ +int libscrypt_scrypt(const uint8_t* passwd, size_t passwdlen, + const uint8_t* salt, size_t saltlen, uint64_t N, uint32_t r, uint32_t p, + uint8_t* buf, size_t buflen) { + void * B0, *V0, *XY0; + uint8_t* B; + uint32_t* V; + uint32_t* XY; + uint32_t i; + + /* Sanity-check parameters. */ #if SIZE_MAX > UINT32_MAX - if (buflen > (((uint64_t)(1) << 32) - 1) * 32) { - errno = EFBIG; - goto err0; - } + if (buflen > (((uint64_t)(1) << 32) - 1) * 32) { + errno = EFBIG; + goto err0; + } #endif - if ((uint64_t)(r) * (uint64_t)(p) >= (1 << 30)) { - errno = EFBIG; - goto err0; - } - if (r == 0 || p == 0) { - errno = EINVAL; - goto err0; - } - if (((N & (N - 1)) != 0) || (N < 2)) { - errno = EINVAL; - goto err0; - } - if ((r > SIZE_MAX / 128 / p) || + if ((uint64_t)(r) * (uint64_t)(p) >= (1 << 30)) { + errno = EFBIG; + goto err0; + } + if (r == 0 || p == 0) { + errno = EINVAL; + goto err0; + } + if (((N & (N - 1)) != 0) || (N < 2)) { + errno = EINVAL; + goto err0; + } + if ((r > SIZE_MAX / 128 / p) || #if SIZE_MAX / 256 <= UINT32_MAX - (r > SIZE_MAX / 256) || + (r > SIZE_MAX / 256) || #endif - (N > SIZE_MAX / 128 / r)) { - errno = ENOMEM; - goto err0; - } + (N > SIZE_MAX / 128 / r)) { + errno = ENOMEM; + goto err0; + } - /* Allocate memory. */ + /* Allocate memory. */ #ifdef HAVE_POSIX_MEMALIGN - if ((errno = posix_memalign(&B0, 64, 128 * r * p)) != 0) - goto err0; - B = (uint8_t *)(B0); - if ((errno = posix_memalign(&XY0, 64, 256 * r + 64)) != 0) - goto err1; - XY = (uint32_t *)(XY0); + if ((errno = posix_memalign(&B0, 64, 128 * r * p)) != 0) + goto err0; + B = (uint8_t*) (B0); + if ((errno = posix_memalign(&XY0, 64, 256 * r + 64)) != 0) + goto err1; + XY = (uint32_t*) (XY0); #ifndef MAP_ANON - if ((errno = posix_memalign(&V0, 64, 128 * r * N)) != 0) - goto err2; - V = (uint32_t *)(V0); + if ((errno = posix_memalign(&V0, 64, 128 * r * N)) != 0) + goto err2; + V = (uint32_t*) (V0); #endif #else - if ((B0 = malloc(128 * r * p + 63)) == NULL) - goto err0; - B = (uint8_t *)(((uintptr_t)(B0) + 63) & ~ (uintptr_t)(63)); - if ((XY0 = malloc(256 * r + 64 + 63)) == NULL) - goto err1; - XY = (uint32_t *)(((uintptr_t)(XY0) + 63) & ~ (uintptr_t)(63)); + if ((B0 = malloc(128 * r * p + 63)) == NULL) + goto err0; + B = (uint8_t*) (((uintptr_t)(B0) + 63) & ~(uintptr_t)(63)); + if ((XY0 = malloc(256 * r + 64 + 63)) == NULL) + goto err1; + XY = (uint32_t*) (((uintptr_t)(XY0) + 63) & ~(uintptr_t)(63)); #ifndef MAP_ANON - if ((V0 = malloc(128 * r * N + 63)) == NULL) - goto err2; - V = (uint32_t *)(((uintptr_t)(V0) + 63) & ~ (uintptr_t)(63)); + if ((V0 = malloc(128 * r * N + 63)) == NULL) + goto err2; + V = (uint32_t*) (((uintptr_t)(V0) + 63) & ~(uintptr_t)(63)); #endif #endif #ifdef MAP_ANON - if ((V0 = mmap(NULL, 128 * r * N, PROT_READ | PROT_WRITE, + if ((V0 = mmap(NULL, 128 * r * N, PROT_READ | PROT_WRITE, #ifdef MAP_NOCORE - MAP_ANON | MAP_PRIVATE | MAP_NOCORE, + MAP_ANON | MAP_PRIVATE | MAP_NOCORE, #else - MAP_ANON | MAP_PRIVATE, + MAP_ANON | MAP_PRIVATE, #endif - -1, 0)) == MAP_FAILED) - goto err2; - V = (uint32_t *)(V0); + -1, 0)) == MAP_FAILED) + goto err2; + V = (uint32_t*) (V0); #endif - /* 1: (B_0 ... B_{p-1}) <-- PBKDF2(P, S, 1, p * MFLen) */ - libscrypt_PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, 1, B, p * 128 * r); + /* 1: (B_0 ... B_{p-1}) <-- PBKDF2(P, S, 1, p * MFLen) */ + libscrypt_PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, 1, B, p * 128 * r); - /* 2: for i = 0 to p - 1 do */ - for (i = 0; i < p; i++) { - /* 3: B_i <-- MF(B_i, N) */ - smix(&B[i * 128 * r], r, N, V, XY); - } + /* 2: for i = 0 to p - 1 do */ + for (i = 0; i < p; i++) { + /* 3: B_i <-- MF(B_i, N) */ + smix(&B[i * 128 * r], r, N, V, XY); + } - /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */ - libscrypt_PBKDF2_SHA256(passwd, passwdlen, B, p * 128 * r, 1, buf, buflen); + /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */ + libscrypt_PBKDF2_SHA256(passwd, passwdlen, B, p * 128 * r, 1, buf, buflen); - /* Free memory. */ + /* Free memory. */ #ifdef MAP_ANON - if (munmap(V0, 128 * r * N)) - goto err2; + if (munmap(V0, 128 * r * N)) + goto err2; #else - free(V0); + free(V0); #endif - free(XY0); - free(B0); + free(XY0); + free(B0); - /* Success! */ - return (0); + /* Success! */ + return (0); err2: - free(XY0); + free(XY0); err1: - free(B0); + free(B0); err0: - /* Failure! */ - return (-1); + /* Failure! */ + return (-1); } diff --git a/c/test/testdata/requests/in3_keys.json b/c/test/testdata/requests/in3_keys.json index f2bc9f66e..bf2d361ff 100644 --- a/c/test/testdata/requests/in3_keys.json +++ b/c/test/testdata/requests/in3_keys.json @@ -153,7 +153,27 @@ "request": { "method": "in3_decryptKey", "params": [ - {"version":3,"id":"c6efce20-e867-4ced-914b-996480c31757","address":"50a5dda1e41c1858f771d3dac944b75d5626d1b2","crypto":{"ciphertext":"d13228a430d6ec1108a7e076ceed39102fb21b0b0fe53cadf5a0d0f7496c9ee0","cipherparams":{"iv":"0b7adca34fb47b1250bd1b7944cc94e9"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"d748c19fe9982fbc3c7f3cea203f3ed948f9a4eb07729bfe112fe5f647e1bca6","n":131072,"r":8,"p":1},"mac":"43aa4502be45f2679eb3a63971fb9f7e6fb2425e14099746a0c87076a8b729c4"}}, + { + "version": 3, + "id": "c6efce20-e867-4ced-914b-996480c31757", + "address": "50a5dda1e41c1858f771d3dac944b75d5626d1b2", + "crypto": { + "ciphertext": "d13228a430d6ec1108a7e076ceed39102fb21b0b0fe53cadf5a0d0f7496c9ee0", + "cipherparams": { + "iv": "0b7adca34fb47b1250bd1b7944cc94e9" + }, + "cipher": "aes-128-ctr", + "kdf": "scrypt", + "kdfparams": { + "dklen": 32, + "salt": "d748c19fe9982fbc3c7f3cea203f3ed948f9a4eb07729bfe112fe5f647e1bca6", + "n": 131072, + "r": 8, + "p": 1 + }, + "mac": "43aa4502be45f2679eb3a63971fb9f7e6fb2425e14099746a0c87076a8b729c4" + } + }, "ABCabc123AB" ] }, From 860b2eb6a51002ecbacd1bf5b34f92461658de8c Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Wed, 11 Mar 2020 13:49:24 +0100 Subject: [PATCH 44/97] allow memory to grow --- wasm/src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasm/src/CMakeLists.txt b/wasm/src/CMakeLists.txt index 309d49adc..ba79efb8b 100644 --- a/wasm/src/CMakeLists.txt +++ b/wasm/src/CMakeLists.txt @@ -36,7 +36,7 @@ include(${PROJECT_SOURCE_DIR}/c/compiler.cmake) IF (ASMJS) set(CMAKE_EXECUTABLE_SUFFIX ".js") - set(EMC_PROPS "-O1 -s FINALIZE_ASM_JS=1 -s NODEJS_CATCH_REJECTION=0 -s SEPARATE_ASM=1 -s WASM=0 -s ASM_JS=1 -s EXPORT_NAME=in3w -s FILESYSTEM=0 -s 'EXTRA_EXPORTED_RUNTIME_METHODS=[\"ccall\", \"cwrap\"]'") + set(EMC_PROPS "-O1 -s ALLOW_MEMORY_GROWTH=1 -s FINALIZE_ASM_JS=1 -s NODEJS_CATCH_REJECTION=0 -s SEPARATE_ASM=1 -s WASM=0 -s ASM_JS=1 -s EXPORT_NAME=in3w -s FILESYSTEM=0 -s 'EXTRA_EXPORTED_RUNTIME_METHODS=[\"ccall\", \"cwrap\"]'") else(ASMJS) set(EMC_PROPS "-Oz -s ALLOW_MEMORY_GROWTH=1 -s NODEJS_CATCH_REJECTION=0 -s EXPORT_NAME=in3w -s WASM=1 -s FILESYSTEM=0 -s 'EXTRA_EXPORTED_RUNTIME_METHODS=[\"ccall\", \"cwrap\"]'") endif(ASMJS) From 4e6cdbe3c6ebc2beac7c2a9478c2bc81d8500ca5 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Thu, 12 Mar 2020 11:40:47 +0100 Subject: [PATCH 45/97] fix ens-check --- c/src/cmd/in3/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/src/cmd/in3/main.c b/c/src/cmd/in3/main.c index b0b31012c..712b974da 100644 --- a/c/src/cmd/in3/main.c +++ b/c/src/cmd/in3/main.c @@ -318,7 +318,7 @@ static void execute(in3_t* c, FILE* f) { char* resolve(in3_t* c, char* name) { if (!name) return NULL; if (name[0] == '0' && name[1] == 'x') return name; - if (strchr(name, '.')) { + if (strstr(name, ".eth")) { char* params = alloca(strlen(name) + 10); sprintf(params, "[\"%s\"]", name); char *res = NULL, *err = NULL; From 27c48f549f13e13c5bfb8ebfbab604e670916730 Mon Sep 17 00:00:00 2001 From: leonardocardoso Date: Thu, 12 Mar 2020 16:07:32 +0100 Subject: [PATCH 46/97] Fix java IN3#nodeList --- c/test/testdata/requests/in3_nodeList.json | 2 +- java/resources/responses/in3_nodeList.json | 394 ++++++++++----------- java/src/in3/IN3.java | 35 +- java/src/in3/IN3Props.java | 40 +++ java/test/in3/IN3MockBuilder.java | 11 +- java/test/in3/IN3Test.java | 57 ++- 6 files changed, 312 insertions(+), 227 deletions(-) create mode 100644 java/src/in3/IN3Props.java diff --git a/c/test/testdata/requests/in3_nodeList.json b/c/test/testdata/requests/in3_nodeList.json index cffbea03f..f4f2f417f 100644 --- a/c/test/testdata/requests/in3_nodeList.json +++ b/c/test/testdata/requests/in3_nodeList.json @@ -1,7 +1,7 @@ [ { "descr": "in3_nodeList", - "chainId": "0x5", + "chainId": "0x0", "fuzzer": true, "verification": "proof", "request": { diff --git a/java/resources/responses/in3_nodeList.json b/java/resources/responses/in3_nodeList.json index ab38d134f..16010c6af 100644 --- a/java/resources/responses/in3_nodeList.json +++ b/java/resources/responses/in3_nodeList.json @@ -1,201 +1,201 @@ { - "id": 1, - "result": { - "nodes": [ - { - "url": "https://in3-v2.slock.it/goerli/nd-1", - "address": "0x45d45e6ff99e6c34a235d263965910298985fcfe", - "index": 0, - "deposit": "0x2386f26fc10000", - "props": "0x1dd", - "timeout": 3456000, - "registerTime": 1576227711, - "weight": 2000 - }, - { - "url": "https://in3-v2.slock.it/goerli/nd-2", - "address": "0x1fe2e9bf29aa1938859af64c413361227d04059a", - "index": 1, - "deposit": "0x2386f26fc10000", - "props": "0x1dd", - "timeout": 3456000, - "registerTime": 1576227741, - "weight": 2000 - }, - { - "url": "https://in3-v2.slock.it/goerli/nd-3", - "address": "0x945f75c0408c0026a3cd204d36f5e47745182fd4", - "index": 2, - "deposit": "0x2386f26fc10000", - "props": "0x1dd", - "timeout": 3456000, - "registerTime": 1576227801, - "weight": 2000 - }, - { - "url": "https://in3-v2.slock.it/goerli/nd-4", - "address": "0xc513a534de5a9d3f413152c41b09bd8116237fc8", - "index": 3, - "deposit": "0x2386f26fc10000", - "props": "0x1dd", - "timeout": 3456000, - "registerTime": 1576227831, - "weight": 2000 - }, - { - "url": "https://in3-v2.slock.it/goerli/nd-5", - "address": "0xbcdf4e3e90cc7288b578329efd7bcc90655148d2", - "index": 4, - "deposit": "0x2386f26fc10000", - "props": "0x1dd", - "timeout": 3456000, - "registerTime": 1576227876, - "weight": 2000 - }, - { - "url": "https://tincubeth.komputing.org/", - "address": "0xf944d416ebdf7f6e22eaf79a5a53ad1a487ddd9a", - "index": 5, - "deposit": "0x2386f26fc10000", - "props": "0x1d7e0000000a", - "timeout": 3456000, - "registerTime": 1578947320, - "weight": 1 - }, - { - "url": "https://h5l45fkzz7oc3gmb.onion/", - "address": "0x56d986deb3b5d14cb230d0f39247cc32416020b6", - "index": 6, - "deposit": "0x2386f26fc10000", - "props": "0x21660000000a", - "timeout": 3456000, - "registerTime": 1578954071, - "weight": 1 - } - ], - "contract": "0x5f51e413581dd76759e9eed51e63d14c8d1379c8", - "registryId": "0x67c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea", - "lastBlockNumber": 2276348, - "totalServers": 7 - }, - "jsonrpc": "2.0", - "in3": { - "execTime": 126, - "lastValidatorChange": 0, - "proof": { - "type": "accountProof", - "block": "0xf9025ca05b15c4d9014a57f19c037563bba8f3e39733b6bbeb730be5a6bd9a8677011d1da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0b3edf0f8f66f2b10ea77fb77d6dc43e6bc99eddf51910dc8c79e135f0ba062f9a0697d4da49cf730d9502a6e9d418f0cd3842c86be0085de59d51c2237972aa16ea04dc4fe69fff1798d2a06d4ddd7087d69e850b6b0c2d7553f0f02991fcb862576b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010028322bbfc837a1200830111f4845e5d5b4db861f09f928e20407072796c616273206e6f64652d3020f09f928e00000000000000a7e5fe715a2bddc9892d1070f70de87e11b89bc3509c2614129110bb4d4f350a3d6a3e13948a53841251ff04c9ead54d2473cb1e42130bad8938e5913297c8c900a00000000000000000000000000000000000000000000000000000000000000000880000000000000000", - "accounts": { - "0x5f51e413581dd76759e9eed51e63d14c8d1379c8": { - "accountProof": [ - "0xf90211a0d0041802b39b0d8bd4378870fa197e5003b421ac2bc80584948b3b60b5494fcba06322ab1446b2e05a586551002aca2a54e69e2e43d39f5b7b6f70afb480a64b4ca0b4882ba72df3c3d1b7ca77b564ec48dbf4ab5a92a50d68defd661be4d7878a33a00bb6eac3bdca095e582ba5da8b2be578f80342f2c6a01f2042b1ccc60b85abbea09109537ad73d5b8f008b732bc534b15cd2236e6b766a50d8c618e66270fde61fa02e77b7a5fd2d67c43aa3ab8ff34210223a33a09b8a7edbded1c3c631092e66aba051581e21dcea914f421eeed20d2077a64378c49afac44d7e68cadc37e381ea25a0da5a4c2ac0ab47dfbe886e015a72f374f31d1e7eae477a7a9d6165b29cf8c96ca0126132bfe5dd60bd3bca3d38cb58f1c873f4e10b18ecb3edbeadb6a9e3c649e1a0625f574e3a0e5c5ef39d154b41d51a655501f6cb6b75478e75548ed80fc77cd6a06cc1bf23c495e44a53028fa80a3ff456dee8ac834d7e206402e1b4b10fca523da0a5193530b3367a31bdaef12b0d5c335de05b875ae8115789f02e1f3a9f4f8b29a0a0036923d8d622eb6d7d7074b06fb8560d65ee988bc9d3dfddd6e20108bc01bca0ecbc61e03b4a37cc986d554ff6e2bf3cb900d928172f16a0baeb3ca3b15567c7a01d8386e911112eced18f14c29a46e4ee7615310edecfc571189c2d1e69db9907a0faa4de346fd2ac4ec484486721bf616790ff4e78f8c7d278a82ce926c2004ca280", - "0xf90211a08d0d30992008df5380950d4a30bcb85fe4b5eeb5e9d47555c90ca2234c8fae28a09a302760d70f3f2fa0c734f158d450f923c60578c0d529f0d549d706c477bc11a0762865973e46fe93a0a685d314e44f2ab84cc59b492842450c36fa397fd62469a0de35caac9820b0794cf37106feb3bdb0ad7f5e2215827d37a41acea831d04a16a09f98e10d34e06fb1781b872e39c31340d4ffcb3d910008e8b51354eb6601fa11a0a2febd9de2b468d25b1ec2637ea3d39e91cd29bc3601bbb6fa34b0b9cb63e415a0f380f3c2b51b87f2b5e4286b3fcb16ff74e351518eb92a576948cb063821ba59a0a44e858b9a24c4f135a0f6a3abadcb22db4bd7a1078b0517ecb265a2851a6aeba0ae5e6314da5f1606c9645357f1386f0c9ce7c48d2eeb98ec13cda7221575158ea05727b21aa0b265667cbbdeb748a7cbd97f314b77264f10a9e69b371c48e65122a0141f1557dd2463e0c9543b33a232e48fd38480f71103c181f89c489cd1a8f8bfa0543d1abb6740c1b8a32d673dd3eb8f820acf19d474a90d6ed4882466388ce4f7a0e2414ea84085dd02f8ef08affca0176efe7441c7a2a621d764500fb2384f9780a08e6d9f028885ab7b4b89bcb301c9b063d7090428187b8b7f4863b0b700ba549ca097d06d96cda5e4c4b5751f84265e7dd2658877e617b83aaf5d03f19c6ad221b4a0e59cfab2feab060e26dc24f1028b391ddbd29ba95839f6b4daf15fe95c30b00b80", - "0xf90211a07141c17f9fa7951761d2bb4fd14657ee63c26fcac0f453edcc40b53077b8cb49a02b1ca5efd39e8a92c786d47afb8cfd3779be68c944e9801bc7ba4c929d85344da01d1283ee9b93563a4c902fcaa91b650f7e4f03b8a4ed17573f1579787ff61b80a0ae1a099c4db1b5200630a8c28e8f45e6c4f4225621d58731f741d33be08f66d2a017d364fed382f188095309fdc368673de02d2da42bc5a2359d6511165011ba43a0730866177275ebb899cb4ab75b14a88aadf750449dd31a2c08ad7e13b783be8aa093ef04e32e63ac2a0cde09ad847e6173b85237978859b2128efd43c5812540c7a0c84f94a4c4e3ea68de7100e4b28fe4dfb2e54047adb6a49badd774a10f24543aa0a0e318859f0a2607fc274087ac0429602dc4bceca9a607ba37ee49e3a231dda2a0a411c30ed2e578256d2e446418216b8f590ab5e5e55e220c0d468dce23e1f761a05b780600a7bd74ea0327bcabcd6c43e2f2d025451850dbf362ddbd3f22729ae4a09e95eb773b6f31faad66dc56e3bfe287e4ee69ece42a3b7f30fde8b036e3bbaca0c84c78fd76cb13e9c5a087f1f1044ceb746831831d7476b17194f7f57c239b5fa0b4a5b67caf37da52aaf4ef490874f790e37f9a6e9aea1fa473ace0c91c8ec325a09e6487086f9452e35b966b84ea5434580580004d54914716b9194263d3ec0802a0d65313ba3300ad622207f36a1241ac74e7b18d30b814c7074cd1c932caaeacfa80", - "0xf901b1a02691bcd5e32c39f4f36d5b6b03f091948eb9ca3df225ddad93eb31b8497e4c1aa08e5e2cd65a2ec84ffbc2ae1c2066139423cfe71c351a8dd42b471faeb4c05dd6a0bc2809c3a3720f2b0fae7dea4f7efedb4327a48c151b89b090ab99dee7bdcf4aa01f28521aec2d7a50a466f88281e6e827d5509bc5a77be74f3f704fd91079442da05ed7f0cf73f299255bfc2bdf20b31a709518fb71bdcaa9fb8fd488ad07af28ae80a03ecd2de48b44e54b5b892520291fd2601ddff191ba446997f3587d51e8f68ddfa097a4d6d7f15b05d96ed7511e39aae51032fc3648c15eb4d789ce8916f79a78a180a0bb081130c535bc8a46528bae3596200eb99d0b99bde40ad12b624e2466c7757ba0296c2142079e1c5b73bd703978eaa04e3b9123a240f7bc046a9cb701fd064435a04c35b4967661e70f5068aa326f3599c7393498e1b082b8b26062f98ffbb2e8f4a023d8b0cdfc5807cf338a56b1260118129ce2d1080dca624d02c1e7a44ef7255fa068665baa882f2e62da7897273881f510f3768c3d9878efdf097085ef3f0b5ac480a0d4524fcdca73a594f45be8e41613995cdd8bd38512c6932f04f6d6787ca4856380", - "0xf87180a05da0431ddcf9c0df5220e90991d6fafadcbb70ec9e51c042a743f4d1980df7c4a05e856a872504286cb6dbb11c85fab4ca263a72cbee0a785053fbbb4f2d6078738080808080a09922b3a2aac38c7bd2332ec05abd047f2fb7858f2d2ae4f6c49bce18b73eae948080808080808080", - "0xf8679e3860ace08b3156e1e8b3657a41748919bc942fd9e0f3de90d72f6e5bdfc3b846f8440180a0ee67942d4ba6f187e143ee4568896cf8db17df6298d91961b468176ef9e6ba0ba029140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1" - ], - "address": "0x5f51e413581dd76759e9eed51e63d14c8d1379c8", - "balance": "0x0", - "codeHash": "0x29140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1", - "nonce": "0x1", - "storageHash": "0xee67942d4ba6f187e143ee4568896cf8db17df6298d91961b468176ef9e6ba0b", - "storageProof": [ - { - "key": "0x0", - "proof": [ - "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", - "0xf8d1a0f881becd1a54ec2ac129979fbb7cc851f4245d372d588056b040ccae152793e88080a028b34037d7d67765fa1cd15091337086eacdd8770b711a026d4ee0a839f8b3f2808080a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a0c9c743682962d9d06dd0f9ed6cb2620cce02f34a0a4f5d60a4e5d1e081a5b5fba0bf73b8437dc32850158814b8c0c28c9c76a22c373fa84a77c3fc2175317a6aa18080a0bd01265657739e1793ae1ad68a77f330e98f0d5d5a53235211faa848c3eea787808080", - "0xe2a0200decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56307" - ], - "value": "0x7" - }, - { - "key": "0x1", - "proof": [ - "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", - "0xf85180a0fb829ab79f00d7bab5aa54e5cfd67ae721eaf17d076bca3984477a72b5391c92808080808080808080808080a0f7fc12e7aa12b24609029780c05d852e0ddb7e1eceaf8671a2e2d3c1aa7bd8068080", - "0xf843a0200e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6a1a067c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea" - ], - "value": "0x67c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e567", - "proof": [ - "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", - "0xf891a031b20905ab02dba97c5a82079a50550a5a70d3f5e7f25cfe6c9e88b1c3768ae8808080808080a01b7ed3dd208fb30e8581d7e5278fb4581b99f960be8d08ff41759b10b537dfe080808080a03b77164a66693f214b5328da08b60566b0aeae3d719121004ed8c6d6e49ca5e580a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", - "0xf843a020418048a637d1641c6d732dd38174732bbf7b47a1cf6d5f65895384518b07d9a1a02b80cb1b568146d64e7a622d7b895925d06ef8582fa0166d8ec069f86070610a" - ], - "value": "0x2b80cb1b568146d64e7a622d7b895925d06ef8582fa0166d8ec069f86070610a" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56c", - "proof": [ - "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", - "0xf8f18080a03c79db405090818f0b5b51e29d2ac7b67f6ff814b03e773af1975584a0dd1f908080a0a26c5f90f028898be4e12961969ae89f323a66586730f92b8fb2dd1ca0ba6f8a80a078c9aaa17553d7357d2014c0a75c9de51fdab46248846ddf03ea16d8cb790b0e80a04a0c4b948805886065449dad60fce7e1c7680a3bc4a235800fbd2edafac731e680a0c50523b8a14aff442da2ba7343c04f960e59083796de9ba7fcbbd592959515f180a0df910adad94453538847b694bdb134432b0a9e2cc829dce2346460720fd2ee5380a06e1a723ced013021ff250a9fdd129c3a7c1aa3970d955cd28688dbdff277174880", - "0xf843a0205fcc8f73196524ea5f04c38888c2f09c6cbef411cb31e259d35b56e3d0047ba1a00c2f5e53902cca915645c2f00ae6a6357ce4aafa18140db4be24d33f41709b6e" - ], - "value": "0xc2f5e53902cca915645c2f00ae6a6357ce4aafa18140db4be24d33f41709b6e" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e571", - "proof": [ - "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", - "0xf8b1a0f3ab6aa3f0575916e985798d7ee01e8c75436765f043cdfba2ad10f36b47f6d48080a069a129011ab4666f131c1bdac7d923dcbb6f1047057a62d6ecede5d17057658280a064bde28657cfaa21b487ad660da11e94a06a1b7f46502263094cde0407dfd24380808080a04a5be21f4f0c0f5e1fcccb140e7cb5b1ff2ce45bce977d8e23cc7320e8c7bdd080a015cb29fd7064f1cbac8773177854799e563e10ba66e44c5adf25b31fa39a7d3980808080", - "0xf843a0206695c256a4a4a1b8ed004dc824e330f1747032632c0e6d88c1d84c330c1c5ca1a098d7a1f953e0805e2053a6ab062f8a16f1d35b9fc7bad41fd10eece87cc1b280" - ], - "value": "0x98d7a1f953e0805e2053a6ab062f8a16f1d35b9fc7bad41fd10eece87cc1b280" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e576", - "proof": [ - "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", - "0xf85180a0fb829ab79f00d7bab5aa54e5cfd67ae721eaf17d076bca3984477a72b5391c92808080808080808080808080a0f7fc12e7aa12b24609029780c05d852e0ddb7e1eceaf8671a2e2d3c1aa7bd8068080", - "0xf843a020257165ee8c7eae64faf81e97823d50dba1b6a2be88bccea1ac5d01256f0590a1a079c63d2302907690c944fa45f7405ac59b364089f366764025f13f2055511b43" - ], - "value": "0x79c63d2302907690c944fa45f7405ac59b364089f366764025f13f2055511b43" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e57b", - "proof": [ - "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", - "0xf891a031b20905ab02dba97c5a82079a50550a5a70d3f5e7f25cfe6c9e88b1c3768ae8808080808080a01b7ed3dd208fb30e8581d7e5278fb4581b99f960be8d08ff41759b10b537dfe080808080a03b77164a66693f214b5328da08b60566b0aeae3d719121004ed8c6d6e49ca5e580a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", - "0xf85180808080a0fe0a1c808c8e90225d5dcfad8bde23daee522b2905b605bc6eb5c39596018464808080808080808080a04083c8127572e64ae53476470e7a632258565a37b7f2066cb22ef228e679c24e8080", - "0xf8429f3d807394a26a5623e844d859daa1940d13cb7bda091582294562d688f4de00a1a0a7b2aa99ebb2a9e076a84dfd43cc1355ca060aea5b8bb1f1ee825e131125e462" - ], - "value": "0xa7b2aa99ebb2a9e076a84dfd43cc1355ca060aea5b8bb1f1ee825e131125e462" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e580", - "proof": [ - "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", - "0xf8d1a0f881becd1a54ec2ac129979fbb7cc851f4245d372d588056b040ccae152793e88080a028b34037d7d67765fa1cd15091337086eacdd8770b711a026d4ee0a839f8b3f2808080a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a0c9c743682962d9d06dd0f9ed6cb2620cce02f34a0a4f5d60a4e5d1e081a5b5fba0bf73b8437dc32850158814b8c0c28c9c76a22c373fa84a77c3fc2175317a6aa18080a0bd01265657739e1793ae1ad68a77f330e98f0d5d5a53235211faa848c3eea787808080", - "0xf843a0202f0f7a7af9ed4f160d1c425f37d148d10bddb9c828e99d4145b150485711cea1a0ac8d18ba63b2e8486a3c5bd9915b9335d0df0862e5601476fadf568443a8cca0" - ], - "value": "0xac8d18ba63b2e8486a3c5bd9915b9335d0df0862e5601476fadf568443a8cca0" - }, - { - "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e585", - "proof": [ - "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", - "0xf8f18080a03c79db405090818f0b5b51e29d2ac7b67f6ff814b03e773af1975584a0dd1f908080a0a26c5f90f028898be4e12961969ae89f323a66586730f92b8fb2dd1ca0ba6f8a80a078c9aaa17553d7357d2014c0a75c9de51fdab46248846ddf03ea16d8cb790b0e80a04a0c4b948805886065449dad60fce7e1c7680a3bc4a235800fbd2edafac731e680a0c50523b8a14aff442da2ba7343c04f960e59083796de9ba7fcbbd592959515f180a0df910adad94453538847b694bdb134432b0a9e2cc829dce2346460720fd2ee5380a06e1a723ced013021ff250a9fdd129c3a7c1aa3970d955cd28688dbdff277174880", - "0xf843a0207c73e826b7dd131777470492494a9f14b451e947ae119760ac27c5aac4422ca1a01fae1104ad418c61c2e19407f6151fa634431da77d15469ffd1b993986fccc59" - ], - "value": "0x1fae1104ad418c61c2e19407f6151fa634431da77d15469ffd1b993986fccc59" - } - ] - } - }, - "signatures": [ + "id": 1, + "result": { + "nodes": [ + { + "url": "https://in3-v2.slock.it/goerli/nd-1", + "address": "0x45d45e6ff99e6c34a235d263965910298985fcfe", + "index": 0, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227711, + "weight": 2000 + }, + { + "url": "https://in3-v2.slock.it/goerli/nd-2", + "address": "0x1fe2e9bf29aa1938859af64c413361227d04059a", + "index": 1, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227741, + "weight": 2000 + }, + { + "url": "https://in3-v2.slock.it/goerli/nd-3", + "address": "0x945f75c0408c0026a3cd204d36f5e47745182fd4", + "index": 2, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227801, + "weight": 2000 + }, + { + "url": "https://in3-v2.slock.it/goerli/nd-4", + "address": "0xc513a534de5a9d3f413152c41b09bd8116237fc8", + "index": 3, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227831, + "weight": 2000 + }, + { + "url": "https://in3-v2.slock.it/goerli/nd-5", + "address": "0xbcdf4e3e90cc7288b578329efd7bcc90655148d2", + "index": 4, + "deposit": "0x2386f26fc10000", + "props": "0x1dd", + "timeout": 3456000, + "registerTime": 1576227876, + "weight": 2000 + }, + { + "url": "https://tincubeth.komputing.org/", + "address": "0xf944d416ebdf7f6e22eaf79a5a53ad1a487ddd9a", + "index": 5, + "deposit": "0x2386f26fc10000", + "props": "0x1d7e0000000a", + "timeout": 3456000, + "registerTime": 1578947320, + "weight": 1 + }, { - "blockHash": "0xb1ca57784055c67d58cf76924355e0ff2324237769efdcdb2cea6824896cb0a2", - "block": 2276348, - "r": "0x67ba22ce31bf6c6e06b55109e5cbe67633ba20c7275b89fa93819fde744e1c69", - "s": "0x46a77396374f817acac3ae0bfde5b3efbdfa33fd0e72516176e60dae8a1dc41b", - "v": 28, - "msgHash": "0x4e242053e85d8d3ef8bae15d6efdb24af2086f5047a371830083a9fce3ab01d1" + "url": "https://h5l45fkzz7oc3gmb.onion/", + "address": "0x56d986deb3b5d14cb230d0f39247cc32416020b6", + "index": 6, + "deposit": "0x2386f26fc10000", + "props": "0x21660000000a", + "timeout": 3456000, + "registerTime": 1578954071, + "weight": 1 } - ] - } - } + ], + "contract": "0x5f51e413581dd76759e9eed51e63d14c8d1379c8", + "registryId": "0x67c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea", + "lastBlockNumber": 2320627, + "totalServers": 7 + }, + "jsonrpc": "2.0", + "in3": { + "execTime": 46, + "lastValidatorChange": 0, + "proof": { + "type": "accountProof", + "block": "0xf9025ba055f6b4aa91745fbb52cf97670818aa02b322f02d1493ae12b00248db7714da33a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a053dfa5bed7fcd8db8e53f62d89a9d0150f100d94bc4012a5fc0021bd40e54af2a0816933a656d094e3839b1c8451ec1c7b7fa3417008d866bdc1d3c40c699b412aa0a016a3e03d190d68ed522721348ab73e351de580cfe6cc0599c1ef3ce4e970eeb901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002832368f3837a120082520c845e677e57b86144505020417574686f726974790000000000000000000000000000000000000023f9a4d677658cc5769bc4155255f804fca774641e5e7ee3ba3b37c0d261ea5036bb37cf6ab5d88e1210b8544022fca17fcd99d0b90abcf30d0fea71d550793800a00000000000000000000000000000000000000000000000000000000000000000880000000000000000", + "accounts": { + "0x5f51e413581dd76759e9eed51e63d14c8d1379c8": { + "accountProof": [ + "0xf90211a07f2fcbf477f78c116a1ae210b6c809bd9de8c746d897f01df8325257eac8fa2da0da3247da1c9b573bb0f949dccd06d741d23f573a971a2fd22bb813b0db125475a0af84436894eebbe2c25c8cadd1f2aaad3e5d780be5d5885df9666f41a195c486a0f912828f6a75bbfd5c34b5f38ce67d520ed8c7c6a81996a94db0d7d673aaff34a034485e46b6a9e4287c0457dab61a8d043aa34b6bc2920994c017f69103fe70c8a006d4af0c6846b639e7f42d98213c077ac71a4ebb5239ce040208f752bd20f91ba0085bd12c921e3911120d55660e90eb0de19b626295cd44fc52e82421f6531a23a040670226521f787e8f91e602c2bda74d20fafbf8a903ebcb28baf7b853db463ea00ef26743f9cdd5cbc3c094bbd9e6aa39a3c567de88c6ca18fa8613e8f978fe32a034afa40daedd0c3260562ed477b6fd6fb8244fc7668b82ffe916dd5609c12bdca0c3f0aed8bff8e99e2d3c00cb41995af6228a65700000815492fd5ee2bd0b7c3aa0aee3e7e0867f2d4d5b32b85e41e01e1aed5d28b0f00099f2aeeab93c0607ce7ea04b86770d609b3d66c58bbe7b5c94bb958e39d34f3155029d1be1b8b23c72d8cfa096c5a37a41f65ca713add0c42ba5998402b687d3067df27de48d0442f168c0dba0d41db9d14fcac964fdfcc8792cc34948b0dd2beb72e9a41fc7cf128cdda8d91ca0d52b29b8d83fcfedd15eb55083f7d7ff7c039d4368c0c68f8564b057dc1b1de380", + "0xf90211a048ad2947963e563552346d01b7ff56bb854cdc67b31de8cb5f32f7b227f82d22a09e5c0a0facca3da267ac8860a86aac8dfbdbada34067928b614734b83166c6e7a05a10a9e7139931794c639f4dd13fb887423c0e032cf3728860e975ba81a974faa06552aa39f90e07d17916e4ce8e2c1e6c5f6f4b3381e6d7fc8dbc02c0d3a3dffaa00d93f1c76b4ba40c195b3bb96fc41141ad659d456b61c1440656293ad1e69a16a0fc51d5c8f47b6139c5a3ab34e664e600818c1e5d2a1cf76f3693c03cf1eb4269a0066601b2c34591323031a24394f76ccd16799efae36f4cfa1fea64586ac32df4a0065ab8064dea83dae7e1d2f2f588fe3e7667fd56746f07bd4a64cf9a3c810e78a08ff2d32d5a7fdf1c00ef53fd8d5f835ac46a992a572aef1f7a14fda3aae3a91ca04e6dece42772229aee1d6d4f732c38aff55edb23a47fe768b0cedfbfb4506c18a0b9e22f83f9aa10f9a98f2c0e0b88408222850fcf208e58bb15c7c1c6880a2524a09c3d0d005c2f696590e29c67678082c3c8b6df86aa352a5bf7321eb64413ef9ea0d461a60f8e86759996c08d2b2efc4a80e1b35122aebecb7ad266add1a72a9d42a0424c1317a88c81857236901162338928bd7784f561af667cd40693821b8d004da0fe86912529153eda23a6dc5b36ed7f76b5e0f56658417cfc0ff065fd85b271b4a06a04a3436920f8f01cfe9e2252babcfc72ecf0d36e3dc5c4f78d7f2fc8f551d680", + "0xf90211a07141c17f9fa7951761d2bb4fd14657ee63c26fcac0f453edcc40b53077b8cb49a011a1829719b64b2963be244e5cc70370e918f11bc0f76b3afeaad72b334bb3b0a0b8a19bab2a7fbce893d4f7fa6aebff851f91ce283cce75a956f648cfdf1cca73a001ccf1d06d5af32f277ea2f918b726604238161cf9ab496401c2d4b27cad5881a0a5ab6e572c7862950a6b4e0ad8b281954126d931eb0e4d9ce9d37ceade30917ba0db170d582739015526b62443782a481d31ef5f16bb3847044ec9245e30da9f2ba0cc05ae7a81635ec756a23040202783cce5f0ff95fc7568abeca48d99451ca58ea0e67d2d5b047d3e715ddf0dc9b7337b8d0897d4441f5f04b12246a3a0c722da3fa0d2559dcce9c8542dc07069cb8b86066b76ef6053dba01309ebf2e80aadf08d3fa0a411c30ed2e578256d2e446418216b8f590ab5e5e55e220c0d468dce23e1f761a09bcb2be34112ca0596ce9ef706c059de0415fbb8598979c5c691f8ce4509fb8ca0624edfa58969d47f3da6e6688f61dfef249a1f4ec4e5b0ba3be8c94283069edba0e60f84dfa36d07f8103be8a33bdeb46bdd619155a3abc69f6c5a9dbabd064fdaa0c6d8e810d9206e0abe24b656af58eb289d67b50dc7f6fdb8e287de71069a872aa0fb123fece0ab7b47f219fd3b8d4a3a68e928f58ae806a9a68fdd67cd2f449e87a0d65313ba3300ad622207f36a1241ac74e7b18d30b814c7074cd1c932caaeacfa80", + "0xf901b1a02691bcd5e32c39f4f36d5b6b03f091948eb9ca3df225ddad93eb31b8497e4c1aa08e5e2cd65a2ec84ffbc2ae1c2066139423cfe71c351a8dd42b471faeb4c05dd6a0bc2809c3a3720f2b0fae7dea4f7efedb4327a48c151b89b090ab99dee7bdcf4aa01f28521aec2d7a50a466f88281e6e827d5509bc5a77be74f3f704fd91079442da05ed7f0cf73f299255bfc2bdf20b31a709518fb71bdcaa9fb8fd488ad07af28ae80a03ecd2de48b44e54b5b892520291fd2601ddff191ba446997f3587d51e8f68ddfa097a4d6d7f15b05d96ed7511e39aae51032fc3648c15eb4d789ce8916f79a78a180a0bb081130c535bc8a46528bae3596200eb99d0b99bde40ad12b624e2466c7757ba006b3c644afc9051baca2f44b34ba9f257ffef290b157655cc5acb614127496e4a04c35b4967661e70f5068aa326f3599c7393498e1b082b8b26062f98ffbb2e8f4a023d8b0cdfc5807cf338a56b1260118129ce2d1080dca624d02c1e7a44ef7255fa068665baa882f2e62da7897273881f510f3768c3d9878efdf097085ef3f0b5ac480a0d4524fcdca73a594f45be8e41613995cdd8bd38512c6932f04f6d6787ca4856380", + "0xf87180a05da0431ddcf9c0df5220e90991d6fafadcbb70ec9e51c042a743f4d1980df7c4a05e856a872504286cb6dbb11c85fab4ca263a72cbee0a785053fbbb4f2d6078738080808080a09922b3a2aac38c7bd2332ec05abd047f2fb7858f2d2ae4f6c49bce18b73eae948080808080808080", + "0xf8679e3860ace08b3156e1e8b3657a41748919bc942fd9e0f3de90d72f6e5bdfc3b846f8440180a0ee67942d4ba6f187e143ee4568896cf8db17df6298d91961b468176ef9e6ba0ba029140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1" + ], + "address": "0x5f51e413581dd76759e9eed51e63d14c8d1379c8", + "balance": "0x0", + "codeHash": "0x29140efcd5358d1dd75badfaa179e3df0dd53f17a883a30152d82903305697a1", + "nonce": "0x1", + "storageHash": "0xee67942d4ba6f187e143ee4568896cf8db17df6298d91961b468176ef9e6ba0b", + "storageProof": [ + { + "key": "0x0", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8d1a0f881becd1a54ec2ac129979fbb7cc851f4245d372d588056b040ccae152793e88080a028b34037d7d67765fa1cd15091337086eacdd8770b711a026d4ee0a839f8b3f2808080a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a0c9c743682962d9d06dd0f9ed6cb2620cce02f34a0a4f5d60a4e5d1e081a5b5fba0bf73b8437dc32850158814b8c0c28c9c76a22c373fa84a77c3fc2175317a6aa18080a0bd01265657739e1793ae1ad68a77f330e98f0d5d5a53235211faa848c3eea787808080", + "0xe2a0200decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56307" + ], + "value": "0x7" + }, + { + "key": "0x1", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf85180a0fb829ab79f00d7bab5aa54e5cfd67ae721eaf17d076bca3984477a72b5391c92808080808080808080808080a0f7fc12e7aa12b24609029780c05d852e0ddb7e1eceaf8671a2e2d3c1aa7bd8068080", + "0xf843a0200e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6a1a067c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea" + ], + "value": "0x67c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e567", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf891a031b20905ab02dba97c5a82079a50550a5a70d3f5e7f25cfe6c9e88b1c3768ae8808080808080a01b7ed3dd208fb30e8581d7e5278fb4581b99f960be8d08ff41759b10b537dfe080808080a03b77164a66693f214b5328da08b60566b0aeae3d719121004ed8c6d6e49ca5e580a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", + "0xf843a020418048a637d1641c6d732dd38174732bbf7b47a1cf6d5f65895384518b07d9a1a02b80cb1b568146d64e7a622d7b895925d06ef8582fa0166d8ec069f86070610a" + ], + "value": "0x2b80cb1b568146d64e7a622d7b895925d06ef8582fa0166d8ec069f86070610a" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56c", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8f18080a03c79db405090818f0b5b51e29d2ac7b67f6ff814b03e773af1975584a0dd1f908080a0a26c5f90f028898be4e12961969ae89f323a66586730f92b8fb2dd1ca0ba6f8a80a078c9aaa17553d7357d2014c0a75c9de51fdab46248846ddf03ea16d8cb790b0e80a04a0c4b948805886065449dad60fce7e1c7680a3bc4a235800fbd2edafac731e680a0c50523b8a14aff442da2ba7343c04f960e59083796de9ba7fcbbd592959515f180a0df910adad94453538847b694bdb134432b0a9e2cc829dce2346460720fd2ee5380a06e1a723ced013021ff250a9fdd129c3a7c1aa3970d955cd28688dbdff277174880", + "0xf843a0205fcc8f73196524ea5f04c38888c2f09c6cbef411cb31e259d35b56e3d0047ba1a00c2f5e53902cca915645c2f00ae6a6357ce4aafa18140db4be24d33f41709b6e" + ], + "value": "0xc2f5e53902cca915645c2f00ae6a6357ce4aafa18140db4be24d33f41709b6e" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e571", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8b1a0f3ab6aa3f0575916e985798d7ee01e8c75436765f043cdfba2ad10f36b47f6d48080a069a129011ab4666f131c1bdac7d923dcbb6f1047057a62d6ecede5d17057658280a064bde28657cfaa21b487ad660da11e94a06a1b7f46502263094cde0407dfd24380808080a04a5be21f4f0c0f5e1fcccb140e7cb5b1ff2ce45bce977d8e23cc7320e8c7bdd080a015cb29fd7064f1cbac8773177854799e563e10ba66e44c5adf25b31fa39a7d3980808080", + "0xf843a0206695c256a4a4a1b8ed004dc824e330f1747032632c0e6d88c1d84c330c1c5ca1a098d7a1f953e0805e2053a6ab062f8a16f1d35b9fc7bad41fd10eece87cc1b280" + ], + "value": "0x98d7a1f953e0805e2053a6ab062f8a16f1d35b9fc7bad41fd10eece87cc1b280" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e576", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf85180a0fb829ab79f00d7bab5aa54e5cfd67ae721eaf17d076bca3984477a72b5391c92808080808080808080808080a0f7fc12e7aa12b24609029780c05d852e0ddb7e1eceaf8671a2e2d3c1aa7bd8068080", + "0xf843a020257165ee8c7eae64faf81e97823d50dba1b6a2be88bccea1ac5d01256f0590a1a079c63d2302907690c944fa45f7405ac59b364089f366764025f13f2055511b43" + ], + "value": "0x79c63d2302907690c944fa45f7405ac59b364089f366764025f13f2055511b43" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e57b", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf891a031b20905ab02dba97c5a82079a50550a5a70d3f5e7f25cfe6c9e88b1c3768ae8808080808080a01b7ed3dd208fb30e8581d7e5278fb4581b99f960be8d08ff41759b10b537dfe080808080a03b77164a66693f214b5328da08b60566b0aeae3d719121004ed8c6d6e49ca5e580a0a3e90ff33462c5a993a90a3387e5c9c2d7aad2f327ff5c69cbfab2e5ce6c3a798080", + "0xf85180808080a0fe0a1c808c8e90225d5dcfad8bde23daee522b2905b605bc6eb5c39596018464808080808080808080a04083c8127572e64ae53476470e7a632258565a37b7f2066cb22ef228e679c24e8080", + "0xf8429f3d807394a26a5623e844d859daa1940d13cb7bda091582294562d688f4de00a1a0a7b2aa99ebb2a9e076a84dfd43cc1355ca060aea5b8bb1f1ee825e131125e462" + ], + "value": "0xa7b2aa99ebb2a9e076a84dfd43cc1355ca060aea5b8bb1f1ee825e131125e462" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e580", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8d1a0f881becd1a54ec2ac129979fbb7cc851f4245d372d588056b040ccae152793e88080a028b34037d7d67765fa1cd15091337086eacdd8770b711a026d4ee0a839f8b3f2808080a0f229214dba34c16ca65b1e0df175282a07b3ea9453d97f5b9e9e78762fe279fd80a0c9c743682962d9d06dd0f9ed6cb2620cce02f34a0a4f5d60a4e5d1e081a5b5fba0bf73b8437dc32850158814b8c0c28c9c76a22c373fa84a77c3fc2175317a6aa18080a0bd01265657739e1793ae1ad68a77f330e98f0d5d5a53235211faa848c3eea787808080", + "0xf843a0202f0f7a7af9ed4f160d1c425f37d148d10bddb9c828e99d4145b150485711cea1a0ac8d18ba63b2e8486a3c5bd9915b9335d0df0862e5601476fadf568443a8cca0" + ], + "value": "0xac8d18ba63b2e8486a3c5bd9915b9335d0df0862e5601476fadf568443a8cca0" + }, + { + "key": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e585", + "proof": [ + "0xf90211a0b67c8fc9ccaf87362466a14c4714f75a7c9c006275629bd089e53bf8f6aef3e8a0bd9d8e083eb43f66f4d68a0380a3cd078c8545f824908c26ac5f07974738c92ba08bffccfd9d8731d2d99c8648802c7b5eff3fe744a2bc04379d6dabd1153e21afa036116c8887c0dc0123a4cf2245c15715e70b974258903b7356e4433b42f66680a0dcf55ed8f57d2c1b0f878e707eb0e97a569aa7ba7862c50ae77de4d1cc0b5821a00be8b340536029c2414fa57ba8e51d736ca4b65aad1b7a003b20302ccc93f7afa02d9e3c9a3e9c20257da776cc8f5ed75c1f9c6f9cf476de236151ced43b8cc8aaa0f73b2fa3dc8e174f3264edd2f919961667cae58a94261f583a6c6510a8dd563ba088e163fa4b0a1523f1c036041414d05bbacfaa6b936f30ab2e65f7a4eb3613aea0220f6d1822378bfbdfc6e22f95afd16d125e3c18ef03827558d6325f364280eaa0ae7d2d73044556135fc217f27b2872e1344c02141831190f71360e0c4336e172a0b500471bfcc9d941b168b2dcbad5f530b89504d913323fe8e64ec0fcf1c73d80a0b8a03827b3caf845deda97cd6494a368980b87a128a4da8749cc2170df171bf2a027b9fee8d3cfda74a3dc9b0dca2121790a7237fec5c3354367abc993a7255e68a095d48f902ec25c846ef66b4bed5f3863b34429b9383045b0200ad8a89ab77b3ca0cc4718b5f77c427bbc51c0971db6ebcc041b7c40cb7c90bc9f8262fb9792db5a80", + "0xf8f18080a03c79db405090818f0b5b51e29d2ac7b67f6ff814b03e773af1975584a0dd1f908080a0a26c5f90f028898be4e12961969ae89f323a66586730f92b8fb2dd1ca0ba6f8a80a078c9aaa17553d7357d2014c0a75c9de51fdab46248846ddf03ea16d8cb790b0e80a04a0c4b948805886065449dad60fce7e1c7680a3bc4a235800fbd2edafac731e680a0c50523b8a14aff442da2ba7343c04f960e59083796de9ba7fcbbd592959515f180a0df910adad94453538847b694bdb134432b0a9e2cc829dce2346460720fd2ee5380a06e1a723ced013021ff250a9fdd129c3a7c1aa3970d955cd28688dbdff277174880", + "0xf843a0207c73e826b7dd131777470492494a9f14b451e947ae119760ac27c5aac4422ca1a01fae1104ad418c61c2e19407f6151fa634431da77d15469ffd1b993986fccc59" + ], + "value": "0x1fae1104ad418c61c2e19407f6151fa634431da77d15469ffd1b993986fccc59" + } + ] + } + }, + "signatures": [ + { + "blockHash": "0x0f4988c4c7fa0fb090b6b2298098372ccc0af3b9abe3cd71e743d0a279784920", + "block": 2320627, + "r": "0xa5ba4d5442f42e8010bfaeae63a999af6b599b81c8809b3e43d638b67e2c8d4c", + "s": "0x499d871855bf0983709194422400dc9208c6bdafd48d2abc3a99b77819b33576", + "v": 28, + "msgHash": "0xa97b35fc1a12376ed57c1ca01bde6ca19901f4864e29fa720a763cd8f89d0f16" + } + ] + } + } } \ No newline at end of file diff --git a/java/src/in3/IN3.java b/java/src/in3/IN3.java index 3cf7e2bab..4e7ffd66a 100644 --- a/java/src/in3/IN3.java +++ b/java/src/in3/IN3.java @@ -211,6 +211,7 @@ public Object sendobject(String request) { } return sendobjectinternal(request); } + private native Object sendobjectinternal(String request); private String toRPC(String method, Object[] params) { @@ -232,7 +233,7 @@ else if (params[i] instanceof String) { return "{\"method\":\"" + method + "\", \"params\":[" + p + "]}"; } - private String toRPC(String method, Object[] params, Object[] address) { + private String toRPC(String method, Object[] params, IN3Props props) { String p = ""; for (int i = 0; i < params.length; i++) { if (p.length() > 0) @@ -249,7 +250,7 @@ else if (params[i] instanceof String) { p += JSON.toJson(params[i]); } - return "{\"in3\":{\"data_nodes\":" + JSON.toJson(address) + "}, \"method\":\"" + method + "\", \"params\":[" + p + "]}"; + return "{\"in3\":" + props.toJSON() + ", \"method\":\"" + method + "\", \"params\":[" + p + "]}"; } /** @@ -260,8 +261,8 @@ public String sendRPC(String method, Object[] params) { return this.send(toRPC(method, params)); } - private Object sendObjectRPC(String method, Object[] params, String[] address) { - return this.sendobject(toRPC(method, params, address)); + private Object sendObjectRPC(String method, Object[] params, IN3Props props) { + return this.sendobject(toRPC(method, params, props)); } public Object sendRPCasObject(String method, Object[] params, boolean useEnsResolver) { @@ -304,15 +305,35 @@ public boolean cacheClear() { * restrieves the node list */ public IN3Node[] nodeList() { - NodeList nl = NodeList.asNodeList(sendRPCasObject(NODE_LIST, new Object[] {})); + return nodeList(new String[] {}); + } + + /** + * restrieves the node list + */ + protected IN3Node[] nodeList(String[] signerNodeAddresses) { + NodeList nl; + if (signerNodeAddresses != null && signerNodeAddresses.length > 0) { + IN3Props props = new IN3Props(); + props.setSignerNodes(signerNodeAddresses); + nl = NodeList.asNodeList(sendObjectRPC(NODE_LIST, new Object[] {}, props)); + } + + nl = NodeList.asNodeList(sendRPCasObject(NODE_LIST, new Object[] {})); return nl.getNodes(); } /** * request for a signature of an already verified hash. */ - public SignedBlockHash[] sign(BlockID[] blocks, String[] address) { - return SignedBlockHash.asSignedBlockHashs(sendObjectRPC(SIGN, blocks, address)); + public SignedBlockHash[] sign(BlockID[] blocks, String[] dataNodeAdresses) { + if (dataNodeAdresses != null && dataNodeAdresses.length > 0) { + IN3Props props = new IN3Props(); + props.setDataNodes(dataNodeAdresses); + return SignedBlockHash.asSignedBlockHashs(sendObjectRPC(SIGN, new Object[] { blocks }, props)); + } + + return SignedBlockHash.asSignedBlockHashs(sendRPCasObject(SIGN, new Object[] { blocks })); } protected Object[] handleEns(Object[] params) { diff --git a/java/src/in3/IN3Props.java b/java/src/in3/IN3Props.java new file mode 100644 index 000000000..22d08828c --- /dev/null +++ b/java/src/in3/IN3Props.java @@ -0,0 +1,40 @@ +package in3; + +import java.util.HashMap; +import in3.utils.JSON; + +public class IN3Props { + + HashMap props; + + private static final String DATA_NODES = "dataNodes"; + private static final String SIGNER_NODES = "signerNodes"; + + public IN3Props() { + props = new HashMap(); + } + + public void setDataNodes(String[] adresses) { + props.put(DATA_NODES, adresses); + } + + public void setSignerNodes(String[] adresses) { + props.put(SIGNER_NODES, adresses); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("{"); + + for (String key : props.keySet()) { + JSON.appendKey(sb, key, props.get(key)); + } + + sb.setCharAt(sb.length() - 1, '}'); + return sb.toString(); + } + + public String toJSON() { + return JSON.asString(this); + } +} diff --git a/java/test/in3/IN3MockBuilder.java b/java/test/in3/IN3MockBuilder.java index 4d726a7c1..abdf2efca 100644 --- a/java/test/in3/IN3MockBuilder.java +++ b/java/test/in3/IN3MockBuilder.java @@ -2,7 +2,6 @@ import in3.config.ChainConfiguration; import in3.config.ClientConfiguration; -import in3.config.NodeConfiguration; public class IN3MockBuilder { private IN3 client; @@ -37,14 +36,8 @@ public void buildConfig() { ChainConfiguration chainConfig2 = new ChainConfiguration(Chain.GOERLI, clientConfig); chainConfig2.setNeedsUpdate(false); - chainConfig2.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f"); - chainConfig2.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb"); - - // Necessary for nodelist test to pass - NodeConfiguration nodeConfig = new NodeConfiguration(chainConfig2); - nodeConfig.setUrl("https://in3-v2.slock.it/goerli/nd-2"); - nodeConfig.setAddress("0x1fe2e9bf29aa1938859af64c413361227d04059a"); - nodeConfig.setProps(0); + chainConfig2.setContract("0x5f51e413581dd76759e9eed51e63d14c8d1379c8"); + chainConfig2.setRegistryId("0x67c02e5e272f9d6b4a33716614061dd298283f86351079ef903bf0d4410a44ea"); ChainConfiguration chainConfig3 = new ChainConfiguration(Chain.KOVAN, clientConfig); chainConfig3.setNeedsUpdate(false); diff --git a/java/test/in3/IN3Test.java b/java/test/in3/IN3Test.java index 0c750b621..2b1b9465e 100644 --- a/java/test/in3/IN3Test.java +++ b/java/test/in3/IN3Test.java @@ -3,31 +3,27 @@ import org.junit.jupiter.api.*; public class IN3Test { - - private IN3 in3; - - @BeforeEach - public void setBuilder() { + @Test + public void nodeList() { String[][] mockedResponses = { {"eth_call", "eth_call_2.json"}, {"in3_nodeList", "in3_nodeList.json"}, {"in3_sign", "in3_sign.json"}}; IN3MockBuilder builder = new IN3MockBuilder(Chain.GOERLI); - in3 = builder.constructClient(mockedResponses); - } + IN3 in3 = builder.constructClient(mockedResponses); - @Test - public void nodeList() { - String url = "https://in3-v2.slock.it/mainnet/nd-1"; + String url = "https://in3-v2.slock.it/goerli/nd-1"; String address = "0x45d45e6ff99e6c34a235d263965910298985fcfe"; int index = 0; String deposit = "0x2386f26fc10000"; - long props = 0x06000001ddL; + long props = 0x1ddL; int timeout = 3456000; - int registerTime = 1576224418; + int registerTime = 1576227711; int weight = 2000; - IN3Node[] list = in3.nodeList(); + IN3Node[] list = in3.nodeList(new String[] { + "0x45d45e6ff99e6c34a235d263965910298985fcfe" + }); Assertions.assertTrue(list.length > 0); Assertions.assertEquals(url, list[0].getUrl()); @@ -42,6 +38,13 @@ public void nodeList() { @Test public void cacheClear() { + String[][] mockedResponses = { + {"eth_call", "eth_call_2.json"}, + {"in3_nodeList", "in3_nodeList.json"}, + {"in3_sign", "in3_sign.json"}}; + IN3MockBuilder builder = new IN3MockBuilder(Chain.GOERLI); + IN3 in3 = builder.constructClient(mockedResponses); + // This test, for now is a lie. boolean result = in3.cacheClear(); Assertions.assertTrue(result); @@ -49,6 +52,13 @@ public void cacheClear() { @Test public void sign() { + String[][] mockedResponses = { + {"eth_call", "eth_call_2.json"}, + {"in3_nodeList", "in3_nodeList.json"}, + {"in3_sign", "in3_sign.json"}}; + IN3MockBuilder builder = new IN3MockBuilder(Chain.GOERLI); + IN3 in3 = builder.constructClient(mockedResponses); + BlockID[] vR = new BlockID[] { BlockID.fromHash("0x2a8bf38abe3fec478a2029e74ac95ecdbef95ff2fb832786ba4c5231c8cea480")}; String[] address = new String[] {"0x1fe2e9bf29aa1938859af64c413361227d04059a"}; @@ -63,6 +73,13 @@ public void sign() { @Test public void getConfig() { + String[][] mockedResponses = { + {"eth_call", "eth_call_2.json"}, + {"in3_nodeList", "in3_nodeList.json"}, + {"in3_sign", "in3_sign.json"}}; + IN3MockBuilder builder = new IN3MockBuilder(Chain.GOERLI); + IN3 in3 = builder.constructClient(mockedResponses); + // This test may seem pointless but it intends to test the proper conversion of the jni getConfig to a valid String. String configJson = in3.getConfig().toJSON(); Assertions.assertNotNull(configJson); @@ -70,6 +87,13 @@ public void getConfig() { @Test public void handleEns() { + String[][] mockedResponses = { + {"eth_call", "eth_call_2.json"}, + {"in3_nodeList", "in3_nodeList.json"}, + {"in3_sign", "in3_sign.json"}}; + IN3MockBuilder builder = new IN3MockBuilder(Chain.MAINNET); + IN3 in3 = builder.constructClient(mockedResponses); + String[] params = new String[] { "cryptokitties.eth", "0x0102030405060708090a0b0c0d0e0f", @@ -86,6 +110,13 @@ public void handleEns() { @Test public void free() { + String[][] mockedResponses = { + {"eth_call", "eth_call_2.json"}, + {"in3_nodeList", "in3_nodeList.json"}, + {"in3_sign", "in3_sign.json"}}; + IN3MockBuilder builder = new IN3MockBuilder(Chain.GOERLI); + IN3 in3 = builder.constructClient(mockedResponses); + in3.free(); } } From 8da529bb71479ddcd1e7b925efb78c55976d9238 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Thu, 12 Mar 2020 16:40:03 +0100 Subject: [PATCH 47/97] Fix nodelist JSON test --- c/test/testdata/requests/in3_nodeList.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/test/testdata/requests/in3_nodeList.json b/c/test/testdata/requests/in3_nodeList.json index f4f2f417f..cffbea03f 100644 --- a/c/test/testdata/requests/in3_nodeList.json +++ b/c/test/testdata/requests/in3_nodeList.json @@ -1,7 +1,7 @@ [ { "descr": "in3_nodeList", - "chainId": "0x0", + "chainId": "0x5", "fuzzer": true, "verification": "proof", "request": { From 62eca6b47c3e2dd34308fababcd99cfaca330c58 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Thu, 12 Mar 2020 17:18:24 +0100 Subject: [PATCH 48/97] Fix format --- java/src/in3/IN3.java | 4 ++-- java/src/in3/IN3Props.java | 4 ++-- java/test/in3/IN3Test.java | 15 +++++++-------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/java/src/in3/IN3.java b/java/src/in3/IN3.java index 4e7ffd66a..dfe2f5bd8 100644 --- a/java/src/in3/IN3.java +++ b/java/src/in3/IN3.java @@ -330,10 +330,10 @@ public SignedBlockHash[] sign(BlockID[] blocks, String[] dataNodeAdresses) { if (dataNodeAdresses != null && dataNodeAdresses.length > 0) { IN3Props props = new IN3Props(); props.setDataNodes(dataNodeAdresses); - return SignedBlockHash.asSignedBlockHashs(sendObjectRPC(SIGN, new Object[] { blocks }, props)); + return SignedBlockHash.asSignedBlockHashs(sendObjectRPC(SIGN, new Object[] {blocks}, props)); } - return SignedBlockHash.asSignedBlockHashs(sendRPCasObject(SIGN, new Object[] { blocks })); + return SignedBlockHash.asSignedBlockHashs(sendRPCasObject(SIGN, new Object[] {blocks})); } protected Object[] handleEns(Object[] params) { diff --git a/java/src/in3/IN3Props.java b/java/src/in3/IN3Props.java index 22d08828c..9b2efd9cc 100644 --- a/java/src/in3/IN3Props.java +++ b/java/src/in3/IN3Props.java @@ -1,13 +1,13 @@ package in3; -import java.util.HashMap; import in3.utils.JSON; +import java.util.HashMap; public class IN3Props { HashMap props; - private static final String DATA_NODES = "dataNodes"; + private static final String DATA_NODES = "dataNodes"; private static final String SIGNER_NODES = "signerNodes"; public IN3Props() { diff --git a/java/test/in3/IN3Test.java b/java/test/in3/IN3Test.java index 2b1b9465e..895529542 100644 --- a/java/test/in3/IN3Test.java +++ b/java/test/in3/IN3Test.java @@ -10,7 +10,7 @@ public void nodeList() { {"in3_nodeList", "in3_nodeList.json"}, {"in3_sign", "in3_sign.json"}}; IN3MockBuilder builder = new IN3MockBuilder(Chain.GOERLI); - IN3 in3 = builder.constructClient(mockedResponses); + IN3 in3 = builder.constructClient(mockedResponses); String url = "https://in3-v2.slock.it/goerli/nd-1"; String address = "0x45d45e6ff99e6c34a235d263965910298985fcfe"; @@ -22,8 +22,7 @@ public void nodeList() { int weight = 2000; IN3Node[] list = in3.nodeList(new String[] { - "0x45d45e6ff99e6c34a235d263965910298985fcfe" - }); + "0x45d45e6ff99e6c34a235d263965910298985fcfe"}); Assertions.assertTrue(list.length > 0); Assertions.assertEquals(url, list[0].getUrl()); @@ -43,7 +42,7 @@ public void cacheClear() { {"in3_nodeList", "in3_nodeList.json"}, {"in3_sign", "in3_sign.json"}}; IN3MockBuilder builder = new IN3MockBuilder(Chain.GOERLI); - IN3 in3 = builder.constructClient(mockedResponses); + IN3 in3 = builder.constructClient(mockedResponses); // This test, for now is a lie. boolean result = in3.cacheClear(); @@ -57,7 +56,7 @@ public void sign() { {"in3_nodeList", "in3_nodeList.json"}, {"in3_sign", "in3_sign.json"}}; IN3MockBuilder builder = new IN3MockBuilder(Chain.GOERLI); - IN3 in3 = builder.constructClient(mockedResponses); + IN3 in3 = builder.constructClient(mockedResponses); BlockID[] vR = new BlockID[] { BlockID.fromHash("0x2a8bf38abe3fec478a2029e74ac95ecdbef95ff2fb832786ba4c5231c8cea480")}; @@ -78,7 +77,7 @@ public void getConfig() { {"in3_nodeList", "in3_nodeList.json"}, {"in3_sign", "in3_sign.json"}}; IN3MockBuilder builder = new IN3MockBuilder(Chain.GOERLI); - IN3 in3 = builder.constructClient(mockedResponses); + IN3 in3 = builder.constructClient(mockedResponses); // This test may seem pointless but it intends to test the proper conversion of the jni getConfig to a valid String. String configJson = in3.getConfig().toJSON(); @@ -92,7 +91,7 @@ public void handleEns() { {"in3_nodeList", "in3_nodeList.json"}, {"in3_sign", "in3_sign.json"}}; IN3MockBuilder builder = new IN3MockBuilder(Chain.MAINNET); - IN3 in3 = builder.constructClient(mockedResponses); + IN3 in3 = builder.constructClient(mockedResponses); String[] params = new String[] { "cryptokitties.eth", @@ -115,7 +114,7 @@ public void free() { {"in3_nodeList", "in3_nodeList.json"}, {"in3_sign", "in3_sign.json"}}; IN3MockBuilder builder = new IN3MockBuilder(Chain.GOERLI); - IN3 in3 = builder.constructClient(mockedResponses); + IN3 in3 = builder.constructClient(mockedResponses); in3.free(); } From ae099e3ce8bf4fe8d7a8d9bd09941fbdcde9f305 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Thu, 12 Mar 2020 22:07:31 +0100 Subject: [PATCH 49/97] set new ipfs-registry --- c/src/core/client/client_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/c/src/core/client/client_init.c b/c/src/core/client/client_init.c index cebfa19ed..f067675b1 100644 --- a/c/src/core/client/client_init.c +++ b/c/src/core/client/client_init.c @@ -169,9 +169,9 @@ static void initNode(in3_chain_t* chain, int node_index, char* address, char* ur static void init_ipfs(in3_chain_t* chain) { // ipfs - initChain(chain, 0x7d0, "f0fb87f4757c77ea3416afe87f36acaa0496c7e9", NULL, 1, 2, CHAIN_IPFS, NULL); - initNode(chain, 0, "784bfa9eb182c3a02dbeb5285e3dba92d717e07a", "https://in3.slock.it/ipfs/nd-1"); - initNode(chain, 1, "243D5BB48A47bEd0F6A89B61E4660540E856A33D", "https://in3.slock.it/ipfs/nd-5"); + initChain(chain, 0x7d0, "a93b57289070550c82edb1106e12bb37138948b8", "f0162ec6d785ee990e36bad865251f45af0916cf136169540c02b0dd9cb69196", 2, 2, CHAIN_IPFS, NULL); + initNode(chain, 0, "45d45e6ff99e6c34a235d263965910298985fcfe", "https://in3-v2.slock.it/ipfs/nd-1"); + initNode(chain, 1, "1fe2e9bf29aa1938859af64c413361227d04059a", "https://in3-v2.slock.it/ipfs/nd-5"); } static void init_mainnet(in3_chain_t* chain) { From 836e105bae37d10e772b2694d3dfe44c917e79ac Mon Sep 17 00:00:00 2001 From: leonardocardoso Date: Tue, 10 Mar 2020 15:46:59 +0100 Subject: [PATCH 50/97] Add ipfs for java bindings --- .vscode/settings.json | 4 +- java/resources/responses/ipfs_get.json | 15 ++++++ java/resources/responses/ipfs_put.json | 15 ++++++ java/src/CMakeLists.txt | 1 + java/src/in3/IN3.java | 13 ++++-- java/src/in3/eth1/API.java | 2 +- java/src/in3/ipfs/API.java | 64 ++++++++++++++++++++++++++ java/src/in3_jni.c | 34 ++++++++++++++ java/src/in3_jni.h | 16 +++++++ java/test/in3/IN3MockBuilder.java | 5 ++ java/test/in3/ipfs/ApiTest.java | 54 ++++++++++++++++++++++ 11 files changed, 217 insertions(+), 6 deletions(-) create mode 100644 java/resources/responses/ipfs_get.json create mode 100644 java/resources/responses/ipfs_put.json create mode 100644 java/src/in3/ipfs/API.java create mode 100644 java/test/in3/ipfs/ApiTest.java diff --git a/.vscode/settings.json b/.vscode/settings.json index 3542a6d66..8b8940d98 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -87,7 +87,9 @@ "eth_call_response_binary.h": "c", "malloc.h": "c", "memzero.h": "c", - "eth_basic.h": "c" + "eth_basic.h": "c", + "sha2.h": "c", + "pb_decode.h": "c" }, "C_Cpp.errorSquiggles": "Disabled" } \ No newline at end of file diff --git a/java/resources/responses/ipfs_get.json b/java/resources/responses/ipfs_get.json new file mode 100644 index 000000000..d84d4211f --- /dev/null +++ b/java/resources/responses/ipfs_get.json @@ -0,0 +1,15 @@ +[ + { + "id": 1, + "result": "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQ=", + "jsonrpc": "2.0", + "in3": { + "lastValidatorChange": 0, + "lastNodeList": 8525528, + "execTime": 14, + "rpcTime": 0, + "rpcCount": 0, + "currentBlock": 17091918 + } + } +] \ No newline at end of file diff --git a/java/resources/responses/ipfs_put.json b/java/resources/responses/ipfs_put.json new file mode 100644 index 000000000..62492daa7 --- /dev/null +++ b/java/resources/responses/ipfs_put.json @@ -0,0 +1,15 @@ +[ + { + "id": 1, + "result": "QmbGySCLuGxu2GxVLYWeqJW9XeyjGFvpoZAhGhXDGEUQu8", + "jsonrpc": "2.0", + "in3": { + "lastValidatorChange": 0, + "lastNodeList": 8525528, + "execTime": 23, + "rpcTime": 0, + "rpcCount": 0, + "currentBlock": 17091918 + } + } +] \ No newline at end of file diff --git a/java/src/CMakeLists.txt b/java/src/CMakeLists.txt index f9c0464d9..daf3d0bfc 100644 --- a/java/src/CMakeLists.txt +++ b/java/src/CMakeLists.txt @@ -73,6 +73,7 @@ IF (NOT DEFINED ANDROID_ABI) in3/eth1/Transaction.java in3/eth1/TransactionReceipt.java in3/eth1/TransactionRequest.java + in3/ipfs/API.java in3/utils/Account.java in3/utils/Crypto.java in3/utils/JSON.java diff --git a/java/src/in3/IN3.java b/java/src/in3/IN3.java index 3cf7e2bab..a9976a2b6 100644 --- a/java/src/in3/IN3.java +++ b/java/src/in3/IN3.java @@ -35,10 +35,8 @@ package in3; import in3.config.ClientConfiguration; -import in3.eth1.API; import in3.utils.Crypto; import in3.utils.JSON; -import in3.utils.Signature; import in3.utils.Signer; import in3.utils.StorageProvider; @@ -140,11 +138,18 @@ public Signer getSigner() { return signer; } + /** + * gets the ipfs-api + */ + public in3.ipfs.API getIpfs() { + return new in3.ipfs.API(this); + } + /** * gets the ethereum-api */ - public API getEth1API() { - return new API(this); + public in3.eth1.API getEth1API() { + return new in3.eth1.API(this); } /** diff --git a/java/src/in3/eth1/API.java b/java/src/in3/eth1/API.java index 838e9a35d..cd2f5ca1e 100644 --- a/java/src/in3/eth1/API.java +++ b/java/src/in3/eth1/API.java @@ -83,7 +83,7 @@ public class API { private IN3 in3; /** - * creates a API using the given incubed instance. + * creates an eth1.API using the given incubed instance. */ public API(IN3 in3) { this.in3 = in3; diff --git a/java/src/in3/ipfs/API.java b/java/src/in3/ipfs/API.java new file mode 100644 index 000000000..953df2372 --- /dev/null +++ b/java/src/in3/ipfs/API.java @@ -0,0 +1,64 @@ +package in3.ipfs; + +import in3.IN3; +import in3.utils.JSON; +import java.nio.charset.Charset; + +/** + * API for ipfs custom methods. To be used along with "Chain.IPFS" on in3 instance. + */ +public class API { + private IN3 in3; + + private static final String PUT = "ipfs_put"; + private static final String GET = "ipfs_get"; + + private enum Enconding { + base64, + hex, + utf8; + } + + /** + * creates a ipfs.API using the given incubed instance. + */ + public API(IN3 in3) { + this.in3 = in3; + } + + /** + * Returns the content associated with specified multihash on success OR NULL on error. + */ + public byte[] get(String multihash) { + if (multihash == null) throw new IllegalArgumentException(); + + String content = JSON.asString(in3.sendRPCasObject(GET, new Object[] { + multihash, + JSON.asString(Enconding.base64)})); + + return content != null ? base64Decode(content) : null; + } + + /** + * Returns the IPFS multihash of stored content on success OR NULL on error. + */ + public String put(String content) { + return put(content != null ? content.getBytes(Charset.forName("UTF8")) : null); + } + + /** + * Returns the IPFS multihash of stored content on success OR NULL on error. + */ + public String put(byte[] content) { + if (content == null) throw new IllegalArgumentException(); + + String encodedContent = base64Encode(content); + Object rawResult = in3.sendRPCasObject(PUT, new Object[] { + encodedContent}); + + return JSON.asString(rawResult); + } + + private native byte[] base64Decode(String str); + private native String base64Encode(byte[] str); +} diff --git a/java/src/in3_jni.c b/java/src/in3_jni.c index 9857cd87e..f78d52c35 100644 --- a/java/src/in3_jni.c +++ b/java/src/in3_jni.c @@ -47,6 +47,8 @@ #include "../../c/src/third-party/crypto/secp256k1.h" #include "../../c/src/verifier/eth1/full/eth_full.h" #ifdef IPFS +#include "../../c/src/third-party/libb64/cdecode.h" +#include "../../c/src/third-party/libb64/cencode.h" #include "../../c/src/verifier/ipfs/ipfs.h" #endif @@ -938,6 +940,38 @@ void in3_set_jclient_config(in3_t* c, jobject jclient) { (*jni)->CallVoidMethod(jni, jclientconfigurationobj, marked_as_synced); } +#ifdef IPFS +/* + * Class: in3_ipfs_API + * Method: base64Decode + * Signature: (Ljava/lang/String;)[B + */ +JNIEXPORT jbyteArray JNICALL Java_in3_ipfs_API_base64Decode(JNIEnv* env, jobject ob, jstring jinput) { + UNUSED_VAR(ob); + size_t len = 0; + const char* input = (*env)->GetStringUTFChars(env, jinput, 0); + uint8_t* b64 = base64_decode(input, &len); + (*env)->ReleaseStringUTFChars(env, jinput, input); + jbyteArray res = (*env)->NewByteArray(env, len); + (*env)->SetByteArrayRegion(env, res, 0, len, (jbyte*) b64); + return res; +} + +/* + * Class: in3_ipfs_API + * Method: base64Encode + * Signature: ([B)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_in3_ipfs_API_base64Encode(JNIEnv* env, jobject ob, jbyteArray jinput) { + UNUSED_VAR(ob); + jbyte* body = (*env)->GetByteArrayElements(env, jinput, 0); + char* b64 = base64_encode((uint8_t*) body, (*env)->GetArrayLength(env, jinput)); + (*env)->ReleaseByteArrayElements(env, jinput, body, 0); + jstring jresult = (*env)->NewStringUTF(env, b64); + return jresult; +} +#endif + /* * Class: in3_IN3 * Method: init diff --git a/java/src/in3_jni.h b/java/src/in3_jni.h index f04fed902..bdc55c320 100644 --- a/java/src/in3_jni.h +++ b/java/src/in3_jni.h @@ -301,6 +301,22 @@ JNIEXPORT jobject JNICALL Java_in3_IN3_sendobjectinternal(JNIEnv*, jobject, jstr */ JNIEXPORT void JNICALL Java_in3_IN3_free(JNIEnv*, jobject); +#ifdef IPFS +/* + * Class: in3_ipfs_API + * Method: base64Decode + * Signature: (Ljava/lang/String;)[B + */ +JNIEXPORT jbyteArray JNICALL Java_in3_ipfs_API_base64Decode(JNIEnv* env, jobject ob, jstring jinput); + +/* + * Class: in3_ipfs_API + * Method: base64Encode + * Signature: ([B)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_in3_ipfs_API_base64Encode(JNIEnv* env, jobject ob, jbyteArray jinput); +#endif + /* * Class: in3_IN3 * Method: init diff --git a/java/test/in3/IN3MockBuilder.java b/java/test/in3/IN3MockBuilder.java index 8e8b84794..09cc07ca1 100644 --- a/java/test/in3/IN3MockBuilder.java +++ b/java/test/in3/IN3MockBuilder.java @@ -44,6 +44,11 @@ public void buildConfig() { nodeConfig3.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f"); nodeConfig3.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb"); + ChainConfiguration nodeConfig4 = new ChainConfiguration(Chain.IPFS, clientConfig); + nodeConfig4.setNeedsUpdate(false); + nodeConfig4.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f"); + nodeConfig4.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb"); + clientConfig.setRequestCount(1); clientConfig.setAutoUpdateList(false); clientConfig.setProof(Proof.none); diff --git a/java/test/in3/ipfs/ApiTest.java b/java/test/in3/ipfs/ApiTest.java new file mode 100644 index 000000000..d99ec2df8 --- /dev/null +++ b/java/test/in3/ipfs/ApiTest.java @@ -0,0 +1,54 @@ +package in3.ipfs; + +import in3.Chain; +import in3.IN3; +import in3.IN3MockBuilder; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class ApiTest { + + private IN3 in3; + + @BeforeEach + public void setupClient() { + String[][] mockedResponses = { + {"ipfs_get", "ipfs_get.json"}, + {"ipfs_put", "ipfs_put.json"}}; + IN3MockBuilder builder = new IN3MockBuilder(Chain.IPFS); + in3 = builder.constructClient(mockedResponses); + } + + @Test + public void put_success() { + String content = "Lorem ipsum dolor sit amet"; + String multihash = in3.getIpfs().put(content); + Assertions.assertNotNull(multihash); + Assertions.assertEquals("QmbGySCLuGxu2GxVLYWeqJW9XeyjGFvpoZAhGhXDGEUQu8", multihash); + } + + @Test + public void put_failure() { + String nullable = null; + Assertions.assertThrows(IllegalArgumentException.class, () -> { + in3.getIpfs().put(nullable); + }); + } + + @Test + public void get_success() { + String multihash = "QmbGySCLuGxu2GxVLYWeqJW9XeyjGFvpoZAhGhXDGEUQu8"; + byte[] content = in3.getIpfs().get(multihash); + Assertions.assertNotNull(content); + Assertions.assertEquals("Lorem ipsum dolor sit amet", new String(content)); + } + + @Test + public void get_failure() { + String multihash = null; + Assertions.assertThrows(IllegalArgumentException.class, () -> { + in3.getIpfs().get(multihash); + }); + } +} From 031f6abe8919d025c60ee0e999c721be34505116 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 13 Mar 2020 11:56:00 +0100 Subject: [PATCH 51/97] Add verifier_init.c/h --- c/src/verifier/verifier_init.c | 34 ++++++++++++++++++++++++++++++++++ c/src/verifier/verifier_init.h | 13 +++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 c/src/verifier/verifier_init.c create mode 100644 c/src/verifier/verifier_init.h diff --git a/c/src/verifier/verifier_init.c b/c/src/verifier/verifier_init.c new file mode 100644 index 000000000..82d2bea03 --- /dev/null +++ b/c/src/verifier/verifier_init.c @@ -0,0 +1,34 @@ +#include "verifier_init.h" +#include "../api/eth1/eth_api.h" +#include "../verifier/eth1/basic/eth_basic.h" +#include "../verifier/eth1/full/eth_full.h" +#include "../verifier/eth1/nano/eth_nano.h" +#include "../verifier/ipfs/ipfs.h" + +static bool initialized; + +static void verifier_init() { + if (initialized) return; + initialized = true; + +#ifdef ETH_FULL + in3_register_eth_full(); +#endif +#ifdef ETH_BASIC + in3_register_eth_basic(); +#endif +#ifdef ETH_NANO + in3_register_eth_nano(); +#endif +#ifdef ETH_API + in3_register_eth_api(); +#endif +#ifdef IPFS + in3_register_ipfs(); +#endif +} + +in3_t* in3_for_chain_auto_init(chain_id_t chain_id) { + verifier_init(); + return in3_for_chain_default(chain_id); +} diff --git a/c/src/verifier/verifier_init.h b/c/src/verifier/verifier_init.h new file mode 100644 index 000000000..3634e70ad --- /dev/null +++ b/c/src/verifier/verifier_init.h @@ -0,0 +1,13 @@ +#ifndef IN3_VERIFIER_INIT_H +#define IN3_VERIFIER_INIT_H + +#include "../core/client/client.h" + +#ifdef in3_for_chain +#undef in3_for_chain +#define in3_for_chain(chain_id) in3_for_chain_auto_init(chain_id) +#endif + +in3_t* in3_for_chain_auto_init(chain_id_t chain_id); + +#endif //IN3_VERIFIER_INIT_H From 92785dcbdc35da72350d394466194d2db7e41be1 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 13 Mar 2020 11:56:40 +0100 Subject: [PATCH 52/97] Add module init --- c/src/core/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/c/src/core/CMakeLists.txt b/c/src/core/CMakeLists.txt index 6bc3f4451..7a9172aaf 100644 --- a/c/src/core/CMakeLists.txt +++ b/c/src/core/CMakeLists.txt @@ -38,8 +38,8 @@ include("${PROJECT_SOURCE_DIR}/c/compiler.cmake") # This module does not have any dependencies and cannot be used without additional modules providing verification and transport. OPTION(IN3_STAGING "if true, the client will use the staging-network instead of the live ones" OFF) IF (IN3_STAGING) - ADD_DEFINITIONS(-DIN3_STAGING) -ENDIF(IN3_STAGING) + ADD_DEFINITIONS(-DIN3_STAGING) +ENDIF (IN3_STAGING) add_library(core_o OBJECT client/context.c @@ -61,3 +61,7 @@ add_library(core_o OBJECT ) add_library(core STATIC $) target_link_libraries(core crypto) + +add_library(init_o OBJECT ../verifier/verifier_init.c) +add_library(init STATIC $) +target_link_libraries(init eth_full eth_api ipfs) From befb40d352932ab3d353f2023f8ef771a47606be Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 13 Mar 2020 12:22:49 +0100 Subject: [PATCH 53/97] Rename in3_for_chain to in3_for_chain_default --- c/src/core/client/client.h | 4 +++- c/src/core/client/client_init.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/c/src/core/client/client.h b/c/src/core/client/client.h index 814040174..f741addf4 100644 --- a/c/src/core/client/client.h +++ b/c/src/core/client/client.h @@ -555,7 +555,9 @@ in3_t* in3_new() __attribute__((deprecated("use in3_for_chain(ETH_CHAIN_ID_MULTI * * @returns the incubed instance. */ -in3_t* in3_for_chain( +#define in3_for_chain(chain_id) in3_for_chain_default(chain_id) + +in3_t* in3_for_chain_default( chain_id_t chain_id /**< the chain_id (see ETH_CHAIN_ID_... constants). */ ); diff --git a/c/src/core/client/client_init.c b/c/src/core/client/client_init.c index 3d0e9bba0..9f5fc30e2 100644 --- a/c/src/core/client/client_init.c +++ b/c/src/core/client/client_init.c @@ -434,7 +434,7 @@ void in3_free(in3_t* a) { _free(a); } -in3_t* in3_for_chain(chain_id_t chain_id) { +in3_t* in3_for_chain_default(chain_id_t chain_id) { // initialize random with the timestamp (in nanoseconds) as seed in3_srand(current_ms()); From 455e21cb1b38a7594ee04438674dcb033c01c578 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 13 Mar 2020 12:23:28 +0100 Subject: [PATCH 54/97] link runner to init module --- c/test/CMakeLists.txt | 2 +- c/test/runner.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/c/test/CMakeLists.txt b/c/test/CMakeLists.txt index d06784a8b..71b627642 100644 --- a/c/test/CMakeLists.txt +++ b/c/test/CMakeLists.txt @@ -54,7 +54,7 @@ endif() # first we build the runners add_executable(runner runner.c) -target_link_libraries(runner eth_full eth_api ipfs) +target_link_libraries(runner eth_full eth_api ipfs init) add_executable(vmrunner vm_runner.c test_evm.c test_trie.c test_rlp.c) target_link_libraries(vmrunner eth_full) diff --git a/c/test/runner.c b/c/test/runner.c index c27cd8f2a..a89d6c16f 100644 --- a/c/test/runner.c +++ b/c/test/runner.c @@ -42,6 +42,7 @@ #include "../src/core/util/mem.h" #include "../src/verifier/eth1/full/eth_full.h" #include "../src/verifier/ipfs/ipfs.h" +#include "verifier/verifier_init.h" #include #include #include @@ -447,9 +448,6 @@ int runRequests(char** names, int test_index, int mem_track) { int main(int argc, char* argv[]) { use_color = 1; in3_log_set_level(LOG_INFO); - in3_register_eth_full(); - in3_register_eth_api(); - in3_register_ipfs(); int i = 0, size = 1; int testIndex = -1, membrk = -1; char** names = malloc(sizeof(char*)); From bf2bca45effa1c4540d488c6f9224c4f24992a9b Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 13 Mar 2020 12:24:05 +0100 Subject: [PATCH 55/97] Fix failing tests due to memory leak --- c/src/api/eth1/rpc_api.c | 2 +- c/src/core/client/verifier.c | 1 - c/src/verifier/btc/btc.c | 2 +- c/src/verifier/eth1/basic/eth_basic.c | 2 +- c/src/verifier/eth1/full/eth_full.c | 2 +- c/src/verifier/eth1/nano/eth_nano.c | 2 +- c/src/verifier/ipfs/ipfs.c | 2 +- 7 files changed, 6 insertions(+), 7 deletions(-) diff --git a/c/src/api/eth1/rpc_api.c b/c/src/api/eth1/rpc_api.c index ed3bdc893..cc5b2a098 100644 --- a/c/src/api/eth1/rpc_api.c +++ b/c/src/api/eth1/rpc_api.c @@ -382,7 +382,7 @@ void in3_register_eth_api() { v->verify = (in3_verify) verify; v->pre_handle = eth_handle_intern; } else { - in3_verifier_t* v = _calloc(1, sizeof(in3_verifier_t)); + in3_verifier_t* v = calloc(1, sizeof(in3_verifier_t)); v->type = CHAIN_ETH; v->pre_handle = eth_handle_intern; v->verify = (in3_verify) verify; diff --git a/c/src/core/client/verifier.c b/c/src/core/client/verifier.c index 662967213..26b4daa86 100644 --- a/c/src/core/client/verifier.c +++ b/c/src/core/client/verifier.c @@ -33,7 +33,6 @@ *******************************************************************************/ #include "verifier.h" -#include "../util/stringbuilder.h" #include "client.h" #include "keys.h" diff --git a/c/src/verifier/btc/btc.c b/c/src/verifier/btc/btc.c index e610ab51a..f804b5c6b 100644 --- a/c/src/verifier/btc/btc.c +++ b/c/src/verifier/btc/btc.c @@ -138,7 +138,7 @@ in3_ret_t in3_verify_btc(in3_vctx_t* vc) { } void in3_register_btc() { - in3_verifier_t* v = _calloc(1, sizeof(in3_verifier_t)); + in3_verifier_t* v = calloc(1, sizeof(in3_verifier_t)); v->type = CHAIN_BTC; v->pre_handle = btc_handle_intern; v->verify = in3_verify_btc; diff --git a/c/src/verifier/eth1/basic/eth_basic.c b/c/src/verifier/eth1/basic/eth_basic.c index c9027cd93..2de0cff6d 100644 --- a/c/src/verifier/eth1/basic/eth_basic.c +++ b/c/src/verifier/eth1/basic/eth_basic.c @@ -224,7 +224,7 @@ in3_ret_t eth_handle_intern(in3_ctx_t* ctx, in3_response_t** response) { } void in3_register_eth_basic() { - in3_verifier_t* v = _calloc(1, sizeof(in3_verifier_t)); + in3_verifier_t* v = calloc(1, sizeof(in3_verifier_t)); v->type = CHAIN_ETH; v->pre_handle = eth_handle_intern; v->verify = in3_verify_eth_basic; diff --git a/c/src/verifier/eth1/full/eth_full.c b/c/src/verifier/eth1/full/eth_full.c index cd3c2a1f5..2c735af85 100644 --- a/c/src/verifier/eth1/full/eth_full.c +++ b/c/src/verifier/eth1/full/eth_full.c @@ -118,7 +118,7 @@ int in3_verify_eth_full(in3_vctx_t* vc) { } void in3_register_eth_full() { - in3_verifier_t* v = _calloc(1, sizeof(in3_verifier_t)); + in3_verifier_t* v = calloc(1, sizeof(in3_verifier_t)); v->type = CHAIN_ETH; v->pre_handle = eth_handle_intern; v->verify = (in3_verify) in3_verify_eth_full; diff --git a/c/src/verifier/eth1/nano/eth_nano.c b/c/src/verifier/eth1/nano/eth_nano.c index 590589952..199e33948 100644 --- a/c/src/verifier/eth1/nano/eth_nano.c +++ b/c/src/verifier/eth1/nano/eth_nano.c @@ -80,7 +80,7 @@ in3_ret_t in3_verify_eth_nano(in3_vctx_t* vc) { } void in3_register_eth_nano() { - in3_verifier_t* v = _calloc(1, sizeof(in3_verifier_t)); + in3_verifier_t* v = calloc(1, sizeof(in3_verifier_t)); v->type = CHAIN_ETH; v->verify = in3_verify_eth_nano; in3_register_verifier(v); diff --git a/c/src/verifier/ipfs/ipfs.c b/c/src/verifier/ipfs/ipfs.c index e8568f6f4..9a39f1957 100644 --- a/c/src/verifier/ipfs/ipfs.c +++ b/c/src/verifier/ipfs/ipfs.c @@ -167,7 +167,7 @@ in3_ret_t in3_verify_ipfs(in3_vctx_t* vc) { } void in3_register_ipfs() { - in3_verifier_t* v = _calloc(1, sizeof(in3_verifier_t)); + in3_verifier_t* v = calloc(1, sizeof(in3_verifier_t)); v->type = CHAIN_IPFS; v->verify = in3_verify_ipfs; in3_register_verifier(v); From e96768a0dae6391eaa554ee0f2ced671efc0f740 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Fri, 13 Mar 2020 14:10:39 +0100 Subject: [PATCH 56/97] add ipfs in cmd --- c/src/cmd/in3/CMakeLists.txt | 2 +- c/src/cmd/in3/main.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/c/src/cmd/in3/CMakeLists.txt b/c/src/cmd/in3/CMakeLists.txt index ba40ab30b..3cc8968ce 100644 --- a/c/src/cmd/in3/CMakeLists.txt +++ b/c/src/cmd/in3/CMakeLists.txt @@ -56,7 +56,7 @@ endif() if (IPFS) ADD_DEFINITIONS(-DIPFS) - set(LIBS ${LIBS} ipfs) + set(LIBS ${LIBS} ipfs ipfs_api ) endif() diff --git a/c/src/cmd/in3/main.c b/c/src/cmd/in3/main.c index 712b974da..42f49a9d0 100644 --- a/c/src/cmd/in3/main.c +++ b/c/src/cmd/in3/main.c @@ -76,6 +76,7 @@ #include "../../verifier/btc/btc.h" #endif #ifdef IPFS +#include "../../api/ipfs/ipfs_api.h" #include "../../verifier/ipfs/ipfs.h" #endif @@ -602,6 +603,7 @@ int main(int argc, char* argv[]) { // define vars char *method = NULL, params[50000]; params[0] = '['; + params[1] = 0; int p = 1, i; bytes32_t pk; @@ -848,7 +850,24 @@ int main(int argc, char* argv[]) { else print_val(res->result); return 0; +#ifdef IPFS + } else if (strcmp(method, "ipfs_get") == 0) { + c->chain_id = ETH_CHAIN_ID_IPFS; + int size = strlen(params); + if (p == 1 || params[1] != '"' || size < 20 || strstr(params + 2, "\"") == NULL) die("missing ipfs has"); + params[size - 2] = 0; + bytes_t* content = ipfs_get(c, params + 2); + if (!content) die("IPFS hash not found!"); + fwrite(content->data, content->len, 1, stdout); + fflush(stdout); + return 0; + + } else if (strcmp(method, "ipfs_put") == 0) { + c->chain_id = ETH_CHAIN_ID_IPFS; + printf("%s\n", ipfs_put(c, get_std_in())); + return 0; +#endif } else if (strcmp(method, "in3_weights") == 0) { c->max_attempts = 1; uint32_t block = 0, b = 0; @@ -907,7 +926,6 @@ int main(int argc, char* argv[]) { } return 0; - } else if (strcmp(method, "send") == 0) { prepare_tx(sig, resolve(c, to), params, NULL, gas_limit, value, data); method = "eth_sendTransaction"; From 436f3be04c92e0d1256f593f7dd875f9b4009fe7 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Fri, 13 Mar 2020 14:23:02 +0100 Subject: [PATCH 57/97] fix ipfs_put --- c/src/cmd/in3/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/c/src/cmd/in3/main.c b/c/src/cmd/in3/main.c index 42f49a9d0..acc2b847d 100644 --- a/c/src/cmd/in3/main.c +++ b/c/src/cmd/in3/main.c @@ -863,8 +863,10 @@ int main(int argc, char* argv[]) { return 0; } else if (strcmp(method, "ipfs_put") == 0) { - c->chain_id = ETH_CHAIN_ID_IPFS; - printf("%s\n", ipfs_put(c, get_std_in())); + c->chain_id = ETH_CHAIN_ID_IPFS; + bytes_t data = readFile(stdin); + data.data[data.len] = 0; + printf("%s\n", ipfs_put(c, &data)); return 0; #endif From 1d998f3661fae2e9d975e6cf9877c602b8b2c92d Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Fri, 13 Mar 2020 14:29:28 +0100 Subject: [PATCH 58/97] add in help in --- c/src/cmd/in3/main.c | 8 +++++++- scripts/_in3.sh | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/c/src/cmd/in3/main.c b/c/src/cmd/in3/main.c index acc2b847d..190da8e66 100644 --- a/c/src/cmd/in3/main.c +++ b/c/src/cmd/in3/main.c @@ -138,6 +138,12 @@ in3_nodeList\n\ in3_sign \n\ requests a node to sign. in order to specify the signer, you need to pass the url with -c\n\ \n\ +ipfs_get \n\ + requests and verifies the content for a given ipfs-hash and write the content to stdout\n\ +\n\ +ipfs_put\n\ + reads a content from stdin and pushes to the ipfs-network. it write the ipfs-hash to stdout.\n\ +\n\ in3_stats\n\ returns the stats of a node. unless you specify the node with -c it will pick a random node.\n\ \n\ @@ -991,7 +997,7 @@ int main(int argc, char* argv[]) { return 0; } else if (strcmp(method, "autocompletelist") == 0) { - printf("send call abi_encode abi_decode ecrecover key -sigtype -st eth_sign raw hash sign createkey -ri -ro keystore unlock pk2address pk2public mainnet tobalaba kovan goerli local volta true false latest -np -debug -c -chain -p -version -proof -s -signs -b -block -to -d -data -gas_limit -value -w -wait -hex -json in3_nodeList in3_stats in3_sign web3_clientVersion web3_sha3 net_version net_peerCount net_listening eth_protocolVersion eth_syncing eth_coinbase eth_mining eth_hashrate eth_gasPrice eth_accounts eth_blockNumber eth_getBalance eth_getStorageAt eth_getTransactionCount eth_getBlockTransactionCountByHash eth_getBlockTransactionCountByNumber eth_getUncleCountByBlockHash eth_getUncleCountByBlockNumber eth_getCode eth_sign eth_sendTransaction eth_sendRawTransaction eth_call eth_estimateGas eth_getBlockByHash eth_getBlockByNumber eth_getTransactionByHash eth_getTransactionByBlockHashAndIndex eth_getTransactionByBlockNumberAndIndex eth_getTransactionReceipt eth_pendingTransactions eth_getUncleByBlockHashAndIndex eth_getUncleByBlockNumberAndIndex eth_getCompilers eth_compileLLL eth_compileSolidity eth_compileSerpent eth_newFilter eth_newBlockFilter eth_newPendingTransactionFilter eth_uninstallFilter eth_getFilterChanges eth_getFilterLogs eth_getLogs eth_getWork eth_submitWork eth_submitHashrate in3_cacheClear\n"); + printf("send call abi_encode abi_decode ipfs_get ipfs_put ecrecover key -sigtype -st eth_sign raw hash sign createkey -ri -ro keystore unlock pk2address pk2public mainnet tobalaba kovan goerli local volta true false latest -np -debug -c -chain -p -version -proof -s -signs -b -block -to -d -data -gas_limit -value -w -wait -hex -json in3_nodeList in3_stats in3_sign web3_clientVersion web3_sha3 net_version net_peerCount net_listening eth_protocolVersion eth_syncing eth_coinbase eth_mining eth_hashrate eth_gasPrice eth_accounts eth_blockNumber eth_getBalance eth_getStorageAt eth_getTransactionCount eth_getBlockTransactionCountByHash eth_getBlockTransactionCountByNumber eth_getUncleCountByBlockHash eth_getUncleCountByBlockNumber eth_getCode eth_sign eth_sendTransaction eth_sendRawTransaction eth_call eth_estimateGas eth_getBlockByHash eth_getBlockByNumber eth_getTransactionByHash eth_getTransactionByBlockHashAndIndex eth_getTransactionByBlockNumberAndIndex eth_getTransactionReceipt eth_pendingTransactions eth_getUncleByBlockHashAndIndex eth_getUncleByBlockNumberAndIndex eth_getCompilers eth_compileLLL eth_compileSolidity eth_compileSerpent eth_newFilter eth_newBlockFilter eth_newPendingTransactionFilter eth_uninstallFilter eth_getFilterChanges eth_getFilterLogs eth_getLogs eth_getWork eth_submitWork eth_submitHashrate in3_cacheClear\n"); return 0; } else if (strcmp(method, "createkey") == 0) { time_t t; diff --git a/scripts/_in3.sh b/scripts/_in3.sh index f048db25a..12f80cc91 100755 --- a/scripts/_in3.sh +++ b/scripts/_in3.sh @@ -30,6 +30,8 @@ subcmds=( 'in3_cacheClear: clears the cache' 'in3_sign: requests a node to sign. ' 'in3_ens: resolve ens-name. ' + 'ipfs_get: requests and verifies the content for a given ipfs-hash and write the content to stdout ' + 'ipfs_put: reads data from stdin and pushes to the ipfs-network. it write the ipfs-hash to stdout.' 'send: sends a transaction ...args' 'call: calls a contract ...args' 'abi_encode: encodes the arguments as described in the method signature using ABI-Encoding. ...args' @@ -47,6 +49,7 @@ args=( '-p[the Verification level]:p:(none standard full)' '-pwd[password to unlock the key]:pwd:()' '-np[short for -p none]' + '-ns[short for no stats, which does count this request in the public stats]' '-eth[onverts the result (as wei) to ether]' '-l[replaces "latest" with latest BlockNumber - the number of blocks given]:latest:(1 2 3 4 5 6 7 8 9 10)' '-s[number of signatures to use when verifying]:sigs:(1 2 3 4 5 6 7 8 9 10)' From 40c66b7cb2ad128d6211a71b7552157f36a016ff Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 13 Mar 2020 20:18:04 +0100 Subject: [PATCH 59/97] Add in3_register_btc() to verifier init --- c/src/verifier/verifier_init.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/c/src/verifier/verifier_init.c b/c/src/verifier/verifier_init.c index 82d2bea03..f86b084a1 100644 --- a/c/src/verifier/verifier_init.c +++ b/c/src/verifier/verifier_init.c @@ -1,5 +1,6 @@ #include "verifier_init.h" #include "../api/eth1/eth_api.h" +#include "../verifier/btc/btc.h" #include "../verifier/eth1/basic/eth_basic.h" #include "../verifier/eth1/full/eth_full.h" #include "../verifier/eth1/nano/eth_nano.h" @@ -26,6 +27,9 @@ static void verifier_init() { #ifdef IPFS in3_register_ipfs(); #endif +#ifdef BTC + in3_register_btc(); +#endif } in3_t* in3_for_chain_auto_init(chain_id_t chain_id) { From 4fbc240584ebb2f4c5453eb74bf14e4958fc0365 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 13 Mar 2020 20:31:39 +0100 Subject: [PATCH 60/97] Minor refactoring --- c/src/core/CMakeLists.txt | 2 +- c/src/verifier/{verifier_init.c => in3_init.c} | 13 +++++++------ c/src/verifier/{verifier_init.h => in3_init.h} | 6 +++--- c/test/runner.c | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) rename c/src/verifier/{verifier_init.c => in3_init.c} (79%) rename c/src/verifier/{verifier_init.h => in3_init.h} (70%) diff --git a/c/src/core/CMakeLists.txt b/c/src/core/CMakeLists.txt index 7a9172aaf..d05b57194 100644 --- a/c/src/core/CMakeLists.txt +++ b/c/src/core/CMakeLists.txt @@ -62,6 +62,6 @@ add_library(core_o OBJECT add_library(core STATIC $) target_link_libraries(core crypto) -add_library(init_o OBJECT ../verifier/verifier_init.c) +add_library(init_o OBJECT ../verifier/in3_init.c) add_library(init STATIC $) target_link_libraries(init eth_full eth_api ipfs) diff --git a/c/src/verifier/verifier_init.c b/c/src/verifier/in3_init.c similarity index 79% rename from c/src/verifier/verifier_init.c rename to c/src/verifier/in3_init.c index f86b084a1..405dd54e7 100644 --- a/c/src/verifier/verifier_init.c +++ b/c/src/verifier/in3_init.c @@ -1,5 +1,6 @@ -#include "verifier_init.h" +#include "in3_init.h" #include "../api/eth1/eth_api.h" +#include "../transport/curl/in3_curl.h" #include "../verifier/btc/btc.h" #include "../verifier/eth1/basic/eth_basic.h" #include "../verifier/eth1/full/eth_full.h" @@ -8,10 +9,7 @@ static bool initialized; -static void verifier_init() { - if (initialized) return; - initialized = true; - +static void init_verifier() { #ifdef ETH_FULL in3_register_eth_full(); #endif @@ -33,6 +31,9 @@ static void verifier_init() { } in3_t* in3_for_chain_auto_init(chain_id_t chain_id) { - verifier_init(); + if (!initialized) { + initialized = true; + init_verifier(); + } return in3_for_chain_default(chain_id); } diff --git a/c/src/verifier/verifier_init.h b/c/src/verifier/in3_init.h similarity index 70% rename from c/src/verifier/verifier_init.h rename to c/src/verifier/in3_init.h index 3634e70ad..71e16f591 100644 --- a/c/src/verifier/verifier_init.h +++ b/c/src/verifier/in3_init.h @@ -1,5 +1,5 @@ -#ifndef IN3_VERIFIER_INIT_H -#define IN3_VERIFIER_INIT_H +#ifndef IN3_IN3_INIT_H +#define IN3_IN3_INIT_H #include "../core/client/client.h" @@ -10,4 +10,4 @@ in3_t* in3_for_chain_auto_init(chain_id_t chain_id); -#endif //IN3_VERIFIER_INIT_H +#endif //IN3_IN3_INIT_H diff --git a/c/test/runner.c b/c/test/runner.c index a89d6c16f..89c09aef0 100644 --- a/c/test/runner.c +++ b/c/test/runner.c @@ -42,7 +42,7 @@ #include "../src/core/util/mem.h" #include "../src/verifier/eth1/full/eth_full.h" #include "../src/verifier/ipfs/ipfs.h" -#include "verifier/verifier_init.h" +#include "verifier/in3_init.h" #include #include #include From 5e17bc3e478c6028ccce3faecdd5a37bc3ac7e4a Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 13 Mar 2020 21:25:54 +0100 Subject: [PATCH 61/97] Use init module for JNI and WASM --- CMakeLists.txt | 5 ----- java/src/CMakeLists.txt | 2 +- java/src/in3_jni.c | 12 +----------- wasm/src/CMakeLists.txt | 2 +- wasm/src/wasm.c | 37 ++++--------------------------------- 5 files changed, 7 insertions(+), 51 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2091f7301..aeef27e4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,22 +81,17 @@ endif() if(ETH_FULL) ADD_DEFINITIONS(-DETH_FULL) - set(IN3_VERIFIER eth_full) elseif(ETH_BASIC) ADD_DEFINITIONS(-DETH_BASIC) - set(IN3_VERIFIER eth_basic) elseif(ETH_NANO) ADD_DEFINITIONS(-DETH_NANO) - set(IN3_VERIFIER eth_nano) endif() if(IN3API) ADD_DEFINITIONS(-DETH_API) - set(IN3_API eth_api) endif() if(IPFS) ADD_DEFINITIONS(-DIPFS) - set(IN3_VERIFIER ${IN3_VERIFIER} ipfs) endif() if(CMAKE_BUILD_TYPE MATCHES Debug) diff --git a/java/src/CMakeLists.txt b/java/src/CMakeLists.txt index 056450dd0..dfaab1b1c 100644 --- a/java/src/CMakeLists.txt +++ b/java/src/CMakeLists.txt @@ -35,7 +35,7 @@ include("${PROJECT_SOURCE_DIR}/c/compiler.cmake") add_library(in3_jni SHARED in3_jni.c) -target_link_libraries(in3_jni ${IN3_VERIFIER} eth_api) +target_link_libraries(in3_jni init) IF (NOT DEFINED ANDROID_ABI) diff --git a/java/src/in3_jni.c b/java/src/in3_jni.c index ebb1b04a2..a16ee3fd3 100644 --- a/java/src/in3_jni.c +++ b/java/src/in3_jni.c @@ -44,11 +44,7 @@ #include "../../c/src/core/util/mem.h" #include "../../c/src/third-party/crypto/ecdsa.h" #include "../../c/src/third-party/crypto/secp256k1.h" -#include "../../c/src/verifier/eth1/full/eth_full.h" -#ifdef IPFS -#include "../../c/src/verifier/ipfs/ipfs.h" - -#endif +#include "../../c/src/verifier/in3_init.h" static in3_t* get_in3(JNIEnv* env, jobject obj) { jlong l = (*env)->GetLongField(env, obj, (*env)->GetFieldID(env, (*env)->GetObjectClass(env, obj), "ptr", "J")); @@ -935,12 +931,6 @@ void in3_set_jclient_config(in3_t* c, jobject jclient) { * Signature: ()J */ JNIEXPORT jlong JNICALL Java_in3_IN3_init(JNIEnv* env, jobject ob, jlong jchain) { - in3_register_eth_full(); - -#ifdef IPFS - in3_register_ipfs(); -#endif - in3_t* in3 = in3_for_chain(jchain); in3_log_set_level(LOG_DEBUG); in3->transport = Java_in3_IN3_transport; diff --git a/wasm/src/CMakeLists.txt b/wasm/src/CMakeLists.txt index b9ad7783a..7b189876a 100644 --- a/wasm/src/CMakeLists.txt +++ b/wasm/src/CMakeLists.txt @@ -60,7 +60,7 @@ if (WASM_SYNC) endif(WASM_SYNC) add_executable(in3w wasm.c) -target_link_libraries(in3w ${IN3_VERIFIER} ${IN3_API}) +target_link_libraries(in3w init) set_target_properties(in3w PROPERTIES LINK_FLAGS "${EMC_PROPS}") add_custom_command(TARGET in3w diff --git a/wasm/src/wasm.c b/wasm/src/wasm.c index 8452c1c5b..a46c433c9 100644 --- a/wasm/src/wasm.c +++ b/wasm/src/wasm.c @@ -31,11 +31,6 @@ * You should have received a copy of the GNU Affero General Public License along * with this program. If not, see . *******************************************************************************/ - -#ifdef ETH_API -#include "../../c/src/api/eth1/abi.h" -#include "../../c/src/api/eth1/eth_api.h" -#endif #include "../../c/src/core/client/client.h" #include "../../c/src/core/client/context.h" #include "../../c/src/core/client/keys.h" @@ -43,21 +38,14 @@ #include "../../c/src/core/util/mem.h" #include "../../c/src/third-party/crypto/ecdsa.h" #include "../../c/src/third-party/crypto/secp256k1.h" +#include "../../c/src/verifier/in3_init.h" #include #include #include -#ifdef ETH_FULL -#include "../../c/src/verifier/eth1/full/eth_full.h" -#endif -#ifdef ETH_BASIC -#include "../../c/src/verifier/eth1/basic/eth_basic.h" -#endif -#ifdef ETH_NANO -#include "../../c/src/verifier/eth1/nano/eth_nano.h" -#endif -#ifdef IPFS -#include "../../c/src/verifier/ipfs/ipfs.h" +#ifdef ETH_API +#include "../../c/src/api/eth1/abi.h" +#include "../../c/src/api/utils/api_utils.h" #endif #define err_string(msg) (":ERROR:" msg) @@ -213,23 +201,6 @@ void EMSCRIPTEN_KEEPALIVE ctx_set_response(in3_ctx_t* ctx, in3_request_t* r, int } in3_t* EMSCRIPTEN_KEEPALIVE in3_create(chain_id_t chain) { -// register a chain-verifier for full Ethereum-Support -#ifdef ETH_FULL - in3_register_eth_full(); -#endif -#ifdef ETH_BASIC - in3_register_eth_basic(); -#endif -#ifdef ETH_NANO - in3_register_eth_nano(); -#endif -#ifdef ETH_API - in3_register_eth_api(); -#endif -#ifdef IPFS - in3_register_ipfs(); -#endif - in3_t* c = in3_for_chain(chain); c->cache = malloc(sizeof(in3_storage_handler_t)); c->cache->get_item = storage_get_item; From 24ba9d0ca27170e1d36d720ebef72812a26738e6 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 13 Mar 2020 21:53:36 +0100 Subject: [PATCH 62/97] Fix build --- CMakeLists.txt | 15 ++++++++++----- c/src/core/CMakeLists.txt | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aeef27e4f..08115f5c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,18 +80,23 @@ if (ERR_MSG) endif() if(ETH_FULL) - ADD_DEFINITIONS(-DETH_FULL) + ADD_DEFINITIONS(-DETH_FULL) + set(IN3_VERIFIER eth_full) elseif(ETH_BASIC) - ADD_DEFINITIONS(-DETH_BASIC) + ADD_DEFINITIONS(-DETH_BASIC) + set(IN3_VERIFIER eth_basic) elseif(ETH_NANO) - ADD_DEFINITIONS(-DETH_NANO) + ADD_DEFINITIONS(-DETH_NANO) + set(IN3_VERIFIER eth_nano) endif() if(IN3API) - ADD_DEFINITIONS(-DETH_API) + ADD_DEFINITIONS(-DETH_API) + set(IN3_API eth_api) endif() if(IPFS) - ADD_DEFINITIONS(-DIPFS) + ADD_DEFINITIONS(-DIPFS) + set(IN3_VERIFIER ${IN3_VERIFIER} ipfs) endif() if(CMAKE_BUILD_TYPE MATCHES Debug) diff --git a/c/src/core/CMakeLists.txt b/c/src/core/CMakeLists.txt index d05b57194..c5d029202 100644 --- a/c/src/core/CMakeLists.txt +++ b/c/src/core/CMakeLists.txt @@ -64,4 +64,4 @@ target_link_libraries(core crypto) add_library(init_o OBJECT ../verifier/in3_init.c) add_library(init STATIC $) -target_link_libraries(init eth_full eth_api ipfs) +target_link_libraries(init ${IN3_VERIFIER} ${IN3_API}) From f9106f2a353f70d08caa66916d1c577b21391645 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 13 Mar 2020 21:58:05 +0100 Subject: [PATCH 63/97] Rebuild headers --- c/include/in3/client.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/c/include/in3/client.h b/c/include/in3/client.h index 6d09b20d1..65961f46c 100644 --- a/c/include/in3/client.h +++ b/c/include/in3/client.h @@ -555,7 +555,9 @@ in3_t* in3_new() __attribute__((deprecated("use in3_for_chain(ETH_CHAIN_ID_MULTI * * @returns the incubed instance. */ -in3_t* in3_for_chain( +#define in3_for_chain(chain_id) in3_for_chain_default(chain_id) + +in3_t* in3_for_chain_default( chain_id_t chain_id /**< the chain_id (see ETH_CHAIN_ID_... constants). */ ); From bd9b59da9f0453877712410052043ea18e17b987 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 13 Mar 2020 23:02:36 +0100 Subject: [PATCH 64/97] Allow boot nodes to be blacklisted --- c/src/core/client/nodelist.c | 6 +++--- c/test/unit_tests/test_nodelist.c | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/c/src/core/client/nodelist.c b/c/src/core/client/nodelist.c index 1c18e6ff9..900dd9d19 100644 --- a/c/src/core/client/nodelist.c +++ b/c/src/core/client/nodelist.c @@ -385,12 +385,12 @@ node_match_t* in3_node_list_fill_weight(in3_t* c, chain_id_t chain_id, in3_node_ } if (!in_filter_nodes) continue; - } else if (nodeDef->boot_node) - goto SKIP_FILTERING; + } + if (weightDef->blacklisted_until > (uint64_t) now) continue; + if (nodeDef->boot_node) goto SKIP_FILTERING; if (chain->whitelist && !nodeDef->whitelisted) continue; if (nodeDef->deposit < c->min_deposit) continue; if (!in3_node_props_match(filter.props, nodeDef->props)) continue; - if (weightDef->blacklisted_until > (uint64_t) now) continue; SKIP_FILTERING: current = _malloc(sizeof(node_match_t)); diff --git a/c/test/unit_tests/test_nodelist.c b/c/test/unit_tests/test_nodelist.c index 8b599443f..c98d5fbca 100644 --- a/c/test/unit_tests/test_nodelist.c +++ b/c/test/unit_tests/test_nodelist.c @@ -541,8 +541,6 @@ static void test_nodelist_update_6() { // reset rand to be deterministic s = 0; in3_rand(&s); - t = 3720; - in3_time(&t); c->proof = PROOF_NONE; From 693de8d0a51678af8433f4349d34dfe6633f50d5 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 13 Mar 2020 23:06:32 +0100 Subject: [PATCH 65/97] Fix mem leak --- c/test/unit_tests/test_cache.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/c/test/unit_tests/test_cache.c b/c/test/unit_tests/test_cache.c index 3cae0d945..389d31499 100644 --- a/c/test/unit_tests/test_cache.c +++ b/c/test/unit_tests/test_cache.c @@ -126,9 +126,6 @@ void static setup_test_cache(in3_t* c) { } static void test_cache() { - - in3_register_eth_nano(); - in3_t* c = in3_for_chain(0x1); c->transport = test_transport; setup_test_cache(c); @@ -172,8 +169,6 @@ static void test_cache() { } static void test_newchain() { - - in3_register_eth_nano(); in3_set_default_transport(test_transport); in3_t* c = in3_for_chain(0); @@ -308,6 +303,7 @@ static void test_whitelist_cache() { int main() { TEST_ASSERT_EQUAL(0, mem_stack_size()); memstack(); + in3_register_eth_nano(); in3_log_set_udata_(NULL); in3_log_set_lock_(NULL); in3_log_set_fp_(NULL); From 3dd75d623b3f5072fdef7f5dd34f77b718182982 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Fri, 13 Mar 2020 23:48:35 +0100 Subject: [PATCH 66/97] Fix more leaks --- c/test/unit_tests/test_ethapi.c | 2 +- c/test/unit_tests/test_filter.c | 8 +------- c/test/unit_tests/test_nodelist.c | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/c/test/unit_tests/test_ethapi.c b/c/test/unit_tests/test_ethapi.c index f17d88bb2..3d0869b5d 100644 --- a/c/test/unit_tests/test_ethapi.c +++ b/c/test/unit_tests/test_ethapi.c @@ -58,7 +58,6 @@ in3_t* init_in3(in3_transport_send custom_transport, chain_id_t chain) { in3_t* in3 = NULL; int err; - in3_register_eth_full(); in3 = in3_for_chain(0); if (custom_transport) in3->transport = custom_transport; // use curl to handle the requests @@ -589,6 +588,7 @@ static void test_send_raw_tx(void) { int main() { in3_log_set_quiet(true); in3_log_set_level(LOG_ERROR); + in3_register_eth_full(); // now run tests TESTS_BEGIN(); diff --git a/c/test/unit_tests/test_filter.c b/c/test/unit_tests/test_filter.c index e2ee5f32f..dec5768ee 100644 --- a/c/test/unit_tests/test_filter.c +++ b/c/test/unit_tests/test_filter.c @@ -59,9 +59,6 @@ } while (0) static void test_filter() { - - in3_register_eth_basic(); - in3_t* c = in3_for_chain(ETH_CHAIN_ID_MAINNET); c->transport = test_transport; c->flags = FLAGS_STATS; @@ -182,8 +179,6 @@ static void test_filter_from_block_manip() { } static void test_filter_creation() { - in3_register_eth_basic(); - in3_t* c = in3_for_chain(ETH_CHAIN_ID_MAINNET); c->transport = test_transport; c->flags = FLAGS_STATS; @@ -209,8 +204,6 @@ static void test_filter_creation() { } static void test_filter_changes() { - in3_register_eth_basic(); - in3_t* c = in3_for_chain(ETH_CHAIN_ID_MAINNET); c->transport = test_transport; c->flags = FLAGS_STATS; @@ -288,6 +281,7 @@ static void test_filter_changes() { int main() { in3_log_set_quiet(true); TESTS_BEGIN(); + in3_register_eth_basic(); RUN_TEST(test_filter); RUN_TEST(test_filter_opt_validation); RUN_TEST(test_filter_from_block_manip); diff --git a/c/test/unit_tests/test_nodelist.c b/c/test/unit_tests/test_nodelist.c index 331a65b69..73bc53138 100644 --- a/c/test/unit_tests/test_nodelist.c +++ b/c/test/unit_tests/test_nodelist.c @@ -222,7 +222,6 @@ static void test_capabilities(void) { } static in3_t* in3_init_test(chain_id_t chain) { - in3_register_eth_full(); in3_t* in3 = in3_for_chain(chain); in3->chain_id = chain; in3->transport = test_transport; @@ -590,6 +589,7 @@ static void test_nodelist_update_7() { int main() { TESTS_BEGIN(); in3_log_set_quiet(true); + in3_register_eth_full(); in3_set_func_time(mock_time); in3_set_func_rand(mock_rand); RUN_TEST(test_capabilities); From aec351f7b908cc0a4d09990211616b02a115aff9 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Sat, 14 Mar 2020 06:05:45 +0000 Subject: [PATCH 67/97] fixed android --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 62a975942..2393849e8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -275,8 +275,6 @@ test_android: - cd in3-example-android/app - cp -r ../../java/src/in3 src/main/java/ - mv ../../c ../../java in3-c/ - - mkdir c - - cp in3-c/c/compiler.cmake c/ - cd .. - ./gradlew build artifacts: From ab05867a4c6a3cc83e9a8ec0bc241ba0999e16f1 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Sat, 14 Mar 2020 07:28:17 +0100 Subject: [PATCH 68/97] format --- c/src/core/client/execute.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/c/src/core/client/execute.c b/c/src/core/client/execute.c index a29ac827f..3ca3b6462 100644 --- a/c/src/core/client/execute.c +++ b/c/src/core/client/execute.c @@ -124,12 +124,11 @@ static in3_ret_t configure_request(in3_ctx_t* ctx, in3_request_config_t* conf, d return IN3_OK; // For nodeList request, we always ask for proof & atleast one signature + conf->use_full_proof = c->proof == PROOF_FULL; + conf->verification = VERIFICATION_PROOF; uint8_t total_sig_cnt = c->signature_count ? c->signature_count : auto_ask_sig(ctx) ? 1 : 0; - conf->use_full_proof = c->proof == PROOF_FULL; - conf->verification = VERIFICATION_PROOF; - if (total_sig_cnt) { node_match_t* signer_nodes = NULL; in3_node_filter_t filter = NODE_FILTER_INIT; From 8aa38ddc50cc6b62e4a9cc287aec311762ddd464 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Sat, 14 Mar 2020 07:30:10 +0100 Subject: [PATCH 69/97] no camelcase --- c/src/core/client/nodelist.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/c/src/core/client/nodelist.c b/c/src/core/client/nodelist.c index 900dd9d19..197a0e498 100644 --- a/c/src/core/client/nodelist.c +++ b/c/src/core/client/nodelist.c @@ -362,8 +362,8 @@ node_match_t* in3_node_list_fill_weight(in3_t* c, chain_id_t chain_id, in3_node_ int found = 0; uint32_t weight_sum = 0; - in3_node_t* nodeDef = NULL; - in3_node_weight_t* weightDef = NULL; + in3_node_t* node_def = NULL; + in3_node_weight_t* weight_def = NULL; node_match_t* prev = NULL; node_match_t* current = NULL; node_match_t* first = NULL; @@ -372,13 +372,13 @@ node_match_t* in3_node_list_fill_weight(in3_t* c, chain_id_t chain_id, in3_node_ if (!chain) return NULL; for (int i = 0; i < len; i++) { - nodeDef = all_nodes + i; - weightDef = weights + i; + node_def = all_nodes + i; + weight_def = weights + i; if (filter.nodes != NULL) { bool in_filter_nodes = false; for (d_iterator_t it = d_iter(filter.nodes); it.left; d_iter_next(&it)) { - if (b_cmp(d_bytesl(it.token, 20), nodeDef->address)) { + if (b_cmp(d_bytesl(it.token, 20), node_def->address)) { in_filter_nodes = true; break; } @@ -386,11 +386,11 @@ node_match_t* in3_node_list_fill_weight(in3_t* c, chain_id_t chain_id, in3_node_ if (!in_filter_nodes) continue; } - if (weightDef->blacklisted_until > (uint64_t) now) continue; - if (nodeDef->boot_node) goto SKIP_FILTERING; - if (chain->whitelist && !nodeDef->whitelisted) continue; - if (nodeDef->deposit < c->min_deposit) continue; - if (!in3_node_props_match(filter.props, nodeDef->props)) continue; + if (weight_def->blacklisted_until > (uint64_t) now) continue; + if (node_def->boot_node) goto SKIP_FILTERING; + if (chain->whitelist && !node_def->whitelisted) continue; + if (node_def->deposit < c->min_deposit) continue; + if (!in3_node_props_match(filter.props, node_def->props)) continue; SKIP_FILTERING: current = _malloc(sizeof(node_match_t)); @@ -399,11 +399,11 @@ node_match_t* in3_node_list_fill_weight(in3_t* c, chain_id_t chain_id, in3_node_ return NULL; } if (!first) first = current; - current->node = nodeDef; - current->weight = weightDef; + current->node = node_def; + current->weight = weight_def; current->next = NULL; current->s = weight_sum; - current->w = in3_node_calculate_weight(weightDef, nodeDef->capacity); + current->w = in3_node_calculate_weight(weight_def, node_def->capacity); weight_sum += current->w; found++; if (prev) prev->next = current; From f1c29514d1c0273bff1b0712795aad6b4c473ede Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Mon, 16 Mar 2020 14:26:46 +0100 Subject: [PATCH 70/97] Fix wasm build --- wasm/src/CMakeLists.txt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/wasm/src/CMakeLists.txt b/wasm/src/CMakeLists.txt index e63e08151..3177ff6c4 100644 --- a/wasm/src/CMakeLists.txt +++ b/wasm/src/CMakeLists.txt @@ -47,26 +47,20 @@ IF (CMAKE_BUILD_TYPE MATCHES Debug) # set(EMC_PROPS "${EMC_PROPS} --source-map-base 'http://localhost/build/bin/' --emit-symbol-map -g -s ASSERTIONS=1 ") ENDIF (CMAKE_BUILD_TYPE MATCHES Debug) -if (WASM_EMBED) +if (WASM_EMBED) set(EMC_PROPS "${EMC_PROPS} -s SUPPORT_BASE64_EMBEDDING=0 -s SINGLE_FILE=1") endif(WASM_EMBED) -if (WASM_EMMALLOC) +if (WASM_EMMALLOC) set(EMC_PROPS "${EMC_PROPS} -s MALLOC=emmalloc") endif(WASM_EMMALLOC) -if (WASM_SYNC) +if (WASM_SYNC) set(EMC_PROPS "${EMC_PROPS} -s WASM_ASYNC_COMPILATION=0") endif(WASM_SYNC) add_executable(in3w wasm.c) -<<<<<<< HEAD target_link_libraries(in3w init) -======= - -target_link_libraries(in3w ${IN3_VERIFIER} ${IN3_API}) - ->>>>>>> develop set_target_properties(in3w PROPERTIES LINK_FLAGS "${EMC_PROPS}") add_custom_command(TARGET in3w From 09d1e6e724dab7b4427338c02e21a2957f1440c6 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Mon, 16 Mar 2020 14:29:31 +0100 Subject: [PATCH 71/97] Rebuild headers --- c/include/in3/colors.h | 180 ++++++++++++++++++++++++++++++++++++++ c/include/in3/context.h | 2 +- c/include/in3/eth_api.h | 2 +- c/include/in3/eth_basic.h | 7 +- c/include/in3/ipfs_api.h | 2 +- c/include/in3/log.h | 2 +- c/include/in3/verifier.h | 4 +- 7 files changed, 192 insertions(+), 7 deletions(-) create mode 100644 c/include/in3/colors.h mode change 100755 => 100644 c/include/in3/log.h diff --git a/c/include/in3/colors.h b/c/include/in3/colors.h new file mode 100644 index 000000000..edbc8a538 --- /dev/null +++ b/c/include/in3/colors.h @@ -0,0 +1,180 @@ +/******************************************************************************* + * This file is part of the Incubed project. + * Sources: https://github.com/slockit/in3-c + * + * Copyright (C) 2018-2020 slock.it GmbH, Blockchains LLC + * + * + * COMMERCIAL LICENSE USAGE + * + * Licensees holding a valid commercial license may use this file in accordance + * with the commercial license agreement provided with the Software or, alternatively, + * in accordance with the terms contained in a written agreement between you and + * slock.it GmbH/Blockchains LLC. For licensing terms and conditions or further + * information please contact slock.it at in3@slock.it. + * + * Alternatively, this file may be used under the AGPL license as follows: + * + * AGPL LICENSE USAGE + * + * This program is free software: you can redistribute it and/or modify it under the + * terms of the GNU Affero General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + * [Permissions of this strong copyleft license are conditioned on making available + * complete source code of licensed works and modifications, which include larger + * works using a licensed work, under the same license. Copyright and license notices + * must be preserved. Contributors provide an express grant of patent rights.] + * You should have received a copy of the GNU Affero General Public License along + * with this program. If not, see . + *******************************************************************************/ + +/*Term colors*/ + +#ifdef LOG_USE_COLOR +#define COLORT_RESET "\033[0m" +#define COLORT_BOLD "\033[1m" +#define COLORT_DIM "\033[2m" +#define COLORT_UNDERLINED "\033[4m" +#define COLORT_BLINK "\033[5m" +#define COLORT_REVERSE "\033[7m" +#define COLORT_HIDDEN "\033[8m" +#define COLORT_RESETBOLD "\033[21m" +#define COLORT_RESETDIM "\033[22m" +#define COLORT_RESETUNDERLINED "\033[24m" +#define COLORT_RESETBLINK "\033[25m" +#define COLORT_RESETREVERSE "\033[27m" +#define COLORT_RESETHIDDEN "\033[28m" +#define COLORT_DEFAULT "\033[39m" +#define COLORT_BLACK "\033[30m" +#define COLORT_BBLACK "\033[1;30m" +#define COLORT_RRED "\033[0;31m" +#define COLORT_RED "\033[31m" +#define COLORT_SELECT "\033[%sm" +#define COLORT_GREEN "\033[32m" +#define COLORT_RGREEN "\033[0;32m" +#define COLORT_YELLOW "\033[33m" +#define COLORT_RYELLOW "\033[0;33m" +#define COLORT_BLUE "\033[34m" +#define COLORT_MAGENTA "\033[35m" +#define COLORT_RMAGENTA "\033[0;35m" +#define COLORT_CYAN "\033[36m" +#define COLORT_LIGHTGRAY "\033[37m" +#define COLORT_DARKGRAY "\033[90m" +#define COLORT_LIGHTRED "\033[91m" +#define COLORT_LIGHTGREEN "\033[92m" +#define COLORT_LIGHTYELLOW "\033[93m" +#define COLORT_LIGHTBLUE "\033[94m" +#define COLORT_LIGHTMAGENTA "\033[95m" +#define COLORT_LIGHTCYAN "\033[96m" +#define COLORT_WHITE "\033[97m" +#else +#define COLORT_RESET " " +#define COLORT_BOLD "" +#define COLORT_DIM "" +#define COLORT_UNDERLINED "" +#define COLORT_BLINK "" +#define COLORT_REVERSE "" +#define COLORT_HIDDEN " " +#define COLORT_RESETBOLD "" +#define COLORT_RESETDIM "" +#define COLORT_RESETUNDERLINED "" +#define COLORT_RESETBLINK "" +#define COLORT_RESETREVERSE "" +#define COLORT_RESETHIDDEN " " +#define COLORT_DEFAULT "" +#define COLORT_BLACK "" +#define COLORT_BBLACK "" +#define COLORT_RRED " " +#define COLORT_RED " " +#define COLORT_SELECT "%s" +#define COLORT_GREEN "" +#define COLORT_RGREEN "" +#define COLORT_YELLOW " " +#define COLORT_RYELLOW "" +#define COLORT_BLUE "" +#define COLORT_MAGENTA "" +#define COLORT_RMAGENTA "" +#define COLORT_CYAN "" +#define COLORT_LIGHTGRAY "" +#define COLORT_DARKGRAY "" +#define COLORT_LIGHTRED "" +#define COLORT_LIGHTGREEN "" +#define COLORT_LIGHTYELLOW "" +#define COLORT_LIGHTBLUE "" +#define COLORT_LIGHTMAGENTA "" +#define COLORT_LIGHTCYAN "" +#define COLORT_WHITE "" +#endif + +/* Control sequences, based on ANSI. +Can be used to control color, and +clear the screen +*/ + +#ifdef LOG_USE_COLOR +#define COLOR_RESET "\x1B[0m" // Reset to default colors +#define COLOR_CLEAR "\x1B[2J" // Clear screen, reposition cursor to top left +#define COLOR_BLACK "\x1B[30m" +#define COLOR_RED "\x1B[31m" +#define COLOR_GREEN "\x1B[32m" +#define COLOR_YELLOW "\x1B[33m" +#define COLOR_BLUE "\x1B[34m" +#define COLOR_MAGENTA "\x1B[35m" +#define COLOR_CYAN "\x1B[36m" +#define COLOR_WHITE "\x1B[37m" +#define COLOR_DEFAULT "\x1B[39m" +#else +#define COLOR_RESET " " // Reset to default colors +#define COLOR_CLEAR " " // Clear screen, reposition cursor to top left +#define COLOR_BLACK " " +#define COLOR_RED " " +#define COLOR_GREEN " " +#define COLOR_YELLOW " " +#define COLOR_BLUE " " +#define COLOR_MAGENTA " " +#define COLOR_CYAN " " +#define COLOR_WHITE " " +#define COLOR_DEFAULT " " +#endif + +#define COLOR_RED_STR COLOR_RED "%s" COLOR_RESET +#define COLOR_GREEN_STR COLOR_GREEN "%s" COLOR_RESET +#define COLOR_GREEN_S2 COLOR_GREEN "%-10s" COLOR_RESET +#define COLOR_GREEN_X1 COLOR_GREEN "%01x" COLOR_RESET +#define COLOR_GREEN_STR_INT COLOR_GREEN "%s%i" COLOR_RESET +#define COLOR_YELLOW_STR COLOR_YELLOW "%s" COLOR_RESET +#define COLOR_YELLOW_STR COLOR_YELLOW "%s" COLOR_RESET +#define COLOR_MAGENTA_STR COLOR_MAGENTA "%s" COLOR_RESET +#define COLOR_YELLOW_PRIu64 COLOR_YELLOW "%5" PRIu64 "" COLOR_RESET +#define COLOR_YELLOW_PRIu64plus COLOR_YELLOW "%5" PRIu64 "" COLOR_RESET +#define COLOR_BRIGHT_BLACK "\x1B[90m" +#define COLOR_BRIGHT_RED "\x1B[91m" +#define COLOR_BRIGHT_GREEN "\x1B[92m" +#define COLOR_BRIGHT_YELLOW "\x1B[93m" +#define COLOR_BRIGHT_BLUE "\x1B[94m" +#define COLOR_BRIGHT_MAGENTA "\x1B[95m" +#define COLOR_BRIGHT_CYAN "\x1B[96m" +#define COLOR_BRIGHT_WHITE "\x1B[97m" + +#define COLOR_BG_DEFAULT "\x1B[24;49m" +#define COLOR_BG_BLACK "\x1B[24;40m" +#define COLOR_BG_RED "\x1B[24;41m" +#define COLOR_BG_GREEN "\x1B[24;42m" +#define COLOR_BG_YELLOW "\x1B[24;43m" +#define COLOR_BG_BLUE "\x1B[24;44m" +#define COLOR_BG_MAGENTA "\x1B[24;45m" +#define COLOR_BG_CYAN "\x1B[24;46m" +#define COLOR_BG_WHITE "\x1B[24;47m" + +#define COLOR_BG_BRIGHT_BLACK "\x1B[4;100m" +#define COLOR_BG_BRIGHT_RED "\x1B[4;101m" +#define COLOR_BG_BRIGHT_GREEN "\x1B[4;102m" +#define COLOR_BG_BRIGHT_YELLOW "\x1B[4;103m" +#define COLOR_BG_BRIGHT_BLUE "\x1B[4;104m" +#define COLOR_BG_BRIGHT_MAGENTA "\x1B[4;105m" +#define COLOR_BG_BRIGHT_CYAN "\x1B[4;106m" +#define COLOR_BG_BRIGHT_WHITE "\x1B[4;107m" diff --git a/c/include/in3/context.h b/c/include/in3/context.h index 67c9086fd..2d7d2435f 100644 --- a/c/include/in3/context.h +++ b/c/include/in3/context.h @@ -38,11 +38,11 @@ * This is used for each request holding request and response-pointers but also controls the execution process. * */ -#include "client.h" #include "data.h" #include "scache.h" #include "stringbuilder.h" #include "utils.h" +#include "client.h" #include #include #ifndef CONTEXT_H diff --git a/c/include/in3/eth_api.h b/c/include/in3/eth_api.h index 32dde1bc8..c5bffffaf 100644 --- a/c/include/in3/eth_api.h +++ b/c/include/in3/eth_api.h @@ -42,8 +42,8 @@ #ifndef ETH_API_H #define ETH_API_H -#include "api_utils.h" #include "client.h" +#include "api_utils.h" #include /** Initializer macros for eth_blknum_t */ diff --git a/c/include/in3/eth_basic.h b/c/include/in3/eth_basic.h index 98b645e64..2d28b1355 100644 --- a/c/include/in3/eth_basic.h +++ b/c/include/in3/eth_basic.h @@ -70,7 +70,12 @@ in3_ret_t eth_verify_account_proof(in3_vctx_t* vc); in3_ret_t eth_verify_eth_getBlock(in3_vctx_t* vc, bytes_t* block_hash, uint64_t blockNumber); /** - * this function should only be called once and will register the eth-basic verifier. + * verifies block transaction count by number or hash + */ +in3_ret_t eth_verify_eth_getBlockTransactionCount(in3_vctx_t* vc, bytes_t* block_hash, uint64_t blockNumber); + +/** + * this function should only be called once and will register the eth-nano verifier. */ void in3_register_eth_basic(); diff --git a/c/include/in3/ipfs_api.h b/c/include/in3/ipfs_api.h index ae3e458dc..3415de9f9 100644 --- a/c/include/in3/ipfs_api.h +++ b/c/include/in3/ipfs_api.h @@ -42,8 +42,8 @@ #ifndef IN3_IPFS_API_H #define IN3_IPFS_API_H -#include "bytes.h" #include "client.h" +#include "bytes.h" char* ipfs_put(in3_t* in3, const bytes_t* content); /**< Returns the IPFS multihash of stored content on success OR NULL on error (check api_last_error()). Result must be freed by caller. */ bytes_t* ipfs_get(in3_t* in3, const char* multihash); /**< Returns the content associated with specified multihash on success OR NULL on error (check api_last_error()). Result must be freed by caller. */ diff --git a/c/include/in3/log.h b/c/include/in3/log.h old mode 100755 new mode 100644 index e60421e3e..29e680e6a --- a/c/include/in3/log.h +++ b/c/include/in3/log.h @@ -9,10 +9,10 @@ #ifndef LOG_H #define LOG_H +#include "colors.h" #include "utils.h" #include #include - #define LOG_VERSION "0.1.0" typedef void (*in3_log_LockFn)(void* udata, int lock); diff --git a/c/include/in3/verifier.h b/c/include/in3/verifier.h index b0535dbc0..9afc78967 100644 --- a/c/include/in3/verifier.h +++ b/c/include/in3/verifier.h @@ -38,11 +38,11 @@ * This context is passed to the verifier. * */ -#include "client.h" -#include "context.h" #include "data.h" #include "stringbuilder.h" #include "utils.h" +#include "client.h" +#include "context.h" #include #include From 82ecb2c510b12907966feed28b51843445a488c8 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Mon, 16 Mar 2020 14:40:46 +0100 Subject: [PATCH 72/97] Fix valgrind --- c/test/unit_tests/test_cache.c | 1 - 1 file changed, 1 deletion(-) diff --git a/c/test/unit_tests/test_cache.c b/c/test/unit_tests/test_cache.c index a04a1fd38..fa7cbd3c7 100644 --- a/c/test/unit_tests/test_cache.c +++ b/c/test/unit_tests/test_cache.c @@ -126,7 +126,6 @@ void static setup_test_cache(in3_t* c) { } static void test_cache() { - in3_register_eth_nano(); in3_t* c = in3_for_chain(ETH_CHAIN_ID_GOERLI); c->transport = test_transport; setup_test_cache(c); From 6183e0dbbf957c76fcefcd04a4e2bc40c16a1cf3 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Mon, 16 Mar 2020 18:23:13 +0100 Subject: [PATCH 73/97] Use init module in examples --- c/examples/build.sh | 2 +- c/examples/call_a_function.c | 10 +-- c/examples/get_balance.c | 15 ++--- c/examples/get_block.c | 13 ++-- c/examples/get_logs.c | 14 ++-- c/examples/get_transaction.c | 15 ++--- c/examples/get_transaction_receipt.c | 15 ++--- c/examples/ipfs_put_get.c | 6 +- c/examples/send_transaction.c | 17 ++--- c/examples/usn_device.c | 16 ++--- c/examples/usn_rent.c | 14 ++-- c/include/in3/eth_basic.h | 92 --------------------------- c/include/in3/eth_full.h | 53 --------------- c/include/in3/eth_nano.h | 91 -------------------------- c/include/in3/{ipfs.h => in3_init.h} | 24 +++---- c/src/verifier/eth1/basic/eth_basic.h | 1 - c/src/verifier/eth1/full/eth_full.h | 1 - c/src/verifier/eth1/nano/eth_nano.h | 2 +- c/src/verifier/in3_init.h | 38 +++++++++++ c/src/verifier/ipfs/ipfs.h | 1 - 20 files changed, 95 insertions(+), 345 deletions(-) delete mode 100644 c/include/in3/eth_basic.h delete mode 100644 c/include/in3/eth_full.h delete mode 100644 c/include/in3/eth_nano.h rename c/include/in3/{ipfs.h => in3_init.h} (78%) diff --git a/c/examples/build.sh b/c/examples/build.sh index 5b53e1a76..e260659ae 100755 --- a/c/examples/build.sh +++ b/c/examples/build.sh @@ -18,6 +18,6 @@ fi # now build the examples build for f in *.c; - do gcc -std=c99 -o "${f%%.*}" $f $BUILDARGS -lin3 -lcurl -D_POSIX_C_SOURCE=199309L + do gcc -std=c99 -o "${f%%.*}" $f $BUILDARGS -lin3 -lcurl -linit -D_POSIX_C_SOURCE=199309L done diff --git a/c/examples/call_a_function.c b/c/examples/call_a_function.c index 0dccf2e09..8ea42e3f2 100644 --- a/c/examples/call_a_function.c +++ b/c/examples/call_a_function.c @@ -1,9 +1,9 @@ /// This example shows how to call functions on a smart contract eiither directly or using the api to encode the arguments -#include // the core client -#include // wrapper for easier use -#include // the full ethereum verifier containing the EVM +#include // the core client +#include #include // transport implementation +#include #include #include #include @@ -14,10 +14,6 @@ static in3_ret_t call_func_api(in3_t* c, address_t contract); int main() { in3_ret_t ret = IN3_OK; - // register a chain-verifier for full Ethereum-Support in order to verify eth_call - // this needs to be called only once. - in3_register_eth_full(); - // use curl as the default for sending out requests // this needs to be called only once. in3_register_curl(); diff --git a/c/examples/get_balance.c b/c/examples/get_balance.c index 294735ced..bcdfb32ff 100644 --- a/c/examples/get_balance.c +++ b/c/examples/get_balance.c @@ -1,21 +1,16 @@ /// get the Balance with the API and also as direct RPC-call -#include // the core client -#include // wrapper for easier use -#include // use the basic module -#include // transport implementation - +#include // the core client +#include +#include // transport implementation +#include +#include #include static void get_balance_rpc(in3_t* in3); static void get_balance_api(in3_t* in3); int main() { - - // register a chain-verifier for basic Ethereum-Support, which is enough to verify accounts - // this needs to be called only once - in3_register_eth_basic(); - // use curl as the default for sending out requests // this needs to be called only once. in3_register_curl(); diff --git a/c/examples/get_block.c b/c/examples/get_block.c index c36050a0c..63e77aa36 100644 --- a/c/examples/get_block.c +++ b/c/examples/get_block.c @@ -1,9 +1,9 @@ /// using the basic-module to get and verify a Block with the API and also as direct RPC-call -#include // the core client -#include // wrapper for easier use -#include // use the basic module -#include // transport implementation +#include // the core client +#include +#include // transport implementation +#include #include #include @@ -12,11 +12,6 @@ static void get_block_rpc(in3_t* in3); static void get_block_api(in3_t* in3); int main() { - - // register a chain-verifier for basic Ethereum-Support, which is enough to verify blocks - // this needs to be called only once - in3_register_eth_basic(); - // use curl as the default for sending out requests // this needs to be called only once. in3_register_curl(); diff --git a/c/examples/get_logs.c b/c/examples/get_logs.c index 9855b96ef..225c28be1 100644 --- a/c/examples/get_logs.c +++ b/c/examples/get_logs.c @@ -1,10 +1,9 @@ /// fetching events and verify them with eth_getLogs -#include // the core client -#include // wrapper for easier use -#include // use the basic module -#include // transport implementation - +#include // the core client +#include +#include // transport implementation +#include #include #include @@ -12,11 +11,6 @@ static void get_logs_rpc(in3_t* in3); static void get_logs_api(in3_t* in3); int main() { - - // register a chain-verifier for basic Ethereum-Support, which is enough to verify logs - // this needs to be called only once - in3_register_eth_basic(); - // use curl as the default for sending out requests // this needs to be called only once. in3_register_curl(); diff --git a/c/examples/get_transaction.c b/c/examples/get_transaction.c index 80040dcd5..721dd443e 100644 --- a/c/examples/get_transaction.c +++ b/c/examples/get_transaction.c @@ -1,21 +1,16 @@ /// checking the transaction data -#include // the core client -#include // wrapper for easier use -#include // use the basic module -#include // transport implementation - +#include // the core client +#include +#include // transport implementation +#include +#include #include static void get_tx_rpc(in3_t* in3); static void get_tx_api(in3_t* in3); int main() { - - // register a chain-verifier for basic Ethereum-Support, which is enough to verify txs - // this needs to be called only once - in3_register_eth_basic(); - // use curl as the default for sending out requests // this needs to be called only once. in3_register_curl(); diff --git a/c/examples/get_transaction_receipt.c b/c/examples/get_transaction_receipt.c index 03ef2abc6..e356e4104 100644 --- a/c/examples/get_transaction_receipt.c +++ b/c/examples/get_transaction_receipt.c @@ -1,10 +1,10 @@ /// validating the result or receipt of an transaction -#include // the core client -#include // wrapper for easier use -#include // use the basic module -#include // transport implementation - +#include // the core client +#include +#include // transport implementation +#include +#include #include #include @@ -12,11 +12,6 @@ static void get_tx_receipt_rpc(in3_t* in3); static void get_tx_receipt_api(in3_t* in3); int main() { - - // register a chain-verifier for basic Ethereum-Support, which is enough to verify tx receipts - // this needs to be called only once - in3_register_eth_basic(); - // use curl as the default for sending out requests // this needs to be called only once. in3_register_curl(); diff --git a/c/examples/ipfs_put_get.c b/c/examples/ipfs_put_get.c index 3f9353ea6..dc8cd786c 100644 --- a/c/examples/ipfs_put_get.c +++ b/c/examples/ipfs_put_get.c @@ -2,8 +2,8 @@ #include // the core client #include // transport implementation -#include // IPFS verifier module -#include // IPFS API module +#include +#include #include #define LOREM_IPSUM "Lorem ipsum dolor sit amet" @@ -62,8 +62,6 @@ static void ipfs_api_example(in3_t* c) { } int main() { - // register a chain-verifier for IPFS-Support (only called once) - in3_register_ipfs(); // use curl as the default for sending out requests (only called once) in3_register_curl(); diff --git a/c/examples/send_transaction.c b/c/examples/send_transaction.c index 3e68fc962..10fd5d407 100644 --- a/c/examples/send_transaction.c +++ b/c/examples/send_transaction.c @@ -1,11 +1,11 @@ /// sending a transaction including signing it with a private key -#include // the core client -#include // wrapper for easier use -#include // use the basic module -#include // transport implementation -#include // default signer implementation - +#include // the core client +#include +#include // transport implementation +#include +#include // default signer implementation +#include #include // fixme: This is only for the sake of demo. Do NOT store private keys as plaintext. @@ -15,11 +15,6 @@ static void send_tx_rpc(in3_t* in3); static void send_tx_api(in3_t* in3); int main() { - - // register a chain-verifier for basic Ethereum-Support, which is enough to verify txs - // this needs to be called only once - in3_register_eth_basic(); - // use curl as the default for sending out requests // this needs to be called only once. in3_register_curl(); diff --git a/c/examples/usn_device.c b/c/examples/usn_device.c index d2a54ebb6..8f2f10c6b 100644 --- a/c/examples/usn_device.c +++ b/c/examples/usn_device.c @@ -1,11 +1,12 @@ /// a example how to watch usn events and act upon it. -#include // the core client -#include // wrapper for easier use -#include // the full ethereum verifier containing the EVM +#include // the core client +#include #include // transport implementation -#include // signer-api -#include // api for renting +#include +#include // signer-api +#include +#include #include #include #include @@ -21,11 +22,6 @@ static int handle_booking(usn_event_t* ev) { } int main(int argc, char* argv[]) { - - // register a chain-verifier for full Ethereum-Support in order to verify eth_call - // this needs to be called only once. - in3_register_eth_full(); - // use curl as the default for sending out requests // this needs to be called only once. in3_register_curl(); diff --git a/c/examples/usn_rent.c b/c/examples/usn_rent.c index 34085ed78..c9bd91617 100644 --- a/c/examples/usn_rent.c +++ b/c/examples/usn_rent.c @@ -1,11 +1,12 @@ /// how to send a rent transaction to a usn contract usinig the usn-api. +#include #include // the core client -#include // wrapper for easier use -#include // the full ethereum verifier containing the EVM #include // transport implementation -#include // signer-api -#include // api for renting +#include +#include // signer-api +#include // api for renting +#include #include #include @@ -35,11 +36,6 @@ void unlock_key(in3_t* c, char* json_data, char* passwd) { } int main(int argc, char* argv[]) { - - // register a chain-verifier for full Ethereum-Support in order to verify eth_call - // this needs to be called only once. - in3_register_eth_full(); - // use curl as the default for sending out requests // this needs to be called only once. in3_register_curl(); diff --git a/c/include/in3/eth_basic.h b/c/include/in3/eth_basic.h deleted file mode 100644 index 2d28b1355..000000000 --- a/c/include/in3/eth_basic.h +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * This file is part of the Incubed project. - * Sources: https://github.com/slockit/in3-c - * - * Copyright (C) 2018-2020 slock.it GmbH, Blockchains LLC - * - * - * COMMERCIAL LICENSE USAGE - * - * Licensees holding a valid commercial license may use this file in accordance - * with the commercial license agreement provided with the Software or, alternatively, - * in accordance with the terms contained in a written agreement between you and - * slock.it GmbH/Blockchains LLC. For licensing terms and conditions or further - * information please contact slock.it at in3@slock.it. - * - * Alternatively, this file may be used under the AGPL license as follows: - * - * AGPL LICENSE USAGE - * - * This program is free software: you can redistribute it and/or modify it under the - * terms of the GNU Affero General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - * [Permissions of this strong copyleft license are conditioned on making available - * complete source code of licensed works and modifications, which include larger - * works using a licensed work, under the same license. Copyright and license notices - * must be preserved. Contributors provide an express grant of patent rights.] - * You should have received a copy of the GNU Affero General Public License along - * with this program. If not, see . - *******************************************************************************/ - -// @PUBLIC_HEADER -/** @file - * Ethereum Nanon verification. - * */ - -#ifndef in3_eth_basic_h__ -#define in3_eth_basic_h__ - -#include "verifier.h" - -/** entry-function to execute the verification context. */ -in3_ret_t in3_verify_eth_basic(in3_vctx_t* v); -/** - * verifies internal tx-values. - */ -in3_ret_t eth_verify_tx_values(in3_vctx_t* vc, d_token_t* tx, bytes_t* raw); - -/** - * verifies a transaction. - */ -in3_ret_t eth_verify_eth_getTransaction(in3_vctx_t* vc, bytes_t* tx_hash); - -/** - * verifies a transaction by block hash/number and id. - */ -in3_ret_t eth_verify_eth_getTransactionByBlock(in3_vctx_t* vc, d_token_t* blk, uint32_t tx_idx); - -/** - * verify account-proofs - */ -in3_ret_t eth_verify_account_proof(in3_vctx_t* vc); - -/** - * verifies a block - */ -in3_ret_t eth_verify_eth_getBlock(in3_vctx_t* vc, bytes_t* block_hash, uint64_t blockNumber); - -/** - * verifies block transaction count by number or hash - */ -in3_ret_t eth_verify_eth_getBlockTransactionCount(in3_vctx_t* vc, bytes_t* block_hash, uint64_t blockNumber); - -/** - * this function should only be called once and will register the eth-nano verifier. - */ -void in3_register_eth_basic(); - -/** - * verify logs - */ -in3_ret_t eth_verify_eth_getLog(in3_vctx_t* vc, int l_logs); - -/** - * this is called before a request is send - */ -in3_ret_t eth_handle_intern(in3_ctx_t* ctx, in3_response_t** response); - -#endif // in3_eth_basic_h__ diff --git a/c/include/in3/eth_full.h b/c/include/in3/eth_full.h deleted file mode 100644 index 787a9bb53..000000000 --- a/c/include/in3/eth_full.h +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * This file is part of the Incubed project. - * Sources: https://github.com/slockit/in3-c - * - * Copyright (C) 2018-2020 slock.it GmbH, Blockchains LLC - * - * - * COMMERCIAL LICENSE USAGE - * - * Licensees holding a valid commercial license may use this file in accordance - * with the commercial license agreement provided with the Software or, alternatively, - * in accordance with the terms contained in a written agreement between you and - * slock.it GmbH/Blockchains LLC. For licensing terms and conditions or further - * information please contact slock.it at in3@slock.it. - * - * Alternatively, this file may be used under the AGPL license as follows: - * - * AGPL LICENSE USAGE - * - * This program is free software: you can redistribute it and/or modify it under the - * terms of the GNU Affero General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - * [Permissions of this strong copyleft license are conditioned on making available - * complete source code of licensed works and modifications, which include larger - * works using a licensed work, under the same license. Copyright and license notices - * must be preserved. Contributors provide an express grant of patent rights.] - * You should have received a copy of the GNU Affero General Public License along - * with this program. If not, see . - *******************************************************************************/ - -// @PUBLIC_HEADER -/** @file - * Ethereum Nanon verification. - * */ - -#ifndef in3_eth_full_h__ -#define in3_eth_full_h__ - -#include "verifier.h" - -/** entry-function to execute the verification context. */ -int in3_verify_eth_full(in3_vctx_t* v); - -/** - * this function should only be called once and will register the eth-full verifier. - */ -void in3_register_eth_full(); - -#endif // in3_eth_full_h__ diff --git a/c/include/in3/eth_nano.h b/c/include/in3/eth_nano.h deleted file mode 100644 index 837b1bee9..000000000 --- a/c/include/in3/eth_nano.h +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * This file is part of the Incubed project. - * Sources: https://github.com/slockit/in3-c - * - * Copyright (C) 2018-2020 slock.it GmbH, Blockchains LLC - * - * - * COMMERCIAL LICENSE USAGE - * - * Licensees holding a valid commercial license may use this file in accordance - * with the commercial license agreement provided with the Software or, alternatively, - * in accordance with the terms contained in a written agreement between you and - * slock.it GmbH/Blockchains LLC. For licensing terms and conditions or further - * information please contact slock.it at in3@slock.it. - * - * Alternatively, this file may be used under the AGPL license as follows: - * - * AGPL LICENSE USAGE - * - * This program is free software: you can redistribute it and/or modify it under the - * terms of the GNU Affero General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - * [Permissions of this strong copyleft license are conditioned on making available - * complete source code of licensed works and modifications, which include larger - * works using a licensed work, under the same license. Copyright and license notices - * must be preserved. Contributors provide an express grant of patent rights.] - * You should have received a copy of the GNU Affero General Public License along - * with this program. If not, see . - *******************************************************************************/ - -// @PUBLIC_HEADER -/** @file - * Ethereum Nanon verification. - * */ - -#ifndef in3_eth_nano_h__ -#define in3_eth_nano_h__ - -#include "verifier.h" - -/** entry-function to execute the verification context. */ -in3_ret_t in3_verify_eth_nano(in3_vctx_t* v); - -/** verifies a blockheader. */ -in3_ret_t eth_verify_blockheader(in3_vctx_t* vc, bytes_t* header, bytes_t* expected_blockhash); - -/** - * verifies a single signature blockheader. - * - * This function will return a positive integer with a bitmask holding the bit set according to the address that signed it. - * This is based on the signatiures in the request-config. - * - */ -int eth_verify_signature(in3_vctx_t* vc, bytes_t* msg_hash, d_token_t* sig); - -/** - * returns the address of the signature if the msg_hash is correct - */ -bytes_t* ecrecover_signature(bytes_t* msg_hash, d_token_t* sig); - -/** - * verifies a transaction receipt. - */ -in3_ret_t eth_verify_eth_getTransactionReceipt(in3_vctx_t* vc, bytes_t* tx_hash); - -/** - * verifies the nodelist. - */ -in3_ret_t eth_verify_in3_nodelist(in3_vctx_t* vc, uint32_t node_limit, bytes_t* seed, d_token_t* required_addresses); - -/** - * verifies the nodelist. - */ -in3_ret_t eth_verify_in3_whitelist(in3_vctx_t* vc); - -/** - * this function should only be called once and will register the eth-nano verifier. - */ -void in3_register_eth_nano(); - -/** - * helper function to rlp-encode the transaction_index. - * - * The result must be freed after use! - */ -bytes_t* create_tx_path(uint32_t index); -#endif // in3_eth_nano_h__ diff --git a/c/include/in3/ipfs.h b/c/include/in3/in3_init.h similarity index 78% rename from c/include/in3/ipfs.h rename to c/include/in3/in3_init.h index 2dd561588..df8f8ea48 100644 --- a/c/include/in3/ipfs.h +++ b/c/include/in3/in3_init.h @@ -34,22 +34,18 @@ // @PUBLIC_HEADER /** @file - * IPFS verification. + * Ethereum Nanon verification. * */ -#ifndef IN3_IPFS_H -#define IN3_IPFS_H +#ifndef IN3_IN3_INIT_H +#define IN3_IN3_INIT_H -#include "verifier.h" +#include "client.h" -/** verifies an IPFS hash. Supported encoding schemes - hex, utf8 and base64 */ -in3_ret_t ipfs_verify_hash(const char* content, const char* encoding, const char* requsted_hash); +#ifdef in3_for_chain +#undef in3_for_chain +#define in3_for_chain(chain_id) in3_for_chain_auto_init(chain_id) +#endif -/** entry-function to execute the verification context. */ -in3_ret_t in3_verify_ipfs(in3_vctx_t* vc); +in3_t* in3_for_chain_auto_init(chain_id_t chain_id); -/** - * this function should only be called once and will register the IPFS verifier. - */ -void in3_register_ipfs(); - -#endif //IN3_IPFS_H +#endif //IN3_IN3_INIT_H diff --git a/c/src/verifier/eth1/basic/eth_basic.h b/c/src/verifier/eth1/basic/eth_basic.h index 2ef299d3b..aa1c85f4d 100644 --- a/c/src/verifier/eth1/basic/eth_basic.h +++ b/c/src/verifier/eth1/basic/eth_basic.h @@ -32,7 +32,6 @@ * with this program. If not, see . *******************************************************************************/ -// @PUBLIC_HEADER /** @file * Ethereum Nanon verification. * */ diff --git a/c/src/verifier/eth1/full/eth_full.h b/c/src/verifier/eth1/full/eth_full.h index f22960368..7afab5ae0 100644 --- a/c/src/verifier/eth1/full/eth_full.h +++ b/c/src/verifier/eth1/full/eth_full.h @@ -32,7 +32,6 @@ * with this program. If not, see . *******************************************************************************/ -// @PUBLIC_HEADER /** @file * Ethereum Nanon verification. * */ diff --git a/c/src/verifier/eth1/nano/eth_nano.h b/c/src/verifier/eth1/nano/eth_nano.h index 6504f3eed..360895361 100644 --- a/c/src/verifier/eth1/nano/eth_nano.h +++ b/c/src/verifier/eth1/nano/eth_nano.h @@ -32,7 +32,6 @@ * with this program. If not, see . *******************************************************************************/ -// @PUBLIC_HEADER /** @file * Ethereum Nanon verification. * */ @@ -88,4 +87,5 @@ void in3_register_eth_nano(); * The result must be freed after use! */ bytes_t* create_tx_path(uint32_t index); + #endif // in3_eth_nano_h__ \ No newline at end of file diff --git a/c/src/verifier/in3_init.h b/c/src/verifier/in3_init.h index 71e16f591..0708c9a5a 100644 --- a/c/src/verifier/in3_init.h +++ b/c/src/verifier/in3_init.h @@ -1,3 +1,41 @@ +/******************************************************************************* + * This file is part of the Incubed project. + * Sources: https://github.com/slockit/in3-c + * + * Copyright (C) 2018-2020 slock.it GmbH, Blockchains LLC + * + * + * COMMERCIAL LICENSE USAGE + * + * Licensees holding a valid commercial license may use this file in accordance + * with the commercial license agreement provided with the Software or, alternatively, + * in accordance with the terms contained in a written agreement between you and + * slock.it GmbH/Blockchains LLC. For licensing terms and conditions or further + * information please contact slock.it at in3@slock.it. + * + * Alternatively, this file may be used under the AGPL license as follows: + * + * AGPL LICENSE USAGE + * + * This program is free software: you can redistribute it and/or modify it under the + * terms of the GNU Affero General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + * [Permissions of this strong copyleft license are conditioned on making available + * complete source code of licensed works and modifications, which include larger + * works using a licensed work, under the same license. Copyright and license notices + * must be preserved. Contributors provide an express grant of patent rights.] + * You should have received a copy of the GNU Affero General Public License along + * with this program. If not, see . + *******************************************************************************/ + +// @PUBLIC_HEADER +/** @file + * Ethereum Nanon verification. + * */ #ifndef IN3_IN3_INIT_H #define IN3_IN3_INIT_H diff --git a/c/src/verifier/ipfs/ipfs.h b/c/src/verifier/ipfs/ipfs.h index b59d1c719..249bacf30 100644 --- a/c/src/verifier/ipfs/ipfs.h +++ b/c/src/verifier/ipfs/ipfs.h @@ -32,7 +32,6 @@ * with this program. If not, see . *******************************************************************************/ -// @PUBLIC_HEADER /** @file * IPFS verification. * */ From 86690246e78d95edbfba6ac435026cbaadb625ae Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Mon, 16 Mar 2020 18:36:15 +0100 Subject: [PATCH 74/97] Hide internal funcs from context.h --- c/include/in3/context.h | 49 --------------- c/src/core/client/context.h | 49 --------------- c/src/core/client/context_internal.h | 89 ++++++++++++++++++++++++++++ c/src/core/client/execute.c | 2 +- c/test/unit_tests/test_request.c | 2 +- wasm/src/wasm.c | 2 +- 6 files changed, 92 insertions(+), 101 deletions(-) create mode 100644 c/src/core/client/context_internal.h diff --git a/c/include/in3/context.h b/c/include/in3/context.h index 2d7d2435f..9fd6bf18c 100644 --- a/c/include/in3/context.h +++ b/c/include/in3/context.h @@ -262,31 +262,6 @@ in3_ctx_state_t in3_ctx_state( in3_ctx_t* ctx /**< [in] the request context. */ ); -/** - * creates a request-object, which then need to be filled with the responses. - * - * each request object contains a array of reponse-objects. In order to set the response, you need to call - * - * ```c - * // set a succesfull response - * sb_add_chars(&request->results[0].result, my_response); - * // set a error response - * sb_add_chars(&request->results[0].error, my_error); - * ``` - */ -in3_request_t* in3_create_request( - in3_ctx_t* ctx /**< [in] the request context. */ -); - -/** - * frees a previuosly allocated request. - */ -void request_free( - in3_request_t* req, /**< [in] the request. */ - const in3_ctx_t* ctx, /**< [in] the request context. */ - bool response_free /**< [in] if true the responses will freed also, but usually this is done when the ctx is freed. */ -); - /** * frees all resources allocated during the request. * @@ -373,21 +348,6 @@ in3_ret_t ctx_check_response_error( in3_ctx_t* c, /**< [in] the current request context. */ int i /**< [in] the index of the request to check (if this is a batch-request, otherwise 0). */ ); -/** - * sets the error message in the context. - * - * If there is a previous error it will append it. - * the return value will simply be passed so you can use it like - * - * ```c - * return ctx_set_error(ctx, "wrong number of arguments", IN3_EINVAL) - * ``` - */ -in3_ret_t ctx_set_error_intern( - in3_ctx_t* c, /**< [in] the current request context. */ - char* msg, /**< [in] the error message. (This string will be copied) */ - in3_ret_t errnumber /**< [in] the error code to return */ -); /** * determins the errorcode for the given request. @@ -418,13 +378,4 @@ in3_ctx_t* in3_client_rpc_ctx( char* params /**< [in] params as string. */ ); -/** - * handles a failable context - * - * This context *MUST* be freed with ctx_free(ctx) after usage to release the resources. -*/ -in3_ret_t ctx_handle_failable( - in3_ctx_t* ctx /**< [in] the current request context. */ -); - #endif diff --git a/c/src/core/client/context.h b/c/src/core/client/context.h index 0d7b5eecb..9037a0a33 100644 --- a/c/src/core/client/context.h +++ b/c/src/core/client/context.h @@ -262,31 +262,6 @@ in3_ctx_state_t in3_ctx_state( in3_ctx_t* ctx /**< [in] the request context. */ ); -/** - * creates a request-object, which then need to be filled with the responses. - * - * each request object contains a array of reponse-objects. In order to set the response, you need to call - * - * ```c - * // set a succesfull response - * sb_add_chars(&request->results[0].result, my_response); - * // set a error response - * sb_add_chars(&request->results[0].error, my_error); - * ``` - */ -in3_request_t* in3_create_request( - in3_ctx_t* ctx /**< [in] the request context. */ -); - -/** - * frees a previuosly allocated request. - */ -void request_free( - in3_request_t* req, /**< [in] the request. */ - const in3_ctx_t* ctx, /**< [in] the request context. */ - bool response_free /**< [in] if true the responses will freed also, but usually this is done when the ctx is freed. */ -); - /** * frees all resources allocated during the request. * @@ -373,21 +348,6 @@ in3_ret_t ctx_check_response_error( in3_ctx_t* c, /**< [in] the current request context. */ int i /**< [in] the index of the request to check (if this is a batch-request, otherwise 0). */ ); -/** - * sets the error message in the context. - * - * If there is a previous error it will append it. - * the return value will simply be passed so you can use it like - * - * ```c - * return ctx_set_error(ctx, "wrong number of arguments", IN3_EINVAL) - * ``` - */ -in3_ret_t ctx_set_error_intern( - in3_ctx_t* c, /**< [in] the current request context. */ - char* msg, /**< [in] the error message. (This string will be copied) */ - in3_ret_t errnumber /**< [in] the error code to return */ -); /** * determins the errorcode for the given request. @@ -418,13 +378,4 @@ in3_ctx_t* in3_client_rpc_ctx( char* params /**< [in] params as string. */ ); -/** - * handles a failable context - * - * This context *MUST* be freed with ctx_free(ctx) after usage to release the resources. -*/ -in3_ret_t ctx_handle_failable( - in3_ctx_t* ctx /**< [in] the current request context. */ -); - #endif diff --git a/c/src/core/client/context_internal.h b/c/src/core/client/context_internal.h new file mode 100644 index 000000000..34a6f0e41 --- /dev/null +++ b/c/src/core/client/context_internal.h @@ -0,0 +1,89 @@ +/******************************************************************************* + * This file is part of the Incubed project. + * Sources: https://github.com/slockit/in3-c + * + * Copyright (C) 2018-2019 slock.it GmbH, Blockchains LLC + * + * + * COMMERCIAL LICENSE USAGE + * + * Licensees holding a valid commercial license may use this file in accordance + * with the commercial license agreement provided with the Software or, alternatively, + * in accordance with the terms contained in a written agreement between you and + * slock.it GmbH/Blockchains LLC. For licensing terms and conditions or further + * information please contact slock.it at in3@slock.it. + * + * Alternatively, this file may be used under the AGPL license as follows: + * + * AGPL LICENSE USAGE + * + * This program is free software: you can redistribute it and/or modify it under the + * terms of the GNU Affero General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + * [Permissions of this strong copyleft license are conditioned on making available + * complete source code of licensed works and modifications, which include larger + * works using a licensed work, under the same license. Copyright and license notices + * must be preserved. Contributors provide an express grant of patent rights.] + * You should have received a copy of the GNU Affero General Public License along + * with this program. If not, see . + *******************************************************************************/ +#ifndef CONTEXT_INTERNAL_H +#define CONTEXT_INTERNAL_H + +#include "context.h" + +/** + * creates a request-object, which then need to be filled with the responses. + * + * each request object contains a array of reponse-objects. In order to set the response, you need to call + * + * ```c + * // set a succesfull response + * sb_add_chars(&request->results[0].result, my_response); + * // set a error response + * sb_add_chars(&request->results[0].error, my_error); + * ``` + */ +in3_request_t* in3_create_request( + in3_ctx_t* ctx /**< [in] the request context. */ +); + +/** + * frees a previuosly allocated request. + */ +void request_free( + in3_request_t* req, /**< [in] the request. */ + const in3_ctx_t* ctx, /**< [in] the request context. */ + bool response_free /**< [in] if true the responses will freed also, but usually this is done when the ctx is freed. */ +); + +/** + * sets the error message in the context. + * + * If there is a previous error it will append it. + * the return value will simply be passed so you can use it like + * + * ```c + * return ctx_set_error(ctx, "wrong number of arguments", IN3_EINVAL) + * ``` + */ +in3_ret_t ctx_set_error_intern( + in3_ctx_t* c, /**< [in] the current request context. */ + char* msg, /**< [in] the error message. (This string will be copied) */ + in3_ret_t errnumber /**< [in] the error code to return */ +); + +/** + * handles a failable context + * + * This context *MUST* be freed with ctx_free(ctx) after usage to release the resources. +*/ +in3_ret_t ctx_handle_failable( + in3_ctx_t* ctx /**< [in] the current request context. */ +); + +#endif // CONTEXT_INTERNAL_H \ No newline at end of file diff --git a/c/src/core/client/execute.c b/c/src/core/client/execute.c index 3ca3b6462..315cc0ce8 100644 --- a/c/src/core/client/execute.c +++ b/c/src/core/client/execute.c @@ -42,7 +42,7 @@ #include "../util/utils.h" #include "cache.h" #include "client.h" -#include "context.h" +#include "context_internal.h" #include "keys.h" #include "nodelist.h" #include "verifier.h" diff --git a/c/test/unit_tests/test_request.c b/c/test/unit_tests/test_request.c index 18ea7e748..d5e016ad9 100644 --- a/c/test/unit_tests/test_request.c +++ b/c/test/unit_tests/test_request.c @@ -41,7 +41,7 @@ #include "../../src/api/eth1/eth_api.h" #include "../../src/core/client/cache.h" -#include "../../src/core/client/context.h" +#include "../../src/core/client/context_internal.h" #include "../../src/core/client/keys.h" #include "../../src/core/client/nodelist.h" #include "../../src/core/util/data.h" diff --git a/wasm/src/wasm.c b/wasm/src/wasm.c index aac43ae0d..3c8c210a7 100644 --- a/wasm/src/wasm.c +++ b/wasm/src/wasm.c @@ -32,7 +32,7 @@ * with this program. If not, see . *******************************************************************************/ #include "../../c/src/core/client/client.h" -#include "../../c/src/core/client/context.h" +#include "../../c/src/core/client/context_internal.h" #include "../../c/src/core/client/keys.h" #include "../../c/src/core/client/version.h" #include "../../c/src/core/util/mem.h" From 74c746359a9a988040db673a6c602e29c8384b3b Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Mon, 16 Mar 2020 18:55:20 +0100 Subject: [PATCH 75/97] Fix build --- c/src/api/eth1/ens.c | 2 +- c/src/api/eth1/rpc_api.c | 2 +- c/src/core/client/context.c | 1 + c/src/core/client/context.h | 6 ------ c/src/core/client/context_internal.h | 6 ++++++ c/src/core/client/nodelist.c | 2 +- c/src/core/client/verifier.c | 1 + c/src/verifier/eth1/basic/eth_basic.c | 2 +- c/src/verifier/eth1/basic/filter.c | 2 +- c/src/verifier/eth1/basic/signer-priv.h | 2 +- c/src/verifier/eth1/full/eth_full.c | 2 +- c/test/unit_tests/test_rpc_api.c | 2 +- 12 files changed, 16 insertions(+), 14 deletions(-) diff --git a/c/src/api/eth1/ens.c b/c/src/api/eth1/ens.c index dd7c0d07c..1fc7b019d 100644 --- a/c/src/api/eth1/ens.c +++ b/c/src/api/eth1/ens.c @@ -1,6 +1,6 @@ #include "ens.h" #include "../../core/client/client.h" -#include "../../core/client/context.h" +#include "../../core/client/context_internal.h" #include "../../core/client/keys.h" #include "../../core/util/bytes.h" #include "../../core/util/data.h" diff --git a/c/src/api/eth1/rpc_api.c b/c/src/api/eth1/rpc_api.c index ec139224d..d9d7571a7 100644 --- a/c/src/api/eth1/rpc_api.c +++ b/c/src/api/eth1/rpc_api.c @@ -32,7 +32,7 @@ * with this program. If not, see . *******************************************************************************/ -#include "../../core/client/context.h" +#include "../../core/client/context_internal.h" #include "../../core/client/keys.h" #include "../../core/client/verifier.h" #include "../../core/util/log.h" diff --git a/c/src/core/client/context.c b/c/src/core/client/context.c index 40934a9d2..c0c7ebf3a 100644 --- a/c/src/core/client/context.c +++ b/c/src/core/client/context.c @@ -38,6 +38,7 @@ #include "../util/mem.h" #include "../util/stringbuilder.h" #include "client.h" +#include "context_internal.h" #include "keys.h" #include #include diff --git a/c/src/core/client/context.h b/c/src/core/client/context.h index 9037a0a33..37b059ac3 100644 --- a/c/src/core/client/context.h +++ b/c/src/core/client/context.h @@ -48,12 +48,6 @@ #ifndef CONTEXT_H #define CONTEXT_H -#ifdef ERR_MSG -#define ctx_set_error(c, msg, err) ctx_set_error_intern(c, msg, err) -#else -#define ctx_set_error(c, msg, err) ctx_set_error_intern(c, NULL, err) -#endif - /** * type of the request context, */ diff --git a/c/src/core/client/context_internal.h b/c/src/core/client/context_internal.h index 34a6f0e41..651a0325b 100644 --- a/c/src/core/client/context_internal.h +++ b/c/src/core/client/context_internal.h @@ -36,6 +36,12 @@ #include "context.h" +#ifdef ERR_MSG +#define ctx_set_error(c, msg, err) ctx_set_error_intern(c, msg, err) +#else +#define ctx_set_error(c, msg, err) ctx_set_error_intern(c, NULL, err) +#endif + /** * creates a request-object, which then need to be filled with the responses. * diff --git a/c/src/core/client/nodelist.c b/c/src/core/client/nodelist.c index 12c68d0bc..01f831d69 100644 --- a/c/src/core/client/nodelist.c +++ b/c/src/core/client/nodelist.c @@ -41,7 +41,7 @@ #include "../util/utils.h" #include "cache.h" #include "client.h" -#include "context.h" +#include "context_internal.h" #include "keys.h" #include #include diff --git a/c/src/core/client/verifier.c b/c/src/core/client/verifier.c index 4284fa55d..a8c4230c3 100644 --- a/c/src/core/client/verifier.c +++ b/c/src/core/client/verifier.c @@ -34,6 +34,7 @@ #include "verifier.h" #include "client.h" +#include "context_internal.h" #include "keys.h" static in3_verifier_t* verifiers = NULL; diff --git a/c/src/verifier/eth1/basic/eth_basic.c b/c/src/verifier/eth1/basic/eth_basic.c index 96cad72aa..ef16b499f 100644 --- a/c/src/verifier/eth1/basic/eth_basic.c +++ b/c/src/verifier/eth1/basic/eth_basic.c @@ -33,7 +33,7 @@ *******************************************************************************/ #include "eth_basic.h" -#include "../../../core/client/context.h" +#include "../../../core/client/context_internal.h" #include "../../../core/client/keys.h" #include "../../../core/util/data.h" #include "../../../core/util/mem.h" diff --git a/c/src/verifier/eth1/basic/filter.c b/c/src/verifier/eth1/basic/filter.c index ba8eb594d..afb7164eb 100644 --- a/c/src/verifier/eth1/basic/filter.c +++ b/c/src/verifier/eth1/basic/filter.c @@ -33,7 +33,7 @@ *******************************************************************************/ #include "filter.h" -#include "../../../core/client/context.h" +#include "../../../core/client/context_internal.h" #include "../../../core/client/keys.h" #include "../../../core/util/log.h" #include "../../../core/util/mem.h" diff --git a/c/src/verifier/eth1/basic/signer-priv.h b/c/src/verifier/eth1/basic/signer-priv.h index a4d7185b0..5a453efb3 100644 --- a/c/src/verifier/eth1/basic/signer-priv.h +++ b/c/src/verifier/eth1/basic/signer-priv.h @@ -35,7 +35,7 @@ #ifndef in3_signer_priv_h__ #define in3_signer_priv_h__ -#include "../../../core/client/context.h" +#include "../../../core/client/context_internal.h" in3_ret_t eth_sign(void* pk, d_signature_type_t type, bytes_t message, bytes_t account, uint8_t* dst); diff --git a/c/src/verifier/eth1/full/eth_full.c b/c/src/verifier/eth1/full/eth_full.c index b542c389f..a8b7902b2 100644 --- a/c/src/verifier/eth1/full/eth_full.c +++ b/c/src/verifier/eth1/full/eth_full.c @@ -33,7 +33,7 @@ *******************************************************************************/ #include "eth_full.h" -#include "../../../core/client/context.h" +#include "../../../core/client/context_internal.h" #include "../../../core/client/keys.h" #include "../../../core/util/data.h" #include "../../../core/util/log.h" diff --git a/c/test/unit_tests/test_rpc_api.c b/c/test/unit_tests/test_rpc_api.c index 576316a22..87bbdc3be 100644 --- a/c/test/unit_tests/test_rpc_api.c +++ b/c/test/unit_tests/test_rpc_api.c @@ -41,7 +41,7 @@ #include "../../src/api/eth1/abi.h" #include "../../src/api/eth1/eth_api.h" -#include "../../src/core/client/context.h" +#include "../../src/core/client/context_internal.h" #include "../../src/core/client/keys.h" #include "../../src/core/util/bitset.h" #include "../../src/core/util/data.h" From 324c57adb68467d5f05ad8b955ffa35fa4da968f Mon Sep 17 00:00:00 2001 From: leonardocardoso Date: Mon, 16 Mar 2020 10:15:01 +0100 Subject: [PATCH 76/97] Add ipfs to wasm implementation --- wasm/src/build_js.sh | 3 +- wasm/src/in3.d.ts | 22 ++++++++++++- wasm/src/in3.js | 1 + wasm/src/in3_ipfs_api.js | 28 ++++++++++++++++ wasm/src/in3_util.js | 53 ++++++++++++++++++++++++++++++- wasm/src/wasm.c | 15 ++++++++- wasm/test/package.json | 3 +- wasm/test/responses/ipfs_get.json | 15 +++++++++ wasm/test/responses/ipfs_put.json | 15 +++++++++ wasm/test/testIpfs.js | 20 ++++++++++++ wasm/test/util/mocker.js | 5 +++ 11 files changed, 175 insertions(+), 5 deletions(-) create mode 100644 wasm/src/in3_ipfs_api.js create mode 100644 wasm/test/responses/ipfs_get.json create mode 100644 wasm/test/responses/ipfs_put.json create mode 100644 wasm/test/testIpfs.js diff --git a/wasm/src/build_js.sh b/wasm/src/build_js.sh index a0fba75cc..91796e3a8 100755 --- a/wasm/src/build_js.sh +++ b/wasm/src/build_js.sh @@ -11,6 +11,7 @@ cat in3w.js | sed "s/uncaughtException/ue/g" >> $TARGET_JS cat "$1/in3.js" >> $TARGET_JS cat "$1/in3_util.js" >> $TARGET_JS cat "$1/in3_eth_api.js" >> $TARGET_JS +cat "$1/in3_ipfs_api.js" >> $TARGET_JS # we return the default export echo " return IN3; })();" >> $TARGET_JS @@ -23,7 +24,7 @@ if [ -e in3w.wasm ] then cp in3w.wasm ../module/ fi if [ $2 == "true" ] - then + then cat "$1/package.json" | sed 's/wasm/asmjs/g' > ../module/package.json cat "$1/../README.md" | sed 's/wasm/asmjs/g' > ../module/README.md fi diff --git a/wasm/src/in3.d.ts b/wasm/src/in3.d.ts index 3c3c85ec6..92252dc92 100644 --- a/wasm/src/in3.d.ts +++ b/wasm/src/in3.d.ts @@ -465,6 +465,12 @@ export default class IN3Generic { */ public eth: EthAPI + + /** + * ipfs API. + */ + public ipfs: IpfsAPI + /** * collection of util-functions. */ @@ -1098,4 +1104,18 @@ export declare interface Utils { */ private2address(pk: Hex | BufferType): Address -} \ No newline at end of file +} + +export declare interface IpfsAPI { + /** + * retrieves the content for a hash from IPFS. + * @param multihash the IPFS-hash to fetch + * + */ + get(multihash: string): Promise + /** + * stores the data on ipfs and returns the IPFS-Hash. + * @param content puts a IPFS content + */ + put(content: BufferType): Promise +} \ No newline at end of file diff --git a/wasm/src/in3.js b/wasm/src/in3.js index 43d658d30..eb2b92fc5 100644 --- a/wasm/src/in3.js +++ b/wasm/src/in3.js @@ -161,6 +161,7 @@ class IN3 { this.needsSetConfig = !!config this.ptr = 0; this.eth = new EthAPI(this) + this.ipfs = new IpfsAPI(this) } /** diff --git a/wasm/src/in3_ipfs_api.js b/wasm/src/in3_ipfs_api.js new file mode 100644 index 000000000..d2aaa31c8 --- /dev/null +++ b/wasm/src/in3_ipfs_api.js @@ -0,0 +1,28 @@ +class IpfsAPI { + constructor(client) { + this.client = client + this.encoding = 'base64' + } + + /** + * retrieves the content for a hash from IPFS. + * @param multihash the IPFS-hash to fetch + * + */ + get(multihash) { + return this.client.sendRPC('ipfs_get', [multihash, this.encoding]) + .then(response => response ? response : Promise.reject(new Error(response.error || 'Hash not found'))) + .then(result => this.client.util.base64Decode(result)) + .then(result => this.client.util.toBuffer(result)) + } + + /** + * stores the data on ipfs and returns the IPFS-Hash. + * @param content puts a IPFS content + */ + put(data) { + let encoded = this.client.util.base64Encode(this.client.util.toBuffer(data)) + return this.client.sendRPC('ipfs_put', [encoded, this.encoding]) + .then(response => response ? response : Promise.reject(new Error(response.error || 'Hash not found'))) + } +} \ No newline at end of file diff --git a/wasm/src/in3_util.js b/wasm/src/in3_util.js index 23cb764c1..64b63433a 100644 --- a/wasm/src/in3_util.js +++ b/wasm/src/in3_util.js @@ -53,8 +53,45 @@ function promisify(self, fn, ...args) { }) } +// Credit to: https://stackoverflow.com/questions/8936984/uint8array-to-string-in-javascript +function Utf8ArrayToStr(array) { + var out, i, len, c; + var char2, char3; + + out = ""; + len = array.length; + i = 0; + while(i < len) { + c = array[i++]; + switch(c >> 4) { + case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: + // 0xxxxxxx + out += String.fromCharCode(c); + break; + case 12: case 13: + // 110x xxxx 10xx xxxx + char2 = array[i++]; + out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); + break; + case 14: + // 1110 xxxx 10xx xxxx 10xx xxxx + char2 = array[i++]; + char3 = array[i++]; + out += String.fromCharCode(((c & 0x0F) << 12) | + ((char2 & 0x3F) << 6) | + ((char3 & 0x3F) << 0)); + break; + } + } + + return out; +} + function toUtf8(val) { if (!val) return val + if (val.constructor == Uint8Array) { + return Utf8ArrayToStr(val) + } if (typeof val === 'string' && val.startsWith('0x')) { const hex = fixLength(val).substr(2) let str = '' @@ -108,7 +145,7 @@ function abiEncode(sig, ...params) { } function ecSign(pk, data, hashMessage = true, adjustV = true) { - data = toUint8Array(data) + data = toUint8Array(data) pk = toUint8Array(pk) return call_buffer('ec_sign', 65, pk, hashMessage ? 1 : 0, data, data.byteLength, adjustV ? 1 : 0) } @@ -294,6 +331,18 @@ function toSimpleHex(val) { hex = hex.substr(2); return '0x' + hex; } +/** + * decodes to base64 + */ +function base64Decode(val) { + return in3w.ccall("base64Decode", 'string', ['string'], [val]); +} +/** + * encodes to base64 + */ +function base64Encode(val) { + return in3w.ccall("base64Encode", 'string', ['array', 'number'], [val, val.length]); +} /** * returns a address from a private key */ @@ -388,6 +437,8 @@ const util = { soliditySha3, createSignatureHash, toUint8Array, + base64Decode, + base64Encode } // add as static proporty and as standard property. diff --git a/wasm/src/wasm.c b/wasm/src/wasm.c index 26e08c84f..6fe1197f3 100644 --- a/wasm/src/wasm.c +++ b/wasm/src/wasm.c @@ -43,6 +43,8 @@ #include "../../c/src/core/util/mem.h" #include "../../c/src/third-party/crypto/ecdsa.h" #include "../../c/src/third-party/crypto/secp256k1.h" +#include "../../c/src/third-party/libb64/cdecode.h" +#include "../../c/src/third-party/libb64/cencode.h" #include #include #include @@ -88,7 +90,7 @@ EM_JS(char*, in3_cache_get, (char* key), { var val = Module.in3_cache.get(UTF8ToString(key)); if (val) { var len = (val.length << 2) + 1; - var ret = stackAlloc(len); + var ret = stackAlloc(len); stringToUTF8(val, ret, len); return ret; } @@ -212,6 +214,17 @@ void EMSCRIPTEN_KEEPALIVE ctx_set_response(in3_ctx_t* ctx, in3_request_t* r, int sb_add_chars(&r->results[i].result, msg); } +uint8_t* EMSCRIPTEN_KEEPALIVE base64Decode(char* input) { + size_t len = 0; + uint8_t* b64 = base64_decode(input, &len); + return b64; +} + +char* EMSCRIPTEN_KEEPALIVE base64Encode(uint8_t* input, int len) { + char* b64 = base64_encode(input, len); + return b64; +} + in3_t* EMSCRIPTEN_KEEPALIVE in3_create(chain_id_t chain) { // register a chain-verifier for full Ethereum-Support #ifdef ETH_FULL diff --git a/wasm/test/package.json b/wasm/test/package.json index adb1b0dee..5bb4a6fa0 100644 --- a/wasm/test/package.json +++ b/wasm/test/package.json @@ -5,9 +5,10 @@ "main": "js/src/index.js", "scripts": { "build": "tsc -p .", - "test": "mocha --timeout 15000 --full-trace testRunner.js testApi.js testUtil.js", + "test": "mocha --timeout 15000 --full-trace testRunner.js testApi.js testUtil.js testApi.js testIpfs.js", "test_report": "mocha --timeout 15000 --reporter mocha-junit-reporter --reporter-options mochaFile=mocha.xml --full-trace testRunner.js testApi.js testUtil.js", "test_api": "mocha --inspect-brk --timeout 15000 --full-trace testApi.js", + "test_ipfs": "mocha --inspect-brk --timeout 15000 --full-trace testIpfs.js", "test_fail": "mocha --timeout 15000 --full-trace testApi.js testRunner.js ", "test_all": "mocha --timeout 15000 --full-trace *.js", "test_runner": "mocha --inspect-brk --timeout 15000 --full-trace testRunner.js" diff --git a/wasm/test/responses/ipfs_get.json b/wasm/test/responses/ipfs_get.json new file mode 100644 index 000000000..c3810da03 --- /dev/null +++ b/wasm/test/responses/ipfs_get.json @@ -0,0 +1,15 @@ +{ + "content": { + "id": 1, + "result": "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQ=", + "jsonrpc": "2.0", + "in3": { + "lastValidatorChange": 0, + "lastNodeList": 8525528, + "execTime": 14, + "rpcTime": 0, + "rpcCount": 0, + "currentBlock": 17091918 + } + } +} diff --git a/wasm/test/responses/ipfs_put.json b/wasm/test/responses/ipfs_put.json new file mode 100644 index 000000000..b136a912e --- /dev/null +++ b/wasm/test/responses/ipfs_put.json @@ -0,0 +1,15 @@ +{ + "multihash": { + "id": 1, + "result": "QmbGySCLuGxu2GxVLYWeqJW9XeyjGFvpoZAhGhXDGEUQu8", + "jsonrpc": "2.0", + "in3": { + "lastValidatorChange": 0, + "lastNodeList": 8525528, + "execTime": 23, + "rpcTime": 0, + "rpcCount": 0, + "currentBlock": 17091918 + } + } +} \ No newline at end of file diff --git a/wasm/test/testIpfs.js b/wasm/test/testIpfs.js new file mode 100644 index 000000000..8dbcccda3 --- /dev/null +++ b/wasm/test/testIpfs.js @@ -0,0 +1,20 @@ +require('mocha') +const { assert } = require('chai') +const { createClient, mockResponse, IN3, beforeTest } = require('./util/mocker') + +describe('API-Tests', () => { + beforeEach(beforeTest) + afterEach(IN3.freeAll) + + it('ipfs_put', async () => { + mockResponse('ipfs_put', 'multihash') + const multihash = await createClient({ chainId: '0x7d0', proof: 'none' }).ipfs.put("Lorem ipsum dolor sit amet") + assert.equal(multihash, 'QmbGySCLuGxu2GxVLYWeqJW9XeyjGFvpoZAhGhXDGEUQu8') + }) + + it('ipfs_get', async () => { + mockResponse('ipfs_get', 'content') + const content = await createClient({ chainId: '0x7d0' }).ipfs.get('QmbGySCLuGxu2GxVLYWeqJW9XeyjGFvpoZAhGhXDGEUQu8') + assert.equal(IN3.util.toUtf8(content), 'Lorem ipsum dolor sit amet') + }) +}) \ No newline at end of file diff --git a/wasm/test/util/mocker.js b/wasm/test/util/mocker.js index 25bb96eab..47cfebad0 100644 --- a/wasm/test/util/mocker.js +++ b/wasm/test/util/mocker.js @@ -53,6 +53,11 @@ function createClient(config = {}) { needsUpdate: false, contract: '0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f', registryId: '0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb' + }, + '0x7d0': { + needsUpdate: false, + contract: '0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f', + registryId: '0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb' } }, ...config From 462bb5f6f26cdb0f9806b6c3492c6d394a276ba1 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Mon, 16 Mar 2020 20:42:42 +0100 Subject: [PATCH 77/97] add doc --- wasm/src/in3.d.ts | 4 +++- wasm/src/in3_ipfs_api.js | 48 ++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/wasm/src/in3.d.ts b/wasm/src/in3.d.ts index 92252dc92..7b606e144 100644 --- a/wasm/src/in3.d.ts +++ b/wasm/src/in3.d.ts @@ -1105,7 +1105,9 @@ export declare interface Utils { private2address(pk: Hex | BufferType): Address } - +/** + * API for storing and retrieving IPFS-data. + */ export declare interface IpfsAPI { /** * retrieves the content for a hash from IPFS. diff --git a/wasm/src/in3_ipfs_api.js b/wasm/src/in3_ipfs_api.js index d2aaa31c8..f9f807285 100644 --- a/wasm/src/in3_ipfs_api.js +++ b/wasm/src/in3_ipfs_api.js @@ -1,28 +1,28 @@ class IpfsAPI { - constructor(client) { - this.client = client - this.encoding = 'base64' - } + constructor(client) { + this.client = client + this.encoding = 'base64' + } - /** - * retrieves the content for a hash from IPFS. - * @param multihash the IPFS-hash to fetch - * - */ - get(multihash) { - return this.client.sendRPC('ipfs_get', [multihash, this.encoding]) - .then(response => response ? response : Promise.reject(new Error(response.error || 'Hash not found'))) - .then(result => this.client.util.base64Decode(result)) - .then(result => this.client.util.toBuffer(result)) - } + /** + * retrieves the content for a hash from IPFS. + * @param multihash the IPFS-hash to fetch + * + */ + get(multihash) { + return this.client.sendRPC('ipfs_get', [multihash, this.encoding]) + .then(response => response || Promise.reject(new Error(response.error || 'Hash not found'))) + .then(result => this.client.util.base64Decode(result)) + .then(result => this.client.util.toBuffer(result)) + } - /** - * stores the data on ipfs and returns the IPFS-Hash. - * @param content puts a IPFS content - */ - put(data) { - let encoded = this.client.util.base64Encode(this.client.util.toBuffer(data)) - return this.client.sendRPC('ipfs_put', [encoded, this.encoding]) - .then(response => response ? response : Promise.reject(new Error(response.error || 'Hash not found'))) - } + /** + * stores the data on ipfs and returns the IPFS-Hash. + * @param content puts a IPFS content + */ + put(data) { + let encoded = this.client.util.base64Encode(this.client.util.toBuffer(data)) + return this.client.sendRPC('ipfs_put', [encoded, this.encoding]) + .then(response => response || Promise.reject(new Error(response.error || 'Hash not found'))) + } } \ No newline at end of file From b32e4125a4525d16743774f4ea8ecb93d88d9f94 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Mon, 16 Mar 2020 20:52:04 +0100 Subject: [PATCH 78/97] fix memory leak --- wasm/src/in3_util.js | 77 ++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/wasm/src/in3_util.js b/wasm/src/in3_util.js index 64b63433a..c76546923 100644 --- a/wasm/src/in3_util.js +++ b/wasm/src/in3_util.js @@ -6,21 +6,21 @@ let convertBuffer = toUint8Array // Overriding default convert function setConvertBigInt(convertBigFn) { - convertBigInt = convertBigFn + convertBigInt = convertBigFn } function setConvertBuffer(convertBufFn) { - convertBuffer = convertBufFn + convertBuffer = convertBufFn } -if (typeof(_free) == 'undefined') _free = function(ptr) { - in3w.ccall("ifree", 'void', ['number'], [ptr]) - } - /** - * internal function calling a wasm-function, which returns a string. - * @param {*} name - * @param {...any} params_values - */ +if (typeof (_free) == 'undefined') _free = function (ptr) { + in3w.ccall("ifree", 'void', ['number'], [ptr]) +} +/** + * internal function calling a wasm-function, which returns a string. + * @param {*} name + * @param {...any} params_values + */ function call_string(name, ...params_values) { const res = in3w.ccall(name, 'number', params_values.map(_ => _ && _.__proto__ === Uint8Array.prototype ? 'array' : typeof _), params_values) if (!res) return null @@ -61,26 +61,26 @@ function Utf8ArrayToStr(array) { out = ""; len = array.length; i = 0; - while(i < len) { - c = array[i++]; - switch(c >> 4) { - case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: - // 0xxxxxxx - out += String.fromCharCode(c); - break; - case 12: case 13: - // 110x xxxx 10xx xxxx - char2 = array[i++]; - out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); - break; - case 14: - // 1110 xxxx 10xx xxxx 10xx xxxx - char2 = array[i++]; - char3 = array[i++]; - out += String.fromCharCode(((c & 0x0F) << 12) | - ((char2 & 0x3F) << 6) | - ((char3 & 0x3F) << 0)); - break; + while (i < len) { + c = array[i++]; + switch (c >> 4) { + case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: + // 0xxxxxxx + out += String.fromCharCode(c); + break; + case 12: case 13: + // 110x xxxx 10xx xxxx + char2 = array[i++]; + out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); + break; + case 14: + // 1110 xxxx 10xx xxxx 10xx xxxx + char2 = array[i++]; + char3 = array[i++]; + out += String.fromCharCode(((c & 0x0F) << 12) | + ((char2 & 0x3F) << 6) | + ((char3 & 0x3F) << 0)); + break; } } @@ -272,14 +272,14 @@ function toNumber(val) { try { return val.toNumber() } - catch (ex) { - return toNumber(val.toHexString()) - } + catch (ex) { + return toNumber(val.toHexString()) + } throw new Error('can not convert a ' + (typeof val) + ' to number'); } } -function toBuffer (val, len = -1) { +function toBuffer(val, len = -1) { return convertBuffer(val, len) } /** @@ -309,10 +309,10 @@ function toUint8Array(val, len = -1) { val = val.toArrayLike(Uint8Array) if (!val) val = new Uint8Array(0) - // since rlp encodes an empty array for a 0 -value we create one if the required len===0 + // since rlp encodes an empty array for a 0 -value we create one if the required len===0 if (len == 0 && val.byteLength == 1 && val[0] === 0) return new Uint8Array(0) - // if we have a defined length, we should padLeft 00 or cut the left content to ensure length + // if we have a defined length, we should padLeft 00 or cut the left content to ensure length if (len > 0 && val.byteLength && val.byteLength !== len) { if (val.byteLength > len) return val.slice(val.byteLength - len) let b = new Uint8Array(len) @@ -341,7 +341,8 @@ function base64Decode(val) { * encodes to base64 */ function base64Encode(val) { - return in3w.ccall("base64Encode", 'string', ['array', 'number'], [val, val.length]); + return call_string('base64Encode', val, val.length) + // return in3w.ccall("base64Encode", 'string', ['array', 'number'], [val, val.length]); } /** * returns a address from a private key @@ -468,7 +469,7 @@ class SimpleSigner { if (!pk || pk.length != 32) throw new Error('Account not found for signing ' + account) return ecSign(pk, data, type, ethV) - } + } } From 4a164ba435365c4c21435d04b329d1972a9d68a3 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Mon, 16 Mar 2020 21:28:51 +0100 Subject: [PATCH 79/97] fixed length of buffer --- wasm/src/in3_util.js | 12 ++++++++++-- wasm/src/wasm.c | 6 +++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/wasm/src/in3_util.js b/wasm/src/in3_util.js index c76546923..0aed89843 100644 --- a/wasm/src/in3_util.js +++ b/wasm/src/in3_util.js @@ -335,14 +335,22 @@ function toSimpleHex(val) { * decodes to base64 */ function base64Decode(val) { - return in3w.ccall("base64Decode", 'string', ['string'], [val]); + // calculate the length + if ((typeof val) !== 'string') throw new Error('Must be a string as input') + let lip = val.len + let len = lip / 4 * 3 + if (lip > 1 && ip[lip - 2] == '=' && ip[lip - 1] == '=') + len -= 2 + else if (ip[lip - 1] == '=') + len -= 1 + + return call_buffer('base64Decode', len, val) } /** * encodes to base64 */ function base64Encode(val) { return call_string('base64Encode', val, val.length) - // return in3w.ccall("base64Encode", 'string', ['array', 'number'], [val, val.length]); } /** * returns a address from a private key diff --git a/wasm/src/wasm.c b/wasm/src/wasm.c index 6fe1197f3..18377cb53 100644 --- a/wasm/src/wasm.c +++ b/wasm/src/wasm.c @@ -215,13 +215,13 @@ void EMSCRIPTEN_KEEPALIVE ctx_set_response(in3_ctx_t* ctx, in3_request_t* r, int } uint8_t* EMSCRIPTEN_KEEPALIVE base64Decode(char* input) { - size_t len = 0; - uint8_t* b64 = base64_decode(input, &len); + size_t len = 0; + uint8_t* b64 = base64_decode(input, &len); return b64; } char* EMSCRIPTEN_KEEPALIVE base64Encode(uint8_t* input, int len) { - char* b64 = base64_encode(input, len); + char* b64 = base64_encode(input, len); return b64; } From 2e7f58d8892c43fce936aba74d2b61f8f7b07e08 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Mon, 16 Mar 2020 21:32:52 +0100 Subject: [PATCH 80/97] fix name --- wasm/src/in3_util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wasm/src/in3_util.js b/wasm/src/in3_util.js index 0aed89843..6a74a3291 100644 --- a/wasm/src/in3_util.js +++ b/wasm/src/in3_util.js @@ -339,9 +339,9 @@ function base64Decode(val) { if ((typeof val) !== 'string') throw new Error('Must be a string as input') let lip = val.len let len = lip / 4 * 3 - if (lip > 1 && ip[lip - 2] == '=' && ip[lip - 1] == '=') + if (lip > 1 && val[lip - 2] == '=' && val[lip - 1] == '=') len -= 2 - else if (ip[lip - 1] == '=') + else if (val[lip - 1] == '=') len -= 1 return call_buffer('base64Decode', len, val) From 1af19c15959a7be245fa7f8aaadaa6785709d15d Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Mon, 16 Mar 2020 21:45:21 +0100 Subject: [PATCH 81/97] fix typo --- wasm/src/in3_util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasm/src/in3_util.js b/wasm/src/in3_util.js index 6a74a3291..c0d1dda7e 100644 --- a/wasm/src/in3_util.js +++ b/wasm/src/in3_util.js @@ -337,7 +337,7 @@ function toSimpleHex(val) { function base64Decode(val) { // calculate the length if ((typeof val) !== 'string') throw new Error('Must be a string as input') - let lip = val.len + let lip = val.length let len = lip / 4 * 3 if (lip > 1 && val[lip - 2] == '=' && val[lip - 1] == '=') len -= 2 From bbe1d3779a3a8c4cec1c64807437d8f23b02ef13 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 17 Mar 2020 10:20:18 +0100 Subject: [PATCH 82/97] Add init module to IN3_LIBS --- c/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index d50382dbe..925f923b2 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -52,6 +52,7 @@ add_subdirectory(docs) if (IN3_LIB) set(IN3_LIBS $ + $ $ $ $ From 1c71cdb87911ca358abc502c7f4190662f47e0e8 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 17 Mar 2020 10:20:50 +0100 Subject: [PATCH 83/97] Don't link examples to init explicitly --- c/examples/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/examples/build.sh b/c/examples/build.sh index e260659ae..5b53e1a76 100755 --- a/c/examples/build.sh +++ b/c/examples/build.sh @@ -18,6 +18,6 @@ fi # now build the examples build for f in *.c; - do gcc -std=c99 -o "${f%%.*}" $f $BUILDARGS -lin3 -lcurl -linit -D_POSIX_C_SOURCE=199309L + do gcc -std=c99 -o "${f%%.*}" $f $BUILDARGS -lin3 -lcurl -D_POSIX_C_SOURCE=199309L done From 33bf9452784db6164639631e7782fe45df39be01 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 17 Mar 2020 10:21:00 +0100 Subject: [PATCH 84/97] Fix comment --- c/src/verifier/in3_init.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/src/verifier/in3_init.h b/c/src/verifier/in3_init.h index 0708c9a5a..8b5fcee67 100644 --- a/c/src/verifier/in3_init.h +++ b/c/src/verifier/in3_init.h @@ -34,7 +34,7 @@ // @PUBLIC_HEADER /** @file - * Ethereum Nanon verification. + * IN3 init module for auto initializing verifiers and transport based on build config. * */ #ifndef IN3_IN3_INIT_H #define IN3_IN3_INIT_H From dcfd0df4b15d22d9c41160b9bdb0cbb28c48c780 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 17 Mar 2020 11:30:53 +0100 Subject: [PATCH 85/97] Add curl init to init module --- c/examples/call_a_function.c | 4 ---- c/examples/get_balance.c | 4 ---- c/examples/get_block.c | 4 ---- c/examples/get_logs.c | 4 ---- c/examples/get_transaction.c | 4 ---- c/examples/get_transaction_receipt.c | 4 ---- c/examples/ipfs_put_get.c | 3 --- c/examples/send_transaction.c | 4 ---- c/examples/usn_device.c | 4 ---- c/examples/usn_rent.c | 4 ---- c/src/verifier/in3_init.c | 7 +++++++ 11 files changed, 7 insertions(+), 39 deletions(-) diff --git a/c/examples/call_a_function.c b/c/examples/call_a_function.c index 8ea42e3f2..0be959dae 100644 --- a/c/examples/call_a_function.c +++ b/c/examples/call_a_function.c @@ -14,10 +14,6 @@ static in3_ret_t call_func_api(in3_t* c, address_t contract); int main() { in3_ret_t ret = IN3_OK; - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // Remove log prefix for readability in3_log_set_prefix(""); diff --git a/c/examples/get_balance.c b/c/examples/get_balance.c index bcdfb32ff..8b4325e6a 100644 --- a/c/examples/get_balance.c +++ b/c/examples/get_balance.c @@ -11,10 +11,6 @@ static void get_balance_rpc(in3_t* in3); static void get_balance_api(in3_t* in3); int main() { - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* in3 = in3_for_chain(ETH_CHAIN_ID_MAINNET); diff --git a/c/examples/get_block.c b/c/examples/get_block.c index 63e77aa36..d6d2012b2 100644 --- a/c/examples/get_block.c +++ b/c/examples/get_block.c @@ -12,10 +12,6 @@ static void get_block_rpc(in3_t* in3); static void get_block_api(in3_t* in3); int main() { - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* in3 = in3_for_chain(ETH_CHAIN_ID_MAINNET); diff --git a/c/examples/get_logs.c b/c/examples/get_logs.c index 225c28be1..231bc9958 100644 --- a/c/examples/get_logs.c +++ b/c/examples/get_logs.c @@ -11,10 +11,6 @@ static void get_logs_rpc(in3_t* in3); static void get_logs_api(in3_t* in3); int main() { - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* in3 = in3_for_chain(ETH_CHAIN_ID_MAINNET); in3->chain_id = ETH_CHAIN_ID_KOVAN; diff --git a/c/examples/get_transaction.c b/c/examples/get_transaction.c index 721dd443e..de8929dbb 100644 --- a/c/examples/get_transaction.c +++ b/c/examples/get_transaction.c @@ -11,10 +11,6 @@ static void get_tx_rpc(in3_t* in3); static void get_tx_api(in3_t* in3); int main() { - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* in3 = in3_for_chain(ETH_CHAIN_ID_MAINNET); diff --git a/c/examples/get_transaction_receipt.c b/c/examples/get_transaction_receipt.c index e356e4104..3381c1562 100644 --- a/c/examples/get_transaction_receipt.c +++ b/c/examples/get_transaction_receipt.c @@ -12,10 +12,6 @@ static void get_tx_receipt_rpc(in3_t* in3); static void get_tx_receipt_api(in3_t* in3); int main() { - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* in3 = in3_for_chain(ETH_CHAIN_ID_MAINNET); diff --git a/c/examples/ipfs_put_get.c b/c/examples/ipfs_put_get.c index dc8cd786c..100d0be79 100644 --- a/c/examples/ipfs_put_get.c +++ b/c/examples/ipfs_put_get.c @@ -62,9 +62,6 @@ static void ipfs_api_example(in3_t* c) { } int main() { - // use curl as the default for sending out requests (only called once) - in3_register_curl(); - // create new incubed client in3_t* c = in3_for_chain(ETH_CHAIN_ID_IPFS); diff --git a/c/examples/send_transaction.c b/c/examples/send_transaction.c index 10fd5d407..6c593c298 100644 --- a/c/examples/send_transaction.c +++ b/c/examples/send_transaction.c @@ -15,10 +15,6 @@ static void send_tx_rpc(in3_t* in3); static void send_tx_api(in3_t* in3); int main() { - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* in3 = in3_for_chain(ETH_CHAIN_ID_MAINNET); diff --git a/c/examples/usn_device.c b/c/examples/usn_device.c index 8f2f10c6b..887e5240f 100644 --- a/c/examples/usn_device.c +++ b/c/examples/usn_device.c @@ -22,10 +22,6 @@ static int handle_booking(usn_event_t* ev) { } int main(int argc, char* argv[]) { - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* c = in3_for_chain(ETH_CHAIN_ID_MAINNET); diff --git a/c/examples/usn_rent.c b/c/examples/usn_rent.c index c9bd91617..834943d81 100644 --- a/c/examples/usn_rent.c +++ b/c/examples/usn_rent.c @@ -36,10 +36,6 @@ void unlock_key(in3_t* c, char* json_data, char* passwd) { } int main(int argc, char* argv[]) { - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* c = in3_for_chain(ETH_CHAIN_ID_GOERLI); diff --git a/c/src/verifier/in3_init.c b/c/src/verifier/in3_init.c index 405dd54e7..f1541f2f3 100644 --- a/c/src/verifier/in3_init.c +++ b/c/src/verifier/in3_init.c @@ -30,10 +30,17 @@ static void init_verifier() { #endif } +static void init_transport() { +#ifdef USE_CURL + in3_register_curl(); +#endif +} + in3_t* in3_for_chain_auto_init(chain_id_t chain_id) { if (!initialized) { initialized = true; init_verifier(); + init_transport(); } return in3_for_chain_default(chain_id); } From eb558b6c6b327bd0de7ffa0a3069259286473263 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 17 Mar 2020 13:43:25 +0100 Subject: [PATCH 86/97] Link init with transport_curl --- CMakeLists.txt | 10 ++++++++-- c/CMakeLists.txt | 10 +--------- c/examples/build.sh | 2 +- c/src/cmd/in3/CMakeLists.txt | 2 -- c/src/core/CMakeLists.txt | 2 +- c/src/transport/CMakeLists.txt | 1 - 6 files changed, 11 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b2daab81..51d2e235a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,14 +65,20 @@ option(WASM_EMMALLOC "use ther smaller EMSCRIPTEN Malloc, which reduces the size option(WASM_SYNC "intiaializes the WASM synchronisly, which allows to require and use it the same function, but this will not be supported by chrome (4k limit)" OFF) option(CODE_COVERAGE "Builds targets with code coverage instrumentation. (Requires GCC or Clang)" OFF) OPTION(USE_SCRYPT "if scrypt is installed, it will link dynamicly to the shared scrypt lib." ON) +OPTION(USE_CURL "if true the curl transport will be built (with a dependency to libcurl)" ON) + if (USE_PRECOMPUTED_EC) ADD_DEFINITIONS(-DUSE_PRECOMPUTED_CP=1) else() ADD_DEFINITIONS(-DUSE_PRECOMPUTED_CP=0) endif() -if (CURL_BLOCKING) - ADD_DEFINITIONS(-DCURL_BLOCKING) +if (USE_CURL) + ADD_DEFINITIONS(-DUSE_CURL) + set(IN3_TRANSPORT ${IN3_TRANSPORT} transport_curl) + if (CURL_BLOCKING) + ADD_DEFINITIONS(-DCURL_BLOCKING) + endif() endif() diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index 925f923b2..25c15ea6c 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -66,10 +66,6 @@ if (IN3_LIB) $ $ ) - # if we use curl, we include curl transport as well - if (USE_CURL) - set(IN3_LIBS ${IN3_LIBS} $) - endif() if (USE_SCRYPT) set(IN3_LIBS ${IN3_LIBS} $) @@ -80,11 +76,7 @@ if (IN3_LIB) add_library(in3_lib SHARED ${IN3_LIBS} ) set_target_properties(in3_bundle PROPERTIES OUTPUT_NAME "in3") set_target_properties(in3_lib PROPERTIES OUTPUT_NAME "in3") - - # for curl we need to add the dependency - if (USE_CURL) - target_link_libraries(in3_lib transport_curl) - endif() + target_link_libraries(in3_lib ${IN3_TRANSPORT}) # install INSTALL(TARGETS in3_bundle diff --git a/c/examples/build.sh b/c/examples/build.sh index 5b53e1a76..4ceed5e05 100755 --- a/c/examples/build.sh +++ b/c/examples/build.sh @@ -18,6 +18,6 @@ fi # now build the examples build for f in *.c; - do gcc -std=c99 -o "${f%%.*}" $f $BUILDARGS -lin3 -lcurl -D_POSIX_C_SOURCE=199309L + do gcc -std=c99 -o "${f%%.*}" $f $BUILDARGS -lin3 -D_POSIX_C_SOURCE=199309L done diff --git a/c/src/cmd/in3/CMakeLists.txt b/c/src/cmd/in3/CMakeLists.txt index 3cc8968ce..c96840f30 100644 --- a/c/src/cmd/in3/CMakeLists.txt +++ b/c/src/cmd/in3/CMakeLists.txt @@ -33,10 +33,8 @@ ############################################################################### include("${PROJECT_SOURCE_DIR}/c/compiler.cmake") -OPTION(USE_CURL "if true the curl transport will be build (with a dependency to libcurl)" ON) IF (USE_CURL) message("using curl for comandline") - ADD_DEFINITIONS(-DUSE_CURL) set(LIBS ${LIBS} transport_curl) else() message("using http for comandline") diff --git a/c/src/core/CMakeLists.txt b/c/src/core/CMakeLists.txt index 0113b6b55..a11622442 100644 --- a/c/src/core/CMakeLists.txt +++ b/c/src/core/CMakeLists.txt @@ -64,4 +64,4 @@ target_link_libraries(core crypto) add_library(init_o OBJECT ../verifier/in3_init.c) add_library(init STATIC $) -target_link_libraries(init ${IN3_VERIFIER} ${IN3_API}) +target_link_libraries(init ${IN3_VERIFIER} ${IN3_API} ${IN3_TRANSPORT}) diff --git a/c/src/transport/CMakeLists.txt b/c/src/transport/CMakeLists.txt index 64d415b74..74e84cbb3 100644 --- a/c/src/transport/CMakeLists.txt +++ b/c/src/transport/CMakeLists.txt @@ -32,7 +32,6 @@ # with this program. If not, see . ############################################################################### -OPTION(USE_CURL "if true " ON) OPTION(TRANSPORTS "builds transports, which may require extra libraries." ON) IF (TRANSPORTS) IF (USE_CURL) From 56022e6df20f5364fdd1ba740b1b4db788ef9a89 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 17 Mar 2020 14:49:02 +0100 Subject: [PATCH 87/97] Use _calloc in verifier register funcs --- c/src/api/eth1/rpc_api.c | 2 +- c/src/verifier/btc/btc.c | 2 +- c/src/verifier/eth1/basic/eth_basic.c | 2 +- c/src/verifier/eth1/full/eth_full.c | 2 +- c/src/verifier/eth1/nano/eth_nano.c | 2 +- c/src/verifier/ipfs/ipfs.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/c/src/api/eth1/rpc_api.c b/c/src/api/eth1/rpc_api.c index d9d7571a7..cb4127083 100644 --- a/c/src/api/eth1/rpc_api.c +++ b/c/src/api/eth1/rpc_api.c @@ -382,7 +382,7 @@ void in3_register_eth_api() { v->verify = (in3_verify) verify; v->pre_handle = eth_handle_intern; } else { - in3_verifier_t* v = calloc(1, sizeof(in3_verifier_t)); + in3_verifier_t* v = _calloc(1, sizeof(in3_verifier_t)); v->type = CHAIN_ETH; v->pre_handle = eth_handle_intern; v->verify = (in3_verify) verify; diff --git a/c/src/verifier/btc/btc.c b/c/src/verifier/btc/btc.c index f804b5c6b..e610ab51a 100644 --- a/c/src/verifier/btc/btc.c +++ b/c/src/verifier/btc/btc.c @@ -138,7 +138,7 @@ in3_ret_t in3_verify_btc(in3_vctx_t* vc) { } void in3_register_btc() { - in3_verifier_t* v = calloc(1, sizeof(in3_verifier_t)); + in3_verifier_t* v = _calloc(1, sizeof(in3_verifier_t)); v->type = CHAIN_BTC; v->pre_handle = btc_handle_intern; v->verify = in3_verify_btc; diff --git a/c/src/verifier/eth1/basic/eth_basic.c b/c/src/verifier/eth1/basic/eth_basic.c index ef16b499f..0fa2148f5 100644 --- a/c/src/verifier/eth1/basic/eth_basic.c +++ b/c/src/verifier/eth1/basic/eth_basic.c @@ -224,7 +224,7 @@ in3_ret_t eth_handle_intern(in3_ctx_t* ctx, in3_response_t** response) { } void in3_register_eth_basic() { - in3_verifier_t* v = calloc(1, sizeof(in3_verifier_t)); + in3_verifier_t* v = _calloc(1, sizeof(in3_verifier_t)); v->type = CHAIN_ETH; v->pre_handle = eth_handle_intern; v->verify = in3_verify_eth_basic; diff --git a/c/src/verifier/eth1/full/eth_full.c b/c/src/verifier/eth1/full/eth_full.c index a8b7902b2..8bf432b2f 100644 --- a/c/src/verifier/eth1/full/eth_full.c +++ b/c/src/verifier/eth1/full/eth_full.c @@ -118,7 +118,7 @@ int in3_verify_eth_full(in3_vctx_t* vc) { } void in3_register_eth_full() { - in3_verifier_t* v = calloc(1, sizeof(in3_verifier_t)); + in3_verifier_t* v = _calloc(1, sizeof(in3_verifier_t)); v->type = CHAIN_ETH; v->pre_handle = eth_handle_intern; v->verify = (in3_verify) in3_verify_eth_full; diff --git a/c/src/verifier/eth1/nano/eth_nano.c b/c/src/verifier/eth1/nano/eth_nano.c index 601f18e0e..7213ed4d0 100644 --- a/c/src/verifier/eth1/nano/eth_nano.c +++ b/c/src/verifier/eth1/nano/eth_nano.c @@ -80,7 +80,7 @@ in3_ret_t in3_verify_eth_nano(in3_vctx_t* vc) { } void in3_register_eth_nano() { - in3_verifier_t* v = calloc(1, sizeof(in3_verifier_t)); + in3_verifier_t* v = _calloc(1, sizeof(in3_verifier_t)); v->type = CHAIN_ETH; v->verify = in3_verify_eth_nano; in3_register_verifier(v); diff --git a/c/src/verifier/ipfs/ipfs.c b/c/src/verifier/ipfs/ipfs.c index 9a39f1957..e8568f6f4 100644 --- a/c/src/verifier/ipfs/ipfs.c +++ b/c/src/verifier/ipfs/ipfs.c @@ -167,7 +167,7 @@ in3_ret_t in3_verify_ipfs(in3_vctx_t* vc) { } void in3_register_ipfs() { - in3_verifier_t* v = calloc(1, sizeof(in3_verifier_t)); + in3_verifier_t* v = _calloc(1, sizeof(in3_verifier_t)); v->type = CHAIN_IPFS; v->verify = in3_verify_ipfs; in3_register_verifier(v); From f67d15c7faaa62c9374e2f14fc2824cbf3aedfe5 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 17 Mar 2020 14:49:44 +0100 Subject: [PATCH 88/97] Don't link runner to init mod --- c/test/CMakeLists.txt | 2 +- c/test/runner.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/c/test/CMakeLists.txt b/c/test/CMakeLists.txt index 218fb6031..5d3367656 100644 --- a/c/test/CMakeLists.txt +++ b/c/test/CMakeLists.txt @@ -54,7 +54,7 @@ endif() # first we build the runners add_executable(runner runner.c) -target_link_libraries(runner eth_full eth_api ipfs init) +target_link_libraries(runner eth_full eth_api ipfs) add_executable(junit util/junit.c) target_link_libraries(junit eth_full) diff --git a/c/test/runner.c b/c/test/runner.c index 4436a4e5f..0bb357e17 100644 --- a/c/test/runner.c +++ b/c/test/runner.c @@ -42,7 +42,6 @@ #include "../src/core/util/mem.h" #include "../src/verifier/eth1/full/eth_full.h" #include "../src/verifier/ipfs/ipfs.h" -#include "verifier/in3_init.h" #include #include #include @@ -450,6 +449,10 @@ int runRequests(char** names, int test_index, int mem_track) { int main(int argc, char* argv[]) { use_color = 1; in3_log_set_level(LOG_INFO); + in3_register_eth_full(); + in3_register_eth_api(); + in3_register_ipfs(); + int i = 0, size = 1; int testIndex = -1, membrk = -1; char** names = malloc(sizeof(char*)); From e2c5f78975d60e6c7980461840f7ce5a2cc48638 Mon Sep 17 00:00:00 2001 From: Shoaib Ahmed Date: Tue, 17 Mar 2020 14:50:21 +0100 Subject: [PATCH 89/97] Rebuild headers --- c/include/in3/context.h | 6 ------ c/include/in3/in3_init.h | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/c/include/in3/context.h b/c/include/in3/context.h index 9fd6bf18c..8745630ba 100644 --- a/c/include/in3/context.h +++ b/c/include/in3/context.h @@ -48,12 +48,6 @@ #ifndef CONTEXT_H #define CONTEXT_H -#ifdef ERR_MSG -#define ctx_set_error(c, msg, err) ctx_set_error_intern(c, msg, err) -#else -#define ctx_set_error(c, msg, err) ctx_set_error_intern(c, NULL, err) -#endif - /** * type of the request context, */ diff --git a/c/include/in3/in3_init.h b/c/include/in3/in3_init.h index df8f8ea48..88110e5d6 100644 --- a/c/include/in3/in3_init.h +++ b/c/include/in3/in3_init.h @@ -34,7 +34,7 @@ // @PUBLIC_HEADER /** @file - * Ethereum Nanon verification. + * IN3 init module for auto initializing verifiers and transport based on build config. * */ #ifndef IN3_IN3_INIT_H #define IN3_IN3_INIT_H From 51799d81ef39c083903b741f06bb075c57701967 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 17 Mar 2020 20:25:17 +0100 Subject: [PATCH 90/97] fix CI --- .gitlab-ci.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2393849e8..07a4f4eee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -57,9 +57,18 @@ arm7: tags: - arm variables: - CONAN_OPTS: "-DJAVA=true" + CONAN_OPTS: "-DJAVA=false" BUILD: "arm7_build" +arm_jni: + image: docker.slock.it/build-images/cmake:gcc8-armv7 + extends: .conanbuild + tags: + - arm + variables: + CONAN_OPTS: "-DJAVA=true -DUSE_CURL=false" + BUILD: "arm_jni_build" + gcc8-x86: image: docker.slock.it/build-images/cmake:gcc8-x86 extends: .conanbuild @@ -78,7 +87,7 @@ clang50: clang10: image: docker.slock.it/build-images/cmake:clang10 extends: .conanbuild - + mac_os: stage: build script: @@ -151,7 +160,7 @@ java: - mac_os - win_mingw - gcc8 - - arm7 + - arm_jni script: - mkdir java_build - cd java_build @@ -159,7 +168,7 @@ java: - cp ../mac_build/lib/libin3_jni.dylib ../java/src/in3/native/ - cp ../win_build/lib/libin3_jni.so ../java/src/in3/native/in3_jni.dll - cp ../x64_build/lib/libin3_jni.so ../java/src/in3/native/ - - cp ../arm7_build/lib/libin3_jni.so ../java/src/in3/native/libin3_jni_arm.so + - cp ../arm_jni_build/lib/libin3_jni.so ../java/src/in3/native/libin3_jni_arm.so - cmake -DIN3_LIB=false -DJAVA_MULTI_LIBS=true -DCMAKE_BUILD_TYPE=Release -DJAVA=true -DBUILD_DOC=true .. - make in3j artifacts: @@ -264,7 +273,6 @@ test_c: # - cd ../vmTests # - ../../../../testbuild/test/vmrunner */*.json || echo "\n ignoring failure .." - test_android: image: cangol/android-gradle stage: test @@ -281,7 +289,6 @@ test_android: paths: - in3-example-android/app/build/outputs/apk - test_wasm: image: docker.slock.it/build-images/node:10-alpine dependencies: From cd3cbf7aba1be5b8d10f2fde453ab6dea4d0da4c Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 17 Mar 2020 22:26:12 +0100 Subject: [PATCH 91/97] add jni-versions --- .gitlab-ci.yml | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 07a4f4eee..2c2d3a5f3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,11 +34,17 @@ gcc8: - short-jobs script: - mkdir x64_build + - mkdir x64_jni - cd x64_build + - cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=Release -DJAVA=true -DUSE_CURL=false .. + - make in3_jni + - cp lib/libin3_jni.so ../x64_jni/ + - rm -rf * - cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=Release -DJAVA=true -DBUILD_DOC=true .. - make artifacts: paths: + - x64_jni - x64_build/bin - x64_build/lib - x64_build/c/docs/doc_doxygen @@ -48,9 +54,16 @@ win_mingw: image: docker.slock.it/build-images/cmake:gcc7-mingw extends: .conanbuild variables: - CONAN_OPTS: "-DLIBCURL_LINKTYPE=static -DJAVA=true" + CONAN_OPTS: "-DLIBCURL_LINKTYPE=static -DJAVA=false" BUILD: "win_build" +win_jni: + image: docker.slock.it/build-images/cmake:gcc7-mingw + extends: .conanbuild + variables: + CONAN_OPTS: "-DUSE_CURL=false -DJAVA=true" + BUILD: "win_jni" + arm7: image: docker.slock.it/build-images/cmake:gcc8-armv7 extends: .conanbuild @@ -92,11 +105,16 @@ mac_os: stage: build script: - mkdir mac_build + - mkdir mac_jni - cd mac_build - cmake -DTEST=true -DTAG_VERSION=$CI_COMMIT_TAG -DEVM_GAS=true -DCMAKE_BUILD_TYPE=Debug -DLIBCURL_TYPE=shared .. - make - ctest -V | tee ../mac_test_c.log | test/junit > ../mac_test_c.xml - rm -rf * + - cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=MINSIZEREL -DJAVA=true -DUSE_CURL=false -DUSE_SCRYPT=true .. + - make in3_jni + - cp lib/libin3_jni.dylib ../mac_jni/ + - rm -rf * - cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=MINSIZEREL -DJAVA=true .. - make @@ -104,6 +122,7 @@ mac_os: reports: junit: mac_test_c.xml paths: + - mac_jni - mac_build/c/docs - mac_build/java/docs - mac_build/lib @@ -158,16 +177,16 @@ java: - short-jobs dependencies: - mac_os - - win_mingw + - win_jni - gcc8 - arm_jni script: - mkdir java_build - cd java_build - mkdir -p ../java/src/in3/native/ - - cp ../mac_build/lib/libin3_jni.dylib ../java/src/in3/native/ - - cp ../win_build/lib/libin3_jni.so ../java/src/in3/native/in3_jni.dll - - cp ../x64_build/lib/libin3_jni.so ../java/src/in3/native/ + - cp ../mac_jni/lib/libin3_jni.dylib ../java/src/in3/native/ + - cp ../win_jni/lib/libin3_jni.so ../java/src/in3/native/in3_jni.dll + - cp ../x64_jni/lib/libin3_jni.so ../java/src/in3/native/ - cp ../arm_jni_build/lib/libin3_jni.so ../java/src/in3/native/libin3_jni_arm.so - cmake -DIN3_LIB=false -DJAVA_MULTI_LIBS=true -DCMAKE_BUILD_TYPE=Release -DJAVA=true -DBUILD_DOC=true .. - make in3j From 3e009cfd33e617053c783b5ac1b8c68879f137a8 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 17 Mar 2020 22:33:43 +0100 Subject: [PATCH 92/97] fixed jni-build --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2c2d3a5f3..c8ee4f215 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -184,9 +184,9 @@ java: - mkdir java_build - cd java_build - mkdir -p ../java/src/in3/native/ - - cp ../mac_jni/lib/libin3_jni.dylib ../java/src/in3/native/ + - cp ../mac_jni/libin3_jni.dylib ../java/src/in3/native/ - cp ../win_jni/lib/libin3_jni.so ../java/src/in3/native/in3_jni.dll - - cp ../x64_jni/lib/libin3_jni.so ../java/src/in3/native/ + - cp ../x64_jni/libin3_jni.so ../java/src/in3/native/ - cp ../arm_jni_build/lib/libin3_jni.so ../java/src/in3/native/libin3_jni_arm.so - cmake -DIN3_LIB=false -DJAVA_MULTI_LIBS=true -DCMAKE_BUILD_TYPE=Release -DJAVA=true -DBUILD_DOC=true .. - make in3j From 1f44a06dd53291b88e12675ba5a6a4dc1b71564c Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 17 Mar 2020 22:57:45 +0100 Subject: [PATCH 93/97] disable curl for wasm or java --- CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51d2e235a..2e7be1793 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,8 +64,8 @@ option(WASM_EMBED "embedds the wasm as base64-encoded into the js-file" ON) option(WASM_EMMALLOC "use ther smaller EMSCRIPTEN Malloc, which reduces the size about 10k, but may be a bit slower" ON) option(WASM_SYNC "intiaializes the WASM synchronisly, which allows to require and use it the same function, but this will not be supported by chrome (4k limit)" OFF) option(CODE_COVERAGE "Builds targets with code coverage instrumentation. (Requires GCC or Clang)" OFF) -OPTION(USE_SCRYPT "if scrypt is installed, it will link dynamicly to the shared scrypt lib." ON) -OPTION(USE_CURL "if true the curl transport will be built (with a dependency to libcurl)" ON) +option(USE_SCRYPT "integrate scrypt into the build in order to allow decrypt_key for scrypt encoded keys." ON) +option(USE_CURL "if true the curl transport will be built (with a dependency to libcurl)" ON) if (USE_PRECOMPUTED_EC) ADD_DEFINITIONS(-DUSE_PRECOMPUTED_CP=1) @@ -73,12 +73,14 @@ else() ADD_DEFINITIONS(-DUSE_PRECOMPUTED_CP=0) endif() -if (USE_CURL) +if (USE_CURL AND NOT (JAVA OR WASM OR ASMJS)) ADD_DEFINITIONS(-DUSE_CURL) set(IN3_TRANSPORT ${IN3_TRANSPORT} transport_curl) if (CURL_BLOCKING) ADD_DEFINITIONS(-DCURL_BLOCKING) endif() +else() + set(USE_CURL 0) endif() @@ -101,6 +103,7 @@ if(IN3API) ADD_DEFINITIONS(-DETH_API) set(IN3_API eth_api) endif() + if(IPFS) ADD_DEFINITIONS(-DIPFS) set(IN3_VERIFIER ${IN3_VERIFIER} ipfs) From 360b914b730c0c8fe79abbcc26fc93041f46854e Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 17 Mar 2020 23:38:31 +0100 Subject: [PATCH 94/97] create Option-dependend lib --- CMakeLists.txt | 3 +++ c/CMakeLists.txt | 51 +++++++++++++++++++++++++++++++++++++----------- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e7be1793..6bd4995fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,9 +91,12 @@ endif() if(ETH_FULL) ADD_DEFINITIONS(-DETH_FULL) set(IN3_VERIFIER eth_full) + set(ETH_BASIC true) + set(ETH_NANO true) elseif(ETH_BASIC) ADD_DEFINITIONS(-DETH_BASIC) set(IN3_VERIFIER eth_basic) + set(ETH_NANO true) elseif(ETH_NANO) ADD_DEFINITIONS(-DETH_NANO) set(IN3_VERIFIER eth_nano) diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index 25c15ea6c..97e2a5a5d 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -54,19 +54,48 @@ if (IN3_LIB) $ $ $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ ) + if (ETH_FULL) + set(IN3_LIBS ${IN3_LIBS} + $ + $ + $ + ) + endif() + + if (ETH_BASIC) + set(IN3_LIBS ${IN3_LIBS} + $ + ) + endif() + + if (ETH_NANO) + set(IN3_LIBS ${IN3_LIBS} + $ + ) + endif() + + if (IPFS) + set(IN3_LIBS ${IN3_LIBS} + $ + $ + ) + if (IN3API) + set(IN3_LIBS ${IN3_LIBS} + $ + ) + endif() + endif() + + if (IN3API) + set(IN3_LIBS ${IN3_LIBS} + $ + $ + $ + ) + endif() + if (USE_SCRYPT) set(IN3_LIBS ${IN3_LIBS} $) endif() From 170fa12b2f7c486a34b8f4770c598d8dcfc27bf5 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 17 Mar 2020 23:45:49 +0100 Subject: [PATCH 95/97] doc in examples --- c/examples/call_a_function.c | 9 ++++----- c/examples/get_balance.c | 8 ++++---- c/examples/get_block.c | 8 ++++---- c/examples/get_logs.c | 8 ++++---- c/examples/get_transaction_receipt.c | 8 ++++---- c/examples/ipfs_put_get.c | 6 +++--- c/examples/send_transaction.c | 10 +++++----- c/examples/usn_device.c | 10 +++++----- c/examples/usn_rent.c | 9 ++++----- 9 files changed, 37 insertions(+), 39 deletions(-) diff --git a/c/examples/call_a_function.c b/c/examples/call_a_function.c index 0be959dae..4bb87f3bb 100644 --- a/c/examples/call_a_function.c +++ b/c/examples/call_a_function.c @@ -1,10 +1,9 @@ /// This example shows how to call functions on a smart contract eiither directly or using the api to encode the arguments -#include // the core client -#include -#include // transport implementation -#include -#include +#include // the core client +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions #include #include diff --git a/c/examples/get_balance.c b/c/examples/get_balance.c index 8b4325e6a..68ea3619e 100644 --- a/c/examples/get_balance.c +++ b/c/examples/get_balance.c @@ -1,9 +1,9 @@ /// get the Balance with the API and also as direct RPC-call -#include // the core client -#include -#include // transport implementation -#include +#include // the core client +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions #include #include diff --git a/c/examples/get_block.c b/c/examples/get_block.c index d6d2012b2..ec0c3b520 100644 --- a/c/examples/get_block.c +++ b/c/examples/get_block.c @@ -1,9 +1,9 @@ /// using the basic-module to get and verify a Block with the API and also as direct RPC-call -#include // the core client -#include -#include // transport implementation -#include +#include // the core client +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions #include #include diff --git a/c/examples/get_logs.c b/c/examples/get_logs.c index 231bc9958..5e13fa286 100644 --- a/c/examples/get_logs.c +++ b/c/examples/get_logs.c @@ -1,9 +1,9 @@ /// fetching events and verify them with eth_getLogs -#include // the core client -#include -#include // transport implementation -#include +#include // the core client +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions #include #include diff --git a/c/examples/get_transaction_receipt.c b/c/examples/get_transaction_receipt.c index 3381c1562..9a9eb4024 100644 --- a/c/examples/get_transaction_receipt.c +++ b/c/examples/get_transaction_receipt.c @@ -1,9 +1,9 @@ /// validating the result or receipt of an transaction -#include // the core client -#include -#include // transport implementation -#include +#include // the core client +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions #include #include #include diff --git a/c/examples/ipfs_put_get.c b/c/examples/ipfs_put_get.c index 100d0be79..b1f8a1fbc 100644 --- a/c/examples/ipfs_put_get.c +++ b/c/examples/ipfs_put_get.c @@ -1,9 +1,9 @@ /// using the IPFS module #include // the core client -#include // transport implementation -#include -#include +#include // if included the verifier will automaticly be initialized. +#include // access ipfs-api +#include // logging functions #include #define LOREM_IPSUM "Lorem ipsum dolor sit amet" diff --git a/c/examples/send_transaction.c b/c/examples/send_transaction.c index 6c593c298..bf07772eb 100644 --- a/c/examples/send_transaction.c +++ b/c/examples/send_transaction.c @@ -1,10 +1,10 @@ /// sending a transaction including signing it with a private key -#include // the core client -#include -#include // transport implementation -#include -#include // default signer implementation +#include // the core client +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions +#include // default signer implementation #include #include diff --git a/c/examples/usn_device.c b/c/examples/usn_device.c index 887e5240f..b46065772 100644 --- a/c/examples/usn_device.c +++ b/c/examples/usn_device.c @@ -1,10 +1,10 @@ /// a example how to watch usn events and act upon it. -#include // the core client -#include -#include // transport implementation -#include -#include // signer-api +#include // the core client +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions +#include // signer-api #include #include #include diff --git a/c/examples/usn_rent.c b/c/examples/usn_rent.c index 834943d81..e5612b100 100644 --- a/c/examples/usn_rent.c +++ b/c/examples/usn_rent.c @@ -1,11 +1,10 @@ /// how to send a rent transaction to a usn contract usinig the usn-api. #include -#include // the core client -#include // transport implementation -#include -#include // signer-api -#include // api for renting +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // signer-api +#include // api for renting #include #include #include From 20ed41f00c9370a8543ab83f54179f787c05aa67 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 17 Mar 2020 23:48:41 +0100 Subject: [PATCH 96/97] update options --- c/docs/1_install.md | 34 +++++- c/docs/2_examples.md | 223 +++++++++++++++----------------------- java/docs/2_examples.md | 34 +++--- scripts/update_options.sh | 2 +- 4 files changed, 138 insertions(+), 155 deletions(-) diff --git a/c/docs/1_install.md b/c/docs/1_install.md index f3ea5df9d..1d76e7176 100644 --- a/c/docs/1_install.md +++ b/c/docs/1_install.md @@ -28,6 +28,13 @@ When configuring cmake, you can set a lot of different incubed specific like `cm Default-Value: `-DASMJS=OFF` +#### BTC + + if true, the bitcoin verifiers will be build + +Default-Value: `-DBTC=OFF` + + #### BUILD_DOC generates the documenation with doxygen. @@ -42,6 +49,20 @@ Default-Value: `-DBUILD_DOC=OFF` Default-Value: `-DCMD=ON` +#### CODE_COVERAGE + + Builds targets with code coverage instrumentation. (Requires GCC or Clang) + +Default-Value: `-DCODE_COVERAGE=OFF` + + +#### COLOR + + Enable color codes for debug + +Default-Value: `-DCOLOR=ON` + + #### ERR_MSG if set human readable error messages will be inculded in th executable, otherwise only the error code is used. (saves about 19kB) @@ -112,6 +133,13 @@ Default-Value: `-DIN3_SERVER=OFF` Default-Value: `-DIN3_STAGING=OFF` +#### IPFS + + build IPFS verification + +Default-Value: `-DIPFS=ON` + + #### JAVA build the java-binding (shared-lib and jar-file) @@ -163,7 +191,7 @@ Default-Value: `-DTRANSPORTS=ON` #### USE_CURL - if true the curl transport will be build (with a dependency to libcurl) + if true the curl transport will be built (with a dependency to libcurl) Default-Value: `-DUSE_CURL=ON` @@ -177,9 +205,9 @@ Default-Value: `-DUSE_PRECOMPUTED_EC=ON` #### USE_SCRYPT - if scrypt is installed, it will link dynamicly to the shared scrypt lib. + integrate scrypt into the build in order to allow decrypt_key for scrypt encoded keys. -Default-Value: `-DUSE_SCRYPT=OFF` +Default-Value: `-DUSE_SCRYPT=ON` #### WASM diff --git a/c/docs/2_examples.md b/c/docs/2_examples.md index 4ff7efc2b..833eb7934 100644 --- a/c/docs/2_examples.md +++ b/c/docs/2_examples.md @@ -11,10 +11,9 @@ This example shows how to call functions on a smart contract eiither directly or /// This example shows how to call functions on a smart contract eiither directly or using the api to encode the arguments #include // the core client -#include // wrapper for easier use -#include // the full ethereum verifier containing the EVM -#include // transport implementation -#include +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions #include #include @@ -24,14 +23,6 @@ static in3_ret_t call_func_api(in3_t* c, address_t contract); int main() { in3_ret_t ret = IN3_OK; - // register a chain-verifier for full Ethereum-Support in order to verify eth_call - // this needs to be called only once. - in3_register_eth_full(); - - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // Remove log prefix for readability in3_log_set_prefix(""); @@ -132,26 +123,17 @@ source : [in3-c/c/examples/get_balance.c](https://github.com/slockit/in3-c/blob/ ```c /// get the Balance with the API and also as direct RPC-call -#include // the core client -#include // wrapper for easier use -#include // use the basic module -#include // transport implementation - +#include // the core client +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions +#include #include static void get_balance_rpc(in3_t* in3); static void get_balance_api(in3_t* in3); int main() { - - // register a chain-verifier for basic Ethereum-Support, which is enough to verify accounts - // this needs to be called only once - in3_register_eth_basic(); - - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* in3 = in3_for_chain(ETH_CHAIN_ID_MAINNET); @@ -211,10 +193,10 @@ source : [in3-c/c/examples/get_block.c](https://github.com/slockit/in3-c/blob/ma ```c /// using the basic-module to get and verify a Block with the API and also as direct RPC-call -#include // the core client -#include // wrapper for easier use -#include // use the basic module -#include // transport implementation +#include // the core client +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions #include #include @@ -223,15 +205,6 @@ static void get_block_rpc(in3_t* in3); static void get_block_api(in3_t* in3); int main() { - - // register a chain-verifier for basic Ethereum-Support, which is enough to verify blocks - // this needs to be called only once - in3_register_eth_basic(); - - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* in3 = in3_for_chain(ETH_CHAIN_ID_MAINNET); @@ -292,11 +265,10 @@ source : [in3-c/c/examples/get_logs.c](https://github.com/slockit/in3-c/blob/mas ```c /// fetching events and verify them with eth_getLogs -#include // the core client -#include // wrapper for easier use -#include // use the basic module -#include // transport implementation - +#include // the core client +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions #include #include @@ -304,15 +276,6 @@ static void get_logs_rpc(in3_t* in3); static void get_logs_api(in3_t* in3); int main() { - - // register a chain-verifier for basic Ethereum-Support, which is enough to verify logs - // this needs to be called only once - in3_register_eth_basic(); - - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* in3 = in3_for_chain(ETH_CHAIN_ID_MAINNET); in3->chain_id = ETH_CHAIN_ID_KOVAN; @@ -407,26 +370,17 @@ checking the transaction data ```c /// checking the transaction data -#include // the core client -#include // wrapper for easier use -#include // use the basic module -#include // transport implementation - +#include // the core client +#include +#include // transport implementation +#include +#include #include static void get_tx_rpc(in3_t* in3); static void get_tx_api(in3_t* in3); int main() { - - // register a chain-verifier for basic Ethereum-Support, which is enough to verify txs - // this needs to be called only once - in3_register_eth_basic(); - - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* in3 = in3_for_chain(ETH_CHAIN_ID_MAINNET); @@ -491,11 +445,11 @@ source : [in3-c/c/examples/get_transaction_receipt.c](https://github.com/slockit ```c /// validating the result or receipt of an transaction -#include // the core client -#include // wrapper for easier use -#include // use the basic module -#include // transport implementation - +#include // the core client +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions +#include #include #include @@ -503,15 +457,6 @@ static void get_tx_receipt_rpc(in3_t* in3); static void get_tx_receipt_api(in3_t* in3); int main() { - - // register a chain-verifier for basic Ethereum-Support, which is enough to verify tx receipts - // this needs to be called only once - in3_register_eth_basic(); - - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* in3 = in3_for_chain(ETH_CHAIN_ID_MAINNET); @@ -577,19 +522,21 @@ source : [in3-c/c/examples/ipfs_put_get.c](https://github.com/slockit/in3-c/blob /// using the IPFS module #include // the core client -#include // transport implementation -#include // IPFS verifier +#include // if included the verifier will automaticly be initialized. +#include // access ipfs-api +#include // logging functions #include #define LOREM_IPSUM "Lorem ipsum dolor sit amet" +#define return_err(err) \ + do { \ + printf(__FILE__ ":%d::Error %s\n", __LINE__, err); \ + return; \ + } while (0) -int main() { - in3_register_ipfs(); - in3_register_curl(); - - in3_t* c = in3_for_chain(ETH_CHAIN_ID_IPFS); - char * result, *error; - char tmp[100]; +static void ipfs_rpc_example(in3_t* c) { + char *result, *error; + char tmp[100]; in3_ret_t res = in3_client_rpc( c, @@ -598,7 +545,7 @@ int main() { &result, &error); if (res != IN3_OK) - return -1; + return_err(in3_errmsg(res)); printf("IPFS hash: %s\n", result); sprintf(tmp, "[%s, \"utf8\"]", result); @@ -612,10 +559,44 @@ int main() { &result, &error); if (res != IN3_OK) - return -1; + return_err(in3_errmsg(res)); + res = strcmp(result, "\"" LOREM_IPSUM "\""); + if (res) return_err("Content mismatch"); +} - return strcmp(result, "\"" LOREM_IPSUM "\""); +static void ipfs_api_example(in3_t* c) { + bytes_t b = {.data = (uint8_t*) LOREM_IPSUM, .len = strlen(LOREM_IPSUM)}; + char* multihash = ipfs_put(c, &b); + if (multihash == NULL) + return_err("ipfs_put API call error"); + printf("IPFS hash: %s\n", multihash); + + bytes_t* content = ipfs_get(c, multihash); + free(multihash); + if (content == NULL) + return_err("ipfs_get API call error"); + + int res = strncmp((char*) content->data, LOREM_IPSUM, content->len); + b_free(content); + if (res) + return_err("Content mismatch"); } + +int main() { + // create new incubed client + in3_t* c = in3_for_chain(ETH_CHAIN_ID_IPFS); + + // IPFS put/get using raw RPC calls + ipfs_rpc_example(c); + + // IPFS put/get using API + ipfs_api_example(c); + + // cleanup client after usage + in3_free(c); + return 0; +} + ``` ### send_transaction @@ -628,12 +609,12 @@ sending a transaction including signing it with a private key ```c /// sending a transaction including signing it with a private key -#include // the core client -#include // wrapper for easier use -#include // use the basic module -#include // transport implementation -#include // default signer implementation - +#include // the core client +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions +#include // default signer implementation +#include #include // fixme: This is only for the sake of demo. Do NOT store private keys as plaintext. @@ -643,15 +624,6 @@ static void send_tx_rpc(in3_t* in3); static void send_tx_api(in3_t* in3); int main() { - - // register a chain-verifier for basic Ethereum-Support, which is enough to verify txs - // this needs to be called only once - in3_register_eth_basic(); - - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* in3 = in3_for_chain(ETH_CHAIN_ID_MAINNET); @@ -732,11 +704,12 @@ a example how to watch usn events and act upon it. /// a example how to watch usn events and act upon it. #include // the core client -#include // wrapper for easier use -#include // the full ethereum verifier containing the EVM -#include // transport implementation +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. +#include // logging functions #include // signer-api -#include // api for renting +#include +#include #include #include #include @@ -752,15 +725,6 @@ static int handle_booking(usn_event_t* ev) { } int main(int argc, char* argv[]) { - - // register a chain-verifier for full Ethereum-Support in order to verify eth_call - // this needs to be called only once. - in3_register_eth_full(); - - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* c = in3_for_chain(ETH_CHAIN_ID_MAINNET); @@ -811,12 +775,12 @@ how to send a rent transaction to a usn contract usinig the usn-api. ```c /// how to send a rent transaction to a usn contract usinig the usn-api. -#include // the core client -#include // wrapper for easier use -#include // the full ethereum verifier containing the EVM -#include // transport implementation +#include +#include // functions for direct api-access +#include // if included the verifier will automaticly be initialized. #include // signer-api #include // api for renting +#include #include #include @@ -846,15 +810,6 @@ void unlock_key(in3_t* c, char* json_data, char* passwd) { } int main(int argc, char* argv[]) { - - // register a chain-verifier for full Ethereum-Support in order to verify eth_call - // this needs to be called only once. - in3_register_eth_full(); - - // use curl as the default for sending out requests - // this needs to be called only once. - in3_register_curl(); - // create new incubed client in3_t* c = in3_for_chain(ETH_CHAIN_ID_GOERLI); diff --git a/java/docs/2_examples.md b/java/docs/2_examples.md index 88f2fbf54..d99688380 100644 --- a/java/docs/2_examples.md +++ b/java/docs/2_examples.md @@ -67,11 +67,11 @@ public class Configure { clientConfig.setMaxAttempts(1); // sets max attempts to 1 before giving up clientConfig.setProof(Proof.none); // does not require proof (not recommended) - // Setup the NodeConfiguration object for the nodes on a certain chain - NodeConfiguration nodeConfiguration = new NodeConfiguration(Chain.GOERLI, clientConfig); - nodeConfiguration.setNeedsUpdate(false); - nodeConfiguration.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f"); - nodeConfiguration.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb"); + // Setup the ChainConfiguration object for the nodes on a certain chain + ChainConfiguration chainConfiguration = new ChainConfiguration(Chain.GOERLI, clientConfig); + chainConfiguration.setNeedsUpdate(false); + chainConfiguration.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f"); + chainConfiguration.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb"); in3.setConfig(clientConfig); @@ -104,16 +104,16 @@ public class GetBalance { // create incubed IN3 in3 = IN3.forChain(Chain.MAINNET); // set it to mainnet (which is also dthe default) - System.out.println("Balance API" + GetBalanceAPI(in3).longValue()); + System.out.println("Balance API" + getBalanceAPI(in3).longValue()); - System.out.println("Balance RPC " + GetBalanceRPC(in3)); + System.out.println("Balance RPC " + getBalanceRPC(in3)); } - static BigInteger GetBalanceAPI(IN3 in3) { + static BigInteger getBalanceAPI(IN3 in3) { return in3.getEth1API().getBalance(AC_ADDR, Block.LATEST); } - static String GetBalanceRPC(IN3 in3) { + static String getBalanceRPC(IN3 in3) { return in3.sendRPC("eth_getBalance", new Object[] {AC_ADDR, "latest"}); } } @@ -213,17 +213,17 @@ public class GetTransaction { // create incubed IN3 in3 = IN3.forChain(Chain.MAINNET); // set it to mainnet (which is also dthe default) - Transaction txn = GetTransactionAPI(in3); + Transaction txn = getTransactionAPI(in3); System.out.println("Transaction API #blockNumber: " + txn.getBlockNumber()); - System.out.println("Transaction RPC :" + GetTransactionRPC(in3)); + System.out.println("Transaction RPC :" + getTransactionRPC(in3)); } - static Transaction GetTransactionAPI(IN3 in3) { + static Transaction getTransactionAPI(IN3 in3) { return in3.getEth1API().getTransactionByHash(TXN_HASH); } - static String GetTransactionRPC(IN3 in3) { + static String getTransactionRPC(IN3 in3) { return in3.sendRPC("eth_getTransactionByHash", new Object[] {TXN_HASH}); } } @@ -252,17 +252,17 @@ public class GetTransactionReceipt { // create incubed IN3 in3 = IN3.forChain(Chain.MAINNET); // set it to mainnet (which is also the default) - TransactionReceipt txn = GetTransactionReceiptAPI(in3); + TransactionReceipt txn = getTransactionReceiptAPI(in3); System.out.println("TransactionRerceipt API : for txIndex " + txn.getTransactionIndex() + " Block num " + txn.getBlockNumber() + " Gas used " + txn.getGasUsed() + " status " + txn.getStatus()); - System.out.println("TransactionReceipt RPC : " + GetTransactionReceiptRPC(in3)); + System.out.println("TransactionReceipt RPC : " + getTransactionReceiptRPC(in3)); } - static TransactionReceipt GetTransactionReceiptAPI(IN3 in3) { + static TransactionReceipt getTransactionReceiptAPI(IN3 in3) { return in3.getEth1API().getTransactionReceipt(TRANSACTION_HASH); } - static String GetTransactionReceiptRPC(IN3 in3) { + static String getTransactionReceiptRPC(IN3 in3) { return in3.sendRPC("eth_getTransactionReceipt", new Object[] {TRANSACTION_HASH}); } } diff --git a/scripts/update_options.sh b/scripts/update_options.sh index 9ec6159a5..4eaa545c9 100755 --- a/scripts/update_options.sh +++ b/scripts/update_options.sh @@ -1,4 +1,4 @@ #!/bin/sh cd ../build -cmake -LAH .. | grep '^[^-]\|^$' | awk -f ../docs/options.awk > ../docs/1_install.md \ No newline at end of file +cmake -LAH .. | grep '^[^-]\|^$' | awk -f ../c/docs/options.awk > ../c/docs/1_install.md \ No newline at end of file From 12d492cdb663eced94ef5de49adc123298030e61 Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Tue, 17 Mar 2020 23:59:13 +0100 Subject: [PATCH 97/97] fixed docu --- c/docs/Doxyfile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/docs/Doxyfile.in b/c/docs/Doxyfile.in index 4ded95d68..bdbafa96b 100644 --- a/c/docs/Doxyfile.in +++ b/c/docs/Doxyfile.in @@ -874,7 +874,7 @@ RECURSIVE = YES # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = +EXCLUDE = @CMAKE_CURRENT_SOURCE_DIR@/../src/third-party # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded