Drop write lock on sysvars (#15497)
* Drop write lock on sysvars * adds env var for demoting sysvar write lock demotion * moves demote logic to is_writable * feature gates sysvar write lock demotion * adds builtins to write lock demotion * adds system program id to builtins * adds Feature111... * adds an abi-freeze test * mvines set of builtin program keys Co-authored-by: Michael Vines <mvines@gmail.com> * update tests * adds bpf loader keys * Add test sysvar * Plumb demote_sysvar to is_writable * more plumbing of demote_sysvar_write_locks to is_writable * patches test_program_bpf_instruction_introspection * hard codes demote_sysvar_write_locks to false for serialization/encoding methods * Revert "hard codes demote_sysvar_write_locks to false for serialization/encoding methods" This reverts commit ae3e2d2e777437bddd753933097a210dcbc1b1fc. * change the hardcoded ones to demote_sysvar_write_locks=true * Use data_as_mut_slice Co-authored-by: behzad nouri <behzadnouri@gmail.com> Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
@ -30,6 +30,7 @@ use {
|
||||
solana_sdk::{
|
||||
account::{Account, AccountSharedData, ReadableAccount},
|
||||
clock::Slot,
|
||||
feature_set::demote_sysvar_write_locks,
|
||||
genesis_config::{ClusterType, GenesisConfig},
|
||||
keyed_account::KeyedAccount,
|
||||
process_instruction::{
|
||||
@ -244,12 +245,14 @@ impl program_stubs::SyscallStubs for SyscallStubs {
|
||||
}
|
||||
panic!("Program id {} wasn't found in account_infos", program_id);
|
||||
};
|
||||
let demote_sysvar_write_locks =
|
||||
invoke_context.is_feature_active(&demote_sysvar_write_locks::id());
|
||||
// TODO don't have the caller's keyed_accounts so can't validate writer or signer escalation or deescalation yet
|
||||
let caller_privileges = message
|
||||
.account_keys
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, _)| message.is_writable(i))
|
||||
.map(|(i, _)| message.is_writable(i, demote_sysvar_write_locks))
|
||||
.collect::<Vec<bool>>();
|
||||
|
||||
stable_log::program_invoke(&logger, &program_id, invoke_context.invoke_depth());
|
||||
|
Reference in New Issue
Block a user