Skip to content

Commit

Permalink
fix: use absolute imports to fix forge coverage (#38)
Browse files Browse the repository at this point in the history
when Kernel is used as a dependency on a project, that project's forge coverage might fail to run because of a dependency resolution issue when relative import paths are used

Relevant Foundry issue: foundry-rs/foundry#2915
  • Loading branch information
0xca11 authored Oct 3, 2023
1 parent eafc8f7 commit 50bd922
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/Kernel.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import "./abstract/Compatibility.sol";
import "./abstract/KernelStorage.sol";
import "./utils/KernelHelper.sol";

import "src/common/Constants.sol";
import "src/common/Enum.sol";
import "./common/Constants.sol";
import "./common/Enum.sol";

/// @title Kernel
/// @author taek<[email protected]>
Expand Down
6 changes: 3 additions & 3 deletions src/abstract/KernelStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity ^0.8.0;

// Importing necessary interfaces
import "account-abstraction/interfaces/IEntryPoint.sol";
import "src/interfaces/IValidator.sol";
import "src/common/Constants.sol";
import "src/common/Structs.sol";
import "../interfaces/IValidator.sol";
import "../common/Constants.sol";
import "../common/Structs.sol";

/// @title Kernel Storage Contract
/// @author taek<[email protected]>
Expand Down
6 changes: 3 additions & 3 deletions src/common/Structs.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pragma solidity ^0.8.0;

import "src/interfaces/IValidator.sol";
import "src/common/Enum.sol";
import "src/common/Types.sol";
import "../interfaces/IValidator.sol";
import "./Enum.sol";
import "./Types.sol";

// Defining a struct for execution details
struct ExecutionDetail {
Expand Down
2 changes: 1 addition & 1 deletion src/common/Types.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity ^0.8.9;

import "src/common/Constants.sol";
import "./Constants.sol";

type ValidAfter is uint48;

Expand Down
6 changes: 3 additions & 3 deletions src/executor/KillSwitchAction.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pragma solidity ^0.8.18;

import "src/interfaces/IValidator.sol";
import "src/validator/KillSwitchValidator.sol";
import "src/abstract/KernelStorage.sol";
import "../interfaces/IValidator.sol";
import "../validator/KillSwitchValidator.sol";
import "../abstract/KernelStorage.sol";

contract KillSwitchAction {
KillSwitchValidator public immutable killSwitchValidator;
Expand Down
4 changes: 2 additions & 2 deletions src/factory/KernelFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pragma solidity ^0.8.0;
import "./AdminLessERC1967Factory.sol";

import "openzeppelin-contracts/contracts/utils/Create2.sol";
import "src/Kernel.sol";
import "src/validator/ECDSAValidator.sol";
import "../Kernel.sol";
import "../validator/ECDSAValidator.sol";
import "solady/auth/Ownable.sol";

contract KernelFactory is AdminLessERC1967Factory, Ownable {
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

import {UserOperation} from "account-abstraction/interfaces/UserOperation.sol";
import "src/common/Types.sol";
import "../common/Types.sol";

interface IKernelValidator {
function enable(bytes calldata _data) external payable;
Expand Down
2 changes: 1 addition & 1 deletion src/test/TestKernel.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity ^0.8.0;

import "src/Kernel.sol";
import "../Kernel.sol";

contract TestKernel is Kernel {
constructor(IEntryPoint _entryPoint) Kernel(_entryPoint) {}
Expand Down
4 changes: 2 additions & 2 deletions src/test/TestValidator.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "src/interfaces/IValidator.sol";
import "src/common/Types.sol";
import "../interfaces/IValidator.sol";
import "../common/Types.sol";

contract TestValidator is IKernelValidator {
event TestValidateUserOp(bytes32 indexed opHash);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/KernelHelper.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {SIG_VALIDATION_FAILED_UINT} from "src/common/Constants.sol";
import {ValidationData} from "src/common/Types.sol";
import {SIG_VALIDATION_FAILED_UINT} from "../common/Constants.sol";
import {ValidationData} from "../common/Types.sol";

function _intersectValidationData(ValidationData a, ValidationData b) pure returns (ValidationData validationData) {
assembly {
Expand Down
6 changes: 3 additions & 3 deletions src/validator/ECDSAValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
pragma solidity ^0.8.0;

import "solady/utils/ECDSA.sol";
import "src/utils/KernelHelper.sol";
import "src/interfaces/IValidator.sol";
import "src/common/Types.sol";
import "../utils/KernelHelper.sol";
import "../interfaces/IValidator.sol";
import "../common/Types.sol";

struct ECDSAValidatorStorage {
address owner;
Expand Down
6 changes: 3 additions & 3 deletions src/validator/ERC165SessionKeyValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity ^0.8.0;

import "openzeppelin-contracts/contracts/utils/introspection/IERC165.sol";
import "solady/utils/ECDSA.sol";
import "src/utils/KernelHelper.sol";
import "src/interfaces/IValidator.sol";
import "src/common/Types.sol";
import "../utils/KernelHelper.sol";
import "../interfaces/IValidator.sol";
import "../common/Types.sol";

// idea, we can make this merkle root
struct ERC165SessionKeyStorage {
Expand Down
12 changes: 6 additions & 6 deletions src/validator/KillSwitchValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
pragma solidity ^0.8.0;

import "solady/utils/ECDSA.sol";
import "src/utils/KernelHelper.sol";
import "src/Kernel.sol";
import {WalletKernelStorage, ExecutionDetail} from "src/abstract/KernelStorage.sol";
import "src/interfaces/IValidator.sol";
import "src/common/Types.sol";
import {KillSwitchAction} from "src/executor/KillSwitchAction.sol";
import "../utils/KernelHelper.sol";
import "../Kernel.sol";
import {WalletKernelStorage, ExecutionDetail} from "../abstract/KernelStorage.sol";
import "../interfaces/IValidator.sol";
import "../common/Types.sol";
import {KillSwitchAction} from "../executor/KillSwitchAction.sol";

struct KillSwitchValidatorStorage {
address guardian;
Expand Down
8 changes: 4 additions & 4 deletions src/validator/MultiECDSAValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
pragma solidity ^0.8.0;

import "solady/utils/ECDSA.sol";
import "src/utils/KernelHelper.sol";
import "src/interfaces/IAddressBook.sol";
import "src/interfaces/IValidator.sol";
import "src/common/Types.sol";
import "../utils/KernelHelper.sol";
import "../interfaces/IAddressBook.sol";
import "../interfaces/IValidator.sol";
import "../common/Types.sol";

contract MultiECDSAValidator is IKernelValidator {
event OwnerAdded(address indexed kernel, address indexed owner);
Expand Down
6 changes: 3 additions & 3 deletions src/validator/SessionKeyOwnedValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ pragma solidity ^0.8.0;

import "solady/utils/ECDSA.sol";
import "solady/utils/EIP712.sol";
import "src/utils/KernelHelper.sol";
import "src/interfaces/IValidator.sol";
import "src/common/Types.sol";
import "../utils/KernelHelper.sol";
import "../interfaces/IValidator.sol";
import "../common/Types.sol";

struct SessionKeyStorage {
ValidUntil validUntil;
Expand Down
10 changes: 5 additions & 5 deletions src/validator/SessionKeyValidator.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
pragma solidity ^0.8.0;

import "solady/utils/ECDSA.sol";
import "src/interfaces/IValidator.sol";
import "../interfaces/IValidator.sol";
import "solady/utils/MerkleProofLib.sol";
import "src/common/Constants.sol";
import "src/common/Enum.sol";
import "src/common/Structs.sol";
import "src/common/Types.sol";
import "../common/Constants.sol";
import "../common/Enum.sol";
import "../common/Structs.sol";
import "../common/Types.sol";

contract ExecuteSessionKeyValidator is IKernelValidator {
mapping(address sessionKey => mapping(address kernel => SessionData)) public sessionData;
Expand Down

0 comments on commit 50bd922

Please sign in to comment.