Skip to content

Conversation

@s-medvedev
Copy link

  1. Use AccountStorage to access Rent sysvar and return_data()
  2. Implement log_data() and log_msg() to work with our implementation instead of syscall_stab in emulation context

@s-medvedev s-medvedev self-assigned this Feb 16, 2024
Copy link
Collaborator

@anton-lisanin anton-lisanin left a comment

Choose a reason for hiding this comment

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

You can remove lib/src/syscall_stubs.rs

.await?
.value
.unwrap();
let rent = Rent::from_account_info(&AccountInfo {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be simplified to
let rent = bincode::deserialize(&rent_account.data)

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

};

// TODO: is it correct to get rent from the account
let mut rent_account = rpc
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is correct

Copy link
Author

Choose a reason for hiding this comment

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

Removed

.get_account(&solana_sdk::sysvar::rent::id())
.await?
.value
.unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Check for error instead of unwarping

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

}

fn rent(&self) -> &Rent {
unimplemented!();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why unimplemented!?

Copy link
Author

Choose a reason for hiding this comment

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

This TestDatabase is used only for cargo tests and rent() method isn't required.

}

#[cfg(target_os = "solana")]
macro_rules! log_msg {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the difference between debug_print and log_msg?

Copy link
Author

Choose a reason for hiding this comment

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

debug_print doesn't show any line in program, log_msg is replacement for solana_program::msg macros.

@anton-lisanin
Copy link
Collaborator

Will be merged to 1.9.x as part of #281

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.

4 participants