Skip to content

Commit

Permalink
fix(p2p): remove p2p datastore persistence for now (#6879)
Browse files Browse the repository at this point in the history
removing datastore persistence as it's causing issues with discovery
when restarting nodes
  • Loading branch information
spypsy authored Jun 4, 2024
1 parent 1e38115 commit ce7f0e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion yarn-project/p2p/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const createP2PClient = async (
// Create peer discovery service
const peerId = await createLibP2PPeerId(config.peerIdPrivateKey);
discv5Service = new DiscV5Service(peerId, config);
p2pService = await LibP2PService.new(config, discv5Service, peerId, txPool, store);
p2pService = await LibP2PService.new(config, discv5Service, peerId, txPool);
} else {
p2pService = new DummyP2PService();
discv5Service = new DummyPeerDiscoveryService();
Expand Down
10 changes: 2 additions & 8 deletions yarn-project/p2p/src/service/libp2p_service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { type Tx, type TxHash } from '@aztec/circuit-types';
import { SerialQueue } from '@aztec/foundation/fifo';
import { createDebugLogger } from '@aztec/foundation/log';
import { type AztecKVStore } from '@aztec/kv-store';

import { ENR } from '@chainsafe/enr';
import { type GossipsubEvents, gossipsub } from '@chainsafe/libp2p-gossipsub';
Expand All @@ -18,7 +17,6 @@ import { type Libp2p, createLibp2p } from 'libp2p';

import { type P2PConfig } from '../config.js';
import { type TxPool } from '../tx_pool/index.js';
import { AztecDatastore } from './data_store.js';
import { KnownTxLookup } from './known_txs.js';
import { PeerManager } from './peer_manager.js';
import type { P2PService, PeerDiscoveryService } from './service.js';
Expand Down Expand Up @@ -99,7 +97,7 @@ export class LibP2PService implements P2PService {
if (this.isBootstrapPeer(peerId)) {
this.logger.verbose(`Disconnect from bootstrap peer ${peerId.toString()}`);
} else {
this.logger.verbose(`Disconnected from transaction peer ${peerId.toString()}`);
this.logger.info(`Disconnected from transaction peer ${peerId.toString()}`);
await this.peerManager.updateDiscoveryService();
}
});
Expand Down Expand Up @@ -144,7 +142,6 @@ export class LibP2PService implements P2PService {
peerDiscoveryService: PeerDiscoveryService,
peerId: PeerId,
txPool: TxPool,
store: AztecKVStore,
) {
const { tcpListenIp, tcpListenPort, minPeerCount, maxPeerCount, transactionProtocol: protocolId } = config;
const bindAddrTcp = `/ip4/${tcpListenIp}/tcp/${tcpListenPort}`;
Expand All @@ -163,8 +160,6 @@ export class LibP2PService implements P2PService {
// services.uPnPNAT = uPnPNATService();
// }

const datastore = new AztecDatastore(store);

const node = await createLibp2p({
start: false,
peerId,
Expand All @@ -176,7 +171,6 @@ export class LibP2PService implements P2PService {
maxConnections: config.maxPeerCount,
}),
],
datastore,
streamMuxers: [yamux(), mplex()],
connectionEncryption: [noise()],
connectionManager: {
Expand Down Expand Up @@ -304,7 +298,7 @@ export class LibP2PService implements P2PService {
if (this.isBootstrapPeer(peerId)) {
this.logger.verbose(`Connected to bootstrap peer ${peerId.toString()}`);
} else {
this.logger.verbose(`Connected to transaction peer ${peerId.toString()}`);
this.logger.info(`Connected to transaction peer ${peerId.toString()}`);
await this.peerManager.updateDiscoveryService();
}
}
Expand Down

0 comments on commit ce7f0e2

Please sign in to comment.