Implement RECEIPT_CLAIM transaction type
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Successful in 4s
Documentation Validation / validate-docs (push) Successful in 12s
Documentation Validation / validate-policies-strict (push) Successful in 3s
Integration Tests / test-service-integration (push) Failing after 12s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 3s
P2P Network Verification / p2p-verification (push) Successful in 2s
Python Tests / test-python (push) Successful in 10s
Security Scanning / security-scan (push) Successful in 31s

- Add status fields to Receipt model (status, claimed_at, claimed_by)
- Add RECEIPT_CLAIM handling to state_transition.py with validation and reward minting
- Add type field to Transaction model for reliable transaction type storage
- Update router to use TransactionRequest model to preserve type field
- Update poa.py to extract type from mempool transaction content and store only original payload
- Add RECEIPT_CLAIM to GasType enum with gas schedule
This commit is contained in:
aitbc
2026-04-22 13:35:31 +02:00
parent a6a840a930
commit f36fd45d28
40 changed files with 1194 additions and 349 deletions

View File

@@ -229,15 +229,11 @@ class PoAProposer:
# Apply state transition through validated transaction
state_transition = get_state_transition()
tx_data = {
"from": sender,
"to": recipient,
"value": value,
"fee": fee,
"nonce": sender_account.nonce
}
# Use original tx_data from mempool to preserve type and payload
tx_data_for_transition = tx.content.copy()
tx_data_for_transition["nonce"] = sender_account.nonce
success, error_msg = state_transition.apply_transaction(
session, self._config.chain_id, tx_data, tx.tx_hash
session, self._config.chain_id, tx_data_for_transition, tx.tx_hash
)
if not success:
@@ -257,18 +253,30 @@ class PoAProposer:
continue
# Create transaction record
# Extract type from normalized tx_data (which should have the type field)
tx_type = tx.content.get("type", "TRANSFER")
self._logger.info(f"[PROPOSE] Transaction {tx.tx_hash} content type: {tx_type}, full content: {tx.content}")
if tx_type:
tx_type = tx_type.upper()
else:
tx_type = "TRANSFER"
# Store only the original payload, not the full normalized data
original_payload = tx.content.get("payload", {})
transaction = Transaction(
chain_id=self._config.chain_id,
tx_hash=tx.tx_hash,
sender=sender,
recipient=recipient,
payload=tx_data,
payload=original_payload,
value=value,
fee=fee,
nonce=sender_account.nonce - 1,
timestamp=timestamp,
block_height=next_height,
status="confirmed"
status="confirmed",
type=tx_type
)
session.add(transaction)
processed_txs.append(tx)