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

UniversalFactory.json file not found while running Counter.t.sol #16

Open
aman879 opened this issue Jan 20, 2025 · 0 comments
Open

UniversalFactory.json file not found while running Counter.t.sol #16

aman879 opened this issue Jan 20, 2025 · 0 comments

Comments

@aman879
Copy link

aman879 commented Jan 20, 2025

While running Counter.t.sol I'm getting this error

[⠒] Compiling...
No files changed, compilation skipped

Ran 1 test for test/Counter.t.sol:CounterTest
[FAIL. Reason: setup failed: vm.getCode: failed to read from "/home/schizo/workplace/projects/hello_gmp/lib/universal-factory/abi/UniversalFactory.json": No such file or directory (os error 2)] setUp() (gas: 0)
Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 3.11s (0.00ns CPU time)

Ran 1 test suite in 3.29s (3.11s CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests)

Failing tests:
Encountered 1 failing test in test/Counter.t.sol:CounterTest
[FAIL. Reason: setup failed: vm.getCode: failed to read from "/home/schizo/workplace/projects/hello_gmp/lib/universal-factory/abi/UniversalFactory.json": No such file or directory (os error 2)] setUp() (gas: 0)

Encountered a total of 1 failing tests, 0 tests succeeded

I have already executed the remmaping command

@analog-gmp/=lib/analog-gmp/src/
@evm-interpreter/=lib/analog-gmp/lib/evm-interpreter/src/
@frost-evm/=lib/analog-gmp/lib/frost-evm/sol/
@solmate/=lib/analog-gmp/lib/solmate/src/
@universal-factory/=lib/analog-gmp/lib/universal-factory/src/
analog-gmp/=lib/analog-gmp/
ds-test/=lib/analog-gmp/lib/solmate/lib/ds-test/src/
evm-interpreter/=lib/analog-gmp/lib/evm-interpreter/src/
forge-std/=lib/forge-std/src/
frost-evm/=lib/analog-gmp/lib/
solmate/=lib/analog-gmp/lib/solmate/src/
universal-factory/=lib/analog-gmp/lib/universal-factory/

and my .vscode/settings.json

  "solidity.packageDefaultDependenciesContractsDirectory": "src",
  "solidity.packageDefaultDependenciesDirectory": "lib",
  "editor.formatOnSave": true,
  "[solidity]": {
    "editor.defaultFormatter": "JuanBlanco.solidity"
  },
  "solidity.formatter": "forge",
  "solidity.remappings": [
    "@analog-gmp-testing/=lib/analog-gmp/test/",
    "@analog-gmp/=lib/analog-gmp/src/",
    "@evm-interpreter/=lib/analog-gmp/lib/evm-interpreter/src/",
    "@frost-evm/=lib/analog-gmp/lib/frost-evm/sol/",
    "@solmate/=lib/analog-gmp/lib/solmate/src/",
    "@universal-factory/=lib/analog-gmp/lib/universal-factory/src/",
    "analog-gmp/=lib/analog-gmp/",
    "ds-test/=lib/analog-gmp/lib/solmate/lib/ds-test/src/",
    "evm-interpreter/=lib/analog-gmp/lib/evm-interpreter/src/",
    "forge-std/=lib/forge-std/src/",
    "frost-evm/=lib/analog-gmp/lib/",
    "solmate/=lib/analog-gmp/lib/solmate/src/",
    "universal-factory/=lib/analog-gmp/lib/universal-factory/",
  ]
}

I think the error is because of the hardcoded path in BaseTest.sol

            bytes memory creationCode = vm.getCode("./lib/universal-factory/abi/UniversalFactory.json");
            vm.deal(FACTORY_DEPLOYER, 100 ether);
            vm.prank(FACTORY_DEPLOYER, FACTORY_DEPLOYER);
            address factory;
            assembly {
                factory := create(0, add(creationCode, 32), mload(creationCode))
            }
            require(factory == address(FACTORY), "Factory address mismatch");
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant