This commit is contained in:
Michael Vines
2021-04-18 10:27:36 -07:00
parent 3b79b21e9d
commit a911ae00ba
39 changed files with 113 additions and 144 deletions

View File

@@ -76,7 +76,7 @@ pub fn create_and_cache_executor(
use_jit: bool,
) -> Result<Arc<BpfExecutor>, InstructionError> {
let bpf_compute_budget = invoke_context.get_bpf_compute_budget();
let mut program = Executable::<BpfError, ThisInstructionMeter>::from_elf(
let mut program = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
data,
None,
Config {
@@ -923,7 +923,7 @@ mod tests {
];
let input = &mut [0x00];
let program = Executable::<BpfError, TestInstructionMeter>::from_text_bytes(
let program = <dyn Executable<BpfError, TestInstructionMeter>>::from_text_bytes(
program,
None,
Config::default(),

View File

@@ -567,9 +567,9 @@ mod tests {
offset += size_of::<u64>();
accounts.push(AccountInfo {
key,
is_signer,
is_writable,
key,
lamports,
data,
owner,

View File

@@ -86,10 +86,7 @@ pub fn process_instruction(
}
// If Config account is already initialized, update signatures must match Config data
if !current_data.keys.is_empty()
&& current_signer_keys
.iter()
.find(|&pubkey| pubkey == signer)
.is_none()
&& !current_signer_keys.iter().any(|pubkey| pubkey == signer)
{
ic_msg!(
invoke_context,

View File

@@ -2536,13 +2536,12 @@ mod tests {
},
);
let effective_rate_limited = (effective as f64 * stake.warmup_cooldown_rate) as u64;
if epoch < stake.deactivation_epoch {
let increase = (effective as f64 * stake.warmup_cooldown_rate) as u64;
effective += increase.min(activating);
effective += effective_rate_limited.min(activating);
other_activations.push(0);
} else {
let decrease = (effective as f64 * stake.warmup_cooldown_rate) as u64;
effective -= decrease.min(deactivating);
effective -= effective_rate_limited.min(deactivating);
effective += other_activation;
other_activations.push(other_activation);
}