Browse Source

Add the option to force or not a forgeBatch at the beginning of the slot

feature/update-smart-contracts
Pantani 3 years ago
parent
commit
968fcc207e
5 changed files with 13 additions and 1 deletions
  1. +1
    -0
      cli/node/cfg.buidler.toml
  2. +5
    -0
      config/config.go
  3. +5
    -0
      coordinator/coordinator.go
  4. +1
    -1
      coordinator/pipeline.go
  5. +1
    -0
      node/node.go

+ 1
- 0
cli/node/cfg.buidler.toml

@ -64,6 +64,7 @@ ForgeDelay = "10s"
ForgeNoTxsDelay = "0s" ForgeNoTxsDelay = "0s"
PurgeByExtDelInterval = "1m" PurgeByExtDelInterval = "1m"
MustForgeAtSlotDeadline = true MustForgeAtSlotDeadline = true
IgnoreSlotCommitment = false
[Coordinator.FeeAccount] [Coordinator.FeeAccount]
Address = "0x56232B1c5B10038125Bc7345664B4AFD745bcF8E" Address = "0x56232B1c5B10038125Bc7345664B4AFD745bcF8E"

+ 5
- 0
config/config.go

@ -104,6 +104,11 @@ type Coordinator struct {
// MustForgeAtSlotDeadline enables the coordinator to forge slots if // MustForgeAtSlotDeadline enables the coordinator to forge slots if
// the empty slots reach the slot deadline. // the empty slots reach the slot deadline.
MustForgeAtSlotDeadline bool MustForgeAtSlotDeadline bool
// IgnoreSlotCommitment IgnoreSlotCommitment disables forcing the
// coordinator to forge a slot immediately when the slot is not
// committed. If set to false, the coordinator will immediately forge
// a batch at the beginning of a slot if it's the slot winner.
IgnoreSlotCommitment bool
// SyncRetryInterval is the waiting interval between calls to the main // SyncRetryInterval is the waiting interval between calls to the main
// handler of a synced block after an error // handler of a synced block after an error
SyncRetryInterval Duration `validate:"required"` SyncRetryInterval Duration `validate:"required"`

+ 5
- 0
coordinator/coordinator.go

@ -87,6 +87,11 @@ type Config struct {
// MustForgeAtSlotDeadline enables the coordinator to forge slots if // MustForgeAtSlotDeadline enables the coordinator to forge slots if
// the empty slots reach the slot deadline. // the empty slots reach the slot deadline.
MustForgeAtSlotDeadline bool MustForgeAtSlotDeadline bool
// IgnoreSlotCommitment disables forcing the coordinator to forge a
// slot immediately when the slot is not committed. If set to false,
// the coordinator will immediately forge a batch at the beginning of
// a slot if it's the slot winner.
IgnoreSlotCommitment bool
// SyncRetryInterval is the waiting interval between calls to the main // SyncRetryInterval is the waiting interval between calls to the main
// handler of a synced block after an error // handler of a synced block after an error
SyncRetryInterval time.Duration SyncRetryInterval time.Duration

+ 1
- 1
coordinator/pipeline.go

@ -414,7 +414,7 @@ func (p *Pipeline) forgeBatch(batchNum common.BatchNum) (batchInfo *BatchInfo, e
var coordIdxs []common.Idx var coordIdxs []common.Idx
// Check if the slot is not yet fulfilled // Check if the slot is not yet fulfilled
slotCommitted := false
slotCommitted := p.cfg.IgnoreSlotCommitment
if p.stats.Sync.Auction.CurrentSlot.ForgerCommitment || if p.stats.Sync.Auction.CurrentSlot.ForgerCommitment ||
p.stats.Sync.Auction.CurrentSlot.SlotNum == p.state.lastSlotForged { p.stats.Sync.Auction.CurrentSlot.SlotNum == p.state.lastSlotForged {
slotCommitted = true slotCommitted = true

+ 1
- 0
node/node.go

@ -338,6 +338,7 @@ func NewNode(mode Mode, cfg *config.Node) (*Node, error) {
ForgeRetryInterval: cfg.Coordinator.ForgeRetryInterval.Duration, ForgeRetryInterval: cfg.Coordinator.ForgeRetryInterval.Duration,
ForgeDelay: cfg.Coordinator.ForgeDelay.Duration, ForgeDelay: cfg.Coordinator.ForgeDelay.Duration,
MustForgeAtSlotDeadline: cfg.Coordinator.MustForgeAtSlotDeadline, MustForgeAtSlotDeadline: cfg.Coordinator.MustForgeAtSlotDeadline,
IgnoreSlotCommitment: cfg.Coordinator.IgnoreSlotCommitment,
ForgeNoTxsDelay: cfg.Coordinator.ForgeNoTxsDelay.Duration, ForgeNoTxsDelay: cfg.Coordinator.ForgeNoTxsDelay.Duration,
SyncRetryInterval: cfg.Coordinator.SyncRetryInterval.Duration, SyncRetryInterval: cfg.Coordinator.SyncRetryInterval.Duration,
PurgeByExtDelInterval: cfg.Coordinator.PurgeByExtDelInterval.Duration, PurgeByExtDelInterval: cfg.Coordinator.PurgeByExtDelInterval.Duration,

Loading…
Cancel
Save