Skip to content

Commit

Permalink
fix: change moduleAddr to moduleAddress in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kopy-kat committed Jul 3, 2024
1 parent d792ff4 commit 10c3719
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 26 deletions.
26 changes: 13 additions & 13 deletions test/Attestation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ contract AttestationTest is BaseTest {
for (uint256 i; i < types.length; i++) {
typesEnc[i] = ModuleType.wrap(types[i]);
}
request = AttestationRequest({ moduleAddr: module, expirationTime: expirationTime, data: data, moduleTypes: typesEnc });
request = AttestationRequest({ moduleAddress: module, expirationTime: expirationTime, data: data, moduleTypes: typesEnc });
}

function mockRevocation(address module) internal pure returns (RevocationRequest memory request) {
request = RevocationRequest({ moduleAddr: module });
request = RevocationRequest({ moduleAddress: module });
}

function test_WhenAttestingWithNoAttestationData() public prankWithAccount(attester1) {
Expand All @@ -41,7 +41,7 @@ contract AttestationTest is BaseTest {

assertEq(record.time, block.timestamp);
assertEq(record.expirationTime, request.expirationTime);
assertEq(record.moduleAddr, request.moduleAddr);
assertEq(record.moduleAddress, request.moduleAddress);
assertEq(record.attester, attester1.addr);
}

Expand All @@ -59,7 +59,7 @@ contract AttestationTest is BaseTest {

assertEq(record.time, block.timestamp);
assertEq(record.expirationTime, requests[0].expirationTime);
assertEq(record.moduleAddr, requests[0].moduleAddr);
assertEq(record.moduleAddress, requests[0].moduleAddress);
assertEq(record.attester, attester1.addr);
}

Expand Down Expand Up @@ -143,12 +143,12 @@ contract AttestationTest is BaseTest {

assertEq(record[0].time, block.timestamp);
assertEq(record[0].expirationTime, requests[0].expirationTime);
assertEq(record[0].moduleAddr, requests[0].moduleAddr);
assertEq(record[0].moduleAddress, requests[0].moduleAddress);
assertEq(record[0].attester, attester1.addr);

assertEq(record[1].time, block.timestamp);
assertEq(record[1].expirationTime, requests[0].expirationTime);
assertEq(record[1].moduleAddr, requests[0].moduleAddr);
assertEq(record[1].moduleAddress, requests[0].moduleAddress);
assertEq(record[1].attester, attester2.addr);
}

Expand All @@ -164,10 +164,10 @@ contract AttestationTest is BaseTest {
assertEq(record.time, block.timestamp);
assertEq(record.expirationTime, request.expirationTime);
assertEq(record.revocationTime, 0);
assertEq(record.moduleAddr, request.moduleAddr);
assertEq(record.moduleAddress, request.moduleAddress);
assertEq(record.attester, attester1.addr);

RevocationRequest memory revocation = RevocationRequest({ moduleAddr: module });
RevocationRequest memory revocation = RevocationRequest({ moduleAddress: module });

vm.warp(block.timestamp + 100);
registry.revoke(revocation);
Expand All @@ -183,7 +183,7 @@ contract AttestationTest is BaseTest {
assertEq(record.expirationTime, request.expirationTime);
// ensure revocation time is reset
assertEq(record.revocationTime, 0);
assertEq(record.moduleAddr, request.moduleAddr);
assertEq(record.moduleAddress, request.moduleAddress);
assertEq(record.attester, attester1.addr);
}

Expand Down Expand Up @@ -303,7 +303,7 @@ contract AttestationTest is BaseTest {

assertEq(record.time, block.timestamp);
assertEq(record.expirationTime, request.expirationTime);
assertEq(record.moduleAddr, request.moduleAddr);
assertEq(record.moduleAddress, request.moduleAddress);
assertEq(record.attester, attester.addr);
assertEq(nonceAfter, nonceBefore + 1);
assertEq(PackedModuleTypes.unwrap(record.moduleTypes), 2 ** 1 + 2 ** 2);
Expand Down Expand Up @@ -347,7 +347,7 @@ contract AttestationTest is BaseTest {

assertEq(record.time, block.timestamp);
assertEq(record.expirationTime, requests[0].expirationTime);
assertEq(record.moduleAddr, requests[0].moduleAddr);
assertEq(record.moduleAddress, requests[0].moduleAddress);
assertEq(record.attester, attester1.addr);
assertEq(nonceAfter, nonceBefore + 1);
}
Expand Down Expand Up @@ -389,7 +389,7 @@ contract AttestationTest is BaseTest {

assertEq(record.time, block.timestamp);
assertEq(record.expirationTime, request.expirationTime);
assertEq(record.moduleAddr, request.moduleAddr);
assertEq(record.moduleAddress, request.moduleAddress);
assertEq(record.attester, address(erc1271AttesterTrue));
}

Expand All @@ -406,7 +406,7 @@ contract AttestationTest is BaseTest {

assertEq(record.time, block.timestamp);
assertEq(record.expirationTime, requests[0].expirationTime);
assertEq(record.moduleAddr, requests[0].moduleAddr);
assertEq(record.moduleAddress, requests[0].moduleAddress);
assertEq(record.attester, address(erc1271AttesterTrue));
}

Expand Down
2 changes: 1 addition & 1 deletion test/Base.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ contract BaseTest is Test {
registry.registerModule(differentResolverUID, address(module3), "", "");

AttestationRequest memory req = AttestationRequest({
moduleAddr: address(module1),
moduleAddress: address(module1),
expirationTime: uint48(block.timestamp + 100_000),
data: "0x",
moduleTypes: new ModuleType[](0)
Expand Down
4 changes: 2 additions & 2 deletions test/Factory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ contract FactoryTest is BaseTest {
bytes32 salt = 0x05a40beaf368eb6b2bc5665901a885c044c19346fc828ba80a35fe4cc30d0000;

vm.startPrank(address(0x05a40beAF368EB6b2bc5665901a885C044C19346));
address moduleAddr = registry.calcModuleAddress(salt, type(MockModuleFoo).creationCode);
address moduleAddress = registry.calcModuleAddress(salt, type(MockModuleFoo).creationCode);

address deployedAddr = registry.deployModule(salt, defaultResolverUID, type(MockModuleFoo).creationCode, "", "");
vm.stopPrank();
assertTrue(moduleAddr == deployedAddr);
assertTrue(moduleAddress == deployedAddr);
}
}
8 changes: 4 additions & 4 deletions test/ModuleRegistration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ contract ModuleRegistrationTest is BaseTest {

bytes memory bytecode = type(MockModule).creationCode;

address moduleAddr = registry.deployModule(salt, defaultResolverUID, bytecode, "", "");
ModuleRecord memory record = registry.findModule(moduleAddr);
address moduleAddress = registry.deployModule(salt, defaultResolverUID, bytecode, "", "");
ModuleRecord memory record = registry.findModule(moduleAddress);
assertTrue(record.resolverUID == defaultResolverUID);
}

Expand All @@ -33,10 +33,10 @@ contract ModuleRegistrationTest is BaseTest {
bytes memory bytecode = type(MockModuleWithArgs).creationCode;
bytes memory initCode = abi.encodePacked(bytecode, abi.encode(313_131));

address moduleAddr = registry.deployModule(salt, defaultResolverUID, initCode, "", "");
address moduleAddress = registry.deployModule(salt, defaultResolverUID, initCode, "", "");

address moduleAddrCalc = registry.calcModuleAddress(salt, initCode);
assertTrue(moduleAddr == moduleAddrCalc);
assertTrue(moduleAddress == moduleAddrCalc);
}

function test_WhenRegisteringAModuleOnAnInvalidResolverUID() external prankWithAccount(moduleDev1) {
Expand Down
17 changes: 12 additions & 5 deletions test/invariance/Handler.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,18 @@ contract Handler is CommonBase, StdCheats, StdUtils {
SchemaRecord memory record = REGISTRY.findSchema(uid);
}

function handle_registerModule(uint256 randomResolverNr, address moduleAddr, bytes calldata bytecode, bytes calldata metadata) public {
vm.etch(moduleAddr, bytecode);
function handle_registerModule(
uint256 randomResolverNr,
address moduleAddress,
bytes calldata bytecode,
bytes calldata metadata
)
public
{
vm.etch(moduleAddress, bytecode);
ResolverUID uid = _pickRandomResolverUID(randomResolverNr);

REGISTRY.registerModule(uid, moduleAddr, metadata, "");
REGISTRY.registerModule(uid, moduleAddress, metadata, "");
}

function _pickTypes() private pure returns (ModuleType[] memory ret) {
Expand All @@ -88,7 +95,7 @@ contract Handler is CommonBase, StdCheats, StdUtils {
bound(request.expirationTime, block.timestamp + 1, type(uint48).max);
request.moduleTypes = _pickTypes();

handle_registerModule(randResolve, request.moduleAddr, bytecode, metadata);
handle_registerModule(randResolve, request.moduleAddress, bytecode, metadata);
SchemaUID uid = _pickRandomSchemaUID(randomSchemaUID);

REGISTRY.attest(uid, request);
Expand All @@ -106,7 +113,7 @@ contract Handler is CommonBase, StdCheats, StdUtils {
// for (uint256 i = 0; i < requests.length; i++) {
// bound(requests[i].expirationTime, block.timestamp + 1, type(uint48).max);
// requests[i].moduleTypes = _pickTypes();
// handle_registerModule(randResolve, requests[i].moduleAddr, bytecode, metadata);
// handle_registerModule(randResolve, requests[i].moduleAddress, bytecode, metadata);
// }
//
SchemaUID uid = _pickRandomSchemaUID(randomSchemaUID);
Expand Down
2 changes: 1 addition & 1 deletion test/invariance/invariant_ImmutableData.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ contract ImmutableData is BaseTest {
function invariant_attestation_immutable() public {
AttestationRecord memory record = registry.findAttestation(address(module1), invarAttester.addr);
assertTrue(record.dataPointer == defaultDataRef);
assertEq(record.moduleAddr, address(module1));
assertEq(record.moduleAddress, address(module1));
assertEq(record.attester, invarAttester.addr);
assertTrue(record.attester != address(0));
}
Expand Down

0 comments on commit 10c3719

Please sign in to comment.