Skip to content

discriminator / pod / program-error / tlv-ar / tlv / tlv-test: Port everything from spl #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 502 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
502 commits
Select commit Hold shift + click to select a range
44f800a
chore: fix typos (#6518)
xiaoxianBoy Mar 29, 2024
16c9252
build(deps): bump borsh from 1.2.1 to 1.4.0 (#6520)
dependabot[bot] Mar 29, 2024
de137e7
build(deps-dev): bump @types/node from 20.11.30 to 20.12.2 (#6529)
dependabot[bot] Apr 1, 2024
65705bc
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.4.0 to …
dependabot[bot] Apr 2, 2024
0540e17
build(deps-dev): bump @typescript-eslint/parser from 7.4.0 to 7.5.0 (…
dependabot[bot] Apr 2, 2024
038dee5
build(deps-dev): bump @types/node from 20.12.2 to 20.12.3 (#6540)
dependabot[bot] Apr 3, 2024
f46985c
build(deps-dev): bump @types/node from 20.12.3 to 20.12.4 (#6548)
dependabot[bot] Apr 4, 2024
614fdcd
build(deps-dev): bump typescript from 5.4.3 to 5.4.4 (#6551)
dependabot[bot] Apr 5, 2024
172d8a0
build(deps-dev): bump @types/node from 20.12.4 to 20.12.5 (#6552)
dependabot[bot] Apr 8, 2024
e10f5f5
build(deps-dev): bump typedoc from 0.25.12 to 0.25.13 (#6556)
dependabot[bot] Apr 8, 2024
87545bc
build(deps-dev): bump @types/node from 20.12.5 to 20.12.6 (#6559)
dependabot[bot] Apr 9, 2024
275b7cc
build(deps-dev): bump @typescript-eslint/parser from 7.5.0 to 7.6.0 (…
dependabot[bot] Apr 9, 2024
fb713c8
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.5.0 to …
dependabot[bot] Apr 9, 2024
567080b
build(deps-dev): bump @types/node from 20.12.6 to 20.12.7 (#6564)
dependabot[bot] Apr 10, 2024
18a4eff
build(deps-dev): bump typescript from 5.4.4 to 5.4.5 (#6566)
dependabot[bot] Apr 11, 2024
446534f
build(deps): bump serde_json from 1.0.115 to 1.0.116 (#6584)
dependabot[bot] Apr 16, 2024
2d9ca2a
build(deps-dev): bump @typescript-eslint/parser from 7.6.0 to 7.7.0 (…
dependabot[bot] Apr 16, 2024
15f70de
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.6.0 to …
dependabot[bot] Apr 16, 2024
6c85288
build(deps): bump serde from 1.0.197 to 1.0.198 (#6589)
dependabot[bot] Apr 17, 2024
671aca4
program error: use unambigious globs (#6590)
Apr 17, 2024
2c830e4
program error: bump patch version (#6592)
Apr 18, 2024
d3a966e
build(deps): bump serial_test from 3.0.0 to 3.1.0 (#6606)
dependabot[bot] Apr 22, 2024
427801a
build(deps-dev): bump @typescript-eslint/parser from 7.7.0 to 7.7.1 (…
dependabot[bot] Apr 23, 2024
c73a8c6
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.7.0 to …
dependabot[bot] Apr 23, 2024
b84e32f
Bump solana version to 1.18.11 (#6624)
samkim-crypto Apr 24, 2024
940f2f8
build(deps): bump serde from 1.0.198 to 1.0.199 (#6647)
dependabot[bot] Apr 29, 2024
14d075c
build(deps): bump borsh from 1.4.0 to 1.5.0 (#6659)
dependabot[bot] Apr 30, 2024
0b54e13
build(deps-dev): bump @typescript-eslint/parser from 7.7.1 to 7.8.0 (…
dependabot[bot] Apr 30, 2024
116626a
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.7.1 to …
dependabot[bot] Apr 30, 2024
3b20cb8
build(deps): bump base64 from 0.22.0 to 0.22.1 (#6670)
dependabot[bot] May 1, 2024
7454aea
build(deps-dev): bump @types/node from 20.12.7 to 20.12.8 (#6675)
dependabot[bot] May 2, 2024
be6b280
build(deps-dev): bump @types/chai from 4.3.14 to 4.3.15 (#6684)
dependabot[bot] May 3, 2024
3e6e606
build(deps): bump serde from 1.0.199 to 1.0.200 (#6679)
dependabot[bot] May 3, 2024
57d1ca1
build(deps-dev): bump @types/chai from 4.3.15 to 4.3.16 (#6692)
dependabot[bot] May 6, 2024
ace6d79
build(deps-dev): bump @types/node from 20.12.8 to 20.12.10 (#6699)
dependabot[bot] May 7, 2024
a780227
build(deps): bump serde_json from 1.0.116 to 1.0.117 (#6705)
dependabot[bot] May 8, 2024
62fa72c
build(deps): bump serde from 1.0.200 to 1.0.201 (#6706)
dependabot[bot] May 8, 2024
29ae4a6
build(deps-dev): bump @types/node from 20.12.10 to 20.12.11 (#6711)
dependabot[bot] May 9, 2024
71db6b7
build(deps-dev): bump chai from 5.1.0 to 5.1.1 (#6717)
dependabot[bot] May 11, 2024
7d0a994
build(deps-dev): bump @typescript-eslint/parser from 7.8.0 to 7.9.0 (…
dependabot[bot] May 14, 2024
ebd524e
build(deps-dev): bump @types/node from 20.12.11 to 20.12.12 (#6727)
dependabot[bot] May 14, 2024
94c2314
build(deps): bump bytemuck from 1.15.0 to 1.16.0 (#6729)
dependabot[bot] May 14, 2024
4f3e7b9
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.8.0 to …
dependabot[bot] May 14, 2024
fb084b7
build(deps): bump serde from 1.0.201 to 1.0.202 (#6733)
dependabot[bot] May 15, 2024
b4229d1
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.9.0 to …
dependabot[bot] May 21, 2024
75047f3
build(deps-dev): bump @typescript-eslint/parser from 7.9.0 to 7.10.0 …
dependabot[bot] May 21, 2024
cd3d0d0
build(deps): bump serde from 1.0.202 to 1.0.203 (#6763)
dependabot[bot] May 27, 2024
c328a36
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.10.0 to…
dependabot[bot] May 28, 2024
70bf514
build(deps-dev): bump @typescript-eslint/parser from 7.10.0 to 7.11.0…
dependabot[bot] May 28, 2024
6042f0b
build(deps-dev): bump @types/node from 20.12.12 to 20.12.13 (#6773)
dependabot[bot] May 30, 2024
3d54fae
build(deps): bump borsh from 1.5.0 to 1.5.1 (#6778)
dependabot[bot] Jun 3, 2024
ec36a13
build(deps-dev): bump prettier from 3.2.5 to 3.3.0 (#6781)
dependabot[bot] Jun 3, 2024
0381b88
build(deps-dev): bump @types/node from 20.12.13 to 20.14.0 (#6782)
dependabot[bot] Jun 3, 2024
ad10e3e
build(deps-dev): bump @types/node from 20.14.0 to 20.14.1 (#6787)
dependabot[bot] Jun 4, 2024
8a8146e
build(deps-dev): bump @typescript-eslint/parser from 7.11.0 to 7.12.0…
dependabot[bot] Jun 4, 2024
d9e8394
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.11.0 to…
dependabot[bot] Jun 4, 2024
364b950
build(deps-dev): bump @types/node from 20.14.1 to 20.14.2 (#6804)
dependabot[bot] Jun 5, 2024
dd2e6b9
build(deps-dev): bump prettier from 3.3.0 to 3.3.1 (#6801)
dependabot[bot] Jun 5, 2024
61278a8
build(deps-dev): bump prettier from 3.3.1 to 3.3.2 (#6830)
dependabot[bot] Jun 11, 2024
96b21c2
build(deps-dev): bump @typescript-eslint/parser from 7.12.0 to 7.13.0…
dependabot[bot] Jun 11, 2024
40b3577
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.12.0 to…
dependabot[bot] Jun 11, 2024
7cc3cf8
TLV Account Resolution: Add support for keys in data (#6847)
Jun 14, 2024
85abaec
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.13.0 to…
dependabot[bot] Jun 18, 2024
cd0351a
build(deps-dev): bump @typescript-eslint/parser from 7.13.0 to 7.13.1…
dependabot[bot] Jun 18, 2024
57e3e15
build(deps-dev): bump @types/node from 20.14.2 to 20.14.5 (#6869)
dependabot[bot] Jun 18, 2024
c72886f
build(deps-dev): bump @types/node from 20.14.5 to 20.14.6 (#6888)
dependabot[bot] Jun 20, 2024
cf53643
build(deps): bump bytemuck from 1.16.0 to 1.16.1 (#6875)
dependabot[bot] Jun 20, 2024
7a35610
build(deps-dev): bump @types/node from 20.14.6 to 20.14.7 (#6892)
dependabot[bot] Jun 21, 2024
e6e2b0b
build(deps-dev): bump @types/node from 20.14.7 to 20.14.8 (#6906)
dependabot[bot] Jun 24, 2024
c45b50a
build(deps-dev): bump typedoc from 0.25.13 to 0.26.2 (#6904)
dependabot[bot] Jun 24, 2024
38b8ad6
build(deps): bump lazy_static from 1.4.0 to 1.5.0 (#6900)
dependabot[bot] Jun 24, 2024
d0419d2
build(deps-dev): bump @types/mocha from 10.0.6 to 10.0.7 (#6903)
dependabot[bot] Jun 24, 2024
ec39ef3
build(deps-dev): bump typescript from 5.4.5 to 5.5.2 (#6894)
dependabot[bot] Jun 24, 2024
03710d4
deps: Upgrade to Solana v2 (#6908)
joncinque Jun 25, 2024
c275342
discriminator: Bump to 0.3.0 for Solana v2 (#6911)
joncinque Jun 25, 2024
7f884b1
program-error: Bump to 0.5.0 for Solana v2 compatibility (#6914)
joncinque Jun 25, 2024
7b72a05
pod: Bump to 0.3.0 for Solana v2 compat (#6917)
joncinque Jun 25, 2024
454a2ae
tlv: Bump to 0.5.0 for Solana v2 compatibility (#6919)
joncinque Jun 25, 2024
8479f8e
pod: Use `bytemuck_derive` explicitly (#6928)
joncinque Jun 25, 2024
d3729d6
tlv-account-resolution: Bump to 0.7.0 for Solana v2 (#6920)
joncinque Jun 25, 2024
c0eb4a1
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.13.1 to…
dependabot[bot] Jun 25, 2024
8246a48
build(deps-dev): bump mocha from 10.4.0 to 10.5.1 (#6921)
dependabot[bot] Jun 25, 2024
f0b2939
build(deps-dev): bump @typescript-eslint/parser from 7.13.1 to 7.14.1…
dependabot[bot] Jun 25, 2024
065d761
build(deps): bump serde_json from 1.0.117 to 1.0.118 (#6909)
dependabot[bot] Jun 26, 2024
56f6f8c
build(deps-dev): bump @types/node from 20.14.8 to 20.14.9 (#6936)
dependabot[bot] Jun 26, 2024
f9212b8
build(deps-dev): bump mocha from 10.5.1 to 10.5.2 (#6942)
dependabot[bot] Jun 27, 2024
2592edd
build(deps-dev): bump typedoc from 0.26.2 to 0.26.3 (#6949)
dependabot[bot] Jun 28, 2024
f76af00
build(deps): bump serde_json from 1.0.118 to 1.0.119 (#6957)
dependabot[bot] Jul 1, 2024
792b370
build(deps-dev): bump @typescript-eslint/parser from 7.14.1 to 7.15.0…
dependabot[bot] Jul 2, 2024
b196a95
build(deps): bump serde_json from 1.0.119 to 1.0.120 (#6966)
dependabot[bot] Jul 2, 2024
8b94887
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.14.1 to…
dependabot[bot] Jul 2, 2024
afcd577
build(deps-dev): bump typescript from 5.5.2 to 5.5.3 (#6971)
dependabot[bot] Jul 2, 2024
da7e86a
build(deps-dev): bump mocha from 10.5.2 to 10.6.0 (#6975)
dependabot[bot] Jul 4, 2024
ea5326a
build(deps): bump serde from 1.0.203 to 1.0.204 (#6983)
dependabot[bot] Jul 8, 2024
cdda608
build(deps-dev): bump @types/node from 20.14.9 to 20.14.10 (#6987)
dependabot[bot] Jul 8, 2024
8cf865a
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.15.0 to…
dependabot[bot] Jul 10, 2024
917b6f1
build(deps-dev): bump typedoc from 0.26.3 to 0.26.4 (#7001)
dependabot[bot] Jul 10, 2024
3102fb2
build(deps-dev): bump @typescript-eslint/parser from 7.15.0 to 7.16.0…
dependabot[bot] Jul 11, 2024
8d5b57f
[libraries/pod]: add `PodOption` type (#6886)
febo Jul 12, 2024
195427d
build(deps-dev): bump prettier from 3.3.2 to 3.3.3 (#7015)
dependabot[bot] Jul 15, 2024
368f6dc
[libraries/pod]: add `PodU128` type (#7012)
febo Jul 16, 2024
52bcae8
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.16.0 to…
dependabot[bot] Jul 16, 2024
dc06507
build(deps-dev): bump @typescript-eslint/parser from 7.16.0 to 7.16.1…
dependabot[bot] Jul 16, 2024
8c110b0
build(deps-dev): bump @types/node from 20.14.10 to 20.14.11 (#7024)
dependabot[bot] Jul 17, 2024
3ee6648
build(deps-dev): bump eslint-plugin-prettier from 5.1.3 to 5.2.1 (#7029)
dependabot[bot] Jul 18, 2024
aa4411a
build(deps-dev): bump typedoc from 0.26.4 to 0.26.5 (#7036)
dependabot[bot] Jul 22, 2024
4af7c8e
build(deps-dev): bump mocha from 10.6.0 to 10.7.0 (#7040)
dependabot[bot] Jul 22, 2024
f239f55
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.16.1 to…
dependabot[bot] Jul 23, 2024
a51fd8f
build(deps-dev): bump @typescript-eslint/parser from 7.16.1 to 7.17.0…
dependabot[bot] Jul 23, 2024
a866db8
build(deps-dev): bump typescript from 5.5.3 to 5.5.4 (#7045)
dependabot[bot] Jul 23, 2024
7ae42f5
build(deps-dev): bump @types/node from 20.14.11 to 20.14.12 (#7049)
dependabot[bot] Jul 24, 2024
70b93a8
ci: Bump crates to Solana 2.0.3 (#7047)
joncinque Jul 25, 2024
9934071
build(deps-dev): bump @types/node from 20.14.12 to 22.0.0 (#7065)
dependabot[bot] Jul 29, 2024
1ed8f62
build(deps): bump serde_json from 1.0.120 to 1.0.121 (#7062)
dependabot[bot] Jul 29, 2024
01f45c3
build(deps-dev): bump @typescript-eslint/parser from 7.17.0 to 7.18.0…
dependabot[bot] Jul 30, 2024
66f35b6
[libraries/pod]: improve `PodOption` type (#7076)
febo Jul 30, 2024
a9a7e35
pod: Bump to 0.3.1 (#7075)
febo Jul 30, 2024
3af2762
build(deps): bump bytemuck from 1.16.1 to 1.16.3 (#7077)
dependabot[bot] Jul 31, 2024
a8c5fa2
pod: Implement `Default` for `PodOption` (#7083)
joncinque Jul 31, 2024
5ed65aa
build(deps-dev): bump @types/node from 22.0.0 to 22.0.2 (#7088)
dependabot[bot] Aug 1, 2024
4e7c1d1
build(deps-dev): bump @types/chai from 4.3.16 to 4.3.17 (#7093)
dependabot[bot] Aug 1, 2024
5a5fe5c
build(deps): bump serde_json from 1.0.121 to 1.0.122 (#7102)
dependabot[bot] Aug 2, 2024
1910d12
build(deps-dev): bump @types/node from 22.0.2 to 22.0.3 (#7103)
dependabot[bot] Aug 2, 2024
18b3c91
build(deps-dev): bump @types/node from 22.0.3 to 22.1.0 (#7111)
dependabot[bot] Aug 5, 2024
b323dc5
tlv: fix typos, update example code in README.md (#7106)
jacksondoherty Aug 5, 2024
3777fc3
TLV: README: use repetition numbers (#7114)
Aug 5, 2024
1f156fd
pnpm: Use workspace-wide prettier configuration (#7115)
joncinque Aug 5, 2024
97e8773
build(deps): bump serde from 1.0.204 to 1.0.205 (#7124)
dependabot[bot] Aug 8, 2024
4b4432c
build(deps): bump serde from 1.0.205 to 1.0.206 (#7131)
dependabot[bot] Aug 12, 2024
fff4b70
build(deps-dev): bump @types/node from 22.1.0 to 22.2.0 (#7133)
dependabot[bot] Aug 12, 2024
f56e045
build(deps-dev): bump mocha from 10.7.0 to 10.7.3 (#7136)
dependabot[bot] Aug 12, 2024
6450119
build(deps): bump serde_json from 1.0.122 to 1.0.124 (#7132)
dependabot[bot] Aug 12, 2024
282ec04
build(deps): bump serde from 1.0.206 to 1.0.207 (#7139)
dependabot[bot] Aug 13, 2024
ffea635
build(deps-dev): bump @typescript-eslint/parser from 7.18.0 to 8.1.0 …
dependabot[bot] Aug 13, 2024
1fd70c6
program-error: Add option to specify solana_program crate (#7112)
joncinque Aug 13, 2024
4e08c6a
build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.17.0 to…
dependabot[bot] Aug 13, 2024
865da58
build(deps-dev): bump @types/node from 22.2.0 to 22.3.0 (#7149)
dependabot[bot] Aug 14, 2024
4871118
[token-2022] Upgrade to `zk-sdk` (#7148)
samkim-crypto Aug 16, 2024
026fdda
build(deps): bump serde_json from 1.0.124 to 1.0.125 (#7157)
dependabot[bot] Aug 16, 2024
c559198
build(deps): bump bytemuck from 1.16.3 to 1.17.0 (#7159)
dependabot[bot] Aug 16, 2024
8b55e1b
build(deps): bump bytemuck_derive from 1.7.0 to 1.7.1 (#7156)
dependabot[bot] Aug 16, 2024
6ab4db8
build(deps): bump serde from 1.0.207 to 1.0.208 (#7158)
dependabot[bot] Aug 16, 2024
831b4fd
build(deps-dev): bump @types/node from 22.3.0 to 22.4.1 (#7170)
dependabot[bot] Aug 19, 2024
02ca7f9
build(deps-dev): bump typedoc from 0.26.5 to 0.26.6 (#7168)
dependabot[bot] Aug 19, 2024
63f91be
build(deps-dev): bump @typescript-eslint/eslint-plugin from 8.1.0 to …
dependabot[bot] Aug 20, 2024
9ed09d3
build(deps-dev): bump @typescript-eslint/parser from 8.1.0 to 8.2.0 (…
dependabot[bot] Aug 20, 2024
6bae666
build(deps-dev): bump @types/node from 22.4.1 to 22.4.2 (#7176)
dependabot[bot] Aug 21, 2024
35b9749
build(deps-dev): bump @types/node from 22.4.2 to 22.5.0 (#7180)
dependabot[bot] Aug 22, 2024
aa2b619
build(deps): bump serde from 1.0.208 to 1.0.209 (#7187)
dependabot[bot] Aug 26, 2024
9ecf817
build(deps-dev): bump @types/chai from 4.3.17 to 4.3.18 (#7189)
dependabot[bot] Aug 26, 2024
06a838b
build(deps): bump serde_json from 1.0.125 to 1.0.127 (#7188)
dependabot[bot] Aug 26, 2024
425ebb6
build(deps-dev): bump @typescript-eslint/parser from 8.2.0 to 8.3.0 (…
dependabot[bot] Aug 27, 2024
6b4b4df
build(deps-dev): bump @typescript-eslint/eslint-plugin from 8.2.0 to …
dependabot[bot] Aug 27, 2024
18e9c23
Publish pod v0.3.2
github-actions[bot] Aug 27, 2024
e186bcc
build(deps): bump bytemuck from 1.17.0 to 1.17.1 (#7209)
dependabot[bot] Aug 28, 2024
31d48be
Publish pod v0.4.0
github-actions[bot] Aug 28, 2024
ea6874f
type-length-value: Revert specifying solana program crate path (#7212)
joncinque Aug 28, 2024
1a90a92
build(deps-dev): bump @types/node from 22.5.0 to 22.5.1 (#7210)
dependabot[bot] Aug 28, 2024
7d69147
build(deps-dev): bump @types/chai from 4.3.18 to 4.3.19 (#7213)
dependabot[bot] Aug 28, 2024
a7ea597
Publish tlv-account-resolution v0.8.0
github-actions[bot] Aug 28, 2024
7269bc2
build(deps-dev): bump @types/node from 22.5.1 to 22.5.2 (#7228)
dependabot[bot] Sep 2, 2024
25015cc
build(deps-dev): bump @typescript-eslint/eslint-plugin from 8.3.0 to …
dependabot[bot] Sep 3, 2024
101c70b
build(deps-dev): bump @typescript-eslint/parser from 8.3.0 to 8.4.0 (…
dependabot[bot] Sep 3, 2024
1e3146e
Publish type-length-value v0.6.0 (#7233)
joncinque Sep 3, 2024
7ac127f
Publish tlv-account-resolution v0.8.1
github-actions[bot] Sep 3, 2024
c48ec36
build(deps-dev): bump @types/node from 22.5.2 to 22.5.3 (#7239)
dependabot[bot] Sep 4, 2024
147e645
build(deps): bump serde_json from 1.0.127 to 1.0.128 (#7241)
dependabot[bot] Sep 5, 2024
350d5d7
build(deps-dev): bump @types/node from 22.5.3 to 22.5.4 (#7242)
dependabot[bot] Sep 5, 2024
8cae448
build(deps): bump bytemuck from 1.17.1 to 1.18.0 (#7244)
dependabot[bot] Sep 6, 2024
0303ebd
build(deps): bump serde from 1.0.209 to 1.0.210 (#7250)
dependabot[bot] Sep 9, 2024
8f65fa5
build(deps-dev): bump typedoc from 0.26.6 to 0.26.7 (#7254)
dependabot[bot] Sep 9, 2024
a1e7e70
build(deps-dev): bump typescript from 5.5.4 to 5.6.2 (#7255)
dependabot[bot] Sep 10, 2024
10e1f87
build(deps-dev): bump @typescript-eslint/eslint-plugin from 8.4.0 to …
dependabot[bot] Sep 10, 2024
35791dd
build(deps-dev): bump @typescript-eslint/parser from 8.4.0 to 8.5.0 (…
dependabot[bot] Sep 10, 2024
76d6fa9
Revert ESLint plugin bump (#7260)
buffalojoec Sep 12, 2024
f140a98
build(deps-dev): bump @types/mocha from 10.0.7 to 10.0.8 (#7275)
dependabot[bot] Sep 13, 2024
654de4a
build(deps-dev): bump @types/node from 22.5.4 to 22.5.5 (#7279)
dependabot[bot] Sep 16, 2024
d9a4002
build(deps-dev): bump @types/node from 22.5.5 to 22.6.1 (#7295)
dependabot[bot] Sep 24, 2024
d2d2b13
build(deps-dev): bump @types/node from 22.6.1 to 22.7.0 (#7302)
dependabot[bot] Sep 25, 2024
e92dfde
build(deps-dev): bump @types/chai from 4.3.19 to 5.0.0 (#7303)
dependabot[bot] Sep 25, 2024
ab7a638
build(deps-dev): bump @types/node from 22.7.0 to 22.7.2 (#7307)
dependabot[bot] Sep 27, 2024
3ebf64b
build(deps-dev): bump @types/node from 22.7.2 to 22.7.4 (#7310)
dependabot[bot] Oct 1, 2024
37ff676
build(deps): bump bytemuck_derive from 1.7.1 to 1.8.0 (#7325)
dependabot[bot] Oct 7, 2024
056d445
build(deps): bump futures from 0.3.30 to 0.3.31 (#7328)
dependabot[bot] Oct 7, 2024
38f96ff
build(deps-dev): bump typedoc from 0.26.7 to 0.26.8 (#7330)
dependabot[bot] Oct 7, 2024
dd7324b
build(deps-dev): bump @types/mocha from 10.0.8 to 10.0.9 (#7338)
dependabot[bot] Oct 8, 2024
df5b168
build(deps-dev): bump @types/node from 22.7.4 to 22.7.5 (#7337)
dependabot[bot] Oct 8, 2024
78cdb8d
build(deps-dev): bump typescript from 5.6.2 to 5.6.3 (#7343)
dependabot[bot] Oct 9, 2024
72e4164
build(deps-dev): bump gh-pages from 6.1.1 to 6.2.0 (#7344)
dependabot[bot] Oct 11, 2024
b442903
build(deps): bump bytemuck from 1.18.0 to 1.19.0 (#7345)
dependabot[bot] Oct 14, 2024
42ddc08
build(deps-dev): bump typedoc from 0.26.8 to 0.26.9 (#7346)
dependabot[bot] Oct 14, 2024
f70800c
build(deps-dev): bump typedoc from 0.26.9 to 0.26.10 (#7352)
dependabot[bot] Oct 16, 2024
bd7caed
build(deps-dev): bump @types/node from 22.7.5 to 22.7.6 (#7362)
dependabot[bot] Oct 17, 2024
cbbdecc
Use the SHA-256 implementation built into JavaScript engines (#7361)
steveluscher Oct 17, 2024
46782ca
build(deps): bump serde_json from 1.0.128 to 1.0.129 (#7364)
dependabot[bot] Oct 18, 2024
67f5f79
build(deps): bump serde_json from 1.0.129 to 1.0.132 (#7372)
dependabot[bot] Oct 21, 2024
850e4ad
build(deps-dev): bump @types/node from 22.7.6 to 22.7.7 (#7373)
dependabot[bot] Oct 21, 2024
fe4027d
build(deps): bump serde from 1.0.210 to 1.0.211 (#7380)
dependabot[bot] Oct 22, 2024
5c43a38
build(deps-dev): bump @types/node from 22.7.7 to 22.7.8 (#7384)
dependabot[bot] Oct 22, 2024
711f9fc
build(deps): bump serde from 1.0.211 to 1.0.213 (#7388)
dependabot[bot] Oct 23, 2024
23d9440
build(deps-dev): bump chai from 5.1.1 to 5.1.2 (#7389)
dependabot[bot] Oct 23, 2024
69493b0
build(deps-dev): bump @types/node from 22.7.8 to 22.7.9 (#7390)
dependabot[bot] Oct 23, 2024
4c61ff1
CI: Update clippy to use `--all-features`, fix issues (#7395)
joncinque Oct 25, 2024
e74bb00
build(deps-dev): bump @types/node from 22.7.9 to 22.8.1 (#7401)
dependabot[bot] Oct 28, 2024
05f2bb4
build(deps): bump serde from 1.0.213 to 1.0.214 (#7405)
dependabot[bot] Oct 29, 2024
3c0ce8d
build(deps-dev): bump @types/node from 22.8.1 to 22.8.2 (#7407)
dependabot[bot] Oct 29, 2024
1a6cf0e
build(deps-dev): bump @types/chai from 5.0.0 to 5.0.1 (#7409)
dependabot[bot] Oct 29, 2024
282ac7a
build(deps-dev): bump mocha from 10.7.3 to 10.8.1 (#7413)
dependabot[bot] Oct 30, 2024
a81c830
build(deps-dev): bump @types/node from 22.8.2 to 22.8.4 (#7411)
dependabot[bot] Oct 30, 2024
686f47e
build(deps-dev): bump mocha from 10.8.1 to 10.8.2 (#7422)
dependabot[bot] Oct 31, 2024
a470d2a
build(deps-dev): bump @types/node from 22.8.4 to 22.8.5 (#7423)
dependabot[bot] Oct 31, 2024
229dac6
CI: Update to Solana v2.1 crates (#7416)
joncinque Oct 31, 2024
02d14d8
js: Update libs from rc.1 to rc.2 (#7426)
joncinque Oct 31, 2024
31f1f4a
remove solana-program from spl-type-length-value (#7428)
kevinheavey Oct 31, 2024
6e9e2e1
remove solana-program from spl-pod (#7425)
kevinheavey Oct 31, 2024
6d83a41
remove solana-program from spl-discriminator (#7427)
kevinheavey Oct 31, 2024
f4d883c
remove solana-program from tlv-account-resolution (#7433)
kevinheavey Oct 31, 2024
08c9d67
pod: remove solana-program from dev-dependencies (#7435)
joncinque Oct 31, 2024
9b3492e
Publish spl-pod v0.5.0
github-actions[bot] Nov 1, 2024
611583d
Publish spl-program-error v0.6.0
github-actions[bot] Nov 1, 2024
b61dec0
build(deps-dev): bump @types/node from 22.8.5 to 22.8.6 (#7439)
dependabot[bot] Nov 1, 2024
fb648e5
Publish spl-discriminator v0.4.0
github-actions[bot] Nov 1, 2024
a25f5f7
Publish spl-type-length-value v0.7.0
github-actions[bot] Nov 1, 2024
ff04298
Publish spl-tlv-account-resolution v0.9.0
github-actions[bot] Nov 1, 2024
bbac048
build(deps-dev): bump typedoc from 0.26.10 to 0.26.11 (#7451)
dependabot[bot] Nov 4, 2024
4a4e73d
build(deps-dev): bump @types/node from 22.8.6 to 22.8.7 (#7452)
dependabot[bot] Nov 4, 2024
6ebe228
build(deps-dev): bump @types/node from 22.8.7 to 22.9.0 (#7459)
dependabot[bot] Nov 5, 2024
e448ab3
build(deps): bump thiserror from 1.0.68 to 2.0.0 (#7462)
dependabot[bot] Nov 6, 2024
a630c50
build(deps): bump borsh from 1.5.1 to 1.5.2 (#7470)
dependabot[bot] Nov 8, 2024
a6766a6
build(deps): bump @solana/assertions from 2.0.0-rc.2 to 2.0.0 (#7476)
dependabot[bot] Nov 8, 2024
a951d53
build(deps): bump serial_test from 3.1.1 to 3.2.0 (#7481)
dependabot[bot] Nov 11, 2024
75933b5
build(deps): bump serde from 1.0.214 to 1.0.215 (#7485)
dependabot[bot] Nov 12, 2024
bd526ae
build(deps): bump borsh from 1.5.2 to 1.5.3 (#7491)
dependabot[bot] Nov 14, 2024
41e2211
build(deps): bump serde_json from 1.0.132 to 1.0.133 (#7497)
dependabot[bot] Nov 18, 2024
11ebfd9
build(deps): bump bytemuck from 1.19.0 to 1.20.0 (#7507)
dependabot[bot] Nov 20, 2024
fbc8747
build(deps-dev): bump @types/node from 22.9.0 to 22.9.1 (#7508)
dependabot[bot] Nov 20, 2024
aacae62
build(deps-dev): bump @types/mocha from 10.0.9 to 10.0.10 (#7513)
dependabot[bot] Nov 21, 2024
ffa9291
build(deps-dev): bump @types/node from 22.9.1 to 22.9.3 (#7522)
dependabot[bot] Nov 25, 2024
479cef9
build(deps-dev): bump typescript from 5.6.3 to 5.7.2 (#7521)
dependabot[bot] Nov 25, 2024
8f874d2
build(deps-dev): bump @types/node from 22.9.3 to 22.10.0 (#7534)
dependabot[bot] Nov 26, 2024
43bc64f
build(deps-dev): bump typedoc from 0.26.11 to 0.27.0 (#7536)
dependabot[bot] Nov 27, 2024
3540b61
build(deps-dev): bump @types/node from 22.10.0 to 22.10.1 (#7544)
dependabot[bot] Nov 28, 2024
4fff171
build(deps-dev): bump typedoc from 0.27.0 to 0.27.1 (#7545)
dependabot[bot] Nov 28, 2024
e560d5d
build(deps-dev): bump typedoc from 0.27.1 to 0.27.2 (#7548)
dependabot[bot] Dec 2, 2024
2c107f1
build(deps-dev): bump mocha from 10.8.2 to 11.0.1 (#7553)
dependabot[bot] Dec 3, 2024
c13ca8b
build(deps-dev): bump typedoc from 0.27.2 to 0.27.3 (#7558)
dependabot[bot] Dec 4, 2024
2f6ef33
build(deps-dev): bump typedoc from 0.27.3 to 0.27.4 (#7567)
dependabot[bot] Dec 9, 2024
43bbdfd
build(deps): bump serde from 1.0.215 to 1.0.216 (#7576)
dependabot[bot] Dec 11, 2024
69163e2
build(deps-dev): bump @types/node from 22.10.1 to 22.10.2 (#7578)
dependabot[bot] Dec 11, 2024
f38888d
Oops, moving tlv-account-resolution which was missed
joncinque Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions discriminator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "spl-discriminator"
version = "0.4.0"
description = "Solana Program Library 8-Byte Discriminator Management"
authors = ["Solana Labs Maintainers <maintainers@solanalabs.com>"]
repository = "https://github.com/solana-labs/solana-program-library"
license = "Apache-2.0"
edition = "2021"

[features]
borsh = ["dep:borsh"]

[dependencies]
borsh = { version = "1", optional = true }
bytemuck = { version = "1.20.0", features = ["derive"] }
solana-program-error = "2.1.0"
solana-sha256-hasher = "2.1.0"
spl-discriminator-derive = { version = "0.2.0", path = "./derive" }

[lib]
crate-type = ["cdylib", "lib"]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
57 changes: 57 additions & 0 deletions discriminator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# SPL Discriminator

This library allows for easy management of 8-byte discriminators.

### The `ArrayDiscriminator` Struct

With this crate, you can leverage the `ArrayDiscriminator` type to manage an 8-byte discriminator for generic purposes.

```rust
let my_discriminator = ArrayDiscriminator::new([8, 5, 1, 56, 10, 53, 9, 198]);
```

The `new(..)` function is also a **constant function**, so you can use `ArrayDiscriminator` in constants as well.

```rust
const MY_DISCRIMINATOR: ArrayDiscriminator = ArrayDiscriminator::new([8, 5, 1, 56, 10, 53, 9, 198]);
```

The `ArrayDiscriminator` struct also offers another constant function `as_slice(&self)`, so you can use `as_slice()` in constants as well.

```rust
const MY_DISCRIMINATOR_SLICE: &[u8] = MY_DISCRIMINATOR.as_slice();
```

### The `SplDiscriminate` Trait

A trait, `SplDiscriminate` is also available, which will give you the `ArrayDiscriminator` constant type and also a slice representation of the discriminator. This can be particularly handy with match statements.

```rust
/// A trait for managing 8-byte discriminators in a slab of bytes
pub trait SplDiscriminate {
/// The 8-byte discriminator as a `[u8; 8]`
const SPL_DISCRIMINATOR: ArrayDiscriminator;
/// The 8-byte discriminator as a slice (`&[u8]`)
const SPL_DISCRIMINATOR_SLICE: &'static [u8] = Self::SPL_DISCRIMINATOR.as_slice();
}
```

### The `SplDiscriminate` Derive Macro

The `SplDiscriminate` derive macro is a particularly useful tool for those who wish to derive their 8-byte discriminator from a particular string literal. Typically, you would have to run a hash function against the string literal, then copy the first 8 bytes, and then hard-code those bytes into a statement like the one above.

Instead, you can simply annotate a struct or enum with `SplDiscriminate` and provide a **hash input** via the `discriminator_hash_input` attribute, and the macro will automatically derive the 8-byte discriminator for you!

```rust
#[derive(SplDiscriminate)] // Implements `SplDiscriminate` for your struct/enum using your declared string literal hash_input
#[discriminator_hash_input("some_discriminator_hash_input")]
pub struct MyInstruction1 {
arg1: String,
arg2: u8,
}

let my_discriminator: ArrayDiscriminator = MyInstruction1::SPL_DISCRIMINATOR;
let my_discriminator_slice: &[u8] = MyInstruction1::SPL_DISCRIMINATOR_SLICE;
```

Note: the 8-byte discriminator derived using the macro is always the **first 8 bytes** of the resulting hashed bytes.
19 changes: 19 additions & 0 deletions discriminator/derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "spl-discriminator-derive"
version = "0.2.0"
description = "Derive macro library for the `spl-discriminator` library"
authors = ["Solana Labs Maintainers <maintainers@solanalabs.com>"]
repository = "https://github.com/solana-labs/solana-program-library"
license = "Apache-2.0"
edition = "2021"

[dependencies]
quote = "1.0"
spl-discriminator-syn = { version = "0.2.0", path = "../syn" }
syn = { version = "2.0", features = ["full"] }

[lib]
proc-macro = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
20 changes: 20 additions & 0 deletions discriminator/derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//! Derive macro library for the `spl-discriminator` library

#![deny(missing_docs)]
#![cfg_attr(not(test), forbid(unsafe_code))]

extern crate proc_macro;

use {
proc_macro::TokenStream, quote::ToTokens, spl_discriminator_syn::SplDiscriminateBuilder,
syn::parse_macro_input,
};

/// Derive macro library to implement the `SplDiscriminate` trait
/// on an enum or struct
#[proc_macro_derive(SplDiscriminate, attributes(discriminator_hash_input))]
pub fn spl_discriminator(input: TokenStream) -> TokenStream {
parse_macro_input!(input as SplDiscriminateBuilder)
.to_token_stream()
.into()
}
83 changes: 83 additions & 0 deletions discriminator/src/discriminator.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//! The traits and types used to create a discriminator for a type

use {
bytemuck::{Pod, Zeroable},
solana_program_error::ProgramError,
solana_sha256_hasher::hashv,
};

/// A trait for managing 8-byte discriminators in a slab of bytes
pub trait SplDiscriminate {
/// The 8-byte discriminator as a `[u8; 8]`
const SPL_DISCRIMINATOR: ArrayDiscriminator;
/// The 8-byte discriminator as a slice (`&[u8]`)
const SPL_DISCRIMINATOR_SLICE: &'static [u8] = Self::SPL_DISCRIMINATOR.as_slice();
}

/// Array Discriminator type
#[cfg_attr(
feature = "borsh",
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
#[repr(transparent)]
pub struct ArrayDiscriminator([u8; ArrayDiscriminator::LENGTH]);
impl ArrayDiscriminator {
/// Size for discriminator in account data
pub const LENGTH: usize = 8;
/// Uninitialized variant of a discriminator
pub const UNINITIALIZED: Self = Self::new([0; Self::LENGTH]);
/// Creates a discriminator from an array
pub const fn new(value: [u8; Self::LENGTH]) -> Self {
Self(value)
}
/// Get the array as a const slice
pub const fn as_slice(&self) -> &[u8] {
self.0.as_slice()
}
/// Creates a new `ArrayDiscriminator` from some hash input string literal
pub fn new_with_hash_input(hash_input: &str) -> Self {
let hash_bytes = hashv(&[hash_input.as_bytes()]).to_bytes();
let mut discriminator_bytes = [0u8; 8];
discriminator_bytes.copy_from_slice(&hash_bytes[..8]);
Self(discriminator_bytes)
}
}
impl AsRef<[u8]> for ArrayDiscriminator {
fn as_ref(&self) -> &[u8] {
&self.0[..]
}
}
impl AsRef<[u8; ArrayDiscriminator::LENGTH]> for ArrayDiscriminator {
fn as_ref(&self) -> &[u8; ArrayDiscriminator::LENGTH] {
&self.0
}
}
impl From<u64> for ArrayDiscriminator {
fn from(from: u64) -> Self {
Self(from.to_le_bytes())
}
}
impl From<[u8; Self::LENGTH]> for ArrayDiscriminator {
fn from(from: [u8; Self::LENGTH]) -> Self {
Self(from)
}
}
impl TryFrom<&[u8]> for ArrayDiscriminator {
type Error = ProgramError;
fn try_from(a: &[u8]) -> Result<Self, Self::Error> {
<[u8; Self::LENGTH]>::try_from(a)
.map(Self::from)
.map_err(|_| ProgramError::InvalidAccountData)
}
}
impl From<ArrayDiscriminator> for [u8; 8] {
fn from(from: ArrayDiscriminator) -> Self {
from.0
}
}
impl From<ArrayDiscriminator> for u64 {
fn from(from: ArrayDiscriminator) -> Self {
u64::from_le_bytes(from.0)
}
}
144 changes: 144 additions & 0 deletions discriminator/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
//! Crate defining a discriminator type, which creates a set of bytes
//! meant to be unique for instructions or struct types

#![deny(missing_docs)]
#![cfg_attr(not(test), forbid(unsafe_code))]

extern crate self as spl_discriminator;

/// Exports the discriminator module
pub mod discriminator;

// Export for downstream
pub use {
discriminator::{ArrayDiscriminator, SplDiscriminate},
spl_discriminator_derive::SplDiscriminate,
};

#[cfg(test)]
mod tests {
use {super::*, crate::discriminator::ArrayDiscriminator};

#[allow(dead_code)]
#[derive(SplDiscriminate)]
#[discriminator_hash_input("my_first_instruction")]
pub struct MyInstruction1 {
arg1: String,
arg2: u8,
}

#[allow(dead_code)]
#[derive(SplDiscriminate)]
#[discriminator_hash_input("global:my_second_instruction")]
pub enum MyInstruction2 {
One,
Two,
Three,
}

#[allow(dead_code)]
#[derive(SplDiscriminate)]
#[discriminator_hash_input("global:my_instruction_with_lifetime")]
pub struct MyInstruction3<'a> {
data: &'a [u8],
}

#[allow(dead_code)]
#[derive(SplDiscriminate)]
#[discriminator_hash_input("global:my_instruction_with_one_generic")]
pub struct MyInstruction4<T> {
data: T,
}

#[allow(dead_code)]
#[derive(SplDiscriminate)]
#[discriminator_hash_input("global:my_instruction_with_one_generic_and_lifetime")]
pub struct MyInstruction5<'b, T> {
data: &'b [T],
}

#[allow(dead_code)]
#[derive(SplDiscriminate)]
#[discriminator_hash_input("global:my_instruction_with_multiple_generics_and_lifetime")]
pub struct MyInstruction6<'c, U, V> {
data1: &'c [U],
data2: &'c [V],
}

#[allow(dead_code)]
#[derive(SplDiscriminate)]
#[discriminator_hash_input(
"global:my_instruction_with_multiple_generics_and_lifetime_and_where"
)]
pub struct MyInstruction7<'c, U, V>
where
U: Clone + Copy,
V: Clone + Copy,
{
data1: &'c [U],
data2: &'c [V],
}

fn assert_discriminator<T: spl_discriminator::discriminator::SplDiscriminate>(
hash_input: &str,
) {
let discriminator = build_discriminator(hash_input);
assert_eq!(
T::SPL_DISCRIMINATOR,
discriminator,
"Discriminator mismatch: case: {}",
hash_input
);
assert_eq!(
T::SPL_DISCRIMINATOR_SLICE,
discriminator.as_slice(),
"Discriminator mismatch: case: {}",
hash_input
);
}

fn build_discriminator(hash_input: &str) -> ArrayDiscriminator {
let preimage = solana_sha256_hasher::hashv(&[hash_input.as_bytes()]);
let mut bytes = [0u8; 8];
bytes.copy_from_slice(&preimage.to_bytes()[..8]);
ArrayDiscriminator::new(bytes)
}

#[test]
fn test_discrminators() {
let runtime_discrim = ArrayDiscriminator::new_with_hash_input("my_runtime_hash_input");
assert_eq!(
runtime_discrim,
build_discriminator("my_runtime_hash_input"),
);

assert_discriminator::<MyInstruction1>("my_first_instruction");
assert_discriminator::<MyInstruction2>("global:my_second_instruction");
assert_discriminator::<MyInstruction3<'_>>("global:my_instruction_with_lifetime");
assert_discriminator::<MyInstruction4<u8>>("global:my_instruction_with_one_generic");
assert_discriminator::<MyInstruction5<'_, u8>>(
"global:my_instruction_with_one_generic_and_lifetime",
);
assert_discriminator::<MyInstruction6<'_, u8, u8>>(
"global:my_instruction_with_multiple_generics_and_lifetime",
);
assert_discriminator::<MyInstruction7<'_, u8, u8>>(
"global:my_instruction_with_multiple_generics_and_lifetime_and_where",
);
}
}

#[cfg(all(test, feature = "borsh"))]
mod borsh_test {
use {super::*, borsh::BorshDeserialize};

#[test]
fn borsh_test() {
let my_discrim = ArrayDiscriminator::new_with_hash_input("my_discrim");
let mut buffer = [0u8; 8];
borsh::to_writer(&mut buffer[..], &my_discrim).unwrap();
let my_discrim_again = ArrayDiscriminator::try_from_slice(&buffer).unwrap();
assert_eq!(my_discrim, my_discrim_again);
assert_eq!(buffer, <[u8; 8]>::from(my_discrim));
}
}
18 changes: 18 additions & 0 deletions discriminator/syn/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "spl-discriminator-syn"
version = "0.2.0"
description = "Token parsing and generating library for the `spl-discriminator` library"
authors = ["Solana Labs Maintainers <maintainers@solanalabs.com>"]
repository = "https://github.com/solana-labs/solana-program-library"
license = "Apache-2.0"
edition = "2021"

[dependencies]
proc-macro2 = "1.0"
quote = "1.0"
sha2 = "0.10"
syn = { version = "2.0", features = ["full"] }
thiserror = "1.0"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
12 changes: 12 additions & 0 deletions discriminator/syn/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//! Error types for the `hash_input` parser

/// Error types for the `hash_input` parser
#[derive(Clone, Debug, Eq, thiserror::Error, PartialEq)]
pub enum SplDiscriminateError {
/// Discriminator hash_input attribute not provided
#[error("Discriminator `hash_input` attribute not provided")]
HashInputAttributeNotProvided,
/// Error parsing discriminator hash_input attribute
#[error("Error parsing discriminator `hash_input` attribute")]
HashInputAttributeParseError,
}
Loading