diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f75b2527..0ca8fa9ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Bug Fixes * **da:** fixed da path seperator and encoding issue ([#731](https://github.com/dymensionxyz/dymint/issues/731)) ([3a3b219](https://github.com/dymensionxyz/dymint/commit/3a3b21932750fee7eaaa9c186f78e36e3e597746)) +* **DA:** use expo backoff in retries ([#739](https://github.com/dymensionxyz/dymint/issues/739)) ([848085f](https://github.com/dymensionxyz/dymint/commit/848085f70bcaae81fb80da3ab78c4d8b399e13b1)) * **p2p:** validate block before applying and not before caching in p2p gossiping ([#723](https://github.com/dymensionxyz/dymint/issues/723)) ([98371b5](https://github.com/dymensionxyz/dymint/commit/98371b5220613e70f3274fab5593e02ba532f7db)) * **produce loop:** handle unauthenticated error in settlement layer ([#726](https://github.com/dymensionxyz/dymint/issues/726)) ([33e78d1](https://github.com/dymensionxyz/dymint/commit/33e78d116b5f14b91b8b3bda2b6cbfee9040e2d3)) diff --git a/da/celestia/celestia.go b/da/celestia/celestia.go index 48805a203..c5acfbba3 100644 --- a/da/celestia/celestia.go +++ b/da/celestia/celestia.go @@ -567,10 +567,28 @@ func (c *DataAvailabilityLayerClient) submit(daBlob da.Blob) (uint64, da.Commitm ctx, cancel := context.WithTimeout(c.ctx, c.config.Timeout) defer cancel() - height, err := c.rpc.Submit(ctx, blobs, options) + /* + TODO: dry out all retries + */ + + var height uint64 + + err = retry.Do( + func() error { + var err error + height, err = c.rpc.Submit(ctx, blobs, options) + return err + }, + retry.Context(c.ctx), + retry.LastErrorOnly(true), + retry.Delay(c.rpcRetryDelay), + retry.Attempts(uint(c.rpcRetryAttempts)), + retry.DelayType(retry.FixedDelay), + ) if err != nil { - return 0, nil, fmt.Errorf("rpc submit: %w", err) + return 0, nil, fmt.Errorf("do rpc submit: %w", err) } + c.logger.Info("Successfully submitted blobs to Celestia", "height", height, "gas", options.GasLimit, "fee", options.Fee) return height, commitments[0], nil diff --git a/da/celestia/config.go b/da/celestia/config.go index fbed0d964..245406311 100644 --- a/da/celestia/config.go +++ b/da/celestia/config.go @@ -12,8 +12,8 @@ import ( ) const ( - defaultRpcRetryDelay = 15 * time.Second - defaultRpcCheckAttempts = 5 + defaultRpcRetryDelay = 30 * time.Second + defaultRpcCheckAttempts = 10 namespaceVersion = 0 defaultGasPrices = 0.1 defaultGasAdjustment float64 = 1.3