Skip to content

Commit

Permalink
Merge pull request #392 from maticnetwork/change-delay
Browse files Browse the repository at this point in the history
change delay interval
  • Loading branch information
jdkanani authored Jun 23, 2020
2 parents 6db612a + 2864b0a commit ef3e7e1
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions bridge/setu/processor/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ func (cp *CheckpointProcessor) sendCheckpointAckToHeimdall(eventName string, che
}
// After broadcasting transaction from bridge, add back the msg to queue with retry delay.
// This is to retry side-tx msg incase if it was failed earlier during side-tx processing on heimdall.
cp.Logger.Debug("Retrying checkpoint-ack to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
cp.Logger.Debug("Retrying checkpoint-ack to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
}

// handleCheckpointNoAck - Checkpoint No-Ack handler
Expand Down
4 changes: 2 additions & 2 deletions bridge/setu/processor/clerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ func (cp *ClerkProcessor) sendStateSyncedToHeimdall(eventName string, logBytes s

// After broadcasting transaction from bridge, add back the msg to queue with retry delay.
// This is to retry side-tx msg incase if it was failed earlier during side-tx processing on heimdall.
cp.Logger.Debug("Retrying deposit to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
cp.Logger.Debug("Retrying deposit to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
}

// isOldTx checks if tx is already processed or not
Expand Down
4 changes: 2 additions & 2 deletions bridge/setu/processor/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ func (fp *FeeProcessor) sendTopUpFeeToHeimdall(eventName string, logBytes string

// After broadcasting transaction from bridge, add back the msg to queue with retry delay.
// This is to retry side-tx msg incase if it was failed earlier during side-tx processing on heimdall.
fp.Logger.Debug("Retrying topup to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
fp.Logger.Debug("Retrying topup to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
}

// isOldTx checks if tx is already processed or not
Expand Down
16 changes: 8 additions & 8 deletions bridge/setu/processor/staking.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ func (sp *StakingProcessor) sendValidatorJoinToHeimdall(eventName string, logByt
}
// After broadcasting transaction from bridge, add back the msg to queue with retry delay.
// This is to retry side-tx msg incase if it was failed earlier during side-tx processing on heimdall.
sp.Logger.Debug("Retrying validatorjoin to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
sp.Logger.Debug("Retrying validatorjoin to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
}

func (sp *StakingProcessor) sendUnstakeInitToHeimdall(eventName string, logBytes string) error {
Expand Down Expand Up @@ -191,8 +191,8 @@ func (sp *StakingProcessor) sendUnstakeInitToHeimdall(eventName string, logBytes

// After broadcasting transaction from bridge, add back the msg to queue with retry delay.
// This is to retry side-tx msg incase if it was failed earlier during side-tx processing on heimdall.
sp.Logger.Debug("Retrying unstake-init to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
sp.Logger.Debug("Retrying unstake-init to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
}

func (sp *StakingProcessor) sendStakeUpdateToHeimdall(eventName string, logBytes string) error {
Expand Down Expand Up @@ -249,8 +249,8 @@ func (sp *StakingProcessor) sendStakeUpdateToHeimdall(eventName string, logBytes

// After broadcasting transaction from bridge, add back the msg to queue with retry delay.
// This is to retry side-tx msg incase if it was failed earlier during side-tx processing on heimdall.
sp.Logger.Debug("Retrying stake-update to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
sp.Logger.Debug("Retrying stake-update to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
}

func (sp *StakingProcessor) sendSignerChangeToHeimdall(eventName string, logBytes string) error {
Expand Down Expand Up @@ -316,8 +316,8 @@ func (sp *StakingProcessor) sendSignerChangeToHeimdall(eventName string, logByte

// After broadcasting transaction from bridge, add back the msg to queue with retry delay.
// This is to retry side-tx msg incase if it was failed earlier during side-tx processing on heimdall.
sp.Logger.Debug("Retrying signer-change to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.TimeBetweenTwoBlocks)
sp.Logger.Debug("Retrying signer-change to check if side-tx is successful or not", "after", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
}

// isOldTx checks if tx is already processed or not
Expand Down
6 changes: 3 additions & 3 deletions bridge/setu/util/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ const (

TransactionTimeout = 1 * time.Minute
CommitTimeout = 2 * time.Minute
TaskDelayBetweenEachVal = 6 * time.Second
ValidatorJoinRetryDelay = 12 * time.Second
BlockInterval = 6 * time.Second
TaskDelayBetweenEachVal = 3 * BlockInterval
ValidatorJoinRetryDelay = 3 * BlockInterval

TimeBetweenTwoBlocks = 6 * time.Second
BlocksToDelayBeforeRetry = 6

BridgeDBFlag = "bridge-db"
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ require (
github.com/karalabe/usb v0.0.0-20191104083709-911d15fe12a9 // indirect
github.com/maticnetwork/bor v0.1.7-0.20200507151553-e03cd94ed12b
github.com/olekukonko/tablewriter v0.0.4 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pborman/uuid v1.2.0
github.com/peterh/liner v1.2.0 // indirect
github.com/pkg/errors v0.9.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsq
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/oschwald/maxminddb-golang v1.6.0 h1:KAJSjdHQ8Kv45nFIbtoLGrGWqHFajOIm7skTyz/+Dls=
github.com/oschwald/maxminddb-golang v1.6.0/go.mod h1:DUJFucBg2cvqx42YmDa/+xHvb0elJtOm3o4aFQ/nb/w=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34=
github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
Expand Down

0 comments on commit ef3e7e1

Please sign in to comment.