Conversation
| if config.verbose() { | ||
| if simulation_data.value.err.is_none() && !config.verbose() { | ||
| println_display(config, "Simulation succeeded".to_string()); | ||
| } else { | ||
| let status_str = if simulation_data.value.err.is_some() { | ||
| "FAILED" | ||
| } else { | ||
| "succeeded" | ||
| }; |
There was a problem hiding this comment.
found this by accident when testing my fancy new display warnings. as it turns out, simulate_transaction() does not return Err when the simulation errors. so we were saying every --dry-run succeeded no matter what actually happened. oops!
| // XXX this file will be deleted and replaced with a stake program client once i | ||
| // write one |
There was a problem hiding this comment.
i originally wrote svsp before i was doing core protocol work so writing a bunch of stake middleware seemed like not a terrible use of time, but im never going to do this
| // and program client | ||
| let program_client = Arc::new(ProgramRpcClient::new( | ||
| rpc_client.clone(), | ||
| ProgramRpcClientSendTransaction, | ||
| )); |
There was a problem hiding this comment.
the backstory here is ProgramClient is a quirky rpc wrapper inside a quirky token client. we were originally using ProgramClient directly because it provides a cute generic send_transaction() that can either send or simulate, and we used the token wrapper since we already had to pull in spl_token_client so why not. we stopped using the simulate stuff so we could print simulation logs ourselves, and we dont use token22, so all this has been useless bloat ever since
| // we know the pool exists so the vote account must exist | ||
| unreachable!(); | ||
| return Err(format!("Vote account {} does not exist", vote_account_address).into()); |
There was a problem hiding this comment.
not actually unreachable lol
| writeln_name_value( | ||
| w, | ||
| " Undelegated lamports:", | ||
| &self.undelegated_lamports.to_string(), | ||
| )?; | ||
| writeln_name_value( | ||
| w, | ||
| " Notional token supply:", | ||
| &self.token_supply.to_string(), | ||
| )?; |
There was a problem hiding this comment.
in my original issue description i was imagining printing total value, pool stake, onramp stake, pool extra lamports, blah blah blah. but theres no need. what a user really cares about is a) how much is this pool worth, b) do i have to replenish
0b876bf to
2c41b37
Compare
2c41b37 to
642024b
Compare
| @@ -86,25 +122,45 @@ pub async fn get_available_balances( | |||
| ); | |||
There was a problem hiding this comment.
Could this throw in the case of a funded-but-not-initialized onramp account? Perhaps we should display something in that case and not err? Or maybe that's an edge case anyway.
| } else { | ||
| Ok(None) | ||
| } |
There was a problem hiding this comment.
See this in a few places, but I worry about potentially swallowing network issues/rate limits/timeouts/etc and treating it as a kind of "account does not exist" case. Think we avoid that case if we do:
let account = config
.rpc_client
.get_account_with_commitment(token_account_address, config.rpc_client.commitment())
.await?
.value;
let Some(account) = account else {
return Ok(None);
};There was a problem hiding this comment.
4e03279 maybe i lost the plot but i cant remember why we would ever want to treat a zero-len nonzero-lamport account as existing in any of these cases at all
| "{} Onramp does not exist; use `spl-single-pool manage create-on-ramp` to create it", | ||
| style("/!\\").bold(), | ||
| )?; | ||
| } else if self.undelegated_lamports > self.minimum_delegation { |
There was a problem hiding this comment.
Should this be >=?
single-pool/program/src/processor.rs
Lines 943 to 945 in 642024b
* display locked stake and phantom tokens in line with solana-program#582 * display total pool asset value and total excess lamports in line with solana-program#601 * show total network value for `DisplayAll` in sol rather than lamports * display warnings for a dedelegated pool, nonexistent onramp, and potentially valuable replenish * fix a bug where all `--dry-run` commands claimed to succeed * remove `spl_token_client` including `ProgramClient` * replace all uses of `spl_token`, `vote_program`, and `stake_program` with interface crates
f27da9e to
99b4e0e
Compare
71f388c to
c822c55
Compare
DisplayAllin sol rather than lamports--dry-runcommands claimed to succeedspl_token_clientincludingProgramClientspl_token,vote_program, andstake_programwith interface cratesmost of the meaningful work is in
command_display(),get_stake_summaries(), andoutput.rschanging howDisplayandDisplayAllwork. the rest of the diff is just consequences of changingprogram_clienttorpc_client. no functionality (except the simulate bug lol) for any other command changes except a couple errors are slightly more correctnormal example:
verbose example:
closes #118
closes #543