Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 8s
CLI Tests / test-cli (push) Successful in 10s
Contract Performance Benchmarks / benchmark-gas-usage (push) Successful in 1m22s
Contract Performance Benchmarks / benchmark-execution-time (push) Successful in 1m11s
Contract Performance Benchmarks / benchmark-throughput (push) Successful in 1m13s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Failing after 5s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 5s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Failing after 3s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Cross-Node Transaction Testing / transaction-test (push) Successful in 5s
Deploy to Testnet / deploy-testnet (push) Successful in 1m14s
Contract Performance Benchmarks / compare-benchmarks (push) Has been cancelled
Documentation Validation / validate-docs (push) Failing after 10s
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Node Failover Simulation / failover-test (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Smart Contract Tests / test-solidity (map[name:aitbc-contracts path:contracts]) (push) Has been cancelled
Smart Contract Tests / test-solidity (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Has been cancelled
Smart Contract Tests / test-foundry (push) Has been cancelled
Smart Contract Tests / lint-solidity (push) Has been cancelled
Smart Contract Tests / deploy-contracts (push) Has been cancelled
Documentation Validation / validate-policies-strict (push) Successful in 3s
Integration Tests / test-service-integration (push) Failing after 45s
Multi-Chain Island Architecture Tests / test-multi-chain-island (push) Failing after 2s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 5s
P2P Network Verification / p2p-verification (push) Successful in 3s
Production Tests / Production Integration Tests (push) Failing after 7s
Python Tests / test-python (push) Failing after 46s
Staking Tests / test-staking-service (push) Failing after 2s
Staking Tests / test-staking-integration (push) Has been skipped
Staking Tests / test-staking-contract (push) Has been skipped
Staking Tests / run-staking-test-runner (push) Has been skipped
Systemd Sync / sync-systemd (push) Successful in 21s
API Endpoint Tests / test-api-endpoints (push) Failing after 12m19s
- Changed pytest calls to use `venv/bin/python -m pytest` with explicit config - Added `--rootdir "$PWD"` and `--import-mode=importlib` for consistent imports - Fixed PYTHONPATH to use absolute paths with $PWD prefix - Added smart contract security scanning for Solidity files - Added Circom circuit security checks for ZK proof circuits - Added ZK proof implementation security validation - Added contracts/** to security scanning workflow
121 lines
3.5 KiB
Plaintext
121 lines
3.5 KiB
Plaintext
pragma circom 2.0.0;
|
|
|
|
include "node_modules/circomlib/circuits/bitify.circom";
|
|
include "node_modules/circomlib/circuits/escalarmulfix.circom";
|
|
include "node_modules/circomlib/circuits/comparators.circom";
|
|
include "node_modules/circomlib/circuits/poseidon.circom";
|
|
|
|
/*
|
|
* Receipt Attestation Circuit
|
|
*
|
|
* This circuit proves that a receipt is valid without revealing sensitive details.
|
|
*
|
|
* Public Inputs:
|
|
* - receiptHash: Hash of the receipt (for public verification)
|
|
* - settlementAmount: Amount to be settled (public)
|
|
* - timestamp: Receipt timestamp (public)
|
|
*
|
|
* Private Inputs:
|
|
* - receipt: The full receipt data (private)
|
|
* - computationResult: Result of the computation (private)
|
|
* - pricingRate: Pricing rate used (private)
|
|
* - minerReward: Reward for miner (private)
|
|
* - coordinatorFee: Fee for coordinator (private)
|
|
*/
|
|
|
|
template ReceiptAttestation() {
|
|
// Public signals
|
|
signal input receiptHash;
|
|
signal input settlementAmount;
|
|
signal input timestamp;
|
|
|
|
// Private signals
|
|
signal input receipt[8];
|
|
signal input computationResult;
|
|
signal input pricingRate;
|
|
signal input minerReward;
|
|
signal input coordinatorFee;
|
|
|
|
// Components
|
|
component hasher = Poseidon(8);
|
|
component amountChecker = GreaterEqThan(8);
|
|
component feeCalculator = Add8(8);
|
|
|
|
// Hash the receipt to verify it matches the public hash
|
|
for (var i = 0; i < 8; i++) {
|
|
hasher.inputs[i] <== receipt[i];
|
|
}
|
|
|
|
// Ensure the computed hash matches the public hash
|
|
hasher.out === receiptHash;
|
|
|
|
// Verify settlement amount calculation
|
|
// settlementAmount = minerReward + coordinatorFee
|
|
feeCalculator.a[0] <== minerReward;
|
|
feeCalculator.a[1] <== coordinatorFee;
|
|
for (var i = 2; i < 8; i++) {
|
|
feeCalculator.a[i] <== 0;
|
|
}
|
|
feeCalculator.out === settlementAmount;
|
|
|
|
// Ensure amounts are non-negative
|
|
amountChecker.in[0] <== settlementAmount;
|
|
amountChecker.in[1] <== 0;
|
|
amountChecker.out === 1;
|
|
|
|
// Additional constraints can be added here:
|
|
// - Timestamp validation
|
|
// - Pricing rate bounds
|
|
// - Computation result format
|
|
}
|
|
|
|
/*
|
|
* Simplified Receipt Hash Preimage Circuit
|
|
*
|
|
* This is a minimal circuit for initial testing that proves
|
|
* knowledge of a receipt preimage without revealing it.
|
|
*/
|
|
template ReceiptHashPreimage() {
|
|
// Public signal
|
|
signal input hash;
|
|
|
|
// Private signals (receipt data)
|
|
signal input data[4];
|
|
|
|
// Hash component
|
|
component poseidon = Poseidon(4);
|
|
|
|
// Connect inputs
|
|
for (var i = 0; i < 4; i++) {
|
|
poseidon.inputs[i] <== data[i];
|
|
}
|
|
|
|
// Constraint: computed hash must match public hash
|
|
poseidon.out === hash;
|
|
}
|
|
|
|
/*
|
|
* Signature Verification Component
|
|
*
|
|
* SECURITY NOTE: Signature verification moved off-chain
|
|
*
|
|
* Full on-chain signature verification in Circom is complex and requires
|
|
* significant circuit constraints. For the immediate security fix, signature
|
|
* verification is performed off-chain by the Coordinator API before accepting
|
|
* proofs. The circuit proves knowledge of the receipt preimage without
|
|
* attempting to verify signatures.
|
|
*
|
|
* Future Enhancement: Implement EdDSA verification using circomlib's
|
|
* eddsa.circom circuits for on-chain signature verification.
|
|
*
|
|
* Current Security Model:
|
|
* - API layer verifies signatures before accepting proofs
|
|
* - Circuit proves receipt preimage knowledge
|
|
* - Signature verification is a prerequisite for proof submission
|
|
*/
|
|
|
|
/*
|
|
* Main circuit for initial implementation
|
|
*/
|
|
component main = ReceiptHashPreimage();
|