Some checks failed
AITBC CI/CD Pipeline / lint-and-test (3.11) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.12) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.13) (push) Has been cancelled
AITBC CI/CD Pipeline / test-cli (push) Has been cancelled
AITBC CI/CD Pipeline / test-services (push) Has been cancelled
AITBC CI/CD Pipeline / test-production-services (push) Has been cancelled
AITBC CI/CD Pipeline / security-scan (push) Has been cancelled
AITBC CI/CD Pipeline / build (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-staging (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-production (push) Has been cancelled
AITBC CI/CD Pipeline / performance-test (push) Has been cancelled
AITBC CI/CD Pipeline / docs (push) Has been cancelled
AITBC CI/CD Pipeline / release (push) Has been cancelled
AITBC CI/CD Pipeline / notify (push) Has been cancelled
Security Scanning / Bandit Security Scan (apps/coordinator-api/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (cli/aitbc_cli) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-core/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-crypto/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-sdk/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (tests) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (javascript) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (python) (push) Has been cancelled
Security Scanning / Dependency Security Scan (push) Has been cancelled
Security Scanning / Container Security Scan (push) Has been cancelled
Security Scanning / OSSF Scorecard (push) Has been cancelled
Security Scanning / Security Summary Report (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.11) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.12) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.13) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-summary (push) Has been cancelled
- Remove debugging service documentation (DEBUgging_SERVICES.md) - Remove development logs policy and quick reference guides - Remove E2E test creation summary - Remove gift certificate example file - Remove GitHub pull summary documentation
58 lines
1.4 KiB
Python
Executable File
58 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Test the BlockImportRequest model
|
|
"""
|
|
|
|
from pydantic import BaseModel, Field
|
|
from typing import Dict, Any, List, Optional
|
|
|
|
class TransactionData(BaseModel):
|
|
tx_hash: str
|
|
sender: str
|
|
recipient: str
|
|
payload: Dict[str, Any] = Field(default_factory=dict)
|
|
|
|
class BlockImportRequest(BaseModel):
|
|
height: int = Field(gt=0)
|
|
hash: str
|
|
parent_hash: str
|
|
proposer: str
|
|
timestamp: str
|
|
tx_count: int = Field(ge=0)
|
|
state_root: Optional[str] = None
|
|
transactions: List[TransactionData] = Field(default_factory=list)
|
|
|
|
# Test creating the request
|
|
test_data = {
|
|
"height": 1,
|
|
"hash": "0xtest",
|
|
"parent_hash": "0x00",
|
|
"proposer": "test",
|
|
"timestamp": "2026-01-29T10:20:00",
|
|
"tx_count": 1,
|
|
"transactions": [{
|
|
"tx_hash": "0xtx123",
|
|
"sender": "0xsender",
|
|
"recipient": "0xrecipient",
|
|
"payload": {"test": "data"}
|
|
}]
|
|
}
|
|
|
|
print("Test data:")
|
|
print(test_data)
|
|
|
|
try:
|
|
request = BlockImportRequest(**test_data)
|
|
print("\n✅ Request validated successfully!")
|
|
print(f"Transactions count: {len(request.transactions)}")
|
|
if request.transactions:
|
|
tx = request.transactions[0]
|
|
print(f"First transaction:")
|
|
print(f" tx_hash: {tx.tx_hash}")
|
|
print(f" sender: {tx.sender}")
|
|
print(f" recipient: {tx.recipient}")
|
|
except Exception as e:
|
|
print(f"\n❌ Validation failed: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|