@acala-network/chopsticks 0.9.13 → 0.10.0-1

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.
Files changed (27) hide show
  1. package/dist/cjs/cli.js +4 -4
  2. package/dist/cjs/plugins/index.js +2 -1
  3. package/dist/cjs/plugins/trace-transaction/README.md +12 -0
  4. package/dist/cjs/plugins/trace-transaction/__tests__/__snapshots__/trace-call.test.ts.snap +365 -0
  5. package/dist/cjs/plugins/trace-transaction/index.d.ts +2 -0
  6. package/dist/cjs/plugins/trace-transaction/index.js +66 -0
  7. package/dist/cjs/plugins/trace-transaction/table.d.ts +148 -0
  8. package/dist/cjs/plugins/trace-transaction/table.js +168 -0
  9. package/dist/cjs/plugins/trace-transaction/types.d.ts +30 -0
  10. package/dist/cjs/plugins/trace-transaction/types.js +64 -0
  11. package/dist/cjs/plugins/trace-transaction/utils.d.ts +40 -0
  12. package/dist/cjs/plugins/trace-transaction/utils.js +207 -0
  13. package/dist/cjs/utils/tunnel.js +2 -1
  14. package/dist/esm/cli.js +5 -5
  15. package/dist/esm/plugins/index.js +2 -1
  16. package/dist/esm/plugins/trace-transaction/README.md +12 -0
  17. package/dist/esm/plugins/trace-transaction/__tests__/__snapshots__/trace-call.test.ts.snap +365 -0
  18. package/dist/esm/plugins/trace-transaction/index.d.ts +2 -0
  19. package/dist/esm/plugins/trace-transaction/index.js +56 -0
  20. package/dist/esm/plugins/trace-transaction/table.d.ts +148 -0
  21. package/dist/esm/plugins/trace-transaction/table.js +150 -0
  22. package/dist/esm/plugins/trace-transaction/types.d.ts +30 -0
  23. package/dist/esm/plugins/trace-transaction/types.js +54 -0
  24. package/dist/esm/plugins/trace-transaction/utils.d.ts +40 -0
  25. package/dist/esm/plugins/trace-transaction/utils.js +199 -0
  26. package/dist/esm/utils/tunnel.js +2 -1
  27. package/package.json +3 -3
package/dist/cjs/cli.js CHANGED
@@ -20,8 +20,8 @@ const processArgv = async (argv)=>{
20
20
  if (argv.config) {
21
21
  Object.assign(argv, _lodash.default.defaults(argv, await (0, _index.fetchConfig)(argv.config)));
22
22
  }
23
- if (process.env.PORT) {
24
- argv.port = Number(process.env.PORT);
23
+ if (_chopstickscore.environment.PORT) {
24
+ argv.port = Number(_chopstickscore.environment.PORT);
25
25
  }
26
26
  };
27
27
  const commands = (0, _yargs.default)((0, _helpers.hideBin)(process.argv)).scriptName('chopsticks').middleware(processArgv, false).command('*', 'Dev mode, fork off a chain', (yargs)=>yargs.config('config', 'Path to config file with default options', ()=>({})).options((0, _index.getYargsOptions)(_index.configSchema.shape)), async (argv)=>{
@@ -44,7 +44,7 @@ const commands = (0, _yargs.default)((0, _helpers.hideBin)(process.argv)).script
44
44
  parachains.push(chain);
45
45
  }
46
46
  if (parachains.length > 1) {
47
- await (0, _chopstickscore.connectParachains)(parachains);
47
+ await (0, _chopstickscore.connectParachains)(parachains, _chopstickscore.environment.DISABLE_AUTO_HRMP);
48
48
  }
49
49
  if (argv.relaychain) {
50
50
  const { chain: relaychain } = await (0, _index2.setupWithServer)(await (0, _index.fetchConfig)(argv.relaychain));
@@ -53,7 +53,7 @@ const commands = (0, _yargs.default)((0, _helpers.hideBin)(process.argv)).script
53
53
  }
54
54
  }
55
55
  }).strict().help().alias('help', 'h').alias('version', 'v').alias('config', 'c').alias('endpoint', 'e').alias('port', 'p').alias('block', 'b').alias('import-storage', 's').alias('wasm-override', 'w').usage('Usage: $0 <command> [options]').example('$0', '-c acala');
56
- if (!process.env.DISABLE_PLUGINS) {
56
+ if (!_chopstickscore.environment.DISABLE_PLUGINS) {
57
57
  (0, _index1.pluginExtendCli)(commands.config('config', 'Path to config file with default options', ()=>({}))).then(()=>commands.parse());
58
58
  } else {
59
59
  commands.parse();
@@ -22,6 +22,7 @@ _export(exports, {
22
22
  return rpcPluginMethods;
23
23
  }
24
24
  });
25
+ const _chopstickscore = require("@acala-network/chopsticks-core");
25
26
  const _fs = require("fs");
26
27
  const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
27
28
  const _logger = require("../logger.js");
@@ -79,7 +80,7 @@ const rpcPluginHandlers = {};
79
80
  const plugins = (0, _fs.readdirSync)(new URL('.', require("url").pathToFileURL(__filename).toString())).filter((file)=>(0, _fs.lstatSync)(new URL(file, require("url").pathToFileURL(__filename).toString())).isDirectory());
80
81
  const rpcPluginMethods = plugins.filter((name)=>(0, _fs.readdirSync)(new URL(name, require("url").pathToFileURL(__filename).toString())).some((file)=>file.startsWith('rpc'))).map((name)=>`dev_${_lodash.default.camelCase(name)}`);
81
82
  const loadRpcPlugin = async (method)=>{
82
- if (process.env.DISABLE_PLUGINS) {
83
+ if (_chopstickscore.environment.DISABLE_PLUGINS) {
83
84
  return undefined;
84
85
  }
85
86
  if (rpcPluginHandlers[method]) return rpcPluginHandlers[method];
@@ -0,0 +1,12 @@
1
+ # EVM+ trace transaction plugin
2
+
3
+ This plugin allows you to trace the execution of a transaction on the Acala & Karura EVM+. The plugin will take a transaction hash as input and will look up the mainnet for transaction details and perform a trace call for the transaction. You can do either call trace or VM trace
4
+
5
+ Example usage:
6
+ To trace transaction calls, you can use the following command:
7
+
8
+ ```bash
9
+ npx @acala-network/chopsticks trace-transaction <tx-hash> --chain acala --output trace.json
10
+ ```
11
+
12
+ VM trace can be enabled by add `--vm` flag to the command
@@ -0,0 +1,365 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`trace-call > Acala 1`] = `
4
+ "[
5
+ {
6
+ "type": "CALL",
7
+ "from": "0x69f7f2e5a66f36f1ccab6eeafedbdf78ce0cfd06",
8
+ "to": "0x7fe92ec600f15cd25253b421bc151c51b0276b7d",
9
+ "input": "0x9e2c8a5b00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000007d414210be",
10
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
11
+ "gas": 240000,
12
+ "gasUsed": 178429,
13
+ "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
14
+ "error": null,
15
+ "revertReason": null,
16
+ "depth": 0,
17
+ "calls": [
18
+ {
19
+ "type": "DELEGATECALL",
20
+ "from": "0x69f7f2e5a66f36f1ccab6eeafedbdf78ce0cfd06",
21
+ "to": "0xfa68ce20228ae14ac338aedb95f0f55b4e8b2bbe",
22
+ "input": "0x9e2c8a5b00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000007d414210be",
23
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
24
+ "gas": 214107,
25
+ "gasUsed": 152495,
26
+ "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
27
+ "error": null,
28
+ "revertReason": null,
29
+ "depth": 1,
30
+ "calls": [
31
+ {
32
+ "type": "CALL",
33
+ "from": "0x7fe92ec600f15cd25253b421bc151c51b0276b7d",
34
+ "to": "0x0000000000000000000100000000000000000003",
35
+ "input": "0xa9059cbb00000000000000000000000069f7f2e5a66f36f1ccab6eeafedbdf78ce0cfd06000000000000000000000000000000000000000000000000000003a352944002",
36
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
37
+ "gas": 124877,
38
+ "gasUsed": 61299,
39
+ "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
40
+ "error": null,
41
+ "revertReason": null,
42
+ "depth": 2,
43
+ "calls": [
44
+ {
45
+ "type": "CALL",
46
+ "from": "0x0000000000000000000100000000000000000003",
47
+ "to": "0x0000000000000000000000000000000000000400",
48
+ "input": "0xbeabacc80000000000000000000000007fe92ec600f15cd25253b421bc151c51b0276b7d00000000000000000000000069f7f2e5a66f36f1ccab6eeafedbdf78ce0cfd06000000000000000000000000000000000000000000000000000003a352944002",
49
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
50
+ "gas": 119284,
51
+ "gasUsed": 55585,
52
+ "output": null,
53
+ "error": null,
54
+ "revertReason": null,
55
+ "depth": 3,
56
+ "calls": []
57
+ }
58
+ ]
59
+ }
60
+ ]
61
+ }
62
+ ]
63
+ }
64
+ ]"
65
+ `;
66
+
67
+ exports[`trace-call > Karura 1`] = `
68
+ "[
69
+ {
70
+ "type": "CALL",
71
+ "from": "0x1d2ee3565f835759f67df69e4f5c78af6e2f1bde",
72
+ "to": "0x387aa6fffaa5d1e4e39f92d3402d0d002b18ed59",
73
+ "input": "0x413a675f0000000000000000000000002aefc65b6e1660d2ba2796f8698120a2acb956340827afb9d8f574620c4b49da80554613907fcae8d25bb943272514d6a21141440000000000000000000000000000000000000000000100000000000000000082",
74
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
75
+ "gas": 1380000,
76
+ "gasUsed": 1133292,
77
+ "output": null,
78
+ "error": null,
79
+ "revertReason": null,
80
+ "depth": 0,
81
+ "calls": [
82
+ {
83
+ "type": "CREATE",
84
+ "from": "0x387aa6fffaa5d1e4e39f92d3402d0d002b18ed59",
85
+ "to": "0xbc39747ca0cc6da0905fecdd50a557fc5289178c",
86
+ "input": "0x60806040523480156200001157600080fd5b506040516200116838038062001168833981810160405281019062000037919062000373565b81806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503073ffffffffffffffffffffffffffffffffffffffff167f59490ddc6330cd50a9703c0b77827ff51b21e7a8592eb50d5252a4d20188cfd360405160405180910390a25080600160008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604082015181600201559050505050620003ba565b6000604051905090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200019e8262000171565b9050919050565b6000620001b28262000191565b9050919050565b620001c481620001a5565b8114620001d057600080fd5b50565b600081519050620001e481620001b9565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200023a82620001ef565b810181811067ffffffffffffffff821117156200025c576200025b62000200565b5b80604052505050565b60006200027162000162565b90506200027f82826200022f565b919050565b6000620002918262000191565b9050919050565b620002a38162000284565b8114620002af57600080fd5b50565b600081519050620002c38162000298565b92915050565b6000819050919050565b620002de81620002c9565b8114620002ea57600080fd5b50565b600081519050620002fe81620002d3565b92915050565b6000606082840312156200031d576200031c620001ea565b5b62000329606062000265565b905060006200033b84828501620002b2565b60008301525060206200035184828501620002b2565b60208301525060406200036784828501620002ed565b60408301525092915050565b600080608083850312156200038d576200038c6200016c565b5b60006200039d85828601620001d3565b9250506020620003b08582860162000304565b9150509250929050565b610d9e80620003ca6000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806338bb09c91461005157806398d079b01461006d5780639af1d35a14610089578063c0f36cb0146100a7575b600080fd5b61006b6004803603810190610066919061089f565b6100c3565b005b6100876004803603810190610082919061089f565b610133565b005b61009161029c565b60405161009e919061092b565b60405180910390f35b6100c160048036038101906100bc9190610972565b6102c0565b005b6100cc816103db565b60004703610130573073ffffffffffffffffffffffffffffffffffffffff167f4d71224652a46a6b2a06bc43b09b55d157972d227c848693032b32aa7d5aefe860405160405180910390a23373ffffffffffffffffffffffffffffffffffffffff16ff5b50565b60016002015461080673ffffffffffffffffffffffffffffffffffffffff1663e0b490f7336040518263ffffffff1660e01b815260040161017491906109c1565b602060405180830381865afa158015610191573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b59190610a12565b146101f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ec90610a9c565b60405180910390fd5b610299338273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161023291906109c1565b602060405180830381865afa15801561024f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102739190610af2565b8373ffffffffffffffffffffffffffffffffffffffff166107929092919063ffffffff16565b50565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b88c9148846040518263ffffffff1660e01b815260040161031c91906109c1565b602060405180830381865afa158015610339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035d9190610af2565b9050600081116103a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161039990610b6b565b60405180910390fd5b6103cd82828573ffffffffffffffffffffffffffffffffffffffff166107929092919063ffffffff16565b6103d6836100c3565b505050565b600160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036106a557600061080573ffffffffffffffffffffffffffffffffffffffff1663a0712d688373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161048c91906109c1565b602060405180830381865afa1580156104a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cd9190610af2565b6040518263ffffffff1660e01b81526004016104e99190610b9a565b6020604051808303816000875af1158015610508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052c9190610bed565b90508061056e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056590610c66565b60405180910390fd5b7394bb240ff3bb9a61d8f31c39978ce7d858b9c01563d2fd13126001800160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166001600201546001800160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161061091906109c1565b602060405180830381865afa15801561062d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106519190610af2565b6040518463ffffffff1660e01b815260040161066f93929190610cc5565b60006040518083038186803b15801561068757600080fd5b505af415801561069b573d6000803e3d6000fd5b505050505061078f565b7394bb240ff3bb9a61d8f31c39978ce7d858b9c01563d2fd1312826001600201548473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016106ff91906109c1565b602060405180830381865afa15801561071c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107409190610af2565b6040518463ffffffff1660e01b815260040161075e93929190610cc5565b60006040518083038186803b15801561077657600080fd5b505af415801561078a573d6000803e3d6000fd5b505050505b50565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000008152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080610824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081b90610d48565b60405180910390fd5b50505050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061085a8261082f565b9050919050565b600061086c8261084f565b9050919050565b61087c81610861565b811461088757600080fd5b50565b60008135905061089981610873565b92915050565b6000602082840312156108b5576108b461082a565b5b60006108c38482850161088a565b91505092915050565b6000819050919050565b60006108f16108ec6108e78461082f565b6108cc565b61082f565b9050919050565b6000610903826108d6565b9050919050565b6000610915826108f8565b9050919050565b6109258161090a565b82525050565b6000602082019050610940600083018461091c565b92915050565b61094f8161084f565b811461095a57600080fd5b50565b60008135905061096c81610946565b92915050565b600080604083850312156109895761098861082a565b5b60006109978582860161088a565b92505060206109a88582860161095d565b9150509250929050565b6109bb8161084f565b82525050565b60006020820190506109d660008301846109b2565b92915050565b6000819050919050565b6109ef816109dc565b81146109fa57600080fd5b50565b600081519050610a0c816109e6565b92915050565b600060208284031215610a2857610a2761082a565b5b6000610a36848285016109fd565b91505092915050565b600082825260208201905092915050565b7f486f6d61526f757465723a206e6f7420726563697069656e7400000000000000600082015250565b6000610a86601983610a3f565b9150610a9182610a50565b602082019050919050565b60006020820190508181036000830152610ab581610a79565b9050919050565b6000819050919050565b610acf81610abc565b8114610ada57600080fd5b50565b600081519050610aec81610ac6565b92915050565b600060208284031215610b0857610b0761082a565b5b6000610b1684828501610add565b91505092915050565b7f7a65726f20666565000000000000000000000000000000000000000000000000600082015250565b6000610b55600883610a3f565b9150610b6082610b1f565b602082019050919050565b60006020820190508181036000830152610b8481610b48565b9050919050565b610b9481610abc565b82525050565b6000602082019050610baf6000830184610b8b565b92915050565b60008115159050919050565b610bca81610bb5565b8114610bd557600080fd5b50565b600081519050610be781610bc1565b92915050565b600060208284031215610c0357610c0261082a565b5b6000610c1184828501610bd8565b91505092915050565b7f486f6d61526f757465723a206d696e74206661696c6564000000000000000000600082015250565b6000610c50601783610a3f565b9150610c5b82610c1a565b602082019050919050565b60006020820190508181036000830152610c7f81610c43565b9050919050565b6000610c91826108f8565b9050919050565b610ca181610c86565b82525050565b610cb0816109dc565b82525050565b610cbf81610abc565b82525050565b6000606082019050610cda6000830186610c98565b610ce76020830185610ca7565b610cf46040830184610cb6565b949350505050565b7f5452414e534645525f4641494c45440000000000000000000000000000000000600082015250565b6000610d32600f83610a3f565b9150610d3d82610cfc565b602082019050919050565b60006020820190508181036000830152610d6181610d25565b905091905056fea2646970667358221220fd86f3941eddecca0464d71c11e373005f2fb64d2980af3d49eff46c102d620e64736f6c634300081200330000000000000000000000002aefc65b6e1660d2ba2796f8698120a2acb95634000000000000000000000000000000000000000000010000000000000000008200000000000000000000000000000000000000000001000000000000000000830827afb9d8f574620c4b49da80554613907fcae8d25bb943272514d6a2114144",
87
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
88
+ "gas": 1354644,
89
+ "gasUsed": 822356,
90
+ "output": null,
91
+ "error": null,
92
+ "revertReason": null,
93
+ "depth": 1,
94
+ "calls": []
95
+ },
96
+ {
97
+ "type": "CALL",
98
+ "from": "0x387aa6fffaa5d1e4e39f92d3402d0d002b18ed59",
99
+ "to": "0xbc39747ca0cc6da0905fecdd50a557fc5289178c",
100
+ "input": "0xc0f36cb000000000000000000000000000000000000000000001000000000000000000820000000000000000000000001d2ee3565f835759f67df69e4f5c78af6e2f1bde",
101
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
102
+ "gas": 531468,
103
+ "gasUsed": 284712,
104
+ "output": null,
105
+ "error": null,
106
+ "revertReason": null,
107
+ "depth": 1,
108
+ "calls": [
109
+ {
110
+ "type": "STATICCALL",
111
+ "from": "0xbc39747ca0cc6da0905fecdd50a557fc5289178c",
112
+ "to": "0x2aefc65b6e1660d2ba2796f8698120a2acb95634",
113
+ "input": "0xb88c91480000000000000000000000000000000000000000000100000000000000000082",
114
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
115
+ "gas": 521895,
116
+ "gasUsed": 5419,
117
+ "output": "0x000000000000000000000000000000000000000000000000000000003b9aca00",
118
+ "error": null,
119
+ "revertReason": null,
120
+ "depth": 2,
121
+ "calls": []
122
+ },
123
+ {
124
+ "type": "CALL",
125
+ "from": "0xbc39747ca0cc6da0905fecdd50a557fc5289178c",
126
+ "to": "0x0000000000000000000100000000000000000082",
127
+ "input": "0xa9059cbb0000000000000000000000001d2ee3565f835759f67df69e4f5c78af6e2f1bde000000000000000000000000000000000000000000000000000000003b9aca00",
128
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
129
+ "gas": 516003,
130
+ "gasUsed": 61430,
131
+ "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
132
+ "error": null,
133
+ "revertReason": null,
134
+ "depth": 2,
135
+ "calls": [
136
+ {
137
+ "type": "CALL",
138
+ "from": "0x0000000000000000000100000000000000000082",
139
+ "to": "0x0000000000000000000000000000000000000400",
140
+ "input": "0xbeabacc8000000000000000000000000bc39747ca0cc6da0905fecdd50a557fc5289178c0000000000000000000000001d2ee3565f835759f67df69e4f5c78af6e2f1bde000000000000000000000000000000000000000000000000000000003b9aca00",
141
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
142
+ "gas": 504299,
143
+ "gasUsed": 55716,
144
+ "output": null,
145
+ "error": null,
146
+ "revertReason": null,
147
+ "depth": 3,
148
+ "calls": []
149
+ }
150
+ ]
151
+ },
152
+ {
153
+ "type": "STATICCALL",
154
+ "from": "0xbc39747ca0cc6da0905fecdd50a557fc5289178c",
155
+ "to": "0x0000000000000000000100000000000000000082",
156
+ "input": "0x70a08231000000000000000000000000bc39747ca0cc6da0905fecdd50a557fc5289178c",
157
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
158
+ "gas": 454000,
159
+ "gasUsed": 10060,
160
+ "output": "0x000000000000000000000000000000000000000000000000000005e927feda9b",
161
+ "error": null,
162
+ "revertReason": null,
163
+ "depth": 2,
164
+ "calls": [
165
+ {
166
+ "type": "STATICCALL",
167
+ "from": "0x0000000000000000000100000000000000000082",
168
+ "to": "0x0000000000000000000000000000000000000400",
169
+ "input": "0x70a08231000000000000000000000000bc39747ca0cc6da0905fecdd50a557fc5289178c",
170
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
171
+ "gas": 446027,
172
+ "gasUsed": 8832,
173
+ "output": "0x000000000000000000000000000000000000000000000000000005e927feda9b",
174
+ "error": null,
175
+ "revertReason": null,
176
+ "depth": 3,
177
+ "calls": []
178
+ }
179
+ ]
180
+ },
181
+ {
182
+ "type": "CALL",
183
+ "from": "0xbc39747ca0cc6da0905fecdd50a557fc5289178c",
184
+ "to": "0x0000000000000000000000000000000000000805",
185
+ "input": "0xa0712d68000000000000000000000000000000000000000000000000000005e927feda9b",
186
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
187
+ "gas": 443406,
188
+ "gasUsed": 120952,
189
+ "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
190
+ "error": null,
191
+ "revertReason": null,
192
+ "depth": 2,
193
+ "calls": [
194
+ {
195
+ "type": "CALL",
196
+ "from": "0x0000000000000000000000000000000000000805",
197
+ "to": "0x0000000000000000000000000000000000000407",
198
+ "input": "0x40c10f19000000000000000000000000bc39747ca0cc6da0905fecdd50a557fc5289178c000000000000000000000000000000000000000000000000000005e927feda9b",
199
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
200
+ "gas": 433128,
201
+ "gasUsed": 115971,
202
+ "output": null,
203
+ "error": null,
204
+ "revertReason": null,
205
+ "depth": 3,
206
+ "calls": []
207
+ }
208
+ ]
209
+ },
210
+ {
211
+ "type": "STATICCALL",
212
+ "from": "0xbc39747ca0cc6da0905fecdd50a557fc5289178c",
213
+ "to": "0x0000000000000000000100000000000000000083",
214
+ "input": "0x70a08231000000000000000000000000bc39747ca0cc6da0905fecdd50a557fc5289178c",
215
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
216
+ "gas": 321427,
217
+ "gasUsed": 12560,
218
+ "output": "0x00000000000000000000000000000000000000000000000000002601d769faa7",
219
+ "error": null,
220
+ "revertReason": null,
221
+ "depth": 2,
222
+ "calls": [
223
+ {
224
+ "type": "STATICCALL",
225
+ "from": "0x0000000000000000000100000000000000000083",
226
+ "to": "0x0000000000000000000000000000000000000400",
227
+ "input": "0x70a08231000000000000000000000000bc39747ca0cc6da0905fecdd50a557fc5289178c",
228
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
229
+ "gas": 313065,
230
+ "gasUsed": 8832,
231
+ "output": "0x00000000000000000000000000000000000000000000000000002601d769faa7",
232
+ "error": null,
233
+ "revertReason": null,
234
+ "depth": 3,
235
+ "calls": []
236
+ }
237
+ ]
238
+ },
239
+ {
240
+ "type": "DELEGATECALL",
241
+ "from": "0x387aa6fffaa5d1e4e39f92d3402d0d002b18ed59",
242
+ "to": "0x94bb240ff3bb9a61d8f31c39978ce7d858b9c015",
243
+ "input": "0xd2fd131200000000000000000000000000000000000000000001000000000000000000830827afb9d8f574620c4b49da80554613907fcae8d25bb943272514d6a211414400000000000000000000000000000000000000000000000000002601d769faa7",
244
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
245
+ "gas": 305278,
246
+ "gasUsed": 60576,
247
+ "output": null,
248
+ "error": null,
249
+ "revertReason": null,
250
+ "depth": 2,
251
+ "calls": [
252
+ {
253
+ "type": "CALL",
254
+ "from": "0xbc39747ca0cc6da0905fecdd50a557fc5289178c",
255
+ "to": "0x0000000000000000000100000000000000000083",
256
+ "input": "0x871069c00827afb9d8f574620c4b49da80554613907fcae8d25bb943272514d6a211414400000000000000000000000000000000000000000000000000002601d769faa7",
257
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
258
+ "gas": 299083,
259
+ "gasUsed": 58789,
260
+ "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
261
+ "error": null,
262
+ "revertReason": null,
263
+ "depth": 3,
264
+ "calls": [
265
+ {
266
+ "type": "CALL",
267
+ "from": "0x0000000000000000000100000000000000000083",
268
+ "to": "0x0000000000000000000000000000000000000400",
269
+ "input": "0x89590498000000000000000000000000bc39747ca0cc6da0905fecdd50a557fc5289178c0827afb9d8f574620c4b49da80554613907fcae8d25bb943272514d6a211414400000000000000000000000000000000000000000000000000002601d769faa7",
270
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
271
+ "gas": 293345,
272
+ "gasUsed": 55716,
273
+ "output": null,
274
+ "error": null,
275
+ "revertReason": null,
276
+ "depth": 4,
277
+ "calls": []
278
+ }
279
+ ]
280
+ }
281
+ ]
282
+ },
283
+ {
284
+ "type": "SUICIDE",
285
+ "from": "0xbc39747ca0cc6da0905fecdd50a557fc5289178c",
286
+ "to": "0x387aa6fffaa5d1e4e39f92d3402d0d002b18ed59",
287
+ "input": "0x",
288
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
289
+ "gas": 0,
290
+ "gasUsed": 0,
291
+ "output": null,
292
+ "error": null,
293
+ "revertReason": null,
294
+ "depth": 2,
295
+ "calls": []
296
+ }
297
+ ]
298
+ }
299
+ ]
300
+ }
301
+ ]"
302
+ `;
303
+
304
+ exports[`trace-call > Substrate+EVM 1`] = `
305
+ "[
306
+ {
307
+ "type": "CALL",
308
+ "from": "0x87c048b68dd762c17224e1e3b7af67da728270ac",
309
+ "to": "0x07df96d1341a7d16ba1ad431e2c847d978bc2bce",
310
+ "input": "0xa9059cbb000000000000000000000000905c015e38c24ed973fd6075541a124c621fa7430000000000000000000000000000000000000000000000000000000012ff7252",
311
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
312
+ "gas": 200000,
313
+ "gasUsed": 49773,
314
+ "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
315
+ "error": null,
316
+ "revertReason": null,
317
+ "depth": 0,
318
+ "calls": [
319
+ {
320
+ "type": "STATICCALL",
321
+ "from": "0x07df96d1341a7d16ba1ad431e2c847d978bc2bce",
322
+ "to": "0xae9d7fe007b3327aa64a32824aaac52c42a6e624",
323
+ "input": "0x5c60da1b",
324
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
325
+ "gas": 173483,
326
+ "gasUsed": 7454,
327
+ "output": "0x0000000000000000000000006c780b35bcb862912e20384a9373426004e4cb92",
328
+ "error": null,
329
+ "revertReason": null,
330
+ "depth": 1,
331
+ "calls": [
332
+ {
333
+ "type": "DELEGATECALL",
334
+ "from": "0x07df96d1341a7d16ba1ad431e2c847d978bc2bce",
335
+ "to": "0x294a3918bd93dbb02127cf900e3f919623b12430",
336
+ "input": "0x5c60da1b",
337
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
338
+ "gas": 168420,
339
+ "gasUsed": 5059,
340
+ "output": "0x0000000000000000000000006c780b35bcb862912e20384a9373426004e4cb92",
341
+ "error": null,
342
+ "revertReason": null,
343
+ "depth": 2,
344
+ "calls": []
345
+ }
346
+ ]
347
+ },
348
+ {
349
+ "type": "DELEGATECALL",
350
+ "from": "0x87c048b68dd762c17224e1e3b7af67da728270ac",
351
+ "to": "0x6c780b35bcb862912e20384a9373426004e4cb92",
352
+ "input": "0xa9059cbb000000000000000000000000905c015e38c24ed973fd6075541a124c621fa7430000000000000000000000000000000000000000000000000000000012ff7252",
353
+ "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
354
+ "gas": 165757,
355
+ "gasUsed": 15489,
356
+ "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
357
+ "error": null,
358
+ "revertReason": null,
359
+ "depth": 1,
360
+ "calls": []
361
+ }
362
+ ]
363
+ }
364
+ ]"
365
+ `;
@@ -0,0 +1,2 @@
1
+ import { Argv } from 'yargs';
2
+ export declare const cli: (y: Argv) => void;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "cli", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return cli;
9
+ }
10
+ });
11
+ const _chopstickscore = require("@acala-network/chopsticks-core");
12
+ const _fs = require("fs");
13
+ const _zod = require("zod");
14
+ const _index = require("../../schema/index.js");
15
+ const _utils = require("./utils.js");
16
+ const _context = require("../../context.js");
17
+ const schema = _index.configSchema.extend({
18
+ vm: _zod.z.boolean({
19
+ description: 'Trace VM opcode'
20
+ }).optional(),
21
+ 'enable-memory': _zod.z.boolean({
22
+ description: 'Enable memory trace'
23
+ }).optional(),
24
+ 'disable-stack': _zod.z.boolean({
25
+ description: 'Disable stack trace'
26
+ }).optional(),
27
+ 'page-size': _zod.z.number({
28
+ description: 'Default 50000. Reduce this if you get memory limit error.'
29
+ }).optional(),
30
+ output: _zod.z.string({
31
+ description: 'Output file'
32
+ })
33
+ });
34
+ const cli = (y)=>{
35
+ y.command('trace-transaction <tx-hash>', 'EVM+ trace transaction. Only Acala and Karura are supported', (yargs)=>yargs.options((0, _index.getYargsOptions)(schema.shape)).positional('tx-hash', {
36
+ desc: 'Transaction hash',
37
+ type: 'string',
38
+ required: true
39
+ }), async (argv)=>{
40
+ const config = schema.parse(argv);
41
+ const wasmPath = config['wasm-override'];
42
+ delete config['wasm-override'];
43
+ const context = await (0, _context.setupContext)(config, false);
44
+ const txHash = argv['tx-hash'];
45
+ if (!txHash) {
46
+ throw new Error('tx-hash is required');
47
+ }
48
+ const transaction = await (0, _utils.fetchEVMTransaction)(await context.chain.head.runtimeVersion, txHash);
49
+ _chopstickscore.pinoLogger.trace({
50
+ transaction
51
+ }, 'Transaction fetched');
52
+ const { blockHash } = transaction;
53
+ const { tracingBlock, extrinsic } = await (0, _utils.prepareBlock)(context.chain, blockHash, txHash, wasmPath);
54
+ if (config.vm) {
55
+ _chopstickscore.pinoLogger.info('Running EVM opcode trace ...');
56
+ const steps = await (0, _utils.traceVM)(tracingBlock, extrinsic, config['page-size'], config['disable-stack'], config['enable-memory']);
57
+ (0, _fs.writeFileSync)(argv.output, JSON.stringify(steps, null, 2));
58
+ } else {
59
+ _chopstickscore.pinoLogger.info('Running EVM call trace ...');
60
+ const calls = await (0, _utils.traceCalls)(tracingBlock, extrinsic);
61
+ (0, _fs.writeFileSync)(argv.output, JSON.stringify(calls, null, 2));
62
+ }
63
+ _chopstickscore.pinoLogger.info(`Trace logs: ${argv.output}`);
64
+ process.exit(0);
65
+ });
66
+ };
@@ -0,0 +1,148 @@
1
+ export declare const TABLE: {
2
+ '0x00': string;
3
+ '0x01': string;
4
+ '0x02': string;
5
+ '0x03': string;
6
+ '0x04': string;
7
+ '0x05': string;
8
+ '0x06': string;
9
+ '0x07': string;
10
+ '0x08': string;
11
+ '0x09': string;
12
+ '0x0a': string;
13
+ '0x0b': string;
14
+ '0x10': string;
15
+ '0x11': string;
16
+ '0x12': string;
17
+ '0x13': string;
18
+ '0x14': string;
19
+ '0x15': string;
20
+ '0x16': string;
21
+ '0x17': string;
22
+ '0x18': string;
23
+ '0x19': string;
24
+ '0x1a': string;
25
+ '0x35': string;
26
+ '0x36': string;
27
+ '0x37': string;
28
+ '0x38': string;
29
+ '0x39': string;
30
+ '0x1b': string;
31
+ '0x1c': string;
32
+ '0x1d': string;
33
+ '0x50': string;
34
+ '0x51': string;
35
+ '0x52': string;
36
+ '0x53': string;
37
+ '0x56': string;
38
+ '0x57': string;
39
+ '0x58': string;
40
+ '0x59': string;
41
+ '0x5b': string;
42
+ '0x5f': string;
43
+ '0x60': string;
44
+ '0x61': string;
45
+ '0x62': string;
46
+ '0x63': string;
47
+ '0x64': string;
48
+ '0x65': string;
49
+ '0x66': string;
50
+ '0x67': string;
51
+ '0x68': string;
52
+ '0x69': string;
53
+ '0x6a': string;
54
+ '0x6b': string;
55
+ '0x6c': string;
56
+ '0x6d': string;
57
+ '0x6e': string;
58
+ '0x6f': string;
59
+ '0x70': string;
60
+ '0x71': string;
61
+ '0x72': string;
62
+ '0x73': string;
63
+ '0x74': string;
64
+ '0x75': string;
65
+ '0x76': string;
66
+ '0x77': string;
67
+ '0x78': string;
68
+ '0x79': string;
69
+ '0x7a': string;
70
+ '0x7b': string;
71
+ '0x7c': string;
72
+ '0x7d': string;
73
+ '0x7e': string;
74
+ '0x7f': string;
75
+ '0x80': string;
76
+ '0x81': string;
77
+ '0x82': string;
78
+ '0x83': string;
79
+ '0x84': string;
80
+ '0x85': string;
81
+ '0x86': string;
82
+ '0x87': string;
83
+ '0x88': string;
84
+ '0x89': string;
85
+ '0x8a': string;
86
+ '0x8b': string;
87
+ '0x8c': string;
88
+ '0x8d': string;
89
+ '0x8e': string;
90
+ '0x8f': string;
91
+ '0x90': string;
92
+ '0x91': string;
93
+ '0x92': string;
94
+ '0x93': string;
95
+ '0x94': string;
96
+ '0x95': string;
97
+ '0x96': string;
98
+ '0x97': string;
99
+ '0x98': string;
100
+ '0x99': string;
101
+ '0x9a': string;
102
+ '0x9b': string;
103
+ '0x9c': string;
104
+ '0x9d': string;
105
+ '0x9e': string;
106
+ '0x9f': string;
107
+ '0xf3': string;
108
+ '0xfd': string;
109
+ '0xfe': string;
110
+ '0xef': string;
111
+ '0x20': string;
112
+ '0x30': string;
113
+ '0x31': string;
114
+ '0x47': string;
115
+ '0x48': string;
116
+ '0x32': string;
117
+ '0x33': string;
118
+ '0x34': string;
119
+ '0x3a': string;
120
+ '0x3b': string;
121
+ '0x3c': string;
122
+ '0x3f': string;
123
+ '0x3d': string;
124
+ '0x3e': string;
125
+ '0x40': string;
126
+ '0x41': string;
127
+ '0x42': string;
128
+ '0x43': string;
129
+ '0x44': string;
130
+ '0x45': string;
131
+ '0x54': string;
132
+ '0x55': string;
133
+ '0x5a': string;
134
+ '0xa0': string;
135
+ '0xa1': string;
136
+ '0xa2': string;
137
+ '0xa3': string;
138
+ '0xa4': string;
139
+ '0xf0': string;
140
+ '0xf5': string;
141
+ '0xf1': string;
142
+ '0xf2': string;
143
+ '0xf4': string;
144
+ '0xfa': string;
145
+ '0xff': string;
146
+ '0x46': string;
147
+ };
148
+ export declare const opName: (op: number) => any;