chore: gofumpt (#11839)
* fumpt using main not master... * be more descriptive * fumpt * fix nits Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
co-authored by
Julien Robert
parent
bc2d553f77
commit
55054282d2
@@ -206,7 +206,6 @@ func (c converter) UnsignedTx(ops []*rosettatypes.Operation) (tx authsigning.Tx,
|
||||
}
|
||||
|
||||
return builder.GetTx(), nil
|
||||
|
||||
}
|
||||
|
||||
// Msg unmarshals the rosetta metadata to the given sdk.Msg
|
||||
@@ -328,7 +327,6 @@ func (c converter) BalanceOps(status string, events []abci.Event) []*rosettatype
|
||||
// has changed and rosetta needs to reflect those changes too.
|
||||
// The balance operations are multiple, one for each denom.
|
||||
func sdkEventToBalanceOperations(status string, event abci.Event) (operations []*rosettatypes.Operation, isBalanceEvent bool) {
|
||||
|
||||
var (
|
||||
accountIdentifier string
|
||||
coinChange sdk.Coins
|
||||
@@ -510,7 +508,7 @@ func (c converter) HashToTxType(hashBytes []byte) (txType TransactionType, realH
|
||||
// StatusToSyncStatus converts a tendermint status to rosetta sync status
|
||||
func (c converter) SyncStatus(status *tmcoretypes.ResultStatus) *rosettatypes.SyncStatus {
|
||||
// determine sync status
|
||||
var stage = StatusPeerSynced
|
||||
stage := StatusPeerSynced
|
||||
if status.SyncInfo.CatchingUp {
|
||||
stage = StatusPeerSyncing
|
||||
}
|
||||
@@ -578,7 +576,6 @@ func (c converter) Peers(peers []tmcoretypes.Peer) []*rosettatypes.Peer {
|
||||
// OpsAndSigners takes transactions bytes and returns the operation, is signed is true it will return
|
||||
// the account identifiers which have signed the transaction
|
||||
func (c converter) OpsAndSigners(txBytes []byte) (ops []*rosettatypes.Operation, signers []*rosettatypes.AccountIdentifier, err error) {
|
||||
|
||||
rosTx, err := c.ToRosetta().Tx(txBytes, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -672,7 +669,6 @@ func (c converter) PubKey(pubKey *rosettatypes.PublicKey) (cryptotypes.PubKey, e
|
||||
|
||||
// SigningComponents takes a sdk tx and construction metadata and returns signable components
|
||||
func (c converter) SigningComponents(tx authsigning.Tx, metadata *ConstructionMetadata, rosPubKeys []*rosettatypes.PublicKey) (txBytes []byte, payloadsToSign []*rosettatypes.SigningPayload, err error) {
|
||||
|
||||
// verify metadata correctness
|
||||
feeAmount, err := sdk.ParseCoinsNormalized(metadata.GasPrice)
|
||||
if err != nil {
|
||||
|
||||
@@ -92,7 +92,6 @@ func (s *ConverterTestSuite) TestFromRosettaOpsToTxSuccess() {
|
||||
|
||||
s.Require().Equal(getMsgs[0], msg1)
|
||||
s.Require().Equal(getMsgs[1], msg2)
|
||||
|
||||
}
|
||||
|
||||
func (s *ConverterTestSuite) TestFromRosettaOpsToTxErrors() {
|
||||
@@ -114,9 +113,7 @@ func (s *ConverterTestSuite) TestFromRosettaOpsToTxErrors() {
|
||||
_, err := s.c.ToSDK().UnsignedTx([]*rosettatypes.Operation{op})
|
||||
|
||||
s.Require().ErrorIs(err, crgerrs.ErrBadArgument)
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func (s *ConverterTestSuite) TestMsgToMetaMetaToMsg() {
|
||||
@@ -137,7 +134,6 @@ func (s *ConverterTestSuite) TestMsgToMetaMetaToMsg() {
|
||||
}
|
||||
|
||||
func (s *ConverterTestSuite) TestSignedTx() {
|
||||
|
||||
s.Run("success", func() {
|
||||
const payloadsJSON = `[{"hex_bytes":"82ccce81a3e4a7272249f0e25c3037a316ee2acce76eb0c25db00ef6634a4d57303b2420edfdb4c9a635ad8851fe5c7a9379b7bc2baadc7d74f7e76ac97459b5","signing_payload":{"address":"cosmos147klh7th5jkjy3aajsj2rqvhtvh9mfde37wq5g","hex_bytes":"ed574d84b095250280de38bf8c254e4a1f8755e5bd300b1f6ca2671688136ecc","account_identifier":{"address":"cosmos147klh7th5jkjy3aajsj2rqvhtvh9mfde37wq5g"},"signature_type":"ecdsa"},"public_key":{"hex_bytes":"034c92046950c876f4a5cb6c7797d6eeb9ef80d67ced4d45fb62b1e859240ba9ad","curve_type":"secp256k1"},"signature_type":"ecdsa"}]`
|
||||
const expectedSignedTxHex = "0a8e010a8b010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126b0a2d636f736d6f733134376b6c68377468356a6b6a793361616a736a3272717668747668396d666465333777713567122d636f736d6f73316d6e7670386c786b616679346c787777617175356561653764787630647a36687767797436331a0b0a057374616b651202313612620a4e0a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034c92046950c876f4a5cb6c7797d6eeb9ef80d67ced4d45fb62b1e859240ba9ad12040a02087f12100a0a0a057374616b651201311090a10f1a4082ccce81a3e4a7272249f0e25c3037a316ee2acce76eb0c25db00ef6634a4d57303b2420edfdb4c9a635ad8851fe5c7a9379b7bc2baadc7d74f7e76ac97459b5"
|
||||
@@ -291,7 +287,6 @@ func (s *ConverterTestSuite) TestSigningComponents() {
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func (s *ConverterTestSuite) TestBalanceOps() {
|
||||
|
||||
@@ -30,7 +30,6 @@ func TestRegisterError(t *testing.T) {
|
||||
// add a new error on a sealed registry
|
||||
error = RegisterError(1024, "bytes", false, "bytes")
|
||||
assert.NotNil(t, error)
|
||||
|
||||
}
|
||||
|
||||
func TestError_Error(t *testing.T) {
|
||||
@@ -58,12 +57,12 @@ func TestToRosetta(t *testing.T) {
|
||||
assert.NotNil(t, ToRosetta(&MyError{}))
|
||||
}
|
||||
|
||||
type MyError struct {
|
||||
}
|
||||
type MyError struct{}
|
||||
|
||||
func (e *MyError) Error() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (e *MyError) Is(err error) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -129,7 +129,6 @@ func (on OnlineNetwork) ConstructionParse(ctx context.Context, request *types.Co
|
||||
AccountIdentifierSigners: signers,
|
||||
Metadata: nil,
|
||||
}, nil
|
||||
|
||||
}
|
||||
|
||||
// ConstructionPayloads Payloads is called with an array of operations and the response from
|
||||
|
||||
@@ -13,8 +13,10 @@ import (
|
||||
crgtypes "github.com/cosmos/cosmos-sdk/server/rosetta/lib/types"
|
||||
)
|
||||
|
||||
const DefaultRetries = 5
|
||||
const DefaultRetryWait = 5 * time.Second
|
||||
const (
|
||||
DefaultRetries = 5
|
||||
DefaultRetryWait = 5 * time.Second
|
||||
)
|
||||
|
||||
// Settings define the rosetta server settings
|
||||
type Settings struct {
|
||||
@@ -55,9 +57,7 @@ func NewServer(settings Settings) (Server, error) {
|
||||
return Server{}, fmt.Errorf("cannot build asserter: %w", err)
|
||||
}
|
||||
|
||||
var (
|
||||
adapter crgtypes.API
|
||||
)
|
||||
var adapter crgtypes.API
|
||||
switch settings.Offline {
|
||||
case true:
|
||||
adapter, err = newOfflineAdapter(settings)
|
||||
|
||||
Reference in New Issue
Block a user