# Verax Improvement Proposal \[VIP-9\] - Workflow Differentiation for "Attest" and "Replace"

**URL:** <https://community.ver.ax/t/verax-improvement-proposal-vip-9-workflow-differentiation-for-attest-and-replace/78>\
**Category:** Verax Improvement Proposals\
**Created:** [July 15, 2024, 1:03pm UTC](https://community.ver.ax/t/verax-improvement-proposal-vip-9-workflow-differentiation-for-attest-and-replace/78 "2024-07-15T13:03:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alain\_ncls](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.ver.ax/alain_ncls/32/13_2.png) [@alain\_ncls](https://community.ver.ax/u/alain_ncls)\
**Post date:** [July 15, 2024, 1:03pm UTC](https://community.ver.ax/t/verax-improvement-proposal-vip-9-workflow-differentiation-for-attest-and-replace/78/1 "2024-07-15T13:03:51Z")

</div>

# Verax Improvement Proposal [VIP-9] - Workflow Differentiation for “Attest” and “Replace”

Author[s]: @alain_ncls  
Title: Workflow Differentiation for “Attest” and “Replace”  
Type: Verax Improvement Proposal

## Abstract

This proposal focuses on an upgrade to the Verax protocol to enhance the differentiation between “attest” and “replace” workflows.

## Proposal Summary

Introduce an `operationType` string in the `runModulesV2` function to differentiate between “attest” and “replace” workflows.

## Overview of Proposal

This proposal aims to enhance the Verax protocol by allowing Modules to distinguish between “attest” and “replace” workflows through an additional parameter, `operationType`, in the `runModulesV2` function. The key objectives include:

- Providing dedicated logic for “attest” and “replace” workflows in the Modules.
- Allowing Modules to perform operations specific to the workflow type.

**Projected Timeline:**

- Governance Vote: 2024-07-28T22:00:00Z (min. 2 weeks from publishing proposal)
- Deployment Target: 2024-08-04T22:00:00Z (min. 1 week from start of voting period)

**Implementation Team:**

- Development: Core Verax Development Team
- Review: Verax Governance Committee

**Anticipated Benefits:**

- Improved flexibility and functionality of the Verax protocol.
- Enhanced ability for Modules to perform specialized tasks based on the workflow type.

## Motivation

The current implementation of the `runModulesV2` function does not differentiate between “attest” and “replace” workflows, limiting the ability of modules to execute workflow-specific logic. By introducing an `operationType` parameter, this proposal aims to enhance the functionality and versatility of the Verax protocol, thus improving its adoption and integration within the ecosystem.

## Technical Considerations

The technical aspects of this proposal include:

- Modifying the `runModulesV2` function in the `ModuleRegistry` contract to accept an additional `operationType` parameter.
- Updating the `AbstractModuleV2` interface to handle the new parameter.
- Updating the `AbstractPortal` interface to pass the new parameter to the Module.

### Previous Implementation:

```solidity
  function runModulesV2(
    address[] memory modulesAddresses,
    AttestationPayload memory attestationPayload,
    bytes[] memory validationPayloads,
    uint256 value,
    address initialCaller,
    address attester
  ) public {
    if (modulesAddresses.length == 0) return;
    if (modulesAddresses.length != validationPayloads.length) revert ModuleValidationPayloadMismatch();

    for (uint32 i = 0; i < modulesAddresses.length; i = uncheckedInc32(i)) {
      if (!isRegistered(modulesAddresses[i])) revert ModuleNotRegistered();
      AbstractModuleV2(modulesAddresses[i]).run(
        attestationPayload,
        validationPayloads[i],
        initialCaller,
        value,
        attester,
        msg.sender
      );
    }
  }

```

### Proposed Implementation:

```solidity
  function runModulesV2(
    address[] memory modulesAddresses,
    AttestationPayload memory attestationPayload,
    bytes[] memory validationPayloads,
    uint256 value,
    address initialCaller,
    address attester,
    OperationType operationType
  ) public {
    if (modulesAddresses.length == 0) return;
    if (modulesAddresses.length != validationPayloads.length) revert ModuleValidationPayloadMismatch();

    for (uint32 i = 0; i < modulesAddresses.length; i = uncheckedInc32(i)) {
      if (!isRegistered(modulesAddresses[i])) revert ModuleNotRegistered();
      AbstractModuleV2(modulesAddresses[i]).run(
        attestationPayload,
        validationPayloads[i],
        initialCaller,
        value,
        attester,
        msg.sender,
        operationType
      );
    }
  }

```

## Deployment Considerations

As the onchain upgrade for Modules V2 has not been done yet, we can take this opportunity to still change the signature of the `runModulesV2` function without breaking backward compatibility. This means that the upgrade of the contract will contain both these VIPs implementations.

## Research Outcomes

The necessity and potential effectiveness of this upgrade are supported by:

- Analysis of current limitations in handling different workflows.
- Feedback from the community and developers indicating the need for enhanced workflow differentiation.
- Studies on the potential improvements in efficiency and functionality provided by the proposed changes.

## Conflict of Interest

No conflicts of interest to disclose.

## Next Steps

1. Publish the proposal for community review and feedback.
2. Conduct the governance vote.
3. Implement the changes in the `ModuleRegistry` contract.
4. Update and test all relevant modules.
5. Deploy the updated contracts to the testnets and mainnets.

## References and Links

- [Corresponding PR](https://github.com/Consensys/linea-attestation-registry/pull/651)

---

<div class="post-metadata">

**Author:** ![goinfrex](https://avatars.discourse-cdn.com/v4/letter/g/cdc98d/32.png) [@goinfrex](https://community.ver.ax/u/goinfrex)\
**Post date:** [July 29, 2024, 2:41pm UTC](https://community.ver.ax/t/verax-improvement-proposal-vip-9-workflow-differentiation-for-attest-and-replace/78/2 "2024-07-29T14:41:59Z")

</div>

Hey,  
I suggest to postpone the vote after the week of the 2024-08-11T22:00:00Z in order to make sure everybody is able to vote and potentially batch this vote with another change proposal.

---

<div class="post-metadata">

**Author:** ![simon.brown](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.ver.ax/simon.brown/32/18_2.png) [@simon.brown](https://community.ver.ax/u/simon.brown)\
**Post date:** [August 1, 2024, 10:46am UTC](https://community.ver.ax/t/verax-improvement-proposal-vip-9-workflow-differentiation-for-attest-and-replace/78/3 "2024-08-01T10:46:45Z")

</div>

I agreed, I think it’s best to postpone this proposal a little as we haven’t seen a lot of engagement, and I think it could have a lot to do with the time of year (people traveling and/or taking vacation)
