Commit 79c7cd66 authored by suyanlong's avatar suyanlong

replace for encoding/json package

parent 4d92091a
...@@ -41,7 +41,7 @@ NC=\033[0m ...@@ -41,7 +41,7 @@ NC=\033[0m
build: packr build: packr
@mkdir -p bin @mkdir -p bin
rm -f imports/imports.go rm -f imports/imports.go
$(GO) build -ldflags '${GOLDFLAGS}' ./cmd/${APP_NAME} $(GO) build -tags=go_json -ldflags '${GOLDFLAGS}' ./cmd/${APP_NAME}
@mv ./sidecar bin @mv ./sidecar bin
@printf "${GREEN}Build sidecar successfully!${NC}\n" @printf "${GREEN}Build sidecar successfully!${NC}\n"
......
...@@ -2,7 +2,6 @@ package main ...@@ -2,7 +2,6 @@ package main
import ( import (
"encoding/base64" "encoding/base64"
"encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"path/filepath" "path/filepath"
...@@ -16,6 +15,7 @@ import ( ...@@ -16,6 +15,7 @@ import (
rpcx "gitlab.33.cn/link33/sidecar/hub/client" rpcx "gitlab.33.cn/link33/sidecar/hub/client"
"gitlab.33.cn/link33/sidecar/internal/repo" "gitlab.33.cn/link33/sidecar/internal/repo"
"gitlab.33.cn/link33/sidecar/model/constant" "gitlab.33.cn/link33/sidecar/model/constant"
"gitlab.33.cn/link33/sidecar/pkg/json"
) )
var appchainBxhCMD = cli.Command{ var appchainBxhCMD = cli.Command{
......
package client package client
import ( import (
"encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"strconv" "strconv"
...@@ -12,6 +11,7 @@ import ( ...@@ -12,6 +11,7 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
"gitlab.33.cn/link33/sidecar/internal/repo" "gitlab.33.cn/link33/sidecar/internal/repo"
"gitlab.33.cn/link33/sidecar/pkg/json"
) )
type Approve struct { type Approve struct {
......
...@@ -10,6 +10,7 @@ require ( ...@@ -10,6 +10,7 @@ require (
github.com/bits-and-blooms/bloom/v3 v3.1.0 github.com/bits-and-blooms/bloom/v3 v3.1.0
github.com/btcsuite/btcd v0.21.0-beta github.com/btcsuite/btcd v0.21.0-beta
github.com/bxcodec/faker/v3 v3.6.0 github.com/bxcodec/faker/v3 v3.6.0
github.com/casbin/casbin v1.9.1
github.com/cbergoon/merkletree v0.2.0 github.com/cbergoon/merkletree v0.2.0
github.com/creasty/defaults v1.5.2 github.com/creasty/defaults v1.5.2
github.com/deckarep/golang-set v1.7.2-0.20201129021324-03b572015f8e github.com/deckarep/golang-set v1.7.2-0.20201129021324-03b572015f8e
...@@ -18,13 +19,18 @@ require ( ...@@ -18,13 +19,18 @@ require (
github.com/fatih/color v1.12.0 github.com/fatih/color v1.12.0
github.com/fsnotify/fsnotify v1.4.9 github.com/fsnotify/fsnotify v1.4.9
github.com/gammazero/deque v0.1.0 github.com/gammazero/deque v0.1.0
github.com/gin-gonic/gin v1.6.3 github.com/gin-contrib/authz v0.0.0-20211106112157-2a70df09d207
github.com/gin-contrib/gzip v0.0.3
github.com/gin-contrib/requestid v0.0.1
github.com/gin-contrib/timeout v0.0.2
github.com/gin-gonic/gin v1.7.7
github.com/gobuffalo/packd v1.0.0 github.com/gobuffalo/packd v1.0.0
github.com/gobuffalo/packr v1.30.1 github.com/gobuffalo/packr v1.30.1
github.com/goccy/go-json v0.7.10
github.com/gogo/protobuf v1.3.2 github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.5.0 github.com/golang/mock v1.5.0
github.com/golang/protobuf v1.4.3 github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.0 github.com/google/go-cmp v0.5.5
github.com/gookit/goutil v0.3.15 github.com/gookit/goutil v0.3.15
github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd
...@@ -68,15 +74,16 @@ require ( ...@@ -68,15 +74,16 @@ require (
require ( require (
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect
github.com/casbin/casbin/v2 v2.37.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davidlazar/go-crypto v0.0.0-20190912175916-7055855a373f // indirect github.com/davidlazar/go-crypto v0.0.0-20190912175916-7055855a373f // indirect
github.com/dgryski/go-metro v0.0.0-20200812162917-85c65e2d0165 // indirect github.com/dgryski/go-metro v0.0.0-20200812162917-85c65e2d0165 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.13.0 // indirect github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.2.0 // indirect github.com/go-playground/validator/v10 v10.9.0 // indirect
github.com/gobuffalo/envy v1.7.0 // indirect github.com/gobuffalo/envy v1.7.0 // indirect
github.com/golang/snappy v0.0.2-0.20200707131729-196ae77b8a26 // indirect github.com/golang/snappy v0.0.2-0.20200707131729-196ae77b8a26 // indirect
github.com/google/gopacket v1.1.17 // indirect github.com/google/gopacket v1.1.17 // indirect
...@@ -97,10 +104,10 @@ require ( ...@@ -97,10 +104,10 @@ require (
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect github.com/jbenet/goprocess v0.1.4 // indirect
github.com/joho/godotenv v1.3.0 // indirect github.com/joho/godotenv v1.3.0 // indirect
github.com/json-iterator/go v1.1.11 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d // indirect github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d // indirect
github.com/leodido/go-urn v1.2.0 // indirect github.com/leodido/go-urn v1.2.1 // indirect
github.com/lestrrat-go/strftime v1.0.0 // indirect github.com/lestrrat-go/strftime v1.0.0 // indirect
github.com/libp2p/go-addr-util v0.0.2 // indirect github.com/libp2p/go-addr-util v0.0.2 // indirect
github.com/libp2p/go-buffer-pool v0.0.2 // indirect github.com/libp2p/go-buffer-pool v0.0.2 // indirect
...@@ -147,7 +154,7 @@ require ( ...@@ -147,7 +154,7 @@ require (
github.com/minio/sha256-simd v0.1.1 // indirect github.com/minio/sha256-simd v0.1.1 // indirect
github.com/mitchellh/go-testing-interface v1.0.0 // indirect github.com/mitchellh/go-testing-interface v1.0.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mr-tron/base58 v1.1.3 // indirect github.com/mr-tron/base58 v1.1.3 // indirect
github.com/multiformats/go-base32 v0.0.3 // indirect github.com/multiformats/go-base32 v0.0.3 // indirect
github.com/multiformats/go-base36 v0.1.0 // indirect github.com/multiformats/go-base36 v0.1.0 // indirect
...@@ -163,7 +170,7 @@ require ( ...@@ -163,7 +170,7 @@ require (
github.com/pelletier/go-toml v1.2.0 // indirect github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.3.0 // indirect github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
...@@ -176,7 +183,7 @@ require ( ...@@ -176,7 +183,7 @@ require (
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 // indirect
github.com/tidwall/match v1.0.3 // indirect github.com/tidwall/match v1.0.3 // indirect
github.com/tidwall/pretty v1.0.2 // indirect github.com/tidwall/pretty v1.0.2 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect github.com/ugorji/go/codec v1.2.6 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 // indirect github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 // indirect
...@@ -184,14 +191,14 @@ require ( ...@@ -184,14 +191,14 @@ require (
go.uber.org/atomic v1.6.0 // indirect go.uber.org/atomic v1.6.0 // indirect
go.uber.org/multierr v1.5.0 // indirect go.uber.org/multierr v1.5.0 // indirect
go.uber.org/zap v1.15.0 // indirect go.uber.org/zap v1.15.0 // indirect
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3 // indirect golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 // indirect
golang.org/x/text v0.3.3 // indirect golang.org/x/text v0.3.7 // indirect
google.golang.org/protobuf v1.25.0 // indirect google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.51.0 // indirect gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
) )
replace github.com/libp2p/go-libp2p-core => github.com/libp2p/go-libp2p-core v0.5.6 replace github.com/libp2p/go-libp2p-core => github.com/libp2p/go-libp2p-core v0.5.6
......
This diff is collapsed.
package checker package checker
import ( import (
"encoding/json"
"io/ioutil" "io/ioutil"
"testing" "testing"
"time" "time"
...@@ -10,6 +9,7 @@ import ( ...@@ -10,6 +9,7 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"gitlab.33.cn/link33/sidecar/model/pb" "gitlab.33.cn/link33/sidecar/model/pb"
"gitlab.33.cn/link33/sidecar/pkg/json"
) )
const ( const (
......
package manger package manger
import ( import (
"encoding/json"
appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr" appchainmgr "github.com/meshplus/bitxhub-core/appchain-mgr"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"gitlab.33.cn/link33/sidecar/internal/peermgr" "gitlab.33.cn/link33/sidecar/internal/peermgr"
"gitlab.33.cn/link33/sidecar/internal/port" "gitlab.33.cn/link33/sidecar/internal/port"
"gitlab.33.cn/link33/sidecar/model/pb" "gitlab.33.cn/link33/sidecar/model/pb"
"gitlab.33.cn/link33/sidecar/pkg/json"
) )
type Manager struct { type Manager struct {
......
package manger package manger
import ( import (
"encoding/json"
"github.com/meshplus/bitxhub-core/governance" "github.com/meshplus/bitxhub-core/governance"
"github.com/meshplus/bitxhub-kit/storage" "github.com/meshplus/bitxhub-kit/storage"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"gitlab.33.cn/link33/sidecar/pkg/json"
) )
var _ governance.Persister = (*Persister)(nil) var _ governance.Persister = (*Persister)(nil)
......
package rulemgr package rulemgr
import ( import (
"encoding/json"
"github.com/meshplus/bitxhub-kit/types" "github.com/meshplus/bitxhub-kit/types"
"gitlab.33.cn/link33/sidecar/internal/port" "gitlab.33.cn/link33/sidecar/internal/port"
"gitlab.33.cn/link33/sidecar/model/pb" "gitlab.33.cn/link33/sidecar/model/pb"
"gitlab.33.cn/link33/sidecar/pkg/json"
) )
func (rm *RuleMgr) HandleRule(p port.Port, msg *pb.Message) { func (rm *RuleMgr) HandleRule(p port.Port, msg *pb.Message) {
......
...@@ -2,7 +2,6 @@ package syncer ...@@ -2,7 +2,6 @@ package syncer
import ( import (
"context" "context"
"encoding/json"
"fmt" "fmt"
"strconv" "strconv"
"sync/atomic" "sync/atomic"
...@@ -18,6 +17,7 @@ import ( ...@@ -18,6 +17,7 @@ import (
rpcx "gitlab.33.cn/link33/sidecar/hub/client" rpcx "gitlab.33.cn/link33/sidecar/hub/client"
"gitlab.33.cn/link33/sidecar/internal/lite" "gitlab.33.cn/link33/sidecar/internal/lite"
"gitlab.33.cn/link33/sidecar/model/pb" "gitlab.33.cn/link33/sidecar/model/pb"
"gitlab.33.cn/link33/sidecar/pkg/json"
) )
var _ Syncer = (*WrapperSyncer)(nil) var _ Syncer = (*WrapperSyncer)(nil)
......
...@@ -4,7 +4,6 @@ import ( ...@@ -4,7 +4,6 @@ import (
"bytes" "bytes"
"context" "context"
"crypto/sha256" "crypto/sha256"
"encoding/json"
"errors" "errors"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
...@@ -28,6 +27,7 @@ import ( ...@@ -28,6 +27,7 @@ import (
"gitlab.33.cn/link33/sidecar/internal/repo" "gitlab.33.cn/link33/sidecar/internal/repo"
"gitlab.33.cn/link33/sidecar/model/constant" "gitlab.33.cn/link33/sidecar/model/constant"
"gitlab.33.cn/link33/sidecar/model/pb" "gitlab.33.cn/link33/sidecar/model/pb"
"gitlab.33.cn/link33/sidecar/pkg/json"
"gitlab.33.cn/link33/sidecar/pkg/log" "gitlab.33.cn/link33/sidecar/pkg/log"
) )
......
...@@ -130,3 +130,11 @@ func testAggVerify(ibtpx *IBTPX) bool { ...@@ -130,3 +130,11 @@ func testAggVerify(ibtpx *IBTPX) bool {
//3、接收者作为结速点(中间点); //3、接收者作为结速点(中间点);
//4、中继链裁决方分配(裁决)。 //4、中继链裁决方分配(裁决)。
//裁决方案:奖励金额最大、路由节点最少、速度最快方案裁决。 //裁决方案:奖励金额最大、路由节点最少、速度最快方案裁决。
//不同私钥对各自公钥的证明可以聚合。
//不同私钥对不同消息的证明可以聚合。
//不同私钥对不同消息的证明可以聚合。
//不同私钥对相同消息的证明可以聚合。
//相同私钥对不同消息的证明可以聚合。
//无证书聚合签名方案
...@@ -2,10 +2,11 @@ package pb ...@@ -2,10 +2,11 @@ package pb
import ( import (
"crypto/sha256" "crypto/sha256"
"encoding/json"
"github.com/meshplus/bitxhub-kit/hexutil" "github.com/meshplus/bitxhub-kit/hexutil"
"github.com/meshplus/bitxhub-kit/types" "github.com/meshplus/bitxhub-kit/types"
"gitlab.33.cn/link33/sidecar/pkg/json"
) )
func (m *Receipt) Hash() *types.Hash { func (m *Receipt) Hash() *types.Hash {
......
...@@ -26,6 +26,7 @@ func init() { ...@@ -26,6 +26,7 @@ func init() {
) )
} }
// Verify TODO fix bug
func Verify(opt crypto.KeyType, sig, digest []byte, from types.Address) (bool, error) { func Verify(opt crypto.KeyType, sig, digest []byte, from types.Address) (bool, error) {
if len(sig) == 0 { if len(sig) == 0 {
return false, fmt.Errorf("empty sig data") return false, fmt.Errorf("empty sig data")
......
package json
import json "github.com/goccy/go-json"
var (
Marshal = json.Marshal
Unmarshal = json.Unmarshal
)
package validatorlib package validatorlib
import ( import (
"encoding/json"
"fmt" "fmt"
"gitlab.33.cn/link33/sidecar/pkg/json"
"strings" "strings"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
......
package validator package validator
import ( import (
"encoding/json"
"fmt" "fmt"
"gitlab.33.cn/link33/sidecar/pkg/json"
"strconv" "strconv"
"sync" "sync"
......
package validator package validator
import ( import (
"encoding/json" "gitlab.33.cn/link33/sidecar/pkg/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"strconv" "strconv"
......
package wasm package wasm
import ( import (
"encoding/json"
"fmt" "fmt"
"gitlab.33.cn/link33/sidecar/pkg/json"
"strconv" "strconv"
"sync" "sync"
......
package wasm package wasm
import ( import (
"encoding/json" "gitlab.33.cn/link33/sidecar/pkg/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"sync" "sync"
......
...@@ -74,3 +74,5 @@ func Exist(path string) bool { ...@@ -74,3 +74,5 @@ func Exist(path string) bool {
//Scan git repos (or files) for secrets using regex and entropy 🔑 //Scan git repos (or files) for secrets using regex and entropy 🔑
//https://github.com/zricethezav/gitleaks //https://github.com/zricethezav/gitleaks
//https://github.com/casbin/casbin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment