From 63e5230df4e669fadf83e4d141bf002df2ecc2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nina=20/=20=E1=83=9C=E1=83=98=E1=83=9C=E1=83=90?= Date: Thu, 29 Aug 2024 12:40:03 +0200 Subject: [PATCH] chore!: bump celestia-app to v2.1.2 (#3674) Co-authored-by: Rootul P --- go.mod | 8 +++---- go.sum | 12 +++++------ state/core_access.go | 51 ++++++++++++++++---------------------------- 3 files changed, 28 insertions(+), 43 deletions(-) diff --git a/go.mod b/go.mod index 6ea2f78112..0a007ce40b 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,11 @@ module github.com/celestiaorg/celestia-node go 1.23 require ( - cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.3.0 github.com/BurntSushi/toml v1.4.0 github.com/alecthomas/jsonschema v0.0.0-20220216202328-9eeeec9d044b github.com/benbjohnson/clock v1.3.5 - github.com/celestiaorg/celestia-app/v2 v2.0.0 + github.com/celestiaorg/celestia-app/v2 v2.1.2 github.com/celestiaorg/go-fraud v0.2.1 github.com/celestiaorg/go-header v0.6.2 github.com/celestiaorg/go-libp2p-messenger v0.2.0 @@ -83,6 +82,7 @@ require ( cloud.google.com/go/compute/metadata v0.3.0 // indirect cloud.google.com/go/iam v1.1.6 // indirect cloud.google.com/go/storage v1.38.0 // indirect + cosmossdk.io/errors v1.0.1 // indirect filippo.io/edwards25519 v1.0.0-rc.1 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -353,10 +353,10 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.23.0-sdk-v0.46.16 + github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.24.1-sdk-v0.46.16 github.com/filecoin-project/dagstore => github.com/celestiaorg/dagstore v0.0.0-20230824094345-537c012aa403 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 // broken goleveldb needs to be replaced for the cosmos-sdk and celestia-app github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.38.0-tm-v0.34.29 + github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29 ) diff --git a/go.sum b/go.sum index 40005814c5..2c990f9004 100644 --- a/go.sum +++ b/go.sum @@ -354,12 +354,12 @@ github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOC github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/celestiaorg/blobstream-contracts/v3 v3.1.0 h1:h1Y4V3EMQ2mFmNtWt2sIhZIuyASInj1a9ExI8xOsTOw= github.com/celestiaorg/blobstream-contracts/v3 v3.1.0/go.mod h1:x4DKyfKOSv1ZJM9NwV+Pw01kH2CD7N5zTFclXIVJ6GQ= -github.com/celestiaorg/celestia-app/v2 v2.0.0 h1:cGrkLbqbaNqj+g+LhvmQ0iFKFyrD/GdU5z3WQI/bq8E= -github.com/celestiaorg/celestia-app/v2 v2.0.0/go.mod h1:0wP0W+GLghvsODxLhAYToKsy0RFKeg1HdZftQG90W5A= -github.com/celestiaorg/celestia-core v1.38.0-tm-v0.34.29 h1:HwbA4OegRvXX0aNchBA7Cmu+oIxnH7xRcOhISuDP0ak= -github.com/celestiaorg/celestia-core v1.38.0-tm-v0.34.29/go.mod h1:MyElURdWAOJkOp84WZnfEUJ+OLvTwOOHG2lbK9E8XRI= -github.com/celestiaorg/cosmos-sdk v1.23.0-sdk-v0.46.16 h1:N2uETI13szEKnGAdKhtTR0EsrpcW0AwRKYER74WLnuw= -github.com/celestiaorg/cosmos-sdk v1.23.0-sdk-v0.46.16/go.mod h1:Bpl1LSWiDpQumgOhhMTZBMopqa0j7fRasIhvTZB44P0= +github.com/celestiaorg/celestia-app/v2 v2.1.2 h1:/3NhEPkVHahKrJ3blehDPjy7AzWq8z68afgvEmor/tk= +github.com/celestiaorg/celestia-app/v2 v2.1.2/go.mod h1:qraGN1WNAtIFwGWB0NWnZ3tGPL5joPlbLStSZ4k6niQ= +github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29 h1:J79TAjizxwIvm7/k+WI3PPH1aFj4AjOSjajoq5UzAwI= +github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29/go.mod h1:5jJ5magtH7gQOwSYfS/m5fliIS7irKunLV7kLNaD8o0= +github.com/celestiaorg/cosmos-sdk v1.24.1-sdk-v0.46.16 h1:SeQ7Y/CyOcUMKo7mQiexaj/pZ/xIgyuZFIwYZwpSkWE= +github.com/celestiaorg/cosmos-sdk v1.24.1-sdk-v0.46.16/go.mod h1:Bpl1LSWiDpQumgOhhMTZBMopqa0j7fRasIhvTZB44P0= github.com/celestiaorg/dagstore v0.0.0-20230824094345-537c012aa403 h1:Lj73O3S+KJx5/hgZ+IeOLEIoLsAveJN/7/ZtQQtPSVw= github.com/celestiaorg/dagstore v0.0.0-20230824094345-537c012aa403/go.mod h1:cCGM1UoMvyTk8k62mkc+ReVu8iHBCtSBAAL4wYU7KEI= github.com/celestiaorg/go-fraud v0.2.1 h1:oYhxI0gM/EpGRgbVQdRI/LSlqyT65g/WhQGSVGfx09w= diff --git a/state/core_access.go b/state/core_access.go index 11eb72bea5..caaaa2feff 100644 --- a/state/core_access.go +++ b/state/core_access.go @@ -7,7 +7,6 @@ import ( "sync" "time" - sdkErrors "cosmossdk.io/errors" nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -239,20 +238,10 @@ func (ca *CoreAccessor) SubmitPayForBlob( if feeGrant != nil { opts = append(opts, feeGrant) } - response, err := ca.client.BroadcastPayForBlobWithAccount( - ctx, - accName, - appblobs, - opts..., - ) - if err != nil { - return nil, err - } - // TODO @vgonkivs: remove me to achieve async blob submission - response, err = ca.client.ConfirmTx(ctx, response.TxHash) - // the node is capable of changing the min gas price at any time so we must be able to detect it and - // update our version accordingly + response, err := ca.client.SubmitPayForBlobWithAccount(ctx, accName, appblobs, opts...) + // Network min gas price can be updated through governance in app + // If that's the case, we parse the insufficient min gas price error message and update the gas price if apperrors.IsInsufficientMinGasPrice(err) { // The error message contains enough information to parse the new min gas price gasPrice, err = apperrors.ParseInsufficientMinGasPrice(err, gasPrice, gas) @@ -265,15 +254,15 @@ func (ca *CoreAccessor) SubmitPayForBlob( continue } - // metrics should only be counted on a successful PFD tx - if err == nil && response.Code == 0 { - ca.markSuccessfulPFB() + if err != nil { + return nil, err } - if response != nil && response.Code != 0 { - err = errors.Join(err, sdkErrors.ABCIError(response.Codespace, response.Code, response.Logs.String())) + // metrics should only be counted on a successful PFD tx + if response.Code == 0 { + ca.markSuccessfulPFB() } - return unsetTx(response), err + return convertToSdkTxResponse(response), nil } return nil, fmt.Errorf("failed to submit blobs after %d attempts: %w", maxRetries, lastErr) } @@ -632,7 +621,7 @@ func (ca *CoreAccessor) submitMsg( } resp, err := ca.client.SubmitTx(ctx, []sdktypes.Msg{msg}, txConfig...) - return unsetTx(resp), err + return convertToSdkTxResponse(resp), err } func (ca *CoreAccessor) getSigner(cfg *TxConfig) (AccAddress, error) { @@ -646,16 +635,12 @@ func (ca *CoreAccessor) getSigner(cfg *TxConfig) (AccAddress, error) { } } -// THIS IS A TEMPORARY SOLUTION!!! -// unsetTx helps to fix issue in TxResponse marshaling. Marshaling TxReponse -// fails because `TxResponse.Tx` is not empty but does not contain respective codec -// for encoding using the standard `json.MarshalJSON()`. It becomes empty when -// https://github.com/celestiaorg/celestia-core/issues/1281 will be merged. -// The `TxResponse.Tx` contains the transaction that is sent to the cosmos-sdk in the form -// in which it is processed there, so the user should not be aware of it. -func unsetTx(txResponse *TxResponse) *TxResponse { - if txResponse != nil && txResponse.Tx != nil { - txResponse.Tx = nil - } - return txResponse +// convertToTxResponse converts the user.TxResponse to sdk.TxResponse. +// This is a temporary workaround in order to avoid breaking the api. +func convertToSdkTxResponse(resp *user.TxResponse) *TxResponse { + return &TxResponse{ + Code: resp.Code, + TxHash: resp.TxHash, + Height: resp.Height, + } }