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

Introduces Result return types to mutable accessors of BorrowedAccount #25380

Merged

Conversation

Lichtso
Copy link
Contributor

@Lichtso Lichtso commented May 19, 2022

Problem

Instead of PreAccount catching misbehavior after the instruction finishes,
we want to call it out immediately, when it happens.
This is a preparation to throw errors on faulty access.

Summary of Changes

Introduces Result return types to the following methods of BorrowedAccount:

  • get_data_mut()
  • set_data()
  • set_data_length()
  • set_owner()
  • set_lamports()
  • set_executable()

And always return Ok() for now, the actual feature gated check comes later.

@Lichtso Lichtso requested a review from jstarry May 20, 2022 13:47
@Lichtso Lichtso merged commit 7eae98c into solana-labs:master May 21, 2022
@Lichtso Lichtso deleted the refactor/borrowed_account_access_result branch May 21, 2022 15:47
behzadnouri added a commit that referenced this pull request May 22, 2022
This partially reverts commit f884203.

Apparently CI runs for
#25380
#25429
have interleaved each other resulting in a broken master.
behzadnouri added a commit that referenced this pull request May 23, 2022
This partially reverts commit f884203.

Apparently CI runs for
#25380
#25429
have interleaved each other resulting in a broken master.
@behzadnouri
Copy link
Contributor

@Lichtso can you also please verify if the ones in #25466 should be ignored?

I only reverted the code because master was broken, but not clear to me if ignoring errors there are fine.

@Lichtso
Copy link
Contributor Author

Lichtso commented May 23, 2022

@behzadnouri Yes, the Result should be ignored for now as it is always Ok(). I will add the error logic later in a separate PR.

jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Jun 29, 2022
…ount` (solana-labs#25380)

* Introduces result return types to get_data_mut(), set_data() and set_data_length() of BorrowedAccount.

* Introduces result return types to set_owner(), set_lamports() and set_executable() of BorrowedAccount.
jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Jun 29, 2022
This partially reverts commit f884203.

Apparently CI runs for
solana-labs#25380
solana-labs#25429
have interleaved each other resulting in a broken master.
jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Jun 29, 2022
…ount` (solana-labs#25380)

* Introduces result return types to get_data_mut(), set_data() and set_data_length() of BorrowedAccount.

* Introduces result return types to set_owner(), set_lamports() and set_executable() of BorrowedAccount.
jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Jun 29, 2022
This partially reverts commit f884203.

Apparently CI runs for
solana-labs#25380
solana-labs#25429
have interleaved each other resulting in a broken master.
jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Jun 29, 2022
This partially reverts commit f884203.

Apparently CI runs for
solana-labs#25380
solana-labs#25429
have interleaved each other resulting in a broken master.
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.

None yet

3 participants