Skip to content

Commit

Permalink
penumbra: remove penumbra-chain (#3703)
Browse files Browse the repository at this point in the history
* sct: add `SctParameters` to track epoch/time config

* governance(proto): move `Ratio` to gov component

* governance(tally): local `Ratio` computation

* sct(component): expose `params` module

* sct(params): add docstrings to `SctParameters`

* chain: remove `ChainParameters`!

* sct(proto): add sct param message definition

* sct(proto): define `Epoch`

* app: prelude to including `SctParameters`

* chain: remove genesis module

* sct(epoch): define epoch structure in sct component

* sct: define sct query service api

* proto: remove chain all chain component messages

* sct(proto): add genesis message

* app(proto): add sct genesis content to messages

* governance(proto): remove dep on obsolete chain protos

* app(proto): fix missing type

* proto-compiler: remove `chain` from targets

* penumbra: generate interfaces without the chain messages

* sct: add genesis module

* app(proto): add chain id to app param message

* chain: remove `params`, `genesis

* penumbra: generate protos with chain id in app params

* sct: implement simple query service for epochs

* chain: remove rpc module

* chain: remove epoch module

* sct(state_key): define `block_manager` and `epoch_manager` namespaces

* chain: remove state keys and R/W ext traits

* penumbra: remove the chain component

* penumbra: remove chain component from workspace

* app: add `chain_id` methods

* app(state_key): namespace state keys by domain

* app: move cometbft prefix to `lib`

* sct: handle epoch and block timestamp management

* penumbra: remove all dep imports of `penumbra-chain`

* penumbra: untangle dependency build up on `penumbra-chain`

* penumbra: second pass at fixing build errors (wip)

* penumbra: third pass at fixing various build errors (wip)

* shielded-pool: scaffolding for shielded pool parameters

* shielded-pool(proto): define `ShieldedPoolParameters` message

* governance(proto): update changed app params

* penumbra: propagate api changes

* buf: lint protos

* penumbra: regenerate protos with shielded pool params

* app(proto): add shielded pool params to app params

* penumbra: third pass on the changed app params workflow

* penumbra: regenerate protos

* penumbra: progress through removing usage of `ChainParameters`

* penumbra: update the wasm planner and view services

* penumbra: run `fmt`

* ci: remove p-chain from rustdocs

* app(host_chain): reimplement the host chain interface

* app(host_chain): comment impl

* view: simplify the plan method

* transaction(gas): make compact block cost zero for proposals

* penumbra: remove obsolete comments

* penumbra: run `fmt`

* transaction(gas): remove unused imports

* app: fix `get_chain_id`

* shielded-pool: finalize genesis content struct

* shielded-pool(proto): add params to protos

* penumbra: refresh protos to account for changes

* governance: fix halt count logic

* app: init sct params

* view: go back to having a kv table

The original schema had a kv table, it's much simpler to do it this way than to
manifest our data structures again in the form of a SQL schema.

* view: remove unused deps

* view(storage): fix unused imports p2

---------

Co-authored-by: Henry de Valence <[email protected]>
  • Loading branch information
erwanor and hdevalence authored Jan 31, 2024
1 parent 2221fb7 commit d991530
Show file tree
Hide file tree
Showing 125 changed files with 4,575 additions and 4,880 deletions.
45 changes: 2 additions & 43 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ members = [
"crates/core/keys",
"crates/core/asset",
"crates/core/txhash",
"crates/core/component/chain",
"crates/core/component/shielded-pool",
"crates/core/component/governance",
"crates/core/component/ibc",
Expand Down
2 changes: 1 addition & 1 deletion crates/bin/pcli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ penumbra-tct = { path = "../../crypto/tct" }
penumbra-num = { path = "../../core/num", default-features = false }
penumbra-asset = { path = "../../core/asset", default-features = false }
penumbra-keys = { path = "../../core/keys", default-features = false }
penumbra-chain = { path = "../../core/component/chain", default-features = false }
#penumbra-chain = { path = "../../core/component/chain", default-features = false }
penumbra-shielded-pool = { path = "../../core/component/shielded-pool", default-features = false }
penumbra-governance = { path = "../../core/component/governance", default-features = false }
penumbra-stake = { path = "../../core/component/stake", default-features = false }
Expand Down
15 changes: 6 additions & 9 deletions crates/bin/pcli/src/command/query/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use penumbra_proto::{
core::app::v1alpha1::{
query_service_client::QueryServiceClient as AppQueryServiceClient, AppParametersRequest,
},
core::component::chain::v1alpha1::{
query_service_client::QueryServiceClient as ChainQueryServiceClient, EpochByHeightRequest,
core::component::sct::v1alpha1::{
query_service_client::QueryServiceClient as SctQueryServiceClient, EpochByHeightRequest,
},
core::component::stake::v1alpha1::{
query_service_client::QueryServiceClient as StakeQueryServiceClient, ValidatorInfoRequest,
Expand Down Expand Up @@ -63,10 +63,10 @@ impl ChainCmd {
table.load_preset(presets::NOTHING);
table
.set_header(vec!["", ""])
.add_row(vec!["Chain ID", &params.chain_params.chain_id])
.add_row(vec!["Chain ID", &params.chain_id])
.add_row(vec![
"Epoch Duration",
&format!("{}", params.chain_params.epoch_duration),
&format!("{}", params.sct_params.epoch_duration),
])
.add_row(vec![
"Unbonding Epochs",
Expand Down Expand Up @@ -130,7 +130,7 @@ impl ChainCmd {
.ok_or_else(|| anyhow!("missing sync_info"))?
.latest_block_height;

let mut client = ChainQueryServiceClient::new(channel.clone());
let mut client = SctQueryServiceClient::new(channel.clone());
let current_epoch: u64 = client
.epoch_by_height(tonic::Request::new(EpochByHeightRequest {
height: current_block_height.clone(),
Expand All @@ -156,10 +156,7 @@ impl ChainCmd {
let validators = client
.validator_info(ValidatorInfoRequest {
show_inactive: true,
chain_id: app_params
.chain_params
.ok_or_else(|| anyhow::anyhow!("missing chain_params in app params"))?
.chain_id,
chain_id: app_params.chain_id,
})
.await?
.into_inner()
Expand Down
2 changes: 1 addition & 1 deletion crates/bin/pcli/src/command/query/community_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl CommunityPoolCmd {
});

let mut client = CommunityPoolQueryServiceClient::new(app.pd_channel().await?);
let chain_id = app.view().app_params().await?.chain_params.chain_id;
let chain_id = app.view().app_params().await?.chain_id;
let balances = client
.community_pool_asset_balances(CommunityPoolAssetBalancesRequest {
chain_id,
Expand Down
4 changes: 2 additions & 2 deletions crates/bin/pcli/src/command/query/dex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ impl DexCmd {
) -> Result<()> {
let mut client = ShieldedPoolQueryServiceClient::new(app.pd_channel().await?);

let chain_id = app.view().app_params().await?.chain_params.chain_id;
let chain_id = app.view().app_params().await?.chain_id;

let outputs = self
.get_batch_outputs(app, chain_id.clone(), height, trading_pair)
Expand Down Expand Up @@ -408,7 +408,7 @@ impl DexCmd {
}
DexCmd::AllPositions { include_closed } => {
let client = DexQueryServiceClient::new(app.pd_channel().await?);
let chain_id = app.view().app_params().await?.chain_params.chain_id;
let chain_id = app.view().app_params().await?.chain_id;

let positions_stream = self
.get_all_liquidity_positions(client.clone(), *include_closed, Some(chain_id))
Expand Down
25 changes: 12 additions & 13 deletions crates/bin/pcli/src/command/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ use penumbra_keys::keys::AddressIndex;
use penumbra_num::Amount;
use penumbra_proto::{
core::component::{
chain::v1alpha1::{
query_service_client::QueryServiceClient as ChainQueryServiceClient,
EpochByHeightRequest,
},
dex::v1alpha1::{
query_service_client::QueryServiceClient as DexQueryServiceClient,
LiquidityPositionByIdRequest, PositionId,
Expand All @@ -47,6 +43,9 @@ use penumbra_proto::{
NextProposalIdRequest, ProposalDataRequest, ProposalInfoRequest, ProposalInfoResponse,
ProposalRateDataRequest,
},
sct::v1alpha1::{
query_service_client::QueryServiceClient as SctQueryServiceClient, EpochByHeightRequest,
},
stake::v1alpha1::{
query_service_client::QueryServiceClient as StakeQueryServiceClient,
ValidatorPenaltyRequest,
Expand Down Expand Up @@ -518,7 +517,7 @@ impl TxCmd {
swap_plaintext,
position: swap_record.position,
output_data: swap_record.output_data,
epoch_duration: params.chain_params.epoch_duration,
epoch_duration: params.sct_params.epoch_duration,
proof_blinding_r: Fq::rand(&mut OsRng),
proof_blinding_s: Fq::rand(&mut OsRng),
})
Expand Down Expand Up @@ -622,7 +621,7 @@ impl TxCmd {
.context("view service must be initialized")?;

let current_height = view.status().await?.full_sync_height;
let mut client = ChainQueryServiceClient::new(channel.clone());
let mut client = SctQueryServiceClient::new(channel.clone());
let current_epoch = client
.epoch_by_height(EpochByHeightRequest {
height: current_height,
Expand Down Expand Up @@ -666,7 +665,7 @@ impl TxCmd {
let mut client = StakeQueryServiceClient::new(channel.clone());
let penalty: Penalty = client
.validator_penalty(tonic::Request::new(ValidatorPenaltyRequest {
chain_id: params.chain_params.chain_id.to_string(),
chain_id: params.chain_id.to_string(),
identity_key: Some(validator_identity.into()),
start_epoch_index,
end_epoch_index,
Expand Down Expand Up @@ -773,7 +772,7 @@ impl TxCmd {
let mut client = GovernanceQueryServiceClient::new(app.pd_channel().await?);
let next_proposal_id: u64 = client
.next_proposal_id(NextProposalIdRequest {
chain_id: app.view().app_params().await?.chain_params.chain_id,
chain_id: app.view().app_params().await?.chain_id,
})
.await?
.into_inner()
Expand All @@ -800,7 +799,7 @@ impl TxCmd {
let mut client = GovernanceQueryServiceClient::new(app.pd_channel().await?);
let proposal = client
.proposal_data(ProposalDataRequest {
chain_id: app.view().app_params().await?.chain_params.chain_id,
chain_id: app.view().app_params().await?.chain_id,
proposal_id: *proposal_id,
})
.await?
Expand Down Expand Up @@ -870,7 +869,7 @@ impl TxCmd {
start_position,
} = client
.proposal_info(ProposalInfoRequest {
chain_id: app.view().app_params().await?.chain_params.chain_id,
chain_id: app.view().app_params().await?.chain_id,
proposal_id,
})
.await?
Expand All @@ -879,7 +878,7 @@ impl TxCmd {

let mut rate_data_stream = client
.proposal_rate_data(ProposalRateDataRequest {
chain_id: app.view().app_params().await?.chain_params.chain_id,
chain_id: app.view().app_params().await?.chain_id,
proposal_id,
})
.await?
Expand Down Expand Up @@ -1169,7 +1168,7 @@ impl TxCmd {
// Fetch the information regarding the position from the view service.
let position = client
.liquidity_position_by_id(LiquidityPositionByIdRequest {
chain_id: params.chain_params.chain_id.to_string(),
chain_id: params.chain_id.to_string(),
position_id: Some(position_id.into()),
})
.await?
Expand Down Expand Up @@ -1222,7 +1221,7 @@ impl TxCmd {
// Fetch the information regarding the position from the view service.
let position = client
.liquidity_position_by_id(LiquidityPositionByIdRequest {
chain_id: params.chain_params.chain_id.to_string(),
chain_id: params.chain_id.to_string(),
position_id: Some(PositionId::from(*position_id)),
})
.await?
Expand Down
Loading

0 comments on commit d991530

Please sign in to comment.