This document outlines the test coverage requirements for LN1 node-level operations and smart contract testing on OP Sepolia testnet1.
Test coverage ensures comprehensive validation of all smart contract functions, with particular focus on token economics, node operations, and cross-chain interactions.
// Required coverage: 100%
stake()
unstake()
claimRewards()
// Required coverage: 100%
registerNode()
updateNodeStatus()
removeNode()
// Required coverage: 100%
validateLegalData()
updateValidationRules()
processDataBatch()
// Required coverage: 100% for each token
ETH // Native L2 token
USDC // Test USDC
USDT // Test USDT
BTC // Wrapped BTC
- Function-level testing
- Input validation
- Error handling
- Event emission
- State changes
- Cross-contract interactions
- Token transfers
- Multi-step operations
- Network state validation
- Access control
- Reentrancy protection
- Integer overflow/underflow
- Token approval handling
- Emergency procedures
- Statements: >= 95%
- Branches: >= 95%
- Functions: 100%
- Lines: >= 95%
- Happy path: 100%
- Error conditions: 100%
- Edge cases: 100%
- Network conditions: >= 95%
# Generate coverage report
npm run coverage
# Generate detailed HTML report
npm run coverage:html
# Check coverage thresholds
npm run coverage:check
{
"contractName": "TokenEconomics",
"coverage": {
"statements": 98.5,
"branches": 97.2,
"functions": 100,
"lines": 98.7
},
"uncovered": {
"functions": [],
"lines": [45, 67]
}
}
- Staking flows
- Unstaking flows
- Reward distribution
- Token transfers
- Emergency procedures
- Registration process
- Status updates
- Validation sequences
- Consensus operations
- Recovery procedures
// Required coverage with gas assertions
stake(): <= 40,000 gas
unstake(): <= 35,000 gas
claimRewards(): <= 50,000 gas
// Required coverage with gas assertions
registerNode(): <= 50,000 gas
updateNodeStatus(): <= 20,000 gas
removeNode(): <= 35,000 gas
- Pre-commit hooks
- Pull request validation
- Deployment verification
- Gas optimization checks
- Generated per commit
- Archived for analysis
- Trend tracking
- Regression detection
- Test case descriptions
- Coverage explanations
- Uncovered code justification
- Known limitations
- Coverage metrics
- Gas usage analysis
- Performance metrics
- Security findings