From 8902772fc66cc177abfb828394f7bf8e8f5a6323 Mon Sep 17 00:00:00 2001 From: ara-klaytn Date: Wed, 17 Jan 2024 11:19:14 +0800 Subject: [PATCH] Prevents sending data if error occured in all chain --- aptos-tx-latency-measurement/sendtx_aptos.js | 24 +++++++++---------- .../sendtx_arbitrium.js | 22 ++++++++--------- .../sendtx_avalanche.js | 16 ++++++------- bnb-tx-latency-measurement/sendtx_bnb.js | 16 ++++++------- .../sendtx_elrond.js | 15 ++++++------ eos-tx-latency-measurement/sendtx_eos.js | 14 +++++------ .../sendtx_fantom.js | 23 ++++++++---------- .../sendtx_harmony.js | 20 ++++++++-------- .../sendtx_hedera.js | 14 +++++------ .../sendtx_klaytn.js | 14 +++++------ near-tx-latency-measurement/sendtx_near.js | 14 +++++------ .../sendtx_optimism.js | 18 +++++++------- .../sendtx_polkadot.js | 13 +++++++--- .../sendtx_polygon.js | 14 +++++------ .../sendtx_solana.js | 14 +++++------ sui-tx-latency-measurement/sendtx_sui.js | 21 ++++++++-------- 16 files changed, 136 insertions(+), 136 deletions(-) diff --git a/aptos-tx-latency-measurement/sendtx_aptos.js b/aptos-tx-latency-measurement/sendtx_aptos.js index 32387ab..881e135 100644 --- a/aptos-tx-latency-measurement/sendtx_aptos.js +++ b/aptos-tx-latency-measurement/sendtx_aptos.js @@ -227,25 +227,23 @@ async function sendTx() { data.txFee = txfee; data.txFeeInUSD = APTOStoUSD * data.txFee; // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) + try { + await uploadChoice(data); + } catch (err) { + await sendSlackMsg(`failed to upload aptos, ${err.toString()}`); + console.log( + `failed to ${process.env.UPLOAD_METHOD === "AWS" ? "s3" : "gcs"}.upload!! Printing instead!`, + err.toString() + ); + console.log(JSON.stringify(data)); + } } catch (err) { - - const now = new Date(); + const now = new Date(); await sendSlackMsg(`${now}, failed to execute aptos, ${err.toString()}`); console.log("failed to execute.", err.toString()); data.error = err.toString(); console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try { - await uploadChoice(data); - } catch (err) { - const now = new Date(); - await sendSlackMsg(`${now}, failed to upload aptos, ${err.toString()}`); - console.log( - `failed to ${process.env.UPLOAD_METHOD === "AWS" ? "s3" : "gcs"}.upload!! Printing instead!`, - err.toString() - ); - console.log(JSON.stringify(data)); - } } async function main() { diff --git a/arbitrium-tx-latency-measurement/sendtx_arbitrium.js b/arbitrium-tx-latency-measurement/sendtx_arbitrium.js index 63f5fda..9567888 100644 --- a/arbitrium-tx-latency-measurement/sendtx_arbitrium.js +++ b/arbitrium-tx-latency-measurement/sendtx_arbitrium.js @@ -258,7 +258,16 @@ async function sendTx() { ARBtoUSD = response.data["arbitrum"].usd; }); data.txFeeInUSD = data.txFee * ARBtoUSD; - + try { + await uploadChoice(data); + } catch (err) { + await sendSlackMsg(`failed to upload arbitrium, ${err.toString()}`); + + console.log( + `failed to ${process.env.UPLOAD_METHOD === "AWS" ? "s3" : "gcs"}.upload!! Printing instead!`, + err.toString() + ); + } // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } catch (err) { const now = new Date(); @@ -267,17 +276,6 @@ async function sendTx() { data.error = err.toString(); console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try { - await uploadChoice(data); - } catch (err) { - const now = new Date(); - await sendSlackMsg(`${now}, failed to upload arbitrium, ${err.toString()}`); - - console.log( - `failed to ${process.env.UPLOAD_METHOD === "AWS" ? "s3" : "gcs"}.upload!! Printing instead!`, - err.toString() - ); - } } async function l1Checker() { diff --git a/avalanche-tx-latency-measurement/sendtx_avalanche.js b/avalanche-tx-latency-measurement/sendtx_avalanche.js index 0f308a5..7e87990 100644 --- a/avalanche-tx-latency-measurement/sendtx_avalanche.js +++ b/avalanche-tx-latency-measurement/sendtx_avalanche.js @@ -231,20 +231,20 @@ const sendAvax = async (amount, to, maxFeePerGas = undefined, maxPriorityFeePerG data.txFee = ethers.utils.formatEther(signature.effectiveGasPrice) * signature.gasUsed; data.txFeeInUSD = data.txFee * AVAXtoUSD; // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) + try{ + await uploadChoice(data) + } catch(err){ + await sendSlackMsg(`failed to upload avalanche, ${err.toString()}`); + console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) + console.log(JSON.stringify(data)) + } } catch(err){ const now = new Date(); - await sendSlackMsg(`${now}, failed to execute avalanche, ${err.toString()}`); + await sendSlackMsg(`${now}, failed to execute avalanche, ${err.toString()}`); console.log("failed to execute.", err.toString()) data.error = err.toString() console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try{ - await uploadChoice(data) - } catch(err){ - await sendSlackMsg(`failed to upload avalanche, ${err.toString()}`); - console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) - console.log(JSON.stringify(data)) - } }; async function main(){ diff --git a/bnb-tx-latency-measurement/sendtx_bnb.js b/bnb-tx-latency-measurement/sendtx_bnb.js index dc91649..3f21e29 100644 --- a/bnb-tx-latency-measurement/sendtx_bnb.js +++ b/bnb-tx-latency-measurement/sendtx_bnb.js @@ -213,7 +213,13 @@ async function sendTx(){ }); data.txFeeInUSD = data.txFee * BNBtoUSD // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) - + try{ + await uploadChoice(data) + } catch(err){ + await sendSlackMsg(`failed to upload bnb, ${err.toString()}`); + console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) + console.log(JSON.stringify(data)) + } } catch(err){ const now = new Date(); await sendSlackMsg(`${now}, failed to execute bnb, ${err.toString()}`); @@ -221,13 +227,7 @@ async function sendTx(){ data.error = err.toString() console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try{ - await uploadChoice(data) - } catch(err){ - await sendSlackMsg(`failed to upload bnb, ${err.toString()}`); - console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) - console.log(JSON.stringify(data)) - } + } async function main(){ diff --git a/elrond-tx-latency-measurement/sendtx_elrond.js b/elrond-tx-latency-measurement/sendtx_elrond.js index 0308881..cea9436 100644 --- a/elrond-tx-latency-measurement/sendtx_elrond.js +++ b/elrond-tx-latency-measurement/sendtx_elrond.js @@ -231,7 +231,13 @@ async function sendTx(){ }); data.txFeeInUSD = data.txFee * EGLDtoUSD // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) - + try{ + await uploadToS3(data) + } catch(err){ + await sendSlackMsg(`failed to upload elrond, ${err.toString()}`); + console.log('failed to s3.upload! Printing instead!', err.toString()) + console.log(JSON.stringify(data)) + } } catch(err){ const now = new Date(); await sendSlackMsg(`${now}, failed to execute elrond, ${err.toString()}`); @@ -239,13 +245,6 @@ async function sendTx(){ data.error = err.toString() console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try{ - await uploadToS3(data) - } catch(err){ - await sendSlackMsg(`failed to upload elrond, ${err.toString()}`); - console.log('failed to s3.upload! Printing instead!', err.toString()) - console.log(JSON.stringify(data)) - } } async function main(){ diff --git a/eos-tx-latency-measurement/sendtx_eos.js b/eos-tx-latency-measurement/sendtx_eos.js index 2a81d13..d72e635 100644 --- a/eos-tx-latency-measurement/sendtx_eos.js +++ b/eos-tx-latency-measurement/sendtx_eos.js @@ -208,6 +208,13 @@ async function sendTx(){ data.txFeeInUSD = data.txFee * EOStoUSD console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) + try{ + await uploadChoice(data) + } catch(err){ + await sendSlackMsg(`failed to upload eos, ${err.toString()}`); + console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) + console.log(JSON.stringify(data)) + } } catch(err){ const now = new Date(); await sendSlackMsg(`${now}, failed to execute eos, ${err.toString()}`); @@ -215,13 +222,6 @@ async function sendTx(){ data.error = err.toString() console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try{ - await uploadChoice(data) - } catch(err){ - await sendSlackMsg(`failed to upload eos, ${err.toString()}`); - console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) - console.log(JSON.stringify(data)) - } } async function main(){ diff --git a/fantom-tx-latency-measurement/sendtx_fantom.js b/fantom-tx-latency-measurement/sendtx_fantom.js index 44a3c6b..488428d 100644 --- a/fantom-tx-latency-measurement/sendtx_fantom.js +++ b/fantom-tx-latency-measurement/sendtx_fantom.js @@ -134,7 +134,6 @@ async function sendTx(){ pingTime:0 } - var transactionError = false try{ const signer = web3.eth.accounts.privateKeyToAccount( @@ -233,25 +232,23 @@ async function sendTx(){ data.txFeeInUSD = data.txFee * FTMtoUSD // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) + try { + await uploadChoice(data); + } catch (err) { + await sendSlackMsg(`failed to upload sui, ${err.toString()}`); + console.log( + `failed to ${process.env.UPLOAD_METHOD === "AWS" ? "s3" : "gcs"}.upload!! Printing instead!`, + err.toString() + ); + console.log(JSON.stringify(data)); + } } catch(err){ - transactionError = true const now = new Date(); await sendSlackMsg(`${now}, failed to execute fantom, ${err.toString()}`); console.log("failed to execute.", err.toString()) data.error = err.toString() console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try{ - if (!transactionError){ - await uploadChoice(data) - } else { - console.log("not uploading fantom data due to transaction error") - } - } catch(err){ - await sendSlackMsg(`failed to upload fantom, ${err.toString()}`); - console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) - console.log(JSON.stringify(data)) - } } async function main(){ diff --git a/harmony-tx-latency-measurement/sendtx_harmony.js b/harmony-tx-latency-measurement/sendtx_harmony.js index c261750..caf9c31 100644 --- a/harmony-tx-latency-measurement/sendtx_harmony.js +++ b/harmony-tx-latency-measurement/sendtx_harmony.js @@ -220,6 +220,16 @@ async function sendTx() { data.txFeeInUSD = data.txFee * ONEtoUSD; // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) + try { + await uploadChoice(data); + } catch (err) { + await sendSlackMsg(`failed to upload harmony, ${err.toString()}`); + console.log( + `failed to ${process.env.UPLOAD_METHOD === "AWS" ? "s3" : "gcs"}.upload!! Printing instead!`, + err.toString() + ); + console.log(JSON.stringify(data)); + } } catch (err) { const now = new Date(); await sendSlackMsg(`${now}, failed to execute harmony, ${err.toString()}`); @@ -227,16 +237,6 @@ async function sendTx() { data.error = err.toString(); console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try { - await uploadChoice(data); - } catch (err) { - await sendSlackMsg(`failed to upload harmony, ${err.toString()}`); - console.log( - `failed to ${process.env.UPLOAD_METHOD === "AWS" ? "s3" : "gcs"}.upload!! Printing instead!`, - err.toString() - ); - console.log(JSON.stringify(data)); - } } async function main() { diff --git a/hedera-tx-latency-measurement/sendtx_hedera.js b/hedera-tx-latency-measurement/sendtx_hedera.js index a843975..b43ebfc 100644 --- a/hedera-tx-latency-measurement/sendtx_hedera.js +++ b/hedera-tx-latency-measurement/sendtx_hedera.js @@ -200,6 +200,13 @@ async function sendTx(){ data.txFeeInUSD = data.txFee * HBARtoUSD // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) + try{ + await uploadChoice(data) + } catch(err) { + await sendSlackMsg(`failed to upload hedera, ${err.toString()}`); + console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS' ? 's3' : 'gcs'}.upload!! Printing instead!`, err.toString()) + console.log(JSON.stringify(data)) + } } catch(err){ const now = new Date(); await sendSlackMsg(`${now}, failed to execute hedera, ${err.toString()}`); @@ -207,13 +214,6 @@ async function sendTx(){ data.error = err.toString() console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try{ - await uploadChoice(data) - } catch(err) { - await sendSlackMsg(`failed to upload hedera, ${err.toString()}`); - console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS' ? 's3' : 'gcs'}.upload!! Printing instead!`, err.toString()) - console.log(JSON.stringify(data)) - } } async function main(){ diff --git a/klaytn-tx-latency-measurement/sendtx_klaytn.js b/klaytn-tx-latency-measurement/sendtx_klaytn.js index 9499e6b..f3fcbd0 100644 --- a/klaytn-tx-latency-measurement/sendtx_klaytn.js +++ b/klaytn-tx-latency-measurement/sendtx_klaytn.js @@ -204,6 +204,13 @@ async function sendTx() { data.txFee = caver.utils.convertFromPeb(receipt.gasPrice, 'KLAY') * receipt.gasUsed data.txFeeInUSD = KLAYtoUSD * data.txFee // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) + try{ + await uploadChoice(data) + } catch(err){ + await sendSlackMsg(`failed to upload Klaytn, ${err.toString()}`); + console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) + console.log(JSON.stringify(data)) + } } catch (err) { const now = new Date(); await sendSlackMsg(`${now}, failed to execute Klaytn, ${err.toString()}`); @@ -211,13 +218,6 @@ async function sendTx() { data.error = err.toString() console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try{ - await uploadChoice(data) - } catch(err){ - await sendSlackMsg(`failed to upload Klaytn, ${err.toString()}`); - console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) - console.log(JSON.stringify(data)) - } } async function main() { diff --git a/near-tx-latency-measurement/sendtx_near.js b/near-tx-latency-measurement/sendtx_near.js index cb3604d..e425161 100644 --- a/near-tx-latency-measurement/sendtx_near.js +++ b/near-tx-latency-measurement/sendtx_near.js @@ -283,6 +283,13 @@ async function sendTx() { data.txFeeInUSD = data.txFee * NEARtoUSD // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) + try{ + await uploadChoice(data) + } catch(err){ + await sendSlackMsg(`failed to upload Near, ${err.toString()}`); + console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) + console.log(JSON.stringify(data)) + } } catch(err){ const now = new Date(); await sendSlackMsg(`${now}, failed to execute Near, ${err.toString()}`); @@ -290,13 +297,6 @@ async function sendTx() { data.error = err.toString() console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try{ - await uploadChoice(data) - } catch(err){ - await sendSlackMsg(`failed to upload Near, ${err.toString()}`); - console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) - console.log(JSON.stringify(data)) - } } async function main (){ diff --git a/optimism-tx-latency-measurement/sendtx_optimism.js b/optimism-tx-latency-measurement/sendtx_optimism.js index a92bbad..990facb 100644 --- a/optimism-tx-latency-measurement/sendtx_optimism.js +++ b/optimism-tx-latency-measurement/sendtx_optimism.js @@ -262,6 +262,15 @@ async function sendTx() { data.txFeeInUSD = data.txFee * OPTtoUSD; // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) + try { + await uploadChoice(data); + } catch (err) { + await sendSlackMsg(`failed to upload optimism, ${err.toString()}`); + console.log( + `failed to ${process.env.UPLOAD_METHOD === "AWS" ? "s3" : "gcs"}.upload!! Printing instead!`, + err.toString() + ); + } } catch (err) { const now = new Date(); await sendSlackMsg(`${now}, failed to execute optimism, ${err.toString()}`); @@ -269,15 +278,6 @@ async function sendTx() { data.error = err.toString(); console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try { - await uploadChoice(data); - } catch (err) { - await sendSlackMsg(`failed to upload optimism, ${err.toString()}`); - console.log( - `failed to ${process.env.UPLOAD_METHOD === "AWS" ? "s3" : "gcs"}.upload!! Printing instead!`, - err.toString() - ); - } } async function l1Checker() { diff --git a/polkadot-tx-latency-measurement/sendtx_polkadot.js b/polkadot-tx-latency-measurement/sendtx_polkadot.js index c79067c..425bdea 100644 --- a/polkadot-tx-latency-measurement/sendtx_polkadot.js +++ b/polkadot-tx-latency-measurement/sendtx_polkadot.js @@ -214,17 +214,24 @@ async function sendTx(){ data.txFeeInUSD = data.txFee * DOTtoUSD console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) - await uploadChoice(data); + try { + await uploadChoice(data); + } catch (err) { + await sendSlackMsg(`failed to upload optimism, ${err.toString()}`); + console.log( + `failed to ${process.env.UPLOAD_METHOD === "AWS" ? "s3" : "gcs"}.upload!! Printing instead!`, + err.toString() + ); + } } }) } catch(err){ const now = new Date(); - await sendSlackMsg(`${now}, failed to execute polkadot, ${err.toString()}`); + await sendSlackMsg(`${now}, failed to execute polkadot, ${err.toString()}`); console.log("failed to execute.", err.toString()) data.error = err.toString() console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) - uploadChoice(data) } } diff --git a/polygon-tx-latency-measurement/sendtx_polygon.js b/polygon-tx-latency-measurement/sendtx_polygon.js index eb185ae..be88a43 100644 --- a/polygon-tx-latency-measurement/sendtx_polygon.js +++ b/polygon-tx-latency-measurement/sendtx_polygon.js @@ -236,6 +236,13 @@ async function sendTx(){ data.txFeeInUSD = data.txFee * MATICtoUSD // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) + try{ + await uploadChoice(data) + } catch(err){ + await sendSlackMsg(`failed to upload polygon, ${err.toString()}`); + console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) + console.log(JSON.stringify(data)) + } } catch(err){ const now = new Date(); await sendSlackMsg(`${now}, failed to execute polygon, ${err.toString()}`); @@ -243,13 +250,6 @@ async function sendTx(){ data.error = err.toString() console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try{ - await uploadChoice(data) - } catch(err){ - await sendSlackMsg(`failed to upload polygon, ${err.toString()}`); - console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) - console.log(JSON.stringify(data)) - } } async function main(){ diff --git a/solana-tx-latency-measurement/sendtx_solana.js b/solana-tx-latency-measurement/sendtx_solana.js index 9d67c9d..84a4c60 100644 --- a/solana-tx-latency-measurement/sendtx_solana.js +++ b/solana-tx-latency-measurement/sendtx_solana.js @@ -202,6 +202,13 @@ async function sendZeroSol(){ data.txFee = feeInLamports * 10**(-9) data.txFeeInUSD = SOLtoUSD * data.txFee // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) + try{ + await uploadChoice(data) + } catch(err){ + await sendSlackMsg(`failed to upload solana, ${err.toString()}`); + console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) + console.log(JSON.stringify(data)) + } } catch(err){ const now = new Date(); await sendSlackMsg(`${now}, failed to execute solana, ${err.toString()}`); @@ -209,13 +216,6 @@ async function sendZeroSol(){ data.error = err.toString() console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try{ - await uploadChoice(data) - } catch(err){ - await sendSlackMsg(`failed to upload solana, ${err.toString()}`); - console.log(`failed to ${process.env.UPLOAD_METHOD === 'AWS'? 's3': 'gcs'}.upload!! Printing instead!`, err.toString()) - console.log(JSON.stringify(data)) - } } async function main (){ diff --git a/sui-tx-latency-measurement/sendtx_sui.js b/sui-tx-latency-measurement/sendtx_sui.js index 4ffb714..31c496a 100644 --- a/sui-tx-latency-measurement/sendtx_sui.js +++ b/sui-tx-latency-measurement/sendtx_sui.js @@ -237,6 +237,16 @@ async function sendTx() { data.txFee = 1997880 / Math.pow(10, 9); data.txFeeInUSD = SUItoUSD * txfee; // console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) + try { + await uploadChoice(data); + } catch (err) { + await sendSlackMsg(`failed to upload sui, ${err.toString()}`); + console.log( + `failed to ${process.env.UPLOAD_METHOD === "AWS" ? "s3" : "gcs"}.upload!! Printing instead!`, + err.toString() + ); + console.log(JSON.stringify(data)); + } } catch (err) { const now = new Date(); await sendSlackMsg(`${now}, failed to execute sui, ${err.toString()}`); @@ -244,16 +254,7 @@ async function sendTx() { data.error = err.toString(); console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`) } - try { - await uploadChoice(data); - } catch (err) { - await sendSlackMsg(`failed to upload sui, ${err.toString()}`); - console.log( - `failed to ${process.env.UPLOAD_METHOD === "AWS" ? "s3" : "gcs"}.upload!! Printing instead!`, - err.toString() - ); - console.log(JSON.stringify(data)); - } + } async function main() {