mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 14:33:52 +00:00
Merge branch 'master' into main
This commit is contained in:
commit
3b264e929a
22 changed files with 643 additions and 201 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
|
@ -6,9 +6,9 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v2.1.3
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.16.7
|
go-version: 1.17
|
||||||
- name: "Build binaries"
|
- name: "Build binaries"
|
||||||
run: make all
|
run: make all
|
||||||
- name: "Run tests"
|
- name: "Run tests"
|
||||||
|
|
|
||||||
26
.github/workflows/dockerimage-latest.yml
vendored
26
.github/workflows/dockerimage-latest.yml
vendored
|
|
@ -1,26 +0,0 @@
|
||||||
name: Docker Images For Latest Branches
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Build docker image
|
|
||||||
env:
|
|
||||||
DOCKERHUB: ${{ secrets.DOCKERHUB }}
|
|
||||||
DOCKERHUB_KEY: ${{ secrets.DOCKERHUB_KEY }}
|
|
||||||
run: |
|
|
||||||
set -x
|
|
||||||
ls -l
|
|
||||||
echo "Docker login"
|
|
||||||
docker login -u $DOCKERHUB -p $DOCKERHUB_KEY
|
|
||||||
echo "Running build"
|
|
||||||
docker build -t maticnetwork/bor:${GITHUB_REF/refs\/heads\//} .
|
|
||||||
echo "Pushing image"
|
|
||||||
docker push maticnetwork/bor:${GITHUB_REF/refs\/heads\//}
|
|
||||||
echo "Done"
|
|
||||||
25
.github/workflows/dockerimage.yml
vendored
25
.github/workflows/dockerimage.yml
vendored
|
|
@ -1,25 +0,0 @@
|
||||||
name: Bor Docker Image CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*.*.*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Build the Bor Docker image
|
|
||||||
env:
|
|
||||||
DOCKERHUB: ${{ secrets.DOCKERHUB }}
|
|
||||||
DOCKERHUB_KEY: ${{ secrets.DOCKERHUB_KEY }}
|
|
||||||
run: |
|
|
||||||
ls -l
|
|
||||||
echo "Docker login"
|
|
||||||
docker login -u $DOCKERHUB -p $DOCKERHUB_KEY
|
|
||||||
echo "running build"
|
|
||||||
docker build -t maticnetwork/bor:${GITHUB_REF/refs\/tags\//} .
|
|
||||||
echo "pushing image"
|
|
||||||
docker push maticnetwork/bor:${GITHUB_REF/refs\/tags\//}
|
|
||||||
echo "DONE!"
|
|
||||||
67
.github/workflows/linuxpackage.yml
vendored
67
.github/workflows/linuxpackage.yml
vendored
|
|
@ -1,67 +0,0 @@
|
||||||
name: Linux package
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "v*.*.*"
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v1
|
|
||||||
with:
|
|
||||||
go-version: 1.17
|
|
||||||
|
|
||||||
- name: Set up Ruby 2.6
|
|
||||||
uses: actions/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
ruby-version: 2.6
|
|
||||||
|
|
||||||
- name: Retrieve release version
|
|
||||||
run: |
|
|
||||||
echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Build package
|
|
||||||
run: |
|
|
||||||
set -x
|
|
||||||
|
|
||||||
echo "Release version: ${{ env.RELEASE_VERSION }}"
|
|
||||||
|
|
||||||
sudo apt-get -yqq install libpq-dev build-essential
|
|
||||||
gem install --no-document fpm
|
|
||||||
fpm --version
|
|
||||||
|
|
||||||
make bor-all
|
|
||||||
|
|
||||||
fpm -s dir -t deb --deb-user root --deb-group root -n matic-bor -v ${{ env.RELEASE_VERSION }} \
|
|
||||||
build/bin/bor=/usr/bin/ \
|
|
||||||
build/bin/bootnode=/usr/bin/
|
|
||||||
|
|
||||||
mkdir packages-v${{ env.RELEASE_VERSION }}
|
|
||||||
|
|
||||||
mv matic-bor_${{ env.RELEASE_VERSION }}_amd64.deb packages-v${{ env.RELEASE_VERSION }}/
|
|
||||||
|
|
||||||
ls packages-v${{ env.RELEASE_VERSION }}/
|
|
||||||
|
|
||||||
- name: S3 upload
|
|
||||||
uses: jakejarvis/s3-sync-action@master
|
|
||||||
with:
|
|
||||||
args: --acl public-read
|
|
||||||
env:
|
|
||||||
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_REGION: "us-east-1" # optional: defaults to us-east-1
|
|
||||||
SOURCE_DIR: "packages-v${{ env.RELEASE_VERSION }}"
|
|
||||||
DEST_DIR: "v${{ env.RELEASE_VERSION }}"
|
|
||||||
|
|
||||||
- name: Slack Notification
|
|
||||||
uses: rtCamp/action-slack-notify@v2.0.0
|
|
||||||
env:
|
|
||||||
SLACK_CHANNEL: code-releases
|
|
||||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
|
||||||
SLACK_TITLE: "New linux package for Bor v${{ env.RELEASE_VERSION }} just got released"
|
|
||||||
SLACK_MESSAGE: "Package has been uploaded to S3 bucket for public use and available at https://matic-public.s3.amazonaws.com/v${{ env.RELEASE_VERSION }}/matic-bor_${{ env.RELEASE_VERSION }}_amd64.deb"
|
|
||||||
43
.github/workflows/release.yml
vendored
Normal file
43
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- '**'
|
||||||
|
tags:
|
||||||
|
- 'v*.*.*'
|
||||||
|
# to be used by fork patch-releases ^^
|
||||||
|
- 'v*.*.*-*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
goreleaser:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@master
|
||||||
|
with:
|
||||||
|
go-version: 1.17.x
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
id: prepare
|
||||||
|
run: |
|
||||||
|
TAG=${GITHUB_REF#refs/tags/}
|
||||||
|
echo ::set-output name=tag_name::${TAG}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
|
- name: Run GoReleaser
|
||||||
|
run: |
|
||||||
|
make release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
VERSION: ${{ steps.prepare.outputs.tag_name }}
|
||||||
|
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||||
|
DOCKER_USERNAME: ${{ secrets.DOCKERHUB }}
|
||||||
|
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_KEY }}
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -49,3 +49,5 @@ profile.cov
|
||||||
**/yarn-error.log
|
**/yarn-error.log
|
||||||
./test
|
./test
|
||||||
./bor-debug-*
|
./bor-debug-*
|
||||||
|
|
||||||
|
dist
|
||||||
|
|
|
||||||
126
.goreleaser.yml
Normal file
126
.goreleaser.yml
Normal file
|
|
@ -0,0 +1,126 @@
|
||||||
|
project_name: bor
|
||||||
|
|
||||||
|
release:
|
||||||
|
disable: false
|
||||||
|
draft: true
|
||||||
|
prerelease: auto
|
||||||
|
|
||||||
|
builds:
|
||||||
|
- id: darwin-amd64
|
||||||
|
main: ./cmd/geth
|
||||||
|
binary: bor
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
env:
|
||||||
|
- CC=o64-clang
|
||||||
|
- CXX=o64-clang++
|
||||||
|
ldflags:
|
||||||
|
-s -w
|
||||||
|
|
||||||
|
- id: darwin-arm64
|
||||||
|
main: ./cmd/geth
|
||||||
|
binary: bor
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
goarch:
|
||||||
|
- arm64
|
||||||
|
env:
|
||||||
|
- CC=oa64-clang
|
||||||
|
- CXX=oa64-clang++
|
||||||
|
ldflags:
|
||||||
|
-s -w
|
||||||
|
|
||||||
|
- id: linux-amd64
|
||||||
|
main: ./cmd/geth
|
||||||
|
binary: bor
|
||||||
|
goos:
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
env:
|
||||||
|
- CC=gcc
|
||||||
|
- CXX=g++
|
||||||
|
ldflags:
|
||||||
|
# We need to build a static binary because we are building in a glibc based system and running in a musl container
|
||||||
|
-s -w -linkmode external -extldflags "-static"
|
||||||
|
|
||||||
|
- id: linux-arm64
|
||||||
|
main: ./cmd/geth
|
||||||
|
binary: bor
|
||||||
|
goos:
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- arm64
|
||||||
|
env:
|
||||||
|
- CC=aarch64-linux-gnu-gcc
|
||||||
|
- CXX=aarch64-linux-gnu-g++
|
||||||
|
ldflags:
|
||||||
|
# We need to build a static binary because we are building in a glibc based system and running in a musl container
|
||||||
|
-s -w -linkmode external -extldflags "-static"
|
||||||
|
|
||||||
|
nfpms:
|
||||||
|
- vendor: 0xPolygon
|
||||||
|
homepage: https://polygon.technology
|
||||||
|
maintainer: Polygon Team <team@polygon.technology>
|
||||||
|
description: Polygon Blockchain
|
||||||
|
license: GPLv3 LGPLv3
|
||||||
|
|
||||||
|
formats:
|
||||||
|
- apk
|
||||||
|
- deb
|
||||||
|
- rpm
|
||||||
|
|
||||||
|
contents:
|
||||||
|
- src: builder/files/bor.service
|
||||||
|
dst: /lib/systemd/system/bor.service
|
||||||
|
type: config
|
||||||
|
|
||||||
|
overrides:
|
||||||
|
rpm:
|
||||||
|
replacements:
|
||||||
|
amd64: x86_64
|
||||||
|
|
||||||
|
snapshot:
|
||||||
|
name_template: "{{ .Tag }}.next"
|
||||||
|
|
||||||
|
dockers:
|
||||||
|
- image_templates:
|
||||||
|
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-amd64
|
||||||
|
dockerfile: Dockerfile.release
|
||||||
|
use: buildx
|
||||||
|
goarch: amd64
|
||||||
|
ids:
|
||||||
|
- linux-amd64
|
||||||
|
build_flag_templates:
|
||||||
|
- --platform=linux/amd64
|
||||||
|
skip_push: true
|
||||||
|
|
||||||
|
- image_templates:
|
||||||
|
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
|
||||||
|
dockerfile: Dockerfile.release
|
||||||
|
use: buildx
|
||||||
|
goarch: arm64
|
||||||
|
ids:
|
||||||
|
- linux-arm64
|
||||||
|
build_flag_templates:
|
||||||
|
- --platform=linux/arm64
|
||||||
|
skip_push: true
|
||||||
|
|
||||||
|
docker_manifests:
|
||||||
|
- name_template: 0xpolygon/{{ .ProjectName }}:{{ .Version }}
|
||||||
|
image_templates:
|
||||||
|
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-amd64
|
||||||
|
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
|
||||||
|
|
||||||
|
- name_template: 0xpolygon/{{ .ProjectName }}:latest
|
||||||
|
image_templates:
|
||||||
|
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-amd64
|
||||||
|
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
|
||||||
|
|
||||||
|
announce:
|
||||||
|
slack:
|
||||||
|
enabled: true
|
||||||
|
# The name of the channel that the user selected as a destination for webhook messages.
|
||||||
|
channel: '#code-releases'
|
||||||
21
Dockerfile
21
Dockerfile
|
|
@ -1,18 +1,29 @@
|
||||||
# Build Geth in a stock Go builder container
|
# Build Geth in a stock Go builder container
|
||||||
FROM golang:1.17-alpine as builder
|
FROM golang:1.17-alpine as builder
|
||||||
|
|
||||||
RUN apk add --no-cache make gcc musl-dev linux-headers git bash
|
RUN set -x \
|
||||||
|
&& buildDeps='bash build-base musl-dev linux-headers git' \
|
||||||
|
&& apk add --update $buildDeps \
|
||||||
|
&& rm -rf /var/cache/apk/* \
|
||||||
|
&& mkdir -p /bor
|
||||||
|
|
||||||
ADD . /bor
|
WORKDIR /bor
|
||||||
RUN cd /bor && make bor-all
|
COPY . .
|
||||||
|
RUN make bor-all
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
CMD ["/bin/bash"]
|
||||||
|
|
||||||
# Pull Bor into a second stage deploy alpine container
|
# Pull Bor into a second stage deploy alpine container
|
||||||
FROM alpine:latest
|
FROM alpine:3.14
|
||||||
|
|
||||||
|
RUN set -x \
|
||||||
|
&& apk add --update --no-cache \
|
||||||
|
ca-certificates \
|
||||||
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
RUN apk add --no-cache ca-certificates
|
|
||||||
COPY --from=builder /bor/build/bin/bor /usr/local/bin/
|
COPY --from=builder /bor/build/bin/bor /usr/local/bin/
|
||||||
COPY --from=builder /bor/build/bin/bootnode /usr/local/bin/
|
COPY --from=builder /bor/build/bin/bootnode /usr/local/bin/
|
||||||
|
|
||||||
EXPOSE 8545 8546 8547 30303 30303/udp
|
EXPOSE 8545 8546 8547 30303 30303/udp
|
||||||
|
|
||||||
|
ENTRYPOINT ["bor"]
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,10 @@ RUN cd /bor && make bor-all
|
||||||
# Pull all binaries into a second stage deploy alpine container
|
# Pull all binaries into a second stage deploy alpine container
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
RUN apk add --no-cache ca-certificates
|
RUN set -x \
|
||||||
|
&& apk add --update --no-cache \
|
||||||
|
ca-certificates \
|
||||||
|
&& rm -rf /var/cache/apk/*
|
||||||
COPY --from=builder /bor/build/bin/* /usr/local/bin/
|
COPY --from=builder /bor/build/bin/* /usr/local/bin/
|
||||||
|
|
||||||
EXPOSE 8545 8546 30303 30303/udp
|
EXPOSE 8545 8546 30303 30303/udp
|
||||||
10
Dockerfile.release
Normal file
10
Dockerfile.release
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
FROM alpine:3.14
|
||||||
|
|
||||||
|
RUN set -x \
|
||||||
|
&& apk add --update --no-cache \
|
||||||
|
ca-certificates \
|
||||||
|
&& rm -rf /var/cache/apk/*
|
||||||
|
COPY bor /usr/local/bin/
|
||||||
|
|
||||||
|
EXPOSE 8545 8546 8547 30303 30303/udp
|
||||||
|
ENTRYPOINT ["bor"]
|
||||||
34
Makefile
34
Makefile
|
|
@ -163,3 +163,37 @@ geth-windows-amd64:
|
||||||
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/geth
|
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/geth
|
||||||
@echo "Windows amd64 cross compilation done:"
|
@echo "Windows amd64 cross compilation done:"
|
||||||
@ls -ld $(GOBIN)/geth-windows-* | grep amd64
|
@ls -ld $(GOBIN)/geth-windows-* | grep amd64
|
||||||
|
|
||||||
|
PACKAGE_NAME := github.com/maticnetwork/bor
|
||||||
|
GOLANG_CROSS_VERSION ?= v1.17.2
|
||||||
|
|
||||||
|
.PHONY: release-dry-run
|
||||||
|
release-dry-run:
|
||||||
|
@docker run \
|
||||||
|
--rm \
|
||||||
|
--privileged \
|
||||||
|
-e CGO_ENABLED=1 \
|
||||||
|
-e GITHUB_TOKEN \
|
||||||
|
-e DOCKER_USERNAME \
|
||||||
|
-e DOCKER_PASSWORD \
|
||||||
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
|
-v `pwd`:/go/src/$(PACKAGE_NAME) \
|
||||||
|
-w /go/src/$(PACKAGE_NAME) \
|
||||||
|
ghcr.io/troian/golang-cross:${GOLANG_CROSS_VERSION} \
|
||||||
|
--rm-dist --skip-validate --skip-publish
|
||||||
|
|
||||||
|
.PHONY: release
|
||||||
|
release:
|
||||||
|
@docker run \
|
||||||
|
--rm \
|
||||||
|
--privileged \
|
||||||
|
-e CGO_ENABLED=1 \
|
||||||
|
-e GITHUB_TOKEN \
|
||||||
|
-e DOCKER_USERNAME \
|
||||||
|
-e DOCKER_PASSWORD \
|
||||||
|
-e SLACK_WEBHOOK \
|
||||||
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
|
-v `pwd`:/go/src/$(PACKAGE_NAME) \
|
||||||
|
-w /go/src/$(PACKAGE_NAME) \
|
||||||
|
ghcr.io/troian/golang-cross:${GOLANG_CROSS_VERSION} \
|
||||||
|
--rm-dist --skip-validate
|
||||||
|
|
|
||||||
18
builder/files/bor.service
Normal file
18
builder/files/bor.service
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
[Unit]
|
||||||
|
Description=bor
|
||||||
|
StartLimitIntervalSec=500
|
||||||
|
StartLimitBurst=5
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5s
|
||||||
|
WorkingDirectory=$NODE_DIR
|
||||||
|
EnvironmentFile=/etc/matic/metadata
|
||||||
|
ExecStart=/usr/local/bin/bor $VALIDATOR_ADDRESS
|
||||||
|
Type=simple
|
||||||
|
User=$USER
|
||||||
|
KillSignal=SIGINT
|
||||||
|
TimeoutStopSec=120
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
31
command/chain.go
Normal file
31
command/chain.go
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/mitchellh/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ChainCommand is the command to group the peers commands
|
||||||
|
type ChainCommand struct {
|
||||||
|
UI cli.Ui
|
||||||
|
}
|
||||||
|
|
||||||
|
// Help implements the cli.Command interface
|
||||||
|
func (c *ChainCommand) Help() string {
|
||||||
|
return `Usage: bor chain <subcommand>
|
||||||
|
|
||||||
|
This command groups actions to interact with the chain.
|
||||||
|
|
||||||
|
Set the new head of the chain:
|
||||||
|
|
||||||
|
$ bor chain sethead <number>`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Synopsis implements the cli.Command interface
|
||||||
|
func (c *ChainCommand) Synopsis() string {
|
||||||
|
return "Interact with the chain"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run implements the cli.Command interface
|
||||||
|
func (c *ChainCommand) Run(args []string) int {
|
||||||
|
return cli.RunResultHelp
|
||||||
|
}
|
||||||
91
command/chain_sethead.go
Normal file
91
command/chain_sethead.go
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/command/flagset"
|
||||||
|
"github.com/ethereum/go-ethereum/command/server/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ChainSetHeadCommand is the command to group the peers commands
|
||||||
|
type ChainSetHeadCommand struct {
|
||||||
|
*Meta2
|
||||||
|
|
||||||
|
yes bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Help implements the cli.Command interface
|
||||||
|
func (c *ChainSetHeadCommand) Help() string {
|
||||||
|
return `Usage: bor chain sethead <number> [--yes]
|
||||||
|
|
||||||
|
This command sets the current chain to a certain block`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ChainSetHeadCommand) Flags() *flagset.Flagset {
|
||||||
|
flags := c.NewFlagSet("chain sethead")
|
||||||
|
|
||||||
|
flags.BoolFlag(&flagset.BoolFlag{
|
||||||
|
Name: "yes",
|
||||||
|
Usage: "Force set head",
|
||||||
|
Default: false,
|
||||||
|
Value: &c.yes,
|
||||||
|
})
|
||||||
|
return flags
|
||||||
|
}
|
||||||
|
|
||||||
|
// Synopsis implements the cli.Command interface
|
||||||
|
func (c *ChainSetHeadCommand) Synopsis() string {
|
||||||
|
return "Set the new head of the chain"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run implements the cli.Command interface
|
||||||
|
func (c *ChainSetHeadCommand) Run(args []string) int {
|
||||||
|
flags := c.Flags()
|
||||||
|
if err := flags.Parse(args); err != nil {
|
||||||
|
c.UI.Error(err.Error())
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
args = flags.Args()
|
||||||
|
if len(args) != 1 {
|
||||||
|
c.UI.Error("No number provided")
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
borClt, err := c.BorConn()
|
||||||
|
if err != nil {
|
||||||
|
c.UI.Error(err.Error())
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
arg := args[0]
|
||||||
|
fmt.Println(arg)
|
||||||
|
|
||||||
|
number, err := strconv.Atoi(arg)
|
||||||
|
if err != nil {
|
||||||
|
c.UI.Error(err.Error())
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if !c.yes {
|
||||||
|
response, err := c.UI.Ask("Are you sure you want to reset the database? (y/n)")
|
||||||
|
if err != nil {
|
||||||
|
c.UI.Error(err.Error())
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
if response != "y" {
|
||||||
|
c.UI.Output("set head aborted")
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := borClt.ChainSetHead(context.Background(), &proto.ChainSetHeadRequest{Number: uint64(number)}); err != nil {
|
||||||
|
c.UI.Error(err.Error())
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
c.UI.Output("Done!")
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
@ -64,6 +64,16 @@ func commands() map[string]cli.CommandFactory {
|
||||||
Meta2: meta2,
|
Meta2: meta2,
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
|
"chain": func() (cli.Command, error) {
|
||||||
|
return &ChainCommand{
|
||||||
|
UI: ui,
|
||||||
|
}, nil
|
||||||
|
},
|
||||||
|
"chain sethead": func() (cli.Command, error) {
|
||||||
|
return &ChainSetHeadCommand{
|
||||||
|
Meta2: meta2,
|
||||||
|
}, nil
|
||||||
|
},
|
||||||
"account": func() (cli.Command, error) {
|
"account": func() (cli.Command, error) {
|
||||||
return &Account{
|
return &Account{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ func (x PprofRequest_Type) Number() protoreflect.EnumNumber {
|
||||||
|
|
||||||
// Deprecated: Use PprofRequest_Type.Descriptor instead.
|
// Deprecated: Use PprofRequest_Type.Descriptor instead.
|
||||||
func (PprofRequest_Type) EnumDescriptor() ([]byte, []int) {
|
func (PprofRequest_Type) EnumDescriptor() ([]byte, []int) {
|
||||||
return file_command_server_proto_server_proto_rawDescGZIP(), []int{9, 0}
|
return file_command_server_proto_server_proto_rawDescGZIP(), []int{11, 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
type PeersAddRequest struct {
|
type PeersAddRequest struct {
|
||||||
|
|
@ -534,6 +534,91 @@ func (x *Peer) GetStatic() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ChainSetHeadRequest struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Number uint64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChainSetHeadRequest) Reset() {
|
||||||
|
*x = ChainSetHeadRequest{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_command_server_proto_server_proto_msgTypes[9]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChainSetHeadRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ChainSetHeadRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ChainSetHeadRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_command_server_proto_server_proto_msgTypes[9]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ChainSetHeadRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ChainSetHeadRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_command_server_proto_server_proto_rawDescGZIP(), []int{9}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChainSetHeadRequest) GetNumber() uint64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Number
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type ChainSetHeadResponse struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChainSetHeadResponse) Reset() {
|
||||||
|
*x = ChainSetHeadResponse{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_command_server_proto_server_proto_msgTypes[10]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChainSetHeadResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ChainSetHeadResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ChainSetHeadResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_command_server_proto_server_proto_msgTypes[10]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ChainSetHeadResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ChainSetHeadResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_command_server_proto_server_proto_rawDescGZIP(), []int{10}
|
||||||
|
}
|
||||||
|
|
||||||
type PprofRequest struct {
|
type PprofRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
|
@ -547,7 +632,7 @@ type PprofRequest struct {
|
||||||
func (x *PprofRequest) Reset() {
|
func (x *PprofRequest) Reset() {
|
||||||
*x = PprofRequest{}
|
*x = PprofRequest{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_command_server_proto_server_proto_msgTypes[9]
|
mi := &file_command_server_proto_server_proto_msgTypes[11]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
|
@ -560,7 +645,7 @@ func (x *PprofRequest) String() string {
|
||||||
func (*PprofRequest) ProtoMessage() {}
|
func (*PprofRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *PprofRequest) ProtoReflect() protoreflect.Message {
|
func (x *PprofRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_command_server_proto_server_proto_msgTypes[9]
|
mi := &file_command_server_proto_server_proto_msgTypes[11]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
|
@ -573,7 +658,7 @@ func (x *PprofRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
|
||||||
// Deprecated: Use PprofRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use PprofRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*PprofRequest) Descriptor() ([]byte, []int) {
|
func (*PprofRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_command_server_proto_server_proto_rawDescGZIP(), []int{9}
|
return file_command_server_proto_server_proto_rawDescGZIP(), []int{11}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PprofRequest) GetType() PprofRequest_Type {
|
func (x *PprofRequest) GetType() PprofRequest_Type {
|
||||||
|
|
@ -609,7 +694,7 @@ type PprofResponse struct {
|
||||||
func (x *PprofResponse) Reset() {
|
func (x *PprofResponse) Reset() {
|
||||||
*x = PprofResponse{}
|
*x = PprofResponse{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_command_server_proto_server_proto_msgTypes[10]
|
mi := &file_command_server_proto_server_proto_msgTypes[12]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
|
@ -622,7 +707,7 @@ func (x *PprofResponse) String() string {
|
||||||
func (*PprofResponse) ProtoMessage() {}
|
func (*PprofResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *PprofResponse) ProtoReflect() protoreflect.Message {
|
func (x *PprofResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_command_server_proto_server_proto_msgTypes[10]
|
mi := &file_command_server_proto_server_proto_msgTypes[12]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
|
@ -635,7 +720,7 @@ func (x *PprofResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
|
||||||
// Deprecated: Use PprofResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use PprofResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*PprofResponse) Descriptor() ([]byte, []int) {
|
func (*PprofResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_command_server_proto_server_proto_rawDescGZIP(), []int{10}
|
return file_command_server_proto_server_proto_rawDescGZIP(), []int{12}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PprofResponse) GetPayload() string {
|
func (x *PprofResponse) GetPayload() string {
|
||||||
|
|
@ -689,47 +774,56 @@ var file_command_server_proto_server_proto_rawDesc = []byte{
|
||||||
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x75, 0x73, 0x74,
|
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x75, 0x73, 0x74,
|
||||||
0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65,
|
0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65,
|
||||||
0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28,
|
0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28,
|
||||||
0x08, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x22, 0x98, 0x01, 0x0a, 0x0c, 0x50, 0x70,
|
0x08, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x22, 0x2d, 0x0a, 0x13, 0x43, 0x68, 0x61,
|
||||||
0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x04, 0x74, 0x79,
|
0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||||
0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04,
|
||||||
0x2e, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x79,
|
0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x16, 0x0a, 0x14, 0x43, 0x68, 0x61, 0x69,
|
||||||
0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x66,
|
0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||||
0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69,
|
0x22, 0x98, 0x01, 0x0a, 0x0c, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||||
0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20,
|
0x74, 0x12, 0x2c, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32,
|
||||||
0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x26, 0x0a, 0x04,
|
0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71,
|
||||||
0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x00,
|
0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12,
|
||||||
0x12, 0x07, 0x0a, 0x03, 0x43, 0x50, 0x55, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, 0x41,
|
0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x43, 0x45, 0x10, 0x02, 0x22, 0xa2, 0x01, 0x0a, 0x0d, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65,
|
0x52, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63,
|
||||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61,
|
0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f,
|
||||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64,
|
0x6e, 0x64, 0x73, 0x22, 0x26, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x4c,
|
||||||
0x12, 0x3b, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28,
|
0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x43, 0x50, 0x55, 0x10, 0x01,
|
||||||
0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52,
|
0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x02, 0x22, 0xa2, 0x01, 0x0a, 0x0d,
|
||||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45,
|
0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a,
|
||||||
0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x1a, 0x3a, 0x0a,
|
0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
|
||||||
0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
|
0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x3b, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65,
|
||||||
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
|
0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
0x2e, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48,
|
||||||
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0xc2, 0x02, 0x0a, 0x03, 0x42, 0x6f,
|
0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61,
|
||||||
0x72, 0x12, 0x32, 0x0a, 0x05, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f,
|
0x64, 0x65, 0x72, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45,
|
||||||
0x74, 0x6f, 0x2e, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x73,
|
0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
|
||||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64,
|
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
|
||||||
0x64, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41,
|
0x32, 0x8b, 0x03, 0x0a, 0x03, 0x42, 0x6f, 0x72, 0x12, 0x32, 0x0a, 0x05, 0x50, 0x70, 0x72, 0x6f,
|
||||||
0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x66, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52,
|
||||||
0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50,
|
||||||
0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76,
|
0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08,
|
||||||
0x65, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52,
|
0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70,
|
0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65,
|
0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64,
|
||||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x09, 0x50, 0x65, 0x65, 0x72,
|
0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x50, 0x65, 0x65,
|
||||||
0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65,
|
0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18,
|
0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75,
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74,
|
0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72,
|
||||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72,
|
0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||||
0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
|
0x3e, 0x0a, 0x09, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x70,
|
||||||
0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
|
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65,
|
||||||
0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65,
|
||||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x17,
|
0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||||
|
0x44, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19,
|
||||||
|
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74,
|
||||||
|
0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73,
|
||||||
|
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65,
|
||||||
|
0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68,
|
||||||
|
0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||||
|
0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53,
|
||||||
|
0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x17,
|
||||||
0x5a, 0x15, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65,
|
0x5a, 0x15, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65,
|
||||||
0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
@ -747,39 +841,43 @@ func file_command_server_proto_server_proto_rawDescGZIP() []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_command_server_proto_server_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
var file_command_server_proto_server_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||||
var file_command_server_proto_server_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
var file_command_server_proto_server_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||||
var file_command_server_proto_server_proto_goTypes = []interface{}{
|
var file_command_server_proto_server_proto_goTypes = []interface{}{
|
||||||
(PprofRequest_Type)(0), // 0: proto.PprofRequest.Type
|
(PprofRequest_Type)(0), // 0: proto.PprofRequest.Type
|
||||||
(*PeersAddRequest)(nil), // 1: proto.PeersAddRequest
|
(*PeersAddRequest)(nil), // 1: proto.PeersAddRequest
|
||||||
(*PeersAddResponse)(nil), // 2: proto.PeersAddResponse
|
(*PeersAddResponse)(nil), // 2: proto.PeersAddResponse
|
||||||
(*PeersRemoveRequest)(nil), // 3: proto.PeersRemoveRequest
|
(*PeersRemoveRequest)(nil), // 3: proto.PeersRemoveRequest
|
||||||
(*PeersRemoveResponse)(nil), // 4: proto.PeersRemoveResponse
|
(*PeersRemoveResponse)(nil), // 4: proto.PeersRemoveResponse
|
||||||
(*PeersListRequest)(nil), // 5: proto.PeersListRequest
|
(*PeersListRequest)(nil), // 5: proto.PeersListRequest
|
||||||
(*PeersListResponse)(nil), // 6: proto.PeersListResponse
|
(*PeersListResponse)(nil), // 6: proto.PeersListResponse
|
||||||
(*PeersStatusRequest)(nil), // 7: proto.PeersStatusRequest
|
(*PeersStatusRequest)(nil), // 7: proto.PeersStatusRequest
|
||||||
(*PeersStatusResponse)(nil), // 8: proto.PeersStatusResponse
|
(*PeersStatusResponse)(nil), // 8: proto.PeersStatusResponse
|
||||||
(*Peer)(nil), // 9: proto.Peer
|
(*Peer)(nil), // 9: proto.Peer
|
||||||
(*PprofRequest)(nil), // 10: proto.PprofRequest
|
(*ChainSetHeadRequest)(nil), // 10: proto.ChainSetHeadRequest
|
||||||
(*PprofResponse)(nil), // 11: proto.PprofResponse
|
(*ChainSetHeadResponse)(nil), // 11: proto.ChainSetHeadResponse
|
||||||
nil, // 12: proto.PprofResponse.HeadersEntry
|
(*PprofRequest)(nil), // 12: proto.PprofRequest
|
||||||
|
(*PprofResponse)(nil), // 13: proto.PprofResponse
|
||||||
|
nil, // 14: proto.PprofResponse.HeadersEntry
|
||||||
}
|
}
|
||||||
var file_command_server_proto_server_proto_depIdxs = []int32{
|
var file_command_server_proto_server_proto_depIdxs = []int32{
|
||||||
9, // 0: proto.PeersListResponse.peers:type_name -> proto.Peer
|
9, // 0: proto.PeersListResponse.peers:type_name -> proto.Peer
|
||||||
9, // 1: proto.PeersStatusResponse.peer:type_name -> proto.Peer
|
9, // 1: proto.PeersStatusResponse.peer:type_name -> proto.Peer
|
||||||
0, // 2: proto.PprofRequest.type:type_name -> proto.PprofRequest.Type
|
0, // 2: proto.PprofRequest.type:type_name -> proto.PprofRequest.Type
|
||||||
12, // 3: proto.PprofResponse.headers:type_name -> proto.PprofResponse.HeadersEntry
|
14, // 3: proto.PprofResponse.headers:type_name -> proto.PprofResponse.HeadersEntry
|
||||||
10, // 4: proto.Bor.Pprof:input_type -> proto.PprofRequest
|
12, // 4: proto.Bor.Pprof:input_type -> proto.PprofRequest
|
||||||
1, // 5: proto.Bor.PeersAdd:input_type -> proto.PeersAddRequest
|
1, // 5: proto.Bor.PeersAdd:input_type -> proto.PeersAddRequest
|
||||||
3, // 6: proto.Bor.PeersRemove:input_type -> proto.PeersRemoveRequest
|
3, // 6: proto.Bor.PeersRemove:input_type -> proto.PeersRemoveRequest
|
||||||
5, // 7: proto.Bor.PeersList:input_type -> proto.PeersListRequest
|
5, // 7: proto.Bor.PeersList:input_type -> proto.PeersListRequest
|
||||||
7, // 8: proto.Bor.PeersStatus:input_type -> proto.PeersStatusRequest
|
7, // 8: proto.Bor.PeersStatus:input_type -> proto.PeersStatusRequest
|
||||||
11, // 9: proto.Bor.Pprof:output_type -> proto.PprofResponse
|
10, // 9: proto.Bor.ChainSetHead:input_type -> proto.ChainSetHeadRequest
|
||||||
2, // 10: proto.Bor.PeersAdd:output_type -> proto.PeersAddResponse
|
13, // 10: proto.Bor.Pprof:output_type -> proto.PprofResponse
|
||||||
4, // 11: proto.Bor.PeersRemove:output_type -> proto.PeersRemoveResponse
|
2, // 11: proto.Bor.PeersAdd:output_type -> proto.PeersAddResponse
|
||||||
6, // 12: proto.Bor.PeersList:output_type -> proto.PeersListResponse
|
4, // 12: proto.Bor.PeersRemove:output_type -> proto.PeersRemoveResponse
|
||||||
8, // 13: proto.Bor.PeersStatus:output_type -> proto.PeersStatusResponse
|
6, // 13: proto.Bor.PeersList:output_type -> proto.PeersListResponse
|
||||||
9, // [9:14] is the sub-list for method output_type
|
8, // 14: proto.Bor.PeersStatus:output_type -> proto.PeersStatusResponse
|
||||||
4, // [4:9] is the sub-list for method input_type
|
11, // 15: proto.Bor.ChainSetHead:output_type -> proto.ChainSetHeadResponse
|
||||||
|
10, // [10:16] is the sub-list for method output_type
|
||||||
|
4, // [4:10] is the sub-list for method input_type
|
||||||
4, // [4:4] is the sub-list for extension type_name
|
4, // [4:4] is the sub-list for extension type_name
|
||||||
4, // [4:4] is the sub-list for extension extendee
|
4, // [4:4] is the sub-list for extension extendee
|
||||||
0, // [0:4] is the sub-list for field type_name
|
0, // [0:4] is the sub-list for field type_name
|
||||||
|
|
@ -900,7 +998,7 @@ func file_command_server_proto_server_proto_init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_command_server_proto_server_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
file_command_server_proto_server_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*PprofRequest); i {
|
switch v := v.(*ChainSetHeadRequest); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
|
|
@ -912,6 +1010,30 @@ func file_command_server_proto_server_proto_init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_command_server_proto_server_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
file_command_server_proto_server_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*ChainSetHeadResponse); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_command_server_proto_server_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*PprofRequest); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_command_server_proto_server_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*PprofResponse); i {
|
switch v := v.(*PprofResponse); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
|
|
@ -930,7 +1052,7 @@ func file_command_server_proto_server_proto_init() {
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_command_server_proto_server_proto_rawDesc,
|
RawDescriptor: file_command_server_proto_server_proto_rawDesc,
|
||||||
NumEnums: 1,
|
NumEnums: 1,
|
||||||
NumMessages: 12,
|
NumMessages: 14,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ service Bor {
|
||||||
rpc PeersList(PeersListRequest) returns (PeersListResponse);
|
rpc PeersList(PeersListRequest) returns (PeersListResponse);
|
||||||
|
|
||||||
rpc PeersStatus(PeersStatusRequest) returns (PeersStatusResponse);
|
rpc PeersStatus(PeersStatusRequest) returns (PeersStatusResponse);
|
||||||
|
|
||||||
|
rpc ChainSetHead(ChainSetHeadRequest) returns (ChainSetHeadResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -58,6 +60,13 @@ message Peer {
|
||||||
bool static = 7;
|
bool static = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message ChainSetHeadRequest {
|
||||||
|
uint64 number = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChainSetHeadResponse {
|
||||||
|
}
|
||||||
|
|
||||||
message PprofRequest {
|
message PprofRequest {
|
||||||
Type type = 1;
|
Type type = 1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ type BorClient interface {
|
||||||
PeersRemove(ctx context.Context, in *PeersRemoveRequest, opts ...grpc.CallOption) (*PeersRemoveResponse, error)
|
PeersRemove(ctx context.Context, in *PeersRemoveRequest, opts ...grpc.CallOption) (*PeersRemoveResponse, error)
|
||||||
PeersList(ctx context.Context, in *PeersListRequest, opts ...grpc.CallOption) (*PeersListResponse, error)
|
PeersList(ctx context.Context, in *PeersListRequest, opts ...grpc.CallOption) (*PeersListResponse, error)
|
||||||
PeersStatus(ctx context.Context, in *PeersStatusRequest, opts ...grpc.CallOption) (*PeersStatusResponse, error)
|
PeersStatus(ctx context.Context, in *PeersStatusRequest, opts ...grpc.CallOption) (*PeersStatusResponse, error)
|
||||||
|
ChainSetHead(ctx context.Context, in *ChainSetHeadRequest, opts ...grpc.CallOption) (*ChainSetHeadResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type borClient struct {
|
type borClient struct {
|
||||||
|
|
@ -78,6 +79,15 @@ func (c *borClient) PeersStatus(ctx context.Context, in *PeersStatusRequest, opt
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *borClient) ChainSetHead(ctx context.Context, in *ChainSetHeadRequest, opts ...grpc.CallOption) (*ChainSetHeadResponse, error) {
|
||||||
|
out := new(ChainSetHeadResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/proto.Bor/ChainSetHead", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// BorServer is the server API for Bor service.
|
// BorServer is the server API for Bor service.
|
||||||
// All implementations must embed UnimplementedBorServer
|
// All implementations must embed UnimplementedBorServer
|
||||||
// for forward compatibility
|
// for forward compatibility
|
||||||
|
|
@ -87,6 +97,7 @@ type BorServer interface {
|
||||||
PeersRemove(context.Context, *PeersRemoveRequest) (*PeersRemoveResponse, error)
|
PeersRemove(context.Context, *PeersRemoveRequest) (*PeersRemoveResponse, error)
|
||||||
PeersList(context.Context, *PeersListRequest) (*PeersListResponse, error)
|
PeersList(context.Context, *PeersListRequest) (*PeersListResponse, error)
|
||||||
PeersStatus(context.Context, *PeersStatusRequest) (*PeersStatusResponse, error)
|
PeersStatus(context.Context, *PeersStatusRequest) (*PeersStatusResponse, error)
|
||||||
|
ChainSetHead(context.Context, *ChainSetHeadRequest) (*ChainSetHeadResponse, error)
|
||||||
mustEmbedUnimplementedBorServer()
|
mustEmbedUnimplementedBorServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,6 +120,9 @@ func (UnimplementedBorServer) PeersList(context.Context, *PeersListRequest) (*Pe
|
||||||
func (UnimplementedBorServer) PeersStatus(context.Context, *PeersStatusRequest) (*PeersStatusResponse, error) {
|
func (UnimplementedBorServer) PeersStatus(context.Context, *PeersStatusRequest) (*PeersStatusResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method PeersStatus not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method PeersStatus not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedBorServer) ChainSetHead(context.Context, *ChainSetHeadRequest) (*ChainSetHeadResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method ChainSetHead not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedBorServer) mustEmbedUnimplementedBorServer() {}
|
func (UnimplementedBorServer) mustEmbedUnimplementedBorServer() {}
|
||||||
|
|
||||||
// UnsafeBorServer may be embedded to opt out of forward compatibility for this service.
|
// UnsafeBorServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
|
@ -212,6 +226,24 @@ func _Bor_PeersStatus_Handler(srv interface{}, ctx context.Context, dec func(int
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Bor_ChainSetHead_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(ChainSetHeadRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(BorServer).ChainSetHead(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/proto.Bor/ChainSetHead",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(BorServer).ChainSetHead(ctx, req.(*ChainSetHeadRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// Bor_ServiceDesc is the grpc.ServiceDesc for Bor service.
|
// Bor_ServiceDesc is the grpc.ServiceDesc for Bor service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
|
@ -239,6 +271,10 @@ var Bor_ServiceDesc = grpc.ServiceDesc{
|
||||||
MethodName: "PeersStatus",
|
MethodName: "PeersStatus",
|
||||||
Handler: _Bor_PeersStatus_Handler,
|
Handler: _Bor_PeersStatus_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ChainSetHead",
|
||||||
|
Handler: _Bor_ChainSetHead_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "command/server/proto/server.proto",
|
Metadata: "command/server/proto/server.proto",
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import (
|
||||||
type Server struct {
|
type Server struct {
|
||||||
proto.UnimplementedBorServer
|
proto.UnimplementedBorServer
|
||||||
node *node.Node
|
node *node.Node
|
||||||
|
backend *eth.Ethereum
|
||||||
grpcServer *grpc.Server
|
grpcServer *grpc.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,6 +68,7 @@ func NewServer(config *Config) (*Server, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
srv.backend = backend
|
||||||
|
|
||||||
// debug tracing is enabled by default
|
// debug tracing is enabled by default
|
||||||
stack.RegisterAPIs(tracers.APIs(backend.APIBackend))
|
stack.RegisterAPIs(tracers.APIs(backend.APIBackend))
|
||||||
|
|
|
||||||
|
|
@ -102,3 +102,8 @@ func peerInfoToPeer(info *p2p.PeerInfo) *proto.Peer {
|
||||||
Static: info.Network.Static,
|
Static: info.Network.Static,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) ChainSetHead(ctx context.Context, req *proto.ChainSetHeadRequest) (*proto.ChainSetHeadResponse, error) {
|
||||||
|
s.backend.APIBackend.SetHead(req.Number)
|
||||||
|
return &proto.ChainSetHeadResponse{}, nil
|
||||||
|
}
|
||||||
|
|
|
||||||
2
go.sum
2
go.sum
|
|
@ -691,6 +691,8 @@ google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8
|
||||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c=
|
google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c=
|
||||||
google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||||
|
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE=
|
||||||
|
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||||
|
|
|
||||||
5
scripts/tools-protobuf.sh
Normal file
5
scripts/tools-protobuf.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.12.0/protoc-3.12.0-linux-x86_64.zip
|
||||||
|
sudo unzip protoc-3.12.0-linux-x86_64.zip -d /usr/local/bin
|
||||||
|
|
||||||
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.25.0
|
||||||
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1
|
||||||
Loading…
Reference in a new issue