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

Instruction log parsing could be better sanitized #262

Open
sintemal opened this issue Jun 27, 2023 · 0 comments
Open

Instruction log parsing could be better sanitized #262

sintemal opened this issue Jun 27, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@sintemal
Copy link

sintemal commented Jun 27, 2023

Currently, the explorer parses the hierarchy of inner instructions based on the program logs:
https://github.com/solana-labs/explorer/blob/7b6116dfdda770c82fa41190cb52b0ffba8f329e/app/utils/program-logs.ts#L91C49-L91C49

Especially the parsing of program returns based on log.includes("success") and log.includes("failed") seems a bit flawed,
as the logs of native programs do not have the Program log: prefix like normal programs and, therefore, do not get filtered out beforehand.
This means that if a native program emits a log message containing success or failure, the parsing is incorrect.
One could achieve this by using
https://github.com/solana-labs/solana/blob/0cd57addcf4ae242e0d068d09fc0359a4249a5e6/programs/zk-token-proof/src/lib.rs#L33

or, -as the zk-token-proof program doesn't seem to be deployed yet- by grinding a Pubkey containing the string and using one of the various other logs: https://github.com/solana-labs/solana/blob/2210af60ee615eda44bd3afc0b2093c23600a005/program-runtime/src/invoke_context.rs#L600

I guess the best fix here would be using a regex similar to the parsing of an invoked program.

@sintemal sintemal added the bug Something isn't working label Jun 27, 2023
@sintemal sintemal changed the title Instruction Log parsing could be better sanitized Instruction log parsing could be better sanitized Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants