@aztec/protocol-contracts 0.55.0 → 0.55.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/AuthRegistry.json +1 -1
- package/artifacts/ContractClassRegisterer.json +1 -1
- package/artifacts/ContractInstanceDeployer.json +1 -1
- package/artifacts/FeeJuice.json +1 -1
- package/artifacts/KeyRegistry.json +1 -1
- package/artifacts/MultiCallEntrypoint.json +1 -1
- package/artifacts/Router.json +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"transpiled":true,"noir_version":"0.33.0+cb20e078dd909656110d133339b2b425e6c3ebb0","name":"KeyRegistry","functions":[{"name":"register_initial_keys","is_unconstrained":true,"custom_attributes":["aztec(public)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"account","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"partial_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::partial_address::PartialAddress"},"visibility":"private"},{"name":"keys","type":{"fields":[{"name":"npk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::NpkM"}},{"name":"ivpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::IvpkM"}},{"name":"ovpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::OvpkM"}},{"name":"tpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::TpkM"}}],"kind":"struct","path":"aztec::keys::public_keys::PublicKeys"},"visibility":"private"}],"return_type":null},"bytecode":"H4sIAAAAAAAC/5VYTYg0Rxl+u6q7t3d3dvZnenpmeqenp6e7Z2Z3+0u+aOhVwUNIzI/5YswXvIheBD1oUDwJHjx5EcVDCEiQIBIFbwYJBPSWY0AQQ5DgwZNHTyqiYPB5qrprV7P7gQvV+1bV+1dvvfXUW3NXtKceER29KHJX9NEIH4nPBH8x2kgkejyTMHoieuIF9KMnbBOF5nHimegZM/GMbVcT96J7ZuKebVcTz0fPm4nnbbuauB/dNxP3bbMTl3BA9CWt+vh+SgJ8n5QQ36dkB9+nJbqk6V18Py17+D4r+5e0OcD3OTnA9zMyvKSxQ3w/K0f4viDHl7Ry8hCMFE/S7ItcNJbvjVuzeC1jaZWOOaT7IY0h3wz5/ZAPIU/8fvwa610JRVNFIt5uPJcwjl/oIxv3C9yTcEePffHicQI6MnQypsxgDJnx2MiMu9bL7OkEfONkAnrfyEzGHImTMSQPE0gmiZFMutZLHuiYFmJKDg09iTtdkDx5gORR7xvoY91Zs5ZN3PDxJ49i0fbvQPo/BkamCJM3Q0weTdEdnOKj53fEe0mSRr4Aq7s0PcjwOVzgc5JTaYFwLhnOwuzNCt2C3ZXpluiu2C1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Gp12a+DOBu0/f+g7PtjIHQivX4VsW28rcAqNksyeyxRTZ8bTDtjK7wCrb5optd8S2B1tWK7G1ZbYSW3LFNrliy8bYjt6L1YOtKCWxtZalxmytZakxW2tZaszWWpYaso3WstSYreEs9YStqywVXWWpaC1Ljdlay1Jjtp76Uj166kv16Kkv1aOrvhS56kuRq74UucpS5CpLkat0Qa7SBblKF+QqXaQjHGi+CSTQHf4XtldMBIgpAWJiQEwZEFMBxFQBMTVATB0PEwdATIB1nAHrOAPWcQas4wxYxxmwjvMRdXzb235jmMJl5P4YALnBE6DIt+WUaEGgKyeQg3YCUTsBwifA88vDy+JLnDM8AZ7fqsVteQSKdgL4PiAQwPeBEqYvcUlxQQDfB8YECr4PCATwfUAggO8DAoGknQBrJ4DvxAIBfCcWCOA7sUBAuxMXBU48Ly91cdNfVeDEYwIKnHhMQIETjwkocOIxAQVOPCaAX0ZTn5ZzfLMjWy4ePUzeG/73fQtX4Zp1wy8Oe7LFrySb2I7b0Q2/7OzJFn+3sCdb/K3Fnmzx9yF7srXlthJb/B3Ojmw7/nZoT7bGspTA1liWEti6ylKHTF06jq2rLNVdZanuKkt1V1mqe8pSl3/ED1NM01B25rhkgB+QJAb4oUdigB9kJAasnoGCm64EBgruuhIYKL/t6sIA3+wlBvgGLjCIYI72CgrMpF5BgfnOKygwK3kFZWvLMrr8eCFra8cyHHl8+W22OoQSW1sdQomtsQ7h8Nry5V/xU/iudI31CCW6xpqEEl1jXUKJrrE2oUTXWJ9QoJuMXXSV6Fq7g200Q/VC19otbAJda6lKoMu+6FpLVQJda6lKoGstVQl0DaeqZ3R9pSr2larY03MBF7qeHgy40PXVqzpkTNKBdH31qthXr0rB3Khd6frqVSmYSbUnXQUTrHal6ytmZF8xI7Mvun5ixpfL3/77/tcP73/6+PNvl595+cf/fPr75w+/fPrjr5//9+/Xf7ks/j8=","brillig_names":["register_initial_keys"],"assert_messages":{"832":"attempt to add with overflow","320":"attempt to add with overflow","756":"Array index out of bounds","622":"attempt to add with overflow","686":"attempt to add with overflow","875":"Array index out of bounds","1055":"attempt to add with overflow","348":"Array index out of bounds","601":"Array index out of bounds","278":"attempt to add with overflow","915":"Array index out of bounds","214":"attempt to add with overflow","1034":"Array index out of bounds","193":"Array index out of bounds","449":"Computed address does not match supplied address","769":"attempt to add with overflow","961":"Array index out of bounds","824":"Array index out of bounds","943":"Array index out of bounds","748":"Array index out of bounds","361":"attempt to add with overflow","675":"Array index out of bounds","928":"attempt to add with overflow","340":"Array index out of bounds","593":"Array index out of bounds","657":"Array index out of bounds","907":"Array index out of bounds","267":"Array index out of bounds","1026":"Array index out of bounds","249":"Array index out of bounds","886":"attempt to add with overflow","1014":"attempt to add with overflow","185":"Array index out of bounds","868":"Array index out of bounds","740":"Array index out of bounds","609":"Array index out of bounds","728":"attempt to add with overflow","1042":"Array index out of bounds","466":"Storage slot 0 not allowed. Storage slots must start from 1.","972":"attempt to add with overflow","332":"Array index out of bounds","201":"Array index out of bounds","899":"Array index out of bounds"}},{"name":"compute_note_hash_and_optionally_a_nullifier","is_unconstrained":true,"custom_attributes":[],"abi":{"error_types":{},"parameters":[{"name":"contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"nonce","type":{"kind":"field"},"visibility":"private"},{"name":"storage_slot","type":{"kind":"field"},"visibility":"private"},{"name":"note_type_id","type":{"kind":"field"},"visibility":"private"},{"name":"compute_nullifier","type":{"kind":"boolean"},"visibility":"private"},{"name":"serialized_note","type":{"kind":"array","length":0,"type":{"kind":"field"}},"visibility":"private"}],"return_type":{"abi_type":{"kind":"array","length":4,"type":{"kind":"field"}},"visibility":"public"}},"bytecode":"H4sIAAAAAAAA/9VW207DMAx1Wbum6yom+IHyhuCBVtqkPQ5x/QB+YBqV2MuG1sL3M3c2O8sKLzQSjRQ5ceLjE8e5eLQrZls9aQci+3RcdM5MZPa3kreIlbnk6XWE50lHePY6wtNvkafXwJOlL20+d3zmQtqdx6NBNOaN7sE4/QLkWU653ED7UuTL27JMF+tVtZkvqvR1XZTpal2lH2WRvm+Wn/Oq4H5RfgPdioyEEJKetRO1PLIW3hr2dLyIhLsD3hPGHbjBznhj78w+9gS+OCmeZEylJzWRcQL7hPaJcw86TbgH0OmL8Ai6kA59MR/jZr+mDvcrY9zYDXaewP4Q+MCCB1l5DMhZDtUvWmz5V196lut8kc00oPPNIc86X6x85G4K4wbWpOPX1tqQS8/iwriBi1hIXvVdYGfZGGPoN8QwaIhhvyGG59v6bOEw79A44V2/VgY4+uBLeZ7AHAM8Auhf0V4faRIInsZFcU957ZpH5mc737IbwZw+2IWWXQi867nbeiHtWOKJ90uLv77cfg/a/FHiWfYFW33pegKYo1+mMzouGAOiTtyvky7fr0OL0wh0mItDC2toYf0Hu4QOY6s6vctjkF9e6Ei/eg4AAA==","debug_symbols":"lZDLCsMgEEX/ZdYu0sZG8FdKCZpoGBANagpF/PdOHots3QxzZu7Z3AKz0dsyorchgXwXcGFSGYMnKpWBjugcLuP9DN0+eH/k06r8jimrmEH2g2Bg/EybeJJv0RmQvHvUDwPO25VXuzK0K6JRqYRfFVFpZ66m7OanW3H5t54fCv8B","brillig_names":["compute_note_hash_and_optionally_a_nullifier"]},{"name":"rotate_npk_m","is_unconstrained":true,"custom_attributes":["aztec(public)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"account","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"new_npk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::NpkM"},"visibility":"private"},{"name":"nonce","type":{"kind":"field"},"visibility":"private"}],"return_type":null},"bytecode":"H4sIAAAAAAAC/6Vae6wtV1lfs2Zm7z2zX+ec/ZiZM/sx+/2ac8+9tMy1JQ1qW/pAFKIxN0rB+IqQFNGUGFDB1oaqaaimiaTEoEYJlkYhRglGNCbqH6JB0aIh+IfVENTyBxiqaIzx9/vWzOzt5ZzbPzzJmrPWmm997+9ba32zryrb0teUXXtQqavKrvp4qPpG4a+O5itVu3uoKrV7ave8AePaPaYpjWbxxf21++XF/aaZF9exStnXCergea9y8XyNquB5n6peJ2QNzweUdwXgJ68hggdJE9SteiZ0wYbKtO1/3ZRz89RVZal6pusy3yjmG5ivqEamG35C1L6vKq7f7Cur6Q9UxfffoIyA0oRtILKaVEALD7tNdEdAYh2j55ycKfVK5afqGhB5DR/D25V/n6VU6rxFKHgTPjtA3ulybQ+sdMhKj4J0ONXHVI9TfQrSK6acYqrucCrAVJ9TAaYafU6FmAo4FWKqFXAqwlTIqYhqU6d46AHGp4MYbyK+idVVC4DoRjrO9GlMmJjD+DTTUTiAmKfg9zRCL7Iz1YJ8b24o27cjgp6eqeobVZSq78usjp9ZPTuzgjizwsBXdtwKz5T9vApT9VZ4EBQxwMpBPPThGfUB9PPDakD9kNkBWBqSpQGHxyMMyasaCYfsDvQIb47G6I5H40yNEmBLxhMYbDIBj5OJGGySNzEYaDymJtAR9G8nOknVuzI9GJLgIQUQBEL0MBwLQXZHekyCsnScZGo8AcFJMgXB6RQEp1MhOM1bQfAX1RQEwYI90ZNUvS/TowEJHlDAe8piAamiPCqh0QDQgq5+FVTCOCHpCZwrnd4ONzV/x6r4m50p/YyCPB/OrDEV0UrGoP2cGqcW7DBMMgs6sgZCJi5EjVXhKrFxlcKZQuNMHM4LR5pz6CwwnHO4EL2wO9eYXCwzPV1itNToNQ56mZ5TXvdWKxsXrix6M+KAOx6FcPgg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jmLh645i4e2MIuHtjCHp4CW9jFA1vYxcPS2P3qNjx57euNxT2eaY/Fb1tQzqWPmtYBa0oD1pQHrKkI1LSEVlNYP9V0XF29rx+rq8/LEwV1dgU8RzCLKnDTK/DTKwjTK4hDKbjXtA5YUxqwJonelmKrKbsnNZUBa6rD1VQXif6zbp+nFIgrx9t0wcdr552b9yl+KHDTK/CDKwjOP147uF1EcjF8KAjTK4jTK1inV5CmV5CnV1CmV1BnV+BG78m0gtF7Mq1g+p7spu/JPEfoiiqYvie76XuyG6sn32saq8veaxqrb77X5MfqhP/92+0f/+e7f/7w3Z9//P6X2y+9/dt//fSXX3/4+aePf/z1f/9x/ze3xf8H","brillig_names":["rotate_npk_m"],"assert_messages":{"1798":"attempt to add with overflow","1920":"attempt to add with overflow","1536":"Array index out of bounds","1402":"attempt to add with overflow","579":"attempt to add with overflow","256":"Array index out of bounds","110":"Args length exceeds maximum","372":"Array index out of bounds","695":"attempt to add with overflow","482":"Array index out of bounds","409":"Array index out of bounds","531":"Array index out of bounds","1677":"Array index out of bounds","1549":"attempt to add with overflow","391":"Array index out of bounds","1860":"Array index out of bounds","964":"Array index out of bounds","830":"Array index out of bounds","1787":"Array index out of bounds","385":"attempt to add with overflow","641":"Array index out of bounds","818":"attempt to add with overflow","568":"Array index out of bounds","1769":"Array index out of bounds","550":"Array index out of bounds","544":"attempt to add with overflow","1373":"Array index out of bounds","1111":"Nested call failed!","977":"attempt to add with overflow","1739":"Array index out of bounds","51":"invalid nonce","1520":"Array index out of bounds","490":"Array index out of bounds","356":"Array index out of bounds","1508":"attempt to add with overflow","1752":"attempt to add with overflow","1868":"Array index out of bounds","649":"Array index out of bounds","838":"Array index out of bounds","515":"Array index out of bounds","1600":"Array index out of bounds","1466":"attempt to add with overflow","503":"attempt to add with overflow","948":"Array index out of bounds","1710":"attempt to add with overflow","936":"attempt to add with overflow","1381":"Array index out of bounds","674":"Array index out of bounds","1887":"attempt to add with overflow","1881":"attempt to add with overflow","662":"attempt to add with overflow","784":"Array index out of bounds","894":"attempt to add with overflow","1662":"attempt to add with overflow","1144":"Storage slot 0 not allowed. Storage slots must start from 1.","1528":"Array index out of bounds","1723":"Array index out of bounds","1455":"Array index out of bounds","364":"Array index out of bounds","1644":"Array index out of bounds","1699":"Array index out of bounds","1437":"Array index out of bounds","669":"Index out of bounds","474":"Array index out of bounds","846":"Array index out of bounds","462":"attempt to add with overflow","523":"Array index out of bounds","1608":"attempt to add with overflow","956":"Array index out of bounds","633":"Array index out of bounds","1852":"Array index out of bounds","883":"Array index out of bounds","1651":"Array index out of bounds","1389":"Array index out of bounds","621":"attempt to add with overflow","1127":"Message not authorized by account","682":"Array index out of bounds","865":"Array index out of bounds","420":"attempt to add with overflow","859":"attempt to add with overflow","1688":"attempt to add with overflow","1840":"attempt to add with overflow","1670":"Array index out of bounds","1731":"Array index out of bounds"}},{"name":"get_current_keys","is_unconstrained":true,"custom_attributes":[],"abi":{"error_types":{},"parameters":[{"name":"account","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"}],"return_type":{"abi_type":{"fields":[{"name":"npk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::NpkM"}},{"name":"ivpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::IvpkM"}},{"name":"ovpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::OvpkM"}},{"name":"tpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::TpkM"}}],"kind":"struct","path":"aztec::keys::public_keys::PublicKeys"},"visibility":"public"}},"bytecode":"H4sIAAAAAAAA/71ZSY/cVBB+PV7adtu9zJCdg++gqDshECQOk4QlIRAQSNw9Y08yYqaN3B4C/4cDnOAMEocoUq5R8ocy7lRNf11T3YomfnlSdz2Xa/mq3uLyc8e8bvHxr0N9jyhfY2PeNtHx27VJi7bGsYJzg6hD1BUx+kS7RAOiIdGIaA/yNDfuCkfYYri3Qc5dcuqTs4CcRGQ8XmHzA+h/RvTHuqyyh0U6OyjrdJxOj/+zg4PycZFfTfHeLD08mtXprM6qOt2rysN0chVt/wn9S0RvVVX2e7o/zYvf0vKoTsu9dKc8muYzVPz7rIr/Qv99olldF4e/1Gldplmep4/360dp+WtR7R1HdJKKl0RDsxhTHoZtuh6/XZuEAK5V2zdvjEOzPLxt4/bs2B43U/UOLQq5dhKzWFcs05D34P7nxHeA94Ww1/C+DE7b/op4PvDuEq8LvHvgm3lf00UIvPvEi4D3DfF6wPuWeDHwHgSLPtPviNcn3hbEy7ox3H9Y1LcPyt2fHxwd7hQVLgttx8VNBltjcXNh8U45ratst76V51UxW1psvmLVrLAYgcVH2f70Xo5a3bNZ+qmoZvvlFLWCN7QUgqWW5/T1xCzmhVmBBzMfAQ3tYJp0wA/7Z1+83zW4ewJTI4PPve2W8AyNeOZRzD2BsScwop4DGC2N5bhjFmtyVd6a674d/9dGFBtj6Ivx6QEGnHMt+R8bGB9P+GPqQOydlnPfh7x3AIsDmFjmQ6K8e2FzhI4B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qzsvJNKGVkVeP6yso3lVk1K99UYWXlmyqsrHwTxqMANZpRf1iz8k0VVuiIlZVvqrCy8k0pa3KrhcDKyjdVWHn5piIr/d3kpR1ukvx2chCXLW7Cj+STn0HK8slPCmX55K/zsnzyS56ifPJ7yivyyS9MyvLJ7yp3l13lybnjQT75I1zK8slX3bJ88pv6y/LJ7+ovyyd/jEtZPvlzXMryyR/kUpRP/kyIinzyR7mU5bdddckf3lCR33bVJX/IQkV+21WX/GEIBfn7w6Mfy/f18mGzOt829vlz+5jcRXb38+33M4fgXw==","brillig_names":["get_current_keys"]}],"outputs":{"globals":{"storage":[{"fields":[{"name":"current_keys","value":{"fields":[{"name":"slot","value":{"kind":"integer","sign":false,"value":"0000000000000000000000000000000000000000000000000000000000000001"}}],"kind":"struct"}}],"kind":"struct"}]},"structs":{"functions":[{"fields":[{"name":"parameters","type":{"fields":[{"name":"account","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"partial_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::partial_address::PartialAddress"}},{"name":"keys","type":{"fields":[{"name":"npk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::NpkM"}},{"name":"ivpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::IvpkM"}},{"name":"ovpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::OvpkM"}},{"name":"tpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::TpkM"}}],"kind":"struct","path":"aztec::keys::public_keys::PublicKeys"}}],"kind":"struct","path":"KeyRegistry::register_initial_keys_parameters"}}],"kind":"struct","path":"KeyRegistry::register_initial_keys_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"account","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"new_npk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::NpkM"}},{"name":"nonce","type":{"kind":"field"}}],"kind":"struct","path":"KeyRegistry::rotate_npk_m_parameters"}}],"kind":"struct","path":"KeyRegistry::rotate_npk_m_abi"}]}},"file_map":{"109":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/unconstrained_context.nr","source":"use dep::protocol_types::{address::AztecAddress, traits::Deserialize};\nuse crate::oracle::{execution::{get_chain_id, get_version, get_contract_address, get_block_number}, storage::storage_read};\n\nstruct UnconstrainedContext {\n block_number: u32,\n contract_address: AztecAddress,\n version: Field,\n chain_id: Field,\n}\n\nimpl UnconstrainedContext {\n unconstrained fn new() -> Self {\n // We could call these oracles on the getters instead of at creation, which makes sense given that they might\n // not even be accessed. However any performance gains are minimal, and we'd rather fail early if a user\n // incorrectly attempts to create an UnconstrainedContext in an environment in which these oracles are not\n // available.\n let block_number = get_block_number();\n let contract_address = get_contract_address();\n let chain_id = get_chain_id();\n let version = get_version();\n Self { block_number, contract_address, version, chain_id }\n }\n\n unconstrained fn at(contract_address: AztecAddress) -> Self {\n let block_number = get_block_number();\n let chain_id = get_chain_id();\n let version = get_version();\n Self { block_number, contract_address, version, chain_id }\n }\n\n unconstrained fn at_historical(contract_address: AztecAddress, block_number: u32) -> Self {\n let chain_id = get_chain_id();\n let version = get_version();\n Self { block_number, contract_address, version, chain_id }\n }\n\n fn block_number(self) -> u32 {\n self.block_number\n }\n\n fn this_address(self) -> AztecAddress {\n self.contract_address\n }\n\n fn version(self) -> Field {\n self.version\n }\n\n fn chain_id(self) -> Field {\n self.chain_id\n }\n\n unconstrained fn raw_storage_read<let N: u32>(self: Self, storage_slot: Field) -> [Field; N] {\n storage_read(self.this_address(), storage_slot, self.block_number())\n }\n\n unconstrained fn storage_read<T, let N: u32>(\n self,\n storage_slot: Field\n ) -> T where T: Deserialize<N> {\n T::deserialize(self.raw_storage_read(storage_slot))\n }\n}\n"},"116":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/public_context.nr","source":"use crate::hash::{compute_secret_hash, compute_message_hash, compute_message_nullifier};\nuse dep::protocol_types::address::{AztecAddress, EthAddress};\nuse dep::protocol_types::constants::MAX_FIELD_VALUE;\nuse dep::protocol_types::traits::{Serialize, Deserialize, Empty};\nuse dep::protocol_types::abis::function_selector::FunctionSelector;\nuse crate::context::inputs::public_context_inputs::PublicContextInputs;\nuse crate::context::gas::GasOpts;\nuse crate::hash::ArgsHasher;\n\nstruct PublicContext {\n inputs: PublicContextInputs,\n args_hash: Option<Field>\n}\n\nimpl PublicContext {\n pub fn new(inputs: PublicContextInputs) -> Self {\n PublicContext { inputs, args_hash: Option::none() }\n }\n\n pub fn emit_unencrypted_log<T, let N: u32>(_self: &mut Self, log: T) where T: Serialize<N> {\n emit_unencrypted_log(Serialize::serialize(log).as_slice());\n }\n\n pub fn note_hash_exists(_self: Self, note_hash: Field, leaf_index: Field) -> bool {\n note_hash_exists(note_hash, leaf_index) == 1\n }\n\n pub fn l1_to_l2_msg_exists(_self: Self, msg_hash: Field, msg_leaf_index: Field) -> bool {\n l1_to_l2_msg_exists(msg_hash, msg_leaf_index) == 1\n }\n\n fn nullifier_exists(_self: Self, unsiloed_nullifier: Field, address: AztecAddress) -> bool {\n nullifier_exists(unsiloed_nullifier, address.to_field()) == 1\n }\n\n fn consume_l1_to_l2_message(\n &mut self,\n content: Field,\n secret: Field,\n sender: EthAddress,\n leaf_index: Field\n ) {\n let secret_hash = compute_secret_hash(secret);\n let message_hash = compute_message_hash(\n sender,\n self.chain_id(),\n /*recipient=*/ self.this_address(),\n self.version(),\n content,\n secret_hash\n );\n let nullifier = compute_message_nullifier(message_hash, secret, leaf_index);\n\n assert(\n !self.nullifier_exists(nullifier, self.this_address()), \"L1-to-L2 message is already nullified\"\n );\n assert(\n self.l1_to_l2_msg_exists(message_hash, leaf_index), \"Tried to consume nonexistent L1-to-L2 message\"\n );\n\n self.push_nullifier(nullifier);\n }\n\n fn message_portal(_self: &mut Self, recipient: EthAddress, content: Field) {\n send_l2_to_l1_msg(recipient, content);\n }\n\n fn call_public_function<let RETURNS_COUNT: u32>(\n _self: &mut Self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field],\n gas_opts: GasOpts\n ) -> FunctionReturns<RETURNS_COUNT> {\n let results = call(\n gas_for_call(gas_opts),\n contract_address,\n args,\n function_selector.to_field()\n );\n let data_to_return: [Field; RETURNS_COUNT] = results.0;\n let success: u8 = results.1;\n assert(success == 1, \"Nested call failed!\");\n\n FunctionReturns::new(data_to_return)\n }\n\n fn static_call_public_function<let RETURNS_COUNT: u32>(\n _self: &mut Self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field],\n gas_opts: GasOpts\n ) -> FunctionReturns<RETURNS_COUNT> {\n let (data_to_return, success): ([Field; RETURNS_COUNT], u8) = call_static(\n gas_for_call(gas_opts),\n contract_address,\n args,\n function_selector.to_field()\n );\n\n assert(success == 1, \"Nested static call failed!\");\n FunctionReturns::new(data_to_return)\n }\n\n fn delegate_call_public_function<let RETURNS_COUNT: u32>(\n _self: &mut Self,\n _contract_address: AztecAddress,\n _function_selector: FunctionSelector,\n _args: [Field]\n ) -> FunctionReturns<RETURNS_COUNT> {\n assert(false, \"'delegate_call_public_function' not implemented!\");\n FunctionReturns::new([0; RETURNS_COUNT])\n }\n\n fn push_note_hash(_self: &mut Self, note_hash: Field) {\n emit_note_hash(note_hash);\n }\n fn push_nullifier(_self: &mut Self, nullifier: Field) {\n emit_nullifier(nullifier);\n }\n\n fn this_address(_self: Self) -> AztecAddress {\n address()\n }\n pub fn storage_address(_self: Self) -> AztecAddress {\n storage_address()\n }\n fn msg_sender(_self: Self) -> AztecAddress {\n sender()\n }\n fn selector(_self: Self) -> FunctionSelector {\n FunctionSelector::from_u32(function_selector())\n }\n fn get_args_hash(mut self) -> Field {\n if !self.args_hash.is_some() {\n let mut hasher = ArgsHasher::new();\n\n // TODO: this should be replaced with the compile-time calldata size.\n for i in 0..self.inputs.calldata_length as u32 {\n let argn: [Field; 1] = calldata_copy((2 + i) as u32, 1);\n hasher.add(argn[0]);\n }\n\n self.args_hash = Option::some(hasher.hash());\n }\n\n self.args_hash.unwrap()\n }\n fn transaction_fee(_self: Self) -> Field {\n transaction_fee()\n }\n\n fn chain_id(_self: Self) -> Field {\n chain_id()\n }\n fn version(_self: Self) -> Field {\n version()\n }\n fn block_number(_self: Self) -> Field {\n block_number()\n }\n fn timestamp(_self: Self) -> u64 {\n timestamp()\n }\n pub fn fee_per_l2_gas(_self: Self) -> Field {\n fee_per_l2_gas()\n }\n pub fn fee_per_da_gas(_self: Self) -> Field {\n fee_per_da_gas()\n }\n\n fn l2_gas_left(_self: Self) -> Field {\n l2_gas_left()\n }\n fn da_gas_left(_self: Self) -> Field {\n da_gas_left()\n }\n\n fn raw_storage_read<let N: u32>(_self: Self, storage_slot: Field) -> [Field; N] {\n let mut out = [0; N];\n for i in 0..N {\n out[i] = storage_read(storage_slot + i as Field);\n }\n out\n }\n\n fn storage_read<T, let N: u32>(self, storage_slot: Field) -> T where T: Deserialize<N> {\n T::deserialize(self.raw_storage_read(storage_slot))\n }\n\n fn raw_storage_write<let N: u32>(_self: Self, storage_slot: Field, values: [Field; N]) {\n for i in 0..N {\n storage_write(storage_slot + i as Field, values[i]);\n }\n }\n\n fn storage_write<T, let N: u32>(self, storage_slot: Field, value: T) where T: Serialize<N> {\n self.raw_storage_write(storage_slot, value.serialize());\n }\n}\n\n// Helper functions\nfn gas_for_call(user_gas: GasOpts) -> [Field; 2] {\n // It's ok to use the max possible gas here, because the gas will be\n // capped by the gas left in the (STATIC)CALL instruction.\n [\n user_gas.l2_gas.unwrap_or(MAX_FIELD_VALUE),\n user_gas.da_gas.unwrap_or(MAX_FIELD_VALUE)\n ]\n}\n\n// Unconstrained opcode wrappers (do not use directly).\n// TODO(https://github.com/AztecProtocol/aztec-packages/issues/6420): reconsider.\nunconstrained fn address() -> AztecAddress {\n address_opcode()\n}\nunconstrained fn storage_address() -> AztecAddress {\n storage_address_opcode()\n}\nunconstrained fn sender() -> AztecAddress {\n sender_opcode()\n}\nunconstrained fn portal() -> EthAddress {\n portal_opcode()\n}\nunconstrained fn function_selector() -> u32 {\n function_selector_opcode()\n}\nunconstrained fn transaction_fee() -> Field {\n transaction_fee_opcode()\n}\nunconstrained fn chain_id() -> Field {\n chain_id_opcode()\n}\nunconstrained fn version() -> Field {\n version_opcode()\n}\nunconstrained fn block_number() -> Field {\n block_number_opcode()\n}\nunconstrained fn timestamp() -> u64 {\n timestamp_opcode()\n}\nunconstrained fn fee_per_l2_gas() -> Field {\n fee_per_l2_gas_opcode()\n}\nunconstrained fn fee_per_da_gas() -> Field {\n fee_per_da_gas_opcode()\n}\nunconstrained fn l2_gas_left() -> Field {\n l2_gas_left_opcode()\n}\nunconstrained fn da_gas_left() -> Field {\n da_gas_left_opcode()\n}\nunconstrained fn note_hash_exists(note_hash: Field, leaf_index: Field) -> u8 {\n note_hash_exists_opcode(note_hash, leaf_index)\n}\nunconstrained fn emit_note_hash(note_hash: Field) {\n emit_note_hash_opcode(note_hash)\n}\nunconstrained fn nullifier_exists(nullifier: Field, address: Field) -> u8 {\n nullifier_exists_opcode(nullifier, address)\n}\nunconstrained fn emit_nullifier(nullifier: Field) {\n emit_nullifier_opcode(nullifier)\n}\nunconstrained fn emit_unencrypted_log(message: [Field]) {\n emit_unencrypted_log_opcode(message)\n}\nunconstrained fn l1_to_l2_msg_exists(msg_hash: Field, msg_leaf_index: Field) -> u8 {\n l1_to_l2_msg_exists_opcode(msg_hash, msg_leaf_index)\n}\nunconstrained fn send_l2_to_l1_msg(recipient: EthAddress, content: Field) {\n send_l2_to_l1_msg_opcode(recipient, content)\n}\nunconstrained fn call<let RET_SIZE: u32>(\n gas: [Field; 2],\n address: AztecAddress,\n args: [Field],\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {\n call_opcode(gas, address, args, function_selector)\n}\nunconstrained fn call_static<let RET_SIZE: u32>(\n gas: [Field; 2],\n address: AztecAddress,\n args: [Field],\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {\n call_static_opcode(gas, address, args, function_selector)\n}\n\nunconstrained fn calldata_copy<let N: u32>(cdoffset: u32, copy_size: u32) -> [Field; N] {\n calldata_copy_opcode(cdoffset, copy_size)\n}\n\nunconstrained fn storage_read(storage_slot: Field) -> Field {\n storage_read_opcode(storage_slot)\n}\n\nunconstrained fn storage_write(storage_slot: Field, value: Field) {\n storage_write_opcode(storage_slot, value);\n}\n\nimpl Empty for PublicContext {\n fn empty() -> Self {\n PublicContext::new(PublicContextInputs::empty())\n }\n}\n\n// AVM oracles (opcodes) follow, do not use directly.\n#[oracle(avmOpcodeAddress)]\nunconstrained fn address_opcode() -> AztecAddress {}\n\n#[oracle(avmOpcodeStorageAddress)]\nunconstrained fn storage_address_opcode() -> AztecAddress {}\n\n#[oracle(avmOpcodeSender)]\nunconstrained fn sender_opcode() -> AztecAddress {}\n\n#[oracle(avmOpcodePortal)]\nunconstrained fn portal_opcode() -> EthAddress {}\n\n#[oracle(avmOpcodeFunctionSelector)]\nunconstrained fn function_selector_opcode() -> u32 {}\n\n#[oracle(avmOpcodeTransactionFee)]\nunconstrained fn transaction_fee_opcode() -> Field {}\n\n#[oracle(avmOpcodeChainId)]\nunconstrained fn chain_id_opcode() -> Field {}\n\n#[oracle(avmOpcodeVersion)]\nunconstrained fn version_opcode() -> Field {}\n\n#[oracle(avmOpcodeBlockNumber)]\nunconstrained fn block_number_opcode() -> Field {}\n\n#[oracle(avmOpcodeTimestamp)]\nunconstrained fn timestamp_opcode() -> u64 {}\n\n#[oracle(avmOpcodeFeePerL2Gas)]\nunconstrained fn fee_per_l2_gas_opcode() -> Field {}\n\n#[oracle(avmOpcodeFeePerDaGas)]\nunconstrained fn fee_per_da_gas_opcode() -> Field {}\n\n#[oracle(avmOpcodeL2GasLeft)]\nunconstrained fn l2_gas_left_opcode() -> Field {}\n\n#[oracle(avmOpcodeDaGasLeft)]\nunconstrained fn da_gas_left_opcode() -> Field {}\n\n#[oracle(avmOpcodeNoteHashExists)]\nunconstrained fn note_hash_exists_opcode(note_hash: Field, leaf_index: Field) -> u8 {}\n\n#[oracle(avmOpcodeEmitNoteHash)]\nunconstrained fn emit_note_hash_opcode(note_hash: Field) {}\n\n#[oracle(avmOpcodeNullifierExists)]\nunconstrained fn nullifier_exists_opcode(nullifier: Field, address: Field) -> u8 {}\n\n#[oracle(avmOpcodeEmitNullifier)]\nunconstrained fn emit_nullifier_opcode(nullifier: Field) {}\n\n#[oracle(avmOpcodeEmitUnencryptedLog)]\nunconstrained fn emit_unencrypted_log_opcode(message: [Field]) {}\n\n#[oracle(avmOpcodeL1ToL2MsgExists)]\nunconstrained fn l1_to_l2_msg_exists_opcode(msg_hash: Field, msg_leaf_index: Field) -> u8 {}\n\n#[oracle(avmOpcodeSendL2ToL1Msg)]\nunconstrained fn send_l2_to_l1_msg_opcode(recipient: EthAddress, content: Field) {}\n\n#[oracle(avmOpcodeCalldataCopy)]\nunconstrained fn calldata_copy_opcode<let N: u32>(cdoffset: u32, copy_size: u32) -> [Field; N] {}\n\n#[oracle(avmOpcodeCall)]\nunconstrained fn call_opcode<let RET_SIZE: u32>(\n gas: [Field; 2], // gas allocation: [l2_gas, da_gas]\n address: AztecAddress,\n args: [Field],\n // TODO(5110): consider passing in calldata directly\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {}\n// ^ return data ^ success\n\n#[oracle(avmOpcodeStaticCall)]\nunconstrained fn call_static_opcode<let RET_SIZE: u32>(\n gas: [Field; 2], // gas allocation: [l2_gas, da_gas]\n address: AztecAddress,\n args: [Field],\n // TODO(5110): consider passing in calldata directly\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {}\n// ^ return data ^ success\n\n#[oracle(avmOpcodeStorageRead)]\nunconstrained fn storage_read_opcode(storage_slot: Field) -> Field {}\n\n#[oracle(avmOpcodeStorageWrite)]\nunconstrained fn storage_write_opcode(storage_slot: Field, value: Field) {}\n\nstruct FunctionReturns<let N: u32> {\n values: [Field; N]\n}\n\nimpl<let N: u32> FunctionReturns<N> {\n pub fn new(values: [Field; N]) -> FunctionReturns<N> {\n FunctionReturns { values }\n }\n\n pub fn raw(self) -> [Field; N] {\n self.values\n }\n\n pub fn deserialize_into<T>(self) -> T where T: Deserialize<N> {\n Deserialize::deserialize(self.raw())\n }\n}\n\nimpl FunctionReturns<0> {\n pub fn assert_empty(self) {\n assert(self.values.len() == 0);\n }\n}\n"},"143":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/hash.nr","source":"use dep::protocol_types::{\n address::{AztecAddress, EthAddress},\n constants::{\n GENERATOR_INDEX__SECRET_HASH, GENERATOR_INDEX__MESSAGE_NULLIFIER, ARGS_HASH_CHUNK_COUNT,\n GENERATOR_INDEX__FUNCTION_ARGS, ARGS_HASH_CHUNK_LENGTH, MAX_ARGS_LENGTH\n},\n point::Point, traits::Hash, hash::{sha256_to_field, poseidon2_hash_with_separator}\n};\nuse crate::oracle::logs_traits::ToBytesForUnencryptedLog;\n\npub use dep::protocol_types::hash::{compute_siloed_nullifier, pedersen_hash};\n\npub fn pedersen_commitment<let N: u32>(inputs: [Field; N], hash_index: u32) -> Point {\n std::hash::pedersen_commitment_with_separator(inputs, hash_index)\n}\n\npub fn compute_secret_hash(secret: Field) -> Field {\n poseidon2_hash_with_separator([secret], GENERATOR_INDEX__SECRET_HASH)\n}\n\npub fn compute_unencrypted_log_hash<T, let N: u32, let M: u32>(\n contract_address: AztecAddress,\n log: T\n) -> Field where T: ToBytesForUnencryptedLog<N, M> {\n let message_bytes: [u8; N] = log.to_be_bytes_arr();\n // can't use N - not in scope error\n let n = message_bytes.len();\n let mut hash_bytes = [0; M];\n // Address is converted to 32 bytes in ts\n let address_bytes = contract_address.to_be_bytes_arr();\n for i in 0..32 {\n hash_bytes[i] = address_bytes[i];\n }\n let len_bytes: [u8; 4] = (n as Field).to_be_bytes();\n for i in 0..4 {\n hash_bytes[32 + i] = len_bytes[i];\n }\n for i in 0..n {\n hash_bytes[36 + i] = message_bytes[i];\n }\n\n sha256_to_field(hash_bytes)\n}\n\npub fn compute_message_hash(\n sender: EthAddress,\n chain_id: Field,\n recipient: AztecAddress,\n version: Field,\n content: Field,\n secret_hash: Field\n) -> Field {\n let mut hash_bytes = [0 as u8; 192];\n let sender_bytes: [u8; 32] = sender.to_field().to_be_bytes();\n let chain_id_bytes: [u8; 32] = chain_id.to_be_bytes();\n let recipient_bytes: [u8; 32] = recipient.to_field().to_be_bytes();\n let version_bytes: [u8; 32] = version.to_be_bytes();\n let content_bytes: [u8; 32] = content.to_be_bytes();\n let secret_hash_bytes: [u8; 32] = secret_hash.to_be_bytes();\n\n for i in 0..32 {\n hash_bytes[i] = sender_bytes[i];\n hash_bytes[i + 32] = chain_id_bytes[i];\n hash_bytes[i + 64] = recipient_bytes[i];\n hash_bytes[i + 96] = version_bytes[i];\n hash_bytes[i + 128] = content_bytes[i];\n hash_bytes[i + 160] = secret_hash_bytes[i];\n }\n\n sha256_to_field(hash_bytes)\n}\n\n// The nullifier of a l1 to l2 message is the hash of the message salted with the secret and index of the message hash\n// in the L1 to L2 message tree\npub fn compute_message_nullifier(message_hash: Field, secret: Field, leaf_index: Field) -> Field {\n poseidon2_hash_with_separator(\n [message_hash, secret, leaf_index],\n GENERATOR_INDEX__MESSAGE_NULLIFIER\n )\n}\n\nstruct ArgsHasher {\n fields: [Field],\n}\n\nimpl Hash for ArgsHasher {\n fn hash(self) -> Field {\n hash_args(self.fields)\n }\n}\n\nimpl ArgsHasher {\n pub fn new() -> Self {\n Self { fields: [] }\n }\n\n pub fn add(&mut self, field: Field) {\n self.fields = self.fields.push_back(field);\n }\n\n pub fn add_multiple<let N: u32>(&mut self, fields: [Field; N]) {\n for i in 0..N {\n self.fields = self.fields.push_back(fields[i]);\n }\n }\n}\n\npub fn hash_args_array<let N: u32>(args: [Field; N]) -> Field {\n hash_args(args.as_slice())\n}\n\npub fn hash_args(args: [Field]) -> Field {\n if args.len() == 0 {\n 0\n } else {\n assert(args.len() <= MAX_ARGS_LENGTH, \"Args length exceeds maximum\");\n let mut chunks_hashes = [0; ARGS_HASH_CHUNK_COUNT];\n let mut current_chunk_values = [0; ARGS_HASH_CHUNK_LENGTH];\n\n let mut current_chunk_index = 0;\n let mut index_inside_current_chunk = 0;\n for i in 0..args.len() {\n current_chunk_values[index_inside_current_chunk] = args[i];\n index_inside_current_chunk+=1;\n if index_inside_current_chunk == ARGS_HASH_CHUNK_LENGTH {\n chunks_hashes[current_chunk_index] = poseidon2_hash_with_separator(current_chunk_values, GENERATOR_INDEX__FUNCTION_ARGS);\n current_chunk_values = [0; ARGS_HASH_CHUNK_LENGTH];\n current_chunk_index+=1;\n index_inside_current_chunk = 0;\n }\n }\n if index_inside_current_chunk > 0 {\n chunks_hashes[current_chunk_index] = poseidon2_hash_with_separator(current_chunk_values, GENERATOR_INDEX__FUNCTION_ARGS);\n }\n poseidon2_hash_with_separator(chunks_hashes, GENERATOR_INDEX__FUNCTION_ARGS)\n }\n}\n\n#[test]\nfn compute_var_args_hash() {\n let mut input = ArgsHasher::new();\n for i in 0..MAX_ARGS_LENGTH {\n input.add(i as Field);\n }\n let hash = input.hash();\n assert(hash == 0x1cce4dbf69f14c44865919991ee1057922e34d7310ba237d71759aa422621ca9);\n}\n\n#[test]\nfn compute_unenc_log_hash_array() {\n let contract_address = AztecAddress::from_field(0x233a3e0df23b2b15b324194cb4a151f26c0b7333250781d34cc269d85dc334c6);\n let log = [\n 0x20660de09f35f876e3e69d227b2a35166ad05f09d82d06366ec9b6f65a51fec2,\n 0x1b52bfe3b8689761916f76dc3d38aa8810860db325cd39ca611eed980091f01c,\n 0x2e559c4045c378a56ad13b9edb1e8de4e7ad3b3aa35cc7ba9ec77f7a68fa43a4,\n 0x25d0f689c4a4178a29d59306f2675824d19be6d25e44fa03b03f49c263053dd2,\n 0x2d513a722d6f352dc0961f156afdc5e31495b9f0e35cb069261a8e55e2df67fd\n ];\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x0095b2d17ab72f4b27a341f7ac63e49ec73935ae8c9181a0ac02023eb12f3284);\n}\n\n#[test]\nfn compute_unenc_log_hash_addr() {\n let contract_address = AztecAddress::from_field(0x233a3e0df23b2b15b324194cb4a151f26c0b7333250781d34cc269d85dc334c6);\n let log = AztecAddress::from_field(0x26aa302d4715fd8a687453cb26d616b0768027bd54bcae56b09d908ecd9f8303);\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x0083ab647dfb26e7ddee90a0f4209d049d4660cab42000c544b986aaa84c55a3);\n}\n\n#[test]\nfn compute_unenc_log_hash_str() {\n let contract_address = AztecAddress::from_field(0x1b401e1146c5c507962287065c81f0ef7590adae3802c533d7549d6bf0a41bd8);\n let log = \"dummy\";\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x00629e88ebd6374f44aa6cfe07e251ecf07213ebc7267e8f6b578ae57ffd6c20);\n}\n\n#[test]\nfn compute_unenc_log_hash_longer_str() {\n let contract_address = AztecAddress::from_field(0x1b401e1146c5c507962287065c81f0ef7590adae3802c533d7549d6bf0a41bd8);\n let log = \"Hello this is a string\";\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x0098637962f7d34fa202b7ffad8a07a238c5d1fd897b82a108f7f467fa73b841);\n}\n"},"153":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/storage.nr","source":"use dep::protocol_types::{address::AztecAddress, traits::Deserialize};\n\n#[oracle(storageRead)]\nunconstrained fn storage_read_oracle<let N: u32>(address: Field, storage_slot: Field, block_number: Field, length: Field) -> [Field; N] {}\n\nunconstrained pub fn raw_storage_read<let N: u32>(\n address: AztecAddress,\n storage_slot: Field,\n block_number: u32\n) -> [Field; N] {\n storage_read_oracle(\n address.to_field(),\n storage_slot,\n block_number as Field,\n N as Field\n )\n}\n\nunconstrained pub fn storage_read<T, let N: u32>(\n address: AztecAddress,\n storage_slot: Field,\n block_number: u32\n) -> T where T: Deserialize<N> {\n T::deserialize(raw_storage_read(address, storage_slot, block_number))\n}\n\nmod tests {\n use crate::oracle::storage::{raw_storage_read, storage_read};\n use dep::protocol_types::address::AztecAddress;\n\n use std::test::OracleMock;\n use crate::test::mocks::mock_struct::MockStruct;\n\n global address = AztecAddress::from_field(29);\n global slot = 7;\n global block_number = 17;\n\n #[test]\n fn test_raw_storage_read() {\n let written = MockStruct { a: 13, b: 42 };\n\n let _ = OracleMock::mock(\"storageRead\").returns(written.serialize());\n\n let read: [Field; 2] = raw_storage_read(address, slot, block_number);\n assert_eq(read[0], 13);\n assert_eq(read[1], 42);\n }\n\n #[test]\n fn test_storage_read() {\n let written = MockStruct { a: 13, b: 42 };\n\n let _ = OracleMock::mock(\"storageRead\").returns(written.serialize());\n\n let read: MockStruct = storage_read(address, slot, block_number);\n assert_eq(read.a, 13);\n assert_eq(read.b, 42);\n }\n}\n"},"163":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/execution.nr","source":"use dep::protocol_types::address::AztecAddress;\n\n#[oracle(getContractAddress)]\nunconstrained fn get_contract_address_oracle() -> AztecAddress {}\n\n#[oracle(getBlockNumber)]\nunconstrained fn get_block_number_oracle() -> u32 {}\n\n#[oracle(getChainId)]\nunconstrained fn get_chain_id_oracle() -> Field {}\n\n#[oracle(getVersion)]\nunconstrained fn get_version_oracle() -> Field {}\n\nunconstrained pub fn get_contract_address() -> AztecAddress {\n get_contract_address_oracle()\n}\n\nunconstrained pub fn get_block_number() -> u32 {\n get_block_number_oracle()\n}\n\nunconstrained pub fn get_chain_id() -> Field {\n get_chain_id_oracle()\n}\n\nunconstrained pub fn get_version() -> Field {\n get_version_oracle()\n}\n"},"166":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/state_vars/map.nr","source":"use dep::protocol_types::{storage::map::derive_storage_slot_in_map, traits::ToField};\nuse crate::state_vars::storage::Storage;\n\n// docs:start:map\nstruct Map<K, V, Context> {\n context: Context,\n storage_slot: Field,\n state_var_constructor: fn(Context, Field) -> V,\n}\n// docs:end:map\n\nimpl<K, T, Context> Storage<T> for Map<K, T, Context> {}\n\nimpl<K, V, Context> Map<K, V, Context> {\n // docs:start:new\n pub fn new(\n context: Context,\n storage_slot: Field,\n state_var_constructor: fn(Context, Field) -> V\n ) -> Self {\n assert(storage_slot != 0, \"Storage slot 0 not allowed. Storage slots must start from 1.\");\n Map { context, storage_slot, state_var_constructor }\n }\n // docs:end:new\n\n // docs:start:at\n pub fn at(self, key: K) -> V where K: ToField {\n // TODO(#1204): use a generator index for the storage slot\n let derived_storage_slot = derive_storage_slot_in_map(self.storage_slot, key);\n\n let state_var_constructor = self.state_var_constructor;\n state_var_constructor(self.context, derived_storage_slot)\n }\n // docs:end:at\n}\n\n"},"168":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr","source":"use crate::context::{PublicContext, UnconstrainedContext};\nuse dep::protocol_types::traits::{Deserialize, Serialize};\nuse crate::state_vars::storage::Storage;\n\n// docs:start:public_mutable_struct\nstruct PublicMutable<T, Context> {\n context: Context,\n storage_slot: Field,\n}\n// docs:end:public_mutable_struct\n\nimpl<T, Context> Storage<T> for PublicMutable<T, Context> {}\n\nimpl<T, Context> PublicMutable<T, Context> {\n // docs:start:public_mutable_struct_new\n pub fn new(\n // Note: Passing the contexts to new(...) just to have an interface compatible with a Map.\n context: Context,\n storage_slot: Field\n ) -> Self {\n assert(storage_slot != 0, \"Storage slot 0 not allowed. Storage slots must start from 1.\");\n PublicMutable { context, storage_slot }\n }\n // docs:end:public_mutable_struct_new\n}\n\nimpl<T, T_SERIALIZED_LEN> PublicMutable<T, &mut PublicContext> where T: Serialize<T_SERIALIZED_LEN> + Deserialize<T_SERIALIZED_LEN> {\n // docs:start:public_mutable_struct_read\n pub fn read(self) -> T {\n self.context.storage_read(self.storage_slot)\n }\n // docs:end:public_mutable_struct_read\n\n // docs:start:public_mutable_struct_write\n pub fn write(self, value: T) {\n self.context.storage_write(self.storage_slot, value);\n }\n // docs:end:public_mutable_struct_write\n}\n\nimpl<T, T_SERIALIZED_LEN> PublicMutable<T, UnconstrainedContext> where T: Deserialize<T_SERIALIZED_LEN> {\n unconstrained pub fn read(self) -> T {\n self.context.storage_read(self.storage_slot)\n }\n}\n"},"221":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/abis/function_selector.nr","source":"use crate::utils::field::field_from_bytes;\nuse crate::traits::{Serialize, Deserialize, FromField, ToField, Empty};\n\nglobal SELECTOR_SIZE = 4;\n\nstruct FunctionSelector {\n // 1st 4-bytes of abi-encoding of function.\n inner: u32,\n}\n\nimpl Eq for FunctionSelector {\n fn eq(self, function_selector: FunctionSelector) -> bool {\n function_selector.inner == self.inner\n }\n}\n\nimpl Serialize<1> for FunctionSelector {\n fn serialize(self: Self) -> [Field; 1] {\n [self.inner as Field]\n }\n}\n\nimpl Deserialize<1> for FunctionSelector {\n fn deserialize(fields: [Field; 1]) -> Self {\n Self { inner: fields[0] as u32 }\n }\n}\n\nimpl FromField for FunctionSelector {\n fn from_field(field: Field) -> Self {\n Self { inner: field as u32 }\n }\n}\n\nimpl ToField for FunctionSelector {\n fn to_field(self) -> Field {\n self.inner as Field\n }\n}\n\nimpl Empty for FunctionSelector {\n fn empty() -> Self {\n Self { inner: 0 as u32 }\n }\n}\n\nimpl FunctionSelector {\n pub fn from_u32(value: u32) -> Self {\n Self { inner: value }\n }\n\n pub fn from_signature<let N: u32>(signature: str<N>) -> Self {\n let bytes = signature.as_bytes();\n let hash = std::hash::keccak256(bytes, bytes.len() as u32);\n\n let mut selector_be_bytes = [0; SELECTOR_SIZE];\n for i in 0..SELECTOR_SIZE {\n selector_be_bytes[i] = hash[i];\n }\n\n FunctionSelector::from_field(field_from_bytes(selector_be_bytes, true))\n }\n\n pub fn zero() -> Self {\n Self { inner: 0 }\n }\n}\n"},"24":{"path":"std/embedded_curve_ops.nr","source":"use crate::ops::arith::{Add, Sub, Neg};\nuse crate::cmp::Eq;\n\n/// A point on the embedded elliptic curve\n/// By definition, the base field of the embedded curve is the scalar field of the proof system curve, i.e the Noir Field.\n/// x and y denotes the Weierstrass coordinates of the point, if is_infinite is false.\nstruct EmbeddedCurvePoint {\n x: Field,\n y: Field,\n is_infinite: bool\n}\n\nimpl EmbeddedCurvePoint {\n /// Elliptic curve point doubling operation\n /// returns the doubled point of a point P, i.e P+P\n fn double(self) -> EmbeddedCurvePoint {\n embedded_curve_add(self, self)\n }\n\n /// Returns the null element of the curve; 'the point at infinity'\n fn point_at_infinity() -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true }\n }\n}\n\nimpl Add for EmbeddedCurvePoint {\n /// Adds two points P+Q, using the curve addition formula, and also handles point at infinity\n fn add(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n embedded_curve_add(self, other)\n }\n}\n\nimpl Sub for EmbeddedCurvePoint {\n /// Points subtraction operation, using addition and negation\n fn sub(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n self + other.neg()\n }\n}\n\nimpl Neg for EmbeddedCurvePoint {\n /// Negates a point P, i.e returns -P, by negating the y coordinate.\n /// If the point is at infinity, then the result is also at infinity.\n fn neg(self) -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: self.x, y: -self.y, is_infinite: self.is_infinite }\n }\n}\n\nimpl Eq for EmbeddedCurvePoint {\n /// Checks whether two points are equal\n fn eq(self: Self, b: EmbeddedCurvePoint) -> bool {\n (self.is_infinite & b.is_infinite)\n | ((self.is_infinite == b.is_infinite) & (self.x == b.x) & (self.y == b.y))\n }\n}\n\n/// Scalar for the embedded curve represented as low and high limbs\n/// By definition, the scalar field of the embedded curve is base field of the proving system curve.\n/// It may not fit into a Field element, so it is represented with two Field elements; its low and high limbs.\nstruct EmbeddedCurveScalar {\n lo: Field,\n hi: Field,\n}\n\nimpl EmbeddedCurveScalar {\n pub fn new(lo: Field, hi: Field) -> Self {\n EmbeddedCurveScalar { lo, hi }\n }\n\n #[field(bn254)]\n fn from_field(scalar: Field) -> EmbeddedCurveScalar {\n let (a,b) = crate::field::bn254::decompose(scalar);\n EmbeddedCurveScalar { lo: a, hi: b }\n }\n}\n\nimpl Eq for EmbeddedCurveScalar {\n fn eq(self, other: Self) -> bool {\n (other.hi == self.hi) & (other.lo == self.lo)\n }\n}\n\n// Computes a multi scalar multiplication over the embedded curve.\n// For bn254, We have Grumpkin and Baby JubJub.\n// For bls12-381, we have JubJub and Bandersnatch.\n//\n// The embedded curve being used is decided by the \n// underlying proof system.\n// docs:start:multi_scalar_mul\npub fn multi_scalar_mul<let N: u32>(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N]\n) -> EmbeddedCurvePoint\n// docs:end:multi_scalar_mul\n{\n let point_array = multi_scalar_mul_array_return(points, scalars);\n EmbeddedCurvePoint { x: point_array[0], y: point_array[1], is_infinite: point_array[2] as bool }\n}\n\n#[foreign(multi_scalar_mul)]\nfn multi_scalar_mul_array_return<let N: u32>(points: [EmbeddedCurvePoint; N], scalars: [EmbeddedCurveScalar; N]) -> [Field; 3] {}\n\n#[foreign(multi_scalar_mul)]\npub(crate) fn multi_scalar_mul_slice(points: [EmbeddedCurvePoint], scalars: [EmbeddedCurveScalar]) -> [Field; 3] {}\n\n// docs:start:fixed_base_scalar_mul\npub fn fixed_base_scalar_mul(scalar: EmbeddedCurveScalar) -> EmbeddedCurvePoint\n// docs:end:fixed_base_scalar_mul\n{\n let g1 = EmbeddedCurvePoint { x: 1, y: 17631683881184975370165255887551781615748388533673675138860, is_infinite: false };\n multi_scalar_mul([g1], [scalar])\n}\n\n// This is a hack as returning an `EmbeddedCurvePoint` from a foreign function in brillig returns a [BrilligVariable::SingleAddr; 2] rather than BrilligVariable::BrilligArray\n// as is defined in the brillig bytecode format. This is a workaround which allows us to fix this without modifying the serialization format.\n// docs:start:embedded_curve_add\nfn embedded_curve_add(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint\n) -> EmbeddedCurvePoint\n// docs:end:embedded_curve_add\n{\n let point_array = embedded_curve_add_array_return(point1, point2);\n let x = point_array[0];\n let y = point_array[1];\n EmbeddedCurvePoint { x, y, is_infinite: point_array[2] == 1 }\n}\n\n#[foreign(embedded_curve_add)]\nfn embedded_curve_add_array_return(_point1: EmbeddedCurvePoint, _point2: EmbeddedCurvePoint) -> [Field; 3] {}\n"},"258":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/storage/map.nr","source":"use crate::{hash::pedersen_hash, traits::ToField};\n\npub fn derive_storage_slot_in_map<K>(storage_slot: Field, key: K) -> Field where K: ToField {\n pedersen_hash([storage_slot, key.to_field()], 0)\n}\n\nmod test {\n use crate::{address::AztecAddress, storage::map::derive_storage_slot_in_map};\n\n #[test]\n fn test_derive_storage_slot_in_map_matches_typescript() {\n let map_slot = 0x132258fb6962c4387ba659d9556521102d227549a386d39f0b22d1890d59c2b5;\n let key = AztecAddress::from_field(0x302dbc2f9b50a73283d5fb2f35bc01eae8935615817a0b4219a057b2ba8a5a3f);\n\n let slot = derive_storage_slot_in_map(map_slot, key);\n\n // The following value was generated by `map_slot.test.ts`\n let slot_from_typescript = 0x2499880e2b1b831785c17286f99a0d5122fee784ce7b1c04e380c4a991da819a;\n\n assert_eq(slot, slot_from_typescript);\n }\n}\n"},"263":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/type_serialization.nr","source":"use crate::traits::{Serialize, Deserialize};\n\nglobal BOOL_SERIALIZED_LEN: Field = 1;\nglobal U8_SERIALIZED_LEN: Field = 1;\nglobal U32_SERIALIZED_LEN: Field = 1;\nglobal U64_SERIALIZED_LEN: Field = 1;\nglobal U128_SERIALIZED_LEN: Field = 1;\nglobal FIELD_SERIALIZED_LEN: Field = 1;\n\nimpl Serialize<BOOL_SERIALIZED_LEN> for bool {\n fn serialize(self) -> [Field; BOOL_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<BOOL_SERIALIZED_LEN> for bool {\n fn deserialize(fields: [Field; BOOL_SERIALIZED_LEN]) -> bool {\n fields[0] as bool\n }\n}\n\nimpl Serialize<U8_SERIALIZED_LEN> for u8 {\n fn serialize(self) -> [Field; U32_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<U8_SERIALIZED_LEN> for u8 {\n fn deserialize(fields: [Field; U8_SERIALIZED_LEN]) -> Self {\n fields[0] as u8\n }\n}\n\nimpl Serialize<U32_SERIALIZED_LEN> for u32 {\n fn serialize(self) -> [Field; U32_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<U32_SERIALIZED_LEN> for u32 {\n fn deserialize(fields: [Field; U32_SERIALIZED_LEN]) -> Self {\n fields[0] as u32\n }\n}\n\nimpl Serialize<U64_SERIALIZED_LEN> for u64 {\n fn serialize(self) -> [Field; U64_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<U64_SERIALIZED_LEN> for u64 {\n fn deserialize(fields: [Field; U64_SERIALIZED_LEN]) -> Self {\n fields[0] as u64\n }\n}\n\nimpl Serialize<U128_SERIALIZED_LEN> for U128 {\n fn serialize(self) -> [Field; 1] {\n [self.to_integer()]\n }\n}\n\nimpl Deserialize<U128_SERIALIZED_LEN> for U128 {\n fn deserialize(fields: [Field; U128_SERIALIZED_LEN]) -> Self {\n U128::from_integer(fields[0])\n }\n}\n\nimpl Serialize<FIELD_SERIALIZED_LEN> for Field {\n fn serialize(self) -> [Field; U32_SERIALIZED_LEN] {\n [self]\n }\n}\n\nimpl Deserialize<FIELD_SERIALIZED_LEN> for Field {\n fn deserialize(fields: [Field; FIELD_SERIALIZED_LEN]) -> Self {\n fields[0]\n }\n}\n"},"264":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/traits.nr","source":"use crate::utils::field::field_from_bytes;\n\n// Trait: is_empty\n//\n// The general is_empty trait checks if a data type is is empty,\n// and it defines empty for the basic data types as 0.\n//\n// If a Field is equal to zero, then it is regarded as zero.\n// We will go with this definition for now, however it can be problematic \n// if a value can actually be zero. In a future refactor, we can \n// use the optional type for safety. Doing it now would lead to a worse devex\n// and would make it harder to sync up with the cpp code.\n// Preferred over Default trait to convey intent, as default doesn't necessarily mean empty.\ntrait Empty {\n fn empty() -> Self;\n}\n\nimpl Empty for Field {\n fn empty() -> Self {\n 0\n }\n}\n\nimpl Empty for u1 {\n fn empty() -> Self {\n 0\n }\n}\nimpl Empty for u8 {\n fn empty() -> Self {\n 0\n }\n}\nimpl Empty for u32 {\n fn empty() -> Self {\n 0\n }\n}\nimpl Empty for u64 {\n fn empty() -> Self {\n 0\n }\n}\nimpl Empty for U128 {\n fn empty() -> Self {\n U128::from_integer(0)\n }\n}\n\npub fn is_empty<T>(item: T) -> bool where T: Empty + Eq {\n item.eq(T::empty())\n}\n\npub fn is_empty_array<T, let N: u32>(array: [T; N]) -> bool where T: Empty + Eq {\n array.all(|elem| is_empty(elem))\n}\n\ntrait Hash {\n fn hash(self) -> Field;\n}\n\ntrait ToField {\n fn to_field(self) -> Field;\n}\n\nimpl ToField for Field {\n fn to_field(self) -> Field {\n self\n }\n}\n\nimpl ToField for bool {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for u1 {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for u8 {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for u32 {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for u64 {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for U128 {\n fn to_field(self) -> Field {\n self.to_integer()\n }\n}\nimpl<let N: u32> ToField for str<N> {\n fn to_field(self) -> Field {\n assert(N < 32, \"String doesn't fit in a field, consider using Serialize instead\");\n field_from_bytes(self.as_bytes(), true)\n }\n}\n\ntrait FromField {\n fn from_field(value: Field) -> Self;\n}\n\nimpl FromField for Field {\n fn from_field(value: Field) -> Self {\n value\n }\n}\n\nimpl FromField for bool {\n fn from_field(value: Field) -> Self {\n value as bool\n }\n}\nimpl FromField for u1 {\n fn from_field(value: Field) -> Self {\n value as u1\n }\n}\nimpl FromField for u8 {\n fn from_field(value: Field) -> Self {\n value as u8\n }\n}\nimpl FromField for u32 {\n fn from_field(value: Field) -> Self {\n value as u32\n }\n}\nimpl FromField for u64 {\n fn from_field(value: Field) -> Self {\n value as u64\n }\n}\nimpl FromField for U128 {\n fn from_field(value: Field) -> Self {\n U128::from_integer(value)\n }\n}\n\n// docs:start:serialize\ntrait Serialize<let N: u32> {\n fn serialize(self) -> [Field; N];\n}\n// docs:end:serialize\n\nimpl<let N: u32> Serialize<N> for [Field; N] {\n fn serialize(self) -> [Field; N] {\n self\n }\n}\nimpl<let N: u32> Serialize<N> for str<N> {\n fn serialize(self) -> [Field; N] {\n let mut result = [0; N];\n let bytes: [u8; N] = self.as_bytes();\n for i in 0..N {\n result[i] = field_from_bytes([bytes[i];1], true);\n }\n result\n }\n}\n\n// docs:start:deserialize\ntrait Deserialize<let N: u32> {\n fn deserialize(fields: [Field; N]) -> Self;\n}\n// docs:end:deserialize\n\nimpl<let N: u32> Deserialize<N> for [Field; N] {\n fn deserialize(fields: [Field; N]) -> Self {\n fields\n }\n}\n"},"269":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/hash.nr","source":"use crate::{\n abis::{\n contract_class_function_leaf_preimage::ContractClassFunctionLeafPreimage,\n function_selector::FunctionSelector, log_hash::{LogHash, ScopedLogHash, ScopedEncryptedLogHash},\n note_hash::ScopedNoteHash, nullifier::ScopedNullifier\n},\n address::{AztecAddress, EthAddress},\n constants::{\n FUNCTION_TREE_HEIGHT, GENERATOR_INDEX__SILOED_NOTE_HASH, GENERATOR_INDEX__OUTER_NULLIFIER,\n GENERATOR_INDEX__VK, GENERATOR_INDEX__NOTE_HASH_NONCE, GENERATOR_INDEX__UNIQUE_NOTE_HASH,\n MAX_ENCRYPTED_LOGS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX\n},\n merkle_tree::root::root_from_sibling_path,\n messaging::l2_to_l1_message::{L2ToL1Message, ScopedL2ToL1Message},\n recursion::verification_key::VerificationKey, traits::{is_empty, ToField},\n utils::field::field_from_bytes_32_trunc\n};\n\npub fn sha256_to_field<let N: u32>(bytes_to_hash: [u8; N]) -> Field {\n let sha256_hashed = std::hash::sha256(bytes_to_hash);\n let hash_in_a_field = field_from_bytes_32_trunc(sha256_hashed);\n\n hash_in_a_field\n}\n\npub fn private_functions_root_from_siblings(\n selector: FunctionSelector,\n vk_hash: Field,\n function_leaf_index: Field,\n function_leaf_sibling_path: [Field; FUNCTION_TREE_HEIGHT]\n) -> Field {\n let function_leaf_preimage = ContractClassFunctionLeafPreimage { selector, vk_hash };\n let function_leaf = function_leaf_preimage.hash();\n root_from_sibling_path(function_leaf, function_leaf_index, function_leaf_sibling_path)\n}\n\nfn compute_note_hash_nonce(tx_hash: Field, note_index_in_tx: u32) -> Field {\n // Hashing tx hash with note index in tx is guaranteed to be unique\n poseidon2_hash_with_separator(\n [\n tx_hash,\n note_index_in_tx as Field\n ],\n GENERATOR_INDEX__NOTE_HASH_NONCE\n )\n}\n\npub fn compute_unique_note_hash(nonce: Field, note_hash: Field) -> Field {\n let inputs = [nonce, note_hash];\n poseidon2_hash_with_separator(inputs, GENERATOR_INDEX__UNIQUE_NOTE_HASH)\n}\n\npub fn compute_siloed_note_hash(app: AztecAddress, unique_note_hash: Field) -> Field {\n poseidon2_hash_with_separator(\n [\n app.to_field(),\n unique_note_hash\n ],\n GENERATOR_INDEX__SILOED_NOTE_HASH\n )\n}\n\n/// Siloing in the context of Aztec refers to the process of hashing a note hash with a contract address (this way\n/// the note hash is scoped to a specific contract). This is used to prevent intermingling of notes between contracts.\npub fn silo_note_hash(note_hash: ScopedNoteHash, tx_hash: Field, note_index_in_tx: u32) -> Field {\n if note_hash.contract_address.is_zero() {\n 0\n } else {\n let nonce = compute_note_hash_nonce(tx_hash, note_index_in_tx);\n let unique_note_hash = compute_unique_note_hash(nonce, note_hash.value());\n compute_siloed_note_hash(note_hash.contract_address, unique_note_hash)\n }\n}\n\npub fn compute_siloed_nullifier(app: AztecAddress, nullifier: Field) -> Field {\n poseidon2_hash_with_separator(\n [\n app.to_field(),\n nullifier\n ],\n GENERATOR_INDEX__OUTER_NULLIFIER\n )\n}\n\npub fn silo_nullifier(nullifier: ScopedNullifier) -> Field {\n if nullifier.contract_address.is_zero() {\n nullifier.value() // Return value instead of 0 because the first nullifier's contract address is zero.\n } else {\n compute_siloed_nullifier(nullifier.contract_address, nullifier.value())\n }\n}\n\npub fn silo_encrypted_log_hash(log_hash: ScopedLogHash) -> Field {\n // We assume contract address has already been masked\n if log_hash.contract_address.is_zero() {\n 0\n } else {\n accumulate_sha256([log_hash.contract_address.to_field(), log_hash.log_hash.value])\n }\n}\n\npub fn mask_encrypted_log_hash(scoped_log: ScopedEncryptedLogHash) -> AztecAddress {\n if scoped_log.contract_address.is_zero() {\n AztecAddress::from_field(0)\n } else if (scoped_log.log_hash.randomness == 0) {\n scoped_log.contract_address\n } else {\n AztecAddress::from_field(\n poseidon2_hash_with_separator(\n [scoped_log.contract_address.to_field(), scoped_log.log_hash.randomness],\n 0\n )\n )\n }\n}\n\nfn compute_siloed_unencrypted_log_hash(address: AztecAddress, log_hash: Field) -> Field {\n accumulate_sha256([address.to_field(), log_hash])\n}\n\npub fn silo_unencrypted_log_hash(log_hash: ScopedLogHash) -> Field {\n if log_hash.contract_address.is_zero() {\n 0\n } else {\n compute_siloed_unencrypted_log_hash(log_hash.contract_address, log_hash.value())\n }\n}\n\npub fn merkle_hash(left: Field, right: Field) -> Field {\n poseidon2_hash([left, right])\n}\n\npub fn stdlib_recursion_verification_key_compress_native_vk(_vk: VerificationKey) -> Field {\n // Original cpp code\n // stdlib::recursion::verification_key<CT::bn254>::compress_native(private_call.vk, GeneratorIndex::VK);\n // The above cpp method is only ever called on verification key, so it has been special cased here\n let _hash_index = GENERATOR_INDEX__VK;\n 0\n}\n\npub fn compute_l2_to_l1_hash(\n contract_address: AztecAddress,\n recipient: EthAddress,\n content: Field,\n rollup_version_id: Field,\n chain_id: Field\n) -> Field {\n let mut bytes: BoundedVec<u8, 160> = BoundedVec::new();\n\n let inputs = [contract_address.to_field(), rollup_version_id, recipient.to_field(), chain_id, content];\n for i in 0..inputs.len() {\n // TODO are bytes be in fr.to_buffer() ?\n let item_bytes: [u8; 32] = inputs[i].to_be_bytes();\n for j in 0..32 {\n bytes.push(item_bytes[j]);\n }\n }\n\n sha256_to_field(bytes.storage)\n}\n\npub fn silo_l2_to_l1_message(msg: ScopedL2ToL1Message, rollup_version_id: Field, chain_id: Field) -> Field {\n if msg.contract_address.is_zero() {\n 0\n } else {\n compute_l2_to_l1_hash(\n msg.contract_address,\n msg.message.recipient,\n msg.message.content,\n rollup_version_id,\n chain_id\n )\n }\n}\n\n// Computes sha256 hash of 2 input hashes.\n//\n// NB: This method now takes in two 31 byte fields - it assumes that any input\n// is the result of a sha_to_field hash and => is truncated\n//\n// TODO(Jan and David): This is used for the encrypted_log hashes.\n// Can we check to see if we can just use hash_to_field or pedersen_compress here?\n//\npub fn accumulate_sha256(input: [Field; 2]) -> Field {\n // This is a note about the cpp code, since it takes an array of Fields\n // instead of a U128.\n // 4 Field elements when converted to bytes will usually\n // occupy 4 * 32 = 128 bytes.\n // However, this function is making the assumption that each Field\n // only occupies 128 bits.\n //\n // TODO(David): This does not seem to be getting guaranteed anywhere in the code?\n\n // Concatentate two fields into 32x2 = 64 bytes\n // accumulate_sha256 assumes that the inputs are pre-truncated 31 byte numbers\n let mut hash_input_flattened = [0; 64];\n for offset in 0..input.len() {\n let input_as_bytes: [u8; 32] = input[offset].to_be_bytes();\n for byte_index in 0..32 {\n hash_input_flattened[offset * 32 + byte_index] = input_as_bytes[byte_index];\n }\n }\n\n sha256_to_field(hash_input_flattened)\n}\n\n// Computes the final logs hash for a tx.\n// NB: this assumes MAX_ENCRYPTED_LOGS_PER_TX == MAX_UNENCRYPTED_LOGS_PER_TX\n// to avoid doubling code, since we can't define the byte len to be 32*N directly.\npub fn compute_tx_logs_hash(logs: [LogHash; MAX_ENCRYPTED_LOGS_PER_TX]) -> Field {\n // Convert each field element into a byte array and append the bytes to `hash_input_flattened`\n let mut hash_input_flattened = [0; MAX_ENCRYPTED_LOGS_PER_TX * 32];\n for offset in 0..MAX_ENCRYPTED_LOGS_PER_TX {\n let input_as_bytes: [u8; 32] = logs[offset].value.to_be_bytes();\n for byte_index in 0..32 {\n hash_input_flattened[offset * 32 + byte_index] = input_as_bytes[byte_index];\n }\n }\n // Ideally we would push to a slice then hash, but there is no sha_slice\n // Hardcode to 256 bytes for now\n let mut hash = sha256_to_field(hash_input_flattened);\n // Not having a 0 value hash for empty logs causes issues with empty txs\n // used for padding. Returning early is currently unsupported.\n // We always provide sorted logs here, so 0 being empty means all are empty.\n if is_empty(logs[0]) {\n hash = 0;\n }\n hash\n}\n\npub fn compute_tx_note_logs_hash(logs: [LogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX]) -> Field {\n // Convert each field element into a byte array and append the bytes to `hash_input_flattened`\n let mut hash_input_flattened = [0; MAX_NOTE_ENCRYPTED_LOGS_PER_TX * 32];\n for offset in 0..MAX_NOTE_ENCRYPTED_LOGS_PER_TX {\n let input_as_bytes: [u8; 32] = logs[offset].value.to_be_bytes();\n for byte_index in 0..32 {\n hash_input_flattened[offset * 32 + byte_index] = input_as_bytes[byte_index];\n }\n }\n // Ideally we would push to a slice then hash, but there is no sha_slice\n // Hardcode to 256 bytes for now\n let mut hash = sha256_to_field(hash_input_flattened);\n // Not having a 0 value hash for empty logs causes issues with empty txs\n // used for padding. Returning early is currently unsupported.\n // We always provide sorted logs here, so 0 being empty means all are empty.\n if is_empty(logs[0]) {\n hash = 0;\n }\n hash\n}\n\npub fn pedersen_hash<let N: u32>(inputs: [Field; N], hash_index: u32) -> Field {\n std::hash::pedersen_hash_with_separator(inputs, hash_index)\n}\n\npub fn poseidon2_hash<let N: u32>(inputs: [Field; N]) -> Field {\n std::hash::poseidon2::Poseidon2::hash(inputs, N)\n}\n\n#[no_predicates]\npub fn poseidon2_hash_with_separator<let N: u32, T>(\n inputs: [Field; N],\n separator: T\n) -> Field where T: ToField {\n // We manually hash the inputs here, since we cannot express with the type system a constant size inputs array of N + 1\n let in_len = N + 1;\n let two_pow_64 = 18446744073709551616;\n let iv : Field = (in_len as Field) * two_pow_64;\n let mut sponge = std::hash::poseidon2::Poseidon2::new(iv);\n sponge.absorb(separator.to_field());\n\n for i in 0..inputs.len() {\n sponge.absorb(inputs[i]);\n }\n\n sponge.squeeze()\n}\n\n#[test]\nfn smoke_sha256_to_field() {\n let full_buffer = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,\n 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,\n 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,\n 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,\n 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,\n 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,\n 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,\n 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159\n ];\n let result = sha256_to_field(full_buffer);\n\n assert(result == 0x448ebbc9e1a31220a2f3830c18eef61b9bd070e5084b7fa2a359fe729184c7);\n\n // to show correctness of the current ver (truncate one byte) vs old ver (mod full bytes):\n let result_bytes = std::hash::sha256(full_buffer);\n let truncated_field = crate::utils::field::field_from_bytes_32_trunc(result_bytes);\n assert(truncated_field == result);\n let mod_res = result + (result_bytes[31] as Field);\n assert(mod_res == 0x448ebbc9e1a31220a2f3830c18eef61b9bd070e5084b7fa2a359fe729184e0);\n}\n\n#[test]\nfn compute_l2_l1_hash() {\n // All zeroes\n let hash_result = compute_l2_to_l1_hash(AztecAddress::from_field(0), EthAddress::zero(), 0, 0, 0);\n assert(hash_result == 0xb393978842a0fa3d3e1470196f098f473f9678e72463cb65ec4ab5581856c2);\n\n // Non-zero case\n let hash_result = compute_l2_to_l1_hash(AztecAddress::from_field(1), EthAddress::from_field(3), 5, 2, 4);\n assert(hash_result == 0x3f88c1044a05e5340ed20466276500f6d45ca5603913b9091e957161734e16);\n}\n\n#[test]\nfn silo_l2_to_l1_message_matches_typescript() {\n let version = 4;\n let chainId = 5;\n\n let hash = silo_l2_to_l1_message(\n ScopedL2ToL1Message {\n message: L2ToL1Message { recipient: EthAddress::from_field(1), content: 2, counter: 0 },\n contract_address: AztecAddress::from_field(3)\n },\n version,\n chainId\n );\n\n // The following value was generated by `l2_to_l1_message.test.ts`\n let hash_from_typescript = 0x00c6155d69febb9d5039b374dd4f77bf57b7c881709aa524a18acaa0bd57476a;\n\n assert_eq(hash, hash_from_typescript);\n}\n"},"29":{"path":"std/hash/mod.nr","source":"mod poseidon;\nmod mimc;\nmod poseidon2;\nmod keccak;\nmod sha256;\nmod sha512;\n\nuse crate::default::Default;\nuse crate::uint128::U128;\nuse crate::collections::vec::Vec;\nuse crate::embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, multi_scalar_mul, multi_scalar_mul_slice};\nuse crate::meta::derive_via;\n\n// Kept for backwards compatibility\npub use sha256::{digest, sha256, sha256_compression, sha256_var};\n\n#[foreign(blake2s)]\n// docs:start:blake2s\npub fn blake2s<let N: u32>(input: [u8; N]) -> [u8; 32]\n// docs:end:blake2s\n{}\n\n#[foreign(blake3)]\n// docs:start:blake3\npub fn blake3<let N: u32>(input: [u8; N]) -> [u8; 32]\n// docs:end:blake3\n{}\n\n// docs:start:pedersen_commitment\npub fn pedersen_commitment<let N: u32>(input: [Field; N]) -> EmbeddedCurvePoint {\n // docs:end:pedersen_commitment\n pedersen_commitment_with_separator(input, 0)\n}\n\npub fn pedersen_hash_with_separator<let N: u32>(input: [Field; N], separator: u32) -> Field {\n __pedersen_hash_with_separator(input, separator)\n}\n\nfn pedersen_commitment_with_separator<let N: u32>(input: [Field; N], separator: u32) -> EmbeddedCurvePoint {\n let value = __pedersen_commitment_with_separator(input, separator);\n if (value[0] == 0) & (value[1] == 0) {\n EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true }\n } else {\n EmbeddedCurvePoint { x: value[0], y: value[1], is_infinite: false }\n }\n}\n\n#[no_predicates]\nfn pedersen_commitment_with_separator_noir<let N: u32>(input: [Field; N], separator: u32) -> EmbeddedCurvePoint {\n let mut points = [EmbeddedCurveScalar { lo: 0, hi: 0 }; N];\n for i in 0..N {\n // we use the unsafe version because the multi_scalar_mul will constrain the scalars.\n points[i] = from_field_unsafe(input[i]);\n }\n let generators = derive_generators(\"DEFAULT_DOMAIN_SEPARATOR\".as_bytes(), separator);\n multi_scalar_mul(generators, points)\n}\n\n#[no_predicates]\nfn pedersen_hash_with_separator_noir<let N: u32>(input: [Field; N], separator: u32) -> Field {\n let mut scalars: Vec<EmbeddedCurveScalar> = Vec::from_slice([EmbeddedCurveScalar { lo: 0, hi: 0 }; N].as_slice()); //Vec::new();\n\n for i in 0..N {\n scalars.set(i, from_field_unsafe(input[i]));\n }\n scalars.push(EmbeddedCurveScalar { lo: N as Field, hi: 0 as Field });\n let domain_generators :[EmbeddedCurvePoint; N]= derive_generators(\"DEFAULT_DOMAIN_SEPARATOR\".as_bytes(), separator);\n let mut vec_generators = Vec::new();\n for i in 0..N {\n vec_generators.push(domain_generators[i]);\n }\n let length_generator : [EmbeddedCurvePoint; 1] = derive_generators(\"pedersen_hash_length\".as_bytes(), 0);\n vec_generators.push(length_generator[0]);\n multi_scalar_mul_slice(vec_generators.slice, scalars.slice)[0]\n}\n\n// docs:start:pedersen_hash\npub fn pedersen_hash<let N: u32>(input: [Field; N]) -> Field\n// docs:end:pedersen_hash\n{\n __pedersen_hash_with_separator(input, 0)\n}\n\n#[foreign(pedersen_hash)]\nfn __pedersen_hash_with_separator<let N: u32>(input: [Field; N], separator: u32) -> Field {}\n\n#[foreign(pedersen_commitment)]\nfn __pedersen_commitment_with_separator<let N: u32>(input: [Field; N], separator: u32) -> [Field; 2] {}\n\n#[field(bn254)]\nfn derive_generators<let N: u32, let M: u32>(domain_separator_bytes: [u8; M], starting_index: u32) -> [EmbeddedCurvePoint; N] {\n crate::assert_constant(domain_separator_bytes);\n // TODO(https://github.com/noir-lang/noir/issues/5672): Add back assert_constant on starting_index\n __derive_generators(domain_separator_bytes, starting_index)\n}\n\n#[builtin(derive_pedersen_generators)]\n#[field(bn254)]\nfn __derive_generators<let N: u32, let M: u32>(\n domain_separator_bytes: [u8; M],\n starting_index: u32\n) -> [EmbeddedCurvePoint; N] {}\n\n#[field(bn254)]\n // Same as from_field but:\n // does not assert the limbs are 128 bits\n // does not assert the decomposition does not overflow the EmbeddedCurveScalar\n fn from_field_unsafe(scalar: Field) -> EmbeddedCurveScalar {\n let (xlo, xhi) = unsafe {\n crate::field::bn254::decompose_hint(scalar)\n };\n // Check that the decomposition is correct\n assert_eq(scalar, xlo + crate::field::bn254::TWO_POW_128 * xhi);\n EmbeddedCurveScalar { lo: xlo, hi: xhi }\n}\n\npub fn hash_to_field(inputs: [Field]) -> Field {\n let mut sum = 0;\n\n for input in inputs {\n let input_bytes: [u8; 32] = input.to_le_bytes();\n sum += crate::field::bytes32_to_field(blake2s(input_bytes));\n }\n\n sum\n}\n\n// docs:start:keccak256\npub fn keccak256<let N: u32>(input: [u8; N], message_size: u32) -> [u8; 32]\n// docs:end:keccak256\n{\n crate::hash::keccak::keccak256(input, message_size)\n}\n\n#[foreign(poseidon2_permutation)]\npub fn poseidon2_permutation<let N: u32>(_input: [Field; N], _state_length: u32) -> [Field; N] {}\n\n// Generic hashing support. \n// Partially ported and impacted by rust.\n\n// Hash trait shall be implemented per type.\n#[derive_via(derive_hash)]\ntrait Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher;\n}\n\n// docs:start:derive_hash\ncomptime fn derive_hash(s: StructDefinition) -> Quoted {\n let name = quote { Hash };\n let signature = quote { fn hash<H>(_self: Self, _state: &mut H) where H: std::hash::Hasher };\n let for_each_field = |name| quote { _self.$name.hash(_state); };\n crate::meta::make_trait_impl(s, name, signature, for_each_field, quote {}, |fields| fields)\n}\n// docs:end:derive_hash\n\n// Hasher trait shall be implemented by algorithms to provide hash-agnostic means.\n// TODO: consider making the types generic here ([u8], [Field], etc.)\ntrait Hasher{\n fn finish(self) -> Field;\n \n fn write(&mut self, input: Field);\n}\n\n// BuildHasher is a factory trait, responsible for production of specific Hasher.\ntrait BuildHasher<H> where H: Hasher{\n fn build_hasher(self) -> H;\n}\n\nstruct BuildHasherDefault<H>;\n\nimpl<H> BuildHasher<H> for BuildHasherDefault<H>\nwhere \n H: Hasher + Default {\n fn build_hasher(_self: Self) -> H {\n H::default()\n }\n}\n\nimpl<H> Default for BuildHasherDefault<H>\nwhere \n H: Hasher + Default {\n fn default() -> Self {\n BuildHasherDefault {}\n }\n}\n\nimpl Hash for Field {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self);\n }\n}\n\nimpl Hash for u1 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u8 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u16 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u32 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u64 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i8 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i16 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i32 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i64 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for bool {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for () {\n fn hash<H>(_self: Self, _state: &mut H) where H: Hasher {}\n}\n\nimpl Hash for U128 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self.lo as Field);\n H::write(state, self.hi as Field);\n }\n}\n\nimpl<T, let N: u32> Hash for [T; N] where T: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n for elem in self {\n elem.hash(state);\n }\n }\n}\n\nimpl<T> Hash for [T] where T: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.len().hash(state);\n for elem in self {\n elem.hash(state);\n }\n }\n}\n\nimpl<A, B> Hash for (A, B) where A: Hash, B: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.0.hash(state);\n self.1.hash(state);\n }\n}\n\nimpl<A, B, C> Hash for (A, B, C) where A: Hash, B: Hash, C: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.0.hash(state);\n self.1.hash(state);\n self.2.hash(state);\n }\n}\n\nimpl<A, B, C, D> Hash for (A, B, C, D) where A: Hash, B: Hash, C: Hash, D: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.0.hash(state);\n self.1.hash(state);\n self.2.hash(state);\n self.3.hash(state);\n }\n}\n\nimpl<A, B, C, D, E> Hash for (A, B, C, D, E) where A: Hash, B: Hash, C: Hash, D: Hash, E: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.0.hash(state);\n self.1.hash(state);\n self.2.hash(state);\n self.3.hash(state);\n self.4.hash(state);\n }\n}\n\n// Some test vectors for Pedersen hash and Pedersen Commitment.\n// They have been generated using the same functions so the tests are for now useless\n// but they will be useful when we switch to Noir implementation.\n#[test]\nfn assert_pedersen() {\n assert_eq(\n pedersen_hash_with_separator([1], 1), 0x1b3f4b1a83092a13d8d1a59f7acb62aba15e7002f4440f2275edb99ebbc2305f\n );\n assert_eq(\n pedersen_commitment_with_separator([1], 1), EmbeddedCurvePoint {\n x: 0x054aa86a73cb8a34525e5bbed6e43ba1198e860f5f3950268f71df4591bde402,\n y: 0x209dcfbf2cfb57f9f6046f44d71ac6faf87254afc7407c04eb621a6287cac126,\n is_infinite: false\n }\n );\n\n assert_eq(\n pedersen_hash_with_separator([1, 2], 2), 0x26691c129448e9ace0c66d11f0a16d9014a9e8498ee78f4d69f0083168188255\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2], 2), EmbeddedCurvePoint {\n x: 0x2e2b3b191e49541fe468ec6877721d445dcaffe41728df0a0eafeb15e87b0753,\n y: 0x2ff4482400ad3a6228be17a2af33e2bcdf41be04795f9782bd96efe7e24f8778,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3], 3), 0x0bc694b7a1f8d10d2d8987d07433f26bd616a2d351bc79a3c540d85b6206dbe4\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3], 3), EmbeddedCurvePoint {\n x: 0x1fee4e8cf8d2f527caa2684236b07c4b1bad7342c01b0f75e9a877a71827dc85,\n y: 0x2f9fedb9a090697ab69bf04c8bc15f7385b3e4b68c849c1536e5ae15ff138fd1,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4], 4), 0xdae10fb32a8408521803905981a2b300d6a35e40e798743e9322b223a5eddc\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4], 4), EmbeddedCurvePoint {\n x: 0x07ae3e202811e1fca39c2d81eabe6f79183978e6f12be0d3b8eda095b79bdbc9,\n y: 0x0afc6f892593db6fbba60f2da558517e279e0ae04f95758587760ba193145014,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5], 5), 0xfc375b062c4f4f0150f7100dfb8d9b72a6d28582dd9512390b0497cdad9c22\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5], 5), EmbeddedCurvePoint {\n x: 0x1754b12bd475a6984a1094b5109eeca9838f4f81ac89c5f0a41dbce53189bb29,\n y: 0x2da030e3cfcdc7ddad80eaf2599df6692cae0717d4e9f7bfbee8d073d5d278f7,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6], 6), 0x1696ed13dc2730062a98ac9d8f9de0661bb98829c7582f699d0273b18c86a572\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6], 6), EmbeddedCurvePoint {\n x: 0x190f6c0e97ad83e1e28da22a98aae156da083c5a4100e929b77e750d3106a697,\n y: 0x1f4b60f34ef91221a0b49756fa0705da93311a61af73d37a0c458877706616fb,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7], 7), 0x128c0ff144fc66b6cb60eeac8a38e23da52992fc427b92397a7dffd71c45ede3\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7], 7), EmbeddedCurvePoint {\n x: 0x015441e9d29491b06563fac16fc76abf7a9534c715421d0de85d20dbe2965939,\n y: 0x1d2575b0276f4e9087e6e07c2cb75aa1baafad127af4be5918ef8a2ef2fea8fc,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7, 8], 8), 0x2f960e117482044dfc99d12fece2ef6862fba9242be4846c7c9a3e854325a55c\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7, 8], 8), EmbeddedCurvePoint {\n x: 0x1657737676968887fceb6dd516382ea13b3a2c557f509811cd86d5d1199bc443,\n y: 0x1f39f0cb569040105fa1e2f156521e8b8e08261e635a2b210bdc94e8d6d65f77,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9], 9), 0x0c96db0790602dcb166cc4699e2d306c479a76926b81c2cb2aaa92d249ec7be7\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9], 9), EmbeddedCurvePoint {\n x: 0x0a3ceae42d14914a432aa60ec7fded4af7dad7dd4acdbf2908452675ec67e06d,\n y: 0xfc19761eaaf621ad4aec9a8b2e84a4eceffdba78f60f8b9391b0bd9345a2f2,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 10), 0x2cd37505871bc460a62ea1e63c7fe51149df5d0801302cf1cbc48beb8dff7e94\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 10), EmbeddedCurvePoint {\n x: 0x2fb3f8b3d41ddde007c8c3c62550f9a9380ee546fcc639ffbb3fd30c8d8de30c,\n y: 0x300783be23c446b11a4c0fabf6c91af148937cea15fcf5fb054abf7f752ee245,\n is_infinite: false\n }\n );\n}\n\n"},"325":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/address/aztec_address.nr","source":"use crate::{\n crate::address::{partial_address::PartialAddress, public_keys_hash::PublicKeysHash},\n constants::{AZTEC_ADDRESS_LENGTH, GENERATOR_INDEX__CONTRACT_ADDRESS_V1},\n hash::poseidon2_hash_with_separator, traits::{Empty, FromField, ToField, Serialize, Deserialize},\n utils\n};\n\n// Aztec address\nstruct AztecAddress {\n inner : Field\n}\n\nimpl Eq for AztecAddress {\n fn eq(self, other: Self) -> bool {\n self.to_field() == other.to_field()\n }\n}\n\nimpl Empty for AztecAddress {\n fn empty() -> Self {\n Self { inner: 0 }\n }\n}\n\nimpl ToField for AztecAddress {\n fn to_field(self) -> Field {\n self.inner\n }\n}\n\nimpl FromField for AztecAddress {\n fn from_field(value: Field) -> AztecAddress {\n AztecAddress { inner: value }\n }\n}\n\nimpl Serialize<AZTEC_ADDRESS_LENGTH> for AztecAddress {\n fn serialize(self: Self) -> [Field; AZTEC_ADDRESS_LENGTH] {\n [self.to_field()]\n }\n}\n\nimpl Deserialize<AZTEC_ADDRESS_LENGTH> for AztecAddress {\n fn deserialize(fields: [Field; AZTEC_ADDRESS_LENGTH]) -> Self {\n FromField::from_field(fields[0])\n }\n}\n\nimpl AztecAddress {\n pub fn zero() -> Self {\n Self { inner: 0 }\n }\n\n pub fn compute(pub_keys_hash: PublicKeysHash, partial_address: PartialAddress) -> AztecAddress {\n AztecAddress::from_field(\n poseidon2_hash_with_separator(\n [pub_keys_hash.to_field(), partial_address.to_field()],\n GENERATOR_INDEX__CONTRACT_ADDRESS_V1\n )\n )\n }\n\n pub fn is_zero(self) -> bool {\n self.inner == 0\n }\n\n pub fn assert_is_zero(self) {\n assert(self.to_field() == 0);\n }\n\n pub fn conditional_assign(predicate: bool, lhs: Self, rhs: Self) -> Self {\n let result = utils::conditional_assign(predicate, rhs.to_field(), lhs.to_field());\n Self { inner: result }\n }\n}\n\n#[test]\nfn compute_address_from_partial_and_pub_keys_hash() {\n let pub_keys_hash = PublicKeysHash::from_field(1);\n let partial_address = PartialAddress::from_field(2);\n\n let address = AztecAddress::compute(pub_keys_hash, partial_address);\n let expected_computed_address_from_partial_and_pubkey = 0x23ce9be3fa3c846b0f9245cc796902e731d04f086e8a42473bb29e405fc98075;\n assert(address.to_field() == expected_computed_address_from_partial_and_pubkey);\n}\n\n#[test]\nfn from_field_to_field() {\n let address = AztecAddress { inner: 37 };\n assert_eq(FromField::from_field(address.to_field()), address);\n}\n\n#[test]\nfn serde() {\n let address = AztecAddress { inner: 37 };\n assert_eq(Deserialize::deserialize(address.serialize()), address);\n}\n"},"34":{"path":"std/hash/poseidon2.nr","source":"use crate::hash::Hasher;\nuse crate::default::Default;\n\ncomptime global RATE: u32 = 3;\n\nstruct Poseidon2 {\n cache: [Field;3],\n state: [Field;4],\n cache_size: u32,\n squeeze_mode: bool, // 0 => absorb, 1 => squeeze\n}\n\nimpl Poseidon2 {\n #[no_predicates]\n pub fn hash<let N: u32>(input: [Field; N], message_size: u32) -> Field {\n if message_size == N {\n Poseidon2::hash_internal(input, N, false)\n } else {\n Poseidon2::hash_internal(input, message_size, true)\n }\n }\n\n fn new(iv: Field) -> Poseidon2 {\n let mut result = Poseidon2 { cache: [0; 3], state: [0; 4], cache_size: 0, squeeze_mode: false };\n result.state[RATE] = iv;\n result\n }\n\n fn perform_duplex(&mut self) {\n // add the cache into sponge state\n for i in 0..RATE {\n // We effectively zero-pad the cache by only adding to the state\n // cache that is less than the specified `cache_size`\n if i < self.cache_size {\n self.state[i] += self.cache[i];\n }\n }\n self.state = crate::hash::poseidon2_permutation(self.state, 4);\n }\n\n fn absorb(&mut self, input: Field) {\n assert(!self.squeeze_mode);\n if self.cache_size == RATE {\n // If we're absorbing, and the cache is full, apply the sponge permutation to compress the cache\n self.perform_duplex();\n self.cache[0] = input;\n self.cache_size = 1;\n } else {\n // If we're absorbing, and the cache is not full, add the input into the cache\n self.cache[self.cache_size] = input;\n self.cache_size += 1;\n }\n }\n\n fn squeeze(&mut self) -> Field {\n assert(!self.squeeze_mode);\n // If we're in absorb mode, apply sponge permutation to compress the cache.\n self.perform_duplex();\n self.squeeze_mode = true;\n\n // Pop one item off the top of the permutation and return it.\n self.state[0]\n }\n\n fn hash_internal<let N: u32>(input: [Field; N], in_len: u32, is_variable_length: bool) -> Field {\n let two_pow_64 = 18446744073709551616;\n let iv : Field = (in_len as Field) * two_pow_64;\n let mut sponge = Poseidon2::new(iv);\n for i in 0..input.len() {\n if i < in_len {\n sponge.absorb(input[i]);\n }\n }\n\n // In the case where the hash preimage is variable-length, we append `1` to the end of the input, to distinguish\n // from fixed-length hashes. (the combination of this additional field element + the hash IV ensures\n // fixed-length and variable-length hashes do not collide)\n if is_variable_length {\n sponge.absorb(1);\n }\n sponge.squeeze()\n }\n}\n\nstruct Poseidon2Hasher{\n _state: [Field],\n}\n\nimpl Hasher for Poseidon2Hasher {\n fn finish(self) -> Field {\n let iv : Field = (self._state.len() as Field) * 18446744073709551616; // iv = (self._state.len() << 64)\n let mut sponge = Poseidon2::new(iv);\n for i in 0..self._state.len() {\n sponge.absorb(self._state[i]);\n }\n sponge.squeeze()\n }\n\n fn write(&mut self, input: Field) {\n self._state = self._state.push_back(input);\n }\n}\n\nimpl Default for Poseidon2Hasher {\n fn default() -> Self {\n Poseidon2Hasher { _state: &[] }\n }\n}\n"},"401":{"path":"/usr/src/noir-projects/noir-contracts/contracts/key_registry_contract/src/main.nr","source":"contract KeyRegistry {\n use dep::authwit::auth::assert_current_call_valid_authwit_public;\n\n use dep::aztec::{\n keys::{PublicKeys, stored_keys::StoredKeys, public_keys::NpkM},\n state_vars::{PublicMutable, Map}, protocol_types::address::{AztecAddress, PartialAddress}\n };\n\n #[aztec(storage)]\n struct Storage {\n current_keys: Map<AztecAddress, PublicMutable<StoredKeys>>,\n }\n\n impl<Context> Storage<Context> {\n // The init function is typically automatically generated by the macros - here we implement it manually in order\n // to have control over which storage slot is assigned to the current_keys state variable.\n fn init(context: Context) -> Self {\n Storage {\n // Ideally we'd do KEY_REGISTRY_STORAGE_SLOT instead of hardcoding the 1 here, but that is currently\n // causing compilation errors.\n // TODO(#7829): fix this\n current_keys: Map::new(\n context,\n 1,\n |context, slot| { PublicMutable::new(context, slot) }\n )\n }\n }\n }\n\n unconstrained fn get_current_keys(account: AztecAddress) -> pub PublicKeys {\n // If #7524 were to be implemented, this function could be called by an oracle from an unconstrained function\n // in order to produce the preimage of the stored hash, and hence prove the correctness of the keys.\n storage.current_keys.at(account).read().public_keys\n }\n\n #[aztec(public)]\n fn register_initial_keys(account: AztecAddress, partial_address: PartialAddress, keys: PublicKeys) {\n let computed_address = AztecAddress::compute(keys.hash(), partial_address);\n assert(computed_address.eq(account), \"Computed address does not match supplied address\");\n\n storage.current_keys.at(account).write(StoredKeys::new(keys));\n }\n\n #[aztec(public)]\n fn rotate_npk_m(account: AztecAddress, new_npk_m: NpkM, nonce: Field) {\n if (!account.eq(context.msg_sender())) {\n assert_current_call_valid_authwit_public(&mut context, account);\n } else {\n assert(nonce == 0, \"invalid nonce\");\n }\n\n let account_key_storage = storage.current_keys.at(account);\n\n // We read all other current keys so that we can compute the new hash - we can't update just the npk. This means\n // updating all keys at once costs the same as updating just one (unless setting public storage to its current\n // value is cheaper than changing it, e.g. EIP-2200).\n let mut current_keys = account_key_storage.read().public_keys;\n current_keys.npk_m = new_npk_m;\n\n account_key_storage.write(StoredKeys::new(current_keys));\n }\n}\n"},"73":{"path":"/usr/src/noir-projects/aztec-nr/authwit/src/auth.nr","source":"use dep::aztec::protocol_types::{\n abis::function_selector::FunctionSelector, address::AztecAddress,\n constants::{\n GENERATOR_INDEX__AUTHWIT_INNER, GENERATOR_INDEX__AUTHWIT_OUTER, GENERATOR_INDEX__AUTHWIT_NULLIFIER,\n CANONICAL_AUTH_REGISTRY_ADDRESS\n},\n hash::poseidon2_hash_with_separator\n};\nuse dep::aztec::{prelude::Deserialize, context::{PrivateContext, PublicContext, gas::GasOpts}, hash::hash_args_array};\n\n/**\n * Authenticaion witness helper library\n *\n * Authentication Witness is a scheme for authenticating actions on Aztec, so users can allow third-parties\n * (e.g. protocols or other users) to execute an action on their behalf.\n *\n * This library provides helper functions to manage such witnesses.\n * The authentication witness, is some \"witness\" (data) that authenticates a `message_hash`.\n * The simplest example of an authentication witness, is a signature. The signature is the \"evidence\",\n * that the signer has seen the message, agrees with it, and has allowed it.\n * It does not need to be a signature. It could be any kind of \"proof\" that the message is allowed.\n * Another proof could be knowing some kind of secret, or having some kind of \"token\" that allows the message.\n *\n * The `message_hash` is a hash of the following structure:\n * hash(consumer, chain_id, version, inner_hash)\n * - consumer: the address of the contract that is \"consuming\" the message,\n * - chain_id: the chain id of the chain that the message is being consumed on,\n * - version: the version of the chain that the message is being consumed on,\n * - inner_hash: the hash of the \"inner\" message that is being consumed, this is the \"actual\" message or action.\n *\n * While the `inner_hash` could be anything, such as showing you signed a specific message, it will often be\n * a hash of the \"action\" to approve, along with who made the call. As part of this library, we provide a few\n * helper functions to deal with such messages.\n *\n * For example, we provide helper function that is used for checking that the message is an encoding of the current call.\n * This can be used to let some contract \"allow\" another contract to act on its behalf, as long as it can\n * show that it is acting on behalf of the contract.\n *\n * If we take a case of allowing a contract to transfer tokens on behalf of an account, the `inner_hash` can be\n * derived as:\n * inner_hash = hash(caller, \"transfer\", hash(to, amount))\n *\n * Where the `caller` would be the address of the contract that is trying to transfer the tokens, and `to` and `amount`\n * the arguments for the transfer.\n *\n * Note that we have both a `caller` and a `consumer`, the `consumer` will be the contract that is consuming the message,\n * in the case of the transfer, it would be the `Token` contract itself, while the caller, will be the actor that is\n * allowed to transfer the tokens.\n *\n *\n * The authentication mechanism works differently in public and private contexts. In private, we recall that everything\n * is executed on the user's device, so we can use `oracles` to \"ask\" the user (not contract) for information. In public\n * we cannot do this, since it is executed by the sequencer (someone else). Therefore we can instead use a \"registry\"\n * to store the messages that we have approved.\n *\n * A simple example would be a \"token\" that is being \"pulled\" from one account into another. We will first outline\n * how this would look in private, and then in public later.\n *\n * Say that a user `Alice` wants to deposit some tokens into a DeFi protocol (say a DEX).\n * `Alice` would make a `deposit` transaction, that she is executing using her account contract.\n * The account would call the `DeFi` contract to execute `deposit`, which would try to pull funds from the `Token`\n * contract. Since the `DeFi` contract is trying to pull funds from an account that is not its own, it needs to\n * convince the `Token` contract that it is allowed to do so.\n *\n * This is where the authentication witness comes in The `Token` contract computes a `message_hash` from the\n * `transfer` call, and then asks `Alice Account` contract to verify that the `DeFi` contract is allowed to\n * execute that call.\n *\n * `Alice Account` contract can then ask `Alice` if she wants to allow the `DeFi` contract to pull funds from her\n * account. If she does, she will sign the `message_hash` and return the signature to the `Alice Account` which\n * will validate it and return success to the `Token` contract which will then allow the `DeFi` contract to pull\n * funds from `Alice`.\n *\n * To ensure that the same \"approval\" cannot be used multiple times, we also compute a `nullifier` for the\n * authentication witness, and emit it from the `Token` contract (consumer).\n *\n * Note that we can do this flow as we are in private were we can do oracle calls out from contracts.\n *\n *\n * Person Contract Contract Contract\n * Alice Alice Account Token DeFi\n * | | | |\n * | Defi.deposit(Token, 1000) | |\n * |----------------->| | |\n * | | deposit(Token, 1000) |\n * | |---------------------------------------->|\n * | | | |\n * | | | transfer(Alice, Defi, 1000)\n * | | |<---------------------|\n * | | | |\n * | | Check if Defi may call transfer(Alice, Defi, 1000)\n * | |<-----------------| |\n * | | | |\n * | Please give me AuthWit for DeFi | |\n * | calling transfer(Alice, Defi, 1000) | |\n * |<-----------------| | |\n * | | | |\n * | | | |\n * | AuthWit for transfer(Alice, Defi, 1000) |\n * |----------------->| | |\n * | | AuthWit validity | |\n * | |----------------->| |\n * | | | |\n * | | throw if invalid AuthWit |\n * | | | |\n * | | emit AuthWit nullifier |\n * | | | |\n * | | transfer(Alice, Defi, 1000) |\n * | | | |\n * | | | |\n * | | | success |\n * | | |--------------------->|\n * | | | |\n * | | | |\n * | | | deposit(Token, 1000)\n * | | | |\n * | | | |\n *\n *\n * If we instead were in public, we cannot do the same flow. Instead we would use an authentication registry to store\n * the messages that we have approved.\n *\n * To approve a message, `Alice Account` can make a `set_authorized` call to the registry, to set a `message_hash`\n * as authorized. This is essentially a mapping from `message_hash` to `true` for `Alice Contract`. Every account\n * has its own map in the registry, so `Alice` cannot approve a message for `Bob`.\n *\n * The `Token` contract can then try to \"spend\" the approval by calling `consume` on the registry. If the message\n * was approved, the value is updated to `false`, and we return the success flag. For more information on the\n * registry, see `main.nr` in `auth_registry_contract`.\n *\n * Person Contract Contract Contract Contract\n * Alice Alice Account Registry Token DeFi\n * | | | | |\n * | Registry.set_authorized(..., true) | | |\n * |----------------->| | | |\n * | | set_authorized(..., true) | |\n * | |------------------->| | |\n * | | | | |\n * | | set authorized to true | |\n * | | | | |\n * | | | | |\n * | Defi.deposit(Token, 1000) | | |\n * |----------------->| | | |\n * | | deposit(Token, 1000) | |\n * | |-------------------------------------------------------------->|\n * | | | | |\n * | | | transfer(Alice, Defi, 1000) |\n * | | | |<---------------------|\n * | | | | |\n * | | | Check if Defi may call transfer(Alice, Defi, 1000)\n * | | |<------------------| |\n * | | | | |\n * | | throw if invalid AuthWit | |\n * | | | | |\n * | | | | |\n * | | set authorized to false | |\n * | | | | |\n * | | | | |\n * | | | AuthWit validity | |\n * | | |------------------>| |\n * | | | | |\n * | | | | transfer(Alice, Defi, 1000)\n * | | | |<-------------------->|\n * | | | | |\n * | | | | success |\n * | | | |--------------------->|\n * | | | | |\n * | | | | deposit(Token, 1000)\n * | | | | |\n *\n *\n * --- FAQ ---\n * Q: Why are we using a success flag of `keccak256(\"IS_VALID()\")` instead of just returning a boolean?\n * A: We want to make sure that we don't accidentally return `true` if there is a collision in the function selector.\n * By returning a hash of `IS_VALID()`, it becomes very unlikely that there is both a collision and we return\n * a success flag.\n *\n * Q: Why are we using static calls?\n * A: We are using static calls to ensure that the account contract cannot re-enter. If it was a normal call, it\n * could make a new call and do a re-entry attack. Using a static ensures that it cannot update any state.\n *\n * Q: Would it not be cheaper to use a nullifier instead of updating state in public?\n * A: At a quick glance, a public state update + nullifier is 96 bytes, but two state updates are 128, so it would be\n * cheaper to use a nullifier, if this is the way it would always be done. However, if both the approval and the\n * consumption is done in the same transaction, then we will be able to squash the updates (only final tx state diff is posted to DA), and now it is cheaper.\n *\n * Q: Why is the chain id and the version part of the message hash?\n * A: The chain id and the version is part of the message hash to ensure that the message is only valid on a specific\n * chain to avoid a case where the same message could be used across multiple chains.\n */\n\nglobal IS_VALID_SELECTOR = 0xabf64ad4; // 4 first bytes of keccak256(\"IS_VALID()\")\n\n/**\n * Assert that `on_behalf_of` have authorized the current call with a valid authentication witness\n *\n * Computing the `inner_hash` using the `msg_sender`, `selector` and `args_hash` and then making a call out to the\n * `on_behalf_of` contract to verify that the `inner_hash` is valid.\n *\n * @param on_behalf_of The address that have authorized the current call\n */\n// docs:start:assert_current_call_valid_authwit\npub fn assert_current_call_valid_authwit(context: &mut PrivateContext, on_behalf_of: AztecAddress) {\n let inner_hash = compute_inner_authwit_hash([context.msg_sender().to_field(), context.selector().to_field(), context.args_hash]);\n assert_inner_hash_valid_authwit(context, on_behalf_of, inner_hash);\n}\n// docs:end:assert_current_call_valid_authwit\n\n/**\n * Assert that a specific `inner_hash` is valid for the `on_behalf_of` address\n *\n * Used as an internal function for `assert_current_call_valid_authwit` and can be used as a standalone function when\n * the `inner_hash` is from a different source, e.g., say a block of text etc.\n *\n * @param on_behalf_of The address that have authorized the current call\n * @param inner_hash The hash of the message to authorize\n */\npub fn assert_inner_hash_valid_authwit(\n context: &mut PrivateContext,\n on_behalf_of: AztecAddress,\n inner_hash: Field\n) {\n // We perform a static call here and not a standard one to ensure that the account contract cannot re-enter.\n let result: Field = context.static_call_private_function(\n on_behalf_of,\n comptime {\n FunctionSelector::from_signature(\"verify_private_authwit(Field)\")\n },\n [inner_hash]\n ).unpack_into();\n assert(result == IS_VALID_SELECTOR, \"Message not authorized by account\");\n // Compute the nullifier, similar computation to the outer hash, but without the chain_id and version.\n // Those should already be handled in the verification, so we just need something to nullify, that allow same inner_hash for multiple actors.\n let nullifier = compute_authwit_nullifier(on_behalf_of, inner_hash);\n context.push_nullifier(nullifier);\n}\n\n/**\n * Assert that `on_behalf_of` have authorized the current call in the authentication registry\n *\n * Computing the `inner_hash` using the `msg_sender`, `selector` and `args_hash` and then making a call out to the\n * `on_behalf_of` contract to verify that the `inner_hash` is valid.\n *\n * Note that the authentication registry will take the `msg_sender` into account as the consumer, so this will only\n * work if the `msg_sender` is the same as the `consumer` when the `message_hash` was inserted into the registry.\n *\n * @param on_behalf_of The address that have authorized the current call\n */\n// docs:start:assert_current_call_valid_authwit_public\npub fn assert_current_call_valid_authwit_public(context: &mut PublicContext, on_behalf_of: AztecAddress) {\n let inner_hash = compute_inner_authwit_hash(\n [(*context).msg_sender().to_field(), (*context).selector().to_field(), (*context).get_args_hash()]\n );\n assert_inner_hash_valid_authwit_public(context, on_behalf_of, inner_hash);\n}\n// docs:end:assert_current_call_valid_authwit_public\n\n/**\n * Assert that `on_behalf_of` have authorized a speicifc `inner_hash` in the authentication registry\n *\n * Computing the `inner_hash` using the `msg_sender`, `selector` and `args_hash` and then making a call out to the\n * `on_behalf_of` contract to verify that the `inner_hash` is valid.\n *\n * Note that the authentication registry will take the `msg_sender` into account as the consumer, so this will only\n * work if the `msg_sender` is the same as the `consumer` when the `message_hash` was inserted into the registry.\n *\n * @param on_behalf_of The address that have authorized the `inner_hash`\n */\npub fn assert_inner_hash_valid_authwit_public(\n context: &mut PublicContext,\n on_behalf_of: AztecAddress,\n inner_hash: Field\n) {\n let result: Field = context.call_public_function(\n CANONICAL_AUTH_REGISTRY_ADDRESS,\n comptime {\n FunctionSelector::from_signature(\"consume((Field),Field)\")\n },\n [on_behalf_of.to_field(), inner_hash].as_slice(),\n GasOpts::default()\n ).deserialize_into();\n assert(result == IS_VALID_SELECTOR, \"Message not authorized by account\");\n}\n\n/**\n * Compute the `message_hash` from a function call to be used by an authentication witness\n *\n * Useful for when you need a non-account contract to approve during execution. For example if you need a contract\n * to make a call to nested contract, e.g., contract A wants to exit token T to L1 using bridge B, so it needs to allow\n * B to transfer T on its behalf.\n *\n * @param caller The address of the contract that is calling the function, in the example above, this would be B\n * @param consumer The address of the contract that is consuming the message, in the example above, this would be T\n * @param chain_id The chain id of the chain that the message is being consumed on\n * @param version The version of the chain that the message is being consumed on\n * @param selector The function selector of the function that is being called\n * @param args The arguments of the function that is being called\n */\n// docs:start:compute_authwit_message_hash_from_call\npub fn compute_authwit_message_hash_from_call<let N: u32>(\n caller: AztecAddress,\n consumer: AztecAddress,\n chain_id: Field,\n version: Field,\n selector: FunctionSelector,\n args: [Field; N]\n) -> Field {\n let args_hash = hash_args_array(args);\n let inner_hash = compute_inner_authwit_hash([caller.to_field(), selector.to_field(), args_hash]);\n compute_authwit_message_hash(consumer, chain_id, version, inner_hash)\n}\n// docs:end:compute_authwit_message_hash_from_call\n\n/**\n * Computes the `inner_hash` of the authentication witness\n *\n * This is used internally, but also useful in cases where you want to compute the `inner_hash` for a specific message\n * that is not necessarily a call, but just some \"bytes\" or text.\n *\n * @param args The arguments to hash\n */\npub fn compute_inner_authwit_hash<let N: u32>(args: [Field; N]) -> Field {\n poseidon2_hash_with_separator(args, GENERATOR_INDEX__AUTHWIT_INNER)\n}\n\n/**\n * Computs the `authwit_nullifier` for a specific `on_behalf_of` and `inner_hash`\n *\n * Using the `on_behalf_of` and the `inner_hash` to ensure that the nullifier is siloed for a specific `on_behalf_of`.\n *\n * @param on_behalf_of The address that have authorized the `inner_hash`\n * @param inner_hash The hash of the message to authorize\n */\npub fn compute_authwit_nullifier(on_behalf_of: AztecAddress, inner_hash: Field) -> Field {\n poseidon2_hash_with_separator(\n [on_behalf_of.to_field(), inner_hash],\n GENERATOR_INDEX__AUTHWIT_NULLIFIER\n )\n}\n\n/**\n * Computes the `message_hash` for the authentication witness\n *\n * @param consumer The address of the contract that is consuming the message\n * @param chain_id The chain id of the chain that the message is being consumed on\n * @param version The version of the chain that the message is being consumed on\n * @param inner_hash The hash of the \"inner\" message that is being consumed\n */\npub fn compute_authwit_message_hash(\n consumer: AztecAddress,\n chain_id: Field,\n version: Field,\n inner_hash: Field\n) -> Field {\n poseidon2_hash_with_separator(\n [\n consumer.to_field(),\n chain_id,\n version,\n inner_hash\n ],\n GENERATOR_INDEX__AUTHWIT_OUTER\n )\n}\n\n/**\n * Helper function to set the authorization status of a message hash\n *\n * Wraps a public call to the authentication registry to set the authorization status of a `message_hash`\n *\n * @param message_hash The hash of the message to authorize\n * @param authorize True if the message should be authorized, false if it should be revoked\n */\npub fn set_authorized(context: &mut PublicContext, message_hash: Field, authorize: bool) {\n context.call_public_function(\n CANONICAL_AUTH_REGISTRY_ADDRESS,\n comptime {\n FunctionSelector::from_signature(\"set_authorized(Field,bool)\")\n },\n [message_hash, authorize as Field].as_slice(),\n GasOpts::default()\n ).assert_empty();\n}\n\n/**\n * Helper function to reject all authwits\n *\n * Wraps a public call to the authentication registry to set the `reject_all` flag\n *\n * @param reject True if all authwits should be rejected, false otherwise\n */\npub fn set_reject_all(context: &mut PublicContext, reject: bool) {\n context.call_public_function(\n CANONICAL_AUTH_REGISTRY_ADDRESS,\n comptime {\n FunctionSelector::from_signature(\"set_reject_all(bool)\")\n },\n [context.this_address().to_field(), reject as Field].as_slice(),\n GasOpts::default()\n ).assert_empty();\n}\n"},"84":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/keys/stored_keys.nr","source":"use crate::keys::public_keys::{PublicKeys, PUBLIC_KEYS_LENGTH};\nuse dep::protocol_types::traits::{Serialize, Deserialize};\n\n// This struct represents how public keys are stored in the key registry. We store not just the keys themselves but also\n// their hash, so that when reading in private we can perform a historical read for the hash and then show that it\n// corresponds to a preimage obtained from an unconstrained hint. We do store the keys keys regardless as they might be\n// needed during public execution, and since we need to broadcast and produce hints in some standardized way.\n// While it might seem odd to create a struct for what is effectively some data and a pure function called on it, state\n// variables rely on serializable structs in order to persist data to storage, so we must use this abstraction.\nstruct StoredKeys {\n public_keys: PublicKeys,\n hash: Field,\n}\n\nimpl StoredKeys {\n // Instances of StoredKeys are expected to only be created by calling this function so that we guarantee that the\n // hash field does indeed correspond to the hash of the keys. Ideally we'd forbid direct access to the struct, but \n // Noir doesn't yet support private members.\n fn new(public_keys: PublicKeys) -> Self {\n Self { public_keys, hash: public_keys.hash().inner }\n }\n}\n\n// Our serialization is the concatenation of the public keys serialization plush the hash, so we need one extra field.\nglobal STORED_KEYS_LENGTH: u32 = PUBLIC_KEYS_LENGTH + 1;\n\nimpl Serialize<STORED_KEYS_LENGTH> for StoredKeys {\n fn serialize(self) -> [Field; STORED_KEYS_LENGTH] {\n // The code below is equivalent to:\n // [ ...self.public_keys.serialize(), self.hash ]\n\n let mut array = [0; STORED_KEYS_LENGTH];\n\n let serialized_keys = self.public_keys.serialize();\n for i in 0..serialized_keys.len() {\n array[i] = serialized_keys[i];\n }\n\n array[PUBLIC_KEYS_LENGTH] = self.hash;\n\n array\n }\n}\n\nimpl Deserialize<STORED_KEYS_LENGTH> for StoredKeys {\n fn deserialize(array: [Field; STORED_KEYS_LENGTH]) -> Self {\n // The code below is equivalent to:\n // Self { public_keys: PublicKeys::deserialize(array[0 : PUBLIC_KEYS_LENGTH]), hash: array[PUBLIC_KEYS_LENGTH] }\n\n let mut serialized_keys = [0; PUBLIC_KEYS_LENGTH];\n for i in 0..serialized_keys.len() {\n serialized_keys[i] = array[i];\n }\n\n let hash = array[PUBLIC_KEYS_LENGTH];\n\n Self { public_keys: PublicKeys::deserialize(serialized_keys), hash }\n }\n}\n"},"85":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/keys/public_keys.nr","source":"use dep::protocol_types::{\n address::PublicKeysHash, constants::GENERATOR_INDEX__PUBLIC_KEYS_HASH,\n hash::poseidon2_hash_with_separator, point::{Point, POINT_LENGTH},\n traits::{Deserialize, Serialize, Empty, is_empty, Hash}\n};\n\nglobal PUBLIC_KEYS_LENGTH: u32 = 12;\n\nstruct PublicKeys {\n npk_m: NpkM,\n ivpk_m: IvpkM,\n ovpk_m: OvpkM,\n tpk_m: TpkM,\n}\n\ntrait ToPoint {\n fn to_point(self) -> Point;\n}\n\nstruct NpkM {\n inner: Point\n}\n\nimpl ToPoint for NpkM {\n fn to_point(self) -> Point {\n self.inner\n }\n}\n\nimpl Serialize<POINT_LENGTH> for NpkM {\n fn serialize(self) -> [Field; POINT_LENGTH] {\n self.inner.serialize()\n }\n}\n\n// Note: If we store npk_m_hash directly we can remove this trait implementation. See #8091\nimpl Hash for NpkM {\n fn hash(self) -> Field {\n self.inner.hash()\n }\n}\n\nstruct IvpkM {\n inner: Point\n}\n\nimpl ToPoint for IvpkM {\n fn to_point(self) -> Point {\n self.inner\n }\n}\n\nimpl Serialize<POINT_LENGTH> for IvpkM {\n fn serialize(self) -> [Field; POINT_LENGTH] {\n self.inner.serialize()\n }\n}\n\nstruct OvpkM {\n inner: Point\n}\n\nimpl Hash for OvpkM {\n fn hash(self) -> Field {\n self.inner.hash()\n }\n}\n\nimpl ToPoint for OvpkM {\n fn to_point(self) -> Point {\n self.inner\n }\n}\n\nimpl Serialize<POINT_LENGTH> for OvpkM {\n fn serialize(self) -> [Field; POINT_LENGTH] {\n self.inner.serialize()\n }\n}\n\nstruct TpkM {\n inner: Point\n}\n\nimpl ToPoint for TpkM {\n fn to_point(self) -> Point {\n self.inner\n }\n}\n\nimpl Empty for PublicKeys {\n fn empty() -> Self {\n PublicKeys {\n npk_m: NpkM { inner: Point::empty() },\n ivpk_m: IvpkM { inner: Point::empty() },\n ovpk_m: OvpkM { inner: Point::empty() },\n tpk_m: TpkM { inner: Point::empty() }\n }\n }\n}\n\nimpl Eq for PublicKeys {\n fn eq(self, other: PublicKeys) -> bool {\n (self.npk_m.inner == other.npk_m.inner)\n & (self.ivpk_m.inner == other.ivpk_m.inner)\n & (self.ovpk_m.inner == other.ovpk_m.inner)\n & (self.tpk_m.inner == other.tpk_m.inner)\n }\n}\n\nimpl PublicKeys {\n pub fn hash(self) -> PublicKeysHash {\n PublicKeysHash::from_field(\n if is_empty(self) {\n 0\n } else {\n poseidon2_hash_with_separator(self.serialize(), GENERATOR_INDEX__PUBLIC_KEYS_HASH as Field)\n }\n )\n }\n}\n\nimpl Serialize<PUBLIC_KEYS_LENGTH> for PublicKeys {\n fn serialize(self) -> [Field; PUBLIC_KEYS_LENGTH] {\n [\n self.npk_m.inner.x,\n self.npk_m.inner.y,\n self.npk_m.inner.is_infinite as Field,\n self.ivpk_m.inner.x,\n self.ivpk_m.inner.y,\n self.ivpk_m.inner.is_infinite as Field,\n self.ovpk_m.inner.x,\n self.ovpk_m.inner.y,\n self.ovpk_m.inner.is_infinite as Field,\n self.tpk_m.inner.x,\n self.tpk_m.inner.y,\n self.tpk_m.inner.is_infinite as Field\n ]\n }\n}\n\nimpl Deserialize<PUBLIC_KEYS_LENGTH> for PublicKeys {\n fn deserialize(serialized: [Field; PUBLIC_KEYS_LENGTH]) -> PublicKeys {\n PublicKeys {\n npk_m: NpkM { inner: Point { x: serialized[0], y: serialized[1], is_infinite: serialized[2] as bool } },\n ivpk_m: IvpkM { inner: Point { x: serialized[3], y: serialized[4], is_infinite: serialized[5] as bool } },\n ovpk_m: OvpkM { inner: Point { x: serialized[6], y: serialized[7], is_infinite: serialized[8] as bool } },\n tpk_m: TpkM { inner: Point { x: serialized[9], y: serialized[10], is_infinite: serialized[11] as bool } }\n }\n }\n}\n\n#[test]\nfn compute_public_keys_hash() {\n let keys = PublicKeys {\n npk_m: NpkM { inner: Point { x: 1, y: 2, is_infinite: false } },\n ivpk_m: IvpkM { inner: Point { x: 3, y: 4, is_infinite: false } },\n ovpk_m: OvpkM { inner: Point { x: 5, y: 6, is_infinite: false } },\n tpk_m: TpkM { inner: Point { x: 7, y: 8, is_infinite: false } }\n };\n\n let actual = keys.hash();\n let expected_public_keys_hash = 0x0fecd9a32db731fec1fded1b9ff957a1625c069245a3613a2538bd527068b0ad;\n\n assert(actual.to_field() == expected_public_keys_hash);\n}\n\n#[test]\nfn compute_empty_hash() {\n let keys = PublicKeys::empty();\n\n let actual = keys.hash();\n let test_data_empty_hash = 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n assert(actual.to_field() == test_data_empty_hash);\n}\n\n#[test]\nfn test_public_keys_serialization() {\n let keys = PublicKeys {\n npk_m: NpkM { inner: Point { x: 1, y: 2, is_infinite: false } },\n ivpk_m: IvpkM { inner: Point { x: 3, y: 4, is_infinite: false } },\n ovpk_m: OvpkM { inner: Point { x: 5, y: 6, is_infinite: false } },\n tpk_m: TpkM { inner: Point { x: 7, y: 8, is_infinite: false } }\n };\n\n let serialized = keys.serialize();\n let deserialized = PublicKeys::deserialize(serialized);\n\n assert_eq(keys.npk_m.inner.x, deserialized.npk_m.inner.x);\n assert_eq(keys.npk_m.inner.y, deserialized.npk_m.inner.y);\n assert_eq(keys.ivpk_m.inner.x, deserialized.ivpk_m.inner.x);\n assert_eq(keys.ivpk_m.inner.y, deserialized.ivpk_m.inner.y);\n assert_eq(keys.ovpk_m.inner.x, deserialized.ovpk_m.inner.x);\n assert_eq(keys.ovpk_m.inner.y, deserialized.ovpk_m.inner.y);\n assert_eq(keys.tpk_m.inner.x, deserialized.tpk_m.inner.x);\n assert_eq(keys.tpk_m.inner.y, deserialized.tpk_m.inner.y);\n}\n"}}}
|
|
1
|
+
{"transpiled":true,"noir_version":"0.34.0+e0185e75e65df08b5334856f8bf63fa3aed7049a","name":"KeyRegistry","functions":[{"name":"register_initial_keys","is_unconstrained":true,"custom_attributes":["aztec(public)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"account","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"partial_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::partial_address::PartialAddress"},"visibility":"private"},{"name":"keys","type":{"fields":[{"name":"npk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::NpkM"}},{"name":"ivpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::IvpkM"}},{"name":"ovpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::OvpkM"}},{"name":"tpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::TpkM"}}],"kind":"struct","path":"aztec::keys::public_keys::PublicKeys"},"visibility":"private"}],"return_type":null},"bytecode":"H4sIAAAAAAAC/31YT4g0RxV/VdXd27s7O7s709Mz0zs9P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rKktVV1mquspS1VWWaq6yVHOVpZqrLNXwsxTTtJOdeTHcP2KV0r4A+IlHAMAPMQIAfi4RABTcbjUGUHC71RCga7/dquN7vACAb9sCAJiR3TSBedNNE5jd3DSBOchF0yX22TpJGV1wvMDaOkcZLjm+/iNXtLZmghKtsZng8GryBdfYUFDCNTYVlHCNjQUF3GhsLijhGhsMSrjGJoMSrrHLrBIuG8MdbU294Fq7aU3AtZaqBFxrqUrAtZaqBFxrqWqMS9ZSlYBrOFU9w/WVqshXqjpiD9CRuJ6+CnD5t75mVeRrVkW+ZlXka1alYFPUrri+ZlUKtlDtiusrVSlYELUrrq+YkXzFDAXLwvbC/Xr5278//Prxw0+ffv7t8jPXf/mvz3/98vGXz3/+9ct//vnHv7kc/F8=","brillig_names":["register_initial_keys"],"assert_messages":{"890":"Array index out of bounds","753":"attempt to add with overflow","1009":"Array index out of bounds","241":"Array index out of bounds","177":"Array index out of bounds","869":"attempt to add with overflow","997":"attempt to add with overflow","732":"Array index out of bounds","659":"Array index out of bounds","851":"Array index out of bounds","324":"Array index out of bounds","193":"Array index out of bounds","577":"Array index out of bounds","641":"Array index out of bounds","312":"attempt to add with overflow","437":"Computed address does not match supplied address","1025":"Array index out of bounds","955":"attempt to add with overflow","882":"Array index out of bounds","815":"attempt to add with overflow","858":"Array index out of bounds","340":"Array index out of bounds","593":"Array index out of bounds","1038":"attempt to add with overflow","270":"attempt to add with overflow","206":"attempt to add with overflow","712":"attempt to add with overflow","898":"Array index out of bounds","724":"Array index out of bounds","1017":"Array index out of bounds","185":"Array index out of bounds","944":"Array index out of bounds","807":"Array index out of bounds","740":"Array index out of bounds","353":"attempt to add with overflow","926":"Array index out of bounds","670":"attempt to add with overflow","606":"attempt to add with overflow","911":"attempt to add with overflow","332":"Array index out of bounds","585":"Array index out of bounds","454":"Storage slot 0 not allowed. Storage slots must start from 1.","259":"Array index out of bounds"}},{"name":"get_current_keys","is_unconstrained":true,"custom_attributes":[],"abi":{"error_types":{},"parameters":[{"name":"account","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"}],"return_type":{"abi_type":{"fields":[{"name":"npk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::NpkM"}},{"name":"ivpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::IvpkM"}},{"name":"ovpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::OvpkM"}},{"name":"tpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::TpkM"}}],"kind":"struct","path":"aztec::keys::public_keys::PublicKeys"},"visibility":"public"}},"bytecode":"H4sIAAAAAAAA/71ZzW/cVBB/G3+s7bV3vQn95uA7qNptKRSJQ0KB0gKtBBJ3J3baiGSNvA6Fv4cDnOAMEgeExBXRv6jxdib728lkVaV+fdLuPI/n4zfz3rPnPffMyxaf/HrU94jyNTbmbROdvF6bdmhrEis4N4g6RF0Ro0+0TzQgGhKNiA4gTwvjrnCELYZ7G+TcJac+OQvISUT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J0Sou6KS16TkspLTCnpZSW/+ByJaS0WIOAKi3iOufw8DJfeHNSb5tW75pW75tWH1pWb0XT6mXT6lXT6nXT6qFp9U3XWtt0rbVN11rbdK21Tdda13StdU3XWkd+vocUrbPos3ry831VPfWrFiAqUWDtlXpP/aqFEP8NQRntcvWFFbzSsWemlckuEntCpX6JT4hK3XtPiErdqH8P1diEmjW3zqjUZ/kJUamXhAlRqa8XvofqIaEGd41KfXExISr1lciEqOQN0GSogZdbuqBqYa5RebmlKiovt1RFZeWWtHEJ1YlrVOgHlZVbqqOyckt1VFZuSTuTUL2/RmXlluqorNxSFVUKVnYJYWXll0BEIRqkHbGyMkwIKyvHhLBCR6ysPFPOqmDEyso0IaysXBPCyso2gUtdUvBhxMrKN9VZJSvfhLDy8k11Vl6+KaRGkxFuxMrLN9VZoSNWXr6pzsrKNxmlEqs2I1ZWvglhZeWbEFZWvqnOqlj5ppwV9IiVlW9CWFn5JoSVlW8yIa1frRj1YPATRhmxsvJNCCsv31RnZeWbrJSJVY3rKyvfhLCy8k11Vs3KNyGsrHyTTUefa2tG/WHNyjchrKx8E8IKHbGy8k05a3avgsjKyjchrLx8U5WV/mby2gY3SX43OYjLDjcRRvLJzyB1+eQnhbp88td5XT75JU9dPvlVTFU++T3liHzym8r9ZVN5dnB3lE/+BJe6fPJVty6fetVF5JPf1F+XT/4Ul7p88se41OWTP8elLp/8QS5V+eTPhEDkt111yZ/dgMhvu+qSP2MBkd921SV/FkJF/v7w7Pfybb2836zO9119+tg+ZLdh3f15/frNIfgv","brillig_names":["get_current_keys"]},{"name":"rotate_npk_m","is_unconstrained":true,"custom_attributes":["aztec(public)"],"abi":{"error_types":{},"parameters":[{"name":"inputs","type":{"fields":[{"name":"calldata_length","type":{"kind":"field"}},{"name":"is_static_call","type":{"kind":"boolean"}}],"kind":"struct","path":"aztec::context::inputs::public_context_inputs::PublicContextInputs"},"visibility":"private"},{"name":"account","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"new_npk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::NpkM"},"visibility":"private"},{"name":"nonce","type":{"kind":"field"},"visibility":"private"}],"return_type":null},"bytecode":"H4sIAAAAAAAC/31ZW4gsRxmuruqZ7ememd2dme6e6bl0T8/uuWhvzjkx6RMDASE5OceIIQkRoyJRoj4oiBjyIAoajBIlKlGM6IOGgIqShxOj8QL6IOpDIAko3oKgAdHzoJA8hHh78Pv+6u6ZxV0Xureq66//XlXfX3NWGUefU8a7Ramzymz5eKngtMJfgMdXyrtxrtreTd5Nt6Pv3WQfpfE4HLjkXZKBS/axA+cxS5nzJHXxvqBaeN+s2nhfVFvnSenh/XrVuQrkg5vJ4BbKLEWkAZdSG3+z5270zipHBaUODn1qq26pu35GNr6v2i2/Fymn589U2/dvV9YYeURF2tkDI6ePlruNl7ODl9k9oCP8QhXg0en66J5R/kVHqcK5Isw7S74H4DsYQoFBo+8AvVGj7wg9t+4FLnph3euG6EV1rxehF9dmGDXBS0/Rn0wTjIw5kqizjnHYHOuk1JOENAm7yaTU43gGzSfQaDJGa2xK1YMFd3aV8c2YpJMD5f5ajQt1V+kM/NIZmdKJktKJI1+ZpBcfKOfNKi7U3WCZ7MR9vOMpTL9HTWk6OMfTa+Bi++eo+i92VXsaz9YGoDVtWvOmtWhaKd2dsZuJTSmaqc5KlS0RwyIvdQ7/mqVewk8brVKncTW9lXN6vjE9L1WegYp8M31Ma4YnnZZ6Z454LAr1ELw0K9Rn4aVZksLYP6i0UA+XziLxlZMEET59UUW031J+iZS7CT4/qZJCfaV0pnOoNKNKyTpKMzTnmhFy6ZSZjt5g4CpQqKh0ZnMZhg7zGXt63dMzaNd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MxfieL7q5Et1DPZhDeQ4uLmJnY3zTXJX4GBPKsb5ZsSueOabPi/hQe4Nxvnm2q54QPG08MzXOXfFM1+b3RWP7NSD4pmvge+KZ75uvyeeJDw1Y3iEp2YMj6bmJh5NzU08oHhaeDQ1N/Foam7i0dTcxKOpuYlnvtQMLlc8cLwPymFD586O58u2mOP54irmeL4EijkGcY4nfBYccSzuWXAOuxJ3djxfQEMcc9gct+X4boJ5qLibYJ4T7iaYl/67CdlNfvuJFw6bbr4jnPbRe47DrokD6ci+sYHREX5fo/2wlOOwpeRIPKB4WniE39fA8Ai/r4HhEX5fA8Mj/L4Ghkf400AIHg6bqL4rnubhV47D9qwj8UhPzQge6akZwQOKp4VHempG8EhPzQgeTc1NPJqam7FQU3MLD4eNjEfi0TdPm3h0rbmJR9eam3hA8bTw6FpzE4+uNTfxaGpu4tHU3MSjqbmFZ8Jtqrvi0VjYxKOxsIkHFE8LT5fC7pKreBYzbb+Q7fpMO2S3wbE2vWnKBDUVepr6bCDdWZMdoMn4qsmHB03H0WVJI2+jy+3f18GBY+/As3cA7B0E9g4ieweJlIO7pkxQU6GnKYyobRGqpmSfaLIENTmCmkbUn7BdT9EjM4dNqb5/lvL20LuL4c0BsHcQiDvwJq9J0ttdz2PhrTMJkb2DxN5BZu+gcHcQDXsHlr0Dx94B9ZqMO6Bek3EH7GtyZF+TI/uaHNnX5Mi+JidaNfmuiVaVvWuiVTfvmmhVwr98Xf74/x9+//jhl0+//rH80uv/++/Pf/vy8bfPb3/88p9/3f+fZfB/AQ==","brillig_names":["rotate_npk_m"],"assert_messages":{"1213":"Array index out of bounds","890":"Array index out of bounds","1015":"attempt to add with overflow","1076":"Array index out of bounds","1140":"Array index out of bounds","311":"Array index out of bounds","46":"invalid nonce","299":"attempt to add with overflow","997":"Array index out of bounds","1122":"Array index out of bounds","820":"attempt to add with overflow","1052":"Array index out of bounds","98":"attempt to add with overflow","756":"attempt to add with overflow","217":"attempt to add with overflow","470":"Nested call failed!","735":"Array index out of bounds","903":"attempt to add with overflow","196":"Array index out of bounds","257":"attempt to add with overflow","1092":"Array index out of bounds","961":"attempt to add with overflow","504":"Storage slot 0 not allowed. Storage slots must start from 1.","1205":"Array index out of bounds","882":"Array index out of bounds","327":"Array index out of bounds","1004":"Array index out of bounds","809":"Array index out of bounds","486":"Message not authorized by account","227":"Array index out of bounds","1193":"attempt to add with overflow","727":"Array index out of bounds","340":"attempt to add with overflow","791":"Array index out of bounds","1041":"attempt to add with overflow","1105":"attempt to add with overflow","1221":"Array index out of bounds","1151":"attempt to add with overflow","319":"Array index out of bounds","1273":"attempt to add with overflow","188":"Array index out of bounds","246":"Array index out of bounds","953":"Array index out of bounds","1023":"Array index out of bounds","874":"Array index out of bounds","743":"Array index out of bounds","1063":"attempt to add with overflow","1084":"Array index out of bounds","222":"Index out of bounds","862":"attempt to add with overflow","1240":"attempt to add with overflow","1234":"attempt to add with overflow","204":"Array index out of bounds","1030":"Array index out of bounds"}},{"name":"compute_note_hash_and_optionally_a_nullifier","is_unconstrained":true,"custom_attributes":[],"abi":{"error_types":{},"parameters":[{"name":"contract_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"},"visibility":"private"},{"name":"nonce","type":{"kind":"field"},"visibility":"private"},{"name":"storage_slot","type":{"kind":"field"},"visibility":"private"},{"name":"note_type_id","type":{"kind":"field"},"visibility":"private"},{"name":"compute_nullifier","type":{"kind":"boolean"},"visibility":"private"},{"name":"serialized_note","type":{"kind":"array","length":0,"type":{"kind":"field"}},"visibility":"private"}],"return_type":{"abi_type":{"kind":"array","length":4,"type":{"kind":"field"}},"visibility":"public"}},"bytecode":"H4sIAAAAAAAA/9VWzU7DMAx2Wdqm6yomeAB6BA7QSUPacRK/D8ALTKMSu2xoLTw/S2dr39KyC4m0RaqcOLH95bOTNKBt05sv4H7IMqJ2kzVTlsX/2sihr8InzuBEcJ6dCM7eieBUDnEGHTiNVNw3586cuZi257E1icYm0T2YpwOOAiuoaXfQv2b5/rmo8vlqWa9n8zr/WJVVvlzV+XdV5l/rxc+sLs24rFosJwwIQU/dsDZKrI078z0ZzxPG7gH3g/Hb9+O7MIl91DvuCWKZonjlOZEBfxnPE9hntCucJ9BJwT2DTl6EF9DFtB/L4NF+8jXxmK8iAw4JYmDDwyb13idveW5endSK37fiNzllwjXoFA9S0IVWzZjhFcxr2JPM31p7Qyw9C4vxG/rggnMf+fBdFGPkUHVwGHZwGHVweLn53iw/BnesveBuXhQNGBXEEpxnsEYDjhDGN7TTJ1IE7E94Eb/nZu9SR/pvO2XZDWFNBHaxZRcD7mbt5su5nzKfeAc4/DMb2Xe2y78+PMuKfUss2U8Ia+5ZXlC7IQdEfu/ABDC5fiMP3a8S8xju14GFaQg6rMWB5Wtg+ToGu4z2uRWd3OUpyF9gHhYxHg4AAA==","debug_symbols":"lZDBCsMgDIbfJWcPpbUt+CpjFG21BCQWtYMhvvvSbYdevYR8yf9d/gKbNee+ILmQQD0K+LDqjIGYShVgInqP+3I/Q3cN2X/z6dB0Yco6ZlDDNAuwtPE29+w79BaU7Mb6FCCHdkW2K2O7MjUqlfGlI2rj7b8pd9J6Ky6/j9+Hwx8=","brillig_names":["compute_note_hash_and_optionally_a_nullifier"]}],"outputs":{"globals":{"storage":[{"fields":[{"name":"current_keys","value":{"fields":[{"name":"slot","value":{"kind":"integer","sign":false,"value":"0000000000000000000000000000000000000000000000000000000000000001"}}],"kind":"struct"}}],"kind":"struct"}]},"structs":{"functions":[{"fields":[{"name":"parameters","type":{"fields":[{"name":"account","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"partial_address","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::partial_address::PartialAddress"}},{"name":"keys","type":{"fields":[{"name":"npk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::NpkM"}},{"name":"ivpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::IvpkM"}},{"name":"ovpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::OvpkM"}},{"name":"tpk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::TpkM"}}],"kind":"struct","path":"aztec::keys::public_keys::PublicKeys"}}],"kind":"struct","path":"KeyRegistry::register_initial_keys_parameters"}}],"kind":"struct","path":"KeyRegistry::register_initial_keys_abi"},{"fields":[{"name":"parameters","type":{"fields":[{"name":"account","type":{"fields":[{"name":"inner","type":{"kind":"field"}}],"kind":"struct","path":"authwit::aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"new_npk_m","type":{"fields":[{"name":"inner","type":{"fields":[{"name":"x","type":{"kind":"field"}},{"name":"y","type":{"kind":"field"}},{"name":"is_infinite","type":{"kind":"boolean"}}],"kind":"struct","path":"std::embedded_curve_ops::EmbeddedCurvePoint"}}],"kind":"struct","path":"aztec::keys::public_keys::NpkM"}},{"name":"nonce","type":{"kind":"field"}}],"kind":"struct","path":"KeyRegistry::rotate_npk_m_parameters"}}],"kind":"struct","path":"KeyRegistry::rotate_npk_m_abi"}]}},"file_map":{"110":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/unconstrained_context.nr","source":"use dep::protocol_types::{address::AztecAddress, traits::Deserialize};\nuse crate::oracle::{execution::{get_chain_id, get_version, get_contract_address, get_block_number}, storage::storage_read};\n\nstruct UnconstrainedContext {\n block_number: u32,\n contract_address: AztecAddress,\n version: Field,\n chain_id: Field,\n}\n\nimpl UnconstrainedContext {\n unconstrained fn new() -> Self {\n // We could call these oracles on the getters instead of at creation, which makes sense given that they might\n // not even be accessed. However any performance gains are minimal, and we'd rather fail early if a user\n // incorrectly attempts to create an UnconstrainedContext in an environment in which these oracles are not\n // available.\n let block_number = get_block_number();\n let contract_address = get_contract_address();\n let chain_id = get_chain_id();\n let version = get_version();\n Self { block_number, contract_address, version, chain_id }\n }\n\n unconstrained fn at(contract_address: AztecAddress) -> Self {\n let block_number = get_block_number();\n let chain_id = get_chain_id();\n let version = get_version();\n Self { block_number, contract_address, version, chain_id }\n }\n\n unconstrained fn at_historical(contract_address: AztecAddress, block_number: u32) -> Self {\n let chain_id = get_chain_id();\n let version = get_version();\n Self { block_number, contract_address, version, chain_id }\n }\n\n fn block_number(self) -> u32 {\n self.block_number\n }\n\n fn this_address(self) -> AztecAddress {\n self.contract_address\n }\n\n fn version(self) -> Field {\n self.version\n }\n\n fn chain_id(self) -> Field {\n self.chain_id\n }\n\n unconstrained fn raw_storage_read<let N: u32>(self: Self, storage_slot: Field) -> [Field; N] {\n storage_read(self.this_address(), storage_slot, self.block_number())\n }\n\n unconstrained fn storage_read<T, let N: u32>(\n self,\n storage_slot: Field\n ) -> T where T: Deserialize<N> {\n T::deserialize(self.raw_storage_read(storage_slot))\n }\n}\n"},"117":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/context/public_context.nr","source":"use crate::hash::{compute_secret_hash, compute_message_hash, compute_message_nullifier};\nuse dep::protocol_types::address::{AztecAddress, EthAddress};\nuse dep::protocol_types::constants::MAX_FIELD_VALUE;\nuse dep::protocol_types::traits::{Serialize, Deserialize, Empty};\nuse dep::protocol_types::abis::function_selector::FunctionSelector;\nuse crate::context::inputs::public_context_inputs::PublicContextInputs;\nuse crate::context::gas::GasOpts;\nuse crate::hash::ArgsHasher;\n\nstruct PublicContext {\n inputs: PublicContextInputs,\n args_hash: Option<Field>\n}\n\nimpl PublicContext {\n pub fn new(inputs: PublicContextInputs) -> Self {\n PublicContext { inputs, args_hash: Option::none() }\n }\n\n pub fn emit_unencrypted_log<T, let N: u32>(_self: &mut Self, log: T) where T: Serialize<N> {\n emit_unencrypted_log(Serialize::serialize(log).as_slice());\n }\n\n pub fn note_hash_exists(_self: Self, note_hash: Field, leaf_index: Field) -> bool {\n note_hash_exists(note_hash, leaf_index) == 1\n }\n\n pub fn l1_to_l2_msg_exists(_self: Self, msg_hash: Field, msg_leaf_index: Field) -> bool {\n l1_to_l2_msg_exists(msg_hash, msg_leaf_index) == 1\n }\n\n fn nullifier_exists(_self: Self, unsiloed_nullifier: Field, address: AztecAddress) -> bool {\n nullifier_exists(unsiloed_nullifier, address.to_field()) == 1\n }\n\n fn consume_l1_to_l2_message(\n &mut self,\n content: Field,\n secret: Field,\n sender: EthAddress,\n leaf_index: Field\n ) {\n let secret_hash = compute_secret_hash(secret);\n let message_hash = compute_message_hash(\n sender,\n self.chain_id(),\n /*recipient=*/ self.this_address(),\n self.version(),\n content,\n secret_hash\n );\n let nullifier = compute_message_nullifier(message_hash, secret, leaf_index);\n\n assert(\n !self.nullifier_exists(nullifier, self.this_address()), \"L1-to-L2 message is already nullified\"\n );\n assert(\n self.l1_to_l2_msg_exists(message_hash, leaf_index), \"Tried to consume nonexistent L1-to-L2 message\"\n );\n\n self.push_nullifier(nullifier);\n }\n\n fn message_portal(_self: &mut Self, recipient: EthAddress, content: Field) {\n send_l2_to_l1_msg(recipient, content);\n }\n\n fn call_public_function<let RETURNS_COUNT: u32>(\n _self: &mut Self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field],\n gas_opts: GasOpts\n ) -> FunctionReturns<RETURNS_COUNT> {\n let results = call(\n gas_for_call(gas_opts),\n contract_address,\n args,\n function_selector.to_field()\n );\n let data_to_return: [Field; RETURNS_COUNT] = results.0;\n let success: u8 = results.1;\n assert(success == 1, \"Nested call failed!\");\n\n FunctionReturns::new(data_to_return)\n }\n\n fn static_call_public_function<let RETURNS_COUNT: u32>(\n _self: &mut Self,\n contract_address: AztecAddress,\n function_selector: FunctionSelector,\n args: [Field],\n gas_opts: GasOpts\n ) -> FunctionReturns<RETURNS_COUNT> {\n let (data_to_return, success): ([Field; RETURNS_COUNT], u8) = call_static(\n gas_for_call(gas_opts),\n contract_address,\n args,\n function_selector.to_field()\n );\n\n assert(success == 1, \"Nested static call failed!\");\n FunctionReturns::new(data_to_return)\n }\n\n fn delegate_call_public_function<let RETURNS_COUNT: u32>(\n _self: &mut Self,\n _contract_address: AztecAddress,\n _function_selector: FunctionSelector,\n _args: [Field]\n ) -> FunctionReturns<RETURNS_COUNT> {\n assert(false, \"'delegate_call_public_function' not implemented!\");\n FunctionReturns::new([0; RETURNS_COUNT])\n }\n\n fn push_note_hash(_self: &mut Self, note_hash: Field) {\n emit_note_hash(note_hash);\n }\n fn push_nullifier(_self: &mut Self, nullifier: Field) {\n emit_nullifier(nullifier);\n }\n\n fn this_address(_self: Self) -> AztecAddress {\n address()\n }\n pub fn storage_address(_self: Self) -> AztecAddress {\n storage_address()\n }\n fn msg_sender(_self: Self) -> AztecAddress {\n sender()\n }\n fn selector(_self: Self) -> FunctionSelector {\n FunctionSelector::from_u32(function_selector())\n }\n fn get_args_hash(mut self) -> Field {\n if !self.args_hash.is_some() {\n let mut hasher = ArgsHasher::new();\n\n // TODO: this should be replaced with the compile-time calldata size.\n for i in 0..self.inputs.calldata_length as u32 {\n let argn: [Field; 1] = calldata_copy((2 + i) as u32, 1);\n hasher.add(argn[0]);\n }\n\n self.args_hash = Option::some(hasher.hash());\n }\n\n self.args_hash.unwrap()\n }\n fn transaction_fee(_self: Self) -> Field {\n transaction_fee()\n }\n\n fn chain_id(_self: Self) -> Field {\n chain_id()\n }\n fn version(_self: Self) -> Field {\n version()\n }\n fn block_number(_self: Self) -> Field {\n block_number()\n }\n fn timestamp(_self: Self) -> u64 {\n timestamp()\n }\n pub fn fee_per_l2_gas(_self: Self) -> Field {\n fee_per_l2_gas()\n }\n pub fn fee_per_da_gas(_self: Self) -> Field {\n fee_per_da_gas()\n }\n\n fn l2_gas_left(_self: Self) -> Field {\n l2_gas_left()\n }\n fn da_gas_left(_self: Self) -> Field {\n da_gas_left()\n }\n\n fn raw_storage_read<let N: u32>(_self: Self, storage_slot: Field) -> [Field; N] {\n let mut out = [0; N];\n for i in 0..N {\n out[i] = storage_read(storage_slot + i as Field);\n }\n out\n }\n\n fn storage_read<T, let N: u32>(self, storage_slot: Field) -> T where T: Deserialize<N> {\n T::deserialize(self.raw_storage_read(storage_slot))\n }\n\n fn raw_storage_write<let N: u32>(_self: Self, storage_slot: Field, values: [Field; N]) {\n for i in 0..N {\n storage_write(storage_slot + i as Field, values[i]);\n }\n }\n\n fn storage_write<T, let N: u32>(self, storage_slot: Field, value: T) where T: Serialize<N> {\n self.raw_storage_write(storage_slot, value.serialize());\n }\n}\n\n// Helper functions\nfn gas_for_call(user_gas: GasOpts) -> [Field; 2] {\n // It's ok to use the max possible gas here, because the gas will be\n // capped by the gas left in the (STATIC)CALL instruction.\n [\n user_gas.l2_gas.unwrap_or(MAX_FIELD_VALUE),\n user_gas.da_gas.unwrap_or(MAX_FIELD_VALUE)\n ]\n}\n\n// Unconstrained opcode wrappers (do not use directly).\n// TODO(https://github.com/AztecProtocol/aztec-packages/issues/6420): reconsider.\nunconstrained fn address() -> AztecAddress {\n address_opcode()\n}\nunconstrained fn storage_address() -> AztecAddress {\n storage_address_opcode()\n}\nunconstrained fn sender() -> AztecAddress {\n sender_opcode()\n}\nunconstrained fn portal() -> EthAddress {\n portal_opcode()\n}\nunconstrained fn function_selector() -> u32 {\n function_selector_opcode()\n}\nunconstrained fn transaction_fee() -> Field {\n transaction_fee_opcode()\n}\nunconstrained fn chain_id() -> Field {\n chain_id_opcode()\n}\nunconstrained fn version() -> Field {\n version_opcode()\n}\nunconstrained fn block_number() -> Field {\n block_number_opcode()\n}\nunconstrained fn timestamp() -> u64 {\n timestamp_opcode()\n}\nunconstrained fn fee_per_l2_gas() -> Field {\n fee_per_l2_gas_opcode()\n}\nunconstrained fn fee_per_da_gas() -> Field {\n fee_per_da_gas_opcode()\n}\nunconstrained fn l2_gas_left() -> Field {\n l2_gas_left_opcode()\n}\nunconstrained fn da_gas_left() -> Field {\n da_gas_left_opcode()\n}\nunconstrained fn note_hash_exists(note_hash: Field, leaf_index: Field) -> u8 {\n note_hash_exists_opcode(note_hash, leaf_index)\n}\nunconstrained fn emit_note_hash(note_hash: Field) {\n emit_note_hash_opcode(note_hash)\n}\nunconstrained fn nullifier_exists(nullifier: Field, address: Field) -> u8 {\n nullifier_exists_opcode(nullifier, address)\n}\nunconstrained fn emit_nullifier(nullifier: Field) {\n emit_nullifier_opcode(nullifier)\n}\nunconstrained fn emit_unencrypted_log(message: [Field]) {\n emit_unencrypted_log_opcode(message)\n}\nunconstrained fn l1_to_l2_msg_exists(msg_hash: Field, msg_leaf_index: Field) -> u8 {\n l1_to_l2_msg_exists_opcode(msg_hash, msg_leaf_index)\n}\nunconstrained fn send_l2_to_l1_msg(recipient: EthAddress, content: Field) {\n send_l2_to_l1_msg_opcode(recipient, content)\n}\nunconstrained fn call<let RET_SIZE: u32>(\n gas: [Field; 2],\n address: AztecAddress,\n args: [Field],\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {\n call_opcode(gas, address, args, function_selector)\n}\nunconstrained fn call_static<let RET_SIZE: u32>(\n gas: [Field; 2],\n address: AztecAddress,\n args: [Field],\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {\n call_static_opcode(gas, address, args, function_selector)\n}\n\nunconstrained fn calldata_copy<let N: u32>(cdoffset: u32, copy_size: u32) -> [Field; N] {\n calldata_copy_opcode(cdoffset, copy_size)\n}\n\nunconstrained fn storage_read(storage_slot: Field) -> Field {\n storage_read_opcode(storage_slot)\n}\n\nunconstrained fn storage_write(storage_slot: Field, value: Field) {\n storage_write_opcode(storage_slot, value);\n}\n\nimpl Empty for PublicContext {\n fn empty() -> Self {\n PublicContext::new(PublicContextInputs::empty())\n }\n}\n\n// AVM oracles (opcodes) follow, do not use directly.\n#[oracle(avmOpcodeAddress)]\nunconstrained fn address_opcode() -> AztecAddress {}\n\n#[oracle(avmOpcodeStorageAddress)]\nunconstrained fn storage_address_opcode() -> AztecAddress {}\n\n#[oracle(avmOpcodeSender)]\nunconstrained fn sender_opcode() -> AztecAddress {}\n\n#[oracle(avmOpcodePortal)]\nunconstrained fn portal_opcode() -> EthAddress {}\n\n#[oracle(avmOpcodeFunctionSelector)]\nunconstrained fn function_selector_opcode() -> u32 {}\n\n#[oracle(avmOpcodeTransactionFee)]\nunconstrained fn transaction_fee_opcode() -> Field {}\n\n#[oracle(avmOpcodeChainId)]\nunconstrained fn chain_id_opcode() -> Field {}\n\n#[oracle(avmOpcodeVersion)]\nunconstrained fn version_opcode() -> Field {}\n\n#[oracle(avmOpcodeBlockNumber)]\nunconstrained fn block_number_opcode() -> Field {}\n\n#[oracle(avmOpcodeTimestamp)]\nunconstrained fn timestamp_opcode() -> u64 {}\n\n#[oracle(avmOpcodeFeePerL2Gas)]\nunconstrained fn fee_per_l2_gas_opcode() -> Field {}\n\n#[oracle(avmOpcodeFeePerDaGas)]\nunconstrained fn fee_per_da_gas_opcode() -> Field {}\n\n#[oracle(avmOpcodeL2GasLeft)]\nunconstrained fn l2_gas_left_opcode() -> Field {}\n\n#[oracle(avmOpcodeDaGasLeft)]\nunconstrained fn da_gas_left_opcode() -> Field {}\n\n#[oracle(avmOpcodeNoteHashExists)]\nunconstrained fn note_hash_exists_opcode(note_hash: Field, leaf_index: Field) -> u8 {}\n\n#[oracle(avmOpcodeEmitNoteHash)]\nunconstrained fn emit_note_hash_opcode(note_hash: Field) {}\n\n#[oracle(avmOpcodeNullifierExists)]\nunconstrained fn nullifier_exists_opcode(nullifier: Field, address: Field) -> u8 {}\n\n#[oracle(avmOpcodeEmitNullifier)]\nunconstrained fn emit_nullifier_opcode(nullifier: Field) {}\n\n#[oracle(avmOpcodeEmitUnencryptedLog)]\nunconstrained fn emit_unencrypted_log_opcode(message: [Field]) {}\n\n#[oracle(avmOpcodeL1ToL2MsgExists)]\nunconstrained fn l1_to_l2_msg_exists_opcode(msg_hash: Field, msg_leaf_index: Field) -> u8 {}\n\n#[oracle(avmOpcodeSendL2ToL1Msg)]\nunconstrained fn send_l2_to_l1_msg_opcode(recipient: EthAddress, content: Field) {}\n\n#[oracle(avmOpcodeCalldataCopy)]\nunconstrained fn calldata_copy_opcode<let N: u32>(cdoffset: u32, copy_size: u32) -> [Field; N] {}\n\n#[oracle(avmOpcodeCall)]\nunconstrained fn call_opcode<let RET_SIZE: u32>(\n gas: [Field; 2], // gas allocation: [l2_gas, da_gas]\n address: AztecAddress,\n args: [Field],\n // TODO(5110): consider passing in calldata directly\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {}\n// ^ return data ^ success\n\n#[oracle(avmOpcodeStaticCall)]\nunconstrained fn call_static_opcode<let RET_SIZE: u32>(\n gas: [Field; 2], // gas allocation: [l2_gas, da_gas]\n address: AztecAddress,\n args: [Field],\n // TODO(5110): consider passing in calldata directly\n function_selector: Field\n) -> ([Field; RET_SIZE], u8) {}\n// ^ return data ^ success\n\n#[oracle(avmOpcodeStorageRead)]\nunconstrained fn storage_read_opcode(storage_slot: Field) -> Field {}\n\n#[oracle(avmOpcodeStorageWrite)]\nunconstrained fn storage_write_opcode(storage_slot: Field, value: Field) {}\n\nstruct FunctionReturns<let N: u32> {\n values: [Field; N]\n}\n\nimpl<let N: u32> FunctionReturns<N> {\n pub fn new(values: [Field; N]) -> FunctionReturns<N> {\n FunctionReturns { values }\n }\n\n pub fn raw(self) -> [Field; N] {\n self.values\n }\n\n pub fn deserialize_into<T>(self) -> T where T: Deserialize<N> {\n Deserialize::deserialize(self.raw())\n }\n}\n\nimpl FunctionReturns<0> {\n pub fn assert_empty(self) {\n assert(self.values.len() == 0);\n }\n}\n"},"144":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/hash.nr","source":"use dep::protocol_types::{\n address::{AztecAddress, EthAddress},\n constants::{GENERATOR_INDEX__SECRET_HASH, GENERATOR_INDEX__MESSAGE_NULLIFIER, GENERATOR_INDEX__FUNCTION_ARGS},\n point::Point, traits::Hash,\n hash::{sha256_to_field, poseidon2_hash_with_separator, poseidon2_hash_with_separator_slice}\n};\nuse crate::oracle::logs_traits::ToBytesForUnencryptedLog;\n\npub use dep::protocol_types::hash::{compute_siloed_nullifier, pedersen_hash};\n\npub fn pedersen_commitment<let N: u32>(inputs: [Field; N], hash_index: u32) -> Point {\n std::hash::pedersen_commitment_with_separator(inputs, hash_index)\n}\n\npub fn compute_secret_hash(secret: Field) -> Field {\n poseidon2_hash_with_separator([secret], GENERATOR_INDEX__SECRET_HASH)\n}\n\npub fn compute_unencrypted_log_hash<T, let N: u32, let M: u32>(\n contract_address: AztecAddress,\n log: T\n) -> Field where T: ToBytesForUnencryptedLog<N, M> {\n let message_bytes: [u8; N] = log.to_be_bytes_arr();\n // can't use N - not in scope error\n let n = message_bytes.len();\n let mut hash_bytes = [0; M];\n // Address is converted to 32 bytes in ts\n let address_bytes = contract_address.to_be_bytes_arr();\n for i in 0..32 {\n hash_bytes[i] = address_bytes[i];\n }\n let len_bytes: [u8; 4] = (n as Field).to_be_bytes();\n for i in 0..4 {\n hash_bytes[32 + i] = len_bytes[i];\n }\n for i in 0..n {\n hash_bytes[36 + i] = message_bytes[i];\n }\n\n sha256_to_field(hash_bytes)\n}\n\npub fn compute_message_hash(\n sender: EthAddress,\n chain_id: Field,\n recipient: AztecAddress,\n version: Field,\n content: Field,\n secret_hash: Field\n) -> Field {\n let mut hash_bytes = [0 as u8; 192];\n let sender_bytes: [u8; 32] = sender.to_field().to_be_bytes();\n let chain_id_bytes: [u8; 32] = chain_id.to_be_bytes();\n let recipient_bytes: [u8; 32] = recipient.to_field().to_be_bytes();\n let version_bytes: [u8; 32] = version.to_be_bytes();\n let content_bytes: [u8; 32] = content.to_be_bytes();\n let secret_hash_bytes: [u8; 32] = secret_hash.to_be_bytes();\n\n for i in 0..32 {\n hash_bytes[i] = sender_bytes[i];\n hash_bytes[i + 32] = chain_id_bytes[i];\n hash_bytes[i + 64] = recipient_bytes[i];\n hash_bytes[i + 96] = version_bytes[i];\n hash_bytes[i + 128] = content_bytes[i];\n hash_bytes[i + 160] = secret_hash_bytes[i];\n }\n\n sha256_to_field(hash_bytes)\n}\n\n// The nullifier of a l1 to l2 message is the hash of the message salted with the secret and index of the message hash\n// in the L1 to L2 message tree\npub fn compute_message_nullifier(message_hash: Field, secret: Field, leaf_index: Field) -> Field {\n poseidon2_hash_with_separator(\n [message_hash, secret, leaf_index],\n GENERATOR_INDEX__MESSAGE_NULLIFIER\n )\n}\n\nstruct ArgsHasher {\n fields: [Field],\n}\n\nimpl Hash for ArgsHasher {\n fn hash(self) -> Field {\n hash_args(self.fields)\n }\n}\n\nimpl ArgsHasher {\n pub fn new() -> Self {\n Self { fields: [] }\n }\n\n pub fn add(&mut self, field: Field) {\n self.fields = self.fields.push_back(field);\n }\n\n pub fn add_multiple<let N: u32>(&mut self, fields: [Field; N]) {\n for i in 0..N {\n self.fields = self.fields.push_back(fields[i]);\n }\n }\n}\n\npub fn hash_args_array<let N: u32>(args: [Field; N]) -> Field {\n if args.len() == 0 {\n 0\n } else {\n poseidon2_hash_with_separator(args, GENERATOR_INDEX__FUNCTION_ARGS)\n }\n}\n\npub fn hash_args(args: [Field]) -> Field {\n if args.len() == 0 {\n 0\n } else {\n poseidon2_hash_with_separator_slice(args, GENERATOR_INDEX__FUNCTION_ARGS)\n }\n}\n\n#[test]\nfn compute_var_args_hash() {\n let mut input = ArgsHasher::new();\n for i in 0..100 {\n input.add(i as Field);\n }\n let hash = input.hash();\n dep::std::println(hash);\n assert(hash == 0x19b0d74feb06ebde19edd85a28986c97063e84b3b351a8b666c7cac963ce655f);\n}\n\n#[test]\nfn compute_unenc_log_hash_array() {\n let contract_address = AztecAddress::from_field(0x233a3e0df23b2b15b324194cb4a151f26c0b7333250781d34cc269d85dc334c6);\n let log = [\n 0x20660de09f35f876e3e69d227b2a35166ad05f09d82d06366ec9b6f65a51fec2,\n 0x1b52bfe3b8689761916f76dc3d38aa8810860db325cd39ca611eed980091f01c,\n 0x2e559c4045c378a56ad13b9edb1e8de4e7ad3b3aa35cc7ba9ec77f7a68fa43a4,\n 0x25d0f689c4a4178a29d59306f2675824d19be6d25e44fa03b03f49c263053dd2,\n 0x2d513a722d6f352dc0961f156afdc5e31495b9f0e35cb069261a8e55e2df67fd\n ];\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x0095b2d17ab72f4b27a341f7ac63e49ec73935ae8c9181a0ac02023eb12f3284);\n}\n\n#[test]\nfn compute_unenc_log_hash_addr() {\n let contract_address = AztecAddress::from_field(0x233a3e0df23b2b15b324194cb4a151f26c0b7333250781d34cc269d85dc334c6);\n let log = AztecAddress::from_field(0x26aa302d4715fd8a687453cb26d616b0768027bd54bcae56b09d908ecd9f8303);\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x0083ab647dfb26e7ddee90a0f4209d049d4660cab42000c544b986aaa84c55a3);\n}\n\n#[test]\nfn compute_unenc_log_hash_str() {\n let contract_address = AztecAddress::from_field(0x1b401e1146c5c507962287065c81f0ef7590adae3802c533d7549d6bf0a41bd8);\n let log = \"dummy\";\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x00629e88ebd6374f44aa6cfe07e251ecf07213ebc7267e8f6b578ae57ffd6c20);\n}\n\n#[test]\nfn compute_unenc_log_hash_longer_str() {\n let contract_address = AztecAddress::from_field(0x1b401e1146c5c507962287065c81f0ef7590adae3802c533d7549d6bf0a41bd8);\n let log = \"Hello this is a string\";\n let hash = compute_unencrypted_log_hash(contract_address, log);\n assert(hash == 0x0098637962f7d34fa202b7ffad8a07a238c5d1fd897b82a108f7f467fa73b841);\n}\n"},"154":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/storage.nr","source":"use dep::protocol_types::{address::AztecAddress, traits::Deserialize};\n\n#[oracle(storageRead)]\nunconstrained fn storage_read_oracle<let N: u32>(address: Field, storage_slot: Field, block_number: Field, length: Field) -> [Field; N] {}\n\nunconstrained pub fn raw_storage_read<let N: u32>(\n address: AztecAddress,\n storage_slot: Field,\n block_number: u32\n) -> [Field; N] {\n storage_read_oracle(\n address.to_field(),\n storage_slot,\n block_number as Field,\n N as Field\n )\n}\n\nunconstrained pub fn storage_read<T, let N: u32>(\n address: AztecAddress,\n storage_slot: Field,\n block_number: u32\n) -> T where T: Deserialize<N> {\n T::deserialize(raw_storage_read(address, storage_slot, block_number))\n}\n\nmod tests {\n use crate::oracle::storage::{raw_storage_read, storage_read};\n use dep::protocol_types::address::AztecAddress;\n\n use std::test::OracleMock;\n use crate::test::mocks::mock_struct::MockStruct;\n\n global address = AztecAddress::from_field(29);\n global slot = 7;\n global block_number = 17;\n\n #[test]\n fn test_raw_storage_read() {\n let written = MockStruct { a: 13, b: 42 };\n\n let _ = OracleMock::mock(\"storageRead\").returns(written.serialize());\n\n let read: [Field; 2] = raw_storage_read(address, slot, block_number);\n assert_eq(read[0], 13);\n assert_eq(read[1], 42);\n }\n\n #[test]\n fn test_storage_read() {\n let written = MockStruct { a: 13, b: 42 };\n\n let _ = OracleMock::mock(\"storageRead\").returns(written.serialize());\n\n let read: MockStruct = storage_read(address, slot, block_number);\n assert_eq(read.a, 13);\n assert_eq(read.b, 42);\n }\n}\n"},"164":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/oracle/execution.nr","source":"use dep::protocol_types::address::AztecAddress;\n\n#[oracle(getContractAddress)]\nunconstrained fn get_contract_address_oracle() -> AztecAddress {}\n\n#[oracle(getBlockNumber)]\nunconstrained fn get_block_number_oracle() -> u32 {}\n\n#[oracle(getChainId)]\nunconstrained fn get_chain_id_oracle() -> Field {}\n\n#[oracle(getVersion)]\nunconstrained fn get_version_oracle() -> Field {}\n\nunconstrained pub fn get_contract_address() -> AztecAddress {\n get_contract_address_oracle()\n}\n\nunconstrained pub fn get_block_number() -> u32 {\n get_block_number_oracle()\n}\n\nunconstrained pub fn get_chain_id() -> Field {\n get_chain_id_oracle()\n}\n\nunconstrained pub fn get_version() -> Field {\n get_version_oracle()\n}\n"},"167":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/state_vars/map.nr","source":"use dep::protocol_types::{storage::map::derive_storage_slot_in_map, traits::ToField};\nuse crate::state_vars::storage::Storage;\n\n// docs:start:map\nstruct Map<K, V, Context> {\n context: Context,\n storage_slot: Field,\n state_var_constructor: fn(Context, Field) -> V,\n}\n// docs:end:map\n\nimpl<K, T, Context> Storage<T> for Map<K, T, Context> {}\n\nimpl<K, V, Context> Map<K, V, Context> {\n // docs:start:new\n pub fn new(\n context: Context,\n storage_slot: Field,\n state_var_constructor: fn(Context, Field) -> V\n ) -> Self {\n assert(storage_slot != 0, \"Storage slot 0 not allowed. Storage slots must start from 1.\");\n Map { context, storage_slot, state_var_constructor }\n }\n // docs:end:new\n\n // docs:start:at\n pub fn at(self, key: K) -> V where K: ToField {\n // TODO(#1204): use a generator index for the storage slot\n let derived_storage_slot = derive_storage_slot_in_map(self.storage_slot, key);\n\n let state_var_constructor = self.state_var_constructor;\n state_var_constructor(self.context, derived_storage_slot)\n }\n // docs:end:at\n}\n\n"},"169":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr","source":"use crate::context::{PublicContext, UnconstrainedContext};\nuse dep::protocol_types::traits::{Deserialize, Serialize};\nuse crate::state_vars::storage::Storage;\n\n// docs:start:public_mutable_struct\nstruct PublicMutable<T, Context> {\n context: Context,\n storage_slot: Field,\n}\n// docs:end:public_mutable_struct\n\nimpl<T, Context> Storage<T> for PublicMutable<T, Context> {}\n\nimpl<T, Context> PublicMutable<T, Context> {\n // docs:start:public_mutable_struct_new\n pub fn new(\n // Note: Passing the contexts to new(...) just to have an interface compatible with a Map.\n context: Context,\n storage_slot: Field\n ) -> Self {\n assert(storage_slot != 0, \"Storage slot 0 not allowed. Storage slots must start from 1.\");\n PublicMutable { context, storage_slot }\n }\n // docs:end:public_mutable_struct_new\n}\n\nimpl<T, T_SERIALIZED_LEN> PublicMutable<T, &mut PublicContext> where T: Serialize<T_SERIALIZED_LEN> + Deserialize<T_SERIALIZED_LEN> {\n // docs:start:public_mutable_struct_read\n pub fn read(self) -> T {\n self.context.storage_read(self.storage_slot)\n }\n // docs:end:public_mutable_struct_read\n\n // docs:start:public_mutable_struct_write\n pub fn write(self, value: T) {\n self.context.storage_write(self.storage_slot, value);\n }\n // docs:end:public_mutable_struct_write\n}\n\nimpl<T, T_SERIALIZED_LEN> PublicMutable<T, UnconstrainedContext> where T: Deserialize<T_SERIALIZED_LEN> {\n unconstrained pub fn read(self) -> T {\n self.context.storage_read(self.storage_slot)\n }\n}\n"},"222":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/abis/function_selector.nr","source":"use crate::utils::field::field_from_bytes;\nuse crate::traits::{Serialize, Deserialize, FromField, ToField, Empty};\n\nglobal SELECTOR_SIZE = 4;\n\nstruct FunctionSelector {\n // 1st 4-bytes of abi-encoding of function.\n inner: u32,\n}\n\nimpl Eq for FunctionSelector {\n fn eq(self, function_selector: FunctionSelector) -> bool {\n function_selector.inner == self.inner\n }\n}\n\nimpl Serialize<1> for FunctionSelector {\n fn serialize(self: Self) -> [Field; 1] {\n [self.inner as Field]\n }\n}\n\nimpl Deserialize<1> for FunctionSelector {\n fn deserialize(fields: [Field; 1]) -> Self {\n Self { inner: fields[0] as u32 }\n }\n}\n\nimpl FromField for FunctionSelector {\n fn from_field(field: Field) -> Self {\n Self { inner: field as u32 }\n }\n}\n\nimpl ToField for FunctionSelector {\n fn to_field(self) -> Field {\n self.inner as Field\n }\n}\n\nimpl Empty for FunctionSelector {\n fn empty() -> Self {\n Self { inner: 0 as u32 }\n }\n}\n\nimpl FunctionSelector {\n pub fn from_u32(value: u32) -> Self {\n Self { inner: value }\n }\n\n pub fn from_signature<let N: u32>(signature: str<N>) -> Self {\n let bytes = signature.as_bytes();\n let hash = crate::hash::poseidon2_hash_bytes(bytes);\n\n // We choose the last SELECTOR_SIZE bytes of the hash to avoid getting the first byte that is not full\n let hash_bytes = hash.to_be_bytes::<SELECTOR_SIZE>();\n\n FunctionSelector::from_field(field_from_bytes(hash_bytes, true))\n }\n\n pub fn zero() -> Self {\n Self { inner: 0 }\n }\n}\n\n#[test]\nfn test_is_valid_selector() {\n let selector = FunctionSelector::from_signature(\"IS_VALID()\");\n assert_eq(selector.to_field(), 0x73cdda47);\n}\n\n#[test]\nfn test_long_selector() {\n let selector = FunctionSelector::from_signature(\"foo_and_bar_and_baz_and_foo_bar_baz_and_bar_foo\");\n assert_eq(selector.to_field(), 0x7590a997);\n}\n"},"24":{"path":"std/embedded_curve_ops.nr","source":"use crate::ops::arith::{Add, Sub, Neg};\nuse crate::cmp::Eq;\n\n/// A point on the embedded elliptic curve\n/// By definition, the base field of the embedded curve is the scalar field of the proof system curve, i.e the Noir Field.\n/// x and y denotes the Weierstrass coordinates of the point, if is_infinite is false.\nstruct EmbeddedCurvePoint {\n x: Field,\n y: Field,\n is_infinite: bool\n}\n\nimpl EmbeddedCurvePoint {\n /// Elliptic curve point doubling operation\n /// returns the doubled point of a point P, i.e P+P\n fn double(self) -> EmbeddedCurvePoint {\n embedded_curve_add(self, self)\n }\n\n /// Returns the null element of the curve; 'the point at infinity'\n fn point_at_infinity() -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true }\n }\n}\n\nimpl Add for EmbeddedCurvePoint {\n /// Adds two points P+Q, using the curve addition formula, and also handles point at infinity\n fn add(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n embedded_curve_add(self, other)\n }\n}\n\nimpl Sub for EmbeddedCurvePoint {\n /// Points subtraction operation, using addition and negation\n fn sub(self, other: EmbeddedCurvePoint) -> EmbeddedCurvePoint {\n self + other.neg()\n }\n}\n\nimpl Neg for EmbeddedCurvePoint {\n /// Negates a point P, i.e returns -P, by negating the y coordinate.\n /// If the point is at infinity, then the result is also at infinity.\n fn neg(self) -> EmbeddedCurvePoint {\n EmbeddedCurvePoint { x: self.x, y: -self.y, is_infinite: self.is_infinite }\n }\n}\n\nimpl Eq for EmbeddedCurvePoint {\n /// Checks whether two points are equal\n fn eq(self: Self, b: EmbeddedCurvePoint) -> bool {\n (self.is_infinite & b.is_infinite)\n | ((self.is_infinite == b.is_infinite) & (self.x == b.x) & (self.y == b.y))\n }\n}\n\n/// Scalar for the embedded curve represented as low and high limbs\n/// By definition, the scalar field of the embedded curve is base field of the proving system curve.\n/// It may not fit into a Field element, so it is represented with two Field elements; its low and high limbs.\nstruct EmbeddedCurveScalar {\n lo: Field,\n hi: Field,\n}\n\nimpl EmbeddedCurveScalar {\n pub fn new(lo: Field, hi: Field) -> Self {\n EmbeddedCurveScalar { lo, hi }\n }\n\n #[field(bn254)]\n fn from_field(scalar: Field) -> EmbeddedCurveScalar {\n let (a,b) = crate::field::bn254::decompose(scalar);\n EmbeddedCurveScalar { lo: a, hi: b }\n }\n}\n\nimpl Eq for EmbeddedCurveScalar {\n fn eq(self, other: Self) -> bool {\n (other.hi == self.hi) & (other.lo == self.lo)\n }\n}\n\n// Computes a multi scalar multiplication over the embedded curve.\n// For bn254, We have Grumpkin and Baby JubJub.\n// For bls12-381, we have JubJub and Bandersnatch.\n//\n// The embedded curve being used is decided by the \n// underlying proof system.\n// docs:start:multi_scalar_mul\npub fn multi_scalar_mul<let N: u32>(\n points: [EmbeddedCurvePoint; N],\n scalars: [EmbeddedCurveScalar; N]\n) -> EmbeddedCurvePoint\n// docs:end:multi_scalar_mul\n{\n let point_array = multi_scalar_mul_array_return(points, scalars);\n EmbeddedCurvePoint { x: point_array[0], y: point_array[1], is_infinite: point_array[2] as bool }\n}\n\n#[foreign(multi_scalar_mul)]\nfn multi_scalar_mul_array_return<let N: u32>(points: [EmbeddedCurvePoint; N], scalars: [EmbeddedCurveScalar; N]) -> [Field; 3] {}\n\n#[foreign(multi_scalar_mul)]\npub(crate) fn multi_scalar_mul_slice(points: [EmbeddedCurvePoint], scalars: [EmbeddedCurveScalar]) -> [Field; 3] {}\n\n// docs:start:fixed_base_scalar_mul\npub fn fixed_base_scalar_mul(scalar: EmbeddedCurveScalar) -> EmbeddedCurvePoint\n// docs:end:fixed_base_scalar_mul\n{\n let g1 = EmbeddedCurvePoint { x: 1, y: 17631683881184975370165255887551781615748388533673675138860, is_infinite: false };\n multi_scalar_mul([g1], [scalar])\n}\n\n// This is a hack as returning an `EmbeddedCurvePoint` from a foreign function in brillig returns a [BrilligVariable::SingleAddr; 2] rather than BrilligVariable::BrilligArray\n// as is defined in the brillig bytecode format. This is a workaround which allows us to fix this without modifying the serialization format.\n// docs:start:embedded_curve_add\nfn embedded_curve_add(\n point1: EmbeddedCurvePoint,\n point2: EmbeddedCurvePoint\n) -> EmbeddedCurvePoint\n// docs:end:embedded_curve_add\n{\n let point_array = embedded_curve_add_array_return(point1, point2);\n let x = point_array[0];\n let y = point_array[1];\n EmbeddedCurvePoint { x, y, is_infinite: point_array[2] == 1 }\n}\n\n#[foreign(embedded_curve_add)]\nfn embedded_curve_add_array_return(_point1: EmbeddedCurvePoint, _point2: EmbeddedCurvePoint) -> [Field; 3] {}\n"},"259":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/storage/map.nr","source":"use crate::{hash::pedersen_hash, traits::ToField};\n\npub fn derive_storage_slot_in_map<K>(storage_slot: Field, key: K) -> Field where K: ToField {\n pedersen_hash([storage_slot, key.to_field()], 0)\n}\n\nmod test {\n use crate::{address::AztecAddress, storage::map::derive_storage_slot_in_map};\n\n #[test]\n fn test_derive_storage_slot_in_map_matches_typescript() {\n let map_slot = 0x132258fb6962c4387ba659d9556521102d227549a386d39f0b22d1890d59c2b5;\n let key = AztecAddress::from_field(0x302dbc2f9b50a73283d5fb2f35bc01eae8935615817a0b4219a057b2ba8a5a3f);\n\n let slot = derive_storage_slot_in_map(map_slot, key);\n\n // The following value was generated by `map_slot.test.ts`\n let slot_from_typescript = 0x2499880e2b1b831785c17286f99a0d5122fee784ce7b1c04e380c4a991da819a;\n\n assert_eq(slot, slot_from_typescript);\n }\n}\n"},"264":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/type_serialization.nr","source":"use crate::traits::{Serialize, Deserialize};\n\nglobal BOOL_SERIALIZED_LEN: Field = 1;\nglobal U8_SERIALIZED_LEN: Field = 1;\nglobal U32_SERIALIZED_LEN: Field = 1;\nglobal U64_SERIALIZED_LEN: Field = 1;\nglobal U128_SERIALIZED_LEN: Field = 1;\nglobal FIELD_SERIALIZED_LEN: Field = 1;\n\nimpl Serialize<BOOL_SERIALIZED_LEN> for bool {\n fn serialize(self) -> [Field; BOOL_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<BOOL_SERIALIZED_LEN> for bool {\n fn deserialize(fields: [Field; BOOL_SERIALIZED_LEN]) -> bool {\n fields[0] as bool\n }\n}\n\nimpl Serialize<U8_SERIALIZED_LEN> for u8 {\n fn serialize(self) -> [Field; U32_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<U8_SERIALIZED_LEN> for u8 {\n fn deserialize(fields: [Field; U8_SERIALIZED_LEN]) -> Self {\n fields[0] as u8\n }\n}\n\nimpl Serialize<U32_SERIALIZED_LEN> for u32 {\n fn serialize(self) -> [Field; U32_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<U32_SERIALIZED_LEN> for u32 {\n fn deserialize(fields: [Field; U32_SERIALIZED_LEN]) -> Self {\n fields[0] as u32\n }\n}\n\nimpl Serialize<U64_SERIALIZED_LEN> for u64 {\n fn serialize(self) -> [Field; U64_SERIALIZED_LEN] {\n [self as Field]\n }\n}\n\nimpl Deserialize<U64_SERIALIZED_LEN> for u64 {\n fn deserialize(fields: [Field; U64_SERIALIZED_LEN]) -> Self {\n fields[0] as u64\n }\n}\n\nimpl Serialize<U128_SERIALIZED_LEN> for U128 {\n fn serialize(self) -> [Field; 1] {\n [self.to_integer()]\n }\n}\n\nimpl Deserialize<U128_SERIALIZED_LEN> for U128 {\n fn deserialize(fields: [Field; U128_SERIALIZED_LEN]) -> Self {\n U128::from_integer(fields[0])\n }\n}\n\nimpl Serialize<FIELD_SERIALIZED_LEN> for Field {\n fn serialize(self) -> [Field; U32_SERIALIZED_LEN] {\n [self]\n }\n}\n\nimpl Deserialize<FIELD_SERIALIZED_LEN> for Field {\n fn deserialize(fields: [Field; FIELD_SERIALIZED_LEN]) -> Self {\n fields[0]\n }\n}\n"},"265":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/traits.nr","source":"use crate::utils::field::field_from_bytes;\n\n// Trait: is_empty\n//\n// The general is_empty trait checks if a data type is is empty,\n// and it defines empty for the basic data types as 0.\n//\n// If a Field is equal to zero, then it is regarded as zero.\n// We will go with this definition for now, however it can be problematic \n// if a value can actually be zero. In a future refactor, we can \n// use the optional type for safety. Doing it now would lead to a worse devex\n// and would make it harder to sync up with the cpp code.\n// Preferred over Default trait to convey intent, as default doesn't necessarily mean empty.\ntrait Empty {\n fn empty() -> Self;\n}\n\nimpl Empty for Field {\n fn empty() -> Self {\n 0\n }\n}\n\nimpl Empty for u1 {\n fn empty() -> Self {\n 0\n }\n}\nimpl Empty for u8 {\n fn empty() -> Self {\n 0\n }\n}\nimpl Empty for u32 {\n fn empty() -> Self {\n 0\n }\n}\nimpl Empty for u64 {\n fn empty() -> Self {\n 0\n }\n}\nimpl Empty for U128 {\n fn empty() -> Self {\n U128::from_integer(0)\n }\n}\n\npub fn is_empty<T>(item: T) -> bool where T: Empty + Eq {\n item.eq(T::empty())\n}\n\npub fn is_empty_array<T, let N: u32>(array: [T; N]) -> bool where T: Empty + Eq {\n array.all(|elem| is_empty(elem))\n}\n\ntrait Hash {\n fn hash(self) -> Field;\n}\n\ntrait ToField {\n fn to_field(self) -> Field;\n}\n\nimpl ToField for Field {\n fn to_field(self) -> Field {\n self\n }\n}\n\nimpl ToField for bool {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for u1 {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for u8 {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for u32 {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for u64 {\n fn to_field(self) -> Field {\n self as Field\n }\n}\nimpl ToField for U128 {\n fn to_field(self) -> Field {\n self.to_integer()\n }\n}\nimpl<let N: u32> ToField for str<N> {\n fn to_field(self) -> Field {\n assert(N < 32, \"String doesn't fit in a field, consider using Serialize instead\");\n field_from_bytes(self.as_bytes(), true)\n }\n}\n\ntrait FromField {\n fn from_field(value: Field) -> Self;\n}\n\nimpl FromField for Field {\n fn from_field(value: Field) -> Self {\n value\n }\n}\n\nimpl FromField for bool {\n fn from_field(value: Field) -> Self {\n value as bool\n }\n}\nimpl FromField for u1 {\n fn from_field(value: Field) -> Self {\n value as u1\n }\n}\nimpl FromField for u8 {\n fn from_field(value: Field) -> Self {\n value as u8\n }\n}\nimpl FromField for u32 {\n fn from_field(value: Field) -> Self {\n value as u32\n }\n}\nimpl FromField for u64 {\n fn from_field(value: Field) -> Self {\n value as u64\n }\n}\nimpl FromField for U128 {\n fn from_field(value: Field) -> Self {\n U128::from_integer(value)\n }\n}\n\n// docs:start:serialize\ntrait Serialize<let N: u32> {\n fn serialize(self) -> [Field; N];\n}\n// docs:end:serialize\n\nimpl<let N: u32> Serialize<N> for [Field; N] {\n fn serialize(self) -> [Field; N] {\n self\n }\n}\nimpl<let N: u32> Serialize<N> for str<N> {\n fn serialize(self) -> [Field; N] {\n let mut result = [0; N];\n let bytes: [u8; N] = self.as_bytes();\n for i in 0..N {\n result[i] = field_from_bytes([bytes[i];1], true);\n }\n result\n }\n}\n\n// docs:start:deserialize\ntrait Deserialize<let N: u32> {\n fn deserialize(fields: [Field; N]) -> Self;\n}\n// docs:end:deserialize\n\nimpl<let N: u32> Deserialize<N> for [Field; N] {\n fn deserialize(fields: [Field; N]) -> Self {\n fields\n }\n}\n"},"270":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/hash.nr","source":"use crate::{\n abis::{\n contract_class_function_leaf_preimage::ContractClassFunctionLeafPreimage,\n function_selector::FunctionSelector, log_hash::{LogHash, ScopedLogHash, ScopedEncryptedLogHash},\n note_hash::ScopedNoteHash, nullifier::ScopedNullifier\n},\n address::{AztecAddress, EthAddress},\n constants::{\n FUNCTION_TREE_HEIGHT, GENERATOR_INDEX__SILOED_NOTE_HASH, GENERATOR_INDEX__OUTER_NULLIFIER,\n GENERATOR_INDEX__VK, GENERATOR_INDEX__NOTE_HASH_NONCE, GENERATOR_INDEX__UNIQUE_NOTE_HASH,\n MAX_ENCRYPTED_LOGS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX\n},\n merkle_tree::root::root_from_sibling_path,\n messaging::l2_to_l1_message::{L2ToL1Message, ScopedL2ToL1Message},\n recursion::verification_key::VerificationKey, traits::{is_empty, ToField},\n utils::field::field_from_bytes_32_trunc\n};\nuse super::utils::field::field_from_bytes;\n\npub fn sha256_to_field<let N: u32>(bytes_to_hash: [u8; N]) -> Field {\n let sha256_hashed = std::hash::sha256(bytes_to_hash);\n let hash_in_a_field = field_from_bytes_32_trunc(sha256_hashed);\n\n hash_in_a_field\n}\n\npub fn private_functions_root_from_siblings(\n selector: FunctionSelector,\n vk_hash: Field,\n function_leaf_index: Field,\n function_leaf_sibling_path: [Field; FUNCTION_TREE_HEIGHT]\n) -> Field {\n let function_leaf_preimage = ContractClassFunctionLeafPreimage { selector, vk_hash };\n let function_leaf = function_leaf_preimage.hash();\n root_from_sibling_path(function_leaf, function_leaf_index, function_leaf_sibling_path)\n}\n\nfn compute_note_hash_nonce(tx_hash: Field, note_index_in_tx: u32) -> Field {\n // Hashing tx hash with note index in tx is guaranteed to be unique\n poseidon2_hash_with_separator(\n [\n tx_hash,\n note_index_in_tx as Field\n ],\n GENERATOR_INDEX__NOTE_HASH_NONCE\n )\n}\n\npub fn compute_unique_note_hash(nonce: Field, note_hash: Field) -> Field {\n let inputs = [nonce, note_hash];\n poseidon2_hash_with_separator(inputs, GENERATOR_INDEX__UNIQUE_NOTE_HASH)\n}\n\npub fn compute_siloed_note_hash(app: AztecAddress, unique_note_hash: Field) -> Field {\n poseidon2_hash_with_separator(\n [\n app.to_field(),\n unique_note_hash\n ],\n GENERATOR_INDEX__SILOED_NOTE_HASH\n )\n}\n\n/// Siloing in the context of Aztec refers to the process of hashing a note hash with a contract address (this way\n/// the note hash is scoped to a specific contract). This is used to prevent intermingling of notes between contracts.\npub fn silo_note_hash(note_hash: ScopedNoteHash, tx_hash: Field, note_index_in_tx: u32) -> Field {\n if note_hash.contract_address.is_zero() {\n 0\n } else {\n let nonce = compute_note_hash_nonce(tx_hash, note_index_in_tx);\n let unique_note_hash = compute_unique_note_hash(nonce, note_hash.value());\n compute_siloed_note_hash(note_hash.contract_address, unique_note_hash)\n }\n}\n\npub fn compute_siloed_nullifier(app: AztecAddress, nullifier: Field) -> Field {\n poseidon2_hash_with_separator(\n [\n app.to_field(),\n nullifier\n ],\n GENERATOR_INDEX__OUTER_NULLIFIER\n )\n}\n\npub fn silo_nullifier(nullifier: ScopedNullifier) -> Field {\n if nullifier.contract_address.is_zero() {\n nullifier.value() // Return value instead of 0 because the first nullifier's contract address is zero.\n } else {\n compute_siloed_nullifier(nullifier.contract_address, nullifier.value())\n }\n}\n\npub fn silo_encrypted_log_hash(log_hash: ScopedLogHash) -> Field {\n // We assume contract address has already been masked\n if log_hash.contract_address.is_zero() {\n 0\n } else {\n accumulate_sha256([log_hash.contract_address.to_field(), log_hash.log_hash.value])\n }\n}\n\npub fn mask_encrypted_log_hash(scoped_log: ScopedEncryptedLogHash) -> AztecAddress {\n if scoped_log.contract_address.is_zero() {\n AztecAddress::from_field(0)\n } else if (scoped_log.log_hash.randomness == 0) {\n scoped_log.contract_address\n } else {\n AztecAddress::from_field(\n poseidon2_hash_with_separator(\n [scoped_log.contract_address.to_field(), scoped_log.log_hash.randomness],\n 0\n )\n )\n }\n}\n\nfn compute_siloed_unencrypted_log_hash(address: AztecAddress, log_hash: Field) -> Field {\n accumulate_sha256([address.to_field(), log_hash])\n}\n\npub fn silo_unencrypted_log_hash(log_hash: ScopedLogHash) -> Field {\n if log_hash.contract_address.is_zero() {\n 0\n } else {\n compute_siloed_unencrypted_log_hash(log_hash.contract_address, log_hash.value())\n }\n}\n\npub fn merkle_hash(left: Field, right: Field) -> Field {\n poseidon2_hash([left, right])\n}\n\npub fn stdlib_recursion_verification_key_compress_native_vk(_vk: VerificationKey) -> Field {\n // Original cpp code\n // stdlib::recursion::verification_key<CT::bn254>::compress_native(private_call.vk, GeneratorIndex::VK);\n // The above cpp method is only ever called on verification key, so it has been special cased here\n let _hash_index = GENERATOR_INDEX__VK;\n 0\n}\n\npub fn compute_l2_to_l1_hash(\n contract_address: AztecAddress,\n recipient: EthAddress,\n content: Field,\n rollup_version_id: Field,\n chain_id: Field\n) -> Field {\n let mut bytes: BoundedVec<u8, 160> = BoundedVec::new();\n\n let inputs = [contract_address.to_field(), rollup_version_id, recipient.to_field(), chain_id, content];\n for i in 0..inputs.len() {\n // TODO are bytes be in fr.to_buffer() ?\n let item_bytes: [u8; 32] = inputs[i].to_be_bytes();\n for j in 0..32 {\n bytes.push(item_bytes[j]);\n }\n }\n\n sha256_to_field(bytes.storage)\n}\n\npub fn silo_l2_to_l1_message(msg: ScopedL2ToL1Message, rollup_version_id: Field, chain_id: Field) -> Field {\n if msg.contract_address.is_zero() {\n 0\n } else {\n compute_l2_to_l1_hash(\n msg.contract_address,\n msg.message.recipient,\n msg.message.content,\n rollup_version_id,\n chain_id\n )\n }\n}\n\n// Computes sha256 hash of 2 input hashes.\n//\n// NB: This method now takes in two 31 byte fields - it assumes that any input\n// is the result of a sha_to_field hash and => is truncated\n//\n// TODO(Jan and David): This is used for the encrypted_log hashes.\n// Can we check to see if we can just use hash_to_field or pedersen_compress here?\n//\npub fn accumulate_sha256(input: [Field; 2]) -> Field {\n // This is a note about the cpp code, since it takes an array of Fields\n // instead of a U128.\n // 4 Field elements when converted to bytes will usually\n // occupy 4 * 32 = 128 bytes.\n // However, this function is making the assumption that each Field\n // only occupies 128 bits.\n //\n // TODO(David): This does not seem to be getting guaranteed anywhere in the code?\n\n // Concatentate two fields into 32x2 = 64 bytes\n // accumulate_sha256 assumes that the inputs are pre-truncated 31 byte numbers\n let mut hash_input_flattened = [0; 64];\n for offset in 0..input.len() {\n let input_as_bytes: [u8; 32] = input[offset].to_be_bytes();\n for byte_index in 0..32 {\n hash_input_flattened[offset * 32 + byte_index] = input_as_bytes[byte_index];\n }\n }\n\n sha256_to_field(hash_input_flattened)\n}\n\n// Computes the final logs hash for a tx.\n// NB: this assumes MAX_ENCRYPTED_LOGS_PER_TX == MAX_UNENCRYPTED_LOGS_PER_TX\n// to avoid doubling code, since we can't define the byte len to be 32*N directly.\npub fn compute_tx_logs_hash(logs: [LogHash; MAX_ENCRYPTED_LOGS_PER_TX]) -> Field {\n // Convert each field element into a byte array and append the bytes to `hash_input_flattened`\n let mut hash_input_flattened = [0; MAX_ENCRYPTED_LOGS_PER_TX * 32];\n for offset in 0..MAX_ENCRYPTED_LOGS_PER_TX {\n let input_as_bytes: [u8; 32] = logs[offset].value.to_be_bytes();\n for byte_index in 0..32 {\n hash_input_flattened[offset * 32 + byte_index] = input_as_bytes[byte_index];\n }\n }\n // Ideally we would push to a slice then hash, but there is no sha_slice\n // Hardcode to 256 bytes for now\n let mut hash = sha256_to_field(hash_input_flattened);\n // Not having a 0 value hash for empty logs causes issues with empty txs\n // used for padding. Returning early is currently unsupported.\n // We always provide sorted logs here, so 0 being empty means all are empty.\n if is_empty(logs[0]) {\n hash = 0;\n }\n hash\n}\n\npub fn compute_tx_note_logs_hash(logs: [LogHash; MAX_NOTE_ENCRYPTED_LOGS_PER_TX]) -> Field {\n // Convert each field element into a byte array and append the bytes to `hash_input_flattened`\n let mut hash_input_flattened = [0; MAX_NOTE_ENCRYPTED_LOGS_PER_TX * 32];\n for offset in 0..MAX_NOTE_ENCRYPTED_LOGS_PER_TX {\n let input_as_bytes: [u8; 32] = logs[offset].value.to_be_bytes();\n for byte_index in 0..32 {\n hash_input_flattened[offset * 32 + byte_index] = input_as_bytes[byte_index];\n }\n }\n // Ideally we would push to a slice then hash, but there is no sha_slice\n // Hardcode to 256 bytes for now\n let mut hash = sha256_to_field(hash_input_flattened);\n // Not having a 0 value hash for empty logs causes issues with empty txs\n // used for padding. Returning early is currently unsupported.\n // We always provide sorted logs here, so 0 being empty means all are empty.\n if is_empty(logs[0]) {\n hash = 0;\n }\n hash\n}\n\npub fn pedersen_hash<let N: u32>(inputs: [Field; N], hash_index: u32) -> Field {\n std::hash::pedersen_hash_with_separator(inputs, hash_index)\n}\n\npub fn poseidon2_hash<let N: u32>(inputs: [Field; N]) -> Field {\n std::hash::poseidon2::Poseidon2::hash(inputs, N)\n}\n\n#[no_predicates]\npub fn poseidon2_hash_with_separator<let N: u32, T>(\n inputs: [Field; N],\n separator: T\n) -> Field where T: ToField {\n // We manually hash the inputs here, since we cannot express with the type system a constant size inputs array of N + 1\n let in_len = N + 1;\n let two_pow_64 = 18446744073709551616;\n let iv : Field = (in_len as Field) * two_pow_64;\n let mut sponge = std::hash::poseidon2::Poseidon2::new(iv);\n sponge.absorb(separator.to_field());\n\n for i in 0..inputs.len() {\n sponge.absorb(inputs[i]);\n }\n\n sponge.squeeze()\n}\n\npub fn poseidon2_hash_with_separator_slice<T>(inputs: [Field], separator: T) -> Field where T: ToField {\n let in_len = inputs.len() + 1;\n let two_pow_64 = 18446744073709551616;\n let iv : Field = (in_len as Field) * two_pow_64;\n let mut sponge = std::hash::poseidon2::Poseidon2::new(iv);\n sponge.absorb(separator.to_field());\n\n for i in 0..inputs.len() {\n sponge.absorb(inputs[i]);\n }\n\n sponge.squeeze()\n}\n\n#[no_predicates]\npub fn poseidon2_hash_bytes<let N: u32>(inputs: [u8; N]) -> Field {\n // We manually hash the inputs here, since we cannot express with the type system a constant size inputs array of Math.ceil(N/31)\n let mut in_len = N / 31;\n let mut has_padding = false;\n if N % 31 != 0 {\n in_len += 1;\n has_padding = true;\n }\n\n let two_pow_64 = 18446744073709551616;\n let iv : Field = (in_len as Field) * two_pow_64;\n let mut sponge = std::hash::poseidon2::Poseidon2::new(iv);\n\n let mut current_field = [0; 31];\n for i in 0..inputs.len() {\n let index = i % 31;\n current_field[index] = inputs[i];\n if index == 30 {\n sponge.absorb(field_from_bytes(current_field, false));\n current_field = [0; 31];\n }\n }\n if has_padding {\n sponge.absorb(field_from_bytes(current_field, false));\n }\n\n sponge.squeeze()\n}\n\n#[test]\nfn smoke_sha256_to_field() {\n let full_buffer = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,\n 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,\n 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,\n 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,\n 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,\n 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,\n 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,\n 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159\n ];\n let result = sha256_to_field(full_buffer);\n\n assert(result == 0x448ebbc9e1a31220a2f3830c18eef61b9bd070e5084b7fa2a359fe729184c7);\n\n // to show correctness of the current ver (truncate one byte) vs old ver (mod full bytes):\n let result_bytes = std::hash::sha256(full_buffer);\n let truncated_field = crate::utils::field::field_from_bytes_32_trunc(result_bytes);\n assert(truncated_field == result);\n let mod_res = result + (result_bytes[31] as Field);\n assert(mod_res == 0x448ebbc9e1a31220a2f3830c18eef61b9bd070e5084b7fa2a359fe729184e0);\n}\n\n#[test]\nfn compute_l2_l1_hash() {\n // All zeroes\n let hash_result = compute_l2_to_l1_hash(AztecAddress::from_field(0), EthAddress::zero(), 0, 0, 0);\n assert(hash_result == 0xb393978842a0fa3d3e1470196f098f473f9678e72463cb65ec4ab5581856c2);\n\n // Non-zero case\n let hash_result = compute_l2_to_l1_hash(AztecAddress::from_field(1), EthAddress::from_field(3), 5, 2, 4);\n assert(hash_result == 0x3f88c1044a05e5340ed20466276500f6d45ca5603913b9091e957161734e16);\n}\n\n#[test]\nfn silo_l2_to_l1_message_matches_typescript() {\n let version = 4;\n let chainId = 5;\n\n let hash = silo_l2_to_l1_message(\n ScopedL2ToL1Message {\n message: L2ToL1Message { recipient: EthAddress::from_field(1), content: 2, counter: 0 },\n contract_address: AztecAddress::from_field(3)\n },\n version,\n chainId\n );\n\n // The following value was generated by `l2_to_l1_message.test.ts`\n let hash_from_typescript = 0x00c6155d69febb9d5039b374dd4f77bf57b7c881709aa524a18acaa0bd57476a;\n\n assert_eq(hash, hash_from_typescript);\n}\n"},"29":{"path":"std/hash/mod.nr","source":"mod poseidon;\nmod mimc;\nmod poseidon2;\nmod keccak;\nmod sha256;\nmod sha512;\n\nuse crate::default::Default;\nuse crate::uint128::U128;\nuse crate::collections::vec::Vec;\nuse crate::embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, multi_scalar_mul, multi_scalar_mul_slice};\nuse crate::meta::derive_via;\n\n// Kept for backwards compatibility\npub use sha256::{digest, sha256, sha256_compression, sha256_var};\n\n#[foreign(blake2s)]\n// docs:start:blake2s\npub fn blake2s<let N: u32>(input: [u8; N]) -> [u8; 32]\n// docs:end:blake2s\n{}\n\n#[foreign(blake3)]\n// docs:start:blake3\npub fn blake3<let N: u32>(input: [u8; N]) -> [u8; 32]\n// docs:end:blake3\n{}\n\n// docs:start:pedersen_commitment\npub fn pedersen_commitment<let N: u32>(input: [Field; N]) -> EmbeddedCurvePoint {\n // docs:end:pedersen_commitment\n pedersen_commitment_with_separator(input, 0)\n}\n\npub fn pedersen_hash_with_separator<let N: u32>(input: [Field; N], separator: u32) -> Field {\n __pedersen_hash_with_separator(input, separator)\n}\n\nfn pedersen_commitment_with_separator<let N: u32>(input: [Field; N], separator: u32) -> EmbeddedCurvePoint {\n let value = __pedersen_commitment_with_separator(input, separator);\n if (value[0] == 0) & (value[1] == 0) {\n EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true }\n } else {\n EmbeddedCurvePoint { x: value[0], y: value[1], is_infinite: false }\n }\n}\n\n#[no_predicates]\nfn pedersen_commitment_with_separator_noir<let N: u32>(input: [Field; N], separator: u32) -> EmbeddedCurvePoint {\n let mut points = [EmbeddedCurveScalar { lo: 0, hi: 0 }; N];\n for i in 0..N {\n // we use the unsafe version because the multi_scalar_mul will constrain the scalars.\n points[i] = from_field_unsafe(input[i]);\n }\n let generators = derive_generators(\"DEFAULT_DOMAIN_SEPARATOR\".as_bytes(), separator);\n multi_scalar_mul(generators, points)\n}\n\n#[no_predicates]\nfn pedersen_hash_with_separator_noir<let N: u32>(input: [Field; N], separator: u32) -> Field {\n let mut scalars: Vec<EmbeddedCurveScalar> = Vec::from_slice([EmbeddedCurveScalar { lo: 0, hi: 0 }; N].as_slice()); //Vec::new();\n\n for i in 0..N {\n scalars.set(i, from_field_unsafe(input[i]));\n }\n scalars.push(EmbeddedCurveScalar { lo: N as Field, hi: 0 as Field });\n let domain_generators :[EmbeddedCurvePoint; N]= derive_generators(\"DEFAULT_DOMAIN_SEPARATOR\".as_bytes(), separator);\n let mut vec_generators = Vec::new();\n for i in 0..N {\n vec_generators.push(domain_generators[i]);\n }\n let length_generator : [EmbeddedCurvePoint; 1] = derive_generators(\"pedersen_hash_length\".as_bytes(), 0);\n vec_generators.push(length_generator[0]);\n multi_scalar_mul_slice(vec_generators.slice, scalars.slice)[0]\n}\n\n// docs:start:pedersen_hash\npub fn pedersen_hash<let N: u32>(input: [Field; N]) -> Field\n// docs:end:pedersen_hash\n{\n __pedersen_hash_with_separator(input, 0)\n}\n\n#[foreign(pedersen_hash)]\nfn __pedersen_hash_with_separator<let N: u32>(input: [Field; N], separator: u32) -> Field {}\n\n#[foreign(pedersen_commitment)]\nfn __pedersen_commitment_with_separator<let N: u32>(input: [Field; N], separator: u32) -> [Field; 2] {}\n\n#[field(bn254)]\nfn derive_generators<let N: u32, let M: u32>(domain_separator_bytes: [u8; M], starting_index: u32) -> [EmbeddedCurvePoint; N] {\n crate::assert_constant(domain_separator_bytes);\n // TODO(https://github.com/noir-lang/noir/issues/5672): Add back assert_constant on starting_index\n __derive_generators(domain_separator_bytes, starting_index)\n}\n\n#[builtin(derive_pedersen_generators)]\n#[field(bn254)]\nfn __derive_generators<let N: u32, let M: u32>(\n domain_separator_bytes: [u8; M],\n starting_index: u32\n) -> [EmbeddedCurvePoint; N] {}\n\n#[field(bn254)]\n // Same as from_field but:\n // does not assert the limbs are 128 bits\n // does not assert the decomposition does not overflow the EmbeddedCurveScalar\n fn from_field_unsafe(scalar: Field) -> EmbeddedCurveScalar {\n let (xlo, xhi) = unsafe {\n crate::field::bn254::decompose_hint(scalar)\n };\n // Check that the decomposition is correct\n assert_eq(scalar, xlo + crate::field::bn254::TWO_POW_128 * xhi);\n EmbeddedCurveScalar { lo: xlo, hi: xhi }\n}\n\npub fn hash_to_field(inputs: [Field]) -> Field {\n let mut sum = 0;\n\n for input in inputs {\n let input_bytes: [u8; 32] = input.to_le_bytes();\n sum += crate::field::bytes32_to_field(blake2s(input_bytes));\n }\n\n sum\n}\n\n// docs:start:keccak256\npub fn keccak256<let N: u32>(input: [u8; N], message_size: u32) -> [u8; 32]\n// docs:end:keccak256\n{\n crate::hash::keccak::keccak256(input, message_size)\n}\n\n#[foreign(poseidon2_permutation)]\npub fn poseidon2_permutation<let N: u32>(_input: [Field; N], _state_length: u32) -> [Field; N] {}\n\n// Generic hashing support. \n// Partially ported and impacted by rust.\n\n// Hash trait shall be implemented per type.\n#[derive_via(derive_hash)]\ntrait Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher;\n}\n\n// docs:start:derive_hash\ncomptime fn derive_hash(s: StructDefinition) -> Quoted {\n let name = quote { Hash };\n let signature = quote { fn hash<H>(_self: Self, _state: &mut H) where H: std::hash::Hasher };\n let for_each_field = |name| quote { _self.$name.hash(_state); };\n crate::meta::make_trait_impl(s, name, signature, for_each_field, quote {}, |fields| fields)\n}\n// docs:end:derive_hash\n\n// Hasher trait shall be implemented by algorithms to provide hash-agnostic means.\n// TODO: consider making the types generic here ([u8], [Field], etc.)\ntrait Hasher{\n fn finish(self) -> Field;\n \n fn write(&mut self, input: Field);\n}\n\n// BuildHasher is a factory trait, responsible for production of specific Hasher.\ntrait BuildHasher<H> where H: Hasher{\n fn build_hasher(self) -> H;\n}\n\nstruct BuildHasherDefault<H>;\n\nimpl<H> BuildHasher<H> for BuildHasherDefault<H>\nwhere \n H: Hasher + Default {\n fn build_hasher(_self: Self) -> H {\n H::default()\n }\n}\n\nimpl<H> Default for BuildHasherDefault<H>\nwhere \n H: Hasher + Default {\n fn default() -> Self {\n BuildHasherDefault {}\n }\n}\n\nimpl Hash for Field {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self);\n }\n}\n\nimpl Hash for u1 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u8 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u16 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u32 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for u64 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i8 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i16 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i32 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for i64 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for bool {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self as Field);\n }\n}\n\nimpl Hash for () {\n fn hash<H>(_self: Self, _state: &mut H) where H: Hasher {}\n}\n\nimpl Hash for U128 {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n H::write(state, self.lo as Field);\n H::write(state, self.hi as Field);\n }\n}\n\nimpl<T, let N: u32> Hash for [T; N] where T: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n for elem in self {\n elem.hash(state);\n }\n }\n}\n\nimpl<T> Hash for [T] where T: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.len().hash(state);\n for elem in self {\n elem.hash(state);\n }\n }\n}\n\nimpl<A, B> Hash for (A, B) where A: Hash, B: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.0.hash(state);\n self.1.hash(state);\n }\n}\n\nimpl<A, B, C> Hash for (A, B, C) where A: Hash, B: Hash, C: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.0.hash(state);\n self.1.hash(state);\n self.2.hash(state);\n }\n}\n\nimpl<A, B, C, D> Hash for (A, B, C, D) where A: Hash, B: Hash, C: Hash, D: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.0.hash(state);\n self.1.hash(state);\n self.2.hash(state);\n self.3.hash(state);\n }\n}\n\nimpl<A, B, C, D, E> Hash for (A, B, C, D, E) where A: Hash, B: Hash, C: Hash, D: Hash, E: Hash {\n fn hash<H>(self, state: &mut H) where H: Hasher {\n self.0.hash(state);\n self.1.hash(state);\n self.2.hash(state);\n self.3.hash(state);\n self.4.hash(state);\n }\n}\n\n// Some test vectors for Pedersen hash and Pedersen Commitment.\n// They have been generated using the same functions so the tests are for now useless\n// but they will be useful when we switch to Noir implementation.\n#[test]\nfn assert_pedersen() {\n assert_eq(\n pedersen_hash_with_separator([1], 1), 0x1b3f4b1a83092a13d8d1a59f7acb62aba15e7002f4440f2275edb99ebbc2305f\n );\n assert_eq(\n pedersen_commitment_with_separator([1], 1), EmbeddedCurvePoint {\n x: 0x054aa86a73cb8a34525e5bbed6e43ba1198e860f5f3950268f71df4591bde402,\n y: 0x209dcfbf2cfb57f9f6046f44d71ac6faf87254afc7407c04eb621a6287cac126,\n is_infinite: false\n }\n );\n\n assert_eq(\n pedersen_hash_with_separator([1, 2], 2), 0x26691c129448e9ace0c66d11f0a16d9014a9e8498ee78f4d69f0083168188255\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2], 2), EmbeddedCurvePoint {\n x: 0x2e2b3b191e49541fe468ec6877721d445dcaffe41728df0a0eafeb15e87b0753,\n y: 0x2ff4482400ad3a6228be17a2af33e2bcdf41be04795f9782bd96efe7e24f8778,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3], 3), 0x0bc694b7a1f8d10d2d8987d07433f26bd616a2d351bc79a3c540d85b6206dbe4\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3], 3), EmbeddedCurvePoint {\n x: 0x1fee4e8cf8d2f527caa2684236b07c4b1bad7342c01b0f75e9a877a71827dc85,\n y: 0x2f9fedb9a090697ab69bf04c8bc15f7385b3e4b68c849c1536e5ae15ff138fd1,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4], 4), 0xdae10fb32a8408521803905981a2b300d6a35e40e798743e9322b223a5eddc\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4], 4), EmbeddedCurvePoint {\n x: 0x07ae3e202811e1fca39c2d81eabe6f79183978e6f12be0d3b8eda095b79bdbc9,\n y: 0x0afc6f892593db6fbba60f2da558517e279e0ae04f95758587760ba193145014,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5], 5), 0xfc375b062c4f4f0150f7100dfb8d9b72a6d28582dd9512390b0497cdad9c22\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5], 5), EmbeddedCurvePoint {\n x: 0x1754b12bd475a6984a1094b5109eeca9838f4f81ac89c5f0a41dbce53189bb29,\n y: 0x2da030e3cfcdc7ddad80eaf2599df6692cae0717d4e9f7bfbee8d073d5d278f7,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6], 6), 0x1696ed13dc2730062a98ac9d8f9de0661bb98829c7582f699d0273b18c86a572\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6], 6), EmbeddedCurvePoint {\n x: 0x190f6c0e97ad83e1e28da22a98aae156da083c5a4100e929b77e750d3106a697,\n y: 0x1f4b60f34ef91221a0b49756fa0705da93311a61af73d37a0c458877706616fb,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7], 7), 0x128c0ff144fc66b6cb60eeac8a38e23da52992fc427b92397a7dffd71c45ede3\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7], 7), EmbeddedCurvePoint {\n x: 0x015441e9d29491b06563fac16fc76abf7a9534c715421d0de85d20dbe2965939,\n y: 0x1d2575b0276f4e9087e6e07c2cb75aa1baafad127af4be5918ef8a2ef2fea8fc,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7, 8], 8), 0x2f960e117482044dfc99d12fece2ef6862fba9242be4846c7c9a3e854325a55c\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7, 8], 8), EmbeddedCurvePoint {\n x: 0x1657737676968887fceb6dd516382ea13b3a2c557f509811cd86d5d1199bc443,\n y: 0x1f39f0cb569040105fa1e2f156521e8b8e08261e635a2b210bdc94e8d6d65f77,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9], 9), 0x0c96db0790602dcb166cc4699e2d306c479a76926b81c2cb2aaa92d249ec7be7\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9], 9), EmbeddedCurvePoint {\n x: 0x0a3ceae42d14914a432aa60ec7fded4af7dad7dd4acdbf2908452675ec67e06d,\n y: 0xfc19761eaaf621ad4aec9a8b2e84a4eceffdba78f60f8b9391b0bd9345a2f2,\n is_infinite: false\n }\n );\n assert_eq(\n pedersen_hash_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 10), 0x2cd37505871bc460a62ea1e63c7fe51149df5d0801302cf1cbc48beb8dff7e94\n );\n assert_eq(\n pedersen_commitment_with_separator([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 10), EmbeddedCurvePoint {\n x: 0x2fb3f8b3d41ddde007c8c3c62550f9a9380ee546fcc639ffbb3fd30c8d8de30c,\n y: 0x300783be23c446b11a4c0fabf6c91af148937cea15fcf5fb054abf7f752ee245,\n is_infinite: false\n }\n );\n}\n\n"},"326":{"path":"/usr/src/noir-projects/noir-protocol-circuits/crates/types/src/address/aztec_address.nr","source":"use crate::{\n crate::address::{partial_address::PartialAddress, public_keys_hash::PublicKeysHash},\n constants::{AZTEC_ADDRESS_LENGTH, GENERATOR_INDEX__CONTRACT_ADDRESS_V1},\n hash::poseidon2_hash_with_separator, traits::{Empty, FromField, ToField, Serialize, Deserialize},\n utils\n};\n\n// Aztec address\nstruct AztecAddress {\n inner : Field\n}\n\nimpl Eq for AztecAddress {\n fn eq(self, other: Self) -> bool {\n self.to_field() == other.to_field()\n }\n}\n\nimpl Empty for AztecAddress {\n fn empty() -> Self {\n Self { inner: 0 }\n }\n}\n\nimpl ToField for AztecAddress {\n fn to_field(self) -> Field {\n self.inner\n }\n}\n\nimpl FromField for AztecAddress {\n fn from_field(value: Field) -> AztecAddress {\n AztecAddress { inner: value }\n }\n}\n\nimpl Serialize<AZTEC_ADDRESS_LENGTH> for AztecAddress {\n fn serialize(self: Self) -> [Field; AZTEC_ADDRESS_LENGTH] {\n [self.to_field()]\n }\n}\n\nimpl Deserialize<AZTEC_ADDRESS_LENGTH> for AztecAddress {\n fn deserialize(fields: [Field; AZTEC_ADDRESS_LENGTH]) -> Self {\n FromField::from_field(fields[0])\n }\n}\n\nimpl AztecAddress {\n pub fn zero() -> Self {\n Self { inner: 0 }\n }\n\n pub fn compute(pub_keys_hash: PublicKeysHash, partial_address: PartialAddress) -> AztecAddress {\n AztecAddress::from_field(\n poseidon2_hash_with_separator(\n [pub_keys_hash.to_field(), partial_address.to_field()],\n GENERATOR_INDEX__CONTRACT_ADDRESS_V1\n )\n )\n }\n\n pub fn is_zero(self) -> bool {\n self.inner == 0\n }\n\n pub fn assert_is_zero(self) {\n assert(self.to_field() == 0);\n }\n\n pub fn conditional_assign(predicate: bool, lhs: Self, rhs: Self) -> Self {\n let result = utils::conditional_assign(predicate, rhs.to_field(), lhs.to_field());\n Self { inner: result }\n }\n}\n\n#[test]\nfn compute_address_from_partial_and_pub_keys_hash() {\n let pub_keys_hash = PublicKeysHash::from_field(1);\n let partial_address = PartialAddress::from_field(2);\n\n let address = AztecAddress::compute(pub_keys_hash, partial_address);\n let expected_computed_address_from_partial_and_pubkey = 0x23ce9be3fa3c846b0f9245cc796902e731d04f086e8a42473bb29e405fc98075;\n assert(address.to_field() == expected_computed_address_from_partial_and_pubkey);\n}\n\n#[test]\nfn from_field_to_field() {\n let address = AztecAddress { inner: 37 };\n assert_eq(FromField::from_field(address.to_field()), address);\n}\n\n#[test]\nfn serde() {\n let address = AztecAddress { inner: 37 };\n assert_eq(Deserialize::deserialize(address.serialize()), address);\n}\n"},"34":{"path":"std/hash/poseidon2.nr","source":"use crate::hash::Hasher;\nuse crate::default::Default;\n\ncomptime global RATE: u32 = 3;\n\nstruct Poseidon2 {\n cache: [Field;3],\n state: [Field;4],\n cache_size: u32,\n squeeze_mode: bool, // 0 => absorb, 1 => squeeze\n}\n\nimpl Poseidon2 {\n #[no_predicates]\n pub fn hash<let N: u32>(input: [Field; N], message_size: u32) -> Field {\n if message_size == N {\n Poseidon2::hash_internal(input, N, false)\n } else {\n Poseidon2::hash_internal(input, message_size, true)\n }\n }\n\n fn new(iv: Field) -> Poseidon2 {\n let mut result = Poseidon2 { cache: [0; 3], state: [0; 4], cache_size: 0, squeeze_mode: false };\n result.state[RATE] = iv;\n result\n }\n\n fn perform_duplex(&mut self) {\n // add the cache into sponge state\n for i in 0..RATE {\n // We effectively zero-pad the cache by only adding to the state\n // cache that is less than the specified `cache_size`\n if i < self.cache_size {\n self.state[i] += self.cache[i];\n }\n }\n self.state = crate::hash::poseidon2_permutation(self.state, 4);\n }\n\n fn absorb(&mut self, input: Field) {\n assert(!self.squeeze_mode);\n if self.cache_size == RATE {\n // If we're absorbing, and the cache is full, apply the sponge permutation to compress the cache\n self.perform_duplex();\n self.cache[0] = input;\n self.cache_size = 1;\n } else {\n // If we're absorbing, and the cache is not full, add the input into the cache\n self.cache[self.cache_size] = input;\n self.cache_size += 1;\n }\n }\n\n fn squeeze(&mut self) -> Field {\n assert(!self.squeeze_mode);\n // If we're in absorb mode, apply sponge permutation to compress the cache.\n self.perform_duplex();\n self.squeeze_mode = true;\n\n // Pop one item off the top of the permutation and return it.\n self.state[0]\n }\n\n fn hash_internal<let N: u32>(input: [Field; N], in_len: u32, is_variable_length: bool) -> Field {\n let two_pow_64 = 18446744073709551616;\n let iv : Field = (in_len as Field) * two_pow_64;\n let mut sponge = Poseidon2::new(iv);\n for i in 0..input.len() {\n if i < in_len {\n sponge.absorb(input[i]);\n }\n }\n\n // In the case where the hash preimage is variable-length, we append `1` to the end of the input, to distinguish\n // from fixed-length hashes. (the combination of this additional field element + the hash IV ensures\n // fixed-length and variable-length hashes do not collide)\n if is_variable_length {\n sponge.absorb(1);\n }\n sponge.squeeze()\n }\n}\n\nstruct Poseidon2Hasher{\n _state: [Field],\n}\n\nimpl Hasher for Poseidon2Hasher {\n fn finish(self) -> Field {\n let iv : Field = (self._state.len() as Field) * 18446744073709551616; // iv = (self._state.len() << 64)\n let mut sponge = Poseidon2::new(iv);\n for i in 0..self._state.len() {\n sponge.absorb(self._state[i]);\n }\n sponge.squeeze()\n }\n\n fn write(&mut self, input: Field) {\n self._state = self._state.push_back(input);\n }\n}\n\nimpl Default for Poseidon2Hasher {\n fn default() -> Self {\n Poseidon2Hasher { _state: &[] }\n }\n}\n"},"405":{"path":"/usr/src/noir-projects/noir-contracts/contracts/key_registry_contract/src/main.nr","source":"contract KeyRegistry {\n use dep::authwit::auth::assert_current_call_valid_authwit_public;\n\n use dep::aztec::{\n keys::{PublicKeys, stored_keys::StoredKeys, public_keys::NpkM},\n state_vars::{PublicMutable, Map}, protocol_types::address::{AztecAddress, PartialAddress}\n };\n\n #[aztec(storage)]\n struct Storage {\n current_keys: Map<AztecAddress, PublicMutable<StoredKeys>>,\n }\n\n impl<Context> Storage<Context> {\n // The init function is typically automatically generated by the macros - here we implement it manually in order\n // to have control over which storage slot is assigned to the current_keys state variable.\n fn init(context: Context) -> Self {\n Storage {\n // Ideally we'd do KEY_REGISTRY_STORAGE_SLOT instead of hardcoding the 1 here, but that is currently\n // causing compilation errors.\n // TODO(#7829): fix this\n current_keys: Map::new(\n context,\n 1,\n |context, slot| { PublicMutable::new(context, slot) }\n )\n }\n }\n }\n\n unconstrained fn get_current_keys(account: AztecAddress) -> pub PublicKeys {\n // If #7524 were to be implemented, this function could be called by an oracle from an unconstrained function\n // in order to produce the preimage of the stored hash, and hence prove the correctness of the keys.\n storage.current_keys.at(account).read().public_keys\n }\n\n #[aztec(public)]\n fn register_initial_keys(account: AztecAddress, partial_address: PartialAddress, keys: PublicKeys) {\n let computed_address = AztecAddress::compute(keys.hash(), partial_address);\n assert(computed_address.eq(account), \"Computed address does not match supplied address\");\n\n storage.current_keys.at(account).write(StoredKeys::new(keys));\n }\n\n #[aztec(public)]\n fn rotate_npk_m(account: AztecAddress, new_npk_m: NpkM, nonce: Field) {\n if (!account.eq(context.msg_sender())) {\n assert_current_call_valid_authwit_public(&mut context, account);\n } else {\n assert(nonce == 0, \"invalid nonce\");\n }\n\n let account_key_storage = storage.current_keys.at(account);\n\n // We read all other current keys so that we can compute the new hash - we can't update just the npk. This means\n // updating all keys at once costs the same as updating just one (unless setting public storage to its current\n // value is cheaper than changing it, e.g. EIP-2200).\n let mut current_keys = account_key_storage.read().public_keys;\n current_keys.npk_m = new_npk_m;\n\n account_key_storage.write(StoredKeys::new(current_keys));\n }\n}\n"},"74":{"path":"/usr/src/noir-projects/aztec-nr/authwit/src/auth.nr","source":"use dep::aztec::protocol_types::{\n abis::function_selector::FunctionSelector, address::AztecAddress,\n constants::{\n GENERATOR_INDEX__AUTHWIT_INNER, GENERATOR_INDEX__AUTHWIT_OUTER, GENERATOR_INDEX__AUTHWIT_NULLIFIER,\n CANONICAL_AUTH_REGISTRY_ADDRESS\n},\n hash::poseidon2_hash_with_separator\n};\nuse dep::aztec::{prelude::Deserialize, context::{PrivateContext, PublicContext, gas::GasOpts}, hash::hash_args_array};\n\n/**\n * Authenticaion witness helper library\n *\n * Authentication Witness is a scheme for authenticating actions on Aztec, so users can allow third-parties\n * (e.g. protocols or other users) to execute an action on their behalf.\n *\n * This library provides helper functions to manage such witnesses.\n * The authentication witness, is some \"witness\" (data) that authenticates a `message_hash`.\n * The simplest example of an authentication witness, is a signature. The signature is the \"evidence\",\n * that the signer has seen the message, agrees with it, and has allowed it.\n * It does not need to be a signature. It could be any kind of \"proof\" that the message is allowed.\n * Another proof could be knowing some kind of secret, or having some kind of \"token\" that allows the message.\n *\n * The `message_hash` is a hash of the following structure:\n * hash(consumer, chain_id, version, inner_hash)\n * - consumer: the address of the contract that is \"consuming\" the message,\n * - chain_id: the chain id of the chain that the message is being consumed on,\n * - version: the version of the chain that the message is being consumed on,\n * - inner_hash: the hash of the \"inner\" message that is being consumed, this is the \"actual\" message or action.\n *\n * While the `inner_hash` could be anything, such as showing you signed a specific message, it will often be\n * a hash of the \"action\" to approve, along with who made the call. As part of this library, we provide a few\n * helper functions to deal with such messages.\n *\n * For example, we provide helper function that is used for checking that the message is an encoding of the current call.\n * This can be used to let some contract \"allow\" another contract to act on its behalf, as long as it can\n * show that it is acting on behalf of the contract.\n *\n * If we take a case of allowing a contract to transfer tokens on behalf of an account, the `inner_hash` can be\n * derived as:\n * inner_hash = hash(caller, \"transfer\", hash(to, amount))\n *\n * Where the `caller` would be the address of the contract that is trying to transfer the tokens, and `to` and `amount`\n * the arguments for the transfer.\n *\n * Note that we have both a `caller` and a `consumer`, the `consumer` will be the contract that is consuming the message,\n * in the case of the transfer, it would be the `Token` contract itself, while the caller, will be the actor that is\n * allowed to transfer the tokens.\n *\n *\n * The authentication mechanism works differently in public and private contexts. In private, we recall that everything\n * is executed on the user's device, so we can use `oracles` to \"ask\" the user (not contract) for information. In public\n * we cannot do this, since it is executed by the sequencer (someone else). Therefore we can instead use a \"registry\"\n * to store the messages that we have approved.\n *\n * A simple example would be a \"token\" that is being \"pulled\" from one account into another. We will first outline\n * how this would look in private, and then in public later.\n *\n * Say that a user `Alice` wants to deposit some tokens into a DeFi protocol (say a DEX).\n * `Alice` would make a `deposit` transaction, that she is executing using her account contract.\n * The account would call the `DeFi` contract to execute `deposit`, which would try to pull funds from the `Token`\n * contract. Since the `DeFi` contract is trying to pull funds from an account that is not its own, it needs to\n * convince the `Token` contract that it is allowed to do so.\n *\n * This is where the authentication witness comes in The `Token` contract computes a `message_hash` from the\n * `transfer` call, and then asks `Alice Account` contract to verify that the `DeFi` contract is allowed to\n * execute that call.\n *\n * `Alice Account` contract can then ask `Alice` if she wants to allow the `DeFi` contract to pull funds from her\n * account. If she does, she will sign the `message_hash` and return the signature to the `Alice Account` which\n * will validate it and return success to the `Token` contract which will then allow the `DeFi` contract to pull\n * funds from `Alice`.\n *\n * To ensure that the same \"approval\" cannot be used multiple times, we also compute a `nullifier` for the\n * authentication witness, and emit it from the `Token` contract (consumer).\n *\n * Note that we can do this flow as we are in private were we can do oracle calls out from contracts.\n *\n *\n * Person Contract Contract Contract\n * Alice Alice Account Token DeFi\n * | | | |\n * | Defi.deposit(Token, 1000) | |\n * |----------------->| | |\n * | | deposit(Token, 1000) |\n * | |---------------------------------------->|\n * | | | |\n * | | | transfer(Alice, Defi, 1000)\n * | | |<---------------------|\n * | | | |\n * | | Check if Defi may call transfer(Alice, Defi, 1000)\n * | |<-----------------| |\n * | | | |\n * | Please give me AuthWit for DeFi | |\n * | calling transfer(Alice, Defi, 1000) | |\n * |<-----------------| | |\n * | | | |\n * | | | |\n * | AuthWit for transfer(Alice, Defi, 1000) |\n * |----------------->| | |\n * | | AuthWit validity | |\n * | |----------------->| |\n * | | | |\n * | | throw if invalid AuthWit |\n * | | | |\n * | | emit AuthWit nullifier |\n * | | | |\n * | | transfer(Alice, Defi, 1000) |\n * | | | |\n * | | | |\n * | | | success |\n * | | |--------------------->|\n * | | | |\n * | | | |\n * | | | deposit(Token, 1000)\n * | | | |\n * | | | |\n *\n *\n * If we instead were in public, we cannot do the same flow. Instead we would use an authentication registry to store\n * the messages that we have approved.\n *\n * To approve a message, `Alice Account` can make a `set_authorized` call to the registry, to set a `message_hash`\n * as authorized. This is essentially a mapping from `message_hash` to `true` for `Alice Contract`. Every account\n * has its own map in the registry, so `Alice` cannot approve a message for `Bob`.\n *\n * The `Token` contract can then try to \"spend\" the approval by calling `consume` on the registry. If the message\n * was approved, the value is updated to `false`, and we return the success flag. For more information on the\n * registry, see `main.nr` in `auth_registry_contract`.\n *\n * Person Contract Contract Contract Contract\n * Alice Alice Account Registry Token DeFi\n * | | | | |\n * | Registry.set_authorized(..., true) | | |\n * |----------------->| | | |\n * | | set_authorized(..., true) | |\n * | |------------------->| | |\n * | | | | |\n * | | set authorized to true | |\n * | | | | |\n * | | | | |\n * | Defi.deposit(Token, 1000) | | |\n * |----------------->| | | |\n * | | deposit(Token, 1000) | |\n * | |-------------------------------------------------------------->|\n * | | | | |\n * | | | transfer(Alice, Defi, 1000) |\n * | | | |<---------------------|\n * | | | | |\n * | | | Check if Defi may call transfer(Alice, Defi, 1000)\n * | | |<------------------| |\n * | | | | |\n * | | throw if invalid AuthWit | |\n * | | | | |\n * | | | | |\n * | | set authorized to false | |\n * | | | | |\n * | | | | |\n * | | | AuthWit validity | |\n * | | |------------------>| |\n * | | | | |\n * | | | | transfer(Alice, Defi, 1000)\n * | | | |<-------------------->|\n * | | | | |\n * | | | | success |\n * | | | |--------------------->|\n * | | | | |\n * | | | | deposit(Token, 1000)\n * | | | | |\n *\n *\n * --- FAQ ---\n * Q: Why are we using a success flag of `poseidon2_hash_bytes(\"IS_VALID()\")` instead of just returning a boolean?\n * A: We want to make sure that we don't accidentally return `true` if there is a collision in the function selector.\n * By returning a hash of `IS_VALID()`, it becomes very unlikely that there is both a collision and we return\n * a success flag.\n *\n * Q: Why are we using static calls?\n * A: We are using static calls to ensure that the account contract cannot re-enter. If it was a normal call, it\n * could make a new call and do a re-entry attack. Using a static ensures that it cannot update any state.\n *\n * Q: Would it not be cheaper to use a nullifier instead of updating state in public?\n * A: At a quick glance, a public state update + nullifier is 96 bytes, but two state updates are 128, so it would be\n * cheaper to use a nullifier, if this is the way it would always be done. However, if both the approval and the\n * consumption is done in the same transaction, then we will be able to squash the updates (only final tx state diff is posted to DA), and now it is cheaper.\n *\n * Q: Why is the chain id and the version part of the message hash?\n * A: The chain id and the version is part of the message hash to ensure that the message is only valid on a specific\n * chain to avoid a case where the same message could be used across multiple chains.\n */\n\nglobal IS_VALID_SELECTOR = 0x47dacd73; // 4 last bytes of poseidon2_hash_bytes(\"IS_VALID()\")\n\n/**\n * Assert that `on_behalf_of` have authorized the current call with a valid authentication witness\n *\n * Computing the `inner_hash` using the `msg_sender`, `selector` and `args_hash` and then making a call out to the\n * `on_behalf_of` contract to verify that the `inner_hash` is valid.\n *\n * @param on_behalf_of The address that have authorized the current call\n */\n// docs:start:assert_current_call_valid_authwit\npub fn assert_current_call_valid_authwit(context: &mut PrivateContext, on_behalf_of: AztecAddress) {\n let inner_hash = compute_inner_authwit_hash([context.msg_sender().to_field(), context.selector().to_field(), context.args_hash]);\n assert_inner_hash_valid_authwit(context, on_behalf_of, inner_hash);\n}\n// docs:end:assert_current_call_valid_authwit\n\n/**\n * Assert that a specific `inner_hash` is valid for the `on_behalf_of` address\n *\n * Used as an internal function for `assert_current_call_valid_authwit` and can be used as a standalone function when\n * the `inner_hash` is from a different source, e.g., say a block of text etc.\n *\n * @param on_behalf_of The address that have authorized the current call\n * @param inner_hash The hash of the message to authorize\n */\npub fn assert_inner_hash_valid_authwit(\n context: &mut PrivateContext,\n on_behalf_of: AztecAddress,\n inner_hash: Field\n) {\n // We perform a static call here and not a standard one to ensure that the account contract cannot re-enter.\n let result: Field = context.static_call_private_function(\n on_behalf_of,\n comptime {\n FunctionSelector::from_signature(\"verify_private_authwit(Field)\")\n },\n [inner_hash]\n ).unpack_into();\n assert(result == IS_VALID_SELECTOR, \"Message not authorized by account\");\n // Compute the nullifier, similar computation to the outer hash, but without the chain_id and version.\n // Those should already be handled in the verification, so we just need something to nullify, that allow same inner_hash for multiple actors.\n let nullifier = compute_authwit_nullifier(on_behalf_of, inner_hash);\n context.push_nullifier(nullifier);\n}\n\n/**\n * Assert that `on_behalf_of` have authorized the current call in the authentication registry\n *\n * Computing the `inner_hash` using the `msg_sender`, `selector` and `args_hash` and then making a call out to the\n * `on_behalf_of` contract to verify that the `inner_hash` is valid.\n *\n * Note that the authentication registry will take the `msg_sender` into account as the consumer, so this will only\n * work if the `msg_sender` is the same as the `consumer` when the `message_hash` was inserted into the registry.\n *\n * @param on_behalf_of The address that have authorized the current call\n */\n// docs:start:assert_current_call_valid_authwit_public\npub fn assert_current_call_valid_authwit_public(context: &mut PublicContext, on_behalf_of: AztecAddress) {\n let inner_hash = compute_inner_authwit_hash(\n [(*context).msg_sender().to_field(), (*context).selector().to_field(), (*context).get_args_hash()]\n );\n assert_inner_hash_valid_authwit_public(context, on_behalf_of, inner_hash);\n}\n// docs:end:assert_current_call_valid_authwit_public\n\n/**\n * Assert that `on_behalf_of` have authorized a speicifc `inner_hash` in the authentication registry\n *\n * Computing the `inner_hash` using the `msg_sender`, `selector` and `args_hash` and then making a call out to the\n * `on_behalf_of` contract to verify that the `inner_hash` is valid.\n *\n * Note that the authentication registry will take the `msg_sender` into account as the consumer, so this will only\n * work if the `msg_sender` is the same as the `consumer` when the `message_hash` was inserted into the registry.\n *\n * @param on_behalf_of The address that have authorized the `inner_hash`\n */\npub fn assert_inner_hash_valid_authwit_public(\n context: &mut PublicContext,\n on_behalf_of: AztecAddress,\n inner_hash: Field\n) {\n let result: Field = context.call_public_function(\n CANONICAL_AUTH_REGISTRY_ADDRESS,\n comptime {\n FunctionSelector::from_signature(\"consume((Field),Field)\")\n },\n [on_behalf_of.to_field(), inner_hash].as_slice(),\n GasOpts::default()\n ).deserialize_into();\n assert(result == IS_VALID_SELECTOR, \"Message not authorized by account\");\n}\n\n/**\n * Compute the `message_hash` from a function call to be used by an authentication witness\n *\n * Useful for when you need a non-account contract to approve during execution. For example if you need a contract\n * to make a call to nested contract, e.g., contract A wants to exit token T to L1 using bridge B, so it needs to allow\n * B to transfer T on its behalf.\n *\n * @param caller The address of the contract that is calling the function, in the example above, this would be B\n * @param consumer The address of the contract that is consuming the message, in the example above, this would be T\n * @param chain_id The chain id of the chain that the message is being consumed on\n * @param version The version of the chain that the message is being consumed on\n * @param selector The function selector of the function that is being called\n * @param args The arguments of the function that is being called\n */\n// docs:start:compute_authwit_message_hash_from_call\npub fn compute_authwit_message_hash_from_call<let N: u32>(\n caller: AztecAddress,\n consumer: AztecAddress,\n chain_id: Field,\n version: Field,\n selector: FunctionSelector,\n args: [Field; N]\n) -> Field {\n let args_hash = hash_args_array(args);\n let inner_hash = compute_inner_authwit_hash([caller.to_field(), selector.to_field(), args_hash]);\n compute_authwit_message_hash(consumer, chain_id, version, inner_hash)\n}\n// docs:end:compute_authwit_message_hash_from_call\n\n/**\n * Computes the `inner_hash` of the authentication witness\n *\n * This is used internally, but also useful in cases where you want to compute the `inner_hash` for a specific message\n * that is not necessarily a call, but just some \"bytes\" or text.\n *\n * @param args The arguments to hash\n */\npub fn compute_inner_authwit_hash<let N: u32>(args: [Field; N]) -> Field {\n poseidon2_hash_with_separator(args, GENERATOR_INDEX__AUTHWIT_INNER)\n}\n\n/**\n * Computs the `authwit_nullifier` for a specific `on_behalf_of` and `inner_hash`\n *\n * Using the `on_behalf_of` and the `inner_hash` to ensure that the nullifier is siloed for a specific `on_behalf_of`.\n *\n * @param on_behalf_of The address that have authorized the `inner_hash`\n * @param inner_hash The hash of the message to authorize\n */\npub fn compute_authwit_nullifier(on_behalf_of: AztecAddress, inner_hash: Field) -> Field {\n poseidon2_hash_with_separator(\n [on_behalf_of.to_field(), inner_hash],\n GENERATOR_INDEX__AUTHWIT_NULLIFIER\n )\n}\n\n/**\n * Computes the `message_hash` for the authentication witness\n *\n * @param consumer The address of the contract that is consuming the message\n * @param chain_id The chain id of the chain that the message is being consumed on\n * @param version The version of the chain that the message is being consumed on\n * @param inner_hash The hash of the \"inner\" message that is being consumed\n */\npub fn compute_authwit_message_hash(\n consumer: AztecAddress,\n chain_id: Field,\n version: Field,\n inner_hash: Field\n) -> Field {\n poseidon2_hash_with_separator(\n [\n consumer.to_field(),\n chain_id,\n version,\n inner_hash\n ],\n GENERATOR_INDEX__AUTHWIT_OUTER\n )\n}\n\n/**\n * Helper function to set the authorization status of a message hash\n *\n * Wraps a public call to the authentication registry to set the authorization status of a `message_hash`\n *\n * @param message_hash The hash of the message to authorize\n * @param authorize True if the message should be authorized, false if it should be revoked\n */\npub fn set_authorized(context: &mut PublicContext, message_hash: Field, authorize: bool) {\n context.call_public_function(\n CANONICAL_AUTH_REGISTRY_ADDRESS,\n comptime {\n FunctionSelector::from_signature(\"set_authorized(Field,bool)\")\n },\n [message_hash, authorize as Field].as_slice(),\n GasOpts::default()\n ).assert_empty();\n}\n\n/**\n * Helper function to reject all authwits\n *\n * Wraps a public call to the authentication registry to set the `reject_all` flag\n *\n * @param reject True if all authwits should be rejected, false otherwise\n */\npub fn set_reject_all(context: &mut PublicContext, reject: bool) {\n context.call_public_function(\n CANONICAL_AUTH_REGISTRY_ADDRESS,\n comptime {\n FunctionSelector::from_signature(\"set_reject_all(bool)\")\n },\n [context.this_address().to_field(), reject as Field].as_slice(),\n GasOpts::default()\n ).assert_empty();\n}\n"},"85":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/keys/stored_keys.nr","source":"use crate::keys::public_keys::{PublicKeys, PUBLIC_KEYS_LENGTH};\nuse dep::protocol_types::traits::{Serialize, Deserialize};\n\n// This struct represents how public keys are stored in the key registry. We store not just the keys themselves but also\n// their hash, so that when reading in private we can perform a historical read for the hash and then show that it\n// corresponds to a preimage obtained from an unconstrained hint. We do store the keys keys regardless as they might be\n// needed during public execution, and since we need to broadcast and produce hints in some standardized way.\n// While it might seem odd to create a struct for what is effectively some data and a pure function called on it, state\n// variables rely on serializable structs in order to persist data to storage, so we must use this abstraction.\nstruct StoredKeys {\n public_keys: PublicKeys,\n hash: Field,\n}\n\nimpl StoredKeys {\n // Instances of StoredKeys are expected to only be created by calling this function so that we guarantee that the\n // hash field does indeed correspond to the hash of the keys. Ideally we'd forbid direct access to the struct, but \n // Noir doesn't yet support private members.\n fn new(public_keys: PublicKeys) -> Self {\n Self { public_keys, hash: public_keys.hash().inner }\n }\n}\n\n// Our serialization is the concatenation of the public keys serialization plush the hash, so we need one extra field.\nglobal STORED_KEYS_LENGTH: u32 = PUBLIC_KEYS_LENGTH + 1;\n\nimpl Serialize<STORED_KEYS_LENGTH> for StoredKeys {\n fn serialize(self) -> [Field; STORED_KEYS_LENGTH] {\n // The code below is equivalent to:\n // [ ...self.public_keys.serialize(), self.hash ]\n\n let mut array = [0; STORED_KEYS_LENGTH];\n\n let serialized_keys = self.public_keys.serialize();\n for i in 0..serialized_keys.len() {\n array[i] = serialized_keys[i];\n }\n\n array[PUBLIC_KEYS_LENGTH] = self.hash;\n\n array\n }\n}\n\nimpl Deserialize<STORED_KEYS_LENGTH> for StoredKeys {\n fn deserialize(array: [Field; STORED_KEYS_LENGTH]) -> Self {\n // The code below is equivalent to:\n // Self { public_keys: PublicKeys::deserialize(array[0 : PUBLIC_KEYS_LENGTH]), hash: array[PUBLIC_KEYS_LENGTH] }\n\n let mut serialized_keys = [0; PUBLIC_KEYS_LENGTH];\n for i in 0..serialized_keys.len() {\n serialized_keys[i] = array[i];\n }\n\n let hash = array[PUBLIC_KEYS_LENGTH];\n\n Self { public_keys: PublicKeys::deserialize(serialized_keys), hash }\n }\n}\n"},"86":{"path":"/usr/src/noir-projects/aztec-nr/aztec/src/keys/public_keys.nr","source":"use dep::protocol_types::{\n address::PublicKeysHash, constants::GENERATOR_INDEX__PUBLIC_KEYS_HASH,\n hash::poseidon2_hash_with_separator, point::{Point, POINT_LENGTH},\n traits::{Deserialize, Serialize, Empty, is_empty, Hash}\n};\n\nglobal PUBLIC_KEYS_LENGTH: u32 = 12;\n\nstruct PublicKeys {\n npk_m: NpkM,\n ivpk_m: IvpkM,\n ovpk_m: OvpkM,\n tpk_m: TpkM,\n}\n\ntrait ToPoint {\n fn to_point(self) -> Point;\n}\n\nstruct NpkM {\n inner: Point\n}\n\nimpl ToPoint for NpkM {\n fn to_point(self) -> Point {\n self.inner\n }\n}\n\nimpl Serialize<POINT_LENGTH> for NpkM {\n fn serialize(self) -> [Field; POINT_LENGTH] {\n self.inner.serialize()\n }\n}\n\n// Note: If we store npk_m_hash directly we can remove this trait implementation. See #8091\nimpl Hash for NpkM {\n fn hash(self) -> Field {\n self.inner.hash()\n }\n}\n\nstruct IvpkM {\n inner: Point\n}\n\nimpl ToPoint for IvpkM {\n fn to_point(self) -> Point {\n self.inner\n }\n}\n\nimpl Serialize<POINT_LENGTH> for IvpkM {\n fn serialize(self) -> [Field; POINT_LENGTH] {\n self.inner.serialize()\n }\n}\n\nstruct OvpkM {\n inner: Point\n}\n\nimpl Hash for OvpkM {\n fn hash(self) -> Field {\n self.inner.hash()\n }\n}\n\nimpl ToPoint for OvpkM {\n fn to_point(self) -> Point {\n self.inner\n }\n}\n\nimpl Serialize<POINT_LENGTH> for OvpkM {\n fn serialize(self) -> [Field; POINT_LENGTH] {\n self.inner.serialize()\n }\n}\n\nstruct TpkM {\n inner: Point\n}\n\nimpl ToPoint for TpkM {\n fn to_point(self) -> Point {\n self.inner\n }\n}\n\nimpl Empty for PublicKeys {\n fn empty() -> Self {\n PublicKeys {\n npk_m: NpkM { inner: Point::empty() },\n ivpk_m: IvpkM { inner: Point::empty() },\n ovpk_m: OvpkM { inner: Point::empty() },\n tpk_m: TpkM { inner: Point::empty() }\n }\n }\n}\n\nimpl Eq for PublicKeys {\n fn eq(self, other: PublicKeys) -> bool {\n (self.npk_m.inner == other.npk_m.inner)\n & (self.ivpk_m.inner == other.ivpk_m.inner)\n & (self.ovpk_m.inner == other.ovpk_m.inner)\n & (self.tpk_m.inner == other.tpk_m.inner)\n }\n}\n\nimpl PublicKeys {\n pub fn hash(self) -> PublicKeysHash {\n PublicKeysHash::from_field(\n if is_empty(self) {\n 0\n } else {\n poseidon2_hash_with_separator(self.serialize(), GENERATOR_INDEX__PUBLIC_KEYS_HASH as Field)\n }\n )\n }\n}\n\nimpl Serialize<PUBLIC_KEYS_LENGTH> for PublicKeys {\n fn serialize(self) -> [Field; PUBLIC_KEYS_LENGTH] {\n [\n self.npk_m.inner.x,\n self.npk_m.inner.y,\n self.npk_m.inner.is_infinite as Field,\n self.ivpk_m.inner.x,\n self.ivpk_m.inner.y,\n self.ivpk_m.inner.is_infinite as Field,\n self.ovpk_m.inner.x,\n self.ovpk_m.inner.y,\n self.ovpk_m.inner.is_infinite as Field,\n self.tpk_m.inner.x,\n self.tpk_m.inner.y,\n self.tpk_m.inner.is_infinite as Field\n ]\n }\n}\n\nimpl Deserialize<PUBLIC_KEYS_LENGTH> for PublicKeys {\n fn deserialize(serialized: [Field; PUBLIC_KEYS_LENGTH]) -> PublicKeys {\n PublicKeys {\n npk_m: NpkM { inner: Point { x: serialized[0], y: serialized[1], is_infinite: serialized[2] as bool } },\n ivpk_m: IvpkM { inner: Point { x: serialized[3], y: serialized[4], is_infinite: serialized[5] as bool } },\n ovpk_m: OvpkM { inner: Point { x: serialized[6], y: serialized[7], is_infinite: serialized[8] as bool } },\n tpk_m: TpkM { inner: Point { x: serialized[9], y: serialized[10], is_infinite: serialized[11] as bool } }\n }\n }\n}\n\n#[test]\nfn compute_public_keys_hash() {\n let keys = PublicKeys {\n npk_m: NpkM { inner: Point { x: 1, y: 2, is_infinite: false } },\n ivpk_m: IvpkM { inner: Point { x: 3, y: 4, is_infinite: false } },\n ovpk_m: OvpkM { inner: Point { x: 5, y: 6, is_infinite: false } },\n tpk_m: TpkM { inner: Point { x: 7, y: 8, is_infinite: false } }\n };\n\n let actual = keys.hash();\n let expected_public_keys_hash = 0x0fecd9a32db731fec1fded1b9ff957a1625c069245a3613a2538bd527068b0ad;\n\n assert(actual.to_field() == expected_public_keys_hash);\n}\n\n#[test]\nfn compute_empty_hash() {\n let keys = PublicKeys::empty();\n\n let actual = keys.hash();\n let test_data_empty_hash = 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n assert(actual.to_field() == test_data_empty_hash);\n}\n\n#[test]\nfn test_public_keys_serialization() {\n let keys = PublicKeys {\n npk_m: NpkM { inner: Point { x: 1, y: 2, is_infinite: false } },\n ivpk_m: IvpkM { inner: Point { x: 3, y: 4, is_infinite: false } },\n ovpk_m: OvpkM { inner: Point { x: 5, y: 6, is_infinite: false } },\n tpk_m: TpkM { inner: Point { x: 7, y: 8, is_infinite: false } }\n };\n\n let serialized = keys.serialize();\n let deserialized = PublicKeys::deserialize(serialized);\n\n assert_eq(keys.npk_m.inner.x, deserialized.npk_m.inner.x);\n assert_eq(keys.npk_m.inner.y, deserialized.npk_m.inner.y);\n assert_eq(keys.ivpk_m.inner.x, deserialized.ivpk_m.inner.x);\n assert_eq(keys.ivpk_m.inner.y, deserialized.ivpk_m.inner.y);\n assert_eq(keys.ovpk_m.inner.x, deserialized.ovpk_m.inner.x);\n assert_eq(keys.ovpk_m.inner.y, deserialized.ovpk_m.inner.y);\n assert_eq(keys.tpk_m.inner.x, deserialized.tpk_m.inner.x);\n assert_eq(keys.tpk_m.inner.y, deserialized.tpk_m.inner.y);\n}\n"}}}
|