Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
38 changes: 12 additions & 26 deletions src/modules/quotes/quotes.service.ts
Original file line number Diff line number Diff line change
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.0: use raw ECDSA signature (no MEE prefix).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be after 2.2.1, please update the comments here

// 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
21 changes: 3 additions & 18 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.0: use raw ECDSA signature (no MEE prefix).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

// Routes through NoMeeFlowLib.validateSignatureForOwner on-chain.
const dummySignature = dummyStxSig;

const dummySessionDetails: GrantPermissionResponseType = {
...sessionInfo?.sessionDetails,
Expand Down
Loading