Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
66a1932e
Commit
66a1932e
authored
Sep 29, 2020
by
Kelvin Fichter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started porting tests for trie libraries
parent
69264d3a
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
412 additions
and
82 deletions
+412
-82
TestLib_EthMerkleTrie.sol
...s/contracts/test-libraries/trie/TestLib_EthMerkleTrie.sol
+0
-76
package.json
packages/contracts/package.json
+1
-1
Lib_EthMerkleTrie.spec.ts
...s/test/contracts/libraries/trie/Lib_EthMerkleTrie.spec.ts
+9
-0
Lib_MerkleTrie.spec.ts
...acts/test/contracts/libraries/trie/Lib_MerkleTrie.spec.ts
+9
-0
Lib_SecureMerkleTrie.spec.ts
...est/contracts/libraries/trie/Lib_SecureMerkleTrie.spec.ts
+9
-0
index.ts
packages/contracts/test/data/index.ts
+7
-5
Lib_RLPWriter.test.json
...acts/test/data/json/libraries/rlp/Lib_RLPWriter.test.json
+0
-0
Lib_EthMerkleTrie.test.json
...test/data/json/libraries/trie/Lib_EthMerkleTrie.test.json
+32
-0
Lib_MerkleTrie.test.json
...ts/test/data/json/libraries/trie/Lib_MerkleTrie.test.json
+340
-0
Lib_SecureMerkleTrie.test.json
...t/data/json/libraries/trie/Lib_SecureMerkleTrie.test.json
+5
-0
Lib_Bytes32Utils.test.json
...test/data/json/libraries/utils/Lib_Bytes32Utils.test.json
+0
-0
Lib_BytesUtils.test.json
...s/test/data/json/libraries/utils/Lib_BytesUtils.test.json
+0
-0
Lib_ECDSAUtils.test.json
...s/test/data/json/libraries/utils/Lib_ECDSAUtils.test.json
+0
-0
No files found.
packages/contracts/contracts/test-libraries/trie/TestLib_EthMerkleTrie.sol
View file @
66a1932e
...
...
@@ -58,44 +58,6 @@ library TestLib_EthMerkleTrie {
function proveAccountState(
address _address,
Lib_OVMCodec.EVMAccount memory _accountState,
Lib_OVMCodec.ProofMatrix memory _proofMatrix,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
public
view
returns (bool)
{
return Lib_EthMerkleTrie.proveAccountState(
_address,
_accountState,
_proofMatrix,
_stateTrieWitness,
_stateTrieRoot
);
}
function proveAccountState(
address _address,
Lib_OVMCodec.EVMAccount memory _accountState,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
public
view
returns (bool)
{
return Lib_EthMerkleTrie.proveAccountState(
_address,
_accountState,
_stateTrieWitness,
_stateTrieRoot
);
}
function proveAccountState(
address _address,
Lib_OVMCodec.Account memory _accountState,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
...
...
@@ -186,44 +148,6 @@ library TestLib_EthMerkleTrie {
function updateAccountState(
address _address,
Lib_OVMCodec.EVMAccount memory _accountState,
Lib_OVMCodec.ProofMatrix memory _proofMatrix,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
public
view
returns (bytes32)
{
return Lib_EthMerkleTrie.updateAccountState(
_address,
_accountState,
_proofMatrix,
_stateTrieWitness,
_stateTrieRoot
);
}
function updateAccountState(
address _address,
Lib_OVMCodec.EVMAccount memory _accountState,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
public
view
returns (bytes32)
{
return Lib_EthMerkleTrie.updateAccountState(
_address,
_accountState,
_stateTrieWitness,
_stateTrieRoot
);
}
function updateAccountState(
address _address,
Lib_OVMCodec.Account memory _accountState,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
...
...
packages/contracts/package.json
View file @
66a1932e
...
...
@@ -9,7 +9,7 @@
"build:contracts"
:
"buidler compile"
,
"build:copy"
:
"copyfiles -u 2
\"
contracts/optimistic-ethereum/**/*.sol
\"
\"
build/contracts
\"
"
,
"test"
:
"yarn run test:contracts"
,
"test:contracts"
:
"buidler test
\"
test/contracts/libraries/
utils/Lib_EthUtils
.spec.ts
\"
--show-stack-traces"
,
"test:contracts"
:
"buidler test
\"
test/contracts/libraries/
trie/Lib_MerkleTrie
.spec.ts
\"
--show-stack-traces"
,
"lint"
:
"tslint --format stylish --project ."
,
"fix"
:
"prettier --config prettier-config.json --write
\"
buidler.config.ts
\"
\"
{src,test}/**/*.ts
\"
"
,
"clean"
:
"rm -rf ./artifacts ./build ./cache"
...
...
packages/contracts/test/contracts/libraries/trie/Lib_EthMerkleTrie.spec.ts
View file @
66a1932e
/* Internal Imports */
import
{
Lib_EthMerkleTrie_TEST_JSON
}
from
'
../../../data
'
import
{
runJsonTest
}
from
'
../../../helpers
'
describe
(
'
Lib_EthMerkleTrie
'
,
()
=>
{
describe
(
'
JSON tests
'
,
()
=>
{
runJsonTest
(
'
TestLib_EthMerkleTrie
'
,
Lib_EthMerkleTrie_TEST_JSON
)
})
})
packages/contracts/test/contracts/libraries/trie/Lib_MerkleTrie.spec.ts
View file @
66a1932e
/* Internal Imports */
import
{
Lib_MerkleTrie_TEST_JSON
}
from
'
../../../data
'
import
{
runJsonTest
}
from
'
../../../helpers
'
describe
(
'
Lib_MerkleTrie
'
,
()
=>
{
describe
(
'
JSON tests
'
,
()
=>
{
runJsonTest
(
'
TestLib_MerkleTrie
'
,
Lib_MerkleTrie_TEST_JSON
)
})
})
packages/contracts/test/contracts/libraries/trie/Lib_SecureMerkleTrie.spec.ts
View file @
66a1932e
/* Internal Imports */
import
{
Lib_SecureMerkleTrie_TEST_JSON
}
from
'
../../../data
'
import
{
runJsonTest
}
from
'
../../../helpers
'
describe
(
'
Lib_SecureMerkleTrie
'
,
()
=>
{
describe
(
'
JSON tests
'
,
()
=>
{
runJsonTest
(
'
TestLib_SecureMerkleTrie
'
,
Lib_SecureMerkleTrie_TEST_JSON
)
})
})
packages/contracts/test/data/index.ts
View file @
66a1932e
export
{
tests
as
Lib_RLPWriter_TEST_JSON
}
from
'
./json/libraries/Lib_RLPWriter.test.json
'
export
{
tests
as
Lib_Bytes32Utils_TEST_JSON
}
from
'
./json/libraries/Lib_Bytes32Utils.test.json
'
export
{
tests
as
Lib_BytesUtils_TEST_JSON
}
from
'
./json/libraries/Lib_BytesUtils.test.json
'
export
{
tests
as
Lib_ECDSAUtils_TEST_JSON
}
from
'
./json/libraries/Lib_ECDSAUtils.test.json
'
export
{
tests
as
Lib_MerkleUtils_TEST_JSON
}
from
'
./json/libraries/Lib_MerkleUtils.test.json
'
export
{
tests
as
Lib_RLPWriter_TEST_JSON
}
from
'
./json/libraries/rlp/Lib_RLPWriter.test.json
'
export
{
tests
as
Lib_Bytes32Utils_TEST_JSON
}
from
'
./json/libraries/utils/Lib_Bytes32Utils.test.json
'
export
{
tests
as
Lib_BytesUtils_TEST_JSON
}
from
'
./json/libraries/utils/Lib_BytesUtils.test.json
'
export
{
tests
as
Lib_ECDSAUtils_TEST_JSON
}
from
'
./json/libraries/utils/Lib_ECDSAUtils.test.json
'
export
{
tests
as
Lib_MerkleTrie_TEST_JSON
}
from
'
./json/libraries/trie/Lib_MerkleTrie.test.json
'
export
{
tests
as
Lib_SecureMerkleTrie_TEST_JSON
}
from
'
./json/libraries/trie/Lib_SecureMerkleTrie.test.json
'
export
{
tests
as
Lib_EthMerkleTrie_TEST_JSON
}
from
'
./json/libraries/trie/Lib_EthMerkleTrie.test.json
'
export
{
tests
as
CREATE2_TEST_JSON
}
from
'
./json/create2.test.json
'
export
{
tests
as
SAFETY_CHECKER_TEST_JSON
}
from
'
./json/safety-checker.test.json
'
packages/contracts/test/data/json/libraries/Lib_RLPWriter.test.json
→
packages/contracts/test/data/json/libraries/
rlp/
Lib_RLPWriter.test.json
View file @
66a1932e
File moved
packages/contracts/test/data/json/libraries/trie/Lib_EthMerkleTrie.test.json
0 → 100644
View file @
66a1932e
{
"tests"
:
{
"proveAccountStorageSlotValue"
:
{
"single account, single storage slot"
:
{
},
"single account, multiple storage slots"
:
{
},
"multiple accounts, multiple storage slots"
:
{
}
},
"updateAccountStorageSlotValue"
:
{
"single account, single storage slot"
:
{
},
"single account, multiple storage slots"
:
{
},
"multiple accounts, multiple storage slots"
:
{
}
},
"proveAccountState"
:
{
"account within trie with a single account"
:
{
},
"account within trie with multiple accounts"
:
{
}
},
"updateAccountState"
:
{
"account within trie with a single account"
:
{
},
"account within trie with multiple accounts"
:
{
}
}
}
}
\ No newline at end of file
packages/contracts/test/data/json/libraries/trie/Lib_MerkleTrie.test.json
0 → 100644
View file @
66a1932e
This diff is collapsed.
Click to expand it.
packages/contracts/test/data/json/libraries/trie/Lib_SecureMerkleTrie.test.json
0 → 100644
View file @
66a1932e
{
"tests"
:
{
}
}
\ No newline at end of file
packages/contracts/test/data/json/libraries/Lib_Bytes32Utils.test.json
→
packages/contracts/test/data/json/libraries/
utils/
Lib_Bytes32Utils.test.json
View file @
66a1932e
File moved
packages/contracts/test/data/json/libraries/Lib_BytesUtils.test.json
→
packages/contracts/test/data/json/libraries/
utils/
Lib_BytesUtils.test.json
View file @
66a1932e
File moved
packages/contracts/test/data/json/libraries/Lib_ECDSAUtils.test.json
→
packages/contracts/test/data/json/libraries/
utils/
Lib_ECDSAUtils.test.json
View file @
66a1932e
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment