Commit Graph

1427 Commits

Author SHA1 Message Date
Bryan Stitt
9ba2045dbd improve health checking 2023-10-10 15:46:11 -07:00
Bryan Stitt
a10a283023 trust just removing uncles from the cache 2023-10-10 14:21:54 -07:00
Bryan Stitt
78edfee6b9 timeout and server selection fixes
add a short connect timeout separate from the overall request timeout.

also fix a bug when only 1 server was in the rpc list causing a very tight loop that made tokio sad
2023-10-09 23:30:17 -07:00
Bryan Stitt
ab16f6b2e8 check for MDBX_PANIC 2023-10-09 09:38:58 -07:00
Bryan Stitt
d04f99a0e4 DRY 2023-10-07 16:52:54 -07:00
Bryan Stitt
e02a1e3b7c stream again 2023-10-07 16:52:46 -07:00
Bryan Stitt
36ce2f6524 derp 2023-10-07 16:16:42 -07:00
Bryan Stitt
7e0b6c3034 next_available should not be reversed and other bugs 2023-10-07 16:12:51 -07:00
Bryan Stitt
5a1a87a314 stream should count as success. lagged return the rpc 2023-10-07 15:18:55 -07:00
Bryan Stitt
4dc6f47f9a add new_internal_requests to the logs 2023-10-07 14:36:36 -07:00
Bryan Stitt
580f4c1865 lint 2023-10-07 14:26:10 -07:00
Bryan Stitt
de5674254b hopefully handle min_synced_rpcs properly 2023-10-07 13:45:04 -07:00
Bryan Stitt
9ed0c70ecd wait for lagged rpcs. v1.43.19 2023-10-07 11:58:47 -07:00
Bryan Stitt
349be463f3 initial sort on median latency instead of weighted peak 2023-10-07 10:31:33 -07:00
Bryan Stitt
b2ab5bd6d6 fix from_rpcs 2023-10-07 10:06:01 -07:00
Bryan Stitt
cc2eb9e862 no more overflow on the pending txid firehose 2023-10-07 03:41:11 -07:00
Bryan Stitt
36363c8921 lint 2023-10-07 00:35:22 -07:00
Bryan Stitt
d38a35903e cargo update 2023-10-07 00:35:22 -07:00
Bryan Stitt
97f7e1673e finish todo for waiting for head_block_sender 2023-10-07 00:35:22 -07:00
Bryan Stitt
aeb30787dd more openssl and no rmp
i like rustls, but we can't use it on everything and so our compile times are bad
2023-10-07 00:35:22 -07:00
Bryan Stitt
159fef9e8d include ws_url in hash 2023-10-07 00:35:22 -07:00
Bryan Stitt
f7997a4878 split inner and outer 2023-10-07 00:35:22 -07:00
Bryan Stitt
949c3eeb5d DRY throttling 2023-10-07 00:35:22 -07:00
Bryan Stitt
9a7777e3f9 fix >= to < 2023-10-07 00:35:22 -07:00
Bryan Stitt
8180290be7 chain isn't ExactSizeIterator 2023-10-07 00:35:22 -07:00
Bryan Stitt
c1df05f8b6 fix sort order (hopefully) 2023-10-07 00:35:22 -07:00
Bryan Stitt
0dcc324b61 disable tests that need refactor to match new code 2023-10-07 00:35:22 -07:00
Bryan Stitt
6756559ec2 wow this got big 2023-10-07 00:35:22 -07:00
Bryan Stitt
f704d1c4aa more refs will cut down on cloning an Arc multiple times that isn't really necessary 2023-10-07 00:35:22 -07:00
Bryan Stitt
376048a76b bump returndata limit to 16mb 2023-10-07 00:35:22 -07:00
Bryan Stitt
9258d36e6a refactor rpc selection 2023-10-07 00:35:22 -07:00
Bryan Stitt
d6e9f61ee2 only send to 2 servers (not 3x2) 2023-10-06 00:04:46 -07:00
Bryan Stitt
249ad884fc only send to 3 servers 2023-10-05 20:28:22 -07:00
Bryan Stitt
bba02cc121
temporarily switch off streaming and always buffer (#225)
Co-authored-by: Rory Neithinger <rory@llamanodes.com>
2023-10-05 18:26:29 -07:00
Bryan Stitt
32862937ad fix newHead serialization 2023-10-05 11:01:24 -07:00
Bryan Stitt
f153b2b805
add method/params to duplicate stream (#224)
Co-authored-by: Rory Neithinger <rory@llamanodes.com>
2023-10-04 21:53:46 -07:00
Bryan Stitt
c1c127e6bd try_send_all_synced_connections for getting transactions 2023-10-03 21:35:25 -07:00
Bryan Stitt
dd3fc165e3 error instead of panic 2023-10-03 19:05:15 -07:00
Bryan Stitt
e917a11d6c
Suprisingly large refactor to get ids everywhere (#222)
* cargo upgrade --incompatible and update

* first draft at suprisingly_large_refactor_to_get_ids_everywhere

* put app in a task_local

* ref cleanup

* use a OnceLock instead of a tokio local

* test more methods

* APP isn't set in all tests

* it compiles. tests fail. todos still open

* use the app only when necessary

* more tests. less panic

* less verbose debug impl

* short enum names

* move kafka and secrets to their own files

* main tests pass

* add debug chain block time

* helper for stats that ignores internal stats

* Update Jenkinsfile (#223)

* more tests

---------

Co-authored-by: Pewxz <124064710+pewxz@users.noreply.github.com>
2023-10-03 13:46:27 -07:00
Bryan Stitt
abe516c21e turn down logging on eth_getLogs for now 2023-09-29 10:37:49 -07:00
Bryan Stitt
f0b6465069
streaming responses 2 (#219)
* streaming responses compile, still small TODOs & cleanup

* refactor to allow short curcuits on uncacheable requests (#220)

* refactor to allow short curcuits on uncacheable requests

* handle error inside an Arc from moka

* arc instead of box

* lint

* more lint

* add bonus rate limits and keep all semaphores after rate limits (#221)

* add bonus rate limits and keep all semaphores after rate limits

* remove stale todos

* better function names

* cargo upgrade and update

* make some panics warn. more todo

* pass request_metadata through so streaming responses include their final size

* remove stale TODO

* remove more stale todos

* add file i missed

* make to_json_string work well enough

* check config for free_subscriptions

---------

Co-authored-by: Rory Neithinger <rory@llamanodes.com>
2023-09-26 18:18:06 -07:00
Bryan Stitt
5b0aebb6e5 allow missing params in requests 2023-09-26 17:41:42 -07:00
Bryan Stitt
f79c8adbf9
add a shared pool of bonus concurrency (#218) 2023-09-25 12:34:00 -07:00
Bryan Stitt
3aee9071ad require active premium for most websocket subscriptions
only newHeads is allowed without premium
2023-09-25 10:38:55 -07:00
Bryan Stitt
9b2f27862d remove unnecessary yield_nows 2023-09-21 11:22:20 -07:00
Bryan Stitt
ac2f518174 filter_map instead of unwrap 2023-09-20 10:14:21 -07:00
Bryan Stitt
dc037e663a
tokio spawn the cached future (#217)
* tokio spawn the cached future

* lint
2023-09-20 10:11:07 -07:00
Bryan Stitt
e4d3a736d0 return an error earlier 2023-09-19 19:22:28 -07:00
Bryan Stitt
8a0c2dfdc1 try timeout inside the cache get again but with shorter timeouts 2023-09-19 18:37:49 -07:00
Bryan Stitt
0437d9bfc9 sigh 2023-09-19 15:38:40 -07:00
Bryan Stitt
fe2493236e missing & 2023-09-19 15:28:53 -07:00
Bryan Stitt
e137d813af this fix got lost in rebases 2023-09-19 15:28:07 -07:00
Bryan Stitt
8b08828473 make it compile. my editor didnt show any errors 🤷 2023-09-19 14:57:42 -07:00
Bryan Stitt
f0be8b992b always wait for watch_ranked_rpcs change 2023-09-19 14:42:31 -07:00
Bryan Stitt
10c4ffc9d2 smarter archive retry 2023-09-19 10:56:54 -07:00
Bryan Stitt
60ffbdfbb2 move the timeout outside the try_get_with 2023-09-19 09:24:07 -07:00
Bryan Stitt
41314df25b move another yield_now 2023-09-18 23:42:54 -07:00
Bryan Stitt
fc287d24ea borrow_and_update instead of borrow
i think this won't matter and the update is probably a waste, but it feels wrong to leave it in a changed state
2023-09-18 23:29:01 -07:00
Bryan Stitt
94cbe6153a remove timeout layer. its not playing nice with moka 2023-09-18 23:18:52 -07:00
Bryan Stitt
6d4d8ea840 minor refactor of error retry logic 2023-09-18 23:17:55 -07:00
Bryan Stitt
5f85a17b19 put timeout around the moka stuff
we went a long time without seeing errors on this, but i just saw some again
2023-09-18 23:08:16 -07:00
Bryan Stitt
e6c376ae94 add block interval for zkevm polygon 2023-09-18 15:21:02 -07:00
Bryan Stitt
37df2a5650 delete unused deps 2023-09-18 14:32:02 -07:00
Bryan Stitt
3174fa5bad increase cost of eth_subscribe(newPendingTransactions) 2023-09-18 14:18:05 -07:00
Bryan Stitt
f4a648223b add uptime to /status 2023-09-18 12:35:17 -07:00
Bryan Stitt
b5a1e9ff71 add start Instant to app 2023-09-18 12:33:58 -07:00
Bryan Stitt
7e60a21956 prepare for more complex variable pricing 2023-09-18 12:26:52 -07:00
Bryan Stitt
a68a98ce41 cargo upgrade and update
moka 0.12 required some migration help: https://github.com/moka-rs/moka/blob/main/MIGRATION-GUIDE.md
2023-09-18 11:04:22 -07:00
Bryan Stitt
c72db731bd add block times for optimism and base 2023-09-18 10:55:30 -07:00
Bryan Stitt
357dae108a loop, dont crash 2023-09-14 12:51:40 -07:00
Bryan Stitt
8e5a27a184 use Ordering::Relaxed more 2023-09-13 12:35:58 -07:00
Bryan Stitt
1fd8f6f383
Deduped broadcast channel (#209)
* upgrade and start adding deduped_broadcast

* basic test

* accept arg for cache ttl

* first pass at bringing the tx firehose back

* try_send instead of send since there aren't always receivers

* deduped broadcaster needs the try send

* track counts and include in /status

* use config for enable subscribe_txs
2023-09-13 12:05:47 -07:00
Bryan Stitt
c7c2497238 add cost for txpool_content and some unimplemented methods 2023-09-12 21:53:44 -07:00
Bryan Stitt
fc7ec5e5ee custom deserializer for BlockDataLimit 2023-09-12 14:59:13 -07:00
Bryan Stitt
56db1eb13e untagged serde magic 2023-09-12 14:30:01 -07:00
Bryan Stitt
ceb202b53c allow the string 'Archive' when setting block data limit 2023-09-12 13:35:51 -07:00
Bryan Stitt
d34f884f1c clean inputs to Web3ProxyError::MethodNotFound 2023-09-07 13:09:03 -07:00
Bryan Stitt
71dd6614dc test chain priced same as eth 2023-09-02 11:32:10 -07:00
Bryan Stitt
633abc0d60 make wait_for_best_rpc work for private/4337/groups without head subscriptions 2023-09-02 10:59:07 -07:00
Bryan Stitt
2cf688cc68 fix one syntax error 2023-09-02 10:38:26 -07:00
Bryan Stitt
5ce1b5bace add web3_bundlerVersion with the same cost as web3_clientVersion 2023-09-02 10:30:42 -07:00
Bryan Stitt
8d51a1b4dd remove stale comment 2023-09-02 10:20:50 -07:00
Bryan Stitt
428dfdd835 improve 4337 bundler support and retries 2023-09-02 10:19:43 -07:00
Bryan Stitt
a487ce5149 skip backups unless backups are needed for ranked_rpcs to exist 2023-09-01 17:01:59 -07:00
Bryan Stitt
f415315626 check more possible empty values 2023-09-01 16:56:20 -07:00
Bryan Stitt
484610b80f cargo upgrade and update 2023-08-30 21:05:34 -07:00
Bryan Stitt
0ff3ccd479 eth = 0.0000004. everything else to match polygon (0.0000005333) 2023-08-30 21:02:31 -07:00
Bryan Stitt
e76bef272f put rate limit things into data 2023-08-24 13:25:14 -07:00
Bryan Stitt
2acca1fbbc unimplemented compute units for alchemy_ method 2023-08-22 13:27:19 -07:00
Bryan Stitt
8b4aba592c cargo fmt 2023-08-22 10:49:04 -07:00
Bryan Stitt
372c3c60fd shorter cache and timeout on /status and related endpoints 2023-08-22 10:42:02 -07:00
Bryan Stitt
99d405f7db Revert "remove caching the /status things"
This reverts commit c5827b6f37ff44f50a63c07e6c03023429b97287.
2023-08-22 10:37:12 -07:00
Bryan Stitt
c5827b6f37 remove caching the /status things 2023-08-21 15:45:23 -07:00
Bryan Stitt
dbda653812 trim trailing slashes isn't working as expected. put the routes back for now 2023-08-21 15:18:57 -07:00
Bryan Stitt
d2aa67e8ee test more methods 2023-08-17 21:55:58 -07:00
Bryan Stitt
10a8620044 fix method not found jsonrpc error codes 2023-08-17 15:32:22 -07:00
Bryan Stitt
e0f700189b fix error code on method not implemented and error_response user_response bools 2023-08-17 13:44:26 -07:00
Bryan Stitt
36eb520f84 rename block_ to block_and_rpc_ where applicable 2023-08-16 13:20:22 -07:00
Bryan Stitt
5b9ef30e64 include user_error_response in aggregate stats 2023-08-15 17:08:11 -07:00
Bryan Stitt
54341c4654 learn to cache more 2023-08-15 16:37:53 -07:00
Bryan Stitt
70d75d5acb exit early when empty params array 2023-08-15 16:20:25 -07:00
Bryan Stitt
b742a25729 dont return max depth so we can do cannonical block faster 2023-08-15 16:12:40 -07:00
Bryan Stitt
805cb6ad10 ignore alchemy_ methods 2023-08-08 17:40:26 -07:00
Bryan Stitt
3f932b9d57 also bump cli version 2023-08-08 15:58:21 -07:00
Bryan Stitt
a844c5f624 remove accidental todos 2023-08-08 15:52:11 -07:00
Bryan Stitt
8ea587120b handle functions that need the block num instead of the hash 2023-08-08 15:50:34 -07:00
Bryan Stitt
c38c27a3d1 lint 2023-08-07 15:25:14 -07:00
Bryan Stitt
bc8040f61d more yields and less timeouts 2023-08-04 18:54:16 -07:00
Bryan Stitt
aed98ac034 try yielding around all selects 2023-08-04 18:37:46 -07:00
Bryan Stitt
0bc523ab9f improve hard limits
rate limit per server or per endpoint and with any period
2023-08-03 12:24:28 -07:00
Bryan Stitt
690601643d improve eth_sendRawTransaction and other timeouts 2023-08-03 11:39:48 -07:00
Bryan Stitt
74224977b7 Revert "Revert "remove max_tries for now""
This reverts commit 5fbcb75157cd012b723c9d2b37bb7947e5e05aa5.
2023-08-03 09:15:31 -07:00
Bryan Stitt
ec0b733c8e cache 16 MiB responses
we should really just get this from config
2023-08-03 01:19:12 -07:00
Bryan Stitt
ca802751c1 if block fails, try other rpcs 2023-08-03 00:29:13 -07:00
Bryan Stitt
5747caec71 break if no max_wait 2023-08-03 00:23:44 -07:00
Bryan Stitt
5fbcb75157 Revert "remove max_tries for now"
This reverts commit e0d7d11398163bb8554cd6736d1dbc7f55caaa24.
2023-08-03 00:22:45 -07:00
Bryan Stitt
ab6d3a1d9b split command line into separte module 2023-08-03 00:16:54 -07:00
Bryan Stitt
e0d7d11398 remove max_tries for now
i think this is causing problematic looping
2023-08-02 22:07:28 -07:00
Bryan Stitt
8aac4779bf clean up some selects 2023-08-02 21:27:56 -07:00
Bryan Stitt
d25884dfbb dont cache responses larger than 2MB 2023-08-02 15:22:26 -07:00
Bryan Stitt
7cd91af3a8 don't cache nulls 2023-07-31 14:26:07 -07:00
Bryan Stitt
ca92b3646c cache eth_feeHistory and eth_gasPrice 2023-07-28 10:41:23 -07:00
Bryan Stitt
1185b2d0f9 cache eth_maxPriorityFeePerGas with the head block 2023-07-28 10:38:12 -07:00
Bryan Stitt
a696fb92f6 disable CheckEmailInput for now 2023-07-27 13:52:12 -07:00
Bryan Stitt
32a73a0c53 cargo upgrade --incompatible 2023-07-27 12:29:10 -07:00
Bryan Stitt
9c458c9ee0 add grant_credits_to_address script 2023-07-27 12:29:10 -07:00
Bryan Stitt
f9dd827439 add a log message about how many users are being upgraded 2023-07-27 12:29:10 -07:00
Bryan Stitt
67fd5a2188 change log levels 2023-07-26 16:42:49 -07:00
Bryan Stitt
788ebff29f improve logging during payment parsing 2023-07-26 16:39:17 -07:00
Bryan Stitt
2b14842879 check the payment factory address against the log address 2023-07-26 13:22:13 -07:00
Bryan Stitt
b1f447c5c8
add mass_grant_credits helper script and other prep for premium (#196)
* add mass_grant_credits helper script

* include error in the rate limit log

* allow granting 0 credits

* migration to change default user_tier to premium
2023-07-26 07:33:00 -07:00
Bryan Stitt
b80f994e90 timestamps instead of tags for cardinality reduction 2023-07-25 21:45:01 -07:00
talking-llama
e238203bbc
Add OtterScan Methods and corresponding CUs (#195)
Co-authored-by: Rory Neithinger <rorytrent@gmail.com>
2023-07-25 21:06:03 -07:00
Bryan Stitt
c831a810b4 error level for anyhow errors 2023-07-25 15:15:03 -07:00
Bryan Stitt
05e618f74c
Anon rpc accounting (#194)
* cargo generate migrations didnt work without this

* anon rpc accounting

* Revert "anon rpc accounting"

This reverts commit f1b8cbcdeca0d5f9545da32f11dda6a90854f97a.

* 0 for anon in mysql

* only set approximate_balance_remaining on owned stats

* only set self.approximate_balance_remaining when adding if some

* todo complete
2023-07-24 22:02:33 -07:00
Bryan Stitt
439ac49495 jsonrpc formatted errors for JsonRejection 2023-07-24 16:25:58 -07:00
Bryan Stitt
e01b3c2806 watch for SIGTERM 2023-07-22 02:30:49 -07:00
Bryan Stitt
12f3f940a0 include the window in the tsdb logs 2023-07-22 01:56:13 -07:00
Bryan Stitt
35b03cffad lint 2023-07-22 01:41:07 -07:00
Bryan Stitt
80d50bc2c0 need unique names in tests 2023-07-22 01:38:54 -07:00
Bryan Stitt
4091e05f3d influx id from config. default to the hostname or fallback to ulid 2023-07-22 00:26:02 -07:00
Bryan Stitt
df027527e9 remove origin (pt 2) 2023-07-21 22:47:43 -07:00
Bryan Stitt
252b3001c1 increment a wrapping counter every time we save stats 2023-07-21 22:47:22 -07:00
Bryan Stitt
39141c1e52 comments 2023-07-21 22:14:31 -07:00
Bryan Stitt
185ce7a3b4 flush tsdb every 10 2023-07-21 16:39:27 -07:00
Bryan Stitt
88b2618edf add to the running total everywhere 2023-07-21 16:38:02 -07:00
Bryan Stitt
b08a279b60 add another field to try to handle improper de-duplication 2023-07-21 16:29:10 -07:00
Bryan Stitt
620f2d9d00 30 second flushes for db too 2023-07-21 16:12:43 -07:00
Bryan Stitt
0a3698de0f 30 seconds for tsdb everywhere 2023-07-21 15:51:32 -07:00
Bryan Stitt
f15f1027cf stat buffer count total requests and print on exit 2023-07-21 15:25:02 -07:00
yenicelik
f7cfd39d93 Revert "Merge branch 'devel' of github.com:llamanodes/web3-proxy into devel"
This reverts commit 4fc745b52b90b72fdd2d9e8e990ec2d42d9f680d, reversing
changes made to bc6d18041d652502f83d44aedbea234e02b59f6f.
2023-07-21 18:03:55 -04:00
Bryan Stitt
489cd7c326 drop Origin (it was none everywhere already anyways) 2023-07-21 14:50:38 -07:00
Bryan Stitt
d4518cd2bf spans on the stat add function 2023-07-21 14:27:43 -07:00
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
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
cb5c1c6582 no limits on rpc_secret_key_cache and user_balance_cache 2023-07-20 19:04:32 -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
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
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
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
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