Commit Graph

57 Commits

Author SHA1 Message Date
Sanjay
4c9fb6176d feat: allow sharding event stream by fid (#1917)
## Motivation

Allow sharding the event stream by fid

## Change Summary

Describe the changes being made in 1-2 concise sentences.

## Merge Checklist

_Choose all relevant options below by adding an `x` now or at any time
before submitting for review_

- [x] PR title adheres to the [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/) standard
- [x] PR has a
[changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets)
- [x] PR has been tagged with a change label(s) (i.e. documentation,
feature, bugfix, or chore)
- [ ] PR includes
[documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs)
if necessary.
- [x] All [commits have been
signed](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#22-signing-commits)

## Additional Context

If this is a relatively large or complex change, provide more details
here that will help reviewers

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces sharding of event streams by `fid`, adds
`total_shards` and `shard_index` fields, and updates event handling
logic.

### Detailed summary
- Introduces sharding event stream by `fid`
- Adds `total_shards` and `shard_index` fields for event stream sharding
- Updates event handling logic based on sharding parameters

> The following files were skipped due to too many changes:
`apps/hubble/src/rpc/test/eventService.test.ts`

>  Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
2024-04-16 09:50:17 -07:00
adityapk00
5ca5a4a52d Create and gossip bundles (#1888)
## Motivation

Gossip MessageBundles instead of individual messages

## Change Summary

- The feature is in, but it is not turned on yet. It can be % rolled out
via network config

## Merge Checklist

_Choose all relevant options below by adding an `x` now or at any time
before submitting for review_

- [X] PR title adheres to the [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/) standard
- [X] PR has a
[changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets)
- [X] PR has been tagged with a change label(s) (i.e. documentation,
feature, bugfix, or chore)
- [ ] PR includes
[documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs)
if necessary.
- [X] All [commits have been
signed](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#22-signing-commits)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces gossip MessageBundles, adds `mergeMany` method,
refactors message handling, and updates network configuration handling.

### Detailed summary
- Added gossip `MessageBundle` in `gossip.proto`
- Implemented `mergeMany` method in Rust functions
- Refactored message handling in various files
- Updated network configuration handling

> The following files were skipped due to too many changes:
`apps/hubble/src/network/p2p/bundleCreator.ts`,
`apps/hubble/src/storage/stores/rustStoreBase.ts`,
`apps/hubble/src/addon/src/store/store.rs`,
`apps/hubble/src/network/p2p/gossipNode.ts`,
`apps/hubble/src/storage/stores/castStore.test.ts`,
`apps/hubble/src/storage/engine/index.test.ts`,
`apps/hubble/src/test/e2e/hubbleNetwork.test.ts`,
`apps/hubble/src/network/p2p/bundleCreator.test.ts`,
`packages/hub-web/src/generated/gossip.ts`,
`packages/hub-nodejs/src/generated/gossip.ts`,
`packages/core/src/protobufs/generated/gossip.ts`,
`apps/hubble/src/storage/stores/castStoreBundle.test.ts`,
`apps/hubble/src/test/e2e/gossipNetworkBundle.test.ts`,
`apps/hubble/src/storage/engine/index.ts`,
`apps/hubble/src/network/p2p/gossipNodeWorker.ts`,
`apps/hubble/src/network/utils/networkConfig.test.ts`,
`apps/hubble/src/hubble.ts`

>  Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
2024-04-12 09:34:11 -05:00
horsefacts
22615b3c3a feat: add address to frame message (#1807)
## Motivation

It's useful for frames to know:

1) the current connected address, to generate transaction calldata
2) the actual address that executed a tx, in the post transaction
callback

We should pass this as part of the frame message.

## Change Summary

- Add `address` field to `FrameActionBody`
- Limit length to 64 bytes.

## Merge Checklist

_Choose all relevant options below by adding an `x` now or at any time
before submitting for review_

- [x] PR title adheres to the [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/) standard
- [x] PR has a
[changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets)
- [x] PR has been tagged with a change label(s) (i.e. documentation,
feature, bugfix, or chore)
- [ ] PR includes
[documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs)
if necessary.
- [x] All [commits have been
signed](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#22-signing-commits)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates message schemas and validations to include a
chain-specific address for transaction actions.

### Detailed summary
- Added `address` field to message schemas
- Updated validations to check address length
- Updated message serialization and deserialization functions to handle
the `address` field

> The following files were skipped due to too many changes:
`packages/hub-web/src/generated/rpc.ts`

>  Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
2024-03-11 17:40:55 -04:00
Zach Terrell
419d82875d feat: Add currentPeers RPC Endpoint (#1630)
## Motivation

This endpoint was added to get an approximate list of all peers on the
network

## Change Summary

- Added new Proto definitions for endpoint
- New accessor method for current peers
- New RPC endpoint for current peers `/v1/peerList`

## Merge Checklist

_Choose all relevant options below by adding an `x` now or at any time
before submitting for review_

- [x] PR title adheres to the [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/) standard
- [x] PR has a
[changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets)
- [ ] PR has been tagged with a change label(s) (i.e. documentation,
feature, bugfix, or chore)
- [x] PR includes
[documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs)
if necessary.
- [x] All [commits have been
signed](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#22-signing-commits)

## Additional Context

Response looks like the following:
```
{
    "contacts": [
        {
            "gossipAddress": {
                "address": "84.247.175.196",
                "family": 4,
                "port": 2282,
                "dnsName": ""
            },
            "rpcAddress": {
                "address": "84.247.175.196",
                "family": 4,
                "port": 2283,
                "dnsName": ""
            },
            "excludedHashes": [],
            "count": 10694067,
            "hubVersion": "2023.12.27",
            "network": "FARCASTER_NETWORK_MAINNET",
            "appVersion": "1.9.2",
            "timestamp": 1705796040744
        },
      ...
```

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds a new `currentPeers` API endpoint and related changes to
support fetching current peer contacts in the Hub network.

### Detailed summary
- Added `currentPeers` RPC endpoint
- Implemented API endpoint for getting a list of current sync peers
- Updated documentation for the new API endpoint
- Added protobuf message for `ContactInfoResponse`
- Updated HTTP server to handle `currentPeers` API call
- Updated TypeScript files to include `ContactInfoResponse` and related
functions

> The following files were skipped due to too many changes:
`packages/core/src/protobufs/generated/request_response.ts`,
`packages/hub-nodejs/src/generated/rpc.ts`,
`packages/hub-web/src/generated/rpc.ts`,
`packages/hub-web/src/generated/gossip.ts`,
`packages/hub-nodejs/src/generated/gossip.ts`

>  Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
2024-02-28 22:35:13 -08:00
horsefacts
579d29a493 feat: add transaction_id to frame message (#1754)
## Motivation

Frame
[transactions](https://www.notion.so/warpcast/Frames-Transactions-Public-Draft-v2-9d9f9f4f527249519a41bd8d16165f73)
require an additional `transaction_id` field in the frame message body.

## Change Summary

- Add `transaction_id` field to `FrameActionBody`.
- Limit to 256 bytes.

## Merge Checklist

_Choose all relevant options below by adding an `x` now or at any time
before submitting for review_

- [x] PR title adheres to the [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/) standard
- [x] PR has a
[changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets)
- [x] PR has been tagged with a change label(s) (i.e. documentation,
feature, bugfix, or chore)
- [ ] PR includes
[documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs)
if necessary.
- [x] All [commits have been
signed](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#22-signing-commits)

## Additional Context

If this is a relatively large or complex change, provide more details
here that will help reviewers


<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds a transaction ID field to frame messages for chain-specific
actions.

### Detailed summary
- Added `transaction_id` field to frame messages
- Updated message schemas in different packages
- Updated validation tests for various message bodies

> The following files were skipped due to too many changes:
`packages/core/src/validations.test.ts`

>  Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
2024-02-29 01:16:19 -05:00
horsefacts
5703d33940 feat: frame message state field (#1717)
* feat: frame message state field

* chore: add changeset
2024-02-22 13:46:58 -05:00
adityapk00
bf37ec7666 fix: Run validateOrRevoke only if signer is changed (#1695)
* fix: Run validateOrRevoke only if signer is changed

* cleanup

* timebug

* review
2024-02-13 09:27:03 -06:00
Sanjay
ae91b73ae0 feat: support solana verified addresses (#1668)
* feat: rename verification message to support additional protocols in the future

* chore: add changeset

* refactor: change signature for verification message

* remove solana related changes

* refactor: update ethereum verification tests to support new protocol field on message

* feat: add initial logic for parsing solana vs ethereum message

* Add protocol to verifications, update tests

* Add sol factories

* Add some verification tests

* Update claim factory for solana

* Fix tests for sol

* Update comment

* Verify signature for solana

* Replace tweetnacl due to dynamic import issue

* Got signature verification working for Solana ed25519

* Add changeset

* minor cleanup

* update solana verification to use full message adhering to off-chain message specification

* Use a simpler claim message format

* feature flag solana verifications

* cleanup

---------

Co-authored-by: Wasif Iqbal <Wazzymandias@users.noreply.github.com>
2024-02-09 14:07:49 -08:00
adityapk00
97a4216508 fix: Stop old messages from being broadcast on gossip (#1688)
* fix: Stop old messages from being broadcast on gossip

* add separate timestamp

* await
2024-02-09 12:18:40 -06:00
Sanjay
6fec63caf3 fix: Keep the old message type name for backwards compatibility (#1678) 2024-02-07 13:17:22 -08:00
Sanjay
763d3154af feat: Rename verifications message to support multiple protocols (#1667)
* Revert "fix: Revert verification rename (#1642)"

This reverts commit f8c5f28034.

* Rename to claimSignature

* Add http api backwards compatibility

* changeset
2024-02-06 16:56:39 -08:00
Sanjay
f8c5f28034 fix: Revert verification rename (#1642)
* Revert "refactor: rename verification message  (#1637)"

This reverts commit fd9f9ff86b.

* Add changeset
2024-02-02 09:10:57 -08:00
Sanjay
362f580b15 feat: add text input frame field (#1639) 2024-02-01 16:39:17 -08:00
Wasif Iqbal
fd9f9ff86b refactor: rename verification message (#1637)
* feat: rename verification message to support additional protocols in the future

* chore: add changeset

* refactor: change signature for verification message
2024-01-31 15:35:35 -06:00
Sanjay
229ea16658 feat: create FrameAction message and add validation endpoint (#1632)
* feat: create FrameAction message and add validation endpoint

* Rename to buttonIndex and add test
2024-01-25 16:01:28 -08:00
Sanjay
704e0777a0 feat: Add more information in the limits response (#1569)
* feat: Add more information in the limits response

* changeset

* Fix flaky test
2023-12-04 10:28:57 -08:00
Cassandra Heart
3313c23244 feat: Add ContactInfoContent signing + config toggle for strict validation + StrictNoSign (#1545)
* first pass, working native signing + tests

* WAR-1064 – add configuration support and validation of contact info signing

* remove signing info from message signature validation

* add changeset

* misref

* pr feedback

* Support clean restarts on specific changes to network config

* don't terminate gossip node unless we are following default termination

* delay invocation if gossip node worker isn't started

* reduce delay to 1s, shouldn't need to exceed
2023-10-26 17:29:03 -05:00
Sanjay
f3d322274b feat: support v2 id and key registry contracts (#1526) 2023-10-24 17:58:30 -07:00
Sagar Dhawan
153da45a5b fix: Remove PubSub based PeerDiscovery (#1530)
* fix: Remove PubSub based PeerDiscovery

* fix: update Grafana dashboard for Hubble

* chore: add changeset

* chore: lint

* chore: tests

* fix: AsyncValidate ContactInfo
2023-10-18 17:18:21 -07:00
adityapk00
ba86d37467 fix: Accept raw databytes if using alternate protobuf encoding (#1508) 2023-10-12 11:04:24 -05:00
Sanjay
433bee81bc [feat]: Enable events sync by default (#1461)
* feat: Enable events sync by default

* changeset

* Fix test
2023-10-09 14:32:26 -07:00
horsefacts
81e6d8ec27 feat: FIP-8 verifications for contract wallets (#1449)
* feat: FIP-8 verifications for contract wallets

* chore: add changeset

* fix: better return types

* feat: validate signature length

* fix: stub test client

* fix: return network_failure on verify error
2023-10-06 20:28:51 -04:00
adityapk00
f5c7034833 docs: Linter now checks rpc.proto to ensure HTTP APIs (#1456) 2023-10-05 09:44:07 -05:00
adityapk00
22f49d8fc1 chore: Cleanup unused protobufs (#1443) 2023-10-02 14:12:52 -05:00
adityapk00
14f67cf242 feat: Add Peer scoring (#1441) 2023-10-02 13:20:28 -05:00
Sanjay
fb1f5c61cf feat: Support onchain events and fnames in sync trie (#1417)
* feat: Support onchain events and fnames in sync trie

* changeset

* fix flaky test
2023-09-25 09:04:55 -07:00
Sanjay
a6747f498c [docs] Update docs post migration (#1384)
* docs: Update docs post migration

* Update docs readme with auto generate instructions
2023-09-13 14:39:08 -07:00
Sanjay
d77970b110 [chore] Delete pre-migration code (#1369)
* Remove deprecated RPC methods

* Delete unused code

* Delete unused code

* Fix store tests

* Fix more tests

* changeset

* Remove more signer code

* Remove unused signature scheme
2023-09-12 11:11:21 -07:00
Sanjay
08b652edd5 fix: Fix onchain event dedup bug (#1354)
* fix: Correct on-chain event dedup bug

* Handle secondary indices

* Only fix up events before the migration

* Add changeset
2023-09-07 20:32:53 -07:00
adityapk00
bc416dbe8c feat: Add hub operator's FID (#1352) 2023-09-07 08:04:56 -05:00
Sanjay
76a031e245 feat: move storage limit constants to core (#1343)
* feat: move storage limit constants to core

* changeset
2023-09-05 17:16:02 -07:00
Sanjay
bf1c44d2f1 feat: Add new signer event fields and new onchainevent RPC calls (#1276)
* feat: RPC compatibility for migration

* Add rpc tests

* Store key and metadata types on onchain signer events

* changeset

* Use generic iterator
2023-08-18 22:06:39 -07:00
Sanjay
1fcfd49517 fix: last block bugs with events providers (#1243)
* fix: last block bugs with events providers

* Remove usages of name registry worker

* Better defaults for OP constants

* Fix tests

* Add changeset
2023-08-14 13:32:45 -07:00
Sanjay
c6d79cdbb8 feat: Handle onchain event edge cases (#1240)
* feat: Handle onchain event ordering edge cases

* changeset

* validate scheme for signer

* Sort events by blocknumber and logindex to reflect actual order of onchain operations

* revert enum ordering changes
2023-08-09 10:14:20 -07:00
adityapk00
e55e571f2d chore: add "getting blockchain events" to hub status (#1239) 2023-08-09 09:04:50 -05:00
Sanjay
86149d3277 feat: Storage RPC (#1211)
* Storage RPC

* added changeset

* updated docs

* Add tests and minor cleanup

* Rename signer on chain event factory for clarity

---------

Co-authored-by: Cassie Heart <cassie@merklemanufactory.com>
2023-08-03 17:10:25 -07:00
Sanjay
67e9466ed5 feat: Refactor storage events to use OnChainEvent (#1210)
* feat: Refactor storage events to use OnChainEvent

* Add tests for getOnChainEvents

* Add changeset

* Guarantee ordering to fix tests
2023-08-02 16:53:11 -07:00
Sanjay
dcd7a14920 feat: Implement migrating to L2 (#1203)
* feat: onchain signers

* Refactor l2 provider to accept more contracts and events easily

* flesh out support for storing onchain events

* Switch source of truth on migration

* Emit events and fix active signer
2023-08-01 10:17:40 -07:00
Varun Srinivasan
c43effe355 docs(hubble): update api, event and message docs (#1148)
* docs(hubble): add git pull to upgrade instructions

* docs(hubble): add documentation for events

* docs(protobuf): update instructions to generate docs

* docs(hubble): update more docs
2023-07-15 22:38:55 -07: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
Sanjay
4fa7a56153 Rename UserDataType.FNAME to USERNAME (#1108) 2023-07-11 17:16:53 -07: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
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
5a1baaedbb feat: Switch from name events to username proofs (#1049)
* feat: switch to username proofs

* Add rpc endpoint

* Add changeset
2023-06-28 17:36:11 -07: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
hellno
9d08463ff6 remove .DS_Store files (#1029) 2023-06-21 12:22:51 -07:00
98967eth
05618d1f8f add my own peer id (#991)
Co-authored-by: Shane da Silva <shane@dasilva.io>
2023-05-25 10:49:41 -07:00
Cassandra Heart
2bc598abcc feat: Links (#973)
* rolling up changes for links FIP

* typeToSetPostfix

* pr feedback

* consistency to avoid js quirks

* add versioning logic and update tests

* include version check in mergeMessages

* update protobuf comment to reflect nit

* added changeset

* code coverage
2023-05-24 19:42:26 -05:00