@aztec/ivc-integration 5.0.0-rc.2 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/app_creator.json +92 -72
- package/artifacts/app_reader.json +92 -72
- package/artifacts/keys/mock_rollup_root_verifier.sol +263 -292
- package/artifacts/mock_hiding.json +126 -154
- package/artifacts/mock_private_kernel_init.json +277 -253
- package/artifacts/mock_private_kernel_inner.json +278 -254
- package/artifacts/mock_private_kernel_reset.json +144 -124
- package/artifacts/mock_private_kernel_tail.json +144 -124
- package/artifacts/mock_rollup_root.json +82 -82
- package/artifacts/mock_rollup_tx_base_private.json +129 -129
- package/artifacts/mock_rollup_tx_base_public.json +132 -132
- package/artifacts/mock_rollup_tx_merge.json +126 -126
- package/dest/prove_native.d.ts +1 -1
- package/dest/prove_native.d.ts.map +1 -1
- package/dest/prove_native.js +3 -6
- package/dest/types/index.d.ts +15 -15
- package/dest/witgen.d.ts +3 -3
- package/dest/witgen.d.ts.map +1 -1
- package/dest/witgen.js +2 -2
- package/package.json +16 -16
- package/src/prove_native.ts +3 -6
- package/src/types/index.ts +15 -15
- package/src/witgen.ts +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"noir_version": "1.0.0-beta.
|
|
3
|
-
"hash": "
|
|
2
|
+
"noir_version": "1.0.0-beta.22+c57152f91260ecdb9faad4efc20abb14b6d2ece7",
|
|
3
|
+
"hash": "11624877766123003898",
|
|
4
4
|
"abi": {
|
|
5
5
|
"parameters": [
|
|
6
6
|
{
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"name": "key",
|
|
52
52
|
"type": {
|
|
53
53
|
"kind": "array",
|
|
54
|
-
"length":
|
|
54
|
+
"length": 163,
|
|
55
55
|
"type": {
|
|
56
56
|
"kind": "field"
|
|
57
57
|
}
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"name": "key",
|
|
108
108
|
"type": {
|
|
109
109
|
"kind": "array",
|
|
110
|
-
"length":
|
|
110
|
+
"length": 163,
|
|
111
111
|
"type": {
|
|
112
112
|
"kind": "field"
|
|
113
113
|
}
|
|
@@ -176,436 +176,440 @@
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
},
|
|
179
|
-
"bytecode": "H4sIAAAAAAAA/
|
|
180
|
-
"debug_symbols": "
|
|
179
|
+
"bytecode": "H4sIAAAAAAAA/92dB3RURRfHMxtIIKEXG5ZVFGkiRQRRREioShFEUVAMYY0L6dlEkOZSFFQ02Q0BlBYCAelNpNoSEOGOYKGoQUVUmlIEVPp3XxJnhpdo7tvs5HxHjsfzO8N9M/87M2/mP7tDEuhJy5gXE+GMzWPV3Ss6REdEDu0QN6xTcmxkWER0tHt+7/Y9Onf0uBc84XTFOpKSAuzFBK3p7YhMTkxypjjaR0UlOqIiXM642Iy8gCzxWEVBIYJCBVUSVFlQFUFVBVUTVF1QDUE1BdUSVFvQNYKuFXSdoOsF3SCojqAbBd0k6GZBtwiyC7pV0G2C6gq6XdAdguoJulNQfUENBDUU1EhQY0F3CWoi6G5BTQU1E9RcUAtB9whqKeheQa0EtRZ0n6A2gu4X9ICgtoIeFNRO0EOC2gvqIChMULigjoI6CeosqIugroK6CXpY0COCugvqIainoF6CHhXUW1AfQY8J6ivocUFPCOon6ElBTwnqL2iAoKcFPSNooKBnBUUIGiQoUtBgQQ5BzwmKEvS8IKegIYKGCooWFCMoVlCcoHhBCYISBSUJcglKFpQi6AVBwwQNF/SioBGCRgoaJWi0oDGC4CWJboljJY6TOF7iBIkvS3xF4kSJkyS+KvE1ia9LnCzxDYlvSkyVmCZRrtbglZgucYrEDIlTJU6TOF3iWxLfljhD4kyJsyTOljhHYqbEuRLljgHzJM6XmC1xgcSFEt+RuEji4lSlq5bY3AvD4mKTXBGxrlx7wL//YT7td7BS4iqJqyWukfiuxLUS35O4TuJ6iRskbpS4SeJmie9L/EDihxI/kvixxByJuRK3SNwq8ROJ2yR+KnG7xB0SQSKX+JnEnRJ3Sfxc4hcSv5T4lcTdEvdI3Ctxn8SvJX4j8VuJeRL3S/xO4vcSf5B4QOKPEg9K/EnizxJ/kXhI4mGJRyQelXhM4q8Sf5N4XOIJiSclnpL4u8TTEs9IPCvxD4l/SvxL4jmJ5yVekHhR4iWJlyVeEchZgMJMYZvCgQqXU7i8wkEKBytcQeGKCocoHKpwJYUrK1xF4aoKV1O4usI1FK6pcC2Fayt8jcLXKnydwtcrfIPCdRS+UeGbFL5Z4VsUtit8q8K3KVxX4dsVvkPhegrfqXB9hRso3FDhRgo3VvguhZsofLfCTRVupnBzhVsofI/CLRW+V+FWCrdW+D6F2yh8v8IPKNxW4QcVbqfwQwq3V7iDwmEKhyvcUeFOCndWuIvCXRXupvDDCj+icHeFeyjcU+FeCj+qcG+F+yhbN2ePWdu7F3dIdEZHO6OMbTs9IM2d3ccZGxXt8KameUp+mpUYUlBjTHy0g7NnvKmpBEWL2qPrTnQ95UiM86Z5CSKwZopYzgbm2psO7pF4oNmcBut6dVzrdvd7un6Lw12Gr49PCztw1nsSo3xpfWDJWQWUrp9tlvr5WT39bMOaaf0coaGfsfUIy/3MPFf3c0mq8qfIv1V/5cqVS7LKf9fDjP955LAMkhhJG6GSP2zCWmlhkfarejzVS+uNf4/ynMwf7kGkuiIJPWt1UuCcwOZpIzuIMHnM7ZdUq/HyeyjrJEnhYIsKiVPaQam2uyMmLnF411inyxuUjlLwsYL/sgv+xoehGYij45dpVhgVQYp6jvBeLSzIqWe8J8j7MT7CWdRV+XkIQ2+sR9QZGkWZIzZSes8TBlNNLyc/vefNKePIOn2ZS0Os9+4Qzob60lR0iU3ZzE1FcxbjS1OxJTYVaG4qlrO40u3pgZb29Hg9e3og1kzb0xM07OnYekKp9nSPP5eXEveny77u/IkSk/y38yfSwpJMO3962S3Jhf4gkVRXEqH/rW9CCdg8bRFItLj7eqir/2AvqStxRfaQ3kQnKR2XBruTr3IoTeVQkspkXSpjaCpjSCpTdKmMo6mMI6l8waLPq4g+z4VDgPnhw8X5PA/V5yVQ34WEMlx9vCdwzcAmSXUNs+Q2KhoWYBhnwy3bxkBqZ+HCNZwyOwJJ6b1oyTZWNGwjpvfif2w2XKbOhhEEQ0jZe0fYzZMGLcBIcxk65FHmMrSyo81l6DnHlM5zlrPkOV/S4znLYc00z+nW4DmxdXdpPKeXtLYXvgWkTYAWiOvBCMJ6YCuY4gEl9u2IEu3WRV/t7liJ4/xnd8fSwsbZfdiKjeEiuURbLV1WgNh+bS3tG5OL1r7DYvupU/05Z0nHjbGkJX4cpUVbLVJUbVKUg/DGWT/guDFh2gFnrJYDDk4dF3WOjaTZ3ZGkdMbrSieZms4oWjqjSOlM0JVOCjWd0bR0RpPSeVlXOi9Q0xlDS2cMKZ1XLJ6tQvBsNR4HFTsCHy7ubJWaUXYLY2ESE//fljzjz9WdQvtAz02KmqTBu2InYsW09fZVS2euEMPhv8rZa5ZfC3S0k0gvxSSsnfZSvEZK8HWLCebkJ/i6j51OUz6JpHwyQTnFbE62m0cQPe8b5jI8371pLsPzXaq5DM93aaU735W3dL7z6Dnflceaaec7r4bzHbbu1X4fI8hSP6fr6ecgrJnWz1M09DO2PqUM7mN49d3HyJA41X/H1Axa2FSf7mN4SQegDFJdUwk9a32lnoLN00Y2Q8NJ1nj5KftEeZLCaRZNXyiavml+uDjhxW70y3wojJpCippu6av9UGPDms7ZW5Y/ATcWDupUeosymEGk9N62ZFZCDbOC6b1tThlHdoa5DPf3meYy3N9nmctwf59dun0n2NK+M0fPvhOMNdP2nUwN+w62nlkGdwaIb5a+OwNzJWb5b3eaSwvL8unOgF9Wo8I9bC6prixC/1tffzOxedoeNlfLpxy48E0jHegwcAbtWDSDlM48LR8uo8qZNJUzSSrn61I5i6ZyFkllti6Vs2kqZ5NULrBocSqhxZmHQ4D54cO+3xlAi5NJfRcyy3D1KbwzkEmqa6GlOwOVDAuwkLN3LDumYGpn4cL1DmV2BJPSW2TJMVUyHBOmt+g/NhsuU2fDYj/dGVhsN08atABLzGXoOZeay9BzLjOXoedcXjrPWcGS51yhx3NWwJppnnOlBs+Jra/Uf2eg8C0gbQK0QFwPFtPuDGSS+naxvjsDqySu9p/dXUULW+3LnQFjuGjfmTfUZQWI7TfS0r4xuWjtj7DYPvHOAHHOko4bq0hL/GrSl14NSVGNSFGUWzrWDzgrMWHaAWeVlgMOTp151Dm2hGZ3l5DSWaMrnfnUdJbS0llKSuddXelkU9NZRktnGSmdtbrSWUBNZzktneWkdN6zeLaqjGerNTio2BH4cCnuDPhlYSxMYt3/25Jn/PHlzsBKUtR6LXcG1mHFtPV2g6UzV2XD4W/gbKPl1wId7XrSS7Eea6e9FBtJCW6ymGBOfoKbfOx0mvL1JOWb/XRnYLPdPILoed83l+H57gNzGZ7vPjSX4fnuo9Kd72CppQPex3oOeLAUq6ad8HI0nPCM5nNKc8Sj7UVuziaSAidxNjlV32krV+IW/522cmlhW+y+XXOdSDtttPLhtFNy+8aA0NpvbXX/SiedUHJJi9QW0hbbihTVWsvZAxf0XNpemKvFDuJEGk8d8TdoQrfqEjqBKvRNmtBPdAl9mSqUeOtnmy6hr1CFptGEfmrR41dBj78VBwJTxIeL9fi0T663l92LXpCEdcedQ4raocVxb8eKaSMIlgxpFcNzAWfc8vQzHMYOkuXegdXTjCsnZfiZxQxz8jP8zMdepynfQVK+00+We6fdPIRofHaZy9Byf24uQ8v9hbkMLfeXpbTcyyxZ7q80We5lWDXNcu/WYbmx+d36LTfO5u2kQHztdmq03Hsk7vWf5d5DC9tr982pbadZ3jAtltsYEFr74Xos9x7SIrWXtMeGkaLCtVju3ZgKbTPco8V34UTaSh3xXTSh+3QJ/YQq9HOa0K91Cd1GFfoFTeg3uoR+ShX6JU3otxYtd1W03PtwIDBFfLgUljuv7F70giSsW+7dpKj9Wix3HlZMG8HvLBnSqobn+o6z761bbnQY+0mWez9WTzOu35My/MFihjn5Gf7gY6/TlO8nKT/gJ8t9wG4eQjQ+P5rL0HIfNJeh5f7JXIaW++dSWu7lliz3L5os93Ksmma5D+mw3Nj8If2WeyV++UIKxC+XNmu03IclHvGf5T5MCzvii+U2eo5meXtqsdzGgNDa76XHch8mLVJHSHtsT1JULy2W+xCmQtsMD2vxXTiR1lBH/H2a0KO6hL5LFfoBTegxXULXUoV+SBP6qy6h71GFfkQT+ptFy10NLfdRHAhMER8uheU+XnYvekES1i33IVLUCS2W+zhWTBvBk5YMaTXDc53k7JR1y40O4wTJcp/A6mnG9RQpw98tZpiTn+HvPvY6TfkJkvLTfrLcp+3mIUTjc8Zchpb7rLkMLfcf5jK03H+W0nKvsGS5/9JkuVdg1TTLfU6H5cbmz+m33Og3jpMC8bU7rdFyn5d4wX+W+zwt7ILdN6d2nGZ5+2ux3MaA0NofoMdynyctUhdIe2x/UtQALZb7HKZC2wzPa/FdOJGOUkf8DE3oRV1Cj1GFnqUJvaRL6K9UoX/QhF7WJfQ3qtA/aUKvWLTc1dFyX8SBwBTxYd8tty2g7F70giSsW+5zpEQYYfOxvMrYjIppyzXhd3Ypnqs6ei6bjdsCrVvuFSjJS+oRrJ5kXG2kHypuK2cxw5z8DMv52Os05aTftGQj/Jw0iuOwlbebhhAtty3IXDaE24LNZdHcVsFcFsttFYu+DyXlHEDKOITgbSkZh9itK+SsL1VjQEmjYvXfzud/+72P+iXQj7SDwuO6hH5NFXqQJvQJXUK/oQr9iSa0ny6h31KF/kwT+qQWoehdL1KX8CCa0Kd0Cb1EFRpME9pfl9DLVKEVaEIH6BJ6hSq0Ik3o0xa9Y43puELjqobrBb6JOMdx9uC4YMZY16LeDldyYmx4hCviqoeCpwcwW2C58kHBuI8Zm4URcXW9FdJhKSyD5bBCRrA81lc8WDEktFLlKlWrVa9Rs1bta6697vob6tx408232G+9re7td9S7s36Dho0a39Xk7qbNmre4p+W9rVrf1+b+B9o+2O6h9h3Cwjt26tyla7eHH+neo2evR3v3eazv40/0e/Kp/gOefmbgsxGDIgc7not63jlkaHRMbFx8QmKSKznlhWHDXxwxctToMfASuGEsjIPxMAFehldgIkyCV+E1eB0mwxvwJqRCGnjAC+kwBTJgKkyD6fAWvA0zYCbMgtkwBzJhLmTBPJgP2bAAFsI7sAgWw5K/84WVsApWwxp4F9bCe7AO1sMG2AibYDO8Dx/Ah/ARfAw5kAtbYCt8AtvgU9gOOwCAw2ewE3bB5/AFfAlfwW7YA3thH3wN38C3kAf74Tv4Hn6AA/AjHISf4Gf4BQ7BYTgCR+EY/Aq/wXE4ASfhFPwOp+EMnIU/4E/4C87BebgAF+ESXIYrnOG8w3li48ZvYCvHjZ+ZGsSNn6xWgbOKnIVwFspZJc4qc1aFs6qcVeOsOmc1OKvJWS3OanN2DWfXcnYdZ9dzdgNndTi7kbObOLuZs1s4s3N2K2e3cVaXs9s5u4OzepzdyVl9zhpw1pCzRpw15uwuzppwdjdnTTlrxllzzlpwdg9nLTm7l7NWnLXm7D7O2nB2P2cPcNaWswc5a8fZQ5y156wDZ2GchXPWkbNOnHXmrAtnXTnrxtnDnD3CWXfOenDWk7NenD3KWW/O+nD2WGpqXkBNj3te+0hnYmXPztUtG7ep3K/eS6mFRXWLFjXx7NwVfOzMjq1RqX8XtS0a1a1o1JNFo4YWLUop+iBMKBoGnmLi5hQTt7SYuI3FxG0rJm5PMXEHi4k7VUzc5aJxOL08O+tscuxql3c0D83iisHOREeky5niGOiMTcGVcrp7fv4vq/a6s8Pz/6q2e0HXWJcjypGY1bdFc8IZzvR8LWvPB7iXGEvTYFyawuLih4tqAqQeUbGpJdv8Tk5HNOWXti7t4IyNSByeH94zPv3vCgKzOyYkR0QnFWnT5s7ulhwT3/U5jwitYG6dEVtn/9R6QFa4M0XUJjXM6+OKi0/zyLT/7gjPBnXw8rt4YEJynMvpiHVNM8sLsTYMNvPzoX4exhBZ8T/0h21RYYNKtwTI/vmHp1hW9+RoZdxKDO+TPKiY2rO6x6V4ipkHpsEIFen8D0G0immVjAAA",
|
|
180
|
+
"debug_symbols": "tZjdauNIEIXfRde+UNdP/8yrLEtwEmcwGCd47IUl5N2nq6uOMzMgYWLmRudLHB2fqlJZit+n593j5fvD/vjy+mP69s/79HjaHw777w+H16ftef967L99/9hM+PHhfNrt+q+mX17vZ71tT7vjefp2vBwOm+m/7eEy/ujH2/Y49Lw99VfnzbQ7Pnfthi/7w87oY/N59rx8qqjEycp6PV3Tb+en5fOZs4YBi9SrA6VbE6ikMMgpLyXgv5kgZw6DIrKUQJfPJy0woJw+Eyjd7JC5XB1yWnIoKzVIvbZR2meGfLtBwZWQldIXDJTpaqDyFYPKV4O6ZLDWxTojAVVpX5lDzfXq0GTJIfG9g1h3uGUSqw43jWLd4ZZZrOxUUXwoldoWP1fqylonggMnnRdHsWqR29WiLVrQfO801x1umeaqw03TXHe4ZZqrrewNRCtZ05emweU6UG68OI189zTy3dPId08j/9VpfPahIy21cuWKqDPuN/WP2/6//aft0/7024PKlHpJm4n688Jm4h51M8k46jjmcSzjWMexdePNlGaX5EIu/fx+LaVukHrCpKE5tITW0OZKc2gab0Dk4mHI05DHIc9DHog8EbUhPLt4JPZIzC7ioiMgRyCOQByBOAJJBJIUSqEcGgWKFdjHJTnUY4nHEo+lHku9OPXi1ItTj6Xqkl2KS3Xxfmfvd06jgByBcgTKEShHx3MUmKPAHAXmKLBEgSUKLOFX2AspEupdL3EVeHnFyyvm1a+cOoemUArlUAm1bP0aqzm0hNZQ8+s38GZ+dp2lUArlUAnV0Oz+rYTW0MiX5hmQAARgf+80C0ABGVA8V5qrv2GaW0CaAQlAAAYIQAEZYM7FoAKQmZCZkJmQmRggAAUgMxVABbQA2xKHBCAAR6WMzIzMjMxjZQagG4xuCLoh6IagG4JuCJzH6ljJY3cGxPySVAC6oeiGLZHdrZKtkQMDxP4vMFBABhRABbQAWysyZ1ssYgMCMEAACsiAAqiAFmAr5gBnWzKyPtuWOUiEtz1zyIACqIAWMBZuQIoqbOUcGIBuVHSjohu2d6PkiswVmRsyN2Ru6EZDNxq60dCNhm40dKPB2XbQKiXbQYeYIM0EYIAAzFkNMqAAzLkYtADbQYcEIAADLHM1MGd7C9tBhwKogBZgO+iQAARggADgbDvIdjOzHXSoEd52cIDtoEMCEIABAtCownbQoQDQDUY3BN2wHRwlCzILMgsyCzILuiHohqAbgm4ouqHohsLZdnBUajvogAkqJqiYoKIbtoOc7JY+G3zYE81pv3087OL7k5fL8emXr1PO/7/hFXzh8nZ6fdo9X047e6IZr/VnnJ8=",
|
|
181
181
|
"file_map": {
|
|
182
182
|
"6": {
|
|
183
|
-
"source": "use crate::{cmp::Eq, convert::From, runtime::is_unconstrained, static_assert};\n\n/// A `BoundedVec<T, MaxLen>` is a growable storage similar to a built-in vector except that it\n/// is bounded with a maximum possible length. `BoundedVec` is also not\n/// subject to the same restrictions vectors are (notably, nested vectors are disallowed).\n///\n/// Since a BoundedVec is backed by a normal array under the hood, growing the BoundedVec by\n/// pushing an additional element is also more efficient - the length only needs to be increased\n/// by one.\n///\n/// For these reasons `BoundedVec<T, N>` should generally be preferred over vectors when there\n/// is a reasonable maximum bound that can be placed on the vector.\n///\n/// Example:\n///\n/// ```noir\n/// let mut vector: BoundedVec<Field, 10> = BoundedVec::new();\n/// for i in 0..5 {\n/// vector.push(i);\n/// }\n/// assert(vector.len() == 5);\n/// assert(vector.max_len() == 10);\n/// ```\npub struct BoundedVec<T, let MaxLen: u32> {\n storage: [T; MaxLen],\n len: u32,\n}\n\nimpl<T, let MaxLen: u32> BoundedVec<T, MaxLen> {\n /// Creates a new, empty vector of length zero.\n ///\n /// Since this container is backed by an array internally, it still needs an initial value\n /// to give each element. To resolve this, each element is zeroed internally. This value\n /// is guaranteed to be inaccessible unless `get_unchecked` is used.\n ///\n /// Example:\n ///\n /// ```noir\n /// let empty_vector: BoundedVec<Field, 10> = BoundedVec::new();\n /// assert(empty_vector.len() == 0);\n /// ```\n ///\n /// Note that whenever calling `new` the maximum length of the vector should always be specified\n /// via a type signature:\n ///\n /// ```noir\n /// fn good() -> BoundedVec<Field, 10> {\n /// // Ok! MaxLen is specified with a type annotation\n /// let v1: BoundedVec<Field, 3> = BoundedVec::new();\n /// let v2 = BoundedVec::new();\n ///\n /// // Ok! MaxLen is known from the type of `good`'s return value\n /// v2\n /// }\n ///\n /// fn bad() {\n /// // Error: Type annotation needed\n /// // The compiler can't infer `MaxLen` from the following code:\n /// let mut v3 = BoundedVec::new();\n /// v3.push(5);\n /// }\n /// ```\n ///\n /// This defaulting of `MaxLen` (and numeric generics in general) to zero may change in future noir versions\n /// but for now make sure to use type annotations when using bounded vectors. Otherwise, you will receive a\n /// constraint failure at runtime when the vec is pushed to.\n pub fn new() -> Self {\n let zeroed = crate::mem::zeroed();\n BoundedVec { storage: [zeroed; MaxLen], len: 0 }\n }\n\n /// Retrieves an element from the vector at the given index, starting from zero.\n ///\n /// If the given index is equal to or greater than the length of the vector, this\n /// will issue a constraint failure.\n ///\n /// Example:\n ///\n /// ```noir\n /// fn foo<let N: u32>(v: BoundedVec<u32, N>) {\n /// let first = v.get(0);\n /// let last = v.get(v.len() - 1);\n /// assert(first != last);\n /// }\n /// ```\n pub fn get(&self, index: u32) -> T {\n assert(index < self.len, \"Attempted to read past end of BoundedVec\");\n self.get_unchecked(index)\n }\n\n /// Retrieves an element from the vector at the given index, starting from zero, without\n /// performing a bounds check.\n ///\n /// Since this function does not perform a bounds check on length before accessing the element,\n /// it is unsafe! Use at your own risk!\n ///\n /// Example:\n ///\n /// ```noir\n /// fn sum_of_first_three<let N: u32>(v: BoundedVec<u32, N>) -> u32 {\n /// // Always ensure the length is larger than the largest\n /// // index passed to get_unchecked\n /// assert(v.len() > 2);\n /// let first = v.get_unchecked(0);\n /// let second = v.get_unchecked(1);\n /// let third = v.get_unchecked(2);\n /// first + second + third\n /// }\n /// ```\n pub fn get_unchecked(&self, index: u32) -> T {\n self.storage[index]\n }\n\n /// Writes an element to the vector at the given index, starting from zero.\n ///\n /// If the given index is equal to or greater than the length of the vector, this will issue a constraint failure.\n ///\n /// Example:\n ///\n /// ```noir\n /// fn foo<let N: u32>(v: BoundedVec<u32, N>) {\n /// let first = v.get(0);\n /// assert(first != 42);\n /// v.set(0, 42);\n /// let new_first = v.get(0);\n /// assert(new_first == 42);\n /// }\n /// ```\n pub fn set(&mut self, index: u32, value: T) {\n assert(index < self.len, \"Attempted to write past end of BoundedVec\");\n self.set_unchecked(index, value)\n }\n\n /// Writes an element to the vector at the given index, starting from zero, without performing a bounds check.\n ///\n /// Since this function does not perform a bounds check on length before accessing the element, it is unsafe! Use at your own risk!\n ///\n /// Example:\n ///\n /// ```noir\n /// fn set_unchecked_example() {\n /// let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n /// vec.extend_from_array([1, 2]);\n ///\n /// // Here we're safely writing within the valid range of `vec`\n /// // `vec` now has the value [42, 2]\n /// vec.set_unchecked(0, 42);\n ///\n /// // We can then safely read this value back out of `vec`.\n /// // Notice that we use the checked version of `get` which would prevent reading unsafe values.\n /// assert_eq(vec.get(0), 42);\n ///\n /// // We've now written past the end of `vec`.\n /// // As this index is still within the maximum potential length of `v`,\n /// // it won't cause a constraint failure.\n /// vec.set_unchecked(2, 42);\n /// println(vec);\n ///\n /// // This will write past the end of the maximum potential length of `vec`,\n /// // it will then trigger a constraint failure.\n /// vec.set_unchecked(5, 42);\n /// println(vec);\n /// }\n /// ```\n pub fn set_unchecked(&mut self, index: u32, value: T) {\n self.storage[index] = value;\n }\n\n /// Pushes an element to the end of the vector. This increases the length\n /// of the vector by one.\n ///\n /// Panics if the new length of the vector will be greater than the max length.\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut v: BoundedVec<Field, 2> = BoundedVec::new();\n ///\n /// v.push(1);\n /// v.push(2);\n ///\n /// // Panics with failed assertion \"push out of bounds\"\n /// v.push(3);\n /// ```\n pub fn push(&mut self, elem: T) {\n assert(self.len < MaxLen, \"push out of bounds\");\n\n self.storage[self.len] = elem;\n self.len += 1;\n }\n\n /// Returns the current length of this vector\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut v: BoundedVec<Field, 4> = BoundedVec::new();\n /// assert(v.len() == 0);\n ///\n /// v.push(100);\n /// assert(v.len() == 1);\n ///\n /// v.push(200);\n /// v.push(300);\n /// v.push(400);\n /// assert(v.len() == 4);\n ///\n /// let _ = v.pop();\n /// let _ = v.pop();\n /// assert(v.len() == 2);\n /// ```\n pub fn len(&self) -> u32 {\n self.len\n }\n\n /// Returns the maximum length of this vector. This is always\n /// equal to the `MaxLen` parameter this vector was initialized with.\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut v: BoundedVec<Field, 5> = BoundedVec::new();\n ///\n /// assert(v.max_len() == 5);\n /// v.push(10);\n /// assert(v.max_len() == 5);\n /// ```\n pub fn max_len(_self: &BoundedVec<T, MaxLen>) -> u32 {\n MaxLen\n }\n\n /// Returns the internal array within this vector.\n ///\n /// Since arrays in Noir are immutable, mutating the returned storage array will not mutate\n /// the storage held internally by this vector.\n ///\n /// Note that uninitialized elements may be zeroed out!\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut v: BoundedVec<Field, 5> = BoundedVec::new();\n ///\n /// assert(v.storage() == [0, 0, 0, 0, 0]);\n ///\n /// v.push(57);\n /// assert(v.storage() == [57, 0, 0, 0, 0]);\n /// ```\n pub fn storage(self) -> [T; MaxLen] {\n self.storage\n }\n\n /// Pushes each element from the given array to this vector.\n ///\n /// Panics if pushing each element would cause the length of this vector\n /// to exceed the maximum length.\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut vec: BoundedVec<Field, 3> = BoundedVec::new();\n /// vec.extend_from_array([2, 4]);\n ///\n /// assert(vec.len == 2);\n /// assert(vec.get(0) == 2);\n /// assert(vec.get(1) == 4);\n /// ```\n pub fn extend_from_array<let Len: u32>(&mut self, array: [T; Len]) {\n let new_len = self.len + array.len();\n assert(new_len <= MaxLen, \"extend_from_array out of bounds\");\n for i in 0..array.len() {\n self.storage[self.len + i] = array[i];\n }\n self.len = new_len;\n }\n\n /// Pushes each element from the given vector to this vector.\n ///\n /// Panics if pushing each element would cause the length of this vector\n /// to exceed the maximum length.\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut vec: BoundedVec<Field, 3> = BoundedVec::new();\n /// vec.extend_from_vector([2, 4].as_vector());\n ///\n /// assert(vec.len == 2);\n /// assert(vec.get(0) == 2);\n /// assert(vec.get(1) == 4);\n /// ```\n pub fn extend_from_vector(&mut self, vector: [T]) {\n let new_len = self.len + vector.len();\n assert(new_len <= MaxLen, \"extend_from_vector out of bounds\");\n for i in 0..vector.len() {\n self.storage[self.len + i] = vector[i];\n }\n self.len = new_len;\n }\n\n /// Pushes each element from the other vector to this vector. The length of\n /// the other vector is left unchanged.\n ///\n /// Panics if pushing each element would cause the length of this vector\n /// to exceed the maximum length.\n ///\n /// ```noir\n /// let mut v1: BoundedVec<Field, 5> = BoundedVec::new();\n /// let mut v2: BoundedVec<Field, 7> = BoundedVec::new();\n ///\n /// v2.extend_from_array([1, 2, 3]);\n /// v1.extend_from_bounded_vec(v2);\n ///\n /// assert(v1.storage() == [1, 2, 3, 0, 0]);\n /// assert(v2.storage() == [1, 2, 3, 0, 0, 0, 0]);\n /// ```\n pub fn extend_from_bounded_vec<let Len: u32>(&mut self, vec: BoundedVec<T, Len>) {\n let append_len = vec.len();\n let new_len = self.len + append_len;\n assert(new_len <= MaxLen, \"extend_from_bounded_vec out of bounds\");\n\n if is_unconstrained() {\n for i in 0..append_len {\n self.storage[self.len + i] = vec.get_unchecked(i);\n }\n } else {\n // The source vector can be longer than the destination, or vice versa;\n // regardless we will only ever be able to read or write whichever is\n // the shorter max length of the two. We asserted that the actual content fits,\n // but the capacity of the source vector could be higher.\n let max = crate::cmp::min(Len, MaxLen);\n\n // Save the last item in case we have to do a fixup on an already full array.\n let last = if MaxLen > 0 {\n self.storage[MaxLen - 1]\n } else {\n crate::mem::zeroed()\n };\n\n for src in 0..max {\n // Since we are iterating to the static capacity of the arrays,\n // the destination could be out of bounds. If that's the case,\n // overwrite the last item, which we'll fixup in the end.\n // NB using cmp::min resulted in more opcodes here.\n let mut dst = self.len + src;\n if dst >= MaxLen { dst = MaxLen - 1; };\n // Assigning the source or zeroed to avoid having to merge arrays in SSA.\n self.storage[dst] = if src < append_len {\n vec.get_unchecked(src)\n } else {\n last\n }\n }\n\n // Fixup the last item if we have to.\n if MaxLen > 0 {\n self.storage[MaxLen - 1] = if (self.len + append_len == MaxLen) & (append_len > 0) {\n vec.get_unchecked(append_len - 1)\n } else {\n last\n }\n }\n }\n self.len = new_len;\n }\n\n /// Creates a new vector, populating it with values derived from an array input.\n /// The maximum length of the vector is determined based on the type signature.\n ///\n /// Example:\n ///\n /// ```noir\n /// let bounded_vec: BoundedVec<Field, 10> = BoundedVec::from_array([1, 2, 3])\n /// ```\n pub fn from_array<let Len: u32>(array: [T; Len]) -> Self {\n static_assert(Len <= MaxLen, \"from array out of bounds\");\n let mut vec: BoundedVec<T, MaxLen> = BoundedVec::new();\n vec.extend_from_array(array);\n vec\n }\n\n /// Pops the element at the end of the vector. This will decrease the length\n /// of the vector by one.\n ///\n /// Panics if the vector is empty.\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut v: BoundedVec<Field, 2> = BoundedVec::new();\n /// v.push(1);\n /// v.push(2);\n ///\n /// let two = v.pop();\n /// let one = v.pop();\n ///\n /// assert(two == 2);\n /// assert(one == 1);\n ///\n /// // error: cannot pop from an empty vector\n /// let _ = v.pop();\n /// ```\n pub fn pop(&mut self) -> T {\n assert(self.len > 0, \"cannot pop from an empty vector\");\n self.len -= 1;\n\n let elem = self.storage[self.len];\n self.storage[self.len] = crate::mem::zeroed();\n elem\n }\n\n /// Returns true if the given predicate returns true for any element\n /// in this vector.\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut v: BoundedVec<u32, 3> = BoundedVec::new();\n /// v.extend_from_array([2, 4, 6]);\n ///\n /// let all_even = !v.any(|elem: u32| elem % 2 != 0);\n /// assert(all_even);\n /// ```\n pub fn any<Env>(self, predicate: fn[Env](T) -> bool) -> bool {\n let mut ret = false;\n if is_unconstrained() {\n for i in 0..self.len {\n ret |= predicate(self.storage[i]);\n }\n } else {\n let mut exceeded_len = false;\n for i in 0..MaxLen {\n exceeded_len |= i == self.len;\n if !exceeded_len {\n ret |= predicate(self.storage[i]);\n }\n }\n }\n ret\n }\n\n /// Creates a new vector of equal size by calling a closure on each element in this vector.\n ///\n /// Example:\n ///\n /// ```noir\n /// let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n /// let result = vec.map(|value| value * 2);\n ///\n /// let expected = BoundedVec::from_array([2, 4, 6, 8]);\n /// assert_eq(result, expected);\n /// ```\n pub fn map<U, Env>(&self, f: fn[Env](T) -> U) -> BoundedVec<U, MaxLen> {\n let mut ret = BoundedVec::new();\n ret.len = self.len();\n\n if is_unconstrained() {\n for i in 0..self.len() {\n ret.storage[i] = f(self.get_unchecked(i));\n }\n } else {\n for i in 0..MaxLen {\n ret.storage[i] = if i < self.len() {\n f(self.get_unchecked(i))\n } else {\n crate::mem::zeroed()\n }\n }\n }\n\n ret\n }\n\n /// Creates a new vector of equal size by calling a closure on each element\n /// in this vector, along with its index.\n ///\n /// Example:\n ///\n /// ```noir\n /// let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n /// let result = vec.mapi(|i, value| i + value * 2);\n ///\n /// let expected = BoundedVec::from_array([2, 5, 8, 11]);\n /// assert_eq(result, expected);\n /// ```\n pub fn mapi<U, Env>(&self, f: fn[Env](u32, T) -> U) -> BoundedVec<U, MaxLen> {\n let mut ret = BoundedVec::new();\n ret.len = self.len();\n\n if is_unconstrained() {\n for i in 0..self.len() {\n ret.storage[i] = f(i, self.get_unchecked(i));\n }\n } else {\n for i in 0..MaxLen {\n ret.storage[i] = if i < self.len() {\n f(i, self.get_unchecked(i))\n } else {\n crate::mem::zeroed()\n }\n }\n }\n\n ret\n }\n\n /// Calls a closure on each element in this vector.\n ///\n /// Example:\n ///\n /// ```noir\n /// let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n /// let mut result = BoundedVec::<u32, 4>::new();\n /// vec.for_each(|value| result.push(value * 2));\n ///\n /// let expected = BoundedVec::from_array([2, 4, 6, 8]);\n /// assert_eq(result, expected);\n /// ```\n pub fn for_each<Env>(&self, f: fn[Env](T) -> ()) {\n if is_unconstrained() {\n for i in 0..self.len() {\n f(self.get_unchecked(i));\n }\n } else {\n for i in 0..MaxLen {\n if i < self.len() {\n f(self.get_unchecked(i));\n }\n }\n }\n }\n\n /// Calls a closure on each element in this vector, along with its index.\n ///\n /// Example:\n ///\n /// ```noir\n /// let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n /// let mut result = BoundedVec::<u32, 4>::new();\n /// vec.for_eachi(|i, value| result.push(i + value * 2));\n ///\n /// let expected = BoundedVec::from_array([2, 5, 8, 11]);\n /// assert_eq(result, expected);\n /// ```\n pub fn for_eachi<Env>(&self, f: fn[Env](u32, T) -> ()) {\n if is_unconstrained() {\n for i in 0..self.len() {\n f(i, self.get_unchecked(i));\n }\n } else {\n for i in 0..MaxLen {\n if i < self.len() {\n f(i, self.get_unchecked(i));\n }\n }\n }\n }\n\n /// Creates a new BoundedVec from the given array and length.\n /// The given length must be less than or equal to the length of the array.\n ///\n /// This function will zero out any elements at or past index `len` of `array`.\n /// This incurs an extra runtime cost of O(MaxLen). If you are sure your array is\n /// zeroed after that index, you can use [`from_parts_unchecked`][Self::from_parts_unchecked] to remove the extra loop.\n ///\n /// Example:\n ///\n /// ```noir\n /// let vec: BoundedVec<u32, 4> = BoundedVec::from_parts([1, 2, 3, 0], 3);\n /// assert_eq(vec.len(), 3);\n /// ```\n pub fn from_parts(mut array: [T; MaxLen], len: u32) -> Self {\n assert(len <= MaxLen);\n let zeroed = crate::mem::zeroed();\n\n if is_unconstrained() {\n for i in len..MaxLen {\n array[i] = zeroed;\n }\n } else {\n for i in 0..MaxLen {\n if i >= len {\n array[i] = zeroed;\n }\n }\n }\n\n BoundedVec { storage: array, len }\n }\n\n /// Creates a new BoundedVec from the given array and length.\n /// The given length must be less than or equal to the length of the array.\n ///\n /// This function is unsafe because it expects all elements past the `len` index\n /// of `array` to be zeroed, but does not check for this internally. Use `from_parts`\n /// for a safe version of this function which does zero out any indices past the\n /// given length. Invalidating this assumption can notably cause `BoundedVec::eq`\n /// to give incorrect results since it will check even elements past `len`.\n ///\n /// Example:\n ///\n /// ```noir\n /// let vec: BoundedVec<u32, 4> = BoundedVec::from_parts_unchecked([1, 2, 3, 0], 3);\n /// assert_eq(vec.len(), 3);\n ///\n /// // invalid use!\n /// let vec1: BoundedVec<u32, 4> = BoundedVec::from_parts_unchecked([1, 2, 3, 1], 3);\n /// let vec2: BoundedVec<u32, 4> = BoundedVec::from_parts_unchecked([1, 2, 3, 2], 3);\n ///\n /// // both vecs have length 3 so we'd expect them to be equal, but this\n /// // fails because elements past the length are still checked in eq\n /// assert_eq(vec1, vec2); // fails\n /// ```\n pub fn from_parts_unchecked(array: [T; MaxLen], len: u32) -> Self {\n assert(len <= MaxLen);\n BoundedVec { storage: array, len }\n }\n}\n\nimpl<T, let MaxLen: u32> Eq for BoundedVec<T, MaxLen>\nwhere\n T: Eq,\n{\n fn eq(self, other: BoundedVec<T, MaxLen>) -> bool {\n // TODO: https://github.com/noir-lang/noir/issues/4837\n //\n // We make the assumption that the user has used the proper interface for working with `BoundedVec`s\n // rather than directly manipulating the internal fields as this can result in an inconsistent internal state.\n if self.len == other.len {\n self.storage == other.storage\n } else {\n false\n }\n }\n}\n\nimpl<T, let MaxLen: u32, let Len: u32> From<[T; Len]> for BoundedVec<T, MaxLen> {\n fn from(array: [T; Len]) -> BoundedVec<T, MaxLen> {\n BoundedVec::from_array(array)\n }\n}\n\nmod bounded_vec_tests {\n\n mod get {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test(should_fail_with = \"Attempted to read past end of BoundedVec\")]\n fn panics_when_reading_elements_past_end_of_vec() {\n let vec: BoundedVec<Field, 5> = BoundedVec::new();\n\n let _ = vec.get(0);\n }\n\n #[test(should_fail_with = \"Attempted to read past end of BoundedVec\")]\n fn panics_when_reading_beyond_length() {\n let vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3]);\n let _ = vec.get(3);\n }\n\n #[test]\n fn get_works_within_bounds() {\n let vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3, 4, 5]);\n assert_eq(vec.get(0), 1);\n assert_eq(vec.get(2), 3);\n assert_eq(vec.get(4), 5);\n }\n\n #[test]\n fn get_unchecked_works() {\n let vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3]);\n assert_eq(vec.get_unchecked(0), 1);\n assert_eq(vec.get_unchecked(2), 3);\n }\n\n #[test]\n fn get_unchecked_works_past_len() {\n let vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3]);\n assert_eq(vec.get_unchecked(4), 0);\n }\n }\n\n mod set {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn set_updates_values_properly() {\n let mut vec = BoundedVec::from_array([0, 0, 0, 0, 0]);\n\n vec.set(0, 42);\n assert_eq(vec.storage, [42, 0, 0, 0, 0]);\n\n vec.set(1, 43);\n assert_eq(vec.storage, [42, 43, 0, 0, 0]);\n\n vec.set(2, 44);\n assert_eq(vec.storage, [42, 43, 44, 0, 0]);\n\n vec.set(1, 10);\n assert_eq(vec.storage, [42, 10, 44, 0, 0]);\n\n vec.set(0, 0);\n assert_eq(vec.storage, [0, 10, 44, 0, 0]);\n }\n\n #[test(should_fail_with = \"Attempted to write past end of BoundedVec\")]\n fn panics_when_writing_elements_past_end_of_vec() {\n let mut vec: BoundedVec<Field, 5> = BoundedVec::new();\n vec.set(0, 42);\n }\n\n #[test(should_fail_with = \"Attempted to write past end of BoundedVec\")]\n fn panics_when_setting_beyond_length() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3]);\n vec.set(3, 4);\n }\n\n #[test]\n fn set_unchecked_operations() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n vec.push(1);\n vec.push(2);\n\n vec.set_unchecked(0, 10);\n assert_eq(vec.get(0), 10);\n }\n\n #[test(should_fail_with = \"Attempted to read past end of BoundedVec\")]\n fn set_unchecked_operations_past_len() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n vec.push(1);\n vec.push(2);\n\n vec.set_unchecked(3, 40);\n assert_eq(vec.get(3), 40);\n }\n\n #[test]\n fn set_preserves_other_elements() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3, 4, 5]);\n\n vec.set(2, 30);\n assert_eq(vec.get(0), 1);\n assert_eq(vec.get(1), 2);\n assert_eq(vec.get(2), 30);\n assert_eq(vec.get(3), 4);\n assert_eq(vec.get(4), 5);\n }\n }\n\n mod any {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn returns_false_if_predicate_not_satisfied() {\n let vec: BoundedVec<bool, 4> = BoundedVec::from_array([false, false, false, false]);\n let result = vec.any(|value| value);\n\n assert(!result);\n }\n\n #[test]\n fn returns_true_if_predicate_satisfied() {\n let vec: BoundedVec<bool, 4> = BoundedVec::from_array([false, false, true, true]);\n let result = vec.any(|value| value);\n\n assert(result);\n }\n\n #[test]\n fn returns_false_on_empty_boundedvec() {\n let vec: BoundedVec<bool, 0> = BoundedVec::new();\n let result = vec.any(|value| value);\n\n assert(!result);\n }\n\n #[test]\n fn any_with_complex_predicates() {\n let vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3, 4, 5]);\n\n assert(vec.any(|x| x > 3));\n assert(!vec.any(|x| x > 10));\n assert(vec.any(|x| x % 2 == 0)); // has a even number\n assert(vec.any(|x| x == 3)); // has a specific value\n }\n\n #[test]\n fn any_with_partial_vector() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n vec.push(1);\n vec.push(2);\n\n assert(vec.any(|x| x == 1));\n assert(vec.any(|x| x == 2));\n assert(!vec.any(|x| x == 3));\n }\n }\n\n mod map {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn applies_function_correctly() {\n // docs:start:bounded-vec-map-example\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = vec.map(|value| value * 2);\n // docs:end:bounded-vec-map-example\n let expected = BoundedVec::from_array([2, 4, 6, 8]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn applies_function_that_changes_return_type() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = vec.map(|value| (value * 2) as Field);\n let expected: BoundedVec<Field, 4> = BoundedVec::from_array([2, 4, 6, 8]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn does_not_apply_function_past_len() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([0, 1]);\n let result = vec.map(|value| if value == 0 { 5 } else { value });\n let expected = BoundedVec::from_array([5, 1]);\n\n assert_eq(result, expected);\n assert_eq(result.get_unchecked(2), 0);\n }\n\n #[test]\n fn map_with_conditional_logic() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n\n let result = vec.map(|x| if x % 2 == 0 { x * 2 } else { x });\n let expected = BoundedVec::from_array([1, 4, 3, 8]);\n assert_eq(result, expected);\n }\n\n #[test]\n fn map_preserves_length() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = vec.map(|x| x * 2);\n\n assert_eq(result.len(), vec.len());\n assert_eq(result.max_len(), vec.max_len());\n }\n\n #[test]\n fn map_on_empty_vector() {\n let vec: BoundedVec<u32, 5> = BoundedVec::new();\n let result = vec.map(|x| x * 2);\n assert_eq(result, vec);\n assert_eq(result.len(), 0);\n assert_eq(result.max_len(), 5);\n }\n }\n\n mod mapi {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn applies_function_correctly() {\n // docs:start:bounded-vec-mapi-example\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = vec.mapi(|i, value| i + value * 2);\n // docs:end:bounded-vec-mapi-example\n let expected = BoundedVec::from_array([2, 5, 8, 11]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn applies_function_that_changes_return_type() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = vec.mapi(|i, value| (i + value * 2) as Field);\n let expected: BoundedVec<Field, 4> = BoundedVec::from_array([2, 5, 8, 11]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn does_not_apply_function_past_len() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([0, 1]);\n let result = vec.mapi(|_, value| if value == 0 { 5 } else { value });\n let expected = BoundedVec::from_array([5, 1]);\n\n assert_eq(result, expected);\n assert_eq(result.get_unchecked(2), 0);\n }\n\n #[test]\n fn mapi_with_index_branching_logic() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n\n let result = vec.mapi(|i, x| if i % 2 == 0 { x * 2 } else { x });\n let expected = BoundedVec::from_array([2, 2, 6, 4]);\n assert_eq(result, expected);\n }\n }\n\n mod for_each {\n use crate::collections::bounded_vec::BoundedVec;\n\n // map in terms of for_each\n fn for_each_map<T, U, Env, let MaxLen: u32>(\n input: BoundedVec<T, MaxLen>,\n f: fn[Env](T) -> U,\n ) -> BoundedVec<U, MaxLen> {\n let mut output = BoundedVec::<U, MaxLen>::new();\n let output_ref = &mut output;\n input.for_each(|x| output_ref.push(f(x)));\n output\n }\n\n #[test]\n fn smoke_test() {\n let mut acc = 0;\n let acc_ref = &mut acc;\n // docs:start:bounded-vec-for-each-example\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([1, 2, 3]);\n vec.for_each(|value| { *acc_ref += value; });\n // docs:end:bounded-vec-for-each-example\n assert_eq(acc, 6);\n }\n\n #[test]\n fn applies_function_correctly() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = for_each_map(vec, |value| value * 2);\n let expected = BoundedVec::from_array([2, 4, 6, 8]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn applies_function_that_changes_return_type() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = for_each_map(vec, |value| (value * 2) as Field);\n let expected: BoundedVec<Field, 4> = BoundedVec::from_array([2, 4, 6, 8]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn does_not_apply_function_past_len() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([0, 1]);\n let result = for_each_map(vec, |value| if value == 0 { 5 } else { value });\n let expected = BoundedVec::from_array([5, 1]);\n\n assert_eq(result, expected);\n assert_eq(result.get_unchecked(2), 0);\n }\n\n #[test]\n fn for_each_on_empty_vector() {\n let vec: BoundedVec<u32, 5> = BoundedVec::new();\n let mut count = 0;\n let count_ref = &mut count;\n vec.for_each(|_| { *count_ref += 1; });\n assert_eq(count, 0);\n }\n\n #[test]\n fn for_each_with_side_effects() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([1, 2, 3]);\n let mut seen = BoundedVec::<u32, 3>::new();\n let seen_ref = &mut seen;\n vec.for_each(|x| seen_ref.push(x));\n assert_eq(seen, vec);\n }\n }\n\n mod for_eachi {\n use crate::collections::bounded_vec::BoundedVec;\n\n // mapi in terms of for_eachi\n fn for_eachi_mapi<T, U, Env, let MaxLen: u32>(\n input: BoundedVec<T, MaxLen>,\n f: fn[Env](u32, T) -> U,\n ) -> BoundedVec<U, MaxLen> {\n let mut output = BoundedVec::<U, MaxLen>::new();\n let output_ref = &mut output;\n input.for_eachi(|i, x| output_ref.push(f(i, x)));\n output\n }\n\n #[test]\n fn smoke_test() {\n let mut acc = 0;\n let acc_ref = &mut acc;\n // docs:start:bounded-vec-for-eachi-example\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([1, 2, 3]);\n vec.for_eachi(|i, value| { *acc_ref += i * value; });\n // docs:end:bounded-vec-for-eachi-example\n\n // 0 * 1 + 1 * 2 + 2 * 3\n assert_eq(acc, 8);\n }\n\n #[test]\n fn applies_function_correctly() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = for_eachi_mapi(vec, |i, value| i + value * 2);\n let expected = BoundedVec::from_array([2, 5, 8, 11]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn applies_function_that_changes_return_type() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = for_eachi_mapi(vec, |i, value| (i + value * 2) as Field);\n let expected: BoundedVec<Field, 4> = BoundedVec::from_array([2, 5, 8, 11]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn does_not_apply_function_past_len() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([0, 1]);\n let result = for_eachi_mapi(vec, |_, value| if value == 0 { 5 } else { value });\n let expected = BoundedVec::from_array([5, 1]);\n\n assert_eq(result, expected);\n assert_eq(result.get_unchecked(2), 0);\n }\n\n #[test]\n fn for_eachi_on_empty_vector() {\n let vec: BoundedVec<u32, 5> = BoundedVec::new();\n let mut count = 0;\n let count_ref = &mut count;\n vec.for_eachi(|_, _| { *count_ref += 1; });\n assert_eq(count, 0);\n }\n\n #[test]\n fn for_eachi_with_index_tracking() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([10, 20, 30]);\n let mut indices = BoundedVec::<u32, 3>::new();\n let indices_ref = &mut indices;\n vec.for_eachi(|i, _| indices_ref.push(i));\n\n let expected = BoundedVec::from_array([0, 1, 2]);\n assert_eq(indices, expected);\n }\n\n }\n\n mod from_array {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn empty() {\n let empty_array: [Field; 0] = [];\n let bounded_vec = BoundedVec::from_array([]);\n\n assert_eq(bounded_vec.max_len(), 0);\n assert_eq(bounded_vec.len(), 0);\n assert_eq(bounded_vec.storage(), empty_array);\n }\n\n #[test]\n fn equal_len() {\n let array = [1, 2, 3];\n let bounded_vec = BoundedVec::from_array(array);\n\n assert_eq(bounded_vec.max_len(), 3);\n assert_eq(bounded_vec.len(), 3);\n assert_eq(bounded_vec.storage(), array);\n }\n\n #[test]\n fn max_len_greater_then_array_len() {\n let array = [1, 2, 3];\n let bounded_vec: BoundedVec<Field, 10> = BoundedVec::from_array(array);\n\n assert_eq(bounded_vec.max_len(), 10);\n assert_eq(bounded_vec.len(), 3);\n assert_eq(bounded_vec.get(0), 1);\n assert_eq(bounded_vec.get(1), 2);\n assert_eq(bounded_vec.get(2), 3);\n }\n\n #[test(should_fail_with = \"from array out of bounds\")]\n fn max_len_lower_then_array_len() {\n let _: BoundedVec<Field, 2> = BoundedVec::from_array([0; 3]);\n }\n\n #[test]\n fn from_array_preserves_order() {\n let array = [5, 3, 1, 4, 2];\n let vec: BoundedVec<u32, 5> = BoundedVec::from_array(array);\n for i in 0..array.len() {\n assert_eq(vec.get(i), array[i]);\n }\n }\n\n #[test]\n fn from_array_with_different_types() {\n let bool_array = [true, false, true];\n let bool_vec: BoundedVec<bool, 3> = BoundedVec::from_array(bool_array);\n assert_eq(bool_vec.len(), 3);\n assert_eq(bool_vec.get(0), true);\n assert_eq(bool_vec.get(1), false);\n }\n }\n\n mod trait_from {\n use crate::collections::bounded_vec::BoundedVec;\n use crate::convert::From;\n\n #[test]\n fn simple() {\n let array = [1, 2];\n let bounded_vec: BoundedVec<Field, 10> = BoundedVec::from(array);\n\n assert_eq(bounded_vec.max_len(), 10);\n assert_eq(bounded_vec.len(), 2);\n assert_eq(bounded_vec.get(0), 1);\n assert_eq(bounded_vec.get(1), 2);\n }\n }\n\n mod trait_eq {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn empty_equality() {\n let bounded_vec1: BoundedVec<Field, 3> = BoundedVec::new();\n let bounded_vec2: BoundedVec<Field, 3> = BoundedVec::new();\n\n assert_eq(bounded_vec1, bounded_vec2);\n }\n\n #[test]\n fn inequality() {\n let mut bounded_vec1: BoundedVec<Field, 3> = BoundedVec::new();\n let mut bounded_vec2: BoundedVec<Field, 3> = BoundedVec::new();\n bounded_vec1.push(1);\n bounded_vec2.push(2);\n\n assert(bounded_vec1 != bounded_vec2);\n }\n }\n\n mod from_parts {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn from_parts() {\n // docs:start:from-parts\n let vec: BoundedVec<u32, 4> = BoundedVec::from_parts([1, 2, 3, 0], 3);\n assert_eq(vec.len(), 3);\n\n // Any elements past the given length are zeroed out, so these\n // two BoundedVecs will be completely equal\n let vec1: BoundedVec<u32, 4> = BoundedVec::from_parts([1, 2, 3, 1], 3);\n let vec2: BoundedVec<u32, 4> = BoundedVec::from_parts([1, 2, 3, 2], 3);\n assert_eq(vec1, vec2);\n // docs:end:from-parts\n }\n\n #[test]\n fn from_parts_unchecked() {\n // docs:start:from-parts-unchecked\n let vec: BoundedVec<u32, 4> = BoundedVec::from_parts_unchecked([1, 2, 3, 0], 3);\n assert_eq(vec.len(), 3);\n\n // invalid use!\n let vec1: BoundedVec<u32, 4> = BoundedVec::from_parts_unchecked([1, 2, 3, 1], 3);\n let vec2: BoundedVec<u32, 4> = BoundedVec::from_parts_unchecked([1, 2, 3, 2], 3);\n\n // both vecs have length 3 so we'd expect them to be equal, but this\n // fails because elements past the length are still checked in eq\n assert(vec1 != vec2);\n // docs:end:from-parts-unchecked\n }\n }\n\n mod push_pop {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn push_and_pop_operations() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n\n assert_eq(vec.len(), 0);\n\n vec.push(1);\n assert_eq(vec.len(), 1);\n assert_eq(vec.get(0), 1);\n\n vec.push(2);\n assert_eq(vec.len(), 2);\n assert_eq(vec.get(1), 2);\n\n let popped = vec.pop();\n assert_eq(popped, 2);\n assert_eq(vec.len(), 1);\n\n let popped2 = vec.pop();\n assert_eq(popped2, 1);\n assert_eq(vec.len(), 0);\n }\n\n #[test(should_fail_with = \"push out of bounds\")]\n fn push_to_full_vector() {\n let mut vec: BoundedVec<u32, 2> = BoundedVec::new();\n vec.push(1);\n vec.push(2);\n vec.push(3); // should panic\n }\n\n #[test(should_fail_with = \"cannot pop from an empty vector\")]\n fn pop_from_empty_vector() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n let _ = vec.pop(); // should panic\n }\n\n #[test]\n fn push_pop_cycle() {\n let mut vec: BoundedVec<u32, 3> = BoundedVec::new();\n\n // push to full\n vec.push(1);\n vec.push(2);\n vec.push(3);\n assert_eq(vec.len(), 3);\n\n // pop all\n assert_eq(vec.pop(), 3);\n assert_eq(vec.pop(), 2);\n assert_eq(vec.pop(), 1);\n assert_eq(vec.len(), 0);\n\n // push again\n vec.push(4);\n assert_eq(vec.len(), 1);\n assert_eq(vec.get(0), 4);\n }\n }\n\n mod extend {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn extend_from_array() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n vec.push(1);\n vec.extend_from_array([2, 3]);\n\n assert_eq(vec.len(), 3);\n assert_eq(vec.get(0), 1);\n assert_eq(vec.get(1), 2);\n assert_eq(vec.get(2), 3);\n }\n\n #[test]\n fn extend_from_vector() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n vec.push(1);\n vec.extend_from_vector([2, 3].as_vector());\n\n assert_eq(vec.len(), 3);\n assert_eq(vec.get(0), 1);\n assert_eq(vec.get(1), 2);\n assert_eq(vec.get(2), 3);\n }\n\n #[test]\n fn extend_from_bounded_vec() {\n // The source deliberately has a higher capacity,\n // to make sure we are not trying to assign out-of-bounds.\n let mut vec1: BoundedVec<u32, 5> = BoundedVec::new();\n let mut vec2: BoundedVec<u32, 9> = BoundedVec::new();\n\n vec1.push(1);\n vec2.push(2);\n vec2.push(3);\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 3);\n assert_eq(vec1.get(0), 1);\n assert_eq(vec1.get(1), 2);\n assert_eq(vec1.get(2), 3);\n }\n\n #[test]\n fn extend_from_bounded_vec_limit() {\n // Capacity and contents chosen so the last item must be assigned to.\n let mut vec1: BoundedVec<u32, 2> = BoundedVec::new();\n let mut vec2: BoundedVec<u32, 5> = BoundedVec::new();\n\n vec1.push(1);\n vec2.push(2);\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 2);\n assert_eq(vec1.get(0), 1);\n assert_eq(vec1.get(1), 2);\n }\n\n #[test]\n fn extend_from_bounded_vec_full_and_empty() {\n // Capacity and contents chosen so the last item must be assigned to.\n let mut vec1: BoundedVec<u32, 2> = BoundedVec::new();\n let vec2: BoundedVec<u32, 5> = BoundedVec::new();\n\n vec1.push(1);\n vec1.push(2);\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 2);\n assert_eq(vec1.get(0), 1);\n assert_eq(vec1.get(1), 2);\n }\n\n #[test]\n fn extend_from_bounded_vec_zero_len() {\n let mut vec1: BoundedVec<u32, 0> = BoundedVec::new();\n let vec2: BoundedVec<u32, 0> = BoundedVec::new();\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 0);\n }\n\n #[test]\n fn extend_from_bounded_vec_last_zeroed() {\n let mut vec1: BoundedVec<u32, 4> = BoundedVec::new();\n let mut vec2: BoundedVec<u32, 4> = BoundedVec::new();\n\n vec1.push(1);\n vec1.push(2);\n vec2.push(3);\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 3);\n assert_eq(vec1.get_unchecked(3), 0);\n }\n\n #[test]\n fn extend_from_bounded_vec_empty_self() {\n // self.len == 0 with Len > MaxLen: the loop doesn't reach\n // the last storage slot, so the fixup must write it.\n let mut vec1: BoundedVec<u32, 3> = BoundedVec::new();\n let vec2: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3]);\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 3);\n assert_eq(vec1.get(0), 1);\n assert_eq(vec1.get(1), 2);\n assert_eq(vec1.get(2), 3);\n }\n\n #[test]\n fn extend_from_bounded_vec_equal_capacity() {\n // Len == MaxLen, fills to capacity.\n let mut vec1: BoundedVec<u32, 4> = BoundedVec::new();\n vec1.push(1);\n let vec2: BoundedVec<u32, 4> = BoundedVec::from_array([2, 3, 4]);\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 4);\n assert_eq(vec1.get(0), 1);\n assert_eq(vec1.get(1), 2);\n assert_eq(vec1.get(2), 3);\n assert_eq(vec1.get(3), 4);\n }\n\n #[test(should_fail_with = \"extend_from_array out of bounds\")]\n fn extend_array_beyond_max_len() {\n let mut vec: BoundedVec<u32, 3> = BoundedVec::new();\n vec.push(1);\n vec.extend_from_array([2, 3, 4]); // should panic\n }\n\n #[test(should_fail_with = \"extend_from_vector out of bounds\")]\n fn extend_vector_beyond_max_len() {\n let mut vec: BoundedVec<u32, 3> = BoundedVec::new();\n vec.push(1);\n vec.extend_from_vector([2, 3, 4].as_vector()); // S]should panic\n }\n\n #[test(should_fail_with = \"extend_from_bounded_vec out of bounds\")]\n fn extend_bounded_vec_beyond_max_len() {\n let mut vec: BoundedVec<u32, 3> = BoundedVec::new();\n let other: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3, 4, 5]);\n vec.extend_from_bounded_vec(other); // should panic\n }\n\n #[test]\n fn extend_with_empty_collections() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n let original_len = vec.len();\n\n vec.extend_from_array([]);\n assert_eq(vec.len(), original_len);\n\n vec.extend_from_vector([].as_vector());\n assert_eq(vec.len(), original_len);\n\n let empty: BoundedVec<u32, 3> = BoundedVec::new();\n vec.extend_from_bounded_vec(empty);\n assert_eq(vec.len(), original_len);\n }\n }\n\n mod storage {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn storage_consistency() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n\n // test initial storage state\n assert_eq(vec.storage(), [0, 0, 0, 0, 0]);\n\n vec.push(1);\n vec.push(2);\n\n // test storage after modifications\n assert_eq(vec.storage(), [1, 2, 0, 0, 0]);\n\n // storage doesn't change length\n assert_eq(vec.len(), 2);\n assert_eq(vec.max_len(), 5);\n }\n\n #[test]\n fn storage_after_pop() {\n let mut vec: BoundedVec<u32, 3> = BoundedVec::from_array([1, 2, 3]);\n\n let _ = vec.pop();\n // after pop, the last element should be zeroed\n assert_eq(vec.storage(), [1, 2, 0]);\n assert_eq(vec.len(), 2);\n }\n\n #[test]\n fn vector_immutable() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([1, 2, 3]);\n let storage = vec.storage();\n\n assert_eq(storage, [1, 2, 3]);\n\n // Verify that the original vector is unchanged\n assert_eq(vec.len(), 3);\n assert_eq(vec.get(0), 1);\n assert_eq(vec.get(1), 2);\n assert_eq(vec.get(2), 3);\n }\n }\n}\n",
|
|
183
|
+
"source": "use crate::{cmp::Eq, convert::From, runtime::is_unconstrained, static_assert};\n\n/// A `BoundedVec<T, MaxLen>` is a growable storage similar to a built-in vector except that it\n/// is bounded with a maximum possible length. `BoundedVec` is also not\n/// subject to the same restrictions vectors are (notably, nested vectors are disallowed).\n///\n/// Since a BoundedVec is backed by a normal array under the hood, growing the BoundedVec by\n/// pushing an additional element is also more efficient - the length only needs to be increased\n/// by one.\n///\n/// For these reasons `BoundedVec<T, N>` should generally be preferred over vectors when there\n/// is a reasonable maximum bound that can be placed on the vector.\n///\n/// Example:\n///\n/// ```noir\n/// let mut vector: BoundedVec<Field, 10> = BoundedVec::new();\n/// for i in 0..5 {\n/// vector.push(i);\n/// }\n/// assert(vector.len() == 5);\n/// assert(vector.max_len() == 10);\n/// ```\npub struct BoundedVec<T, let MaxLen: u32> {\n storage: [T; MaxLen],\n len: u32,\n}\n\nimpl<T, let MaxLen: u32> BoundedVec<T, MaxLen> {\n /// Creates a new, empty vector of length zero.\n ///\n /// Since this container is backed by an array internally, it still needs an initial value\n /// to give each element. To resolve this, each element is zeroed internally. This value\n /// is guaranteed to be inaccessible unless `get_unchecked` is used.\n ///\n /// Example:\n ///\n /// ```noir\n /// let empty_vector: BoundedVec<Field, 10> = BoundedVec::new();\n /// assert(empty_vector.len() == 0);\n /// ```\n ///\n /// Note that whenever calling `new` the maximum length of the vector should generally be specified\n /// via a type signature:\n ///\n /// ```noir\n /// fn good() -> BoundedVec<Field, 10> {\n /// // Ok! MaxLen is specified with a type annotation\n /// let v1: BoundedVec<Field, 3> = BoundedVec::new();\n /// let v2 = BoundedVec::new();\n ///\n /// // Ok! MaxLen is known from the type of `good`'s return value\n /// v2\n /// }\n ///\n /// fn bad() {\n /// // Error: Type annotation needed\n /// // The compiler can't infer `MaxLen` from the following code:\n /// let mut v3 = BoundedVec::new();\n /// v3.push(5);\n /// }\n /// ```\n pub fn new() -> Self {\n let zeroed = crate::mem::zeroed();\n BoundedVec { storage: [zeroed; MaxLen], len: 0 }\n }\n\n /// Retrieves an element from the vector at the given index, starting from zero.\n ///\n /// If the given index is equal to or greater than the length of the vector, this\n /// will issue a constraint failure.\n ///\n /// Example:\n ///\n /// ```noir\n /// fn foo<let N: u32>(v: BoundedVec<u32, N>) {\n /// let first = v.get(0);\n /// let last = v.get(v.len() - 1);\n /// assert(first != last);\n /// }\n /// ```\n pub fn get(&self, index: u32) -> T {\n assert(index < self.len, \"Attempted to read past end of BoundedVec\");\n self.get_unchecked(index)\n }\n\n /// Retrieves an element from the vector at the given index, starting from zero, without\n /// performing a bounds check.\n ///\n /// Since this function does not perform a bounds check on length before accessing the element,\n /// it is unsafe! Use at your own risk!\n ///\n /// Example:\n ///\n /// ```noir\n /// fn sum_of_first_three<let N: u32>(v: BoundedVec<u32, N>) -> u32 {\n /// // Always ensure the length is larger than the largest\n /// // index passed to get_unchecked\n /// assert(v.len() > 2);\n /// let first = v.get_unchecked(0);\n /// let second = v.get_unchecked(1);\n /// let third = v.get_unchecked(2);\n /// first + second + third\n /// }\n /// ```\n pub fn get_unchecked(&self, index: u32) -> T {\n self.storage[index]\n }\n\n /// Writes an element to the vector at the given index, starting from zero.\n ///\n /// If the given index is equal to or greater than the length of the vector, this will issue a constraint failure.\n ///\n /// Example:\n ///\n /// ```noir\n /// fn foo<let N: u32>(v: BoundedVec<u32, N>) {\n /// let first = v.get(0);\n /// assert(first != 42);\n /// v.set(0, 42);\n /// let new_first = v.get(0);\n /// assert(new_first == 42);\n /// }\n /// ```\n pub fn set(&mut self, index: u32, value: T) {\n assert(index < self.len, \"Attempted to write past end of BoundedVec\");\n self.set_unchecked(index, value)\n }\n\n /// Writes an element to the vector at the given index, starting from zero, without performing a bounds check.\n ///\n /// Since this function does not perform a bounds check on length before accessing the element, it is unsafe! Use at your own risk!\n ///\n /// Example:\n ///\n /// ```noir\n /// fn set_unchecked_example() {\n /// let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n /// vec.extend_from_array([1, 2]);\n ///\n /// // Here we're safely writing within the valid range of `vec`\n /// // `vec` now has the value [42, 2]\n /// vec.set_unchecked(0, 42);\n ///\n /// // We can then safely read this value back out of `vec`.\n /// // Notice that we use the checked version of `get` which would prevent reading unsafe values.\n /// assert_eq(vec.get(0), 42);\n ///\n /// // We've now written past the end of `vec`.\n /// // As this index is still within the maximum potential length of `v`,\n /// // it won't cause a constraint failure.\n /// vec.set_unchecked(2, 42);\n /// println(vec);\n ///\n /// // This will write past the end of the maximum potential length of `vec`,\n /// // it will then trigger a constraint failure.\n /// vec.set_unchecked(5, 42);\n /// println(vec);\n /// }\n /// ```\n pub fn set_unchecked(&mut self, index: u32, value: T) {\n self.storage[index] = value;\n }\n\n /// Pushes an element to the end of the vector. This increases the length\n /// of the vector by one.\n ///\n /// Panics if the new length of the vector will be greater than the max length.\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut v: BoundedVec<Field, 2> = BoundedVec::new();\n ///\n /// v.push(1);\n /// v.push(2);\n ///\n /// // Panics with failed assertion \"push out of bounds\"\n /// v.push(3);\n /// ```\n pub fn push(&mut self, elem: T) {\n assert(self.len < MaxLen, \"push out of bounds\");\n\n self.storage[self.len] = elem;\n self.len += 1;\n }\n\n /// Returns the current length of this vector\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut v: BoundedVec<Field, 4> = BoundedVec::new();\n /// assert(v.len() == 0);\n ///\n /// v.push(100);\n /// assert(v.len() == 1);\n ///\n /// v.push(200);\n /// v.push(300);\n /// v.push(400);\n /// assert(v.len() == 4);\n ///\n /// let _ = v.pop();\n /// let _ = v.pop();\n /// assert(v.len() == 2);\n /// ```\n pub fn len(&self) -> u32 {\n self.len\n }\n\n /// Returns the maximum length of this vector. This is always\n /// equal to the `MaxLen` parameter this vector was initialized with.\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut v: BoundedVec<Field, 5> = BoundedVec::new();\n ///\n /// assert(v.max_len() == 5);\n /// v.push(10);\n /// assert(v.max_len() == 5);\n /// ```\n pub fn max_len(_self: &BoundedVec<T, MaxLen>) -> u32 {\n MaxLen\n }\n\n /// Returns the internal array within this vector.\n ///\n /// Since arrays in Noir are immutable, mutating the returned storage array will not mutate\n /// the storage held internally by this vector.\n ///\n /// Note that uninitialized elements may be zeroed out!\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut v: BoundedVec<Field, 5> = BoundedVec::new();\n ///\n /// assert(v.storage() == [0, 0, 0, 0, 0]);\n ///\n /// v.push(57);\n /// assert(v.storage() == [57, 0, 0, 0, 0]);\n /// ```\n pub fn storage(self) -> [T; MaxLen] {\n self.storage\n }\n\n /// Pushes each element from the given array to this vector.\n ///\n /// Panics if pushing each element would cause the length of this vector\n /// to exceed the maximum length.\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut vec: BoundedVec<Field, 3> = BoundedVec::new();\n /// vec.extend_from_array([2, 4]);\n ///\n /// assert(vec.len == 2);\n /// assert(vec.get(0) == 2);\n /// assert(vec.get(1) == 4);\n /// ```\n pub fn extend_from_array<let Len: u32>(&mut self, array: [T; Len]) {\n let new_len = self.len + array.len();\n assert(new_len <= MaxLen, \"extend_from_array out of bounds\");\n for i in 0..array.len() {\n self.storage[self.len + i] = array[i];\n }\n self.len = new_len;\n }\n\n /// Pushes each element from the given vector to this vector.\n ///\n /// Panics if pushing each element would cause the length of this vector\n /// to exceed the maximum length.\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut vec: BoundedVec<Field, 3> = BoundedVec::new();\n /// vec.extend_from_vector([2, 4].as_vector());\n ///\n /// assert(vec.len == 2);\n /// assert(vec.get(0) == 2);\n /// assert(vec.get(1) == 4);\n /// ```\n pub fn extend_from_vector(&mut self, vector: [T]) {\n let new_len = self.len + vector.len();\n assert(new_len <= MaxLen, \"extend_from_vector out of bounds\");\n for i in 0..vector.len() {\n self.storage[self.len + i] = vector[i];\n }\n self.len = new_len;\n }\n\n /// Pushes each element from the other vector to this vector. The length of\n /// the other vector is left unchanged.\n ///\n /// Panics if pushing each element would cause the length of this vector\n /// to exceed the maximum length.\n ///\n /// ```noir\n /// let mut v1: BoundedVec<Field, 5> = BoundedVec::new();\n /// let mut v2: BoundedVec<Field, 7> = BoundedVec::new();\n ///\n /// v2.extend_from_array([1, 2, 3]);\n /// v1.extend_from_bounded_vec(v2);\n ///\n /// assert(v1.storage() == [1, 2, 3, 0, 0]);\n /// assert(v2.storage() == [1, 2, 3, 0, 0, 0, 0]);\n /// ```\n pub fn extend_from_bounded_vec<let Len: u32>(&mut self, vec: BoundedVec<T, Len>) {\n let append_len = vec.len();\n let new_len = self.len + append_len;\n assert(new_len <= MaxLen, \"extend_from_bounded_vec out of bounds\");\n\n if is_unconstrained() {\n for i in 0..append_len {\n self.storage[self.len + i] = vec.get_unchecked(i);\n }\n } else {\n // The source vector can be longer than the destination, or vice versa;\n // regardless we will only ever be able to read or write whichever is\n // the shorter max length of the two. We asserted that the actual content fits,\n // but the capacity of the source vector could be higher.\n let max = crate::cmp::min(Len, MaxLen);\n\n // Save the last item in case we have to do a fixup on an already full array.\n let last = if MaxLen > 0 {\n self.storage[MaxLen - 1]\n } else {\n crate::mem::zeroed()\n };\n\n for src in 0..max {\n // Since we are iterating to the static capacity of the arrays,\n // the destination could be out of bounds. If that's the case,\n // overwrite the last item, which we'll fixup in the end.\n // NB using cmp::min resulted in more opcodes here.\n let mut dst = self.len + src;\n if dst >= MaxLen { dst = MaxLen - 1; };\n // Assigning the source or zeroed to avoid having to merge arrays in SSA.\n self.storage[dst] = if src < append_len {\n vec.get_unchecked(src)\n } else {\n last\n }\n }\n\n // Fixup the last item if we have to.\n if MaxLen > 0 {\n self.storage[MaxLen - 1] = if (self.len + append_len == MaxLen) & (append_len > 0) {\n vec.get_unchecked(append_len - 1)\n } else {\n last\n }\n }\n }\n self.len = new_len;\n }\n\n /// Creates a new vector, populating it with values derived from an array input.\n /// The maximum length of the vector is determined based on the type signature.\n ///\n /// Example:\n ///\n /// ```noir\n /// let bounded_vec: BoundedVec<Field, 10> = BoundedVec::from_array([1, 2, 3])\n /// ```\n pub fn from_array<let Len: u32>(array: [T; Len]) -> Self {\n static_assert(Len <= MaxLen, \"from array out of bounds\");\n let mut vec: BoundedVec<T, MaxLen> = BoundedVec::new();\n vec.extend_from_array(array);\n vec\n }\n\n /// Pops the element at the end of the vector. This will decrease the length\n /// of the vector by one.\n ///\n /// Panics if the vector is empty.\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut v: BoundedVec<Field, 2> = BoundedVec::new();\n /// v.push(1);\n /// v.push(2);\n ///\n /// let two = v.pop();\n /// let one = v.pop();\n ///\n /// assert(two == 2);\n /// assert(one == 1);\n ///\n /// // error: cannot pop from an empty vector\n /// let _ = v.pop();\n /// ```\n pub fn pop(&mut self) -> T {\n assert(self.len > 0, \"cannot pop from an empty vector\");\n self.len -= 1;\n self.storage[self.len]\n }\n\n /// Returns true if the given predicate returns true for any element\n /// in this vector.\n ///\n /// Example:\n ///\n /// ```noir\n /// let mut v: BoundedVec<u32, 3> = BoundedVec::new();\n /// v.extend_from_array([2, 4, 6]);\n ///\n /// let all_even = !v.any(|elem: u32| elem % 2 != 0);\n /// assert(all_even);\n /// ```\n pub fn any<Env>(self, predicate: fn[Env](T) -> bool) -> bool {\n let mut ret = false;\n if is_unconstrained() {\n for i in 0..self.len {\n ret |= predicate(self.storage[i]);\n }\n } else {\n let mut exceeded_len = false;\n for i in 0..MaxLen {\n exceeded_len |= i == self.len;\n if !exceeded_len {\n ret |= predicate(self.storage[i]);\n }\n }\n }\n ret\n }\n\n /// Creates a new vector of equal size by calling a closure on each element in this vector.\n ///\n /// Example:\n ///\n /// ```noir\n /// let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n /// let result = vec.map(|value| value * 2);\n ///\n /// let expected = BoundedVec::from_array([2, 4, 6, 8]);\n /// assert_eq(result, expected);\n /// ```\n pub fn map<U, Env>(&self, f: fn[Env](T) -> U) -> BoundedVec<U, MaxLen> {\n let mut ret = BoundedVec::new();\n ret.len = self.len();\n\n if is_unconstrained() {\n for i in 0..self.len() {\n ret.storage[i] = f(self.get_unchecked(i));\n }\n } else {\n for i in 0..MaxLen {\n ret.storage[i] = if i < self.len() {\n f(self.get_unchecked(i))\n } else {\n crate::mem::zeroed()\n }\n }\n }\n\n ret\n }\n\n /// Creates a new vector of equal size by calling a closure on each element\n /// in this vector, along with its index.\n ///\n /// Example:\n ///\n /// ```noir\n /// let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n /// let result = vec.mapi(|i, value| i + value * 2);\n ///\n /// let expected = BoundedVec::from_array([2, 5, 8, 11]);\n /// assert_eq(result, expected);\n /// ```\n pub fn mapi<U, Env>(&self, f: fn[Env](u32, T) -> U) -> BoundedVec<U, MaxLen> {\n let mut ret = BoundedVec::new();\n ret.len = self.len();\n\n if is_unconstrained() {\n for i in 0..self.len() {\n ret.storage[i] = f(i, self.get_unchecked(i));\n }\n } else {\n for i in 0..MaxLen {\n ret.storage[i] = if i < self.len() {\n f(i, self.get_unchecked(i))\n } else {\n crate::mem::zeroed()\n }\n }\n }\n\n ret\n }\n\n /// Calls a closure on each element in this vector.\n ///\n /// Example:\n ///\n /// ```noir\n /// let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n /// let mut result = BoundedVec::<u32, 4>::new();\n /// vec.for_each(|value| result.push(value * 2));\n ///\n /// let expected = BoundedVec::from_array([2, 4, 6, 8]);\n /// assert_eq(result, expected);\n /// ```\n pub fn for_each<Env>(&self, f: fn[Env](T) -> ()) {\n if is_unconstrained() {\n for i in 0..self.len() {\n f(self.get_unchecked(i));\n }\n } else {\n for i in 0..MaxLen {\n if i < self.len() {\n f(self.get_unchecked(i));\n }\n }\n }\n }\n\n /// Calls a closure on each element in this vector, along with its index.\n ///\n /// Example:\n ///\n /// ```noir\n /// let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n /// let mut result = BoundedVec::<u32, 4>::new();\n /// vec.for_eachi(|i, value| result.push(i + value * 2));\n ///\n /// let expected = BoundedVec::from_array([2, 5, 8, 11]);\n /// assert_eq(result, expected);\n /// ```\n pub fn for_eachi<Env>(&self, f: fn[Env](u32, T) -> ()) {\n if is_unconstrained() {\n for i in 0..self.len() {\n f(i, self.get_unchecked(i));\n }\n } else {\n for i in 0..MaxLen {\n if i < self.len() {\n f(i, self.get_unchecked(i));\n }\n }\n }\n }\n\n /// Creates a new BoundedVec from the given array and length.\n /// The given length must be less than or equal to the length of the array.\n ///\n /// Example:\n ///\n /// ```noir\n /// let vec: BoundedVec<u32, 4> = BoundedVec::from_parts([1, 2, 3, 0], 3);\n /// assert_eq(vec.len(), 3);\n /// ```\n pub fn from_parts(mut array: [T; MaxLen], len: u32) -> Self {\n assert(len <= MaxLen);\n BoundedVec { storage: array, len }\n }\n\n /// Creates a new BoundedVec from the given array and length.\n /// The given length must be less than or equal to the length of the array.\n ///\n /// This function is unsafe because it expects all elements past the `len` index\n /// of `array` to be zeroed, but does not check for this internally. Use `from_parts`\n /// for a safe version of this function which does zero out any indices past the\n /// given length. Invalidating this assumption can notably cause `BoundedVec::eq`\n /// to give incorrect results since it will check even elements past `len`.\n ///\n /// Example:\n ///\n /// ```noir\n /// let vec: BoundedVec<u32, 4> = BoundedVec::from_parts_unchecked([1, 2, 3, 0], 3);\n /// assert_eq(vec.len(), 3);\n ///\n /// // invalid use!\n /// let vec1: BoundedVec<u32, 4> = BoundedVec::from_parts_unchecked([1, 2, 3, 1], 3);\n /// let vec2: BoundedVec<u32, 4> = BoundedVec::from_parts_unchecked([1, 2, 3, 2], 3);\n ///\n /// // both vecs have length 3 so we'd expect them to be equal, but this\n /// // fails because elements past the length are still checked in eq\n /// assert_eq(vec1, vec2); // fails\n /// ```\n #[deprecated(\"`BoundedVec::from_parts` no longer requires an extra loop, `BoundedVec::from_parts_unchecked` is no longer required\")]\n pub fn from_parts_unchecked(array: [T; MaxLen], len: u32) -> Self {\n assert(len <= MaxLen);\n BoundedVec { storage: array, len }\n }\n}\n\nimpl<T, let MaxLen: u32> Eq for BoundedVec<T, MaxLen>\nwhere\n T: Eq,\n{\n fn eq(self, other: BoundedVec<T, MaxLen>) -> bool {\n if self.len == other.len {\n if is_unconstrained() {\n // safety: we are already in an unconstrained context\n unsafe {\n unconstrained_eq(self, other)\n }\n } else {\n let mut eq = true;\n for i in 0..MaxLen {\n if i < self.len {\n eq &= self.storage[i] == other.storage[i];\n }\n }\n eq\n }\n } else {\n false\n }\n }\n}\n\n/// Returns true if both BoundedVecs are equal.\n/// Note: This assumes the lengths of both Vecs are already equal!\n/// This function is broken out of `impl Eq for BoundedVec` to make use of `break` in unconstrained code.\nunconstrained fn unconstrained_eq<T, let MaxLen: u32>(\n a: BoundedVec<T, MaxLen>,\n b: BoundedVec<T, MaxLen>,\n) -> bool\nwhere\n T: Eq,\n{\n let mut eq = true;\n for i in 0..a.len {\n if a.storage[i] != b.storage[i] {\n eq = false;\n break;\n }\n }\n eq\n}\n\nimpl<T, let MaxLen: u32, let Len: u32> From<[T; Len]> for BoundedVec<T, MaxLen> {\n fn from(array: [T; Len]) -> BoundedVec<T, MaxLen> {\n BoundedVec::from_array(array)\n }\n}\n\nmod bounded_vec_tests {\n\n mod get {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test(should_fail_with = \"Attempted to read past end of BoundedVec\")]\n fn panics_when_reading_elements_past_end_of_vec() {\n let vec: BoundedVec<Field, 5> = BoundedVec::new();\n\n let _ = vec.get(0);\n }\n\n #[test(should_fail_with = \"Attempted to read past end of BoundedVec\")]\n fn panics_when_reading_beyond_length() {\n let vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3]);\n let _ = vec.get(3);\n }\n\n #[test]\n fn get_works_within_bounds() {\n let vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3, 4, 5]);\n assert_eq(vec.get(0), 1);\n assert_eq(vec.get(2), 3);\n assert_eq(vec.get(4), 5);\n }\n\n #[test]\n fn get_unchecked_works() {\n let vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3]);\n assert_eq(vec.get_unchecked(0), 1);\n assert_eq(vec.get_unchecked(2), 3);\n }\n\n #[test]\n fn get_unchecked_works_past_len() {\n let vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3]);\n assert_eq(vec.get_unchecked(4), 0);\n }\n }\n\n mod set {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn set_updates_values_properly() {\n let mut vec = BoundedVec::from_array([0, 0, 0, 0, 0]);\n\n vec.set(0, 42);\n assert_eq(vec.storage, [42, 0, 0, 0, 0]);\n\n vec.set(1, 43);\n assert_eq(vec.storage, [42, 43, 0, 0, 0]);\n\n vec.set(2, 44);\n assert_eq(vec.storage, [42, 43, 44, 0, 0]);\n\n vec.set(1, 10);\n assert_eq(vec.storage, [42, 10, 44, 0, 0]);\n\n vec.set(0, 0);\n assert_eq(vec.storage, [0, 10, 44, 0, 0]);\n }\n\n #[test(should_fail_with = \"Attempted to write past end of BoundedVec\")]\n fn panics_when_writing_elements_past_end_of_vec() {\n let mut vec: BoundedVec<Field, 5> = BoundedVec::new();\n vec.set(0, 42);\n }\n\n #[test(should_fail_with = \"Attempted to write past end of BoundedVec\")]\n fn panics_when_setting_beyond_length() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3]);\n vec.set(3, 4);\n }\n\n #[test]\n fn set_unchecked_operations() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n vec.push(1);\n vec.push(2);\n\n vec.set_unchecked(0, 10);\n assert_eq(vec.get(0), 10);\n }\n\n #[test(should_fail_with = \"Attempted to read past end of BoundedVec\")]\n fn set_unchecked_operations_past_len() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n vec.push(1);\n vec.push(2);\n\n vec.set_unchecked(3, 40);\n assert_eq(vec.get(3), 40);\n }\n\n #[test]\n fn set_preserves_other_elements() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3, 4, 5]);\n\n vec.set(2, 30);\n assert_eq(vec.get(0), 1);\n assert_eq(vec.get(1), 2);\n assert_eq(vec.get(2), 30);\n assert_eq(vec.get(3), 4);\n assert_eq(vec.get(4), 5);\n }\n }\n\n mod any {\n use crate::collections::bounded_vec::BoundedVec;\n use crate::internal::test_unconstrained;\n\n #[test]\n #[test_unconstrained]\n fn returns_false_if_predicate_not_satisfied() {\n let vec: BoundedVec<bool, 4> = BoundedVec::from_array([false, false, false, false]);\n let result = vec.any(|value| value);\n\n assert(!result);\n }\n\n #[test]\n #[test_unconstrained]\n fn returns_true_if_predicate_satisfied() {\n let vec: BoundedVec<bool, 4> = BoundedVec::from_array([false, false, true, true]);\n let result = vec.any(|value| value);\n\n assert(result);\n }\n\n #[test]\n fn returns_false_on_empty_boundedvec() {\n let vec: BoundedVec<bool, 0> = BoundedVec::new();\n let result = vec.any(|value| value);\n\n assert(!result);\n }\n\n #[test]\n #[test_unconstrained]\n fn any_with_complex_predicates() {\n let vec: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3, 4, 5]);\n\n assert(vec.any(|x| x > 3));\n assert(!vec.any(|x| x > 10));\n assert(vec.any(|x| x % 2 == 0)); // has a even number\n assert(vec.any(|x| x == 3)); // has a specific value\n }\n\n #[test]\n fn any_with_partial_vector() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n vec.push(1);\n vec.push(2);\n\n assert(vec.any(|x| x == 1));\n assert(vec.any(|x| x == 2));\n assert(!vec.any(|x| x == 3));\n }\n }\n\n mod map {\n use crate::collections::bounded_vec::BoundedVec;\n use crate::internal::test_unconstrained;\n\n #[test]\n #[test_unconstrained]\n fn applies_function_correctly() {\n // docs:start:bounded-vec-map-example\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = vec.map(|value| value * 2);\n // docs:end:bounded-vec-map-example\n let expected = BoundedVec::from_array([2, 4, 6, 8]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn applies_function_that_changes_return_type() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = vec.map(|value| (value * 2) as Field);\n let expected: BoundedVec<Field, 4> = BoundedVec::from_array([2, 4, 6, 8]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn does_not_apply_function_past_len() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([0, 1]);\n let result = vec.map(|value| if value == 0 { 5 } else { value });\n let expected = BoundedVec::from_array([5, 1]);\n\n assert_eq(result, expected);\n assert_eq(result.get_unchecked(2), 0);\n }\n\n #[test]\n fn map_with_conditional_logic() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n\n let result = vec.map(|x| if x % 2 == 0 { x * 2 } else { x });\n let expected = BoundedVec::from_array([1, 4, 3, 8]);\n assert_eq(result, expected);\n }\n\n #[test]\n fn map_preserves_length() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = vec.map(|x| x * 2);\n\n assert_eq(result.len(), vec.len());\n assert_eq(result.max_len(), vec.max_len());\n }\n\n #[test]\n fn map_on_empty_vector() {\n let vec: BoundedVec<u32, 5> = BoundedVec::new();\n let result = vec.map(|x| x * 2);\n assert_eq(result, vec);\n assert_eq(result.len(), 0);\n assert_eq(result.max_len(), 5);\n }\n }\n\n mod mapi {\n use crate::collections::bounded_vec::BoundedVec;\n use crate::internal::test_unconstrained;\n\n #[test]\n #[test_unconstrained]\n fn applies_function_correctly() {\n // docs:start:bounded-vec-mapi-example\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = vec.mapi(|i, value| i + value * 2);\n // docs:end:bounded-vec-mapi-example\n let expected = BoundedVec::from_array([2, 5, 8, 11]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn applies_function_that_changes_return_type() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = vec.mapi(|i, value| (i + value * 2) as Field);\n let expected: BoundedVec<Field, 4> = BoundedVec::from_array([2, 5, 8, 11]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn does_not_apply_function_past_len() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([0, 1]);\n let result = vec.mapi(|_, value| if value == 0 { 5 } else { value });\n let expected = BoundedVec::from_array([5, 1]);\n\n assert_eq(result, expected);\n assert_eq(result.get_unchecked(2), 0);\n }\n\n #[test]\n fn mapi_with_index_branching_logic() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n\n let result = vec.mapi(|i, x| if i % 2 == 0 { x * 2 } else { x });\n let expected = BoundedVec::from_array([2, 2, 6, 4]);\n assert_eq(result, expected);\n }\n }\n\n mod for_each {\n use crate::collections::bounded_vec::BoundedVec;\n use crate::internal::test_unconstrained;\n\n // map in terms of for_each\n fn for_each_map<T, U, Env, let MaxLen: u32>(\n input: BoundedVec<T, MaxLen>,\n f: fn[Env](T) -> U,\n ) -> BoundedVec<U, MaxLen> {\n let mut output = BoundedVec::<U, MaxLen>::new();\n let output_ref = &mut output;\n input.for_each(|x| output_ref.push(f(x)));\n output\n }\n\n #[test]\n #[test_unconstrained]\n fn smoke_test() {\n let mut acc = 0;\n let acc_ref = &mut acc;\n // docs:start:bounded-vec-for-each-example\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([1, 2, 3]);\n vec.for_each(|value| { *acc_ref += value; });\n // docs:end:bounded-vec-for-each-example\n assert_eq(acc, 6);\n }\n\n #[test]\n fn applies_function_correctly() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = for_each_map(vec, |value| value * 2);\n let expected = BoundedVec::from_array([2, 4, 6, 8]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn applies_function_that_changes_return_type() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = for_each_map(vec, |value| (value * 2) as Field);\n let expected: BoundedVec<Field, 4> = BoundedVec::from_array([2, 4, 6, 8]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn does_not_apply_function_past_len() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([0, 1]);\n let result = for_each_map(vec, |value| if value == 0 { 5 } else { value });\n let expected = BoundedVec::from_array([5, 1]);\n\n assert_eq(result, expected);\n assert_eq(result.get_unchecked(2), 0);\n }\n\n #[test]\n fn for_each_on_empty_vector() {\n let vec: BoundedVec<u32, 5> = BoundedVec::new();\n let mut count = 0;\n let count_ref = &mut count;\n vec.for_each(|_| { *count_ref += 1; });\n assert_eq(count, 0);\n }\n\n #[test]\n fn for_each_with_side_effects() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([1, 2, 3]);\n let mut seen = BoundedVec::<u32, 3>::new();\n let seen_ref = &mut seen;\n vec.for_each(|x| seen_ref.push(x));\n assert_eq(seen, vec);\n }\n }\n\n mod for_eachi {\n use crate::collections::bounded_vec::BoundedVec;\n use crate::internal::test_unconstrained;\n\n // mapi in terms of for_eachi\n fn for_eachi_mapi<T, U, Env, let MaxLen: u32>(\n input: BoundedVec<T, MaxLen>,\n f: fn[Env](u32, T) -> U,\n ) -> BoundedVec<U, MaxLen> {\n let mut output = BoundedVec::<U, MaxLen>::new();\n let output_ref = &mut output;\n input.for_eachi(|i, x| output_ref.push(f(i, x)));\n output\n }\n\n #[test]\n #[test_unconstrained]\n fn smoke_test() {\n let mut acc = 0;\n let acc_ref = &mut acc;\n // docs:start:bounded-vec-for-eachi-example\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([1, 2, 3]);\n vec.for_eachi(|i, value| { *acc_ref += i * value; });\n // docs:end:bounded-vec-for-eachi-example\n\n // 0 * 1 + 1 * 2 + 2 * 3\n assert_eq(acc, 8);\n }\n\n #[test]\n fn applies_function_correctly() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = for_eachi_mapi(vec, |i, value| i + value * 2);\n let expected = BoundedVec::from_array([2, 5, 8, 11]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn applies_function_that_changes_return_type() {\n let vec: BoundedVec<u32, 4> = BoundedVec::from_array([1, 2, 3, 4]);\n let result = for_eachi_mapi(vec, |i, value| (i + value * 2) as Field);\n let expected: BoundedVec<Field, 4> = BoundedVec::from_array([2, 5, 8, 11]);\n\n assert_eq(result, expected);\n }\n\n #[test]\n fn does_not_apply_function_past_len() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([0, 1]);\n let result = for_eachi_mapi(vec, |_, value| if value == 0 { 5 } else { value });\n let expected = BoundedVec::from_array([5, 1]);\n\n assert_eq(result, expected);\n assert_eq(result.get_unchecked(2), 0);\n }\n\n #[test]\n fn for_eachi_on_empty_vector() {\n let vec: BoundedVec<u32, 5> = BoundedVec::new();\n let mut count = 0;\n let count_ref = &mut count;\n vec.for_eachi(|_, _| { *count_ref += 1; });\n assert_eq(count, 0);\n }\n\n #[test]\n fn for_eachi_with_index_tracking() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([10, 20, 30]);\n let mut indices = BoundedVec::<u32, 3>::new();\n let indices_ref = &mut indices;\n vec.for_eachi(|i, _| indices_ref.push(i));\n\n let expected = BoundedVec::from_array([0, 1, 2]);\n assert_eq(indices, expected);\n }\n\n }\n\n mod from_array {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn empty() {\n let empty_array: [Field; 0] = [];\n let bounded_vec = BoundedVec::from_array([]);\n\n assert_eq(bounded_vec.max_len(), 0);\n assert_eq(bounded_vec.len(), 0);\n assert_eq(bounded_vec.storage(), empty_array);\n }\n\n #[test]\n fn equal_len() {\n let array = [1, 2, 3];\n let bounded_vec = BoundedVec::from_array(array);\n\n assert_eq(bounded_vec.max_len(), 3);\n assert_eq(bounded_vec.len(), 3);\n assert_eq(bounded_vec.storage(), array);\n }\n\n #[test]\n fn max_len_greater_then_array_len() {\n let array = [1, 2, 3];\n let bounded_vec: BoundedVec<Field, 10> = BoundedVec::from_array(array);\n\n assert_eq(bounded_vec.max_len(), 10);\n assert_eq(bounded_vec.len(), 3);\n assert_eq(bounded_vec.get(0), 1);\n assert_eq(bounded_vec.get(1), 2);\n assert_eq(bounded_vec.get(2), 3);\n }\n\n #[test(should_fail_with = \"from array out of bounds\")]\n fn max_len_lower_then_array_len() {\n let _: BoundedVec<Field, 2> = BoundedVec::from_array([0; 3]);\n }\n\n #[test]\n fn from_array_preserves_order() {\n let array = [5, 3, 1, 4, 2];\n let vec: BoundedVec<u32, 5> = BoundedVec::from_array(array);\n for i in 0..array.len() {\n assert_eq(vec.get(i), array[i]);\n }\n }\n\n #[test]\n fn from_array_with_different_types() {\n let bool_array = [true, false, true];\n let bool_vec: BoundedVec<bool, 3> = BoundedVec::from_array(bool_array);\n assert_eq(bool_vec.len(), 3);\n assert_eq(bool_vec.get(0), true);\n assert_eq(bool_vec.get(1), false);\n }\n }\n\n mod trait_from {\n use crate::collections::bounded_vec::BoundedVec;\n use crate::convert::From;\n\n #[test]\n fn simple() {\n let array = [1, 2];\n let bounded_vec: BoundedVec<Field, 10> = BoundedVec::from(array);\n\n assert_eq(bounded_vec.max_len(), 10);\n assert_eq(bounded_vec.len(), 2);\n assert_eq(bounded_vec.get(0), 1);\n assert_eq(bounded_vec.get(1), 2);\n }\n }\n\n mod trait_eq {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn empty_equality() {\n let bounded_vec1: BoundedVec<Field, 3> = BoundedVec::new();\n let bounded_vec2: BoundedVec<Field, 3> = BoundedVec::new();\n\n assert_eq(bounded_vec1, bounded_vec2);\n }\n\n #[test]\n fn equality() {\n let mut bounded_vec1: BoundedVec<Field, 3> = BoundedVec::new();\n let mut bounded_vec2: BoundedVec<Field, 3> = BoundedVec::new();\n\n bounded_vec1.push(1);\n bounded_vec2.push(1);\n assert(bounded_vec1 == bounded_vec2);\n }\n\n #[test]\n fn inequality() {\n let mut bounded_vec1: BoundedVec<Field, 3> = BoundedVec::new();\n let mut bounded_vec2: BoundedVec<Field, 3> = BoundedVec::new();\n\n bounded_vec1.push(1);\n assert(bounded_vec1 != bounded_vec2);\n\n bounded_vec2.push(2);\n assert(bounded_vec1 != bounded_vec2);\n }\n }\n\n mod from_parts {\n use crate::collections::bounded_vec::BoundedVec;\n use crate::internal::test_unconstrained;\n\n #[test]\n #[test_unconstrained]\n fn from_parts() {\n // docs:start:from-parts\n let vec: BoundedVec<u32, 4> = BoundedVec::from_parts([1, 2, 3, 0], 3);\n assert_eq(vec.len(), 3);\n\n // Any elements past the given length are ignored, so these\n // two BoundedVecs will be completely equal\n let vec1: BoundedVec<u32, 4> = BoundedVec::from_parts([1, 2, 3, 1], 3);\n let vec2: BoundedVec<u32, 4> = BoundedVec::from_parts([1, 2, 3, 2], 3);\n assert_eq(vec1, vec2);\n // docs:end:from-parts\n }\n }\n\n mod push_pop {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn push_and_pop_operations() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n\n assert_eq(vec.len(), 0);\n\n vec.push(1);\n assert_eq(vec.len(), 1);\n assert_eq(vec.get(0), 1);\n\n vec.push(2);\n assert_eq(vec.len(), 2);\n assert_eq(vec.get(1), 2);\n\n let popped = vec.pop();\n assert_eq(popped, 2);\n assert_eq(vec.len(), 1);\n\n let popped2 = vec.pop();\n assert_eq(popped2, 1);\n assert_eq(vec.len(), 0);\n }\n\n #[test(should_fail_with = \"push out of bounds\")]\n fn push_to_full_vector() {\n let mut vec: BoundedVec<u32, 2> = BoundedVec::new();\n vec.push(1);\n vec.push(2);\n vec.push(3); // should panic\n }\n\n #[test(should_fail_with = \"cannot pop from an empty vector\")]\n fn pop_from_empty_vector() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n let _ = vec.pop(); // should panic\n }\n\n #[test]\n fn push_pop_cycle() {\n let mut vec: BoundedVec<u32, 3> = BoundedVec::new();\n\n // push to full\n vec.push(1);\n vec.push(2);\n vec.push(3);\n assert_eq(vec.len(), 3);\n\n // pop all\n assert_eq(vec.pop(), 3);\n assert_eq(vec.pop(), 2);\n assert_eq(vec.pop(), 1);\n assert_eq(vec.len(), 0);\n\n // push again\n vec.push(4);\n assert_eq(vec.len(), 1);\n assert_eq(vec.get(0), 4);\n }\n }\n\n mod extend {\n use crate::collections::bounded_vec::BoundedVec;\n use crate::internal::test_unconstrained;\n\n #[test]\n fn extend_from_array() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n vec.push(1);\n vec.extend_from_array([2, 3]);\n\n assert_eq(vec.len(), 3);\n assert_eq(vec.get(0), 1);\n assert_eq(vec.get(1), 2);\n assert_eq(vec.get(2), 3);\n }\n\n #[test]\n fn extend_from_vector() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n vec.push(1);\n vec.extend_from_vector([2, 3].as_vector());\n\n assert_eq(vec.len(), 3);\n assert_eq(vec.get(0), 1);\n assert_eq(vec.get(1), 2);\n assert_eq(vec.get(2), 3);\n }\n\n #[test]\n #[test_unconstrained]\n fn extend_from_bounded_vec() {\n // The source deliberately has a higher capacity,\n // to make sure we are not trying to assign out-of-bounds.\n let mut vec1: BoundedVec<u32, 5> = BoundedVec::new();\n let mut vec2: BoundedVec<u32, 9> = BoundedVec::new();\n\n vec1.push(1);\n vec2.push(2);\n vec2.push(3);\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 3);\n assert_eq(vec1.get(0), 1);\n assert_eq(vec1.get(1), 2);\n assert_eq(vec1.get(2), 3);\n }\n\n #[test]\n fn extend_from_bounded_vec_limit() {\n // Capacity and contents chosen so the last item must be assigned to.\n let mut vec1: BoundedVec<u32, 2> = BoundedVec::new();\n let mut vec2: BoundedVec<u32, 5> = BoundedVec::new();\n\n vec1.push(1);\n vec2.push(2);\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 2);\n assert_eq(vec1.get(0), 1);\n assert_eq(vec1.get(1), 2);\n }\n\n #[test]\n fn extend_from_bounded_vec_full_and_empty() {\n // Capacity and contents chosen so the last item must be assigned to.\n let mut vec1: BoundedVec<u32, 2> = BoundedVec::new();\n let vec2: BoundedVec<u32, 5> = BoundedVec::new();\n\n vec1.push(1);\n vec1.push(2);\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 2);\n assert_eq(vec1.get(0), 1);\n assert_eq(vec1.get(1), 2);\n }\n\n #[test]\n fn extend_from_bounded_vec_zero_len() {\n let mut vec1: BoundedVec<u32, 0> = BoundedVec::new();\n let vec2: BoundedVec<u32, 0> = BoundedVec::new();\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 0);\n }\n\n #[test]\n fn extend_from_bounded_vec_last_zeroed() {\n let mut vec1: BoundedVec<u32, 4> = BoundedVec::new();\n let mut vec2: BoundedVec<u32, 4> = BoundedVec::new();\n\n vec1.push(1);\n vec1.push(2);\n vec2.push(3);\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 3);\n assert_eq(vec1.get_unchecked(3), 0);\n }\n\n #[test]\n fn extend_from_bounded_vec_empty_self() {\n // self.len == 0 with Len > MaxLen: the loop doesn't reach\n // the last storage slot, so the fixup must write it.\n let mut vec1: BoundedVec<u32, 3> = BoundedVec::new();\n let vec2: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3]);\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 3);\n assert_eq(vec1.get(0), 1);\n assert_eq(vec1.get(1), 2);\n assert_eq(vec1.get(2), 3);\n }\n\n #[test]\n fn extend_from_bounded_vec_equal_capacity() {\n // Len == MaxLen, fills to capacity.\n let mut vec1: BoundedVec<u32, 4> = BoundedVec::new();\n vec1.push(1);\n let vec2: BoundedVec<u32, 4> = BoundedVec::from_array([2, 3, 4]);\n\n vec1.extend_from_bounded_vec(vec2);\n\n assert_eq(vec1.len(), 4);\n assert_eq(vec1.get(0), 1);\n assert_eq(vec1.get(1), 2);\n assert_eq(vec1.get(2), 3);\n assert_eq(vec1.get(3), 4);\n }\n\n #[test(should_fail_with = \"extend_from_array out of bounds\")]\n fn extend_array_beyond_max_len() {\n let mut vec: BoundedVec<u32, 3> = BoundedVec::new();\n vec.push(1);\n vec.extend_from_array([2, 3, 4]); // should panic\n }\n\n #[test(should_fail_with = \"extend_from_vector out of bounds\")]\n fn extend_vector_beyond_max_len() {\n let mut vec: BoundedVec<u32, 3> = BoundedVec::new();\n vec.push(1);\n vec.extend_from_vector([2, 3, 4].as_vector()); // S]should panic\n }\n\n #[test(should_fail_with = \"extend_from_bounded_vec out of bounds\")]\n fn extend_bounded_vec_beyond_max_len() {\n let mut vec: BoundedVec<u32, 3> = BoundedVec::new();\n let other: BoundedVec<u32, 5> = BoundedVec::from_array([1, 2, 3, 4, 5]);\n vec.extend_from_bounded_vec(other); // should panic\n }\n\n #[test]\n fn extend_with_empty_collections() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n let original_len = vec.len();\n\n vec.extend_from_array([]);\n assert_eq(vec.len(), original_len);\n\n vec.extend_from_vector([].as_vector());\n assert_eq(vec.len(), original_len);\n\n let empty: BoundedVec<u32, 3> = BoundedVec::new();\n vec.extend_from_bounded_vec(empty);\n assert_eq(vec.len(), original_len);\n }\n }\n\n mod storage {\n use crate::collections::bounded_vec::BoundedVec;\n\n #[test]\n fn storage_consistency() {\n let mut vec: BoundedVec<u32, 5> = BoundedVec::new();\n\n // test initial storage state\n assert_eq(vec.storage(), [0, 0, 0, 0, 0]);\n\n vec.push(1);\n vec.push(2);\n\n // test storage after modifications\n assert_eq(vec.storage(), [1, 2, 0, 0, 0]);\n\n // storage doesn't change length\n assert_eq(vec.len(), 2);\n assert_eq(vec.max_len(), 5);\n }\n\n #[test]\n fn storage_after_pop() {\n let mut vec: BoundedVec<u32, 3> = BoundedVec::from_array([1, 2, 3]);\n\n let _ = vec.pop();\n // after pop, the last element should be unmodified\n assert_eq(vec.storage(), [1, 2, 3]);\n assert_eq(vec.len(), 2);\n }\n\n #[test]\n fn vector_immutable() {\n let vec: BoundedVec<u32, 3> = BoundedVec::from_array([1, 2, 3]);\n let storage = vec.storage();\n\n assert_eq(storage, [1, 2, 3]);\n\n // Verify that the original vector is unchanged\n assert_eq(vec.len(), 3);\n assert_eq(vec.get(0), 1);\n assert_eq(vec.get(1), 2);\n assert_eq(vec.get(2), 3);\n }\n }\n}\n",
|
|
184
184
|
"path": "std/collections/bounded_vec.nr",
|
|
185
185
|
"function_locations": [
|
|
186
186
|
{
|
|
187
|
-
"start":
|
|
187
|
+
"start": 2304,
|
|
188
188
|
"name": "BoundedVec<T, MaxLen>::new"
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
|
-
"start":
|
|
191
|
+
"start": 2907,
|
|
192
192
|
"name": "BoundedVec<T, MaxLen>::get"
|
|
193
193
|
},
|
|
194
194
|
{
|
|
195
|
-
"start":
|
|
195
|
+
"start": 3815,
|
|
196
196
|
"name": "BoundedVec<T, MaxLen>::get_unchecked"
|
|
197
197
|
},
|
|
198
198
|
{
|
|
199
|
-
"start":
|
|
199
|
+
"start": 4398,
|
|
200
200
|
"name": "BoundedVec<T, MaxLen>::set"
|
|
201
201
|
},
|
|
202
202
|
{
|
|
203
|
-
"start":
|
|
203
|
+
"start": 5926,
|
|
204
204
|
"name": "BoundedVec<T, MaxLen>::set_unchecked"
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
|
-
"start":
|
|
207
|
+
"start": 6464,
|
|
208
208
|
"name": "BoundedVec<T, MaxLen>::push"
|
|
209
209
|
},
|
|
210
210
|
{
|
|
211
|
-
"start":
|
|
211
|
+
"start": 7072,
|
|
212
212
|
"name": "BoundedVec<T, MaxLen>::len"
|
|
213
213
|
},
|
|
214
214
|
{
|
|
215
|
-
"start":
|
|
215
|
+
"start": 7513,
|
|
216
216
|
"name": "BoundedVec<T, MaxLen>::max_len"
|
|
217
217
|
},
|
|
218
218
|
{
|
|
219
|
-
"start":
|
|
219
|
+
"start": 8111,
|
|
220
220
|
"name": "BoundedVec<T, MaxLen>::storage"
|
|
221
221
|
},
|
|
222
222
|
{
|
|
223
|
-
"start":
|
|
223
|
+
"start": 8667,
|
|
224
224
|
"name": "BoundedVec<T, MaxLen>::extend_from_array"
|
|
225
225
|
},
|
|
226
226
|
{
|
|
227
|
-
"start":
|
|
227
|
+
"start": 9438,
|
|
228
228
|
"name": "BoundedVec<T, MaxLen>::extend_from_vector"
|
|
229
229
|
},
|
|
230
230
|
{
|
|
231
|
-
"start":
|
|
231
|
+
"start": 10383,
|
|
232
232
|
"name": "BoundedVec<T, MaxLen>::extend_from_bounded_vec"
|
|
233
233
|
},
|
|
234
234
|
{
|
|
235
|
-
"start":
|
|
235
|
+
"start": 12778,
|
|
236
236
|
"name": "BoundedVec<T, MaxLen>::from_array"
|
|
237
237
|
},
|
|
238
238
|
{
|
|
239
|
-
"start":
|
|
239
|
+
"start": 13521,
|
|
240
240
|
"name": "BoundedVec<T, MaxLen>::pop"
|
|
241
241
|
},
|
|
242
242
|
{
|
|
243
|
-
"start":
|
|
243
|
+
"start": 14063,
|
|
244
244
|
"name": "BoundedVec<T, MaxLen>::any"
|
|
245
245
|
},
|
|
246
246
|
{
|
|
247
|
-
"start":
|
|
247
|
+
"start": 14979,
|
|
248
248
|
"name": "BoundedVec<T, MaxLen>::map"
|
|
249
249
|
},
|
|
250
250
|
{
|
|
251
|
-
"start":
|
|
251
|
+
"start": 15979,
|
|
252
252
|
"name": "BoundedVec<T, MaxLen>::mapi"
|
|
253
253
|
},
|
|
254
254
|
{
|
|
255
|
-
"start":
|
|
255
|
+
"start": 16937,
|
|
256
256
|
"name": "BoundedVec<T, MaxLen>::for_each"
|
|
257
257
|
},
|
|
258
258
|
{
|
|
259
|
-
"start":
|
|
259
|
+
"start": 17742,
|
|
260
260
|
"name": "BoundedVec<T, MaxLen>::for_eachi"
|
|
261
261
|
},
|
|
262
262
|
{
|
|
263
|
-
"start":
|
|
263
|
+
"start": 18439,
|
|
264
264
|
"name": "BoundedVec<T, MaxLen>::from_parts"
|
|
265
265
|
},
|
|
266
266
|
{
|
|
267
|
-
"start":
|
|
267
|
+
"start": 19903,
|
|
268
268
|
"name": "BoundedVec<T, MaxLen>::from_parts_unchecked"
|
|
269
269
|
},
|
|
270
270
|
{
|
|
271
|
-
"start":
|
|
271
|
+
"start": 20115,
|
|
272
272
|
"name": "<impl Eq for BoundedVec<T, MaxLen>>::eq"
|
|
273
273
|
},
|
|
274
274
|
{
|
|
275
|
-
"start":
|
|
275
|
+
"start": 21039,
|
|
276
|
+
"name": "unconstrained_eq"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"start": 21335,
|
|
276
280
|
"name": "<impl From<[T; Len]> for BoundedVec<T, MaxLen>>::from"
|
|
277
281
|
},
|
|
278
282
|
{
|
|
279
|
-
"start":
|
|
283
|
+
"start": 21618,
|
|
280
284
|
"name": "bounded_vec_tests::get::panics_when_reading_elements_past_end_of_vec"
|
|
281
285
|
},
|
|
282
286
|
{
|
|
283
|
-
"start":
|
|
287
|
+
"start": 21853,
|
|
284
288
|
"name": "bounded_vec_tests::get::panics_when_reading_beyond_length"
|
|
285
289
|
},
|
|
286
290
|
{
|
|
287
|
-
"start":
|
|
291
|
+
"start": 22028,
|
|
288
292
|
"name": "bounded_vec_tests::get::get_works_within_bounds"
|
|
289
293
|
},
|
|
290
294
|
{
|
|
291
|
-
"start":
|
|
295
|
+
"start": 22287,
|
|
292
296
|
"name": "bounded_vec_tests::get::get_unchecked_works"
|
|
293
297
|
},
|
|
294
298
|
{
|
|
295
|
-
"start":
|
|
299
|
+
"start": 22531,
|
|
296
300
|
"name": "bounded_vec_tests::get::get_unchecked_works_past_len"
|
|
297
301
|
},
|
|
298
302
|
{
|
|
299
|
-
"start":
|
|
303
|
+
"start": 22804,
|
|
300
304
|
"name": "bounded_vec_tests::set::set_updates_values_properly"
|
|
301
305
|
},
|
|
302
306
|
{
|
|
303
|
-
"start":
|
|
307
|
+
"start": 23442,
|
|
304
308
|
"name": "bounded_vec_tests::set::panics_when_writing_elements_past_end_of_vec"
|
|
305
309
|
},
|
|
306
310
|
{
|
|
307
|
-
"start":
|
|
311
|
+
"start": 23677,
|
|
308
312
|
"name": "bounded_vec_tests::set::panics_when_setting_beyond_length"
|
|
309
313
|
},
|
|
310
314
|
{
|
|
311
|
-
"start":
|
|
315
|
+
"start": 23852,
|
|
312
316
|
"name": "bounded_vec_tests::set::set_unchecked_operations"
|
|
313
317
|
},
|
|
314
318
|
{
|
|
315
|
-
"start":
|
|
319
|
+
"start": 24184,
|
|
316
320
|
"name": "bounded_vec_tests::set::set_unchecked_operations_past_len"
|
|
317
321
|
},
|
|
318
322
|
{
|
|
319
|
-
"start":
|
|
323
|
+
"start": 24448,
|
|
320
324
|
"name": "bounded_vec_tests::set::set_preserves_other_elements"
|
|
321
325
|
},
|
|
322
326
|
{
|
|
323
|
-
"start":
|
|
327
|
+
"start": 24995,
|
|
324
328
|
"name": "bounded_vec_tests::any::returns_false_if_predicate_not_satisfied"
|
|
325
329
|
},
|
|
326
330
|
{
|
|
327
|
-
"start":
|
|
331
|
+
"start": 25279,
|
|
328
332
|
"name": "bounded_vec_tests::any::returns_true_if_predicate_satisfied"
|
|
329
333
|
},
|
|
330
334
|
{
|
|
331
|
-
"start":
|
|
335
|
+
"start": 25528,
|
|
332
336
|
"name": "bounded_vec_tests::any::returns_false_on_empty_boundedvec"
|
|
333
337
|
},
|
|
334
338
|
{
|
|
335
|
-
"start":
|
|
339
|
+
"start": 25769,
|
|
336
340
|
"name": "bounded_vec_tests::any::any_with_complex_predicates"
|
|
337
341
|
},
|
|
338
342
|
{
|
|
339
|
-
"start":
|
|
343
|
+
"start": 26132,
|
|
340
344
|
"name": "bounded_vec_tests::any::any_with_partial_vector"
|
|
341
345
|
},
|
|
342
346
|
{
|
|
343
|
-
"start":
|
|
347
|
+
"start": 26598,
|
|
344
348
|
"name": "bounded_vec_tests::map::applies_function_correctly"
|
|
345
349
|
},
|
|
346
350
|
{
|
|
347
|
-
"start":
|
|
351
|
+
"start": 27020,
|
|
348
352
|
"name": "bounded_vec_tests::map::applies_function_that_changes_return_type"
|
|
349
353
|
},
|
|
350
354
|
{
|
|
351
|
-
"start":
|
|
355
|
+
"start": 27368,
|
|
352
356
|
"name": "bounded_vec_tests::map::does_not_apply_function_past_len"
|
|
353
357
|
},
|
|
354
358
|
{
|
|
355
|
-
"start":
|
|
359
|
+
"start": 27741,
|
|
356
360
|
"name": "bounded_vec_tests::map::map_with_conditional_logic"
|
|
357
361
|
},
|
|
358
362
|
{
|
|
359
|
-
"start":
|
|
363
|
+
"start": 28065,
|
|
360
364
|
"name": "bounded_vec_tests::map::map_preserves_length"
|
|
361
365
|
},
|
|
362
366
|
{
|
|
363
|
-
"start":
|
|
367
|
+
"start": 28357,
|
|
364
368
|
"name": "bounded_vec_tests::map::map_on_empty_vector"
|
|
365
369
|
},
|
|
366
370
|
{
|
|
367
|
-
"start":
|
|
371
|
+
"start": 28810,
|
|
368
372
|
"name": "bounded_vec_tests::mapi::applies_function_correctly"
|
|
369
373
|
},
|
|
370
374
|
{
|
|
371
|
-
"start":
|
|
375
|
+
"start": 29243,
|
|
372
376
|
"name": "bounded_vec_tests::mapi::applies_function_that_changes_return_type"
|
|
373
377
|
},
|
|
374
378
|
{
|
|
375
|
-
"start":
|
|
379
|
+
"start": 29600,
|
|
376
380
|
"name": "bounded_vec_tests::mapi::does_not_apply_function_past_len"
|
|
377
381
|
},
|
|
378
382
|
{
|
|
379
|
-
"start":
|
|
383
|
+
"start": 29982,
|
|
380
384
|
"name": "bounded_vec_tests::mapi::mapi_with_index_branching_logic"
|
|
381
385
|
},
|
|
382
386
|
{
|
|
383
|
-
"start":
|
|
387
|
+
"start": 30590,
|
|
384
388
|
"name": "bounded_vec_tests::for_each::for_each_map"
|
|
385
389
|
},
|
|
386
390
|
{
|
|
387
|
-
"start":
|
|
391
|
+
"start": 30850,
|
|
388
392
|
"name": "bounded_vec_tests::for_each::smoke_test"
|
|
389
393
|
},
|
|
390
394
|
{
|
|
391
|
-
"start":
|
|
395
|
+
"start": 31258,
|
|
392
396
|
"name": "bounded_vec_tests::for_each::applies_function_correctly"
|
|
393
397
|
},
|
|
394
398
|
{
|
|
395
|
-
"start":
|
|
399
|
+
"start": 31592,
|
|
396
400
|
"name": "bounded_vec_tests::for_each::applies_function_that_changes_return_type"
|
|
397
401
|
},
|
|
398
402
|
{
|
|
399
|
-
"start":
|
|
403
|
+
"start": 31950,
|
|
400
404
|
"name": "bounded_vec_tests::for_each::does_not_apply_function_past_len"
|
|
401
405
|
},
|
|
402
406
|
{
|
|
403
|
-
"start":
|
|
407
|
+
"start": 32331,
|
|
404
408
|
"name": "bounded_vec_tests::for_each::for_each_on_empty_vector"
|
|
405
409
|
},
|
|
406
410
|
{
|
|
407
|
-
"start":
|
|
411
|
+
"start": 32617,
|
|
408
412
|
"name": "bounded_vec_tests::for_each::for_each_with_side_effects"
|
|
409
413
|
},
|
|
410
414
|
{
|
|
411
|
-
"start":
|
|
415
|
+
"start": 33223,
|
|
412
416
|
"name": "bounded_vec_tests::for_eachi::for_eachi_mapi"
|
|
413
417
|
},
|
|
414
418
|
{
|
|
415
|
-
"start":
|
|
419
|
+
"start": 33490,
|
|
416
420
|
"name": "bounded_vec_tests::for_eachi::smoke_test"
|
|
417
421
|
},
|
|
418
422
|
{
|
|
419
|
-
"start":
|
|
423
|
+
"start": 33946,
|
|
420
424
|
"name": "bounded_vec_tests::for_eachi::applies_function_correctly"
|
|
421
425
|
},
|
|
422
426
|
{
|
|
423
|
-
"start":
|
|
427
|
+
"start": 34290,
|
|
424
428
|
"name": "bounded_vec_tests::for_eachi::applies_function_that_changes_return_type"
|
|
425
429
|
},
|
|
426
430
|
{
|
|
427
|
-
"start":
|
|
431
|
+
"start": 34658,
|
|
428
432
|
"name": "bounded_vec_tests::for_eachi::does_not_apply_function_past_len"
|
|
429
433
|
},
|
|
430
434
|
{
|
|
431
|
-
"start":
|
|
435
|
+
"start": 35045,
|
|
432
436
|
"name": "bounded_vec_tests::for_eachi::for_eachi_on_empty_vector"
|
|
433
437
|
},
|
|
434
438
|
{
|
|
435
|
-
"start":
|
|
439
|
+
"start": 35338,
|
|
436
440
|
"name": "bounded_vec_tests::for_eachi::for_eachi_with_index_tracking"
|
|
437
441
|
},
|
|
438
442
|
{
|
|
439
|
-
"start":
|
|
443
|
+
"start": 35815,
|
|
440
444
|
"name": "bounded_vec_tests::from_array::empty"
|
|
441
445
|
},
|
|
442
446
|
{
|
|
443
|
-
"start":
|
|
447
|
+
"start": 36125,
|
|
444
448
|
"name": "bounded_vec_tests::from_array::equal_len"
|
|
445
449
|
},
|
|
446
450
|
{
|
|
447
|
-
"start":
|
|
451
|
+
"start": 36442,
|
|
448
452
|
"name": "bounded_vec_tests::from_array::max_len_greater_then_array_len"
|
|
449
453
|
},
|
|
450
454
|
{
|
|
451
|
-
"start":
|
|
455
|
+
"start": 36913,
|
|
452
456
|
"name": "bounded_vec_tests::from_array::max_len_lower_then_array_len"
|
|
453
457
|
},
|
|
454
458
|
{
|
|
455
|
-
"start":
|
|
459
|
+
"start": 37056,
|
|
456
460
|
"name": "bounded_vec_tests::from_array::from_array_preserves_order"
|
|
457
461
|
},
|
|
458
462
|
{
|
|
459
|
-
"start":
|
|
463
|
+
"start": 37345,
|
|
460
464
|
"name": "bounded_vec_tests::from_array::from_array_with_different_types"
|
|
461
465
|
},
|
|
462
466
|
{
|
|
463
|
-
"start":
|
|
467
|
+
"start": 37782,
|
|
464
468
|
"name": "bounded_vec_tests::trait_from::simple"
|
|
465
469
|
},
|
|
466
470
|
{
|
|
467
|
-
"start":
|
|
471
|
+
"start": 38220,
|
|
468
472
|
"name": "bounded_vec_tests::trait_eq::empty_equality"
|
|
469
473
|
},
|
|
470
474
|
{
|
|
471
|
-
"start":
|
|
472
|
-
"name": "bounded_vec_tests::trait_eq::
|
|
475
|
+
"start": 38467,
|
|
476
|
+
"name": "bounded_vec_tests::trait_eq::equality"
|
|
473
477
|
},
|
|
474
478
|
{
|
|
475
|
-
"start":
|
|
476
|
-
"name": "bounded_vec_tests::
|
|
479
|
+
"start": 38791,
|
|
480
|
+
"name": "bounded_vec_tests::trait_eq::inequality"
|
|
477
481
|
},
|
|
478
482
|
{
|
|
479
|
-
"start":
|
|
480
|
-
"name": "bounded_vec_tests::from_parts::
|
|
483
|
+
"start": 39330,
|
|
484
|
+
"name": "bounded_vec_tests::from_parts::from_parts"
|
|
481
485
|
},
|
|
482
486
|
{
|
|
483
|
-
"start":
|
|
487
|
+
"start": 40003,
|
|
484
488
|
"name": "bounded_vec_tests::push_pop::push_and_pop_operations"
|
|
485
489
|
},
|
|
486
490
|
{
|
|
487
|
-
"start":
|
|
491
|
+
"start": 40629,
|
|
488
492
|
"name": "bounded_vec_tests::push_pop::push_to_full_vector"
|
|
489
493
|
},
|
|
490
494
|
{
|
|
491
|
-
"start":
|
|
495
|
+
"start": 40903,
|
|
492
496
|
"name": "bounded_vec_tests::push_pop::pop_from_empty_vector"
|
|
493
497
|
},
|
|
494
498
|
{
|
|
495
|
-
"start":
|
|
499
|
+
"start": 41072,
|
|
496
500
|
"name": "bounded_vec_tests::push_pop::push_pop_cycle"
|
|
497
501
|
},
|
|
498
502
|
{
|
|
499
|
-
"start":
|
|
503
|
+
"start": 41767,
|
|
500
504
|
"name": "bounded_vec_tests::extend::extend_from_array"
|
|
501
505
|
},
|
|
502
506
|
{
|
|
503
|
-
"start":
|
|
507
|
+
"start": 42113,
|
|
504
508
|
"name": "bounded_vec_tests::extend::extend_from_vector"
|
|
505
509
|
},
|
|
506
510
|
{
|
|
507
|
-
"start":
|
|
511
|
+
"start": 42507,
|
|
508
512
|
"name": "bounded_vec_tests::extend::extend_from_bounded_vec"
|
|
509
513
|
},
|
|
510
514
|
{
|
|
511
|
-
"start":
|
|
515
|
+
"start": 43128,
|
|
512
516
|
"name": "bounded_vec_tests::extend::extend_from_bounded_vec_limit"
|
|
513
517
|
},
|
|
514
518
|
{
|
|
515
|
-
"start":
|
|
519
|
+
"start": 43642,
|
|
516
520
|
"name": "bounded_vec_tests::extend::extend_from_bounded_vec_full_and_empty"
|
|
517
521
|
},
|
|
518
522
|
{
|
|
519
|
-
"start":
|
|
523
|
+
"start": 44146,
|
|
520
524
|
"name": "bounded_vec_tests::extend::extend_from_bounded_vec_zero_len"
|
|
521
525
|
},
|
|
522
526
|
{
|
|
523
|
-
"start":
|
|
527
|
+
"start": 44440,
|
|
524
528
|
"name": "bounded_vec_tests::extend::extend_from_bounded_vec_last_zeroed"
|
|
525
529
|
},
|
|
526
530
|
{
|
|
527
|
-
"start":
|
|
531
|
+
"start": 44865,
|
|
528
532
|
"name": "bounded_vec_tests::extend::extend_from_bounded_vec_empty_self"
|
|
529
533
|
},
|
|
530
534
|
{
|
|
531
|
-
"start":
|
|
535
|
+
"start": 45432,
|
|
532
536
|
"name": "bounded_vec_tests::extend::extend_from_bounded_vec_equal_capacity"
|
|
533
537
|
},
|
|
534
538
|
{
|
|
535
|
-
"start":
|
|
539
|
+
"start": 46019,
|
|
536
540
|
"name": "bounded_vec_tests::extend::extend_array_beyond_max_len"
|
|
537
541
|
},
|
|
538
542
|
{
|
|
539
|
-
"start":
|
|
543
|
+
"start": 46297,
|
|
540
544
|
"name": "bounded_vec_tests::extend::extend_vector_beyond_max_len"
|
|
541
545
|
},
|
|
542
546
|
{
|
|
543
|
-
"start":
|
|
547
|
+
"start": 46600,
|
|
544
548
|
"name": "bounded_vec_tests::extend::extend_bounded_vec_beyond_max_len"
|
|
545
549
|
},
|
|
546
550
|
{
|
|
547
|
-
"start":
|
|
551
|
+
"start": 46886,
|
|
548
552
|
"name": "bounded_vec_tests::extend::extend_with_empty_collections"
|
|
549
553
|
},
|
|
550
554
|
{
|
|
551
|
-
"start":
|
|
555
|
+
"start": 47486,
|
|
552
556
|
"name": "bounded_vec_tests::storage::storage_consistency"
|
|
553
557
|
},
|
|
554
558
|
{
|
|
555
|
-
"start":
|
|
559
|
+
"start": 47988,
|
|
556
560
|
"name": "bounded_vec_tests::storage::storage_after_pop"
|
|
557
561
|
},
|
|
558
562
|
{
|
|
559
|
-
"start":
|
|
563
|
+
"start": 48310,
|
|
560
564
|
"name": "bounded_vec_tests::storage::vector_immutable"
|
|
561
565
|
}
|
|
562
566
|
]
|
|
563
567
|
},
|
|
564
|
-
"
|
|
565
|
-
"source": "pub mod hash;\npub mod aes128;\npub mod array;\npub mod vector;\npub mod ecdsa_secp256k1;\npub mod ecdsa_secp256r1;\npub mod embedded_curve_ops;\npub mod field;\npub mod collections;\npub mod compat;\npub mod convert;\npub mod option;\npub mod string;\npub mod test;\npub mod cmp;\npub mod ops;\npub mod default;\npub mod prelude;\npub mod runtime;\npub mod meta;\npub mod append;\npub mod mem;\npub mod panic;\npub mod hint;\n\nmod primitive_docs;\n\n// Oracle calls are required to be wrapped in an unconstrained function\n// Thus, the only argument to the `println` oracle is expected to always be an ident\n#[oracle(print)]\nunconstrained fn print_oracle<T>(with_newline: bool, input: T) {}\n\nunconstrained fn print_unconstrained<T>(with_newline: bool, input: T) {\n print_oracle(with_newline, input);\n}\n\n/// Print the given input to stdout followed by a newline\npub fn println<T>(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(true, input);\n }\n}\n\n/// Print the given input to stdout\npub fn print<T>(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(false, input);\n }\n}\n\n/// Asserts the validity of the provided proof and public inputs against the provided verification key and hash.\n///\n/// The ACVM cannot determine whether the provided proof is valid during execution as this requires knowledge of\n/// the backend against which the program is being proven. However if an invalid proof if submitted, the program may\n/// fail to prove or the backend may generate a proof which will subsequently fail to verify.\n///\n/// # Important Note\n///\n/// If you are not developing your own backend such as [Barretenberg](https://github.com/AztecProtocol/barretenberg)\n/// you probably shouldn't need to interact with this function directly. It's easier and safer to use a verification\n/// library which is published by the developers of the backend which will document or enforce any safety requirements.\n///\n/// If you use this directly, you're liable to introduce underconstrainedness bugs and *your circuit will be insecure*.\n///\n/// # Arguments\n/// - verification_key: The verification key of the circuit to be verified.\n/// - proof: The proof to be verified.\n/// - public_inputs: The public inputs associated with `proof`\n/// - key_hash: The hash of `verification_key` of the form expected by the backend.\n/// - proof_type: An identifier for the proving scheme used to generate the proof to be verified. This allows\n/// for a single backend to support verifying multiple proving schemes.\n///\n/// # Constraining `key_hash`\n///\n/// The Noir compiler does not by itself constrain that `key_hash` is a valid hash of `verification_key`.\n/// This is because different backends may differ in how they hash their verification keys.\n/// It is then the responsibility of either the noir developer (by explicitly hashing the verification key\n/// in the correct manner) or by the proving system itself internally asserting the correctness of `key_hash`.\npub fn verify_proof_with_type<let N: u32, let M: u32, let K: u32>(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {\n if !crate::runtime::is_unconstrained() {\n crate::assert_constant(proof_type);\n }\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, proof_type);\n}\n\n#[foreign(recursive_aggregation)]\nfn verify_proof_internal<let N: u32, let M: u32, let K: u32>(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {}\n\n/// Asserts that the given value is known at compile-time.\n/// Useful for debugging for-loop bounds.\n#[builtin(assert_constant)]\npub fn assert_constant<T>(x: T) {}\n\n/// Asserts that the given value is both true and known at compile-time.\n/// The message can be a string, a format string, or any value, as long as it is known at compile-time\n#[builtin(static_assert)]\npub fn static_assert<T>(predicate: bool, message: T) {}\n\n/// Force a field value to be a witness instead of a constant in the compiled output.\n/// This is often only useful for debugging compiler optimizations.\n///\n/// This has no effect in unconstrained or comptime code.\n#[builtin(as_witness)]\npub fn as_witness(x: Field) {}\n",
|
|
568
|
+
"21": {
|
|
569
|
+
"source": "pub mod hash;\npub mod aes128;\npub mod array;\npub mod vector;\npub mod ecdsa_secp256k1;\npub mod ecdsa_secp256r1;\npub mod embedded_curve_ops;\npub mod field;\npub mod collections;\npub mod compat;\npub mod convert;\npub mod option;\npub mod string;\npub mod test;\npub mod cmp;\npub mod ops;\npub mod default;\npub mod prelude;\npub mod runtime;\npub mod meta;\npub mod append;\npub mod mem;\npub mod panic;\npub mod hint;\n\nmod primitive_docs;\nmod internal;\n\n// Oracle calls are required to be wrapped in an unconstrained function\n// Thus, the only argument to the `println` oracle is expected to always be an ident\n#[oracle(print)]\nunconstrained fn print_oracle<T>(with_newline: bool, input: T) {}\n\nunconstrained fn print_unconstrained<T>(with_newline: bool, input: T) {\n print_oracle(with_newline, input);\n}\n\n/// Print the given input to stdout followed by a newline\npub fn println<T>(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(true, input);\n }\n}\n\n/// Print the given input to stdout\npub fn print<T>(input: T) {\n // Safety: a print statement cannot be constrained\n unsafe {\n print_unconstrained(false, input);\n }\n}\n\n/// Asserts the validity of the provided proof and public inputs against the provided verification key and hash.\n///\n/// The ACVM cannot determine whether the provided proof is valid during execution as this requires knowledge of\n/// the backend against which the program is being proven. However if an invalid proof if submitted, the program may\n/// fail to prove or the backend may generate a proof which will subsequently fail to verify.\n///\n/// # Important Note\n///\n/// If you are not developing your own backend such as [Barretenberg](https://github.com/AztecProtocol/barretenberg)\n/// you probably shouldn't need to interact with this function directly. It's easier and safer to use a verification\n/// library which is published by the developers of the backend which will document or enforce any safety requirements.\n///\n/// If you use this directly, you're liable to introduce underconstrainedness bugs and *your circuit will be insecure*.\n///\n/// # Arguments\n/// - verification_key: The verification key of the circuit to be verified.\n/// - proof: The proof to be verified.\n/// - public_inputs: The public inputs associated with `proof`\n/// - key_hash: The hash of `verification_key` of the form expected by the backend.\n/// - proof_type: An identifier for the proving scheme used to generate the proof to be verified. This allows\n/// for a single backend to support verifying multiple proving schemes.\n///\n/// # Constraining `key_hash`\n///\n/// The Noir compiler does not by itself constrain that `key_hash` is a valid hash of `verification_key`.\n/// This is because different backends may differ in how they hash their verification keys.\n/// It is then the responsibility of either the noir developer (by explicitly hashing the verification key\n/// in the correct manner) or by the proving system itself internally asserting the correctness of `key_hash`.\npub fn verify_proof_with_type<let N: u32, let M: u32, let K: u32>(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {\n if !crate::runtime::is_unconstrained() {\n crate::assert_constant(proof_type);\n }\n verify_proof_internal(verification_key, proof, public_inputs, key_hash, proof_type);\n}\n\n#[foreign(recursive_aggregation)]\nfn verify_proof_internal<let N: u32, let M: u32, let K: u32>(\n verification_key: [Field; N],\n proof: [Field; M],\n public_inputs: [Field; K],\n key_hash: Field,\n proof_type: u32,\n) {}\n\n/// Asserts that the given value is known at compile-time.\n/// Useful for debugging for-loop bounds.\n#[builtin(assert_constant)]\npub fn assert_constant<T>(x: T) {}\n\n/// Asserts that the given value is both true and known at compile-time.\n/// The message can be a string, a format string, or any value, as long as it is known at compile-time\n#[builtin(static_assert)]\npub fn static_assert<T>(predicate: bool, message: T) {}\n\n/// Force a field value to be a witness instead of a constant in the compiled output.\n/// This is often only useful for debugging compiler optimizations.\n///\n/// This has no effect in unconstrained or comptime code.\n#[builtin(as_witness)]\npub fn as_witness(x: Field) {}\n",
|
|
566
570
|
"path": "std/lib.nr",
|
|
567
571
|
"function_locations": [
|
|
568
572
|
{
|
|
569
|
-
"start":
|
|
573
|
+
"start": 676,
|
|
570
574
|
"name": "print_oracle"
|
|
571
575
|
},
|
|
572
576
|
{
|
|
573
|
-
"start":
|
|
577
|
+
"start": 750,
|
|
574
578
|
"name": "print_unconstrained"
|
|
575
579
|
},
|
|
576
580
|
{
|
|
577
|
-
"start":
|
|
581
|
+
"start": 880,
|
|
578
582
|
"name": "println"
|
|
579
583
|
},
|
|
580
584
|
{
|
|
581
|
-
"start":
|
|
585
|
+
"start": 1063,
|
|
582
586
|
"name": "print"
|
|
583
587
|
},
|
|
584
588
|
{
|
|
585
|
-
"start":
|
|
589
|
+
"start": 3264,
|
|
586
590
|
"name": "verify_proof_with_type"
|
|
587
591
|
},
|
|
588
592
|
{
|
|
589
|
-
"start":
|
|
593
|
+
"start": 3681,
|
|
590
594
|
"name": "verify_proof_internal"
|
|
591
595
|
},
|
|
592
596
|
{
|
|
593
|
-
"start":
|
|
597
|
+
"start": 3846,
|
|
594
598
|
"name": "assert_constant"
|
|
595
599
|
},
|
|
596
600
|
{
|
|
597
|
-
"start":
|
|
601
|
+
"start": 4105,
|
|
598
602
|
"name": "static_assert"
|
|
599
603
|
},
|
|
600
604
|
{
|
|
601
|
-
"start":
|
|
605
|
+
"start": 4376,
|
|
602
606
|
"name": "as_witness"
|
|
603
607
|
}
|
|
604
608
|
]
|
|
605
609
|
},
|
|
606
|
-
"
|
|
610
|
+
"51": {
|
|
607
611
|
"source": "use mock_types::{\n AppPublicInputs, MEGA_VK_LENGTH_IN_FIELDS, PrivateKernelPublicInputs,\n PrivateKernelPublicInputsBuilder, PROOF_TYPE_HN, VerificationKey,\n};\n\nfn main(\n prev_kernel_public_inputs: call_data(0) PrivateKernelPublicInputs,\n kernel_vk: VerificationKey<MEGA_VK_LENGTH_IN_FIELDS>,\n app_inputs: call_data(1) AppPublicInputs,\n app_vk: VerificationKey<MEGA_VK_LENGTH_IN_FIELDS>,\n) -> return_data PrivateKernelPublicInputs {\n std::verify_proof_with_type(kernel_vk.key, [], [], kernel_vk.hash, PROOF_TYPE_HN);\n std::verify_proof_with_type(app_vk.key, [], [], app_vk.hash, PROOF_TYPE_HN);\n\n let mut private_kernel_inputs =\n PrivateKernelPublicInputsBuilder::from_previous_kernel(prev_kernel_public_inputs);\n private_kernel_inputs.ingest_app_inputs(app_inputs);\n private_kernel_inputs.finish()\n}\n",
|
|
608
|
-
"path": "/home/
|
|
612
|
+
"path": "/home/aztec-dev/aztec-packages-private/noir-projects/mock-protocol-circuits/crates/mock-private-kernel-inner/src/main.nr",
|
|
609
613
|
"function_locations": [
|
|
610
614
|
{
|
|
611
615
|
"start": 448,
|
|
@@ -613,177 +617,107 @@
|
|
|
613
617
|
}
|
|
614
618
|
]
|
|
615
619
|
},
|
|
616
|
-
"
|
|
617
|
-
"source": "pub global MAX_COMMITMENTS_PER_CALL: u32 = 2;\npub global MAX_COMMITMENTS_PER_TX: u32 = 4;\npub global MAX_COMMITMENT_READ_REQUESTS_PER_CALL: u32 = 2;\npub global MAX_COMMITMENT_READ_REQUESTS_PER_TX: u32 = 4;\n\npub use protocol_types::{\n abis::avm_circuit_public_inputs::AvmCircuitPublicInputs,\n constants::{\n
|
|
618
|
-
"path": "/home/
|
|
620
|
+
"52": {
|
|
621
|
+
"source": "pub global MAX_COMMITMENTS_PER_CALL: u32 = 2;\npub global MAX_COMMITMENTS_PER_TX: u32 = 4;\npub global MAX_COMMITMENT_READ_REQUESTS_PER_CALL: u32 = 2;\npub global MAX_COMMITMENT_READ_REQUESTS_PER_TX: u32 = 4;\n\npub use protocol_types::{\n abis::avm_circuit_public_inputs::AvmCircuitPublicInputs,\n constants::{\n AVM_V2_PROOF_LENGTH_IN_FIELDS, CHONK_PROOF_LENGTH, CHONK_VK_LENGTH_IN_FIELDS,\n MEGA_VK_LENGTH_IN_FIELDS, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, PROOF_TYPE_AVM,\n PROOF_TYPE_CHONK, PROOF_TYPE_HN, PROOF_TYPE_HN_FINAL, PROOF_TYPE_HN_TAIL, PROOF_TYPE_OINK,\n PROOF_TYPE_ROLLUP_HONK, PROOF_TYPE_ROOT_ROLLUP_HONK,\n },\n proof::{\n traits::SerializeToColumns,\n verification_key::{RollupHonkVerificationKey, VerificationKey},\n },\n traits::Serialize,\n};\n\npub struct TxRequest {\n pub number_of_calls: u32,\n}\n\npub struct AppPublicInputs {\n pub commitments: [Field; MAX_COMMITMENTS_PER_CALL],\n pub read_requests: [Field; MAX_COMMITMENT_READ_REQUESTS_PER_CALL],\n}\n\nimpl Default for AppPublicInputs {\n fn default() -> Self {\n Self {\n commitments: [0; MAX_COMMITMENTS_PER_CALL],\n read_requests: [0; MAX_COMMITMENT_READ_REQUESTS_PER_CALL],\n }\n }\n}\n\npub struct PrivateKernelPublicInputs {\n pub remaining_calls: u32,\n pub commitments: [Field; MAX_COMMITMENTS_PER_TX],\n pub read_requests: [Field; MAX_COMMITMENT_READ_REQUESTS_PER_TX],\n}\n\nimpl Default for PrivateKernelPublicInputs {\n fn default() -> Self {\n Self {\n remaining_calls: 0,\n commitments: [0; MAX_COMMITMENTS_PER_TX],\n read_requests: [0; MAX_COMMITMENT_READ_REQUESTS_PER_TX],\n }\n }\n}\n\npub struct PrivateKernelPublicInputsBuilder {\n pub remaining_calls: u32,\n pub commitments: BoundedVec<Field, MAX_COMMITMENTS_PER_TX>,\n pub read_requests: BoundedVec<Field, MAX_COMMITMENT_READ_REQUESTS_PER_TX>,\n}\n\nimpl PrivateKernelPublicInputsBuilder {\n pub fn from_tx(tx: TxRequest) -> Self {\n Self {\n remaining_calls: tx.number_of_calls,\n commitments: BoundedVec::new(),\n read_requests: BoundedVec::new(),\n }\n }\n\n pub fn from_previous_kernel(prev_kernel_public_inputs: PrivateKernelPublicInputs) -> Self {\n let mut builder = PrivateKernelPublicInputsBuilder {\n remaining_calls: prev_kernel_public_inputs.remaining_calls,\n commitments: BoundedVec::new(),\n read_requests: BoundedVec::new(),\n };\n for i in 0..MAX_COMMITMENTS_PER_TX {\n if prev_kernel_public_inputs.commitments[i] != 0 {\n builder.commitments.push(prev_kernel_public_inputs.commitments[i]);\n }\n }\n for i in 0..MAX_COMMITMENT_READ_REQUESTS_PER_TX {\n if prev_kernel_public_inputs.read_requests[i] != 0 {\n builder.read_requests.push(prev_kernel_public_inputs.read_requests[i]);\n }\n }\n builder\n }\n\n pub fn ingest_app_inputs(&mut self, app_inputs: AppPublicInputs) {\n for i in 0..MAX_COMMITMENTS_PER_CALL {\n if app_inputs.commitments[i] != 0 {\n self.commitments.push(app_inputs.commitments[i]);\n }\n }\n\n for i in 0..MAX_COMMITMENT_READ_REQUESTS_PER_CALL {\n if app_inputs.read_requests[i] != 0 {\n self.read_requests.push(app_inputs.read_requests[i]);\n }\n }\n\n self.remaining_calls -= 1;\n }\n\n pub fn finish(self) -> PrivateKernelPublicInputs {\n PrivateKernelPublicInputs {\n remaining_calls: self.remaining_calls,\n commitments: self.commitments.storage(),\n read_requests: self.read_requests.storage(),\n }\n }\n}\n\n#[derive(Serialize)]\npub struct KernelPublicInputs {\n pub commitments: [Field; MAX_COMMITMENTS_PER_TX],\n}\n\nimpl Default for KernelPublicInputs {\n fn default() -> Self {\n Self { commitments: [0; MAX_COMMITMENTS_PER_TX] }\n }\n}\n\n#[derive(Serialize)]\npub struct RollupPublicInputs {\n accumulated: u32,\n}\n\nimpl RollupPublicInputs {\n pub fn new(accumulated: u32) -> Self {\n Self { accumulated }\n }\n\n pub fn merge(self, other: Self) -> Self {\n Self { accumulated: self.accumulated + other.accumulated }\n }\n}\n\npub struct PreviousRollupData {\n base_or_merge_public_inputs: RollupPublicInputs,\n proof: [Field; NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH],\n vk: RollupHonkVerificationKey,\n}\n\nimpl PreviousRollupData {\n pub fn verify(self, is_root: bool) {\n let inputs = self.base_or_merge_public_inputs.serialize();\n\n std::verify_proof_with_type(\n self.vk.key,\n self.proof,\n inputs,\n self.vk.hash,\n if is_root {\n PROOF_TYPE_ROOT_ROLLUP_HONK\n } else {\n PROOF_TYPE_ROLLUP_HONK\n },\n );\n }\n\n pub fn public_inputs(self) -> RollupPublicInputs {\n self.base_or_merge_public_inputs\n }\n}\n\n// CHONK: \"Client Honk\" - An UltraHonk variant with incremental folding and delayed non-native arithmetic.\npub struct ChonkProofData {\n pub public_inputs: KernelPublicInputs,\n pub proof: [Field; CHONK_PROOF_LENGTH],\n pub vk_data: VerificationKey<CHONK_VK_LENGTH_IN_FIELDS>,\n}\n\nimpl ChonkProofData {\n pub fn verify(self) {\n let inputs = KernelPublicInputs::serialize(self.public_inputs);\n std::verify_proof_with_type(\n self.vk_data.key,\n self.proof,\n inputs,\n self.vk_data.hash,\n PROOF_TYPE_CHONK,\n );\n }\n}\n",
|
|
622
|
+
"path": "/home/aztec-dev/aztec-packages-private/noir-projects/mock-protocol-circuits/crates/mock-types/src/lib.nr",
|
|
619
623
|
"function_locations": [
|
|
620
624
|
{
|
|
621
|
-
"start":
|
|
625
|
+
"start": 1087,
|
|
622
626
|
"name": "<impl Default for AppPublicInputs>::default"
|
|
623
627
|
},
|
|
624
628
|
{
|
|
625
|
-
"start":
|
|
629
|
+
"start": 1515,
|
|
626
630
|
"name": "<impl Default for PrivateKernelPublicInputs>::default"
|
|
627
631
|
},
|
|
628
632
|
{
|
|
629
|
-
"start":
|
|
633
|
+
"start": 2010,
|
|
630
634
|
"name": "PrivateKernelPublicInputsBuilder::from_tx"
|
|
631
635
|
},
|
|
632
636
|
{
|
|
633
|
-
"start":
|
|
637
|
+
"start": 2277,
|
|
634
638
|
"name": "PrivateKernelPublicInputsBuilder::from_previous_kernel"
|
|
635
639
|
},
|
|
636
640
|
{
|
|
637
|
-
"start":
|
|
641
|
+
"start": 3056,
|
|
638
642
|
"name": "PrivateKernelPublicInputsBuilder::ingest_app_inputs"
|
|
639
643
|
},
|
|
640
644
|
{
|
|
641
|
-
"start":
|
|
645
|
+
"start": 3544,
|
|
642
646
|
"name": "PrivateKernelPublicInputsBuilder::finish"
|
|
643
647
|
},
|
|
644
648
|
{
|
|
645
|
-
"start":
|
|
649
|
+
"start": 3935,
|
|
646
650
|
"name": "<impl Default for KernelPublicInputs>::default"
|
|
647
651
|
},
|
|
648
652
|
{
|
|
649
|
-
"start":
|
|
653
|
+
"start": 4149,
|
|
650
654
|
"name": "RollupPublicInputs::new"
|
|
651
655
|
},
|
|
652
656
|
{
|
|
653
|
-
"start":
|
|
657
|
+
"start": 4231,
|
|
654
658
|
"name": "RollupPublicInputs::merge"
|
|
655
659
|
},
|
|
656
660
|
{
|
|
657
|
-
"start":
|
|
661
|
+
"start": 4560,
|
|
658
662
|
"name": "PreviousRollupData::verify"
|
|
659
663
|
},
|
|
660
664
|
{
|
|
661
|
-
"start":
|
|
665
|
+
"start": 4977,
|
|
662
666
|
"name": "PreviousRollupData::public_inputs"
|
|
663
667
|
},
|
|
664
668
|
{
|
|
665
|
-
"start":
|
|
669
|
+
"start": 5361,
|
|
666
670
|
"name": "ChonkProofData::verify"
|
|
667
671
|
}
|
|
668
672
|
]
|
|
669
673
|
}
|
|
670
674
|
},
|
|
671
675
|
"verificationKey": {
|
|
672
|
-
"bytes": "000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000134000000000000000000000000000000c1bfc3f99228ab8f515058d1fdb9851da0000000000000000000000000000000000000b9fbb3c86916c1eb9f3658d8836a0000000000000000000000000000009f18edf9b4520e4fbba3603e3aa34d6e9100000000000000000000000000000000001bb6e3087bf76ce385c98bca91d89b0000000000000000000000000000009f74236572ebf4db735927c82ac6c18561000000000000000000000000000000000026ea3c45875db17d84ca9ee3344bc4000000000000000000000000000000f56bef61e2402543959f741812b881c353000000000000000000000000000000000012b622a5d5dedc34f4dadac1db659a0000000000000000000000000000005dfcb033c5524045a4eb74c46a84643d4b000000000000000000000000000000000015777373445e54b18f0ae8b006a86600000000000000000000000000000043ff764e151ed1e229fd5d59b3b58306f500000000000000000000000000000000000d7237e793ee7febc3d10f635e2895000000000000000000000000000000eebc2b6c354d8f4522bf432883ebcb11aa0000000000000000000000000000000000100ce9adba5b21879454fea294513d000000000000000000000000000000d87100eb0c1e18f3a16a11b6c34f9a0260000000000000000000000000000000000019a30f6e3a66c016e0838b5d20e0e600000000000000000000000000000019b5a0de37b2409fc21106dc041eb5d31900000000000000000000000000000000001f4d6586c46ebd8afe5bf6b342b68f00000000000000000000000000000081d3c9082379d972b662193dd3cf3f851a0000000000000000000000000000000000089e11298cc4b087985ca5a31426b800000000000000000000000000000083814332545834490bcfc0dcf6a1160bdd00000000000000000000000000000000001d97617b52e183e74bc6c0aabe6f55000000000000000000000000000000bbda99ec9cac2f5af2f0256b956a81d447000000000000000000000000000000000002d2e918026825bcd3be325f044b410000000000000000000000000000005eb30cba0ed872fbc18d5305b1664c5fa100000000000000000000000000000000001dcf65e7fc72f15438e2fb1b6163730000000000000000000000000000003ef0c5ae5b7b3a86d4908880ce965d32c000000000000000000000000000000000002bc4a2b7826fcf286b8b57b994403f00000000000000000000000000000096b70d23bd8484acd596299257d04d2a9300000000000000000000000000000000002cb8d8bc22becb318d67ac624ae373000000000000000000000000000000751b314d663364358135a15e4cf2c5b67300000000000000000000000000000000000cd01903c998eb1745b6032234aa990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e296f109e422a04f5ae8ef38f4e7586cc400000000000000000000000000000000000cef03d0e7377bc7d4948e407a70d300000000000000000000000000000000740a216d83debac935eb3a26550b2d2a000000000000000000000000000000000025afa3c3698962ff83d4e059b8b27700000000000000000000000000000060eda24bec383b26077c7030ee8fefbc240000000000000000000000000000000000176e2130fd5493d044efb8f934d28d00000000000000000000000000000099df9d068635b4c819cfa7d76c55dd253200000000000000000000000000000000002601ebfb62658e1fc883d88f9613b700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff8b0833e610611c04bfaaf8052fc7219000000000000000000000000000000000018b31784c6926f2b615fb46fb2cfb600000000000000000000000000000038defb6638f0333282769b2f8d59b1cd120000000000000000000000000000000000146d4ab4e26cd552c0da693b5454ad00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008df4930108f1ef0867683a176e2ef45fff000000000000000000000000000000000027e7249785078a711d9744a4a571b4000000000000000000000000000000b01643d75e49abc1be292eea9b0f3ed79000000000000000000000000000000000002db138131737ece94deeb91644eaa6000000000000000000000000000000ddb3fb85b4c25d9c7f1c4664080ff47114000000000000000000000000000000000012b549314ecad780cae2770d27f09f0000000000000000000000000000006c3c06085bfdb5a544b1f945d6095ac5d900000000000000000000000000000000000ab2744c1e35f01d84d7d963bfd8f3000000000000000000000000000000c5f66632ff41e87c33df11f634dddd3f50000000000000000000000000000000000014b8a13d937cc4f5a3c8862349dd2d000000000000000000000000000000cdc00cac5b916e91f727ba2ffd3dbfe01f00000000000000000000000000000000000dfe945fc5f6ae08603001c827976d000000000000000000000000000000e69d645ee50d817fb6d2fa0602231a48ba00000000000000000000000000000000002e11b8bcf809cfe8016b9885276ad00000000000000000000000000000005686b52f9f3b36aff85966d1c59c9d8c61000000000000000000000000000000000023dea8b5b0364d28ecfba5d006b27a0000000000000000000000000000005dd1aae330b9bc4a7585bcd1affaf9edd000000000000000000000000000000000000f1f64dba0f60a0bc1aed51157860b0000000000000000000000000000001989bc89a9ee41fa26a8e42d8a5d6c8f750000000000000000000000000000000000084cb75daf819349bf8918db380c8b000000000000000000000000000000ceb0b0be655604e8f519d19e4615deb10200000000000000000000000000000000002d4bca54d2347262d417d01bd0912c00000000000000000000000000000021f1f4109a0361ec49dec9b15b4e36094300000000000000000000000000000000002d074bae191ccc206879c5f2add3a3000000000000000000000000000000036c74780bc3085667dd262e537005a3a2000000000000000000000000000000000012e926e012894e6b433b068bc32afd000000000000000000000000000000f96982b26e02e6f4ac2fe6fb6553c704fc000000000000000000000000000000000008f2e8936c0371bed47ed082baa151000000000000000000000000000000b918714708f33ea8f18debd8a93b58c8f100000000000000000000000000000000001a8e8e9aa9cbe42f99afe2bf51c91a000000000000000000000000000000a94f2cf884035c3538d07a1336148493f2000000000000000000000000000000000026ea297020ed03d941c8675f5bfb4f000000000000000000000000000000e949b82585cab6a7068e6a71dc87a4e8db00000000000000000000000000000000001be5c3c12a0c1743b02aabddd68f0a000000000000000000000000000000b225c1a08ae0082707c0c1049fac751df400000000000000000000000000000000001b3c7b20ed39ed4eb7be00fb6261e900000000000000000000000000000084218e7d356389ac6c3b4052f8c9547aa500000000000000000000000000000000000aa3c4d93becd1b193b23724f1712b000000000000000000000000000000abdfca0f9a31dff69ab9d46c1b1099054f0000000000000000000000000000000000185b61eb5c8cadd70417aa66d545750000000000000000000000000000008a33de55d71575d04c72f2dffd35730cf800000000000000000000000000000000000b3380442486626b41413b05f5d1200000000000000000000000000000006e61abaff1545dadcc290e1c9f6ade5caa0000000000000000000000000000000000272f35eb366e6c28ee95a3764ef452000000000000000000000000000000244150b1cf1972eb8507d51a6f91ccfaf300000000000000000000000000000000001235b0006b26d610cd60c6851acaf0000000000000000000000000000000cd6c527725510e01abf32d12be3c2b7da30000000000000000000000000000000000267e47ee020001f0be5ef3049c16b300000000000000000000000000000022c8c44af0184bc18ed8b253639eb1d734000000000000000000000000000000000016216a06a0d4d60694a7f14f04553b0000000000000000000000000000006a9f5bc9b72afbcdbbd9744cdfa92add0300000000000000000000000000000000000481428aa9107e8b5eed3a83fed9b900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f0733f98f24d358a8d033e6954305eaec3000000000000000000000000000000000000579347c0ce0b2a77c6ddf13e05cf000000000000000000000000000000c3bda77dbb2f86a555f2ee06528b67e1460000000000000000000000000000000000072c58e9d2f9a53acd126c62f1cd9000000000000000000000000000000008f6fc7849b8cdaeb4c5026f26b5066c0f00000000000000000000000000000000002c9886a67240f97195641b86902d3b0000000000000000000000000000002724cccc87443e8a635e56d2d54ab42732000000000000000000000000000000000010cc513427dabc91e3fda0df8fc6af00000000000000000000000000000014f0863f2eef8c90fa2ecd91e1e10b572c000000000000000000000000000000000017bd913cb2426b7f89ca0e2dd4e73d000000000000000000000000000000bc2c6d52ed3523bb441f7674e48465fa98000000000000000000000000000000000017bd63ba535af74d8a9188e022f432",
|
|
676
|
+
"bytes": "000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000013f00000000000000000000000000000024d1e1801531d24b57ea2c91d48d22a5a500000000000000000000000000000000002429005c6960f9a98cf27afee9fbcf000000000000000000000000000000e0af9117a4fcd484ae78a56b6b521b74cf000000000000000000000000000000000010d86ae0394d20537c4af89909de10000000000000000000000000000000c0cb6409f2b9f499545e8e752f7f833af000000000000000000000000000000000002dc5da40c501097af04d0cdda406430000000000000000000000000000005e805dd62bd47d56d5b9e88bc3878bef2e000000000000000000000000000000000010fc9b229bc160ee20a6c924e8bb2c0000000000000000000000000000003e6927719cd3c718f76d1082306496ecbd00000000000000000000000000000000000b1bbe48d4d26589772f242ff3b76900000000000000000000000000000091207efce4079d8c722224c4e439cdc85000000000000000000000000000000000001e74764eac68b65b3082c85bac719d000000000000000000000000000000594c9259b85e4f4e329893d459f717c64e0000000000000000000000000000000000234a3924bf862ade3206985a69ea6400000000000000000000000000000017227c6592b71ddadfdf2cafa560d42b7000000000000000000000000000000000000fc3141a80dfc7608c09d90d2c62870000000000000000000000000000002d2a60149ea300dcdb0bf2f4e7162697b5000000000000000000000000000000000024aaf21fa00c5285a0205b6015d8c2000000000000000000000000000000e541125fbb9bd4ef390d534b53dfdfd6c5000000000000000000000000000000000004c3c5cf039424a58bbd0e27c62b070000000000000000000000000000005655a242df78d0782a853ae635984ebdda00000000000000000000000000000000000d26ddcb0ff7d7a4f59a615180e56200000000000000000000000000000061eb3b0012f32b3da1b4142b945418810400000000000000000000000000000000000a50d067f43862fcdeeb14e52320ea000000000000000000000000000000c99d5c1a79a83ba7390e6bd579b092246800000000000000000000000000000000000673e9e9961bc8adc8a7763f4a111e000000000000000000000000000000c25766bf4ddf0df3d1a4aee52637390a4c000000000000000000000000000000000025c068f685ac3fdeefefcb496c1d67000000000000000000000000000000e5c6c4adb56938689e01d4d45310291c5a000000000000000000000000000000000002ceedcfb3595f12b05bb756eb4e640000000000000000000000000000001da5cf2edeaac6120fda4f72cdcef3b0b7000000000000000000000000000000000008df180fbd840fc6c95316ba0be369000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000059f7e400ccce8d7fae59bd6e568062231e00000000000000000000000000000000001a70c8f16e8957b9f4b02e13b71b0100000000000000000000000000000019c4ab8d2ad33cd7d5079fd13103e135f200000000000000000000000000000000001ca549236d4c72f3f2367ae908a030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a0e83722c055377e912a9da5f41023003000000000000000000000000000000000021e45895aa22a4de583f255ee204550000000000000000000000000000003eab8c7b5d061b8a3a7e6ca6a65da6b3a0000000000000000000000000000000000009f82b878a59fcd372e57bb9d1d97c0000000000000000000000000000002206ba5a13c57032d2ab7a97d4e6cc59bc0000000000000000000000000000000000013addf4a8df294df507863adfb6f90000000000000000000000000000004b7261d211da5f567e35fc932d736ea42700000000000000000000000000000000002a5e5476fcc9cca27ba15e4115649e000000000000000000000000000000d638f8d6ffe3fc66a2eadd92f319670b2000000000000000000000000000000000003037b55c6aa77a7c4ce2b5e6278387000000000000000000000000000000d046c9ae13f7648e3ba1e2214c021d8041000000000000000000000000000000000019ad0be73b12047c3c2fca278aa0af00000000000000000000000000000078b3411b0cdac91dedf720dd1247721172000000000000000000000000000000000025ed86e7011d1368c4fcc7bf10a3c700000000000000000000000000000038b98601d66377736799b28faff21edadc00000000000000000000000000000000001e5491d45b22e478abd8e621b4474200000000000000000000000000000038d26dfc2ea148caed6ed8169a68ee3cfe00000000000000000000000000000000001a56ef405d9ba4a91df8f39d0ef3b80000000000000000000000000000003fabce5c6a70e3523606a2d3a3de56698c000000000000000000000000000000000008dc9de46354e79e4f774481305e75000000000000000000000000000000794d0a367773e12c449471e940e17e8c690000000000000000000000000000000000096ec1ee332849549342f5e2e7097b000000000000000000000000000000ae0f4925cce2298ff2f6c5e05058c373bf000000000000000000000000000000000012e05df5dffb5e568c39dbf6762be20000000000000000000000000000008b48f930d2f65aae2df8869e1ffb60751900000000000000000000000000000000002daea80422d11b344721e866f2b14900000000000000000000000000000066fb89fba7044a0c013935cf45f28cbee5000000000000000000000000000000000011dec896c6159769ef3f200da5195b00000000000000000000000000000033681c2a0c2c399797bff720e3a9a3cf4900000000000000000000000000000000002965176b1c265fe23c85794349bb0f0000000000000000000000000000005631e89e34e21ec08584a2fee3b729271300000000000000000000000000000000001081e4125c1cb2a1e74ea38ac4016b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000055d5b0c3e895fd9b66f3cd763e725c8610000000000000000000000000000000000091c9778451573d3fed3afe9d3e1c2000000000000000000000000000000f9b079153c0e6b8011f0bd23e422db17f0000000000000000000000000000000000010d82a42685358a6105b2cb91d31850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bf771ab9a3a704991f143066e16a9bc5da00000000000000000000000000000000000cca071c79b180623a4f35d098d054000000000000000000000000000000c718e32e32be5d8051b76df3a9bec55fd1000000000000000000000000000000000022534c4e73066474b40c84318483d5000000000000000000000000000000cf9e541aa023711860bf68036174ad3b5f00000000000000000000000000000000002e0cd0472f58df8aa5b7d7aa2db52400000000000000000000000000000021a5f4544a0521c53cecd425063ef4005700000000000000000000000000000000000e5b2d2e7c8d18fe7003a0fc303db100000000000000000000000000000077aaf83a294a391c272a998b993b3fb72600000000000000000000000000000000001ef5fc7f99c80e746c5ebc02d079f50000000000000000000000000000006547e28fb2db0b99ed0531152efecc343100000000000000000000000000000000001068f5dcffbed813c829fe71235c2600000000000000000000000000000014f0863f2eef8c90fa2ecd91e1e10b572c000000000000000000000000000000000017bd913cb2426b7f89ca0e2dd4e73d000000000000000000000000000000bc2c6d52ed3523bb441f7674e48465fa98000000000000000000000000000000000017bd63ba535af74d8a9188e022f43200000000000000000000000000000028edd1a7e46c840d9c943fdf45521c64ce0000000000000000000000000000000000043d063b130adfb37342af45d0155a0000000000000000000000000000009330952ae74c573d1686d9cb4a007338540000000000000000000000000000000000261522c4089330646aff96736194940000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000077aaf83a294a391c272a998b993b3fb72600000000000000000000000000000000001ef5fc7f99c80e746c5ebc02d079f50000000000000000000000000000006547e28fb2db0b99ed0531152efecc343100000000000000000000000000000000001068f5dcffbed813c829fe71235c26000000000000000000000000000000ea9cbfb89c58f9d7ca8b4be7c96229ca0700000000000000000000000000000000001ea949e8bb570036e2dd43abda8174000000000000000000000000000000cda4426b108fe5e62619feb285e1e3e84f0000000000000000000000000000000000210bd66b57e9ea7643f36b1e2ba4bf000000000000000000000000000000f09c8092e8870cbcc87d724e315800b3ad00000000000000000000000000000000001bcfd31636242f5c8baa159aab84de0000000000000000000000000000009bd900dc9f66a2d8ac3188cfb9ffb7411a000000000000000000000000000000000021a537eef8bd35970db0a841f2ce2a000000000000000000000000000000bfc0b82fe62223bda294cefddbc89c1f200000000000000000000000000000000000038b26d9d91c5075a2952f41e7495100000000000000000000000000000060cd45e42faf697278e44f34c51b39e62000000000000000000000000000000000000d3709dcf438c4b0a1421c141d9e1c00000000000000000000000000000055dc25f7d9de2bad6b26bbef1ae81380620000000000000000000000000000000000291831411a84551fc455f5effa2af900000000000000000000000000000004842c8749c7363fd7883e40a9e0064f880000000000000000000000000000000000049bc86057a3654e0ea78a2e243d9a0000000000000000000000000000004719b1887d9972887d3981f58a34e6293c000000000000000000000000000000000015f4baa590230a717cb2550e7527c90000000000000000000000000000007fc7806a57c42672f1f7779a354ee754e700000000000000000000000000000000000bdcb647cd244060bc79f7832bcac600000000000000000000000000000098d518e80e8fec85a359d08fd161af85740000000000000000000000000000000000167792de7b2a0830838cc51c08fb2c0000000000000000000000000000005b352c5de04bef5a85efcf7a98fa4bd8c500000000000000000000000000000000000a6b65ab8c37a98706734709851cf8",
|
|
673
677
|
"fields": [
|
|
674
678
|
"0x000000000000000000000000000000000000000000000000000000000000000f",
|
|
675
679
|
"0x000000000000000000000000000000000000000000000000000000000000001a",
|
|
676
|
-
"
|
|
677
|
-
"
|
|
678
|
-
"
|
|
679
|
-
"
|
|
680
|
-
"
|
|
681
|
-
"
|
|
682
|
-
"
|
|
683
|
-
"
|
|
684
|
-
"
|
|
685
|
-
"
|
|
686
|
-
"
|
|
687
|
-
"
|
|
688
|
-
"
|
|
689
|
-
"
|
|
690
|
-
"
|
|
691
|
-
"
|
|
692
|
-
"
|
|
693
|
-
"
|
|
694
|
-
"
|
|
695
|
-
"
|
|
696
|
-
"
|
|
697
|
-
"
|
|
698
|
-
"
|
|
699
|
-
"
|
|
700
|
-
"
|
|
701
|
-
"
|
|
702
|
-
"
|
|
703
|
-
"
|
|
704
|
-
"
|
|
705
|
-
"
|
|
706
|
-
"
|
|
707
|
-
"
|
|
708
|
-
"
|
|
709
|
-
"
|
|
710
|
-
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
711
|
-
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
712
|
-
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
713
|
-
"0x000000000000000000000000000000e296f109e422a04f5ae8ef38f4e7586cc4",
|
|
714
|
-
"0x00000000000000000000000000000000000cef03d0e7377bc7d4948e407a70d3",
|
|
715
|
-
"0x00000000000000000000000000000000740a216d83debac935eb3a26550b2d2a",
|
|
716
|
-
"0x000000000000000000000000000000000025afa3c3698962ff83d4e059b8b277",
|
|
717
|
-
"0x00000000000000000000000000000060eda24bec383b26077c7030ee8fefbc24",
|
|
718
|
-
"0x0000000000000000000000000000000000176e2130fd5493d044efb8f934d28d",
|
|
719
|
-
"0x00000000000000000000000000000099df9d068635b4c819cfa7d76c55dd2532",
|
|
720
|
-
"0x00000000000000000000000000000000002601ebfb62658e1fc883d88f9613b7",
|
|
721
|
-
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
722
|
-
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
723
|
-
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
724
|
-
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
725
|
-
"0x0000000000000000000000000000000ff8b0833e610611c04bfaaf8052fc7219",
|
|
726
|
-
"0x000000000000000000000000000000000018b31784c6926f2b615fb46fb2cfb6",
|
|
727
|
-
"0x00000000000000000000000000000038defb6638f0333282769b2f8d59b1cd12",
|
|
728
|
-
"0x0000000000000000000000000000000000146d4ab4e26cd552c0da693b5454ad",
|
|
729
|
-
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
730
|
-
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
731
|
-
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
732
|
-
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
733
|
-
"0x0000000000000000000000000000008df4930108f1ef0867683a176e2ef45fff",
|
|
734
|
-
"0x000000000000000000000000000000000027e7249785078a711d9744a4a571b4",
|
|
735
|
-
"0x000000000000000000000000000000b01643d75e49abc1be292eea9b0f3ed790",
|
|
736
|
-
"0x00000000000000000000000000000000002db138131737ece94deeb91644eaa6",
|
|
737
|
-
"0x000000000000000000000000000000ddb3fb85b4c25d9c7f1c4664080ff47114",
|
|
738
|
-
"0x000000000000000000000000000000000012b549314ecad780cae2770d27f09f",
|
|
739
|
-
"0x0000000000000000000000000000006c3c06085bfdb5a544b1f945d6095ac5d9",
|
|
740
|
-
"0x00000000000000000000000000000000000ab2744c1e35f01d84d7d963bfd8f3",
|
|
741
|
-
"0x000000000000000000000000000000c5f66632ff41e87c33df11f634dddd3f50",
|
|
742
|
-
"0x000000000000000000000000000000000014b8a13d937cc4f5a3c8862349dd2d",
|
|
743
|
-
"0x000000000000000000000000000000cdc00cac5b916e91f727ba2ffd3dbfe01f",
|
|
744
|
-
"0x00000000000000000000000000000000000dfe945fc5f6ae08603001c827976d",
|
|
745
|
-
"0x000000000000000000000000000000e69d645ee50d817fb6d2fa0602231a48ba",
|
|
746
|
-
"0x00000000000000000000000000000000002e11b8bcf809cfe8016b9885276ad0",
|
|
747
|
-
"0x0000000000000000000000000000005686b52f9f3b36aff85966d1c59c9d8c61",
|
|
748
|
-
"0x000000000000000000000000000000000023dea8b5b0364d28ecfba5d006b27a",
|
|
749
|
-
"0x0000000000000000000000000000005dd1aae330b9bc4a7585bcd1affaf9edd0",
|
|
750
|
-
"0x00000000000000000000000000000000000f1f64dba0f60a0bc1aed51157860b",
|
|
751
|
-
"0x0000000000000000000000000000001989bc89a9ee41fa26a8e42d8a5d6c8f75",
|
|
752
|
-
"0x0000000000000000000000000000000000084cb75daf819349bf8918db380c8b",
|
|
753
|
-
"0x000000000000000000000000000000ceb0b0be655604e8f519d19e4615deb102",
|
|
754
|
-
"0x00000000000000000000000000000000002d4bca54d2347262d417d01bd0912c",
|
|
755
|
-
"0x00000000000000000000000000000021f1f4109a0361ec49dec9b15b4e360943",
|
|
756
|
-
"0x00000000000000000000000000000000002d074bae191ccc206879c5f2add3a3",
|
|
757
|
-
"0x000000000000000000000000000000036c74780bc3085667dd262e537005a3a2",
|
|
758
|
-
"0x000000000000000000000000000000000012e926e012894e6b433b068bc32afd",
|
|
759
|
-
"0x000000000000000000000000000000f96982b26e02e6f4ac2fe6fb6553c704fc",
|
|
760
|
-
"0x000000000000000000000000000000000008f2e8936c0371bed47ed082baa151",
|
|
761
|
-
"0x000000000000000000000000000000b918714708f33ea8f18debd8a93b58c8f1",
|
|
762
|
-
"0x00000000000000000000000000000000001a8e8e9aa9cbe42f99afe2bf51c91a",
|
|
763
|
-
"0x000000000000000000000000000000a94f2cf884035c3538d07a1336148493f2",
|
|
764
|
-
"0x000000000000000000000000000000000026ea297020ed03d941c8675f5bfb4f",
|
|
765
|
-
"0x000000000000000000000000000000e949b82585cab6a7068e6a71dc87a4e8db",
|
|
766
|
-
"0x00000000000000000000000000000000001be5c3c12a0c1743b02aabddd68f0a",
|
|
767
|
-
"0x000000000000000000000000000000b225c1a08ae0082707c0c1049fac751df4",
|
|
768
|
-
"0x00000000000000000000000000000000001b3c7b20ed39ed4eb7be00fb6261e9",
|
|
769
|
-
"0x00000000000000000000000000000084218e7d356389ac6c3b4052f8c9547aa5",
|
|
770
|
-
"0x00000000000000000000000000000000000aa3c4d93becd1b193b23724f1712b",
|
|
771
|
-
"0x000000000000000000000000000000abdfca0f9a31dff69ab9d46c1b1099054f",
|
|
772
|
-
"0x0000000000000000000000000000000000185b61eb5c8cadd70417aa66d54575",
|
|
773
|
-
"0x0000000000000000000000000000008a33de55d71575d04c72f2dffd35730cf8",
|
|
774
|
-
"0x00000000000000000000000000000000000b3380442486626b41413b05f5d120",
|
|
775
|
-
"0x0000000000000000000000000000006e61abaff1545dadcc290e1c9f6ade5caa",
|
|
776
|
-
"0x0000000000000000000000000000000000272f35eb366e6c28ee95a3764ef452",
|
|
777
|
-
"0x000000000000000000000000000000244150b1cf1972eb8507d51a6f91ccfaf3",
|
|
778
|
-
"0x00000000000000000000000000000000001235b0006b26d610cd60c6851acaf0",
|
|
779
|
-
"0x000000000000000000000000000000cd6c527725510e01abf32d12be3c2b7da3",
|
|
780
|
-
"0x0000000000000000000000000000000000267e47ee020001f0be5ef3049c16b3",
|
|
781
|
-
"0x00000000000000000000000000000022c8c44af0184bc18ed8b253639eb1d734",
|
|
782
|
-
"0x000000000000000000000000000000000016216a06a0d4d60694a7f14f04553b",
|
|
783
|
-
"0x0000000000000000000000000000006a9f5bc9b72afbcdbbd9744cdfa92add03",
|
|
784
|
-
"0x00000000000000000000000000000000000481428aa9107e8b5eed3a83fed9b9",
|
|
680
|
+
"0x000000000000000000000000000000000000000000000000000000000000013f",
|
|
681
|
+
"0x00000000000000000000000000000024d1e1801531d24b57ea2c91d48d22a5a5",
|
|
682
|
+
"0x00000000000000000000000000000000002429005c6960f9a98cf27afee9fbcf",
|
|
683
|
+
"0x000000000000000000000000000000e0af9117a4fcd484ae78a56b6b521b74cf",
|
|
684
|
+
"0x000000000000000000000000000000000010d86ae0394d20537c4af89909de10",
|
|
685
|
+
"0x000000000000000000000000000000c0cb6409f2b9f499545e8e752f7f833af0",
|
|
686
|
+
"0x00000000000000000000000000000000002dc5da40c501097af04d0cdda40643",
|
|
687
|
+
"0x0000000000000000000000000000005e805dd62bd47d56d5b9e88bc3878bef2e",
|
|
688
|
+
"0x000000000000000000000000000000000010fc9b229bc160ee20a6c924e8bb2c",
|
|
689
|
+
"0x0000000000000000000000000000003e6927719cd3c718f76d1082306496ecbd",
|
|
690
|
+
"0x00000000000000000000000000000000000b1bbe48d4d26589772f242ff3b769",
|
|
691
|
+
"0x00000000000000000000000000000091207efce4079d8c722224c4e439cdc850",
|
|
692
|
+
"0x00000000000000000000000000000000001e74764eac68b65b3082c85bac719d",
|
|
693
|
+
"0x000000000000000000000000000000594c9259b85e4f4e329893d459f717c64e",
|
|
694
|
+
"0x0000000000000000000000000000000000234a3924bf862ade3206985a69ea64",
|
|
695
|
+
"0x00000000000000000000000000000017227c6592b71ddadfdf2cafa560d42b70",
|
|
696
|
+
"0x00000000000000000000000000000000000fc3141a80dfc7608c09d90d2c6287",
|
|
697
|
+
"0x0000000000000000000000000000002d2a60149ea300dcdb0bf2f4e7162697b5",
|
|
698
|
+
"0x000000000000000000000000000000000024aaf21fa00c5285a0205b6015d8c2",
|
|
699
|
+
"0x000000000000000000000000000000e541125fbb9bd4ef390d534b53dfdfd6c5",
|
|
700
|
+
"0x000000000000000000000000000000000004c3c5cf039424a58bbd0e27c62b07",
|
|
701
|
+
"0x0000000000000000000000000000005655a242df78d0782a853ae635984ebdda",
|
|
702
|
+
"0x00000000000000000000000000000000000d26ddcb0ff7d7a4f59a615180e562",
|
|
703
|
+
"0x00000000000000000000000000000061eb3b0012f32b3da1b4142b9454188104",
|
|
704
|
+
"0x00000000000000000000000000000000000a50d067f43862fcdeeb14e52320ea",
|
|
705
|
+
"0x000000000000000000000000000000c99d5c1a79a83ba7390e6bd579b0922468",
|
|
706
|
+
"0x00000000000000000000000000000000000673e9e9961bc8adc8a7763f4a111e",
|
|
707
|
+
"0x000000000000000000000000000000c25766bf4ddf0df3d1a4aee52637390a4c",
|
|
708
|
+
"0x000000000000000000000000000000000025c068f685ac3fdeefefcb496c1d67",
|
|
709
|
+
"0x000000000000000000000000000000e5c6c4adb56938689e01d4d45310291c5a",
|
|
710
|
+
"0x000000000000000000000000000000000002ceedcfb3595f12b05bb756eb4e64",
|
|
711
|
+
"0x0000000000000000000000000000001da5cf2edeaac6120fda4f72cdcef3b0b7",
|
|
712
|
+
"0x000000000000000000000000000000000008df180fbd840fc6c95316ba0be369",
|
|
713
|
+
"0x0000000000000000000000000000000000000000000000000000000000000001",
|
|
785
714
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
715
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002",
|
|
786
716
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
717
|
+
"0x00000000000000000000000000000059f7e400ccce8d7fae59bd6e568062231e",
|
|
718
|
+
"0x00000000000000000000000000000000001a70c8f16e8957b9f4b02e13b71b01",
|
|
719
|
+
"0x00000000000000000000000000000019c4ab8d2ad33cd7d5079fd13103e135f2",
|
|
720
|
+
"0x00000000000000000000000000000000001ca549236d4c72f3f2367ae908a030",
|
|
787
721
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
788
722
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
789
723
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
@@ -798,24 +732,114 @@
|
|
|
798
732
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
799
733
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
800
734
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
801
|
-
"0x0000000000000000000000000000000000000000000000000000000000000001",
|
|
802
735
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
803
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002",
|
|
804
736
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
805
|
-
"
|
|
806
|
-
"
|
|
807
|
-
"
|
|
808
|
-
"
|
|
809
|
-
"
|
|
810
|
-
"
|
|
811
|
-
"
|
|
812
|
-
"
|
|
737
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
738
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
739
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
740
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
741
|
+
"0x0000000000000000000000000000008a0e83722c055377e912a9da5f41023003",
|
|
742
|
+
"0x000000000000000000000000000000000021e45895aa22a4de583f255ee20455",
|
|
743
|
+
"0x0000000000000000000000000000003eab8c7b5d061b8a3a7e6ca6a65da6b3a0",
|
|
744
|
+
"0x000000000000000000000000000000000009f82b878a59fcd372e57bb9d1d97c",
|
|
745
|
+
"0x0000000000000000000000000000002206ba5a13c57032d2ab7a97d4e6cc59bc",
|
|
746
|
+
"0x0000000000000000000000000000000000013addf4a8df294df507863adfb6f9",
|
|
747
|
+
"0x0000000000000000000000000000004b7261d211da5f567e35fc932d736ea427",
|
|
748
|
+
"0x00000000000000000000000000000000002a5e5476fcc9cca27ba15e4115649e",
|
|
749
|
+
"0x000000000000000000000000000000d638f8d6ffe3fc66a2eadd92f319670b20",
|
|
750
|
+
"0x00000000000000000000000000000000003037b55c6aa77a7c4ce2b5e6278387",
|
|
751
|
+
"0x000000000000000000000000000000d046c9ae13f7648e3ba1e2214c021d8041",
|
|
752
|
+
"0x000000000000000000000000000000000019ad0be73b12047c3c2fca278aa0af",
|
|
753
|
+
"0x00000000000000000000000000000078b3411b0cdac91dedf720dd1247721172",
|
|
754
|
+
"0x000000000000000000000000000000000025ed86e7011d1368c4fcc7bf10a3c7",
|
|
755
|
+
"0x00000000000000000000000000000038b98601d66377736799b28faff21edadc",
|
|
756
|
+
"0x00000000000000000000000000000000001e5491d45b22e478abd8e621b44742",
|
|
757
|
+
"0x00000000000000000000000000000038d26dfc2ea148caed6ed8169a68ee3cfe",
|
|
758
|
+
"0x00000000000000000000000000000000001a56ef405d9ba4a91df8f39d0ef3b8",
|
|
759
|
+
"0x0000000000000000000000000000003fabce5c6a70e3523606a2d3a3de56698c",
|
|
760
|
+
"0x000000000000000000000000000000000008dc9de46354e79e4f774481305e75",
|
|
761
|
+
"0x000000000000000000000000000000794d0a367773e12c449471e940e17e8c69",
|
|
762
|
+
"0x0000000000000000000000000000000000096ec1ee332849549342f5e2e7097b",
|
|
763
|
+
"0x000000000000000000000000000000ae0f4925cce2298ff2f6c5e05058c373bf",
|
|
764
|
+
"0x000000000000000000000000000000000012e05df5dffb5e568c39dbf6762be2",
|
|
765
|
+
"0x0000000000000000000000000000008b48f930d2f65aae2df8869e1ffb607519",
|
|
766
|
+
"0x00000000000000000000000000000000002daea80422d11b344721e866f2b149",
|
|
767
|
+
"0x00000000000000000000000000000066fb89fba7044a0c013935cf45f28cbee5",
|
|
768
|
+
"0x000000000000000000000000000000000011dec896c6159769ef3f200da5195b",
|
|
769
|
+
"0x00000000000000000000000000000033681c2a0c2c399797bff720e3a9a3cf49",
|
|
770
|
+
"0x00000000000000000000000000000000002965176b1c265fe23c85794349bb0f",
|
|
771
|
+
"0x0000000000000000000000000000005631e89e34e21ec08584a2fee3b7292713",
|
|
772
|
+
"0x00000000000000000000000000000000001081e4125c1cb2a1e74ea38ac4016b",
|
|
773
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
774
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
775
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
776
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
777
|
+
"0x000000000000000000000000000000055d5b0c3e895fd9b66f3cd763e725c861",
|
|
778
|
+
"0x0000000000000000000000000000000000091c9778451573d3fed3afe9d3e1c2",
|
|
779
|
+
"0x000000000000000000000000000000f9b079153c0e6b8011f0bd23e422db17f0",
|
|
780
|
+
"0x000000000000000000000000000000000010d82a42685358a6105b2cb91d3185",
|
|
781
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
782
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
783
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
784
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
785
|
+
"0x000000000000000000000000000000bf771ab9a3a704991f143066e16a9bc5da",
|
|
786
|
+
"0x00000000000000000000000000000000000cca071c79b180623a4f35d098d054",
|
|
787
|
+
"0x000000000000000000000000000000c718e32e32be5d8051b76df3a9bec55fd1",
|
|
788
|
+
"0x000000000000000000000000000000000022534c4e73066474b40c84318483d5",
|
|
789
|
+
"0x000000000000000000000000000000cf9e541aa023711860bf68036174ad3b5f",
|
|
790
|
+
"0x00000000000000000000000000000000002e0cd0472f58df8aa5b7d7aa2db524",
|
|
791
|
+
"0x00000000000000000000000000000021a5f4544a0521c53cecd425063ef40057",
|
|
792
|
+
"0x00000000000000000000000000000000000e5b2d2e7c8d18fe7003a0fc303db1",
|
|
793
|
+
"0x00000000000000000000000000000077aaf83a294a391c272a998b993b3fb726",
|
|
794
|
+
"0x00000000000000000000000000000000001ef5fc7f99c80e746c5ebc02d079f5",
|
|
795
|
+
"0x0000000000000000000000000000006547e28fb2db0b99ed0531152efecc3431",
|
|
796
|
+
"0x00000000000000000000000000000000001068f5dcffbed813c829fe71235c26",
|
|
813
797
|
"0x00000000000000000000000000000014f0863f2eef8c90fa2ecd91e1e10b572c",
|
|
814
798
|
"0x000000000000000000000000000000000017bd913cb2426b7f89ca0e2dd4e73d",
|
|
815
799
|
"0x000000000000000000000000000000bc2c6d52ed3523bb441f7674e48465fa98",
|
|
816
|
-
"0x000000000000000000000000000000000017bd63ba535af74d8a9188e022f432"
|
|
800
|
+
"0x000000000000000000000000000000000017bd63ba535af74d8a9188e022f432",
|
|
801
|
+
"0x00000000000000000000000000000028edd1a7e46c840d9c943fdf45521c64ce",
|
|
802
|
+
"0x0000000000000000000000000000000000043d063b130adfb37342af45d0155a",
|
|
803
|
+
"0x0000000000000000000000000000009330952ae74c573d1686d9cb4a00733854",
|
|
804
|
+
"0x0000000000000000000000000000000000261522c4089330646aff9673619494",
|
|
805
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
806
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
807
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
808
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
809
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
810
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
811
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
812
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
813
|
+
"0x00000000000000000000000000000077aaf83a294a391c272a998b993b3fb726",
|
|
814
|
+
"0x00000000000000000000000000000000001ef5fc7f99c80e746c5ebc02d079f5",
|
|
815
|
+
"0x0000000000000000000000000000006547e28fb2db0b99ed0531152efecc3431",
|
|
816
|
+
"0x00000000000000000000000000000000001068f5dcffbed813c829fe71235c26",
|
|
817
|
+
"0x000000000000000000000000000000ea9cbfb89c58f9d7ca8b4be7c96229ca07",
|
|
818
|
+
"0x00000000000000000000000000000000001ea949e8bb570036e2dd43abda8174",
|
|
819
|
+
"0x000000000000000000000000000000cda4426b108fe5e62619feb285e1e3e84f",
|
|
820
|
+
"0x0000000000000000000000000000000000210bd66b57e9ea7643f36b1e2ba4bf",
|
|
821
|
+
"0x000000000000000000000000000000f09c8092e8870cbcc87d724e315800b3ad",
|
|
822
|
+
"0x00000000000000000000000000000000001bcfd31636242f5c8baa159aab84de",
|
|
823
|
+
"0x0000000000000000000000000000009bd900dc9f66a2d8ac3188cfb9ffb7411a",
|
|
824
|
+
"0x000000000000000000000000000000000021a537eef8bd35970db0a841f2ce2a",
|
|
825
|
+
"0x000000000000000000000000000000bfc0b82fe62223bda294cefddbc89c1f20",
|
|
826
|
+
"0x0000000000000000000000000000000000038b26d9d91c5075a2952f41e74951",
|
|
827
|
+
"0x00000000000000000000000000000060cd45e42faf697278e44f34c51b39e620",
|
|
828
|
+
"0x00000000000000000000000000000000000d3709dcf438c4b0a1421c141d9e1c",
|
|
829
|
+
"0x00000000000000000000000000000055dc25f7d9de2bad6b26bbef1ae8138062",
|
|
830
|
+
"0x0000000000000000000000000000000000291831411a84551fc455f5effa2af9",
|
|
831
|
+
"0x00000000000000000000000000000004842c8749c7363fd7883e40a9e0064f88",
|
|
832
|
+
"0x0000000000000000000000000000000000049bc86057a3654e0ea78a2e243d9a",
|
|
833
|
+
"0x0000000000000000000000000000004719b1887d9972887d3981f58a34e6293c",
|
|
834
|
+
"0x000000000000000000000000000000000015f4baa590230a717cb2550e7527c9",
|
|
835
|
+
"0x0000000000000000000000000000007fc7806a57c42672f1f7779a354ee754e7",
|
|
836
|
+
"0x00000000000000000000000000000000000bdcb647cd244060bc79f7832bcac6",
|
|
837
|
+
"0x00000000000000000000000000000098d518e80e8fec85a359d08fd161af8574",
|
|
838
|
+
"0x0000000000000000000000000000000000167792de7b2a0830838cc51c08fb2c",
|
|
839
|
+
"0x0000000000000000000000000000005b352c5de04bef5a85efcf7a98fa4bd8c5",
|
|
840
|
+
"0x00000000000000000000000000000000000a6b65ab8c37a98706734709851cf8"
|
|
817
841
|
],
|
|
818
842
|
"hash": ""
|
|
819
843
|
},
|
|
820
|
-
"aztec_version": "5.0.
|
|
844
|
+
"aztec_version": "5.0.1"
|
|
821
845
|
}
|