@@ -13,9 +13,6 @@ contract EvmSharpMmrGrowingModule is IEvmSharpMmrGrowingModule, AccessController
1313 // Using inline library for efficient splitting and joining of uint256 values
1414 using Uint256Splitter for uint256 ;
1515
16- // Cairo program hash calculated with Poseidon (i.e., the off-chain block headers accumulator program)
17- bytes32 public constant PROGRAM_HASH = bytes32 (uint256 (0x1eca36d586f5356fba096edbf7414017d51cd0ed24b8fde80f78b61a9216ed2 ));
18-
1916 bytes32 public constant KECCAK_HASHING_FUNCTION = keccak256 ("keccak " );
2017 bytes32 public constant POSEIDON_HASHING_FUNCTION = keccak256 ("poseidon " );
2118
@@ -39,12 +36,32 @@ contract EvmSharpMmrGrowingModule is IEvmSharpMmrGrowingModule, AccessController
3936
4037 // ========================= Core Functions ========================= //
4138
42- function initEvmSharpMmrGrowingModule (IFactsRegistry factsRegistry ) external onlyOwner {
39+ function initEvmSharpMmrGrowingModule () external onlyOwner {
4340 EvmSharpMmrGrowingModuleStorage storage ms = moduleStorage ();
44- ms.factsRegistry = factsRegistry;
4541 ms.aggregatedChainId = block .chainid ;
4642 }
4743
44+ function setEvmSharpMmrGrowingModuleFactsRegistry (address factsRegistry ) external onlyOwner {
45+ EvmSharpMmrGrowingModuleStorage storage ms = moduleStorage ();
46+ ms.factsRegistry = IFactsRegistry (factsRegistry);
47+ }
48+
49+ // Cairo program hash calculated with Poseidon (i.e., the off-chain block headers accumulator program)
50+ function setEvmSharpMmrGrowingModuleProgramHash (uint256 programHash ) external onlyOwner {
51+ EvmSharpMmrGrowingModuleStorage storage ms = moduleStorage ();
52+ ms.programHash = programHash;
53+ }
54+
55+ function getEvmSharpMmrGrowingModuleFactsRegistry () external view returns (address ) {
56+ EvmSharpMmrGrowingModuleStorage storage ms = moduleStorage ();
57+ return address (ms.factsRegistry);
58+ }
59+
60+ function getEvmSharpMmrGrowingModuleProgramHash () external view returns (uint256 ) {
61+ EvmSharpMmrGrowingModuleStorage storage ms = moduleStorage ();
62+ return ms.programHash;
63+ }
64+
4865 function createEvmSharpMmr (uint256 newMmrId , uint256 originalMmrId , uint256 mmrSize ) external {
4966 bytes32 [] memory hashingFunctions = new bytes32 [](2 );
5067 hashingFunctions[0 ] = KECCAK_HASHING_FUNCTION;
@@ -189,11 +206,11 @@ contract EvmSharpMmrGrowingModule is IEvmSharpMmrGrowingModule, AccessController
189206 // We hash the outputs
190207 bytes32 outputHash = keccak256 (abi.encodePacked (outputs));
191208
192- // We compute the deterministic fact bytes32 value
193- bytes32 fact = keccak256 (abi.encode (PROGRAM_HASH, outputHash));
194-
195209 EvmSharpMmrGrowingModuleStorage storage ms = moduleStorage ();
196210
211+ // We compute the deterministic fact bytes32 value
212+ bytes32 fact = keccak256 (abi.encode (ms.programHash, outputHash));
213+
197214 // We ensure this fact has been registered on SHARP Facts Registry
198215 if (! ms.factsRegistry.isValid (fact)) {
199216 revert InvalidFact ();
0 commit comments