Skip to content

Commit

Permalink
fix: add FeeTier support to galileo tx sending
Browse files Browse the repository at this point in the history
During Testnet 77 we enabled fees [0] and in the process broke some
things like Galileo. Adding FeeTier support is rather straightforward,
although this changeset requires a patch to the `penumbra-fee` crate in
order to compile [1].

[0] penumbra-zone/penumbra#4306
[1] penumbra-zone/penumbra#4539
  • Loading branch information
conorsch authored and cratelyn committed Jun 4, 2024
1 parent c398e89 commit b488131
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ parallel = ["penumbra-wallet/parallel"]
# Penumbra dependencies
penumbra-proto = { path = "../penumbra/crates/proto", features = ["rpc", "box-grpc"] }
penumbra-asset = { path = "../penumbra/crates/core/asset" }
penumbra-fee = { path = "../penumbra/crates/core/component/fee" }
penumbra-keys = { path = "../penumbra/crates/core/keys" }
penumbra-custody = { path = "../penumbra/crates/custody" }
penumbra-wallet = { path = "../penumbra/crates/wallet" }
Expand Down
3 changes: 0 additions & 3 deletions src/opt/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ use crate::{

#[derive(Debug, Clone, Parser)]
pub struct Serve {
/// The transaction fee for each response (paid in upenumbra).
#[structopt(long, default_value = "0")]
fee: u64,
/// Per-user rate limit (e.g. "10m" or "1day").
#[clap(short, long, default_value = "1day", parse(try_from_str = humantime::parse_duration))]
rate_limit: Duration,
Expand Down
14 changes: 14 additions & 0 deletions src/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use penumbra_proto::view::v1::broadcast_transaction_response::Status as Broadcas

use penumbra_asset::Value;
use penumbra_custody::{AuthorizeRequest, CustodyClient};
use penumbra_fee::FeeTier;
use penumbra_fee::GasPrices;
use penumbra_keys::{Address, FullViewingKey};
use penumbra_txhash::TransactionId;
use penumbra_view::ViewClient;
Expand Down Expand Up @@ -70,7 +72,19 @@ where
"tried to send empty list of values to address"
));
}

let mut planner = Planner::new(OsRng);

// Here we hardcode low fees. It'd be nice to override via CLI arg.
// Look up GasPrices, because merely calling `set_fee_tier` is not sufficient.
let gp: GasPrices = self2
.view
.gas_prices()
.await
.expect("failed to look up GasPrices");
planner.set_gas_prices(gp);
planner.set_fee_tier(FeeTier::Low);

for value in values {
planner.output(value, address.clone());
}
Expand Down

0 comments on commit b488131

Please sign in to comment.