Skip to content

Commit

Permalink
feat: replace venus-gateway with sophon-gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Jun 8, 2023
1 parent 452ecda commit eb17db8
Show file tree
Hide file tree
Showing 37 changed files with 219 additions and 186 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build_upload:
uses: filecoin-project/venus/.github/workflows/common_build_upload.yml@master
with:
bin_name: 'venus-gateway'
bin_name: 'sophon-gateway'
has_ffi: true
secrets:
OSS_KEY_ID: ${{secrets.OSS_KEY_ID}}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
./venus*
.idea
.vscode
venus-gateway
sophon-gateway
server
client
token
Expand Down
18 changes: 9 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# venus-gateway changelog
# sophon-gateway changelog

## v1.11.1

Expand All @@ -10,19 +10,19 @@
## v1.11.0-rc1

### New Features
* feat: add status api to detect api ready / 添加状态检测接口[[#116](https://github.com/ipfs-force-community/venus-gateway/pull/116)]
* feat:update the auth client with token /客户端token验证 [[#117](https://github.com/ipfs-force-community/venus-gateway/pull/117)]
* feat: refactor market event / 重构market event [[#112](https://github.com/ipfs-force-community/venus-gateway/pull/112)]
* feat: rm isUnseal method in market envent / 移除 IsUnseal 方法 [[#125](https://github.com/ipfs-force-community/venus-gateway/pull/125)]
* feat: add docker push /增加推送到镜像仓库的功能 [[#126](https://github.com/ipfs-force-community/venus-gateway/pull/126)]
* feat: add status api to detect api ready / 添加状态检测接口[[#116](https://github.com/ipfs-force-community/sophon-gateway/pull/116)]
* feat:update the auth client with token /客户端token验证 [[#117](https://github.com/ipfs-force-community/sophon-gateway/pull/117)]
* feat: refactor market event / 重构market event [[#112](https://github.com/ipfs-force-community/sophon-gateway/pull/112)]
* feat: rm isUnseal method in market envent / 移除 IsUnseal 方法 [[#125](https://github.com/ipfs-force-community/sophon-gateway/pull/125)]
* feat: add docker push /增加推送到镜像仓库的功能 [[#126](https://github.com/ipfs-force-community/sophon-gateway/pull/126)]

# v1.10.1

* 支持注册 delegated address [[#122](https://github.com/ipfs-force-community/venus-gateway/pull/122)]
* 升级 venus 和 venus-auth 版本到 v1.10.1
* 支持注册 delegated address [[#122](https://github.com/ipfs-force-community/sophon-gateway/pull/122)]
* 升级 venus 和 sophon-auth 版本到 v1.10.1

## v1.10.0

* 升级 venus 和 venus-auth 版本到 v1.10.0
* 升级 venus 和 sophon-auth 版本到 v1.10.0
* 升级 filecoin-ffi 版本到 v1.20.0
* 升级 go-jsonrpc 版本到 v0.1.7
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ all: build
# git modules that need to be loaded
MODULES:=

ldflags=-X=github.com/ipfs-force-community/venus-gateway/version.CurrentCommit=+git.$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))
ldflags=-X=github.com/ipfs-force-community/sophon-gateway/version.CurrentCommit=+git.$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))
ifneq ($(strip $(LDFLAGS)),)
ldflags+=-extldflags=$(LDFLAGS)
endif
Expand Down Expand Up @@ -57,12 +57,12 @@ dist-clean:
git submodule deinit --all -f

build: $(BUILD_DEPS)
rm -f venus-gateway
go build -o ./venus-gateway $(GOFLAGS) .
rm -f sophon-gateway
go build -o ./sophon-gateway $(GOFLAGS) .

debug: $(BUILD_DEPS)
rm -f venus-gateway
go build -gcflags=all="-N -l" -o ./venus-gateway $(GOFLAGS) .
rm -f sophon-gateway
go build -gcflags=all="-N -l" -o ./sophon-gateway $(GOFLAGS) .

.PHONY: docker

Expand All @@ -73,11 +73,11 @@ ifdef DOCKERFILE
else
curl -o dockerfile https://raw.githubusercontent.com/filecoin-project/venus-docs/master/script/docker/dockerfile
endif
docker build --build-arg HTTPS_PROXY=$(BUILD_DOCKER_PROXY) --build-arg BUILD_TARGET=venus-gateway -t venus-gateway .
docker tag venus-gateway filvenus/venus-gateway:$(TAG)
docker build --build-arg HTTPS_PROXY=$(BUILD_DOCKER_PROXY) --build-arg BUILD_TARGET=sophon-gateway -t sophon-gateway .
docker tag sophon-gateway filvenus/sophon-gateway:$(TAG)
ifdef PRIVATE_REGISTRY
docker tag venus-gateway $(PRIVATE_REGISTRY)/filvenus/venus-gateway:$(TAG)
docker tag sophon-gateway $(PRIVATE_REGISTRY)/filvenus/sophon-gateway:$(TAG)
endif

docker-push: docker
docker push $(PRIVATE_REGISTRY)/filvenus/venus-gateway:$(TAG)
docker push $(PRIVATE_REGISTRY)/filvenus/sophon-gateway:$(TAG)
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<h1 align="center">Venus Gateway</h1>
<h1 align="center">Sophon Gateway</h1>

<p align="center">
<a href="https://github.com/ipfs-force-community/venus-gateway/actions"><img src="https://github.com/ipfs-force-community/venus-gateway/actions/workflows/build_upload.yml/badge.svg"/></a>
<a href="https://codecov.io/gh/ipfs-force-community/venus-gateway"><img src="https://codecov.io/gh/ipfs-force-community/venus-gateway/branch/master/graph/badge.svg?token=J5QWYWkgHT"/></a>
<a href="https://goreportcard.com/report/github.com/ipfs-force-community/venus-gateway"><img src="https://goreportcard.com/badge/github.com/ipfs-force-community/venus-gateway"/></a>
<a href="https://github.com/ipfs-force-community/venus-gateway/tags"><img src="https://img.shields.io/github/v/tag/ipfs-force-community/venus-gateway"/></a>
<a href="https://github.com/ipfs-force-community/sophon-gateway/actions"><img src="https://github.com/ipfs-force-community/sophon-gateway/actions/workflows/build_upload.yml/badge.svg"/></a>
<a href="https://codecov.io/gh/ipfs-force-community/sophon-gateway"><img src="https://codecov.io/gh/ipfs-force-community/sophon-gateway/branch/master/graph/badge.svg?token=J5QWYWkgHT"/></a>
<a href="https://goreportcard.com/report/github.com/ipfs-force-community/sophon-gateway"><img src="https://goreportcard.com/badge/github.com/ipfs-force-community/sophon-gateway"/></a>
<a href="https://github.com/ipfs-force-community/sophon-gateway/tags"><img src="https://img.shields.io/github/v/tag/ipfs-force-community/sophon-gateway"/></a>
<br>
</p>

venus-gateway used to simplify deployment and reduce the complexity of miner access. Increase the security of miner access
sophon-gateway used to simplify deployment and reduce the complexity of miner access. Increase the security of miner access

1. miners don't need external IP and exposure wallet services
2. the connection between all miners and the pool is safe after the pool configure with HTTPS
Expand All @@ -20,4 +20,4 @@ Use [Venus Issues](https://github.com/filecoin-project/venus/issues) for reporti

### How to use

[quick start](https://github.com/ipfs-force-community/venus-gateway/blob/master/docs/en/getting-started.md) | [中文](https://github.com/ipfs-force-community/venus-gateway/blob/master/docs/zh/%E5%BF%AB%E9%80%9F%E5%90%AF%E7%94%A8.md)
[quick start](https://github.com/ipfs-force-community/sophon-gateway/blob/master/docs/en/getting-started.md) | [中文](https://github.com/ipfs-force-community/sophon-gateway/blob/master/docs/zh/%E5%BF%AB%E9%80%9F%E5%90%AF%E7%94%A8.md)
8 changes: 4 additions & 4 deletions api/rpc_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
sharedTypes "github.com/filecoin-project/venus/venus-shared/types"
gtypes "github.com/filecoin-project/venus/venus-shared/types/gateway"

"github.com/ipfs-force-community/venus-gateway/marketevent"
"github.com/ipfs-force-community/venus-gateway/proofevent"
"github.com/ipfs-force-community/venus-gateway/version"
"github.com/ipfs-force-community/venus-gateway/walletevent"
"github.com/ipfs-force-community/sophon-gateway/marketevent"
"github.com/ipfs-force-community/sophon-gateway/proofevent"
"github.com/ipfs-force-community/sophon-gateway/version"
"github.com/ipfs-force-community/sophon-gateway/walletevent"
)

type IGatewayPushAPI interface {
Expand Down
2 changes: 1 addition & 1 deletion cmds/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
_ "github.com/filecoin-project/venus/venus-shared/api"
v2API "github.com/filecoin-project/venus/venus-shared/api/gateway/v2"

"github.com/ipfs-force-community/venus-gateway/config"
"github.com/ipfs-force-community/sophon-gateway/config"
)

func NewGatewayClient(ctx *cli.Context) (v2API.IGateway, jsonrpc.ClientCloser, error) {
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func DefaultConfig() *Config {
cfg.Metrics.Exporter.Graphite.Namespace = namespace
cfg.Metrics.Exporter.Prometheus.EndPoint = "/ip4/0.0.0.0/tcp/4569"
cfg.Metrics.Exporter.Graphite.Port = 4569
cfg.Trace.ServerName = "venus-gateway"
cfg.Trace.ServerName = "sophon-gateway"
cfg.Trace.JaegerEndpoint = ""

return cfg
Expand Down
30 changes: 15 additions & 15 deletions docs/en/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# venus-gateway
# sophon-gateway

The venus-gateway is used for registering wallets, keeping track of miner-related information, and as a liaison between wallets and other components. It could be also used for proxy requests from chain services (shared modules/components) to independent modules/components.
The sophon-gateway is used for registering wallets, keeping track of miner-related information, and as a liaison between wallets and other components. It could be also used for proxy requests from chain services (shared modules/components) to independent modules/components.

## Start venus-gateway
## Start sophon-gateway

Download source code.

```shell script
git clone https://github.com/ipfs-force-community/venus-gateway.git
git clone https://github.com/ipfs-force-community/sophon-gateway.git
```

Compile.
Expand All @@ -19,12 +19,12 @@ make
Start service.

```shell script
./venus-gateway run
./sophon-gateway run
```

:::tip

A successful startup will generate two files, `config.toml` and `token`, in the default repo directory `~/.venusgateway`. Inside `config.toml` is the configuration item for `venus-gateway`. `token` file is stored in JWT token, used for command execution.
A successful startup will generate two files, `config.toml` and `token`, in the default repo directory `~/.sophon-gateway`. Inside `config.toml` is the configuration item for `sophon-gateway`. `token` file is stored in JWT token, used for command execution.

:::

Expand All @@ -33,19 +33,19 @@ A successful startup will generate two files, `config.toml` and `token`, in the
Check help information.

```shell script
./venus-gateway -h
./sophon-gateway -h

NAME:
venus-gateway - venus-gateway for proxy incoming wallet and proof
sophon-gateway - sophon-gateway for proxy incoming wallet and proof

USAGE:
venus-gateway [global options] command [command options] [arguments...]
sophon-gateway [global options] command [command options] [arguments...]

VERSION:
0.0.1'+gitc2048fb'

COMMANDS:
run start venus-gateway daemon
run start sophon-gateway daemon
miner miner cmds
wallet wallet cmds
help, h Shows a list of commands or help for one command
Expand All @@ -63,7 +63,7 @@ GLOBAL OPTIONS:
List all miners.

```shell script
$ ./venus-gateway miner list
$ ./sophon-gateway miner list

# output
t01561
Expand All @@ -74,7 +74,7 @@ t02082
Check miner status.

```shell script
$ ./venus-gateway miner <MINER_ID>
$ ./sophon-gateway miner <MINER_ID>

# output
{
Expand All @@ -95,7 +95,7 @@ $ ./venus-gateway miner <MINER_ID>
List all wallets.

```shell script
$ ./venus-gateway wallet list
$ ./sophon-gateway wallet list

# output
[
Expand Down Expand Up @@ -140,9 +140,9 @@ $ ./venus-gateway wallet list
Check individual wallet.

```shell script
$ ./venus-gateway wallet <wallet-account>
$ ./sophon-gateway wallet <wallet-account>
```

### Check if wallet address exists

Everytime gateway starts up, it will generate a random string (`gateway_string`). When a wallet tries to connect to gateway, it will carry a randomly generated string by itself (`wallet_string`). Gateway will then check each wallet address by calling `sign` interface with hash of gateway_string + wallet_string as payload. Through `MsgMeta.Extra`, `gateway_string` will also be transferred to wallet. And finally the result of wallet's `sign` will be validatated by gateway.
Every time gateway starts up, it will generate a random string (`gateway_string`). When a wallet tries to connect to gateway, it will carry a randomly generated string by itself (`wallet_string`). Gateway will then check each wallet address by calling `sign` interface with hash of gateway_string + wallet_string as payload. Through `MsgMeta.Extra`, `gateway_string` will also be transferred to wallet. And finally the result of wallet's `sign` will be validated by gateway.
6 changes: 3 additions & 3 deletions docs/zh/metrics-使用说明.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# venus-gateway metrics 使用说明
# sophon-gateway metrics 使用说明

## 配置

Expand Down Expand Up @@ -42,7 +42,7 @@

exporter端口为 `4569`,url为 `debug/metrics`, 因此对于默认的部署方式,exporter的url为 `host:4569/debug/metrics`

如果配置 `Prometheus exporter`,则在 `venus-gateway` 服务启动时会附带启动 `Prometheus exporter` 的监听服务,可以通过以下方式快速查看指标:
如果配置 `Prometheus exporter`,则在 `sophon-gateway` 服务启动时会附带启动 `Prometheus exporter` 的监听服务,可以通过以下方式快速查看指标:

```bash
$ curl http://localhost:4569/debug/metrics
Expand All @@ -65,7 +65,7 @@ $ curl http://localhost:4569/debug/metrics
$ curl http://<ip>:4569/debug/metrics
```

如果配置 `Graphite exporter`,需要先启动 `Graphite exporter` 的收集器服务, `venus-gateway` 服务启动时将指标上报给收集器。服务启动参考 [Graphite exporter](https://github.com/prometheus/graphite_exporter) 中的说明。
如果配置 `Graphite exporter`,需要先启动 `Graphite exporter` 的收集器服务, `sophon-gateway` 服务启动时将指标上报给收集器。服务启动参考 [Graphite exporter](https://github.com/prometheus/graphite_exporter) 中的说明。

`Graphite exporter``Prometheus exporter` 自身都不带图形界面的,如果需要可视化监控及更高阶的图表分析,请到 `venus-docs` 项目中查找关于 `Prometheus+Grafana` 的说明文档。

Expand Down
31 changes: 15 additions & 16 deletions docs/zh/快速启用.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Venus Gateway
# Sophon Gateway

venus-gateway用于注册钱包,矿工相关信息,也是其它组件和钱包交流的中间桥梁。用于代理从共享组件调用本地组件的请求。
sophon-gateway用于注册钱包,矿工相关信息,也是其它组件和钱包交流的中间桥梁。用于代理从共享组件调用本地组件的请求。

## 快速启动

### 下载代码

```shell script
git clone https://github.com/ipfs-force-community/venus-gateway.git
git clone https://github.com/ipfs-force-community/sophon-gateway.git
```

### 编译
Expand All @@ -19,12 +19,12 @@ make
### 启动服务

```shell script
./venus-gateway run
./sophon-gateway run
```

:::tip

启动成功会在默认的`repo`目录 `~/.venusgateway` 中生成 `config.toml``token` 两个文件,`config.toml` 里面是 `venus-gateway` 的配置项,`token` 文件里面存的是 jwt token,给命令行使用
启动成功会在默认的`repo`目录 `~/.sophon-gateway` 中生成 `config.toml``token` 两个文件,`config.toml` 里面是 `sophon-gateway` 的配置项,`token` 文件里面存的是 jwt token,给命令行使用

:::

Expand All @@ -33,19 +33,19 @@ make
### 查看帮助

```shell script
./venus-gateway -h
./sophon-gateway -h

NAME:
venus-gateway - venus-gateway for proxy incoming wallet and proof
sophon-gateway - sophon-gateway for proxy incoming wallet and proof

USAGE:
venus-gateway [global options] command [command options] [arguments...]
sophon-gateway [global options] command [command options] [arguments...]

VERSION:
0.0.1'+gitc2048fb'

COMMANDS:
run start venus-gateway daemon
run start sophon-gateway daemon
miner miner cmds
wallet wallet cmds
help, h Shows a list of commands or help for one command
Expand All @@ -56,14 +56,14 @@ GLOBAL OPTIONS:
--version, -v print the version (default: false)
```

### venus gateway 基础操作
### sophon gateway 基础操作

#### miner相关

1. 列出 miner

```shell script
./venus-gateway miner list
./sophon-gateway miner list

# res
t01561
Expand All @@ -74,7 +74,7 @@ t02082
2. 查看单个miner状态

```shell script
./venus-gateway miner <miner-id>
./sophon-gateway miner <miner-id>

# res
{
Expand All @@ -95,7 +95,7 @@ t02082
1. 列出钱包

```shell script
./venus-gateway wallet list
./sophon-gateway wallet list

# res
[
Expand Down Expand Up @@ -140,12 +140,11 @@ t02082
2. 查看单个钱包

```shell script
./venus-gateway wallet <wallet-account>
./sophon-gateway wallet <wallet-account>
```

### 验证钱包地址是否真实存在

1. gateway 每次启动会生成一个随机的字符串(gateway_string)
2. 钱包注册时携带一个随机字符串(wallet_string)给到 gateway
3. gateway 逐个验证钱包注册的地址:gateway 会调用`sign`接口,签名的数据是 hash(gateway_string+wallet_string)后的新的字符串,并通过 `MsgMeta.Extra`
`gateway_string` 携带给钱包,最后gateway验证钱包签名后的结果
3. gateway 逐个验证钱包注册的地址:gateway 会调用`sign`接口,签名的数据是 hash(gateway_string+wallet_string)后的新的字符串,并通过 `MsgMeta.Extra``gateway_string` 携带给钱包,最后gateway验证钱包签名后的结果
Loading

0 comments on commit eb17db8

Please sign in to comment.