Skip to content

Commit 893bbd4

Browse files
authored
Merge pull request #25 from flare-foundation/v0.1.47-upgrade
This syncs up Avalanche Rosetta code with upstream version 0.1.47 and support go-flare 1.12.0.
2 parents 60a33de + 0b3920d commit 893bbd4

31 files changed

+572
-307
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,23 @@ docker run -d -p 8081:8080 -p 19650:9650 -p 19651:9651 -e NETWORK_ID=costwo -e M
175175
```
176176

177177
Modify cli config in `server/rosetta-cli-conf/config.json -> construction.offline_url` to point to the offline node.
178+
179+
## Local full integration test
180+
181+
You can use `test-localflare.sh` script. You need bash, node 20, npm, yarn, curl, jq and docker preinstalled.
182+
183+
This script does the following:
184+
- spins up a 5 node localflare cluster
185+
- creates a few blocks
186+
- spins up a rosetta docker image, build from local source (as opposed to pulling from github)
187+
- installs rosetta-cli from github
188+
- performss a construction test
189+
- tears down the localflare network
190+
191+
Run with:
192+
```
193+
export=ROSETTA_IMAGE=rosetta-local
194+
export=START_ROSETTA_SERVER_AFTER_BOOTSTRAP=true
195+
export=MODE=online
196+
./test-localflare.sh
197+
```

server/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM golang:1.22 AS flare
55

66
WORKDIR /app
77

8-
ARG GO_FLARE_VERSION=v1.11.13-rc0
8+
ARG GO_FLARE_VERSION=v1.12.0
99
ARG GO_FLARE_REPO=https://github.com/flare-foundation/go-flare
1010

1111
RUN git clone --branch "$GO_FLARE_VERSION" "${GO_FLARE_REPO}" .

server/Dockerfile.arm64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM arm64v8/golang:1.22 AS flare
55

66
WORKDIR /app
77

8-
ARG GO_FLARE_VERSION=v1.11.0
8+
ARG GO_FLARE_VERSION=v1.12.0
99
ARG GO_FLARE_REPO=https://github.com/flare-foundation/go-flare
1010

1111
RUN git clone --branch "$GO_FLARE_VERSION" "${GO_FLARE_REPO}" .

server/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ DOCKER_ORG ?= avaplatform
1111
DOCKER_IMAGE ?= ${DOCKER_ORG}/${PROJECT}
1212
DOCKER_LABEL ?= latest
1313
DOCKER_TAG ?= ${DOCKER_IMAGE}:${DOCKER_LABEL}
14-
AVALANCHE_VERSION ?= v1.7.18
14+
AVALANCHE_VERSION ?= v1.11.9
1515

1616
build:
1717
go build -o ./rosetta-server ./cmd/server

server/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
}

server/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.

server/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)

server/cmd/server/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ func main() {
139139
}
140140

141141
pChainBackend, err := pchain.NewBackend(
142-
cfg.Mode,
143142
pChainClient,
144143
pIndexerParser,
145144
avaxAssetID,

server/constants/network.go

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

33
const (
4+
// MainnetChainID = 43114
5+
// MainnetAssetID = "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z"
6+
// MainnetNetwork = constants.MainnetName
7+
8+
// FujiChainID = 43113
9+
// FujiAssetID = "U8iRqJoiJm8xZHAacmvYyZVwqQx6uDNtQeP3CQ6fcgQk3JqnK"
10+
// FujiNetwork = constants.FujiName
11+
412
MainnetNetwork = "flare"
513
TestnetNetwork = "fuji" // Using fuji for backwards compatibility with tests
614
LocalNetwork = "localflare"

server/docker/docker-compose.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
validator1:
3-
image: ghcr.io/flare-foundation/go-flare:v1.11.13-rc0
3+
image: ghcr.io/flare-foundation/go-flare:v1.12.0
44
environment:
55
LOG_LEVEL: info
66
NETWORK_ID: localflare
@@ -20,7 +20,7 @@ services:
2020
test: curl localhost:9650/ext/health
2121

2222
validator2:
23-
image: ghcr.io/flare-foundation/go-flare:v1.11.13-rc0
23+
image: ghcr.io/flare-foundation/go-flare:v1.12.0
2424
environment:
2525
LOG_LEVEL: info
2626
NETWORK_ID: localflare
@@ -37,7 +37,7 @@ services:
3737
ipv4_address: 10.20.30.2
3838

3939
validator3:
40-
image: ghcr.io/flare-foundation/go-flare:v1.11.13-rc0
40+
image: ghcr.io/flare-foundation/go-flare:v1.12.0
4141
environment:
4242
LOG_LEVEL: info
4343
NETWORK_ID: localflare
@@ -55,7 +55,7 @@ services:
5555
ipv4_address: 10.20.30.3
5656

5757
validator4:
58-
image: ghcr.io/flare-foundation/go-flare:v1.11.13-rc0
58+
image: ghcr.io/flare-foundation/go-flare:v1.12.0
5959
environment:
6060
LOG_LEVEL: info
6161
NETWORK_ID: localflare
@@ -72,7 +72,7 @@ services:
7272
ipv4_address: 10.20.30.4
7373

7474
validator5:
75-
image: ghcr.io/flare-foundation/go-flare:v1.11.13-rc0
75+
image: ghcr.io/flare-foundation/go-flare:v1.12.0
7676
environment:
7777
LOG_LEVEL: info
7878
NETWORK_ID: localflare
@@ -102,6 +102,7 @@ services:
102102
START_ROSETTA_SERVER_AFTER_BOOTSTRAP: ${START_ROSETTA_SERVER_AFTER_BOOTSTRAP}
103103
MODE: ${MODE}
104104
ports:
105+
- 7650:9650
105106
- 8080:8080
106107
depends_on:
107108
- validator1

0 commit comments

Comments
 (0)