Skip to content

Commit

Permalink
feat(status-page): disable L3 on boolean env var (#13838)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored and dantaik committed May 31, 2023
1 parent 3d92491 commit e0e560c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 7 deletions.
10 changes: 10 additions & 0 deletions packages/eventindexer/indexer/save_block_proven_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ func (svc *Service) updateAverageProofTime(ctx context.Context, event *taikol1.T
new(big.Int).SetUint64(proofTime),
)

log.Infof("avgProofTime update: id: %v, prover: %v, proposedAt: %v, provenAt: %v, proofTIme: %v, avg: %v, newAvg: %v",
event.Id.Int64(),
event.Prover.Hex(),
proposedAt,
provenAt,
proofTime,
avg.String(),
newAverageProofTime.String(),
)

_, err = svc.statRepo.Save(ctx, eventindexer.SaveStatOpts{
ProofTime: newAverageProofTime,
})
Expand Down
6 changes: 6 additions & 0 deletions packages/eventindexer/indexer/save_block_verified_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ func (svc *Service) updateAverageBlockReward(ctx context.Context, event *taikol1
new(big.Int).SetUint64(stat.NumVerifiedBlocks),
new(big.Int).SetUint64(reward),
)
log.Infof("blockVerified reward update. id: %v, newAvg: %v, oldAvg: %v, reward: %v",
event.Id.String(),
newAverageProofReward.String(),
avg.String(),
reward,
)

_, err = svc.statRepo.Save(ctx, eventindexer.SaveStatOpts{
ProofReward: newAverageProofReward,
Expand Down
3 changes: 2 additions & 1 deletion packages/status-page/.default.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ VITE_L3_EXPLORER_URL="https://l3explorer.internal.taiko.xyz"
VITE_FEE_TOKEN_SYMBOL=TTKO
VITE_ORACLE_PROVER_ADDRESS="0x1567CDAb5F7a69154e61A16D8Ff5eE6A3e991b39"
VITE_L2_EVENT_INDEXER_API_URL="http://localhost:4100"
VITE_L3_EVENT_INDEXER_API_URL="http://localhost:4100"
VITE_L3_EVENT_INDEXER_API_URL="http://localhost:4100"
VITE_ENABLE_L3=true
2 changes: 1 addition & 1 deletion packages/status-page/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ dist-ssr
.env
.a1.env
.s.env

.a3.env
# vite
vite.config.ts.timestamp-*.mjs
6 changes: 3 additions & 3 deletions packages/status-page/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import Home from "./pages/home/Home.svelte";
import { setupI18n } from "./i18n";
import Navbar from "./components/Navbar.svelte";
import { ethers } from "ethers";
import { layer } from "./store/layer";
import { Layer } from "./domain/layer";
setupI18n({ withLocale: "en" });
const routes = {
"/": wrap({
component: Home,
props: {
enableL3: import.meta.env.VITE_ENABLE_L3,
},
}),
};
</script>
Expand Down
2 changes: 1 addition & 1 deletion packages/status-page/src/domain/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type StatusIndicatorProp = {
provider: ethers.providers.JsonRpcProvider,
contractAddress: string,
onEvent: (value: Status) => void
) => void;
) => () => void;
provider: ethers.providers.JsonRpcProvider;
contractAddress: string;
header: string;
Expand Down
6 changes: 5 additions & 1 deletion packages/status-page/src/pages/home/Home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import { initConfig } from "../../utils/initConfig";
import { buildStatusIndicators } from "../../utils/buildStatusIndicators";
export let enableL3: boolean = false;
let statusIndicators: StatusIndicatorProp[] = [];
let proverDetailsOpen: boolean = false;
Expand All @@ -32,6 +34,8 @@
});
async function toggleLayer() {
if (!enableL3) return;
const newLayer = $layer === Layer.Two ? Layer.Three : Layer.Two;
layer.set(newLayer);
Expand All @@ -53,7 +57,7 @@

<div class="text-center">
<h1 class="text-2xl">Taiko Protocol Status</h1>
<h2 class="cursor-pointer" on:click={toggleLayer}>
<h2 class={enableL3 ? "cursor-pointer" : ""} on:click={toggleLayer}>
{layerToDisplayName($layer)}
</h2>
</div>
Expand Down

0 comments on commit e0e560c

Please sign in to comment.