Skip to content

Commit

Permalink
fix: dymint out of sync with hub on tx submission timeout (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
omritoptix authored Jul 20, 2023
1 parent a67e445 commit 87343ed
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions da/celestia/celestia.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (c *DataAvailabilityLayerClient) SubmitBatch(batch *types.Batch) da.ResultS
// Here we assume that if txResponse is not nil and also error is not nil it means that the transaction
// was submitted (not necessarily accepted) and we still didn't get a clear status regarding it (e.g timeout).
// hence trying to poll for it.
c.logger.Debug("Failed to receive DA batch inclusion result. Waiting for inclusion", "txResponse", txResponse, "error", err)
c.logger.Debug("Failed to receive DA batch inclusion result. Waiting for inclusion", "txResponse", txResponse.RawLog, "error", err)
inclusionHeight, err := c.waitForTXInclusion(txResponse.TxHash)
if err == nil {
res, err := da.SubmitBatchHealthEventHelper(c.pubsubServer, c.ctx, true, nil)
Expand All @@ -196,7 +196,7 @@ func (c *DataAvailabilityLayerClient) SubmitBatch(batch *types.Batch) da.ResultS
}

} else {
c.logger.Debug("Successfully submitted DA batch", "txResponse", txResponse)
c.logger.Debug("Successfully submitted DA batch", "txResponse", txResponse.RawLog)
res, err := da.SubmitBatchHealthEventHelper(c.pubsubServer, c.ctx, true, nil)
if err != nil {
return res
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/celestiaorg/go-cnc v0.4.2
github.com/centrifuge/go-substrate-rpc-client/v4 v4.0.12
github.com/dgraph-io/badger/v3 v3.2103.3
github.com/dymensionxyz/cosmosclient v0.3.0-beta.0.20230621132116-77eb2ae5ab92
github.com/dymensionxyz/cosmosclient v0.4.0-beta
github.com/dymensionxyz/dymension v0.2.0-beta.0.20230607115558-745644a96ea6
github.com/go-kit/kit v0.12.0
github.com/gofrs/uuid v4.3.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac h1:opbrjaN/L8
github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM=
github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
github.com/dymensionxyz/cosmosclient v0.3.0-beta.0.20230621132116-77eb2ae5ab92 h1:OIKQAadI4pa2LTi888nzEWrGAUW225ysETiEHIr+oLY=
github.com/dymensionxyz/cosmosclient v0.3.0-beta.0.20230621132116-77eb2ae5ab92/go.mod h1:3y64ecWDzhnd0sSYZfaL4QpwgK0b0j6LFLVRGdygg+o=
github.com/dymensionxyz/cosmosclient v0.4.0-beta h1:IWyEEdvJ60n/v/DGNelD0n23lS6ED/5rsQJBClgIfhA=
github.com/dymensionxyz/cosmosclient v0.4.0-beta/go.mod h1:3y64ecWDzhnd0sSYZfaL4QpwgK0b0j6LFLVRGdygg+o=
github.com/dymensionxyz/dymension v0.2.0-beta.0.20230607115558-745644a96ea6 h1:dnriGXmMdYEiF/8lMrj+PDlN1vyQc6zgs/ZHL67eoyI=
github.com/dymensionxyz/dymension v0.2.0-beta.0.20230607115558-745644a96ea6/go.mod h1:rDkVuF+DxBDi5tTgVHFk1D2xpqf8bOccs6aB1wTOvP0=
github.com/dymensionxyz/rpc v1.3.1 h1:7EXWIobaBes5zldRvTIg7TmNsEKjicrWA/OjCc0NaGs=
Expand Down
4 changes: 3 additions & 1 deletion settlement/dymension/dymension.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"cosmossdk.io/errors"
"github.com/avast/retry-go"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
Expand Down Expand Up @@ -336,7 +337,7 @@ func (d *HubClient) submitBatch(msgUpdateState *rollapptypes.MsgUpdateState) err
err := retry.Do(func() error {
txResp, err := d.client.BroadcastTx(d.config.DymAccountName, msgUpdateState)
if err != nil || txResp.Code != 0 {
d.logger.Error("Error sending batch to settlement layer", "resp", txResp, "error", err)
d.logger.Error("Error sending batch to settlement layer", "resp", txResp.RawLog, "error", err)
return err
}
return nil
Expand Down Expand Up @@ -423,6 +424,7 @@ func getCosmosClientOptions(config *settlement.Config) []cosmosclient.Option {
}
options := []cosmosclient.Option{
cosmosclient.WithAddressPrefix(addressPrefix),
cosmosclient.WithBroadcastMode(flags.BroadcastSync),
cosmosclient.WithNodeAddress(config.NodeAddress),
cosmosclient.WithFees(config.GasFees),
cosmosclient.WithGasLimit(config.GasLimit),
Expand Down

0 comments on commit 87343ed

Please sign in to comment.