update package

This commit is contained in:
a 2022-10-25 07:32:28 -05:00
parent 13d7178cb5
commit a8eef9731f
6 changed files with 21 additions and 12 deletions

View File

@ -28,7 +28,12 @@ func main() {
defer borDb.Close() defer borDb.Close()
} }
r := chi.NewRouter() r := chi.NewRouter()
RouteServer(r, *cfg) // route the server
if !cfg.OtsServerDisable {
RouteServer(r, *cfg)
}
apiList := mycmds.APIList(db, borDb, backend, txPool, mining, ff, stateCache, blockReader, agg, *cfg) apiList := mycmds.APIList(db, borDb, backend, txPool, mining, ff, stateCache, blockReader, agg, *cfg)
if err := cli.StartRpcServer(ctx, r, *cfg, apiList); err != nil { if err := cli.StartRpcServer(ctx, r, *cfg, apiList); err != nil {
log.Error(err.Error()) log.Error(err.Error())

View File

@ -6,6 +6,8 @@ import (
"strings" "strings"
"gfx.cafe/open/4bytes/sigs" "gfx.cafe/open/4bytes/sigs"
"gfx.cafe/open/4bytes/topics"
"gfx.cafe/open/4bytes/triemap"
"github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware" "github.com/go-chi/chi/v5/middleware"
"github.com/wmitsuda/otterscan/cmd/otter/cli/httpcfg" "github.com/wmitsuda/otterscan/cmd/otter/cli/httpcfg"
@ -16,7 +18,8 @@ func RouteServer(r chi.Router, cfg httpcfg.HttpCfg) {
filesDir := http.Dir(cfg.OtsStaticDir) filesDir := http.Dir(cfg.OtsStaticDir)
r.Use(middleware.Logger) r.Use(middleware.Logger)
r.Use(middleware.Recoverer) r.Use(middleware.Recoverer)
r.Handle("/signatures/{hash}", &sigs.HttpServer{}) r.HandleFunc("/signatures/{hash}", triemap.HttpHandler(sigs.Both))
r.HandleFunc("/topic0/{hash}", triemap.HttpHandler(topics.Both))
r.HandleFunc("/config.json", func(w http.ResponseWriter, r *http.Request) { r.HandleFunc("/config.json", func(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(map[string]any{ json.NewEncoder(w).Encode(map[string]any{
"erigonURL": cfg.OtsRpcDaemonUrl, "erigonURL": cfg.OtsRpcDaemonUrl,

View File

@ -16,4 +16,4 @@ services:
--metrics --metrics.addr=0.0.0.0 --metrics.port=6064 --metrics --metrics.addr=0.0.0.0 --metrics.port=6064
--pprof --pprof.addr=0.0.0.0 --pprof.port=6000 --pprof --pprof.addr=0.0.0.0 --pprof.port=6000
ports: ports:
- 3000:8545 - 3001:8545

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.19
replace github.com/tendermint/tendermint => github.com/bnb-chain/tendermint v0.31.12 replace github.com/tendermint/tendermint => github.com/bnb-chain/tendermint v0.31.12
require ( require (
gfx.cafe/open/4bytes v0.0.0-20221025085909-a307043c1e5e gfx.cafe/open/4bytes v0.0.0-20221025122240-de8bf0bf48d0
github.com/RoaringBitmap/roaring v1.2.1 github.com/RoaringBitmap/roaring v1.2.1
github.com/go-chi/chi/v5 v5.0.7 github.com/go-chi/chi/v5 v5.0.7
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d

6
go.sum
View File

@ -8,6 +8,12 @@ crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508/go.mod h1:igAO5JulrQ1Dbd
filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU=
gfx.cafe/open/4bytes v0.0.0-20221025085909-a307043c1e5e h1:Fl+QPNlTOVAxKqSEdut5fH+/To4TPE8kg8weQ3LGzUY= gfx.cafe/open/4bytes v0.0.0-20221025085909-a307043c1e5e h1:Fl+QPNlTOVAxKqSEdut5fH+/To4TPE8kg8weQ3LGzUY=
gfx.cafe/open/4bytes v0.0.0-20221025085909-a307043c1e5e/go.mod h1:C0vwSYhh1b/ckPTkpq0kDXk32vU4DT5QuQwYLxO6W2c= gfx.cafe/open/4bytes v0.0.0-20221025085909-a307043c1e5e/go.mod h1:C0vwSYhh1b/ckPTkpq0kDXk32vU4DT5QuQwYLxO6W2c=
gfx.cafe/open/4bytes v0.0.0-20221025114135-d7c548af19db h1:M34YDF/XRgqMSV9YAamH8u599fd67SJ95v6PQxP/96o=
gfx.cafe/open/4bytes v0.0.0-20221025114135-d7c548af19db/go.mod h1:C0vwSYhh1b/ckPTkpq0kDXk32vU4DT5QuQwYLxO6W2c=
gfx.cafe/open/4bytes v0.0.0-20221025121800-1d49c2434a12 h1:DpJNnzuMmIyIB1NTNJKybdYkR4gjIV7q/WzNQMS5/J0=
gfx.cafe/open/4bytes v0.0.0-20221025121800-1d49c2434a12/go.mod h1:C0vwSYhh1b/ckPTkpq0kDXk32vU4DT5QuQwYLxO6W2c=
gfx.cafe/open/4bytes v0.0.0-20221025122240-de8bf0bf48d0 h1:LOv6iGWTv80aSGw9zb7P8varDijsj/G2s7pr32VH1d0=
gfx.cafe/open/4bytes v0.0.0-20221025122240-de8bf0bf48d0/go.mod h1:C0vwSYhh1b/ckPTkpq0kDXk32vU4DT5QuQwYLxO6W2c=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=

View File

@ -45,21 +45,16 @@
}, },
"scripts": { "scripts": {
"start": "vite", "start": "vite",
"clean": "rm -rf chains topic0 4bytes dist", "clean": "rm -rf chains dist",
"fullbuild": "npm run dl-all && npm run build", "fullbuild": "npm run dl-all && npm run build",
"build": "tsc && vite build", "build": "tsc && vite build",
"postbuild": "npm run copy-all", "postbuild": "npm run copy-all",
"preview": "vite preview", "preview": "vite preview",
"dl-all":"npm run clean && npm run dl-chains && npm run dl-topic0", "dl-all":"npm run clean && npm run dl-chains",
"dl-chains": "svn checkout https://github.com/ethereum-lists/chains/trunk/_data/chains && rm -rf chains/.svn", "dl-chains": "svn checkout https://github.com/ethereum-lists/chains/trunk/_data/chains && rm -rf chains/.svn",
"dl-topic0": "git clone https://github.com/wmitsuda/topic0 && rm -rf topic0/.git", "copy-all":"npm run copy-chains",
"copy-all":"npm run copy-chains && npm run copy-topic0",
"copy-chains": "rsync -ah chains dist", "copy-chains": "rsync -ah chains dist",
"copy-topic0": "mkdir -p dist/topic0 && rsync -ah topic0/with_parameter_names/ dist/topic0/",
"source-map-explorer": "source-map-explorer build/static/js/*.js", "source-map-explorer": "source-map-explorer build/static/js/*.js",
"assets-start": "docker run --rm -p 3001:80 --name otterscan-assets -d -v$(pwd)/4bytes/signatures:/usr/share/nginx/html/signatures/ -v$(pwd)/trustwallet/blockchains/ethereum/assets:/usr/share/nginx/html/assets/1 -v$(pwd)/topic0/with_parameter_names:/usr/share/nginx/html/topic0/ -v$(pwd)/chains/_data/chains:/usr/share/nginx/html/chains/ -v$(pwd)/nginx/nginx.conf:/etc/nginx/nginx.conf -v$(pwd)/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf nginx:1.21.1-alpine",
"assets-start-with-param-names": "docker run --rm -p 3001:80 --name otterscan-assets -d -v$(pwd)/4bytes/with_parameter_names:/usr/share/nginx/html/signatures/ -v$(pwd)/trustwallet/blockchains/ethereum/assets:/usr/share/nginx/html/assets/1 -v$(pwd)/topic0/with_parameter_names:/usr/share/nginx/html/topic0/ -v$(pwd)/chains/_data/chains:/usr/share/nginx/html/chains/ -v$(pwd)/nginx/nginx.conf:/etc/nginx/nginx.conf -v$(pwd)/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf nginx:1.21.1-alpine",
"assets-stop": "docker stop otterscan-assets",
"docker-build": "docker buildx build -t otterscan .", "docker-build": "docker buildx build -t otterscan .",
"docker-start": "docker run --rm -p 5000:80 --name otterscan -d otterscan", "docker-start": "docker run --rm -p 5000:80 --name otterscan -d otterscan",
"docker-stop": "docker stop otterscan" "docker-stop": "docker stop otterscan"