Make control-plane smoke resilient to tx pending/revert
Some checks are pending
check / contracts (push) Waiting to run
Some checks are pending
check / contracts (push) Waiting to run
This commit is contained in:
parent
048482b05f
commit
1dd74d57e6
@ -7,6 +7,7 @@ const CHAIN_ID = Number((process.env.SECRET_API_CHAIN_ID || "84532").trim());
|
|||||||
const PRIVATE_KEY = (process.env.DEPLOYER_PRIVATE_KEY || "").trim();
|
const PRIVATE_KEY = (process.env.DEPLOYER_PRIVATE_KEY || "").trim();
|
||||||
const RPC_URL = (process.env.BASE_SEPOLIA_RPC_URL || "").trim();
|
const RPC_URL = (process.env.BASE_SEPOLIA_RPC_URL || "").trim();
|
||||||
const GAS_PRICE_WEI = (process.env.E2E_GAS_PRICE_WEI || "").trim();
|
const GAS_PRICE_WEI = (process.env.E2E_GAS_PRICE_WEI || "").trim();
|
||||||
|
const GAS_LIMIT = (process.env.E2E_GAS_LIMIT || "500000").trim();
|
||||||
|
|
||||||
const OFFER_ID = (process.env.E2E_OFFER_ID || "edut.workspace.core").trim();
|
const OFFER_ID = (process.env.E2E_OFFER_ID || "edut.workspace.core").trim();
|
||||||
const ORG_ROOT_ID = (process.env.E2E_ORG_ROOT_ID || "org.e2e.workspace").trim();
|
const ORG_ROOT_ID = (process.env.E2E_ORG_ROOT_ID || "org.e2e.workspace").trim();
|
||||||
@ -71,6 +72,9 @@ async function submitTransaction(signer, txLike) {
|
|||||||
data: txLike.data,
|
data: txLike.data,
|
||||||
value: ethers.BigNumber.from(txLike.value || "0x0"),
|
value: ethers.BigNumber.from(txLike.value || "0x0"),
|
||||||
};
|
};
|
||||||
|
if (GAS_LIMIT && GAS_LIMIT !== "0") {
|
||||||
|
txRequest.gasLimit = ethers.BigNumber.from(GAS_LIMIT);
|
||||||
|
}
|
||||||
if (GAS_PRICE_WEI) {
|
if (GAS_PRICE_WEI) {
|
||||||
txRequest.gasPrice = ethers.BigNumber.from(GAS_PRICE_WEI);
|
txRequest.gasPrice = ethers.BigNumber.from(GAS_PRICE_WEI);
|
||||||
}
|
}
|
||||||
@ -93,6 +97,12 @@ function isInsufficientFundsError(err) {
|
|||||||
return text.includes("insufficient funds");
|
return text.includes("insufficient funds");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isTxRevertError(err) {
|
||||||
|
const code = String(err?.code || "").toUpperCase();
|
||||||
|
const text = String(err?.message || err || "").toLowerCase();
|
||||||
|
return code === "CALL_EXCEPTION" || text.includes("transaction failed");
|
||||||
|
}
|
||||||
|
|
||||||
function isTxPendingResponse(result) {
|
function isTxPendingResponse(result) {
|
||||||
if (!result || result.ok) {
|
if (!result || result.ok) {
|
||||||
return false;
|
return false;
|
||||||
@ -188,6 +198,12 @@ async function main() {
|
|||||||
0,
|
0,
|
||||||
String(err?.message || err)
|
String(err?.message || err)
|
||||||
);
|
);
|
||||||
|
} else if (isTxRevertError(err)) {
|
||||||
|
result.stages.membership_activation = summarizeSkip(
|
||||||
|
"tx_reverted",
|
||||||
|
0,
|
||||||
|
String(err?.message || err)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
@ -295,6 +311,12 @@ async function main() {
|
|||||||
0,
|
0,
|
||||||
String(err?.message || err)
|
String(err?.message || err)
|
||||||
);
|
);
|
||||||
|
} else if (isTxRevertError(err)) {
|
||||||
|
result.stages.marketplace_checkout = summarizeSkip(
|
||||||
|
"tx_reverted",
|
||||||
|
0,
|
||||||
|
String(err?.message || err)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user