From 1b924364a92d9bb11aec1320edaae0b90713de90 Mon Sep 17 00:00:00 2001 From: zeroknots Date: Wed, 21 Feb 2024 15:03:22 +0700 Subject: [PATCH] fix: coverage --- test/Attestation.t.sol | 18 ++++++++++++++++++ test/Base.t.sol | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/test/Attestation.t.sol b/test/Attestation.t.sol index 2608d58c..62a2309f 100644 --- a/test/Attestation.t.sol +++ b/test/Attestation.t.sol @@ -63,14 +63,32 @@ contract AttestationTest is BaseTest { assertEq(record.attester, attester1.addr); } + function test_WhenUsingValidMultiDifferentResolver__ShouldRevert() public prankWithAccount(attester1) { + // It should recover. + uint32[] memory types = new uint32[](1); + + AttestationRequest[] memory requests = new AttestationRequest[](2); + requests[0] = mockAttestation(address(module1), uint48(block.timestamp + 100), "", types); + requests[1] = mockAttestation(address(module3), uint48(block.timestamp + 100), "", types); + + vm.expectRevert(); + registry.attest(defaultSchemaUID, requests); + } + function test_WhenUsingValidMulti__Revocation() public { test_WhenUsingValidMulti(); RevocationRequest[] memory requests = new RevocationRequest[](2); requests[0] = mockRevocation(address(module1)); requests[1] = mockRevocation(address(module2)); + + vm.prank(attester2.addr); + vm.expectRevert(); + registry.revoke(requests); vm.prank(attester1.addr); registry.revoke(requests); + vm.expectRevert(); + registry.revoke(requests); } function test_findAttestation() public { diff --git a/test/Base.t.sol b/test/Base.t.sol index 2f15a898..ba2c061d 100644 --- a/test/Base.t.sol +++ b/test/Base.t.sol @@ -28,6 +28,8 @@ contract BaseTest is Test { MockResolver resolverFalse; MockResolver resolverTrue; + MockResolver differentResolver; + MockSchemaValidator schemaValidatorFalse; MockSchemaValidator schemaValidatorTrue; @@ -41,6 +43,7 @@ contract BaseTest is Test { string defaultSchema = "Foobar"; SchemaUID defaultSchemaUID; ResolverUID internal defaultResolverUID; + ResolverUID internal differentResolverUID; function setUp() public virtual { vm.warp(1_641_070_800); @@ -61,6 +64,7 @@ contract BaseTest is Test { resolverFalse = new MockResolver(false); resolverTrue = new MockResolver(true); + differentResolver = new MockResolver(true); schemaValidatorFalse = new MockSchemaValidator(false); schemaValidatorTrue = new MockSchemaValidator(true); @@ -85,12 +89,16 @@ contract BaseTest is Test { vm.prank(opsEntity1.addr); defaultResolverUID = registry.registerResolver(IExternalResolver(address(resolverTrue))); vm.prank(opsEntity1.addr); + differentResolverUID = registry.registerResolver(IExternalResolver(address(differentResolver))); + vm.prank(opsEntity1.addr); defaultSchemaUID = registry.registerSchema(defaultSchema, IExternalSchemaValidator(address(schemaValidatorTrue))); vm.prank(moduleDev1.addr); registry.registerModule(defaultResolverUID, address(module1), ""); vm.prank(moduleDev2.addr); registry.registerModule(defaultResolverUID, address(module2), ""); + vm.prank(moduleDev1.addr); + registry.registerModule(differentResolverUID, address(module3), ""); AttestationRequest memory req = AttestationRequest({ moduleAddr: address(module1),