mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-06 19:06:42 +01:00
fix some code and comment typos
This commit is contained in:
@@ -44,7 +44,7 @@ func (a *API) getAccounts(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Build succesfull response
|
||||
// Build successful response
|
||||
type accountResponse struct {
|
||||
Accounts []historydb.AccountAPI `json:"accounts"`
|
||||
PendingItems uint64 `json:"pendingItems"`
|
||||
|
||||
@@ -47,7 +47,7 @@ func (a *API) getAccountCreationAuth(c *gin.Context) {
|
||||
retSQLErr(err, c)
|
||||
return
|
||||
}
|
||||
// Build succesfull response
|
||||
// Build successful response
|
||||
c.JSON(http.StatusOK, auth)
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ func TestMain(m *testing.M) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
apiConnCon := db.NewAPICnnectionController(1, time.Second)
|
||||
apiConnCon := db.NewAPIConnectionController(1, time.Second)
|
||||
hdb := historydb.NewHistoryDB(database, database, apiConnCon)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -260,7 +260,7 @@ func TestMain(m *testing.M) {
|
||||
// Reset DB
|
||||
test.WipeDB(api.h.DB())
|
||||
|
||||
// Genratre blockchain data with til
|
||||
// Generate blockchain data with til
|
||||
tcc := til.NewContext(chainID, common.RollupConstMaxL1UserTx)
|
||||
tilCfgExtra := til.ConfigExtra{
|
||||
BootCoordAddr: ethCommon.HexToAddress("0xE39fEc6224708f0772D2A74fd3f9055A90E0A9f2"),
|
||||
@@ -512,7 +512,7 @@ func TestMain(m *testing.M) {
|
||||
WithdrawalDelay: uint64(3000),
|
||||
}
|
||||
|
||||
// Generate test data, as expected to be received/sended from/to the API
|
||||
// Generate test data, as expected to be received/sent from/to the API
|
||||
testCoords := genTestCoordinators(commonCoords)
|
||||
testBids := genTestBids(commonBlocks, testCoords, bids)
|
||||
testExits := genTestExits(commonExitTree, testTokens, commonAccounts)
|
||||
@@ -599,7 +599,7 @@ func TestTimeout(t *testing.T) {
|
||||
pass := os.Getenv("POSTGRES_PASS")
|
||||
databaseTO, err := db.InitSQLDB(5432, "localhost", "hermez", pass, "hermez")
|
||||
require.NoError(t, err)
|
||||
apiConnConTO := db.NewAPICnnectionController(1, 100*time.Millisecond)
|
||||
apiConnConTO := db.NewAPIConnectionController(1, 100*time.Millisecond)
|
||||
hdbTO := historydb.NewHistoryDB(databaseTO, databaseTO, apiConnConTO)
|
||||
require.NoError(t, err)
|
||||
// L2DB
|
||||
|
||||
@@ -52,7 +52,7 @@ func (a *API) getBatches(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Build succesfull response
|
||||
// Build successful response
|
||||
type batchesResponse struct {
|
||||
Batches []historydb.BatchAPI `json:"batches"`
|
||||
PendingItems uint64 `json:"pendingItems"`
|
||||
|
||||
@@ -34,7 +34,7 @@ func (a *API) getBids(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Build succesfull response
|
||||
// Build successful response
|
||||
type bidsResponse struct {
|
||||
Bids []historydb.BidAPI `json:"bids"`
|
||||
PendingItems uint64 `json:"pendingItems"`
|
||||
|
||||
@@ -32,7 +32,7 @@ func (a *API) getCoordinators(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Build succesfull response
|
||||
// Build successful response
|
||||
type coordinatorsResponse struct {
|
||||
Coordinators []historydb.CoordinatorAPI `json:"coordinators"`
|
||||
PendingItems uint64 `json:"pendingItems"`
|
||||
|
||||
@@ -43,7 +43,7 @@ func (a *API) getExits(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Build succesfull response
|
||||
// Build successful response
|
||||
type exitsResponse struct {
|
||||
Exits []historydb.ExitAPI `json:"exits"`
|
||||
PendingItems uint64 `json:"pendingItems"`
|
||||
@@ -72,6 +72,6 @@ func (a *API) getExit(c *gin.Context) {
|
||||
retSQLErr(err, c)
|
||||
return
|
||||
}
|
||||
// Build succesfull response
|
||||
// Build successful response
|
||||
c.JSON(http.StatusOK, exit)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// maxLimit is the max permited items to be returned in paginated responses
|
||||
// maxLimit is the max permitted items to be returned in paginated responses
|
||||
maxLimit uint = 2049
|
||||
|
||||
// dfltOrder indicates how paginated endpoints are ordered if not specified
|
||||
@@ -40,8 +40,8 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrNillBidderAddr is used when a nil bidderAddr is received in the getCoordinator method
|
||||
ErrNillBidderAddr = errors.New("biderAddr can not be nil")
|
||||
// ErrNilBidderAddr is used when a nil bidderAddr is received in the getCoordinator method
|
||||
ErrNilBidderAddr = errors.New("biderAddr can not be nil")
|
||||
)
|
||||
|
||||
func retSQLErr(err error, c *gin.Context) {
|
||||
|
||||
@@ -50,19 +50,19 @@ func parsePagination(c querier) (fromItem *uint, order string, limit *uint, err
|
||||
return fromItem, order, limit, nil
|
||||
}
|
||||
|
||||
// nolint reason: res may be not overwriten
|
||||
// nolint reason: res may be not overwritten
|
||||
func parseQueryUint(name string, dflt *uint, min, max uint, c querier) (*uint, error) { //nolint:SA4009
|
||||
str := c.Query(name)
|
||||
return stringToUint(str, name, dflt, min, max)
|
||||
}
|
||||
|
||||
// nolint reason: res may be not overwriten
|
||||
// nolint reason: res may be not overwritten
|
||||
func parseQueryInt64(name string, dflt *int64, min, max int64, c querier) (*int64, error) { //nolint:SA4009
|
||||
str := c.Query(name)
|
||||
return stringToInt64(str, name, dflt, min, max)
|
||||
}
|
||||
|
||||
// nolint reason: res may be not overwriten
|
||||
// nolint reason: res may be not overwritten
|
||||
func parseQueryBool(name string, dflt *bool, c querier) (*bool, error) { //nolint:SA4009
|
||||
str := c.Query(name)
|
||||
if str == "" {
|
||||
@@ -295,13 +295,13 @@ func parseParamIdx(c paramer) (*common.Idx, error) {
|
||||
return stringToIdx(idxStr, name)
|
||||
}
|
||||
|
||||
// nolint reason: res may be not overwriten
|
||||
// nolint reason: res may be not overwritten
|
||||
func parseParamUint(name string, dflt *uint, min, max uint, c paramer) (*uint, error) { //nolint:SA4009
|
||||
str := c.Param(name)
|
||||
return stringToUint(str, name, dflt, min, max)
|
||||
}
|
||||
|
||||
// nolint reason: res may be not overwriten
|
||||
// nolint reason: res may be not overwritten
|
||||
func parseParamInt64(name string, dflt *int64, min, max int64, c paramer) (*int64, error) { //nolint:SA4009
|
||||
str := c.Param(name)
|
||||
return stringToInt64(str, name, dflt, min, max)
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/hermeznetwork/tracerr"
|
||||
)
|
||||
|
||||
// SlotAPI is a repesentation of a slot information
|
||||
// SlotAPI is a representation of a slot information
|
||||
type SlotAPI struct {
|
||||
ItemID uint64 `json:"itemId"`
|
||||
SlotNum int64 `json:"slotNum"`
|
||||
@@ -316,7 +316,7 @@ func (a *API) getSlots(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Build succesfull response
|
||||
// Build successful response
|
||||
type slotsResponse struct {
|
||||
Slots []SlotAPI `json:"slots"`
|
||||
PendingItems uint64 `json:"pendingItems"`
|
||||
|
||||
@@ -53,7 +53,7 @@ func (a *API) getTokens(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Build succesfull response
|
||||
// Build successful response
|
||||
type tokensResponse struct {
|
||||
Tokens []historydb.TokenWithUSD `json:"tokens"`
|
||||
PendingItems uint64 `json:"pendingItems"`
|
||||
|
||||
@@ -42,7 +42,7 @@ func (a *API) getHistoryTxs(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Build succesfull response
|
||||
// Build successful response
|
||||
type txsResponse struct {
|
||||
Txs []historydb.TxAPI `json:"transactions"`
|
||||
PendingItems uint64 `json:"pendingItems"`
|
||||
@@ -66,6 +66,6 @@ func (a *API) getHistoryTx(c *gin.Context) {
|
||||
retSQLErr(err, c)
|
||||
return
|
||||
}
|
||||
// Build succesfull response
|
||||
// Build successful response
|
||||
c.JSON(http.StatusOK, tx)
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ func TestGetHistoryTx(t *testing.T) {
|
||||
// 400, due invalid TxID
|
||||
err := doBadReq("GET", endpoint+"0x001", nil, 400)
|
||||
assert.NoError(t, err)
|
||||
// 404, due inexistent TxID in DB
|
||||
// 404, due nonexistent TxID in DB
|
||||
err = doBadReq("GET", endpoint+"0x00eb5e95e1ce5e9f6c4ed402d415e8d0bdd7664769cfd2064d28da04a2c76be432", nil, 404)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ func (a *API) getPoolTx(c *gin.Context) {
|
||||
retSQLErr(err, c)
|
||||
return
|
||||
}
|
||||
// Build succesfull response
|
||||
// Build successful response
|
||||
c.JSON(http.StatusOK, tx)
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ func TestPoolTxs(t *testing.T) {
|
||||
// 400, due invalid TxID
|
||||
err = doBadReq("GET", endpoint+"0xG2241b6f2b1dd772dba391f4a1a3407c7c21f598d86e2585a14e616fb4a255f823", nil, 400)
|
||||
require.NoError(t, err)
|
||||
// 404, due inexistent TxID in DB
|
||||
// 404, due nonexistent TxID in DB
|
||||
err = doBadReq("GET", endpoint+"0x02241b6f2b1dd772dba391f4a1a3407c7c21f598d86e2585a14e616fb4a255f823", nil, 404)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user