Skip to content

Commit 37544c2

Browse files
authored
More nits (#209)
* Increased tx pool from 20->40 MiB * WIP: try without `--network host` * WIP: big32 back * Wait finalized * Revert * Try 30MiB * WIP: wrong ip causes disconnects? * Fix docker ipfs ips * nit * revert back to host network with 127.0.0.1 * Run first * Why this is doing difference for Kubo? * Log connected peers * Disabled IPFS dht and discovery * less logs * WIP: temporary cache to speed to * wip * Removed `ws` ? * Fix listen-addr * nit * Better IPFS? * Nit * One more nit * omfg * Refactor DEFAULT_HTTP_IPFS_API and custom ports * Nit * Very nit * Refactor * Revert * Change pool * fmt + revert back to ws * Restart IPFS? * big96 * Parametrize image size * Stats * REvert * Removed comment * Last nits
1 parent 03f1e02 commit 37544c2

14 files changed

+276
-135
lines changed

.github/workflows/integration-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162

163163
- name: Test store-big-data (Westend parachain)
164164
working-directory: examples
165-
run: just run-test-store-big-data "${{ env.TEST_DIR }}"
165+
run: just run-test-store-big-data "${{ env.TEST_DIR }}" "big32"
166166

167167
- name: Test authorize-preimage-and-store (Westend parachain)
168168
working-directory: examples
@@ -197,7 +197,7 @@ jobs:
197197

198198
- name: Test store-big-data (Polkadot solochain)
199199
working-directory: examples
200-
run: just run-test-store-big-data "${{ env.TEST_DIR }}"
200+
run: just run-test-store-big-data "${{ env.TEST_DIR }}" "big32"
201201

202202
- name: Test authorize-preimage-and-store (Polkadot solochain)
203203
working-directory: examples

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ tar -xvzf kubo_v0.38.1_darwin-arm64.tar.gz
7979

8080
```shell
8181
docker pull ipfs/kubo:latest
82-
docker run -d --name ipfs-node -v ipfs-data:/data/ipfs -p 4001:4001 -p 8080:8080 -p 5001:5001 ipfs/kubo:latest
82+
docker run -d --name ipfs-node -v ipfs-data:/data/ipfs -p 4011:4011 -p 8283:8283 -p 5011:5011 ipfs/kubo:latest
8383
docker logs -f ipfs-node
8484
```
8585

examples/authorize_and_store_papi.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createClient } from 'polkadot-api';
33
import { getWsProvider } from 'polkadot-api/ws-provider';
44
import { cryptoWaitReady } from '@polkadot/util-crypto';
55
import { authorizeAccount, fetchCid, store, TX_MODE_FINALIZED_BLOCK } from './api.js';
6-
import { setupKeyringAndSigners } from './common.js';
6+
import { setupKeyringAndSigners, DEFAULT_IPFS_GATEWAY_URL } from './common.js';
77
import { logHeader, logConnection, logSuccess, logError, logTestResult } from './logger.js';
88
import { cidFromBytes } from "./cid_dag_metadata.js";
99
import { bulletin } from './.papi/descriptors/dist/index.mjs';
@@ -12,7 +12,7 @@ import { bulletin } from './.papi/descriptors/dist/index.mjs';
1212
const args = process.argv.slice(2);
1313
const NODE_WS = args[0] || 'ws://localhost:10000';
1414
const SEED = args[1] || '//Alice';
15-
const HTTP_IPFS_API = args[2] || 'http://127.0.0.1:8080';
15+
const HTTP_IPFS_API = args[2] || DEFAULT_IPFS_GATEWAY_URL;
1616

1717
async function main() {
1818
await cryptoWaitReady();

examples/authorize_and_store_papi_smoldot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { createClient } from 'polkadot-api';
55
import { getSmProvider } from 'polkadot-api/sm-provider';
66
import { cryptoWaitReady } from '@polkadot/util-crypto';
77
import { authorizeAccount, fetchCid, store } from './api.js';
8-
import { setupKeyringAndSigners, waitForChainReady } from './common.js';
8+
import { setupKeyringAndSigners, waitForChainReady, DEFAULT_IPFS_GATEWAY_URL } from './common.js';
99
import { logHeader, logConfig, logSuccess, logError, logTestResult } from './logger.js';
1010
import { cidFromBytes } from "./cid_dag_metadata.js";
1111
import { bulletin } from './.papi/descriptors/dist/index.mjs';
@@ -111,7 +111,7 @@ async function main() {
111111
// Optional parachain chainspec path (only needed for parachains)
112112
const parachainSpecPath = process.argv[3] || null;
113113
// Optional IPFS API URL
114-
const HTTP_IPFS_API = process.argv[4] || 'http://127.0.0.1:8080';
114+
const HTTP_IPFS_API = process.argv[4] || DEFAULT_IPFS_GATEWAY_URL;
115115

116116
logConfig({
117117
'Mode': 'Smoldot Light Client',

examples/authorize_preimage_and_store_papi.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createClient } from 'polkadot-api';
33
import { getWsProvider } from 'polkadot-api/ws-provider';
44
import { cryptoWaitReady } from '@polkadot/util-crypto';
55
import { authorizeAccount, authorizePreimage, fetchCid, store, TX_MODE_IN_BLOCK, TX_MODE_FINALIZED_BLOCK } from './api.js';
6-
import { setupKeyringAndSigners, getContentHash } from './common.js';
6+
import { setupKeyringAndSigners, getContentHash, DEFAULT_IPFS_GATEWAY_URL } from './common.js';
77
import { logHeader, logConnection, logSection, logSuccess, logError, logInfo, logTestResult } from './logger.js';
88
import { cidFromBytes } from "./cid_dag_metadata.js";
99
import { bulletin } from './.papi/descriptors/dist/index.mjs';
@@ -12,7 +12,7 @@ import { bulletin } from './.papi/descriptors/dist/index.mjs';
1212
const args = process.argv.slice(2);
1313
const NODE_WS = args[0] || 'ws://localhost:10000';
1414
const SEED = args[1] || '//Alice';
15-
const HTTP_IPFS_API = args[2] || 'http://127.0.0.1:8080';
15+
const HTTP_IPFS_API = args[2] || DEFAULT_IPFS_GATEWAY_URL;
1616

1717
/**
1818
* Run a preimage authorization + store test.

examples/common.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import fs from "fs";
66
import assert from "assert";
77

88
// ---- CONFIG ----
9-
export const HTTP_IPFS_API = 'http://127.0.0.1:8080'; // Local IPFS HTTP gateway
9+
export const DEFAULT_IPFS_API_URL = 'http://127.0.0.1:5011'; // IPFS HTTP API (for ipfs-http-client)
10+
export const DEFAULT_IPFS_GATEWAY_URL = 'http://127.0.0.1:8283'; // IPFS HTTP Gateway (for /ipfs/CID requests)
1011
export const CHUNK_SIZE = 1 * 1024 * 1024; // 1 MiB
1112
// -----------------
1213

@@ -47,7 +48,7 @@ export function newSigner(seed) {
4748
*
4849
* @param {string} file
4950
* @param {string} text
50-
* @param {"small" | "big32" | "big64"} size
51+
* @param {"small" | "big32" | "big64" | "big96"} size
5152
*/
5253
export function generateTextImage(file, text, size = "small") {
5354
console.log(`Generating ${size} image with text: ${text} to the file: ${file}...`);
@@ -77,6 +78,15 @@ export function generateTextImage(file, text, size = "small") {
7778
noise: 50,
7879
targetBytes: 65 * 1024 * 1024,
7980
},
81+
// ~96 MiB
82+
big96: {
83+
width: 9000,
84+
height: 6500,
85+
quality: 0.95,
86+
shapes: 1000,
87+
noise: 50,
88+
targetBytes: 98 * 1024 * 1024,
89+
},
8090
};
8191

8292
const cfg = presets[size];
@@ -117,7 +127,7 @@ export function generateTextImage(file, text, size = "small") {
117127

118128
// 🔧 Big images: tune quality to hit target size
119129
let imageBytes;
120-
if ((size === "big32" || size === "big64") && cfg.targetBytes) {
130+
if ((size === "big32" || size === "big64" || size === "big96") && cfg.targetBytes) {
121131
let quality = cfg.quality;
122132

123133
do {
@@ -271,7 +281,7 @@ export function toHex(bytes) {
271281
// console.error("Unknown command:", command);
272282
// console.error("Usage:");
273283
// console.error(
274-
// ' node common.js generateTextImage "TEXT" [small|big32|big64]'
284+
// ' node common.js generateTextImage "TEXT" [small|big32|big64|big96]'
275285
// );
276286
// process.exit(1);
277287
// }

0 commit comments

Comments
 (0)