-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #503 from 0xPolygonHermez/fractasy_hashdb_64
HashDB64 infrastructure. Create config.hashDB64 to use it.
- Loading branch information
Showing
29 changed files
with
6,003 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "smt_get_result.hpp" | ||
#include "scalar.hpp" | ||
|
||
using namespace std; | ||
|
||
string SmtGetResult::toString (Goldilocks &fr) | ||
{ | ||
string result; | ||
result += "root=" + fea2string(fr, root) + "\n"; | ||
result += "key=" + fea2string(fr, key) + "\n"; | ||
result += "insKey=" + fea2string(fr, insKey) + "\n"; | ||
result += "value=" + value.get_str(16) + "\n"; | ||
result += "insValue=" + insValue.get_str(16) + "\n"; | ||
result += "isOld0=" + to_string(isOld0) + "\n"; | ||
result += "proofHashCounter=" + to_string(proofHashCounter) + "\n"; | ||
map< uint64_t, vector<Goldilocks::Element> >::const_iterator it; | ||
for (it=siblings.begin(); it!=siblings.end(); it++) | ||
{ | ||
result += "siblings[" + to_string(it->first) + "]="; | ||
for (uint64_t i=0; i<it->second.size(); i++) | ||
{ | ||
result += fr.toString(it->second[i], 16) + ":"; | ||
} | ||
result += "\n"; | ||
} | ||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef SMT_GET_RESULT_HPP | ||
#define SMT_GET_RESULT_HPP | ||
|
||
#include <vector> | ||
#include <map> | ||
|
||
#include "poseidon_goldilocks.hpp" | ||
#include "goldilocks_base_field.hpp" | ||
|
||
using namespace std; | ||
|
||
// SMT get method result data | ||
class SmtGetResult | ||
{ | ||
public: | ||
Goldilocks::Element root[4]; // merkle-tree root | ||
Goldilocks::Element key[4]; // key to look for | ||
map< uint64_t, vector<Goldilocks::Element> > siblings; // array of siblings // array of fields?? | ||
Goldilocks::Element insKey[4]; // key found | ||
mpz_class insValue; // value found | ||
bool isOld0; // is new insert or delete | ||
mpz_class value; // value retrieved | ||
uint64_t proofHashCounter; | ||
string toString (Goldilocks &fr); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "smt_set_result.hpp" | ||
#include "scalar.hpp" | ||
|
||
using namespace std; | ||
|
||
string SmtSetResult::toString (Goldilocks &fr) | ||
{ | ||
string result; | ||
result += "mode=" + mode + "\n"; | ||
result += "oldRoot=" + fea2string(fr, oldRoot) + "\n"; | ||
result += "newRoot=" + fea2string(fr, newRoot) + "\n"; | ||
result += "key=" + fea2string(fr, key) + "\n"; | ||
result += "insKey=" + fea2string(fr, insKey) + "\n"; | ||
result += "oldValue=" + oldValue.get_str(16) + "\n"; | ||
result += "newValue=" + newValue.get_str(16) + "\n"; | ||
result += "insValue=" + insValue.get_str(16) + "\n"; | ||
result += "isOld0=" + to_string(isOld0) + "\n"; | ||
result += "proofHashCounter=" + to_string(proofHashCounter) + "\n"; | ||
map< uint64_t, vector<Goldilocks::Element> >::const_iterator it; | ||
for (it=siblings.begin(); it!=siblings.end(); it++) | ||
{ | ||
result += "siblings[" + to_string(it->first) + "]="; | ||
for (uint64_t i=0; i<it->second.size(); i++) | ||
{ | ||
result += fr.toString(it->second[i], 16) + ":"; | ||
} | ||
result += "\n"; | ||
} | ||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef SMT_SET_RESULT_HPP | ||
#define SMT_SET_RESULT_HPP | ||
|
||
#include <vector> | ||
#include <map> | ||
|
||
#include "poseidon_goldilocks.hpp" | ||
#include "goldilocks_base_field.hpp" | ||
|
||
using namespace std; | ||
|
||
// SMT set method result data | ||
class SmtSetResult | ||
{ | ||
public: | ||
Goldilocks::Element oldRoot[4]; | ||
Goldilocks::Element newRoot[4]; | ||
Goldilocks::Element key[4]; | ||
map< uint64_t, vector<Goldilocks::Element> > siblings; | ||
Goldilocks::Element insKey[4]; | ||
mpz_class insValue; | ||
bool isOld0; | ||
mpz_class oldValue; | ||
mpz_class newValue; | ||
string mode; | ||
uint64_t proofHashCounter; | ||
string toString (Goldilocks &fr); | ||
}; | ||
|
||
#endif |
Oops, something went wrong.