Skip to content

Commit 158b789

Browse files
authored
Merge pull request #922 from status-im/libp2p-0.38.0
2 parents f52dd9e + bfeaf6c commit 158b789

File tree

13 files changed

+2872
-1533
lines changed

13 files changed

+2872
-1533
lines changed

package-lock.json

Lines changed: 1264 additions & 1275 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,31 +89,32 @@
8989
"node": ">=16"
9090
},
9191
"dependencies": {
92-
"@chainsafe/libp2p-gossipsub": "^3.4.0",
93-
"@chainsafe/libp2p-noise": "^7.0.1",
92+
"@chainsafe/libp2p-gossipsub": "^4.1.1",
93+
"@chainsafe/libp2p-noise": "^8.0.1",
9494
"@ethersproject/rlp": "^5.5.0",
95-
"@libp2p/crypto": "^1.0.0",
95+
"@libp2p/crypto": "^1.0.4",
9696
"@libp2p/interface-connection": "3.0.1",
9797
"@libp2p/interface-peer-discovery": "^1.0.0",
9898
"@libp2p/interface-peer-id": "^1.0.2",
9999
"@libp2p/interface-peer-info": "^1.0.1",
100100
"@libp2p/interface-peer-store": "^1.0.0",
101101
"@libp2p/interfaces": "^3.0.2",
102-
"@libp2p/mplex": "^4.0.1",
102+
"@libp2p/mplex": "^5.1.1",
103103
"@libp2p/peer-id": "^1.1.10",
104-
"@libp2p/websockets": "^3.0.0",
105-
"@multiformats/multiaddr": "^10.2.0",
104+
"@libp2p/websockets": "^3.0.3",
105+
"@multiformats/multiaddr": "^10.4.0",
106106
"@noble/secp256k1": "^1.3.4",
107107
"debug": "^4.3.4",
108108
"dns-query": "^0.11.2",
109109
"hi-base32": "^0.5.1",
110110
"it-all": "^1.0.6",
111-
"it-length-prefixed": "^7.0.1",
111+
"it-length-prefixed": "^8.0.2",
112112
"it-pipe": "^2.0.4",
113113
"js-sha3": "^0.8.0",
114-
"libp2p": "next",
114+
"libp2p": "0.38.0",
115115
"p-event": "^5.0.1",
116-
"protons-runtime": "^1.0.4",
116+
"protons-runtime": "^3.1.0",
117+
"uint8arraylist": "^2.3.2",
117118
"uint8arrays": "^3.0.0",
118119
"uuid": "^8.3.2"
119120
},
@@ -159,7 +160,7 @@
159160
"portfinder": "^1.0.28",
160161
"prettier": "^2.1.1",
161162
"process": "^0.11.10",
162-
"protons": "^3.0.4",
163+
"protons": "^5.1.0",
163164
"puppeteer": "^13.0.1",
164165
"rollup": "^2.75.0",
165166
"size-limit": "^8.0.0",
@@ -169,10 +170,6 @@
169170
"typedoc": "^0.23.10",
170171
"typescript": "^4.5.5"
171172
},
172-
"overrides": {
173-
"@libp2p/interface-connection": "3.0.1",
174-
"uint8arraylist": "2.3.2"
175-
},
176173
"files": [
177174
"dist",
178175
"bundle",

src/lib/waku_light_push/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import all from "it-all";
44
import * as lp from "it-length-prefixed";
55
import { pipe } from "it-pipe";
66
import { Libp2p } from "libp2p";
7+
import { Uint8ArrayList } from "uint8arraylist";
78

89
import { PushResponse } from "../../proto/light_push";
910
import { DefaultPubSubTopic } from "../constants";
1011
import { getPeersForProtocol, selectRandomPeer } from "../select_peer";
11-
import { concat } from "../utils";
1212
import { WakuMessage } from "../waku_message";
1313

1414
import { PushRPC } from "./push_rpc";
@@ -76,7 +76,11 @@ export class WakuLightPush {
7676
async (source) => await all(source)
7777
);
7878
try {
79-
const bytes = concat(res);
79+
const bytes = new Uint8ArrayList();
80+
res.forEach((chunk) => {
81+
bytes.append(chunk);
82+
});
83+
8084
const response = PushRPC.decode(bytes).response;
8185

8286
if (!response) {

src/lib/waku_light_push/push_rpc.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Uint8ArrayList } from "uint8arraylist";
12
import { v4 as uuid } from "uuid";
23

34
import * as proto from "../../proto/light_push";
@@ -17,7 +18,7 @@ export class PushRPC {
1718
});
1819
}
1920

20-
static decode(bytes: Uint8Array): PushRPC {
21+
static decode(bytes: Uint8ArrayList): PushRPC {
2122
const res = proto.PushRPC.decode(bytes);
2223
return new PushRPC(res);
2324
}

src/lib/waku_store/history_rpc.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Uint8ArrayList } from "uint8arraylist";
12
import { v4 as uuid } from "uuid";
23

34
import * as protoV2Beta3 from "../../proto/store_v2beta3";
@@ -139,7 +140,7 @@ export class HistoryRPC {
139140
}
140141
}
141142

142-
decode(bytes: Uint8Array): HistoryRPC {
143+
decode(bytes: Uint8ArrayList): HistoryRPC {
143144
const res = this.historyRpc.decode(bytes);
144145
return new HistoryRPC(res, this.storeCodec);
145146
}

src/lib/waku_store/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ import all from "it-all";
55
import * as lp from "it-length-prefixed";
66
import { pipe } from "it-pipe";
77
import { Libp2p } from "libp2p";
8+
import { Uint8ArrayList } from "uint8arraylist";
89

910
import * as protoV2Beta4 from "../../proto/store_v2beta4";
1011
import { HistoryResponse } from "../../proto/store_v2beta4";
1112
import { DefaultPubSubTopic, StoreCodecs } from "../constants";
1213
import { getPeersForProtocol, selectRandomPeer } from "../select_peer";
13-
import { concat, hexToBytes } from "../utils";
14+
import { hexToBytes } from "../utils";
1415
import { DecryptionMethod, WakuMessage } from "../waku_message";
1516

1617
import { HistoryRPC, PageDirection } from "./history_rpc";
1718

18-
import Error = HistoryResponse.Error;
19+
import Error = HistoryResponse.HistoryError;
1920

2021
const dbg = debug("waku:store");
2122

@@ -211,7 +212,11 @@ export class WakuStore {
211212
lp.decode(),
212213
async (source) => await all(source)
213214
);
214-
const bytes = concat(res);
215+
const bytes = new Uint8ArrayList();
216+
res.forEach((chunk) => {
217+
bytes.append(chunk);
218+
});
219+
215220
const reply = historyRpcQuery.decode(bytes);
216221

217222
if (!reply.response) {

0 commit comments

Comments
 (0)