Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(contracts): Document potential accounting issue with Module #824

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading