Skip to content

Commit 46737cb

Browse files
mraljspalladino
andauthored
chore: Revert upgraded libp2p (#15911)" (#16071)
This reverts commit 10f2c5f. Due to a massive increase in e2e flakes --------- Co-authored-by: Santiago Palladino <[email protected]>
1 parent 97b8022 commit 46737cb

36 files changed

+3035
-1112
lines changed

.test_patterns.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ tests:
249249
error_regex: "ContractFunctionExecutionError: The contract function"
250250
owners:
251251
- *mitch
252+
- regex: "src/e2e_block_building"
253+
error_regex: "✕ detects an upcoming reorg and builds a block for the correct slot"
254+
owners:
255+
- *palla
252256

253257
# Nightly GKE tests
254258
- regex: "spartan/bootstrap.sh"

yarn-project/cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"@aztec/stdlib": "workspace:^",
8181
"@aztec/world-state": "workspace:^",
8282
"@iarna/toml": "^2.2.5",
83+
"@libp2p/peer-id-factory": "^3.0.4",
8384
"commander": "^12.1.0",
8485
"lodash.chunk": "^4.2.0",
8586
"lodash.groupby": "^4.6.0",
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import type { LogFn } from '@aztec/foundation/log';
2-
import { privateKeyFromHex } from '@aztec/p2p';
32
import { createBootnodeENRandPeerId } from '@aztec/p2p/enr';
43

5-
export function generateEncodedBootnodeENR(
4+
export async function generateEncodedBootnodeENR(
65
privateKey: string,
76
p2pIp: string,
87
p2pPort: number,
98
l1ChainId: number,
109
log: LogFn,
1110
) {
12-
const { enr } = createBootnodeENRandPeerId(privateKeyFromHex(privateKey), p2pIp, p2pPort, l1ChainId);
11+
const { enr } = await createBootnodeENRandPeerId(privateKey, p2pIp, p2pPort, l1ChainId);
1312
log(`ENR: ${enr.encodeTxt()}`);
1413
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import type { LogFn } from '@aztec/foundation/log';
2-
import { createSecp256k1PrivateKeyWithPeerId, privateKeyToHex } from '@aztec/p2p';
2+
3+
import { createSecp256k1PeerId } from '@libp2p/peer-id-factory';
34

45
export async function generateP2PPrivateKey(log: LogFn) {
5-
const { privateKey, peerId } = await createSecp256k1PrivateKeyWithPeerId();
6-
log(`Private key: ${privateKeyToHex(privateKey)}`);
6+
const peerId = await createSecp256k1PeerId();
7+
const exportedPeerId = Buffer.from(peerId.privateKey!).toString('hex');
8+
log(`Private key: ${exportedPeerId}`);
79
log(`Peer Id: ${peerId}`);
810
}

yarn-project/cli/src/cmds/misc/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ export function injectCommands(program: Command, log: LogFn) {
4040
.addOption(l1ChainIdOption)
4141
.action(async (privateKey: string, p2pIp: string, p2pPort: number, options) => {
4242
const { generateEncodedBootnodeENR } = await import('./generate_bootnode_enr.js');
43-
generateEncodedBootnodeENR(privateKey, p2pIp, p2pPort, options.l1ChainId, log);
43+
await generateEncodedBootnodeENR(privateKey, p2pIp, p2pPort, options.l1ChainId, log);
4444
});
4545

4646
program
4747
.command('decode-enr')
4848
.summary('Decodes an ENR record')
4949
.description('Decodes and ENR record')
5050
.argument('<enr>', 'The encoded ENR string')
51-
.action((enr: string) => {
52-
printENR(enr, log);
51+
.action(async (enr: string) => {
52+
await printENR(enr, log);
5353
});
5454

5555
program

yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { ChainMonitor } from '@aztec/ethereum/test';
1616
import { type Logger, createLogger } from '@aztec/foundation/log';
1717
import { RollupAbi, SlashFactoryAbi, SlasherAbi, SlashingProposerAbi, TestERC20Abi } from '@aztec/l1-artifacts';
1818
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
19-
import { privateKeyFromHex } from '@aztec/p2p';
2019
import type { BootstrapNode } from '@aztec/p2p/bootstrap';
2120
import { createBootstrapNodeFromPrivateKey, getBootstrapNodeEnr } from '@aztec/p2p/test-helpers';
2221
import { tryStop } from '@aztec/stdlib/interfaces/server';
@@ -155,7 +154,7 @@ export class P2PNetworkTest {
155154
}) {
156155
const port = basePort || (await getPort());
157156

158-
const bootstrapNodeENR = getBootstrapNodeEnr(privateKeyFromHex(BOOTSTRAP_NODE_PRIVATE_KEY), port);
157+
const bootstrapNodeENR = await getBootstrapNodeEnr(BOOTSTRAP_NODE_PRIVATE_KEY, port);
159158
const bootstrapNodeEnr = bootstrapNodeENR.encodeTxt();
160159

161160
const initialValidatorConfig = await createValidatorConfig(
@@ -187,7 +186,7 @@ export class P2PNetworkTest {
187186
await this.snapshotManager.snapshot('add-bootstrap-node', async ({ aztecNodeConfig }) => {
188187
const telemetry = getEndToEndTestTelemetryClient(this.metricsPort);
189188
this.bootstrapNode = await createBootstrapNodeFromPrivateKey(
190-
privateKeyFromHex(BOOTSTRAP_NODE_PRIVATE_KEY),
189+
BOOTSTRAP_NODE_PRIVATE_KEY,
191190
this.bootNodePort,
192191
telemetry,
193192
aztecNodeConfig,

yarn-project/end-to-end/src/e2e_p2p/preferred_gossip_network.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,9 @@ describe('e2e_p2p_preferred_network', () => {
286286
// We will setup some gossip monitors to ensure that nodes that restrict who they connect to
287287
// only receive messages from expected peers
288288

289-
const preferredNodePeerIds = await Promise.all(preferredNodeEnrs.map(x => ENR.decodeTxt(x!).peerId));
289+
const preferredNodePeerIds = await Promise.all(preferredNodeEnrs.map(x => ENR.decodeTxt(x!).peerId()));
290290
const validatorEnrs = await Promise.all(validators.map(p => p.getEncodedEnr()));
291-
const validatorPeerIds = await Promise.all(validatorEnrs.map(x => ENR.decodeTxt(x!).peerId));
291+
const validatorPeerIds = await Promise.all(validatorEnrs.map(x => ENR.decodeTxt(x!).peerId()));
292292

293293
// No-discovery validators should only receive P2P gossip from preferred nodes, as that is all they connect to
294294
noDiscoveryValidators.forEach(validator => {

yarn-project/foundation/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
},
126126
"devDependencies": {
127127
"@jest/globals": "^30.0.0",
128-
"@libp2p/interface": "^2.10.3",
128+
"@libp2p/interface": "1.3.1",
129129
"@types/detect-node": "^2.0.0",
130130
"@types/jest": "^30.0.0",
131131
"@types/koa": "^2.15.0",

yarn-project/foundation/src/log/libp2p_logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function replaceFormatting(message: string) {
2121
return message;
2222
}
2323

24-
return message.replace(/(%p|%a|%e)/g, '%s');
24+
return message.replace(/(%p|%a)/g, '%s');
2525
}
2626

2727
function createLibp2pLogger(component: string): Logger {

yarn-project/p2p/package.json

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,26 @@
7878
"@aztec/simulator": "workspace:^",
7979
"@aztec/stdlib": "workspace:^",
8080
"@aztec/telemetry-client": "workspace:^",
81-
"@chainsafe/discv5": "^11.0.2",
82-
"@chainsafe/enr": "^5.0.1",
83-
"@chainsafe/libp2p-gossipsub": "14.1.1",
84-
"@chainsafe/libp2p-noise": "^16.1.3",
85-
"@chainsafe/libp2p-yamux": "^7.0.1",
86-
"@libp2p/bootstrap": "^11.0.39",
87-
"@libp2p/crypto": "^5.1.5",
88-
"@libp2p/identify": "^3.0.33",
89-
"@libp2p/interface": "^2.10.3",
90-
"@libp2p/kad-dht": "^15.1.3",
91-
"@libp2p/mplex": "^11.0.39",
92-
"@libp2p/peer-id": "^5.1.6",
93-
"@libp2p/peer-store": "^11.2.3",
94-
"@libp2p/prometheus-metrics": "^4.3.22",
95-
"@libp2p/tcp": "^10.1.14",
96-
"@multiformats/multiaddr": "12.4.4",
97-
"interface-datastore": "^8.3.2",
81+
"@chainsafe/discv5": "9.0.0",
82+
"@chainsafe/enr": "3.0.0",
83+
"@chainsafe/libp2p-gossipsub": "13.0.0",
84+
"@chainsafe/libp2p-noise": "^15.0.0",
85+
"@chainsafe/libp2p-yamux": "^6.0.2",
86+
"@libp2p/bootstrap": "10.0.0",
87+
"@libp2p/crypto": "4.0.3",
88+
"@libp2p/identify": "1.0.18",
89+
"@libp2p/interface": "1.3.1",
90+
"@libp2p/kad-dht": "10.0.4",
91+
"@libp2p/mplex": "10.0.16",
92+
"@libp2p/peer-id": "4.0.7",
93+
"@libp2p/peer-id-factory": "4.1.1",
94+
"@libp2p/peer-store": "10.0.16",
95+
"@libp2p/prometheus-metrics": "^4.2.4",
96+
"@libp2p/tcp": "9.0.24",
97+
"@multiformats/multiaddr": "12.1.14",
98+
"interface-datastore": "^8.2.11",
9899
"interface-store": "^5.1.8",
99-
"libp2p": "2.8.9",
100+
"libp2p": "1.5.0",
100101
"semver": "^7.6.0",
101102
"sha3": "^2.1.4",
102103
"snappy": "^7.2.2",

0 commit comments

Comments
 (0)