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

ChainX v1.0.6 PRC 变更 #90

Closed
liuchengxu opened this issue Aug 30, 2019 · 0 comments
Closed

ChainX v1.0.6 PRC 变更 #90

liuchengxu opened this issue Aug 30, 2019 · 0 comments

Comments

@liuchengxu
Copy link
Contributor

liuchengxu commented Aug 30, 2019

ChainX v1.0.6 RPC 相关变更:

原来 4 个接口提供 V1 版本

为了修复票龄潜在的溢出问题,chainx v1.0.6 进行了安全更新。此次更新导致 4 个 PRC 接口新增 V1 版本,当票龄未超过 rust 的 u64 最大值时,原版本的四个接口可正常访问。当超出 u64 最大值时,此时访问原来的四个接口将会出现错误,无法正常访问,必须切换到 V1 版本进行访问。

需要切换到 V1 版本的错误示例:

{
    "jsonrpc": "2.0",
    "error": {
        "code": 1614,
        "message": "chainx_getPseduIntentions is Deprecated, Please Use chainx_getPseduIntentionsV1 Instead"
    },
    "id": 1
}

有四个接口提供 V1 版本:

  • chainx_getNominationRecords -> chainx_getNominationRecordsV1
  • chainx_getIntentions -> chainx_getIntentionsV1
  • chainx_getPseduIntentions -> chainx_getPseduIntentionsV1
  • chainx_getPseduNominationRecords -> chainx_getPseduNominationRecordsV1

以上接口中以 V1 版本与原版本的区别在于其中一个字段的类型不同,其他均一致。对于类型不同的字段,V1 版本中对应类型为 String, 无 V1 标识的版本中对应类型为 Number(对应 rust 中类型为 u64). 这是由于现阶段 rust serde-json 库 u128 反序列化问题而采取的 workaround.

其他新增接口

  • chainx_getIntentionByAccount, chainx_getIntentionByAccountV1: 传入节点公钥获取节点信息,为 chainx_getIntentions 的单元素版本。
  • chainx_getStakingDividendByAccount: 获取投票用户的投票利息
  • chainx_getCrossMiningDividendByAccount: 获取跨链挖矿用户的跨链挖矿利息
手续费

由于ChainX的手续费模型采用chainx手续费模型的形式。因此自v1.0.6起,手续费权重可以通过rpc feeWeightMap 获取。因此计算一笔交易的手续费的时候,可以通过

  1. chainx_getFeeByCallAndLength 在链上实时计算
  2. chainx_getFeeWeightMap 获取手续费权重列表后在本地计算(js sdk 已封装相应的操作)

以上所有接口的请求和返回详情文档见 https://github.com/chainx-org/ChainX/wiki/RPC.

liuchengxu pushed a commit that referenced this issue May 28, 2020
* refactor for multisig

remove doublemap for multisig

* Feature/linked node (#79)

provide linked node data struct for runtime module storage
this linked node support option data or no option data

* provide linkednode struct in cxsupport
* refactor linked node
* add option for LinkedNode
* refactor linkednode
      remove template mode, use associate type to replace it

* Fix static net address (#80)

* Feature/linked_node provide multinodexindex (#82)

provide multinodexindex

* fix bug for linked_node

when add same index node, do nothing for this node

* refactor financialrecords to support withdraw cache

refactor financialrecords to support withdraw cache and remove deposit fee

* btc bridge

* rename num/hash relationship data (NumberForHash/HashsForNumber)
* let HashsForNumber map to a vec to get all forked block
* add blocknumber in BlockHeaderFor

* tokenbalances

refactor tokenbalances to support issue token in genesis

* reject issue chainx token and provide u32, usize as for tokenbalance

* Perfect deposit  (#83)

* Add deposit cache

* Perfect deposit

* Perfect withdraw (#84)

* Perfect withdraw

* add network check in btc bridge

* when meet testnet, jump header bit check
* check the bit change block in genesis

* Fix test build

* Feature/refactor match (#86)

*  matchorder and pendingorders

* Fix op_return account id parse

* tokenbalances: provide reserved type for reservedtoken

* Fix merge error

* update genesis_config

* Update genesis_config

* x-btc

* provide  codec for btreemap

due to orphan for mod, use local struct named `CodecBTreeMap`

* Update latest bitcoin-rust dependeces

* Implement initial vote weight via coin age (#87)

* Use struct instead of map as much as possible

* Unchecked initial version

* All intentions except these validators are candidates

* Add harsh test

* Put candidates into stats

* Rename unstake to deactive

* Revert StakeWeight

* Remove useless code

* Remove MAX_INTENTIONS

* Refactor with btreemap (#88)

* Refactor NominationRecordsOf to NominationRecords using BTreeMap

* Remove candidate_count

* Rename deactive to deactivate

* optimization match (#89)

* remove ensureaccountliquid in tokenbalances and support

for ensureaccountliquied has changed in staking module

* Hotfix/fix stakeweight type (#90)

* Revert StakeWeight type

* Change Balance to u64

* Fix total_minted and remove valid_cands_weight

* Fix insert registration information failure (#91)

* Change receive_address type

* Update exterbn

* update secp256k1 dependency (#94)

* Fix receive_address bug

* Support new substrate in cxrml

* update rust-secp256k1 dependeces

* Runtime build ok

* Build ok

* New runtime interface

* Update all runtime module

* Runtime build ok

* All build ok

* Add node runtime to support chainx runtime

* Update new runtime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant