Skip to content

txs encode restful api return wrong response #4141

@bitrocks

Description

@bitrocks

Summary of Bug

thetxs/encode api return different txbytes from gaiacli tx encode signed.json when apply the same json file.

Version

0.34.0-rc2

Steps to Reproduce

my signed.json:

{
    "type":"auth/StdTx",
    "value":{
        "msg":[
            {
                "type":"cosmos-sdk/MsgSend",
                "value":{
                    "from_address":"cosmos1rpsdl0wdk42jjf9sp57d3eflm8q8ektuz66at3",
                    "to_address":"cosmos1e4lhppa79t40eqdgl5her60p4zqtenyj839y8z",
                    "amount":[
                        {
                            "denom":"muon",
                            "amount":"1000"
                        }
                    ]
                }
            }
        ],
        "fee":{
            "amount":[
                {
                    "denom":"muon",
                    "amount":"5000"
                }
            ],
            "gas":"200000"
        },
        "signatures":[
            {
                "pub_key":{
                    "type":"tendermint/PubKeySecp256k1",
                    "value":"A9dZ7e2azCHXp9hoTbXxTfiH2elBIet4Crj/4t5vecX0"
                },
                "signature":"TSNafIKca3+hEA48Fbf66gPJJscXkVvqactKHZOMPnBzB0PtNeHSFXWPl1lr1OR5p01V6eaz8zuJH7ukvTRGog=="
            }
        ],
        "memo":"userid001"
    }
}

CLI: gaiacli tx encode signed.json

zwHwYl3uCj6oo2GaChQYYN+9zbVVKSSwDTzY5T/ZwHzZfBIUzX9wh74q6vyBqP0vkenhqIC8zJIaDAoEbXVvbhIEMTAwMBISCgwKBG11b24SBDUwMDAQwJoMGmoKJuta6YchA9dZ7e2azCHXp9hoTbXxTfiH2elBIet4Crj/4t5vecX0EkBNI1p8gpxrf6EQDjwVt/rqA8kmxxeRW+ppy0odk4w+cHMHQ+014dIVdY+XWWvU5HmnTVXp5rPzO4kfu6S9NEaiIgl1c2VyaWQwMDE=

API: curl -d @signed.json -X POST http://localhost:1317/txs/encode

{"tx":"BPBiXe4="}

The former is right. I guess there are some cdc.UnmarshalJson problem. But I failed to get it right.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions