Skip to content

Commit

Permalink
fix(celestia): impl retry on submit (#748)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <[email protected]>
  • Loading branch information
danwt and github-actions authored Apr 30, 2024
1 parent 848085f commit 61630eb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
### Bug Fixes

Check failure on line 4 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / markdownlint

Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]

* **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))

Expand Down
22 changes: 20 additions & 2 deletions da/celestia/celestia.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions da/celestia/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 61630eb

Please sign in to comment.