Skip to content

Commit

Permalink
Use generic data structures and object storage. (#2051)
Browse files Browse the repository at this point in the history
Co-authored-by: Hans Moog <3293976+hmoog@users.noreply.github.com>
  • Loading branch information
piotrm50 and hmoog authored Mar 10, 2022
1 parent e5997eb commit ab5915f
Show file tree
Hide file tree
Showing 77 changed files with 1,741 additions and 3,622 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/client-import.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Setup Go 1.16.3
- name: Setup Go 1.18
uses: actions/setup-go@v1
with:
go-version: 1.16.3
go-version: 1.18

- name: Checkout repository
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on:
- ubuntu-latest
container:
image: gohornet/goreleaser-cgo-cross-compiler:1.16.3
image: gohornet/goreleaser-cgo-cross-compiler:1.18
volumes: [/repo]
steps:
- name: Checkout
Expand All @@ -41,7 +41,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16.3
go-version: 1.18

- name: Copy config.default.json to config.json
run: cp config.default.json config.json
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
with:
fetch-depth: 0 # required for new-from-rev option in .golangci.yml

- uses: actions/setup-go@v2
- uses: actions/setup-go@v1
with:
go-version: "^1.16.2"
go-version: "1.18"

- name: Run golangci-lint
uses: reviewdog/action-golangci-lint@c9fac889cce0d374dc2700eb2bd28987d443fdf9
uses: docker://reviewdog/action-golangci-lint:latest
with:
github_token: ${{ secrets.github_token }}
golangci_lint_flags: "--timeout=10m"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
- name: Setup dependencies
run: sudo apt-get install libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev

- name: Setup Go 1.16.3
- name: Setup Go 1.18
uses: actions/setup-go@v1
with:
go-version: 1.16.3
go-version: 1.18

- name: Checkout repository
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
ARG REMOTE_DEBUGGING=0

############################
# golang 1.17.2-buster multi-arch
FROM golang@sha256:5b036db95aaf91b8c75be815e2ba0ca0eecbfc3f57952c24c5d8c125970e2634 AS build
# golang 1.18rc1-buster multi-arch
FROM golang:1.18rc1-buster AS build

ARG RUN_TEST=0
ARG BUILD_TAGS=rocksdb,builtin_static
Expand Down
23 changes: 11 additions & 12 deletions client/wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ func (wallet *Wallet) SendFunds(options ...sendoptions.SendFundsOption) (tx *led

tx = ledgerstate.NewTransaction(txEssence, unlockBlocks)

// check syntactical validity by marshaling an unmarshaling
tx, _, err = ledgerstate.TransactionFromBytes(tx.Bytes())
// check syntactical validity by marshaling an unmarshalling
tx, err = new(ledgerstate.Transaction).FromBytes(tx.Bytes())
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -226,7 +226,7 @@ func (wallet *Wallet) ConsolidateFunds(options ...consolidateoptions.Consolidate
tx := ledgerstate.NewTransaction(txEssence, unlockBlocks)

// check syntactical validity by marshaling an unmarshaling
tx, _, err = ledgerstate.TransactionFromBytes(tx.Bytes())
tx, err = new(ledgerstate.Transaction).FromBytes(tx.Bytes())
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -303,7 +303,7 @@ func (wallet *Wallet) ClaimConditionalFunds(options ...claimconditionaloptions.C
tx = ledgerstate.NewTransaction(txEssence, unlockBlocks)

// check syntactical validity by marshaling an unmarshaling
tx, _, err = ledgerstate.TransactionFromBytes(tx.Bytes())
tx, err = new(ledgerstate.Transaction).FromBytes(tx.Bytes())
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -472,7 +472,7 @@ func (wallet *Wallet) DelegateFunds(options ...delegateoptions.DelegateFundsOpti
tx = ledgerstate.NewTransaction(txEssence, unlockBlocks)

// check syntactical validity by marshaling an unmarshaling
tx, _, err = ledgerstate.TransactionFromBytes(tx.Bytes())
tx, err = new(ledgerstate.Transaction).FromBytes(tx.Bytes())
if err != nil {
return
}
Expand Down Expand Up @@ -599,7 +599,7 @@ func (wallet *Wallet) CreateNFT(options ...createnftoptions.CreateNFTOption) (tx
tx = ledgerstate.NewTransaction(txEssence, unlockBlocks)

// check syntactical validity by marshaling an unmarshaling
tx, _, err = ledgerstate.TransactionFromBytes(tx.Bytes())
tx, err = new(ledgerstate.Transaction).FromBytes(tx.Bytes())
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -720,7 +720,7 @@ func (wallet *Wallet) TransferNFT(options ...transfernftoptions.TransferNFTOptio
})

// check syntactical validity by marshaling an unmarshaling
tx, _, err = ledgerstate.TransactionFromBytes(tx.Bytes())
tx, err = new(ledgerstate.Transaction).FromBytes(tx.Bytes())
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -816,7 +816,7 @@ func (wallet *Wallet) DestroyNFT(options ...destroynftoptions.DestroyNFTOption)
})

// check syntactical validity by marshaling an unmarshaling
tx, _, err = ledgerstate.TransactionFromBytes(tx.Bytes())
tx, err = new(ledgerstate.Transaction).FromBytes(tx.Bytes())
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -928,7 +928,7 @@ func (wallet *Wallet) WithdrawFundsFromNFT(options ...withdrawfromnftoptions.Wit
})

// check syntactical validity by marshaling an unmarshaling
tx, _, err = ledgerstate.TransactionFromBytes(tx.Bytes())
tx, err = new(ledgerstate.Transaction).FromBytes(tx.Bytes())
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -1043,11 +1043,10 @@ func (wallet *Wallet) DepositFundsToNFT(options ...deposittonftoptions.DepositFu
tx = ledgerstate.NewTransaction(txEssence, unlockBlocks)

// check syntactical validity by marshaling an unmarshaling
tx, _, err = ledgerstate.TransactionFromBytes(tx.Bytes())
tx, err = new(ledgerstate.Transaction).FromBytes(tx.Bytes())
if err != nil {
return nil, err
}

// check tx validity (balances, unlock blocks)
ok, err := checkBalancesAndUnlocks(inputsInOrder, tx)
if err != nil {
Expand Down Expand Up @@ -1183,7 +1182,7 @@ func (wallet Wallet) SweepNFTOwnedFunds(options ...sweepnftownedoptions.SweepNFT
tx = ledgerstate.NewTransaction(essence, unlockBlocks)

// check syntactical validity by marshaling an unmarshaling
tx, _, err = ledgerstate.TransactionFromBytes(tx.Bytes())
tx, err = new(ledgerstate.Transaction).FromBytes(tx.Bytes())
if err != nil {
return nil, err
}
Expand Down
177 changes: 166 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
module github.com/iotaledger/goshimmer

go 1.16
go 1.18

replace github.com/linxGnu/grocksdb => github.com/gohornet/grocksdb v1.6.34-0.20210518222204-d6ea5eedcfb9

require (
github.com/DataDog/zstd v1.4.8 // indirect
github.com/ReneKroon/ttlcache/v2 v2.11.0
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/beevik/ntp v0.3.0
github.com/capossele/asset-registry v0.0.0-20210521112927-c9d6e74574e8
github.com/cockroachdb/errors v1.8.4
github.com/drand/drand v1.1.1
github.com/drand/kyber v1.1.2
github.com/gin-gonic/gin v1.7.0
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/go-resty/resty/v2 v2.6.0
github.com/gorilla/websocket v1.4.2
github.com/iotaledger/hive.go v0.0.0-20220210121915-5c76c0ccc668
github.com/gorilla/websocket v1.5.0
github.com/iotaledger/hive.go v0.0.0-20220309131841-1ee6f559f377
github.com/labstack/echo v3.3.10+incompatible
github.com/labstack/gommon v0.3.0
github.com/libp2p/go-libp2p v0.15.0
Expand All @@ -28,21 +25,179 @@ require (
github.com/mr-tron/base58 v1.2.0
github.com/multiformats/go-multiaddr v0.4.1
github.com/multiformats/go-varint v0.0.6
github.com/panjf2000/ants/v2 v2.4.7
github.com/panjf2000/ants/v2 v2.4.8
github.com/paulbellamy/ratecounter v0.2.0
github.com/prometheus/client_golang v1.11.0
github.com/shirou/gopsutil v2.20.5+incompatible
github.com/spf13/afero v1.3.0 // indirect
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.7.0
go.dedis.ch/kyber/v3 v3.0.13
go.uber.org/atomic v1.9.0
go.uber.org/dig v1.13.0
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e
golang.org/x/exp v0.0.0-20210220032938-85be41e4509f // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
google.golang.org/genproto v0.0.0-20201203001206-6486ece9c497 // indirect
google.golang.org/protobuf v1.27.1
gopkg.in/src-d/go-git.v4 v4.13.1
)

require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/DataDog/zstd v1.4.8 // indirect
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/aws/aws-sdk-go v1.34.28 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd v0.22.0-beta // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect
github.com/cockroachdb/pebble v0.0.0-20220224165957-0e0d279abe38 // indirect
github.com/cockroachdb/redact v1.0.8 // indirect
github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect
github.com/drand/kyber-bls12381 v0.1.0 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/flynn/noise v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-kit/kit v0.10.0 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/gobuffalo/here v0.6.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huin/goupnp v1.0.2 // indirect
github.com/ipfs/go-cid v0.0.7 // indirect
github.com/ipfs/go-ipfs-util v0.0.2 // indirect
github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-log/v2 v2.3.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // 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.4.0 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd // indirect
github.com/kilic/bls12-381 v0.0.0-20200607163746-32e1441c8a9f // indirect
github.com/klauspost/compress v1.12.3 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/knadh/koanf v1.4.0 // indirect
github.com/koron/go-ssdp v0.0.2 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/libp2p/go-addr-util v0.1.0 // indirect
github.com/libp2p/go-buffer-pool v0.0.2 // indirect
github.com/libp2p/go-conn-security-multistream v0.2.1 // 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.4.2 // indirect
github.com/libp2p/go-libp2p-blankhost v0.2.0 // indirect
github.com/libp2p/go-libp2p-circuit v0.4.0 // indirect
github.com/libp2p/go-libp2p-discovery v0.5.1 // indirect
github.com/libp2p/go-libp2p-mplex v0.4.1 // indirect
github.com/libp2p/go-libp2p-nat v0.0.6 // indirect
github.com/libp2p/go-libp2p-netutil v0.1.0 // indirect
github.com/libp2p/go-libp2p-noise v0.2.2 // indirect
github.com/libp2p/go-libp2p-peerstore v0.2.8 // indirect
github.com/libp2p/go-libp2p-pnet v0.2.0 // indirect
github.com/libp2p/go-libp2p-swarm v0.5.3 // indirect
github.com/libp2p/go-libp2p-testing v0.4.2 // indirect
github.com/libp2p/go-libp2p-tls v0.2.0 // indirect
github.com/libp2p/go-libp2p-transport-upgrader v0.4.6 // indirect
github.com/libp2p/go-libp2p-yamux v0.5.4 // indirect
github.com/libp2p/go-maddr-filter v0.1.0 // indirect
github.com/libp2p/go-mplex v0.3.0 // 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.6 // 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.5 // indirect
github.com/libp2p/go-sockaddr v0.1.1 // indirect
github.com/libp2p/go-stream-muxer-multistream v0.3.0 // indirect
github.com/libp2p/go-tcp-transport v0.2.8 // indirect
github.com/libp2p/go-ws-transport v0.5.0 // indirect
github.com/linxGnu/grocksdb v1.6.46 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/miekg/dns v1.1.43 // indirect
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // 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.3.1 // indirect
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
github.com/multiformats/go-multibase v0.0.3 // indirect
github.com/multiformats/go-multihash v0.0.15 // indirect
github.com/multiformats/go-multistream v0.2.2 // indirect
github.com/nikkolasg/hexjson v0.0.0-20181101101858-78e39397e00c // indirect
github.com/oasisprotocol/ed25519 v0.0.0-20210505154701-76d8c688d86e // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pelletier/go-toml v1.7.0 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.30.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
github.com/spf13/afero v1.3.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.0.0 // indirect
github.com/src-d/gcfg v1.4.0 // indirect
github.com/stretchr/objx v0.3.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.1.0 // indirect
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 // indirect
github.com/xanzy/ssh-agent v0.2.1 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.0.2 // indirect
github.com/xdg-go/stringprep v1.0.2 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
go.dedis.ch/fixbuf v1.0.3 // indirect
go.mongodb.org/mongo-driver v1.5.1 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/exp v0.0.0-20210220032938-85be41e4509f // indirect
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20201203001206-6486ece9c497 // indirect
google.golang.org/grpc v1.40.0 // indirect
gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Loading

0 comments on commit ab5915f

Please sign in to comment.