Skip to content

Commit

Permalink
docs: update chagelog & docs
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5459 committed Dec 7, 2023
1 parent e5091fb commit 0bc0f78
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


- damocles-manager
- 支持配置多个 sender 地址,选择其中一个有效的且余额最多的地址作为发送地址 [#1045](https://github.com/ipfs-force-community/damocles/pull/1045)
- 修复对 core.SealerCliAPIClient 错误的依赖注入,导致 damocles-manager 代理模式无法正常启动 [#1047](https://github.com/ipfs-force-community/damocles/pull/1047)
- 修复配置多个 Name 为空的 PersistStores 时启动报错的 bug [#1046](https://github.com/ipfs-force-community/damocles/pull/1046)
- 修复 terminal batch 时缺少对 enable batch 的检查的问题 [#1044](https://github.com/ipfs-force-community/damocles/pull/1044)
Expand Down
27 changes: 18 additions & 9 deletions damocles-manager/modules/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ func defaultMinerSnapUpRetryConfig(example bool) MinerSnapUpRetryConfig {

type MinerSnapUpConfig struct {
Enabled bool
Sender MustAddress
Sender *MustAddress
Senders []MustAddress // allows multiple senders to be specified

SendFund bool
Expand All @@ -411,7 +411,10 @@ type MinerSnapUpConfig struct {

func (m *MinerSnapUpConfig) GetSenders() []address.Address {
stdSenders := lo.Map(m.Senders, func(item MustAddress, _ int) address.Address { return item.Std() })
return lo.Union(stdSenders, []address.Address{m.Sender.Std()})
if m.Sender != nil {
return lo.Union(stdSenders, []address.Address{m.Sender.Std()})
}
return lo.Uniq(stdSenders)
}

func (m *MinerSnapUpConfig) GetMessageConfidence() abi.ChainEpoch {
Expand Down Expand Up @@ -442,7 +445,7 @@ func defaultMinerSnapUpConfig(example bool) MinerSnapUpConfig {
}

if example {
cfg.Sender = fakeAddress
cfg.Senders = []MustAddress{fakeAddress}
}

return cfg
Expand All @@ -469,7 +472,7 @@ func defaultMinerCommitmentConfig(example bool) MinerCommitmentConfig {
}

type MinerCommitmentPolicyConfig struct {
Sender MustAddress
Sender *MustAddress
Senders []MustAddress // allows multiple senders to be specified

SendFund bool
Expand All @@ -479,7 +482,10 @@ type MinerCommitmentPolicyConfig struct {

func (m *MinerCommitmentPolicyConfig) GetSenders() []address.Address {
stdSenders := lo.Map(m.Senders, func(item MustAddress, _ int) address.Address { return item.Std() })
return lo.Union(stdSenders, []address.Address{m.Sender.Std()})
if m.Sender != nil {
return lo.Union(stdSenders, []address.Address{m.Sender.Std()})
}
return lo.Uniq(stdSenders)
}

func defaultMinerCommitmentPolicyConfig(example bool) MinerCommitmentPolicyConfig {
Expand All @@ -490,7 +496,7 @@ func defaultMinerCommitmentPolicyConfig(example bool) MinerCommitmentPolicyConfi
}

if example {
cfg.Sender = fakeAddress
cfg.Senders = []MustAddress{fakeAddress}
}

return cfg
Expand All @@ -517,7 +523,7 @@ func defaultMinerCommitmentBatchPolicyConfig() MinerCommitmentBatchPolicyConfig
}

type MinerPoStConfig struct {
Sender MustAddress
Sender *MustAddress
Senders []MustAddress // allows multiple senders to be specified

Enabled bool
Expand All @@ -534,7 +540,10 @@ type MinerPoStConfig struct {

func (m *MinerPoStConfig) GetSenders() []address.Address {
stdSenders := lo.Map(m.Senders, func(item MustAddress, _ int) address.Address { return item.Std() })
return lo.Union(stdSenders, []address.Address{m.Sender.Std()})
if m.Sender != nil {
return lo.Union(stdSenders, []address.Address{m.Sender.Std()})
}
return lo.Uniq(stdSenders)
}

func DefaultMinerPoStConfig(example bool) MinerPoStConfig {
Expand All @@ -552,7 +561,7 @@ func DefaultMinerPoStConfig(example bool) MinerPoStConfig {
}

if example {
cfg.Sender = fakeAddress
cfg.Senders = []MustAddress{fakeAddress}
}

return cfg
Expand Down
2 changes: 1 addition & 1 deletion damocles-manager/modules/poster/poster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func mockTipSet(t *testing.T, height abi.ChainEpoch) *types.TipSet {

type mockSelecotor struct{}

func (mockSelecotor) Select(ctx context.Context, mid abi.ActorID, senders []address.Address) (address.Address, error) {
func (mockSelecotor) Select(_ context.Context, mid abi.ActorID, senders []address.Address) (address.Address, error) {
for _, sender := range senders {
if sender != address.Undef {
return sender, nil
Expand Down
44 changes: 30 additions & 14 deletions docs/zh/04.damocles-manager的配置解析.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ JobLifetime = "25h0m0s"
#Verbose = false
[Miners.SnapUp]
#Enabled = false
#Sender = "f1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"
#Senders = ["f1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"]
#SendFund = true
#GasOverEstimation = 1.2
#GasOverPremium = 0.0
Expand All @@ -90,7 +90,7 @@ JobLifetime = "25h0m0s"
[Miners.Commitment]
#Confidence = 10
[Miners.Commitment.Pre]
#Sender = "f1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"
#Senders = ["f1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"]
#SendFund = true
#GasOverEstimation = 1.2
#GasOverPremium = 0.0
Expand All @@ -106,7 +106,7 @@ JobLifetime = "25h0m0s"
#GasFeeCap = "5 nanoFIL"
#MaxFeeCap = ""
[Miners.Commitment.Prove]
#Sender = "f1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"
#Senders = ["f1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"]
#SendFund = true
#GasOverEstimation = 1.2
#GasOverPremium = 0.0
Expand All @@ -122,7 +122,7 @@ JobLifetime = "25h0m0s"
#GasFeeCap = "5 nanoFIL"
#MaxFeeCap = ""
[Miners.Commitment.Terminate]
#Sender = "f1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"
#Senders = ["f1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"]
#SendFund = true
#GasOverEstimation = 1.2
#GasOverPremium = 0.0
Expand All @@ -138,7 +138,7 @@ JobLifetime = "25h0m0s"
#GasFeeCap = "5 nanoFIL"
#MaxFeeCap = ""
[Miners.PoSt]
#Sender = "f1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"
#Senders = ["f1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"]
#Enabled = true
#StrictCheck = true
#Parallel = false
Expand Down Expand Up @@ -501,9 +501,15 @@ InitNumber = 0
# 默认值为 false
#Enabled = false

# 发送地址,在启用的情况下为必填项,地址类型

# 已过时
# 发送地址, 选填项,地址类型
#Sender = "t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"

# 发送地址列表,在启用的情况下为必填项,地址数组类型
# damocles-manager 在发送消息会选择该列表中有效的且余额最多的地址作为发送地址
#Senders = ["t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"]

# 提交上链消息时是否从 Sender 发送必要的资金,选填项,布尔类型
# 默认值为 true
# false 时,资金从 miner 出
Expand All @@ -517,7 +523,7 @@ InitNumber = 0
# 默认值为 5 nanoFIL
#GasFeeCap = "5 nanoFIL"

# 已废弃
# 已过时
#MaxFeeCap = ""

# 单条提交消息的 GasPremium 估算倍数,选填项,浮点数类型
Expand Down Expand Up @@ -577,8 +583,13 @@ InitNumber = 0
# 默认值为 true
#SendFund = true

# 发送地址,必填项,地址类型
Sender = "t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"
# 已过时
# 发送地址,选填项,地址类型
#Sender = "t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"

# 发送地址列表,在启用的情况下为必填项,地址数组类型
# damocles-manager 在发送消息会选择该列表中有效的且余额最多的地址作为发送地址
Senders = ["t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"]

# 单条提交消息的 Gas 估算倍数,选填项,浮点数类型
# 默认值为 1.2
Expand Down Expand Up @@ -644,8 +655,13 @@ Sender = "t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"

```toml
[Miners.PoSt]
# 发送地址,必填项,地址类型
Sender = "t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"
# 已过时
# 发送地址,选填项,地址类
#Sender = "t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"

# 发送地址列表,在启用的情况下为必填项,地址数组类型
# damocles-manager 在发送消息会选择该列表中有效的且余额最多的地址作为发送地址
Senders = ["t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"]

# 是否启用,选填项,布尔类型
# 默认值为 true
Expand Down Expand Up @@ -789,17 +805,17 @@ EnableDeals = true

[Miners.Commitment]
[Miners.Commitment.Pre]
Sender = "t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"
Senders = ["t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"]

[Miners.Commitment.Pre.Batch]

[Miners.Commitment.Prove]
Sender = "t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"
Senders = ["t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"]

[Miners.Commitment.Prove.Batch]

[Miners.PoSt]
Sender = "t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"
Senders = ["t1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za"]
Enabled = true

[Miners.Proof]
Expand Down

0 comments on commit 0bc0f78

Please sign in to comment.