Skip to content

Conversation

@swimricky
Copy link
Contributor

@swimricky swimricky commented Apr 25, 2023

Summary

Add create/resize/delete_buffer ixs, allow for MessageBuffer to be variable length

Changes

  • Remove fund
  • Rename whitelist.authority to whitelist.admin and check that admin is signer & payer for all admin ixs.
  • MessageBuffer struct now only defines the header fields and allows for variable length for the actual messages (see MessageBuffer::put_all_in_buffer)

@vercel
Copy link

vercel bot commented Apr 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
example-oracle-amm ⬜️ Ignored (Inspect) Apr 25, 2023 3:44pm
xc-admin-frontend ⬜️ Ignored (Inspect) Apr 25, 2023 3:44pm

@swimricky swimricky changed the title Msg buffer admin [message-buffer 10/X] - Message Buffer Admin IXs Apr 25, 2023
.realloc(target_size, false)
.map_err(|_| MessageBufferError::ReallocFailed)?;
} else {
// TODO:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jayantk what are your thoughts on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's fine to shrink and not worry about the lamports. just leave a comment that the account will retain more rent than needed

)
}

// TODO: should delete_buffer have same CPI restrictions
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jayantk do we want to be able to call delete_buffer outside of a pyth delete_XXX ix?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah let the admin delete whatever.

can you add doc comments to all of these instructions?


/// Initializes the buffer account with the target_size
///
/// TODO: should target_size be a parameter or should
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jayantk what are your thoughts on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

target_size parameter is good. I think we have to manage the sizes anyway

@swimricky swimricky requested a review from jayantk April 25, 2023 12:57
@swimricky swimricky changed the title [message-buffer 10/X] - Message Buffer Admin IXs [message-buffer 10/X] - Message Buffer Admin IXs & variable length Apr 25, 2023
@swimricky swimricky marked this pull request as ready for review April 25, 2023 12:57
@swimricky swimricky requested review from Reisen and ali-behjati April 25, 2023 12:58
@swimricky swimricky requested a review from guibescos April 25, 2023 13:01
Copy link
Contributor

@jayantk jayantk left a comment

Choose a reason for hiding this comment

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

Generally looks good to me with a bunch of minor comments. I think in the interest of time, please fix the API (specifically the unnecessary system_program args) so we can integrate, merge, and then address feedback in a subsequent PR.

*accumulator_input = MessageBuffer::new(bump);
}
loader.exit(&crate::ID)?;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can log a warning or something if the account already exists?

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.

3 participants