Skip to content

Commit ff897c1

Browse files
committed
Merge branch 'Etna_upgrade' into 'main'
Etna upgrade See merge request flarenetwork/network/flare-p-chain-indexer!5
2 parents 2159558 + 2932be3 commit ff897c1

27 files changed

+423
-637
lines changed

README.md

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ api_key = "" # API key (in case the node is protected by API key), adds ?x-ap
6969
private_key_file = "../credentials/pk.txt" # file containing the private key of an account (for voting and mirroring clients), in hex
7070

7171
[p_chain_indexer]
72-
enabled = true # enable p-chain indexing
73-
timeout = "1000ms" # call avalanche p-chain indexer every ...
74-
batch_size = 10 # batch size to fetch from the node
75-
start_index = 0 # start indexing at this block height
72+
enabled = true # enable p-chain indexing
73+
timeout = "1000ms" # call avalanche p-chain indexer every ...
74+
batch_size = 10 # batch size to fetch from the node
75+
start_index = 0 # start indexing at this block height
7676

7777
[uptime_cronjob]
7878
enabled = false # enable uptime monitoring cronjob
@@ -85,16 +85,30 @@ uptime_threshold = 0.8 # minimum uptime ratio in the epoch for a validator to b
8585
delete_old_uptimes_epoch_threshold = 5 # delete uptimes older than this epoch
8686

8787
[voting_cronjob]
88-
enabled = false # enable voting client
89-
timeout = "10s" # check for new epochs every ...
90-
first = 12345 # first epoch to vote for
91-
delay = "10s" # min delay in seconds to send the vote after the epoch ends
88+
enabled = false # enable voting client
89+
timeout = "10s" # check for new epochs every ...
90+
first = 12345 # first epoch to vote for
91+
delay = "10s" # min delay in seconds to send the vote after the epoch ends
92+
93+
[voting_cronjob.gas]
94+
gas_limit = 120000 # Gas limit to set for the transaction execution (empty = estimate)
95+
96+
# type 0 transaction options
97+
# gas_price = ... # Create type 0 transaction: gas price to use for the transaction execution (empty = gas price oracle)
98+
99+
# type 2 transaction (EIP-1559) options
100+
# gas_fee_cap = ... # Gas fee cap to use for the 1559 transaction (type 2) execution (empty = gas price oracle)
101+
# gas_tip_cap = ... # Gas priority fee cap to use for the 1559 transaction (type 2) execution (empty = gas price oracle)
92102

93103
[mirroring_cronjob]
94-
enabled = false # enable mirroring client
95-
timeout = "10s" # check for new epochs every ... seconds
96-
first = 12345 # first epoch to mirror
97-
delay = "10s" # min delay in seconds to send the vote after the epoch ends
104+
enabled = false # enable mirroring client
105+
timeout = "10s" # check for new epochs every ... seconds
106+
first = 12345 # first epoch to mirror
107+
delay = "10s" # min delay in seconds to send the vote after the epoch ends
108+
109+
[mirroring_cronjob.gas]
110+
gas_limit = 1000000
111+
# see voting_cronjob.gas for other gas options
98112

99113
[contract_addresses]
100114
voting = "0xf956df3800379fdFA31D0A45FDD5001D02F4109c" # voting contract address

config.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,32 @@ timeout = "10s"
5858
# first epoch to be voted for (do not leave this empty since the first epoch is well back in time)
5959
first = 1111
6060

61+
[voting_cronjob.gas]
62+
gas_limit = 120000
63+
64+
# type 0
65+
# gas_price =
66+
67+
# type 2
68+
# gas_fee_cap =
69+
# gas_tip_cap =
70+
6171
[mirroring_cronjob]
6272
enabled = false
6373
timeout = "10s"
6474
# first epoch to be voted for (do not leave this empty since the first epoch is well back in time)
6575
first = 1111
6676

77+
[mirroring_cronjob.gas]
78+
gas_limit = 1000000
79+
80+
# type 0
81+
# gas_price =
82+
83+
# type 2
84+
# gas_fee_cap =
85+
# gas_tip_cap =
86+
6787
[contract_addresses]
6888
mirroring = "0x0000000"
6989
voting = "0x0000000"

config/config.go

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package config
22

33
import (
4+
"context"
45
"fmt"
56
"log"
67
"net/url"
@@ -10,7 +11,7 @@ import (
1011
"github.com/BurntSushi/toml"
1112
"github.com/ethereum/go-ethereum/common"
1213
"github.com/ethereum/go-ethereum/ethclient"
13-
"github.com/kelseyhightower/envconfig"
14+
"github.com/sethvargo/go-envconfig"
1415
)
1516

1617
const (
@@ -36,24 +37,24 @@ type LoggerConfig struct {
3637
}
3738

3839
type DBConfig struct {
39-
Host string `toml:"host" envconfig:"DB_HOST"`
40-
Port int `toml:"port" envconfig:"DB_PORT"`
41-
Database string `toml:"database" envconfig:"DB_DATABASE"`
42-
Username string `toml:"username" envconfig:"DB_USERNAME"`
43-
Password string `toml:"password" envconfig:"DB_PASSWORD"`
40+
Host string `toml:"host" env:"DB_HOST"`
41+
Port int `toml:"port" env:"DB_PORT"`
42+
Database string `toml:"database" env:"DB_DATABASE"`
43+
Username string `toml:"username" env:"DB_USERNAME"`
44+
Password string `toml:"password" env:"DB_PASSWORD"`
4445
LogQueries bool `toml:"log_queries"`
4546
}
4647

4748
type ChainConfig struct {
48-
NodeURL string `toml:"node_url" envconfig:"CHAIN_NODE_URL"`
49-
ChainAddressHRP string `toml:"address_hrp" envconfig:"CHAIN_ADDRESS_HRP"`
50-
ChainID int `toml:"chain_id" envconfig:"CHAIN_ID"`
51-
EthRPCURL string `toml:"eth_rpc_url" envconfig:"ETH_RPC_URL"`
52-
ApiKey string `toml:"api_key" envconfig:"API_KEY"`
49+
NodeURL string `toml:"node_url" env:"CHAIN_NODE_URL"`
50+
ChainAddressHRP string `toml:"address_hrp" env:"CHAIN_ADDRESS_HRP"`
51+
ChainID int `toml:"chain_id" env:"CHAIN_ID"`
52+
EthRPCURL string `toml:"eth_rpc_url" env:"ETH_RPC_URL"`
53+
ApiKey string `toml:"api_key" env:"API_KEY"`
5354
// setting the private key in config file is deprecated, except in development and testing
5455
// use private_key_file instead
55-
PrivateKey string `toml:"private_key" envconfig:"PRIVATE_KEY"`
56-
PrivateKeyFile string `toml:"private_key_file" envconfig:"PRIVATE_KEY_FILE"`
56+
PrivateKey string `toml:"private_key" env:"PRIVATE_KEY"`
57+
PrivateKeyFile string `toml:"private_key_file" env:"PRIVATE_KEY_FILE"`
5758
}
5859

5960
func (cfg ChainConfig) GetPrivateKey() (string, error) {
@@ -99,11 +100,11 @@ func (chain *ChainConfig) getRPCURL() (string, error) {
99100
}
100101

101102
type EpochConfig struct {
102-
First int64 `toml:"first" envconfig:"EPOCH_FIRST"`
103+
First int64 `toml:"first" env:"EPOCH_FIRST"`
103104
}
104105

105106
type ContractAddresses struct {
106-
Voting common.Address `toml:"voting" envconfig:"VOTING_CONTRACT_ADDRESS"`
107+
Voting common.Address `toml:"voting" env:"VOTING_CONTRACT_ADDRESS, default=0x0000000000000000000000000000000000000000"`
107108
}
108109

109110
func ParseConfigFile(cfg interface{}, fileName string, allowMissing bool) error {
@@ -124,7 +125,7 @@ func ParseConfigFile(cfg interface{}, fileName string, allowMissing bool) error
124125
}
125126

126127
func ReadEnv(cfg interface{}) error {
127-
err := envconfig.Process("", cfg)
128+
err := envconfig.Process(context.Background(), cfg)
128129
if err != nil {
129130
return fmt.Errorf("error reading env config: %w", err)
130131
}

database/methods.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,3 @@ func (out TxOutput) Tx() string {
2323
func (out TxOutput) Index() uint32 {
2424
return out.Idx
2525
}
26-
27-
func (in TxInput) Addr() string {
28-
return in.Address
29-
}
30-
31-
func (in TxInput) OutTx() string {
32-
return in.OutTxID
33-
}
34-
35-
func (in TxInput) OutIndex() uint32 {
36-
return in.OutIdx
37-
}
38-
39-
func (in *TxInput) UpdateAddr(addr string) {
40-
in.Address = addr
41-
}

database/types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ const (
2828
PChainAddPermissionlessValidatorTx PChainTxType = "ADD_PERMISSIONLESS_VALIDATOR_TX"
2929
PChainAddPermissionlessDelegatorTx PChainTxType = "ADD_PERMISSIONLESS_DELEGATOR_TX"
3030
PChainBaseTx PChainTxType = "BASE_TX"
31+
PChainConvertSubnetToL1Tx PChainTxType = "CONVERT_SUBNET_TO_L1_TX"
32+
PChainRegisterL1ValidatorTx PChainTxType = "REGISTER_L1_VALIDATOR_TX"
33+
PChainDisableL1ValidatorTx PChainTxType = "DISABLE_L1_VALIDATOR_TX"
34+
PChainSetL1ValidatorWeightTx PChainTxType = "SET_L1_VALIDATOR_WEIGHT_TX"
35+
PChainIncreaseL1ValidatorBalanceTx PChainTxType = "INCREASE_L1_VALIDATOR_BALANCE_TX"
3136
PChainUnknownTx PChainTxType = "UNKNOWN_TX"
3237
)
3338

docker/indexer/config_costwo_voting.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ enabled = true
4949
timeout = "10s"
5050
first = 183585 # from env EPOCH_FIRST
5151
delay = "10s"
52+
53+
[voting_cronjob.gas]
5254
gas_limit = 120000
5355

5456
[contract_addresses]

docker/indexer/config_flare_voting.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ enabled = true
5050
timeout = "10s"
5151
first = 211500
5252
delay = "10s"
53+
54+
[voting_cronjob.gas]
5355
gas_limit = 120000
5456

5557
[contract_addresses]

go.mod

Lines changed: 54 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
module flare-indexer
22

3-
go 1.22
3+
go 1.22.8
44

55
require (
6-
github.com/BurntSushi/toml v1.2.1
7-
github.com/ava-labs/avalanchego v1.11.1
8-
github.com/ava-labs/coreth v0.13.0-rc.0
6+
github.com/BurntSushi/toml v1.5.0
7+
github.com/ava-labs/avalanchego v1.12.0
8+
github.com/ava-labs/coreth v0.13.9-rc.1
99
github.com/bradleyjkemp/cupaloy v2.3.0+incompatible
1010
github.com/davidebianchi/gswagger v0.9.0
1111
github.com/deckarep/golang-set/v2 v2.1.0
12-
github.com/ethereum/go-ethereum v1.12.0
12+
github.com/ethereum/go-ethereum v1.13.14
1313
github.com/getkin/kin-openapi v0.115.0
1414
github.com/go-playground/validator/v10 v10.12.0
1515
github.com/go-sql-driver/mysql v1.7.0
1616
github.com/google/go-cmp v0.6.0
1717
github.com/gorilla/mux v1.8.0
18-
github.com/kelseyhightower/envconfig v1.4.0
1918
github.com/pkg/errors v0.9.1
20-
github.com/prometheus/client_golang v1.14.0
19+
github.com/prometheus/client_golang v1.16.0
2120
github.com/rs/cors v1.8.3
22-
github.com/stretchr/testify v1.8.4
21+
github.com/sethvargo/go-envconfig v1.3.0
22+
github.com/stretchr/testify v1.9.0
2323
github.com/swaggest/swgui v1.6.3
2424
github.com/ybbus/jsonrpc/v3 v3.1.1
2525
go.uber.org/zap v1.26.0
@@ -31,33 +31,39 @@ require (
3131

3232
require (
3333
github.com/DataDog/zstd v1.5.2 // indirect
34+
github.com/Microsoft/go-winio v0.6.1 // indirect
3435
github.com/NYTimes/gziphandler v1.1.1 // indirect
35-
github.com/VictoriaMetrics/fastcache v1.10.0 // indirect
36+
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
3637
github.com/beorn7/perks v1.0.1 // indirect
38+
github.com/bits-and-blooms/bitset v1.10.0 // indirect
3739
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
3840
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
39-
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
40-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
41+
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
42+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
43+
github.com/consensys/bavard v0.1.13 // indirect
44+
github.com/consensys/gnark-crypto v0.12.1 // indirect
45+
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
4146
github.com/davecgh/go-spew v1.1.1 // indirect
4247
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
48+
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
4349
github.com/fsnotify/fsnotify v1.6.0 // indirect
4450
github.com/ghodss/yaml v1.0.0 // indirect
45-
github.com/go-logr/logr v1.3.0 // indirect
51+
github.com/go-logr/logr v1.4.1 // indirect
4652
github.com/go-logr/stdr v1.2.2 // indirect
47-
github.com/go-ole/go-ole v1.2.6 // indirect
48-
github.com/go-openapi/jsonpointer v0.19.5 // indirect
49-
github.com/go-openapi/swag v0.21.1 // indirect
53+
github.com/go-ole/go-ole v1.3.0 // indirect
54+
github.com/go-openapi/jsonpointer v0.19.6 // indirect
55+
github.com/go-openapi/swag v0.22.3 // indirect
5056
github.com/go-playground/locales v0.14.1 // indirect
5157
github.com/go-playground/universal-translator v0.18.1 // indirect
52-
github.com/go-stack/stack v1.8.1 // indirect
53-
github.com/golang/protobuf v1.5.3 // indirect
58+
github.com/golang/protobuf v1.5.4 // indirect
5459
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
60+
github.com/google/btree v1.1.2 // indirect
5561
github.com/google/renameio/v2 v2.0.0 // indirect
56-
github.com/google/uuid v1.3.0 // indirect
62+
github.com/google/uuid v1.6.0 // indirect
5763
github.com/gorilla/rpc v1.2.0 // indirect
5864
github.com/gorilla/websocket v1.5.0 // indirect
59-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 // indirect
60-
github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect
65+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
66+
github.com/holiman/uint256 v1.2.4 // indirect
6167
github.com/iancoleman/orderedmap v0.2.0 // indirect
6268
github.com/invopop/yaml v0.2.0 // indirect
6369
github.com/jinzhu/inflection v1.0.0 // indirect
@@ -67,45 +73,47 @@ require (
6773
github.com/mailru/easyjson v0.7.7 // indirect
6874
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
6975
github.com/mia-platform/jsonschema v0.1.0 // indirect
76+
github.com/mmcloughlin/addchain v0.4.0 // indirect
7077
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
7178
github.com/mr-tron/base58 v1.2.0 // indirect
7279
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect
7380
github.com/perimeterx/marshmallow v1.1.4 // indirect
7481
github.com/pires/go-proxyproto v0.6.2 // indirect
7582
github.com/pmezard/go-difflib v1.0.0 // indirect
7683
github.com/prometheus/client_model v0.3.0 // indirect
77-
github.com/prometheus/common v0.39.0 // indirect
78-
github.com/prometheus/procfs v0.9.0 // indirect
84+
github.com/prometheus/common v0.42.0 // indirect
85+
github.com/prometheus/procfs v0.10.1 // indirect
7986
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
8087
github.com/shurcooL/httpgzip v0.0.0-20190720172056-320755c1c1b0 // indirect
81-
github.com/supranational/blst v0.3.11 // indirect
82-
github.com/tklauser/go-sysconf v0.3.11 // indirect
83-
github.com/tklauser/numcpus v0.6.0 // indirect
88+
github.com/supranational/blst v0.3.13 // indirect
89+
github.com/tklauser/go-sysconf v0.3.12 // indirect
90+
github.com/tklauser/numcpus v0.6.1 // indirect
8491
github.com/yusufpapurcu/wmi v1.2.2 // indirect
85-
go.opentelemetry.io/otel v1.11.2 // indirect
86-
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect
87-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 // indirect
88-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 // indirect
89-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.2 // indirect
90-
go.opentelemetry.io/otel/sdk v1.11.2 // indirect
91-
go.opentelemetry.io/otel/trace v1.11.2 // indirect
92-
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
92+
go.opentelemetry.io/otel v1.22.0 // indirect
93+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 // indirect
94+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.22.0 // indirect
95+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 // indirect
96+
go.opentelemetry.io/otel/metric v1.22.0 // indirect
97+
go.opentelemetry.io/otel/sdk v1.22.0 // indirect
98+
go.opentelemetry.io/otel/trace v1.22.0 // indirect
99+
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
93100
go.uber.org/mock v0.4.0 // indirect
94-
go.uber.org/multierr v1.10.0 // indirect
95-
golang.org/x/crypto v0.17.0 // indirect
96-
golang.org/x/net v0.19.0 // indirect
97-
golang.org/x/sync v0.5.0 // indirect
98-
golang.org/x/sys v0.15.0 // indirect
99-
golang.org/x/term v0.15.0 // indirect
100-
golang.org/x/text v0.14.0 // indirect
101+
go.uber.org/multierr v1.11.0 // indirect
102+
golang.org/x/crypto v0.26.0 // indirect
103+
golang.org/x/mod v0.17.0 // indirect
104+
golang.org/x/net v0.28.0 // indirect
105+
golang.org/x/sync v0.8.0 // indirect
106+
golang.org/x/sys v0.24.0 // indirect
107+
golang.org/x/term v0.23.0 // indirect
108+
golang.org/x/text v0.17.0 // indirect
101109
golang.org/x/time v0.3.0 // indirect
110+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
102111
gonum.org/v1/gonum v0.12.0 // indirect
103-
google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 // indirect
104-
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect
105-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
106-
google.golang.org/grpc v1.58.3 // indirect
107-
google.golang.org/protobuf v1.31.0 // indirect
108-
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
112+
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect
113+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect
114+
google.golang.org/grpc v1.66.0 // indirect
115+
google.golang.org/protobuf v1.34.2 // indirect
109116
gopkg.in/yaml.v2 v2.4.0 // indirect
110117
gopkg.in/yaml.v3 v3.0.1 // indirect
118+
rsc.io/tmplfunc v0.0.3 // indirect
111119
)

0 commit comments

Comments
 (0)