Skip to content

Commit

Permalink
Fix gocycle in chain.go
Browse files Browse the repository at this point in the history
  • Loading branch information
zhugelianglongming committed Feb 10, 2023
1 parent 7bd2153 commit bcb14e5
Show file tree
Hide file tree
Showing 9 changed files with 787 additions and 127 deletions.
151 changes: 147 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
module github.com/xuperchain/xupercore

go 1.14
go 1.18

require (
github.com/ChainSafe/go-schnorrkel v0.0.0-20200626160457-b38283118816 // indirect
github.com/agiledragon/gomonkey/v2 v2.9.0
github.com/aws/aws-sdk-go v1.32.4
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d
github.com/dgraph-io/badger/v3 v3.2103.1
github.com/docker/go-connections v0.4.1-0.20180821093606-97c2040d34df // indirect
github.com/docker/go-units v0.4.0
github.com/emirpasic/gods v1.12.1-0.20201118132343-79df803e554c
github.com/fsouza/go-dockerclient v1.6.0
github.com/gammazero/deque v0.1.0
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.4.3
github.com/golang/snappy v0.0.3
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.2.2
github.com/hashicorp/golang-lru v0.5.4
github.com/hyperledger/burrow v0.30.5
Expand Down Expand Up @@ -45,4 +43,149 @@ require (
google.golang.org/grpc v1.35.0
)

require (
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/ChainSafe/go-schnorrkel v0.0.0-20200626160457-b38283118816 // indirect
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 // indirect
github.com/Microsoft/hcsshim v0.8.7-0.20191101173118-65519b62243c // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd v0.20.1-beta // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/consensys/gnark v0.5.2 // indirect
github.com/consensys/gnark-crypto v0.5.3 // indirect
github.com/containerd/containerd v1.3.0 // indirect
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018 // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v1.4.2-0.20191101170500-ac7306503d23 // indirect
github.com/docker/go-connections v0.4.1-0.20180821093606-97c2040d34df // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/fxamacker/cbor/v2 v2.2.0 // indirect
github.com/go-kit/kit v0.9.0 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
github.com/google/flatbuffers v1.12.0 // indirect
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa // indirect
github.com/google/gopacket v1.1.17 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huin/goupnp v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/ipfs/go-cid v0.0.7 // indirect
github.com/ipfs/go-datastore v0.4.4 // indirect
github.com/ipfs/go-ipfs-util v0.0.2 // indirect
github.com/ipfs/go-ipns v0.0.2 // indirect
github.com/ipfs/go-log v1.0.4 // indirect
github.com/ipfs/go-log/v2 v2.1.1 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jmespath/go-jmespath v0.3.0 // indirect
github.com/klauspost/compress v1.12.3 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d // 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-conn-security-multistream v0.2.0 // indirect
github.com/libp2p/go-eventbus v0.2.1 // indirect
github.com/libp2p/go-flow-metrics v0.0.3 // indirect
github.com/libp2p/go-libp2p-autonat v0.3.2 // indirect
github.com/libp2p/go-libp2p-blankhost v0.2.0 // indirect
github.com/libp2p/go-libp2p-crypto v0.1.0 // indirect
github.com/libp2p/go-libp2p-discovery v0.5.0 // indirect
github.com/libp2p/go-libp2p-loggables v0.1.0 // indirect
github.com/libp2p/go-libp2p-mplex v0.2.4 // indirect
github.com/libp2p/go-libp2p-nat v0.0.6 // indirect
github.com/libp2p/go-libp2p-noise v0.1.1 // indirect
github.com/libp2p/go-libp2p-peer v0.2.0 // indirect
github.com/libp2p/go-libp2p-peerstore v0.2.6 // indirect
github.com/libp2p/go-libp2p-pnet v0.2.0 // indirect
github.com/libp2p/go-libp2p-tls v0.1.3 // indirect
github.com/libp2p/go-libp2p-transport-upgrader v0.3.0 // indirect
github.com/libp2p/go-libp2p-yamux v0.2.8 // indirect
github.com/libp2p/go-mplex v0.1.2 // indirect
github.com/libp2p/go-msgio v0.0.6 // indirect
github.com/libp2p/go-nat v0.0.5 // indirect
github.com/libp2p/go-netroute v0.1.3 // indirect
github.com/libp2p/go-openssl v0.0.7 // indirect
github.com/libp2p/go-reuseport v0.0.2 // indirect
github.com/libp2p/go-reuseport-transport v0.0.4 // indirect
github.com/libp2p/go-sockaddr v0.0.2 // indirect
github.com/libp2p/go-stream-muxer-multistream v0.3.0 // indirect
github.com/libp2p/go-tcp-transport v0.2.1 // indirect
github.com/libp2p/go-ws-transport v0.3.1 // indirect
github.com/libp2p/go-yamux v1.3.7 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
github.com/minio/sha256-simd v0.1.1 // indirect
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.0.3 // indirect
github.com/multiformats/go-base36 v0.1.0 // indirect
github.com/multiformats/go-multiaddr-dns v0.2.0 // indirect
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
github.com/multiformats/go-multiaddr-net v0.2.0 // indirect
github.com/multiformats/go-multibase v0.0.3 // indirect
github.com/multiformats/go-multihash v0.0.14 // indirect
github.com/multiformats/go-multistream v0.1.2 // indirect
github.com/multiformats/go-varint v0.0.6 // indirect
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/opencontainers/runc v0.1.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 // indirect
github.com/prometheus/common v0.6.0 // indirect
github.com/prometheus/procfs v0.0.5 // indirect
github.com/sirupsen/logrus v1.4.2 // indirect
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.1.2 // indirect
github.com/spf13/cast v1.3.0 // indirect
github.com/spf13/jwalterweatherman v1.0.0 // indirect
github.com/spf13/pflag v1.0.3 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tendermint/go-amino v0.14.1 // indirect
github.com/tendermint/tendermint v0.33.1 // indirect
github.com/tmthrgd/atomics v0.0.0-20190904060638-dc7a5fcc7e0d // indirect
github.com/tmthrgd/go-bitset v0.0.0-20190904054048-394d9a556c05 // indirect
github.com/tmthrgd/go-bitwise v0.0.0-20190904053232-1430ee983fca // indirect
github.com/tmthrgd/go-byte-test v0.0.0-20190904060354-2794345b9929 // indirect
github.com/tmthrgd/go-memset v0.0.0-20190904060434-6fb7a21f88f1 // indirect
github.com/tmthrgd/go-popcount v0.0.0-20190904054823-afb1ace8b04f // indirect
github.com/twitchyliquid64/golang-asm v0.0.0-20190126203739-365674df15fc // 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/x448/float16 v0.8.4 // indirect
github.com/xuperchain/wagon v0.6.1-0.20200313164333-db544e251599 // indirect
go.opencensus.io v0.22.5 // indirect
go.uber.org/atomic v1.6.0 // indirect
go.uber.org/multierr v1.5.0 // indirect
go.uber.org/zap v1.15.0 // indirect
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect
golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988 // indirect
golang.org/x/text v0.3.3 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
)

replace github.com/hyperledger/burrow => github.com/xuperchain/burrow v0.30.6-0.20211229032028-fbee6a05ab0f
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrd
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/agiledragon/gomonkey/v2 v2.9.0 h1:PDiKKybR596O6FHW+RVSG0Z7uGCBNbmbUXh3uCNQ7Hc=
github.com/agiledragon/gomonkey/v2 v2.9.0/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=
github.com/alecthomas/jsonschema v0.0.0-20190122210438-a6952de1bbe6/go.mod h1:qpebaTNSsyUn5rPSJMsfqEtDw71TTggXM6stUDI16HA=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
Expand Down Expand Up @@ -96,7 +98,6 @@ github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018/go.mod h1:rQY
github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ=
github.com/dgraph-io/badger v1.6.0-rc1/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
github.com/dgraph-io/badger v1.6.1 h1:w9pSFNSdq/JPM1N12Fz/F/bzo993Is1W+Q7HjPzi7yg=
github.com/dgraph-io/badger v1.6.1/go.mod h1:FRmFw3uxvcpa8zG3Rxs0th+hCLIuaQg8HlNV5bjgnuU=
github.com/dgraph-io/badger/v3 v3.2103.1 h1:zaX53IRg7ycxVlkd5pYdCeFp1FynD6qBGQoQql3R3Hk=
github.com/dgraph-io/badger/v3 v3.2103.1/go.mod h1:dULbq6ehJ5K0cGW/1TQ9iSfUk0gbSiToDWmWmTsJ53E=
Expand Down
5 changes: 5 additions & 0 deletions kernel/contract/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ type Response struct {
Body []byte `json:"body"`
}

// HasError checked by status
func (r *Response) HasError() bool {
return r.Status >= StatusErrorThreshold
}

// ContextConfig define the config of context
type ContextConfig struct {
State StateSandbox
Expand Down
50 changes: 50 additions & 0 deletions kernel/contract/context_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package contract

import "testing"

func TestResponse_HasError(t *testing.T) {
type fields struct {
Status int
Message string
Body []byte
}
tests := []struct {
name string
fields fields
want bool
}{
{
name: "no error",
fields: fields{
Status: StatusOK,
},
want: false,
},
{
name: "threshold error",
fields: fields{
Status: StatusErrorThreshold,
},
want: true,
},
{
name: "normal error",
fields: fields{
Status: StatusError,
},
want: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
r := &Response{
Status: tt.fields.Status,
Message: tt.fields.Message,
Body: tt.fields.Body,
}
if got := r.HasError(); got != tt.want {
t.Errorf("Response.HasError() = %v, want %v", got, tt.want)
}
})
}
}
3 changes: 1 addition & 2 deletions kernel/engines/xuperos/asyncworker/asyncworker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package asyncworker

import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -222,7 +221,7 @@ type TestHelper struct {
}

func NewTestHelper() (*TestHelper, error) {
basedir, err := ioutil.TempDir("", "asyncworker-test")
basedir, err := os.MkdirTemp("", "asyncworker-test")
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit bcb14e5

Please sign in to comment.