Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add factory method to parse multisig address in genesis #219

Merged
merged 7 commits into from
Jul 23, 2024

Conversation

ziscky
Copy link
Contributor

@ziscky ziscky commented Jul 16, 2024

https://app.clickup.com/t/2469579/8694vhmqk

This is the current output ( in JSON ) of the generated multisig data for the addresses in the genesis_balances.

Reference: lotus msig inspect f0121 implemented in https://github.com/filecoin-project/lotus/blob/2714a84248095f877f52ce20e737d9c8843a352a/cli/multisig.go#L188

TODO:

  • How to generate the ID without the TxCID ?
  • Should we leave the MultiSigInfo.TxCID empty ?
  • What should be the default MultiSigInfo.Signer when there are multiple signers ?
[
  {
    "id": "",
    "multisig_address": "f090",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":1,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\"],\"StartEpoch\":0,\"UnlockDuration\":0}",
    "signer": "f090"
  },
  {
    "id": "",
    "multisig_address": "f0117",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0117"
  },
  {
    "id": "",
    "multisig_address": "f0121",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0121"
  },
  {
    "id": "",
    "multisig_address": "f0118",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0118"
  },
  {
    "id": "",
    "multisig_address": "f0120",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0120"
  },
  {
    "id": "",
    "multisig_address": "f0122",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":0}",
    "signer": "f0122"
  },
  {
    "id": "",
    "multisig_address": "f0116",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0116"
  },
  {
    "id": "",
    "multisig_address": "f080",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":1,\"Signers\":[\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\"],\"StartEpoch\":0,\"UnlockDuration\":0}",
    "signer": "f080"
  },
  {
    "id": "",
    "multisig_address": "f0115",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0115"
  },
  {
    "id": "",
    "multisig_address": "f0119",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0119"
  }
]

🔗 zboto Link

@ziscky ziscky marked this pull request as draft July 16, 2024 23:46
@ziscky ziscky requested a review from emmanuelm41 July 16, 2024 23:49
@ziscky ziscky requested a review from lucaslopezf July 17, 2024 09:03
@lucaslopezf
Copy link
Contributor

lucaslopezf commented Jul 17, 2024

https://app.clickup.com/t/2469579/8694vhmqk

This is the current output ( in JSON ) of the generated multisig data for the addresses in the genesis_balances.

Reference: lotus msig inspect f0121 implemented in https://github.com/filecoin-project/lotus/blob/2714a84248095f877f52ce20e737d9c8843a352a/cli/multisig.go#L188

TODO:

  • How to generate the ID without the TxCID ?
  • Should we leave the MultiSigInfo.TxCID empty ?
  • What should be the default MultiSigInfo.Signer when there are multiple signers ?
[
  {
    "id": "",
    "multisig_address": "f090",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":1,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\"],\"StartEpoch\":0,\"UnlockDuration\":0}",
    "signer": "f090"
  },
  {
    "id": "",
    "multisig_address": "f0117",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0117"
  },
  {
    "id": "",
    "multisig_address": "f0121",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0121"
  },
  {
    "id": "",
    "multisig_address": "f0118",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0118"
  },
  {
    "id": "",
    "multisig_address": "f0120",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0120"
  },
  {
    "id": "",
    "multisig_address": "f0122",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":0}",
    "signer": "f0122"
  },
  {
    "id": "",
    "multisig_address": "f0116",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0116"
  },
  {
    "id": "",
    "multisig_address": "f080",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":1,\"Signers\":[\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\"],\"StartEpoch\":0,\"UnlockDuration\":0}",
    "signer": "f080"
  },
  {
    "id": "",
    "multisig_address": "f0115",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0115"
  },
  {
    "id": "",
    "multisig_address": "f0119",
    "height": 0,
    "tx_cid": "",
    "action_type": "Constructor",
    "value": "{\"NumApprovalsThreshold\":3,\"Signers\":[\"f1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy\",\"f1meqrx2ijvgrdquybafmlwgszpmc34b3kg3nohvy\",\"f1ovvm6oilbdsvbw27jhil3pcywrjuwiv5uzagq6i\",\"f1cadxk4yywa7hfaiz3rs23t3wmyn7cjcdy5rtm4q\",\"f3udf6vhs3xj7broosspzwjpbldee77qnrtzytpqrz2h6lfnx7sp3xwe3nn6lpg5eylpp3f7nmrqclt4zmd42a\",\"f3thj7rtskyyvqw2i4v6xg6x32rgaf5pqpkgzcdreuapfl4revnez62geu4ens2aarapuppsmok5af3rzmtgua\",\"f1t3atfumgpjhismj7pp3x63gpevxrsz4y2hgc4ci\"],\"StartEpoch\":0,\"UnlockDuration\":6307200}",
    "signer": "f0119"
  }
]

🔗 zboto Link

Great job, Eric! With that command, now we have the information for the genesis multisig.
Answering the questions, it's possible (actually normal) for a multisig to have multiple signers. The concept of multisig is precisely about that: a shared account with "many owners," where a certain number of signatures (threshold) are required to make transactions. Therefore, it's perfectly fine for it to have multiple signers.
Regarding the txCid, since it's a corner case and they come from the genesis, we might not have it (in fact, they're not in the canonical table).
And with the ID, as the fil-parser is now (check this link:

ID: tools.BuildId(tipsetCid, tx.TxTo, fmt.Sprint(tx.Height), tx.TxCid, tx.TxType),
), it will construct correctly, because even though the txCid doesn't exist, the combination of height + address + type doesn't exist in another transaction, so the ID should be unique.

@ziscky ziscky marked this pull request as ready for review July 18, 2024 07:40
Copy link
Contributor

@lucaslopezf lucaslopezf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test? I mean, we could do a test with the json you provided in the example and see if everything works fine

factory.go Outdated Show resolved Hide resolved
@ziscky ziscky requested a review from lucaslopezf July 18, 2024 15:15
gotMultiSigInfo.json Outdated Show resolved Hide resolved
@ziscky ziscky requested a review from emmanuelm41 July 19, 2024 12:33
@emmanuelm41 emmanuelm41 merged commit 702b220 into dev Jul 23, 2024
5 checks passed
@emmanuelm41 emmanuelm41 deleted the feat/genesis-multisig branch July 23, 2024 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants