-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: surface descriptive session key errors (#718)
The session key plugin throws opaque errors when permission checks fail. Surface better errors in the SDK after a validation failure by using state overrides to replace the session key code with a version that produces descriptive errors.
- Loading branch information
1 parent
2bbf359
commit 593e84c
Showing
10 changed files
with
98 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
account-kit/smart-contracts/src/msca/plugins/session-key/debug-session-key-bytecode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* Bytecode for a modified debug-version of the Session Key Plugin, to be used | ||
* in state overrides to produce more descriptive errors on permission failures. | ||
* | ||
* Compiled from | ||
* https://github.com/alchemyplatform/modular-account/tree/ed36ad6483ef06b61e7c096a6615b318c47379be | ||
*/ | ||
export const DEBUG_SESSION_KEY_BYTECODE = | ||
"0x6040608081526004908136101561001557600080fd5b6000803560e01c806331d99c2c146100975763af8734831461003657600080fd5b34610090576003196060368201126100935783359160ff83168303610090576024359167ffffffffffffffff831161009357610160908336030112610090575092610089916020946044359201906106ed565b9051908152f35b80fd5b5080fd5b50823461009357826003193601126100935767ffffffffffffffff81358181116105255736602382011215610525578083013590828211610521576024926024820191602436918560051b01011161051d576001600160a01b0394602435868116810361051957604080516080810182526060808252336020830190815263068076b960e21b938301939093526001600160a01b039093169083015220548761016f8233606091826040516001600160a01b03602082019460808301604052838352168452630b5ff94b60e11b604082015201522090565b91895b87811061045d57505060ff825460781c16156103ef575b5080549060ff8260801c166103b6575b50506101a88497959894610584565b956101b58551978861054c565b8787526101c188610584565b98602098601f19809b01885b8181106103a7575050875b818110610256575050505050505080519380850191818652845180935281818701918460051b880101950193965b8388106102135786860387f35b9091929394838080600193603f198b820301875285601f8b5161024181518092818752878088019101610529565b01160101970193019701969093929193610206565b6102668183899e9b9d9a9e61059c565b803585811680910361039557908c8a928f898e610285838701876105d9565b9790935196879586947f38997b1100000000000000000000000000000000000000000000000000000000865285015201358a83015260606044830152866064830152866084938484013784838884010152601f80970116810103018183335af191821561039d578d9261031a575b505090600191610303828d610628565b5261030e818c610628565b50019a9699979a6101d8565b9091503d808e843e61032c818461054c565b8201918a818403126103915780519089821161039957019081018213156103955790818e92519161036861035f8461060c565b9451948561054c565b8284528b8383010111610391578291610389918c8060019796019101610529565b90918e6102f3565b8d80fd5b8c80fd5b8e80fd5b8e513d8f823e3d90fd5b60608b82018d01528b016101cd565b70ff00000000000000000000000000000000199091168155600101805465ffffffffffff19164265ffffffffffff161790558880610199565b6104029060068301906002840190611191565b1561040d5789610189565b610459828a5191829162461bcd60e51b8352820160609060208152601460208201527f5370656e64206c696d697420657863656564656400000000000000000000000060408201520190565b0390fd5b6104713661046c838b8b61059c565b610673565b926104826020918286015190611042565b938d6104928d83511686336110b0565b9160ff835460101c166104ac575b50505050600101610172565b6104ca92916104bc910151611146565b600160028301920190611191565b156104d757808d816104a0565b85601a8b8f93606494519362461bcd60e51b85528401528201527f4552433230207370656e64206c696d69742065786365656465640000000000006044820152fd5b8780fd5b8580fd5b8480fd5b8380fd5b60005b83811061053c5750506000910152565b818101518382015260200161052c565b90601f8019910116810190811067ffffffffffffffff82111761056e57604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff811161056e5760051b60200190565b91908110156105c35760051b81013590605e19813603018212156105be570190565b600080fd5b634e487b7160e01b600052603260045260246000fd5b903590601e19813603018212156105be570180359067ffffffffffffffff82116105be576020019181360383136105be57565b67ffffffffffffffff811161056e57601f01601f191660200190565b80518210156105c35760209160051b010190565b9291926106488261060c565b91610656604051938461054c565b8294818452818301116105be578281602093846000960137010152565b91906060838203126105be576040519067ffffffffffffffff606083018181118482101761056e57604052829480356001600160a01b03811681036105be5784526020810135602085015260408101359182116105be570181601f820112156105be576040918160206106e89335910161063c565b910152565b60ff161561073957606460405162461bcd60e51b815260206004820152602060248201527f57726f6e672066756e6374696f6e20696420666f722076616c69646174696f6e6044820152fd5b61074660608201826105d9565b806004949294116105be57830192604081850360031901126105be5767ffffffffffffffff9360048201358581116105be57820194816023870112156105be5760048601359561079587610584565b966107a3604051988961054c565b8088526024602089019160051b830101928484116105be5760248301915b84831061101b5750505050505060240135906001600160a01b03821682036105be577f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52610830603c60002061082a6108236101408601866105d9565b369161063c565b90611065565b600581101561100557610f9c5760806040513381527ff938c976000000000000000000000000000000000000000000000000000000006020820152600160408201526bffffffffffffffffffffffff198460601b166060820152205415610f5857604080516080810182526060808252336020830190815263068076b960e21b938301939093526001600160a01b03851691810191909152902054926109058433606091826040516001600160a01b03602082019460808301604052838352168452630b5ff94b60e11b604082015201522090565b9081549465ffffffffffff8660081c16966000918151918215610f145760005b838110610ed2575050505060ff8660781c1615610d50575b5060ff8560701c16610aa8575b60ff825460681c166109db575b50506001600160a01b039182169116036109a85765ffffffffffff60a01b7fffffffffffff00000000000000000000000000000000000000000000000000006000935b60d01b169160681b16171790565b65ffffffffffff60a01b7fffffffffffff000000000000000000000000000000000000000000000000000060019361099a565b806101206109ea9201906105d9565b6bffffffffffffffffffffffff199135918216929160148210610a6c575b505060036001600160a01b03910154169060601c03610a28573880610957565b606460405162461bcd60e51b815260206004820152601b60248201527f4d75737420757365207265717569726564207061796d617374657200000000006044820152fd5b6001600160a01b03929350906003916bffffffffffffffffffffffff19916bffffffffffffffffffffffff1990601403841b1b16169291610a08565b946001600160a01b038416602087013560401c03610cc057610ace6101208701876105d9565b159050610cab57610b11610b06610afb610af160ff60035b1660a08b013561109d565b60808a0135611042565b60c089013590611042565b60e08801359061109d565b9060009060018401546005850154906004860154908583810110610c675765ffffffffffff8160301c1615600014610ba6575081850111610b6157610b5b9301600585015561154f565b9461094a565b60405162461bcd60e51b815260206004820152601260248201527f476173206c696d697420657863656564656400000000000000000000000000006044820152606490fd5b92935093848282011115600014610bf657610b5b945001600585015560ff8760801c16600014610bee578065ffffffffffff80610be89360301c169116611177565b9061154f565b506000610be8565b809392949150111580610c59575b15610b6157610c248365ffffffffffff80610b5b9660301c169116611177565b9170010000000000000000000000000000000070ff00000000000000000000000000000000198916178555600585015561154f565b5060ff8760801c1615610c04565b606460405162461bcd60e51b815260206004820152601260248201527f476173206c696d6974206f766572666c6f7700000000000000000000000000006044820152fd5b610b11610b06610afb610af160ff6001610ae6565b60a460405162461bcd60e51b815260206004820152604f60248201527f4d757374207573652073657373696f6e206b6579206173206b657920706f727460448201527f696f6e206f66206e6f6e6365207768656e20676173206c696d6974206368656360648201527f6b696e6720697320656e61626c656400000000000000000000000000000000006084820152fd5b6000969196906002840154906007850154906006860154928183810110610e8e5765ffffffffffff8160301c1615600014610de157500111610d9c57610d959161154f565b943861093d565b60405162461bcd60e51b815260206004820152601460248201527f5370656e64206c696d69742065786365656465640000000000000000000000006044820152606490fd5b94928092820111610df9575b5050610d95925061154f565b91925010610e2457610e1c8265ffffffffffff80610d959560301c169116611177565b903880610ded565b608460405162461bcd60e51b815260206004820152603260248201527f5370656e64206c696d69742065786365656465642c206576656e20696e636c7560448201527f64696e67206e65787420696e74657276616c00000000000000000000000000006064820152fd5b606460405162461bcd60e51b815260206004820152601460248201527f5370656e64206c696d6974206f766572666c6f770000000000000000000000006044820152fd5b80610f0e8b610ef3610ee660019587610628565b519860208a015190611042565b978660ff60406001600160a01b0384511693015193166112bf565b01610925565b606460405162461bcd60e51b815260206004820152601b60248201527f4d7573742068617665206174206c65617374206f6e652063616c6c00000000006044820152fd5b606460405162461bcd60e51b815260206004820152601360248201527f556e6b6e6f776e2073657373696f6e206b6579000000000000000000000000006044820152fd5b608460405162461bcd60e51b8152602060048201526024808201527f5369676e617475726520646f6573206e6f74206d617463682073657373696f6e60448201527f206b6579000000000000000000000000000000000000000000000000000000006064820152fd5b634e487b7160e01b600052602160045260246000fd5b82358281116105be576020916110378860248594890101610673565b8152019201916107c1565b9190820180921161104f57565b634e487b7160e01b600052601160045260246000fd5b9060418151146000146110935761108f916020820151906060604084015193015160001a90611230565b9091565b5050600090600290565b8181029291811591840414171561104f57565b9061111192916040519260a08401604052608084526001600160a01b0380921660208501527f634c29f50000000000000000000000000000000000000000000000000000000060408501521690606083015260808201526020815191012090565b90565b90602082519201516001600160e01b031990818116936004811061113757505050565b60040360031b82901b16169150565b61115761115282611114565b61156c565b6111615750600090565b6044815110611171576044015190565b50600090565b91909165ffffffffffff8080941691160191821161104f57565b9181549165ffffffffffff90818460301c169160018454940194855493828115928315611218575b5050506000146111ee57505083019283109081156111e4575b506111dd5755600190565b5050600090565b90508211386111d2565b9391509391821161120f5755421665ffffffffffff19825416179055600190565b50505050600090565b611223935016611177565b81429116113882816111b9565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116112b35791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156112a65781516001600160a01b038116156112a0579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600390565b91926112ca90611114565b926112d68183336110b0565b926003811015611005578061147d5750825460ff8116156114395760081c60ff1615611433578361130a9160ff93336115cb565b5416156113c95760ff905b5460101c1690816113b8575b5061132857565b60a460405162461bcd60e51b815260206004820152604460248201527f46756e6374696f6e2073656c6563746f72206e6f7420616c6c6f77656420666f60448201527f7220455243323020636f6e74726163742077697468207370656e64696e67206c60648201527f696d6974000000000000000000000000000000000000000000000000000000006084820152fd5b6113c2915061156c565b1538611321565b608460405162461bcd60e51b815260206004820152602260248201527f46756e6374696f6e2073656c6563746f72206e6f74206f6e20616c6c6f776c6960448201527f73740000000000000000000000000000000000000000000000000000000000006064820152fd5b50505050565b606460405162461bcd60e51b815260206004820152601f60248201527f5461726765742061646472657373206e6f74206f6e20616c6c6f776c697374006044820152fd5b60011461148f575b505060ff90611315565b825460ff8116156115485760081c60ff161561150457836114b39160ff93336115cb565b54166114c0573880611485565b606460405162461bcd60e51b815260206004820152601d60248201527f46756e6374696f6e2073656c6563746f72206f6e2064656e796c6973740000006044820152fd5b606460405162461bcd60e51b815260206004820152601a60248201527f5461726765742061646472657373206f6e2064656e796c6973740000000000006044820152fd5b5050505050565b9065ffffffffffff8082169083161115611567575090565b905090565b6001600160e01b0319167fa9059cbb0000000000000000000000000000000000000000000000000000000081149081156115a4575090565b7f095ea7b30000000000000000000000000000000000000000000000000000000091501490565b926001600160e01b0319611111946040519460a08601604052608086526001600160a01b0380921660208701527fd50536f0000000000000000000000000000000000000000000000000000000006040870152169116179060608301526080820152602081519101209056fea26469706673582212201c78177154c86c4d5ed4f532b4017a1d665037d4831a7cd69e8e8bd8408ab3e764736f6c63430008160033"; |
Oops, something went wrong.