Commit Graph

59 Commits

Author SHA1 Message Date
Varun Srinivasan
645eacea6f refactor(hubble): order and comment cli options for clarity (#1154) 2023-07-16 14:36:57 -07:00
Cassandra Heart
8d0d87dcc1 feat: support direct peering (#1133)
* Support direct peering

* Add changeset
2023-07-14 18:22:10 -05:00
Stephan Cilliers
15d43931f4 feat: support fallback RPC providers (#1128)
CLI now supports comma separated RPC URLs to fall back on (--eth-rpc-url, --eth-mainnet-rpc-url, --l2-rpc-url)

Added --rank-rpcs CLI option which will rank provided RPC URLs by stability and latency if there are multiple
2023-07-14 15:07:51 -05:00
Cassandra Heart
2391c3a5e3 feat: storage registry support (#1052)
This PR adds support for storage events and includes the following changes:

Adds support for storage events in the protobufs
Updates the server to handle rent registry events
Updates the logger to include rent registry and storage admin registry events
Adds CLI option for L2 RPC URL
Adds methods to submit rent registry and storage admin registry events in the mock hub
Updates the sync engine to use L2 events provider
2023-07-12 18:43:41 -05:00
adityapk00
850f82f278 perf: Add a Sync Profiler (#1098)
* feat: Add Sync profiler

* changeset

* bugfix

* pretty print

* cleanup
2023-07-11 10:16:35 -05:00
Sanjay
cd0ddd6d24 feat: Support ENS names in the hub (#1101)
* feat: Add ENS username proof support

* Add UserNameProof store

* ENS name ownership validations

* Add remaining ens validations

* Generate events correctly

* Allow setting ens names on UserData and handle revoking it

* Add changeset and cli flag
2023-07-10 23:40:50 -07:00
Akshaan Kakar
2bfcaf4ec3 feat: create a system to track network propagation delay (#970)
* Add new proto definitions

* Add ping and ack functions

* Add gossip event handler

* Add cli argument for network latency mode

* Add ping message scheduler

* Fix imports

* Add tests for message handler

* Add metrics store

* Fix cli arg name

* Add multinode setup and fix metric logging

* Add docker-compose file for multinode test setup

* Drop hard coded id paths

* preserve backward compatibility of process file path

* Enable gossip network diagnostics

* Add tests 1

* Clean up gossipNode tests

* Fix lint

* Lower frequency for latency pings

* Add tests for metrics

* Improve coverage computation algo

* Clean up

* Fixes from PR feedback

* Fixes from PR feedback

* Fixes from PR feedback

* Rename field for consistency

* Add jitter to ping cron

Add jitter to ping cron

* Log legible peerIds

* Fix import paths

* Update log field name

* Consolidate metrics recorder and ping job

* Fix docker compose

* Add time-to-merge metric

* Confine metrics logic to single class

* Clean up

* Fix div by zero

* Use peerId string as metrics key

* Drop unused getter

* Refactor metrics to be keyed by peerId

* Fix tests

* Clean up and fix tests

* Store metrics in DB

* Replace interfaces with types

* Fix testS

* WIP: Adding metrics serde

* Replace map with object to allow for metrics serde

* Add test for serde

* Fix security warnings

* Fix coverage logging

* Add test

* Move message handling to hub

* Fix timestamp overflow

* Lower ping freq and fix coverage logging

* Add peer network to logs

* Fix merge time metric

* Revert "Fix merge time metric"

This reverts commit 76beb5f11a.

* Expire metrics after logging

* Rename command line arguments

* Fixes + test updateS

* Fixes + test updateS

* Add test for expiry

* Add test for ping function

* Drop unused function

* Record merge times for all merges

* Don't accumulate message count metrics

* Add check for successful message merge

* Re-add generated code

* Fix types

* Re-add generated code

* Fix imports

* fix imports
2023-07-07 21:02:59 -04:00
Tony D'Addeo
f54185f30a chore: hard fail if cannot connect to eth RPC provider (#1086)
* chore: hard fail if cannot connect to eth RPC provider

* add changeset
2023-07-06 17:24:52 -05:00
adityapk00
229b806dd3 Add rocksDB storage profiling (#1085)
* feat: Profile rocksDB storage

* changeset

* fix

* fix index calculation

* cleanup
2023-07-06 13:42:56 -05:00
Varun Srinivasan
4c38067c15 chore: switch from eslint/prettier to rome (#1074)
* chore: add rome config files

* chore: add rome into configs and ci

* chore: remove eslint annotations

* chore: update annotations for rome ignores

* chore: remove prettier
2023-07-04 19:09:15 -07:00
Varun Srinivasan
f176841daf chore: prepare for rome migration (#1077) 2023-07-04 17:48:54 -07:00
Varun Srinivasan
9ffbcc3a99 chore: prepare for rome-tools migration by formatting files (#1073)
* chore(@farcaster/core): apply rome formatter

* chore(@farcaster/hub-nodejs): apply rome formatter

* chore(@farcaster/hub-web): apply rome formatter

* chore(@farcaster/hubble): apply rome formatter
2023-07-04 14:30:23 -07:00
adityapk00
a08bff38ac fix: Better error if hub config is misspecified (#1067)
* fix: Better error if hub config is misspecified

* changeset
2023-07-03 11:13:48 -07:00
Cassandra Heart
1ca8fdcba5 Revert "feat: storage registry support (#1030)" (#1051)
This reverts commit a9da418dbc.
2023-06-29 17:20:36 -05:00
Cassandra Heart
a9da418dbc feat: storage registry support (#1030)
* Initial commit of L2 provider/storage contract integration

* l2 storage admin

* storage store

* update mockhub

* viem

* adjust import

* adjust import

* weave in config

* flesh out l2 test

* storage registry test

* strawman the storage tests

* null check

* switch type

* further updates, updated abi

* temporarily disabling test until anvil issue is sorted out

* more tests

* weird slowdown in node18 test on ci

* ok

* confirm iterator ordering

* rework timestamp into event message

* more coverage
2023-06-29 16:53:22 -05:00
Sanjay
f1c6b25c23 feat: Support fname registry server and store user name proofs (#1014)
* feat: Initial fname registry provider class

* flesh out fname registry provider functionality

* Update to match fip

* Use new query params and gradefully handle errors

* feat: add support for verifying username proofs

* Validate server signatures before submitting username proofs

* Add changeset and default fname server url
2023-06-21 19:33:01 -07:00
Sanjay
6667748a67 fix: Handle peers with zero messages when printing status (#1008)
* fix: Handle peers with zero messages when printing status

* Add changeset
2023-06-05 15:10:17 -07:00
Tony D'Addeo
27181c6ced feat: add fallback to dbreset (#996) 2023-05-26 15:12:52 -05:00
Shane da Silva
23d7a66675 chore: Support pure ESM output (#994)
* Fix import mapping to work with built JS files

This allows us to ship a Docker image that runs using `node` directly,
rather than via `tsx`.

* Remove use of top-level `await` expressions

These were only used in tests and weren't critical. Switch away so we
have the optional to convert to CommonJS if we need.

* Switch all imports to use relative paths instead of ~ shortcut

The ~ shortcut doesn't work in some contexts, which makes our lives more
difficult when trying to output ESM.

Since we were already using relative paths in some part of the codebase
and not others, just switch to using relative paths everywhere for
simplicity.

* Switch imports to append .js extension

And update Jest configuration to work with this extension.

* Build single image instead of two separate ones

We originally created the other image so that we could build an image
using only packages published to NPM, but this proved problematic when
wanting to test those changes without publishing.

Since there are more situations where we'd want to ship an image using
unpublished packages (i.e. for testing) remove the "public" image and
update our "testing" image to also be used as the public image. However,
a key difference is that the testing image will now run compiled JS
instead of using a TypeScript interpreter.
2023-05-24 20:02:38 -07:00
Akshaan Kakar
7b4557128f chore: Add docker compose file for multi-node test setup (#984)
* Add docker-compose file for multinode test setup

* Drop hard coded id paths

* preserve backward compatibility of process file path
2023-05-19 13:24:48 -04:00
Sanjay
c489175437 feat: Sync status improvements (#954)
* feat: improve status reporting

* Add changeset

* Fix test
2023-05-10 10:02:26 -07:00
Aidan Musnitzky
e891c69cdf Fix block number parsing in cli (#937) 2023-05-09 16:50:33 -07:00
Sanjay
1236b4e956 feat: Add a status hubble command for friendly reporting of current hub status (#944)
* feat: Suport sync status rpc call

* Add sync status hubble command

* Fix generated file

* Changeset

* Fix isSyncing check

* Rename to status and report db stats as well

* Fix error
2023-05-08 14:48:24 -07:00
Sanjay
421c385453 feat: Add sync stats to getInfo call (#916)
* refactor: Rename sync events flag for clarity

* feat: Add sync statuts to HubInfo RPC call

* feat: Add sync stats to getInfo rpc call

* re-patch hub-web to use default export as before

* changeset
2023-04-25 10:40:59 -07:00
Paul Fletcher-Hill
1680726c36 parse cli chunk-size as number (#908) 2023-04-24 15:29:41 -04:00
Sanjay
5cee2c5526 fix: Fix off by one error when retrying id registry event on sync (#899)
* fix: Fix off by one error when retrying id registry event on sync

* feat: Add a command line flag to resync eth events from the beginning

* Add changeset
2023-04-20 18:18:49 -07:00
Sanjay
31d8917f66 feat: make commit lock queue size and timeout configurable (#830)
* feat: make commit lock queue size and timeout configurable

* Add changeset

* make StorageCache a child of StoreEventHandler

---------

Co-authored-by: Paul Fletcher-Hill <pfletcherhill@gmail.com>
2023-04-10 15:17:22 -04:00
adityapk00
0fbbbccf24 fix: Make dbreset its own command (#838) 2023-04-07 07:59:01 -07:00
PangZhi
1f47906693 feat: refactor protobufs and utils to remove grpc-js dependency (#798)
* remove grpc-js dependency from protobufs, refactor hubble to use hub-nodejs

* hub-web to use @farcaster/protobufs and utils

* add yarn.lock

* refactor hubble app to only use hub-nodejs

* update readme

* update export order

* update export order

* fix protobufs namespace build issue

* update codecov

* fix protobufCommand naming

---------

Co-authored-by: Paul Fletcher-Hill <pfletcherhill@gmail.com>
2023-04-04 09:27:53 -07:00
adityapk00
71d6494c04 fix: Better error when id protobuf is not found (#807)
* fix: More information when peerId proto is not found

* changeset
2023-04-04 07:10:34 -07:00
adityapk00
64df474646 fix: Make sure there are no duplicate rpc usernames (#783) 2023-03-29 14:26:58 -07:00
adityapk00
1025d3b38b fix: Support multiple RPC usernames (#782) 2023-03-29 14:14:24 -07:00
adityapk00
58cfbb9b33 fix: Have gossip node listen on 0.0.0.0 by default (#770)
* fix: Have gossip node listen on 0.0.0.0 by default

* changeset
2023-03-28 06:48:56 -07:00
adityapk00
e5cb3276c5 docs: Use SSL or Insecure clients in examples (#754)
* docs: Use SSL or Insecure clients in examples

* remove unnecessary awaits

* Remove getHubRpcClient

* changeset

* Fix changeset

* improve error message
2023-03-25 13:20:07 -07:00
adityapk00
74588d351c feat: Dynamically recover from syncTrie corruption (#753)
* feat: Dynamically recover from syncTrie corruption

* log
2023-03-24 16:55:49 -07:00
adityapk00
7a6599a405 fix: Attempt cleanshutdown on unexpected exceptions (#751) 2023-03-24 13:42:34 -07:00
adityapk00
6a0bf29f91 fix: Share dns name when gossiping contactinfo (#738)
* fix: Share dns name when gossiping contactinfo

* changeset
2023-03-23 10:08:11 -07:00
adityapk00
3d45ccba81 chore: Change port numbers (#726) 2023-03-22 14:44:49 -07:00
adityapk00
c26fafa255 feat: Add test data into test hubs (#719)
* feat: Add test data into test hubs

* changeset
2023-03-22 11:57:31 -07:00
adityapk00
a89a5b9520 feat: Reset DB if DB_RESET_TOKEN is set (#713)
* feat: Reset DB if DB_RESET_TOKEN is set

* changeset
2023-03-21 10:24:31 -07:00
adityapk00
1b0e3a7efc feat: Allow setting rpcAuth via env variables (#698)
* feat: Allow setting rpcAuth via env variables

* changeset
2023-03-20 13:49:48 -07:00
adityapk00
69ff0efada fix: Fix issue with ethers v6 (#696)
* fix: Fix issue with ethers v6

* add warning
2023-03-20 10:26:05 -07:00
Shane da Silva
d63e05f0f9 Switch to time-based check for process shutdown file (#688)
Using `fs.watch` uses `inotify`, which doesn't work with network file
systems like EFS where other kernels could be responsible for changes to
the file system.

Instead, check every 10 seconds to see if there is a change.

Ran this locally and it seemed to work fine.
2023-03-19 14:54:45 -07:00
adityapk00
be864e31c0 Pidfix (#685)
* fix: Use a random number instead of PID

* maxsafeint
2023-03-19 13:36:08 -07:00
adityapk00
b596ec9189 feat: Exit if superseeded by a newer hub (#684)
* feat: Exit if superseeded by a newer hub

* changeset
2023-03-19 13:17:12 -07:00
adityapk00
6ff9f4e18d fix: Add a grace period before forcing exit after signals (#682) 2023-03-19 11:59:09 -07:00
adityapk00
2bd81f6255 feat: Admin server on localhost only (#667) 2023-03-17 13:27:11 -07:00
adityapk00
cf0c452e3f feat: Add RPC Auth and SSL support (#624)
* feat: Add RPC Auth and SSL support

* tests
2023-03-01 09:35:47 -08:00
payton
bf5beb879d feat: add ability to change contract configuration via cli (#623)
* feat: add ability to change contract configuration via cli

* feat: add cli options for id + name registry contract addresses,
starting block, and block chunk size for historical event syncing

* feat: generalize makeWithGoerli into build factory method for
EthEventsProvider

* feat: default to Goerli constants from hubble.ts instead of
eth/ethEventsProvider.ts

Signed-off-by: Payton Garland <payton.r.g@gmail.com>

* feat: set 10000 as default chunk size in cli

Signed-off-by: Payton Garland <payton.r.g@gmail.com>

* fix: remove redundant default from command option

Signed-off-by: Payton Garland <payton.r.g@gmail.com>

---------

Signed-off-by: Payton Garland <payton.r.g@gmail.com>
2023-03-01 09:16:21 -08:00
adityapk00
cbb6b4aea8 feat: Implement rate limits for gossip/sync (#609)
* feat: Rate limit gossip messages

* rename const
2023-02-24 06:38:17 -08:00