diff --git a/docs/ProcessRegistry.md b/docs/ProcessRegistry.md index 891f78a..6e88478 100644 --- a/docs/ProcessRegistry.md +++ b/docs/ProcessRegistry.md @@ -299,7 +299,7 @@ Submits a state transition with zero-knowledge proof. - Updates latest state root - Increments vote counts -- Emits `ProcessStateRootUpdated` +- Emits `ProcessStateTransitioned` #### setProcessResults @@ -409,13 +409,16 @@ event ProcessDurationChanged(bytes32 indexed processId, uint256 duration) Emitted when process duration is modified. -### ProcessStateRootUpdated +### ProcessStateTransitioned ```solidity -event ProcessStateRootUpdated( +event ProcessStateTransitioned( bytes32 indexed processId, address indexed sender, - uint256 newStateRoot + uint256 oldStateRoot, + uint256 newStateRoot, + uint256 newVotersCount, + uint256 newOverwrittenVotesCount ) ``` diff --git a/src/ProcessRegistry.sol b/src/ProcessRegistry.sol index 860d10e..2d0c260 100644 --- a/src/ProcessRegistry.sol +++ b/src/ProcessRegistry.sol @@ -303,7 +303,14 @@ contract ProcessRegistry is IProcessRegistry { p.overwrittenVotesCount += st.overwrittenVotesCount; ++p.batchNumber; - emit ProcessStateRootUpdated(processId, msg.sender, st.rootHashAfter); + emit ProcessStateTransitioned( + processId, + msg.sender, + st.rootHashBefore, + st.rootHashAfter, + p.votersCount, + p.overwrittenVotesCount + ); } /// @inheritdoc IProcessRegistry diff --git a/src/interfaces/IProcessRegistry.sol b/src/interfaces/IProcessRegistry.sol index 135f663..9defaec 100644 --- a/src/interfaces/IProcessRegistry.sol +++ b/src/interfaces/IProcessRegistry.sol @@ -34,7 +34,15 @@ interface IProcessRegistry { * @param sender The address of the sender. * @param newStateRoot The new state root of the process. */ - event ProcessStateRootUpdated(bytes32 indexed processId, address indexed sender, uint256 newStateRoot); + event ProcessStateTransitioned( + bytes32 indexed processId, + address indexed sender, + uint256 oldStateRoot, + uint256 newStateRoot, + uint256 newVotersCount, + uint256 newOverwrittenVotesCount + ); + /* * @notice Emitted when the results of a process are set. * @param processId The ID of the process. diff --git a/test/ProcessRegistry.t.sol b/test/ProcessRegistry.t.sol index 8b4e034..a56e643 100644 --- a/test/ProcessRegistry.t.sol +++ b/test/ProcessRegistry.t.sol @@ -1017,8 +1017,8 @@ contract ProcessRegistryTest is Test, TestHelpers { vm.mockCall(KZG_PRECOMPILE, "", abi.encode(FIELD_ELEMENTS_PER_BLOB, BLS_MODULUS)); // Submit state transition - emit IProcessRegistry.ProcessStateRootUpdated(processId, address(this), ROOT_HASH_BEFORE); - processRegistry.submitStateTransition(processId, STATETRANSITION_ABI_PROOF, stateTransitionInputs()); + emit IProcessRegistry.ProcessStateTransitioned(processId, address(this), ROOT_HASH_AFTER); + processRegistry.submitStateTransition(processId, stateTransitionZKProof, stateTransitionInputs()); // Verify state after transition process = processRegistry.getProcess(processId);