Skip to content

Commit 4db4175

Browse files
author
Wizard
committed
feat: implement Operation Protocol Improvements (OPI) architecture
- Add OPI registry system for extensible operation processing - Implement IntermediateState and Context for secure state management - Add BaseProcessor abstract class for OPI implementations - Create test OPI processor as reference implementation - Integrate OPI system with existing BRC20 indexer - Add comprehensive test suite for OPI functionality - Fix code quality issues and ensure all tests pass - Update CI/CD pipeline configuration - Add decimal conversion utilities for precise amount handling - Implement marketplace transfer prioritization - Add performance monitoring and security scanning - Reorganize test structure for better maintainability This commit introduces a complete OPI (Operation Protocol Improvements) architecture that allows for extensible operation processing while maintaining backward compatibility with existing BRC20 functionality.
1 parent d01068f commit 4db4175

File tree

111 files changed

+9164
-4423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+9164
-4423
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_brc20_indexer
9393
REDIS_URL: redis://localhost:6379/0
9494
run: |
95-
pipenv run pytest tests/test_performance.py -v --tb=short
95+
pipenv run pytest tests/integration/test_performance.py -v --tb=short
9696
9797
- name: Upload coverage to Codecov
9898
uses: codecov/codecov-action@v3
@@ -193,7 +193,7 @@ jobs:
193193
-e DATABASE_URL=$DATABASE_URL \
194194
-e REDIS_URL=$REDIS_URL \
195195
universal-brc20-indexer:test \
196-
pipenv run pytest tests/test_integration.py -v
196+
pipenv run pytest tests/integration/test_integration.py -v
197197
198198
- name: Health check validation
199199
env:

.gitignore

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ __pycache__/
33
*.py[cod]
44
*$py.class
55
*.so
6+
.mypy_cache/
67
.Python
78
build/
89
develop-eggs/
@@ -23,6 +24,7 @@ MANIFEST
2324

2425
# Environments
2526
.env
27+
.env.back
2628
.venv
2729
env/
2830
venv/
@@ -61,9 +63,10 @@ coverage.xml
6163
temp_docs/
6264
backups/
6365
dev/
66+
.rules/
67+
.cursor/
6468

6569
# Alembic
66-
alembic/versions/*.py
67-
!alembic/versions/b896be53b879_initial_tables.py
68-
!alembic/versions/add_deployer_address_to_deploy.py
69-
!alembic/versions/ff9599cfaa41_add_is_marketplace_to_brc20_operations.py
70+
# Ne pas ignorer les fichiers de migration
71+
!alembic/versions/
72+
.env.back

Makefile

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Makefile for Simplicity BRC-20 Indexer
2+
# Test execution and development utilities
3+
4+
.PHONY: help test test-unit test-integration test-functional test-all test-fast test-slow test-coverage clean install
5+
6+
# Default target
7+
help:
8+
@echo "Available commands:"
9+
@echo " make test - Run all tests"
10+
@echo " make test-unit - Run unit tests only (fast)"
11+
@echo " make test-integration - Run integration tests"
12+
@echo " make test-functional - Run functional tests"
13+
@echo " make test-fast - Run unit + integration tests (fast)"
14+
@echo " make test-slow - Run functional tests (slow)"
15+
@echo " make test-coverage - Run all tests with coverage report"
16+
@echo " make clean - Clean up temporary files"
17+
@echo " make install - Install dependencies"
18+
19+
# Run all tests
20+
test:
21+
pipenv run pytest tests/ -v
22+
23+
# Run unit tests only (fastest)
24+
test-unit:
25+
pipenv run pytest tests/unit/ -v
26+
27+
# Run integration tests
28+
test-integration:
29+
pipenv run pytest tests/integration/ -v
30+
31+
# Run functional tests (slowest)
32+
test-functional:
33+
pipenv run pytest tests/functional/ -v
34+
35+
# Run fast tests (unit + integration)
36+
test-fast:
37+
pipenv run pytest tests/unit/ tests/integration/ -v
38+
39+
# Run slow tests (functional)
40+
test-slow:
41+
pipenv run pytest tests/functional/ -v
42+
43+
# Run all tests with coverage
44+
test-coverage:
45+
pipenv run pytest tests/ --cov=src --cov-report=html --cov-report=term-missing
46+
47+
# Run tests with specific markers
48+
test-api:
49+
pipenv run pytest tests/ -m api -v
50+
51+
test-bitcoin:
52+
pipenv run pytest tests/ -m bitcoin -v
53+
54+
test-brc20:
55+
pipenv run pytest tests/ -m brc20 -v
56+
57+
test-database:
58+
pipenv run pytest tests/ -m database -v
59+
60+
# Clean up temporary files
61+
clean:
62+
find . -type f -name "*.pyc" -delete
63+
find . -type d -name "__pycache__" -delete
64+
find . -type d -name "*.egg-info" -exec rm -rf {} +
65+
rm -rf htmlcov/
66+
rm -rf .coverage
67+
rm -rf .pytest_cache/
68+
rm -rf test.db
69+
70+
# Install dependencies
71+
install:
72+
pipenv install --dev
73+
74+
# Development utilities
75+
lint:
76+
pipenv run black src/ tests/
77+
pipenv run flake8 src/ tests/
78+
pipenv run isort src/ tests/
79+
80+
format:
81+
pipenv run black src/ tests/
82+
pipenv run isort src/ tests/
83+
84+
# Quick test for CI/CD
85+
test-ci:
86+
pipenv run pytest tests/ --tb=short --maxfail=10

Pipfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ verify_ssl = true
44
name = "pypi"
55

66
[packages]
7-
sqlalchemy = "*"
87
psycopg2-binary = "*"
98
alembic = "*"
109
requests = "*"
@@ -23,6 +22,12 @@ autoflake = "*"
2322
isort = "*"
2423
pytest = "*"
2524
httpx = "*"
25+
pytest-cov = "*"
26+
async-timeout = "*"
27+
sqlalchemy = "*"
28+
mypy = "*"
29+
bandit = "*"
30+
safety = "*"
2631

2732
[dev-packages]
2833
pytest = "*"
@@ -37,4 +42,4 @@ safety = "*"
3742
pre-commit = "*"
3843

3944
[requires]
40-
python_version = ">=3.11,<3.12"
45+
python_version = "3.11"

Pipfile.lock

Lines changed: 1538 additions & 1001 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)