Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

fix multisig_pure_proxy_stash.ts #827

Closed
ryanleecode opened this issue Mar 30, 2023 · 7 comments · Fixed by #829
Closed

fix multisig_pure_proxy_stash.ts #827

ryanleecode opened this issue Mar 30, 2023 · 7 comments · Fixed by #829
Assignees

Comments

@ryanleecode
Copy link
Contributor

Fund Multisig: ready
Fund Multisig: { inBlock: "0x673eae1bd13347115fd7f1c82cd9f5892b4cc80dd6e1a172e392b88c656b788c" }
Fund Multisig: { finalized: "0x673eae1bd13347115fd7f1c82cd9f5892b4cc80dd6e1a172e392b88c656b788c" }
Alice Ratify: ready
Alice Ratify: { inBlock: "0xaf56cde5d93954983e0b0836d468463829f20cd6d03308b28837713a3e863d85" }
Alice Ratify: { finalized: "0xaf56cde5d93954983e0b0836d468463829f20cd6d03308b28837713a3e863d85" }
Bob Ratify: ready
Bob Ratify: { inBlock: "0x27f6075dab996c8459ce93276b993b26a2f6d1d0097779aa5a02e13e4a714753" }
Bob Ratify: { finalized: "0x27f6075dab996c8459ce93276b993b26a2f6d1d0097779aa5a02e13e4a714753" }
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'pure')
        value = value[key]
                     ^
    at RunMap.fn (file:///workspaces/capi/rune/ValueRune.ts:50:22)
    at RunMap._evaluate (file:///workspaces/capi/rune/ValueRune.ts:162:40)
    at async RunMap.evaluate (file:///workspaces/capi/rune/Rune.ts:222:14)
    at async ValueRune.iter (file:///workspaces/capi/rune/Rune.ts:79:23)
    at async ValueRune.run (file:///workspaces/capi/rune/Rune.ts:66:22)
    at async file:///workspaces/capi/examples/multisig_pure_proxy_stash.ts:42:22

@ryanleecode ryanleecode self-assigned this Mar 30, 2023
@ryanleecode
Copy link
Contributor Author

dispatchError { index: 30, error: Uint8Array(4) [ 12, 0, 0, 0 ] }
{
  id: 30,
  name: "Multisig",
  storagePrefix: "Multisig",
  storage: {
    Multisigs: {
      singular: false,
      name: "Multisigs",
      key: $storageKey("Multisig", "Multisigs", $.tuple([Array])),
      partialKey: $storageKey("Multisig", "Multisigs", $partialMultiKey([Array])),
      value: $.object($.field([Array]), $.field([Array]), $.field([Array]), $.field([Array])),
      docs: " The set of open multisig operations.",
      default: undefined
    }
  },
  constants: {
    DepositBase: {
      name: "DepositBase",
      codec: $.u128,
      value: Uint8Array(16) [
        0, 140, 97, 197, 46, 0,
        0,   0,  0,   0,  0, 0,
        0,   0,  0,   0
      ],
      docs: " The base amount of currency needed to reserve for creating a multisig execution or to\n store a disp..."
    },
    DepositFactor: {
      name: "DepositFactor",
      codec: $.u128,
      value: Uint8Array(16) [
        0, 208, 18, 19, 0, 0,
        0,   0,  0,  0, 0, 0,
        0,   0,  0,  0
      ],
      docs: " The amount of currency needed per unit threshold when creating a multisig execution.\n\n This is held..."
    },
    MaxSignatories: {
      name: "MaxSignatories",
      codec: $.u32,
      value: Uint8Array(4) [ 100, 0, 0, 0 ],
      docs: " The maximum amount of signatories allowed in the multisig."
    }
  },
  types: {
    call: $.taggedUnion("type", { "0": [Object], "1": [Object], "2": [Object], "3": [Object] }),
    error: $.literalUnion(
      {
        "0": "MinimumThreshold",
        "1": "AlreadyApproved",
        "2": "NoApprovalsNeeded",
        "3": "TooFewSignatories",
        "4": "TooManySignatories",
        "5": "SignatoriesOutOfOrder",
        "6": "SenderInSignatories",
        "7": "NotFound",
        "8": "NotOwner",
        "9": "NoTimepoint",
        "10": "WrongTimepoint",
        "11": "UnexpectedTimepoint",
        "12": "MaxWeightTooLow",
        "13": "AlreadyStored"
      }
    ),
    event: $.taggedUnion("type", { "0": [Object], "1": [Object], "2": [Object], "3": [Object] })
  },
  docs: ""
}

MaxWeightTooLow??

@tjjfvi
Copy link
Contributor

tjjfvi commented Mar 30, 2023

You probably have a max weight set to 0?

@ryanleecode
Copy link
Contributor Author

@ryanleecode
Copy link
Contributor Author

https://learn.figment.io/tutorials/implement-multisig-accounts-on-polkadot

MAX_WEIGHT refers to the maximum weight of the call, although this is not clearly stated in the API documentation, it has to do with fee calculation. Weight is a fixed number designed to manage block validation times. It can be supplemented with an optional tip. Read more about Polkadot transaction fees here.

@ryanleecode
Copy link
Contributor Author

https://substrate.stackexchange.com/questions/7572/what-is-reftime-and-proofsize

proofSize: The amount of storage in bytes that a transaction is allowed to read.

When i set proof size to not zero it works but we are currently always setting it to zero

  feeEstimate() {
    const extrinsicHex = this.encoded().map(hex.encodePrefixed)
    return this.chain.connection.call("payment_queryInfo", extrinsicHex)
      .dbg("payment_queryInfo")
      .map(({ weight, ...rest }) => ({
        ...rest,
        weight: {
          proofSize: BigInt(typeof weight === "number" ? 0 : weight.proof_size),
          refTime: BigInt(typeof weight === "number" ? weight : weight.ref_time),
        },
      }))
  }

@ryanleecode
Copy link
Contributor Author

Weights are when testing the same example on v0.1.0-beta.29

v0.1.0-beta.29

payment_queryInfo { weight: 158465886, class: "normal", partialFee: "0" }
weight { proofSize: 0n, refTime: 158465886n }

✔️ Works with 0n proof size

main

payment_queryInfo { weight: 129851297, class: "normal", partialFee: "0" }
weight { proofSize: 0n, refTime: 129851297n }

❌ Fails with 0n proof size

@ryanleecode
Copy link
Contributor Author

ryanleecode commented Mar 30, 2023

paritytech/substrate#11637 this got added in 0.9.38.
and this paritytech/substrate#13268 in 0.9.39

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants