Skip to content

Commit 55c2537

Browse files
committed
docs: clarify view function behaviour for address(0) default allocation
Response to TRST-L-3 "Inaccurate view functions for the zero-address target" The current behaviour of getTargetAllocation() and getTargetIssuancePerBlock() is deliberate and regarded as correct. These functions return assigned allocations rather than effective minting amounts. This design choice is supported by the following reasoning: 1. **Semantically correct**: The functions answer "what allocation is assigned to this target?" rather than "what does this target receive?". 2. **Consistent interface**: Callers can query the default target allocation uniformly, regardless of whether it's address(0) or not. 3. **Accounting utility**: When address(0) is used, the returned values represent the unallocated/unminted portion of issuance. 4. **Separation of concerns**: getTotalAllocation() provides the effective system-wide allocation that excludes unmintable portions. The documentation has been enhanced to make this behaviour explicit for the address(0) edge case, to avoid potential confusion.
1 parent 48be37a commit 55c2537

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

packages/issuance/contracts/allocate/IssuanceAllocator.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,9 @@ contract IssuanceAllocator is
826826

827827
/**
828828
* @inheritdoc IIssuanceAllocationStatus
829+
* @dev Returns assigned allocation regardless of whether target is address(0) or the default.
830+
* @dev For address(0), no minting occurs but the allocation represents the unallocated portion.
831+
* @dev For effective allocations excluding unmintable portion, use getTotalAllocation().
829832
*/
830833
function getTargetAllocation(address target) external view override returns (Allocation memory) {
831834
AllocationTarget storage targetData = _getIssuanceAllocatorStorage().allocationTargets[target];
@@ -839,6 +842,8 @@ contract IssuanceAllocator is
839842

840843
/**
841844
* @inheritdoc IIssuanceAllocationDistribution
845+
* @dev Returns assigned issuance rates regardless of whether target is address(0) or the default.
846+
* @dev For address(0), no minting occurs but rates reflect what would be issued if mintable.
842847
*/
843848
function getTargetIssuancePerBlock(address target) external view override returns (TargetIssuancePerBlock memory) {
844849
IssuanceAllocatorData storage $ = _getIssuanceAllocatorStorage();

0 commit comments

Comments
 (0)