You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LoadedPrograms::extract() takes WorkingSlot as an argument. However, the information carried by WorkingSlot can be computed using ForkGraph, that's part of LoadedPrograms struct. The WorkingSlot can be removed, as it makes cooperative program loading (#33715) harder/impossible to implement.
The following are the reasons for passing WorkingSlot as a parameter to LoadedPrograms::extract().
In a validator node, the first bank creates and initializes an instance of LoadedPrograms.
ForkGraph trait is implemented by BankForks. When the first bank is inserted in BankForks, the ForkGraph gets assigned to the LoadedPrograms object in the bank.
Any bank created from the first bank clone the Arc of LoadedPrograms. So every bank is using the same instance of LoadedPrograms, where the ForkGraph has already been initialized.
There are tests that create bank, but the tests do not use/need BankForks. So the bank instance is never inserted in the BankForks. That means, ForkGraph is never set in the LoadedProgram instance in bank.
Proposed Solution
Add a new (or update current) Bank::new_for_tests(), which internally creates a BankForks, inserts the new bank in it, and returns Arc<Bank> to the caller.
Update tests to use this new/updated method.
Or, find a better solution to this issue.
The text was updated successfully, but these errors were encountered:
Problem
LoadedPrograms::extract()
takesWorkingSlot
as an argument. However, the information carried byWorkingSlot
can be computed usingForkGraph
, that's part ofLoadedPrograms
struct. TheWorkingSlot
can be removed, as it makes cooperative program loading (#33715) harder/impossible to implement.The following are the reasons for passing
WorkingSlot
as a parameter toLoadedPrograms::extract()
.LoadedPrograms
.ForkGraph
trait is implemented byBankForks
. When the first bank is inserted inBankForks
, theForkGraph
gets assigned to theLoadedPrograms
object in the bank.Arc
ofLoadedPrograms
. So every bank is using the same instance ofLoadedPrograms
, where theForkGraph
has already been initialized.BankForks
. So the bank instance is never inserted in theBankForks
. That means,ForkGraph
is never set in theLoadedProgram
instance in bank.Proposed Solution
Bank::new_for_tests()
, which internally creates aBankForks
, inserts the new bank in it, and returnsArc<Bank>
to the caller.Or, find a better solution to this issue.
The text was updated successfully, but these errors were encountered: