Skip to content

Commit

Permalink
forge fmt / linter
Browse files Browse the repository at this point in the history
  • Loading branch information
thogard785 committed Nov 19, 2023
1 parent bd0499a commit 8d7a5dc
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/contracts/atlas/Atlas.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ contract Atlas is Escrow {
// replay attacks.
ValidCallsResult validCallsResult;
(solverOps, validCallsResult) = IAtlasVerification(VERIFICATION).validCalls(
dConfig, userOp, solverOps, dAppOp, executionEnvironment, msg.value, msg.sender, msg.sender == SIMULATOR);
dConfig, userOp, solverOps, dAppOp, executionEnvironment, msg.value, msg.sender, msg.sender == SIMULATOR
);
if (validCallsResult != ValidCallsResult.Valid) {
if (msg.sender == SIMULATOR) revert VerificationSimFail();
else revert ValidCalls(validCallsResult);
Expand Down
41 changes: 32 additions & 9 deletions src/contracts/atlas/AtlasVerification.sol
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ contract AtlasVerification is EIP712, DAppIntegration {

// verify user signature
if (!_verifyUser(dConfig, userOp, msgSender, isSimulation)) {
return (prunedSolverOps, ValidCallsResult.UserSignatureInvalid);
return (prunedSolverOps, ValidCallsResult.UserSignatureInvalid);
}

// verify the callchainhash if required by protocol
Expand All @@ -124,7 +124,6 @@ contract AtlasVerification is EIP712, DAppIntegration {
// check dapp signature
if (!_verifyDApp(dConfig, dAppOp, msgSender, isSimulation)) {
return (prunedSolverOps, ValidCallsResult.DAppSignatureInvalid);

}

// check user signature
Expand Down Expand Up @@ -208,7 +207,9 @@ contract AtlasVerification is EIP712, DAppIntegration {

// If all initial checks succeed, add solver op to new array
prunedSolverOps[i] = solverOp;
unchecked{ ++validSolverCount; }
unchecked {
++validSolverCount;
}
}
}

Expand Down Expand Up @@ -254,7 +255,6 @@ contract AtlasVerification is EIP712, DAppIntegration {
);
}


//
// DAPP VERIFICATION
//
Expand All @@ -267,7 +267,15 @@ contract AtlasVerification is EIP712, DAppIntegration {
// the supply chain to submit data. If any other party
// (user, solver, FastLane, or a collusion between
// all of them) attempts to alter it, this check will fail
function _verifyDApp(DAppConfig memory dConfig, DAppOperation calldata dAppOp, address msgSender, bool isSimulation) internal returns (bool) {
function _verifyDApp(
DAppConfig memory dConfig,
DAppOperation calldata dAppOp,
address msgSender,
bool isSimulation
)
internal
returns (bool)
{
// Verify the signature before storing any data to avoid
// spoof transactions clogging up dapp nonces

Expand Down Expand Up @@ -295,7 +303,6 @@ contract AtlasVerification is EIP712, DAppIntegration {

// Make sure the signer is currently enabled by dapp owner
if (!signatories[keccak256(abi.encode(govData.governance, dAppOp.from))]) {

bool bypassSignatoryCheck = isSimulation && dAppOp.from == address(0);
if (!bypassSignatoryCheck) {
return (false);
Expand Down Expand Up @@ -326,7 +333,15 @@ contract AtlasVerification is EIP712, DAppIntegration {
return (true);
}

function _handleNonces(address account, uint256 nonce, bool async, bool isSimulation) internal returns (bool validNonce) {
function _handleNonces(
address account,
uint256 nonce,
bool async,
bool isSimulation
)
internal
returns (bool validNonce)
{
if (nonce > type(uint128).max - 1) {
return false;
}
Expand All @@ -347,7 +362,7 @@ contract AtlasVerification is EIP712, DAppIntegration {
if (bitmap & (1 << bitmapNonce) != 0) {
return false;
}

if (isSimulation) {
// return early if simulation to avoid storing nonce updates
return true;
Expand Down Expand Up @@ -456,7 +471,15 @@ contract AtlasVerification is EIP712, DAppIntegration {
//

// Verify the user's meta transaction
function _verifyUser(DAppConfig memory dConfig, UserOperation calldata userOp, address msgSender, bool isSimulation) internal returns (bool) {
function _verifyUser(
DAppConfig memory dConfig,
UserOperation calldata userOp,
address msgSender,
bool isSimulation
)
internal
returns (bool)
{
// Verify the signature before storing any data to avoid
// spoof transactions clogging up dapp userNonces

Expand Down
1 change: 0 additions & 1 deletion src/contracts/interfaces/IAtlasVerification.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import "../types/EscrowTypes.sol";
import "../types/ValidCallsTypes.sol";

interface IAtlasVerification {

function validCalls(
DAppConfig calldata dConfig,
UserOperation calldata userOp,
Expand Down

0 comments on commit 8d7a5dc

Please sign in to comment.