Commit Graph

1281 Commits

Author SHA1 Message Date
Bryan Stitt
dc4b6d501c move active_premium opt_in check 2023-07-21 13:58:09 -07:00
Bryan Stitt
044d19e3ec more info in Balance's Debug 2023-07-21 13:57:47 -07:00
Bryan Stitt
e6666d92d8 don't unwrap if config cant send 2023-07-21 13:28:08 -07:00
Bryan Stitt
a68d0d60b7 only health check if theres a block and rpc sender 2023-07-21 13:28:00 -07:00
Bryan Stitt
7fa88e7251 keep the cache size consistent 2023-07-20 22:34:32 -07:00
Bryan Stitt
5b9eb080a2 include influx in test_sum_credits_used 2023-07-20 22:21:46 -07:00
Bryan Stitt
f5036f6cd9 set tiers to fix tests 2023-07-20 22:07:46 -07:00
Bryan Stitt
c674871c98 only create owned key if active premium 2023-07-20 21:13:55 -07:00
Bryan Stitt
e222572d09 rpc_key_user_id should be None for global stats 2023-07-20 21:13:24 -07:00
Bryan Stitt
0b1cfeffed use normalize path layer to trim trailing slash 2023-07-20 20:05:37 -07:00
Bryan Stitt
03bfd7148f test_two_buffers needs docker 2023-07-20 20:05:22 -07:00
Bryan Stitt
cb5c1c6582 no limits on rpc_secret_key_cache and user_balance_cache 2023-07-20 19:04:32 -07:00
Bryan Stitt
766e1939d5 cargo upgrade 2023-07-20 18:23:04 -07:00
Bryan Stitt
2611085c00 add simple stat buffer test 2023-07-20 18:22:25 -07:00
Bryan Stitt
7678cb7389 caches aren't actualy optional on buffer 2023-07-20 18:21:49 -07:00
Bryan Stitt
3334dc5c0b mark as premium if no downgrade tier id 2023-07-20 14:54:42 -07:00
Bryan Stitt
ae8a12047e tarpit strange methods 2023-07-20 14:32:52 -07:00
Bryan Stitt
e7905b4344 Revert "First pass implementation of async serialize for Web3Rps (#192)"
This reverts commit 269aa32260a4c3e94d7ada55fee6c8e62d975c87.
2023-07-19 23:12:49 -07:00
Bryan Stitt
6c6a2406b7 cargo upgrade 2023-07-19 22:55:53 -07:00
Bryan Stitt
ac2d9049be improve flushing and buffering of stats 2023-07-19 22:55:14 -07:00
Bryan Stitt
90ffb5254a flush all stats 2023-07-19 18:41:40 -07:00
Bryan Stitt
e6dc64f369 add timeout as a the tower layer 2023-07-19 18:41:26 -07:00
Bryan Stitt
1b8ae5dee0 cargo upgrade 2023-07-18 09:54:56 -07:00
Bryan Stitt
a97cb6a0c5 lint 2023-07-18 09:50:51 -07:00
Bryan Stitt
600c1bafb4
David/multiple proxy test (#187)
* add test_multiple_proxies_stats_add_up

* make a premium user using both proxies

* added a couple clones, must add constraints now to run for multiple-proxies (check arithmetic)

* lint and code review

* fix comment

* fix tests (now fails at todo)

* will introduce endpoint to fetch rpc stats from mysql

* added influxdb to tests, should next do asserst in stats collected by influx, and mysql for multi-proxy

* created test where influx and mysql have separate data, should help with debugging

* forgot to drop influx

* tests pass except multi-proxy

* test passes, will check out nothing broke elswhere

* go back to numbers

* some linting

* linting

* removed redundant info!

* responding to PR comments

* ULID as instance-hash for the tag in influx (for anti-dup)

---------

Co-authored-by: yenicelik <david.yenicelik@gmail.com>
2023-07-17 13:31:41 -07:00
Bryan Stitt
fe672b5189 dont disable on_failure. the log breadcrumbs can be helpful still 2023-07-14 23:04:24 -07:00
Bryan Stitt
140dc04a8b dont put anon stats in the db (for now)
the indexes need to be fixed. UNIQUE+NULL do not play nice
2023-07-14 22:19:18 -07:00
Bryan Stitt
264508c454 treat serde errors as rate limits (because all of them seem to be) 2023-07-14 21:43:37 -07:00
Bryan Stitt
042e644865 comment 2023-07-14 18:38:13 -07:00
Bryan Stitt
61126bb2ac one more Cow 2023-07-14 18:35:40 -07:00
Bryan Stitt
020dff0233 lint 2023-07-14 18:31:42 -07:00
Bryan Stitt
efa189d101 less anyhow and fix tests 2023-07-14 18:31:00 -07:00
Bryan Stitt
0046a02a4a
Global db (#191)
* dont migrate on start. just connect

* it compiles

* that log is loud

* get transaction from a local clone

* import the trait

* put the test app into a thread instead of tokio::spawn

* fix one test

* try db before rpcs

* db connection is too slow. need to wait for it

* do db setup once while spawning
2023-07-14 18:30:01 -07:00
Bryan Stitt
269aa32260
First pass implementation of async serialize for Web3Rps (#192)
Co-authored-by: Rory Neithinger <rorytrent@gmail.com>
2023-07-14 18:29:48 -07:00
Bryan Stitt
fe45813e4c remove info logging 2023-07-14 01:21:50 -07:00
Bryan Stitt
37e3d0be2b you cant do a runtime in a drop like this apparently 2023-07-14 01:19:27 -07:00
Bryan Stitt
6371206315 rate limit by ip if unknown key 2023-07-14 00:23:05 -07:00
Bryan Stitt
f217bf33b3 disable db stats for now 2023-07-13 23:45:04 -07:00
David
31f840432d
Add DateCreated fields to admin and on-chain deposit (#190)
* tests seem to be passing

* bump version

* bump version
2023-07-13 19:25:14 -07:00
Bryan Stitt
3c2d06324e faster rpc. backups always lose 2023-07-13 18:14:13 -07:00
Bryan Stitt
45af241429 less db transactions 2023-07-13 15:44:07 -07:00
Bryan Stitt
5d5e65ed40 close the db connection on exit 2023-07-13 15:44:07 -07:00
Bryan Stitt
a893a41c90 rename get to connect 2023-07-13 15:44:07 -07:00
Bryan Stitt
dce3540ee3 less authorization and remove pending txs for now 2023-07-13 11:01:16 -07:00
Bryan Stitt
53877ed2e5 less transactions when handling uncles 2023-07-13 10:27:44 -07:00
Bryan Stitt
28e6be5d9b handle uncles in the background and keep transaction open for a shorter time 2023-07-13 10:13:50 -07:00
Bryan Stitt
fa21b7c0a8 lint 2023-07-13 10:13:14 -07:00
David
c1a3a2dfbb
Remove stripe duplicate endpoint (#186) 2023-07-12 19:19:15 -07:00
Bryan Stitt
2b1829a882 move db and anvil functions to their proper places 2023-07-12 14:42:59 -07:00
Bryan Stitt
6b5437be2c split mysql and anvil into their own fixtures 2023-07-12 14:28:31 -07:00
Bryan Stitt
5d207fb2c6
Auto tier change (#184)
* lint

* change user to premium on admin credits

todo: change on other deposits

* set tier more places

* BadRequest instead of 500

* insert existing users too

* add the premium file
2023-07-12 10:24:16 -07:00
Bryan Stitt
b6cbf02ae7 test_sum_credits_used needs docker 2023-07-12 00:47:55 -07:00
Bryan Stitt
df2f3d340f
More balance tests (#182)
* fix popularity contest

* more info in the Debug for Web3Rpc

* add frontend_requests and cache_misses to the Balance query

* add more to balance and stats flushing and improved test coverage

* it compiles

* deserializer for Ulid to Uuid

I think a wrapper type on Ulid that implements sea_orm::Value is probably better

* rename variable to match struct name

* add deserializer for Address -> Vec<u8>

* sql sum returns a Decimal. need to convert to u64

* assert more

* one log and assert more

* log more

* use a helper to get the user's rpc provider

* this should be 2 now that we have a public and authed call

* this should be zero. the public has the cache miss

* instrument cu calcs

* trace the value we took, not the default that replaced it

* move usd_per_chain into config

* remove some extra logging

* use Arc::into_inner to maybe avoid a race

* off by 1

* pass paid credits used instead of returning it

this lets us use it to write to our user balance cache first. importantly, this keeps us from holding a write lock while writing to mysql

* no cache misses expected in this test

* actually check the admin

* put the balance checks back now that the rest of the test works

* archive request is being set incorrectly

* wow howd we manage flipping the greater than sign on archive depth

* move latest_balance and premium_credits_used to before any stats are emitted

* lint

* and build undoes the linting. fun

i didnt even want to lint them in the first place, so this is fine

* missed incrementing total_spent when not incrementing total_spent_paid_credits

* use the credits on self

* use the credits on self (pt 2)

* fix type for 10 cu query

* convert the requestmetadata on the other side of the channel

* logs

* viewing stats is allowed even without a balance

* move paid_credits_used to AuthorizationChecks

* wip

* test_sum_credits_used finally passes

* UserBalanceCache::get_or_insert

* re-enable rpc_secret_key_cache

* move invalidate to a helper function

and always call it **after** the db is commited

* fix PartialEq and Eq on RpcSecretKey

* cargo upgrade
2023-07-12 00:35:07 -07:00
Bryan Stitt
5f215facab fix typo 2023-07-11 13:18:19 -07:00
Bryan Stitt
8746cc1ae6 catch the new error format for returndata limit 2023-07-10 23:38:23 -07:00
Bryan Stitt
0f7e370c92 drop flume. just use tokio
i dont know if this is the problem, but this will also get compile times down
2023-07-10 23:08:06 -07:00
Bryan Stitt
3059d08674 error on max_head_block_age and keep the sender alive longer 2023-07-10 22:17:15 -07:00
Bryan Stitt
1af023d689 no iouring for now 2023-07-10 21:17:48 -07:00
Bryan Stitt
04825be99d error if health checks are failing 2023-07-10 20:59:17 -07:00
Bryan Stitt
fe39ad1e1e Revert "Revert "fixes for disconnect and config reloads""
This reverts commit 3cfbc3cbf124caf9154ffe6a444082cb0c3e20a1.
2023-07-10 20:59:03 -07:00
Bryan Stitt
3cfbc3cbf1 Revert "fixes for disconnect and config reloads"
This reverts commit 50fed0b0e79778d17bb40df96a11e44341dde0d1.
2023-07-10 20:30:10 -07:00
Bryan Stitt
50fed0b0e7 fixes for disconnect and config reloads 2023-07-10 19:41:14 -07:00
Bryan Stitt
2dfc5dcdf3 set http keep alive to a longer time 2023-07-10 18:37:25 -07:00
Bryan Stitt
31f772591b put rpcs in a rwlock again 2023-07-10 18:09:58 -07:00
Bryan Stitt
98bda65735 inner instead of left 2023-07-10 16:25:01 -07:00
Bryan Stitt
0181347b42 one less clone 2023-07-10 15:41:55 -07:00
Bryan Stitt
e80d1bd23a add more to Web3Rpcs debug 2023-07-10 15:31:10 -07:00
Bryan Stitt
a7f1c043c5 sync before Serialize 2023-07-10 15:26:00 -07:00
Bryan Stitt
c00eebeb32 admin_ should be unimplemented cost 2023-07-10 15:13:49 -07:00
Bryan Stitt
cceee646ad cargo upgrade 2023-07-10 14:05:03 -07:00
Bryan Stitt
a7119f6b5b
split balance queries up (#177)
* wip

* tests pass, referee_bonus changed to one_time_referee_bonus

---------

Co-authored-by: yenicelik <david.yenicelik@gmail.com>
2023-07-10 14:03:05 -07:00
Bryan Stitt
9ef08c80e1 remove parking_lot 2023-07-10 11:05:07 -07:00
Bryan Stitt
2ea53cc396 could not get block from params should be error level 2023-07-09 22:52:29 -07:00
Bryan Stitt
9ee6b18172 no more lock update needed
all these things are idempodent now
2023-07-09 22:51:01 -07:00
Bryan Stitt
af4ca0f450 distinguish some errors 2023-07-09 22:49:29 -07:00
Bryan Stitt
a43fda0c32
Bryan devel (#176)
* refactor more balance logic

* refactor more balance checks

* doc running full test suite
2023-07-09 21:37:50 -07:00
Bryan Stitt
0ddd3662ac
David/new balance logic mk3 (#175)
* WIP will work on locks

* added concurrent test for referral, numbers rn still add up

* will change balance table to be a view instead of a table

* merged in devel. will proceed with migrations for rpc_stats_v2 and referral

* WIP

* WIP

* WIP compiling

* gotta add the balance_v2 view

* about to add balance view

* stupid missing closing param

* compiles again, now i will just have to implement the raw sql

* need to paste the real query and play with it

* ok now on to testing

* addresses many comments in PR

* app works for simple unauthorized access. will look into tests

* some tests pass, referral logic tests fail

* not sure why the test is failing

* invalidate cache for admin, will check for more possible targets

* user balance decrease test works

* all tests pass

* changed to active model

---------

Co-authored-by: yenicelik <david.yenicelik@gmail.com>
2023-07-09 20:15:32 -07:00
Bryan Stitt
a560d47c48 lint 2023-07-09 20:13:03 -07:00
David
000a1326c3
New Balance Logic (#174)
* WIP will work on locks

* added concurrent test for referral, numbers rn still add up

* will change balance table to be a view instead of a table

* merged in devel. will proceed with migrations for rpc_stats_v2 and referral

* WIP

* WIP

* WIP compiling

* gotta add the balance_v2 view

* about to add balance view

* stupid missing closing param

* compiles again, now i will just have to implement the raw sql

* need to paste the real query and play with it

* ok now on to testing

* addresses many comments in PR

* app works for simple unauthorized access. will look into tests

* some tests pass, referral logic tests fail

* not sure why the test is failing

* invalidate cache for admin, will check for more possible targets

* user balance decrease test works

* all tests pass
2023-07-09 19:43:44 -07:00
Bryan Stitt
b527f5d0d6
David/remove balance logic non destructive (#173)
* WIP will work on locks

* added concurrent test for referral, numbers rn still add up

* will change balance table to be a view instead of a table

* merged in devel. will proceed with migrations for rpc_stats_v2 and referral

* WIP

* WIP

* WIP compiling

* gotta add the balance_v2 view

* about to add balance view

* stupid missing closing param

* compiles again, now i will just have to implement the raw sql

* need to paste the real query and play with it

* ok now on to testing

* addresses many comments in PR

* app works for simple unauthorized access. will look into tests

* some tests pass, referral logic tests fail

* not sure why the test is failing

---------

Co-authored-by: yenicelik <david.yenicelik@gmail.com>
2023-07-09 19:23:32 -07:00
Bryan Stitt
386363e295 add request id to tracing 2023-07-08 11:57:53 -07:00
Bryan Stitt
9e89304eb7 try_send instead of send 2023-07-07 21:58:00 -07:00
Bryan Stitt
62407ee834 more trace logging cleanup 2023-07-07 16:24:45 -07:00
Bryan Stitt
1b7cc2bffe clean trace logging 2023-07-07 16:22:49 -07:00
Bryan Stitt
78c6179f02 clean up rate limit logging 2023-07-07 15:56:46 -07:00
Bryan Stitt
b476a56ad6 check for U64 instead of just BlockNumber
i thouht block number would be smart enough to deserialize, but it seems like not
2023-07-07 15:28:24 -07:00
Bryan Stitt
71aab0dedc cargo upgrade 2023-07-07 15:16:14 -07:00
Bryan Stitt
b234265458
Premium tier changes (#170)
* lower premium concurrency in preparation for key+IP limits

* include the ip in the user semaphore

* 3, not 5

this is our current limit for free

* per user_id+ip rate limiting
2023-07-07 15:15:41 -07:00
Bryan Stitt
651244fbca lower log levels 2023-07-07 14:14:03 -07:00
Bryan Stitt
57f640765a remove a level of retries 2023-07-07 14:06:44 -07:00
Bryan Stitt
512bcf305b lint 2023-07-07 14:06:35 -07:00
Bryan Stitt
6176a91fc1 whitespace 2023-07-07 12:36:26 -07:00
Bryan Stitt
e15235e2a3 add CU cost for trace_callMany
arbitrary cost. we should do some actual calculations
2023-07-07 12:34:12 -07:00
Bryan Stitt
f49a64e551 raise warning to error 2023-07-07 12:27:20 -07:00
Bryan Stitt
f6fea1541b this is warn, not an error 2023-07-07 12:21:25 -07:00
David
f6337ce940
Update payment_stripe.rs 2023-07-07 08:37:47 -04:00
Bryan Stitt
ac77b691df improve deadlock panic message 2023-07-06 15:03:02 -07:00
Bryan Stitt
a8d2f3fe62 include the error in the warning 2023-07-06 14:58:18 -07:00
Bryan Stitt
cf3d984548
switch the lock type (#165) 2023-07-06 14:54:52 -07:00
Bryan Stitt
4a32ce0a19 only warn if unable to flush 2023-07-06 14:51:21 -07:00