Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

CPI without Account Refs #20034

Merged
merged 3 commits into from
Sep 21, 2021

Conversation

Lichtso
Copy link
Contributor

@Lichtso Lichtso commented Sep 20, 2021

Problem

#15410 introduced this unsafe expression.

Summary of Changes

  • Removes search for accounts and unsafe lifetime transmute in InvokeContext::push().
  • Replaces account parameters of all CPI methods by indices, as they are easier to verify and compatible with ABIv2 (see ABI v2 Proposal #19191).

Fixes #

@Lichtso Lichtso added the CI Pull Request is ready to enter CI label Sep 20, 2021
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Sep 20, 2021
@Lichtso Lichtso force-pushed the refactor/cpi_without_account_refs branch from c032a78 to 87cf637 Compare September 20, 2021 14:00
@Lichtso Lichtso force-pushed the refactor/cpi_without_account_refs branch from 87cf637 to dbc9918 Compare September 20, 2021 17:11
Copy link
Contributor

@jstarry jstarry left a comment

Choose a reason for hiding this comment

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

Nice cleanup, noticed something while reading your change

runtime/src/message_processor.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 20, 2021

Codecov Report

Merging #20034 (7d2d2b7) into master (4675fa6) will increase coverage by 0.1%.
The diff coverage is 83.4%.

@@            Coverage Diff            @@
##           master   #20034     +/-   ##
=========================================
+ Coverage    82.6%    82.8%   +0.1%     
=========================================
  Files         478      487      +9     
  Lines      133547   134784   +1237     
=========================================
+ Hits       110369   111651   +1282     
+ Misses      23178    23133     -45     

Copy link
Contributor

@jstarry jstarry left a comment

Choose a reason for hiding this comment

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

Looks great, it also looks like this change makes #9711 trivial to implement

@Lichtso Lichtso merged commit b507715 into solana-labs:master Sep 21, 2021
@Lichtso Lichtso deleted the refactor/cpi_without_account_refs branch September 21, 2021 12:41
@Lichtso Lichtso mentioned this pull request Sep 30, 2021
dankelleher pushed a commit to identity-com/solana that referenced this pull request Nov 24, 2021
* Removes search for accounts and unsafe lifetime transmute in InvokeContext::push().

* Replaces accounts by account_indices in verify_and_update() and process_cross_program_instruction().

Co-authored-by: Justin Starry <[email protected]>
frits-metalogix added a commit to identity-com/solana that referenced this pull request Nov 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants