Fix: new blocks notifications sometimes missing in pubsub RPC
Implement new struct to pass to `new_blocks()` with extra parameter - `has_more_blocks_to_import`, which was previously used to determine whether the notification should be sent. Now it's up to each implementation to decide what to do.
Updated all implementations to behave as before, except `eth_pubsub`, which will send notification even when the queue is not empty.
Update tests.
* Fill transaction hash on ethGetLog of light client. This is enifficient
but we keep align with spec.
* Using better variables names.
* Expose old fast light get log as `parity_getLogsLight`.
* Update rpc/src/v1/helpers/light_fetch.rs
Fix indent.
Co-Authored-By: cheme <emericchevalier.pro@gmail.com>
* Factor common code between light_logs and logs.
* Remove useless check
* Rename parity light logs to 'parity_getLogsNoTransactionHash'.
Fix indent and extra white lines.
* Use vec instead of tree map to avoid inner function.
* better loop
* closes#7009
adds parity_verifySignature RPC method
* removed unneccesary into
* adds support for chain replay protected signatures
* corrected chain replay protection check
* corrected possible overflow
* added tests
* use checked_sub to prevent possible overflow
* use saturating_mul to prevent possible overflow
* changed method signature to accept r,s,v components
* added unit tests
* more tests
* refactored tests for better readability
moved verify_signature tests to live in the same file.
* removed unneccesary imports
* fixed PR grumbles
* fixed rsv notation
* fixed rsv notation
* renamed BasicAcount to RecoveredAccount, Support zero chain_id
* fixed compile errors
* fixed tests
* doc comment
* Add deny_unknown_fields to chainspec
* Add tests and fix existing one
* Remove serde_ignored dependency for chainspec
* Fix rpc test eth chain spec
* Fix starting_nonce_test spec
* feat + fix: Missing blocks in filter_changes RPC
* Implement validity check of reported hashes (in case of re-org) and re-set last_block to the last block reported that is still valid.
* Add const to set history size for validity check (32).
* test: in the case of a re-org we get same block number if hash is different
* Rename db_restore => client
* First step: make it compile!
* Second step: working implementation!
* Refactoring
* Fix tests
* PR Grumbles
* PR Grumbles WIP
* Migrate ancient blocks interating backward
* Early return in block migration if snapshot is aborted
* Remove RwLock getter (PR Grumble I)
* Remove dependency on `Client`: only used Traits
* Add test for recovering aborted snapshot recovery
* Add test for migrating old blocks
* Fix build
* PR Grumble I
* PR Grumble II
* PR Grumble III
* PR Grumble IV
* PR Grumble V
* PR Grumble VI
* Fix one test
* Fix test
* PR Grumble
* PR Grumbles
* PR Grumbles II
* Fix tests
* Release RwLock earlier
* Revert Cargo.lock
* Update _update ancient block_ logic: set local in `commit`
* Update typo in ethcore/src/snapshot/service.rs
Co-Authored-By: ngotchac <ngotchac@gmail.com>
* fix start_gas, handle OOG exceptions & NotEnoughGas
* Change START_GAS: 50_000 -> 60_000
* When the `OutOfGas exception` is received then try to double the gas until it succeeds or block gas limit is reached
* When `NotEnoughBasGas error` is received then use the required gas provided in the response
* fix(light-fetch): ensure block_gas_limit is tried
Try the `block_gas_limit` before regard the execution as an error
* Update rpc/src/v1/helpers/light_fetch.rs
Co-Authored-By: niklasad1 <niklasadolfsson1@gmail.com>
* added sign_191 rpc method
* fixed hash_structured_data return type
* added ConfirmationPayload::SignMessage for non-prefixed signatures, added tests for sign191
* renamed WithValidator -> PresignedTransaction
* rename applicationData to data in test
* adds docs for EIP191Version, renamed SignRequest to EIP191SignRequest
* Update test reference.
Block test are really not working so I disabled a few by commenting
directly in source.
* Move ethtest commit cursor.
* Implements 'NoProof' engine from https://github.com/ethereum/tests/issues/464 .
Since tests has been regenerated those one were failing on block
difficulty check.
Update ethereum/tests, waiting for cost fix (block test are still
commented).
* Update tests submodule reference to latest (all test passing except an
identified case).
Fix block reward of constantinople json.
* Restore broken test by using old json tests files.
* Use CanonNoSeal instead of a custom engine, still have to include some
additional tests code.
* Gas upper limit check in json_chain test was bad, moving the test to
verification, the test is running in `verify_header_param`.
Note that test was previously only for ethash, and now for any engine.
* Restore old behavior (gas uper limit only for ethash engine), at the
cost of an additional trait method.
* Proper rpc test fix.
* Update tests submodule, add SStore bug tests.
* Fix json issue tabulation.
Update tests submodule to latest master (lot of new sstore tests
passing)
* Switch ethereum/tests to tag 6.0.0-beta.1 (no tests changes from latest
synch).
* Display hex with separator, use indirection instead of clone for copy
types.
* Fixing and disabling some tests for windows 10 compatibility.
* Few adjustment for windows in tests (eg bigger timeout for keyserver tests)
* Spaces and temporary single thread ci (to be able to spot the error).
* Clean up serde rename and use rename_all = camelCase when possible
* snake_case for pricing
* Use camelcase for engine
* Use camel case for seal
* Use camel case for validator set
* Use camel case for confirmation payload
* Use camel case for consensus status
* Use camel case for nodekind
* Use kebab case for provenance
* Use camel case for pubsub
* Use lowercase and camelcase for trace
* Use camel case for whisper
* rename Ethash as irregular name
* Replace `tokio_core` with `tokio`.
* Remove `tokio-core` and replace with `tokio` in
- `ethcore/stratum`
- `secret_store`
- `util/fetch`
- `util/reactor`
* Bump hyper to 0.12 in
- `miner`
- `util/fake-fetch`
- `util/fetch`
- `secret_store`
* Bump `jsonrpc-***` to 0.9 in
- `parity`
- `ethcore/stratum`
- `ipfs`
- `rpc`
- `rpc_client`
- `whisper`
* Bump `ring` to 0.13
* Use a more graceful shutdown process in `secret_store` tests.
* Convert some mutexes to rwlocks in `secret_store`.
* Consolidate Tokio Runtime use, remove `CpuPool`.
* Rename and move the `tokio_reactor` crate (`util/reactor`) to
`tokio_runtime` (`util/runtime`).
* Rename `EventLoop` to `Runtime`.
- Rename `EventLoop::spawn` to `Runtime::with_default_thread_count`.
- Add the `Runtime::with_thread_count` method.
- Rename `Remote` to `Executor`.
* Remove uses of `CpuPool` and spawn all tasks via the `Runtime` executor
instead.
* Other changes related to `CpuPool` removal:
- Remove `Reservations::with_pool`. `::new` now takes an `Executor` as an argument.
- Remove `SenderReservations::with_pool`. `::new` now takes an `Executor` as an argument.
* `ExecutionsRequest` from light-clients as read-only
This changes so all `ExecutionRequests` from light-clients are executed
as read-only which the `virtual``flag == true ensures.
This boost up the current transaction to always succeed
Note, this only affects `eth_estimateGas` and `eth_call` AFAIK.
* grumbles(revert renaming) : TransactionProof
* grumbles(trace) : remove incorrect trace
* grumbles(state/prove_tx) : explicit `virt`
Remove the boolean flag to determine that a `state::prove_transaction`
whether it should be executed in a virtual context or not.
Because of that also rename the function to
`state::prove_transction_virtual` to make more clear
* add a new RPC `eth_submitWorkDetail`similar `eth_submitWork`.
It has more details (block hash, error message, and more in future)
in its response and not only the `true` or `false`.
* move RPC submitWorkDetail from namespace eth_ to parity_
* remove SubmitDetailResult type; submitWorkDetail return a error when failed
* change error message of RPC error `cannot_submit_work`.
* remove double imported H256.
* put submit_work_detail into a helper to avoid the duplicate codes.
* OnDemand no longer loop until there is a query.
All peer known at the time will be queried, and the query fail if all
return no reply.
Returning the failure is done through an empty Vec of reply (the type
of the oneshot channel remains unchanged).
Before this commit the query were send randomly to any peer until there
is a reply (for a query that got no result it was an issue, for other
queries it was quering multiple times the same peers).
After this commit the first query is random but next queries
follows hashmap iterator order.
Test no_capability was broken by this commit (the pending query was
removed).
* OnDemand no longer loop until there is a query.
All peer known at the time will be queried, and the query fail if all
return no reply.
Returning the failure is done through an empty Vec of reply (the type
of the oneshot channel remains unchanged).
Before this commit the query were send randomly to any peer until there
is a reply (for a query that got no result it was an issue, for other
queries it was quering multiple times the same peers).
After this commit the first query is random but next queries
follows hashmap iterator order.
Test no_capability was broken by this commit (the pending query was
removed). If adding some kind of timeout mechanism it could be restored.
* Comment plus better field names.
* No panick on dropped oneshot channel.
* Use Set to avoid counter heuristic
* Cli option `on_demand_nb_retry` for maximum number of retry when doing
on demand query in light client.
* Missing test update for previous commit
* Add a timeout (only when there is no peer to query), that way we do not
set number of query to minimum current number peer or configured number
of query : that way capability test was restored.
* Adding an error type for on_demand, it helps having variant of error
reported at rpc level : choice of rpc error code error might not be
right.
* Duration as constant is nice
* Switch to duration in main too
* Fix indentation (sorry for that).
* Fix error management (bad merge in previous commit)
* Lots of english corrections, major change on the new command parameters :
- use standard '-' instead of '_'
- renaming nb_retry params to 'on-demand-retry-count'
* `light::verify_transaction` basic tx validation
* update wasm tests
* Provide `cached_nonce` in `parity_next_nonce` RPC
* nits
* Improve error handeling
Two separate errors for distinguishing between `account not found` and
`insufficient balance`. However, when `next_nonce()` is called and the
account is not found then provide `local_best_next_nonce`!
* Ensure only one n/w request is performed
Refactored to code again:
* Removed `fn cached_next_nonce`
* Removed extra n/w request in `sign` to check balance
* Refactored `fill_optional_field` to request nonce and check account balance
* nits
* grumbles needless clone
* Prevent integer overflow with saturating add & mul
* Call `sign_transaction()` directly from `sign()`
Because the change in `fill_optional_fields` always fill the nonce it is
now possible to call `sign_transaction` directly instead of creating a
`ProspectiveSigner` "object".
* Update & fix JSON state tests.
* Update tests to be able to run ethtest at
021fe3d410773024cd5f0387e62db6e6ec800f32.
- Touch user in state
- Adjust transaction tests to new json format
* Switch to same commit for submodule ethereum/test as geth (next includes constantinople changes).
Added test `json_tests::trie::generic::TrieTests_trieanyorder` and a few
difficulty tests.
* Remove trietestnextprev as it would require to parse differently and
implement it.
* Support new (shitty) format of transaction tests.
* Ignore junk in ethereum/tests repo.
* Ignore incorrect test.
* Update to a later commit
* Move block number to a constant.
* Fix ZK2 test - touched account should also be cleared.
* Fix conflict resolution
* Provide the actual `account` for eth_coinbase
The previous implementation always provided the `zero address` on
`eth_coinbase` RPC. Now, instead the actual address is returned on
success or an error when no account(s) is found!
* full client `eth_coinbase` return err
In the full-client return an error when no account is found instead of
returning the `zero address`
* Remove needless blocks on single import
* Remove needless `static` lifetime on const
* Fix `rpc_eth_author` test
* Light client on-demand request for headers range.
* Cache headers in HeaderWithAncestors response.
Also fulfills request locally if all headers are in cache.
* LightFetch::logs fetches missing headers on demand.
* LightFetch::logs limit the number of headers requested at a time.
* LightFetch::logs refactor header fetching logic.
* Enforce limit on header range length in light client logs request.
* Fix light request tests after struct change.
* Respond to review comments.
* Provide `default_nonce` in tx`s when it´s missing
When `nonce` is missing in a `EthTransaction` will cause it to fall in
these cases provide `default_nonce` value instead!
* Changed http:// to https:// on Yasm link (#9369)
Changed http:// to https:// on Yasm link in README.md
* Provide `default_nonce` in tx`s when it´s missing
When `nonce` is missing in a `EthTransaction` will cause it to fall in
these cases provide `default_nonce` value instead!
* Address grumbles
* Fix PubSub for logs when using light client :
prior to this fix the pubsub process did send a
query for each new block header (and for each subs : there is something
to optimize here) by setting from and to of the filter at this block
number; but there was a bug in the code that fetch logs : it was non
inclusive for its start bound, meaning that with start bound = end bound
we never query any block (and attached logs).
* Option iter instead of once.
Use of bloom existing function to check if a bloom contains another.
* Makes from block header checking explicit
* 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
* ethcore: fix pow difficulty validation
* ethcore: validate difficulty is not zero
* ethcore: add issue link to regression test
* ethcore: fix tests
* ethcore: move difficulty_to_boundary to ethash crate
* ethcore: reuse difficulty_to_boundary and boundary_to_difficulty
* ethcore: fix grumbles in difficulty_to_boundary_aux
* Comply EIP-86 with the new CREATE2 opcode
* Fix rpc compile
* Fix interpreter CREATE/CREATE2 stack pop difference
* Add unreachable! to fix compile
* Fix instruction_info
* Fix gas check due to new stack item
* Add new tests in executive
* Fix have_create2 comment
* Remove all unused references of eip86_transition and block_number
* Added --tx-queue-no-early-reject flag to disable early tx queue rejects because of low gas price
* Fixed failing tests, clarified comments and simplified no_early_reject field name.
* Added test case for the --tx-queue-no-early-reject flag
* Reject if Engine::on_close_block returns error
* Unify open block behaviors
* Fix tests in ethcore
* Fix Aura tests
* Fix RPC test
* Print a warning if open block failed
* Print the actual error when closing the block
* Update comments for prepare_pending_block
* Add BlockPreparationStatus to distingish three different state after prepare_pending_block
* Remove the dapps system from Parity
* Move node-health outside of dapps
* Fix set dapps list test
* Update Cargo.lock
* Deprecate options
* Add _legacy_ prefixes in Dapps
* Fix tests
* Fix deprecatedness of dapps-path
* rpc: return unordered transactions in pending transactions filter
* ethcore: use LruCache for nonce cache
Only clear the nonce cache when a block is retracted
* Revert "ethcore: use LruCache for nonce cache"
This reverts commit b382c19abdb9985be1724c3b8cde83906da07d68.
* Use only cached nonces when computing pending hashes.
* Give filters their own locks, so that they don't block one another.
* Fix pending transaction count if not sealing.
* Clear cache only when block is enacted.
* Fix RPC tests.
* Address review comments.
* Bump parking_lot to 0.6
* Bump parity-wasm to 0.31 so it gets rid of parking_lot
ref https://github.com/paritytech/parity-wasm/pull/206
* Update jsonrpc versions
* Update wasmi and pwasm-utils version
* Fix compile
* Update jsonrpc crates
* Add option for user to set max size limit for RPC requests as requested in #8961.
* Add max_payload to tests.
* Change name for max payload option and change value from NUM to MB.
* Fix broken test.
* Fix incorrect indentation.
* disable hardware-wallets that don't support libusb
* address grumbles
* nits
* Refactor to get rid off as much annotations asap
* Might consume slight more memory than pure conditional compilation
flags
* formatting nits
* Enable libusb for android
* Tested by it compiling succesfully with `cargo build --target=armv7--linux-androideabi`
* The binary is ~66 MB
```bash
$ size
size target/armv7-linux-androideabi/release/parity
text data bss dec hex filename
50676230 416200 31456 51123886 30c16ae target/armv7-linux-androideabi/release/parity
```
* Move all `fake-hardware-wallet` to its own crate
* Removes some conditional compilation flags
* Introduces `fake-hardware-wallet` crate
* return error if no hardware wallets are found
* new blooms database
* fixed conflict in Cargo.lock
* removed bloomchain
* cleanup in progress
* all tests passing in trace db with new blooms-db
* added trace_blooms to BlockChainDB interface, fixed db flushing
* BlockChainDB no longer exposes RwLock in the interface
* automatically flush blooms-db after every insert
* blooms-db uses io::BufReader to read files, wrap blooms-db into Mutex, cause fs::File is just a shared file handle
* fix json_tests
* blooms-db can filter multiple possibilities at the same time
* removed enum trace/db.rs CacheId
* lint fixes
* fixed tests
* kvdb-rocksdb uses fs-swap crate
* update Cargo.lock
* use fs::rename
* fixed failing test on linux
* fix tests
* use fs_swap
* fixed failing test on linux
* cleanup after swap
* fix tests
* fixed osx permissions
* simplify parity database opening functions
* added migration to blooms-db
* address @niklasad1 grumbles
* fix license and authors field of blooms-db Cargo.toml
* restore blooms-db after snapshot
* Add tx_queue_allow_unknown_local config option
- Previous commit messages:
dispatcher checks if we have the sender account
Add `tx_queue_allow_unknown_local` to MinerOptions
Add `tx_queue_allow_unknown_local` to config
fix order in MinerOptions to match Configuration
add cli flag for tx_queue_allow_unknown_local
Update refs to `tx_queue_allow_unknown_local`
Add tx_queue_allow_unknown_local to config test
revert changes to dispatcher
Move tx_queue_allow_unknown_local to `import_own_transaction`
Fix var name
if statement should return the values
derp de derp derp derp semicolons
Reset dispatch file to how it was before
fix compile issues + change from FLAG to ARG
add test and use `into`
import MinerOptions, clone the secret
Fix tests?
Compiler/linter issues fixed
Fix linter msg - case of constants
IT LIVES
refactor to omit yucky explict return
update comments
Fix based on diff AccountProvider.has_account method
* Refactor flag name + don't change import_own_tx behaviour
fix arg name
Note: force commit to try and get gitlab tests working again 😠
* Add fn to TestMinerService
* Avoid race condition from trusted sources
- refactor the miner tests a bit to cut down on code reuse
- add `trusted` param to dispatch_transaction and import_claimed_local_transaction
Add param to `import_claimed_local_transaction`
Fix fn sig in tests
* Add removed geth compatibility field in log
* Fix mocked tests
* Add field block hash in PollFilter
* Store last block hash info for log filters
* Implement canon route
* Use canon logs for fetching reorg logs
Light client removed logs fetching is disabled. It looks expensive.
* Make sure removed flag is set
* Address grumbles
* getting started
* getting started
* signing personal messages works and refactoring
* Refactor `Ledger`
* Make `Ledger Manager` only visible inside the hardwallet-crate
* Refactor `send_apdu` with separate functions for read and write
* Add support for signing messages through `ethcore`
* Trezor modify update_devices and some error msgs
* nits
* Fix concurrent access to signer queue
* Put request back to the queue if confirmation failed
* typo: fix docs and rename functions to be more specific
`request_notify` does not need to be public, and it's renamed to `notify_result`.
`notify` is renamed to `notify_message`.
* Change trace info "Transaction" -> "Request"
* Unordered iterator.
* Use unordered and limited set if full not required.
* Split timeout work into smaller timers.
* Avoid collecting all pending transactions when mining
* Remove println.
* Use priority ordering in eth-filter.
* Fix ethcore-miner tests and tx propagation.
* Review grumbles addressed.
* Add test for unordered not populating the cache.
* Fix ethcore tests.
* Fix light tests.
* Fix ethcore-sync tests.
* Fix RPC tests.
* 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
* Remove public node related settings
* Fix tests
* Unwrap accounts provider in all rpc apis
* Unwrap AccountProvider in all cli places
* Fix rpc tests
* Lots of println to figure out what eth_getBlockByNumber does/should do
* Remove debugging
* Print warnings when fetching pending blocks
When calling `eth_getBlockByNumber` with `pending`, we now print a deprecation warning and:
* if a pending block is found, use it to respond
* if no pending block is found, respond as if if was a request for `Latest`
Addresses issue #8703 (not sure if it's enough to close it tbh)
* Set the request index to that of the current request
When setting up the chain of (two) requests to look up a block by hash, the second need to refer to the first. This fixes an issue where the back ref was set to the subsequent request, not the current one. When the requests are executed we loop through them in order and ensure the requests that should produce headers all match up. We do this by index so they better be right.
In other words: off by one.