Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
syntrust committed Aug 19, 2024
1 parent f484662 commit 6905633
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contracts/StorageContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ abstract contract StorageContract is DecentralizedKV {

/// @notice Checks the payment using the last mine time.
function _prepareAppendWithTimestamp(uint256 _timestamp, uint256 _batchSize) internal {
uint256 kvEntryCountOld = kvEntryCount - _batchSize;
uint256 kvEntryCountOld = kvEntryCount - _batchSize; // kvEntryCount already increased
uint256 totalPayment = _upfrontPaymentInBatch(kvEntryCountOld, _batchSize);
require(msg.value >= totalPayment, "StorageContract: not enough batch payment");
uint256 shardId = kvEntryCount >> SHARD_ENTRY_BITS; // shard id after the batch
Expand All @@ -159,7 +159,6 @@ abstract contract StorageContract is DecentralizedKV {
// (TODO): Setup shard difficulty as current difficulty / factor?
infos[shardId].lastMineTime = _timestamp;
}

}

/// @notice Upfront payment for the next insertion
Expand All @@ -177,6 +176,8 @@ abstract contract StorageContract is DecentralizedKV {
}

/// @notice Upfront payment for a batch insertion
/// @param _batchSize The blob count for a batch insertion.
/// @return The total payment for a batch insertion.
function upfrontPaymentInBatch(uint256 _batchSize) public view virtual override returns (uint256) {
return _upfrontPaymentInBatch(kvEntryCount, _batchSize);
}
Expand Down

0 comments on commit 6905633

Please sign in to comment.