Compare commits

..

6 Commits

Author SHA1 Message Date
arnau
e2bae9a13c Merge pull request #669 from hermeznetwork/fix/mockserer
Fix mock server
2021-03-30 11:41:26 +02:00
Danilo Pantani
b8d339d568 Merge pull request #670 from hermeznetwork/fix/remove-release-os
fix the invalid goarch build
2021-03-26 16:16:29 -03:00
arnaubennassar
e52ba3d258 Fix mock server 2021-03-26 13:27:05 +01:00
Eduard S
6c1c157bc3 Merge pull request #672 from hermeznetwork/feature/configurable-recommendedfee-strategy
Add configuration option to choose recommended fee strategy, and add …
2021-03-25 12:22:57 +01:00
arnaubennassar
f9ddf88c93 Add configuration option to choose recommended fee strategy, and add static strategy 2021-03-25 12:13:04 +01:00
Pantani
a1eea43443 fix the invalid goarch build and avoid calling the migration-pack each build 2021-03-24 10:41:32 -03:00
5 changed files with 35 additions and 39 deletions

3
.gitignore vendored
View File

@@ -1 +1,2 @@
bin/
bin/
dist/

View File

@@ -1,6 +1,7 @@
before:
hooks:
- go mod download
- make migration-pack
builds:
- main: ./cli/node/main.go
@@ -9,10 +10,8 @@ builds:
goos:
- linux
- darwin
- windows
hooks:
pre: make migration-pack
post: make migration-clean
goarch:
- amd64
archives:
- replacements:

View File

@@ -2,6 +2,7 @@ package stateapiupdater
import (
"database/sql"
"fmt"
"sync"
"github.com/hermeznetwork/hermez-node/common"
@@ -23,7 +24,7 @@ type Updater struct {
// RecommendedFeePolicy describes how the recommended fee is calculated
type RecommendedFeePolicy struct {
PolicyType RecommendedFeePolicyType
PolicyType RecommendedFeePolicyType `validate:"required"`
StaticValue float64
}
@@ -31,9 +32,9 @@ type RecommendedFeePolicy struct {
type RecommendedFeePolicyType string
const (
// Always give the same StaticValue as recommended fee
// RecommendedFeePolicyTypeStatic always give the same StaticValue as recommended fee
RecommendedFeePolicyTypeStatic RecommendedFeePolicyType = "Static"
// Set the recommended fee using the average fee of the last hour
// RecommendedFeePolicyTypeAvgLastHour set the recommended fee using the average fee of the last hour
RecommendedFeePolicyTypeAvgLastHour RecommendedFeePolicyType = "AvgLastHour"
)
@@ -55,7 +56,7 @@ func (rfp *RecommendedFeePolicy) valid() bool {
func NewUpdater(hdb *historydb.HistoryDB, config *historydb.NodeConfig, vars *common.SCVariables,
consts *historydb.Constants, rfp *RecommendedFeePolicy) (*Updater, error) {
if ok := rfp.valid(); !ok {
return nil, tracerr.New("Invalid recommende fee policy")
return nil, tracerr.Wrap(fmt.Errorf("Invalid recommended fee policy: %v", rfp.PolicyType))
}
u := Updater{
hdb: hdb,

View File

@@ -59,21 +59,17 @@ externalDocs:
description: Find out more about Hermez network.
url: 'https://hermez.io'
servers:
- description: Hosted mock up, returns fake data useful for development
url: https://apimock.hermez.network
- description: Localhost mock up, returns fake data useful for development
url: http://localhost:4010
- description: Testnet (Rinkeby) server
url: https://api.testnet.hermez.io
- description: Mainnet (Ethereum) server, use it carefully, specially if attempting to send transactions. You could lose money!
url: https://api.hermez.io
- description: Testnet api, connected to Rinkeby deployment
url: https://api.testnet.hermez.io/v1
- description: Localhost usefull for testing/developing the api
url: http://localhost:4010/v1
tags:
- name: Coordinator
description: Endpoints used by the nodes running in coordinator mode. They are used to interact with the network.
- name: Explorer
description: Endpoints used by the nodes running in explorer mode. They are used to get information of the netwrok.
paths:
'/v1/account-creation-authorization':
'/account-creation-authorization':
post:
tags:
- Coordinator
@@ -103,7 +99,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/account-creation-authorization/{hezEthereumAddress}':
'/account-creation-authorization/{hezEthereumAddress}':
get:
tags:
- Coordinator
@@ -143,7 +139,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/accounts':
'/accounts':
get:
tags:
- Explorer
@@ -214,7 +210,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/accounts/{accountIndex}':
'/accounts/{accountIndex}':
get:
tags:
- Explorer
@@ -253,7 +249,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/exits':
'/exits':
get:
tags:
- Explorer
@@ -340,7 +336,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/exits/{batchNum}/{accountIndex}':
'/exits/{batchNum}/{accountIndex}':
get:
tags:
- Explorer
@@ -385,7 +381,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/transactions-pool':
'/transactions-pool':
post:
tags:
- Coordinator
@@ -419,7 +415,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/transactions-pool/{id}':
'/transactions-pool/{id}':
get:
tags:
- Coordinator
@@ -462,7 +458,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/transactions-history':
'/transactions-history':
get:
tags:
- Explorer
@@ -552,7 +548,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/transactions-history/{id}':
'/transactions-history/{id}':
get:
tags:
- Explorer
@@ -592,7 +588,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/batches':
'/batches':
get:
tags:
- Explorer
@@ -668,7 +664,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/batches/{batchNum}':
'/batches/{batchNum}':
get:
tags:
- Explorer
@@ -708,7 +704,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/full-batches/{batchNum}':
'/full-batches/{batchNum}':
get:
tags:
- Explorer
@@ -749,7 +745,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/slots':
'/slots':
get:
tags:
- Explorer
@@ -825,7 +821,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/slots/{slotNum}':
'/slots/{slotNum}':
get:
tags:
- Explorer
@@ -865,7 +861,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/bids':
'/bids':
get:
tags:
- Explorer
@@ -929,7 +925,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/state':
'/state':
get:
tags:
- Explorer
@@ -955,7 +951,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/config':
'/config':
get:
tags:
- Explorer
@@ -975,7 +971,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/tokens':
'/tokens':
get:
tags:
- Explorer
@@ -1048,7 +1044,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/tokens/{id}':
'/tokens/{id}':
get:
tags:
- Explorer
@@ -1087,7 +1083,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
'/v1/coordinators':
'/coordinators':
get:
tags:
- Explorer

View File

@@ -365,7 +365,6 @@ func getConfig(c *cli.Context) (*Config, error) {
}
case modeCoord:
cfg.mode = node.ModeCoordinator
fmt.Println("LOADING CFG")
cfg.node, err = config.LoadNode(nodeCfgPath, true)
if err != nil {
return nil, tracerr.Wrap(err)