Commit d8bbb2b
authored
feat: Blake2s implementation (#821)
* chore: upgrade juno module to use the blake2s implementation
* fix: compiler error due to juno module upgrade
* feat: add Blake2s hash functions
- Implemented Blake2s and Blake2sArray functions for hashing felt.Felt pointers.
* refactor: update compiledClassHash functions logic + new method for blake hash
- Introduced CompiledClassHashV2 for using the Blake2s hash function to generate Compiled Clash Hashes
- Make a compiledClassHash function that accepts a hash function as a parameter, and use it for the CompiledClassHash and CompiledClassHashV2 functions.
* refactor: simplify bytecode segment hashing logic + accept hashFunc param
- Adds a new hashFunc param to make the function work with any hash function specified.
- Adjusted return values in hashCasmClassByteCode to return the computed hash instead of a function.
* test: enhance ClassHashes tests to include CompiledClassHashV2
* feat: add support for Blake2s hash in BuildDeclareTxn
- Introduced the UseBlake2sHash option in TxnOptions to allow selection of the Blake2s hash function for compiled class hash calculation.
- Updated BuildDeclareTxn to conditionally use Blake2s or the default hash function based on the new option.
- Added unit tests to validate the behavior of BuildDeclareTxn with both hash options.
* feat: implement support for dynamic hash selection in transaction methods
- Added the shouldUseBlake2sHash function to determine if the Blake2s hash function should be used for compiled class hashes based on the Starknet version.
- Updated BuildAndSendDeclareTxn and other transaction methods to utilize the new hash selection logic.
- Introduced unit tests for BuildAndSendDeclareTxn to validate behavior with different Starknet versions and their corresponding compiled class hashes.
* feat: enhance BuildAndSendDeclareTxn with TxnOptions for Blake2s hash selection
- Updated TxnOptions to accept a new UseBlake2sHash field, allowing users to specify whether to use the Blake2s hash function for compiled class hash calculation.
- Modified the logic to determine the hash function based on the provided options or default to fetching the Starknet version.
- Enhanced unit tests to cover various scenarios for hash selection based on Starknet versions and TxnOptions.
* test: fix TestBuildAndSendMethodsWithQueryBit test
* chore: use new Juno felt constructors
* chore: upgrade Juno version to v0.15.11
* refactor: update hash function calls to use curve package
- Modified hash function implementations in curve.go to return pointers to the computed hashes.
- Updated references in hash.go to utilize the new curve functions for Poseidon and Pedersen hashes, ensuring consistency across the codebase.
* chore: update changelog1 parent 262d3a9 commit d8bbb2b
File tree
13 files changed
+517
-103
lines changed- account
- curve
- hash
- utils
13 files changed
+517
-103
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
18 | 33 | | |
19 | 34 | | |
20 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | | - | |
63 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
141 | 153 | | |
142 | 154 | | |
143 | 155 | | |
| |||
146 | 158 | | |
147 | 159 | | |
148 | 160 | | |
149 | | - | |
150 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
151 | 164 | | |
152 | 165 | | |
153 | 166 | | |
| |||
239 | 252 | | |
240 | 253 | | |
241 | 254 | | |
242 | | - | |
243 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
244 | 258 | | |
245 | 259 | | |
246 | 260 | | |
| |||
465 | 479 | | |
466 | 480 | | |
467 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
133 | 282 | | |
134 | 283 | | |
135 | 284 | | |
| |||
411 | 560 | | |
412 | 561 | | |
413 | 562 | | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
414 | 568 | | |
415 | 569 | | |
416 | 570 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
48 | 56 | | |
49 | 57 | | |
50 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
246 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
247 | 250 | | |
248 | 251 | | |
249 | 252 | | |
| |||
255 | 258 | | |
256 | 259 | | |
257 | 260 | | |
258 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
259 | 279 | | |
260 | 280 | | |
261 | 281 | | |
| |||
268 | 288 | | |
269 | 289 | | |
270 | 290 | | |
271 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
272 | 294 | | |
273 | 295 | | |
274 | 296 | | |
| |||
281 | 303 | | |
282 | 304 | | |
283 | 305 | | |
284 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
285 | 325 | | |
286 | 326 | | |
287 | 327 | | |
| |||
293 | 333 | | |
294 | 334 | | |
295 | 335 | | |
296 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
297 | 339 | | |
298 | 340 | | |
299 | 341 | | |
| |||
0 commit comments