mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 11:26:44 +01:00
Compare commits
3 Commits
hardcoded-
...
fix/packr-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
628c582ea7 | ||
|
|
6c1c157bc3 | ||
|
|
f9ddf88c93 |
13
.github/workflows/release.yml
vendored
13
.github/workflows/release.yml
vendored
@@ -9,18 +9,19 @@ jobs:
|
|||||||
goreleaser:
|
goreleaser:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
- name: Set up Go
|
||||||
name: Set up Go
|
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.16
|
go-version: 1.16
|
||||||
-
|
- name: Get packr
|
||||||
name: Run GoReleaser
|
run: go get -u github.com/gobuffalo/packr
|
||||||
|
- name: Prepare
|
||||||
|
run: git reset --hard
|
||||||
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v2
|
uses: goreleaser/goreleaser-action@v2
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
|
|||||||
@@ -9,18 +9,8 @@ builds:
|
|||||||
goos:
|
goos:
|
||||||
- linux
|
- linux
|
||||||
- darwin
|
- darwin
|
||||||
- windows
|
goarch:
|
||||||
hooks:
|
- amd64
|
||||||
pre: make migration-pack
|
|
||||||
post: make migration-clean
|
|
||||||
|
|
||||||
archives:
|
|
||||||
- replacements:
|
|
||||||
darwin: Darwin
|
|
||||||
linux: Linux
|
|
||||||
windows: Windows
|
|
||||||
386: i386
|
|
||||||
amd64: x86_64
|
|
||||||
|
|
||||||
checksum:
|
checksum:
|
||||||
name_template: 'checksums.txt'
|
name_template: 'checksums.txt'
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package stateapiupdater
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/hermeznetwork/hermez-node/common"
|
"github.com/hermeznetwork/hermez-node/common"
|
||||||
@@ -23,7 +24,7 @@ type Updater struct {
|
|||||||
|
|
||||||
// RecommendedFeePolicy describes how the recommended fee is calculated
|
// RecommendedFeePolicy describes how the recommended fee is calculated
|
||||||
type RecommendedFeePolicy struct {
|
type RecommendedFeePolicy struct {
|
||||||
PolicyType RecommendedFeePolicyType
|
PolicyType RecommendedFeePolicyType `validate:"required"`
|
||||||
StaticValue float64
|
StaticValue float64
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,9 +32,9 @@ type RecommendedFeePolicy struct {
|
|||||||
type RecommendedFeePolicyType string
|
type RecommendedFeePolicyType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Always give the same StaticValue as recommended fee
|
// RecommendedFeePolicyTypeStatic always give the same StaticValue as recommended fee
|
||||||
RecommendedFeePolicyTypeStatic RecommendedFeePolicyType = "Static"
|
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"
|
RecommendedFeePolicyTypeAvgLastHour RecommendedFeePolicyType = "AvgLastHour"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ func (rfp *RecommendedFeePolicy) valid() bool {
|
|||||||
func NewUpdater(hdb *historydb.HistoryDB, config *historydb.NodeConfig, vars *common.SCVariables,
|
func NewUpdater(hdb *historydb.HistoryDB, config *historydb.NodeConfig, vars *common.SCVariables,
|
||||||
consts *historydb.Constants, rfp *RecommendedFeePolicy) (*Updater, error) {
|
consts *historydb.Constants, rfp *RecommendedFeePolicy) (*Updater, error) {
|
||||||
if ok := rfp.valid(); !ok {
|
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{
|
u := Updater{
|
||||||
hdb: hdb,
|
hdb: hdb,
|
||||||
|
|||||||
@@ -59,21 +59,17 @@ externalDocs:
|
|||||||
description: Find out more about Hermez network.
|
description: Find out more about Hermez network.
|
||||||
url: 'https://hermez.io'
|
url: 'https://hermez.io'
|
||||||
servers:
|
servers:
|
||||||
- description: Hosted mock up, returns fake data useful for development
|
- description: Hosted mock up
|
||||||
url: https://apimock.hermez.network
|
url: https://apimock.hermez.network/v1
|
||||||
- description: Localhost mock up, returns fake data useful for development
|
- description: Localhost mock Up
|
||||||
url: http://localhost:4010
|
url: http://localhost:4010/v1
|
||||||
- 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
|
|
||||||
tags:
|
tags:
|
||||||
- name: Coordinator
|
- name: Coordinator
|
||||||
description: Endpoints used by the nodes running in coordinator mode. They are used to interact with the network.
|
description: Endpoints used by the nodes running in coordinator mode. They are used to interact with the network.
|
||||||
- name: Explorer
|
- name: Explorer
|
||||||
description: Endpoints used by the nodes running in explorer mode. They are used to get information of the netwrok.
|
description: Endpoints used by the nodes running in explorer mode. They are used to get information of the netwrok.
|
||||||
paths:
|
paths:
|
||||||
'/v1/account-creation-authorization':
|
'/account-creation-authorization':
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- Coordinator
|
- Coordinator
|
||||||
@@ -103,7 +99,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/account-creation-authorization/{hezEthereumAddress}':
|
'/account-creation-authorization/{hezEthereumAddress}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Coordinator
|
- Coordinator
|
||||||
@@ -143,7 +139,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/accounts':
|
'/accounts':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -214,7 +210,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/accounts/{accountIndex}':
|
'/accounts/{accountIndex}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -253,7 +249,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/exits':
|
'/exits':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -340,7 +336,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/exits/{batchNum}/{accountIndex}':
|
'/exits/{batchNum}/{accountIndex}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -385,7 +381,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/transactions-pool':
|
'/transactions-pool':
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- Coordinator
|
- Coordinator
|
||||||
@@ -419,7 +415,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/transactions-pool/{id}':
|
'/transactions-pool/{id}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Coordinator
|
- Coordinator
|
||||||
@@ -462,7 +458,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/transactions-history':
|
'/transactions-history':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -552,7 +548,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/transactions-history/{id}':
|
'/transactions-history/{id}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -592,7 +588,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/batches':
|
'/batches':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -668,7 +664,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/batches/{batchNum}':
|
'/batches/{batchNum}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -708,7 +704,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/full-batches/{batchNum}':
|
'/full-batches/{batchNum}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -749,7 +745,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/slots':
|
'/slots':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -825,7 +821,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/slots/{slotNum}':
|
'/slots/{slotNum}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -865,7 +861,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/bids':
|
'/bids':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -929,7 +925,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/state':
|
'/state':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -955,7 +951,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/config':
|
'/config':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -975,7 +971,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/tokens':
|
'/tokens':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -1048,7 +1044,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/tokens/{id}':
|
'/tokens/{id}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -1087,7 +1083,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/v1/coordinators':
|
'/coordinators':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
|
|||||||
@@ -365,7 +365,6 @@ func getConfig(c *cli.Context) (*Config, error) {
|
|||||||
}
|
}
|
||||||
case modeCoord:
|
case modeCoord:
|
||||||
cfg.mode = node.ModeCoordinator
|
cfg.mode = node.ModeCoordinator
|
||||||
fmt.Println("LOADING CFG")
|
|
||||||
cfg.node, err = config.LoadNode(nodeCfgPath, true)
|
cfg.node, err = config.LoadNode(nodeCfgPath, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, tracerr.Wrap(err)
|
return nil, tracerr.Wrap(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user