Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 14 additions & 28 deletions src/modules/quotes/quotes.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class QuotesService {
} = options;

const isEIP712SupportedMeeVersion = this.isVersionConsistentAndAboveTarget(
"2.2.0",
"2.2.1",
meeVersions,
);

Expand Down Expand Up @@ -677,7 +677,7 @@ export class QuotesService {
} = options;

const isEIP712SupportedMeeVersion = this.isVersionConsistentAndAboveTarget(
"2.2.0",
"2.2.1",
meeVersions,
);
const isStxValidatorSupportedMeeVersion =
Expand Down Expand Up @@ -894,32 +894,18 @@ export class QuotesService {
case "simple": {
if (isSessionExists) {
if (isEIP712SupportedMeeVersion) {
signature = concatHex([
signatureType, // Simple signature type
encodeAbiParameters(
[
{ type: "bytes32" }, // stxStructTypeHash
{ type: "uint256" }, // userOp index
{ type: "bytes32[]" }, // meeUserOpHashes - array of hashes
{ type: "bytes" }, // superTxSignature
],
[
SUPERTX_MEEUSEROP_STRUCT_TYPEHASH,
// For trusted sponsorship, as we're ignoring the payment userOp, index should be sub by 1 to account for that
// The index will be always greater than 1 if its sponsorship mode so sub by 1 is not a problem
isEIP712TrustedSponsorshipSupported &&
isTrustedSponsorship
? BigInt(index - 1)
: BigInt(index),
// If it is a trusted sponsorship, the payment userop can be skipped because it is not going to be executed at all.
isEIP712TrustedSponsorshipSupported &&
isTrustedSponsorship
? meeUserOpHashes.slice(1)
: meeUserOpHashes,
signatureData,
],
),
]);
// Smart sessions with MEE >= 2.2.1: use raw ECDSA signature (no MEE prefix).
// This routes through NoMeeFlowLib.validateSignatureForOwner on-chain,
// which does plain ECDSA recovery against the raw userOpHash.
//
// We cannot use the MEE simple mode (0x177eee00) because:
// - SmartSession calls K1MeeValidator.validateSignatureWithData externally
// - compareAndGetFinalHash calls hashTypedDataForAccount(msg.sender, ...)
// - msg.sender is SmartSession's address, not the account
// - SmartSession doesn't implement eip712Domain() → reverts
//
// Session expiry is handled by SmartSession's own policies.
signature = signatureData;
} else {
signature = concatHex([
signatureType,
Expand Down
1 change: 0 additions & 1 deletion src/modules/quotes/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const meeVersionSchema = z.enum([
"3.0.0",
"2.3.0",
"2.2.1",
"2.2.0",
"2.1.0",
"2.0.0",
"1.1.0",
Expand Down
23 changes: 4 additions & 19 deletions src/modules/simulator/simulation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,9 @@ export class SimulationService {
"0xcae0d1955b99d4832aef73ed0a2237045fad91a738ee5b96ba76b9a12ffc6f824ab2ecaeeeb903b50704fdf4a5d64216adf7d6aaaca0ed2a67b86d8525c4b4bb1c" as Hex;

if (sessionInfo?.sessionDetails) {
const dummySignature = concatHex([
"0x177eee00", // Simple signature type
encodeAbiParameters(
[
{ type: "bytes32" }, // stxStructTypeHash
{ type: "uint256" }, // userOp index
{ type: "bytes32[]" }, // meeUserOpHashes - array of hashes
{ type: "bytes" }, // superTxSignature
],
[
SUPERTX_MEEUSEROP_STRUCT_TYPEHASH,
BigInt(index),
// If it is a trusted sponsorship, the payment userop can be skipped because it is not going to be executed at all.
isTrustedSponsorship ? meeUserOpHashes.slice(1) : meeUserOpHashes,
dummyStxSig,
],
),
]);
// Smart sessions with MEE >= 2.2.1: use raw ECDSA signature (no MEE prefix).
// Routes through NoMeeFlowLib.validateSignatureForOwner on-chain.
const dummySignature = dummyStxSig;

const dummySessionDetails: GrantPermissionResponseType = {
...sessionInfo?.sessionDetails,
Expand Down Expand Up @@ -635,7 +620,7 @@ export class SimulationService {
let meeVersion: MeeVersionsType = "2.0.0";

// From this version, the EIP712 signatures are being supported and the dummy signature needs to be different here
const eip712SignatureVersionTarget: MeeVersionsType = "2.2.0";
const eip712SignatureVersionTarget: MeeVersionsType = "2.2.1";

if (meeVersionInfo) {
meeVersion = meeVersionInfo.version.version;
Expand Down
4 changes: 2 additions & 2 deletions src/modules/user-ops/userop.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,14 +458,14 @@ export class UserOpService {
let meeUserOpHash: Hex;

if (isEIP712SupportedMeeVersion && isSimpleMode) {
// If the meeVersion >= 2.2.0, V2 meeUserOp hash will be generated for simple mode
// If the meeVersion >= 2.2.1, V2 meeUserOp hash will be generated for simple mode
meeUserOpHash = getMeeUserOpHashEip712(
userOpHash,
lowerBoundTimestamp,
upperBoundTimestamp,
);
} else {
// If the meeVersion is less than 2.2.0, legacy meeUserOp hash will be generated
// If the meeVersion is less than 2.2.1, legacy meeUserOp hash will be generated
meeUserOpHash = getMeeUserOpHash(
userOpHash,
lowerBoundTimestamp,
Expand Down
Loading