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

Refactor - Merges BuiltinPrograms into LoadedPrograms #31654

Conversation

Lichtso
Copy link
Contributor

@Lichtso Lichtso commented May 15, 2023

Problem

Continuation of #31565.
Built-in programs should take the same paths through the program-runtime as user supplied programs do. This is an important step for their ongoing unification in program-runtime-v2.

Summary of Changes

  • Replaces the functions genesis_builtins() and builtin_feature_transitions() with a static slice BUILTINS
  • Replaces BuiltinFeatureTransition with BuiltinPrototype which has an optional Pubkey for the activation feature, the value None signals a built-in to be present at genesis
  • Removes builtins::create_builtin(), use loaded_programs::LoadedProgram::new_builtin() instead
  • Removes BuiltinPrograms, Bank::builtin_programs and InvokeContext::builtin_programs
  • Removes with_mock_invoke_context_and_builtin_programs!()
  • Fetches built-ins from InvokeContext::programs_loaded_for_tx_batch instead of InvokeContext::builtin_programs
  • Switches from linear search to constant time hash map lookup for dispatching built-in programs
  • Sets LoadedProgram::account_size to name.len() for built-ins
  • Sets effective_slot and deployment_slot to the slot in which their feature was activated

@Lichtso Lichtso marked this pull request as draft May 15, 2023 17:56
@Lichtso Lichtso force-pushed the refactor/merge_builtins_into_loaded_programs branch 13 times, most recently from 116b769 to 7514743 Compare May 18, 2023 15:53
@Lichtso Lichtso force-pushed the refactor/merge_builtins_into_loaded_programs branch from 7514743 to cf57e0a Compare May 18, 2023 16:23
@Lichtso Lichtso marked this pull request as ready for review May 18, 2023 16:56
@Lichtso Lichtso requested a review from pgarg66 May 18, 2023 17:04
@codecov
Copy link

codecov bot commented May 18, 2023

Codecov Report

Merging #31654 (cf57e0a) into master (3ac5bb2) will decrease coverage by 0.1%.
The diff coverage is 84.8%.

@@            Coverage Diff            @@
##           master   #31654     +/-   ##
=========================================
- Coverage    81.9%    81.9%   -0.1%     
=========================================
  Files         737      736      -1     
  Lines      205981   205913     -68     
=========================================
- Hits       168738   168664     -74     
- Misses      37243    37249      +6     

@Lichtso Lichtso merged commit 520c647 into solana-labs:master May 18, 2023
@Lichtso Lichtso deleted the refactor/merge_builtins_into_loaded_programs branch May 18, 2023 20:18
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.

2 participants