- Added AccessControl to ComboHandler for role-based access management. - Implemented gas estimation for plan execution and improved gas limit checks. - Updated execution and preparation methods to enforce step count limits and role restrictions. - Enhanced error handling in orchestrator API endpoints with AppError for better validation feedback. - Integrated request timeout middleware for improved request management. - Updated Swagger documentation to reflect new API structure and parameters.
44 lines
1.3 KiB
Solidity
44 lines
1.3 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.20;
|
|
|
|
import "forge-std/Test.sol";
|
|
import "../ComboHandler.sol";
|
|
import "../AdapterRegistry.sol";
|
|
import "../NotaryRegistry.sol";
|
|
|
|
contract ComboHandlerTest is Test {
|
|
ComboHandler handler;
|
|
AdapterRegistry adapterRegistry;
|
|
NotaryRegistry notaryRegistry;
|
|
|
|
function setUp() public {
|
|
adapterRegistry = new AdapterRegistry();
|
|
notaryRegistry = new NotaryRegistry();
|
|
handler = new ComboHandler(address(adapterRegistry), address(notaryRegistry));
|
|
}
|
|
|
|
function testFuzz_ExecuteCombo(uint256 planIdSeed, uint8 stepCount) public {
|
|
// Fuzz testing for plan execution
|
|
bytes32 planId = keccak256(abi.encodePacked(planIdSeed));
|
|
stepCount = uint8(bound(stepCount, 1, 10));
|
|
|
|
// Create steps
|
|
IComboHandler.Step[] memory steps = new IComboHandler.Step[](stepCount);
|
|
|
|
// Test execution
|
|
// Note: This is a simplified test - in production would need mock adapters
|
|
}
|
|
|
|
function test_GasOptimization() public {
|
|
// Test gas usage for different step counts
|
|
uint256 gasBefore = gasleft();
|
|
|
|
// Execute minimal plan
|
|
// ...
|
|
|
|
uint256 gasUsed = gasBefore - gasleft();
|
|
assertLt(gasUsed, 500000); // Should use less than 500k gas
|
|
}
|
|
}
|
|
|