Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements a fuzzer that generates the valid Merkel Patricia Proofs. #729

Merged
merged 20 commits into from
May 17, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,46 @@
{
"extends": [
"airbnb-base"
"airbnb-base",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"sourceType": "module",
"ecmaFeatures": {
"modules": true
}
},
"plugins": [
"@typescript-eslint",
"json"
],
"rules": {
"@typescript-eslint/indent": ["error", 2],
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/unified-signatures": "error",
"@typescript-eslint/unbound-method": [
"error",
{
"ignoreStatic": true
}
],
"@typescript-eslint/promise-function-async": [
"error",
{
"checkArrowFunctions": true,
"checkFunctionDeclarations": true,
"checkFunctionExpressions": true,
"checkMethodDeclarations": true
}
],
"no-console": "off",
"no-underscore-dangle": "off",
"import/no-extraneous-dependencies": "off",
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ dist/contracts.json
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync

# Compiled js artifacts.
tools/fuzzy_proof_generator_tool/src/*.js
tools/fuzzy_proof_generator_tool/src/*.js.map
schemar marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ install:
before_script:
- ./tools/runGanacheCli.sh </dev/null 1>/dev/null 2>&1 &
- npm run compile
- npm run compile:ts
schemar marked this conversation as resolved.
Show resolved Hide resolved
script:
- npm run test
- npm run test:deployment_tool
- npm run test:integration
- npm run test:generate_proof
- npm run test:fuzzy_proof_generator
- npm run build-package
after_script:
- kill $(ps aux | grep 'ganache-cli' | awk '{print $2}')
4 changes: 2 additions & 2 deletions contracts/lib/MerklePatriciaProof.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ library MerklePatriciaProof {

if(currentNodeList.length == 17) {
if(pathPtr == path.length) {
if(keccak256(abi.encodePacked(RLP.toBytes(currentNodeList[16]))) == value) {
if(keccak256(abi.encodePacked(RLP.toData(currentNodeList[16]))) == value) {
return true;
} else {
return false;
Expand Down Expand Up @@ -129,7 +129,7 @@ library MerklePatriciaProof {

if(currentNodeList.length == 17) {
if(pathPtr == path.length) {
if(keccak256(abi.encodePacked(RLP.toBytes(currentNodeList[16]))) == value) {
if(keccak256(abi.encodePacked(RLP.toData(currentNodeList[16]))) == value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR, focused on tests, should not contain changes to the implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

res_ = true;
return (res_, loc_, path_debug_);
} else {
Expand Down
Loading