mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-08 03:46:52 +01:00
Compare commits
3 Commits
fix/packr-
...
hardcoded-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
714530e164 | ||
|
|
378ba669b6 | ||
|
|
3865c0a9eb |
13
.github/workflows/release.yml
vendored
13
.github/workflows/release.yml
vendored
@@ -9,19 +9,18 @@ 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
|
-
|
||||||
run: go get -u github.com/gobuffalo/packr
|
name: Run GoReleaser
|
||||||
- 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,8 +9,18 @@ builds:
|
|||||||
goos:
|
goos:
|
||||||
- linux
|
- linux
|
||||||
- darwin
|
- darwin
|
||||||
goarch:
|
- windows
|
||||||
- amd64
|
hooks:
|
||||||
|
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,7 +2,6 @@ package stateapiupdater
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/hermeznetwork/hermez-node/common"
|
"github.com/hermeznetwork/hermez-node/common"
|
||||||
@@ -24,7 +23,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 `validate:"required"`
|
PolicyType RecommendedFeePolicyType
|
||||||
StaticValue float64
|
StaticValue float64
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,9 +31,9 @@ type RecommendedFeePolicy struct {
|
|||||||
type RecommendedFeePolicyType string
|
type RecommendedFeePolicyType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// RecommendedFeePolicyTypeStatic always give the same StaticValue as recommended fee
|
// Always give the same StaticValue as recommended fee
|
||||||
RecommendedFeePolicyTypeStatic RecommendedFeePolicyType = "Static"
|
RecommendedFeePolicyTypeStatic RecommendedFeePolicyType = "Static"
|
||||||
// RecommendedFeePolicyTypeAvgLastHour set the recommended fee using the average fee of the last hour
|
// Set the recommended fee using the average fee of the last hour
|
||||||
RecommendedFeePolicyTypeAvgLastHour RecommendedFeePolicyType = "AvgLastHour"
|
RecommendedFeePolicyTypeAvgLastHour RecommendedFeePolicyType = "AvgLastHour"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -56,7 +55,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.Wrap(fmt.Errorf("Invalid recommended fee policy: %v", rfp.PolicyType))
|
return nil, tracerr.New("Invalid recommende fee policy")
|
||||||
}
|
}
|
||||||
u := Updater{
|
u := Updater{
|
||||||
hdb: hdb,
|
hdb: hdb,
|
||||||
|
|||||||
@@ -59,17 +59,21 @@ 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
|
- description: Hosted mock up, returns fake data useful for development
|
||||||
url: https://apimock.hermez.network/v1
|
url: https://apimock.hermez.network
|
||||||
- description: Localhost mock Up
|
- description: Localhost mock up, returns fake data useful for development
|
||||||
url: http://localhost:4010/v1
|
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
|
||||||
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:
|
||||||
'/account-creation-authorization':
|
'/v1/account-creation-authorization':
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- Coordinator
|
- Coordinator
|
||||||
@@ -99,7 +103,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/account-creation-authorization/{hezEthereumAddress}':
|
'/v1/account-creation-authorization/{hezEthereumAddress}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Coordinator
|
- Coordinator
|
||||||
@@ -139,7 +143,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/accounts':
|
'/v1/accounts':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -210,7 +214,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/accounts/{accountIndex}':
|
'/v1/accounts/{accountIndex}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -249,7 +253,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/exits':
|
'/v1/exits':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -336,7 +340,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/exits/{batchNum}/{accountIndex}':
|
'/v1/exits/{batchNum}/{accountIndex}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -381,7 +385,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/transactions-pool':
|
'/v1/transactions-pool':
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- Coordinator
|
- Coordinator
|
||||||
@@ -415,7 +419,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/transactions-pool/{id}':
|
'/v1/transactions-pool/{id}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Coordinator
|
- Coordinator
|
||||||
@@ -458,7 +462,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/transactions-history':
|
'/v1/transactions-history':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -548,7 +552,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/transactions-history/{id}':
|
'/v1/transactions-history/{id}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -588,7 +592,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/batches':
|
'/v1/batches':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -664,7 +668,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/batches/{batchNum}':
|
'/v1/batches/{batchNum}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -704,7 +708,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/full-batches/{batchNum}':
|
'/v1/full-batches/{batchNum}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -745,7 +749,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/slots':
|
'/v1/slots':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -821,7 +825,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/slots/{slotNum}':
|
'/v1/slots/{slotNum}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -861,7 +865,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/bids':
|
'/v1/bids':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -925,7 +929,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/state':
|
'/v1/state':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -951,7 +955,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/config':
|
'/v1/config':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -971,7 +975,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/tokens':
|
'/v1/tokens':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -1044,7 +1048,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/tokens/{id}':
|
'/v1/tokens/{id}':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
@@ -1083,7 +1087,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Error500'
|
$ref: '#/components/schemas/Error500'
|
||||||
'/coordinators':
|
'/v1/coordinators':
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Explorer
|
- Explorer
|
||||||
|
|||||||
@@ -365,6 +365,7 @@ 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