unionlabs/union · error · anyhow::Error

transaction height not found

Error message

transaction height not found

What it means

After `broadcast_tx_commit` succeeds, `send_ibc_transaction` reads `TxResponse.height` to report the block height of the IBC send; the cometbft response left it None, so the code errors out. This reflects an RPC response that omitted the height field, not a chain-level failure.

Source

Thrown at tools/union-test/src/cosmos.rs:782

        match err {
            BroadcastTxCommitError::Query(grpc_err) => {
                grpc_err.log.contains("account sequence mismatch")
            }
            _ => false,
        }
    }

    pub async fn send_ibc_transaction(
        &self,
        contract: Addr,
        msg: (Vec<u8>, Vec<Coin>),
        signer: &LocalSigner,
    ) -> anyhow::Result<(H256, u64)> {
        let result = self.send_cosmwasm_transaction(contract, msg, signer).await;
        let tx_result = result.ok_or_else(|| anyhow!("failed to send transaction"))??;
        let height = tx_result
            .height
            .ok_or_else(|| anyhow!("transaction height not found"))?;

        let send_event = tx_result
            .tx_result
            .events
            .into_iter()
            .find_map(|e| {
                if e.ty == "wasm-packet_send" {
                    CosmosSdkEvent::<ModuleEvent>::new(e).ok().map(|e| e.event)
                } else {
                    None
                }
            })
            .ok_or_else(|| anyhow!("wasm-packet_send event not found"))?;

        Ok(match send_event {
            ModuleEvent::WasmPacketSend { packet_hash, .. } => (packet_hash, height.get()),
            _ => bail!("unexpected event variant"),
        })

View on GitHub (pinned to 031785bb6d)

Solutions

  1. As a caller, recover the height by querying the tx by hash (`/tx` RPC) instead of trusting the commit response
  2. Switch to a standard cometbft-compatible endpoint
  3. Update union-test to a revision matching the chain's cometbft version

Example fix

// before
let height = tx_result.height.ok_or_else(|| anyhow!("transaction height not found"))?; 
// after: fall back to a by-hash tx query
let height = match tx_result.height {
    Some(h) => h,
    None => client.rpc.tx(H256::from(hash), false).await?.tx_result.height,
};
Defensive patterns

Strategy: fallback

Try / catch

let height = match tx_result.height {
    Some(h) => h,
    None => {
        // fallback: recover the height from a by-hash tx query
        let tx = client.rpc.tx(hash_bytes, false).await?;
        tx.tx_result.height
    }
};

Prevention

When it happens

Trigger: A cometbft RPC endpoint (or proxy/mock) that returns TxResponse without `height` populated; version skew between union-test's cometbft types and the node's JSON-RPC serialization.

Common situations: Pointing union-test at a non-standard or proxied RPC; mocked RPC in tests; upgraded chain whose TxResponse schema changed.

Related errors


AI-assisted analysis of unionlabs/union@031785bb6d (2026-08-16). Data as JSON: /api/errors/c36cfaf87768fc8c. Report an issue: GitHub.