Skip to content

Commit f62259d

Browse files
committed
Plant proxy via setStorage instead of addProxy extrinsic
The proxy filtering test runner used to submit an addProxy extrinsic and produce a block before dispatching the dry-run batch. Replaces that with a direct setStorage write into Proxy.proxies. Saves one block per filtering test (~16 blocks across the polkadot proxy file). Also moves the empty-actions early return ahead of the storage write so we do not pay the setStorage cost when there is nothing to test.
1 parent e811c12 commit f62259d

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

packages/shared/src/proxy.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,23 +1233,21 @@ async function proxyCallFilteringSingleTestRunner<
12331233
) {
12341234
const alice = testAccounts.alice
12351235

1236-
// Add the proxy account, with the to-be-tested proxy type
1237-
const addProxyTx = client.api.tx.proxy.addProxy(proxyAccount.address, proxyTypeIx, 0)
1238-
await sendTransaction(addProxyTx.signAsync(alice))
1239-
1240-
await client.dev.newBlock()
1241-
1242-
// Get the appropriate list of actions based on test type
12431236
const proxyActions = await buildProxyActions(proxyType, client, testType, proxyTypeConfig)
12441237

12451238
if (proxyActions.length === 0) {
12461239
return
12471240
}
12481241

1242+
// Plant the proxy relationship and fund the proxy account directly. Avoids the
1243+
// addProxy extrinsic + newBlock that previously cost ~1 block per filtering test.
12491244
await client.dev.setStorage({
12501245
System: {
12511246
account: [[[proxyAccount.address], { providers: 1, data: { free: 10000e10 } }]],
12521247
},
1248+
Proxy: {
1249+
proxies: [[[alice.address], [[{ delegate: proxyAccount.address, proxyType, delay: 0 }], 0]]],
1250+
},
12531251
})
12541252

12551253
// Pre-sign each proxy action with the same base nonce. dryRunExtrinsicsAmortized pops

0 commit comments

Comments
 (0)