fix: provide required constructor arguments for AIPowerRental deployment
Some checks failed
Contract Performance Benchmarks / benchmark-gas-usage (push) Has been skipped
Contract Performance Benchmarks / benchmark-execution-time (push) Has been skipped
Contract Performance Benchmarks / benchmark-throughput (push) Has been skipped
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Has been skipped
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 2s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Has been skipped
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Deploy to Testnet / deploy-testnet (push) Failing after 1m5s
Contract Performance Benchmarks / compare-benchmarks (push) Has been skipped
Deploy to Testnet / notify-deployment (push) Successful in 1s

- Add ZKReceiptVerifier and Groth16Verifier deployments before AIPowerRental
- Fix AITBCPaymentProcessor.test.js to deploy verifiers first
- Fix DynamicPricing.test.js to deploy verifiers first
- Fix EscrowService.test.js to deploy verifiers first
- Fix Phase4ModularContracts.test.js to register contracts before initializing PerformanceAggregator
- This fixes incorrect number of arguments to constructor errors
This commit is contained in:
aitbc
2026-04-29 11:53:24 +02:00
parent 43a62425e3
commit 0c9404fa92
4 changed files with 54 additions and 15 deletions

View File

@@ -17,9 +17,22 @@ describe("AITBCPaymentProcessor", function () {
aitbcToken = await AIToken.deploy(ethers.parseUnits("1000000", 18));
await aitbcToken.waitForDeployment();
// Deploy AIPowerRental (mock)
// Deploy mock verifiers for AIPowerRental
const ZKReceiptVerifier = await ethers.getContractFactory("ZKReceiptVerifier");
const zkVerifier = await ZKReceiptVerifier.deploy();
await zkVerifier.waitForDeployment();
const Groth16Verifier = await ethers.getContractFactory("Groth16Verifier");
const groth16Verifier = await Groth16Verifier.deploy();
await groth16Verifier.waitForDeployment();
// Deploy AIPowerRental
const AIPowerRental = await ethers.getContractFactory("AIPowerRental");
const aiPowerRental = await AIPowerRental.deploy();
const aiPowerRental = await AIPowerRental.deploy(
await aitbcToken.getAddress(),
await zkVerifier.getAddress(),
await groth16Verifier.getAddress()
);
await aiPowerRental.waitForDeployment();
// Deploy PaymentProcessor

View File

@@ -17,9 +17,22 @@ describe("DynamicPricing", function () {
aitbcToken = await AIToken.deploy(INITIAL_SUPPLY);
await aitbcToken.waitForDeployment();
// Deploy AIPowerRental (mock)
// Deploy mock verifiers for AIPowerRental
const ZKReceiptVerifier = await ethers.getContractFactory("ZKReceiptVerifier");
const zkVerifier = await ZKReceiptVerifier.deploy();
await zkVerifier.waitForDeployment();
const Groth16Verifier = await ethers.getContractFactory("Groth16Verifier");
const groth16Verifier = await Groth16Verifier.deploy();
await groth16Verifier.waitForDeployment();
// Deploy AIPowerRental
const AIPowerRental = await ethers.getContractFactory("AIPowerRental");
aiPowerRental = await AIPowerRental.deploy();
aiPowerRental = await AIPowerRental.deploy(
await aitbcToken.getAddress(),
await zkVerifier.getAddress(),
await groth16Verifier.getAddress()
);
await aiPowerRental.waitForDeployment();
// Deploy PerformanceVerifier (mock)

View File

@@ -20,9 +20,22 @@ describe("EscrowService", function () {
// Transfer tokens to depositor
await aitbcToken.transfer(depositor.address, ethers.parseEther("10000"));
// Deploy AIPowerRental (mock)
// Deploy mock verifiers for AIPowerRental
const ZKReceiptVerifier = await ethers.getContractFactory("ZKReceiptVerifier");
const zkVerifier = await ZKReceiptVerifier.deploy();
await zkVerifier.waitForDeployment();
const Groth16Verifier = await ethers.getContractFactory("Groth16Verifier");
const groth16Verifier = await Groth16Verifier.deploy();
await groth16Verifier.waitForDeployment();
// Deploy AIPowerRental
const AIPowerRental = await ethers.getContractFactory("AIPowerRental");
aiPowerRental = await AIPowerRental.deploy();
aiPowerRental = await AIPowerRental.deploy(
await aitbcToken.getAddress(),
await zkVerifier.getAddress(),
await groth16Verifier.getAddress()
);
await aiPowerRental.waitForDeployment();
// Deploy AITBCPaymentProcessor (mock)

View File

@@ -62,15 +62,8 @@ describe("Phase 4 Modular Smart Contracts", function () {
const DAOGovernanceEnhanced = await ethers.getContractFactory("DAOGovernanceEnhanced");
daoGovernanceEnhanced = await DAOGovernanceEnhanced.deploy(await aiToken.getAddress(), MIN_STAKE);
await daoGovernanceEnhanced.waitForDeployment();
// Initialize all contracts
await treasuryManager.initialize(await contractRegistry.getAddress());
await rewardDistributor.initialize(await contractRegistry.getAddress());
await performanceAggregator.initialize(await contractRegistry.getAddress());
await stakingPoolFactory.initialize(await contractRegistry.getAddress());
await daoGovernanceEnhanced.initialize(await contractRegistry.getAddress());
// Register contracts in registry
// Register contracts in registry first (required by PerformanceAggregator.initialize)
await contractRegistry.registerContract(
ethers.keccak256(ethers.toUtf8Bytes("TreasuryManager")),
await treasuryManager.getAddress()
@@ -91,6 +84,13 @@ describe("Phase 4 Modular Smart Contracts", function () {
ethers.keccak256(ethers.toUtf8Bytes("DAOGovernanceEnhanced")),
await daoGovernanceEnhanced.getAddress()
);
// Initialize all contracts (after registration)
await treasuryManager.initialize(await contractRegistry.getAddress());
await rewardDistributor.initialize(await contractRegistry.getAddress());
await performanceAggregator.initialize(await contractRegistry.getAddress());
await stakingPoolFactory.initialize(await contractRegistry.getAddress());
await daoGovernanceEnhanced.initialize(await contractRegistry.getAddress());
});
describe("ContractRegistry", function () {