paritytech / txwrapper

Helper funtions for offline transaction generation.
Apache License 2.0
58 stars 27 forks source link

Decoded tx is not backward compatible #394

Closed anhcao142 closed 3 years ago

anhcao142 commented 3 years ago

With v3.10.10 when decoding a signed hash the result looks like this.

{
  metadataRpc: '',
  method: { 
    args: {
      dest: { Id: '13W9f1t...' },
      value: 10000,
    },
    name: 'transferKeepAlive',
    pallet: 'balances'
  },
  nonce: 218,
  tip: 0,
}

With v3.10.0 it looks like this:

{
  metadataRpc: '',
  method: { 
    args: {
      dest: '13W9f1t...', // Dest in the newest version is an object instead of string
      value: 10000,
    },
    name: 'transferKeepAlive',
    pallet: 'balances'
  },
  nonce: 218,
  tip: 0,
}

It kind of breaks our system

emostov commented 3 years ago

Yes, this change came from the new MultiAddress type that went into polkadot 0.8.28:

https://github.com/paritytech/substrate/blob/9b08105b8c7106d723c4f470304ad9e2868569d9/primitives/runtime/src/multiaddress.rs#L26-L37

Essentially all addresses are now represented as an enum (MultiAddress) that holds a value and those types of enums are represented as objects in polkadot-js, not strings. Practically, this is a breaking change for users who read in addresses.

This change also affects the encoding of transactions as all addresses will now have an extra byte in front of them to represent the enum variant.

Worth noting api-sidecar users would see this same change as well.