progress
This commit is contained in:
parent
00a69a0f30
commit
a828aa9e46
|
@ -26,7 +26,6 @@ yarn-error.log*
|
|||
/.vscode
|
||||
.gitsigners
|
||||
|
||||
4bytes/
|
||||
chains/
|
||||
topic0/
|
||||
|
||||
|
|
116
Dockerfile
116
Dockerfile
|
@ -1,104 +1,42 @@
|
|||
# syntax=docker/dockerfile-upstream:master-labs
|
||||
FROM node:16.16.0-alpine3.15 AS builder
|
||||
|
||||
RUN apk add git subversion rsync
|
||||
WORKDIR /otterscan-build
|
||||
COPY ["package.json", "package-lock.json", "/otterscan-build/"]
|
||||
RUN npm install
|
||||
COPY ["run-nginx.sh", "tsconfig.json", "tsconfig.node.json", "postcss.config.js", "tailwind.config.js", "vite.config.ts", "index.html", "/otterscan-build/"]
|
||||
COPY ["tsconfig.json", "tsconfig.node.json", "postcss.config.js", "tailwind.config.js", "vite.config.ts", "index.html", "/otterscan-build/"]
|
||||
COPY ["public", "/otterscan-build/public/"]
|
||||
COPY ["src", "/otterscan-build/src/"]
|
||||
RUN npm run build
|
||||
RUN npm run fullbuild
|
||||
|
||||
FROM alpine:3.15.0 AS logobuilder
|
||||
RUN apk add imagemagick parallel
|
||||
WORKDIR /assets
|
||||
COPY trustwallet/blockchains/ethereum/assets /assets/1/
|
||||
COPY trustwallet/blockchains/polygon/assets /assets/137/
|
||||
COPY trustwallet/blockchains/smartchain/assets /assets/56/
|
||||
RUN apk add imagemagick parallel subversion git
|
||||
WORKDIR /
|
||||
ADD https://github.com/trustwallet/assets.git /trustwallet
|
||||
RUN mkdir -p /assets/
|
||||
RUN mv /trustwallet/blockchains/ethereum/assets /assets/1/
|
||||
RUN mv /trustwallet/blockchains/polygon/assets /assets/137/
|
||||
RUN mv /trustwallet/blockchains/smartchain/assets /assets/56/
|
||||
RUN find . -name logo.png | parallel magick convert {} -filter Lanczos -resize 32x32 {}; exit 0
|
||||
|
||||
FROM alpine:3.15.0 AS fourbytesbuilder
|
||||
WORKDIR /signatures
|
||||
COPY 4bytes/signatures /signatures/
|
||||
COPY 4bytes/with_parameter_names /signatures/
|
||||
|
||||
FROM alpine:3.15.0 AS topic0builder
|
||||
WORKDIR /topic0
|
||||
COPY topic0/with_parameter_names /topic0/
|
||||
|
||||
FROM alpine:3.15.0 AS chainsbuilder
|
||||
WORKDIR /chains
|
||||
COPY chains/_data/chains /chains/
|
||||
|
||||
# Add brotli module to official nginx image
|
||||
# Based on: https://github.com/nginxinc/docker-nginx/tree/master/modules
|
||||
FROM nginx:1.21.3-alpine as nginxbuilder
|
||||
FROM golang:1.19-alpine as gobuilder
|
||||
RUN apk add alpine-sdk
|
||||
|
||||
RUN set -ex \
|
||||
&& apk update \
|
||||
&& apk add linux-headers openssl-dev pcre-dev zlib-dev openssl abuild \
|
||||
musl-dev libxslt libxml2-utils make mercurial gcc unzip git \
|
||||
xz g++ coreutils \
|
||||
# allow abuild as a root user \
|
||||
&& printf "#!/bin/sh\\nSETFATTR=true /usr/bin/abuild -F \"\$@\"\\n" > /usr/local/bin/abuild \
|
||||
&& chmod +x /usr/local/bin/abuild \
|
||||
&& hg clone -r ${NGINX_VERSION}-${PKG_RELEASE} https://hg.nginx.org/pkg-oss/ \
|
||||
&& cd pkg-oss \
|
||||
&& mkdir /tmp/packages \
|
||||
&& for module in "brotli"; do \
|
||||
echo "Building $module for nginx-$NGINX_VERSION"; \
|
||||
if [ -d /modules/$module ]; then \
|
||||
echo "Building $module from user-supplied sources"; \
|
||||
# check if module sources file is there and not empty
|
||||
if [ ! -s /modules/$module/source ]; then \
|
||||
echo "No source file for $module in modules/$module/source, exiting"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
# some modules require build dependencies
|
||||
if [ -f /modules/$module/build-deps ]; then \
|
||||
echo "Installing $module build dependencies"; \
|
||||
apk update && apk add $(cat /modules/$module/build-deps | xargs); \
|
||||
fi; \
|
||||
# if a module has a build dependency that is not in a distro, provide a
|
||||
# shell script to fetch/build/install those
|
||||
# note that shared libraries produced as a result of this script will
|
||||
# not be copied from the builder image to the main one so build static
|
||||
if [ -x /modules/$module/prebuild ]; then \
|
||||
echo "Running prebuild script for $module"; \
|
||||
/modules/$module/prebuild; \
|
||||
fi; \
|
||||
/pkg-oss/build_module.sh -v $NGINX_VERSION -f -y -o /tmp/packages -n $module $(cat /modules/$module/source); \
|
||||
BUILT_MODULES="$BUILT_MODULES $(echo $module | tr '[A-Z]' '[a-z]' | tr -d '[/_\-\.\t ]')"; \
|
||||
elif make -C /pkg-oss/alpine list | grep -E "^$module\s+\d+" > /dev/null; then \
|
||||
echo "Building $module from pkg-oss sources"; \
|
||||
cd /pkg-oss/alpine; \
|
||||
make abuild-module-$module BASE_VERSION=$NGINX_VERSION NGINX_VERSION=$NGINX_VERSION; \
|
||||
apk add $(. ./abuild-module-$module/APKBUILD; echo $makedepends;); \
|
||||
make module-$module BASE_VERSION=$NGINX_VERSION NGINX_VERSION=$NGINX_VERSION; \
|
||||
find ~/packages -type f -name "*.apk" -exec mv -v {} /tmp/packages/ \;; \
|
||||
BUILT_MODULES="$BUILT_MODULES $module"; \
|
||||
else \
|
||||
echo "Don't know how to build $module module, exiting"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
done \
|
||||
&& echo "BUILT_MODULES=\"$BUILT_MODULES\"" > /tmp/packages/modules.env
|
||||
WORKDIR /wd
|
||||
COPY ["go.mod","go.sum","/wd/"]
|
||||
COPY cmd cmd
|
||||
RUN go build -o rpcdaemon ./cmd/rpcdaemon
|
||||
RUN go build -o server ./cmd/server
|
||||
|
||||
FROM nginx:1.21.3-alpine
|
||||
COPY --from=nginxbuilder /tmp/packages /tmp/packages
|
||||
RUN set -ex \
|
||||
&& . /tmp/packages/modules.env \
|
||||
&& for module in $BUILT_MODULES; do \
|
||||
apk add --no-cache --allow-untrusted /tmp/packages/nginx-module-${module}-${NGINX_VERSION}*.apk; \
|
||||
done \
|
||||
&& rm -rf /tmp/packages
|
||||
RUN apk update && apk add jq
|
||||
COPY --from=chainsbuilder /chains /usr/share/nginx/html/chains/
|
||||
COPY --from=topic0builder /topic0 /usr/share/nginx/html/topic0/
|
||||
COPY --from=fourbytesbuilder /signatures /usr/share/nginx/html/signatures/
|
||||
COPY --from=logobuilder /assets /usr/share/nginx/html/assets/
|
||||
COPY nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY nginx/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY --from=builder /otterscan-build/dist /usr/share/nginx/html/
|
||||
COPY --from=builder /otterscan-build/run-nginx.sh /
|
||||
WORKDIR /
|
||||
FROM alpine:3.15.0
|
||||
RUN apk add alpine-sdk
|
||||
WORKDIR /wd
|
||||
COPY --from=gobuilder /wd/rpcdaemon /usr/bin/rpcdaemon
|
||||
COPY --from=gobuilder /wd/server /usr/bin/server
|
||||
COPY --from=builder /otterscan-build/dist /wd/dist
|
||||
COPY --from=logobuilder /assets /wd/dist
|
||||
|
||||
CMD ["/run-nginx.sh"]
|
||||
CMD ["server"]
|
||||
|
|
|
@ -18,11 +18,11 @@ import (
|
|||
"github.com/ledgerwatch/erigon/eth/ethconfig"
|
||||
"github.com/ledgerwatch/erigon/rpc/rpccfg"
|
||||
|
||||
"github.com/ledgerwatch/erigon/turbo/debug"
|
||||
"github.com/ledgerwatch/erigon/turbo/logging"
|
||||
"github.com/wmitsuda/otterscan/cmd/rpcdaemon/cli/httpcfg"
|
||||
"github.com/wmitsuda/otterscan/cmd/rpcdaemon/health"
|
||||
"github.com/wmitsuda/otterscan/cmd/rpcdaemon/rpcservices"
|
||||
"github.com/wmitsuda/otterscan/erigon_internal/debug"
|
||||
"github.com/wmitsuda/otterscan/erigon_internal/logging"
|
||||
|
||||
"github.com/ledgerwatch/erigon-lib/direct"
|
||||
"github.com/ledgerwatch/erigon-lib/gointerfaces"
|
||||
|
|
|
@ -21,9 +21,11 @@ import (
|
|||
"github.com/ledgerwatch/erigon/rpc"
|
||||
"github.com/ledgerwatch/erigon/turbo/rpchelper"
|
||||
"github.com/ledgerwatch/erigon/turbo/transactions"
|
||||
"github.com/ledgerwatch/erigon/turbo/adapter/ethapi"
|
||||
|
||||
|
||||
"github.com/ledgerwatch/log/v3"
|
||||
|
||||
"github.com/wmitsuda/otterscan/erigon_internal/ethapi"
|
||||
)
|
||||
|
||||
// API_LEVEL Must be incremented every time new additions are made
|
||||
|
@ -370,7 +372,7 @@ func (api *OtterscanAPIImpl) delegateGetBlockByNumber(tx kv.Tx, b *types.Block,
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response, err := ethapi.RPCMarshalBlock(b, inclTx, inclTx)
|
||||
response, err := ethapi.RPCMarshalBlockDeprecated(b, inclTx, inclTx)
|
||||
if !inclTx {
|
||||
delete(response, "transactions") // workaround for https://github.com/ledgerwatch/erigon/issues/4989#issuecomment-1218415666
|
||||
}
|
||||
|
|
|
@ -4,9 +4,11 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gfx.cafe/open/4bytes/sigs"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
)
|
||||
|
@ -32,6 +34,21 @@ func main() {
|
|||
r.Use(middleware.Recoverer)
|
||||
r.Use(middleware.SetHeader("Access-Control-Allow-Origin", "*"))
|
||||
|
||||
r.HandleFunc("/signatures/{hash}", func(w http.ResponseWriter, r *http.Request) {
|
||||
lookup := path.Base(r.URL.Path)
|
||||
if len(lookup) > 8 {
|
||||
http.Error(w, "bad path", 400)
|
||||
return
|
||||
}
|
||||
sig := sigs.Hex(lookup)
|
||||
if sig == "" {
|
||||
http.Error(w, "not found", 404)
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte(sig))
|
||||
})
|
||||
|
||||
FileServer(r, "/", filesDir)
|
||||
|
||||
s := http.Server{
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
version: '3.9'
|
||||
|
||||
|
||||
services:
|
||||
rpcdaemon:
|
||||
build:
|
||||
context: .
|
||||
command: |
|
||||
rpcdaemon
|
||||
--http.addr=0.0.0.0 --http.vhosts=* --http.corsdomain=* --ws
|
||||
--http.api=eth,erigon,web3,net,trace,debug,txpool,ots
|
||||
--metrics --metrics.addr=0.0.0.0 --metrics.port=6064
|
||||
--pprof --pprof.addr=0.0.0.0 --pprof.port=6000
|
||||
--private.api.addr=172.105.22.234:9191
|
||||
##--datadir=/erigon
|
||||
ports:
|
||||
- 8545:8545
|
||||
server:
|
||||
build:
|
||||
context: .
|
||||
command: |
|
||||
server
|
||||
ports:
|
||||
- 3001:3001
|
|
@ -1,239 +0,0 @@
|
|||
// Copyright 2016 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// Package debug interfaces Go runtime debugging facilities.
|
||||
// This package is mostly glue code making these facilities available
|
||||
// through the CLI and RPC subsystem. If you want to use them from Go code,
|
||||
// use package runtime instead.
|
||||
package debug
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"runtime/pprof"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ledgerwatch/erigon-lib/common"
|
||||
"github.com/ledgerwatch/log/v3"
|
||||
)
|
||||
|
||||
// Handler is the global debugging handler.
|
||||
var Handler = new(HandlerT)
|
||||
|
||||
// HandlerT implements the debugging API.
|
||||
// Do not create values of this type, use the one
|
||||
// in the Handler variable instead.
|
||||
type HandlerT struct {
|
||||
mu sync.Mutex
|
||||
cpuW io.WriteCloser
|
||||
cpuFile string
|
||||
traceW io.WriteCloser
|
||||
traceFile string
|
||||
}
|
||||
|
||||
// Verbosity sets the log verbosity ceiling. The verbosity of individual packages
|
||||
// and source files can be raised using Vmodule.
|
||||
func (*HandlerT) Verbosity(level int) {
|
||||
//glogger.Verbosity(log.Lvl(level))
|
||||
}
|
||||
|
||||
// Vmodule sets the log verbosity pattern. See package log for details on the
|
||||
// pattern syntax.
|
||||
func (*HandlerT) Vmodule(pattern string) error {
|
||||
//return glogger.Vmodule(pattern)
|
||||
return nil
|
||||
}
|
||||
|
||||
// BacktraceAt sets the log backtrace location. See package log for details on
|
||||
// the pattern syntax.
|
||||
func (*HandlerT) BacktraceAt(location string) error {
|
||||
//return glogger.BacktraceAt(location)
|
||||
return nil
|
||||
}
|
||||
|
||||
// MemStats returns detailed runtime memory statistics.
|
||||
func (*HandlerT) MemStats() *runtime.MemStats {
|
||||
s := new(runtime.MemStats)
|
||||
common.ReadMemStats(s)
|
||||
return s
|
||||
}
|
||||
|
||||
// GcStats returns GC statistics.
|
||||
func (*HandlerT) GcStats() *debug.GCStats {
|
||||
s := new(debug.GCStats)
|
||||
debug.ReadGCStats(s)
|
||||
return s
|
||||
}
|
||||
|
||||
// CpuProfile turns on CPU profiling for nsec seconds and writes
|
||||
// profile data to file.
|
||||
func (h *HandlerT) CpuProfile(file string, nsec uint) error {
|
||||
if err := h.StartCPUProfile(file); err != nil {
|
||||
return err
|
||||
}
|
||||
time.Sleep(time.Duration(nsec) * time.Second)
|
||||
_ = h.StopCPUProfile()
|
||||
return nil
|
||||
}
|
||||
|
||||
// StartCPUProfile turns on CPU profiling, writing to the given file.
|
||||
func (h *HandlerT) StartCPUProfile(file string) error {
|
||||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
if h.cpuW != nil {
|
||||
return errors.New("CPU profiling already in progress")
|
||||
}
|
||||
f, err := os.Create(expandHome(file))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := pprof.StartCPUProfile(f); err != nil {
|
||||
f.Close()
|
||||
return err
|
||||
}
|
||||
h.cpuW = f
|
||||
h.cpuFile = file
|
||||
log.Info("CPU profiling started", "dump", h.cpuFile)
|
||||
return nil
|
||||
}
|
||||
|
||||
// StopCPUProfile stops an ongoing CPU profile.
|
||||
func (h *HandlerT) StopCPUProfile() error {
|
||||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
pprof.StopCPUProfile()
|
||||
if h.cpuW == nil {
|
||||
return errors.New("CPU profiling not in progress")
|
||||
}
|
||||
log.Info("Done writing CPU profile", "dump", h.cpuFile)
|
||||
h.cpuW.Close()
|
||||
h.cpuW = nil
|
||||
h.cpuFile = ""
|
||||
return nil
|
||||
}
|
||||
|
||||
// GoTrace turns on tracing for nsec seconds and writes
|
||||
// trace data to file.
|
||||
func (h *HandlerT) GoTrace(file string, nsec uint) error {
|
||||
if err := h.StartGoTrace(file); err != nil {
|
||||
return err
|
||||
}
|
||||
time.Sleep(time.Duration(nsec) * time.Second)
|
||||
_ = h.StopGoTrace()
|
||||
return nil
|
||||
}
|
||||
|
||||
// BlockProfile turns on goroutine profiling for nsec seconds and writes profile data to
|
||||
// file. It uses a profile rate of 1 for most accurate information. If a different rate is
|
||||
// desired, set the rate and write the profile manually.
|
||||
func (*HandlerT) BlockProfile(file string, nsec uint) error {
|
||||
runtime.SetBlockProfileRate(1)
|
||||
time.Sleep(time.Duration(nsec) * time.Second)
|
||||
defer runtime.SetBlockProfileRate(0)
|
||||
return writeProfile("block", file)
|
||||
}
|
||||
|
||||
// SetBlockProfileRate sets the rate of goroutine block profile data collection.
|
||||
// rate 0 disables block profiling.
|
||||
func (*HandlerT) SetBlockProfileRate(rate int) {
|
||||
runtime.SetBlockProfileRate(rate)
|
||||
}
|
||||
|
||||
// WriteBlockProfile writes a goroutine blocking profile to the given file.
|
||||
func (*HandlerT) WriteBlockProfile(file string) error {
|
||||
return writeProfile("block", file)
|
||||
}
|
||||
|
||||
// MutexProfile turns on mutex profiling for nsec seconds and writes profile data to file.
|
||||
// It uses a profile rate of 1 for most accurate information. If a different rate is
|
||||
// desired, set the rate and write the profile manually.
|
||||
func (*HandlerT) MutexProfile(file string, nsec uint) error {
|
||||
runtime.SetMutexProfileFraction(1)
|
||||
time.Sleep(time.Duration(nsec) * time.Second)
|
||||
defer runtime.SetMutexProfileFraction(0)
|
||||
return writeProfile("mutex", file)
|
||||
}
|
||||
|
||||
// SetMutexProfileFraction sets the rate of mutex profiling.
|
||||
func (*HandlerT) SetMutexProfileFraction(rate int) {
|
||||
runtime.SetMutexProfileFraction(rate)
|
||||
}
|
||||
|
||||
// WriteMutexProfile writes a goroutine blocking profile to the given file.
|
||||
func (*HandlerT) WriteMutexProfile(file string) error {
|
||||
return writeProfile("mutex", file)
|
||||
}
|
||||
|
||||
// WriteMemProfile writes an allocation profile to the given file.
|
||||
// Note that the profiling rate cannot be set through the API,
|
||||
// it must be set on the command line.
|
||||
func (*HandlerT) WriteMemProfile(file string) error {
|
||||
return writeProfile("heap", file)
|
||||
}
|
||||
|
||||
// Stacks returns a printed representation of the stacks of all goroutines.
|
||||
func (*HandlerT) Stacks() string {
|
||||
buf := new(bytes.Buffer)
|
||||
_ = pprof.Lookup("goroutine").WriteTo(buf, 2)
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// FreeOSMemory forces a garbage collection.
|
||||
func (*HandlerT) FreeOSMemory() {
|
||||
debug.FreeOSMemory()
|
||||
}
|
||||
|
||||
// SetGCPercent sets the garbage collection target percentage. It returns the previous
|
||||
// setting. A negative value disables GC.
|
||||
func (*HandlerT) SetGCPercent(v int) int {
|
||||
return debug.SetGCPercent(v)
|
||||
}
|
||||
|
||||
func writeProfile(name, file string) error {
|
||||
p := pprof.Lookup(name)
|
||||
log.Info("Writing profile records", "count", p.Count(), "type", name, "dump", file)
|
||||
f, err := os.Create(expandHome(file))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
return p.WriteTo(f, 0)
|
||||
}
|
||||
|
||||
// expands home directory in file paths.
|
||||
// ~someuser/tmp will not be expanded.
|
||||
func expandHome(p string) string {
|
||||
if strings.HasPrefix(p, "~/") || strings.HasPrefix(p, "~\\") {
|
||||
home := os.Getenv("HOME")
|
||||
if home == "" {
|
||||
if usr, err := user.Current(); err == nil {
|
||||
home = usr.HomeDir
|
||||
}
|
||||
}
|
||||
if home != "" {
|
||||
p = home + p[1:]
|
||||
}
|
||||
}
|
||||
return filepath.Clean(p)
|
||||
}
|
|
@ -1,217 +0,0 @@
|
|||
// Copyright 2016 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package debug
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
_ "net/http/pprof" //nolint:gosec
|
||||
|
||||
metrics2 "github.com/VictoriaMetrics/metrics"
|
||||
"github.com/ledgerwatch/erigon/common/fdlimit"
|
||||
"github.com/ledgerwatch/erigon/metrics"
|
||||
"github.com/ledgerwatch/erigon/metrics/exp"
|
||||
"github.com/ledgerwatch/log/v3"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/urfave/cli"
|
||||
"github.com/wmitsuda/otterscan/erigon_internal/logging"
|
||||
)
|
||||
|
||||
var (
|
||||
//nolint
|
||||
vmoduleFlag = cli.StringFlag{
|
||||
Name: "vmodule",
|
||||
Usage: "Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)",
|
||||
Value: "",
|
||||
}
|
||||
metricsAddrFlag = cli.StringFlag{
|
||||
Name: "metrics.addr",
|
||||
}
|
||||
metricsPortFlag = cli.UintFlag{
|
||||
Name: "metrics.port",
|
||||
Value: 6060,
|
||||
}
|
||||
pprofFlag = cli.BoolFlag{
|
||||
Name: "pprof",
|
||||
Usage: "Enable the pprof HTTP server",
|
||||
}
|
||||
pprofPortFlag = cli.IntFlag{
|
||||
Name: "pprof.port",
|
||||
Usage: "pprof HTTP server listening port",
|
||||
Value: 6060,
|
||||
}
|
||||
pprofAddrFlag = cli.StringFlag{
|
||||
Name: "pprof.addr",
|
||||
Usage: "pprof HTTP server listening interface",
|
||||
Value: "127.0.0.1",
|
||||
}
|
||||
cpuprofileFlag = cli.StringFlag{
|
||||
Name: "pprof.cpuprofile",
|
||||
Usage: "Write CPU profile to the given file",
|
||||
}
|
||||
traceFlag = cli.StringFlag{
|
||||
Name: "trace",
|
||||
Usage: "Write execution trace to the given file",
|
||||
}
|
||||
)
|
||||
|
||||
// Flags holds all command-line flags required for debugging.
|
||||
var Flags = []cli.Flag{
|
||||
pprofFlag, pprofAddrFlag, pprofPortFlag,
|
||||
cpuprofileFlag, traceFlag,
|
||||
}
|
||||
|
||||
func SetupCobra(cmd *cobra.Command) error {
|
||||
RaiseFdLimit()
|
||||
flags := cmd.Flags()
|
||||
|
||||
_ = logging.GetLoggerCmd("debug", cmd)
|
||||
|
||||
traceFile, err := flags.GetString(traceFlag.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cpuFile, err := flags.GetString(cpuprofileFlag.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// profiling, tracing
|
||||
if traceFile != "" {
|
||||
if err2 := Handler.StartGoTrace(traceFile); err2 != nil {
|
||||
return err2
|
||||
}
|
||||
}
|
||||
if cpuFile != "" {
|
||||
if err2 := Handler.StartCPUProfile(cpuFile); err2 != nil {
|
||||
return err2
|
||||
}
|
||||
}
|
||||
|
||||
go ListenSignals(nil)
|
||||
pprof, err := flags.GetBool(pprofFlag.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pprofAddr, err := flags.GetString(pprofAddrFlag.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pprofPort, err := flags.GetInt(pprofPortFlag.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
metricsAddr, err := flags.GetString(metricsAddrFlag.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
metricsPort, err := flags.GetInt(metricsPortFlag.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if metrics.Enabled && metricsAddr != "" {
|
||||
address := fmt.Sprintf("%s:%d", metricsAddr, metricsPort)
|
||||
exp.Setup(address)
|
||||
}
|
||||
|
||||
withMetrics := metrics.Enabled && metricsAddr == ""
|
||||
if pprof {
|
||||
// metrics and pprof server
|
||||
StartPProf(fmt.Sprintf("%s:%d", pprofAddr, pprofPort), withMetrics)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Setup initializes profiling and logging based on the CLI flags.
|
||||
// It should be called as early as possible in the program.
|
||||
func Setup(ctx *cli.Context) error {
|
||||
RaiseFdLimit()
|
||||
|
||||
_ = logging.GetLoggerCtx("debug", ctx)
|
||||
|
||||
if traceFile := ctx.String(traceFlag.Name); traceFile != "" {
|
||||
if err := Handler.StartGoTrace(traceFile); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if cpuFile := ctx.String(cpuprofileFlag.Name); cpuFile != "" {
|
||||
if err := Handler.StartCPUProfile(cpuFile); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
pprofEnabled := ctx.Bool(pprofFlag.Name)
|
||||
metricsAddr := ctx.String(metricsAddrFlag.Name)
|
||||
|
||||
if metrics.Enabled && (!pprofEnabled || metricsAddr != "") {
|
||||
metricsPort := ctx.Int(metricsPortFlag.Name)
|
||||
address := fmt.Sprintf("%s:%d", metricsAddr, metricsPort)
|
||||
exp.Setup(address)
|
||||
}
|
||||
|
||||
// pprof server
|
||||
if pprofEnabled {
|
||||
pprofHost := ctx.String(pprofAddrFlag.Name)
|
||||
pprofPort := ctx.Int(pprofPortFlag.Name)
|
||||
address := fmt.Sprintf("%s:%d", pprofHost, pprofPort)
|
||||
// This context value ("metrics.addr") represents the utils.MetricsHTTPFlag.Name.
|
||||
// It cannot be imported because it will cause a cyclical dependency.
|
||||
withMetrics := metrics.Enabled && metricsAddr == ""
|
||||
StartPProf(address, withMetrics)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func StartPProf(address string, withMetrics bool) {
|
||||
// Hook go-metrics into expvar on any /debug/metrics request, load all vars
|
||||
// from the registry into expvar, and execute regular expvar handler.
|
||||
if withMetrics {
|
||||
http.HandleFunc("/debug/metrics/prometheus", func(w http.ResponseWriter, req *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
metrics2.WritePrometheus(w, true)
|
||||
})
|
||||
}
|
||||
cpuMsg := fmt.Sprintf("go tool pprof -lines -http=: http://%s/%s", address, "debug/pprof/profile?seconds=20")
|
||||
heapMsg := fmt.Sprintf("go tool pprof -lines -http=: http://%s/%s", address, "debug/pprof/heap")
|
||||
log.Info("Starting pprof server", "cpu", cpuMsg, "heap", heapMsg)
|
||||
go func() {
|
||||
if err := http.ListenAndServe(address, nil); err != nil { // nolint:gosec
|
||||
log.Error("Failure in running pprof server", "err", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// Exit stops all running profiles, flushing their output to the
|
||||
// respective file.
|
||||
func Exit() {
|
||||
_ = Handler.StopCPUProfile()
|
||||
_ = Handler.StopGoTrace()
|
||||
}
|
||||
|
||||
// RaiseFdLimit raises out the number of allowed file handles per process
|
||||
func RaiseFdLimit() {
|
||||
limit, err := fdlimit.Maximum()
|
||||
if err != nil {
|
||||
log.Error("Failed to retrieve file descriptor allowance", "err", err)
|
||||
return
|
||||
}
|
||||
if _, err = fdlimit.Raise(uint64(limit)); err != nil {
|
||||
log.Error("Failed to raise file descriptor allowance", "err", err)
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright 2016 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//go:build go1.6
|
||||
|
||||
package debug
|
||||
|
||||
import "runtime/debug"
|
||||
|
||||
// LoudPanic panics in a way that gets all goroutine stacks printed on stderr.
|
||||
func LoudPanic(x interface{}) {
|
||||
debug.SetTraceback("all")
|
||||
panic(x)
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright 2016 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//go:build !go1.6
|
||||
|
||||
package debug
|
||||
|
||||
// LoudPanic panics in a way that gets all goroutine stacks printed on stderr.
|
||||
func LoudPanic(x interface{}) {
|
||||
panic(x)
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
//go:build !windows
|
||||
|
||||
package debug
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"os/signal"
|
||||
"runtime/pprof"
|
||||
|
||||
_debug "github.com/ledgerwatch/erigon/common/debug"
|
||||
"github.com/ledgerwatch/log/v3"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func ListenSignals(stack io.Closer) {
|
||||
sigc := make(chan os.Signal, 1)
|
||||
signal.Notify(sigc, unix.SIGINT, unix.SIGTERM)
|
||||
_debug.GetSigC(&sigc)
|
||||
defer signal.Stop(sigc)
|
||||
|
||||
usr1 := make(chan os.Signal, 1)
|
||||
signal.Notify(usr1, unix.SIGUSR1)
|
||||
for {
|
||||
select {
|
||||
case <-sigc:
|
||||
log.Info("Got interrupt, shutting down...")
|
||||
if stack != nil {
|
||||
go stack.Close()
|
||||
}
|
||||
for i := 10; i > 0; i-- {
|
||||
<-sigc
|
||||
if i > 1 {
|
||||
log.Warn("Already shutting down, interrupt more to panic.", "times", i-1)
|
||||
}
|
||||
}
|
||||
Exit() // ensure trace and CPU profile data is flushed.
|
||||
LoudPanic("boom")
|
||||
case <-usr1:
|
||||
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
//go:build windows
|
||||
|
||||
package debug
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"os/signal"
|
||||
|
||||
_debug "github.com/ledgerwatch/erigon/common/debug"
|
||||
"github.com/ledgerwatch/log/v3"
|
||||
)
|
||||
|
||||
func ListenSignals(stack io.Closer) {
|
||||
sigc := make(chan os.Signal, 1)
|
||||
signal.Notify(sigc, os.Interrupt)
|
||||
_debug.GetSigC(&sigc)
|
||||
defer signal.Stop(sigc)
|
||||
|
||||
<-sigc
|
||||
log.Info("Got interrupt, shutting down...")
|
||||
if stack != nil {
|
||||
go stack.Close()
|
||||
}
|
||||
for i := 10; i > 0; i-- {
|
||||
<-sigc
|
||||
if i > 1 {
|
||||
log.Warn("Already shutting down, interrupt more to panic.", "times", i-1)
|
||||
}
|
||||
}
|
||||
Exit() // ensure trace and CPU profile data is flushed.
|
||||
LoudPanic("boom")
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
// Copyright 2016 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//go:build go1.5
|
||||
|
||||
package debug
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"runtime/trace"
|
||||
|
||||
"github.com/ledgerwatch/log/v3"
|
||||
)
|
||||
|
||||
// StartGoTrace turns on tracing, writing to the given file.
|
||||
func (h *HandlerT) StartGoTrace(file string) error {
|
||||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
if h.traceW != nil {
|
||||
return errors.New("trace already in progress")
|
||||
}
|
||||
f, err := os.Create(expandHome(file))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := trace.Start(f); err != nil {
|
||||
f.Close()
|
||||
return err
|
||||
}
|
||||
h.traceW = f
|
||||
h.traceFile = file
|
||||
log.Info("Go tracing started", "dump", h.traceFile)
|
||||
return nil
|
||||
}
|
||||
|
||||
// StopTrace stops an ongoing trace.
|
||||
func (h *HandlerT) StopGoTrace() error {
|
||||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
trace.Stop()
|
||||
if h.traceW == nil {
|
||||
return errors.New("trace not in progress")
|
||||
}
|
||||
log.Info("Done writing Go trace", "dump", h.traceFile)
|
||||
h.traceW.Close()
|
||||
h.traceW = nil
|
||||
h.traceFile = ""
|
||||
return nil
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
// Copyright 2016 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//go:build !go1.5
|
||||
|
||||
// no-op implementation of tracing methods for Go < 1.5.
|
||||
|
||||
package debug
|
||||
|
||||
import "errors"
|
||||
|
||||
func (*HandlerT) StartGoTrace(string) error {
|
||||
return errors.New("tracing is not supported on Go < 1.5")
|
||||
}
|
||||
|
||||
func (*HandlerT) StopGoTrace() error {
|
||||
return errors.New("tracing is not supported on Go < 1.5")
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,56 +0,0 @@
|
|||
// Copyright 2015 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// Package ethapi implements the general Ethereum API functions.
|
||||
package ethapi
|
||||
|
||||
/*
|
||||
func GetAPIs(apiBackend Backend) []rpc.API {
|
||||
nonceLock := new(AddrLocker)
|
||||
return []rpc.API{
|
||||
{
|
||||
Namespace: "eth",
|
||||
Version: "1.0",
|
||||
Service: NewPublicEthereumAPI(apiBackend),
|
||||
Public: true,
|
||||
}, {
|
||||
Namespace: "eth",
|
||||
Version: "1.0",
|
||||
Service: NewPublicBlockChainAPI(apiBackend),
|
||||
Public: true,
|
||||
}, {
|
||||
Namespace: "eth",
|
||||
Version: "1.0",
|
||||
Service: NewPublicTransactionPoolAPI(apiBackend, nonceLock),
|
||||
Public: true,
|
||||
}, {
|
||||
Namespace: "txpool",
|
||||
Version: "1.0",
|
||||
Service: NewPublicTxPoolAPI(apiBackend),
|
||||
Public: true,
|
||||
}, {
|
||||
Namespace: "debug",
|
||||
Version: "1.0",
|
||||
Service: NewPublicDebugAPI(apiBackend),
|
||||
Public: true,
|
||||
}, {
|
||||
Namespace: "debug",
|
||||
Version: "1.0",
|
||||
Service: NewPrivateDebugAPI(apiBackend),
|
||||
},
|
||||
}
|
||||
}
|
||||
*/
|
|
@ -1,234 +0,0 @@
|
|||
package ethapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/ledgerwatch/erigon/common"
|
||||
"github.com/ledgerwatch/erigon/common/hexutil"
|
||||
"github.com/ledgerwatch/erigon/core/types/accounts"
|
||||
"github.com/ledgerwatch/erigon/turbo/trie"
|
||||
)
|
||||
|
||||
// Result structs for GetProof
|
||||
type AccountResult struct {
|
||||
Address common.Address `json:"address"`
|
||||
AccountProof []string `json:"accountProof"`
|
||||
Balance *hexutil.Big `json:"balance"`
|
||||
CodeHash common.Hash `json:"codeHash"`
|
||||
Nonce hexutil.Uint64 `json:"nonce"`
|
||||
StorageHash common.Hash `json:"storageHash"`
|
||||
StorageProof []StorageResult `json:"storageProof"`
|
||||
}
|
||||
type StorageResult struct {
|
||||
Key string `json:"key"`
|
||||
Value *hexutil.Big `json:"value"`
|
||||
Proof []string `json:"proof"`
|
||||
}
|
||||
|
||||
/*TODO: to support proofs
|
||||
func (s *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNr rpc.BlockNumber) (*AccountResult, error) {
|
||||
block := uint64(blockNr.Int64()) + 1
|
||||
db := s.b.ChainDb()
|
||||
ts := dbutils.EncodeBlockNumber(block)
|
||||
accountMap := make(map[string]*accounts.Account)
|
||||
if err := changeset.Walk(db, dbutils.AccountChangeSetBucket, ts, 0, func(blockN uint64, a, v []byte) (bool, error) {
|
||||
a, v = common.CopyBytes(a), common.CopyBytes(v)
|
||||
var kHash, err = common.HashData(a)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
k := kHash[:]
|
||||
if _, ok := accountMap[string(k)]; !ok {
|
||||
if len(v) > 0 {
|
||||
var a accounts.Account
|
||||
if innerErr := a.DecodeForStorage(v); innerErr != nil {
|
||||
return false, innerErr
|
||||
}
|
||||
accountMap[string(k)] = &a
|
||||
} else {
|
||||
accountMap[string(k)] = nil
|
||||
}
|
||||
}
|
||||
return true, nil
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
storageMap := make(map[string][]byte)
|
||||
if err := changeset.Walk(db, dbutils.AccountChangeSetBucket, ts, 0, func(blockN uint64, a, v []byte) (bool, error) {
|
||||
a, v = common.CopyBytes(a), common.CopyBytes(v)
|
||||
var kHash, err = common.HashData(a)
|
||||
if err != nil {
|
||||
return true, err
|
||||
}
|
||||
k := kHash[:]
|
||||
if _, ok := storageMap[string(k)]; !ok {
|
||||
storageMap[string(k)] = v
|
||||
}
|
||||
return true, nil
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var unfurlList = make([]string, len(accountMap)+len(storageMap))
|
||||
unfurl := trie.NewRetainList(0)
|
||||
i := 0
|
||||
for ks, acc := range accountMap {
|
||||
unfurlList[i] = ks
|
||||
i++
|
||||
unfurl.AddKey([]byte(ks))
|
||||
if acc != nil {
|
||||
// Fill the code hashes
|
||||
if acc.Incarnation > 0 && acc.IsEmptyCodeHash() {
|
||||
if codeHash, err1 := db.Get(dbutils.ContractCodeBucket, dbutils.GenerateStoragePrefix([]byte(ks), acc.Incarnation)); err1 == nil {
|
||||
copy(acc.CodeHash[:], codeHash)
|
||||
} else {
|
||||
return nil, err1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for ks := range storageMap {
|
||||
unfurlList[i] = ks
|
||||
i++
|
||||
var sk [64]byte
|
||||
copy(sk[:], []byte(ks)[:common.HashLength])
|
||||
copy(sk[common.HashLength:], []byte(ks)[common.HashLength+common.IncarnationLength:])
|
||||
unfurl.AddKey(sk[:])
|
||||
}
|
||||
rl := trie.NewRetainList(0)
|
||||
addrHash, err := common.HashData(address[:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rl.AddKey(addrHash[:])
|
||||
unfurl.AddKey(addrHash[:])
|
||||
for _, key := range storageKeys {
|
||||
keyAsHash := common.HexToHash(key)
|
||||
if keyHash, err1 := common.HashData(keyAsHash[:]); err1 == nil {
|
||||
trieKey := append(addrHash[:], keyHash[:]...)
|
||||
rl.AddKey(trieKey)
|
||||
unfurl.AddKey(trieKey)
|
||||
} else {
|
||||
return nil, err1
|
||||
}
|
||||
}
|
||||
sort.Strings(unfurlList)
|
||||
loader := trie.NewFlatDBTrieLoader("checkRoots")
|
||||
if err = loader.Reset(unfurl, nil, nil, false); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
r := &Receiver{defaultReceiver: trie.NewDefaultReceiver(), unfurlList: unfurlList, accountMap: accountMap, storageMap: storageMap}
|
||||
r.defaultReceiver.Reset(rl, nil, false)
|
||||
loader.SetStreamReceiver(r)
|
||||
_, err = loader.CalcTrieRoot(db.(ethdb.HasTx).Tx().(ethdb.RwTx), []byte{}, nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
hash, err := rawdb.ReadCanonicalHash(db, block-1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
header := rawdb.ReadHeader(db, hash, block-1)
|
||||
tr := trie.New(header.Root)
|
||||
if err = tr.HookSubTries(subTries, [][]byte{nil}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
accountProof, err2 := tr.Prove(addrHash[:], 0, false)
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
}
|
||||
storageProof := make([]StorageResult, len(storageKeys))
|
||||
for i, key := range storageKeys {
|
||||
keyAsHash := common.HexToHash(key)
|
||||
if keyHash, err1 := common.HashData(keyAsHash[:]); err1 == nil {
|
||||
trieKey := append(addrHash[:], keyHash[:]...)
|
||||
if proof, err3 := tr.Prove(trieKey, 64 , true); err3 == nil {
|
||||
v, _ := tr.Get(trieKey)
|
||||
bv := new(big.Int)
|
||||
bv.SetBytes(v)
|
||||
storageProof[i] = StorageResult{key, (*hexutil.Big)(bv), toHexSlice(proof)}
|
||||
} else {
|
||||
return nil, err3
|
||||
}
|
||||
} else {
|
||||
return nil, err1
|
||||
}
|
||||
}
|
||||
acc, found := tr.GetAccount(addrHash[:])
|
||||
if !found {
|
||||
return nil, nil
|
||||
}
|
||||
return &AccountResult{
|
||||
Address: address,
|
||||
AccountProof: toHexSlice(accountProof),
|
||||
Balance: (*hexutil.Big)(acc.Balance.ToBig()),
|
||||
CodeHash: acc.CodeHash,
|
||||
Nonce: hexutil.Uint64(acc.Nonce),
|
||||
StorageHash: acc.Root,
|
||||
StorageProof: storageProof,
|
||||
}, nil
|
||||
return &AccountResult{}, nil
|
||||
}
|
||||
*/
|
||||
|
||||
type Receiver struct {
|
||||
defaultReceiver *trie.RootHashAggregator
|
||||
accountMap map[string]*accounts.Account
|
||||
storageMap map[string][]byte
|
||||
unfurlList []string
|
||||
currentIdx int
|
||||
}
|
||||
|
||||
func (r *Receiver) Root() common.Hash { panic("don't call me") }
|
||||
func (r *Receiver) Receive(
|
||||
itemType trie.StreamItem,
|
||||
accountKey []byte,
|
||||
storageKey []byte,
|
||||
accountValue *accounts.Account,
|
||||
storageValue []byte,
|
||||
hash []byte,
|
||||
hasTree bool,
|
||||
cutoff int,
|
||||
) error {
|
||||
for r.currentIdx < len(r.unfurlList) {
|
||||
ks := r.unfurlList[r.currentIdx]
|
||||
k := []byte(ks)
|
||||
var c int
|
||||
switch itemType {
|
||||
case trie.StorageStreamItem, trie.SHashStreamItem:
|
||||
c = bytes.Compare(k, storageKey)
|
||||
case trie.AccountStreamItem, trie.AHashStreamItem:
|
||||
c = bytes.Compare(k, accountKey)
|
||||
case trie.CutoffStreamItem:
|
||||
c = -1
|
||||
}
|
||||
if c > 0 {
|
||||
return r.defaultReceiver.Receive(itemType, accountKey, storageKey, accountValue, storageValue, hash, hasTree, cutoff)
|
||||
}
|
||||
if len(k) > common.HashLength {
|
||||
v := r.storageMap[ks]
|
||||
if c <= 0 && len(v) > 0 {
|
||||
if err := r.defaultReceiver.Receive(trie.StorageStreamItem, nil, k, nil, v, nil, hasTree, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
v := r.accountMap[ks]
|
||||
if c <= 0 && v != nil {
|
||||
if err := r.defaultReceiver.Receive(trie.AccountStreamItem, k, nil, v, nil, nil, hasTree, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
r.currentIdx++
|
||||
if c == 0 {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
// We ran out of modifications, simply pass through
|
||||
return r.defaultReceiver.Receive(itemType, accountKey, storageKey, accountValue, storageValue, hash, hasTree, cutoff)
|
||||
}
|
||||
|
||||
func (r *Receiver) Result() trie.SubTries {
|
||||
return r.defaultReceiver.Result()
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package ethapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/holiman/uint256"
|
||||
"github.com/ledgerwatch/erigon/common"
|
||||
"github.com/ledgerwatch/erigon/core/state"
|
||||
)
|
||||
|
||||
type StateOverrides map[common.Address]Account
|
||||
|
||||
func (overrides *StateOverrides) Override(state *state.IntraBlockState) error {
|
||||
|
||||
for addr, account := range *overrides {
|
||||
// Override account nonce.
|
||||
if account.Nonce != nil {
|
||||
state.SetNonce(addr, uint64(*account.Nonce))
|
||||
}
|
||||
// Override account(contract) code.
|
||||
if account.Code != nil {
|
||||
state.SetCode(addr, *account.Code)
|
||||
}
|
||||
// Override account balance.
|
||||
if account.Balance != nil {
|
||||
balance, overflow := uint256.FromBig((*big.Int)(*account.Balance))
|
||||
if overflow {
|
||||
return fmt.Errorf("account.Balance higher than 2^256-1")
|
||||
}
|
||||
state.SetBalance(addr, balance)
|
||||
}
|
||||
if account.State != nil && account.StateDiff != nil {
|
||||
return fmt.Errorf("account %s has both 'state' and 'stateDiff'", addr.Hex())
|
||||
}
|
||||
// Replace entire state if caller requires.
|
||||
if account.State != nil {
|
||||
state.SetStorage(addr, *account.State)
|
||||
}
|
||||
// Apply state diff into specified accounts.
|
||||
if account.StateDiff != nil {
|
||||
for key, value := range *account.StateDiff {
|
||||
key := key
|
||||
state.SetState(addr, &key, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package logging
|
||||
|
||||
import (
|
||||
"github.com/ledgerwatch/log/v3"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var (
|
||||
LogJsonFlag = cli.BoolFlag{
|
||||
Name: "log.json",
|
||||
Usage: "Format console logs with JSON",
|
||||
}
|
||||
|
||||
LogConsoleJsonFlag = cli.BoolFlag{
|
||||
Name: "log.console.json",
|
||||
Usage: "Format console logs with JSON",
|
||||
}
|
||||
|
||||
LogDirJsonFlag = cli.BoolFlag{
|
||||
Name: "log.dir.json",
|
||||
Usage: "Format file logs with JSON",
|
||||
}
|
||||
|
||||
LogVerbosityFlag = cli.StringFlag{
|
||||
Name: "verbosity",
|
||||
Usage: "Set the log level for console logs",
|
||||
Value: log.LvlInfo.String(),
|
||||
}
|
||||
|
||||
LogConsoleVerbosityFlag = cli.StringFlag{
|
||||
Name: "log.console.verbosity",
|
||||
Usage: "Set the log level for console logs",
|
||||
Value: log.LvlInfo.String(),
|
||||
}
|
||||
|
||||
LogDirPathFlag = cli.StringFlag{
|
||||
Name: "log.dir.path",
|
||||
Usage: "Path to store user and error logs to disk",
|
||||
}
|
||||
|
||||
LogDirVerbosityFlag = cli.StringFlag{
|
||||
Name: "log.dir.verbosity",
|
||||
Usage: "Set the log verbosity for logs stored to disk",
|
||||
Value: log.LvlDebug.String(),
|
||||
}
|
||||
)
|
||||
|
||||
var Flags = []cli.Flag{
|
||||
LogJsonFlag,
|
||||
LogConsoleJsonFlag,
|
||||
LogDirJsonFlag,
|
||||
LogVerbosityFlag,
|
||||
LogConsoleVerbosityFlag,
|
||||
LogDirPathFlag,
|
||||
LogDirVerbosityFlag,
|
||||
}
|
|
@ -1,162 +0,0 @@
|
|||
package logging
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
|
||||
"github.com/ledgerwatch/log/v3"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
func GetLoggerCtx(filePrefix string, ctx *cli.Context) log.Logger {
|
||||
var consoleJson = ctx.Bool(LogJsonFlag.Name) || ctx.Bool(LogConsoleJsonFlag.Name)
|
||||
var dirJson = ctx.Bool(LogDirJsonFlag.Name)
|
||||
|
||||
consoleLevel, lErr := tryGetLogLevel(ctx.String(LogConsoleVerbosityFlag.Name))
|
||||
if lErr != nil {
|
||||
// try verbosity flag
|
||||
consoleLevel, lErr = tryGetLogLevel(ctx.String(LogVerbosityFlag.Name))
|
||||
if lErr != nil {
|
||||
consoleLevel = log.LvlInfo
|
||||
}
|
||||
}
|
||||
|
||||
dirLevel, dErr := tryGetLogLevel(ctx.String(LogDirVerbosityFlag.Name))
|
||||
if dErr != nil {
|
||||
dirLevel = log.LvlDebug
|
||||
}
|
||||
|
||||
dirPath := ctx.String(LogDirPathFlag.Name)
|
||||
return initSeparatedLogging(filePrefix, dirPath, consoleLevel, dirLevel, consoleJson, dirJson)
|
||||
}
|
||||
|
||||
func GetLoggerCmd(filePrefix string, cmd *cobra.Command) log.Logger {
|
||||
|
||||
logJsonVal, ljerr := cmd.Flags().GetBool(LogJsonFlag.Name)
|
||||
if ljerr != nil {
|
||||
logJsonVal = false
|
||||
}
|
||||
|
||||
logConsoleJsonVal, lcjerr := cmd.Flags().GetBool(LogConsoleJsonFlag.Name)
|
||||
if lcjerr != nil {
|
||||
logConsoleJsonVal = false
|
||||
}
|
||||
|
||||
var consoleJson = logJsonVal || logConsoleJsonVal
|
||||
dirJson, djerr := cmd.Flags().GetBool(LogDirJsonFlag.Name)
|
||||
if djerr != nil {
|
||||
dirJson = false
|
||||
}
|
||||
|
||||
consoleLevel, lErr := tryGetLogLevel(cmd.Flags().Lookup(LogConsoleVerbosityFlag.Name).Value.String())
|
||||
if lErr != nil {
|
||||
// try verbosity flag
|
||||
consoleLevel, lErr = tryGetLogLevel(cmd.Flags().Lookup(LogVerbosityFlag.Name).Value.String())
|
||||
if lErr != nil {
|
||||
consoleLevel = log.LvlInfo
|
||||
}
|
||||
}
|
||||
|
||||
dirLevel, dErr := tryGetLogLevel(cmd.Flags().Lookup(LogDirVerbosityFlag.Name).Value.String())
|
||||
if dErr != nil {
|
||||
dirLevel = log.LvlDebug
|
||||
}
|
||||
|
||||
dirPath := cmd.Flags().Lookup(LogDirPathFlag.Name).Value.String()
|
||||
return initSeparatedLogging(filePrefix, dirPath, consoleLevel, dirLevel, consoleJson, dirJson)
|
||||
}
|
||||
|
||||
func GetLogger(filePrefix string) log.Logger {
|
||||
var logConsoleVerbosity = flag.String(LogConsoleVerbosityFlag.Name, "", LogConsoleVerbosityFlag.Usage)
|
||||
var logDirVerbosity = flag.String(LogDirVerbosityFlag.Name, "", LogDirVerbosityFlag.Usage)
|
||||
var logDirPath = flag.String(LogDirPathFlag.Name, "", LogDirPathFlag.Usage)
|
||||
var logVerbosity = flag.String(LogVerbosityFlag.Name, "", LogVerbosityFlag.Usage)
|
||||
var logConsoleJson = flag.Bool(LogConsoleJsonFlag.Name, false, LogConsoleJsonFlag.Usage)
|
||||
var logJson = flag.Bool(LogJsonFlag.Name, false, LogJsonFlag.Usage)
|
||||
var logDirJson = flag.Bool(LogDirJsonFlag.Name, false, LogDirJsonFlag.Usage)
|
||||
flag.Parse()
|
||||
|
||||
var consoleJson = *logJson || *logConsoleJson
|
||||
var dirJson = logDirJson
|
||||
|
||||
consoleLevel, lErr := tryGetLogLevel(*logConsoleVerbosity)
|
||||
if lErr != nil {
|
||||
// try verbosity flag
|
||||
consoleLevel, lErr = tryGetLogLevel(*logVerbosity)
|
||||
if lErr != nil {
|
||||
consoleLevel = log.LvlInfo
|
||||
}
|
||||
}
|
||||
|
||||
dirLevel, dErr := tryGetLogLevel(*logDirVerbosity)
|
||||
if dErr != nil {
|
||||
dirLevel = log.LvlDebug
|
||||
}
|
||||
|
||||
return initSeparatedLogging(filePrefix, *logDirPath, consoleLevel, dirLevel, consoleJson, *dirJson)
|
||||
}
|
||||
|
||||
func initSeparatedLogging(
|
||||
filePrefix string,
|
||||
dirPath string,
|
||||
consoleLevel log.Lvl,
|
||||
dirLevel log.Lvl,
|
||||
consoleJson bool,
|
||||
dirJson bool) log.Logger {
|
||||
|
||||
logger := log.Root()
|
||||
|
||||
if consoleJson {
|
||||
log.Root().SetHandler(log.LvlFilterHandler(consoleLevel, log.StreamHandler(os.Stderr, log.JsonFormat())))
|
||||
} else {
|
||||
log.Root().SetHandler(log.LvlFilterHandler(consoleLevel, log.StderrHandler))
|
||||
}
|
||||
|
||||
if len(dirPath) == 0 {
|
||||
logger.Warn("no log dir set, console logging only")
|
||||
return logger
|
||||
}
|
||||
|
||||
err := os.MkdirAll(dirPath, 0764)
|
||||
if err != nil {
|
||||
logger.Warn("failed to create log dir, console logging only")
|
||||
return logger
|
||||
}
|
||||
|
||||
dirFormat := log.LogfmtFormat()
|
||||
if dirJson {
|
||||
dirFormat = log.JsonFormat()
|
||||
}
|
||||
|
||||
userLog, err := log.FileHandler(path.Join(dirPath, filePrefix+"-user.log"), dirFormat, 1<<27) // 128Mb
|
||||
if err != nil {
|
||||
logger.Warn("failed to open user log, console logging only")
|
||||
return logger
|
||||
}
|
||||
errLog, err := log.FileHandler(path.Join(dirPath, filePrefix+"-error.log"), dirFormat, 1<<27) // 128Mb
|
||||
if err != nil {
|
||||
logger.Warn("failed to open error log, console logging only")
|
||||
return logger
|
||||
}
|
||||
|
||||
mux := log.MultiHandler(logger.GetHandler(), log.LvlFilterHandler(dirLevel, userLog), log.LvlFilterHandler(log.LvlError, errLog))
|
||||
log.Root().SetHandler(mux)
|
||||
logger.SetHandler(mux)
|
||||
logger.Info("logging to file system", "log dir", dirPath, "file prefix", filePrefix, "log level", dirLevel, "json", dirJson)
|
||||
return logger
|
||||
}
|
||||
|
||||
func tryGetLogLevel(s string) (log.Lvl, error) {
|
||||
lvl, err := log.LvlFromString(s)
|
||||
if err != nil {
|
||||
l, err := strconv.Atoi(s)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return log.Lvl(l), nil
|
||||
}
|
||||
return lvl, nil
|
||||
}
|
25
go.mod
25
go.mod
|
@ -6,24 +6,23 @@ replace github.com/tendermint/tendermint => github.com/bnb-chain/tendermint v0.3
|
|||
|
||||
require (
|
||||
github.com/RoaringBitmap/roaring v1.2.1
|
||||
github.com/VictoriaMetrics/metrics v1.22.2
|
||||
github.com/go-chi/chi/v5 v5.0.7
|
||||
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
|
||||
github.com/holiman/uint256 v1.2.1
|
||||
github.com/ledgerwatch/erigon v1.9.7-0.20221024030055-592ad5792127
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20221024030034-c1965e9c5ae3
|
||||
github.com/ledgerwatch/erigon v1.9.7-0.20221025025825-26fdf9169d27
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20221024025924-48ff56eead80
|
||||
github.com/ledgerwatch/log/v3 v3.6.0
|
||||
github.com/spf13/cobra v1.5.0
|
||||
github.com/urfave/cli v1.22.9
|
||||
golang.org/x/sync v0.1.0
|
||||
golang.org/x/sys v0.1.0
|
||||
google.golang.org/grpc v1.50.1
|
||||
google.golang.org/protobuf v1.28.1
|
||||
)
|
||||
|
||||
require (
|
||||
crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508 // indirect
|
||||
gfx.cafe/open/4bytes v0.0.0-20221025060640-c4301cc087ee // indirect
|
||||
github.com/VictoriaMetrics/fastcache v1.12.0 // indirect
|
||||
github.com/VictoriaMetrics/metrics v1.22.2 // indirect
|
||||
github.com/ajwerner/btree v0.0.0-20211221152037-f427b3e689c0 // indirect
|
||||
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
|
||||
github.com/anacrolix/chansync v0.3.0 // indirect
|
||||
|
@ -46,6 +45,7 @@ require (
|
|||
github.com/benbjohnson/immutable v0.3.0 // indirect
|
||||
github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b // indirect
|
||||
github.com/bits-and-blooms/bitset v1.2.2 // indirect
|
||||
github.com/blang/semver v3.5.1+incompatible // indirect
|
||||
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect
|
||||
github.com/btcsuite/btcd v0.22.0-beta // indirect
|
||||
github.com/c2h5oh/datasize v0.0.0-20220606134207-859f65c6625b // indirect
|
||||
|
@ -72,7 +72,7 @@ require (
|
|||
github.com/goccy/go-json v0.9.7 // indirect
|
||||
github.com/gofrs/flock v0.8.1 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.4.1 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/btree v1.1.2 // indirect
|
||||
|
@ -86,7 +86,8 @@ require (
|
|||
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/kevinburke/go-bindata v3.21.0+incompatible // indirect
|
||||
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20221023043405-d157dec75e9a // indirect
|
||||
github.com/klauspost/compress v1.15.11 // indirect
|
||||
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20221025023844-6e716b9e651c // indirect
|
||||
github.com/ledgerwatch/secp256k1 v1.0.0 // indirect
|
||||
github.com/lispad/go-generics-tools v1.1.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
|
@ -94,6 +95,10 @@ require (
|
|||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/mschoch/smat v0.2.0 // indirect
|
||||
github.com/openacid/errors v0.8.1 // indirect
|
||||
github.com/openacid/low v0.1.14 // indirect
|
||||
github.com/openacid/must v0.1.3 // indirect
|
||||
github.com/openacid/slim v0.5.11 // indirect
|
||||
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
|
||||
github.com/pion/datachannel v1.5.2 // indirect
|
||||
|
@ -128,6 +133,7 @@ require (
|
|||
github.com/torquem-ch/mdbx-go v0.26.1 // indirect
|
||||
github.com/ugorji/go/codec v1.1.13 // indirect
|
||||
github.com/ugorji/go/codec/codecgen v1.1.13 // indirect
|
||||
github.com/urfave/cli v1.22.9 // indirect
|
||||
github.com/valyala/fastjson v1.6.3 // indirect
|
||||
github.com/valyala/fastrand v1.1.0 // indirect
|
||||
github.com/valyala/histogram v1.2.0 // indirect
|
||||
|
@ -138,11 +144,12 @@ require (
|
|||
go.uber.org/atomic v1.10.0 // indirect
|
||||
golang.org/x/crypto v0.1.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20221018221608-02f3b879a704 // indirect
|
||||
golang.org/x/mod v0.6.0 // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||
golang.org/x/net v0.1.0 // indirect
|
||||
golang.org/x/sys v0.1.0 // indirect
|
||||
golang.org/x/text v0.4.0 // indirect
|
||||
golang.org/x/time v0.1.0 // indirect
|
||||
golang.org/x/tools v0.2.0 // indirect
|
||||
golang.org/x/tools v0.1.12 // indirect
|
||||
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect
|
||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
|
|
46
go.sum
46
go.sum
|
@ -6,6 +6,8 @@ crawshaw.io/sqlite v0.3.2/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4=
|
|||
crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508 h1:fILCBBFnjnrQ0whVJlGhfv1E/QiaFDNtGFBObEVRnYg=
|
||||
crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4=
|
||||
filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU=
|
||||
gfx.cafe/open/4bytes v0.0.0-20221025060640-c4301cc087ee h1:Wbz69Iw7rhp7UbCNeHs8lSkUoha9cHwvXz9gVZvD+Fg=
|
||||
gfx.cafe/open/4bytes v0.0.0-20221025060640-c4301cc087ee/go.mod h1:2KCpg7z6U0ePqyX//YkaYEP9aJnmU5HoB6cnXVLR/d0=
|
||||
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/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
|
@ -114,6 +116,8 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB
|
|||
github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
|
||||
github.com/bits-and-blooms/bitset v1.2.2 h1:J5gbX05GpMdBjCvQ9MteIg2KKDExr7DrgK+Yc15FvIk=
|
||||
github.com/bits-and-blooms/bitset v1.2.2/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
|
||||
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
|
||||
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
|
||||
github.com/bnb-chain/tendermint v0.31.12 h1:g+blWaXkRw6iHa56lcRfRzPXHgURCWPmgIvaGBSV7Zc=
|
||||
github.com/bnb-chain/tendermint v0.31.12/go.mod h1:j6XU7CArrhQ+9XBMRwdIz63iUxdVwSrZ8f7vP7gcCqg=
|
||||
github.com/bradfitz/iter v0.0.0-20140124041915-454541ec3da2/go.mod h1:PyRFw1Lt2wKX4ZVSQ2mk+PeDa1rxyObEDlApuIsUKuo=
|
||||
|
@ -249,8 +253,8 @@ github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
|
|||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang-jwt/jwt/v4 v4.4.1 h1:pC5DB52sCeK48Wlb9oPcdhnjkz1TKt1D/P7WKJ0kUcQ=
|
||||
github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||
github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs=
|
||||
github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
|
@ -373,6 +377,8 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW
|
|||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
|
||||
github.com/klauspost/compress v1.15.11 h1:Lcadnb3RKGin4FYM/orgq0qde+nc15E5Cbqg4B9Sx9c=
|
||||
github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
|
@ -387,12 +393,12 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
|||
github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758 h1:0D5M2HQSGD3PYPwICLl+/9oulQauOuETfgFvhBDffs0=
|
||||
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
|
||||
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
|
||||
github.com/ledgerwatch/erigon v1.9.7-0.20221024030055-592ad5792127 h1:6CpFRXkf6p3p1hUGNhjy3KaghtLxv/Q9aPFv0G1rXLU=
|
||||
github.com/ledgerwatch/erigon v1.9.7-0.20221024030055-592ad5792127/go.mod h1:2uW5KjsMycyNF0KSiJKxKfdKFwlf91Hk0YDmRODFe3I=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20221024030034-c1965e9c5ae3 h1:8Kf5Yi9F1Dcmr3KrqvIM02SrPEPMzD+f7aIFaaPrxGw=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20221024030034-c1965e9c5ae3/go.mod h1:jv4jmffliy8Us1wXdT6Q1f/nrrmC6Xrr6V70JxZRp48=
|
||||
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20221023043405-d157dec75e9a h1:5Lw7NR/KWxtAokY11DKaMnrI6Zb04OzX8BQMbF8Lu/w=
|
||||
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20221023043405-d157dec75e9a/go.mod h1:3AuPxZc85jkehh/HA9h8gabv5MSi3kb/ddtzBsTVJFo=
|
||||
github.com/ledgerwatch/erigon v1.9.7-0.20221025025825-26fdf9169d27 h1:fPPn9w19eXQwYzVR+2qQy8gotVxGSWw5rtrwdVH10ec=
|
||||
github.com/ledgerwatch/erigon v1.9.7-0.20221025025825-26fdf9169d27/go.mod h1:+Zpwa8IkLCBQqfXrRjXO5qbvxkgBsv7D9EktGuh6iaU=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20221024025924-48ff56eead80 h1:cXOkc2KEW0AMwXacC3h5Ugwm7np4etAQfN7xM7b3cSA=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20221024025924-48ff56eead80/go.mod h1:jv4jmffliy8Us1wXdT6Q1f/nrrmC6Xrr6V70JxZRp48=
|
||||
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20221025023844-6e716b9e651c h1:OZkwKxpAnFLXMtDX3VFHSClkdbTlvBCXm6jjRxWxMjg=
|
||||
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20221025023844-6e716b9e651c/go.mod h1:3AuPxZc85jkehh/HA9h8gabv5MSi3kb/ddtzBsTVJFo=
|
||||
github.com/ledgerwatch/log/v3 v3.6.0 h1:JBUSK1epPyutUrz7KYDTcJtQLEHnehECRpKbM1ugy5M=
|
||||
github.com/ledgerwatch/log/v3 v3.6.0/go.mod h1:L+Sp+ma/h205EdCjviZECjGEvYUYEyXSdiuHNZzg+xQ=
|
||||
github.com/ledgerwatch/secp256k1 v1.0.0 h1:Usvz87YoTG0uePIV8woOof5cQnLXGYa162rFf3YnwaQ=
|
||||
|
@ -411,7 +417,9 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx
|
|||
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/mdempsky/unconvert v0.0.0-20200228143138-95ecdbfc0b5f/go.mod h1:AmCV4WB3cDMZqgPk+OUQKumliiQS4ZYsBt3AXekyuAU=
|
||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
|
@ -457,6 +465,17 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y
|
|||
github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE=
|
||||
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
|
||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
|
||||
github.com/openacid/errors v0.8.1 h1:Hrj9WENDoj5jP27ZfF60SY5LShbxei+sxKZa0EP+oDw=
|
||||
github.com/openacid/errors v0.8.1/go.mod h1:GUQEJJOJE3W9skHm8E8Y4phdl2LLEN8iD7c5gcGgdx0=
|
||||
github.com/openacid/genr v0.1.1/go.mod h1:2B9wMFQKBKZnmo8AR/3JCRGnHs85r4OzeNy0RStLTiU=
|
||||
github.com/openacid/low v0.1.14 h1:DVg5kcwDrJMtKIGrMHU6ytr1ck2XZ3Ey1b6jm/BTS9I=
|
||||
github.com/openacid/low v0.1.14/go.mod h1:flqvccAtSrKeD+b5AejKgxCQVhVrsNYEWU7NlkpNCI8=
|
||||
github.com/openacid/must v0.1.3 h1:deanGZVyVwV+ozfwNFbRU5YF7czXeQ67s8GVyZxzKW4=
|
||||
github.com/openacid/must v0.1.3/go.mod h1:luPiXCuJlEo3UUFQngVQokV0MPGryeYvtCbQPs3U1+I=
|
||||
github.com/openacid/slim v0.5.11 h1:LIN8ktjSV5/0h9Wai9o30jpzQPPIYZmaRExmt9nGkPU=
|
||||
github.com/openacid/slim v0.5.11/go.mod h1:ddlyrp5csrPL30DlLp/SjgP4bdgCnmaCmmv4my407VI=
|
||||
github.com/openacid/tablewriter v0.0.0-20190429071406-b14f71081b86/go.mod h1:iJAvCLjVGFyZOV2Oh123q4PMcoBv2qQLEvjlVIM9E2E=
|
||||
github.com/openacid/testkeys v0.1.6/go.mod h1:MfA7cACzBpbiwekivj8StqX0WIRmqlMsci1c37CA3Do=
|
||||
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
|
||||
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
|
||||
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
|
@ -683,8 +702,8 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG
|
|||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I=
|
||||
golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
|
@ -798,11 +817,12 @@ golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtn
|
|||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200225230052-807dcd883420/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE=
|
||||
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
|
||||
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
@ -884,6 +904,6 @@ honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWh
|
|||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
pgregory.net/rapid v0.4.7 h1:MTNRktPuv5FNqOO151TM9mDTa+XHcX6ypYeISDVD14g=
|
||||
pgregory.net/rapid v0.5.3 h1:163N50IHFqr1phZens4FQOdPgfJscR7a562mjQqeo4M=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
|
||||
|
|
|
@ -1,167 +0,0 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
gzip_static on;
|
||||
|
||||
#access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
location /static {
|
||||
root /usr/share/nginx/html;
|
||||
expires max;
|
||||
}
|
||||
|
||||
location /signatures {
|
||||
root /usr/share/nginx/html;
|
||||
expires 30d;
|
||||
|
||||
# Base on: https://michielkalkman.com/snippets/nginx-cors-open-configuration/
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
#
|
||||
# Om nom nom cookies
|
||||
#
|
||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
|
||||
|
||||
#
|
||||
# Custom headers and headers various browsers *should* be OK with but aren't
|
||||
#
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||
|
||||
#
|
||||
# Tell client that this pre-flight info is valid for 20 days
|
||||
#
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
if ($request_method = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always;
|
||||
}
|
||||
}
|
||||
|
||||
location /topic0 {
|
||||
root /usr/share/nginx/html;
|
||||
expires 30d;
|
||||
|
||||
# Base on: https://michielkalkman.com/snippets/nginx-cors-open-configuration/
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
#
|
||||
# Om nom nom cookies
|
||||
#
|
||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
|
||||
|
||||
#
|
||||
# Custom headers and headers various browsers *should* be OK with but aren't
|
||||
#
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||
|
||||
#
|
||||
# Tell client that this pre-flight info is valid for 20 days
|
||||
#
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
if ($request_method = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always;
|
||||
}
|
||||
}
|
||||
|
||||
location /assets {
|
||||
root /usr/share/nginx/html;
|
||||
expires 30d;
|
||||
|
||||
# Base on: https://michielkalkman.com/snippets/nginx-cors-open-configuration/
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
#
|
||||
# Om nom nom cookies
|
||||
#
|
||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
|
||||
|
||||
#
|
||||
# Custom headers and headers various browsers *should* be OK with but aren't
|
||||
#
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||
|
||||
#
|
||||
# Tell client that this pre-flight info is valid for 20 days
|
||||
#
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
if ($request_method = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always;
|
||||
}
|
||||
}
|
||||
|
||||
location /chains {
|
||||
root /usr/share/nginx/html;
|
||||
expires 30d;
|
||||
|
||||
# Base on: https://michielkalkman.com/snippets/nginx-cors-open-configuration/
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
#
|
||||
# Om nom nom cookies
|
||||
#
|
||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
|
||||
|
||||
#
|
||||
# Custom headers and headers various browsers *should* be OK with but aren't
|
||||
#
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||
|
||||
#
|
||||
# Tell client that this pre-flight info is valid for 20 days
|
||||
#
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
if ($request_method = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always;
|
||||
}
|
||||
}
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
try_files $uri /index.html;
|
||||
|
||||
# brotli_static on;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
#load_module modules/ngx_http_brotli_static_module.so;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
10
package.json
10
package.json
|
@ -45,13 +45,17 @@
|
|||
},
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"download":"rm -rf chains topic0 4bytes &&npm run dl-chains && npm run dl-topic0 && npm run dl-4bytes",
|
||||
"clean": "rm -rf chains topic0 4bytes dist",
|
||||
"fullbuild": "npm run dl-all && npm run build",
|
||||
"build": "tsc && vite build",
|
||||
"postbuild": "cp -r chains dist && cp -r topic0 dist && cp -r 4bytes dist",
|
||||
"postbuild": "npm run copy-all",
|
||||
"preview": "vite preview",
|
||||
"dl-all":"npm run clean && npm run dl-chains && npm run dl-topic0",
|
||||
"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",
|
||||
"dl-4bytes": "git clone https://github.com/ethereum-lists/4bytes && rm -rf 4bytes/.git",
|
||||
"copy-all":"npm run copy-chains && npm run copy-topic0",
|
||||
"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",
|
||||
"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",
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/sh
|
||||
PARAMS="{\"erigonURL\": $(echo $ERIGON_URL | jq -aR .), \"beaconAPI\": $(echo $BEACON_API_URL | jq -aR .), \"assetsURLPrefix\": \"\"}"
|
||||
echo $PARAMS > /usr/share/nginx/html/config.json
|
||||
nginx -g "daemon off;"
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 7618081e0a5fc37e18298a0bde79f65552fe6901
|
Loading…
Reference in New Issue