1"use strict";(self.webpackChunkaxir_wallet=self.webpackChunkaxir_wallet||[]).push([[5213],{5956:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>h,frontMatter:()=>r,metadata:()=>c,toc:()=>d});var s=i(4848),t=i(8453);const r={sidebar_position:2},a=void 0,c={id:"Account Abstraction/User Op",title:"User Op",description:"UserOperation (UserOp) Structure",source:"@site/docs/Account Abstraction/User Op.md",sourceDirName:"Account Abstraction",slug:"/Account Abstraction/User Op",permalink:"/Account Abstraction/User Op",draft:!1,unlisted:!1,editUrl:"https://github.com/chiranjeev13/axir-docs/tree/main/docs/Account Abstraction/User Op.md",tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Entrypoint",permalink:"/Account Abstraction/Entrypoint"},next:{title:"Bundler",permalink:"/Account Abstraction/bundler-in-account-abstraction"}},o={},d=[{value:"UserOperation (UserOp) Structure",id:"useroperation-userop-structure",level:3},{value:"Differences between UserOp v6 and PackedUserOp v7",id:"differences-between-userop-v6-and-packeduserop-v7",level:3},{value:"PackedUserOp v7 Structure",id:"packeduserop-v7-structure",level:3},{value:"Key Improvements in v7",id:"key-improvements-in-v7",level:3}];function l(e){const n={admonition:"admonition",code:"code",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,t.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h3,{id:"useroperation-userop-structure",children:"UserOperation (UserOp) Structure"}),"\n",(0,s.jsx)(n.p,{children:"The UserOperation struct is a fundamental component of the Account Abstraction system. Here's the detailed structure with explanations:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"struct UserOperation {\n address sender; // The account making the operation\n uint256 nonce; // Anti-replay parameter\n bytes initCode; // Code to create new account (empty for existing)\n bytes callData; // The data to pass to the sender during execution\n uint256 callGasLimit; // Gas limit for the main execution call\n uint256 verificationGasLimit; // Gas limit for the verification step\n uint256 preVerificationGas; // Extra gas to pay the bundler\n uint256 maxFeePerGas; // Maximum fee per gas (similar to EIP-1559)\n uint256 maxPriorityFeePerGas; // Maximum priority fee per gas\n bytes paymasterAndData; // Paymaster address and data (if used)\n bytes signature; // Data to verify authorization\n}\n"})}),"\n",(0,s.jsx)(n.h3,{id:"differences-between-userop-v6-and-packeduserop-v7",children:"Differences between UserOp v6 and PackedUserOp v7"}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Structure and Packing"}),":"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"v6 UserOp: Used the full structure as shown above."}),"\n",(0,s.jsx)(n.li,{children:"v7 PackedUserOp: Introduces a more gas-efficient packed version for on-chain use."}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Field Consolidation in v7"}),":"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"initCode"}),": Combines ",(0,s.jsx)(n.code,{children:"factory"})," and ",(0,s.jsx)(n.code,{children:"factoryData"})," into a single ",(0,s.jsx)(n.code,{children:"bytes"})," field."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"accountGasLimits"}),": Packs ",(0,s.jsx)(n.code,{children:"verificationGasLimit"})," and ",(0,s.jsx)(n.code,{children:"callGasLimit"})," into a single ",(0,s.jsx)(n.code,{children:"bytes32"}),"."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"gasFees"}),": Combines ",(0,s.jsx)(n.code,{children:"maxPriorityFeePerGas"})," and ",(0,s.jsx)(n.code,{children:"maxFeePerGas"})," into a single ",(0,s.jsx)(n.code,{children:"bytes32"}),"."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"paymasterAndData"}),": Consolidates all paymaster-related fields."]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Paymaster Handling"}),":"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"v6: Separate fields for paymaster address and data."}),"\n",(0,s.jsxs)(n.li,{children:["v7: Combines paymaster information into ",(0,s.jsx)(n.code,{children:"paymasterAndData"}),"."]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Gas Limit Representation"}),":"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["v6: Separate ",(0,s.jsx)(n.code,{children:"uint256"})," fields for different gas limits."]}),"\n",(0,s.jsxs)(n.li,{children:["v7: Uses packed ",(0,s.jsx)(n.code,{children:"bytes32"}
1)," for gas limits, improving gas efficiency."]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Nonce Management"}),":"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"v6: Basic nonce field."}),"\n",(0,s.jsx)(n.li,{children:"v7: May include improvements in nonce handling (though not explicitly changed in the struct) may Add validator to be used as a key."}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Signature Field"}),":"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"Remains similar in both versions, but v7 might have enhanced security considerations."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.h3,{id:"packeduserop-v7-structure",children:"PackedUserOp v7 Structure"}),"\n",(0,s.jsx)(n.p,{children:"Here's a representation of how the PackedUserOp in v7 might look:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"struct PackedUserOperation {\n address sender;\n uint256 nonce;\n bytes initCode;\n bytes callData;\n bytes32 accountGasLimits; // Packed verificationGasLimit and callGasLimit\n uint256 preVerificationGas;\n bytes32 gasFees; // Packed maxPriorityFeePerGas and maxFeePerGas\n bytes paymasterAndData;\n bytes signature;\n}\n"})}),"\n",(0,s.jsx)(n.h3,{id:"key-improvements-in-v7",children:"Key Improvements in v7"}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Gas Efficiency"}),": The packed structure in v7 reduces the gas cost for storing and processing UserOperations on-chain."]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Simplified On-Chain Handling"}),": By consolidating fields, v7 simplifies the process of unpacking and using the data within smart contracts."]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Flexibility"}),": The packed format allows for easier future extensions without changing the core structure."]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Optimized Storage"}),": Reduces the storage footprint of UserOperations in contract memory and storage."]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"These changes in v7 reflect a focus on optimizing gas usage and improving the overall efficiency of the Account Abstraction system, while maintaining the core functionality established in v6."}),"\n",(0,s.jsx)(n.admonition,{title:"INFO",type:"info",children:(0,s.jsxs)(n.p,{children:["Refer to ",(0,s.jsx)("a",{href:"https://eips.ethereum.org/EIPS/eip-4337",target:"/",children:"EIP 4337 Using Alt Mempool"})," for better Understanding"]})})]})}function h(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}},8453:(e,n,i)=>{i.d(n,{R:()=>a,x:()=>c});var s=i(6540);const t={},r=s.createContext(t);function a(e){const n=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:a(e.components),s.createElement(r.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.