What is the PCL?

The Phylax Credible Layer (PCL) is a CLI tool built on Phoundry, our modified version of the Foundry development framework. PCL allows you to run and test assertions on your smart contracts. The main command pcl provides access to phorge, our Foundry fork that maintains compatibility with standard Forge commands while adding specialized features for assertion testing.

Installation

Build from Source

It requires the following:

  • just
  • Rust >= 1.86 nightly
  • git

After you have installed the above, you can build the CLI by running the following:

git clone git@github.com:phylaxsystems/pcl.git
cd pcl
just build-all

This will build the CLI and make it available as pcl.

Usage

The Phylax Credible Layer (PCL) CLI

Usage: pcl [OPTIONS] <COMMAND>

Commands:
  phorge  Run tests and assertions using the Phoundry framework
  build   Build the project
  help    Print this message or the help of the given subcommand(s)

Options:
  -d, --assertions-dir <ASSERTIONS_DIR>  Directory containing assertion sources and tests [env: PCL_ROOT=]
  -h, --help                             Print help
  -V, --version                          Print version

To execute phorge, a minimal fork of Forge which includes a cheatcode for assertion execution, you can run:

pcl phorge --help

You need to specify the assertions directory, which is the directory containing the assertions source and tests you want to test or build.

pcl --assertions-dir mock-protocol/assertions phorge

Phorge expects the following directory structure:

  assertions/
    src/
    test/

Assertion source files should be in the src directory, and test files should be in the test directory. Test files should have the .t.sol extension, and test functions should start with test_. As a minimal fork of Forge, it behaves identically to Forge.

By defining the assertions directory, the CLI will automatically add the src and test directories to the phorge command. That way, you can share a foundry.toml and lib directory between the sources and tests of the smart contracts and the assertions.