Commit Graph

13419 Commits

Author SHA1 Message Date
ghubstan
87f75ee10c
Configure GrpcVersionService's rate metering interceptor
This change demonstrates how a method call rate metering interceptor
is configured for a gRPC service.  GrpcVersionService uses a custom
rate metering interceptor, or none.  A commented out, 'default'
interceptor is defined as a usage example.
2020-12-19 16:41:26 -03:00
ghubstan
ea97a801e5
Don't cancel gRPC call if an interceptor does not meter all methods 2020-12-19 16:31:41 -03:00
ghubstan
bb8d2ae7c4
Inject Config into CoreApi 2020-12-19 15:50:00 -03:00
ghubstan
9f679deb08
Add license note and toString method 2020-12-19 15:47:20 -03:00
ghubstan
830a5f009a
Add license note 2020-12-19 15:43:44 -03:00
ghubstan
455ed67f9b
Add GrpcServiceRateMeteringConfigTest 2020-12-19 15:41:55 -03:00
ghubstan
5de910a03d
Add unit test dependencies to daemon subproject 2020-12-19 15:40:27 -03:00
ghubstan
b307593c82
Make CallRateMeteringInterceptor configurable via json
This adds a GrpcServiceRateMeteringConfig class that can read and
write rate metering interceptor config files, and configure
a gRPC rate metering service interceptor at startup.

This seems excessive, but we need to be able to test and tune
method rate metering without having to change hard coded, default
interceptor rate meters.
2020-12-19 15:32:40 -03:00
ghubstan
a5ed17e43f
Add license comment, stop & toString methods, and make isRunning transient 2020-12-19 13:14:06 -03:00
chimp1984
af9f2a9643
In case a reset of the dao state was triggered we delete
now all dao store files and request a shut down of the app.

After a restart the resource files are used. This avoids cases where a resync from
genesis got triggered (observed on seed nodes, not on desktop apps).

Seed nodes and headless apps get shut down automatically.
In case of the desktop app we show a warn popup with shutdown
button and no close button, so we enforce a shutdown to avoid
complications in case the user would continue.
2020-12-18 20:29:47 -05:00
sqrrm
b04a56e543
Merge pull request #4969 from ripcurlx/improve-translations-in-trade-details
Make it easier to translate trade roles
2020-12-18 19:06:49 +01:00
Christoph Atteneder
9a54ccc077
Make it easier to translate trade roles 2020-12-18 17:06:56 +01:00
ghubstan
89e2187878
Change long to int, tidy up error msg 2020-12-17 14:12:04 -03:00
ghubstan
2148a4d958
Prevent excessive api calls
This change provides a gRPC CallRateMeteringInterceptor to help protect
the server and network against being overloaded by CLI scripting mistakes.

An interceptor instance can be configured on a gRPC service to set
individual method call rate limits on one or more of the the service's
methods. For example, the GrpcOffersService could be configured with
this interceptor to set the createoffer rate limit to 5/hour, and
the takeoffer call rate limit could be set to 20/day.  Whenever a
call rate limit is exceeded, the gRPC call is aborted and the client
recieves a "rate limit exceeded" error.

Below is a simple example showing how to set rate limits for one method
in GrpcVersionService.

    final ServerInterceptor[] interceptors() {
        return new ServerInterceptor[]{
                new CallRateMeteringInterceptor(new HashMap<>() {{
                    put("getVersion", new GrpcCallRateMeter(2, SECONDS));
                }})
        };
    }

It specifies a CLI can execute getversion 2 times / second.

This is not a throttling mechansim, there is no blocking nor locking
to slow call rates.  When call rates are exceeded, calls are
simply aborted.
2020-12-17 12:33:45 -03:00
Christoph Atteneder
ceecb404d2
Merge pull request #4899 from jmacxx/4061_privacy_improvement
Privacy improvements for manual payout
2020-12-17 15:32:44 +01:00
Christoph Atteneder
a3824f8151
Merge pull request #4961 from m52go/remove-btcnode-ip
Remove m52go btc node ip
2020-12-17 10:01:52 +01:00
jmacxx
e888be3192
review fix: try..catch around all parseCoin() 2020-12-16 22:15:16 -06:00
sqrrm
113bb4f7f2
Merge pull request #4963 from chimp1984/fix-case-if-no-data-store-service-is-available
Call completeHandler if services in store services is empty.
2020-12-17 00:55:26 +01:00
chimp1984
4c575098b7
Call completeHandler if services in store services is empty.
If oen starts with --daoActivated=false there is no service
set up in one of the data store services so it never calls
the result handler and the app never starts up.
2020-12-16 16:21:10 -05:00
ghubstan
fa9ffa1fb2
Put arguments on separate lines 2020-12-16 15:35:12 -03:00
ghubstan
2572e8641d
Create grpc interceptor pkg, move auth interceptor into it 2020-12-16 15:30:40 -03:00
m52go
4e4cb42f6a
Remove m52go btc node ip 2020-12-16 12:50:46 -05:00
ghubstan
f7c1103848
Rename gRPC exception handler class 2020-12-16 14:42:23 -03:00
ghubstan
c60605f75c
Fix class level comment 2020-12-16 14:26:12 -03:00
ghubstan
1cd47fd0aa
Merge branch 'master' into 09-refactor-grpc-error-handling 2020-12-16 13:45:29 -03:00
ghubstan
e6c6d3b8d3
Add new CoreApiExceptionHandler to gRPC services
This change reduces gRPC service error handling duplication by moving
it into a @Singleton encapsulating everything needed to wrap
an expected or unexpected core api exception into a gRPC
StatusRuntimeException before sending it to the client.  It also
fixes some boilerpate classes were gRPC error handling was missing.
2020-12-16 13:34:21 -03:00
sqrrm
86d81762f6
Merge pull request #4949 from chimp1984/show-pricedeviation-for-fixed-price-offers
Show price deviation in % for fixed price offers and BSQ
2020-12-16 15:30:14 +01:00
Christoph Atteneder
0789180bb0
Merge pull request #4957 from sqrrm/sign-single-account
Sign single account
2020-12-16 14:07:34 +01:00
sqrrm
4cdd94ac28
Merge pull request #4955 from chimp1984/cache-frequent-method-calls
Cache results of isFiatCurrency and isCryptoCurrency
2020-12-16 12:11:58 +01:00
sqrrm
25328167de
Merge pull request #4958 from chimp1984/disable-tx-broadcast-if-connected-to-local-node
Do not use tx broadcast to mempool nodes if a local btc nodes is used
2020-12-16 12:10:19 +01:00
chimp1984
bb3dbf3d78
Add null check (for tests) and fix missing param for test class.
Fix test with price display.
2020-12-15 23:29:53 -05:00
chimp1984
1106d01ff7
Set bsq30DayAveragePrice only at activate as its expensive
call and does not change frequently and is only used for
informational purpose as % display.
2020-12-15 23:29:52 -05:00
chimp1984
c858ac7b7d
Add check to not devide by 0
Cleanups
2020-12-15 23:29:52 -05:00
chimp1984
34f10d37ef
Add price deviation in % to BSQ using 30 day average 2020-12-15 23:29:52 -05:00
chimp1984
f97bb6228b
Show also % price deviation for fixed price and
sort according to it
Allow sorting at show all. This helps to spot
good offers with negative % over the whole market.
2020-12-15 23:29:52 -05:00
chimp1984
59cfb2d3a9
Do not use tx broadcast to mempool nodes if a local btc nodes is used
See discussion at: https://github.com/bisq-network/bisq/pull/4943#issuecomment-745615764
2020-12-15 20:04:38 -05:00
chimp1984
f2273e663d
Use ConcurrentHashMap for cache.
As the normal maps are not using a ConcurrentHashMap it is
likely unnecessary as well that I am not aware of a
multi-threaded access.
But as it does not show any difference in performance
it is likely the bit more safe option.
2020-12-15 19:15:40 -05:00
chimp1984
425bfa3bf7
Fix failing test (remove did operate on map
directly and we did not remove the item from the cache)

- Add getSignedWitnessMapValues method for access to signedWitnessMap values
- Remove Getter for signedWitnessMap
- Add removeSignedWitness method (used in test only)
- Use addToMap in test instead of direct access to map
- Remove getSignedWitnessSetCache entry matching
signedWitness.getHashAsByteArray() as well.
See comment. @sqrrm: Can you cross check?
2020-12-15 19:15:40 -05:00
chimp1984
359dc3759d
Add getSignedWitnessSetCache
The getSignedWitnessSet is called very often and is a bit
expensive. We cache the result in that map but we
remove the cache entry if we get a matching SignedWitness
added to the signedWitnessMap.
2020-12-15 19:15:40 -05:00
chimp1984
1314fd61a5
Add accountAgeWitnessCache
The accountAgeWitnessMap is very large (70k items) and
access is a bit expensive. We usually only access less
than 100 items, those who have offers online. So we
use a cache for a fast lookup and only if
not found there we use the accountAgeWitnessMap and
put then the new item into our cache.
2020-12-15 19:15:40 -05:00
chimp1984
ecad724046
Add null checks, improve comment 2020-12-15 19:08:37 -05:00
sqrrm
f61e62c7c0
Merge pull request #4956 from chimp1984/sort-paymentmethods-by-name
Sort payment methods by display string not by id.
2020-12-16 00:17:26 +01:00
sqrrm
fa01192661
Merge pull request #4952 from chimp1984/fix-priv-message-from-peer-icon
Allow sending private notifications from avatar icon at trade
2020-12-16 00:15:46 +01:00
sqrrm
9b8073b94a
Merge pull request #4954 from chimp1984/various-small-improvements
Various small improvements
2020-12-15 23:04:15 +01:00
sqrrm
bc60db39ae
Merge pull request #4943 from chimp1984/add-tx-broadcast-to-mempool-explorer-api
Add tx broadcast to mempool explorer api
2020-12-15 22:57:37 +01:00
sqrrm
26024bd6ec
Refactor: rename methods, move return statement 2020-12-15 19:35:49 +01:00
sqrrm
e0f4dc22e7
Fix formatting 2020-12-15 19:27:13 +01:00
sqrrm
4c33f9c999
Sign imported AccountAgeWitness,PubKey
Change the specific sign window to sign an imported account in the form
of accountAgeWitnessString,pubKeyString. The SignSpecificWitness never
worked due to missing pubKey data and this is a way to import the missing data.
2020-12-15 16:08:06 +01:00
ghubstan
a341173412
Merge branch 'master' into 09-scratch 2020-12-15 11:13:37 -03:00
chimp1984
0f084d3aec
Use ConcurrentHashMap
Add comment
2020-12-15 09:05:33 -05:00