mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-23 17:28:23 +00:00
## Summary Fixes the CI build failure in the `task-ts-build` workflow caused by Foundry v1.4.2's Solar linter not being able to resolve Snowbridge's context-specific import remappings. ## Problem The Snowbridge submodule uses context-specific remappings (prefixed with `:`) for its dependencies: - `lib/snowbridge/contracts/:openzeppelin/` → OpenZeppelin contracts - `lib/snowbridge/contracts/:prb/math/` → PRB Math library Foundry v1.4.2's Solar linter doesn't understand these context-specific remappings and fails with errors like: ``` error: file openzeppelin/utils/cryptography/MerkleProof.sol not found error: file prb/math/src/UD60x18.sol not found ``` ## Solution Added global remappings that the linter can understand: ```toml "openzeppelin/=lib/snowbridge/contracts/lib/openzeppelin-contracts/contracts/", "prb/math/=lib/snowbridge/contracts/lib/prb-math/", ``` ### Why This Works - The linter can now resolve `openzeppelin/` and `prb/math/` imports globally - These global remappings take **lower precedence** than context-specific ones during compilation - The compiler still uses the context-specific remappings (with `:`) when compiling Snowbridge contracts - The linter uses the global remappings when checking all files ## Changes ### Commit 1: Add global remappings - `contracts/foundry.toml`: Added 2 global remapping entries ### Commit 2: Apply forge fmt - Applied automatic formatting via `forge fmt` to ensure code style consistency - Multi-line formatting for long import statements and function signatures - No functional changes - purely formatting updates ## Testing ✅ Local build succeeds with `forge build` ✅ No Snowbridge import resolution errors ✅ `forge fmt --check` passes with no formatting issues ✅ Only linting notes/warnings remain (not errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
59 lines
2.3 KiB
Solidity
59 lines
2.3 KiB
Solidity
// SPDX-License-Identifier: UNLICENSED
|
|
pragma solidity ^0.8.13;
|
|
|
|
/* solhint-disable func-name-mixedcase */
|
|
|
|
import {Test, console} from "forge-std/Test.sol";
|
|
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
|
|
import {
|
|
IRewardsCoordinator
|
|
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
|
|
import {StrategyBase} from "eigenlayer-contracts/src/contracts/strategies/StrategyBase.sol";
|
|
import {
|
|
IAllocationManagerErrors,
|
|
IAllocationManager
|
|
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
|
|
|
|
import {ServiceManagerMock} from "./mocks/ServiceManagerMock.sol";
|
|
import {AVSDeployer} from "./utils/AVSDeployer.sol";
|
|
import {IServiceManager} from "../src/interfaces/IServiceManager.sol";
|
|
import {IServiceManagerUI} from "../src/interfaces/IServiceManagerUI.sol";
|
|
import {ServiceManagerBase} from "../src/middleware/ServiceManagerBase.sol";
|
|
|
|
contract ServiceManagerBaseTest is AVSDeployer {
|
|
function setUp() public virtual {
|
|
_deployMockEigenLayerAndAVS();
|
|
}
|
|
|
|
function beforeTestSetup(
|
|
bytes4 testSelector
|
|
) public pure returns (bytes[] memory beforeTestCalldata) {
|
|
if (testSelector == this.test_createOperatorSetsWithEmptyParams.selector) {
|
|
beforeTestCalldata = new bytes[](1);
|
|
beforeTestCalldata[0] = abi.encodePacked(this.test_registerAVS.selector);
|
|
}
|
|
}
|
|
|
|
function test_registerAVS() public {
|
|
vm.prank(avsOwner);
|
|
IServiceManagerUI(address(serviceManager)).updateAVSMetadataURI("https://example.com");
|
|
}
|
|
|
|
function test_registerAVSRevertsIfNotAVSOwner() public {
|
|
vm.prank(rewardsUpdater);
|
|
vm.expectRevert(bytes("Ownable: caller is not the owner"));
|
|
IServiceManagerUI(address(serviceManager)).updateAVSMetadataURI("https://example.com");
|
|
}
|
|
|
|
function test_createOperatorSetsWithEmptyParams() public {
|
|
vm.prank(avsOwner);
|
|
IAllocationManager.CreateSetParams[] memory emptyParams =
|
|
new IAllocationManager.CreateSetParams[](0);
|
|
ServiceManagerBase(address(serviceManager)).createOperatorSets(emptyParams);
|
|
}
|
|
|
|
function test_returnsAVSAddress() public view {
|
|
assertEq(serviceManager.avs(), address(serviceManager));
|
|
}
|
|
}
|