Skip to content

Commit c6f6235

Browse files
committed
feat(validator-bot): review fixes by the rabbit
1 parent 4af6323 commit c6f6235

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

validator-cli/.env.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ VEAOUTBOX_ARBSEPOLIA_TO_SEPOLIA_ADDRESS=0x906dE43dBef27639b1688Ac46532a16dc07Ce4
2424
VEAINBOX_ARB_TO_GNOSIS_ADDRESS=0x854374483572FFcD4d0225290346279d0718240b
2525
VEAOUTBOX_ARB_TO_GNOSIS_ADDRESS=0x2f1788F7B74e01c4C85578748290467A5f063B0b
2626
VEAROUTER_ARB_TO_GNOSIS_ADDRESS=0x5BE03fDE7794Bc188416ba16932510Ed1277b193
27-
GNO_AMB_ADDRESS=0x8448E15d0e706C0298dECA99F0b4744030e59d7d
27+
GNOSIS_AMB_ADDRESS=0x8448E15d0e706C0298dECA99F0b4744030e59d7d
2828

2929
TRANSACTION_BATCHER_CONTRACT_ADDRESS_SEPOLIA=0xe7953da7751063d0a41ba727c32c762d3523ade8
3030
TRANSACTION_BATCHER_CONTRACT_ADDRESS_CHIADO=0xcC0a08D4BCC5f91ee9a1587608f7a2975EA75d73

validator-cli/src/ArbToEth/watcherArbToGnosis.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ const secondsPerSlotGnosis = 5;
8686
const veaOutboxAddress = process.env.VEAOUTBOX_ARB_TO_GNOSIS_ADDRESS;
8787
const veaInboxAddress = process.env.VEAINBOX_ARB_TO_GNOSIS_ADDRESS;
8888
const veaRouterAddress = process.env.VEAROUTER_ARB_TO_GNOSIS_ADDRESS;
89+
const gnosisAMBAddress = process.env.GNOSIS_AMB_ADDRESS;
8990

9091
const challenges = new Map<number, ChallengeProgress>();
9192

@@ -101,7 +102,7 @@ const watch = async () => {
101102
const veaOutbox = getVeaOutboxArbToGnosisProvider(veaOutboxAddress, process.env.PRIVATE_KEY, providerGnosis);
102103
const veaInbox = getVeaInboxArbToGnosisProvider(veaInboxAddress, process.env.PRIVATE_KEY, providerArb);
103104
const veaRouter = getVeaRouterArbToGnosisProvider(veaRouterAddress, process.env.PRIVATE_KEY, providerEth);
104-
const amb = getAMBProvider(process.env.PRIVATE_KEY, providerGnosis);
105+
const amb = getAMBProvider(gnosisAMBAddress, process.env.PRIVATE_KEY, providerGnosis);
105106

106107
const wethAddress = (await retryOperation(() => veaOutbox.weth(), 1000, 10)) as string;
107108
const weth = getWETHProvider(wethAddress, process.env.PRIVATE_KEY, providerGnosis);
@@ -932,7 +933,9 @@ async function reconstructChallengeProgress(
932933
retryOperation(() => providerArb.getBlock("latest"), 1000, 10) as any,
933934
]);
934935

935-
const averageArbitrumBlocktime = 0.26;
936+
const blockTimeWindow = 100; // Calculate average over last 100 blocks
937+
const oldBlock = await providerArb.getBlock(arbLatest.number - blockTimeWindow);
938+
const averageArbitrumBlocktime = (arbLatest.timestamp - oldBlock.timestamp) / blockTimeWindow;
936939
const estimatedArbBlocks = Math.ceil((arbLatest.timestamp - challengeBlock.timestamp) / averageArbitrumBlocktime);
937940

938941
const snapshotSentFilter = veaInbox.filters.SnapshotSent(epoch, null);

validator-cli/src/utils/ethers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ function getVeaRouterArbToGnosisProvider(veaRouterAddress: string, privateKey: s
6969
return RouterArbToGnosis__factory.connect(veaRouterAddress, getWalletRPC(privateKey, rpc));
7070
}
7171

72-
function getAMBProvider(privateKey: string, rpc: JsonRpcProvider) {
73-
return IAMB__factory.connect(process.env.GNO_AMB_ADDRESS, getWalletRPC(privateKey, rpc));
72+
function getAMBProvider(ambAddress: string, privateKey: string, rpc: JsonRpcProvider) {
73+
return IAMB__factory.connect(ambAddress, getWalletRPC(privateKey, rpc));
7474
}
7575
export {
7676
getVeaOutboxArbToEth,

0 commit comments

Comments
 (0)