Skip to content

Commit d593aca

Browse files
committed
no fee based aggregation/batching
1 parent cfc0ba3 commit d593aca

File tree

10 files changed

+397
-56
lines changed

10 files changed

+397
-56
lines changed

cmd/curio/config_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ func TestTOMLDecoding(t *testing.T) {
638638
[Batching]
639639
[Batching.Commit]
640640
[Batching.PreCommit]
641+
Timeout = "1h0m0s"
641642
[Batching.Update]
642643
643644
[Fees]

cmd/curio/tasks/tasks.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,8 @@ func addSealingTasks(
316316

317317
var sp *seal.SealPoller
318318
var slr *ffi.SealCalls
319-
var err error
320319
if hasAnySealingTask {
321-
sp, err = seal.NewPoller(db, full, cfg)
322-
if err != nil {
323-
return nil, xerrors.Errorf("creating seal poller: %w", err)
324-
}
320+
sp = seal.NewPoller(db, full, cfg)
325321
go sp.RunPoller(ctx)
326322

327323
slr = must.One(slrLazy.Val())

deps/config/load.go

+20-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"regexp"
1111
"sort"
1212
"strings"
13+
"time"
1314
"unicode"
1415

1516
"github.com/BurntSushi/toml"
@@ -330,15 +331,25 @@ func ConfigUpdate(cfgCur, cfgDef interface{}, opts ...UpdateCfgOpt) ([]byte, err
330331
// create a map of default lines, so we can comment those out later
331332
defLines := strings.Split(defStr, "\n")
332333
defaults := map[string]struct{}{}
334+
currentSection := ""
335+
336+
defSectionRx := regexp.MustCompile(`\[(.+)]`)
337+
333338
for i := range defLines {
334339
l := strings.TrimSpace(defLines[i])
335-
if len(l) == 0 {
340+
if len(l) == 0 || l[0] == '#' {
336341
continue
337342
}
338-
if l[0] == '#' || l[0] == '[' {
343+
if l[0] == '[' {
344+
m := defSectionRx.FindStringSubmatch(l)
345+
if len(m) == 2 {
346+
currentSection = m[1]
347+
}
339348
continue
340349
}
341-
defaults[l] = struct{}{}
350+
351+
qualifiedKey := currentSection + "." + l
352+
defaults[qualifiedKey] = struct{}{}
342353
}
343354

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

446462
if !cmp.Equal(cfgUpdated, cfgCur, opts...) {

docker/curio/entrypoint.sh

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ if [ ! -f $CURIO_REPO_PATH/.init.curio ]; then
6262
EnableCommP = true
6363
EnableDealMarket = true
6464
EnableParkPiece = true
65+
66+
[Batching]
67+
[Batching.PreCommit]
68+
Timeout = "0h0m5s"
69+
Slack = "6h0m0s"
70+
[Batching.Commit]
71+
Timeout = "0h0m5s"
72+
Slack = "1h0m0s"
6573
'
6674
echo "$CONFIG_CONTENT" | curio config create --title market
6775
touch $CURIO_REPO_PATH/.init.config

0 commit comments

Comments
 (0)