Skip to content

Conversation

@vnavascues
Copy link
Contributor

@vnavascues vnavascues commented Aug 14, 2025

How To

  1. Install requirements and dependencies:
$ foundryup
$ pnpm install
$ pnpm foundry:update
  1. Set up Anvil fork env vars in .env (defaults below):
ANVIL_PORT=8545
FORK_URL=https://ethereum-rpc.publicnode.com
FORK_BLOCK_NUMBER=-1 # 'latest' is not supported, -1 will useto the latest - 1.
FORK_CHAIN_ID=1
  1. Set up Simulator server (Fastify) env vars in .env (defaults below):
SIM_ENSO_CHECKOUT_PORT=3000
  1. Spin up Anvil & Simulator server (the script below should source the .env):
$ simulator:enso_checkout:start:with_anvil

Or enabling Fastify hot reload (but not Anvil):

$ simulator:enso_checkout:start:dev:with_anvil
  1. Integrator (e.g., Backend) must POST /simulate with a SimulationRequest payload:

NOTE: current commit is mocking SimulationRequest not only for testing purposes but also until we decide how to format handleOpsCalldata and/or handleOps. That choice will determine how we'll execute EntryPoint.handlOps(PackedUserOperation[] memory, address) (e.g., external call, low-level call).

export interface ForgeData {
  profile?: string;
  contract?: string;
  test?: string;
  testRelativePath?: string;
  rpcUrl?: string;
  logFormat?: ForgeTestLogFormat;
  logVerbosity?: ForgeTestLogVerbosity;
  isTxDataLogged?: boolean;
  isTestResultsLogged?: boolean;
}

export interface ShortcutData {
  tokensInFundingRequired: boolean[];
  tokensInTypes: TokenType[];
  tokensIn: AddressArg[];
  amountsIn: string[]; // BigNumberish
  tokensInHolders: AddressArg[];
}

export interface PackedUserOperation {
  sender: AddressArg;
  nonce: HexString;
  initCode: HexString;
  callData: HexString;
  accountGasLimits: HexString;
  preVerificationGas: string; // BigNumberish
  gasFees: HexString;
  paymasterAndData: HexString;
  signature: HexString;
}

export interface HandleOps {
  ops: PackedUserOperation[];
  beneficiary: AddressArg;
}

export interface SimulationRequest {
  [key: string]: any;
  forgeData?: ForgeData;
  shortcutData: ShortcutData;
  backendSigner: AddressArg;
  ensoReceiver: AddressArg; // NOTE: counterfactual
  signaturePaymaster: AddressArg;
  bundler: AddressArg;
  entryPoint: AddressArg;
  // handleOps?: HandleOps; // NOTE: disabled
  handleOpsCalldata: HexString;
}

@vnavascues vnavascues closed this Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants