hyperledger-iroha / iroha

Iroha - A simple, enterprise-grade decentralized ledger
https://wiki.hyperledger.org/display/iroha
Apache License 2.0
438 stars 280 forks source link

[BUG] Unexpected metadata change by adding quotes #5129

Open arndey opened 2 weeks ago

arndey commented 2 weeks ago

OS and Environment

any

GIT commit hash

tree/v2.0.0-pre-rc.22.2

Minimum working example / Steps to reproduce

{
  "chain" : "00000000-0000-0000-0000-000000000000",
  "executor" : "executor.wasm",
  "parameters" : [ ],
  "instructions" : [ {
    "Register" : {
      "Domain" : {
        "id" : "wonderland",
        "logo" : null,
        "metadata" : { }
      }
    }
  }, {
    "Register" : {
      "Account" : {
        "id" : "ed0120ce7fa46c9dce7ea4b125e2e36bdb63ea33073e7590ac92816ae1e861b7048b03@wonderland",
        "metadata" : { }
      }
    }
  }, {
    "Register" : {
      "Account" : {
        "id" : "ed012004ff5b81046ddccf19e2e451c45dfb6f53759d4eb30fa2efa807284d1cc33016@wonderland",
        "metadata" : { }
      }
    }
  }, {
    "Register" : {
      "AssetDefinition" : {
        "id" : "foo#wonderland",
        "type" : "Store",
        "mintable" : "Infinitely",
        "logo" : null,
        "metadata" : {
          "key" : "vsmIjTvWstOuyjYwairbDnKggldFrDkhtyzcqfAttzeJjKcioW"
        }
      }
    }
  }, {
    "Transfer" : {
      "Domain" : {
        "source" : "ed01204164bf554923ece1fd412d241036d863a6ae430476c898248b8237d77534cfc4@genesis",
        "object" : "wonderland",
        "destination" : "ed0120ce7fa46c9dce7ea4b125e2e36bdb63ea33073e7590ac92816ae1e861b7048b03@wonderland"
      }
    }
  }, {
    "SetKeyValue" : {
      "Asset" : {
        "object" : "foo#wonderland#ed0120ce7fa46c9dce7ea4b125e2e36bdb63ea33073e7590ac92816ae1e861b7048b03@wonderland",
        "key" : "key",
        "value" : "vsmIjTvWstOuyjYwairbDnKggldFrDkhtyzcqfAttzeJjKcioW"
      }
    }
  } ],
  "topology" : [ ]
}

Actual result

After receiving the asset via FindAssetById query, asset metadata contains:

Actual: "\"vsmIjTvWstOuyjYwairbDnKggldFrDkhtyzcqfAttzeJjKcioW\""

Expected result

Expected: "vsmIjTvWstOuyjYwairbDnKggldFrDkhtyzcqfAttzeJjKcioW"

Logs

Log contents ```json Replace this text with a JSON log, so it doesn't grow too large and has highlighting. ```

Who can help to reproduce?

@ mversic

Notes

Explanations like: “We have a JsonString, so we add quotes” do not seem significant enough to me to arbitrarily change the data sent to Iroha for storage

Mingela commented 2 weeks ago

In case "value" : "vsmIjTvWstOuyjYwairbDnKggldFrDkhtyzcqfAttzeJjKcioW" should be "value" : "\"vsmIjTvWstOuyjYwairbDnKggldFrDkhtyzcqfAttzeJjKcioW\"" the genesis block should be explicitly denied by Iroha's validation imo. Though it'd be great to see more motivation not to contain just String there.