eth-ipfs-state-validator/README.md

64 lines
2.8 KiB
Markdown
Raw Permalink Normal View History

2020-06-25 20:11:39 +00:00
# eth-ipfs-state-validator
[![Go Report Card](https://goreportcard.com/badge/github.com/cerc-io/eth-ipfs-state-validator)](https://goreportcard.com/report/github.com/cerc-io/eth-ipfs-state-validator)
2020-07-01 19:14:01 +00:00
> Uses [ipfs-ethdb](https://github.com/cerc-io/ipfs-ethdb/tree/master/postgres) to validate completeness of IPFS Ethereum state data
2020-06-25 20:11:39 +00:00
2020-06-26 18:11:49 +00:00
## Background
2020-06-29 21:07:28 +00:00
State data on Ethereum takes the form of [Modified Merkle Patricia Tries](https://eth.wiki/en/fundamentals/patricia-tree).
On disk each unique node of a trie is stored as a key-value pair between the Keccak256 hash of the RLP-encoded node and the RLP-encoded node.
2020-06-26 18:11:49 +00:00
To prove the existence of a specific node in an MMPT with a known root hash, one provides a list of all of the nodes along the path descending
from the root node to the node in question. To validate the completeness of a state database- to confirm every node for a state and/or storage trie(s) is present
in a database- requires traversing the entire trie (or linked set of tries) and confirming the presence of every node in the database.
2020-06-25 20:11:39 +00:00
## Usage
2020-06-26 18:11:49 +00:00
`full` validates completeness of the entire state corresponding to a provided state root, including both state and storage tries
2020-07-13 00:57:47 +00:00
`./eth-ipfs-state-validator validateTrie --ipfs-path={path to ipfs repo} --type=full --state-root={state root hex string}`
2020-06-26 18:11:49 +00:00
`state` validates completeness of the state trie corresponding to a provided state root, excluding the storage tries
2020-07-13 00:57:47 +00:00
`./eth-ipfs-state-validator validateTrie --ipfs-path={path to ipfs repo} --type=state --state-root={state root hex string}`
2020-06-26 18:11:49 +00:00
2020-06-25 20:11:39 +00:00
2020-06-26 18:11:49 +00:00
`storage` validates completeness of only the storage trie corresponding to a provided storage root and contract address
2020-07-13 00:57:47 +00:00
`./eth-ipfs-state-validator validateTrie --ipfs-path={path to ipfs repo} --type=storage --storage-root={state root hex string} --address={contract address hex string}`
2020-06-26 18:11:49 +00:00
2020-07-13 00:57:47 +00:00
If an IPFS path is provided with the `--ipfs-path` flag, the validator operates through an IPFS block-service and expects a configured IPFS repository at
the provided path. In this case, the validator will vie for contention on the lockfile located at the ipfs path.
Alternatively, if no IPFS path is provided, the `--config` flag can be used to provide a path to a .toml config file with
Postgres database connection parameters. In this case, the validator interfaces directly with the Postgres database and the
database is assumed to be [IPFS-backing](https://github.com/ipfs/go-ds-sql).
Postgres DB config:
2020-06-25 20:11:39 +00:00
```toml
[database]
name = "cerc_public"
2020-06-25 20:11:39 +00:00
hostname = "localhost"
user = "postgres"
password = ""
port = 5432
2020-06-26 18:11:49 +00:00
```
## Maintainers
@cerc-io
2020-06-26 18:11:49 +00:00
@AFDudley
@i-norden
## Contributing
Contributions are welcome!
VulcanizeDB follows the [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/1/4/code-of-conduct).
## License
[AGPL-3.0](LICENSE) © Vulcanize Inc