Skip to content

Commit b4ffdf4

Browse files
Merge branch 'claude/native-document-validator' into claude/native-registration-checks
2 parents 8d1e1bb + 8bf3aad commit b4ffdf4

153 files changed

Lines changed: 13517 additions & 1693 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- [ ] I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
3131
- [ ] I have made corresponding changes to the documentation if needed
3232
- [ ] If I added or changed GroveDB structure, I described it in the area's `structure.rs`, regenerated `grovedb-structure.json`, and checked the structure viewer link posted on this pull request
33+
- [ ] If I added or changed a system contract's document schemas, I checked the contract viewer link posted on this pull request
3334

3435
**For repository code-owners and collaborators only**
3536
- [ ] I have assigned this pull request to a milestone
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: System Contract Preview (PR)
2+
3+
# When a pull request adds or changes a system contract's document schemas,
4+
# post a link that opens each one in the contract viewer: a new contract on its
5+
# own, a changed file or a new schema version compared with what it replaces.
6+
# The viewer reads the files from GitHub itself; this only builds the links.
7+
8+
on:
9+
pull_request:
10+
types: [opened, synchronize, reopened]
11+
paths:
12+
- 'packages/*-contract/schema/**/*.json'
13+
- '.github/workflows/system-contract-preview.yml'
14+
15+
permissions:
16+
contents: read
17+
pull-requests: write
18+
19+
concurrency:
20+
group: system-contract-preview-${{ github.event.pull_request.number }}
21+
cancel-in-progress: true
22+
23+
env:
24+
VIEWER_URL: https://dashpay.github.io/contract-visualizer/
25+
26+
jobs:
27+
preview:
28+
name: Link the contract viewer
29+
runs-on: ubuntu-24.04
30+
steps:
31+
- name: Find the changed system contracts and post the links
32+
uses: actions/github-script@v7
33+
with:
34+
script: |
35+
const pr = context.payload.pull_request;
36+
const { owner, repo } = context.repo;
37+
const viewer = process.env.VIEWER_URL;
38+
39+
// Compare against where the branch left the base, as GitHub's
40+
// "Files changed" tab does, so schemas merged into the base since
41+
// then do not show up as changed
42+
let base = pr.base.sha;
43+
try {
44+
const { data } = await github.rest.repos.compareCommitsWithBasehead({
45+
owner, repo, basehead: `${pr.base.sha}...${pr.head.sha}`, per_page: 1,
46+
});
47+
base = data.merge_base_commit.sha;
48+
} catch (error) {
49+
core.warning(`Could not find the merge base, using the base tip: ${error.message}`);
50+
}
51+
52+
// A system contract's schemas: packages/<name>-contract/schema/v<N>/<file>.json.
53+
// File names come from the pull request, so only names of this shape
54+
// are used, and they are printed as code.
55+
const SCHEMA = /^packages\/([a-z0-9-]+-contract)\/schema\/v([0-9]{1,3})\/([A-Za-z0-9._-]+\.json)$/;
56+
const files = (await github.paginate(github.rest.pulls.listFiles, {
57+
owner, repo, pull_number: pr.number, per_page: 100,
58+
}))
59+
.map((file) => ({ ...file, match: SCHEMA.exec(file.filename) }))
60+
.filter((file) => file.match);
61+
62+
const headRepo = pr.head.repo.full_name;
63+
const blob = (fullName, sha, path) => `https://github.com/${fullName}/blob/${sha}/${path}`;
64+
const open = (source) => `${viewer}?url=${encodeURIComponent(source)}`;
65+
const compare = (before, after) => `${viewer}?base=${encodeURIComponent(before)}&head=${encodeURIComponent(after)}`;
66+
67+
async function existsAtBase(path) {
68+
try {
69+
await github.rest.repos.getContent({ owner, repo, path, ref: base });
70+
return true;
71+
} catch (error) {
72+
if (error.status === 404) return false;
73+
throw error;
74+
}
75+
}
76+
77+
const rows = [];
78+
for (const file of files.slice(0, 30)) {
79+
const [, contract, version, name] = file.match;
80+
const path = file.filename;
81+
const at = `\`${path}\``;
82+
if (file.status === 'removed') {
83+
rows.push(`- ${at}: removed ([last version](${open(blob(`${owner}/${repo}`, base, path))}))`);
84+
continue;
85+
}
86+
const head = blob(headRepo, pr.head.sha, path);
87+
if (file.status === 'added') {
88+
// A new schema version is compared with the newest earlier
89+
// version of the same file
90+
let previous = null;
91+
for (let older = Number(version) - 1; older >= 1 && !previous; older -= 1) {
92+
const candidate = `packages/${contract}/schema/v${older}/${name}`;
93+
if (await existsAtBase(candidate)) previous = { path: candidate, version: older };
94+
}
95+
rows.push(previous
96+
? `- ${at}: new version. **[Compare with \`v${previous.version}\`](${compare(blob(`${owner}/${repo}`, base, previous.path), head)})** · [open on its own](${open(head)})`
97+
: `- ${at}: new contract. **[Open it in the contract viewer](${open(head)})**`);
98+
continue;
99+
}
100+
// Modified or renamed: the file as the base had it, and as the pull request leaves it
101+
const before = blob(`${owner}/${repo}`, base, file.status === 'renamed' && file.previous_filename ? file.previous_filename : path);
102+
rows.push(`- ${at}: changed. **[Compare in the contract viewer](${compare(before, head)})** · [open on its own](${open(head)})`);
103+
}
104+
if (files.length > 30) rows.push(`- and ${files.length - 30} more`);
105+
106+
const marker = '<!-- system-contract-preview -->';
107+
const body = [
108+
marker,
109+
'📜 **System contracts**',
110+
'',
111+
rows.length === 0
112+
? 'This pull request no longer adds or changes a system contract\'s document schemas.'
113+
: 'This pull request adds or changes system contract document schemas. The contract viewer diagrams each one, and a comparison marks what is added, changed and removed, with the update rule each change meets.',
114+
'',
115+
...rows,
116+
'',
117+
`_Compared \`${base.slice(0, 10)}\` with \`${pr.head.sha.slice(0, 10)}\`. Updated at ${new Date().toISOString()}_`,
118+
].join('\n');
119+
120+
await core.summary.addRaw(body.replace(marker, '')).write();
121+
122+
// Fork pull requests run with a read-only token that cannot post comments
123+
if (pr.head.repo.full_name !== `${owner}/${repo}`) {
124+
core.notice(body.replace(marker, ''));
125+
return;
126+
}
127+
128+
const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number: pr.number });
129+
const existing = comments.find((comment) => comment.body.includes(marker));
130+
if (existing) {
131+
await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body });
132+
} else if (rows.length > 0) {
133+
await github.rest.issues.createComment({ owner, repo, issue_number: pr.number, body });
134+
}

‎CHANGELOG.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@
7676
`serialization::dashcore::bls_pubkey` Serde adapter remains a deprecated alias.
7777
Serialized encodings and consensus rules are unchanged. See [#5320](https://github.com/dashpay/platform/pull/5320).
7878

79+
## [5.0.0-rc.8](https://github.com/dashpay/platform/compare/v5.0.0-rc.7...v5.0.0-rc.8) (2026-10-23)
80+
81+
82+
### ⚠ BREAKING CHANGES
83+
84+
* **sdk:** version the non-unique identity lookup so 4.1 clients keep working (#5515)
85+
86+
### Bug Fixes
87+
88+
* **sdk:** verify operation proofs signed by older and newer protocol versions ([#5541](https://github.com/dashpay/platform/issues/5541))
89+
* **sdk:** version the non-unique identity lookup so 4.1 clients keep working ([#5515](https://github.com/dashpay/platform/issues/5515))
90+
7991
## [5.0.0-rc.7](https://github.com/dashpay/platform/compare/v5.0.0-rc.6...v5.0.0-rc.7) (2026-10-21)
8092

8193

0 commit comments

Comments
 (0)