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

Replaces MockInvokeContext by ThisInvokeContext in tests #20881

Merged
merged 9 commits into from
Nov 4, 2021
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ solana-client = { path = "../client", version = "=1.9.0" }
solana-config-program = { path = "../programs/config", version = "=1.9.0" }
solana-faucet = { path = "../faucet", version = "=1.9.0" }
solana-logger = { path = "../logger", version = "=1.9.0" }
solana-program-runtime = { path = "../program-runtime", version = "=1.9.0" }
solana_rbpf = "=0.2.14"
solana-remote-wallet = { path = "../remote-wallet", version = "=1.9.0" }
solana-sdk = { path = "../sdk", version = "=1.9.0" }
Expand Down
4 changes: 2 additions & 2 deletions cli/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use solana_client::{
rpc_filter::{Memcmp, MemcmpEncodedBytes, RpcFilterType},
tpu_client::{TpuClient, TpuClientConfig},
};
use solana_program_runtime::invoke_context::ThisInvokeContext;
use solana_rbpf::{
verifier,
vm::{Config, Executable},
Expand All @@ -40,7 +41,6 @@ use solana_sdk::{
message::Message,
native_token::Sol,
packet::PACKET_DATA_SIZE,
process_instruction::MockInvokeContext,
pubkey::Pubkey,
signature::{keypair_from_seed, read_keypair_file, Keypair, Signature, Signer},
system_instruction::{self, SystemError},
Expand Down Expand Up @@ -1994,7 +1994,7 @@ fn read_and_verify_elf(program_location: &str) -> Result<Vec<u8>, Box<dyn std::e
let mut program_data = Vec::new();
file.read_to_end(&mut program_data)
.map_err(|err| format!("Unable to read program file: {}", err))?;
let mut invoke_context = MockInvokeContext::new(&Pubkey::default(), vec![]);
let mut invoke_context = ThisInvokeContext::new_mock(&[], &[]);

// Verify the program
<dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
Expand Down
2 changes: 1 addition & 1 deletion core/src/cost_update_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl CostUpdateService {
#[cfg(test)]
mod tests {
use super::*;
use solana_program_runtime::ProgramTiming;
use solana_program_runtime::instruction_processor::ProgramTiming;
use solana_sdk::pubkey::Pubkey;

#[test]
Expand Down
1 change: 1 addition & 0 deletions program-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ documentation = "https://docs.rs/solana-program-runtime"
edition = "2018"

[dependencies]
bincode = "1.3.3"
libc = "0.2.101"
libloading = "0.7.0"
log = "0.4.14"
Expand Down
2 changes: 1 addition & 1 deletion program-runtime/benches/instruction_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extern crate test;

use log::*;
use solana_program_runtime::{ExecuteDetailsTimings, PreAccount};
use solana_program_runtime::instruction_processor::{ExecuteDetailsTimings, PreAccount};
use solana_sdk::{account::AccountSharedData, pubkey, rent::Rent};
use test::Bencher;

Expand Down
Loading