@@ -0,0 +1,121 @@
1+// usage: tweak constants at head of file, then run "node find-gas-usage.js"
2+// for very common events/calls, you may need to use a smaller TO-FROM
3+// range to keep web3 from yelling at you
5+const ORIGIN = 6784800; // launch ceremony begins
6+const PUBLIC = 7033765; // azimuth becomes public
7+const LATEST = 'latest';
12+const VENT = 'ChangedKeys';
13+const FUNC = '0x4447e48c'; // configureKeys
16+// const VENT = 'Spawned';
17+// const FUNC = '0xa0d3253f'; // spawn
20+// const VENT = 'OwnerChanged';
21+// const FUNC = '0x1e79a85b'; // transferPoint
24+// const VENT = 'ChangedSpawnProxy';
25+// const FUNC = '0xae326221'; // setSpawnProxy
28+// const VENT = 'ChangedManagementProxy';
29+// const FUNC = '0x8866bb2c'; // setManagementProxy
32+// const VENT = 'ChangedTransferProxy';
33+// const FUNC = '0x2c7ba564'; // setTransferProxy
36+// const VENT = 'ChangedVotingProxy';
37+// const FUNC = '0xa60e8bd6'; // setVotingProxy
40+// const VENT = 'EscapeRequested';
41+// const FUNC = '0xbf5772b9'; // escape
44+// const VENT = 'EscapeCanceled';
45+// const FUNC = '0xc6d761d4'; // cancelEscape
48+// const VENT = 'EscapeAccepted';
49+// const FUNC = '0xc1b9d98b'; // adopt
52+// const VENT = 'EscapeCanceled';
53+// const FUNC = '0xbbe21ca5'; // reject
56+// const VENT = 'LostSponsor';
57+// const FUNC = '0x073a7804'; // detach
60+const LENT = 64 * ARGS + FUNC.length;
62+const Web3 = require('web3');
63+const azimuth = require('azimuth-js');
66+ const web3 = new Web3(
67+ new Web3.providers.HttpProvider(
68+ 'https://mainnet.infura.io/v3/196a7f37c7d54211b4a07904ec73ad87'
71+ const contracts = await azimuth.initContractsPartial(
73+ '0x223c067f8cf28ae173ee5cafea60ca44c335fecb'
76+ const keyEvents = await contracts.azimuth.getPastEvents(VENT, {
81+ const txsBatch = new web3.BatchRequest();
82+ keyEvents.map(vent => {
84+ web3.eth.getTransaction.request(vent.transactionHash, (err, res) => {})
87+ const txs = await txsBatch.execute();
88+ const keyTxs = txs.response.filter(tx => {
89+ const head = tx.input.slice(0, 10) === FUNC;
90+ const size = tx.input.length === LENT;
92+ console.log('weird inputs', tx.hash);
97+ const receiptsBatch = new web3.BatchRequest();
100+ web3.eth.getTransactionReceipt.request(tx.hash, (err, res) => {})
103+ const recs = await receiptsBatch.execute();
106+ recs.response.map(rec => {
107+ if (rec.status !== true) {
108+ console.log('rejecting', rec.gasUsed);
111+ if (rec.gasUsed > 480000) {
112+ console.log(rec.transactionHash);
114+ if (rec.gasUsed in usage) {
115+ usage[rec.gasUsed]++;
117+ usage[rec.gasUsed] = 1;