Commit Graph

53 Commits

Author SHA1 Message Date
Marek Kotewicz ef4a61c769
new ethabi (#9511)
* new ethabi migration in progress

* parity migrated to new ethabi

* migrated secred-store to new ethabi

* bump ethabi to 6.0

* fixed review suggestions
2018-09-13 11:04:39 +02:00
David 72fd1fa58d
Fetch `parity-common` crates from crates.io (#9410)
* Fetch `parity-common` crates from crates.io

* Add doc tests from `patricia-trie` to `patricia-trie-ethereum`
Fix/update a few deps

* [ethkey] upgrade ethereum-types

* [whisper] update deps

* [network] deps

* [network-devp2p] deps

* [journaldb] deps

* [fastmap] deps

* [miner] deps and test fixes

* [machine] deps

* [json] deps

* [hw] deps

* [ethash] deps

* [registrar] deps

* Update a few more dependencies with new ethabi-*

* [updater] Update deps

* deps

* [ethcore] Update deps

* Use new parity-snappy and parity-rocksdb crates

* Updated submodules

* Use parity-snappy 0.1

* Use kvdb-rocksdb 0.1.2

* Don't use latest ethereum/tests

* Fix merge conflicts errors

* Remove superseeded comment

* Address grumbles: add newlines, add/remove spaces
2018-09-04 20:13:51 +02:00
Wei Tang a6df452841
Implement EIP234 block_hash for eth_getLogs (#9256)
* Implement EIP234

* Make filter conversion returns error if both blockHash and from/toBlock is found

This also changes PollFilter to store the EthFilter type, instead of the jsonrpc one, saving repeated conversion.

* Return error if block filtering target is not found in eth_getLogs

Use the old behavior (unwrap_or_default) for anywhere else.

* fix test: secret_store

* Fix weird indentation

* Make client log filter return error in case a block cannot be found

* Return blockId error in rpc

* test_client: allow return error on logs

* Add a mocked test for eth_getLogs error

* fix: should return error if from_block/to_block greater than best block number

* Add notes on pending

* Add comment for UNSUPPORTED_REQUEST

* Address grumbles

* Return err if from > to
2018-08-13 15:47:10 +08:00
Svyatoslav Nikolsky 6f758bc7b1
SecretStore: service pack 1 (#8435)
* SecretStore: error unify initial commit

SecretStore: pass real error in error messages

SecretStore: is_internal_error -> Error::is_non_fatal

warnings

SecretStore: ConsensusTemporaryUnreachable

fix after merge

removed comments

removed comments

SecretStore: updated HTTP error responses

SecretStore: more ConsensusTemporaryUnreachable tests

fix after rebase

* SecretStore: unified SS contract config options && read

* SecretStore: service pack

SecretStore: service pack (continue)

* fixed grumbles
2018-06-14 10:01:52 +03:00
Niklas Adolfsson 98b7c07171 Update `license header` and `scripts` (#8666)
* Update `add_license` script

* run script

* add `remove duplicate lines script` and run it

* Revert changes `English spaces`

* strip whitespaces

* Revert `GPL` in files with `apache/mit license`

* don't append `gpl license` in files with other lic

* Don't append `gpl header` in files with other lic.

* re-ran script

* include c and cpp files too

* remove duplicate header

* rebase nit
2018-06-04 10:19:50 +02:00
Wei Tang 528497b86a Keep all enacted blocks notify in order (#8524)
* Keep all enacted blocks notify in order

* Collect is unnecessary

* Update ChainNotify to use ChainRouteType

* Fix all ethcore fn defs

* Wrap the type within ChainRoute

* Fix private-tx and sync api

* Fix secret_store API

* Fix updater API

* Fix rpc api

* Fix informant api

* Eagerly cache enacted/retracted and remove contain_enacted/retracted

* Fix indent

* tests: should use full expr form for struct constructor

* Use into_enacted_retracted to further avoid copy

* typo: not a function

* rpc/tests: ChainRoute -> ChainRoute::new
2018-05-07 12:58:25 +02:00
Svyatoslav Nikolsky d1f5284fe6 SecretStore: merge two types of errors into single one + Error::is_non_fatal (#8357)
* SecretStore: error unify initial commit

SecretStore: pass real error in error messages

SecretStore: is_internal_error -> Error::is_non_fatal

warnings

SecretStore: ConsensusTemporaryUnreachable

fix after merge

removed comments

removed comments

SecretStore: updated HTTP error responses

SecretStore: more ConsensusTemporaryUnreachable tests

fix after rebase

* fixed grumbles

* use HashSet in tests
2018-05-01 15:02:14 +02:00
Niklas Adolfsson e36c4ecc98 `duration_ns: u64 -> duration: Duration` (#8457)
* duration_ns: u64 -> duration: Duration

* format on millis {:.2} -> {}
2018-04-27 15:04:27 +02:00
Wei Tang f6998cb04e Use tokio::spawn in secret_store listener and fix Uri (#8373)
* Directly wait for future to resolve in a threadpool

* Ignore return value

* Use path.starts_with instead of req_uri.is_absolute

The later now means something else in hyper 0.11..

* Use tokio::spawn

* typo: remove accidential unsafe impl
2018-04-13 21:15:33 +02:00
Wei Tang 99e37844fd Use async hyper server in secret_store and upgrade igd (#8359)
* Update secret_store hyper dep to 0.11

* Upgrade igd to 0.7

* typo: spawn
2018-04-10 19:25:27 +02:00
Svyatoslav Nikolsky 0d75d01c84 SecretStore: get rid of engine.signer dependency (#8173)
* SecretStore: get rid of engine.signer dependency

* SecretStore: fixed self for transact_contract

* SecretStore: fixed pending requests + 1-of-1 sessions completion

* SecretStore: fixed completion signal in 1-of-1 case

* fixed test(s)

* removed obsolete TODO && redundant statement

* ok_or -> ok_or_else
2018-04-09 16:38:59 +02:00
Wei Tang d7a7f034db Read registry_address from block with REQUEST_CONFIRMATIONS_REQUIRED (#8309)
* Read registry_address from block with REQUEST_CONFIRMATIONS_REQUIRED

* Require confirmation blocks in key_server_set

* Add license preamble

* TODO item for constant confirmation required number

* Change license year in helpers.rs to 2015-2018
2018-04-06 12:03:13 +02:00
Svyatoslav Nikolsky ec96091369 SecretStore: generating and retrieving decryption keys via service contract (#8029)
* SecretStore: started document keys generation via contract

* fixed Cargo.lock

* SecretStore: doc key contract gen tests

* SecretStore: fixed log parsing

* SecretStore: flush

* SecretStore: secretstore_generateDocumentKey RPC

* SecretStore: return encrypted_key from secretstore_generateDocumentKey

* prepare to GenerateDocKey -> StoreDocKey

* SecretStore: ability to identify requester via Public/Address

* SecretStore: store author address instead of public in db

* flush

* SecretStore: flush

* SecretStore: fixed test

* SecretStore: flush

* SecretStore: flush

* SecretStore: flush

* SecretStore: flush

* SecretStore: start async generation session

* SecretStore: process StoreDocumentKey service tasks

* SecretStore: flush

* SecretStore: update service contact ABI

* SecretStore: flush

* SecretStore: flush

* SecretStore: fixed event

* SecretStore: flush

* SecretStore: fixed tests

* SecretStore: fix broadcast shadows decryption

* SecretStore: finally decryption via service contract works

* SecretStore: fix for updated contract

* SecretStore: restored pending requests reqding

* SecretStore: fixed some TODOs

* SecretStore: OnChainServiceContractAggregate

* SecretStore: different names for different contracts types

* SecretStore: updated contracts interfaces

* SecretStore: utilize aggregate service contract

* fixed compilation

* SecretStore: fixes for updated contract

* SecretStore: service fixes after testing

* fixed cli test compilation

* SecretStore: decryption_session_origin_is_known_to_all_initialized_nodes

* SecretStore: added new contract listener tests

* SecretStore: session_listener_works

* removed optional TODO

* SecretStore: fixed KeyServer shutdown

* fixed warn + grumble

* const durations
2018-04-03 16:54:34 +02:00
Dmitry Kashitsyn 9d7d6f7108 `Client` refactoring (#7038)
* Improves `BestBlock` comment

* Improves `TraceDB` comment

* Improves `journaldb::Algorithm` comment.

Probably the whole enum should be renamed to `Strategy` or something alike.

* Comments some of the `Client`'s fields

* Deglobs client imports

* Fixes comments

* Extracts `import_lock` to `Importer` struct

* Extracts `verifier` to `Importer` struct

* Extracts `block_queue` to `Importer` struct

* Extracts `miner` to `Importer` struct

* Extracts `ancient_verifier` to `Importer` struct

* Extracts `rng` to `Importer` struct

* Extracts `import_old_block` to `Importer` struct

* Adds `Nonce` trait

* Adds `Balance` trait

* Adds `ChainInfo` trait

* Fixes imports for tests using `chain_info` method

* Adds `BlockInfo` trait

* Adds more `ChainInfo` imports

* Adds `BlockInfo` imports

* Adds `ReopenBlock` trait

* Adds `PrepareOpenBlock` trait

* Fixes import in tests

* Adds `CallContract` trait

* Fixes imports in tests using `call_contract` method

* Adds `TransactionInfo` trait

* Adds `RegistryInfo` trait

* Fixes imports in tests using `registry_address` method

* Adds `ScheduleInfo` trait

* Adds `ImportSealedBlock` trait

* Fixes imports in test using `import_sealed_block` method

* Adds `BroadcastProposalBlock` trait

* Migrates `Miner` to static dispatch

* Fixes tests

* Moves `calculate_enacted_retracted` to `Importer`

* Moves import-related methods to `Importer`

* Removes redundant `import_old_block` wrapper

* Extracts `import_block*` into separate trait

* Fixes tests

* Handles `Pending` in `LightFetch`

* Handles `Pending` in filters

* Handles `Pending` in `ParityClient`

* Handles `Pending` in `EthClient`

* Removes `BlockId::Pending`, partly refactors dependent code

* Adds `StateInfo` trait

* Exports `StateOrBlock` and `BlockChain` types from `client` module

* Refactors `balance` RPC using generic API

* Refactors `storage_at` RPC using generic API

* Makes `MinerService::pending_state`'s return type dynamic

* Adds `StateOrBlock` and `BlockChain` types

* Adds impl of `client::BlockChain` for `Client`

* Exports `StateInfo` trait from `client` module

* Missing `self` use

To be fixed up to "Adds impl of `client::BlockChain` for `Client`"

* Adds `number_to_id` and refactors dependent RPC methods

* Refactors `code_at` using generic API

* Adds `StateClient` trait

* Refactors RPC to use `StateClient` trait

* Reverts `client::BlockChain` trait stuff, refactors methods to accept `StateOrBlock`

* Refactors TestClient

* Adds helper function `block_number_to_id`

* Uses `block_number_to_id` instead of local function

* Handles `Pending` in `list_accounts` and `list_storage_keys`

* Attempt to use associated types for state instead of trait objects

* Simplifies `state_at_beginning`

* Extracts `call` and `call_many` into separate trait

* Refactors `build_last_hashes` to accept reference

* Exports `Call` type from the module

* Refactors `call` and `call_many` to accept state and header

* Exports `state_at` in `StateClient`

* Exports `pending_block_header` from `MinerService`

* Refactors RPC `call` method using new API

* Adds missing parentheses

* Refactors `parity::call` to use new call API

* Update .gitlab-ci.yml

fix gitlab lint

* Fixes error handling

* Refactors `traces::call` and `call_many` to use new call API

* Refactors `call_contract`

* Refactors `block_header`

* Refactors internal RPC method `block`

* Moves `estimate_gas` to `Call` trait, refactors parameters

* Refactors `estimate_gas` in RPC

* Refactors `uncle`

* Refactors RPC `transaction`

* Covers missing branches

* Makes it all compile, fixes compiler grumbles

* Adds casts in `blockchain` module

* Fixes `PendingBlock` tests, work on `MinerService`

* Adds test stubs for StateClient and EngineInfo

* Makes `state_db` public

* Adds missing impls for `TestBlockChainClient`

* Adds trait documentation

* Adds missing docs to the `state_db` module

* Fixes trivial compilation errors

* Moves `code_hash` method to a `BlockInfo` trait

* Refactors `Verifier` to be generic over client

* Refactors `TransactionFilter` to be generic over client

* Refactors `Miner` and `Client` to reflect changes in verifier and txfilter API

* Moves `ServiceTransactionChecker` back to `ethcore`

* Fixes trait bounds in `Miner` API

* Fixes `Client`

* Fixes lifetime bound in `FullFamilyParams`

* Adds comments to `FullFamilyParams`

* Fixes imports in `ethcore`

* Fixes BlockNumber handling in `code_at` and `replay_block_transactions`

* fix compile issues

* First step to redundant trait merge

* Fixes compilation error in RPC tests

* Adds mock `State` as a stub for `TestClient`

* Handles `StateOrBlock::State` in `TestBlockChainClient::balance`

* Fixes `transaction_count` RPC

* Fixes `transaction_count`

* Moves `service_transaction.json` to the `contracts` subfolder

* Fixes compilation errors in tests

* Refactors client to use `AccountData`

* Refactors client to use `BlockChain`

* Refactors miner to use aggregate traits

* Adds `SealedBlockImporter` trait

* Refactors miner to use `SealedBlockImporter` trait

* Removes unused imports

* Simplifies `RegistryInfo::registry_address`

* Fixes indentation

* Removes commented out trait bound
2018-03-03 18:42:13 +01:00
Svyatoslav Nikolsky 0da6c7eb45 SecretStore: ECDSA session for cases when 2*t < N (#7739)
* SecretStore: ECDSA PoC

* SecretStore: fixed ECDSA serialization + cleanup

* removed unused param

* removed unused method

* removed debug unwrap

* SecretStore: 'limited' ECDSA session

* fix after merge
2018-03-01 09:59:21 +01:00
Svyatoslav Nikolsky 8579a56f71 SecretStore: 'broadcast' decryption session (#7843) 2018-02-12 18:05:33 +01:00
Svyatoslav Nikolsky 1ca1fba8cf read registry_address from given block (#7866) 2018-02-12 18:02:48 +01:00
Marek Kotewicz c060d9584d
ethabi version 5 (#7723)
* Refactor updater to use ethabi-derive

* Grumble: do_call type alias

* Empty commit to trigger test re-run

* migration to ethabi-5.0

* migration to ethabi-5.0 in progress

* use ethabi_deriven to generate TransactAcl contract

* use ethabi_deriven to generate Registry contract

* hash-fetch uses ethabi_derive, removed retain cycle from updater, fixed #7720

* node-filter crate uses ethabi_derive to generate peer_set contract interface

* use LruCache in node-filter instead of HashMap

* validator_set engine uses ethabi_derive

* ethcore does not depend on native_contracts

* miner does no depend on native_contracts

* secret_store does not use native_contracts (in progress)

* removed native-contracts

* ethcore and updater does not depend on futures

* updated ethereum-types

* fixed all warnings caused by using new version of ethereum-types

* updated ethabi_derive && ethabi_contract to get rid of warnings

* removed another retain cycle in updater, fixed following minor version on update

* moved contracts out of native_contracts res

* updated ethabi_contract

* fixed failing test

* fixed failing test

* there is no need to create two contracts of the same kind any more

* simplify updater::ReleaseTrack conversion into u8 and add several tests for it

* applied review suggestions

* applied review suggestions
2018-02-09 09:32:06 +01:00
Marek Kotewicz e95b093483 dissolve util (#7460)
* ethereum-types refactor in progress

* ethereum-types refactor in progress

* ethereum-types refactor in progress

* ethereum-types refactor in progress

* ethereum-types refactor finished

* removed obsolete util/src/lib.rs

* removed commented out code
2018-01-10 15:35:18 +03:00
Svyatoslav Nikolsky b685b7fae3 SecretStore: tx retry pattern (#7323)
* SecretStore: auto migrate initial commit

* SecretStore: flush automigrate

* SecretStore: debug flush

* SecretStore: added migration to KeyServerSet contract

* SecretStore: flush automigrate

* SecretStore: flush before testing

* SecretStore: flush

* SecretStore: flush

* SecretStore: bunch of tests for simple ConnectionTrigger && KeyServerSet

* SecretStore: started work on TriggerWithMigration tests

* SecretStore: maintain_session tests

* SecretStore: updated some comments

* SecretStore pass migration_id to ServerSetChangeSession

* SecretStore: fixed lock scope

* SecretStore: fixed error response condition

* SecretStore: fixed ServerSetChange session auto-creation

* SecretStore: update active migration in connector

* removed commented code

* SecretStore: fixed tests compilation

* SecretStore: marked test-related unimplemented-s

* SecretStore: labeled all SS TODOs

* SecretStore: do not read auto-migration stuff when auto-migration is disabled + stripped KeyServerSet contract ABI

* SecretStore: ignore duplicated addresses in KeyServerSet

* fied compilation

* SecretStore: wait for N block confirmations before starting auto-migration

* SecretStore: more tests for migration delay

* SecretStore: clear current nodes set when KSS contract is uninstalled

* SecretStore: retry transaction interval
2018-01-10 11:33:45 +01:00
Svyatoslav Nikolsky fc0eb600f3 checked_sub -> saturating_sub 2017-12-27 15:21:31 +03:00
Svyatoslav Nikolsky 2a73101fab updated doc 2017-12-27 11:44:47 +03:00
Svyatoslav Nikolsky 9a5d0fed2c SecretStore: return error if http listner init has failed 2017-12-21 16:54:24 +03:00
Svyatoslav Nikolsky 8d15338c84 SecretStore: removed extra-tracing 2017-12-21 16:20:34 +03:00
Svyatoslav Nikolsky 9104d4673c SecretStore: reorganize service contract read 2017-12-21 16:19:15 +03:00
Svyatoslav Nikolsky ff094e0a03 Revert "SecretStore: get rid of read_logs in ServiceContract"
This reverts commit 6efca8860a.
2017-12-21 11:44:55 +03:00
Svyatoslav Nikolsky ee1ce42546 SecretStore: extracted TasksQueue to separate file 2017-12-20 19:27:47 +03:00
Svyatoslav Nikolsky 6efca8860a SecretStore: get rid of read_logs in ServiceContract 2017-12-20 17:22:28 +03:00
Svyatoslav Nikolsky b7a744be59 SecretStore: require N confirmations in PendingRequestsIterator 2017-12-20 17:05:32 +03:00
Svyatoslav Nikolsky d7650e2b9c SecretStore: TrustedClient 2017-12-20 16:02:21 +03:00
Svyatoslav Nikolsky 794de9f743 SecretStore: fixing grumbles (part1) 2017-12-20 14:50:46 +03:00
Svyatoslav Nikolsky 14686f2652 SecretStore: cli option to configure service contract 2017-11-24 12:33:33 +03:00
Svyatoslav Nikolsky 333e0e1637 SecretStore: publish key only if requested through contract 2017-11-24 10:26:24 +03:00
Svyatoslav Nikolsky 989f2a0542 SecretStore: removed code comments 2017-11-24 10:26:16 +03:00
Svyatoslav Nikolsky c296b8ac5d SecretStore: fixed service contract update 2017-11-23 09:33:27 +03:00
Svyatoslav Nikolsky 498a708df7 fixed warnings 2017-11-23 08:22:51 +03:00
Svyatoslav Nikolsky 6a7f523cdb SecretStore: generation_is_not_retried_if_tried_in_the_same_cycle 2017-11-23 08:07:46 +03:00
Svyatoslav Nikolsky b036624bac SecretStore: key_is_read_and_published_when_processing_restore_server_key_task 2017-11-23 07:26:45 +03:00
Svyatoslav Nikolsky ea9c8a174c SecretStore: started adding tests for ServiceContractListener 2017-11-22 17:31:34 +03:00
Svyatoslav Nikolsky 5d6abfe2f5 SecretStore: implemented restore_server_key 2017-11-22 11:51:51 +03:00
Svyatoslav Nikolsky a2c12ab13e SecretStore: fixed warnings 2017-11-22 11:47:15 +03:00
Svyatoslav Nikolsky 85e150dbb5 SecretStore: restore server key 2017-11-22 11:43:01 +03:00
Svyatoslav Nikolsky df3a8a9234 SecretStore: default ClusterSessionsListener impl 2017-11-22 10:43:16 +03:00
Svyatoslav Nikolsky fc7f3433b7 SecretStore: removed obsolete traits 2017-11-22 10:21:14 +03:00
Svyatoslav Nikolsky 5a7e065e41 SecretStore: Kovan flush3 2017-11-22 10:05:14 +03:00
Svyatoslav Nikolsky 76e693240d fix after merge 2017-11-20 20:02:03 +03:00
Svyatoslav Nikolsky b5fad300ba Merge branch 'master' into secretstore_kovan 2017-11-20 19:58:01 +03:00
Svyatoslav Nikolsky 32edb33608 removed some TODOs 2017-11-20 19:03:48 +03:00
Svyatoslav Nikolsky 01d6532875 SecretStore: fixed Ordering 2017-11-20 19:03:39 +03:00
Svyatoslav Nikolsky 3945a29ee6 SecretStore: mapping requests to KeyServer + requests retry 2017-11-20 19:03:31 +03:00