MinaProtocol / mina

Mina is a cryptocurrency protocol with a constant size blockchain, improving scaling while maintaining decentralization and security.
https://minaprotocol.com
Apache License 2.0
1.97k stars 522 forks source link

Ignore old, deprecated fields in rosetta transactions #15718

Open mrmr1993 opened 3 weeks ago

mrmr1993 commented 3 weeks ago

This PR allows rosetta parsing to ignore deprecated fields when they are null.

Checklist:

mrmr1993 commented 3 weeks ago

!ci-build-me

mrmr1993 commented 3 weeks ago

!ci-build-me

mrmr1993 commented 3 weeks ago

Confirmed working with transaction

{
  "signature": "a9ad136ccc8dfdfc76937dc884036d625cbdc6baadc968c13f2be090bf53a01f3e0cee3f0959c6a85f6d939ca08d9200ee15a0a64440a0f8e5affe8afde3251f",
  "payment": {
    "to": "B62qkcjubxpCvKyJvtisJqVrnNcXHE7EeZPbQ9FNJbTbFwXPVcYnjgX",
    "from": "B62qoigHEtJCoZ5ekbGHWyr9hYfc6fkZ2A41h9vvVZuvty9amzEz3yB",
    "fee": "10000000000",
    "token": "1",
    "nonce": "68",
    "memo": null,
    "amount": "16571009648348",
    "valid_until": "4294967295"
  },
  "stake_delegation": null,
  "create_token": null,
  "create_token_account": null,
  "mint_tokens": null
}
joaosreis commented 3 weeks ago

Tested it by running mina advanced send-rosetta-transaction and sending various payloads, observing the following behaviors:

Also, I wrote these cases as unit tests for the JSON deserialization. I can push them to the branch if desired.