rust-elements icon indicating copy to clipboard operation
rust-elements copied to clipboard

elementsd-tests: tx_issuance test fails with new elementsd versions

Open LeoComandini opened this issue 1 year ago • 0 comments

This passes (elements 21)

rust-elements/elementsd-tests$ ELEMENTSD_EXE=bin/elementsd cargo test -- tx_issuance

This fails

ELEMENTSD_EXE=~/dev/bin/elements-23.2.1/bin/elementsd cargo test -- tx_issuance

with

error JSON-RPC error: RPC error response: RpcError { code: -4, message: "Unable to create an asset surjection proof", data: None } while calling walletprocesspsbt with ...

After applying this diff (make issuance explicit)

diff --git a/elementsd-tests/src/pset.rs b/elementsd-tests/src/pset.rs
index dd2d92b..6c475b0 100644
--- a/elementsd-tests/src/pset.rs
+++ b/elementsd-tests/src/pset.rs
@@ -55,12 +55,12 @@ fn tx_issuance() {
     let contract_hash = ContractHash::from_byte_array([0u8; 32]);
     let entropy = AssetId::generate_asset_entropy(prevout, contract_hash);
     let asset_id = AssetId::from_entropy(entropy.clone());
-    let reissuance_id = AssetId::reissuance_token_from_entropy(entropy, true);
+    let reissuance_id = AssetId::reissuance_token_from_entropy(entropy, false);
 
     let value = elementsd.call(
             "createpsbt",
             &[
-                json!([{ "txid": prevout.txid.to_string(), "vout": prevout.vout, "issuance_amount": 1000, "issuance_tokens": 1}]),
+                json!([{ "txid": prevout.txid.to_string(), "vout": prevout.vout, "issuance_amount": 1000, "issuance_tokens": 1, "blind_reissuance": false}]),
                 json!([
                     {address_asset: "1000", "asset": asset_id.to_string(), "blinder_index": 0},
                     {address_reissuance: "1", "asset": reissuance_id.to_string(), "blinder_index": 0},

This fails (elements 21)

rust-elements/elementsd-tests$ ELEMENTSD_EXE=bin/elementsd cargo test -- tx_issuance

with

error JSON-RPC error: RPC error response: RpcError { code: -4, message: "Unable to create an asset surjection proof", data: None } while calling walletprocesspsbt with ...

And this passes

ELEMENTSD_EXE=~/dev/bin/elements-23.2.1/bin/elementsd cargo test -- tx_issuance

Anyway this is a elementsd issue related to createpsbt/walletprocesspsbt, so AFAICT on the rust-elements side we can just apply/not apply the diff depending on the version used

LeoComandini avatar Aug 23 '24 09:08 LeoComandini