Skip to content

no fee based aggregation/batching #492

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/curio/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ func TestTOMLDecoding(t *testing.T) {
[Batching]
[Batching.Commit]
[Batching.PreCommit]
Timeout = "1h0m0s"
[Batching.Update]
[Fees]
Expand Down
6 changes: 1 addition & 5 deletions cmd/curio/tasks/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,8 @@ func addSealingTasks(

var sp *seal.SealPoller
var slr *ffi.SealCalls
var err error
if hasAnySealingTask {
sp, err = seal.NewPoller(db, full, cfg)
if err != nil {
return nil, xerrors.Errorf("creating seal poller: %w", err)
}
sp = seal.NewPoller(db, full, cfg)
go sp.RunPoller(ctx)

slr = must.One(slrLazy.Val())
Expand Down
24 changes: 20 additions & 4 deletions deps/config/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"regexp"
"sort"
"strings"
"time"
"unicode"

"github.com/BurntSushi/toml"
Expand Down Expand Up @@ -330,15 +331,25 @@ func ConfigUpdate(cfgCur, cfgDef interface{}, opts ...UpdateCfgOpt) ([]byte, err
// create a map of default lines, so we can comment those out later
defLines := strings.Split(defStr, "\n")
defaults := map[string]struct{}{}
currentSection := ""

defSectionRx := regexp.MustCompile(`\[(.+)]`)

for i := range defLines {
l := strings.TrimSpace(defLines[i])
if len(l) == 0 {
if len(l) == 0 || l[0] == '#' {
continue
}
if l[0] == '#' || l[0] == '[' {
if l[0] == '[' {
m := defSectionRx.FindStringSubmatch(l)
if len(m) == 2 {
currentSection = m[1]
}
continue
}
defaults[l] = struct{}{}

qualifiedKey := currentSection + "." + l
defaults[qualifiedKey] = struct{}{}
}

nodeLines := strings.Split(nodeStr, "\n")
Expand Down Expand Up @@ -409,7 +420,8 @@ func ConfigUpdate(cfgCur, cfgDef interface{}, opts ...UpdateCfgOpt) ([]byte, err
// filter lines from options
optsFilter := updateOpts.keepUncommented != nil && updateOpts.keepUncommented(line)
// if there is the same line in the default config, comment it out in output
if _, found := defaults[strings.TrimSpace(nodeLines[i])]; (cfgDef == nil || found) && len(line) > 0 && !optsFilter {
qualifiedKey := section + "." + strings.TrimSpace(line)
if _, found := defaults[qualifiedKey]; (cfgDef == nil || found) && len(line) > 0 && !optsFilter {
line = pad + "#" + line[len(pad):]
}
outLines = append(outLines, line)
Expand Down Expand Up @@ -441,6 +453,10 @@ func ConfigUpdate(cfgCur, cfgDef interface{}, opts ...UpdateCfgOpt) ([]byte, err
}
return false
}),
cmp.Comparer(func(x, y time.Duration) bool {
tx, ty := reflect.TypeOf(x), reflect.TypeOf(y)
return tx.Kind() == ty.Kind()
}),
}

if !cmp.Equal(cfgUpdated, cfgCur, opts...) {
Expand Down
8 changes: 8 additions & 0 deletions docker/curio/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ if [ ! -f $CURIO_REPO_PATH/.init.curio ]; then
EnableCommP = true
EnableDealMarket = true
EnableParkPiece = true
[Batching]
[Batching.PreCommit]
Timeout = "0h0m5s"
Slack = "6h0m0s"
[Batching.Commit]
Timeout = "0h0m5s"
Slack = "1h0m0s"
'
echo "$CONFIG_CONTENT" | curio config create --title market
touch $CURIO_REPO_PATH/.init.config
Expand Down
Loading