Skip to content

Commit

Permalink
feat: Migrate to solidity 0.8.23
Browse files Browse the repository at this point in the history
  • Loading branch information
ankurdubey521 committed Dec 26, 2023
1 parent 1833664 commit 5b93e4f
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/registry"]
path = lib/registry
url = https://github.com/rhinestonewtf/registry
21 changes: 12 additions & 9 deletions contracts/smart-account/modules/MultichainECDSAValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ contract MultichainECDSAValidator is EcdsaOwnershipRegistryModule {

address sender;
// read sender from userOp, which is first userOp member (saves gas)
assembly {
assembly ("memory-safe") {
sender := calldataload(userOp)
}

Expand All @@ -70,16 +70,19 @@ contract MultichainECDSAValidator is EcdsaOwnershipRegistryModule {
moduleSignature,
(uint48, uint48, bytes32, bytes32[], bytes)
);
{
// make a leaf out of userOpHash, validUntil and validAfter
bytes32 leaf = keccak256(
abi.encodePacked(validUntil, validAfter, userOpHash)
);

// make a leaf out of userOpHash, validUntil and validAfter
bytes32 leaf = keccak256(
abi.encodePacked(validUntil, validAfter, userOpHash)
);

if (!MerkleProof.verify(merkleProof, merkleTreeRoot, leaf)) {
revert("Invalid UserOp");
if (!MerkleProof.verify(merkleProof, merkleTreeRoot, leaf)) {
revert("Invalid UserOp");
}
}

validUntil = validUntil == 0 ? type(uint48).max : validUntil;

return
_verifySignature(
merkleTreeRoot,
Expand All @@ -88,7 +91,7 @@ contract MultichainECDSAValidator is EcdsaOwnershipRegistryModule {
)
? _packValidationData(
false, //sigVerificationFailed = false
validUntil == 0 ? type(uint48).max : validUntil,
validUntil,
validAfter
)
: SIG_VALIDATION_FAILED;
Expand Down
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ remappings = [
via_ir = true
evm_version = "paris"
auto_detect_solc = true
# auto_detect_remappings = false

# See more config options https://github.com/foundry-rs/foundry/tree/master/config

Expand Down
1 change: 1 addition & 0 deletions lib/registry
Submodule registry added at 26e636
4 changes: 3 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ interfaces=contracts/smart-account/interfaces/
libs=contracts/smart-account/libs/
modules=contracts/smart-account/modules/
paymasters=contracts/smart-account/paymasters/
test-contracts=contracts/smart-account/test/
test-contracts=contracts/smart-account/test/

solady/=lib/registry/lib/solady/src
2 changes: 1 addition & 1 deletion test/foundry/base/RhinestoneTestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ contract RhinestoneTestBase is SATestBase, BaseTest {
SATestBase.setUp();
BaseTest.setUp();

vm.label(address(instancel1.registry), "Rhinestone Registry");
vm.label(address(instance.registry), "Rhinestone Registry");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ contract ERC7484SecurityPolicyPluginTest is

// Deploy ERC7484SecurityPolicyPlugin
erc7484SecurityPolicyPlugin = new ERC7484SecurityPolicyPlugin(
instancel1.registry
instance.registry
);

// Enable the Security Policy
Expand Down Expand Up @@ -107,7 +107,7 @@ contract ERC7484SecurityPolicyPluginTest is

// Deploy and register MultichainValidator with registry
validator = MultichainECDSAValidator(
instancel1.deployAndRegister(
instance.deployAndRegister(
defaultResolver,
type(MultichainECDSAValidator).creationCode,
abi.encode(0)
Expand Down Expand Up @@ -162,7 +162,7 @@ contract ERC7484SecurityPolicyPluginTest is
external
{
// Create 3 attestations for the multichain validator module
instancel1.newAttestation(
instance.newDelegatedAttestation(
defaultSchema1,
bob.privateKey,
AttestationRequestData({
Expand All @@ -172,7 +172,7 @@ contract ERC7484SecurityPolicyPluginTest is
value: 0
})
);
instancel1.newAttestation(
instance.newDelegatedAttestation(
defaultSchema1,
charlie.privateKey,
AttestationRequestData({
Expand All @@ -182,7 +182,7 @@ contract ERC7484SecurityPolicyPluginTest is
value: 0
})
);
instancel1.newAttestation(
instance.newDelegatedAttestation(
defaultSchema1,
dan.privateKey,
AttestationRequestData({
Expand Down Expand Up @@ -234,7 +234,7 @@ contract ERC7484SecurityPolicyPluginTest is
vm.stopPrank();

// Create 3 attestations for the multichain validator module
instancel1.newAttestation(
instance.newDelegatedAttestation(
defaultSchema1,
bob.privateKey,
AttestationRequestData({
Expand All @@ -244,7 +244,7 @@ contract ERC7484SecurityPolicyPluginTest is
value: 0
})
);
instancel1.newAttestation(
instance.newDelegatedAttestation(
defaultSchema1,
charlie.privateKey,
AttestationRequestData({
Expand All @@ -254,7 +254,7 @@ contract ERC7484SecurityPolicyPluginTest is
value: 0
})
);
instancel1.newAttestation(
instance.newDelegatedAttestation(
defaultSchema1,
dan.privateKey,
AttestationRequestData({
Expand Down Expand Up @@ -315,7 +315,7 @@ contract ERC7484SecurityPolicyPluginTest is
external
{
// Create 2 attestations for the multichain validator module
instancel1.newAttestation(
instance.newDelegatedAttestation(
defaultSchema1,
bob.privateKey,
AttestationRequestData({
Expand All @@ -325,7 +325,7 @@ contract ERC7484SecurityPolicyPluginTest is
value: 0
})
);
instancel1.newAttestation(
instance.newDelegatedAttestation(
defaultSchema1,
charlie.privateKey,
AttestationRequestData({
Expand Down Expand Up @@ -381,7 +381,7 @@ contract ERC7484SecurityPolicyPluginTest is
external
{
// Create 3 attestations for the multichain validator module
instancel1.newAttestation(
instance.newDelegatedAttestation(
defaultSchema1,
bob.privateKey,
AttestationRequestData({
Expand All @@ -391,7 +391,7 @@ contract ERC7484SecurityPolicyPluginTest is
value: 0
})
);
instancel1.newAttestation(
instance.newDelegatedAttestation(
defaultSchema1,
charlie.privateKey,
AttestationRequestData({
Expand All @@ -401,7 +401,7 @@ contract ERC7484SecurityPolicyPluginTest is
value: 0
})
);
instancel1.newAttestation(
instance.newDelegatedAttestation(
defaultSchema1,
dan.privateKey,
AttestationRequestData({
Expand All @@ -413,7 +413,7 @@ contract ERC7484SecurityPolicyPluginTest is
);

// Revoke one of the attestations
instancel1.revokeAttestation(
instance.delegatedRevokeAttestation(
address(validator),
defaultSchema1,
bob.privateKey
Expand Down

0 comments on commit 5b93e4f

Please sign in to comment.