Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #39 from klaytn/dev
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
praveen-kaia authored Jan 11, 2024
2 parents 3a8d125 + 0487f28 commit 17f34ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions arbitrium-tx-latency-measurement/sendtx_arbitrium.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ async function l1Checker() {

async function l1commitmentprocess(db, hash, createdAt) {

var data = {
var gcpData = {
executedAt: new Date().getTime(),
txhash: "",
startTime: 0,
Expand Down Expand Up @@ -325,17 +325,17 @@ async function l1commitmentprocess(db, hash, createdAt) {
return Error("l2TxHash not found.");
}
}
const data = await response.json();
const finalityTiming = parseInt(data.root_end, 10);
const go_scraper_data = await response.json();
const finalityTiming = parseInt(go_scraper_data.root_end, 10);
const timeTaken = finalityTiming - createdAt;

const postIndex = db.data.posts.findIndex((post) => post.l2TxHash === hash);
if (postIndex !== -1) {
db.data.posts[postIndex].l1CommitTiming = timeTaken;
db.data.posts[postIndex].status = "success";
data.latency = timeTaken;
data.hash = hash;
uploadToGCSL1(data)
gcpData.latency = timeTaken;
gcpData.hash = hash;
uploadToGCSL1(gcpData)
} else {
sendL1FailedSlackMsg(`l2 ${hash} not found! in Arbitrium!`);
return Error("l2TxHash not found.");
Expand Down
12 changes: 6 additions & 6 deletions optimism-tx-latency-measurement/sendtx_optimism.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ async function l1Checker() {

async function l1commitmentprocess(db, hash, createdAt) {

var data = {
var gcpData = {
executedAt: new Date().getTime(),
txhash: "",
startTime: 0,
Expand Down Expand Up @@ -325,17 +325,17 @@ async function l1commitmentprocess(db, hash, createdAt) {
return Error("l2TxHash not found.");
}
}
const data = await response.json();
const finalityTiming = parseInt(data.root_end, 10);
const go_scraper_data = await response.json();
const finalityTiming = parseInt(go_scraper_data.root_end, 10);
const timeTaken = finalityTiming - createdAt;

const postIndex = db.data.posts.findIndex((post) => post.l2TxHash === hash);
if (postIndex !== -1) {
db.data.posts[postIndex].l1CommitTiming = timeTaken;
db.data.posts[postIndex].status = "success";
data.latency = timeTaken;
data.hash = hash;
uploadToGCSL1(data)
gcpData.latency = timeTaken;
gcpData.hash = hash;
uploadToGCSL1(gcpData)
} else {
sendL1FailedSlackMsg(`l2 ${hash} not found!`);
return Error("l2TxHash not found.");
Expand Down

0 comments on commit 17f34ee

Please sign in to comment.