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

Reconstruction #59

Merged
merged 5 commits into from
Mar 19, 2024
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
2 changes: 1 addition & 1 deletion common/src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const INITIAL_DEPLOYMENT_BLOCK_BY_NETWORK_AND_CHAIN: {
aptos: '0', // block is 1094390 but AptosWatcher uses sequence number instead
near: '72767136',
xpla: '777549',
solana: '94401321', // https://explorer.solana.com/tx/KhLy688yDxbP7xbXVXK7TGpZU5DAFHbYiaoX16zZArxvVySz8i8g7N7Ss2noQYoq9XRbg6HDzrQBjUfmNcSWwhe
solana: '94396403', // https://explorer.solana.com/tx/2L8rQY94W2d44sycRkhHA1PyXdh5z6ND541ftDDk1dgBcv6RLR9a3zUgTJispPmXjkmqdqd5EDytXcnP5PC2AmEJ
sui: '1485552', // https://explorer.sui.io/txblock/671SoTvVUvBZQWKXeameDvAwzHQvnr8Nj7dR9MUwm3CV?network=https%3A%2F%2Frpc.mainnet.sui.io
base: '1422314',
sei: '238594',
Expand Down
4 changes: 3 additions & 1 deletion watcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
"backfill-near": "ts-node scripts/backfillNear.ts",
"backfill-signed-vaas": "ts-node scripts/backfillSignedVAAs",
"backfill-vaas-by-tx-hash": "ts-node scripts/backfillVAAsByTxHash.ts",
"delete-messages-by-chain": "ts-node scripts/deleteMessagesByChain.ts",
"locate-message-gaps": "ts-node scripts/locateMessageGaps.ts",
"fetch-missing-vaas": "ts-node scripts/fetchMissingVAAs.ts",
"update-found-vaas": "ts-node scripts/updateFoundVAAs.ts",
"read-bigtable": "ts-node scripts/readBigtable.ts",
"read-firestore": "ts-node scripts/readFirestore.ts"
"read-firestore": "ts-node scripts/readFirestore.ts",
"reconstruct-vaa": "ts-node scripts/reconstructVAA.ts"
},
"dependencies": {
"@celo-tools/celo-ethers-wrapper": "^0.3.0",
Expand Down
35 changes: 29 additions & 6 deletions watcher/scripts/locateMessageGaps.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import * as dotenv from 'dotenv';
dotenv.config();
import { ChainId, coalesceChainName } from '@certusone/wormhole-sdk';
import { Environment, getEnvironment, sleep } from '@wormhole-foundation/wormhole-monitor-common';
import { ChainId, CHAIN_ID_SOLANA, coalesceChainName } from '@certusone/wormhole-sdk';
import {
Environment,
INITIAL_DEPLOYMENT_BLOCK_BY_NETWORK_AND_CHAIN,
getEnvironment,
sleep,
} from '@wormhole-foundation/wormhole-monitor-common';
import { TIMEOUT } from '../src/consts';
import { BigtableDatabase } from '../src/databases/BigtableDatabase';
import { parseMessageId } from '../src/databases/utils';
Expand All @@ -21,10 +26,20 @@ import { Watcher } from '../src/watchers/Watcher';
const messageTable = instance.table(bt.msgTableId);
try {
// Find gaps in sequence numbers with the same chain and emitter
// Filter known bad emitters
// Sort by ascending sequence number
const observedMessages = (await messageTable.getRows())[0].sort((a, b) =>
Number(parseMessageId(a.id).sequence - parseMessageId(b.id).sequence)
);
const observedMessages = (await messageTable.getRows())[0]
.filter((m) => {
const { chain, emitter } = parseMessageId(m.id);
if (
chain === CHAIN_ID_SOLANA &&
emitter === '6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25'
) {
return false;
}
return true;
})
.sort((a, b) => Number(parseMessageId(a.id).sequence - parseMessageId(b.id).sequence));
const total = observedMessages.length;
console.log(`processing ${total} messages`);
const gaps = [];
Expand All @@ -36,9 +51,13 @@ import { Watcher } from '../src/watchers/Watcher';
emitter: emitterAddress,
sequence,
} = parseMessageId(observedMessage.id);
const chainName = coalesceChainName(emitterChain as ChainId);
const emitter = `${emitterChain}/${emitterAddress}`;
if (!latestEmission[emitter]) {
latestEmission[emitter] = { sequence: 0n, block: 0 };
latestEmission[emitter] = {
sequence: chainName === 'algorand' || chainName === 'near' ? 0n : -1n,
block: Number(INITIAL_DEPLOYMENT_BLOCK_BY_NETWORK_AND_CHAIN[network][chainName] || 0),
};
}
while (sequence > latestEmission[emitter].sequence + 1n) {
latestEmission[emitter].sequence += 1n;
Expand Down Expand Up @@ -71,6 +90,10 @@ import { Watcher } from '../src/watchers/Watcher';
for (const gap of gaps) {
const [chain, blockRange, emitter, sequence] = gap.split('/');
const chainName = coalesceChainName(Number(chain) as ChainId);
if (chainName === 'algorand') {
console.warn('skipping algorand gaps until backfilled');
continue;
}
let watcher: Watcher;
try {
watcher = makeFinalizedWatcher(network, chainName);
Expand Down
Loading
Loading