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

Offchain worker #111

Merged
merged 11 commits into from
Feb 24, 2020
Merged

Offchain worker #111

merged 11 commits into from
Feb 24, 2020

Conversation

wangjj9219
Copy link
Member

目前有几个问题还未解决:

  1. rand包在module_cdp_engine模块中使用正常, 但集成到runtime时会提示无法找到rand包, 在 /runtime/Cargo.toml 同样配置有rand仍然提示错误。
  2. 参考pallet_im_online模块配置了Authority, 用于offchain worker 签名 UnsignedTransaction , 节点收到后会验证交易是否由Authority Set其中一员签名, 是否要在SessionKey中加入CdpEngineId? 这样当验证人节点配置CdpEngineId时, Authority Set就由pallet_session模块自动维护。 不加入SessionKey的话, 可能需要一套单独的维护方式(目前是由sudo账户添加)。 还是说不需要Authority, SignedExtension将不会对消息来源进行检查。
  3. 对UnsignedTx的验证使用了不推荐的ValidateUnsigned, 稍后会SignedExtension替代

@xlc
Copy link
Member

xlc commented Feb 16, 2020

避免直接用 rand,offchain_worker api 有 random_seed,可以配合 RandomNumberGenerator

https://github.com/paritytech/substrate/blob/2e8080e2902fc477bbce36512a8f5bcdc4b49f17/client/offchain/src/api.rs#L92

https://github.com/paritytech/substrate/blob/2e8080e2902fc477bbce36512a8f5bcdc4b49f17/primitives/runtime/src/random_number_generator.rs#L46


我们目前没有对清算人有额外奖励的计划,所以应该不需要管是谁发送的。之后可以考虑做一个惩罚机制惩罚不作为的 collator / validator

modules/loans/src/lib.rs Outdated Show resolved Hide resolved
modules/cdp_engine/src/lib.rs Outdated Show resolved Hide resolved
modules/loans/src/lib.rs Outdated Show resolved Hide resolved
@xlc xlc marked this pull request as ready for review February 24, 2020 22:51
@xlc xlc merged commit 03792c6 into master Feb 24, 2020
@xlc xlc deleted the offchain-worker branch February 24, 2020 22:51
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.

None yet

2 participants