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

Some (possibly all) car files don't contain program id index for inner instructions #138

Closed
ring0-rootkit opened this issue Jul 26, 2024 · 7 comments

Comments

@ring0-rootkit
Copy link

So, I stumbled upon an issue where inner instructions in all epochs that i've checked (626, 624, 623) don't have programIdIndex, here is what I get when I parse transactions from car files:

tx signature: 4MZUsuccxz2EWzJDZ547VqvDYuESpM9cbRpn6uYMNK93JuTPUTx3hSZdq4xBkMJ8nHAfQStPaeRDEFFhepjXNevk
inner instruction index: 4
outer instruction index: 9
program id index: 0
account keys: [EiAq1CALGJ4NjUej6GTGNswiZCyGefGwsXcYbk5AKZ25 7bBaVBMVHjZ5Ydf89JugQCoiYL6RFg2QSgVFLJiMaZTB 937UNuzvqiLdopRaRb1Wka5Hrct2uniKmi61xoMVUHC4 CsVZsc37H5rWznBuy7VpvJePvFV157yU11iYNGN7dtza CkeQKW6NxMV3cnMSRrvG31pNWjxx9FScUbA9dpYeVAyb Ddw7tY2i9U5S38EKU2soQBu8jBGKUVkFR5DPApxS8YrW DbK9zkkFDh9aHfV3TVbbDjrXtFtdecSbsGwfofW4KzvC GPTRveZEaAV7m2VjeYSjaLaoubgF7Lyc27L6EGhK5VrN 7hRuuZirTnqpchVuU6jkMrRYK6YdnSyr8oHkp6QZPR2B GHRaHag4bAFmFkQvK8DQeo1jF1JBguhWFa8Udi5fX8ED HNU2PPKQYVYgi8zkQJG7bep3mEXJWvcJeJwPVmfi8Z3u EQVQ11GvXZuE2xEqVdjhMvFPFvQLBb8EuQvGNZWTb7y9 BtgJkrqvE53jHHqw2DckL1697raPEXSCuMZGZCVo3ASw APBRxoEErDuHWF5STBhy2yDE472xyJXkGVRpcLWGHKjf ComputeBudget111111111111111111111111111111 3tZPEagumHvtgBhivFJCmhV9AyhBHGW9VgdsK52i4gwP 11111111111111111111111111111111 JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 D8cy77BBepLMngZx6ZukaTff5hCt1HrWyKk3Hnd9oitf srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX DoyfsKStMN2xdqt6nYQtoGqPJzcJZ88ASFuyHZAPioy1]

I can provide more examples if needed

For reference:
To get transaction I use FindTransactions method
To parse Transaction I use: parseTransactionAndMetaFromNode method from storage.go:174
To parse metadata I use: encodeTransactionResponseBasedOnWantedEncoding

@ring0-rootkit
Copy link
Author

ring0-rootkit commented Jul 26, 2024

UPDATE: checked all epochs I had, results:
missing programid in epochs: 626 - 617, 632
This are all epochs I have, unfortunately :(

@gagliardetto
Copy link
Collaborator

gagliardetto commented Jul 31, 2024

there might be some bug in encodeTransactionResponseBasedOnWantedEncoding

You're better off just doing tx, meta, err := parseTransactionAndMetaFromNode(transactionNode, epochHandler.GetDataFrameByCid) and then asserting txMeta, ok := meta.(*confirmed_block.TransactionStatusMeta) (all modern epochs use that format).

@ring0-rootkit
Copy link
Author

Ok and what about old epochs?

@gagliardetto
Copy link
Collaborator

gagliardetto commented Jul 31, 2024

It's gonna be one of these:

func ParseAnyTransactionStatusMeta(buf []byte) (any, error) {
// try to parse as protobuf (latest format)
status, err := ParseTransactionStatusMeta(buf)
if err == nil {
return status, nil
}
// try to parse as legacy serde format (last serde format used by solana)
status2, err := ParseLegacyTransactionStatusMeta(buf)
if err == nil {
return status2, nil
}
// try to parse as legacy serde format (probably the oldest serde format used by solana)
status1, err := ParseLegacyTransactionStatusMetaOldest(buf)
if err == nil {
return status1, nil
}
return nil, fmt.Errorf("failed to parse tx meta: %w", err)
}

@gagliardetto
Copy link
Collaborator

You just need to make a switch statement on the type of meta.

@ring0-rootkit
Copy link
Author

Ok, thank you I'll try it out

@ring0-rootkit
Copy link
Author

Ok, so I checked and it is skill issue, I mean programIdIndex is actually absent but as it should, and programId is returned already parsed for me. So there is no bug, thank you for your time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants