18 Commits

Author SHA1 Message Date
Mark Rushakoff
d433ebe68d Improve handling of -short flag in tests (#9075)
As a small developer quality of life improvement, I found many individual unit tests that take longer than around a second to complete, and set them to skip when run under `go test -short`.

On my machine, the wall timings for tests (with `go test -count=1 ./...` and optionally `-short` and `-race`) are roughly:

- Long tests, no race detector: about 1m42s
- Short tests, no race detector: about 17s
- Long tests, race detector enabled: about 2m1s
- Short tests, race detector enabled: about 28s

This PR is split into many commits each touching a single package, with commit messages detailing the approximate timing change per package.
2022-07-29 13:41:54 +00:00
Sam Kleinman
c372390fea eventbus: publish without contexts (#8369) 2022-04-18 16:28:31 -04:00
Sam Kleinman
0bded371c5 testing: logger cleanup (#8153)
This contains two major changes:

- Remove the legacy test logging method, and just explicitly call the
  noop logger. This is just to make the test logging behavior more
  coherent and clear. 
  
- Move the logging in the light package from the testing.T logger to
  the noop logger. It's really the case that we very rarely need/want
  to consider test logs unless we're doing reproductions and running a
  narrow set of tests.
  
In most cases, I (for one) prefer to run in verbose mode so I can
watch progress of tests, but I basically never need to consider
logs. If I do want to see logs, then I can edit in the testing.T
logger locally (which is what you have to do today, anyway.)
2022-03-18 17:39:38 +00:00
Anca Zamfir
27ccf3b590 Don't allow duplicates for light client providers (#7781)
* Allow for zero witness providers

* Verify provider duplicates, fix tests

* Add duplicate provider ID to the error

* Return error on attempt to remove last witness

* Verify duplicates when restoring from store
2022-02-08 22:09:10 +01:00
Sam Kleinman
887cb219ab light: remove test panic (#7588) 2022-01-14 13:16:43 -05:00
Sam Kleinman
a67e0e6c43 light: remove global context from tests (#7505) 2022-01-04 13:35:49 -05:00
Sam Kleinman
5c0abb5367 testing: use scoped logger for all public packages (#7504) 2022-01-04 12:56:17 -05:00
William Banfield
9e41414a53 light: replace homegrown mock with mockery (#6735)
This pull request removes the homegrown mocks in `light/provider/mock` in favor of mockery mocks.

Adds a simple benchmark only mock to avoid the overhead of `reflection` that `mockery` incurs.

part of #5274
2021-07-28 16:12:11 +00:00
Callum Waters
a818f914ab fix deadlock in light tests (#6332) 2021-04-08 19:30:19 +02:00
Callum Waters
b272746444 Merge pull request from GHSA-f3w5-v9xx-rp8p
* add time warping lunatic attack test

* create too high and connecton refused errors and add to the light client provider

* add height check to provider

* introduce block lag

* add detection logic for processing forward lunatic attack

* add node-side verification logic

* clean up tests and formatting

* update adr's

* update testing

* fix fetching the latest block

* format

* update changelog

* implement suggestions

* modify ADR's

* format

* clean up node evidence verification
2021-04-08 08:10:03 -07:00
Callum Waters
37d36cd5bc light: improve provider handling (#6053)
Introduces heuristics that track the amount of no responses or unavailable blocks a provider has for more robust provider handling by the light client. Use concurrent calls to all witnesses when a new primary is needed.
2021-03-01 12:04:02 +01:00
Callum Waters
b9b55db4e5 light: remove max retry attempts from client and add to provider (#6054) 2021-02-05 18:01:34 +01:00
Callum Waters
385ea1db7d store: use db iterators for pruning and range-based queries (#5848) 2021-01-08 13:12:54 +01:00
Anton Kaliaev
627f7b5989 light: run detector for sequentially validating light client (#5538)
Closes #5445
2020-11-02 12:42:03 +04:00
Anton Kaliaev
12ebd7735a light: cross-check the very first header (#5429)
Closes #5428
2020-10-09 14:29:22 +04:00
Callum Waters
a4b7018732 light: expand on errors and docs (#5443) 2020-10-02 20:05:15 +02:00
Anton Kaliaev
85a4be87a7 rpc/client: take context as first param (#5347)
Closes #5145

also applies to light/client
2020-09-23 09:21:57 +04:00
Callum Waters
ed002cea7e evidence: introduction of LightClientAttackEvidence and refactor of evidence lifecycle (#5361)
evidence: modify evidence types (#5342)

light: detect light client attacks (#5344)

evidence: refactor evidence pool (#5345)

abci: application evidence prepared by evidence pool (#5354)
2020-09-22 10:22:54 +02:00