Private contract migration and offchain state sync (#10748)

* Temp storage for the private state added

* Temp storage for the private state added

* Request message added

* Store and retrieve offchain state logic

* State sync cache

* Private state column added to key value db

* Private state column added to key value db

* Indexing stored states via its hash

* Works with errors changed

* Private state stored into the local db

* Access to private state db added to sync io

* Private state db file added

* Rlp packets for retrieiving private state data added

* Handling of private sync completed message

* Test code fixed

* External flag for offchain storing added

* Test for private state sync added

* Saving private state logic corrected

* Migration code corrected

* Fixes after merge with master

* Merge with head

* Additional checks for slices

* Log for private state retrieval added

* Limit time of retrieving private states

* Store required hashes for every request, mark them stale if needed

* Store requested private state hashes and check received data

* Log stale requests

* State insertion fix

* Refactoring of how logging passed to state store

* Heapsize removed, syncing hashes structure reworked

* Check state length returned by contract

* Get rid of OverlayDB

* hash-db version updated

* Test fixed

* One more test fixed
This commit is contained in:
Anton Gavrilov
2019-08-16 14:45:52 +02:00
committed by GitHub
parent bd1a578f93
commit 66e4410be7
32 changed files with 990 additions and 141 deletions

View File

@@ -357,6 +357,10 @@ usage! {
"--private-tx-enabled",
"Enable private transactions.",
FLAG flag_private_state_offchain: (bool) = false, or |c: &Config| c.private_tx.as_ref()?.state_offchain,
"--private-state-offchain",
"Store private state offchain (in the local DB).",
ARG arg_private_signer: (Option<String>) = None, or |c: &Config| c.private_tx.as_ref()?.signer.clone(),
"--private-signer=[ACCOUNT]",
"Specify the account for signing public transaction created upon verified private transaction.",
@@ -1200,6 +1204,7 @@ struct Account {
#[serde(deny_unknown_fields)]
struct PrivateTransactions {
enabled: Option<bool>,
state_offchain: Option<bool>,
signer: Option<String>,
validators: Option<Vec<String>>,
account: Option<String>,
@@ -1766,6 +1771,7 @@ mod tests {
// -- Private Transactions Options
flag_private_enabled: true,
flag_private_state_offchain: false,
arg_private_signer: Some("0xdeadbeefcafe0000000000000000000000000000".into()),
arg_private_validators: Some("0xdeadbeefcafe0000000000000000000000000000".into()),
arg_private_passwords: Some("~/.safe/password.file".into()),