Skip to content

Commit

Permalink
Merge pull request #10 from penumbra-zone/new-substore-proof-spec
Browse files Browse the repository at this point in the history
penumbra: update proof spec to new multistore format
  • Loading branch information
avahowell authored Dec 1, 2023
2 parents 6fcc078 + d919331 commit d73a246
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 41 deletions.
4 changes: 2 additions & 2 deletions config-devnet-osmosis.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ event_source = { mode = 'pull', interval = '1s' }
rpc_timeout = '15s'
account_prefix = 'fake' # not used
key_name = 'penumbra-wallet'
store_prefix = '' # not used, the commitment prefix for penumbra IBC is PenumbraAppHash
store_prefix = 'ibc-data'
gas_price = { price = 1, denom = 'upenumbra' } # not used
max_gas = 10000000 # not used
clock_drift = '5s'
Expand All @@ -51,7 +51,7 @@ event_source = { mode = 'pull', interval = '1s' }
rpc_timeout = '15s'
account_prefix = 'osmo' # not used
key_name = 'osmosis'
store_prefix = 'ibc' # not used, the commitment prefix for penumbra IBC is PenumbraAppHash
store_prefix = 'ibc'
gas_price = { price = 0.0026, denom = 'uosmo' }
gas_multiplier = 1.1
clock_drift = '20s'
Expand Down
4 changes: 2 additions & 2 deletions config-osmosis-testnet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ event_source = { mode = 'pull', interval = '1s' }
rpc_timeout = '15s'
account_prefix = 'fake' # not used
key_name = 'penumbra-wallet'
store_prefix = '' # not used, the commitment prefix for penumbra IBC is PenumbraAppHash
store_prefix = 'ibc-data'
gas_price = { price = 1, denom = 'upenumbra' } # not used
max_gas = 10000000 # not used
clock_drift = '5s'
Expand All @@ -51,7 +51,7 @@ event_source = { mode = 'pull', interval = '1s' }
rpc_timeout = '15s'
account_prefix = 'osmo' # not used
key_name = 'osmosis'
store_prefix = 'ibc' # not used, the commitment prefix for penumbra IBC is PenumbraAppHash
store_prefix = 'ibc'
gas_price = { price = 0.0026, denom = 'uosmo' }
gas_multiplier = 1.1
clock_drift = '20s'
Expand Down
4 changes: 2 additions & 2 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ event_source = { mode = 'pull', interval = '1s' }
rpc_timeout = '15s'
account_prefix = 'fake' # not used
key_name = 'penumbra-wallet'
store_prefix = '' # not used, the commitment prefix for penumbra IBC is PenumbraAppHash
store_prefix = 'ibc-data'
gas_price = { price = 1, denom = 'upenumbra' } # not used
max_gas = 10000000 # not used
clock_drift = '5s'
Expand All @@ -51,7 +51,7 @@ event_source = { mode = 'pull', interval = '1s' }
rpc_timeout = '15s'
account_prefix = 'fake' # not used
key_name = 'penumbra-wallet'
store_prefix = '' # not used, the commitment prefix for penumbra IBC is PenumbraAppHash
store_prefix = 'ibc-data'
gas_price = { price = 1, denom = 'upenumbra' } # not used
max_gas = 10000000 # not used
clock_drift = '5s'
Expand Down
2 changes: 1 addition & 1 deletion crates/relayer/src/chain/penumbra/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ impl ChainEndpoint for PenumbraChain {
crate::error::Error,
> {
// This is hardcoded for now.
Ok("PenumbraAppHash".as_bytes().to_vec().try_into().unwrap())
Ok(b"ibc-data".to_vec().try_into().unwrap())
}

fn query_application_status(
Expand Down
33 changes: 2 additions & 31 deletions crates/relayer/src/chain/penumbra/proofspec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,11 @@ fn jmt_spec_with_prehash() -> ics23::ProofSpec {
spec
}

/// this is a proof spec for computing Penumbra's AppHash, which is defined as
/// SHA256("PenumbraAppHash" || jmt.root()). In ICS/IBC terms, this applies a single global prefix
/// to Penumbra's state. Having a stable merkle prefix is currently required for our IBC
/// counterparties to verify our proofs.
fn apphash_spec() -> ibc_proto::cosmos::ics23::v1::ProofSpec {
ics23::ProofSpec {
// the leaf hash is simply H(key || value)
leaf_spec: Some(ics23::LeafOp {
prefix: vec![],
hash: ics23::HashOp::Sha256.into(),
length: ics23::LengthOp::NoPrefix.into(),
prehash_key: ics23::HashOp::NoHash.into(),
prehash_value: ics23::HashOp::NoHash.into(),
}),
// NOTE: we don't actually use any InnerOps.
inner_spec: Some(ics23::InnerSpec {
hash: ics23::HashOp::Sha256.into(),
child_order: vec![0, 1],
child_size: 32,
empty_child: vec![],
min_prefix_length: 0,
max_prefix_length: 0,
}),
min_depth: 0,
max_depth: 1,
prehash_key_before_comparison: false,
}
}

// TODO: this should re-export the proof specs from the Penumbra crate
pub fn penumbra_proof_spec_no_prehash() -> ProofSpecs {
vec![jmt_spec_no_prehash(), apphash_spec()].into()
vec![jmt_spec_no_prehash(), jmt_spec_no_prehash()].into()
}

pub fn penumbra_proof_spec_with_prehash() -> ProofSpecs {
vec![jmt_spec_with_prehash(), apphash_spec()].into()
vec![jmt_spec_with_prehash(), jmt_spec_with_prehash()].into()
}
4 changes: 1 addition & 3 deletions crates/relayer/src/chain/penumbra/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ impl PenumbraChain {

Ok((begin_block_events, end_block_events))
}
pub(super) async fn get_anchor(
&self,
) -> Result<MerkleRoot, Error> {
pub(super) async fn get_anchor(&self) -> Result<MerkleRoot, Error> {
let status = self
.rpc_client
.status()
Expand Down

0 comments on commit d73a246

Please sign in to comment.