Skip to content

Commit 6295b39

Browse files
committed
chore(validator-bot): increased type safety
1 parent 0756c69 commit 6295b39

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

validator-cli/src/ArbToEth/watcherArbToEth.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -441,18 +441,16 @@ const watch = async () => {
441441
continue;
442442
}
443443
}
444-
const gasEstimate = BigInt(
445-
(await retryOperation(
446-
() =>
447-
veaOutbox["challenge(uint256,(bytes32,address,uint32,uint32,uint32,uint8,address))"].estimateGas(
448-
veaEpochOutboxCheck,
449-
claim,
450-
{ value: deposit }
451-
),
452-
1000,
453-
10
454-
)) as any
455-
);
444+
const gasEstimate = (await retryOperation(
445+
() =>
446+
veaOutbox["challenge(uint256,(bytes32,address,uint32,uint32,uint32,uint8,address))"].estimateGas(
447+
veaEpochOutboxCheck,
448+
claim,
449+
{ value: deposit }
450+
),
451+
1000,
452+
10
453+
)) as bigint;
456454

457455
// Adjust the calculation to ensure maxFeePerGas is reasonable
458456
const maxFeePerGasProfitable = deposit / (gasEstimate * BigInt(6));

validator-cli/src/ArbToEth/watcherArbToGnosis.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const watch = async () => {
112112
// get Arb sequencer params
113113
const l2Network = await getArbitrumNetwork(providerArb);
114114
const sequencer = SequencerInbox__factory.connect(l2Network.ethBridge.sequencerInbox, providerEth);
115-
const maxDelaySeconds = Number((await retryOperation(() => sequencer.maxTimeVariation(), 1000, 10))[1] as BigInt);
115+
const maxDelaySeconds = Number((await retryOperation(() => sequencer.maxTimeVariation(), 1000, 10))[1] as bigint);
116116

117117
// get vea outbox params
118118
const deposit = (await retryOperation(() => veaOutbox.deposit(), 1000, 10)) as bigint;

validator-cli/src/utils/devnet.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ async function initialize(
77
veaOutboxAddress: string,
88
veaInboxAddress: string,
99
outboxRPCUrl: string
10-
): Promise<[VeaInboxArbToEth, number, BigInt, VeaOutboxArbToEthDevnet, BigInt]> {
10+
): Promise<[VeaInboxArbToEth, number, bigint, VeaOutboxArbToEthDevnet, bigint]> {
1111
const outboxProvider = new JsonRpcProvider(outboxRPCUrl);
1212
const veaOutbox = getVeaOutboxArbToEthDevnet(veaOutboxAddress, process.env.PRIVATE_KEY, outboxRPCUrl);
1313

@@ -41,18 +41,18 @@ async function initialize(
4141
async function happyPath(
4242
veaInbox: VeaInboxArbToEth,
4343
epochPeriod: number,
44-
lastSavedCount: BigInt,
44+
lastSavedCount: bigint,
4545
veaOutbox: VeaOutboxArbToEthDevnet,
46-
deposit: BigInt
47-
): Promise<BigInt> {
46+
deposit: bigint
47+
): Promise<bigint> {
4848
let currentTS = Math.floor(Date.now() / 1000);
4949
let claimableEpoch = Math.floor(currentTS / epochPeriod);
5050
let newCount = lastSavedCount;
5151
const snapshot = await veaInbox.snapshots(claimableEpoch);
5252

5353
if (snapshot == "0x0000000000000000000000000000000000000000000000000000000000000000") {
5454
// check if snapshot should be taken
55-
const inboxCount: BigInt = await veaInbox.count();
55+
const inboxCount: bigint = await veaInbox.count();
5656
if (inboxCount > lastSavedCount) {
5757
// should take snapshot
5858
console.log("inbox updated: taking snapshot. . .");

0 commit comments

Comments
 (0)