Skip to content

Commit 8cce4b1

Browse files
Rosetta Etna upgrade - Dynamic fee suggestions (#248)
* update to etna fuji rc * dynamic fee calculation * CI fix * lint * new tx types parsing * calculate fee in metadata step * avalanchego 1.12.0 * test fixes * lint * lint * lint * review changes * mock fee state * skip L1 deactivation change utxos * nits * go version minor upgrade
1 parent 4817571 commit 8cce4b1

File tree

19 files changed

+445
-210
lines changed

19 files changed

+445
-210
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,32 @@ on:
77
pull_request:
88

99
env:
10-
go_version: '~1.21.7'
10+
go_version: '~1.22.10'
1111

1212
jobs:
1313
Build:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717
- uses: actions/setup-go@v2
1818
with:
1919
go-version: ${{ env.go_version }}
2020
- run: make build
2121
Test:
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v2
25-
- uses: actions/setup-go@v2
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-go@v4
2626
with:
2727
go-version: ${{ env.go_version }}
2828
- run: make test
2929
Lint:
3030
runs-on: ubuntu-latest
3131
steps:
32-
- uses: actions/checkout@v2
33-
- uses: golangci/golangci-lint-action@v2
32+
- uses: actions/checkout@v4
33+
- uses: golangci/golangci-lint-action@v6
3434
with:
35-
version: v1.56.1
35+
version: v1.62.2
3636
check_mockgen:
3737
name: Up-to-date mocks
3838
runs-on: ubuntu-latest

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ linters-settings:
120120
gosec:
121121
excludes:
122122
- G107 # Url provided to HTTP request as taint input https://securego.io/docs/rules/g107
123+
- G115 # TODO: use typesafe conversion for uint64 -> int64
123124
importas:
124125
# Do not allow unaliased imports of aliased packages.
125126
no-unaliased: false

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ------------------------------------------------------------------------------
22
# Build avalanche
33
# ------------------------------------------------------------------------------
4-
FROM golang:1.21.12 AS avalanche
4+
FROM golang:1.22.10 AS avalanche
55

66
ARG AVALANCHE_VERSION
77

@@ -16,7 +16,7 @@ RUN git checkout $AVALANCHE_VERSION && \
1616
# ------------------------------------------------------------------------------
1717
# Build avalanche rosetta
1818
# ------------------------------------------------------------------------------
19-
FROM golang:1.21.12 AS rosetta
19+
FROM golang:1.22.10 AS rosetta
2020

2121
ARG ROSETTA_VERSION
2222

Dockerfile.arm64

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ------------------------------------------------------------------------------
22
# Build avalanche
33
# ------------------------------------------------------------------------------
4-
FROM arm64v8/golang:1.21.7-bullseye AS avalanche
4+
FROM arm64v8/golang:1.22.10-bullseye AS avalanche
55

66
ARG AVALANCHE_VERSION
77

@@ -16,7 +16,7 @@ RUN git checkout $AVALANCHE_VERSION && \
1616
# ------------------------------------------------------------------------------
1717
# Build avalanche rosetta
1818
# ------------------------------------------------------------------------------
19-
FROM arm64v8/golang:1.21.7-bullseye AS rosetta
19+
FROM arm64v8/golang:1.22.10-bullseye AS rosetta
2020

2121
ARG ROSETTA_VERSION
2222

client/info_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ import (
1313
type InfoClient interface {
1414
GetBlockchainID(context.Context, string, ...rpc.Option) (ids.ID, error)
1515
IsBootstrapped(context.Context, string, ...rpc.Option) (bool, error)
16-
Peers(context.Context, ...rpc.Option) ([]info.Peer, error)
16+
Peers(context.Context, []ids.NodeID, ...rpc.Option) ([]info.Peer, error)
1717
}

client/mock_client.go

Lines changed: 34 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/pchainclient.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ package client
33
import (
44
"context"
55
"strings"
6+
"time"
67

78
"github.com/ava-labs/avalanchego/api"
89
"github.com/ava-labs/avalanchego/api/info"
910
"github.com/ava-labs/avalanchego/ids"
1011
"github.com/ava-labs/avalanchego/indexer"
1112
"github.com/ava-labs/avalanchego/utils/rpc"
1213
"github.com/ava-labs/avalanchego/vms/avm"
14+
"github.com/ava-labs/avalanchego/vms/components/gas"
1315
"github.com/ava-labs/avalanchego/vms/platformvm"
1416
"github.com/ava-labs/avalanchego/vms/platformvm/signer"
1517

@@ -61,6 +63,7 @@ type PChainClient interface {
6163
IssueTx(ctx context.Context, tx []byte, options ...rpc.Option) (ids.ID, error)
6264
GetStake(ctx context.Context, addrs []ids.ShortID, validatorsOnly bool, options ...rpc.Option) (map[ids.ID]uint64, [][]byte, error)
6365
GetCurrentValidators(ctx context.Context, subnetID ids.ID, nodeIDs []ids.NodeID, options ...rpc.Option) ([]platformvm.ClientPermissionlessValidator, error)
66+
GetFeeState(ctx context.Context, options ...rpc.Option) (gas.State, gas.Price, time.Time, error)
6467

6568
// avm.Client methods
6669
GetAssetDescription(ctx context.Context, assetID string, options ...rpc.Option) (*avm.GetAssetDescriptionReply, error)

constants/network.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package constants
22

33
import (
4+
"github.com/ava-labs/avalanchego/upgrade"
45
"github.com/ava-labs/avalanchego/utils/constants"
5-
"github.com/ava-labs/coreth/params"
66
)
77

88
const (
@@ -16,6 +16,11 @@ const (
1616
)
1717

1818
var (
19-
MainnetAP5Activation = *params.AvalancheMainnetChainConfig.ApricotPhase5BlockTimestamp
20-
FujiAP5Activation = *params.AvalancheFujiChainConfig.ApricotPhase5BlockTimestamp
19+
mainnetUpgrades = upgrade.GetConfig(constants.MainnetID)
20+
fujiUpgrades = upgrade.GetConfig(constants.FujiID)
21+
)
22+
23+
var (
24+
MainnetAP5Activation = uint64(mainnetUpgrades.ApricotPhase5Time.Unix())
25+
FujiAP5Activation = uint64(fujiUpgrades.ApricotPhase5Time.Unix())
2126
)

go.mod

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
module github.com/ava-labs/avalanche-rosetta
22

3-
go 1.21.12
3+
go 1.22.10
44

55
require (
6-
github.com/ava-labs/avalanchego v1.11.9
7-
github.com/ava-labs/coreth v0.13.6-rc.1
6+
github.com/ava-labs/avalanchego v1.12.0
7+
github.com/ava-labs/coreth v0.13.9-rc.1
88
github.com/coinbase/rosetta-sdk-go v0.6.5
9-
github.com/ethereum/go-ethereum v1.13.8
10-
github.com/stretchr/testify v1.8.4
9+
github.com/ethereum/go-ethereum v1.13.14
10+
github.com/stretchr/testify v1.9.0
1111
go.uber.org/mock v0.4.0
12-
golang.org/x/crypto v0.21.0
13-
golang.org/x/sync v0.6.0
12+
golang.org/x/crypto v0.26.0
13+
golang.org/x/sync v0.8.0
1414
)
1515

1616
require (
@@ -23,7 +23,7 @@ require (
2323
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
2424
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
2525
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
26-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
26+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2727
github.com/cockroachdb/errors v1.9.1 // indirect
2828
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
2929
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 // indirect
@@ -41,14 +41,13 @@ require (
4141
github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect
4242
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
4343
github.com/fatih/color v1.13.0 // indirect
44-
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
4544
github.com/fsnotify/fsnotify v1.6.0 // indirect
4645
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
4746
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
4847
github.com/getsentry/sentry-go v0.18.0 // indirect
4948
github.com/go-logr/logr v1.4.1 // indirect
5049
github.com/go-logr/stdr v1.2.2 // indirect
51-
github.com/go-ole/go-ole v1.2.6 // indirect
50+
github.com/go-ole/go-ole v1.3.0 // indirect
5251
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
5352
github.com/gogo/protobuf v1.3.2 // indirect
5453
github.com/golang/protobuf v1.5.4 // indirect
@@ -59,11 +58,11 @@ require (
5958
github.com/google/uuid v1.6.0 // indirect
6059
github.com/gorilla/mux v1.8.0 // indirect
6160
github.com/gorilla/rpc v1.2.0 // indirect
62-
github.com/gorilla/websocket v1.4.2 // indirect
61+
github.com/gorilla/websocket v1.5.0 // indirect
6362
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
6463
github.com/hashicorp/go-bexpr v0.1.10 // indirect
6564
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
66-
github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 // indirect
65+
github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 // indirect
6766
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
6867
github.com/holiman/uint256 v1.2.4 // indirect
6968
github.com/klauspost/compress v1.15.15 // indirect
@@ -82,19 +81,19 @@ require (
8281
github.com/pires/go-proxyproto v0.6.2 // indirect
8382
github.com/pkg/errors v0.9.1 // indirect
8483
github.com/pmezard/go-difflib v1.0.0 // indirect
85-
github.com/prometheus/client_golang v1.14.0 // indirect
84+
github.com/prometheus/client_golang v1.16.0 // indirect
8685
github.com/prometheus/client_model v0.3.0 // indirect
8786
github.com/prometheus/common v0.42.0 // indirect
8887
github.com/prometheus/procfs v0.10.1 // indirect
8988
github.com/rivo/uniseg v0.2.0 // indirect
90-
github.com/rogpeppe/go-internal v1.10.0 // indirect
89+
github.com/rogpeppe/go-internal v1.12.0 // indirect
9190
github.com/rs/cors v1.7.0 // indirect
9291
github.com/russross/blackfriday/v2 v2.1.0 // indirect
9392
github.com/segmentio/fasthash v1.0.3 // indirect
9493
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
9594
github.com/spf13/cast v1.5.0 // indirect
9695
github.com/status-im/keycard-go v0.2.0 // indirect
97-
github.com/supranational/blst v0.3.11 // indirect
96+
github.com/supranational/blst v0.3.13 // indirect
9897
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
9998
github.com/tklauser/go-sysconf v0.3.12 // indirect
10099
github.com/tklauser/numcpus v0.6.1 // indirect
@@ -110,18 +109,18 @@ require (
110109
go.opentelemetry.io/otel/sdk v1.22.0 // indirect
111110
go.opentelemetry.io/otel/trace v1.22.0 // indirect
112111
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
113-
go.uber.org/multierr v1.10.0 // indirect
112+
go.uber.org/multierr v1.11.0 // indirect
114113
go.uber.org/zap v1.26.0 // indirect
115114
golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect
116-
golang.org/x/net v0.23.0 // indirect
117-
golang.org/x/sys v0.18.0 // indirect
118-
golang.org/x/term v0.18.0 // indirect
119-
golang.org/x/text v0.14.0 // indirect
115+
golang.org/x/net v0.28.0 // indirect
116+
golang.org/x/sys v0.24.0 // indirect
117+
golang.org/x/term v0.23.0 // indirect
118+
golang.org/x/text v0.17.0 // indirect
120119
golang.org/x/time v0.3.0 // indirect
121120
gonum.org/v1/gonum v0.11.0 // indirect
122-
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect
123-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
124-
google.golang.org/grpc v1.62.0 // indirect
121+
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect
122+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect
123+
google.golang.org/grpc v1.66.0 // indirect
125124
google.golang.org/protobuf v1.34.2 // indirect
126125
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
127126
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)