@gearbox-protocol/deploy-tools 1.6.0-next.13 → 1.6.0-next.15

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 (2) hide show
  1. package/dist/index.js +52 -37
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -313896,14 +313896,15 @@ var require_SafeHelper = __commonJS({
313896
313896
  var utils_1 = require_utils33();
313897
313897
  var SIG_EXECUTE = "0x0825f38f";
313898
313898
  var SIG_QUEUE = "0x3a66f901";
313899
- var _pending, _timelockExecutions, _tenderly, _init, init_fn, _impersonateSafe, impersonateSafe_fn, _validateTransaction, validateTransaction_fn, _validateMultisend, validateMultisend_fn, _validateSingle, validateSingle_fn, _execute, execute_fn, _getTimelockExecute, getTimelockExecute_fn;
313899
+ var _pending, _pairedExecutions, _tenderly, _init, init_fn, _impersonateSafe, impersonateSafe_fn, _validateTransaction, validateTransaction_fn, _validateMultisend, validateMultisend_fn, _validateSingle, validateSingle_fn, _execute, execute_fn, _getPairedExecute, getPairedExecute_fn;
313900
313900
  var _SafeHelper = class _SafeHelper extends SafeBase_1.SafeBase {
313901
- constructor(rpcUrl, options) {
313901
+ constructor(options) {
313902
+ const { multisig, safeApi, rpcURL } = options;
313902
313903
  const provider = new ethers_1.ethers.providers.StaticJsonRpcProvider({
313903
- url: rpcUrl,
313904
+ url: rpcURL,
313904
313905
  timeout: 3e5
313905
313906
  });
313906
- super(provider, options);
313907
+ super(provider, { multisig, safeApi });
313907
313908
  __privateAdd(this, _init);
313908
313909
  /**
313909
313910
  * Impersonates safe and:
@@ -313926,16 +313927,16 @@ var require_SafeHelper = __commonJS({
313926
313927
  * @param eta
313927
313928
  * @returns
313928
313929
  */
313929
- __privateAdd(this, _getTimelockExecute);
313930
+ __privateAdd(this, _getPairedExecute);
313930
313931
  __privateAdd(this, _pending, []);
313931
- __privateAdd(this, _timelockExecutions, []);
313932
+ __privateAdd(this, _pairedExecutions, []);
313932
313933
  __privateAdd(this, _tenderly, void 0);
313933
- __privateSet(this, _tenderly, rpcUrl.includes("tenderly"));
313934
+ __privateSet(this, _tenderly, rpcURL.includes("tenderly"));
313934
313935
  }
313935
313936
  /**
313936
313937
  * Executes all found pending transactions, returns array of safe tx hashes
313937
313938
  */
313938
- async run() {
313939
+ async run({ disablePairedExecute, alwaysWarpTime } = {}) {
313939
313940
  if (__privateGet(this, _tenderly)) {
313940
313941
  console.log(chalk_1.default.red("running on tenderly"));
313941
313942
  }
@@ -313946,18 +313947,18 @@ var require_SafeHelper = __commonJS({
313946
313947
  const { timestamp } = await this.provider.getBlock("latest");
313947
313948
  const txInfo = __privateMethod(this, _validateTransaction, validateTransaction_fn).call(this, timestamp, tx);
313948
313949
  const { multisend, isExecute, isQueue, eta } = txInfo;
313949
- if (isExecute) {
313950
- hasRealExecute = true;
313950
+ hasRealExecute || (hasRealExecute = isExecute);
313951
+ if (isExecute || alwaysWarpTime) {
313951
313952
  await (0, utils_1.warpTime)(this.provider, eta + 1, __privateGet(this, _tenderly));
313952
313953
  }
313953
313954
  console.log(`Executing ${txType(txInfo)} ${tx.safeTxHash} with nonce ${tx.nonce} and eta ${eta}`);
313954
313955
  await __privateMethod(this, _execute, execute_fn).call(this, tx);
313955
- if (isQueue) {
313956
- __privateGet(this, _timelockExecutions).push(await __privateMethod(this, _getTimelockExecute, getTimelockExecute_fn).call(this, tx, multisend, eta));
313956
+ if (isQueue && !disablePairedExecute) {
313957
+ __privateGet(this, _pairedExecutions).push(await __privateMethod(this, _getPairedExecute, getPairedExecute_fn).call(this, tx, multisend, eta));
313957
313958
  }
313958
313959
  }
313959
313960
  if (!hasRealExecute) {
313960
- for (const tx of __privateGet(this, _timelockExecutions)) {
313961
+ for (const tx of __privateGet(this, _pairedExecutions)) {
313961
313962
  await (0, utils_1.warpTime)(this.provider, tx.eta + 1, __privateGet(this, _tenderly));
313962
313963
  console.log(`Executing fake execute timelock tx with eta ${tx.eta}`);
313963
313964
  await __privateMethod(this, _execute, execute_fn).call(this, tx.tx);
@@ -313967,7 +313968,7 @@ var require_SafeHelper = __commonJS({
313967
313968
  }
313968
313969
  };
313969
313970
  _pending = new WeakMap();
313970
- _timelockExecutions = new WeakMap();
313971
+ _pairedExecutions = new WeakMap();
313971
313972
  _tenderly = new WeakMap();
313972
313973
  _init = new WeakSet();
313973
313974
  init_fn = async function() {
@@ -314082,8 +314083,18 @@ var require_SafeHelper = __commonJS({
314082
314083
  throw new Error("eta parameter not found");
314083
314084
  }
314084
314085
  const eta = parseInt(data.dataDecoded.parameters[4].value, 10);
314085
- if (eta <= timestamp) {
314086
- throw new Error("ETA is outdated");
314086
+ if (isQueue) {
314087
+ if (eta <= timestamp) {
314088
+ throw new Error(`Validation failed: ETA is outdated in ${method} tx: ${eta} <= ${timestamp}`);
314089
+ }
314090
+ } else {
314091
+ if (timestamp < eta) {
314092
+ throw new Error("Validation failed: executeTransaction: Transaction hasn't surpassed time lock.");
314093
+ }
314094
+ const GRACE_PERIOD = 14 * 24 * 60 * 60;
314095
+ if (timestamp > eta + GRACE_PERIOD) {
314096
+ throw new Error("Validation failed: executeTransaction: Transaction is stale");
314097
+ }
314087
314098
  }
314088
314099
  return {
314089
314100
  isQueue,
@@ -314115,8 +314126,8 @@ var require_SafeHelper = __commonJS({
314115
314126
  console.log(`executed safe tx with nonce ${tx.data.nonce}`);
314116
314127
  }
314117
314128
  };
314118
- _getTimelockExecute = new WeakSet();
314119
- getTimelockExecute_fn = async function(data, multisend, eta) {
314129
+ _getPairedExecute = new WeakSet();
314130
+ getPairedExecute_fn = async function(data, multisend, eta) {
314120
314131
  let tx;
314121
314132
  if (multisend) {
314122
314133
  tx = await this.safe.createTransaction({
@@ -369191,7 +369202,7 @@ var require_GearboxAddressTree = __commonJS({
369191
369202
  __privateAdd(this, _queue, new queue_1.default({ concurrency: 5 }));
369192
369203
  __privateAdd(this, _visited, /* @__PURE__ */ new Map());
369193
369204
  __privateAdd(this, _create2, /* @__PURE__ */ new Map());
369194
- __privateSet(this, _provider, new ethers_1.ethers.providers.StaticJsonRpcProvider(options.mainnetRpc));
369205
+ __privateSet(this, _provider, new ethers_1.ethers.providers.StaticJsonRpcProvider(options.rpcURL));
369195
369206
  __privateSet(this, _outFile, node_path_1.default.resolve(options.sandboxDir, "tree.json"));
369196
369207
  __privateSet(this, _etherscan, new EtherscanVerifier_1.EtherscanVerifier(options));
369197
369208
  __privateSet(this, _verifier, new Verifier_1.default());
@@ -373759,7 +373770,7 @@ var require_UpdateParser = __commonJS({
373759
373770
  var _logger, _output2, _parseSafeTxHashes, parseSafeTxHashes_fn, _parseBatchAndMeta, parseBatchAndMeta_fn, _parseNormalizedBatch, parseNormalizedBatch_fn, _parseNormalizedTx, parseNormalizedTx_fn, _collectCreate2Addresses, collectCreate2Addresses_fn;
373760
373771
  var UpdateParser2 = class extends SafeBase_1.SafeBase {
373761
373772
  constructor(opts) {
373762
- const provider = new ethers_1.ethers.providers.StaticJsonRpcProvider(opts.mainnetRpc);
373773
+ const provider = new ethers_1.ethers.providers.StaticJsonRpcProvider(opts.rpcURL);
373763
373774
  super(provider, opts);
373764
373775
  __privateAdd(this, _parseSafeTxHashes);
373765
373776
  __privateAdd(this, _parseBatchAndMeta);
@@ -414749,7 +414760,7 @@ var require_package3 = __commonJS({
414749
414760
  module2.exports = {
414750
414761
  name: "@gearbox-protocol/deploy-tools",
414751
414762
  description: "Gearbox deploy tools",
414752
- version: "1.6.0-next.12",
414763
+ version: "1.6.0-next.14",
414753
414764
  homepage: "https://gearbox.fi",
414754
414765
  keywords: [
414755
414766
  "gearbox"
@@ -414877,19 +414888,26 @@ function copyMultisig() {
414877
414888
  "Copies transactions from safe multisig to anvil (or tenderly) fork using multisig impersonation"
414878
414889
  ).addOption(
414879
414890
  new Option(
414880
- "--rpc-url <string>",
414881
- "Anvil fork rpc url (or tenderly fork url)"
414882
- ).default("http://127.0.0.1:8545").env("DEV_RPC")
414883
- ).action(async ({ rpcUrl, ...safeOptions }) => {
414884
- const safeHelper = new import_lib2.SafeHelper(rpcUrl, safeOptions);
414885
- const executed = await safeHelper.run();
414886
- try {
414887
- (0, import_core.exportVariable)("EXECUTED_TRANSACTIONS", executed.join(","));
414888
- } catch (e) {
414889
- console.warn(`Failed to set EXECUTED_TRANSACTIONS: ${e}`);
414891
+ "--disable-paired-execute",
414892
+ "Disable creation and execution of paired executeTrransaction for timelock.queueTransaction"
414893
+ )
414894
+ ).addOption(
414895
+ new Option(
414896
+ "--always-warp-time",
414897
+ "Warp time even after queueTransactions"
414898
+ )
414899
+ ).action(
414900
+ async (options) => {
414901
+ const safeHelper = new import_lib2.SafeHelper(options);
414902
+ const executed = await safeHelper.run(options);
414903
+ try {
414904
+ (0, import_core.exportVariable)("EXECUTED_TRANSACTIONS", executed.join(","));
414905
+ } catch (e) {
414906
+ console.warn(`Failed to set EXECUTED_TRANSACTIONS: ${e}`);
414907
+ }
414908
+ console.log("done");
414890
414909
  }
414891
- console.log("done");
414892
- });
414910
+ );
414893
414911
  }
414894
414912
 
414895
414913
  // src/commands/parse.ts
@@ -416025,10 +416043,7 @@ program2.addCommand(verifyEtherscan());
416025
416043
  program2.addCommand(parse2());
416026
416044
  program2.commands.forEach((cmd) => {
416027
416045
  cmd.addOption(
416028
- new Option(
416029
- "--mainnet-rpc <url>",
416030
- "mainnet rpc provider, used by safe api"
416031
- ).default("https://rpc.ankr.com/eth").env("MAINNET_RPC_URL")
416046
+ new Option("--rpc-url <url>", "rpc provider url").default("https://rpc.ankr.com/eth").env("RPC_URL")
416032
416047
  ).addOption(
416033
416048
  new Option(
416034
416049
  "--cache-policy [never|only]",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/deploy-tools",
3
3
  "description": "Gearbox deploy tools",
4
- "version": "1.6.0-next.13",
4
+ "version": "1.6.0-next.15",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"