sputnikdao2 - ChangePolicy - “数据与未标记枚举 VersionedPolicy 的任何变体都不匹配”

Posted

技术标签:

【中文标题】sputnikdao2 - ChangePolicy - “数据与未标记枚举 VersionedPolicy 的任何变体都不匹配”【英文标题】:sputnikdao2 - ChangePolicy - "data did not match any variant of untagged enum VersionedPolicy" 【发布时间】:2021-10-22 00:45:51 【问题描述】:

我正在尝试更改已部署的 sputnikdao2 合同的政策。

我收到此错误:

   "ExecutionError":"`Smart contract panicked: panicked at 'Failed to deserialize input from JSON.: Error(\"data did not match any variant of untagged enum VersionedPolicy\", line: 1, column: 423)', src/proposals.rs:384:1`"
,
"transaction_outcome":
   "block_hash":"8aUiGxnJv12BASyKjPKVsYWegEmbH8Lz1LsXu7gGXFwa",
   "id":"FTTFLVZzzrK7CT6KCNqWVCs67Hc5oBRHBT9TqCciqjY6",
   "outcome":
      "executor_id":"hundred.testnet",
      "gas_burnt":2428900339092,
      "logs":[
         
      ],
      "receipt_ids":[
         "EuNWubtxcY9YjcbTxSwrrYj59GBVj8u6a8RktQj7tHSh"
      ],
      "status":
         "SuccessReceiptId":"EuNWubtxcY9YjcbTxSwrrYj59GBVj8u6a8RktQj7tHSh"
      ,
      "tokens_burnt":"242890033909200000000"
   ,
   "proof":[
      
         "direction":"Left",
         "hash":"9eTyjRrHrNP1Bmw4rDgSouGmvxP7Lg3EaoUn15qBQH3h"
      ,
      
         "direction":"Right",
         "hash":"4NLf8mPom49oVbXmB2ouujxctjbyZC5FBi5ny1NFcXYj"
      
   ]

 

您可以在此处查看更多信息: https://gist.github.com/hiba-machfej/3a681d22fc2310966ca7692ec3a189d2

【问题讨论】:

【参考方案1】:

我试图发送这个:

'"proposal": "description": "Add New Council", "kind": "ChangePolicy":  "policy":  "roles": [ "name": "all", "kind": "Everyone", "permissions": [ "*:AddProposal" ], "vote_policy": ""], "default_vote_policy":  "weight_kind": "RoleWeight", "quorum": "0", "threshold": [ 1, 2 ] , "proposal_bond": "1000000000000000000000000", "proposal_period": "604800000000000", "bounty_bond": "1000000000000000000000000", "bounty_forgiveness_period": "86400000000000"' \
--accountId hundred.testnet \
--amount 1

我再次重写了对象并且它起作用了:

'"proposal": "description": "Add New Council", "kind": "ChangePolicy":  "policy":   "roles": [ "name": "all", "kind": "Everyone", "permissions": ["*:AddProposal", "*:Finalize"], "vote_policy": ], "default_vote_policy":  "weight_kind": "RoleWeight", "quorum": "0", "threshold": [ 1, 2 ], "proposal_bond": "1000000000000000000000000", "proposal_period": "604800000000000", "bounty_bond": "1000000000000000000000000", "bounty_forgiveness_period": "86400000000000" ' \
--accountId hundred.testnet \
--amount 1

这是收据: https://explorer.testnet.near.org/transactions/DxXLUUcx2jcLdoCFT2HbhSinWV6zjSREUkNXnN3kkHD4

我认为我运行的第一个代码中的 json 格式有错误。

【讨论】:

以上是关于sputnikdao2 - ChangePolicy - “数据与未标记枚举 VersionedPolicy 的任何变体都不匹配”的主要内容,如果未能解决你的问题,请参考以下文章