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: coverage fixups #287

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions test/FnameResolver/FnameResolver.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ contract FnameResolverTest is FnameResolverTestSuite {
resolver.resolve(name, data);
}

function testFuzzResolveRevertsNonAddrFunction(bytes calldata name, bytes memory data) public {
data = bytes.concat(hex"00000001", data);
string[] memory urls = new string[](1);
urls[0] = FNAME_SERVER_URL;

vm.expectRevert(FnameResolver.ResolverFunctionNotSupported.selector);
resolver.resolve(name, data);
}

function testFuzzResolveWithProofValidSignature(string memory name, uint256 timestamp, address owner) public {
bytes memory signature = _signProof(name, timestamp, owner);
bytes memory extraData = abi.encodeCall(IResolverService.resolve, (DNS_ENCODED_NAME, ADDR_QUERY_CALLDATA));
Expand Down
19 changes: 18 additions & 1 deletion test/StorageRent/StorageRent.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "../TestConstants.sol";

import {StorageRent} from "../../src/StorageRent.sol";
import {TransferHelper} from "../../src/lib/TransferHelper.sol";
import {StorageRentTestSuite} from "./StorageRentTestSuite.sol";
import {StorageRentTestSuite, StorageRentHarness} from "./StorageRentTestSuite.sol";
import {MockChainlinkFeed} from "../Utils.sol";

/* solhint-disable state-visibility */
Expand Down Expand Up @@ -109,6 +109,23 @@ contract StorageRentTest is StorageRentTestSuite {
assertEq(storageRent.unitPrice(), INITIAL_PRICE_IN_ETH);
}

function testInitialPriceUpdate() public {
// Clear ethUsdPrice storage slot
vm.store(address(storageRent), bytes32(uint256(11)), bytes32(0));
assertEq(storageRent.ethUsdPrice(), 0);

// Clear prevEthUsdPrice storage slot
vm.store(address(storageRent), bytes32(uint256(12)), bytes32(0));
assertEq(storageRent.prevEthUsdPrice(), 0);

vm.prank(admin);
storageRent.refreshPrice();

assertEq(storageRent.ethUsdPrice(), uint256(ETH_USD_PRICE));
assertEq(storageRent.prevEthUsdPrice(), uint256(ETH_USD_PRICE));
assertEq(storageRent.ethUsdPrice(), storageRent.prevEthUsdPrice());
}

/*//////////////////////////////////////////////////////////////
RENT
//////////////////////////////////////////////////////////////*/
Expand Down
Loading