Cleanup bench-exchange (#3919)

* bench-exchange changes

Generate new keypair for each bench-exchange
Add metrics
Tweak network sleep parameters for better reliability.

* Bench-exchange contract metrics
This commit is contained in:
sakridge
2019-04-22 13:16:28 -07:00
committed by GitHub
parent bec094bb3e
commit 95a16426f3
8 changed files with 60 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ use crate::exchange_instruction::*;
use crate::exchange_state::*;
use crate::id;
use log::*;
use solana_metrics::counter::Counter;
use solana_sdk::account::KeyedAccount;
use solana_sdk::instruction::InstructionError;
use solana_sdk::pubkey::Pubkey;
@@ -256,6 +257,8 @@ impl ExchangeProcessor {
// Trade holds the tokens in escrow
account.tokens[from_token] -= info.tokens;
inc_new_counter_info!("exchange_processor-trades", 1);
Self::serialize(
&ExchangeState::Trade(TradeOrderInfo {
owner: *keyed_accounts[OWNER_INDEX].unsigned_key(),
@@ -386,6 +389,8 @@ impl ExchangeProcessor {
Err(e)?
}
inc_new_counter_info!("exchange_processor-swap", 1);
Self::serialize(
&ExchangeState::Swap(swap),
&mut keyed_accounts[SWAP_ACCOUNT_INDEX].account.data,

View File

@@ -2,6 +2,9 @@ pub mod exchange_instruction;
pub mod exchange_processor;
pub mod exchange_state;
#[macro_use]
extern crate solana_metrics;
use solana_sdk::pubkey::Pubkey;
pub const EXCHANGE_PROGRAM_ID: [u8; 32] = [