diff --git a/.changeset/pretty-tools-do.md b/.changeset/pretty-tools-do.md new file mode 100644 index 0000000000..d40e2b2f46 --- /dev/null +++ b/.changeset/pretty-tools-do.md @@ -0,0 +1,5 @@ +--- +"@farcaster/hubble": patch +--- + +chore: rename/remove v2 contract address cli params after migration diff --git a/apps/hubble/src/cli.ts b/apps/hubble/src/cli.ts index 820d8c20a9..b30bcf59cc 100644 --- a/apps/hubble/src/cli.ts +++ b/apps/hubble/src/cli.ts @@ -80,8 +80,6 @@ app .option("-l, --l2-rpc-url ", "RPC URL of a mainnet Optimism Node (or comma separated list of URLs)") .option("--l2-id-registry-address
", "The address of the L2 Farcaster ID Registry contract") .option("--l2-key-registry-address
", "The address of the L2 Farcaster Key Registry contract") - .option("--l2-id-registry-v2-address
", "The address of the L2 Farcaster ID Registry V2 contract") - .option("--l2-key-registry-v2-address
", "The address of the L2 Farcaster Key Registry V2 contract") .option("--l2-storage-registry-address
", "The address of the L2 Farcaster Storage Registry contract") .option("--l2-resync-events", "Resync events from the L2 Farcaster contracts before starting (default: disabled)") .option("--l2-clear-events", "Deletes all events from the L2 Farcaster contracts before starting (default: disabled)") @@ -488,8 +486,6 @@ app l2RpcUrl: cliOptions.l2RpcUrl ?? hubConfig.l2RpcUrl, l2IdRegistryAddress: cliOptions.l2IdRegistryAddress ?? hubConfig.l2IdRegistryAddress, l2KeyRegistryAddress: cliOptions.l2KeyRegistryAddress ?? hubConfig.l2KeyRegistryAddress, - l2IdRegistryV2Address: cliOptions.l2IdRegistryV2Address ?? hubConfig.l2IdRegistryV2Address, - l2KeyRegistryV2Address: cliOptions.l2KeyRegistryV2Address ?? hubConfig.l2KeyRegistryV2Address, l2StorageRegistryAddress: cliOptions.l2StorageRegistryAddress ?? hubConfig.l2StorageRegistryAddress, l2FirstBlock: cliOptions.l2FirstBlock ?? hubConfig.l2FirstBlock, l2ChunkSize: cliOptions.l2ChunkSize ?? hubConfig.l2ChunkSize, diff --git a/apps/hubble/src/console/console.ts b/apps/hubble/src/console/console.ts index 40c86230d5..c15de850b1 100644 --- a/apps/hubble/src/console/console.ts +++ b/apps/hubble/src/console/console.ts @@ -5,6 +5,8 @@ import { getAuthMetadata, getInsecureHubRpcClient, getSSLHubRpcClient, + toFarcasterTime, + fromFarcasterTime, } from "@farcaster/hub-nodejs"; import path from "path"; import * as repl from "repl"; @@ -15,6 +17,7 @@ import { GenCommand } from "./genCommand.js"; import { FactoriesCommand, ProtobufCommand } from "./protobufCommand.js"; import { RpcClientCommand } from "./rpcClientCommand.js"; import { WarpcastTestCommand } from "./warpcastTestCommand.js"; +import { SyncId } from "../network/sync/syncId.js"; export const DEFAULT_RPC_CONSOLE = "127.0.0.1:2283"; @@ -86,6 +89,9 @@ export const startConsole = async (addressString: string, useInsecure: boolean) // Add some utility functions replServer.context["getAuthMetadata"] = getAuthMetadata; + replServer.context["SyncId"] = SyncId; + replServer.context["toFarcasterTime"] = toFarcasterTime; + replServer.context["fromFarcasterTime"] = fromFarcasterTime; // Run the info command to start diff --git a/apps/hubble/src/hubble.ts b/apps/hubble/src/hubble.ts index 2a8c8feaaa..5824289597 100644 --- a/apps/hubble/src/hubble.ts +++ b/apps/hubble/src/hubble.ts @@ -185,12 +185,6 @@ export interface HubOptions { /** Address of the Key Registry contract */ l2KeyRegistryAddress?: `0x${string}`; - /** Address of the V2 Id Registry contract */ - l2IdRegistryV2Address?: `0x${string}`; - - /** Address of the V2 Key Registry contract */ - l2KeyRegistryV2Address?: `0x${string}`; - /** Address of the StorageRegistry contract */ l2StorageRegistryAddress?: `0x${string}`; @@ -345,8 +339,8 @@ export class Hub implements HubInterface { options.l2RpcUrl, options.rankRpcs ?? false, options.l2StorageRegistryAddress ?? OptimismConstants.StorageRegistryAddress, - options.l2KeyRegistryV2Address ?? OptimismConstants.KeyRegistryV2Address, - options.l2IdRegistryV2Address ?? OptimismConstants.IdRegistryV2Address, + options.l2KeyRegistryAddress ?? OptimismConstants.KeyRegistryV2Address, + options.l2IdRegistryAddress ?? OptimismConstants.IdRegistryV2Address, options.l2FirstBlock ?? OptimismConstants.FirstBlock, options.l2ChunkSize ?? OptimismConstants.ChunkSize, options.l2ChainId ?? OptimismConstants.ChainId, diff --git a/apps/hubble/src/network/sync/multiPeerSyncEngine.test.ts b/apps/hubble/src/network/sync/multiPeerSyncEngine.test.ts index 5153049cd5..df67785f7f 100644 --- a/apps/hubble/src/network/sync/multiPeerSyncEngine.test.ts +++ b/apps/hubble/src/network/sync/multiPeerSyncEngine.test.ts @@ -42,7 +42,6 @@ let signerEvent: OnChainEvent; let storageEvent: OnChainEvent; let castAdd: Message; let fname: UserNameProof; -const blockNumber = 111888235; // Post v2 migration block const eventsByBlock = new Map(); // biome-ignore lint/suspicious/noExplicitAny: mock used only in tests @@ -58,7 +57,7 @@ const retryTransferByName = fnameEventsProvider.retryTransferByName; beforeAll(async () => { const custodySignerKey = (await custodySigner.getSignerKey())._unsafeUnwrap(); const signerKey = (await signer.getSignerKey())._unsafeUnwrap(); - custodyEvent = Factories.IdRegistryOnChainEvent.build({ fid, blockNumber }, { transient: { to: custodySignerKey } }); + custodyEvent = Factories.IdRegistryOnChainEvent.build({ fid }, { transient: { to: custodySignerKey } }); signerEvent = Factories.SignerOnChainEvent.build( { fid, blockNumber: custodyEvent.blockNumber + 1 }, diff --git a/apps/hubble/src/network/sync/syncEngine.ts b/apps/hubble/src/network/sync/syncEngine.ts index e76c1fd360..1c62f3d0f2 100644 --- a/apps/hubble/src/network/sync/syncEngine.ts +++ b/apps/hubble/src/network/sync/syncEngine.ts @@ -405,7 +405,7 @@ class SyncEngine extends TypedEmitter { const existingPeerInfo = this.getContactInfoForPeerId(peerId.toString()); if (existingPeerInfo) { if (contactInfo.timestamp > existingPeerInfo.contactInfo.timestamp) { - log.info({ peerInfo: existingPeerInfo }, "Updating peer with latest contactInfo"); + log.debug({ peerInfo: existingPeerInfo }, "Updating peer with latest contactInfo"); this.currentHubPeerContacts.set(peerId.toString(), { peerId, contactInfo }); } return err(new HubError("bad_request.duplicate", "peer already exists")); @@ -880,12 +880,7 @@ class SyncEngine extends TypedEmitter { const promises: Promise[] = []; for (const syncId of syncIds) { const unpacked = syncId.unpack(); - if (unpacked.type === SyncIdType.FName && this._fnameEventsProvider && unpacked.padded) { - // Temporarily add padded check here so newer hubs don't think unpadded fnames from older hubs are missing. - // TODO: Remove after most hubs are >1.7.1 - if (!unpacked.padded) { - continue; - } + if (unpacked.type === SyncIdType.FName && this._fnameEventsProvider) { log.info(`Retrying missing fname ${Buffer.from(unpacked.name).toString("utf-8")} during sync`, { fid: unpacked.fid, }); @@ -904,11 +899,6 @@ class SyncEngine extends TypedEmitter { for (const syncId of syncIds) { const unpacked = syncId.unpack(); if (unpacked.type === SyncIdType.OnChainEvent && this._l2EventsProvider) { - // Add block number check here so newer hubs don't think attempt to sync v1 id and key registry events from older hubs - // TODO: Remove after most hubs are >1.7.1 - if (unpacked.eventType !== OnChainEventType.EVENT_TYPE_STORAGE_RENT && unpacked.blockNumber < 111888232) { - continue; - } log.info(`Retrying missing block ${unpacked.blockNumber} during sync`, { fid: unpacked.fid }); promises.push(this._l2EventsProvider.retryEventsFromBlock(unpacked.blockNumber)); } diff --git a/apps/hubble/www/docs/docs/cli.md b/apps/hubble/www/docs/docs/cli.md index 67156cb160..83e953a307 100644 --- a/apps/hubble/www/docs/docs/cli.md +++ b/apps/hubble/www/docs/docs/cli.md @@ -43,8 +43,6 @@ Ethereum Options: L2 Options: --l2-id-registry-address The address of the L2 Farcaster ID Registry contract --l2-key-registry-address
The address of the L2 Farcaster Key Registry contract - --l2-id-registry-v2-address The address of the L2 Farcaster ID Registry V2 contract - --l2-key-registry-v2-address
The address of the L2 Farcaster Key Registry V2 contract --l2-storage-registry-address
The address of the L2 Farcaster Storage Registry contract --l2-resync-events Resync events from the L2 Farcaster contracts before starting (default: disabled) --l2-clear-events Deletes all L2 events before starting (default: disabled)