Skip to content

Commit

Permalink
Merge pull request #393 from maticnetwork/revert-infinite-retry
Browse files Browse the repository at this point in the history
revert infinite retry
  • Loading branch information
mankenavenkatesh authored Jun 24, 2020
2 parents ef3e7e1 + a040cfa commit 48f019f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 37 deletions.
6 changes: 1 addition & 5 deletions bridge/setu/processor/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"strconv"
"time"

"github.com/RichardKnop/machinery/v1/tasks"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/maticnetwork/bor/accounts/abi"
Expand Down Expand Up @@ -286,10 +285,7 @@ func (cp *CheckpointProcessor) sendCheckpointAckToHeimdall(eventName string, che
return err
}
}
// 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.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return nil
}

// handleCheckpointNoAck - Checkpoint No-Ack handler
Expand Down
6 changes: 1 addition & 5 deletions bridge/setu/processor/clerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/hex"
"encoding/json"

"github.com/RichardKnop/machinery/v1/tasks"
cliContext "github.com/cosmos/cosmos-sdk/client/context"
"github.com/maticnetwork/bor/accounts/abi"
"github.com/maticnetwork/bor/core/types"
Expand Down Expand Up @@ -108,10 +107,7 @@ 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.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return nil
}

// isOldTx checks if tx is already processed or not
Expand Down
7 changes: 1 addition & 6 deletions bridge/setu/processor/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package processor
import (
"encoding/json"

"github.com/RichardKnop/machinery/v1/tasks"
cliContext "github.com/cosmos/cosmos-sdk/client/context"
"github.com/maticnetwork/bor/accounts/abi"
"github.com/maticnetwork/bor/core/types"
Expand Down Expand Up @@ -86,11 +85,7 @@ func (fp *FeeProcessor) sendTopUpFeeToHeimdall(eventName string, logBytes string
return err
}
}

// 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.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return nil
}

// isOldTx checks if tx is already processed or not
Expand Down
23 changes: 4 additions & 19 deletions bridge/setu/processor/staking.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ func (sp *StakingProcessor) sendValidatorJoinToHeimdall(eventName string, logByt
return err
}
}
// 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.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return nil
}

func (sp *StakingProcessor) sendUnstakeInitToHeimdall(eventName string, logBytes string) error {
Expand Down Expand Up @@ -188,11 +185,7 @@ func (sp *StakingProcessor) sendUnstakeInitToHeimdall(eventName string, logBytes
return err
}
}

// 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.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return nil
}

func (sp *StakingProcessor) sendStakeUpdateToHeimdall(eventName string, logBytes string) error {
Expand Down Expand Up @@ -246,11 +239,7 @@ func (sp *StakingProcessor) sendStakeUpdateToHeimdall(eventName string, logBytes
return err
}
}

// 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.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return nil
}

func (sp *StakingProcessor) sendSignerChangeToHeimdall(eventName string, logBytes string) error {
Expand Down Expand Up @@ -313,11 +302,7 @@ func (sp *StakingProcessor) sendSignerChangeToHeimdall(eventName string, logByte
return err
}
}

// 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.BlockInterval)
return tasks.NewErrRetryTaskLater("retry to check if side-tx is successful or not", util.BlocksToDelayBeforeRetry*util.BlockInterval)
return nil
}

// isOldTx checks if tx is already processed or not
Expand Down
2 changes: 0 additions & 2 deletions bridge/setu/util/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ const (
TaskDelayBetweenEachVal = 3 * BlockInterval
ValidatorJoinRetryDelay = 3 * BlockInterval

BlocksToDelayBeforeRetry = 6

BridgeDBFlag = "bridge-db"
)

Expand Down

0 comments on commit 48f019f

Please sign in to comment.