Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Jan 24, 2025
1 parent d02db54 commit 11ff9aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ contract ForcedInclusionStore is EssentialContract, IForcedInclusionStore {
}

function storeForcedInclusion(
uint8 blobId,
uint8 blobIndex,
uint32 blobByteOffset,
uint32 blobByteSize
)
external
payable
{
bytes32 blobHash = _blobHash(blobId);
bytes32 blobHash = _blobHash(blobIndex);
require(blobHash != bytes32(0), BlobNotFound());
require(msg.value == fee, IncorrectFee());

Expand Down Expand Up @@ -89,7 +89,7 @@ contract ForcedInclusionStore is EssentialContract, IForcedInclusionStore {
}

// @dev Override this function for easier testing blobs
function _blobHash(uint8 blobId) internal view virtual returns (bytes32) {
return blobhash(blobId);
function _blobHash(uint8 blobIndex) internal view virtual returns (bytes32) {
return blobhash(blobIndex);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ interface IForcedInclusionStore {

/// @dev Store a forced inclusion request.
/// The priority fee must be paid to the contract.
/// @param blobId The blob hash to be included
/// @param blobIndex The index of the blob that contains the transaction data.
/// @param blobByteOffset The byte offset in the blob
/// @param blobByteSize The size of the blob in bytes
function storeForcedInclusion(
uint8 blobId,
uint8 blobIndex,
uint32 blobByteOffset,
uint32 blobByteSize
)
Expand Down
18 changes: 9 additions & 9 deletions packages/protocol/test/layer1/based/ForcedInclusionStore.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ contract ForcedInclusionStoreForTest is ForcedInclusionStore {
ForcedInclusionStore(_resolver, _inclusionDelay, _fee)
{ }

function _blobHash(uint8 blobId) internal view virtual override returns (bytes32) {
return bytes32(uint256(blobId + 1));
function _blobHash(uint8 blobIndex) internal view virtual override returns (bytes32) {
return bytes32(uint256(blobIndex + 1));
}
}

Expand Down Expand Up @@ -47,7 +47,7 @@ contract ForcedInclusionStoreTest is ForcedInclusionStoreTestBase {

for (uint8 i; i < 5; ++i) {
store.storeForcedInclusion{ value: _fee }({
blobId: i,
blobIndex: i,
blobByteOffset: 0,
blobByteSize: 1024
});
Expand All @@ -59,7 +59,7 @@ contract ForcedInclusionStoreTest is ForcedInclusionStoreTestBase {
uint32 blobByteSize
) = store.queue(store.tail() - 1);

assertEq(blobHash, bytes32(uint256(i + 1))); // = blobId + 1
assertEq(blobHash, bytes32(uint256(i + 1))); // = blobIndex + 1
assertEq(createdAt, uint64(block.timestamp));
assertEq(fee, _fee);
assertEq(blobByteOffset, 0);
Expand All @@ -73,14 +73,14 @@ contract ForcedInclusionStoreTest is ForcedInclusionStoreTestBase {
uint256 fee = store.fee();
vm.expectRevert(IForcedInclusionStore.IncorrectFee.selector);
store.storeForcedInclusion{ value: fee - 1 }({
blobId: 0,
blobIndex: 0,
blobByteOffset: 0,
blobByteSize: 1024
});

vm.expectRevert(IForcedInclusionStore.IncorrectFee.selector);
store.storeForcedInclusion{ value: fee + 1 }({
blobId: 0,
blobIndex: 0,
blobByteOffset: 0,
blobByteSize: 1024
});
Expand All @@ -92,7 +92,7 @@ contract ForcedInclusionStoreTest is ForcedInclusionStoreTestBase {

vm.prank(Alice);
store.storeForcedInclusion{ value: _fee }({
blobId: 0,
blobIndex: 0,
blobByteOffset: 0,
blobByteSize: 1024
});
Expand Down Expand Up @@ -120,7 +120,7 @@ contract ForcedInclusionStoreTest is ForcedInclusionStoreTestBase {

vm.prank(Alice);
store.storeForcedInclusion{ value: _fee }({
blobId: 0,
blobIndex: 0,
blobByteOffset: 0,
blobByteSize: 1024
});
Expand Down Expand Up @@ -149,7 +149,7 @@ contract ForcedInclusionStoreTest is ForcedInclusionStoreTestBase {

vm.prank(operator);
store.storeForcedInclusion{ value: store.fee() }({
blobId: 0,
blobIndex: 0,
blobByteOffset: 0,
blobByteSize: 1024
});
Expand Down

0 comments on commit 11ff9aa

Please sign in to comment.