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

Use self-CPI for logging #84

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

samuelvanderwaal
Copy link
Contributor

@samuelvanderwaal samuelvanderwaal commented Feb 19, 2024

This PR changes the program to use the Anchor event_cpi feature for logging instead of the normal Solana logs which can get truncated by the validator.

The two additional accounts caused stack overflow issues in the mip1-sol-fulfill-buy accounts struct, so to fix this:

  • the superfluous rent account was removed
  • some address constraint checks were moved from the accounts struct to inside the handler logic

The removal of the rent account is a breaking change and required the client to be updated and any code consuming the client will need to be updated to no longer pass in the rent account.

Program logs before change:
Screenshot 2024-02-19 at 1 03 51 PM

Program logs after change:
Screenshot 2024-02-19 at 12 54 44 PM

Self-cpi:
Screenshot 2024-02-19 at 12 55 11 PM

@samuelvanderwaal samuelvanderwaal marked this pull request as ready for review February 20, 2024 17:55
@@ -75,7 +78,10 @@ pub fn handler(ctx: Context<CreatePool>, args: CreatePoolArgs) -> Result<()> {
pool.payment_mint = args.payment_mint;
pool.allowlists = args.allowlists;

log_pool("post_create_pool", pool)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might have some indexing depends on this logging

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's correct. The idea behind this PR is to change the way logging happens to avoid truncated logs causing misses on indexing, but it requires updating the indexing parser to handle the new logging method. So the indexing changes should be implemented before this PR is merged. @madergaser knows what needs to happen on this.

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

Successfully merging this pull request may close these issues.

2 participants