Skip to content

Commit 5fae7e0

Browse files
committed
this... is...
1 parent 1b8bb02 commit 5fae7e0

File tree

6 files changed

+739
-953
lines changed

6 files changed

+739
-953
lines changed

tooling/sparta/src/admins/manageValidators.ts

Lines changed: 15 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -9,57 +9,6 @@ import { paginate } from "../utils/pagination.js";
99
import { ValidatorService } from "../services/validator-service.js";
1010
import { validateAddress } from "../utils/inputValidator.js";
1111

12-
export const EXCLUDED_VALIDATORS = [
13-
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
14-
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
15-
"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
16-
"0x90F79bf6EB2c4f870365E785982E1f101E93b906",
17-
"0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65",
18-
"0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",
19-
"0x976EA74026E726554dB657fA54763abd0C3a0aa9",
20-
"0x14dC79964da2C08b23698B3D3cc7Ca32193d9955",
21-
"0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f",
22-
"0xa0Ee7A142d267C1f36714E4a8F75612F20a79720",
23-
"0xBcd4042DE499D14e55001CcbB24a551F3b954096",
24-
"0x71bE63f3384f5fb98995898A86B02Fb2426c5788",
25-
"0xFABB0ac9d68B0B445fB7357272Ff202C5651694a",
26-
"0x1CBd3b2770909D4e10f157cABC84C7264073C9Ec",
27-
"0xdF3e18d64BC6A983f673Ab319CCaE4f1a57C7097",
28-
"0xcd3B766CCDd6AE721141F452C550Ca635964ce71",
29-
"0x2546BcD3c84621e976D8185a91A922aE77ECEc30",
30-
"0xbDA5747bFD65F08deb54cb465eB87D40e51B197E",
31-
"0xdD2FD4581271e230360230F9337D5c0430Bf44C0",
32-
"0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199",
33-
"0x09DB0a93B389bEF724429898f539AEB7ac2Dd55f",
34-
"0x02484cb50AAC86Eae85610D6f4Bf026f30f6627D",
35-
"0x08135Da0A343E492FA2d4282F2AE34c6c5CC1BbE",
36-
"0x5E661B79FE2D3F6cE70F5AAC07d8Cd9abb2743F1",
37-
"0x61097BA76cD906d2ba4FD106E757f7Eb455fc295",
38-
"0xDf37F81dAAD2b0327A0A50003740e1C935C70913",
39-
"0x553BC17A05702530097c3677091C5BB47a3a7931",
40-
"0x87BdCE72c06C21cd96219BD8521bDF1F42C78b5e",
41-
"0x40Fc963A729c542424cD800349a7E4Ecc4896624",
42-
"0x9DCCe783B6464611f38631e6C851bf441907c710",
43-
"0x1BcB8e569EedAb4668e55145Cfeaf190902d3CF2",
44-
"0x8263Fce86B1b78F95Ab4dae11907d8AF88f841e7",
45-
"0xcF2d5b3cBb4D7bF04e3F7bFa8e27081B52191f91",
46-
"0x86c53Eb85D0B7548fea5C4B4F82b4205C8f6Ac18",
47-
"0x1aac82773CB722166D7dA0d5b0FA35B0307dD99D",
48-
"0x2f4f06d218E426344CFE1A83D53dAd806994D325",
49-
"0x1003ff39d25F2Ab16dBCc18EcE05a9B6154f65F4",
50-
"0x9eAF5590f2c84912A08de97FA28d0529361Deb9E",
51-
"0x11e8F3eA3C6FcF12EcfF2722d75CEFC539c51a1C",
52-
"0x7D86687F980A56b832e9378952B738b614A99dc6",
53-
"0x9eF6c02FB2ECc446146E05F1fF687a788a8BF76d",
54-
"0x08A2DE6F3528319123b25935C92888B16db8913E",
55-
"0xe141C82D99D85098e03E1a1cC1CdE676556fDdE0",
56-
"0x4b23D303D9e3719D6CDf8d172Ea030F80509ea15",
57-
"0xC004e69C5C04A223463Ff32042dd36DabF63A25a",
58-
"0x5eb15C0992734B5e77c888D713b4FC67b3D679A2",
59-
"0x7Ebb637fd68c523613bE51aad27C35C4DB199B9c",
60-
"0x3c3E2E178C69D4baD964568415a0f0c84fd6320A",
61-
];
62-
6312
export default {
6413
data: new SlashCommandBuilder()
6514
.setName("admin")
@@ -119,31 +68,34 @@ export default {
11968
});
12069

12170
try {
122-
const addressesPerPage = 40;
71+
const addressesPerPage = 20;
12372

124-
const { validators, committee } = await ChainInfoService.getInfo();
125-
const filteredValidators = (validators as string[]).filter(
126-
(v) => !EXCLUDED_VALIDATORS.includes(v)
127-
);
128-
const filteredCommittee = (committee as string[]).filter(
129-
(v) => !EXCLUDED_VALIDATORS.includes(v)
130-
);
73+
const {
74+
validators,
75+
forwardedValidators,
76+
committee,
77+
forwardedCommittee,
78+
} = await ChainInfoService.getInfo();
13179
if (interaction.options.getSubcommand() === "committee") {
13280
await paginate(
133-
filteredCommittee,
81+
committee.map(
82+
(c, i) => `${c} -> ${forwardedCommittee[i]}`
83+
) as string[],
13484
committee.length,
13585
addressesPerPage,
13686
interaction,
137-
"Committee"
87+
"Committee (Forwarders)"
13888
);
13989
return "Checked committee";
14090
} else if (interaction.options.getSubcommand() === "validators") {
14191
await paginate(
142-
filteredValidators,
92+
validators.map(
93+
(v, i) => `${v} -> ${forwardedValidators[i]}`
94+
) as string[],
14395
validators.length,
14496
addressesPerPage,
14597
interaction,
146-
"Validators"
98+
"Validators (Forwarders)"
14799
);
148100
return "Checked validators";
149101
} else if (interaction.options.getSubcommand() === "remove") {

tooling/sparta/src/commands/checkValidator.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import {
44
MessageFlags,
55
} from "discord.js";
66
import { ChainInfoService } from "../services/chaininfo-service.js";
7+
import { Ethereum, getExpectedAddress } from "../utils/ethereum.js";
8+
import { ethereum } from "../index.js";
9+
import { ForwarderBytecode } from "../utils/abis/forwarder.js";
10+
import { ForwarderAbi } from "../utils/abis/forwarder.js";
711

812
export default {
913
data: new SlashCommandBuilder()
@@ -41,26 +45,29 @@ export default {
4145
});
4246
return `Invalid address`;
4347
}
44-
4548
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
4649

50+
const forwarder = getExpectedAddress(
51+
[address as `0x${string}`],
52+
address as `0x${string}`
53+
).address;
54+
4755
if (interaction.options.getSubcommand() === "check") {
4856
const info = await ChainInfoService.getInfo();
4957
const { validators, committee } = info;
5058

51-
let reply = "";
59+
let reply = "Your forwarder contract is: " + forwarder + "\n";
5260
if (validators.includes(address)) {
53-
reply += "You are a validator\n";
61+
reply += "It is a validator\n";
5462
}
5563
if (committee.includes(address)) {
56-
reply += "You are a committee member\n";
64+
reply += "It is a committee member\n";
5765
}
5866

5967
await interaction.editReply({
60-
content:
61-
reply || "You are not a validator or committee member",
68+
content: reply,
6269
});
63-
return `Checked validator ${address}`;
70+
return `Checked validator ${address} with forwarder ${forwarder}`;
6471
}
6572
return `Unknown subcommand`;
6673
} catch (error) {

tooling/sparta/src/services/chaininfo-service.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import { ethereum } from "../index.js";
2+
import { Ethereum, getExpectedAddress } from "../utils/ethereum.js";
23

34
type ChainInfo = {
45
pendingBlockNum: string;
56
provenBlockNum: string;
6-
validators: string | string[];
7-
committee: string | string[];
8-
archive: string | string[];
7+
validators: string[];
8+
forwardedValidators: string[];
9+
committee: string[];
10+
forwardedCommittee: string[];
11+
archive: string[];
912
currentEpoch: string;
1013
currentSlot: string;
1114
proposerNow: string;
@@ -44,8 +47,14 @@ export class ChainInfoService {
4447
return {
4548
pendingBlockNum: pendingNum as string,
4649
provenBlockNum: provenNum as string,
47-
validators: validators as string[],
48-
committee: committee as string[],
50+
validators: validators,
51+
forwardedValidators: validators.map(
52+
(e: `0x${string}`) => getExpectedAddress([e], e).address
53+
),
54+
committee: committee,
55+
forwardedCommittee: committee.map(
56+
(e: `0x${string}`) => getExpectedAddress([e], e).address
57+
),
4958
archive: archive as string[],
5059
currentEpoch: epochNum as string,
5160
currentSlot: slot as string,

0 commit comments

Comments
 (0)