Skip to content
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
17 changes: 7 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
version: stable

- name: Install Docker buildx
uses: docker/setup-buildx-action@v2
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
version: stable

- name: Run forge build
run: |
Expand All @@ -120,6 +120,8 @@ jobs:

halmos:
runs-on: ubuntu-latest
container:
image: ghcr.io/a16z/halmos:latest
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -128,15 +130,8 @@ jobs:
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1

- uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install halmos
run: pip install halmos

- name: Run halmos
run: halmos --error-unknown --test-parallel --solver-parallel --storage-layout=generic --solver-timeout-assertion 0
run: halmos --test-parallel --solver-parallel --storage-layout=generic --solver-timeout-assertion 0

coverage:
permissions:
Expand All @@ -148,6 +143,8 @@ jobs:

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable

- name: Check code coverage
run: forge coverage --report summary --report lcov
Expand Down
13 changes: 4 additions & 9 deletions Dockerfile.foundry
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@

FROM ubuntu:latest

RUN apt-get update -y && apt-get install -y bash curl git gzip netcat
RUN apt-get update -y && apt-get install -y bash curl git gzip netcat-openbsd

# Foundry only keeps the latest 3 nightly releases available, removing older
# ones. We host the artifacts ourselves to ensure they are always there.
#
# This also makes the build very fast (building from source takes ~10 minutes on an M2 Max)
ARG TARGETARCH COMMIT_HASH=577dae3f632b392856d1d62a5016c765fadd872d
RUN curl --proto '=https' --tlsv1.2 -sSf \
"https://download.farcaster.xyz/foundry/foundry_${COMMIT_HASH}_linux_${TARGETARCH}.tar.gz" \
| tar -xzf - -C /usr/local/bin
RUN curl --proto '=https' --tlsv1.2 -L "https://foundry.paradigm.xyz" | bash
ENV PATH="$PATH:/root/.foundry/bin"
RUN foundryup --install stable

ENV RUST_BACKTRACE=full
1 change: 0 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ bytecode_hash = 'none'
[profile.ci]
verbosity = 3
fuzz = { runs = 2500 }
no_match_path = ""
match_path = "test/*/**"

[fmt]
Expand Down
4 changes: 3 additions & 1 deletion script/DeployL1.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ contract DeployL1 is ImmutableCreate2Deployer {
runDeploy(loadDeploymentParams());
}

function runDeploy(DeploymentParams memory params) public returns (Contracts memory) {
function runDeploy(
DeploymentParams memory params
) public returns (Contracts memory) {
return runDeploy(params, true);
}

Expand Down
8 changes: 6 additions & 2 deletions script/DeployL2.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ contract DeployL2 is ImmutableCreate2Deployer {
runSetup(runDeploy(loadDeploymentParams()));
}

function runDeploy(DeploymentParams memory params) public returns (Contracts memory) {
function runDeploy(
DeploymentParams memory params
) public returns (Contracts memory) {
return runDeploy(params, true);
}

Expand Down Expand Up @@ -175,7 +177,9 @@ contract DeployL2 is ImmutableCreate2Deployer {
}
}

function runSetup(Contracts memory contracts) public {
function runSetup(
Contracts memory contracts
) public {
DeploymentParams memory params = loadDeploymentParams();
runSetup(contracts, params, true);
}
Expand Down
13 changes: 4 additions & 9 deletions script/LocalDeploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,11 @@ contract LocalDeploy is Script {

vm.startBroadcast();
(AggregatorV3Interface priceFeed, AggregatorV3Interface uptimeFeed) = _getOrDeployPriceFeeds();
IdRegistry idRegistry = new IdRegistry{salt: ID_REGISTRY_CREATE2_SALT}(
migrator,
initialIdRegistryOwner
IdRegistry idRegistry = new IdRegistry{salt: ID_REGISTRY_CREATE2_SALT}(migrator, initialIdRegistryOwner);
KeyRegistry keyRegistry = new KeyRegistry{salt: KEY_REGISTRY_CREATE2_SALT}(
address(idRegistry), migrator, initialKeyRegistryOwner, 1000
);
KeyRegistry keyRegistry = new KeyRegistry{
salt: KEY_REGISTRY_CREATE2_SALT
}(address(idRegistry), migrator, initialKeyRegistryOwner, 1000);
StorageRegistry storageRegistry = new StorageRegistry{
salt: STORAGE_RENT_CREATE2_SALT
}(
StorageRegistry storageRegistry = new StorageRegistry{salt: STORAGE_RENT_CREATE2_SALT}(
priceFeed,
uptimeFeed,
INITIAL_USD_UNIT_PRICE,
Expand Down
8 changes: 6 additions & 2 deletions script/UpgradeL2.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ contract UpgradeL2 is ImmutableCreate2Deployer, Test {
runSetup(runDeploy(loadDeploymentParams()));
}

function runDeploy(DeploymentParams memory params) public returns (Contracts memory) {
function runDeploy(
DeploymentParams memory params
) public returns (Contracts memory) {
return runDeploy(params, true);
}

Expand Down Expand Up @@ -182,7 +184,9 @@ contract UpgradeL2 is ImmutableCreate2Deployer, Test {
}
}

function runSetup(Contracts memory contracts) public {
function runSetup(
Contracts memory contracts
) public {
DeploymentParams memory params = loadDeploymentParams();
runSetup(contracts, params, true);
}
Expand Down
12 changes: 9 additions & 3 deletions script/abstract/ImmutableCreate2Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import "forge-std/console.sol";
import {Strings} from "openzeppelin/contracts/utils/Strings.sol";

interface ImmutableCreate2Factory {
function hasBeenDeployed(address deploymentAddress) external view returns (bool);
function hasBeenDeployed(
address deploymentAddress
) external view returns (bool);

function findCreate2Address(
bytes32 salt,
Expand Down Expand Up @@ -132,7 +134,9 @@ abstract contract ImmutableCreate2Deployer is Script {
/**
* @dev Deploy all registered contracts.
*/
function deploy(bool broadcast) internal {
function deploy(
bool broadcast
) internal {
console.log(pad("State", 10), pad("Name", 27), pad("Address", 43), "Initcode hash");
for (uint256 i; i < names.length; i++) {
_deploy(names[i], broadcast);
Expand All @@ -153,7 +157,9 @@ abstract contract ImmutableCreate2Deployer is Script {
_deploy(name, broadcast);
}

function deploy(string memory name) internal {
function deploy(
string memory name
) internal {
deploy(name, true);
}

Expand Down
4 changes: 3 additions & 1 deletion src/Bundler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ contract Bundler is IBundler {
/**
* @inheritdoc IBundler
*/
function price(uint256 extraStorage) external view returns (uint256) {
function price(
uint256 extraStorage
) external view returns (uint256) {
return idGateway.price(extraStorage);
}

Expand Down
16 changes: 12 additions & 4 deletions src/FnameResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {ERC165} from "openzeppelin/contracts/utils/introspection/ERC165.sol";
import {EIP712} from "./abstract/EIP712.sol";

interface IAddressQuery {
function addr(bytes32 node) external view returns (address);
function addr(
bytes32 node
) external view returns (address);
}

interface IExtendedResolver {
Expand Down Expand Up @@ -183,7 +185,9 @@ contract FnameResolver is IExtendedResolver, EIP712, ERC165, Ownable2Step {
*
* @param signer The signer address.
*/
function addSigner(address signer) external onlyOwner {
function addSigner(
address signer
) external onlyOwner {
signers[signer] = true;
emit AddSigner(signer);
}
Expand All @@ -193,7 +197,9 @@ contract FnameResolver is IExtendedResolver, EIP712, ERC165, Ownable2Step {
*
* @param signer The signer address.
*/
function removeSigner(address signer) external onlyOwner {
function removeSigner(
address signer
) external onlyOwner {
signers[signer] = false;
emit RemoveSigner(signer);
}
Expand All @@ -202,7 +208,9 @@ contract FnameResolver is IExtendedResolver, EIP712, ERC165, Ownable2Step {
INTERFACE DETECTION
//////////////////////////////////////////////////////////////*/

function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
function supportsInterface(
bytes4 interfaceId
) public view override returns (bool) {
return interfaceId == type(IExtendedResolver).interfaceId || super.supportsInterface(interfaceId);
}
}
12 changes: 9 additions & 3 deletions src/IdGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ contract IdGateway is IIdGateway, Guardians, Signatures, EIP712, Nonces {
/**
* @inheritdoc IIdGateway
*/
function price(uint256 extraStorage) external view returns (uint256) {
function price(
uint256 extraStorage
) external view returns (uint256) {
return storageRegistry.price(1 + extraStorage);
}

Expand All @@ -101,7 +103,9 @@ contract IdGateway is IIdGateway, Guardians, Signatures, EIP712, Nonces {
/**
* @inheritdoc IIdGateway
*/
function register(address recovery) external payable returns (uint256, uint256) {
function register(
address recovery
) external payable returns (uint256, uint256) {
return register(recovery, 0);
}

Expand Down Expand Up @@ -145,7 +149,9 @@ contract IdGateway is IIdGateway, Guardians, Signatures, EIP712, Nonces {
/**
* @inheritdoc IIdGateway
*/
function setStorageRegistry(address _storageRegistry) external onlyOwner {
function setStorageRegistry(
address _storageRegistry
) external onlyOwner {
emit SetStorageRegistry(address(storageRegistry), _storageRegistry);
storageRegistry = IStorageRegistry(_storageRegistry);
}
Expand Down
20 changes: 15 additions & 5 deletions src/IdRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ contract IdRegistry is IIdRegistry, Migration, Signatures, EIP712, Nonces {
/**
* @inheritdoc IIdRegistry
*/
function changeRecoveryAddress(address recovery) external whenNotPaused {
function changeRecoveryAddress(
address recovery
) external whenNotPaused {
/* Revert if the caller does not own an fid */
uint256 ownerId = idOf[msg.sender];
if (ownerId == 0) revert HasNoId();
Expand Down Expand Up @@ -359,7 +361,9 @@ contract IdRegistry is IIdRegistry, Migration, Signatures, EIP712, Nonces {
/**
* @inheritdoc IIdRegistry
*/
function setIdGateway(address _idGateway) external onlyOwner {
function setIdGateway(
address _idGateway
) external onlyOwner {
if (gatewayFrozen) revert GatewayFrozen();
emit SetIdGateway(idGateway, _idGateway);
idGateway = _idGateway;
Expand All @@ -378,7 +382,9 @@ contract IdRegistry is IIdRegistry, Migration, Signatures, EIP712, Nonces {
MIGRATION
//////////////////////////////////////////////////////////////*/

function bulkRegisterIds(BulkRegisterData[] calldata ids) external onlyMigrator {
function bulkRegisterIds(
BulkRegisterData[] calldata ids
) external onlyMigrator {
// Safety: i can be incremented unchecked since it is bound by ids.length.
unchecked {
for (uint256 i = 0; i < ids.length; i++) {
Expand All @@ -403,7 +409,9 @@ contract IdRegistry is IIdRegistry, Migration, Signatures, EIP712, Nonces {
}
}

function bulkResetIds(uint24[] calldata ids) external onlyMigrator {
function bulkResetIds(
uint24[] calldata ids
) external onlyMigrator {
// Safety: i can be incremented unchecked since it is bound by ids.length.
unchecked {
for (uint256 i = 0; i < ids.length; i++) {
Expand All @@ -419,7 +427,9 @@ contract IdRegistry is IIdRegistry, Migration, Signatures, EIP712, Nonces {
}
}

function setIdCounter(uint256 _counter) external onlyMigrator {
function setIdCounter(
uint256 _counter
) external onlyMigrator {
emit SetIdCounter(idCounter, _counter);
idCounter = _counter;
}
Expand Down
Loading
Loading