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

[DRAFT]: Core BPF Migrate Live #22

Closed
wants to merge 9 commits into from

Conversation

buffalojoec
Copy link
Owner

@buffalojoec buffalojoec commented Mar 28, 2024

This is chunk 7/7 of the broken up PR 79.

Problem

Now that the full migration path is in place, it's time to wire it up to the
runtime's feature activation process.

The bank requires two main pieces of functionality:

  • Migrate a builtin program to BPF on feature transition.
  • Abstain from adding a builtin to a new Bank after it has been migrated.

Summary of Changes

Add logic to evaluate a BuiltinPrototype for a contained
Some(CoreBpfMigrationConfig) and use that configuration to call into
migrate_builtin_to_core_bpf from apply_builtin_program_feature_transitions
to migrate the program to Core BPF.

Add a check to finish_init to ensure a builtin is not added to the list if it
was migrated to Core BPF.

Add some test coverage!

@buffalojoec buffalojoec force-pushed the core-bpf-migrate-live branch 2 times, most recently from b91e528 to cc9d599 Compare April 1, 2024 04:04
@buffalojoec buffalojoec force-pushed the core-bpf-migrate-setup branch from a3684d6 to 9161cac Compare April 1, 2024 21:43
@buffalojoec buffalojoec force-pushed the core-bpf-migrate-live branch 2 times, most recently from d5b2b76 to 4d674d5 Compare April 2, 2024 12:24
Comment on lines 6106 to 6115
// The built-in should be added if it has no enable feature ID
// and the feature to migrate it to Core BPF is not active.
let should_add_builtin = builtin.enable_feature_id.is_none() && {
if let Some(core_bpf_migration) = &builtin.core_bpf_migration_config {
!self.feature_set.is_active(&core_bpf_migration.feature_id)
} else {
true
}
};
if should_add_builtin {
Copy link
Owner Author

Choose a reason for hiding this comment

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

We have to figure out how to handle the case where the feature may have been activated, but the migration failed and the program wasn't migrated to BPF.

If this check is left as-is, we're toast!

@buffalojoec buffalojoec force-pushed the core-bpf-migrate-setup branch from 08b75cb to 5019f95 Compare April 4, 2024 19:52
lijunwangs and others added 6 commits April 4, 2024 13:19
* transaction performance tracking -- streamer stage
…abs#525)

* runtime: builtins: add `core_bpf_migration_config` to prototypes

* runtime: builtins: set up test builtins

* macro-ize builtin testing
* ElGamal: add From impls; deprecate from/to_bytes

* variable names
)

* Introduce SchedulingStateMachine

* Apply all typo fixes from code review

Co-authored-by: Andrew Fitzgerald <[email protected]>

* Update word wrapping

* Clarify Token::assume_exclusive_mutating_thread()

* Use slice instead of &Vec<_>

* Improve non-const explanation

* Document consecutive readonly rescheduling opt.

* Make test_gradual_locking terminate for miri

* Avoid unnecessary Task::clone()

* Rename: lock_{status,result} and no attempt_...()

* Add safety comment for get_account_locks_unchecked

* Reduce and comment about Page::blocked_tasks cap.

* Document SchedulingStateMachine::schedule_task()

* Add justification of closure in create_task

* Use the From trait for PageUsage

* Replace unneeded if-let with .expect()

* Add helpful comments for peculiar crossbeam usage

* Fix typo

* Make bug-bounty-exempt statement more clear

* Add test_enfoced_get_account_locks_verification

* Fix typos...

* Big rename: Page => UsageQueue

* Document UsageQueueLoader

* Various minor cleanings for beautifier diff

* Ensure reinitialize() is maintained for new fields

* Remove uneeded impl Send for TokenCell & doc upd.

* Apply typo fixes from code review

Co-authored-by: Andrew Fitzgerald <[email protected]>

* Merge similar tests into one

* Remove test_debug

* Remove assertions of task_index()

* Fix UB in TokenCell

* Make schedule_task doc comment simpler

* Document deschedule_task

* Simplify unlock_usage_queue() args

* Add comment for try_unblock() -> None

* Switch to Option<Usage> for fewer assert!s

* Add assert_matches!() to UsageQueue methods

* Add panicking test case for ::reinitialize()

* Use UsageFromTask

* Rename: LockAttempt => LockContext

* Move locking and unlocking methods to usage queue

* Remove outdated comment...

* Remove redundant fn: pop_unblocked_usage_from_task

* Document the index of task

* Clarifty comment a bit

* Update .current_usage inside try_lock()

* Use inspect_err to simplify code

* fix ci...

* Use ()...

* Rename: schedule{,_next}_unblocked_task()

* Rename: {try_lock,unlock}_{for_task,usage_queues}

* Test solana-unified-scheduler-logic under miri

* Test UB to illustrate limitation of TokenCell

* Test UB of using multiple tokens at the same time

---------

Co-authored-by: Andrew Fitzgerald <[email protected]>
@buffalojoec buffalojoec force-pushed the core-bpf-migrate-live branch from 4d674d5 to f905e58 Compare April 5, 2024 02:25
@buffalojoec buffalojoec force-pushed the core-bpf-migrate-live branch from f905e58 to 57ebee2 Compare April 5, 2024 02:25
@buffalojoec buffalojoec closed this Apr 5, 2024
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.

5 participants