capi icon indicating copy to clipboard operation
capi copied to clipboard

multisig approval/cancellation event capture broken?

Open harrysolovay opened this issue 2 years ago • 2 comments

@statictype has reported an issue in gamma 1 in which multisig approval/cancellation event capture is supposedly broken.

In resolving this, let's also create an example of multisig proposal cancellation.

harrysolovay avatar Jul 06 '23 12:07 harrysolovay

Related comment: https://github.com/paritytech/capi-multisig-app/pull/217#issuecomment-1621232112

peetzweg avatar Jul 06 '23 13:07 peetzweg

I haven't attempted cancellation, but event extraction is seemingly working fine.

import { polkadotDev } from "@capi/polkadot-dev"
import { createDevUsers } from "capi"
import { MultisigRune } from "capi/patterns/multisig"
import { signature } from "capi/patterns/signature/polkadot"

const { alexa, billy, carol, david } = await createDevUsers()

const multisig = MultisigRune.from(polkadotDev, {
  signatories: [alexa, billy, carol].map(({ publicKey }) => publicKey),
  threshold: 3,
})

await multisig
  .fund(2_000_000_000_000n)
  .signed(signature({ sender: alexa }))
  .sent()
  .dbgStatus("Existential deposit")
  .finalized()
  .run()

const call = polkadotDev.Balances.transferKeepAlive({
  dest: david.address,
  value: 1_230_000_000_000n,
})

const firstProposalEvents = await multisig
  .ratify(alexa.address, call)
  .signed(signature({ sender: alexa }))
  .sent()
  .dbgStatus("Proposal:")
  .finalizedEvents()
  .run()
console.log("Proposal events", firstProposalEvents)

const finalApprovalEvents = await multisig
  .ratify(billy.address, call)
  .signed(signature({ sender: billy }))
  .sent()
  .dbgStatus("Final approval:")
  .finalizedEvents()
  .run()
console.log("Final approval events", finalApprovalEvents)

I'll follow up after I've had the chance to test within your chore-capi-beta47 branch.

harrysolovay avatar Jul 08 '23 01:07 harrysolovay