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

Refactor: Remove KeyedAccount from program runtime #22226

Conversation

Lichtso
Copy link
Contributor

@Lichtso Lichtso commented Jan 3, 2022

Problem

Follow up of #21706 and #22165.
Continues the transition away from KeyedAccounts for ABIv2.

Summary of Changes

  • Replaces KeyedAccount in the program runtime by BorrowedAccount.
  • Pushes and pops InstructionContext in parallel to InvokeStackFrame in InvokeContext.

This PR does not change the tests or the native programs yet.

Fixes #

@Lichtso Lichtso force-pushed the refactor/remove_keyed_account_from_program_runtime branch from ee6876c to 1815b45 Compare January 3, 2022 00:58
@Lichtso Lichtso force-pushed the refactor/remove_keyed_account_from_program_runtime branch from 1815b45 to 9b2c04c Compare January 3, 2022 09:02
@Lichtso Lichtso force-pushed the refactor/remove_keyed_account_from_program_runtime branch from 9b2c04c to 05cf106 Compare January 3, 2022 09:20
@Lichtso Lichtso force-pushed the refactor/remove_keyed_account_from_program_runtime branch from 05cf106 to 7222fbe Compare January 3, 2022 14:50
@codecov
Copy link

codecov bot commented Jan 3, 2022

Codecov Report

Merging #22226 (ef88da9) into master (ce6c76e) will increase coverage by 0.0%.
The diff coverage is 84.2%.

@@           Coverage Diff            @@
##           master   #22226    +/-   ##
========================================
  Coverage    81.0%    81.1%            
========================================
  Files         523      523            
  Lines      146497   146525    +28     
========================================
+ Hits       118760   118883   +123     
+ Misses      27737    27642    -95     

@Lichtso Lichtso force-pushed the refactor/remove_keyed_account_from_program_runtime branch from 7222fbe to ef88da9 Compare January 3, 2022 17:47
self.invoke_stack.push(StackFrame::new(
program_indices.len(),
create_keyed_accounts_unified(keyed_accounts.as_slice()),
create_keyed_accounts_unified(unsafe {
std::mem::transmute(keyed_accounts.as_slice())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello unsafe, my old friend. I have come to use you again ...

@Lichtso Lichtso merged commit 73e6038 into solana-labs:master Jan 3, 2022
@Lichtso Lichtso deleted the refactor/remove_keyed_account_from_program_runtime branch January 3, 2022 22:31
@Lichtso
Copy link
Contributor Author

Lichtso commented Jan 7, 2022

It looks like #22165 introduced a consensus failure (privilege escalation), which caused the bank hash at block 114819336 to become FFA4a5tEJDqF1hUinThWadAtAaiAomfq7vtr7cQZL69o.
This PR fixed that and produces the correct blockhash 494ityVXMBdoS9ifoZispFFFYZsZZuQ33yWyazM4AA7t again.

@Lichtso Lichtso mentioned this pull request Jan 9, 2022
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.

1 participant