Skip to content

Commit

Permalink
chore(contracts): Document potential accounting issue with Module
Browse files Browse the repository at this point in the history
  • Loading branch information
alainncls committed Nov 26, 2024
1 parent 7f57adb commit e24b671
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion contracts/src/abstracts/AbstractPortal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ abstract contract AbstractPortal is IPortal {
* @param attestationPayload the payload to attest
* @param validationPayloads the payloads to validate via the modules to issue the attestations
* @dev Runs all modules for the portal and registers the attestation using AttestationRegistry
* @dev WARNING: Ensure that at most one module processes `msg.value` to avoid accounting issues,
* as the total `msg.value` is forwarded to all modules.
*/
function attest(AttestationPayload memory attestationPayload, bytes[] memory validationPayloads) public payable {
moduleRegistry.runModules(modules, attestationPayload, validationPayloads, msg.value);
Expand All @@ -73,6 +75,8 @@ abstract contract AbstractPortal is IPortal {
* @param attestationPayload the payload to attest
* @param validationPayloads the payloads to validate via the modules to issue the attestations
* @dev Runs all modules for the portal and registers the attestation using AttestationRegistry
* @dev WARNING: Ensure that at most one module processes `msg.value` to avoid accounting issues,
* as the total `msg.value` is forwarded to all modules.
*/
function attestV2(AttestationPayload memory attestationPayload, bytes[] memory validationPayloads) public payable {
moduleRegistry.runModulesV2(
Expand All @@ -97,6 +101,8 @@ abstract contract AbstractPortal is IPortal {
* @dev DISCLAIMER: This method may have unexpected behavior if one of the Module checks is done on the attestation ID
* as this ID won't be incremented before the end of the transaction.
* If you need to check the attestation ID, please use the `attest` method.
* @dev WARNING: Ensure that at most one module processes `msg.value` to avoid accounting issues,
* as the total `msg.value` is forwarded to all modules.
*/
function bulkAttest(AttestationPayload[] memory attestationsPayloads, bytes[][] memory validationPayloads) public {
moduleRegistry.bulkRunModules(modules, attestationsPayloads, validationPayloads);
Expand All @@ -113,6 +119,8 @@ abstract contract AbstractPortal is IPortal {
* @dev DISCLAIMER: This method may have unexpected behavior if one of the Module checks is done on the attestation ID
* as this ID won't be incremented before the end of the transaction.
* If you need to check the attestation ID, please use the `attestV2` method.
* @dev WARNING: Ensure that at most one module processes `msg.value` to avoid accounting issues,
* as the total `msg.value` is forwarded to all modules.
*/
function bulkAttestV2(AttestationPayload[] memory attestationPayloads, bytes[][] memory validationPayloads) public {
moduleRegistry.bulkRunModulesV2(
Expand All @@ -135,6 +143,8 @@ abstract contract AbstractPortal is IPortal {
* @param attestationPayload the attestation payload to create the new attestation and register it
* @param validationPayloads the payloads to validate via the modules to issue the attestation
* @dev Runs all modules for the portal and registers the attestation using AttestationRegistry
* @dev WARNING: Ensure that at most one module processes `msg.value` to avoid accounting issues,
* as the total `msg.value` is forwarded to all modules.
*/
function replace(
bytes32 attestationId,
Expand All @@ -154,6 +164,8 @@ abstract contract AbstractPortal is IPortal {
* @param attestationPayload the attestation payload to create the new attestation and register it
* @param validationPayloads the payloads to validate via the modules to issue the attestation
* @dev Runs all modules for the portal and registers the attestation using AttestationRegistry
* @dev WARNING: Ensure that at most one module processes `msg.value` to avoid accounting issues,
* as the total `msg.value` is forwarded to all modules.
*/
function replaceV2(
bytes32 attestationId,
Expand Down Expand Up @@ -183,6 +195,8 @@ abstract contract AbstractPortal is IPortal {
* @dev DISCLAIMER: This method may have unexpected behavior if one of the Module checks is done on the attestation ID
* as this ID won't be incremented before the end of the transaction.
* If you need to check the attestation ID, please use the `replace` method.
* @dev WARNING: Ensure that at most one module processes `msg.value` to avoid accounting issues,
* as the total `msg.value` is forwarded to all modules.
*/
function bulkReplace(
bytes32[] memory attestationIds,
Expand All @@ -204,6 +218,8 @@ abstract contract AbstractPortal is IPortal {
* @dev DISCLAIMER: This method may have unexpected behavior if one of the Module checks is done on the attestation ID
* as this ID won't be incremented before the end of the transaction.
* If you need to check the attestation ID, please use the `replaceV2` method.
* @dev WARNING: Ensure that at most one module processes `msg.value` to avoid accounting issues,
* as the total `msg.value` is forwarded to all modules.
*/
function bulkReplaceV2(
bytes32[] memory attestationIds,
Expand All @@ -228,7 +244,7 @@ abstract contract AbstractPortal is IPortal {
* @notice Revokes an attestation for the given identifier
* @param attestationId the ID of the attestation to revoke
* @dev By default, revocation is only possible by the portal owner
* We strongly encourage implementing such a rule in your Portal if you intend on overriding this method
* We strongly encourage implementing such a rule in your Portal if you intend on overriding this method
*/
function revoke(bytes32 attestationId) public {
_onRevoke(attestationId);
Expand Down

0 comments on commit e24b671

Please sign in to comment.