Skip to content

Commit 1638459

Browse files
Merge branch 'master' into feature/globalKVStore-withDoubleSpendRetry
2 parents 279aabc + 6001df3 commit 1638459

31 files changed

+1827
-354
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Benchmark Comparison
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
benchmarks:
9+
name: Benchmarks (Node 22)
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
pull-requests: write
14+
steps:
15+
- name: Checkout PR branch
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 22
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Build PR branch
29+
run: npm run build
30+
31+
- name: Run PR benchmarks
32+
run: node scripts/run-benchmarks.js --repo . --output pr-benchmarks.json
33+
34+
- name: Checkout master baseline
35+
uses: actions/checkout@v4
36+
with:
37+
ref: master
38+
path: master
39+
40+
- name: Install dependencies (master)
41+
working-directory: master
42+
run: npm ci
43+
44+
- name: Build master
45+
working-directory: master
46+
run: npm run build
47+
48+
- name: Run master benchmarks
49+
run: node scripts/run-benchmarks.js --repo master --output master-benchmarks.json
50+
51+
- name: Capture baseline sha
52+
id: baseline_sha
53+
run: echo "value=$(cd master && git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
54+
55+
- name: Generate benchmark report
56+
run: >
57+
node scripts/format-benchmark-comment.js
58+
--baseline master-benchmarks.json
59+
--branch pr-benchmarks.json
60+
--output benchmark-report.md
61+
--branch-ref $GITHUB_SHA
62+
--baseline-ref ${{ steps.baseline_sha.outputs.value }}
63+
64+
- name: Upload benchmark artifacts
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: benchmark-results
68+
path: |
69+
pr-benchmarks.json
70+
master-benchmarks.json
71+
benchmark-report.md
72+
73+
- name: Comment on PR
74+
if: github.event.pull_request.number != ''
75+
uses: actions/github-script@v7
76+
with:
77+
github-token: ${{ secrets.GITHUB_TOKEN }}
78+
script: |
79+
const fs = require('fs');
80+
const body = fs.readFileSync('benchmark-report.md', 'utf8');
81+
await github.rest.issues.createComment({
82+
...context.repo,
83+
issue_number: context.payload.pull_request.number,
84+
body
85+
});

CHANGELOG.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# CHANGELOG for `@bsv/sdk`
22

3-
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
3+
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec2.0.0.html).
44

55
## Table of Contents
66

77
- [Unreleased](#unreleased)
8+
- [1.9.1 - 2025-11-10](#191---2025-11-10)
9+
- [1.9.0 - 2025-11-09](#190---2025-11-09)
10+
- [1.8.13 - 2025-11-06](#1813---2025-11-06)
11+
- [1.8.12 - 2025-11-06](#1812---2025-11-06)
812
- [1.8.11 - 2025-10-30](#1811---2025-10-30)
913
- [1.8.10 - 2025-10-28](#1810---2025-10-28)
1014
- [1.8.9 - 2025-10-27](#189---2025-10-27)
@@ -171,6 +175,35 @@ All notable changes to this project will be documented in this file. The format
171175

172176
---
173177

178+
### [1.9.1] - 2025-11-10
179+
180+
### Fixed
181+
182+
- Added support for originator param in LocalKVStore wallet calls.
183+
184+
---
185+
186+
### [1.9.0] - 2025-11-09
187+
188+
### Added
189+
190+
- Faster serialization and caching improvements
191+
- Use node- and browser-specific fast-paths opportunistically
192+
- Cache signatures in Spend to avoid repeated verifications
193+
- Cache serialized values and use Uint8Array in more places
194+
- These changes are not intended to be breaking, but a minor version increment is performed out of an abundance of caution
195+
196+
---
197+
198+
199+
### [1.8.13] - 2025-11-06
200+
201+
### Added
202+
203+
- LookupResolver: Support for custom overlay ranking to allow for expedited lookups and reputation tracking.
204+
205+
---
206+
174207
### [1.8.12] - 2025-11-06
175208

176209
### Fixed

benchmarks/script-serialization-bench.js

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

docs/reference/overlay-tools.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
1111
| [LookupResolverConfig](#interface-lookupresolverconfig) |
1212
| [OverlayBroadcastFacilitator](#interface-overlaybroadcastfacilitator) |
1313
| [OverlayLookupFacilitator](#interface-overlaylookupfacilitator) |
14+
| [RankedHost](#interface-rankedhost) |
1415
| [SHIPBroadcasterConfig](#interface-shipbroadcasterconfig) |
1516
| [TaggedBEEF](#interface-taggedbeef) |
1617

@@ -101,6 +102,10 @@ export interface LookupResolverConfig {
101102
hostOverrides?: Record<string, string[]>;
102103
additionalHosts?: Record<string, string[]>;
103104
cache?: CacheOptions;
105+
reputationStorage?: "localStorage" | {
106+
get: (key: string) => string | null | undefined;
107+
set: (key: string, value: string) => void;
108+
};
104109
}
105110
```
106111

@@ -150,6 +155,17 @@ The network preset to use, unless other options override it.
150155
networkPreset?: "mainnet" | "testnet" | "local"
151156
```
152157

158+
#### Property reputationStorage
159+
160+
Optional storage for host reputation data.
161+
162+
```ts
163+
reputationStorage?: "localStorage" | {
164+
get: (key: string) => string | null | undefined;
165+
set: (key: string, value: string) => void;
166+
}
167+
```
168+
153169
#### Property slapTrackers
154170

155171
The list of SLAP trackers queried to resolve Overlay Services hosts for a given lookup service.
@@ -199,6 +215,17 @@ See also: [LookupAnswer](./overlay-tools.md#type-lookupanswer), [LookupQuestion]
199215

200216
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
201217

218+
---
219+
### Interface: RankedHost
220+
221+
```ts
222+
export interface RankedHost extends HostReputationEntry {
223+
score: number;
224+
}
225+
```
226+
227+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
228+
202229
---
203230
### Interface: SHIPBroadcasterConfig
204231

@@ -294,6 +321,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
294321
| --- |
295322
| [HTTPSOverlayBroadcastFacilitator](#class-httpsoverlaybroadcastfacilitator) |
296323
| [HTTPSOverlayLookupFacilitator](#class-httpsoverlaylookupfacilitator) |
324+
| [HostReputationTracker](#class-hostreputationtracker) |
297325
| [LookupResolver](#class-lookupresolver) |
298326
| [OverlayAdminTokenTemplate](#class-overlayadmintokentemplate) |
299327
| [TopicBroadcaster](#class-topicbroadcaster) |
@@ -333,6 +361,24 @@ See also: [LookupAnswer](./overlay-tools.md#type-lookupanswer), [LookupQuestion]
333361

334362
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
335363

364+
---
365+
### Class: HostReputationTracker
366+
367+
```ts
368+
export class HostReputationTracker {
369+
constructor(store?: KeyValueStore)
370+
reset(): void
371+
recordSuccess(host: string, latencyMs: number): void
372+
recordFailure(host: string, reason?: unknown): void
373+
rankHosts(hosts: string[], now: number = Date.now()): RankedHost[]
374+
snapshot(host: string): HostReputationEntry | undefined
375+
}
376+
```
377+
378+
See also: [RankedHost](./overlay-tools.md#interface-rankedhost)
379+
380+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
381+
336382
---
337383
### Class: LookupResolver
338384

@@ -569,6 +615,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
569615
| --- |
570616
| [DEFAULT_SLAP_TRACKERS](#variable-default_slap_trackers) |
571617
| [DEFAULT_TESTNET_SLAP_TRACKERS](#variable-default_testnet_slap_trackers) |
618+
| [getOverlayHostReputationTracker](#variable-getoverlayhostreputationtracker) |
572619
573620
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
574621
@@ -599,3 +646,14 @@ DEFAULT_TESTNET_SLAP_TRACKERS: string[] = [
599646
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
600647
601648
---
649+
### Variable: getOverlayHostReputationTracker
650+
651+
```ts
652+
getOverlayHostReputationTracker = (): HostReputationTracker => globalTracker
653+
```
654+
655+
See also: [HostReputationTracker](./overlay-tools.md#class-hostreputationtracker)
656+
657+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
658+
659+
---

0 commit comments

Comments
 (0)