Skip to content

Commit

Permalink
Merge pull request #114 from ethstorage/kill_warns
Browse files Browse the repository at this point in the history
Fix warnings
  • Loading branch information
syntrust authored Oct 12, 2024
2 parents 0d52b2c + e62ce72 commit 648e477
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 35 deletions.
2 changes: 0 additions & 2 deletions contracts/test/EthStorageContractTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ pragma solidity ^0.8.19;

import "./TestEthStorageContract.sol";
import "forge-std/Test.sol";
import "forge-std/Vm.sol";
import "forge-std/console.sol";
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";

contract EthStorageContractTest is Test {
Expand Down
4 changes: 1 addition & 3 deletions contracts/test/StorageContractTest.t.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./TestStorageContract.sol";
import "../StorageContract.sol";
import "forge-std/Test.sol";
import "forge-std/Vm.sol";

contract StorageContractTest is Test {
uint256 constant STORAGE_COST = 10000000;
Expand Down Expand Up @@ -172,7 +170,7 @@ contract Attacker is Test {
storageContract = _storageContract;
}

fallback() external payable {
receive() external payable {
uint256 _shardId = 0;
uint256 _nonce = 0;
bytes32[] memory _encodedSamples = new bytes32[](0);
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/TestDecentralizedKV.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ contract TestDecentralizedKV is DecentralizedKV {
dataMap[kvIndices[0]] = data;
}

function get(bytes32 key, DecodeType decodeType, uint256 off, uint256 len)
function get(bytes32 key, DecodeType, /* decodeType */ uint256 off, uint256 len)
public
view
override
Expand Down
4 changes: 2 additions & 2 deletions contracts/test/TestEthStorageContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ contract TestEthStorageContract is EthStorageContract {
_putBatchInternal(keys, dataHashes, lengths);
}

function putBlob(bytes32 _key, uint256 _blobIdx, uint256 _length) public payable override {
function putBlob(bytes32 _key, uint256, /* _blobIdx */ uint256 _length) public payable override {
bytes32 dataHash = bytes32(uint256(1 << 8 * 8));
require(dataHash != 0, "EthStorageContract: failed to get blob hash");

Expand Down Expand Up @@ -194,7 +194,7 @@ contract TestEthStorageContract is EthStorageContract {
require(nonce < nonceLimit, "nonce too big");

// Check if the data matches the hash in metadata and obtain the solution hash.
bytes32 hash0 = verifySamples(shardId, initHash0, miner, encodedSamples, masks, inclusiveProofs, decodeProof);
verifySamples(shardId, initHash0, miner, encodedSamples, masks, inclusiveProofs, decodeProof);

uint256 diff = _calculateDiffAndInitHashSingleShard(shardId, mineTs);

Expand Down
26 changes: 12 additions & 14 deletions contracts/test/TestMerkleLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,27 @@ contract TestMerkleLib {
return MerkleLib.merkleRootWithMinTree(data, chunkSize);
}

function merkleRootNoView(bytes memory data, uint256 chunkSize, uint256 nChunkBits) public returns (bytes32) {
function merkleRootNoView(bytes memory data, uint256 chunkSize, uint256 nChunkBits) public pure returns (bytes32) {
return MerkleLib.merkleRoot(data, chunkSize, nChunkBits);
}

function keccak256NoView(bytes memory data) public returns (bytes32) {
function keccak256NoView(bytes memory data) public pure returns (bytes32) {
return keccak256(data);
}

function verify(
bytes memory chunkData,
uint256 chunkIdx,
bytes32 root,
bytes32[] memory proofs
) public pure returns (bool) {
function verify(bytes memory chunkData, uint256 chunkIdx, bytes32 root, bytes32[] memory proofs)
public
pure
returns (bool)
{
return MerkleLib.verify(keccak256(chunkData), chunkIdx, root, proofs);
}

function getProof(
bytes memory data,
uint256 chunkSize,
uint256 nChunkBits,
uint256 chunkIdx
) public pure returns (bytes32[] memory) {
function getProof(bytes memory data, uint256 chunkSize, uint256 nChunkBits, uint256 chunkIdx)
public
pure
returns (bytes32[] memory)
{
return MerkleLib.getProof(data, chunkSize, nChunkBits, chunkIdx);
}

Expand Down
26 changes: 13 additions & 13 deletions contracts/test/TestStorageContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ contract TestStorageContract is StorageContract {
}

function verifySamples(
uint256 _startShardId,
bytes32 _hash0,
address _miner,
bytes32[] memory _encodedSamples,
uint256[] memory _masks,
bytes[] calldata _inclusiveProofs,
bytes[] calldata _decodeProof
uint256, /* _startShardId */
bytes32, /* _hash0 */
address, /* _miner */
bytes32[] memory, /* _encodedSamples */
uint256[] memory, /* _masks */
bytes[] calldata, /* _inclusiveProofs */
bytes[] calldata /* _decodeProof */
) public pure override returns (bytes32) {
return bytes32(0);
}
Expand All @@ -50,12 +50,12 @@ contract TestStorageContract is StorageContract {
uint256 _blockNum,
uint256 _shardId,
address _miner,
uint256 _nonce,
bytes32[] memory _encodedSamples,
uint256[] memory _masks,
bytes calldata _randaoProof,
bytes[] calldata _inclusiveProofs,
bytes[] calldata _decodeProof
uint256, /* _nonce */
bytes32[] memory, /* _encodedSamples */
uint256[] memory, /* _masks */
bytes calldata, /* _randaoProof */
bytes[] calldata, /* _inclusiveProofs */
bytes[] calldata /* _decodeProof */
) internal override {
uint256 mineTs = _getMinedTs(_blockNum);
_rewardMiner(_shardId, _miner, mineTs, 1);
Expand Down

0 comments on commit 648e477

Please sign in to comment.