From 2b42e5497770910065a36bea9cce82237e4411bf Mon Sep 17 00:00:00 2001 From: ara-klaytn Date: Wed, 10 Jan 2024 10:45:37 +0800 Subject: [PATCH] Changed path to gcp for L1 --- .DS_Store | Bin 8196 -> 8196 bytes .../.env.template | 3 -- .../sendtx_arbitrium.js | 22 ++++++------ optimism-tx-latency-measurement/.env.template | 3 -- .../sendtx_optimism.js | 34 +++++++++--------- 5 files changed, 28 insertions(+), 34 deletions(-) diff --git a/.DS_Store b/.DS_Store index 24517a1696bbd13ad0d605044a79abdaa1bbd4b6..7cdbab49fcf239d695399ddfb72bf2acd2a44201 100644 GIT binary patch delta 40 wcmZp1XmOa}&nU7nU^hRb$Yvga+svD#Mcyz^Y%tl(F7b_Jv!UoUril%P02tH_{{R30 delta 64 zcmZp1XmOa}&nUVvU^hRb=w=>)+svX|4CxH{3~3CR40#NR3^_o$h@oWi3L*K;&xPMG TZ)TVH#xglyL~iqQk(W#WRy`B@ diff --git a/arbitrium-tx-latency-measurement/.env.template b/arbitrium-tx-latency-measurement/.env.template index a7fe31a..f7677b5 100644 --- a/arbitrium-tx-latency-measurement/.env.template +++ b/arbitrium-tx-latency-measurement/.env.template @@ -5,9 +5,6 @@ S3_BUCKET= GCP_PROJECT_ID= GCP_KEY_FILE_PATH= GCP_BUCKET= -GCP_PROJECT_ID_L1= -GCP_KEY_FILE_PATH_L1= -GCP_BUCKET_L1= SLACK_CHANNEL=SLACK_CHANNEL SLACK_API_URL=https://slack.com/api/chat.postMessage SLACK_AUTH=xoxb-SLACK_AUTH_TOKEN diff --git a/arbitrium-tx-latency-measurement/sendtx_arbitrium.js b/arbitrium-tx-latency-measurement/sendtx_arbitrium.js index 75491a0..3802218 100644 --- a/arbitrium-tx-latency-measurement/sendtx_arbitrium.js +++ b/arbitrium-tx-latency-measurement/sendtx_arbitrium.js @@ -121,16 +121,16 @@ async function uploadToGCS(data) { async function uploadToGCSL1(data) { if ( - process.env.GCP_PROJECT_ID_L1 === "" || - process.env.GCP_KEY_FILE_PATH_L1 === "" || - process.env.GCP_BUCKET_L1 === "" + process.env.GCP_PROJECT_ID === "" || + process.env.GCP_KEY_FILE_PATH === "" || + process.env.GCP_BUCKET === "" ) { throw "undefined parameters"; } const storage = new Storage({ - projectId: process.env.GCP_PROJECT_ID_L1, - keyFilename: process.env.GCP_KEY_FILE_PATH_L1, + projectId: process.env.GCP_PROJECT_ID, + keyFilename: process.env.GCP_KEY_FILE_PATH, }); const filename = await makeParquetFile(data); @@ -141,8 +141,8 @@ async function uploadToGCSL1(data) { destination: destFileName, }; - await storage.bucket(process.env.GCP_BUCKET_L1).upload(filename, options); - console.log(`${filename} uploaded to ${process.env.GCP_BUCKET_L1}`); + await storage.bucket(process.env.GCP_BUCKET).upload(filename, options); + console.log(`${filename} uploaded to ${process.env.GCP_BUCKET}`); } await uploadFile().catch(console.error); @@ -254,14 +254,14 @@ async function sendTx() { // Calculate Transaction Fee and Get Tx Fee in USD var ARBtoUSD; await axios.get(`https://api.coingecko.com/api/v3/simple/price?ids=arbitrum&vs_currencies=usd&x_cg_demo_api_key=${process.env.COIN_GECKO_API_KEY}`) - .then(response => { - ARBtoUSD = response.data["arbitrum"].usd; - }); + .then(response => { + ARBtoUSD = response.data["arbitrum"].usd; + }); data.txFeeInUSD = data.txFee * ARBtoUSD; // 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(); + const now = new Date(); sendSlackMsg(`${now}, failed to execute arbitrum, ${err.toString()}`); console.log("failed to execute.", err.toString()); data.error = err.toString(); diff --git a/optimism-tx-latency-measurement/.env.template b/optimism-tx-latency-measurement/.env.template index e6e415d..5e0a98f 100644 --- a/optimism-tx-latency-measurement/.env.template +++ b/optimism-tx-latency-measurement/.env.template @@ -5,9 +5,6 @@ S3_BUCKET= GCP_PROJECT_ID= GCP_KEY_FILE_PATH= GCP_BUCKET= -GCP_PROJECT_ID_L1= -GCP_KEY_FILE_PATH_L1= -GCP_BUCKET_L1= SLACK_CHANNEL=SLACK_CHANNEL SLACK_API_URL=https://slack.com/api/chat.postMessage SLACK_AUTH=xoxb-SLACK_AUTH_TOKEN diff --git a/optimism-tx-latency-measurement/sendtx_optimism.js b/optimism-tx-latency-measurement/sendtx_optimism.js index d483bd7..2d25b4b 100644 --- a/optimism-tx-latency-measurement/sendtx_optimism.js +++ b/optimism-tx-latency-measurement/sendtx_optimism.js @@ -121,16 +121,16 @@ async function uploadToGCS(data) { async function uploadToGCSL1(data) { if ( - process.env.GCP_PROJECT_ID_L1 === "" || - process.env.GCP_KEY_FILE_PATH_L1 === "" || - process.env.GCP_BUCKET_L1 === "" + process.env.GCP_PROJECT_ID === "" || + process.env.GCP_KEY_FILE_PATH === "" || + process.env.GCP_BUCKET === "" ) { throw "undefined parameters"; } const storage = new Storage({ - projectId: process.env.GCP_PROJECT_ID_L1, - keyFilename: process.env.GCP_KEY_FILE_PATH_L1, + projectId: process.env.GCP_PROJECT_ID, + keyFilename: process.env.GCP_KEY_FILE_PATH, }); const filename = await makeParquetFile(data); @@ -141,8 +141,8 @@ async function uploadToGCSL1(data) { destination: destFileName, }; - await storage.bucket(process.env.GCP_BUCKET_L1).upload(filename, options); - console.log(`${filename} uploaded to ${process.env.GCP_BUCKET_L1}`); + await storage.bucket(process.env.GCP_BUCKET).upload(filename, options); + console.log(`${filename} uploaded to ${process.env.GCP_BUCKET}`); } await uploadFile().catch(console.error); @@ -241,19 +241,19 @@ async function sendTx() { Number(web3.utils.fromWei(Number(receipt.effectiveGasPrice), "ether")); }); - const db = await JSONPreset("db.json", { posts: [] }); - db.data.posts.push({ - l2TxHash: data.txhash, - createdAt: data.executedAt, - status: "pending", - l1CommitTiming: null, - }); - db.write(); + const db = await JSONPreset("db.json", { posts: [] }); + db.data.posts.push({ + l2TxHash: data.txhash, + createdAt: data.executedAt, + status: "pending", + l1CommitTiming: null, + }); + db.write(); // Calculate Transaction Fee and Get Tx Fee in USD var OPTtoUSD; - await axios.get(`https://api.coingecko.com/api/v3/simple/price?ids=optimism&vs_currencies=usd&x_cg_demo_api_key=${process.env.COIN_GECKO_API_KEY}`) + await axios.get(`https://api.coingecko.com/api/v3/simple/price?ids=optimism&vs_currencies=usd&x_cg_demo_api_key=${process.env.COIN_GECKO_API_KEY}`) .then(response => { OPTtoUSD = response.data["optimism"].usd; }); @@ -263,7 +263,7 @@ async function sendTx() { // 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(); + const now = new Date(); sendSlackMsg(`${now}, failed to execute optimism, ${err.toString()}`); console.log("failed to execute.", err.toString()); data.error = err.toString();