Skip to content

Commit

Permalink
update and merge protos
Browse files Browse the repository at this point in the history
  • Loading branch information
TalDerei committed Apr 19, 2024
2 parents 98e43d1 + 7e8ff55 commit 054037e
Show file tree
Hide file tree
Showing 51 changed files with 2,120 additions and 155 deletions.
40 changes: 39 additions & 1 deletion 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ tendermint-config = { version = "0.34.0" }
tendermint-light-client-verifier = { version = "0.34.0" }
tendermint-proto = { version = "0.34.0" }
tendermint-rpc = { version = "0.34.0" }
termion = { version = "3" }
thiserror = { version = "1.0" }
tokio = { version = "1.3" }
tokio-stream = { version = "0.1.8" }
Expand Down
1 change: 1 addition & 0 deletions crates/bin/pcli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ tokio-util = {workspace = true}
toml = {workspace = true, features = ["preserve_order"]}
tonic = {workspace = true, features = ["tls-webpki-roots", "tls"]}
tower = {workspace = true, features = ["full"]}
termion = {workspace = true}
tracing = {workspace = true}
tracing-subscriber = {workspace = true, features = ["env-filter", "ansi"]}
url = {workspace = true, features = ["serde"]}
Expand Down
4 changes: 3 additions & 1 deletion crates/bin/pcli/src/command/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,9 @@ impl TxCmd {
.await?;
app.build_and_submit_transaction(plan).await?;
}
TxCmd::Position(PositionCmd::RewardClaim {}) => todo!(),
TxCmd::Position(PositionCmd::RewardClaim {}) => {
unimplemented!("deprecated, remove this")
}
TxCmd::Position(PositionCmd::Replicate(replicate_cmd)) => {
replicate_cmd.exec(app).await?;
}
Expand Down
37 changes: 32 additions & 5 deletions crates/bin/pcli/src/terminal.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::io::{Read, Write};

use anyhow::Result;
use penumbra_custody::threshold::{SigningRequest, Terminal};
use tokio::io::{self, AsyncBufReadExt};
use tonic::async_trait;

/// For threshold custody, we need to implement this weird terminal abstraction.
Expand Down Expand Up @@ -40,11 +41,37 @@ impl Terminal for ActualTerminal {
}

async fn next_response(&self) -> Result<Option<String>> {
let stdin = io::stdin();
let mut stdin = io::BufReader::new(stdin);
// Use raw mode to allow reading more than 1KB/4KB of data at a time
// See https://unix.stackexchange.com/questions/204815/terminal-does-not-accept-pasted-or-typed-lines-of-more-than-1024-characters
use termion::raw::IntoRawMode;
tracing::debug!("about to enter raw mode for long pasted input");

// In raw mode, the input is not mirrored into the terminal, so we need
// to read char-by-char and echo it back.
let mut stdout = std::io::stdout().into_raw_mode()?;

let mut bytes = Vec::with_capacity(8192);
for b in std::io::stdin().bytes() {
let b = b?;
// In raw mode, the enter key might generate \r or \n, check either.
if b == b'\n' || b == b'\r' {
break;
}
bytes.push(b);
stdout.write(&[b]).unwrap();
// Flushing may not be the most efficient but performance isn't critical here.
stdout.flush()?;
}
// Drop _stdout to restore the terminal to normal mode
std::mem::drop(stdout);
// We consumed a newline of some kind but didn't echo it, now print
// one out so subsequent output is guaranteed to be on a new line.
println!("");

tracing::debug!("exited raw mode and returned to cooked mode");

let mut line = String::new();
stdin.read_line(&mut line).await?;
let line = String::from_utf8(bytes)?;
tracing::debug!(?line, "read response line");

if line.is_empty() {
return Ok(None);
Expand Down
7 changes: 7 additions & 0 deletions crates/bin/pcli/src/transaction_view_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,13 @@ impl TransactionViewExt for TransactionView {
penumbra_transaction::ActionView::Delegate(_) => ["Delegation", ""],
penumbra_transaction::ActionView::Undelegate(_) => ["Undelegation", ""],
penumbra_transaction::ActionView::UndelegateClaim(_) => ["Undelegation Claim", ""],
penumbra_transaction::ActionView::ActionDutchAuctionSchedule(_) => todo!(),
penumbra_transaction::ActionView::ActionDutchAuctionEnd(_) => {
todo!()
}
penumbra_transaction::ActionView::ActionDutchAuctionWithdraw(_) => {
todo!()
}
};

actions_table.add_row(row);
Expand Down
Binary file modified crates/cnidarium/src/gen/proto_descriptor.bin.no_lfs
Binary file not shown.
1 change: 1 addition & 0 deletions crates/core/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ metrics = { workspace = true }
once_cell = { workspace = true }
parking_lot = { workspace = true }
penumbra-asset = { workspace = true, default-features = true }
penumbra-auction = { workspace = true, default-features = true }
penumbra-community-pool = { workspace = true, default-features = true }
penumbra-compact-block = { workspace = true, default-features = true }
penumbra-dex = { workspace = true, default-features = true }
Expand Down
18 changes: 9 additions & 9 deletions crates/core/app/src/action_handler/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ impl AppActionHandler for Action {
Action::CommunityPoolSpend(action) => action.check_stateless(()).await,
Action::CommunityPoolOutput(action) => action.check_stateless(()).await,
Action::CommunityPoolDeposit(action) => action.check_stateless(()).await,
Action::ActionDutchAuctionSchedule(_) => todo!(),
Action::ActionDutchAuctionEnd(_) => todo!(),
Action::ActionDutchAuctionWithdraw(_) => todo!(),
Action::ActionDutchAuctionSchedule(action) => action.check_stateless(()).await,
Action::ActionDutchAuctionEnd(action) => action.check_stateless(()).await,
Action::ActionDutchAuctionWithdraw(action) => action.check_stateless(()).await,
}
}

Expand Down Expand Up @@ -95,9 +95,9 @@ impl AppActionHandler for Action {
Action::CommunityPoolSpend(action) => action.check_historical(state).await,
Action::CommunityPoolOutput(action) => action.check_historical(state).await,
Action::CommunityPoolDeposit(action) => action.check_historical(state).await,
Action::ActionDutchAuctionSchedule(_) => todo!(),
Action::ActionDutchAuctionEnd(_) => todo!(),
Action::ActionDutchAuctionWithdraw(_) => todo!(),
Action::ActionDutchAuctionSchedule(action) => action.check_historical(state).await,
Action::ActionDutchAuctionEnd(action) => action.check_historical(state).await,
Action::ActionDutchAuctionWithdraw(action) => action.check_historical(state).await,
}
}

Expand Down Expand Up @@ -130,9 +130,9 @@ impl AppActionHandler for Action {
Action::CommunityPoolSpend(action) => action.check_and_execute(state).await,
Action::CommunityPoolOutput(action) => action.check_and_execute(state).await,
Action::CommunityPoolDeposit(action) => action.check_and_execute(state).await,
Action::ActionDutchAuctionSchedule(_) => todo!(),
Action::ActionDutchAuctionEnd(_) => todo!(),
Action::ActionDutchAuctionWithdraw(_) => todo!(),
Action::ActionDutchAuctionSchedule(action) => action.check_and_execute(state).await,
Action::ActionDutchAuctionEnd(action) => action.check_and_execute(state).await,
Action::ActionDutchAuctionWithdraw(action) => action.check_and_execute(state).await,
}
}
}
8 changes: 4 additions & 4 deletions crates/core/app/src/action_handler/actions/submit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ impl AppActionHandler for ProposalSubmit {
| CommunityPoolSpend(_)
| CommunityPoolOutput(_)
| Ics20Withdrawal(_)
| CommunityPoolDeposit(_) => {}
ActionDutchAuctionSchedule(_) => todo!(),
ActionDutchAuctionEnd(_) => todo!(),
ActionDutchAuctionWithdraw(_) => todo!(),
| CommunityPoolDeposit(_)
| ActionDutchAuctionSchedule(_)
| ActionDutchAuctionEnd(_)
| ActionDutchAuctionWithdraw(_) => {}
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions crates/core/app/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ impl App {
begin_block,
)
.await;
Dex::begin_block(&mut arc_state_tx, begin_block).await;
CommunityPool::begin_block(&mut arc_state_tx, begin_block).await;
Governance::begin_block(&mut arc_state_tx, begin_block).await;
Staking::begin_block(&mut arc_state_tx, begin_block).await;
Expand Down Expand Up @@ -382,6 +383,7 @@ impl App {

tracing::debug!("running app components' `end_block` hooks");
let mut arc_state_tx = Arc::new(state_tx);
Sct::end_block(&mut arc_state_tx, end_block).await;
ShieldedPool::end_block(&mut arc_state_tx, end_block).await;
Distributions::end_block(&mut arc_state_tx, end_block).await;
Ibc::end_block(&mut arc_state_tx, end_block).await;
Expand Down Expand Up @@ -485,6 +487,9 @@ impl App {

let mut arc_state_tx = Arc::new(state_tx);

Sct::end_epoch(&mut arc_state_tx)
.await
.expect("able to call end_epoch on Sct component");
Distributions::end_epoch(&mut arc_state_tx)
.await
.expect("able to call end_epoch on Distributions component");
Expand Down
Loading

0 comments on commit 054037e

Please sign in to comment.