Skip to content

Revert mmr/partial.rs leaves() function to const LEAVES once P3 constructors are const #731

@huitseeker

Description

@huitseeker

In miden-crypto/src/merkle/mmr/partial.rs at line 643, the const LEAVES array was changed to fn leaves() to work around the fact that P3's int_to_node function is not const.

Change Made

-    const LEAVES: [Word; 7] = [
-        int_to_node(0),
-        int_to_node(1),
-        int_to_node(2),
-        int_to_node(3),
-        int_to_node(4),
-        int_to_node(5),
-        int_to_node(6),
-    ];
+    fn leaves() -> [Word; 7] {
+        [
+            int_to_node(0),
+            int_to_node(1),
+            int_to_node(2),
+            int_to_node(3),
+            int_to_node(4),
+            int_to_node(5),
+            int_to_node(6),
+        ]
+    }

Action Required

Once upstream Plonky3 releases our changes that make their constructors const, revert this function back to a const array.

Part of #724

Metadata

Metadata

Assignees

No one assigned

    Labels

    merkleRelated to Merkle trees or MMRsplonky3Related to Plonky3 migration

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions