Skip to content

Commit

Permalink
Temporary fix for multisig indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
Redm4x committed Feb 4, 2024
1 parent f829921 commit 915464f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
4 changes: 2 additions & 2 deletions indexer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion indexer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloudmos-indexer",
"version": "1.6.1",
"version": "1.6.2",
"description": "Indexer for any Cosmos based blockchain",
"author": "Cloudmos",
"license": "Apache-2.0",
Expand Down
40 changes: 25 additions & 15 deletions indexer/src/indexers/messageAddressesIndexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,31 @@ export class MessageAddressesIndexer extends Indexer {
for (const signerInfo of signerInfos) {
if (!signerInfo.publicKey) continue;

const pubkey = decodePubkey(signerInfo.publicKey);
if (pubkey.type === "tendermint/PubKeySecp256k1") {
const pubKeyBuffer = Buffer.from(pubkey.value, "base64");

addresses.push(toBech32(activeChain.bech32Prefix, rawSecp256k1PubkeyToRawAddress(pubKeyBuffer)));
} else if (pubkey.type === "tendermint/PubKeyMultisigThreshold") {
multisigThreshold = pubkey.value.threshold;
addresses = addresses.concat(
pubkey.value.pubkeys.map((p) => {
const pubKeyBuffer = Buffer.from(p.value, "base64");
return toBech32(activeChain.bech32Prefix, rawSecp256k1PubkeyToRawAddress(pubKeyBuffer));
})
);
} else {
throw "Unrecognized pubkey type: " + JSON.stringify(pubkey);
try {
const pubkey = decodePubkey(signerInfo.publicKey);
if (pubkey.type === "tendermint/PubKeySecp256k1") {
const pubKeyBuffer = Buffer.from(pubkey.value, "base64");

addresses.push(toBech32(activeChain.bech32Prefix, rawSecp256k1PubkeyToRawAddress(pubKeyBuffer)));
} else if (pubkey.type === "tendermint/PubKeyMultisigThreshold") {
multisigThreshold = pubkey.value.threshold;
addresses = addresses.concat(
pubkey.value.pubkeys.map((p) => {
const pubKeyBuffer = Buffer.from(p.value, "base64");
return toBech32(activeChain.bech32Prefix, rawSecp256k1PubkeyToRawAddress(pubKeyBuffer));
})
);
} else {
throw "Unrecognized pubkey type: " + JSON.stringify(pubkey);
}
} catch (e) {
// TEMPORARY FIX FOR TX 63CBF2B5C23E30B774F5072F625E3400603C95B993F0428E375F8078EAC95B17
if (signerInfo.publicKey.typeUrl === "/cosmos.crypto.multisig.LegacyAminoPubKey") {
console.log("FAILED TO DECODE MULTISIG PUBKEY: ", hash);
return { multisigThreshold: null, addresses: [] };
}

throw e;
}
}

Expand Down

0 comments on commit 915464f

Please sign in to comment.