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

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 +25 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -313896,7 +313896,7 @@ 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
313901
  constructor(rpcUrl, options) {
313902
313902
  const provider = new ethers_1.ethers.providers.StaticJsonRpcProvider({
@@ -313926,16 +313926,16 @@ var require_SafeHelper = __commonJS({
313926
313926
  * @param eta
313927
313927
  * @returns
313928
313928
  */
313929
- __privateAdd(this, _getTimelockExecute);
313929
+ __privateAdd(this, _getPairedExecute);
313930
313930
  __privateAdd(this, _pending, []);
313931
- __privateAdd(this, _timelockExecutions, []);
313931
+ __privateAdd(this, _pairedExecutions, []);
313932
313932
  __privateAdd(this, _tenderly, void 0);
313933
313933
  __privateSet(this, _tenderly, rpcUrl.includes("tenderly"));
313934
313934
  }
313935
313935
  /**
313936
313936
  * Executes all found pending transactions, returns array of safe tx hashes
313937
313937
  */
313938
- async run() {
313938
+ async run({ disablePairedExecute, alwaysWarpTime } = {}) {
313939
313939
  if (__privateGet(this, _tenderly)) {
313940
313940
  console.log(chalk_1.default.red("running on tenderly"));
313941
313941
  }
@@ -313946,18 +313946,18 @@ var require_SafeHelper = __commonJS({
313946
313946
  const { timestamp } = await this.provider.getBlock("latest");
313947
313947
  const txInfo = __privateMethod(this, _validateTransaction, validateTransaction_fn).call(this, timestamp, tx);
313948
313948
  const { multisend, isExecute, isQueue, eta } = txInfo;
313949
- if (isExecute) {
313950
- hasRealExecute = true;
313949
+ hasRealExecute || (hasRealExecute = isExecute);
313950
+ if (isExecute || alwaysWarpTime) {
313951
313951
  await (0, utils_1.warpTime)(this.provider, eta + 1, __privateGet(this, _tenderly));
313952
313952
  }
313953
313953
  console.log(`Executing ${txType(txInfo)} ${tx.safeTxHash} with nonce ${tx.nonce} and eta ${eta}`);
313954
313954
  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));
313955
+ if (isQueue && !disablePairedExecute) {
313956
+ __privateGet(this, _pairedExecutions).push(await __privateMethod(this, _getPairedExecute, getPairedExecute_fn).call(this, tx, multisend, eta));
313957
313957
  }
313958
313958
  }
313959
313959
  if (!hasRealExecute) {
313960
- for (const tx of __privateGet(this, _timelockExecutions)) {
313960
+ for (const tx of __privateGet(this, _pairedExecutions)) {
313961
313961
  await (0, utils_1.warpTime)(this.provider, tx.eta + 1, __privateGet(this, _tenderly));
313962
313962
  console.log(`Executing fake execute timelock tx with eta ${tx.eta}`);
313963
313963
  await __privateMethod(this, _execute, execute_fn).call(this, tx.tx);
@@ -313967,7 +313967,7 @@ var require_SafeHelper = __commonJS({
313967
313967
  }
313968
313968
  };
313969
313969
  _pending = new WeakMap();
313970
- _timelockExecutions = new WeakMap();
313970
+ _pairedExecutions = new WeakMap();
313971
313971
  _tenderly = new WeakMap();
313972
313972
  _init = new WeakSet();
313973
313973
  init_fn = async function() {
@@ -314082,8 +314082,18 @@ var require_SafeHelper = __commonJS({
314082
314082
  throw new Error("eta parameter not found");
314083
314083
  }
314084
314084
  const eta = parseInt(data.dataDecoded.parameters[4].value, 10);
314085
- if (eta <= timestamp) {
314086
- throw new Error("ETA is outdated");
314085
+ if (isQueue) {
314086
+ if (eta <= timestamp) {
314087
+ throw new Error(`Validation failed: ETA is outdated in ${method} tx: ${eta} <= ${timestamp}`);
314088
+ }
314089
+ } else {
314090
+ if (timestamp < eta) {
314091
+ throw new Error("Validation failed: executeTransaction: Transaction hasn't surpassed time lock.");
314092
+ }
314093
+ const GRACE_PERIOD = 14 * 24 * 60 * 60;
314094
+ if (timestamp > eta + GRACE_PERIOD) {
314095
+ throw new Error("Validation failed: executeTransaction: Transaction is stale");
314096
+ }
314087
314097
  }
314088
314098
  return {
314089
314099
  isQueue,
@@ -314115,8 +314125,8 @@ var require_SafeHelper = __commonJS({
314115
314125
  console.log(`executed safe tx with nonce ${tx.data.nonce}`);
314116
314126
  }
314117
314127
  };
314118
- _getTimelockExecute = new WeakSet();
314119
- getTimelockExecute_fn = async function(data, multisend, eta) {
314128
+ _getPairedExecute = new WeakSet();
314129
+ getPairedExecute_fn = async function(data, multisend, eta) {
314120
314130
  let tx;
314121
314131
  if (multisend) {
314122
314132
  tx = await this.safe.createTransaction({
@@ -414882,7 +414892,7 @@ function copyMultisig() {
414882
414892
  ).default("http://127.0.0.1:8545").env("DEV_RPC")
414883
414893
  ).action(async ({ rpcUrl, ...safeOptions }) => {
414884
414894
  const safeHelper = new import_lib2.SafeHelper(rpcUrl, safeOptions);
414885
- const executed = await safeHelper.run();
414895
+ const executed = await safeHelper.run(safeOptions);
414886
414896
  try {
414887
414897
  (0, import_core.exportVariable)("EXECUTED_TRANSACTIONS", executed.join(","));
414888
414898
  } catch (e) {
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.14",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"