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
aa67fe22
Commit
aa67fe22
authored
Sep 30, 2020
by
Kelvin Fichter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Got some tests working for the trie libs
parent
b8a3c25f
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
775 additions
and
646 deletions
+775
-646
OVM_StateTransitioner.sol
...istic-ethereum/OVM/verification/OVM_StateTransitioner.sol
+12
-2
Lib_OVMCodec.sol
...acts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol
+0
-7
Lib_EthMerkleTrie.sol
.../optimistic-ethereum/libraries/trie/Lib_EthMerkleTrie.sol
+6
-481
Lib_MerkleTrie.sol
...cts/optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol
+4
-0
TestLib_EthMerkleTrie.sol
...s/contracts/test-libraries/trie/TestLib_EthMerkleTrie.sol
+1
-145
package.json
packages/contracts/package.json
+6
-2
Lib_EthMerkleTrie.spec.ts
...s/test/contracts/libraries/trie/Lib_EthMerkleTrie.spec.ts
+112
-0
Lib_MerkleTrie.spec.ts
...acts/test/contracts/libraries/trie/Lib_MerkleTrie.spec.ts
+114
-4
Lib_SecureMerkleTrie.spec.ts
...est/contracts/libraries/trie/Lib_SecureMerkleTrie.spec.ts
+119
-0
index.ts
packages/contracts/test/helpers/index.ts
+1
-0
index.ts
packages/contracts/test/helpers/trie/index.ts
+1
-0
trie-test-generator.ts
packages/contracts/test/helpers/trie/trie-test-generator.ts
+259
-0
yarn.lock
packages/contracts/yarn.lock
+140
-5
No files found.
packages/contracts/contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitioner.sol
View file @
aa67fe22
...
...
@@ -173,7 +173,12 @@ contract OVM_StateTransitioner is iOVM_StateTransitioner, Lib_AddressResolver {
require(
Lib_EthMerkleTrie.proveAccountState(
_ovmContractAddress,
_account,
Lib_OVMCodec.EVMAccount({
balance: _account.balance,
nonce: _account.nonce,
storageRoot: _account.storageRoot,
codeHash: _account.codeHash
}),
_stateTrieWitness,
preStateRoot
),
...
...
@@ -284,7 +289,12 @@ contract OVM_StateTransitioner is iOVM_StateTransitioner, Lib_AddressResolver {
postStateRoot = Lib_EthMerkleTrie.updateAccountState(
_ovmContractAddress,
_account,
Lib_OVMCodec.EVMAccount({
balance: _account.balance,
nonce: _account.nonce,
storageRoot: _account.storageRoot,
codeHash: _account.codeHash
}),
_stateTrieWitness,
postStateRoot
);
...
...
packages/contracts/contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol
View file @
aa67fe22
...
...
@@ -68,13 +68,6 @@ library Lib_OVMCodec {
bytes data;
}
struct ProofMatrix {
bool checkNonce;
bool checkBalance;
bool checkStorageRoot;
bool checkCodeHash;
}
struct QueueElement {
uint256 timestamp;
bytes32 batchRoot;
...
...
packages/contracts/contracts/optimistic-ethereum/libraries/trie/Lib_EthMerkleTrie.sol
View file @
aa67fe22
...
...
@@ -124,7 +124,6 @@ library Lib_EthMerkleTrie {
* @notice Verifies a proof of the current state for a given account.
* @param _address Address of the target account.
* @param _accountState Account state object to verify.
* @param _proofMatrix Matrix of fields to verify or ignore.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
...
...
@@ -133,7 +132,6 @@ library Lib_EthMerkleTrie {
function proveAccountState(
address _address,
Lib_OVMCodec.EVMAccount memory _accountState,
Lib_OVMCodec.ProofMatrix memory _proofMatrix,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
...
...
@@ -148,229 +146,11 @@ library Lib_EthMerkleTrie {
_stateTrieRoot
);
// Check each provided component conditionally.
return (
(!_proofMatrix.checkNonce || accountState.nonce == _accountState.nonce) &&
(!_proofMatrix.checkBalance || accountState.balance == _accountState.balance) &&
(!_proofMatrix.checkStorageRoot || accountState.storageRoot == _accountState.storageRoot) &&
(!_proofMatrix.checkCodeHash || accountState.codeHash == _accountState.codeHash)
);
}
/**
* @notice Verifies a proof of the current state for a given account.
* @param _address Address of the target account.
* @param _accountState Account state object to verify.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
* @return `true` if the given account state is valid, `false` otherwise.
*/
function proveAccountState(
address _address,
Lib_OVMCodec.EVMAccount memory _accountState,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
internal
view
returns (bool)
{
return proveAccountState(
_address,
_accountState,
Lib_OVMCodec.ProofMatrix({
checkNonce: true,
checkBalance: true,
checkStorageRoot: true,
checkCodeHash: true
}),
_stateTrieWitness,
_stateTrieRoot
);
}
/**
* @notice Verifies a proof of the current state for a given account.
* @param _address Address of the target account.
* @param _accountState Account state object to verify.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
* @return `true` if the given account state is valid, `false` otherwise.
*/
function proveAccountState(
address _address,
Lib_OVMCodec.Account memory _accountState,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
internal
view
returns (bool)
{
return proveAccountState(
_address,
Lib_OVMCodec.EVMAccount({
nonce: _accountState.nonce,
balance: _accountState.balance,
storageRoot: _accountState.storageRoot,
codeHash: _accountState.codeHash
}),
_stateTrieWitness,
_stateTrieRoot
);
}
/**
* @notice Verifies a proof of the account nonce.
* @param _address Address of the target account.
* @param _nonce Account transaction nonce.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
* @return `true` if the given nonce is valid, `false` otherwise.
*/
function proveAccountNonce(
address _address,
uint256 _nonce,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
internal
view
returns (bool)
{
return proveAccountState(
_address,
Lib_OVMCodec.EVMAccount({
nonce: _nonce,
balance: UINT256_NULL,
storageRoot: BYTES32_NULL,
codeHash: BYTES32_NULL
}),
Lib_OVMCodec.ProofMatrix({
checkNonce: true,
checkBalance: false,
checkStorageRoot: false,
checkCodeHash: false
}),
_stateTrieWitness,
_stateTrieRoot
);
}
/**
* @notice Verifies a proof of the account balance.
* @param _address Address of the target account.
* @param _balance Account balance in wei.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
* @return `true` if the given balance is valid, `false` otherwise.
*/
function proveAccountBalance(
address _address,
uint256 _balance,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
internal
view
returns (bool)
{
return proveAccountState(
_address,
Lib_OVMCodec.EVMAccount({
nonce: UINT256_NULL,
balance: _balance,
storageRoot: BYTES32_NULL,
codeHash: BYTES32_NULL
}),
Lib_OVMCodec.ProofMatrix({
checkNonce: false,
checkBalance: true,
checkStorageRoot: false,
checkCodeHash: false
}),
_stateTrieWitness,
_stateTrieRoot
);
}
/**
* @notice Verifies a proof of the account storage root.
* @param _address Address of the target account.
* @param _storageRoot Account storage root, empty if EOA.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
* @return `true` if the given storage root is valid, `false` otherwise.
*/
function proveAccountStorageRoot(
address _address,
bytes32 _storageRoot,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
internal
view
returns (bool)
{
return proveAccountState(
_address,
Lib_OVMCodec.EVMAccount({
nonce: UINT256_NULL,
balance: UINT256_NULL,
storageRoot: _storageRoot,
codeHash: BYTES32_NULL
}),
Lib_OVMCodec.ProofMatrix({
checkNonce: false,
checkBalance: false,
checkStorageRoot: true,
checkCodeHash: false
}),
_stateTrieWitness,
_stateTrieRoot
);
}
/**
* @notice Verifies a proof of the account code hash.
* @param _address Address of the target account.
* @param _codeHash Account code hash, empty if EOA.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
* @return `true` if the given code hash is valid, `false` otherwise.
*/
function proveAccountCodeHash(
address _address,
bytes32 _codeHash,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
internal
view
returns (bool)
{
return proveAccountState(
_address,
Lib_OVMCodec.EVMAccount({
nonce: UINT256_NULL,
balance: UINT256_NULL,
storageRoot: BYTES32_NULL,
codeHash: _codeHash
}),
Lib_OVMCodec.ProofMatrix({
checkNonce: false,
checkBalance: false,
checkStorageRoot: false,
checkCodeHash: true
}),
_stateTrieWitness,
_stateTrieRoot
accountState.nonce == _accountState.nonce
&& accountState.balance == _accountState.balance
&& accountState.storageRoot == _accountState.storageRoot
&& accountState.codeHash == _accountState.codeHash
);
}
...
...
@@ -383,7 +163,6 @@ library Lib_EthMerkleTrie {
* @notice Updates the current state for a given account.
* @param _address Address of the target account.
* @param _accountState Account state to insert.
* @param _proofMatrix Matrix of fields to update or ignore.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
...
...
@@ -392,7 +171,6 @@ library Lib_EthMerkleTrie {
function updateAccountState(
address _address,
Lib_OVMCodec.EVMAccount memory _accountState,
Lib_OVMCodec.ProofMatrix memory _proofMatrix,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
...
...
@@ -400,264 +178,9 @@ library Lib_EthMerkleTrie {
view
returns (bytes32)
{
Lib_OVMCodec.EVMAccount memory newAccountState = _accountState;
// If the user has provided everything, don't bother pulling the
// current account state.
if (
!_proofMatrix.checkNonce ||
!_proofMatrix.checkBalance ||
!_proofMatrix.checkStorageRoot ||
!_proofMatrix.checkCodeHash
) {
// Pull the old account state.
Lib_OVMCodec.EVMAccount memory oldAccountState = getAccountState(
_address,
_stateTrieWitness,
_stateTrieRoot
);
// Conditionally update elements that haven't been provided with
// elements from the old account state.
if (!_proofMatrix.checkNonce) {
newAccountState.nonce = oldAccountState.nonce;
}
if (!_proofMatrix.checkBalance) {
newAccountState.balance = oldAccountState.balance;
}
if (!_proofMatrix.checkStorageRoot) {
newAccountState.storageRoot = oldAccountState.storageRoot;
}
if (!_proofMatrix.checkCodeHash) {
newAccountState.codeHash = oldAccountState.codeHash;
}
}
// Update the account state.
return setAccountState(
newAccountState,
_address,
_stateTrieWitness,
_stateTrieRoot
);
}
/**
* @notice Updates the current state for a given account.
* @param _address Address of the target account.
* @param _accountState Account state to insert.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
* @return Root hash of the updated state trie.
*/
function updateAccountState(
address _address,
Lib_OVMCodec.EVMAccount memory _accountState,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
internal
view
returns (bytes32)
{
return updateAccountState(
_address,
_accountState,
Lib_OVMCodec.ProofMatrix({
checkNonce: true,
checkBalance: true,
checkStorageRoot: true,
checkCodeHash: true
}),
_stateTrieWitness,
_stateTrieRoot
);
}
/**
* @notice Updates the current state for a given account.
* @param _address Address of the target account.
* @param _accountState Account state to insert.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
* @return Root hash of the updated state trie.
*/
function updateAccountState(
address _address,
Lib_OVMCodec.Account memory _accountState,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
internal
view
returns (bytes32)
{
return updateAccountState(
_address,
Lib_OVMCodec.EVMAccount({
nonce: _accountState.nonce,
balance: _accountState.balance,
storageRoot: _accountState.storageRoot,
codeHash: _accountState.codeHash
}),
_stateTrieWitness,
_stateTrieRoot
);
}
/**
* @notice Updates an account nonce.
* @param _address Address of the target account.
* @param _nonce New account transaction nonce.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
* @return Root hash of the updated state trie.
*/
function updateAccountNonce(
address _address,
uint256 _nonce,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
internal
view
returns (bytes32)
{
return updateAccountState(
_address,
Lib_OVMCodec.EVMAccount({
nonce: _nonce,
balance: UINT256_NULL,
storageRoot: BYTES32_NULL,
codeHash: BYTES32_NULL
}),
Lib_OVMCodec.ProofMatrix({
checkNonce: true,
checkBalance: false,
checkStorageRoot: false,
checkCodeHash: false
}),
_stateTrieWitness,
_stateTrieRoot
);
}
/**
* @notice Updates an account balance.
* @param _address Address of the target account.
* @param _balance New account balance in wei.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
* @return Root hash of the updated state trie.
*/
function updateAccountBalance(
address _address,
uint256 _balance,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
internal
view
returns (bytes32)
{
return updateAccountState(
_address,
Lib_OVMCodec.EVMAccount({
nonce: UINT256_NULL,
balance: _balance,
storageRoot: BYTES32_NULL,
codeHash: BYTES32_NULL
}),
Lib_OVMCodec.ProofMatrix({
checkNonce: false,
checkBalance: true,
checkStorageRoot: false,
checkCodeHash: false
}),
_stateTrieWitness,
_stateTrieRoot
);
}
/**
* @notice Updates an account storage root.
* @param _address Address of the target account.
* @param _storageRoot New account storage root, empty if EOA.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
* @return Root hash of the updated state trie.
*/
function updateAccountStorageRoot(
address _address,
bytes32 _storageRoot,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
internal
view
returns (bytes32)
{
return updateAccountState(
_address,
Lib_OVMCodec.EVMAccount({
nonce: UINT256_NULL,
balance: UINT256_NULL,
storageRoot: _storageRoot,
codeHash: BYTES32_NULL
}),
Lib_OVMCodec.ProofMatrix({
checkNonce: false,
checkBalance: false,
checkStorageRoot: true,
checkCodeHash: false
}),
_stateTrieWitness,
_stateTrieRoot
);
}
/**
* @notice Updates an account code hash.
* @param _address Address of the target account.
* @param _codeHash New account code hash, empty if EOA.
* @param _stateTrieWitness Inclusion proof for the account state within
* the state trie.
* @param _stateTrieRoot Known root of the state trie.
* @return Root hash of the updated state trie.
*/
function updateAccountCodeHash(
address _address,
bytes32 _codeHash,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
internal
view
returns (bytes32)
{
return updateAccountState(
_address,
Lib_OVMCodec.EVMAccount({
nonce: UINT256_NULL,
balance: UINT256_NULL,
storageRoot: BYTES32_NULL,
codeHash: _codeHash
}),
Lib_OVMCodec.ProofMatrix({
checkNonce: false,
checkBalance: false,
checkStorageRoot: false,
checkCodeHash: true
}),
_stateTrieWitness,
_stateTrieRoot
);
...
...
@@ -738,6 +261,7 @@ library Lib_EthMerkleTrie {
codeHash: keccak256(hex'')
});
// TODO: Needs "single node root hash" logic.
(
bool exists,
bytes memory encodedAccountState
...
...
@@ -747,6 +271,7 @@ library Lib_EthMerkleTrie {
_stateTrieRoot
);
// TODO: Must fix this logic, in the next PR.
return exists ? decodeAccountState(encodedAccountState) : DEFAULT_ACCOUNT_STATE;
}
...
...
packages/contracts/contracts/optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol
View file @
aa67fe22
...
...
@@ -6,6 +6,8 @@ import { Lib_BytesUtils } from "../utils/Lib_BytesUtils.sol";
import { Lib_RLPReader } from "../rlp/Lib_RLPReader.sol";
import { Lib_RLPWriter } from "../rlp/Lib_RLPWriter.sol";
import { console } from "@nomiclabs/buidler/console.sol";
/**
* @title Lib_MerkleTrie
*/
...
...
@@ -355,6 +357,8 @@ library Lib_MerkleTrie {
continue;
}
}
} else {
revert("Received an unparseable node.");
}
}
...
...
packages/contracts/contracts/test-libraries/trie/TestLib_EthMerkleTrie.sol
View file @
aa67fe22
...
...
@@ -9,7 +9,7 @@ import { Lib_OVMCodec } from "../../optimistic-ethereum/libraries/codec/Lib_OVMC
/**
* @title TestLib_EthMerkleTrie
*/
library
TestLib_EthMerkleTrie {
contract
TestLib_EthMerkleTrie {
function proveAccountStorageSlotValue(
address _address,
...
...
@@ -73,78 +73,6 @@ library TestLib_EthMerkleTrie {
);
}
function proveAccountNonce(
address _address,
uint256 _nonce,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
public
view
returns (bool)
{
return Lib_EthMerkleTrie.proveAccountNonce(
_address,
_nonce,
_stateTrieWitness,
_stateTrieRoot
);
}
function proveAccountBalance(
address _address,
uint256 _balance,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
public
view
returns (bool)
{
return Lib_EthMerkleTrie.proveAccountBalance(
_address,
_balance,
_stateTrieWitness,
_stateTrieRoot
);
}
function proveAccountStorageRoot(
address _address,
bytes32 _storageRoot,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
public
view
returns (bool)
{
return Lib_EthMerkleTrie.proveAccountStorageRoot(
_address,
_storageRoot,
_stateTrieWitness,
_stateTrieRoot
);
}
function proveAccountCodeHash(
address _address,
bytes32 _codeHash,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
public
view
returns (bool)
{
return Lib_EthMerkleTrie.proveAccountCodeHash(
_address,
_codeHash,
_stateTrieWitness,
_stateTrieRoot
);
}
function updateAccountState(
address _address,
Lib_OVMCodec.EVMAccount memory _accountState,
...
...
@@ -162,76 +90,4 @@ library TestLib_EthMerkleTrie {
_stateTrieRoot
);
}
function updateAccountNonce(
address _address,
uint256 _nonce,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
public
view
returns (bytes32)
{
return Lib_EthMerkleTrie.updateAccountNonce(
_address,
_nonce,
_stateTrieWitness,
_stateTrieRoot
);
}
function updateAccountBalance(
address _address,
uint256 _balance,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
public
view
returns (bytes32)
{
return Lib_EthMerkleTrie.updateAccountBalance(
_address,
_balance,
_stateTrieWitness,
_stateTrieRoot
);
}
function updateAccountStorageRoot(
address _address,
bytes32 _storageRoot,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
public
view
returns (bytes32)
{
return Lib_EthMerkleTrie.updateAccountStorageRoot(
_address,
_storageRoot,
_stateTrieWitness,
_stateTrieRoot
);
}
function updateAccountCodeHash(
address _address,
bytes32 _codeHash,
bytes memory _stateTrieWitness,
bytes32 _stateTrieRoot
)
public
view
returns (bytes32)
{
return Lib_EthMerkleTrie.updateAccountCodeHash(
_address,
_codeHash,
_stateTrieWitness,
_stateTrieRoot
);
}
}
packages/contracts/package.json
View file @
aa67fe22
...
...
@@ -10,7 +10,7 @@
"build:dump"
:
"ts-node
\"
bin/take-dump.ts
\"
"
,
"build:copy"
:
"copyfiles -u 2
\"
contracts/optimistic-ethereum/**/*.sol
\"
\"
build/contracts
\"
"
,
"test"
:
"yarn run test:contracts"
,
"test:contracts"
:
"buidler test --show-stack-traces"
,
"test:contracts"
:
"buidler test
\"
test/contracts/libraries/trie/Lib_EthMerkleTrie.spec.ts
\"
--show-stack-traces"
,
"lint"
:
"yarn run lint:typescript"
,
"lint:typescript"
:
"tslint --format stylish --project ."
,
"lint:fix"
:
"yarn run lint:fix:typescript"
,
...
...
@@ -18,7 +18,7 @@
"clean"
:
"rm -rf ./artifacts ./build ./cache"
},
"devDependencies"
:
{
"@eth-optimism/smock"
:
"^0.
1.0
"
,
"@eth-optimism/smock"
:
"^0.
0.1
"
,
"@nomiclabs/buidler"
:
"^1.4.4"
,
"@nomiclabs/buidler-ethers"
:
"^2.0.0"
,
"@nomiclabs/buidler-waffle"
:
"^2.0.0"
,
...
...
@@ -35,8 +35,12 @@
"fs-extra"
:
"^9.0.1"
,
"ganache-core"
:
"^2.12.1"
,
"lodash"
:
"^4.17.20"
,
"merkle-patricia-tree"
:
"git+https://github.com/kfichter/merkle-patricia-tree"
,
"mocha"
:
"^8.1.1"
,
"prettier"
:
"^2.1.2"
,
"random-bytes-seed"
:
"^1.0.3"
,
"rlp"
:
"^2.2.6"
,
"seedrandom"
:
"^3.0.5"
,
"ts-node"
:
"^9.0.0"
,
"tslint"
:
"^6.1.3"
,
"tslint-config-prettier"
:
"^1.18.0"
,
...
...
packages/contracts/test/contracts/libraries/trie/Lib_EthMerkleTrie.spec.ts
0 → 100644
View file @
aa67fe22
import
{
expect
}
from
'
../../../setup
'
/* External Imports */
import
{
ethers
}
from
'
@nomiclabs/buidler
'
import
{
Contract
}
from
'
ethers
'
/* Internal Imports */
import
{
TrieTestGenerator
,
NON_NULL_BYTES32
}
from
'
../../../helpers
'
import
{
keccak256
}
from
'
ethers/lib/utils
'
const
makeDummyAccounts
=
(
count
:
number
):
any
[]
=>
{
return
[...
Array
(
count
)].
map
((
x
,
idx
)
=>
{
return
{
address
:
'
0xc0de
'
+
`
${
idx
.
toString
(
16
)}
`
.
padStart
(
36
,
'
0
'
),
nonce
:
0
,
balance
:
0
,
codeHash
:
null
,
storage
:
[
{
key
:
keccak256
(
'
0x1234
'
),
val
:
keccak256
(
'
0x5678
'
),
},
],
}
})
}
const
NODE_COUNTS
=
[
1
,
2
,
128
,
256
,
512
,
1024
,
2048
,
4096
]
describe
(
'
Lib_EthMerkleTrie
'
,
()
=>
{
let
Lib_EthMerkleTrie
:
Contract
before
(
async
()
=>
{
Lib_EthMerkleTrie
=
await
(
await
ethers
.
getContractFactory
(
'
TestLib_EthMerkleTrie
'
)
).
deploy
()
})
describe
(
'
proveAccountStorageSlotValue
'
,
()
=>
{})
describe
(
'
updateAccountStorageSlotValue
'
,
()
=>
{})
describe
(
'
proveAccountState
'
,
()
=>
{
for
(
const
nodeCount
of
NODE_COUNTS
)
{
describe
(
`inside a trie with
${
nodeCount
}
nodes`
,
()
=>
{
let
generator
:
TrieTestGenerator
before
(
async
()
=>
{
generator
=
await
TrieTestGenerator
.
fromAccounts
({
accounts
:
makeDummyAccounts
(
nodeCount
),
secure
:
true
,
})
})
for
(
let
i
=
0
;
i
<
nodeCount
;
i
+=
nodeCount
/
(
nodeCount
>
8
?
8
:
1
)
)
{
it
(
`should correctly prove inclusion for node #
${
i
}
`
,
async
()
=>
{
const
test
=
await
generator
.
makeAccountProofTest
(
i
)
expect
(
await
Lib_EthMerkleTrie
.
proveAccountState
(
test
.
address
,
test
.
account
,
test
.
accountTrieWitness
,
test
.
accountTrieRoot
)
).
to
.
equal
(
true
)
})
}
})
}
})
describe
.
only
(
'
updateAccountState
'
,
()
=>
{
for
(
const
nodeCount
of
NODE_COUNTS
)
{
describe
(
`inside a trie with
${
nodeCount
}
nodes`
,
()
=>
{
let
generator
:
TrieTestGenerator
before
(
async
()
=>
{
generator
=
await
TrieTestGenerator
.
fromAccounts
({
accounts
:
makeDummyAccounts
(
nodeCount
),
secure
:
true
,
})
})
for
(
let
i
=
0
;
i
<
nodeCount
;
i
+=
nodeCount
/
(
nodeCount
>
8
?
8
:
1
)
)
{
it
(
`should correctly update node #
${
i
}
`
,
async
()
=>
{
const
test
=
await
generator
.
makeAccountUpdateTest
(
i
,
{
nonce
:
1234
,
balance
:
5678
,
codeHash
:
NON_NULL_BYTES32
,
storageRoot
:
NON_NULL_BYTES32
,
})
expect
(
await
Lib_EthMerkleTrie
.
updateAccountState
(
test
.
address
,
test
.
account
,
test
.
accountTrieWitness
,
test
.
accountTrieRoot
)
).
to
.
equal
(
test
.
newAccountTrieRoot
)
})
}
})
}
})
})
packages/contracts/test/contracts/libraries/trie/Lib_MerkleTrie.spec.ts
View file @
aa67fe22
import
{
expect
}
from
'
../../../setup
'
/* External Imports */
import
{
ethers
}
from
'
@nomiclabs/buidler
'
import
{
Contract
}
from
'
ethers
'
/* Internal Imports */
import
{
Lib_MerkleTrie_TEST_JSON
}
from
'
../../../data
'
import
{
runJsonTest
}
from
'
../../../helpers
'
import
{
TrieTestGenerator
}
from
'
../../../helpers
'
const
NODE_COUNTS
=
[
1
,
2
,
128
,
256
,
512
,
1024
,
2048
,
4096
]
describe
(
'
Lib_MerkleTrie
'
,
()
=>
{
describe
(
'
JSON tests
'
,
()
=>
{
runJsonTest
(
'
TestLib_MerkleTrie
'
,
Lib_MerkleTrie_TEST_JSON
)
let
Lib_MerkleTrie
:
Contract
before
(
async
()
=>
{
Lib_MerkleTrie
=
await
(
await
ethers
.
getContractFactory
(
'
TestLib_MerkleTrie
'
)
).
deploy
()
})
describe
(
'
verifyInclusionProof
'
,
()
=>
{
for
(
const
nodeCount
of
NODE_COUNTS
)
{
describe
(
`inside a trie with
${
nodeCount
}
nodes`
,
()
=>
{
let
generator
:
TrieTestGenerator
before
(
async
()
=>
{
generator
=
await
TrieTestGenerator
.
fromRandom
({
seed
:
`seed.incluson.
${
nodeCount
}
`
,
nodeCount
,
secure
:
false
,
})
})
for
(
let
i
=
0
;
i
<
nodeCount
;
i
+=
nodeCount
/
(
nodeCount
>
8
?
8
:
1
)
)
{
it
(
`should correctly prove inclusion for node #
${
i
}
`
,
async
()
=>
{
const
test
=
await
generator
.
makeInclusionProofTest
(
i
)
expect
(
await
Lib_MerkleTrie
.
verifyInclusionProof
(
test
.
key
,
test
.
val
,
test
.
proof
,
test
.
root
)
).
to
.
equal
(
true
)
})
}
})
}
})
describe
(
'
update
'
,
()
=>
{
for
(
const
nodeCount
of
NODE_COUNTS
)
{
describe
(
`inside a trie with
${
nodeCount
}
nodes`
,
()
=>
{
let
generator
:
TrieTestGenerator
before
(
async
()
=>
{
generator
=
await
TrieTestGenerator
.
fromRandom
({
seed
:
`seed.update.
${
nodeCount
}
`
,
nodeCount
,
secure
:
false
,
})
})
for
(
let
i
=
0
;
i
<
nodeCount
;
i
+=
nodeCount
/
(
nodeCount
>
8
?
8
:
1
)
)
{
it
(
`should correctly update node #
${
i
}
`
,
async
()
=>
{
const
test
=
await
generator
.
makeNodeUpdateTest
(
i
,
'
0x1234123412341234
'
)
expect
(
await
Lib_MerkleTrie
.
update
(
test
.
key
,
test
.
val
,
test
.
proof
,
test
.
root
)
).
to
.
equal
(
test
.
newRoot
)
})
}
})
}
})
describe
(
'
get
'
,
()
=>
{
for
(
const
nodeCount
of
NODE_COUNTS
)
{
describe
(
`inside a trie with
${
nodeCount
}
nodes`
,
()
=>
{
let
generator
:
TrieTestGenerator
before
(
async
()
=>
{
generator
=
await
TrieTestGenerator
.
fromRandom
({
seed
:
`seed.get.
${
nodeCount
}
`
,
nodeCount
,
secure
:
false
,
})
})
for
(
let
i
=
0
;
i
<
nodeCount
;
i
+=
nodeCount
/
(
nodeCount
>
8
?
8
:
1
)
)
{
it
(
`should correctly get the value of node #
${
i
}
`
,
async
()
=>
{
const
test
=
await
generator
.
makeInclusionProofTest
(
i
)
expect
(
await
Lib_MerkleTrie
.
get
(
test
.
key
,
test
.
proof
,
test
.
root
)
).
to
.
deep
.
equal
([
true
,
test
.
val
])
})
}
})
}
})
})
packages/contracts/test/contracts/libraries/trie/Lib_SecureMerkleTrie.spec.ts
0 → 100644
View file @
aa67fe22
import
{
expect
}
from
'
../../../setup
'
/* External Imports */
import
{
ethers
}
from
'
@nomiclabs/buidler
'
import
{
Contract
}
from
'
ethers
'
/* Internal Imports */
import
{
TrieTestGenerator
}
from
'
../../../helpers
'
const
NODE_COUNTS
=
[
1
,
2
,
128
,
256
,
512
,
1024
,
2048
,
4096
]
describe
(
'
Lib_SecureMerkleTrie
'
,
()
=>
{
let
Lib_SecureMerkleTrie
:
Contract
before
(
async
()
=>
{
Lib_SecureMerkleTrie
=
await
(
await
ethers
.
getContractFactory
(
'
TestLib_SecureMerkleTrie
'
)
).
deploy
()
})
describe
(
'
verifyInclusionProof
'
,
()
=>
{
for
(
const
nodeCount
of
NODE_COUNTS
)
{
describe
(
`inside a trie with
${
nodeCount
}
nodes`
,
()
=>
{
let
generator
:
TrieTestGenerator
before
(
async
()
=>
{
generator
=
await
TrieTestGenerator
.
fromRandom
({
seed
:
`seed.incluson.
${
nodeCount
}
`
,
nodeCount
,
secure
:
true
,
})
})
for
(
let
i
=
0
;
i
<
nodeCount
;
i
+=
nodeCount
/
(
nodeCount
>
8
?
8
:
1
)
)
{
it
(
`should correctly prove inclusion for node #
${
i
}
`
,
async
()
=>
{
const
test
=
await
generator
.
makeInclusionProofTest
(
i
)
expect
(
await
Lib_SecureMerkleTrie
.
verifyInclusionProof
(
test
.
key
,
test
.
val
,
test
.
proof
,
test
.
root
)
).
to
.
equal
(
true
)
})
}
})
}
})
describe
(
'
update
'
,
()
=>
{
for
(
const
nodeCount
of
NODE_COUNTS
)
{
describe
(
`inside a trie with
${
nodeCount
}
nodes`
,
()
=>
{
let
generator
:
TrieTestGenerator
before
(
async
()
=>
{
generator
=
await
TrieTestGenerator
.
fromRandom
({
seed
:
`seed.update.
${
nodeCount
}
`
,
nodeCount
,
secure
:
true
,
})
})
for
(
let
i
=
0
;
i
<
nodeCount
;
i
+=
nodeCount
/
(
nodeCount
>
8
?
8
:
1
)
)
{
it
(
`should correctly update node #
${
i
}
`
,
async
()
=>
{
const
test
=
await
generator
.
makeNodeUpdateTest
(
i
,
'
0x1234123412341234
'
)
expect
(
await
Lib_SecureMerkleTrie
.
update
(
test
.
key
,
test
.
val
,
test
.
proof
,
test
.
root
)
).
to
.
equal
(
test
.
newRoot
)
})
}
})
}
})
describe
(
'
get
'
,
()
=>
{
for
(
const
nodeCount
of
NODE_COUNTS
)
{
describe
(
`inside a trie with
${
nodeCount
}
nodes`
,
()
=>
{
let
generator
:
TrieTestGenerator
before
(
async
()
=>
{
generator
=
await
TrieTestGenerator
.
fromRandom
({
seed
:
`seed.get.
${
nodeCount
}
`
,
nodeCount
,
secure
:
true
,
})
})
for
(
let
i
=
0
;
i
<
nodeCount
;
i
+=
nodeCount
/
(
nodeCount
>
8
?
8
:
1
)
)
{
it
(
`should correctly get the value of node #
${
i
}
`
,
async
()
=>
{
const
test
=
await
generator
.
makeInclusionProofTest
(
i
)
expect
(
await
Lib_SecureMerkleTrie
.
get
(
test
.
key
,
test
.
proof
,
test
.
root
)
).
to
.
deep
.
equal
([
true
,
test
.
val
])
})
}
})
}
})
})
packages/contracts/test/helpers/index.ts
View file @
aa67fe22
...
...
@@ -5,3 +5,4 @@ export * from './resolver'
export
*
from
'
./utils
'
export
*
from
'
./codec
'
export
*
from
'
./test-runner
'
export
*
from
'
./trie
'
packages/contracts/test/helpers/trie/index.ts
0 → 100644
View file @
aa67fe22
export
*
from
'
./trie-test-generator
'
packages/contracts/test/helpers/trie/trie-test-generator.ts
0 → 100644
View file @
aa67fe22
/* External Imports */
import
*
as
rlp
from
'
rlp
'
import
{
default
as
seedbytes
}
from
'
random-bytes-seed
'
import
{
SecureTrie
,
BaseTrie
}
from
'
merkle-patricia-tree
'
/* Internal Imports */
import
{
fromHexString
,
toHexString
}
from
'
../utils
'
import
{
NULL_BYTES32
}
from
'
../constants
'
export
interface
TrieNode
{
key
:
string
val
:
string
}
export
interface
InclusionProofTest
{
key
:
string
val
:
string
proof
:
string
root
:
string
}
export
interface
NodeUpdateTest
extends
InclusionProofTest
{
newRoot
:
string
}
export
interface
EthereumAccount
{
address
?:
string
nonce
:
number
balance
:
number
codeHash
:
string
storageRoot
?:
string
storage
?:
TrieNode
[]
}
export
interface
AccountProofTest
{
address
:
string
account
:
EthereumAccount
accountTrieWitness
:
string
accountTrieRoot
:
string
}
export
interface
AccountUpdateTest
extends
AccountProofTest
{
newAccountTrieRoot
:
string
}
const
rlpEncodeAccount
=
(
account
:
EthereumAccount
):
string
=>
{
return
toHexString
(
rlp
.
encode
([
account
.
nonce
,
account
.
balance
,
account
.
codeHash
||
NULL_BYTES32
,
account
.
storageRoot
||
NULL_BYTES32
,
])
)
}
const
rlpDecodeAccount
=
(
encoded
:
string
):
EthereumAccount
=>
{
const
decoded
=
rlp
.
decode
(
fromHexString
(
encoded
))
as
any
return
{
nonce
:
decoded
[
0
].
length
?
parseInt
(
decoded
[
0
],
16
)
:
0
,
balance
:
decoded
[
1
].
length
?
parseInt
(
decoded
[
1
],
16
)
:
0
,
storageRoot
:
decoded
[
2
].
length
?
toHexString
(
decoded
[
2
])
:
NULL_BYTES32
,
codeHash
:
decoded
[
3
].
length
?
toHexString
(
decoded
[
3
])
:
NULL_BYTES32
,
}
}
const
makeTrie
=
async
(
nodes
:
TrieNode
[],
secure
?:
boolean
):
Promise
<
{
trie
:
SecureTrie
|
BaseTrie
TrieClass
:
any
}
>
=>
{
const
TrieClass
=
secure
?
SecureTrie
:
BaseTrie
const
trie
=
new
TrieClass
()
for
(
const
node
of
nodes
)
{
await
trie
.
put
(
fromHexString
(
node
.
key
),
fromHexString
(
node
.
val
))
}
return
{
trie
,
TrieClass
,
}
}
export
class
TrieTestGenerator
{
constructor
(
public
_TrieClass
:
any
,
public
_trie
:
SecureTrie
|
BaseTrie
,
public
_nodes
:
TrieNode
[],
public
_subGenerators
?:
TrieTestGenerator
[]
)
{}
static
async
fromNodes
(
opts
:
{
nodes
:
TrieNode
[]
secure
?:
boolean
}):
Promise
<
TrieTestGenerator
>
{
const
{
trie
,
TrieClass
}
=
await
makeTrie
(
opts
.
nodes
,
opts
.
secure
)
return
new
TrieTestGenerator
(
TrieClass
,
trie
,
opts
.
nodes
)
}
static
async
fromRandom
(
opts
:
{
seed
:
string
nodeCount
:
number
secure
?:
boolean
keySize
?:
number
valSize
?:
number
}):
Promise
<
TrieTestGenerator
>
{
const
getRandomBytes
=
seedbytes
(
opts
.
seed
)
const
nodes
:
TrieNode
[]
=
[...
Array
(
opts
.
nodeCount
)].
map
(()
=>
{
return
{
key
:
toHexString
(
getRandomBytes
(
opts
.
keySize
||
32
)),
val
:
toHexString
(
getRandomBytes
(
opts
.
valSize
||
32
)),
}
})
return
TrieTestGenerator
.
fromNodes
({
nodes
,
secure
:
opts
.
secure
,
})
}
static
async
fromAccounts
(
opts
:
{
accounts
:
EthereumAccount
[]
secure
?:
boolean
}):
Promise
<
TrieTestGenerator
>
{
const
subGenerators
:
TrieTestGenerator
[]
=
[]
for
(
const
account
of
opts
.
accounts
)
{
if
(
account
.
storage
)
{
const
subGenerator
=
await
TrieTestGenerator
.
fromNodes
({
nodes
:
account
.
storage
,
secure
:
opts
.
secure
,
})
account
.
storageRoot
=
toHexString
(
subGenerator
.
_trie
.
root
)
subGenerators
.
push
(
subGenerator
)
}
}
const
nodes
=
opts
.
accounts
.
map
((
account
)
=>
{
return
{
key
:
account
.
address
,
val
:
rlpEncodeAccount
(
account
),
}
})
const
{
trie
,
TrieClass
}
=
await
makeTrie
(
nodes
,
opts
.
secure
)
return
new
TrieTestGenerator
(
TrieClass
,
trie
,
nodes
,
subGenerators
)
}
public
async
makeInclusionProofTest
(
key
:
string
|
number
):
Promise
<
InclusionProofTest
>
{
if
(
typeof
key
===
'
number
'
)
{
key
=
this
.
_nodes
[
key
].
key
}
const
trie
=
this
.
_trie
.
copy
()
const
proof
=
await
this
.
prove
(
key
)
const
val
=
await
trie
.
get
(
fromHexString
(
key
))
return
{
proof
:
toHexString
(
rlp
.
encode
(
proof
)),
key
:
toHexString
(
key
),
val
:
toHexString
(
val
),
root
:
toHexString
(
trie
.
root
),
}
}
public
async
makeAllInclusionProofTests
():
Promise
<
InclusionProofTest
[]
>
{
return
Promise
.
all
(
this
.
_nodes
.
map
(
async
(
node
)
=>
{
return
this
.
makeInclusionProofTest
(
node
.
key
)
})
)
}
public
async
makeNodeUpdateTest
(
key
:
string
|
number
,
val
:
string
):
Promise
<
NodeUpdateTest
>
{
if
(
typeof
key
===
'
number
'
)
{
key
=
this
.
_nodes
[
key
].
key
}
const
trie
=
this
.
_trie
.
copy
()
const
proof
=
await
this
.
prove
(
key
)
const
oldRoot
=
trie
.
root
await
trie
.
put
(
fromHexString
(
key
),
fromHexString
(
val
))
const
newRoot
=
trie
.
root
return
{
proof
:
toHexString
(
rlp
.
encode
(
proof
)),
key
:
toHexString
(
key
),
val
:
toHexString
(
val
),
root
:
toHexString
(
oldRoot
),
newRoot
:
toHexString
(
newRoot
),
}
}
public
async
makeAccountProofTest
(
address
:
string
|
number
):
Promise
<
AccountProofTest
>
{
if
(
typeof
address
===
'
number
'
)
{
address
=
this
.
_nodes
[
address
].
key
}
const
trie
=
this
.
_trie
.
copy
()
const
proof
=
await
this
.
prove
(
address
)
const
account
=
await
trie
.
get
(
fromHexString
(
address
))
return
{
address
,
account
:
rlpDecodeAccount
(
toHexString
(
account
)),
accountTrieWitness
:
toHexString
(
rlp
.
encode
(
proof
)),
accountTrieRoot
:
toHexString
(
trie
.
root
),
}
}
public
async
makeAccountUpdateTest
(
address
:
string
|
number
,
account
:
EthereumAccount
):
Promise
<
AccountUpdateTest
>
{
if
(
typeof
address
===
'
number
'
)
{
address
=
this
.
_nodes
[
address
].
key
}
const
trie
=
this
.
_trie
.
copy
()
const
proof
=
await
this
.
prove
(
address
)
const
oldRoot
=
trie
.
root
await
trie
.
put
(
fromHexString
(
address
),
fromHexString
(
rlpEncodeAccount
(
account
))
)
const
newRoot
=
trie
.
root
return
{
address
,
account
,
accountTrieWitness
:
toHexString
(
rlp
.
encode
(
proof
)),
accountTrieRoot
:
toHexString
(
oldRoot
),
newAccountTrieRoot
:
toHexString
(
newRoot
),
}
}
private
async
prove
(
key
:
string
):
Promise
<
any
>
{
return
this
.
_TrieClass
.
prove
(
this
.
_trie
,
fromHexString
(
key
))
}
}
packages/contracts/yarn.lock
View file @
aa67fe22
...
...
@@ -39,7 +39,7 @@
resolved "https://registry.yarnpkg.com/@ensdomains/resolver/-/resolver-0.2.4.tgz#c10fe28bf5efbf49bff4666d909aed0265efbc89"
integrity sha512-bvaTH34PMCbv6anRa9I/0zjLJgY4EuznbEMgbV77JBCQ9KNC46rzi0avuxpOfu+xDjPEtSFGqVEOr5GlUSGudA==
"@eth-optimism/smock@^0.
1.0
":
"@eth-optimism/smock@^0.
0.1
":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@eth-optimism/smock/-/smock-0.0.1.tgz#8ea7379072eccfe5cac327e7eb78384f0e38b18c"
integrity sha512-lJmdXaDkAQ7Y2T9GfEzrhF6lrJ3WiEb8HJyDBjr2r3Cd4/0b2RAQj4kqkKLFZyGDMnAZ0O+XnTTyaKhBXkDSXw==
...
...
@@ -793,6 +793,17 @@ abstract-leveldown@^5.0.0, abstract-leveldown@~5.0.0:
dependencies:
xtend "~4.0.0"
abstract-leveldown@^6.2.1:
version "6.3.0"
resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz#d25221d1e6612f820c35963ba4bd739928f6026a"
integrity sha512-TU5nlYgta8YrBMNpc9FwQzRbiXsj49gsALsXadbGHt9CROPzX5fB0rWDR5mtdpOOKa5XqRFpbj1QroPAoPzVjQ==
dependencies:
buffer "^5.5.0"
immediate "^3.2.3"
level-concat-iterator "~2.0.0"
level-supports "~1.0.0"
xtend "~4.0.0"
abstract-leveldown@~2.6.0:
version "2.6.3"
resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-2.6.3.tgz#1c5e8c6a5ef965ae8c35dfb3a8770c476b82c4b8"
...
...
@@ -800,6 +811,17 @@ abstract-leveldown@~2.6.0:
dependencies:
xtend "~4.0.0"
abstract-leveldown@~6.2.1:
version "6.2.3"
resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz#036543d87e3710f2528e47040bc3261b77a9a8eb"
integrity sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==
dependencies:
buffer "^5.5.0"
immediate "^3.2.3"
level-concat-iterator "~2.0.0"
level-supports "~1.0.0"
xtend "~4.0.0"
accepts@~1.3.7:
version "1.3.7"
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd"
...
...
@@ -2549,6 +2571,14 @@ deferred-leveldown@~4.0.0:
abstract-leveldown "~5.0.0"
inherits "^2.0.3"
deferred-leveldown@~5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz#27a997ad95408b61161aa69bd489b86c71b78058"
integrity sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw==
dependencies:
abstract-leveldown "~6.2.1"
inherits "^2.0.3"
define-properties@^1.1.2, define-properties@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1"
...
...
@@ -2724,6 +2754,16 @@ encoding-down@5.0.4, encoding-down@~5.0.0:
level-errors "^2.0.0"
xtend "^4.0.1"
encoding-down@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/encoding-down/-/encoding-down-6.3.0.tgz#b1c4eb0e1728c146ecaef8e32963c549e76d082b"
integrity sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw==
dependencies:
abstract-leveldown "^6.2.1"
inherits "^2.0.3"
level-codec "^9.0.0"
level-errors "^2.0.0"
encoding@^0.1.11:
version "0.1.13"
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9"
...
...
@@ -3234,7 +3274,7 @@ ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumjs-util@^5.1.1, ethereum
rlp "^2.0.0"
safe-buffer "^5.1.1"
ethereumjs-util@^7.0.2:
ethereumjs-util@^7.0.
0, ethereumjs-util@^7.0.
2:
version "7.0.5"
resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.0.5.tgz#bc6e178dedbccc4b188c9ae6ae38db1906884b7b"
integrity sha512-gLLZVXYUHR6pamO3h/+M1jzKz7qE20PKFyFKtq1PrIHA6wcLI96mDz96EMkkhXfrpk30rhpkw0iRnzxKhqaIdQ==
...
...
@@ -4917,6 +4957,11 @@ level-codec@~7.0.0:
resolved "https://registry.yarnpkg.com/level-codec/-/level-codec-7.0.1.tgz#341f22f907ce0f16763f24bddd681e395a0fb8a7"
integrity sha512-Ua/R9B9r3RasXdRmOtd+t9TCOEIIlts+TN/7XTT2unhDaL6sJn83S3rUyljbr6lVtw49N3/yA0HHjpV6Kzb2aQ==
level-concat-iterator@~2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz#1d1009cf108340252cb38c51f9727311193e6263"
integrity sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==
level-errors@^1.0.3:
version "1.1.2"
resolved "https://registry.yarnpkg.com/level-errors/-/level-errors-1.1.2.tgz#4399c2f3d3ab87d0625f7e3676e2d807deff404d"
...
...
@@ -4966,6 +5011,15 @@ level-iterator-stream@~3.0.0:
readable-stream "^2.3.6"
xtend "^4.0.0"
level-iterator-stream@~4.0.0:
version "4.0.2"
resolved "https://registry.yarnpkg.com/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz#7ceba69b713b0d7e22fcc0d1f128ccdc8a24f79c"
integrity sha512-ZSthfEqzGSOMWoUGhTXdX9jv26d32XJuHz/5YnuHZzH6wldfWMOVwI9TBtKcya4BKTyTt3XVA0A3cF3q5CY30Q==
dependencies:
inherits "^2.0.4"
readable-stream "^3.4.0"
xtend "^4.0.2"
level-mem@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/level-mem/-/level-mem-3.0.1.tgz#7ce8cf256eac40f716eb6489654726247f5a89e5"
...
...
@@ -4974,6 +5028,22 @@ level-mem@^3.0.1:
level-packager "~4.0.0"
memdown "~3.0.0"
level-mem@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/level-mem/-/level-mem-5.0.1.tgz#c345126b74f5b8aa376dc77d36813a177ef8251d"
integrity sha512-qd+qUJHXsGSFoHTziptAKXoLX87QjR7v2KMbqncDXPxQuCdsQlzmyX+gwrEHhlzn08vkf8TyipYyMmiC6Gobzg==
dependencies:
level-packager "^5.0.3"
memdown "^5.0.0"
level-packager@^5.0.3:
version "5.1.1"
resolved "https://registry.yarnpkg.com/level-packager/-/level-packager-5.1.1.tgz#323ec842d6babe7336f70299c14df2e329c18939"
integrity sha512-HMwMaQPlTC1IlcwT3+swhqf/NUO+ZhXVz6TY1zZIIZlIR0YSn8GtAAWmIvKjNY16ZkEg/JcpAuQskxsXqC0yOQ==
dependencies:
encoding-down "^6.3.0"
levelup "^4.3.2"
level-packager@~4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/level-packager/-/level-packager-4.0.1.tgz#7e7d3016af005be0869bc5fa8de93d2a7f56ffe6"
...
...
@@ -5005,6 +5075,13 @@ level-sublevel@6.6.4:
typewiselite "~1.0.0"
xtend "~4.0.0"
level-supports@~1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/level-supports/-/level-supports-1.0.1.tgz#2f530a596834c7301622521988e2c36bb77d122d"
integrity sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==
dependencies:
xtend "^4.0.2"
level-ws@0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/level-ws/-/level-ws-0.0.0.tgz#372e512177924a00424b0b43aef2bb42496d228b"
...
...
@@ -5022,6 +5099,15 @@ level-ws@^1.0.0:
readable-stream "^2.2.8"
xtend "^4.0.1"
level-ws@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/level-ws/-/level-ws-2.0.0.tgz#207a07bcd0164a0ec5d62c304b4615c54436d339"
integrity sha512-1iv7VXx0G9ec1isqQZ7y5LmoZo/ewAsyDHNA8EFDW5hqH2Kqovm33nSFkSdnLLAK+I5FlT+lo5Cw9itGe+CpQA==
dependencies:
inherits "^2.0.3"
readable-stream "^3.1.0"
xtend "^4.0.1"
levelup@3.1.1, levelup@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/levelup/-/levelup-3.1.1.tgz#c2c0b3be2b4dc316647c53b42e2f559e232d2189"
...
...
@@ -5045,6 +5131,17 @@ levelup@^1.2.1:
semver "~5.4.1"
xtend "~4.0.0"
levelup@^4.3.2:
version "4.4.0"
resolved "https://registry.yarnpkg.com/levelup/-/levelup-4.4.0.tgz#f89da3a228c38deb49c48f88a70fb71f01cafed6"
integrity sha512-94++VFO3qN95cM/d6eBXvd894oJE0w3cInq9USsyQzzoJxmiYzPAocNcuGCPGGjoXqDVJcr3C1jzt1TSjyaiLQ==
dependencies:
deferred-leveldown "~5.3.0"
level-errors "~2.0.0"
level-iterator-stream "~4.0.0"
level-supports "~1.0.0"
xtend "~4.0.0"
lines-and-columns@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
...
...
@@ -5231,6 +5328,18 @@ memdown@^1.0.0:
ltgt "~2.2.0"
safe-buffer "~5.1.1"
memdown@^5.0.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/memdown/-/memdown-5.1.0.tgz#608e91a9f10f37f5b5fe767667a8674129a833cb"
integrity sha512-B3J+UizMRAlEArDjWHTMmadet+UKwHd3UjMgGBkZcKAxAYVPS9o0Yeiha4qvz7iGiL2Sb3igUft6p7nbFWctpw==
dependencies:
abstract-leveldown "~6.2.1"
functional-red-black-tree "~1.0.1"
immediate "~3.2.3"
inherits "~2.0.1"
ltgt "~2.2.0"
safe-buffer "~5.2.0"
memdown@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/memdown/-/memdown-3.0.0.tgz#93aca055d743b20efc37492e9e399784f2958309"
...
...
@@ -5280,6 +5389,17 @@ merkle-patricia-tree@^3.0.0:
rlp "^2.0.0"
semaphore ">=1.0.1"
"merkle-patricia-tree@git+https://github.com/kfichter/merkle-patricia-tree":
version "3.0.0"
resolved "git+https://github.com/kfichter/merkle-patricia-tree#ebd10c405be8ae909f1f82dea275a0e9ec1c8e46"
dependencies:
ethereumjs-util "^7.0.0"
level-mem "^5.0.1"
level-ws "^2.0.0"
readable-stream "^3.6.0"
rlp "^2.2.4"
semaphore-async-await "^1.5.1"
methods@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
...
...
@@ -6263,6 +6383,11 @@ querystring@0.2.0:
resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620"
integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=
random-bytes-seed@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/random-bytes-seed/-/random-bytes-seed-1.0.3.tgz#126f1201dba2ec70cd0784f94a810396cad24a15"
integrity sha512-O+eniMt8Sj2iAn2q1x5VEirS/XvbtwYcXNDbOAcRtGN+OhC48cmzS5ksf9qEHRVKC1I8A4qzjucNVElddofB0A==
randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.0.6, randombytes@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
...
...
@@ -6343,7 +6468,7 @@ readable-stream@^2.0.0, readable-stream@^2.0.5, readable-stream@^2.2.2, readable
string_decoder "~1.1.1"
util-deprecate "~1.0.1"
readable-stream@^3.0.6, readable-stream@^3.6.0:
readable-stream@^3.0.6, readable-stream@^3.
1.0, readable-stream@^3.4.0, readable-stream@^3.
6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198"
integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==
...
...
@@ -6546,7 +6671,7 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
hash-base "^3.0.0"
inherits "^2.0.1"
rlp@^2.0.0, rlp@^2.2.1, rlp@^2.2.2, rlp@^2.2.3, rlp@^2.2.4:
rlp@^2.0.0, rlp@^2.2.1, rlp@^2.2.2, rlp@^2.2.3, rlp@^2.2.4
, rlp@^2.2.6
:
version "2.2.6"
resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.6.tgz#c80ba6266ac7a483ef1e69e8e2f056656de2fb2c"
integrity sha512-HAfAmL6SDYNWPUOJNrM500x4Thn4PZsEy5pijPh40U9WfNk0z15hUYzO9xVIMAdIHdFtD8CBDHd75Td1g36Mjg==
...
...
@@ -6613,6 +6738,11 @@ seedrandom@3.0.1:
resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-3.0.1.tgz#eb3dde015bcf55df05a233514e5df44ef9dce083"
integrity sha512-1/02Y/rUeU1CJBAGLebiC5Lbo5FnB22gQbIFFYTLkwvp1xdABZJH1sn4ZT1MzXmPpzv+Rf/Lu2NcsLJiK4rcDg==
seedrandom@^3.0.5:
version "3.0.5"
resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-3.0.5.tgz#54edc85c95222525b0c7a6f6b3543d8e0b3aa0a7"
integrity sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==
seek-bzip@^1.0.5:
version "1.0.6"
resolved "https://registry.yarnpkg.com/seek-bzip/-/seek-bzip-1.0.6.tgz#35c4171f55a680916b52a07859ecf3b5857f21c4"
...
...
@@ -6620,6 +6750,11 @@ seek-bzip@^1.0.5:
dependencies:
commander "^2.8.1"
semaphore-async-await@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/semaphore-async-await/-/semaphore-async-await-1.5.1.tgz#857bef5e3644601ca4b9570b87e9df5ca12974fa"
integrity sha1-hXvvXjZEYBykuVcLh+nfXKEpdPo=
semaphore@>=1.0.1, semaphore@^1.0.3, semaphore@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/semaphore/-/semaphore-1.1.0.tgz#aaad8b86b20fe8e9b32b16dc2ee682a8cd26a8aa"
...
...
@@ -8118,7 +8253,7 @@ xhr@^2.0.4, xhr@^2.2.0, xhr@^2.3.3:
parse-headers "^2.0.0"
xtend "^4.0.0"
xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0, xtend@~4.0.1:
xtend@^4.0.0, xtend@^4.0.1, xtend@
^4.0.2, xtend@
~4.0.0, xtend@~4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==
...
...
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