Frequently Asked Questions
Common questions about the Phylax Credible Layer
Frequently Asked Questions (FAQ)
Welcome to the Phylax Credible Layer FAQ! Here you’ll find answers to common questions about the PCL’s features, capabilities, and usage. If you can’t find what you’re looking for, please reach out in our Telegram.
General Questions
What is the Phylax Credible Layer (PCL)?
PCL is a security framework that prevents smart contract exploits by enforcing user-defined security rules (assertions) at the sequencer level. It stops malicious transactions before they can affect your protocol.
Why do I need the Credible Layer when I can write rules in my contracts?
There are several key advantages:
- Off-chain Execution: Rules that would be too expensive or impossible to express on-chain can be implemented as assertions. Our current benchmarks show around 1000x efficiency gains.
- Simpler Security Model: Instead of handling all edge cases in your contract, you define states that should never occur
- No Redeployment: Add new security rules without modifying your existing contracts
- Comprehensive Protection: Define protocol-wide invariants that span multiple contracts
How does PCL differ from other security approaches?
The Credible Layer offers several key advantages:
- Prevention First: Stops attacks before they happen by filtering invalid transactions, rather than detecting them after the fact
- Protocol-Defined Security: Your team defines exact security rules in Solidity, eliminating false positives from generic heuristics
- No Contract Changes: Add new security rules without modifying or redeploying your contracts
- Comprehensive Coverage: Define rules that span multiple contracts and complex interactions
- Full Transparency: Unlike AI/LLM analysis which operates as black boxes, assertions are written in Solidity and their logic is fully transparent and verifiable
- Economic Incentives: Creates a market where sequencers earn fees for enforcing security rules
What’s the difference between assertions and traditional audits?
While audits provide one-time code reviews, assertions offer continuous protection by actively monitoring every transaction that interacts with your protocol. They run at the sequencer level, checking each transaction before it’s included in a block, providing real-time protection against:
- New attack vectors discovered after deployment
- Unexpected contract interactions
- Changes in market conditions
- Updates to protocol parameters
- Governance decisions
What is the transparency dashboard?
The transparency dashboard is a tool that allows you to view and browse all assertions deployed by different protocols. It is a useful tool for understanding the security posture of a protocol.
Technical Details
What exactly is an assertion?
An assertion is a Solidity contract that defines invalid states your protocol should never reach. You can think of it as an inverse intent - you define something you don’t want to happen without specifying or caring about all the edge cases that could lead to it.
Assertions are binary in nature, implemented through Solidity’s require
statements:
- If the
require
condition is met, the transaction is valid - If the
require
fails, the transaction is invalid and will be filtered out
This simple binary approach makes assertions both powerful and easy to reason about - there’s no ambiguity about what constitutes a violation.
Common examples include:
- Unauthorized admin changes
- Suspicious price movements
- Violation of core protocol invariants
- Complex cross-contract validations
What are invariants and why are they important?
Invariants are properties of your protocol that must always remain true. They are fundamental to the Credible Layer’s approach to security, and assertions are the perfect tool to enforce them. While invariants define what should always be true, assertions give you the practical means to enforce these rules across your entire protocol:
-
Definition:
- Mathematical properties that must hold true throughout execution
- Core rules that define valid vs. invalid protocol states
- Security guarantees that shouldn’t be violated
-
Common Examples:
- Total supply must equal sum of all balances
- Pool balance should never drop below initial deposit
- Admin privileges can’t be granted without proper authorization
- Price changes must stay within acceptable bounds
-
Advantages:
- More robust than trying to catch all possible exploits
- Easier to reason about security properties
- Can catch novel attack vectors
- Provides clear security boundaries
For a good explainer on invariants see this article
How do assertions work?
Assertions run off-chain through the PhEVM (Phylax EVM) and:
- Compare state before and after transactions
- Monitor specific function calls
- Track changes to storage slots
- Analyze transaction patterns
- Enforce protocol-wide invariants
What are cheatcodes and how do they help?
Cheatcodes are special functions provided by the PhEVM that give assertions powerful capabilities beyond standard Solidity:
-
State Inspection:
- Examine blockchain state at any point in a transaction
- Compare values before and after execution
- Access historical state data
-
Transaction Analysis:
- Inspect call data and function parameters
- Track emitted events
- Monitor internal transactions
- Analyze call traces
-
Storage Access:
- Monitor specific storage slots
- Track state changes across contracts
- Access complex data structures
- Monitor cross-contract interactions
-
Testing Utilities:
- Simulate different scenarios
- Mock contract responses
- Manipulate execution environment
- Debug assertion behavior
For detailed documentation and examples of all available cheatcodes, see our Cheatcodes Reference Guide.
How do I upgrade assertions?
Updating assertions is straightforward:
- Disable current assertion
- Deploy new assertion pointing to upgraded contract
- Enable new assertion
- Include these steps in your upgrade process
Can I copy assertions from other protocols?
Yes, you can copy assertions from other protocols and use them in your own protocol. You should make sure that the assertions are compatible with your protocol. It will make the most sense to copy assertions for standard libraries and interfaces. You will be able to see all assertions deployed by other protocols on the transparency dashboard.
Implementation and Adoption
How does PCL work at the sequencer level?
PCL uses a modified Flashbots builder that:
- Simulates each transaction against relevant assertions
- Allows valid transactions to proceed
- Filters out transactions that violate assertions
- Maintains Superchain compliance for L2 compatibility
How are forced inclusion transactions handled?
For L1->L2 deposits and other forced transactions, PCL:
- Intercepts incoming L1 blocks
- Validates deposit transactions
- Applies mitigations if needed
- Ensures the L2 chain never stalls
Does this introduce new trust assumptions?
No. For single-sequencer L2s, users already trust the sequencer. PCL simply extends the sequencer’s validation logic with protocol-defined rules.
What are some example use cases for assertions?
-
DeFi Protection
- Prevent flash loan attacks
- Monitor liquidity pool ratios
- Enforce borrowing limits
- Detect price manipulation
-
Governance Safety
- Validate proposal execution
- Monitor admin actions
- Enforce timelock requirements
- Track parameter changes
-
Cross-Protocol Security
- Monitor oracle data feeds
- Track cross-chain messages
- Validate bridge transactions
- Enforce protocol dependencies
How do I test my assertions?
Testing assertions is similar to standard Forge testing, with additional PCL-specific features:
-
Standard Testing Tools:
- Use familiar Forge assertions (
assertEq
,assertTrue
) - Access standard cheatcodes (
vm.prank
,vm.deal
) - Leverage console logging for debugging
- Use familiar Forge assertions (
-
PCL-Specific Testing:
- Register assertions using
cl.addAssertion()
- Validate transactions with
cl.validate()
- Test both positive and negative cases
- Verify assertion behavior across different scenarios
- Register assertions using
For detailed examples and testing patterns, see our Testing Guide.