Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,23 @@ docker run -d -p 8081:8080 -p 19650:9650 -p 19651:9651 -e NETWORK_ID=costwo -e M
```

Modify cli config in `server/rosetta-cli-conf/config.json -> construction.offline_url` to point to the offline node.

## Local full integration test

You can use `test-localflare.sh` script. You need bash, node 20, npm, yarn, curl, jq and docker preinstalled.

This script does the following:
- spins up a 5 node localflare cluster
- creates a few blocks
- spins up a rosetta docker image, build from local source (as opposed to pulling from github)
- installs rosetta-cli from github
- performss a construction test
- tears down the localflare network

Run with:
```
export=ROSETTA_IMAGE=rosetta-local
export=START_ROSETTA_SERVER_AFTER_BOOTSTRAP=true
export=MODE=online
./test-localflare.sh
```
2 changes: 1 addition & 1 deletion server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM golang:1.22 AS flare

WORKDIR /app

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

RUN git clone --branch "$GO_FLARE_VERSION" "${GO_FLARE_REPO}" .
Expand Down
2 changes: 1 addition & 1 deletion server/Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM arm64v8/golang:1.22 AS flare

WORKDIR /app

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

RUN git clone --branch "$GO_FLARE_VERSION" "${GO_FLARE_REPO}" .
Expand Down
2 changes: 1 addition & 1 deletion server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DOCKER_ORG ?= avaplatform
DOCKER_IMAGE ?= ${DOCKER_ORG}/${PROJECT}
DOCKER_LABEL ?= latest
DOCKER_TAG ?= ${DOCKER_IMAGE}:${DOCKER_LABEL}
AVALANCHE_VERSION ?= v1.7.18
AVALANCHE_VERSION ?= v1.11.9

build:
go build -o ./rosetta-server ./cmd/server
Expand Down
2 changes: 1 addition & 1 deletion server/client/info_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ import (
type InfoClient interface {
GetBlockchainID(context.Context, string, ...rpc.Option) (ids.ID, error)
IsBootstrapped(context.Context, string, ...rpc.Option) (bool, error)
Peers(context.Context, ...rpc.Option) ([]info.Peer, error)
Peers(context.Context, []ids.NodeID, ...rpc.Option) ([]info.Peer, error)
}
44 changes: 34 additions & 10 deletions server/client/mock_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions server/client/pchainclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package client
import (
"context"
"strings"
"time"

"github.com/ava-labs/avalanchego/api"
"github.com/ava-labs/avalanchego/api/info"
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/indexer"
"github.com/ava-labs/avalanchego/utils/rpc"
"github.com/ava-labs/avalanchego/vms/avm"
"github.com/ava-labs/avalanchego/vms/components/gas"
"github.com/ava-labs/avalanchego/vms/platformvm"
"github.com/ava-labs/avalanchego/vms/platformvm/signer"

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

// avm.Client methods
GetAssetDescription(ctx context.Context, assetID string, options ...rpc.Option) (*avm.GetAssetDescriptionReply, error)
Expand Down
1 change: 0 additions & 1 deletion server/cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ func main() {
}

pChainBackend, err := pchain.NewBackend(
cfg.Mode,
pChainClient,
pIndexerParser,
avaxAssetID,
Expand Down
8 changes: 8 additions & 0 deletions server/constants/network.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
package constants

const (
// MainnetChainID = 43114
// MainnetAssetID = "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z"
// MainnetNetwork = constants.MainnetName

// FujiChainID = 43113
// FujiAssetID = "U8iRqJoiJm8xZHAacmvYyZVwqQx6uDNtQeP3CQ6fcgQk3JqnK"
// FujiNetwork = constants.FujiName

MainnetNetwork = "flare"
TestnetNetwork = "fuji" // Using fuji for backwards compatibility with tests
LocalNetwork = "localflare"
Expand Down
11 changes: 6 additions & 5 deletions server/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
validator1:
image: ghcr.io/flare-foundation/go-flare:v1.11.13-rc0
image: ghcr.io/flare-foundation/go-flare:v1.12.0
environment:
LOG_LEVEL: info
NETWORK_ID: localflare
Expand All @@ -20,7 +20,7 @@ services:
test: curl localhost:9650/ext/health

validator2:
image: ghcr.io/flare-foundation/go-flare:v1.11.13-rc0
image: ghcr.io/flare-foundation/go-flare:v1.12.0
environment:
LOG_LEVEL: info
NETWORK_ID: localflare
Expand All @@ -37,7 +37,7 @@ services:
ipv4_address: 10.20.30.2

validator3:
image: ghcr.io/flare-foundation/go-flare:v1.11.13-rc0
image: ghcr.io/flare-foundation/go-flare:v1.12.0
environment:
LOG_LEVEL: info
NETWORK_ID: localflare
Expand All @@ -55,7 +55,7 @@ services:
ipv4_address: 10.20.30.3

validator4:
image: ghcr.io/flare-foundation/go-flare:v1.11.13-rc0
image: ghcr.io/flare-foundation/go-flare:v1.12.0
environment:
LOG_LEVEL: info
NETWORK_ID: localflare
Expand All @@ -72,7 +72,7 @@ services:
ipv4_address: 10.20.30.4

validator5:
image: ghcr.io/flare-foundation/go-flare:v1.11.13-rc0
image: ghcr.io/flare-foundation/go-flare:v1.12.0
environment:
LOG_LEVEL: info
NETWORK_ID: localflare
Expand Down Expand Up @@ -102,6 +102,7 @@ services:
START_ROSETTA_SERVER_AFTER_BOOTSTRAP: ${START_ROSETTA_SERVER_AFTER_BOOTSTRAP}
MODE: ${MODE}
ports:
- 7650:9650
- 8080:8080
depends_on:
- validator1
Expand Down
3 changes: 1 addition & 2 deletions server/docker/entrypoint_rosetta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ if [ "$MODE" = "online" ]; then
done

jq --arg c "${ROSETTA_FLARE_ENDPOINT}" '.rpc_base_url=$c' "${ROSETTA_CONFIG_PATH}" | sponge "${ROSETTA_CONFIG_PATH}"

fi


jq --arg m "${MODE}" '.mode=$m' "${ROSETTA_CONFIG_PATH}" | sponge "${ROSETTA_CONFIG_PATH}"


/app/rosetta-server/rosetta-server -config=${ROSETTA_CONFIG_PATH}
/app/rosetta-server/rosetta-server -config="${ROSETTA_CONFIG_PATH}"
Loading