|
| 1 | +// SPDX-License-Identifier: UNLICENSED |
| 2 | +pragma solidity ^0.8.0; |
| 3 | + |
| 4 | +import "./Attestation.t.sol"; |
| 5 | +import "src/DataTypes.sol"; |
| 6 | +import { LibSort } from "solady/utils/LibSort.sol"; |
| 7 | + |
| 8 | +contract POCTest is AttestationTest { |
| 9 | + using LibSort for address[]; |
| 10 | + |
| 11 | + function setUp() public override { |
| 12 | + super.setUp(); |
| 13 | + } |
| 14 | + |
| 15 | + function testPOC() external prankWithAccount(smartAccount1) { |
| 16 | + uint8 threshold = 1; |
| 17 | + address[] memory trustedAttesters = new address[](3); |
| 18 | + trustedAttesters[0] = address(attester1.addr); |
| 19 | + trustedAttesters[1] = address(attester2.addr); |
| 20 | + trustedAttesters[2] = makeAddr("attester3"); |
| 21 | + |
| 22 | + trustedAttesters.sort(); |
| 23 | + trustedAttesters.uniquifySorted(); |
| 24 | + |
| 25 | + registry.trustAttesters(threshold, trustedAttesters); |
| 26 | + |
| 27 | + address[] memory result = registry.findTrustedAttesters(smartAccount1.addr); |
| 28 | + |
| 29 | + assertEq(result.length, trustedAttesters.length); |
| 30 | + for (uint256 i; i < trustedAttesters.length; i++) { |
| 31 | + assertEq(result[i], trustedAttesters[i]); |
| 32 | + } |
| 33 | + |
| 34 | + _make_WhenUsingValidECDSA(attester2); |
| 35 | + registry.check(address(module1), ModuleType.wrap(1)); |
| 36 | + |
| 37 | + address[] memory newTrustedAttesters = new address[](1); |
| 38 | + newTrustedAttesters[0] = address(attester1.addr); |
| 39 | + registry.trustAttesters(1, newTrustedAttesters); |
| 40 | + address[] memory newResult = registry.findTrustedAttesters(smartAccount1.addr); |
| 41 | + assertEq(newResult.length, 1); |
| 42 | + assertEq(newResult[0], address(attester1.addr)); |
| 43 | + |
| 44 | + registry.check(address(module1), ModuleType.wrap(1)); |
| 45 | + } |
| 46 | +} |
0 commit comments