@invisi-labs/sdk 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sqlite.cjs CHANGED
@@ -973,6 +973,7 @@ var TransactionalWalletStore = class {
973
973
  };
974
974
 
975
975
  // src/session/operation-protocol.ts
976
+ var import_core3 = require("@invisi-labs/core");
976
977
  var import_protocol2 = require("@invisi-labs/protocol");
977
978
  function requiresAuthorization(plan) {
978
979
  if (plan.kind === "sweep") {
@@ -1110,6 +1111,7 @@ async function witnessFor(protocol, plan, authorization) {
1110
1111
  }
1111
1112
  if (credit.draw) {
1112
1113
  return builder.drawCredit({
1114
+ timestamp: plan.preparedAt.timestamp,
1113
1115
  params: credit.draw,
1114
1116
  deliveries: credit.deliveries,
1115
1117
  inputs: credit.inputs,
@@ -1240,12 +1242,836 @@ function operationExpired(plan, now) {
1240
1242
  const credit = plan.credit;
1241
1243
  if (credit?.topUp && now >= credit.topUp.previousExpiry) return true;
1242
1244
  if (credit?.creation && now >= credit.creation.expiry) return true;
1243
- if (credit?.draw && credit.draw.expiries.some((expiry) => now >= expiry)) return true;
1245
+ if (credit?.draw) {
1246
+ if (credit.draw.expiries.some((expiry) => now >= expiry)) return true;
1247
+ const prepared = (0, import_core3.creditPeriods)(plan.preparedAt.timestamp), current2 = (0, import_core3.creditPeriods)(now);
1248
+ if (prepared.currentDay !== current2.currentDay || prepared.currentMonth !== current2.currentMonth)
1249
+ return true;
1250
+ }
1244
1251
  return false;
1245
1252
  }
1246
1253
 
1247
1254
  // src/data/gas-benchmarks.json
1248
1255
  var gas_benchmarks_default = [
1256
+ {
1257
+ formatVersion: 1,
1258
+ id: "protocol-42f2546-621cbef5f84a-prague-credit-real",
1259
+ deployment: {
1260
+ chainId: "31337",
1261
+ protocolAddress: "0xEeD9be753bccbCB21463C49f0c56cC0E48bEcf3c",
1262
+ runtimeCodeHash: "0x80228a2080d224b4481fc5df24fe8ce080d4536c663b13ec7829ecf0ef46abbd",
1263
+ tokenAddress: "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf"
1264
+ },
1265
+ source: {
1266
+ protocolCommit: "42f2546b62312e4c11e21b8e6b2ff6f72187d6a6",
1267
+ measuredAt: "2026-10-29T10:56:24.758Z",
1268
+ chain: "Anvil 31337",
1269
+ hardfork: "prague",
1270
+ token: "MockERC20",
1271
+ verifier: "real",
1272
+ fingerprints: {
1273
+ protocolSourceSha256: "621cbef5f84a133ca96674a2dba39b21b5f9fbc022977d4d2ab296d9d6e685e0",
1274
+ dirtyDiffSha256: "eb2c41cca3802a47196181648397ec6f47fb2ba0efa8aa3800508d8d255fae3f",
1275
+ compiledArtifactsSha256: "c0e658d74fe49caeebf5ef9deadc1751d9e48add690f7e9ab478de7a00dab7e4",
1276
+ creditManifestSha256: "da819378af60471905cc902a43e464b58159e0c75bd46fb804ea9d34d8aa7ef6",
1277
+ userManifestSha256: "067b6c50e4bc4d9c19dd29f25352db88d189a5f49aed0ed603daa70760e699df",
1278
+ sdkSourceSha256: "37e1f82a447db741f46e1490b866ddf85718eab42c33d369cf5f5d2ec3a25c78"
1279
+ },
1280
+ toolchain: {
1281
+ solidity: "0.8.38",
1282
+ barretenberg: "6.0.0",
1283
+ noir: "1.0.0-rc.6",
1284
+ evmVersion: "prague",
1285
+ optimizerRuns: 200,
1286
+ anvil: "anvil Version: 1.8.6"
1287
+ },
1288
+ blockGasLimit: "500000000",
1289
+ runtimeContracts: {
1290
+ transact_user_slots14_direct_Verifier: {
1291
+ address: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
1292
+ runtimeCodeHash: "0xedab185b2b9fc7d98660db2cdc99fe30b9d1341dfe568172a1626e322d208f7e"
1293
+ },
1294
+ "transact_user_slots14-adapter": {
1295
+ address: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
1296
+ runtimeCodeHash: "0xe222cd9c142bc2b13e083e6fe66ea76c0e1e9a194715bfa57082b625c55d867f"
1297
+ },
1298
+ transact_user_slots56_direct_Verifier: {
1299
+ address: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
1300
+ runtimeCodeHash: "0x8913eb7060f38234aca199c4a1007892f68e703de48b588c436b24faaeb23a53"
1301
+ },
1302
+ "transact_user_slots56-adapter": {
1303
+ address: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
1304
+ runtimeCodeHash: "0x97c416d190da0b9b8111a5ee17367e8a702ba7884019bf724155ae629a783477"
1305
+ },
1306
+ transact_user_slots112_direct_Verifier: {
1307
+ address: "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
1308
+ runtimeCodeHash: "0x501a4791ff0c0a96465ab5e0d42d0ce763bbbb7fd8aebe21929de4d460e1b42c"
1309
+ },
1310
+ "transact_user_slots112-adapter": {
1311
+ address: "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
1312
+ runtimeCodeHash: "0xf22ed8ea34a4011650a41c1b9f664b5259ea5a8d66a82d706dab9611a38c109f"
1313
+ },
1314
+ transact_user_slots168_direct_Verifier: {
1315
+ address: "0x0165878A594ca255338adfa4d48449f69242Eb8F",
1316
+ runtimeCodeHash: "0xc22acdfa6f3e278ae46d194a1c50b905e4815fd7b61e39edb52334570670fdce"
1317
+ },
1318
+ "transact_user_slots168-adapter": {
1319
+ address: "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853",
1320
+ runtimeCodeHash: "0x05a318f54d93440a501b6fc6be88e4e76e89d72f1be8333553cb4a61f4f9a0d7"
1321
+ },
1322
+ transact_aggregate_14_4_Verifier: {
1323
+ address: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6",
1324
+ runtimeCodeHash: "0x7a6f2bafe4c61a72a99a195e188f2f4a32900c0cc63cc132e33881d8199fd446"
1325
+ },
1326
+ "transact_aggregate_14_4-adapter": {
1327
+ address: "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318",
1328
+ runtimeCodeHash: "0x15877da9940d5b8dd4868ffa92ded3b93d6092c3963ba9e18b50f1ea15d89898"
1329
+ },
1330
+ transact_aggregate_14_8_Verifier: {
1331
+ address: "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
1332
+ runtimeCodeHash: "0x5667d16b39973813a499375f6885a3082d7bfcd6e3c0f3548d7de3131cd285f3"
1333
+ },
1334
+ "transact_aggregate_14_8-adapter": {
1335
+ address: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
1336
+ runtimeCodeHash: "0x9d1a93c78edf7e81b4b6da10ab209b3fb009ed8355594f670559a67842d88cfc"
1337
+ },
1338
+ transact_aggregate_14_12_Verifier: {
1339
+ address: "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
1340
+ runtimeCodeHash: "0xa4e67840a47182d4011d577981c2477bb4ab2bc36845bb136375f19f12c0800b"
1341
+ },
1342
+ "transact_aggregate_14_12-adapter": {
1343
+ address: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
1344
+ runtimeCodeHash: "0x96a6e170aafc0af9d46232ba00206d950bba85e65962d43501bafb6d7f9fe61d"
1345
+ },
1346
+ create_credit_direct_Verifier: {
1347
+ address: "0x9A676e781A523b5d0C0e43731313A708CB607508",
1348
+ runtimeCodeHash: "0xbdc6450bf9ba01001082f345b8bd21006a4f75274f32d026cf6e14270e6d56e6"
1349
+ },
1350
+ "create_credit-adapter": {
1351
+ address: "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
1352
+ runtimeCodeHash: "0x3a95a22b32aef18ce053a7110056bbfbf13bb0b07932a49765ebb136528a4707"
1353
+ },
1354
+ credit_draw_slots1_direct_Verifier: {
1355
+ address: "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
1356
+ runtimeCodeHash: "0x47be80e72c3a22ea044638f6004de8c3a0264d5a0d17189c01153cdabfd7bab6"
1357
+ },
1358
+ "credit_draw_slots1-adapter": {
1359
+ address: "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
1360
+ runtimeCodeHash: "0x28f25aeb97659fb9253ae67f2ff284789710bc59e1ed077ffc7a07b800cbfcc1"
1361
+ },
1362
+ credit_draw_slots12_direct_Verifier: {
1363
+ address: "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
1364
+ runtimeCodeHash: "0x244d9ba22f5c736c2a5c42c466701e2a8ba7ae8108665133541026ea45d56e04"
1365
+ },
1366
+ "credit_draw_slots12-adapter": {
1367
+ address: "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
1368
+ runtimeCodeHash: "0x60d48a35279d318a0621e5f59b293f44074463b8002ce180b7e6a31b995ac195"
1369
+ },
1370
+ credit_draw_slots50_direct_Verifier: {
1371
+ address: "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d",
1372
+ runtimeCodeHash: "0x2ad5eb64bcfae34ef04111dd8f9c1ffc5fc8aa6c1ad3a65d8da78233f3390660"
1373
+ },
1374
+ "credit_draw_slots50-adapter": {
1375
+ address: "0x59b670e9fA9D0A427751Af201D676719a970857b",
1376
+ runtimeCodeHash: "0x468966de20e5c71cf7b6f3cda7fa7a76b5d80dc5ddf82119f441ea6a7c6c1e70"
1377
+ },
1378
+ credit_draw_slots120_direct_Verifier: {
1379
+ address: "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1",
1380
+ runtimeCodeHash: "0x523b6d211618bbd33d708f8198b9f3daafc10e2fa7a6a857db5795ed748a24e4"
1381
+ },
1382
+ "credit_draw_slots120-adapter": {
1383
+ address: "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44",
1384
+ runtimeCodeHash: "0xa91d585ce6037e703efb914205bf193881fde4f470d2fc63b615699b56175239"
1385
+ },
1386
+ credit_cancel_direct_Verifier: {
1387
+ address: "0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f",
1388
+ runtimeCodeHash: "0x182e86861a73f712071e40a6b8497b80c58c383eaa799182e7a50e39196399fd"
1389
+ },
1390
+ "credit_cancel-adapter": {
1391
+ address: "0x4A679253410272dd5232B3Ff7cF5dbB88f295319",
1392
+ runtimeCodeHash: "0xea1f0f22445eed5a92c8d6990219059b7e241ad66c55a6d9ddef22a94a0f015f"
1393
+ },
1394
+ credit_top_up_direct_Verifier: {
1395
+ address: "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F",
1396
+ runtimeCodeHash: "0xeeb42a2b6377ab305b713d1caf4ca96edb302c6d1e1007239e5c70091819c266"
1397
+ },
1398
+ "credit_top_up-adapter": {
1399
+ address: "0x09635F643e140090A9A8Dcd712eD6285858ceBef",
1400
+ runtimeCodeHash: "0xbcf35a1d0e6c16dd01b09f944889aa5917d358d986fe399a0343d06bbdedaa61"
1401
+ },
1402
+ PrivateTransferVerifierRegistry: {
1403
+ address: "0xc5a5C42992dECbae36851359345FE25997F5C42d",
1404
+ runtimeCodeHash: "0x678684af147cb42c872184b6e22c8439748139ae0c5885032941ab8832fcb142"
1405
+ },
1406
+ CrossTreeVerifierRegistry: {
1407
+ address: "0x67d269191c92Caf3cD7723F116c85e6E9bf55933",
1408
+ runtimeCodeHash: "0xa5ee16fc7ed9f982450e42a48365a93bfca784fa884adcb8695b557e921cb93b"
1409
+ },
1410
+ DualVerifierRouter: {
1411
+ address: "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
1412
+ runtimeCodeHash: "0xcc094ed6f1bcc9270c597f62b817e4fc0a54770f373320133c2836e5b07ef2cc"
1413
+ },
1414
+ AtomicBatchOutputLib: {
1415
+ address: "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
1416
+ runtimeCodeHash: "0x7c138c13e40b3ad0fee3b319d6c1580a21855cb5ecdda92571d530509d9b7316"
1417
+ },
1418
+ FundingLib: {
1419
+ address: "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
1420
+ runtimeCodeHash: "0x898d13d6ec4123df85f21ee0f98678dcd9f9b9a60134f88e35c1ef1aaa0a45f9"
1421
+ },
1422
+ PrivateTransferLib: {
1423
+ address: "0x9E545E3C0baAB3E08CdfD552C960A1050f373042",
1424
+ runtimeCodeHash: "0xfb18f2dd0a39af1b99ae35c25e2746cb5bc85c205e041db5f440671d84c82e5e"
1425
+ },
1426
+ CrossTreeTransferLib: {
1427
+ address: "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
1428
+ runtimeCodeHash: "0x7b33a08f2feb9da462b951c95482cb2909796a85c0fde7cc9a6b65ff8b7ff253"
1429
+ },
1430
+ AggregateTransferLib: {
1431
+ address: "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
1432
+ runtimeCodeHash: "0xb3b4bd3a428f5c35712a57180f07b2249774d399ca87d4494929148ea26c5b99"
1433
+ },
1434
+ CreateCreditLib: {
1435
+ address: "0x851356ae760d987E095750cCeb3bC6014560891C",
1436
+ runtimeCodeHash: "0xe37a4b7c129c4fba5615d25ed8b7e898e64a306c68f7e599ade911db98fe881c"
1437
+ },
1438
+ CreditLifecycleLib: {
1439
+ address: "0xf5059a5D33d5853360D16C683c16e67980206f36",
1440
+ runtimeCodeHash: "0xf87a2227680efa7070071516587793e2e847c172b83261b8983c826f8a8c79bb"
1441
+ },
1442
+ ShieldLib: {
1443
+ address: "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
1444
+ runtimeCodeHash: "0x371e57d8d324e44445a4ec30303b89a8bc98bbdbd03aeaa80faf0f821a65451d"
1445
+ },
1446
+ InvisiFactory: {
1447
+ address: "0x998abeb3E57409262aE5b751f60747921B33613E",
1448
+ runtimeCodeHash: "0xc56e5a0b71f4a1f63576a6663efb62b17c0d7520b6885a8d3483a356e12edf9b"
1449
+ },
1450
+ InvisiAddressRegistry: {
1451
+ address: "0x70e0bA845a1A0F2DA3359C97E0285013525FFC49",
1452
+ runtimeCodeHash: "0x007da3f4e888366ba0eed52cd511c4a369359291387ad19ca37e89eb395fce30"
1453
+ },
1454
+ InvisiProtocol: {
1455
+ address: "0xEeD9be753bccbCB21463C49f0c56cC0E48bEcf3c",
1456
+ runtimeCodeHash: "0x80228a2080d224b4481fc5df24fe8ce080d4536c663b13ec7829ecf0ef46abbd"
1457
+ },
1458
+ MockERC20: {
1459
+ address: "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf",
1460
+ runtimeCodeHash: "0xf7f676b5c54f6e94f82f0de65a0117468a0d915e8a79d150e74f76bd6d7f708b"
1461
+ }
1462
+ },
1463
+ assumptions: [
1464
+ "normal CREATE/Factory deployment and fresh registry; EIP170/EIP3860 unchanged; no code/storage injection",
1465
+ "Solidity0.8.38 optimizer200 Prague; pinned BB6.0.0 real verifiers; every native proof independently verified",
1466
+ "one physical source tree and 123 existing leaves shared by every sample; top-up has two authenticated source groups; no rollover or screener",
1467
+ "funding/approvals/121 genuine Credit seeds/usage-seed draw/payout reset excluded from business gas",
1468
+ "each round restores identical token balances, exact caller allowance100, note cursor, nullifiers and baseline; spender payout starts zero",
1469
+ "complete receipt.gasUsed is measured, including verifier/calldata/logging/output insertion; memo0",
1470
+ "Prague local block gas limit500000000; measured transactions may be unmineable under lower network transaction/block limits",
1471
+ "observed three-sample ranges are neither a confidence interval nor a recommended transaction gas limit"
1472
+ ]
1473
+ },
1474
+ measurements: [
1475
+ {
1476
+ id: "create-credit-caller-0x0",
1477
+ shape: {
1478
+ kind: "create-credit",
1479
+ target: "evm",
1480
+ capacity: 10,
1481
+ noteInputs: 0,
1482
+ noteOutputs: 0,
1483
+ sourceTrees: 0,
1484
+ creditInputs: 0,
1485
+ creditOutputs: 1,
1486
+ creditRemainders: 0,
1487
+ funding: "caller",
1488
+ permit: false,
1489
+ deliveryBytes: 1132
1490
+ },
1491
+ circuit: {
1492
+ circuitName: "create_credit",
1493
+ target: "evm",
1494
+ artifactSha256: "3ed6cfdee4f5fd840f023580f76c208768777fea79737f2511377e5c55be0230",
1495
+ vkSha256: "56f663c6053be0d158a271022d200c732597efd3a2e0be48fe94549d0b1795e0"
1496
+ },
1497
+ samples: [
1498
+ {
1499
+ gasUsed: "1574696",
1500
+ transactionHash: "0x76112c532a1b5f24ad84fb83f91789ba4acd15ed9473ec9a0267cd5fe605448d",
1501
+ blockNumber: "172",
1502
+ blockHash: "0x0d91421e94947132a19f38ffdd76932c2d85add201de3d9189325ed3568125a7",
1503
+ calldataBytes: 11780
1504
+ },
1505
+ {
1506
+ gasUsed: "1574576",
1507
+ transactionHash: "0x545f72d9d207329bfc69ef0d1e96470c614924d5e463d974cc001712bf619fd8",
1508
+ blockNumber: "172",
1509
+ blockHash: "0x2053f97a2b2f3cf66e14da0ab9c1d7bd462d2d4f3ef2b13021aefcddedb71cf8",
1510
+ calldataBytes: 11780
1511
+ },
1512
+ {
1513
+ gasUsed: "1574612",
1514
+ transactionHash: "0x880ec0c666068d0756fba39947dc5b211aeebb31f41bd1e1e54856b090f65d34",
1515
+ blockNumber: "172",
1516
+ blockHash: "0xbb86ed21379a917e9688a3c90364ae8fbe1ba633ac068360e0a82bf4d3113b6d",
1517
+ calldataBytes: 11780
1518
+ }
1519
+ ]
1520
+ },
1521
+ {
1522
+ id: "create-credit-1x1",
1523
+ shape: {
1524
+ kind: "create-credit",
1525
+ target: "evm",
1526
+ capacity: 10,
1527
+ noteInputs: 1,
1528
+ noteOutputs: 1,
1529
+ sourceTrees: 1,
1530
+ creditInputs: 0,
1531
+ creditOutputs: 1,
1532
+ creditRemainders: 0,
1533
+ funding: "none",
1534
+ permit: false,
1535
+ deliveryBytes: 1360
1536
+ },
1537
+ circuit: {
1538
+ circuitName: "create_credit",
1539
+ target: "evm",
1540
+ artifactSha256: "3ed6cfdee4f5fd840f023580f76c208768777fea79737f2511377e5c55be0230",
1541
+ vkSha256: "56f663c6053be0d158a271022d200c732597efd3a2e0be48fe94549d0b1795e0"
1542
+ },
1543
+ samples: [
1544
+ {
1545
+ gasUsed: "1671641",
1546
+ transactionHash: "0x24ca3f03681aeb188b48989d5eaf7dd264a8c32e828acd34ff1b44be74f17ea6",
1547
+ blockNumber: "172",
1548
+ blockHash: "0xcdac07aa5d3ec187874dc1fc9be65503235289c7036ebe455feaf5161db42bb5",
1549
+ calldataBytes: 12132
1550
+ },
1551
+ {
1552
+ gasUsed: "1671509",
1553
+ transactionHash: "0x31a7f69ab02effa5fdd2e02bd02fb7e715a54786813261113fd7c07a0d3ef549",
1554
+ blockNumber: "172",
1555
+ blockHash: "0xc78ca874aa22cc6b8ea19e12a2806ba448a0f844345450d3fedc9841ea71c3a8",
1556
+ calldataBytes: 12132
1557
+ },
1558
+ {
1559
+ gasUsed: "1671485",
1560
+ transactionHash: "0xc5a30116885dcac8b3631c15847544cfeb91c46bde44c3765ac0ce42e3259157",
1561
+ blockNumber: "172",
1562
+ blockHash: "0x4a2c90ff972da4d37408567062779762efbb5790d4784d03842ee2c926c8c894",
1563
+ calldataBytes: 12132
1564
+ }
1565
+ ]
1566
+ },
1567
+ {
1568
+ id: "draw-credit-1-partial",
1569
+ shape: {
1570
+ kind: "draw-credit",
1571
+ target: "evm",
1572
+ capacity: 1,
1573
+ noteInputs: 0,
1574
+ noteOutputs: 0,
1575
+ sourceTrees: 1,
1576
+ creditInputs: 1,
1577
+ creditOutputs: 1,
1578
+ creditRemainders: 1,
1579
+ funding: "none",
1580
+ permit: false,
1581
+ deliveryBytes: 1132
1582
+ },
1583
+ circuit: {
1584
+ circuitName: "credit_draw_slots1",
1585
+ target: "evm",
1586
+ artifactSha256: "4542b227e0552b45c302f1dace21cadeba4962c96244e021472f1f7531cff8d1",
1587
+ vkSha256: "43c051a2bedf9454c12e70b10156361e414944823ba23e80662c16c7ced0a2ce"
1588
+ },
1589
+ samples: [
1590
+ {
1591
+ gasUsed: "1588303",
1592
+ transactionHash: "0x85c5180692470aa952aa13eb29ca0404d4f5b5192cb31475f90d03d78864895e",
1593
+ blockNumber: "172",
1594
+ blockHash: "0xfe4876c0a2ebf05385a46562bca693b6df80da731fd9651117593916015dc38c",
1595
+ calldataBytes: 11588
1596
+ },
1597
+ {
1598
+ gasUsed: "1588303",
1599
+ transactionHash: "0x61684313840623187ca1205b4b07b43a08038448524ee1a028c7e14050032682",
1600
+ blockNumber: "172",
1601
+ blockHash: "0x9726d31c10e6516e38e3f63c84fc4b9a8a161486d35e0d8d07e6829261a88fe7",
1602
+ calldataBytes: 11588
1603
+ },
1604
+ {
1605
+ gasUsed: "1588255",
1606
+ transactionHash: "0x0aa052fb8e356cc81dd73bcdae72f760937cd2e56bd4a3e8eb5878208b4f7596",
1607
+ blockNumber: "172",
1608
+ blockHash: "0x2c958cfba0627e18cd5cb47001b278628c305071929596e3335d770b92c1dc16",
1609
+ calldataBytes: 11588
1610
+ }
1611
+ ]
1612
+ },
1613
+ {
1614
+ id: "draw-credit-1-full",
1615
+ shape: {
1616
+ kind: "draw-credit",
1617
+ target: "evm",
1618
+ capacity: 1,
1619
+ noteInputs: 0,
1620
+ noteOutputs: 0,
1621
+ sourceTrees: 1,
1622
+ creditInputs: 1,
1623
+ creditOutputs: 0,
1624
+ creditRemainders: 0,
1625
+ funding: "none",
1626
+ permit: false,
1627
+ deliveryBytes: 0
1628
+ },
1629
+ circuit: {
1630
+ circuitName: "credit_draw_slots1",
1631
+ target: "evm",
1632
+ artifactSha256: "4542b227e0552b45c302f1dace21cadeba4962c96244e021472f1f7531cff8d1",
1633
+ vkSha256: "43c051a2bedf9454c12e70b10156361e414944823ba23e80662c16c7ced0a2ce"
1634
+ },
1635
+ samples: [
1636
+ {
1637
+ gasUsed: "1042812",
1638
+ transactionHash: "0xb5d55729d975abdc92ca44c0b72e44a0d5841da8b23dc11b5bd31f46d88a341a",
1639
+ blockNumber: "172",
1640
+ blockHash: "0x8a6ddbe2f1630e1956485cac7984fb9cdc4fbb26b10522e158b38e2970ee4f3b",
1641
+ calldataBytes: 10372
1642
+ },
1643
+ {
1644
+ gasUsed: "1042824",
1645
+ transactionHash: "0xf64f3186fbf94fcbd9fb12426c714b4a8425599e1a7e5677866fae3d6873b7ae",
1646
+ blockNumber: "172",
1647
+ blockHash: "0xd630c44d8ce96234ec836dd2178caac2a6d0bc2df5cf37df1534eb8896be48d3",
1648
+ calldataBytes: 10372
1649
+ },
1650
+ {
1651
+ gasUsed: "1042884",
1652
+ transactionHash: "0xdf634e809b87603a62292ef046fa5e84715561fa76ef121c768303dd779568f1",
1653
+ blockNumber: "172",
1654
+ blockHash: "0x09cad4a799360bdf825c3ad70fe374b7fe2df802f8ee37ccb7f26ffc49aa2a3a",
1655
+ calldataBytes: 10372
1656
+ }
1657
+ ]
1658
+ },
1659
+ {
1660
+ id: "draw-credit-12-partial",
1661
+ shape: {
1662
+ kind: "draw-credit",
1663
+ target: "evm",
1664
+ capacity: 12,
1665
+ noteInputs: 0,
1666
+ noteOutputs: 0,
1667
+ sourceTrees: 1,
1668
+ creditInputs: 12,
1669
+ creditOutputs: 12,
1670
+ creditRemainders: 12,
1671
+ funding: "none",
1672
+ permit: false,
1673
+ deliveryBytes: 13584
1674
+ },
1675
+ circuit: {
1676
+ circuitName: "credit_draw_slots12",
1677
+ target: "evm",
1678
+ artifactSha256: "dd72b0867fc3be7cd90de263bd2d0892075cb18eb4f6dd671b13111710f10369",
1679
+ vkSha256: "5e31d771e6294993736078596d9c69f21fe7595eda50e3cce6d7406b65cf1443"
1680
+ },
1681
+ samples: [
1682
+ {
1683
+ gasUsed: "3102895",
1684
+ transactionHash: "0x699ba81f296f4af397a8dfaf96adf14d00d0f7dd69c0b09608641fc9b99fc28f",
1685
+ blockNumber: "172",
1686
+ blockHash: "0x8d318f563f5563fa5c213617481089f75aab3a6e9d14818db107ac20a8c20ffb",
1687
+ calldataBytes: 30276
1688
+ },
1689
+ {
1690
+ gasUsed: "3102871",
1691
+ transactionHash: "0xddfc1c6c505f6c54f4d9aabc96a02eb6b606182e8ad708a578eacd274d885dee",
1692
+ blockNumber: "172",
1693
+ blockHash: "0xcc7738fe329a608241615dc43b7d16e075eb62be202ea8aaf4ae27a5278bf438",
1694
+ calldataBytes: 30276
1695
+ },
1696
+ {
1697
+ gasUsed: "3103171",
1698
+ transactionHash: "0x6efab6408d927e1877f1f6c33ecd285a128382f7d1dfe6e123927b035781c8aa",
1699
+ blockNumber: "172",
1700
+ blockHash: "0xcb4588df9ecdca0d353ccbd226e1d5d07f21e6dc93875e41cdd5f64568859f4d",
1701
+ calldataBytes: 30276
1702
+ }
1703
+ ]
1704
+ },
1705
+ {
1706
+ id: "draw-credit-12-full",
1707
+ shape: {
1708
+ kind: "draw-credit",
1709
+ target: "evm",
1710
+ capacity: 12,
1711
+ noteInputs: 0,
1712
+ noteOutputs: 0,
1713
+ sourceTrees: 1,
1714
+ creditInputs: 12,
1715
+ creditOutputs: 0,
1716
+ creditRemainders: 0,
1717
+ funding: "none",
1718
+ permit: false,
1719
+ deliveryBytes: 0
1720
+ },
1721
+ circuit: {
1722
+ circuitName: "credit_draw_slots12",
1723
+ target: "evm",
1724
+ artifactSha256: "dd72b0867fc3be7cd90de263bd2d0892075cb18eb4f6dd671b13111710f10369",
1725
+ vkSha256: "5e31d771e6294993736078596d9c69f21fe7595eda50e3cce6d7406b65cf1443"
1726
+ },
1727
+ samples: [
1728
+ {
1729
+ gasUsed: "1536675",
1730
+ transactionHash: "0xc0d3eef8e6b0e90984d776a5e41bcdce1e0ca0bc6dc3a71616e4768e80c01546",
1731
+ blockNumber: "172",
1732
+ blockHash: "0x22dfac3d8e9913a6a1f2ff84faaece4ed59bfe1cb74e06a60131ff28cc6c2f9d",
1733
+ calldataBytes: 15684
1734
+ },
1735
+ {
1736
+ gasUsed: "1536675",
1737
+ transactionHash: "0x9879d86a1eaa550a6a6afaeeb0f5f07745d5dcd9caa07b660d7fb512911dc67e",
1738
+ blockNumber: "172",
1739
+ blockHash: "0xf88ba9f1b7a0c627338a61bbabe1c650bdfcd7fa1c56433d6853f492135b753d",
1740
+ calldataBytes: 15684
1741
+ },
1742
+ {
1743
+ gasUsed: "1536711",
1744
+ transactionHash: "0xbd8f75a021a8ce8dc1900bd2d84d723acc6a64018844050a5aa2f8712cf7fd6b",
1745
+ blockNumber: "172",
1746
+ blockHash: "0xa55b539c2ea4e10ce9a9ee8e6de9cf1daa97263b51f32cfef8342c100b663b0f",
1747
+ calldataBytes: 15684
1748
+ }
1749
+ ]
1750
+ },
1751
+ {
1752
+ id: "draw-credit-50-partial",
1753
+ shape: {
1754
+ kind: "draw-credit",
1755
+ target: "evm",
1756
+ capacity: 50,
1757
+ noteInputs: 0,
1758
+ noteOutputs: 0,
1759
+ sourceTrees: 1,
1760
+ creditInputs: 50,
1761
+ creditOutputs: 50,
1762
+ creditRemainders: 50,
1763
+ funding: "none",
1764
+ permit: false,
1765
+ deliveryBytes: 56600
1766
+ },
1767
+ circuit: {
1768
+ circuitName: "credit_draw_slots50",
1769
+ target: "evm",
1770
+ artifactSha256: "09c7469866748b4c0c4bbf2b040844771948a170999f6dc7a38fe5c0ecda4054",
1771
+ vkSha256: "7b613225b6f32a077011d4196c356e836d22dcd116efe687fde53144fbd8db9f"
1772
+ },
1773
+ samples: [
1774
+ {
1775
+ gasUsed: "8015473",
1776
+ transactionHash: "0x5dcc0fa08abaf5212424ac6f3e2f3bb8a0bd333f90ef6e421f8d3fe370ca1acf",
1777
+ blockNumber: "172",
1778
+ blockHash: "0x3197c523dece3492226c5021f974e7c02db2e686265943d03a5550c6cb96a12e",
1779
+ calldataBytes: 94276
1780
+ },
1781
+ {
1782
+ gasUsed: "8015449",
1783
+ transactionHash: "0x6a55f88551a45b3e118cde0607cfff1ef0b6ab15ad9472e838412d9ce714b42a",
1784
+ blockNumber: "172",
1785
+ blockHash: "0xea82c8962d45db8361bd67ed326806f21c511bd51550adc453d0c3e5cab3a7ae",
1786
+ calldataBytes: 94276
1787
+ },
1788
+ {
1789
+ gasUsed: "8015149",
1790
+ transactionHash: "0x2cc8d474a92abe91f8025109a70cf1f9f081dbec43aa4a475ab9f33222cfc76b",
1791
+ blockNumber: "172",
1792
+ blockHash: "0x4398f419da699ccca33867852d4975b5c461a40bb01cd5241a0e6dcacaeb78b3",
1793
+ calldataBytes: 94276
1794
+ }
1795
+ ]
1796
+ },
1797
+ {
1798
+ id: "draw-credit-50-full",
1799
+ shape: {
1800
+ kind: "draw-credit",
1801
+ target: "evm",
1802
+ capacity: 50,
1803
+ noteInputs: 0,
1804
+ noteOutputs: 0,
1805
+ sourceTrees: 1,
1806
+ creditInputs: 50,
1807
+ creditOutputs: 0,
1808
+ creditRemainders: 0,
1809
+ funding: "none",
1810
+ permit: false,
1811
+ deliveryBytes: 0
1812
+ },
1813
+ circuit: {
1814
+ circuitName: "credit_draw_slots50",
1815
+ target: "evm",
1816
+ artifactSha256: "09c7469866748b4c0c4bbf2b040844771948a170999f6dc7a38fe5c0ecda4054",
1817
+ vkSha256: "7b613225b6f32a077011d4196c356e836d22dcd116efe687fde53144fbd8db9f"
1818
+ },
1819
+ samples: [
1820
+ {
1821
+ gasUsed: "3216708",
1822
+ transactionHash: "0x16933368d26ea1d7fbe69027c700671df832ad308944eeff42e7c2da40297b06",
1823
+ blockNumber: "172",
1824
+ blockHash: "0x0739a6f4188b8bdeae7bd5460960086d04adfea993d07d65b2b3630ad01b8cab",
1825
+ calldataBytes: 33476
1826
+ },
1827
+ {
1828
+ gasUsed: "3216840",
1829
+ transactionHash: "0x45dc15a62b1661f54e167cf13b9693770370c926a8a7af959da7354e9bb4aa6e",
1830
+ blockNumber: "172",
1831
+ blockHash: "0xf2e294db9af3b11814fed1dec358b8370ea28a99189211f883c9b0012349d677",
1832
+ calldataBytes: 33476
1833
+ },
1834
+ {
1835
+ gasUsed: "3216744",
1836
+ transactionHash: "0x2c827753026ea421497534a01bcc2adaca866a7612f570dad3fcf18c660f8590",
1837
+ blockNumber: "172",
1838
+ blockHash: "0x3ccd465528ff22e6d1955670220df3565899a16dd683f71c83c9810f2df420b4",
1839
+ calldataBytes: 33476
1840
+ }
1841
+ ]
1842
+ },
1843
+ {
1844
+ id: "draw-credit-120-partial",
1845
+ shape: {
1846
+ kind: "draw-credit",
1847
+ target: "evm",
1848
+ capacity: 120,
1849
+ noteInputs: 0,
1850
+ noteOutputs: 0,
1851
+ sourceTrees: 1,
1852
+ creditInputs: 120,
1853
+ creditOutputs: 120,
1854
+ creditRemainders: 120,
1855
+ funding: "none",
1856
+ permit: false,
1857
+ deliveryBytes: 135840
1858
+ },
1859
+ circuit: {
1860
+ circuitName: "credit_draw_slots120",
1861
+ target: "evm",
1862
+ artifactSha256: "6ccd0366a669c50fd5da875c3eae194fe8aa4c36d35a5f9ebfd64636ea599b48",
1863
+ vkSha256: "d715848afc5c1ecdfcef5ed5026865abef5040a3bc232fd65330a5ffee8475fb"
1864
+ },
1865
+ samples: [
1866
+ {
1867
+ gasUsed: "17458512",
1868
+ transactionHash: "0x84dd6bda5f3172a53e899051fd226dc5869edb796bd513a33e7f224bed13f4ae",
1869
+ blockNumber: "172",
1870
+ blockHash: "0xfca82de1e112b92319185d8c3f0115e0aa339d0247ea65970eb0d37ba958b08e",
1871
+ calldataBytes: 211140
1872
+ },
1873
+ {
1874
+ gasUsed: "17458224",
1875
+ transactionHash: "0xae26838942cf8b5499d43cb5e74681ae87aec77890a8eabddd692ff83830e013",
1876
+ blockNumber: "172",
1877
+ blockHash: "0x3e513447e0cfdbb682a95b7a719b0d300ec46b0ee22b518eaae7fb082f6436e7",
1878
+ calldataBytes: 211140
1879
+ },
1880
+ {
1881
+ gasUsed: "17458524",
1882
+ transactionHash: "0xeaa07e77fe958f4317e71b07ddb876482ae9c5172fd6d6cefaacc551dbbda7d5",
1883
+ blockNumber: "172",
1884
+ blockHash: "0x12b34c1fd2e15480276052842157c2a6355acdd43d7bd01ae7511c3f39e0ecfc",
1885
+ calldataBytes: 211140
1886
+ }
1887
+ ]
1888
+ },
1889
+ {
1890
+ id: "draw-credit-120-full",
1891
+ shape: {
1892
+ kind: "draw-credit",
1893
+ target: "evm",
1894
+ capacity: 120,
1895
+ noteInputs: 0,
1896
+ noteOutputs: 0,
1897
+ sourceTrees: 1,
1898
+ creditInputs: 120,
1899
+ creditOutputs: 0,
1900
+ creditRemainders: 0,
1901
+ funding: "none",
1902
+ permit: false,
1903
+ deliveryBytes: 0
1904
+ },
1905
+ circuit: {
1906
+ circuitName: "credit_draw_slots120",
1907
+ target: "evm",
1908
+ artifactSha256: "6ccd0366a669c50fd5da875c3eae194fe8aa4c36d35a5f9ebfd64636ea599b48",
1909
+ vkSha256: "d715848afc5c1ecdfcef5ed5026865abef5040a3bc232fd65330a5ffee8475fb"
1910
+ },
1911
+ samples: [
1912
+ {
1913
+ gasUsed: "6289576",
1914
+ transactionHash: "0xbf11743f7edc5ed5ff334efc5e35634f45e48e4940d33ddd9c87d8fe444dafc5",
1915
+ blockNumber: "172",
1916
+ blockHash: "0x774de17971107b73cab2cd20f26b60665f55a37b0cc1147166babf16743e34d5",
1917
+ calldataBytes: 65220
1918
+ },
1919
+ {
1920
+ gasUsed: "6289768",
1921
+ transactionHash: "0x651bb13e0645ee8a08657db627f1072f5e964ddaff44f70f829440ed68488dea",
1922
+ blockNumber: "172",
1923
+ blockHash: "0xa9795828565fb0ce65bda295073106b8bbdc110bb8317d269839d3db3e312d5b",
1924
+ calldataBytes: 65220
1925
+ },
1926
+ {
1927
+ gasUsed: "6289720",
1928
+ transactionHash: "0x2a859d381cb4b50830971b1ffc9789b11569fc96147e130dae6fecd141f5ceb0",
1929
+ blockNumber: "172",
1930
+ blockHash: "0x7d990830157bfeff8e5cbe580e9effe97faa7676c9957ce32891b76c83961430",
1931
+ calldataBytes: 65220
1932
+ }
1933
+ ]
1934
+ },
1935
+ {
1936
+ id: "top-up-credit-1x1-unchanged-limits",
1937
+ shape: {
1938
+ kind: "top-up-credit",
1939
+ target: "evm",
1940
+ capacity: 10,
1941
+ noteInputs: 1,
1942
+ noteOutputs: 1,
1943
+ sourceTrees: 2,
1944
+ creditInputs: 1,
1945
+ creditOutputs: 1,
1946
+ creditRemainders: 0,
1947
+ funding: "none",
1948
+ permit: false,
1949
+ deliveryBytes: 1360
1950
+ },
1951
+ circuit: {
1952
+ circuitName: "credit_top_up",
1953
+ target: "evm",
1954
+ artifactSha256: "2ffebd5753ec1b0c050204d4f97498765fe61ea01a793a9b2466c2f97536345c",
1955
+ vkSha256: "40b02a9d2e7eb7b49daaac4b7760328537b7982fd5a225cc065bb74cd5ef44b3"
1956
+ },
1957
+ samples: [
1958
+ {
1959
+ gasUsed: "1711282",
1960
+ transactionHash: "0x74d45084bb07bacabbced09ee6ef69d8632a22a4493be783c326c47e929ba0ed",
1961
+ blockNumber: "172",
1962
+ blockHash: "0x3503643f7081b52ae20d4754a0e9b11f52034ae48059f5b5298546c2570fa091",
1963
+ calldataBytes: 12292
1964
+ },
1965
+ {
1966
+ gasUsed: "1711282",
1967
+ transactionHash: "0x4b5e2432d5571f6b56507b3ab995a8120560ba608959ff100f03b87873e72be6",
1968
+ blockNumber: "172",
1969
+ blockHash: "0xca15dc309371a5aa9c7bc5bf1d65c5b325c71528ce7856ba68a118114124fccc",
1970
+ calldataBytes: 12292
1971
+ },
1972
+ {
1973
+ gasUsed: "1711390",
1974
+ transactionHash: "0x304f3740b64c80dcc5c894fb30af59080d96a11e08371096ae695cbc46ef2c8b",
1975
+ blockNumber: "172",
1976
+ blockHash: "0x9671ed76d6b8e49a36ba229d3609289fcf70756f31277ac5fc0e3f08cd52304f",
1977
+ calldataBytes: 12292
1978
+ }
1979
+ ]
1980
+ },
1981
+ {
1982
+ id: "top-up-credit-1x1-changed-limits",
1983
+ shape: {
1984
+ kind: "top-up-credit",
1985
+ target: "evm",
1986
+ capacity: 10,
1987
+ noteInputs: 1,
1988
+ noteOutputs: 1,
1989
+ sourceTrees: 2,
1990
+ creditInputs: 1,
1991
+ creditOutputs: 1,
1992
+ creditRemainders: 0,
1993
+ funding: "none",
1994
+ permit: false,
1995
+ deliveryBytes: 1360
1996
+ },
1997
+ circuit: {
1998
+ circuitName: "credit_top_up",
1999
+ target: "evm",
2000
+ artifactSha256: "2ffebd5753ec1b0c050204d4f97498765fe61ea01a793a9b2466c2f97536345c",
2001
+ vkSha256: "40b02a9d2e7eb7b49daaac4b7760328537b7982fd5a225cc065bb74cd5ef44b3"
2002
+ },
2003
+ samples: [
2004
+ {
2005
+ gasUsed: "1711318",
2006
+ transactionHash: "0x65284df534b42631f8a592fb2a6efc16361a4cc122f1a8dd41418e7b950f48f1",
2007
+ blockNumber: "172",
2008
+ blockHash: "0xf198242a1edf5b133961568c9165648c829729e7bfbbf57a1e148551c971b87c",
2009
+ calldataBytes: 12292
2010
+ },
2011
+ {
2012
+ gasUsed: "1711438",
2013
+ transactionHash: "0xcee89a81e598974798365c4ebada806fb51196ee602334b0fffdbb25da0afe25",
2014
+ blockNumber: "172",
2015
+ blockHash: "0xb506a6fb54cc2f91b803211ed955aac0203fba93e2428f8f52ec0d413c90af09",
2016
+ calldataBytes: 12292
2017
+ },
2018
+ {
2019
+ gasUsed: "1711342",
2020
+ transactionHash: "0x957de5c79f365c9b0510b9e125a662317494aad50cb446edceef6f678d561cc7",
2021
+ blockNumber: "172",
2022
+ blockHash: "0xb1d5cffd6d6db58ade9d5e16d48b060b9ab2152415966dc809e7e70785472ab8",
2023
+ calldataBytes: 12292
2024
+ }
2025
+ ]
2026
+ },
2027
+ {
2028
+ id: "cancel-credit-1",
2029
+ shape: {
2030
+ kind: "cancel-credit",
2031
+ target: "evm",
2032
+ capacity: 1,
2033
+ noteInputs: 0,
2034
+ noteOutputs: 0,
2035
+ sourceTrees: 1,
2036
+ creditInputs: 1,
2037
+ creditOutputs: 0,
2038
+ creditRemainders: 0,
2039
+ funding: "none",
2040
+ permit: false,
2041
+ deliveryBytes: 0
2042
+ },
2043
+ circuit: {
2044
+ circuitName: "credit_cancel",
2045
+ target: "evm",
2046
+ artifactSha256: "b4459c2cf756d096e37291cf4d7cd129866b6d420b6d03c928f383b057112ccb",
2047
+ vkSha256: "fc8ad196ef15f3328afcc8f01d867a3ebefd15451c2813948442fab1923b73b2"
2048
+ },
2049
+ samples: [
2050
+ {
2051
+ gasUsed: "985543",
2052
+ transactionHash: "0x29ca63fbefcc5e92dbc86f67d6280993e567a5dd02ff3defd7f3251ce711865e",
2053
+ blockNumber: "172",
2054
+ blockHash: "0xecd7808fe9f7467af917069bd7a82ab0324e3cbab8dcad622b089d6e3eee9a58",
2055
+ calldataBytes: 9540
2056
+ },
2057
+ {
2058
+ gasUsed: "985795",
2059
+ transactionHash: "0xaf8bca0769330f89b647363f99b752dbbe6fdbb8b1aae912224f6a3a59f40faa",
2060
+ blockNumber: "172",
2061
+ blockHash: "0x58e1358e02f189d57628fa7c504b87fb000fe60eb9f0a0c3c0e58dae876e64da",
2062
+ calldataBytes: 9540
2063
+ },
2064
+ {
2065
+ gasUsed: "985711",
2066
+ transactionHash: "0x2c911fd5a422f6f72f2a00b16872b7e46e182d39b8f5bfa9e3b2bf99d3155da7",
2067
+ blockNumber: "172",
2068
+ blockHash: "0x9da571cbe63f52232261ee1527d5ed97a9e90e374b4fcda97d04feb25114d18e",
2069
+ calldataBytes: 9540
2070
+ }
2071
+ ]
2072
+ }
2073
+ ]
2074
+ },
1249
2075
  {
1250
2076
  formatVersion: 1,
1251
2077
  id: "protocol-92ef274-osaka-real",
@@ -1670,190 +2496,6 @@ var gas_benchmarks_default = [
1670
2496
  calldataBytes: 10116
1671
2497
  }
1672
2498
  ]
1673
- },
1674
- {
1675
- id: "create-credit-1x1",
1676
- shape: {
1677
- kind: "create-credit",
1678
- target: "evm",
1679
- capacity: 10,
1680
- noteInputs: 1,
1681
- noteOutputs: 1,
1682
- sourceTrees: 1,
1683
- creditInputs: 0,
1684
- creditOutputs: 1,
1685
- creditRemainders: 0,
1686
- funding: "none",
1687
- permit: false,
1688
- deliveryBytes: 1162
1689
- },
1690
- circuit: {
1691
- circuitName: "create_credit",
1692
- target: "evm",
1693
- artifactSha256: "ab97cd5a036851a9748a5cfd8e6f9834e23090c8e95db4531aabfc37d3abb353",
1694
- vkSha256: "fac0e65b768a28750323cca851990598af936611125b6cfa3f5c16b04c7d084f"
1695
- },
1696
- samples: [
1697
- {
1698
- gasUsed: "1627325",
1699
- transactionHash: "0x7763d93a5b1e8797b5f4af2e1e5b1bb029a8b0f9f7b90bcc04f581947d826803",
1700
- blockNumber: "49",
1701
- blockHash: "0x93e51ae5e99c68dc642693d478e444330d8e26255ff5bb9aafc4a3f4e70d3a45",
1702
- calldataBytes: 11940
1703
- },
1704
- {
1705
- gasUsed: "1627385",
1706
- transactionHash: "0xe246d59cafa2a26dddf21c8385dd843be4d4596388ebe23e936df84e7f906635",
1707
- blockNumber: "49",
1708
- blockHash: "0x3c24b2d6ed2a998562d34b49e0517515742a9b39d59aec38a9ac6b22be1b694b",
1709
- calldataBytes: 11940
1710
- },
1711
- {
1712
- gasUsed: "1627157",
1713
- transactionHash: "0x2f7ed0b75435cc6a820d0cd90fd82d362f74787057413722b6eb3c6e37db87d3",
1714
- blockNumber: "49",
1715
- blockHash: "0x0a0301670b46017da772800c68bb941245ac1941c79fde9c85717632154e15ee",
1716
- calldataBytes: 11940
1717
- }
1718
- ]
1719
- },
1720
- {
1721
- id: "draw-credit-1-partial",
1722
- shape: {
1723
- kind: "draw-credit",
1724
- target: "evm",
1725
- capacity: 1,
1726
- noteInputs: 0,
1727
- noteOutputs: 0,
1728
- sourceTrees: 1,
1729
- creditInputs: 1,
1730
- creditOutputs: 1,
1731
- creditRemainders: 1,
1732
- funding: "none",
1733
- permit: false,
1734
- deliveryBytes: 936
1735
- },
1736
- circuit: {
1737
- circuitName: "credit_draw_slots1",
1738
- target: "evm",
1739
- artifactSha256: "f5e458790948f37a61a833fad52cf2cc3b26a59515d271de32e0caaa4e229eb5",
1740
- vkSha256: "613699a440f50a0937e4c57e5152b5fdea42c31b10157d6b93226fef313df553"
1741
- },
1742
- samples: [
1743
- {
1744
- gasUsed: "1581294",
1745
- transactionHash: "0xd438e22b0fa07a657279f182537e4996f1936f0881d5b7d637845f8ca2808aab",
1746
- blockNumber: "49",
1747
- blockHash: "0x9e384a3054530b1ff237a639bca1a559afb2b73b30e21c262aac85ebf480fc9b",
1748
- calldataBytes: 11396
1749
- },
1750
- {
1751
- gasUsed: "1581402",
1752
- transactionHash: "0xa70ac3e7284b6e98f8591a6ba88e4ddfb23ecbd05343641d0532f34920e10b56",
1753
- blockNumber: "49",
1754
- blockHash: "0x37c5eb34ce96a841e96c36103a7ab65c1a3e08603dc9843efb0c0752c069f1d4",
1755
- calldataBytes: 11396
1756
- },
1757
- {
1758
- gasUsed: "1581174",
1759
- transactionHash: "0xd062494979d0bc0e284ccb070f87b48f3e8e5befb6001f15a006dd2a4a72ca24",
1760
- blockNumber: "49",
1761
- blockHash: "0x12840d920f14163b2d29491f28cee616e1bb9fd9514a4debe10ae35256345fc1",
1762
- calldataBytes: 11396
1763
- }
1764
- ]
1765
- },
1766
- {
1767
- id: "top-up-credit-1x1",
1768
- shape: {
1769
- kind: "top-up-credit",
1770
- target: "evm",
1771
- capacity: 10,
1772
- noteInputs: 1,
1773
- noteOutputs: 1,
1774
- sourceTrees: 2,
1775
- creditInputs: 1,
1776
- creditOutputs: 1,
1777
- creditRemainders: 0,
1778
- funding: "none",
1779
- permit: false,
1780
- deliveryBytes: 1162
1781
- },
1782
- circuit: {
1783
- circuitName: "credit_top_up",
1784
- target: "evm",
1785
- artifactSha256: "ee9dbcf8be6f6c09478190996e90b1d39d4a10a00245950f69fc1d2c329c6e9b",
1786
- vkSha256: "0c369fec0469b60baebb3be650bad42f3ccae6f0ff139cce6ad9a3f451ed7513"
1787
- },
1788
- samples: [
1789
- {
1790
- gasUsed: "1666948",
1791
- transactionHash: "0x1403da01167962a4349d2655ea217bfcfc1a2390138bea0279792c44b4381dd2",
1792
- blockNumber: "49",
1793
- blockHash: "0xcb554ffcdb4afe5f6458e5d23ffbdd1fdbef9c23f982343065772c0b3e3dd633",
1794
- calldataBytes: 12100
1795
- },
1796
- {
1797
- gasUsed: "1666900",
1798
- transactionHash: "0x3b5e54f29e3f888a443526cf23ab9255b3f0c7adf1d0d127c16b85f4c6a324d9",
1799
- blockNumber: "49",
1800
- blockHash: "0xeb304df6bdd24b249cac3197b543b0eaa6381ed75ad812dff248f914864105ed",
1801
- calldataBytes: 12100
1802
- },
1803
- {
1804
- gasUsed: "1666780",
1805
- transactionHash: "0x81c5ef25268a719275cb3b80618c2af291e1f7b3f91d7e82cc26bc894a8c332a",
1806
- blockNumber: "49",
1807
- blockHash: "0xfa42070d6349fc8d559b8bd4ad0ee6b79089107540c4472b9e492b8f5a6bd3e4",
1808
- calldataBytes: 12100
1809
- }
1810
- ]
1811
- },
1812
- {
1813
- id: "cancel-credit-1",
1814
- shape: {
1815
- kind: "cancel-credit",
1816
- target: "evm",
1817
- capacity: 1,
1818
- noteInputs: 0,
1819
- noteOutputs: 0,
1820
- sourceTrees: 1,
1821
- creditInputs: 1,
1822
- creditOutputs: 0,
1823
- creditRemainders: 0,
1824
- funding: "none",
1825
- permit: false,
1826
- deliveryBytes: 0
1827
- },
1828
- circuit: {
1829
- circuitName: "credit_cancel",
1830
- target: "evm",
1831
- artifactSha256: "d332453a2b8c2c544747ac8d5f01912c9757f48d986226fd6a9b0e24d8321474",
1832
- vkSha256: "1f8a3c20cb081d6a90962556da3124919cc4e5675e59ad31562af39299da02fb"
1833
- },
1834
- samples: [
1835
- {
1836
- gasUsed: "998146",
1837
- transactionHash: "0x97bc72692d241e2c344b912804f9939061db5ef59cf4bb23922d93812e382160",
1838
- blockNumber: "49",
1839
- blockHash: "0x2e09df4df84a1c25961386febe8404531bb5da274836d50cc15a26c91b433a98",
1840
- calldataBytes: 9540
1841
- },
1842
- {
1843
- gasUsed: "998134",
1844
- transactionHash: "0x26c5067b12c2bc4b694070784e6b19d4855efa6e77c2422f0c6b1567f061570a",
1845
- blockNumber: "49",
1846
- blockHash: "0xdd3f20520c09e001374cab58387e52c82446db053539e30dad28b0de679a333c",
1847
- calldataBytes: 9540
1848
- },
1849
- {
1850
- gasUsed: "998230",
1851
- transactionHash: "0x5dc09445a405150da1445c22f50d6dd10d8d428a6a3f41ee90db7d3574657e31",
1852
- blockNumber: "49",
1853
- blockHash: "0x5c8f8223a50d2c8d48188a2db28ffa33c1b150a2fb465e99db4430949db3664b",
1854
- calldataBytes: 9540
1855
- }
1856
- ]
1857
2499
  }
1858
2500
  ]
1859
2501
  }
@@ -1882,6 +2524,29 @@ function copyGasBenchmarks(profiles) {
1882
2524
  for (const p of copy) {
1883
2525
  if (p.formatVersion !== 1 || !p.id || !decimal.test(p.deployment.chainId) || !address.test(p.deployment.protocolAddress) || !address.test(p.deployment.tokenAddress) || !p.deployment.runtimeCodeHash || !word2.test(p.deployment.runtimeCodeHash) || p.source.verifier !== "real" || !/^[0-9a-f]{40}$/i.test(p.source.protocolCommit) || !p.source.measuredAt || !Array.isArray(p.source.assumptions) || !p.source.assumptions.every((assumption) => typeof assumption === "string") || !p.measurements.length)
1884
2526
  throw new Error("invalid gas benchmark profile");
2527
+ if (p.source.fingerprints && ![
2528
+ "protocolSourceSha256",
2529
+ "dirtyDiffSha256",
2530
+ "compiledArtifactsSha256",
2531
+ "creditManifestSha256",
2532
+ "userManifestSha256",
2533
+ "sdkSourceSha256"
2534
+ ].every((key) => {
2535
+ const v = p.source.fingerprints[key];
2536
+ return typeof v === "string" && /^[a-f0-9]{64}$/i.test(v);
2537
+ }))
2538
+ throw new Error("invalid benchmark source fingerprint");
2539
+ if (p.source.blockGasLimit !== void 0 && (!decimal.test(p.source.blockGasLimit) || BigInt(p.source.blockGasLimit) <= 0n))
2540
+ throw new Error("invalid benchmark block gas limit");
2541
+ if (p.source.runtimeContracts && !Object.values(p.source.runtimeContracts).every(
2542
+ (v) => address.test(v.address) && word2.test(v.runtimeCodeHash)
2543
+ ))
2544
+ throw new Error("invalid benchmark runtime identity");
2545
+ if (p.source.toolchain && (!["solidity", "barretenberg", "noir", "evmVersion", "anvil"].every((key) => {
2546
+ const v = p.source.toolchain[key];
2547
+ return typeof v === "string" && v.length > 0;
2548
+ }) || !Number.isSafeInteger(p.source.toolchain.optimizerRuns) || p.source.toolchain.optimizerRuns < 0))
2549
+ throw new Error("invalid benchmark toolchain");
1885
2550
  for (const m of p.measurements) {
1886
2551
  if (!m.id || !m.samples.length || !["none", "caller", "signature"].includes(m.shape.funding) || typeof m.shape.permit !== "boolean")
1887
2552
  throw new Error("invalid gas benchmark measurement");
@@ -1961,11 +2626,20 @@ function estimateBenchmarkGas(plan, protocol, profiles) {
1961
2626
  );
1962
2627
  if (!request.deployment.runtimeCodeHash || !candidates.length)
1963
2628
  return { ...base, available: false, reason: "deployment-not-covered" };
1964
- for (const profile of candidates) {
1965
- const measurement = profile.measurements.find(
2629
+ const exact = candidates.flatMap(
2630
+ (profile) => profile.measurements.filter(
1966
2631
  (m) => shapeKeys.every((key) => m.shape[key] === request.shape[key]) && sameCircuit(m.circuit, request.circuit)
1967
- );
1968
- if (!measurement) continue;
2632
+ ).map((measurement) => ({ profile, measurement }))
2633
+ );
2634
+ const mean = (measurement) => {
2635
+ const count = BigInt(measurement.samples.length);
2636
+ return (measurement.samples.reduce((sum, s) => sum + BigInt(s.gasUsed), 0n) + count - 1n) / count;
2637
+ };
2638
+ exact.sort(
2639
+ (a, b) => mean(a.measurement) > mean(b.measurement) ? -1 : mean(a.measurement) < mean(b.measurement) ? 1 : a.measurement.id.localeCompare(b.measurement.id)
2640
+ );
2641
+ if (exact.length) {
2642
+ const { profile, measurement } = exact[0];
1969
2643
  const gas = measurement.samples.map((sample) => BigInt(sample.gasUsed));
1970
2644
  const count = BigInt(gas.length);
1971
2645
  return {
@@ -1995,14 +2669,20 @@ function estimateShapeGas(request, profiles = defaultProfiles) {
1995
2669
  const matching = measurements.filter(
1996
2670
  (measurement) => measurement.shape.kind === request.shape.kind && measurement.shape.target === request.shape.target && sameCircuit(measurement.circuit, request.circuit)
1997
2671
  );
1998
- const exact = matching.find(
2672
+ const exact = matching.filter(
1999
2673
  (measurement) => shapeKeys.every((key) => measurement.shape[key] === request.shape[key])
2000
2674
  );
2001
- if (exact) {
2002
- const gas = exact.samples.map((sample) => BigInt(sample.gasUsed));
2003
- const count = BigInt(gas.length);
2004
- return { gasUnits: (gas.reduce((sum, value) => sum + value, 0n) + count - 1n) / count };
2675
+ if (exact.length) {
2676
+ const means = exact.map((m) => {
2677
+ const count = BigInt(m.samples.length);
2678
+ return (m.samples.reduce((sum, s) => sum + BigInt(s.gasUsed), 0n) + count - 1n) / count;
2679
+ });
2680
+ return { gasUnits: means.reduce((max, v) => v > max ? v : max) };
2005
2681
  }
2682
+ if (["create-credit", "draw-credit", "top-up-credit", "cancel-credit"].includes(
2683
+ request.shape.kind
2684
+ ) && !matching.length)
2685
+ throw new Error("No current Credit gas reference for this artifact and verification key");
2006
2686
  const candidates = matching.length ? matching : measurements.filter(
2007
2687
  (measurement) => measurement.shape.kind === request.shape.kind && measurement.shape.target === request.shape.target
2008
2688
  );
@@ -2017,7 +2697,22 @@ function estimateShapeGas(request, profiles = defaultProfiles) {
2017
2697
  "deliveryBytes",
2018
2698
  ...!matching.length ? ["capacity"] : []
2019
2699
  ];
2020
- const estimates = candidates.map((measurement) => {
2700
+ const groups = /* @__PURE__ */ new Map();
2701
+ for (const candidate of candidates) {
2702
+ const key = JSON.stringify([
2703
+ shapeKeys.map((k) => candidate.shape[k]),
2704
+ candidate.circuit?.circuitName,
2705
+ candidate.circuit?.target,
2706
+ candidate.circuit?.artifactSha256.toLowerCase(),
2707
+ candidate.circuit?.vkSha256.toLowerCase()
2708
+ ]);
2709
+ const previous = groups.get(key);
2710
+ groups.set(
2711
+ key,
2712
+ previous ? { ...candidate, samples: [...previous.samples, ...candidate.samples] } : candidate
2713
+ );
2714
+ }
2715
+ const estimates = [...groups.values()].map((measurement) => {
2021
2716
  let numerator = 1n;
2022
2717
  let denominator = 1n;
2023
2718
  for (const key of dimensions) {
@@ -2048,7 +2743,7 @@ function estimateGasReference(plan, protocol, profiles) {
2048
2743
 
2049
2744
  // src/session/operation-execution.ts
2050
2745
  var import_ethers6 = require("ethers");
2051
- var import_core3 = require("@invisi-labs/core");
2746
+ var import_core4 = require("@invisi-labs/core");
2052
2747
 
2053
2748
  // src/session/proof-integrity.ts
2054
2749
  var import_ethers5 = require("ethers");
@@ -2077,7 +2772,7 @@ async function authorizeOperation(plan, provider) {
2077
2772
  if (provider.walletIdentity !== plan.scope.walletIdentity)
2078
2773
  throw new Error("wallet authorization capability mismatch");
2079
2774
  const request = authorizationRequest(plan);
2080
- const digest = (0, import_core3.computeWalletAuthorizationDigest)(request);
2775
+ const digest = (0, import_core4.computeWalletAuthorizationDigest)(request);
2081
2776
  const signed = await provider.authorize(structuredClone(request));
2082
2777
  if (signed.walletIdentity !== plan.scope.walletIdentity || signed.digest !== digest)
2083
2778
  throw new Error("wallet authorization statement mismatch");
@@ -2161,11 +2856,11 @@ function operationPreview(plan, status) {
2161
2856
  }
2162
2857
 
2163
2858
  // src/session/Operation.ts
2164
- var import_core7 = require("@invisi-labs/core");
2859
+ var import_core8 = require("@invisi-labs/core");
2165
2860
  var import_protocol4 = require("@invisi-labs/protocol");
2166
2861
 
2167
2862
  // src/session/operation-confirmation.ts
2168
- var import_core6 = require("@invisi-labs/core");
2863
+ var import_core7 = require("@invisi-labs/core");
2169
2864
 
2170
2865
  // src/session/aggregate-receipt.ts
2171
2866
  var import_ethers7 = require("ethers");
@@ -2221,10 +2916,10 @@ function matchesAggregateTransaction(saved, transaction) {
2221
2916
  }
2222
2917
 
2223
2918
  // src/session/credit-values.ts
2224
- var import_core4 = require("@invisi-labs/core");
2919
+ var import_core5 = require("@invisi-labs/core");
2225
2920
  async function creditLeaf(state) {
2226
2921
  const n = state.note;
2227
- return (0, import_core4.computeCreditCommitment)(
2922
+ return (0, import_core5.computeCreditCommitment)(
2228
2923
  n.chainId,
2229
2924
  n.spenderWalletIdentity,
2230
2925
  n.ownerWalletIdentity,
@@ -2234,22 +2929,23 @@ async function creditLeaf(state) {
2234
2929
  n.amount,
2235
2930
  n.nonce,
2236
2931
  n.expiry,
2237
- await (0, import_core4.computeCreditSharedKeyHash)(n.creditSharedKey)
2932
+ await (0, import_core5.computeCreditSharedKeyHash)(n.creditSharedKey),
2933
+ n
2238
2934
  );
2239
2935
  }
2240
2936
 
2241
2937
  // src/session/membership.ts
2242
- var import_core5 = require("@invisi-labs/core");
2938
+ var import_core6 = require("@invisi-labs/core");
2243
2939
  async function verifyMembership(reader, context, block, input, proof) {
2244
2940
  if (proof.block.hash !== block.hash || proof.block.number !== block.number || proof.leaf !== input.commitment || proof.treeId !== input.treeId || proof.leafIndex !== input.leafIndex || proof.path.length !== 16 || !Number.isInteger(input.leafIndex) || input.leafIndex < 0 || input.leafIndex >= 65536 || !await reader.isKnownRoot(context, input.treeId, proof.root, block))
2245
2941
  throw new Error("membership context/root mismatch");
2246
2942
  let root = BigInt(input.commitment);
2247
2943
  for (let i = 0; i < 16; i++) {
2248
2944
  const sibling = proof.path[i];
2249
- if (typeof sibling !== "bigint" || sibling < 0n || sibling >= import_core5.FIELD_MODULUS)
2945
+ if (typeof sibling !== "bigint" || sibling < 0n || sibling >= import_core6.FIELD_MODULUS)
2250
2946
  throw new Error("noncanonical membership path");
2251
2947
  root = BigInt(
2252
- await (0, import_core5.poseidonHash)(input.leafIndex >> i & 1 ? [sibling, root] : [root, sibling])
2948
+ await (0, import_core6.poseidonHash)(input.leafIndex >> i & 1 ? [sibling, root] : [root, sibling])
2253
2949
  );
2254
2950
  }
2255
2951
  if (root !== BigInt(proof.root))
@@ -2421,7 +3117,7 @@ async function confirmOperation(runtime, id, generation, hash2, signal) {
2421
3117
  if (credits.length) {
2422
3118
  const nullifiers = await Promise.all(
2423
3119
  credits.map(
2424
- async (record) => (0, import_core6.computeCreditNullifier)(
3120
+ async (record) => (0, import_core7.computeCreditNullifier)(
2425
3121
  plan.context.chainId,
2426
3122
  record.state.note.creditSharedKey,
2427
3123
  await creditLeaf(record.state)
@@ -2753,7 +3449,7 @@ var Operation = class _Operation {
2753
3449
  }
2754
3450
  const prover = this.#runtime.options.prover;
2755
3451
  if (!prover) {
2756
- throw new import_core7.MissingCapabilityError("prover");
3452
+ throw new import_core8.MissingCapabilityError("prover");
2757
3453
  }
2758
3454
  return this.stage(
2759
3455
  "proof",
@@ -2787,7 +3483,7 @@ var Operation = class _Operation {
2787
3483
  check6(p.kind === "shield" || this.#saved.proof, "proof must precede funding authorization");
2788
3484
  const signer = this.#runtime.options.fundingSigner;
2789
3485
  if (!signer) {
2790
- throw new import_core7.MissingCapabilityError("EVM funding signer");
3486
+ throw new import_core8.MissingCapabilityError("EVM funding signer");
2791
3487
  }
2792
3488
  check6(
2793
3489
  signer.address.toLowerCase() === p.funding.payer.toLowerCase(),
@@ -2978,7 +3674,7 @@ var Operation = class _Operation {
2978
3674
 
2979
3675
  // src/session/WalletSession.ts
2980
3676
  var import_ethers11 = require("ethers");
2981
- var import_core12 = require("@invisi-labs/core");
3677
+ var import_core13 = require("@invisi-labs/core");
2982
3678
 
2983
3679
  // src/session/transaction-preparation.ts
2984
3680
  var import_ethers10 = require("ethers");
@@ -2986,7 +3682,7 @@ var import_protocol7 = require("@invisi-labs/protocol");
2986
3682
 
2987
3683
  // src/session/prepare-common.ts
2988
3684
  var import_ethers8 = require("ethers");
2989
- var import_core8 = require("@invisi-labs/core");
3685
+ var import_core9 = require("@invisi-labs/core");
2990
3686
  var import_protocol5 = require("@invisi-labs/protocol");
2991
3687
 
2992
3688
  // src/session/selection.ts
@@ -3042,7 +3738,15 @@ var Preparation = class {
3042
3738
  throw new Error("canonical wallet checkpoint changed; resync required");
3043
3739
  }
3044
3740
  }
3045
- return { context: { ...options.protocol.context, now: block.timestamp }, block, deadline };
3741
+ return {
3742
+ context: {
3743
+ ...options.protocol.context,
3744
+ now: block.timestamp,
3745
+ timestamp: block.timestamp
3746
+ },
3747
+ block,
3748
+ deadline
3749
+ };
3046
3750
  }
3047
3751
  async assertBlock(frame) {
3048
3752
  if ((await this.runtime.reader.getBlock(frame.block.number)).hash !== frame.block.hash) {
@@ -3083,12 +3787,12 @@ var Preparation = class {
3083
3787
  }
3084
3788
  async output(payment, context, change = false) {
3085
3789
  positiveAmount(payment.amount);
3086
- const recipient = await import_core8.ReceivingAddress.parse(payment.to).resolve(
3790
+ const recipient = await import_core9.ReceivingAddress.parse(payment.to).resolve(
3087
3791
  this.runtime.options.addressResolver
3088
3792
  );
3089
- const memo = (0, import_core8.encodeMemo)(payment.memo);
3090
- const nonce = (0, import_core8.generateNonce)();
3091
- const identity = await (0, import_core8.computeNoteIdentity)(BigInt(recipient.walletIdentity), nonce);
3793
+ const memo = (0, import_core9.encodeMemo)(payment.memo);
3794
+ const nonce = (0, import_core9.generateNonce)();
3795
+ const identity = await (0, import_core9.computeNoteIdentity)(BigInt(recipient.walletIdentity), nonce);
3092
3796
  const keys = recipient.getReceivingKeys();
3093
3797
  const note = {
3094
3798
  chainId: context.chainId,
@@ -3099,7 +3803,7 @@ var Preparation = class {
3099
3803
  ...memo.length === 0 ? {} : { memo },
3100
3804
  nonce
3101
3805
  };
3102
- const commitment = await (0, import_core8.computeNoteCommitment)(
3806
+ const commitment = await (0, import_core9.computeNoteCommitment)(
3103
3807
  context.chainId,
3104
3808
  identity,
3105
3809
  note.tokenAddress,
@@ -3113,20 +3817,20 @@ var Preparation = class {
3113
3817
  change,
3114
3818
  delivery: {
3115
3819
  ciphertext: (0, import_ethers8.hexlify)(
3116
- await (0, import_core8.encryptPrivateTransferNote)(keys.viewingPublicKey, note, {
3820
+ await (0, import_core9.encryptPrivateTransferNote)(keys.viewingPublicKey, note, {
3117
3821
  chainId: context.chainId,
3118
3822
  protocolAddress: note.protocolAddress,
3119
3823
  outputCommitment: commitment
3120
3824
  })
3121
3825
  ),
3122
- clue: (0, import_ethers8.hexlify)((0, import_core8.createClue)(keys.clueKey))
3826
+ clue: (0, import_ethers8.hexlify)((0, import_core9.createClue)(keys.clueKey))
3123
3827
  }
3124
3828
  };
3125
3829
  }
3126
3830
  async membership(input, frame) {
3127
3831
  const { options, reader } = this.runtime;
3128
3832
  if (!options.protocolRpc)
3129
- throw new import_core8.MissingCapabilityError("Protocol RPC membership provider");
3833
+ throw new import_core9.MissingCapabilityError("Protocol RPC membership provider");
3130
3834
  const root = this.#roots.get(input.treeId);
3131
3835
  const proof = await options.protocolRpc.getMembership(
3132
3836
  frame.context,
@@ -3173,9 +3877,9 @@ var Preparation = class {
3173
3877
  for (const input of selected) {
3174
3878
  const note = input.note;
3175
3879
  const c = frame.context;
3176
- if (note.walletIdentity !== scope.walletIdentity || note.chainId !== c.chainId || note.protocolAddress !== BigInt(c.protocolAddress) || note.tokenAddress !== BigInt(c.tokenAddress) || await (0, import_core8.computeNoteCommitment)(
3880
+ if (note.walletIdentity !== scope.walletIdentity || note.chainId !== c.chainId || note.protocolAddress !== BigInt(c.protocolAddress) || note.tokenAddress !== BigInt(c.tokenAddress) || await (0, import_core9.computeNoteCommitment)(
3177
3881
  c.chainId,
3178
- await (0, import_core8.computeNoteIdentity)(BigInt(note.walletIdentity), note.nonce),
3882
+ await (0, import_core9.computeNoteIdentity)(BigInt(note.walletIdentity), note.nonce),
3179
3883
  note.tokenAddress,
3180
3884
  note.amount
3181
3885
  ) !== input.commitment) {
@@ -3227,7 +3931,7 @@ function storedCandidates(inputs) {
3227
3931
 
3228
3932
  // src/session/prepare-credit.ts
3229
3933
  var import_ethers9 = require("ethers");
3230
- var import_core9 = require("@invisi-labs/core");
3934
+ var import_core10 = require("@invisi-labs/core");
3231
3935
  var import_protocol6 = require("@invisi-labs/protocol");
3232
3936
  var EMPTY = { ciphertext: "0x", clue: "0x" };
3233
3937
  var CreditPreparation = class {
@@ -3243,7 +3947,7 @@ var CreditPreparation = class {
3243
3947
  return value;
3244
3948
  }
3245
3949
  async seal(input, frame) {
3246
- const state = (0, import_core9.normalizeCreditDeliveryState)(input);
3950
+ const state = (0, import_core10.normalizeCreditDeliveryState)(input);
3247
3951
  const commitment = await creditLeaf(state);
3248
3952
  const context = {
3249
3953
  chainId: frame.context.chainId,
@@ -3255,9 +3959,9 @@ var CreditPreparation = class {
3255
3959
  const keys = role === "owner" ? state.ownerReceivingKeys : state.spenderReceivingKeys;
3256
3960
  return {
3257
3961
  ciphertext: (0, import_ethers9.hexlify)(
3258
- await (0, import_core9.encryptCreditNote)(keys.viewingPublicKey, state, { ...context, role })
3962
+ await (0, import_core10.encryptCreditNote)(keys.viewingPublicKey, state, { ...context, role })
3259
3963
  ),
3260
- clue: (0, import_ethers9.hexlify)((0, import_core9.createClue)(keys.clueKey))
3964
+ clue: (0, import_ethers9.hexlify)((0, import_core10.createClue)(keys.clueKey))
3261
3965
  };
3262
3966
  })
3263
3967
  );
@@ -3268,14 +3972,14 @@ var CreditPreparation = class {
3268
3972
  if (!stored || stored.spent !== "unspent" || stored.role !== role) {
3269
3973
  throw new Error(`confirmed unspent ${role} Credit is unavailable`);
3270
3974
  }
3271
- const state = (0, import_core9.normalizeCreditDeliveryState)(stored.state);
3975
+ const state = (0, import_core10.normalizeCreditDeliveryState)(stored.state);
3272
3976
  const n = state.note;
3273
3977
  if ((role === "owner" ? n.ownerWalletIdentity : n.spenderWalletIdentity) !== this.runtime.scope.walletIdentity || n.chainId !== frame.context.chainId || n.protocolAddress !== BigInt(frame.context.protocolAddress) || n.tokenAddress !== BigInt(frame.context.tokenAddress) || await creditLeaf(state) !== commitment) {
3274
3978
  throw new Error("Credit role, commitment or deployment mismatch");
3275
3979
  }
3276
3980
  const proof = await this.#prepare.membership(stored, frame);
3277
3981
  const path = [...proof.path];
3278
- const nullifier = await (0, import_core9.computeCreditNullifier)(n.chainId, n.creditSharedKey, commitment);
3982
+ const nullifier = await (0, import_core10.computeCreditNullifier)(n.chainId, n.creditSharedKey, commitment);
3279
3983
  await this.#prepare.assertUnspent([nullifier], frame);
3280
3984
  return {
3281
3985
  input: {
@@ -3312,7 +4016,7 @@ var CreditPreparation = class {
3312
4016
  positiveAmount(options.amount, 126);
3313
4017
  const frame = await this.#prepare.frame(options.deadline);
3314
4018
  const expiry = this.expiry(options.expiry, frame);
3315
- const spender = await import_core9.ReceivingAddress.parse(options.spender).resolve(
4019
+ const spender = await import_core10.ReceivingAddress.parse(options.spender).resolve(
3316
4020
  this.runtime.options.addressResolver
3317
4021
  );
3318
4022
  const owner = await this.runtime.options.wallet.getReceivingAddress().resolve(this.runtime.options.addressResolver);
@@ -3331,11 +4035,16 @@ var CreditPreparation = class {
3331
4035
  spenderWalletIdentity: spender.walletIdentity,
3332
4036
  ownerPayout: BigInt(ownerPayout),
3333
4037
  spenderPayout: BigInt(spenderPayout),
4038
+ ...(0, import_core10.normalizeCreditPolicy)({
4039
+ singleLimit: options.singleLimit ?? 0n,
4040
+ dailyLimit: options.dailyLimit ?? 0n,
4041
+ monthlyLimit: options.monthlyLimit ?? 0n
4042
+ }),
3334
4043
  amount: options.amount,
3335
4044
  ...options.memo === void 0 ? {} : { memo: options.memo },
3336
4045
  expiry,
3337
- nonce: (0, import_core9.generateNonce)(),
3338
- creditSharedKey: (0, import_core9.generateCreditSharedKey)()
4046
+ nonce: (0, import_core10.generateNonce)(),
4047
+ creditSharedKey: (0, import_core10.generateCreditSharedKey)()
3339
4048
  },
3340
4049
  ownerReceivingKeys: owner.getReceivingKeys(),
3341
4050
  spenderReceivingKeys: spender.getReceivingKeys()
@@ -3428,9 +4137,12 @@ var CreditPreparation = class {
3428
4137
  ...old,
3429
4138
  note: {
3430
4139
  ...old.note,
4140
+ singleLimit: options.singleLimit ?? old.note.singleLimit ?? 0n,
4141
+ dailyLimit: options.dailyLimit ?? old.note.dailyLimit ?? 0n,
4142
+ monthlyLimit: options.monthlyLimit ?? old.note.monthlyLimit ?? 0n,
3431
4143
  amount,
3432
4144
  expiry,
3433
- nonce: (0, import_core9.generateNonce)(),
4145
+ nonce: (0, import_core10.generateNonce)(),
3434
4146
  ...options.memo === void 0 ? {} : { memo: options.memo }
3435
4147
  }
3436
4148
  },
@@ -3479,6 +4191,7 @@ var CreditPreparation = class {
3479
4191
  }
3480
4192
  sources.set(member.source.treeId, member.source.merkleRoot);
3481
4193
  amounts.push(amount);
4194
+ const usage = (0, import_core10.applyCreditDrawUsage)(n, amount, frame.block.timestamp);
3482
4195
  const remaining = n.amount - amount;
3483
4196
  if (remaining === 0n) {
3484
4197
  remainders.push((0, import_protocol6.word)(0n));
@@ -3498,9 +4211,10 @@ var CreditPreparation = class {
3498
4211
  ...state,
3499
4212
  note: {
3500
4213
  ...n,
4214
+ ...usage,
3501
4215
  amount: remaining,
3502
4216
  ...options.credits[i].memo === void 0 ? {} : { memo: options.credits[i].memo },
3503
- nonce: await (0, import_core9.deriveRemainderNonce)(...args)
4217
+ nonce: await (0, import_core10.deriveRemainderNonce)(...args)
3504
4218
  }
3505
4219
  },
3506
4220
  frame
@@ -3508,7 +4222,7 @@ var CreditPreparation = class {
3508
4222
  outputs.push(output);
3509
4223
  remainders.push(output.commitment);
3510
4224
  recoveryAmounts.push(
3511
- (0, import_protocol6.word)((remaining + await (0, import_core9.computeCreditRecoveryPad)(...args)) % import_core9.FIELD_MODULUS)
4225
+ (0, import_protocol6.word)((remaining + await (0, import_core10.computeCreditRecoveryPad)(...args)) % import_core10.FIELD_MODULUS)
3512
4226
  );
3513
4227
  deliveries.push(...output.deliveries);
3514
4228
  }
@@ -3829,10 +4543,10 @@ async function refreshWallet(runtime, options) {
3829
4543
  }
3830
4544
 
3831
4545
  // src/session/WalletUpdater.ts
3832
- var import_core11 = require("@invisi-labs/core");
4546
+ var import_core12 = require("@invisi-labs/core");
3833
4547
 
3834
4548
  // src/session/inventory.ts
3835
- var import_core10 = require("@invisi-labs/core");
4549
+ var import_core11 = require("@invisi-labs/core");
3836
4550
  var CanonicalConflict = class extends Error {
3837
4551
  };
3838
4552
  var CreditMetadataMismatch = class extends Error {
@@ -3884,10 +4598,10 @@ var InventoryProcessor = class {
3884
4598
  }
3885
4599
  async creditNullifier(state) {
3886
4600
  const n = state.note;
3887
- return (0, import_core10.computeCreditNullifier)(
4601
+ return (0, import_core11.computeCreditNullifier)(
3888
4602
  n.chainId,
3889
4603
  n.creditSharedKey,
3890
- await (0, import_core10.computeCreditCommitment)(
4604
+ await (0, import_core11.computeCreditCommitment)(
3891
4605
  n.chainId,
3892
4606
  n.spenderWalletIdentity,
3893
4607
  n.ownerWalletIdentity,
@@ -3897,7 +4611,8 @@ var InventoryProcessor = class {
3897
4611
  n.amount,
3898
4612
  n.nonce,
3899
4613
  n.expiry,
3900
- await (0, import_core10.computeCreditSharedKeyHash)(n.creditSharedKey)
4614
+ await (0, import_core11.computeCreditSharedKeyHash)(n.creditSharedKey),
4615
+ n
3901
4616
  )
3902
4617
  );
3903
4618
  }
@@ -3944,6 +4659,9 @@ var InventoryProcessor = class {
3944
4659
  };
3945
4660
  for (const event of logs) {
3946
4661
  if (event.eventName === "CreditDraw") {
4662
+ const block = await this.#options.reader.getBlock(event.blockNumber);
4663
+ if (block.hash !== event.blockHash)
4664
+ throw new CanonicalConflict("draw block changed during Credit recovery");
3947
4665
  const args = event.args;
3948
4666
  const params = args.params;
3949
4667
  const indices = args.remainderLeafIndices;
@@ -3957,10 +4675,11 @@ var InventoryProcessor = class {
3957
4675
  previous.state.note.expiry === params.expiries[index2],
3958
4676
  "draw recovery expiry mismatch"
3959
4677
  );
3960
- const remainder = await (0, import_core10.recoverCreditRemainder)(
4678
+ const remainder = await (0, import_core11.recoverCreditRemainder)(
3961
4679
  context,
3962
4680
  previous.state.note,
3963
4681
  {
4682
+ timestamp: block.timestamp,
3964
4683
  creditNullifier: nullifier,
3965
4684
  remainderCommitment: params.remainderCommitments[index2],
3966
4685
  recoveryAmount: BigInt(params.recoveryAmounts[index2])
@@ -3985,7 +4704,7 @@ var InventoryProcessor = class {
3985
4704
  ...clone(previous.state),
3986
4705
  note: {
3987
4706
  ...remainder,
3988
- ...memo === void 0 ? {} : { memo: (0, import_core10.encodeMemo)(memo) }
4707
+ ...memo === void 0 ? {} : { memo: (0, import_core11.encodeMemo)(memo) }
3989
4708
  }
3990
4709
  },
3991
4710
  receivingKeySource: { kind: "draw", commitment: previous.commitment },
@@ -4064,7 +4783,7 @@ var WalletUpdater = class extends InventoryProcessor {
4064
4783
  }
4065
4784
  async run(batch, options) {
4066
4785
  const { reader, protocol, scope, store, viewing } = this.#options;
4067
- const nullifier = import_core11.NullifierCapability.fromIdentity(scope.walletIdentity);
4786
+ const nullifier = import_core12.NullifierCapability.fromIdentity(scope.walletIdentity);
4068
4787
  const { signal, reset } = options;
4069
4788
  signal?.throwIfAborted();
4070
4789
  const context = protocol.context;
@@ -4285,7 +5004,7 @@ var WalletSession = class {
4285
5004
  /** Delegate sending to ethers; managed operations additionally retain the resulting hash. */
4286
5005
  async sendTransaction(input, options = {}) {
4287
5006
  const signer = this.#options.signer;
4288
- if (!signer) throw new import_core12.MissingCapabilityError("ethers signer");
5007
+ if (!signer) throw new import_core13.MissingCapabilityError("ethers signer");
4289
5008
  const operation = input instanceof Operation ? input : void 0;
4290
5009
  if (operation && this.#sending.has(operation.id))
4291
5010
  throw new Error("operation is already being sent by this session");
@@ -4293,12 +5012,12 @@ var WalletSession = class {
4293
5012
  const overrides = { ...options };
4294
5013
  const plain = operation ? void 0 : { ...input };
4295
5014
  try {
4296
- if (!signer.provider) throw new import_core12.MissingCapabilityError("connected ethers signer");
5015
+ if (!signer.provider) throw new import_core13.MissingCapabilityError("connected ethers signer");
4297
5016
  if ((await signer.provider.getNetwork()).chainId !== this.protocol.context.chainId) {
4298
5017
  throw new Error("signer-provider session chain mismatch");
4299
5018
  }
4300
5019
  if (operation) {
4301
- if (!this.#options.store) throw new import_core12.MissingCapabilityError("wallet store");
5020
+ if (!this.#options.store) throw new import_core13.MissingCapabilityError("wallet store");
4302
5021
  const state = await this.#options.store.readSnapshot(this.scope);
4303
5022
  if (!state.operations[operation.id])
4304
5023
  throw new Error("operation does not belong to this wallet session");
@@ -4329,10 +5048,10 @@ var WalletSession = class {
4329
5048
  runtime(tokenAddress) {
4330
5049
  const options = this.#options;
4331
5050
  if (!options.store) {
4332
- throw new import_core12.MissingCapabilityError("wallet store");
5051
+ throw new import_core13.MissingCapabilityError("wallet store");
4333
5052
  }
4334
5053
  if (!options.chainReader) {
4335
- throw new import_core12.MissingCapabilityError("chain reader");
5054
+ throw new import_core13.MissingCapabilityError("chain reader");
4336
5055
  }
4337
5056
  return {
4338
5057
  options: { ...options, protocol: options.protocol.forToken(tokenAddress) },
@@ -4346,7 +5065,7 @@ var WalletSession = class {
4346
5065
  if (this.#updater) return this.#updater;
4347
5066
  const options = this.#options;
4348
5067
  if (!options.store || !options.chainReader || !options.protocolRpc)
4349
- throw new import_core12.MissingCapabilityError("wallet store, chain reader and Protocol RPC");
5068
+ throw new import_core13.MissingCapabilityError("wallet store, chain reader and Protocol RPC");
4350
5069
  const viewing = options.viewing ?? options.wallet.getViewer();
4351
5070
  const receivingAddress = options.wallet.getReceivingAddress();
4352
5071
  const receivingKeys = receivingAddress.kind === "long" ? receivingAddress.getReceivingKeys() : void 0;
@@ -4364,7 +5083,7 @@ var WalletSession = class {
4364
5083
  async balance(tokenAddress) {
4365
5084
  const store = this.#options.store;
4366
5085
  if (!store) {
4367
- throw new import_core12.MissingCapabilityError("wallet store");
5086
+ throw new import_core13.MissingCapabilityError("wallet store");
4368
5087
  }
4369
5088
  return walletBalance(await store.readSnapshot(this.scope), (0, import_ethers11.getAddress)(tokenAddress));
4370
5089
  }
@@ -4372,8 +5091,8 @@ var WalletSession = class {
4372
5091
  async refresh(options) {
4373
5092
  const provider = this.#options.protocolRpc;
4374
5093
  const reader = this.#options.chainReader;
4375
- if (!reader) throw new import_core12.MissingCapabilityError("chain reader");
4376
- if (!provider) throw new import_core12.MissingCapabilityError("Protocol RPC");
5094
+ if (!reader) throw new import_core13.MissingCapabilityError("chain reader");
5095
+ if (!provider) throw new import_core13.MissingCapabilityError("Protocol RPC");
4377
5096
  const updater = this.updater();
4378
5097
  const request = {
4379
5098
  ...options,
@@ -4432,7 +5151,7 @@ var WalletSession = class {
4432
5151
  }
4433
5152
  async resume(operationId) {
4434
5153
  const store = this.#options.store;
4435
- if (!store) throw new import_core12.MissingCapabilityError("wallet store");
5154
+ if (!store) throw new import_core13.MissingCapabilityError("wallet store");
4436
5155
  const state = await store.readSnapshot(this.scope);
4437
5156
  const saved = state.operations[operationId]?.payload;
4438
5157
  if (!saved?.plan) throw new Error("operation not found");