Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(status-page): disable L3 on boolean env var #13838

Merged
merged 2 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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