Skip to content

Commit

Permalink
Show BLS keys in contract
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJohnnyGault committed Mar 8, 2024
1 parent 64756ba commit 6f02737
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions public/_head.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
if (params.get("apiToken")) {
localStorage.setItem("apiToken", params.get("apiToken"));
}
if (params.get("devmode")) {
localStorage.setItem("devmode", params.get("devmode"));
}
ORC_AUTH_TOKEN = localStorage.getItem("apiToken");
</script>
{{end}}
17 changes: 17 additions & 0 deletions public/js/tabulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ const minipoolsDef = {
if (data.ggpSlashAmt > 0) {
row.getElement().style.backgroundColor = "#ff0000bf";
}
if (data.blsPubkeyAndSig === "0x") {
if (/y|1/.test(window.localStorage.getItem("devmode"))) {
row.getElement().style.backgroundColor = "#e0dd06";
}
}
},
columns: [
{ width: 20, formatter: "responsiveCollapse", headerSort: false },
Expand Down Expand Up @@ -398,6 +403,18 @@ const minipoolsDef = {
minWidth: 5000,
responsive: 9,
},
{
title: "BLSPubkey",
field: "blsPubkey",
minWidth: 5000,
responsive: 9,
},
{
title: "BLSSig",
field: "blsSig",
minWidth: 5000,
responsive: 9,
},
{
title: "Snowtrace",
field: "owner",
Expand Down
15 changes: 15 additions & 0 deletions public/js/transformers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { pipeAsyncFunctions, formatters, bigToNumber, unfuckEthersObj } from "/js/utils.js";
import { utils as ethersUtils } from "https://esm.sh/[email protected]";

// process each obj through a pipeline of fns
async function transformer(fns, objs) {
Expand All @@ -8,11 +9,25 @@ async function transformer(fns, objs) {
return xobjs;
}

function decodeBLS(blob) {
let data;
try {
data = ethersUtils.defaultAbiCoder.decode(["bytes", "bytes"], blob);
} catch (err) {
console.log("error decoding BLS", blob);
data = [null, null];
}
return data;
}

async function fixupMinipool(obj) {
obj.nodeAddr = obj.nodeID;
obj.nodeID = await formatters.nodeAddrToId(obj.nodeAddr);
obj.status = formatters.formatMPStatus(obj.status);
obj.txID = await formatters.toCB58(obj.txID);
const blob = decodeBLS(obj.blsPubkeyAndSig);
obj.blsPubkey = blob[0];
obj.blsSig = blob[1];

obj.errorCode = formatters.formatErrorMsg(obj.errorCode);

Expand Down

0 comments on commit 6f02737

Please sign in to comment.