mirror of
https://github.com/selfxyz/self.git
synced 2026-02-21 03:00:36 -05:00
* remove sdk/tests (#622) * remove sdk/tests * chore: update yarn.lock --------- Co-authored-by: Ayman <aymanshaik1015@gmail.com> * fix: add range check on paddedInLength of shaBytesDynamic (#623) * fix ci (#626) * implement self uups upgradeable (#592) * implement self uups upgradeable * small changes in identityVerificationHubImplV2 * delete aderyn.toml * chore: add custom verifier * chnage return output * feat: use self structs and a Generic output struct * feat: add userIdentifier, nullifier, forbiddencountries to returned output * add root view functions from registry * fix: build and compilation errors * add userDefined data into selfVerificationRoot * "resolve conflicts" * fix compilation problem * fix how to register verification config * test: CustomVerifier * fix verification root and hub integration * add scope check in hub impl * replace poseidon hash to ripemd+sha256 * add todo list * feat: refactor and add test cases for generic formatter * add performUserIdentifierCheck in basicVerification * change how to handle additionalData and fix stack too deep * start adding test codes * fix dependency problems in monorepo * fix: forbidden countries (#612) LGTM! * able to run test code * pass happy path * delete unused codes * change error code name, add caller address validation and add scripts to run test and build in monorepo * add all test cases in vcAndDisclose flow * remove comment out * chore: use actual user identifier outputs * success in registration tests * cover all cases * pass contractVersion instead of circuitVersion * fix disclose test * chore: add natspecs for ImplHubV2, CustomVerifier and GenericFormatter * change val name and remove unused lines * add val name change * remove userIdentifier from return data * feat: use GenericDiscloseOutput struct in verfication hook fix test cases for user identifier * chore: change the function order for Hub Impl V2 (#625) * fix nat specs * add nat spec in SelfStructs --------- Co-authored-by: Ayman <aymanshaik1015@gmail.com> Co-authored-by: Nesopie <87437291+Nesopie@users.noreply.github.com> * prettier (#629) --------- Co-authored-by: Ayman <aymanshaik1015@gmail.com> Co-authored-by: Vishalkulkarni45 <109329073+Vishalkulkarni45@users.noreply.github.com> Co-authored-by: nicoshark <i.am.nicoshark@gmail.com> Co-authored-by: Nesopie <87437291+Nesopie@users.noreply.github.com>
Scripts Directory
This directory contains utility scripts for the Self contracts project.
Available Scripts
Test Scripts (test.sh)
Run various types of tests for the contracts.
# Show all available test commands
./scripts/test.sh help
# Run V2 verification flow tests
./scripts/test.sh v2
# Run all contract tests
./scripts/test.sh all
# Run unit tests
./scripts/test.sh unit
# Run integration tests
./scripts/test.sh integration
# Run test coverage
./scripts/test.sh coverage
# Run specific test types
./scripts/test.sh airdrop
./scripts/test.sh attribute
./scripts/test.sh formatter
./scripts/test.sh hub
./scripts/test.sh registry
./scripts/test.sh sdk
# Clean test artifacts
./scripts/test.sh clean
Development Scripts (dev.sh)
Development and deployment utilities.
# Show all available development commands
./scripts/dev.sh help
# Start local Hardhat node
./scripts/dev.sh node
# Compile contracts
./scripts/dev.sh build
# Clean build artifacts
./scripts/dev.sh clean
# Check contract sizes
./scripts/dev.sh size
# Deploy contracts
./scripts/dev.sh deploy
./scripts/dev.sh deploy:hub
./scripts/dev.sh deploy:hub:v2
./scripts/dev.sh deploy:registry
# Open Hardhat console
./scripts/dev.sh console
Usage Examples
Quick Test Workflow
# Navigate to contracts directory
cd contracts
# Run V2 tests
./scripts/test.sh v2
# If tests fail, check build
./scripts/dev.sh build
# Run coverage to see test completeness
./scripts/test.sh coverage
Development Workflow
# Start local development node (in terminal 1)
./scripts/dev.sh node
# In another terminal, deploy contracts
./scripts/dev.sh deploy:hub:v2
# Run tests against local node
./scripts/test.sh integration
Script Features
- Colored Output: Scripts provide colored status messages for better readability
- Error Handling: Scripts will exit on errors and provide meaningful error messages
- Path Detection: Scripts automatically detect if you're running from
contracts/orcontracts/scripts/ - Environment Variables: Test scripts automatically set appropriate environment variables
Running from Different Directories
The scripts are smart about directory detection:
# From contracts directory
./scripts/test.sh v2
# From contracts/scripts directory
./test.sh v2
# Both will work correctly
Troubleshooting
Script Permission Issues
If you get permission denied errors:
chmod +x scripts/test.sh scripts/dev.sh
"hardhat.config.ts not found" Error
This means the script couldn't find the Hardhat configuration. Make sure you're running from:
- The
contracts/directory, or - The
contracts/scripts/directory
Yarn 4 Workspace Issues
If you encounter Yarn workspace issues, these scripts are designed to work directly with npx hardhat to avoid the
workspace complexities.
Integration with Package.json
The scripts complement the existing package.json scripts:
- Package.json scripts: Can be run from anywhere using
yarncommands - Shell scripts: Run directly from contracts directory, providing more control and better output
Choose the approach that works best for your workflow!