From 8e4fbe13aaae9bed16c6928aaf7d02936993d299 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 30 Nov 2023 15:36:59 +0000 Subject: [PATCH] chore: update release-please config --- .github/workflows/main.yml | 5 +- .release-please.json | 2 +- run-client.ts | 61 --------------- run-server.ts | 39 ---------- run.ts | 147 ------------------------------------- 5 files changed, 4 insertions(+), 250 deletions(-) delete mode 100644 run-client.ts delete mode 100644 run-server.ts delete mode 100644 run.ts diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 813783eb23..9f4c34452c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -220,10 +220,11 @@ jobs: if: github.event_name == 'push' && github.ref == 'refs/heads/main' # https://docs.npmjs.com/generating-provenance-statements permissions: - id-token: write contents: write + id-token: write + pull-requests: write steps: - - uses: GoogleCloudPlatform/release-please-action@v2 + - uses: google-github-actions/release-please-action@v3 id: release with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.release-please.json b/.release-please.json index 6fc373e484..b8fd04a23a 100644 --- a/.release-please.json +++ b/.release-please.json @@ -1,5 +1,5 @@ { - "last-release-sha": "17d980c902fa5314e954508255a41c0854416d47", + "last-release-sha": "d5391097b6d7daf24346b3cb2899ae808f1cb0de", "plugins": ["node-workspace"], "group-pull-request-title-pattern": "chore: release ${component}", "packages": { diff --git a/run-client.ts b/run-client.ts deleted file mode 100644 index 90380ae35a..0000000000 --- a/run-client.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* eslint-disable no-console */ -import { noise } from '@chainsafe/libp2p-noise' -import { yamux } from '@chainsafe/libp2p-yamux' -import { mplex } from '@libp2p/mplex' -import { plaintext } from '@libp2p/plaintext' -import { tcp } from '@libp2p/tcp' -import { multiaddr } from '@multiformats/multiaddr' -import { createLibp2p, type Libp2p } from 'libp2p' -import { perf, type PerfOutput, type Perf } from '../src/index.js' - -const ONE_MEG = 1024 * 1024 -const DOWNLOAD_BYTES = ONE_MEG * 1024 * 5 - -async function createNode (): Promise> { - return createLibp2p({ - transports: [ - tcp() - ], - connectionEncryption: [ - noise(), plaintext() - ], - streamMuxers: [ - yamux(), mplex() - ], - services: { - perf: perf({ - writeBlockSize: 1024 * 1024 - }) - }, - connectionManager: { - minConnections: 0 - } - }) -} - -const libp2p1 = await createNode() - -let last: PerfOutput | undefined - -const ma = multiaddr('/ip4/127.0.0.1/tcp/59032') - -for await (const output of libp2p1.services.perf.measurePerformance(ma, 0, DOWNLOAD_BYTES)) { - last = output - console.info(output) - - console.info((output.downloadBytes / (1024 * 1024)) / output.timeSeconds, 'MB/s') -} - -if (last?.type === 'final') { - console.info((last.downloadBytes / (1024 * 1024)) / last.timeSeconds, 'MB/s') -} - -await libp2p1.stop() - -// plaintext/yamux - 1354 MB/s -// plaintext/mplex - 34478 MB/s -// noise/yamux - 60 MB/s -// noise/mplex - 62 MB/s - -// noise/yamux/native crypto - 282 MB/s -// noise/mplex/native crypto - 420 MB/s diff --git a/run-server.ts b/run-server.ts deleted file mode 100644 index 8d6d569994..0000000000 --- a/run-server.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* eslint-disable no-console */ -import { noise } from '@chainsafe/libp2p-noise' -import { yamux } from '@chainsafe/libp2p-yamux' -import { mplex } from '@libp2p/mplex' -import { plaintext } from '@libp2p/plaintext' -import { tcp } from '@libp2p/tcp' -import { createLibp2p, type Libp2p } from 'libp2p' -import { perf, type Perf } from '../src/index.js' - -async function createNode (): Promise> { - return createLibp2p({ - addresses: { - listen: [ - '/ip4/0.0.0.0/tcp/59032' - ] - }, - transports: [ - tcp() - ], - connectionEncryption: [ - noise(), plaintext() - ], - streamMuxers: [ - yamux(), mplex() - ], - services: { - perf: perf({ - writeBlockSize: 1024 * 1024 - }) - }, - connectionManager: { - minConnections: 0 - } - }) -} - -const server = await createNode() - -console.info(server.getMultiaddrs()) diff --git a/run.ts b/run.ts deleted file mode 100644 index 37fac789f8..0000000000 --- a/run.ts +++ /dev/null @@ -1,147 +0,0 @@ -/* eslint-disable no-console */ -import { noise } from '@chainsafe/libp2p-noise' -import { yamux } from '@chainsafe/libp2p-yamux' -import { mplex } from '@libp2p/mplex' -import { plaintext } from '@libp2p/plaintext' -import { tcp } from '@libp2p/tcp' -import last from 'it-last' -import { createLibp2p, type Libp2p } from 'libp2p' -import { perf, type PerfOutput, type Perf } from '../src/index.js' - -const ONE_MEG = 1024 * 1024 -const DOWNLOAD_BYTES = ONE_MEG * 1024 * 5 -const REPEAT = 10 - -// plaintext/yamux - 1354 MB/s -// plaintext/mplex - 34478 MB/s -// noise/yamux - 60 MB/s -// noise/mplex - 62 MB/s - -// noise/yamux/native crypto - 282 MB/s -// noise/mplex/native crypto - 420 MB/s - -const sizes = [ - 64, 128, 256, 384, 512, 640, 768, 896, 1024, 1152, 1280, 1408, 1536 -] - -for (let i = 0; i < sizes.length; i++) { - const size = sizes[i] - - const measurements: PerfOutput[] = [] - - for (let n = 0; n < REPEAT; n++) { - async function createNode (): Promise> { - return createLibp2p({ - addresses: { - listen: [ - '/ip4/0.0.0.0/tcp/0' - ] - }, - transports: [ - tcp() - ], - connectionEncryption: [ - noise(), plaintext() - ], - streamMuxers: [ - yamux(), mplex() - ], - services: { - perf: perf({ - writeBlockSize: size * 1024 - }) - }, - connectionManager: { - minConnections: 0 - } - }) - } - - const libp2p1 = await createNode() - const libp2p2 = await createNode() - - const result = await last( - libp2p1.services.perf.measurePerformance(libp2p2.getMultiaddrs()[0], 0, DOWNLOAD_BYTES) - ) - - if (result != null) { - measurements.push(result) - } - - await libp2p1.stop() - await libp2p2.stop() - } - - const downloadBytes = measurements - .map(m => { - if (m.type === 'final') { - return m.downloadBytes - } - - return 0 - }) - .filter(outliers()) - .reduce((acc, curr) => acc + curr, 0) - - const timeSeconds = measurements - .map(m => { - if (m.type === 'final') { - return m.timeSeconds - } - - return 0 - }) - .filter(outliers()) - .reduce((acc, curr) => acc + curr, 0) - - console.info(size, 'kb', (downloadBytes / (1024 * 1024)) / timeSeconds, 'MB/s') -} - -function outliers() { - let o: number[] - - return function(v: number, i: number, a: number[]) { - if (o == null) { - o = calc(a) - } - - return !~o.indexOf(v); - } -} - -function calc(arr: number[]): number[] { - arr = arr.slice(0); - - arr = arr.sort(function(a, b) { - return a - b; - }); - - var len = arr.length; - var middle = median(arr); - var range = iqr(arr); - var outliers = []; - - for (var i = 0; i < len; i++) { - Math.abs(arr[i] - middle) > range && outliers.push(arr[i]); - } - - return outliers; -} - -function median(arr: number[]): number { - var len = arr.length; - var half = ~~(len / 2); - - return len % 2 - ? arr[half] - : (arr[half - 1] + arr[half]) / 2; -} - -function iqr(arr: number[]): number { - var len = arr.length; - var q1 = median(arr.slice(0, ~~(len / 2))); - var q3 = median(arr.slice(Math.ceil(len / 2))); - var g = 1.5; - - return (q3 - q1) * g; -}