diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 0a7c04206c..cbf681dd92 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,49 +1,39 @@ name: BuildAndTest on: [pull_request, workflow_dispatch] - env: CHIFRA_PATH: src/apps/chifra # Go Version - GO_VERSION: ^1.22 - + GO_VERSION: 1.22 jobs: Lint: runs-on: ubuntu-latest steps: - - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} cache: false cache-dependency-path: ${{ env.CHIFRA_PATH }}/go.sum - - - name: golangci-lint + - name: Generate go.work file + run: | + ./scripts/go-work-sync.sh + - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.54.2 - - # Optional: working directory, useful for monorepos + version: v1.61.0 working-directory: ${{ env.CHIFRA_PATH }} - - # Optional: set location of the config file (if it is not in the root directory) args: --timeout=5m --verbose --out-format=colored-line-number Build: needs: Lint runs-on: ubuntu-20.04 steps: - - - name: Checkout TrueBlocks repo + - name: Checkout TrueBlocks repo uses: actions/checkout@v4 - - - name: Use a certain version of go + - name: Use a certain version of go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - - name: Install prerequistes + - name: Install prerequistes run: | sudo apt-mark hold grub-efi-amd64-signed sudo apt-get update --fix-missing @@ -51,8 +41,7 @@ jobs: sudo apt-get install build-essential git cmake sudo apt-get install python3 tree jq sudo apt-get install libcurl3-dev - - - name: Run basic golang unit tests + - name: Run basic golang unit tests run: | mkdir -p build cd build @@ -68,8 +57,7 @@ jobs: needs: Build runs-on: ubuntu-latest steps: - - - name: Run tests remotely + - name: Run tests remotely uses: appleboy/ssh-action@master with: host: ${{ secrets.TESTING_HOST }} diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 9f061b95f8..7e378c81f6 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -25,11 +25,8 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.54.2 - # Optional: working directory, useful for monorepos + version: v1.61.0 working-directory: src/apps/chifra - # Optional: golangci-lint command line arguments. args: --timeout=5m --verbose --out-format=colored-line-number # Optional: show only new issues if it's a pull request. The default value is `false`. diff --git a/CHANGES.md b/CHANGES.md index e7f6a31c7a..e2568f5ff9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -344,7 +344,7 @@ gh issue list --search "created:>2024-09-22 is:open is:issue sort:created-desc" **chifra daemon** -- Deprecated `chifra daemon --api`, no replacement, +- Deprecated `chifra daemon --api`, no replacement, - Deprecated `chifra daemon --scrape`, use `chifra scrape` instead - Deprecated `chifra daemon --monitor`, use `chifra monitors --watch` instead. diff --git a/MIGRATIONS.md b/MIGRATIONS.md index 9b215ed7d8..d6225cf522 100644 --- a/MIGRATIONS.md +++ b/MIGRATIONS.md @@ -32,7 +32,7 @@ and then removing the folders presented. Do this only if your data is prior to v | v0.25.0 | [Multi Chain](https://github.com/TrueBlocks/trueblocks-core/blob/develop/src/other/migrations/README-v0.25.0.md) | 2022/02/22 | Adds `--chain` option to all commands. Now supports any EVM-based chain. | | v0.18.0 | [Better Neighbors](https://github.com/TrueBlocks/trueblocks-core/blob/develop/src/other/migrations/README-v0.18.0.md) | 2021/12/10 | Cleans up `chifra export --neighbors` output
- Corrects incorrect headers in .txt and .csv export. | | v0.17.0 | [Updated API and SDK](https://github.com/TrueBlocks/trueblocks-core/blob/develop/src/other/migrations/README-v0.17.0.md) | 2021/11/23 | Creates TypeScript SDK and forces all API endpoint options to camelCase. | -| v0.14.0 | [Go Version of Chifra](https://github.com/TrueBlocks/trueblocks-core/blob/develop/src/other/migrations/README-v0.14.0.md) | 2021/10/03 | Ports chifra command line to golang
- Breaking change to --verbose flag. | +| v0.14.0 | [goLang version of Chifra](https://github.com/TrueBlocks/trueblocks-core/blob/develop/src/other/migrations/README-v0.14.0.md) | 2021/10/03 | Ports chifra command line to golang
- Breaking change to --verbose flag. | | v0.12.1 | [New Folder Structure](https://github.com/TrueBlocks/trueblocks-core/blob/develop/src/other/migrations/README-v0.12.1.md) | 2021/09/01 | Adds support for Erigon
- Moves most executables to private path. | | v0.11.3 | [London Hard Fork Migration](https://github.com/TrueBlocks/trueblocks-core/blob/develop/src/other/migrations/README-v0.11.3.md) | 2021/08/20 | Support for cache file format change due to London hard fork. | | v0.9.0 | [Configuration File Migration](https://github.com/TrueBlocks/trueblocks-core/blob/develop/src/other/migrations/README-v0.09.0.md) | 2021/06/02 | Moves configuration file locations. | diff --git a/docs b/docs index 8aa87665c4..0dc7ad17f9 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 8aa87665c486f45346e54bea8513b9cf25c8643a +Subproject commit 0dc7ad17f991a88531677ab5a672a1a789864e83 diff --git a/examples b/examples index 16d1d6082e..333f80269c 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 16d1d6082e35163dfb0e47b9fb7ebbb73cef0bb5 +Subproject commit 333f80269ca65234b031d8e2b91eb6f50757c719 diff --git a/node b/node index ac550d3f2b..9a0127bb05 160000 --- a/node +++ b/node @@ -1 +1 @@ -Subproject commit ac550d3f2b7607b1247423eab46d095637a8a484 +Subproject commit 9a0127bb05b73780acee79f55cfa2f3abe99c428 diff --git a/scripts/go-work-sync.sh b/scripts/go-work-sync.sh index 8751ef0a0e..d7f5be88f0 100755 --- a/scripts/go-work-sync.sh +++ b/scripts/go-work-sync.sh @@ -37,13 +37,14 @@ find . -type f -name 'go.mod' | while read -r modfile; do isGoMaker="[ "$moddir" == "./src/dev_tools/goMaker" ]" isNode="[ "$moddir" == "./node" ]" isFourbyte="[ "$moddir" == "./examples/four_bytes" ]" + isIndexMan="[ "$moddir" == "./src/dev_tools/indexManager" ]" isSimple="[ "$moddir" == "./examples/simple" ]" if $isGoMaker || $isNode || $isFourbyte; then go get github.com/btcsuite/btcd 2> /dev/null fi - if ! $isSdk && ! $isChifra && ! $isGoMaker; then + if ! $isSdk && ! $isChifra && ! $isGoMaker && ! $isFourbyte && ! $isIndexMan; then go get github.com/TrueBlocks/trueblocks-sdk/v3@latest fi if ! $isSimple && ! $isChifra; then diff --git a/sdk b/sdk index 06e14a1983..fa059434bd 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 06e14a19831d0eb06c2cc4c4f9eaf56f378260ba +Subproject commit fa059434bd0e6dd474ef9c9257d092f4b1763958 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d23e1319c3..20829d095d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,9 +39,10 @@ if (NOT GO_VERSION_MATCH) endif() set(GO_MAJOR_VERSION ${CMAKE_MATCH_1}) set(GO_MINOR_VERSION ${CMAKE_MATCH_2}) +# Go Version if (GO_MAJOR_VERSION LESS 1 OR (GO_MAJOR_VERSION EQUAL 1 AND GO_MINOR_VERSION LESS 22)) message(STATUS "${CColor}The build failed.${COff}") - message(STATUS "${CColor}Found ${GO_VERSION_OUTPUT}. Version 1.22 or higher is required.${COff}") + message(STATUS "${CColor}Found ${GO_VERSION_OUTPUT}. Go Version 1.22 or higher is required.${COff}") message(STATUS "${CColor}Please install or update Go from https://golang.org/doc/install.${COff}") return() else() @@ -59,7 +60,7 @@ set(CMAKE_INSTALL_PREFIX "/usr/local/" CACHE PATH "Default install directory") set(REPO_DIR ${CMAKE_SOURCE_DIR}/..) set(SCRIPTS_DIR ${REPO_DIR}/scripts) -add_custom_target(lint COMMAND "golangci-lint" "run" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/apps/chifra") +add_custom_target(lint COMMAND "golangci-lint" "run" "--out-format=colored-line-number" "--path-prefix=src/apps/chifra" "--timeout=5m" "./..." WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/apps/chifra") add_custom_target(generate COMMAND ${BIN_DIR}/goMaker WORKING_DIRECTORY ${REPO_DIR}) add_custom_target(test-all COMMAND ${SCRIPTS_DIR}/test-all.sh WORKING_DIRECTORY ${REPO_DIR}/build) add_custom_target(examples ALL COMMAND ${SCRIPTS_DIR}/build-examples.sh WORKING_DIRECTORY ${REPO_DIR}) diff --git a/src/apps/chifra/cmd/root.go b/src/apps/chifra/cmd/root.go index b0463aa980..d4eb3a2a64 100644 --- a/src/apps/chifra/cmd/root.go +++ b/src/apps/chifra/cmd/root.go @@ -5,6 +5,7 @@ package cmd import ( + "errors" "fmt" "os" @@ -42,7 +43,7 @@ func ErrFunc(cmd *cobra.Command, errMsg error) error { } else { msg = "\n \033[31m" + msg + "\033[0m\n" } - return fmt.Errorf(msg) + return errors.New(msg) } func UsageWithNotes(notes string) string { diff --git a/src/apps/chifra/go.mod b/src/apps/chifra/go.mod index 70fcd2909c..31355ecd40 100644 --- a/src/apps/chifra/go.mod +++ b/src/apps/chifra/go.mod @@ -12,7 +12,7 @@ require ( github.com/gorilla/websocket v1.5.0 github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-ipfs-api v0.6.1 - github.com/panjf2000/ants/v2 v2.7.0 + github.com/panjf2000/ants/v2 v2.10.0 github.com/pelletier/go-toml/v2 v2.2.2 github.com/spf13/cobra v1.7.0 github.com/wealdtech/go-ens/v3 v3.5.2 diff --git a/src/apps/chifra/go.sum b/src/apps/chifra/go.sum index 786471571e..512b4a6108 100644 --- a/src/apps/chifra/go.sum +++ b/src/apps/chifra/go.sum @@ -551,8 +551,8 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/panjf2000/ants/v2 v2.7.0 h1:Y3Bgpfo9HDkBoHNVFbMfY5mAvi5TAA17y3HbzQ74p5Y= -github.com/panjf2000/ants/v2 v2.7.0/go.mod h1:KIBmYG9QQX5U2qzFP/yQJaq/nSb6rahS9iEHkrCMgM8= +github.com/panjf2000/ants/v2 v2.10.0 h1:zhRg1pQUtkyRiOFo2Sbqwjp0GfBNo9cUY2/Grpx1p+8= +github.com/panjf2000/ants/v2 v2.10.0/go.mod h1:7ZxyxsqE4vvW0M7LSD8aI3cKwgFhBHbxnlN8mDqHa1I= github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= @@ -651,7 +651,7 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= @@ -818,7 +818,7 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/src/apps/chifra/internal/chunks/handle_address.go b/src/apps/chifra/internal/chunks/handle_address.go index 993ac897c1..ee8bab82d7 100644 --- a/src/apps/chifra/internal/chunks/handle_address.go +++ b/src/apps/chifra/internal/chunks/handle_address.go @@ -6,6 +6,7 @@ package chunksPkg import ( "encoding/binary" + "errors" "fmt" "io" "strings" @@ -46,7 +47,7 @@ func (opts *ChunksOptions) HandleAddresses(rCtx *output.RenderCtx, blockNums []b msg = fmt.Sprintf("index file %s does not exist. Warnings turned off...", path) } if msg != "" { - errorChan <- fmt.Errorf(msg) + errorChan <- errors.New(msg) } been_here++ return true, nil diff --git a/src/apps/chifra/internal/scrape/options.go b/src/apps/chifra/internal/scrape/options.go index 0c82b48e87..1cdb599b21 100644 --- a/src/apps/chifra/internal/scrape/options.go +++ b/src/apps/chifra/internal/scrape/options.go @@ -24,6 +24,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/caps" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" @@ -34,17 +35,17 @@ import ( // ScrapeOptions provides all command options for the chifra scrape command. type ScrapeOptions struct { - BlockCnt uint64 `json:"blockCnt,omitempty"` // Maximum number of blocks to process per pass - Sleep float64 `json:"sleep,omitempty"` // Seconds to sleep between scraper passes - Publisher string `json:"publisher,omitempty"` // For some query options, the publisher of the index - Touch base.Blknum `json:"touch,omitempty"` // First block to visit when scraping (snapped back to most recent snap_to_grid mark) - RunCount uint64 `json:"runCount,omitempty"` // Run the scraper this many times, then quit - DryRun bool `json:"dryRun,omitempty"` // Show the configuration that would be applied if run,no changes are made - Notify bool `json:"notify,omitempty"` // Enable the notify feature - Settings config.ScrapeSettings `json:"settings,omitempty"` // Configuration items for the scrape - Globals globals.GlobalOptions `json:"globals,omitempty"` // The global options - Conn *rpc.Connection `json:"conn,omitempty"` // The connection to the RPC server - BadFlag error `json:"badFlag,omitempty"` // An error flag if needed + BlockCnt uint64 `json:"blockCnt,omitempty"` // Maximum number of blocks to process per pass + Sleep float64 `json:"sleep,omitempty"` // Seconds to sleep between scraper passes + Publisher string `json:"publisher,omitempty"` // For some query options, the publisher of the index + Touch base.Blknum `json:"touch,omitempty"` // First block to visit when scraping (snapped back to most recent snap_to_grid mark) + RunCount uint64 `json:"runCount,omitempty"` // Run the scraper this many times, then quit + DryRun bool `json:"dryRun,omitempty"` // Show the configuration that would be applied if run,no changes are made + Notify bool `json:"notify,omitempty"` // Enable the notify feature + Settings configtypes.ScrapeSettings `json:"settings,omitempty"` // Configuration items for the scrape + Globals globals.GlobalOptions `json:"globals,omitempty"` // The global options + Conn *rpc.Connection `json:"conn,omitempty"` // The connection to the RPC server + BadFlag error `json:"badFlag,omitempty"` // An error flag if needed // EXISTING_CODE PublisherAddr base.Address `json:"-"` // EXISTING_CODE diff --git a/src/apps/chifra/internal/status/handle_modes.go b/src/apps/chifra/internal/status/handle_modes.go index 268fb7d61e..11b629a678 100644 --- a/src/apps/chifra/internal/status/handle_modes.go +++ b/src/apps/chifra/internal/status/handle_modes.go @@ -2,6 +2,7 @@ package statusPkg import ( "context" + "errors" "fmt" "strings" "time" @@ -130,9 +131,9 @@ func (opts *StatusOptions) HandleModes(rCtx *output.RenderCtx) error { if totalRecords == 0 { str := "" for _, m := range opts.Modes { - str += fmt.Sprintf("%s ", m) + str += m + " " } - errorChan <- fmt.Errorf("no files were found in the [" + strings.Trim(str, " ") + "] caches") + errorChan <- errors.New("no files were found in the [" + strings.Trim(str, " ") + "] caches") return } diff --git a/src/apps/chifra/pkg/base/address.go b/src/apps/chifra/pkg/base/address.go index 62056bd962..0d47d71202 100644 --- a/src/apps/chifra/pkg/base/address.go +++ b/src/apps/chifra/pkg/base/address.go @@ -48,7 +48,7 @@ func (a Address) String() string { // Format is used by Stringer don't remove func (a Address) Format(s fmt.State, c rune) { - s.Write([]byte(a.Hex())) + _, _ = s.Write([]byte(a.Hex())) } // MarshalText is used by Stringer don't remove diff --git a/src/apps/chifra/pkg/base/hash.go b/src/apps/chifra/pkg/base/hash.go index a216ede38f..6aed79579e 100644 --- a/src/apps/chifra/pkg/base/hash.go +++ b/src/apps/chifra/pkg/base/hash.go @@ -30,7 +30,7 @@ func (h *Hash) String() string { // Format is used by Stringer don't remove func (h Hash) Format(s fmt.State, c rune) { - s.Write([]byte(h.Hex())) + _, _ = s.Write([]byte(h.Hex())) } // MarshalText is used by Stringer don't remove diff --git a/src/apps/chifra/pkg/config/chainGroup.go b/src/apps/chifra/pkg/config/chainGroup.go index 53e0fd966c..c10990bd98 100644 --- a/src/apps/chifra/pkg/config/chainGroup.go +++ b/src/apps/chifra/pkg/config/chainGroup.go @@ -4,27 +4,17 @@ package config -type chainGroup struct { - Chain string `toml:"chain,omitempty"` - ChainId string `toml:"chainId"` - IpfsGateway string `toml:"ipfsGateway,omitempty"` - KeyEndpoint string `toml:"keyEndpoint,omitempty"` - LocalExplorer string `toml:"localExplorer,omitempty"` - RemoteExplorer string `toml:"remoteExplorer,omitempty"` - RpcProvider string `toml:"rpcProvider"` - Symbol string `toml:"symbol"` - Scrape ScrapeSettings `toml:"scrape"` -} +import "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" // GetChain returns the chain for a given chain -func GetChain(chain string) chainGroup { +func GetChain(chain string) configtypes.ChainGroup { return GetRootConfig().Chains[chain] } // GetChains returns a list of all chains configured in the config file. Note, there is no "official" // list. Users may add their own chains. -func GetChains() []chainGroup { - chainArray := make([]chainGroup, 0, len(GetRootConfig().Chains)) +func GetChains() []configtypes.ChainGroup { + chainArray := make([]configtypes.ChainGroup, 0, len(GetRootConfig().Chains)) for _, v := range GetRootConfig().Chains { chainArray = append(chainArray, v) } @@ -33,5 +23,5 @@ func GetChains() []chainGroup { // IsChainConfigured returns true if the chain is configured in the config file. func IsChainConfigured(needle string) bool { - return GetRootConfig().Chains != nil && GetRootConfig().Chains[needle] != chainGroup{} + return GetRootConfig().Chains != nil && GetRootConfig().Chains[needle] != configtypes.ChainGroup{} } diff --git a/src/apps/chifra/pkg/config/config.go b/src/apps/chifra/pkg/config/config.go index c5a837ddd6..6621384a52 100644 --- a/src/apps/chifra/pkg/config/config.go +++ b/src/apps/chifra/pkg/config/config.go @@ -1,7 +1,3 @@ -// Copyright 2021 The TrueBlocks Authors. All rights reserved. -// Use of this source code is governed by a license that can -// be found in the LICENSE file. - package config import ( @@ -19,6 +15,7 @@ import ( "strings" "sync" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/usage" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils" @@ -27,19 +24,10 @@ import ( const envPrefix = "TB_" -var trueBlocksConfig ConfigFile +var trueBlocksConfig configtypes.Config var cachePath string var indexPath string -type ConfigFile struct { - Version versionGroup `toml:"version"` - Settings settingsGroup `toml:"settings"` - Keys map[string]keyGroup `toml:"keys"` - Pinning pinningGroup `toml:"pinning"` - Unchained unchainedGroup `toml:"unchained,omitempty" comment:"Do not edit these values unless instructed to do so."` - Chains map[string]chainGroup `toml:"chains"` -} - // init sets up default values for the given configuration func init() { // The location of the per chain caches @@ -51,13 +39,13 @@ func init() { var configMutex sync.Mutex var configLoaded = false -func loadFromTomlFile(filePath string, dest *ConfigFile) error { +func loadFromTomlFile(filePath string, dest *configtypes.Config) error { return ReadToml(filePath, dest) } // GetRootConfig reads and the configuration located in trueBlocks.toml file. Note // that this routine is local to the package -func GetRootConfig() *ConfigFile { +func GetRootConfig() *configtypes.Config { if configLoaded { return &trueBlocksConfig } @@ -67,7 +55,7 @@ func GetRootConfig() *ConfigFile { configPath := PathToRootConfig() // First load the default config - trueBlocksConfig = *defaultConfig + trueBlocksConfig = configtypes.NewConfig(cachePath, indexPath, defaultIpfsGateway) // Load TOML file tomlConfigFn := filepath.Join(configPath, "trueBlocks.toml") @@ -139,7 +127,7 @@ func GetRootConfig() *ConfigFile { } ch.IpfsGateway = clean(ch.IpfsGateway) if ch.Scrape.AppsPerChunk == 0 { - settings := ScrapeSettings{ + settings := configtypes.ScrapeSettings{ AppsPerChunk: 2000000, SnapToGrid: 250000, FirstSnap: 2000000, diff --git a/src/apps/chifra/pkg/config/env.go b/src/apps/chifra/pkg/config/env.go index 7ae38b45fa..86c5fbd6e7 100644 --- a/src/apps/chifra/pkg/config/env.go +++ b/src/apps/chifra/pkg/config/env.go @@ -6,10 +6,12 @@ import ( "reflect" "strconv" "strings" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" ) // loadFromEnv loads configuration from environment variables -func loadFromEnv(prefix string, destination *ConfigFile) (err error) { +func loadFromEnv(prefix string, destination *configtypes.Config) (err error) { // First we get all env variables then filter by prefix and finally parse the values envs := os.Environ() for i := 0; i < len(envs); i++ { @@ -96,7 +98,7 @@ func deepSetByPath(structure *reflect.Value, path []string, value string) error } } - // Since all maps in ConfigFile have structs as values, we use recursion to set the value + // Since all maps in Config have structs as values, we use recursion to set the value // of a correct field of the struct if err := deepSetByPath(&mapValue, path[2:], value); err != nil { return err diff --git a/src/apps/chifra/pkg/config/env_test.go b/src/apps/chifra/pkg/config/env_test.go index 441cf8a8d3..fff94b2bfb 100644 --- a/src/apps/chifra/pkg/config/env_test.go +++ b/src/apps/chifra/pkg/config/env_test.go @@ -2,6 +2,8 @@ package config import ( "testing" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" ) func Test_setByPath(t *testing.T) { @@ -10,7 +12,7 @@ func Test_setByPath(t *testing.T) { Uint uint Bool bool String string - ConfigFile + configtypes.Config } if err := setByPath(&result, []string{"INT"}, "42"); err != nil { @@ -41,21 +43,21 @@ func Test_setByPath(t *testing.T) { t.Fatal("wrong value", v) } - if err := setByPath(&result, []string{"CONFIGFILE", "VERSION", "CURRENT"}, "v3.0.0-release"); err != nil { + if err := setByPath(&result, []string{"CONFIG", "VERSION", "CURRENT"}, "v3.0.0-release"); err != nil { t.Fatal(err) } if v := result.Version.Current; v != "v3.0.0-release" { t.Fatal("wrong value", v) } - if err := setByPath(&result, []string{"CONFIGFILE", "KEYS", "PROVIDER", "APIKEY"}, "test-key"); err != nil { + if err := setByPath(&result, []string{"CONFIG", "KEYS", "PROVIDER", "APIKEY"}, "test-key"); err != nil { t.Fatal(err) } if v := result.Keys["provider"].ApiKey; v != "test-key" { t.Fatal("wrong value", v) } // Make sure we don't override the whole map when setting another key in already initialized map. - if err := setByPath(&result, []string{"CONFIGFILE", "KEYS", "PROVIDER", "SECRET"}, "secret"); err != nil { + if err := setByPath(&result, []string{"CONFIG", "KEYS", "PROVIDER", "SECRET"}, "secret"); err != nil { t.Fatal(err) } if v := result.Keys["provider"].ApiKey; v != "test-key" { @@ -66,7 +68,7 @@ func Test_setByPath(t *testing.T) { } // Make sure we don't override the whole map when setting another key in already initialized map. - if err := setByPath(&result, []string{"CONFIGFILE", "CHAINS", "MAINNET", "SCRAPE", "APPSPERCHUNK"}, "2000000"); err != nil { + if err := setByPath(&result, []string{"CONFIG", "CHAINS", "MAINNET", "SCRAPE", "APPSPERCHUNK"}, "2000000"); err != nil { t.Fatal(err) } if v := result.Chains["mainnet"].Scrape.AppsPerChunk; v != 2000000 { diff --git a/src/apps/chifra/pkg/config/keyGroup.go b/src/apps/chifra/pkg/config/keyGroup.go index 1fc26ea7cd..2b61713405 100644 --- a/src/apps/chifra/pkg/config/keyGroup.go +++ b/src/apps/chifra/pkg/config/keyGroup.go @@ -4,13 +4,8 @@ package config -type keyGroup struct { - License string `toml:"license,omitempty"` - ApiKey string `toml:"apiKey"` - Secret string `toml:"secret,omitempty"` - Jwt string `toml:"jwt,omitempty"` -} +import "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" -func GetKey(set string) keyGroup { +func GetKey(set string) configtypes.KeyGroup { return GetRootConfig().Keys[set] } diff --git a/src/apps/chifra/pkg/config/migrate.go b/src/apps/chifra/pkg/config/migrate.go index 1e9d49cfea..a9f6fc02fe 100644 --- a/src/apps/chifra/pkg/config/migrate.go +++ b/src/apps/chifra/pkg/config/migrate.go @@ -6,6 +6,7 @@ import ( "path/filepath" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/colors" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/version" @@ -25,7 +26,7 @@ func migrate(currentVer version.Version) error { } // note that this routine does not return if it gets this far. - var cfg ConfigFile + var cfg configtypes.Config configFile := PathToConfigFile() if err := ReadToml(configFile, &cfg); err != nil { return err @@ -36,7 +37,7 @@ func migrate(currentVer version.Version) error { for chain := range cfg.Chains { ch := cfg.Chains[chain] ch.Chain = chain - scrape := ScrapeSettings{ + scrape := configtypes.ScrapeSettings{ AppsPerChunk: 2000000, SnapToGrid: 250000, FirstSnap: 2000000, @@ -68,7 +69,7 @@ func migrate(currentVer version.Version) error { vers = version.NewVersion("v2.0.0-release") if currentVer.Uint64() < vers.Uint64() { - pinning := pinningGroup{ + pinning := configtypes.PinningGroup{ LocalPinUrl: "http://localhost:5001", RemotePinUrl: "https://api.pinata.cloud/pinning/pinFileToIPFS", } @@ -83,7 +84,7 @@ func migrate(currentVer version.Version) error { // Re-write the file (after making a backup) with the new version _, _ = file.Copy(configFile+".bak", configFile) - _ = cfg.writeFile(configFile, minVersion) // updates the version + _ = cfg.WriteFile(configFile, minVersion) // updates the version msg := "Your configuration files were upgraded to {%s}. Rerun your command." logger.Fatal(colors.Colored(fmt.Sprintf(msg, minVersion.String()))) @@ -104,7 +105,7 @@ type OldScrape struct { Settings oldScrapeGroup `toml:"settings"` } -func MergeScrapeConfig(fn string, scrape *ScrapeSettings) error { +func MergeScrapeConfig(fn string, scrape *configtypes.ScrapeSettings) error { var sCfg OldScrape if err := ReadToml(fn, &sCfg); err != nil { return err diff --git a/src/apps/chifra/pkg/config/notifyGroup.go b/src/apps/chifra/pkg/config/notifyGroup.go index 01a6057b2c..dfddaaebd6 100644 --- a/src/apps/chifra/pkg/config/notifyGroup.go +++ b/src/apps/chifra/pkg/config/notifyGroup.go @@ -3,8 +3,3 @@ // be found in the LICENSE file. package config - -type notifyGroup struct { - Url string `toml:"url" json:"url,omitempty"` - Author string `toml:"author" json:"author,omitempty"` -} diff --git a/src/apps/chifra/pkg/config/pinningGroup.go b/src/apps/chifra/pkg/config/pinningGroup.go index 55197c99e5..25e619829c 100644 --- a/src/apps/chifra/pkg/config/pinningGroup.go +++ b/src/apps/chifra/pkg/config/pinningGroup.go @@ -7,18 +7,13 @@ package config import ( "strings" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" shell "github.com/ipfs/go-ipfs-api" ) const defaultIpfsGateway = "https://ipfs.unchainedindex.io/ipfs/" -type pinningGroup struct { - GatewayUrl string `toml:"gatewayUrl" comment:"The pinning gateway to query when downloading the unchained index"` - LocalPinUrl string `toml:"localPinUrl" comment:"The local endpoint for the IPFS daemon"` - RemotePinUrl string `toml:"remotePinUrl" comment:"The remote endpoint for pinning on Pinata"` -} - -func GetPinning() pinningGroup { +func GetPinning() configtypes.PinningGroup { return GetRootConfig().Pinning } diff --git a/src/apps/chifra/pkg/config/scrapeGroup.go b/src/apps/chifra/pkg/config/scrapeGroup.go index 749764c091..b6a7505037 100644 --- a/src/apps/chifra/pkg/config/scrapeGroup.go +++ b/src/apps/chifra/pkg/config/scrapeGroup.go @@ -7,37 +7,18 @@ package config import ( "strconv" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" ) -// ScrapeSettings carries config information for the scraper -type ScrapeSettings struct { - AppsPerChunk uint64 `toml:"appsPerChunk" json:"appsPerChunk"` - SnapToGrid uint64 `toml:"snapToGrid" json:"snapToGrid"` - FirstSnap uint64 `toml:"firstSnap" json:"firstSnap"` - UnripeDist uint64 `toml:"unripeDist" json:"unripeDist"` - AllowMissing bool `toml:"allowMissing" json:"allowMissing,omitempty"` - ChannelCount uint64 `toml:"channelCount" json:"channelCount,omitempty"` -} - // GetScrape returns the scraper settings per chain -func GetScrape(chain string) ScrapeSettings { +func GetScrape(chain string) configtypes.ScrapeSettings { return GetRootConfig().Chains[chain].Scrape } -func (s *ScrapeSettings) TestLog(chain string, test bool) { - logger.TestLog(false, "AppsPerChunk: ", s.AppsPerChunk) - logger.TestLog(false, "SnapToGrid: ", s.SnapToGrid) - logger.TestLog(false, "FirstSnap: ", s.FirstSnap) - logger.TestLog(false, "UnripeDist: ", s.UnripeDist) - logger.TestLog(false, "ChannelCount: ", s.ChannelCount) - logger.TestLog(false, "AllowMissing: ", s.AllowMissing) -} - func SetScrapeArgs(chain string, args map[string]string) { ch := trueBlocksConfig.Chains[chain] - empty := ScrapeSettings{} + empty := configtypes.ScrapeSettings{} if trueBlocksConfig.Chains[chain].Scrape == empty { ch.Scrape = GetScrape(chain) diff --git a/src/apps/chifra/pkg/config/settingsGroup.go b/src/apps/chifra/pkg/config/settingsGroup.go index 2584aa7204..803b8ac81c 100644 --- a/src/apps/chifra/pkg/config/settingsGroup.go +++ b/src/apps/chifra/pkg/config/settingsGroup.go @@ -4,14 +4,8 @@ package config -type settingsGroup struct { - CachePath string `toml:"cachePath" comment:"The location of the per chain caches"` - IndexPath string `toml:"indexPath" comment:"The location of the per chain unchained indexes"` - DefaultChain string `toml:"defaultChain" comment:"The default chain to use if none is provided"` - DefaultGateway string `toml:"defaultGateway,omitempty"` - Notify notifyGroup `toml:"notify"` -} +import "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" -func GetSettings() settingsGroup { +func GetSettings() configtypes.SettingsGroup { return GetRootConfig().Settings } diff --git a/src/apps/chifra/pkg/config/unchainedGroup.go b/src/apps/chifra/pkg/config/unchainedGroup.go index 4811afb7b3..dce811b152 100644 --- a/src/apps/chifra/pkg/config/unchainedGroup.go +++ b/src/apps/chifra/pkg/config/unchainedGroup.go @@ -5,16 +5,12 @@ import ( "strings" "sync" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/history" "github.com/ethereum/go-ethereum/crypto" ) -type unchainedGroup struct { - PreferredPublisher string `toml:"preferredPublisher,omitempty" comment:"The default publisher of the index if none other is provided"` - SmartContract string `toml:"smartContract,omitempty" comment:"The address of the current version of the Unchained Index"` -} - -func GetUnchained() unchainedGroup { +func GetUnchained() configtypes.UnchainedGroup { return GetRootConfig().Unchained } diff --git a/src/apps/chifra/pkg/config/versionGroup.go b/src/apps/chifra/pkg/config/versionGroup.go index 84a9510c06..51ab2c6615 100644 --- a/src/apps/chifra/pkg/config/versionGroup.go +++ b/src/apps/chifra/pkg/config/versionGroup.go @@ -4,10 +4,8 @@ package config -type versionGroup struct { - Current string `toml:"current" comment:"Do not edit"` -} +import "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" -func GetVersion() versionGroup { +func GetVersion() configtypes.VersionGroup { return GetRootConfig().Version } diff --git a/src/apps/chifra/pkg/config/write.go b/src/apps/chifra/pkg/config/write.go deleted file mode 100644 index 7d7ffed9be..0000000000 --- a/src/apps/chifra/pkg/config/write.go +++ /dev/null @@ -1,36 +0,0 @@ -package config - -import ( - "bytes" - "io" - "os" - - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/version" - "github.com/pelletier/go-toml/v2" -) - -// writeFile writes the toml config file from the given struct -func (cfg *ConfigFile) writeFile(outFn string, vers version.Version) error { - cfg.Version.Current = vers.String() - f, err := os.OpenFile(outFn, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666) - if err != nil { - return err - } - defer f.Close() - - return write(f, cfg) -} - -func write(w io.Writer, cfg *ConfigFile) (err error) { - // koanf doesn't keep key order nor comments when unmarshalling, - // so we will use TOML package directly. We use the same TOML - // package as koanf. - var buf bytes.Buffer - enc := toml.NewEncoder(&buf) - enc.SetIndentTables(true) - if err = enc.Encode(cfg); err != nil { - return - } - _, err = w.Write(buf.Bytes()) - return -} diff --git a/src/apps/chifra/pkg/configtypes/chain_group.go b/src/apps/chifra/pkg/configtypes/chain_group.go new file mode 100644 index 0000000000..6a2dba50b0 --- /dev/null +++ b/src/apps/chifra/pkg/configtypes/chain_group.go @@ -0,0 +1,13 @@ +package configtypes + +type ChainGroup struct { + Chain string `json:"chain" toml:"chain,omitempty"` + ChainId string `json:"chainId" toml:"chainId"` + IpfsGateway string `json:"ipfsGateway" toml:"ipfsGateway,omitempty"` + KeyEndpoint string `json:"keyEndpoint" toml:"keyEndpoint,omitempty"` + LocalExplorer string `json:"localExplorer" toml:"localExplorer,omitempty"` + RemoteExplorer string `json:"removeExplorer" toml:"remoteExplorer,omitempty"` + RpcProvider string `json:"rpcProvider" toml:"rpcProvider"` + Symbol string `json:"symbol" toml:"symbol"` + Scrape ScrapeSettings `json:"scrape" toml:"scrape"` +} diff --git a/src/apps/chifra/pkg/configtypes/config.go b/src/apps/chifra/pkg/configtypes/config.go new file mode 100644 index 0000000000..db6851ecac --- /dev/null +++ b/src/apps/chifra/pkg/configtypes/config.go @@ -0,0 +1,45 @@ +package configtypes + +import ( + "bytes" + "io" + "os" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/version" + "github.com/pelletier/go-toml/v2" +) + +type Config struct { + Version VersionGroup `json:"version" toml:"version"` + Settings SettingsGroup `json:"settings" toml:"settings"` + Keys map[string]KeyGroup `json:"keys" toml:"keys"` + Pinning PinningGroup `json:"pinning" toml:"pinning"` + Unchained UnchainedGroup `json:"unchained" toml:"unchained,omitempty" comment:"Do not edit these values unless instructed to do so."` + Chains map[string]ChainGroup `json:"chains" toml:"chains"` +} + +// WriteFile writes the toml config file from the given struct +func (cfg *Config) WriteFile(outFn string, vers version.Version) error { + cfg.Version.Current = vers.String() + f, err := os.OpenFile(outFn, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666) + if err != nil { + return err + } + defer f.Close() + + return write(f, cfg) +} + +func write(w io.Writer, cfg *Config) (err error) { + // koanf doesn't keep key order nor comments when unmarshalling, + // so we will use TOML package directly. We use the same TOML + // package as koanf. + var buf bytes.Buffer + enc := toml.NewEncoder(&buf) + enc.SetIndentTables(true) + if err = enc.Encode(cfg); err != nil { + return + } + _, err = w.Write(buf.Bytes()) + return +} diff --git a/src/apps/chifra/pkg/config/default.go b/src/apps/chifra/pkg/configtypes/default.go similarity index 64% rename from src/apps/chifra/pkg/config/default.go rename to src/apps/chifra/pkg/configtypes/default.go index dc474785cc..56abcdffe3 100644 --- a/src/apps/chifra/pkg/config/default.go +++ b/src/apps/chifra/pkg/configtypes/default.go @@ -1,26 +1,34 @@ -package config +package configtypes -var defaultConfig = &ConfigFile{ - Settings: settingsGroup{ +var defaultConfig = Config{ + Settings: SettingsGroup{ // The location of the per chain caches - CachePath: cachePath, + CachePath: "", // The location of the per chain unchained indexes - IndexPath: indexPath, + IndexPath: "", // The default chain to use if none is provided DefaultChain: "mainnet", }, - Pinning: pinningGroup{ + Pinning: PinningGroup{ // The pinning gateway to query when downloading the unchained index - GatewayUrl: defaultIpfsGateway, + GatewayUrl: "", // The local endpoint for the IPFS daemon LocalPinUrl: "http://localhost:5001", // The remote endpoint for pinning on Pinata RemotePinUrl: "https://api.pinata.cloud/pinning/pinFileToIPFS", }, - Unchained: unchainedGroup{ + Unchained: UnchainedGroup{ // The default publisher of the index if none other is provided PreferredPublisher: "publisher.unchainedindex.eth", // V2: The address of the current version of the Unchained Index SmartContract: "0x0c316b7042b419d07d343f2f4f5bd54ff731183d", }, } + +func NewConfig(cachePath, indexPath, defaultIpfs string) Config { + ret := defaultConfig + ret.Settings.CachePath = cachePath + ret.Settings.IndexPath = indexPath + ret.Pinning.GatewayUrl = defaultIpfs + return ret +} diff --git a/src/apps/chifra/pkg/configtypes/key_group.go b/src/apps/chifra/pkg/configtypes/key_group.go new file mode 100644 index 0000000000..3cacfeabdb --- /dev/null +++ b/src/apps/chifra/pkg/configtypes/key_group.go @@ -0,0 +1,8 @@ +package configtypes + +type KeyGroup struct { + License string `json:"license" toml:"license,omitempty"` + ApiKey string `json:"apiKey" toml:"apiKey"` + Secret string `json:"secret" toml:"secret,omitempty"` + Jwt string `json:"jwt" toml:"jwt,omitempty"` +} diff --git a/src/apps/chifra/pkg/configtypes/notify_group.go b/src/apps/chifra/pkg/configtypes/notify_group.go new file mode 100644 index 0000000000..c911d78103 --- /dev/null +++ b/src/apps/chifra/pkg/configtypes/notify_group.go @@ -0,0 +1,6 @@ +package configtypes + +type NotifyGroup struct { + Url string `json:"url,omitempty" toml:"url"` + Author string `json:"author,omitempty" toml:"author"` +} diff --git a/src/apps/chifra/pkg/configtypes/pinning_group.go b/src/apps/chifra/pkg/configtypes/pinning_group.go new file mode 100644 index 0000000000..5669a6534e --- /dev/null +++ b/src/apps/chifra/pkg/configtypes/pinning_group.go @@ -0,0 +1,7 @@ +package configtypes + +type PinningGroup struct { + GatewayUrl string `json:"gatewayUrl" toml:"gatewayUrl" comment:"The pinning gateway to query when downloading the unchained index"` + LocalPinUrl string `json:"localPinUrl" toml:"localPinUrl" comment:"The local endpoint for the IPFS daemon"` + RemotePinUrl string `json:"remotePinUrl" toml:"remotePinUrl" comment:"The remote endpoint for pinning on Pinata"` +} diff --git a/src/apps/chifra/pkg/configtypes/scrape_group.go b/src/apps/chifra/pkg/configtypes/scrape_group.go new file mode 100644 index 0000000000..5290636f46 --- /dev/null +++ b/src/apps/chifra/pkg/configtypes/scrape_group.go @@ -0,0 +1,21 @@ +package configtypes + +import "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" + +type ScrapeSettings struct { + AppsPerChunk uint64 `json:"appsPerChunk" toml:"appsPerChunk"` + SnapToGrid uint64 `json:"snapToGrid" toml:"snapToGrid"` + FirstSnap uint64 `json:"firstSnap" toml:"firstSnap"` + UnripeDist uint64 `json:"unripeDist" toml:"unripeDist"` + AllowMissing bool `json:"allowMissing,omitempty" toml:"allowMissing"` + ChannelCount uint64 `json:"channelCount,omitempty" toml:"channelCount"` +} + +func (s *ScrapeSettings) TestLog(chain string, test bool) { + logger.TestLog(false, "AppsPerChunk: ", s.AppsPerChunk) + logger.TestLog(false, "SnapToGrid: ", s.SnapToGrid) + logger.TestLog(false, "FirstSnap: ", s.FirstSnap) + logger.TestLog(false, "UnripeDist: ", s.UnripeDist) + logger.TestLog(false, "ChannelCount: ", s.ChannelCount) + logger.TestLog(false, "AllowMissing: ", s.AllowMissing) +} diff --git a/src/apps/chifra/pkg/configtypes/settings_group.go b/src/apps/chifra/pkg/configtypes/settings_group.go new file mode 100644 index 0000000000..e369f6285d --- /dev/null +++ b/src/apps/chifra/pkg/configtypes/settings_group.go @@ -0,0 +1,9 @@ +package configtypes + +type SettingsGroup struct { + CachePath string `json:"cachePath" toml:"cachePath" comment:"The location of the per chain caches"` + IndexPath string `json:"indexPath" toml:"indexPath" comment:"The location of the per chain unchained indexes"` + DefaultChain string `json:"defaultChain" toml:"defaultChain" comment:"The default chain to use if none is provided"` + DefaultGateway string `json:"defaultGateway" toml:"defaultGateway,omitempty"` + Notify NotifyGroup `json:"notify" toml:"notify"` +} diff --git a/src/apps/chifra/pkg/configtypes/unchained_group.go b/src/apps/chifra/pkg/configtypes/unchained_group.go new file mode 100644 index 0000000000..d97ed9f0b1 --- /dev/null +++ b/src/apps/chifra/pkg/configtypes/unchained_group.go @@ -0,0 +1,6 @@ +package configtypes + +type UnchainedGroup struct { + PreferredPublisher string `json:"preferredPublisher" toml:"preferredPublisher,omitempty" comment:"The default publisher of the index if none other is provided"` + SmartContract string `json:"smartContract" toml:"smartContract,omitempty" comment:"The address of the current version of the Unchained Index"` +} diff --git a/src/apps/chifra/pkg/configtypes/version_group.go b/src/apps/chifra/pkg/configtypes/version_group.go new file mode 100644 index 0000000000..02c514cf39 --- /dev/null +++ b/src/apps/chifra/pkg/configtypes/version_group.go @@ -0,0 +1,5 @@ +package configtypes + +type VersionGroup struct { + Current string `json:"current" toml:"current" comment:"Do not edit"` +} diff --git a/src/apps/chifra/pkg/config/write_test.go b/src/apps/chifra/pkg/configtypes/write_test.go similarity index 90% rename from src/apps/chifra/pkg/config/write_test.go rename to src/apps/chifra/pkg/configtypes/write_test.go index 8759884f90..3e39135d82 100644 --- a/src/apps/chifra/pkg/config/write_test.go +++ b/src/apps/chifra/pkg/configtypes/write_test.go @@ -1,4 +1,4 @@ -package config +package configtypes import ( "bytes" @@ -25,7 +25,7 @@ func Test_write(t *testing.T) { [pinning] # The pinning gateway to query when downloading the unchained index - gatewayUrl = 'https://ipfs.unchainedindex.io/ipfs/' + gatewayUrl = '' # The local endpoint for the IPFS daemon localPinUrl = 'http://localhost:5001' # The remote endpoint for pinning on Pinata @@ -40,12 +40,12 @@ func Test_write(t *testing.T) { ` var buf bytes.Buffer - if err := write(&buf, defaultConfig); err != nil { + if err := write(&buf, &defaultConfig); err != nil { t.Fatal("writing:", err) } // Some nice error reporting just in case this test fails - str := string(buf.Bytes()) + str := buf.String() line := 0 col := 1 var correctPart string diff --git a/src/apps/chifra/pkg/file/bounds.go b/src/apps/chifra/pkg/file/bounds.go index e98f01697e..cca33f0e77 100644 --- a/src/apps/chifra/pkg/file/bounds.go +++ b/src/apps/chifra/pkg/file/bounds.go @@ -1,7 +1,7 @@ package file import ( - "fmt" + "errors" "os" "path/filepath" ) @@ -13,7 +13,7 @@ func LatestFileInFolder(path string) (string, error) { return "", err } if len(files) == 0 { - return "", fmt.Errorf("No files found in folder " + path) + return "", errors.New("No files found in folder " + path) } return filepath.Join(path, files[len(files)-1].Name()), nil } @@ -25,7 +25,7 @@ func EarliestFileInFolder(path string) (string, error) { return "", err } if len(files) == 0 { - return "", fmt.Errorf("No files found in folder " + path) + return "", errors.New("No files found in folder " + path) } return filepath.Join(path, files[0].Name()), nil } diff --git a/src/apps/chifra/pkg/manifest/manifest.go b/src/apps/chifra/pkg/manifest/manifest.go index d5d2b94b8f..83579f70eb 100644 --- a/src/apps/chifra/pkg/manifest/manifest.go +++ b/src/apps/chifra/pkg/manifest/manifest.go @@ -4,7 +4,7 @@ import ( "errors" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) @@ -22,7 +22,7 @@ type Manifest struct { Specification base.IpfsHash `json:"specification"` // An IPFS hash pointing to documentation describing the binary format of the files in the index - Config config.ScrapeSettings `json:"config"` + Config configtypes.ScrapeSettings `json:"config"` // A list of pinned chunks (see types.ChunkRecord) detailing the location of all chunks in the index and associated bloom filters Chunks []types.ChunkRecord `json:"chunks"` diff --git a/src/apps/chifra/pkg/pricing/uniswap.go b/src/apps/chifra/pkg/pricing/uniswap.go index 95c288ddc9..f05a562d2b 100644 --- a/src/apps/chifra/pkg/pricing/uniswap.go +++ b/src/apps/chifra/pkg/pricing/uniswap.go @@ -1,6 +1,7 @@ package pricing import ( + "errors" "fmt" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/articulate" @@ -64,7 +65,7 @@ func priceUsdUniswap(conn *rpc.Connection, statement *types.Statement) (price ba pairAddress := base.HexToAddress(result.Values["val_0"]) if pairAddress.IsZero() { msg := fmt.Sprintf("no pair found for %s and %s", first.Hex(), second.Hex()) - return 0.0, "not-priced", fmt.Errorf(msg) + return 0.0, "not-priced", errors.New(msg) } theCall2 := "getReserves()" contractCall, _, err = call.NewContractCall(conn, pairAddress, theCall2) diff --git a/src/apps/chifra/pkg/rpc/provider/provider.go b/src/apps/chifra/pkg/rpc/provider/provider.go index 0fdedebf14..6f0d478168 100644 --- a/src/apps/chifra/pkg/rpc/provider/provider.go +++ b/src/apps/chifra/pkg/rpc/provider/provider.go @@ -2,6 +2,7 @@ package provider import ( "context" + "errors" "fmt" "sync" @@ -105,7 +106,7 @@ func fetchAndFilterData(ctx context.Context, provider Provider, query *Query, er } if totalFiltered == 0 { msg := fmt.Sprintf("zero transactions reported, %d fetched", totalFetched) - errorChan <- fmt.Errorf(msg) + errorChan <- errors.New(msg) } } }() diff --git a/src/apps/chifra/pkg/types/types_destination.go b/src/apps/chifra/pkg/types/types_destination.go index f656cd1e85..c684347633 100644 --- a/src/apps/chifra/pkg/types/types_destination.go +++ b/src/apps/chifra/pkg/types/types_destination.go @@ -11,6 +11,7 @@ package types // EXISTING_CODE import ( "encoding/json" + "os" "path" "strings" @@ -127,8 +128,14 @@ func (s *Destination) Resolve(chain string, google, dalle, local bool) []Destina } if dalle { - var query = "http://192.34.63.136:8080/dalle/simple/[{TERM}]" - ret = append(ret, NewDestinationEx(*s, strings.Replace(query, "[{TERM}]", s.Term, -1), "dalle")) + var query = "https://dalledress.io/dalle/[{SERIES}]/[{TERM}]" + query = strings.ReplaceAll(query, "[{TERM}]", s.Term) + if series, ok := os.LookupEnv("TB_DALLE_SERIES"); ok { + query = strings.ReplaceAll(query, "[{SERIES}]", series) + } else { + query = strings.ReplaceAll(query, "[{SERIES}]", "simple") + } + ret = append(ret, NewDestinationEx(*s, query, "dalle")) } if len(ret) > 0 { diff --git a/src/apps/chifra/pkg/types/types_transaction_test.go b/src/apps/chifra/pkg/types/types_transaction_test.go index 5f0dc3a2fd..03082dbcb6 100644 --- a/src/apps/chifra/pkg/types/types_transaction_test.go +++ b/src/apps/chifra/pkg/types/types_transaction_test.go @@ -63,7 +63,7 @@ func TestTransactionCache(t *testing.T) { if !reflect.DeepEqual(expected, readBack) { msg := fmt.Sprintf("value mismatch:\n\tgot %+v\n\twant %+v\n", readBack, expected) - t.Fatalf(msg) + t.Fatal(msg) } } diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index 962f9be1df..51736563fc 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -38,13 +38,14 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.4.1 // indirect github.com/multiformats/go-varint v0.0.7 // indirect - github.com/panjf2000/ants/v2 v2.7.0 // indirect + github.com/panjf2000/ants/v2 v2.10.0 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/pflag v1.0.5 // indirect golang.org/x/crypto v0.25.0 // indirect golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect + golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.22.0 // indirect golang.org/x/term v0.22.0 // indirect google.golang.org/protobuf v1.33.0 // indirect diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index 8840f44cec..3358c2bfb7 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -68,8 +68,8 @@ github.com/multiformats/go-multistream v0.4.1 h1:rFy0Iiyn3YT0asivDUIR05leAdwZq3d github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= -github.com/panjf2000/ants/v2 v2.7.0 h1:Y3Bgpfo9HDkBoHNVFbMfY5mAvi5TAA17y3HbzQ74p5Y= -github.com/panjf2000/ants/v2 v2.7.0/go.mod h1:KIBmYG9QQX5U2qzFP/yQJaq/nSb6rahS9iEHkrCMgM8= +github.com/panjf2000/ants/v2 v2.10.0 h1:zhRg1pQUtkyRiOFo2Sbqwjp0GfBNo9cUY2/Grpx1p+8= +github.com/panjf2000/ants/v2 v2.10.0/go.mod h1:7ZxyxsqE4vvW0M7LSD8aI3cKwgFhBHbxnlN8mDqHa1I= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -88,7 +88,7 @@ github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= @@ -96,7 +96,7 @@ golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/src/dev_tools/goMaker/types/types_command.go b/src/dev_tools/goMaker/types/types_command.go index 865550327c..cd9332a5c6 100644 --- a/src/dev_tools/goMaker/types/types_command.go +++ b/src/dev_tools/goMaker/types/types_command.go @@ -382,7 +382,7 @@ func (c *Command) OptFields() string { } } if c.Route == "scrape" { - ret = append(ret, "Settings config.ScrapeSettings `json:\"settings,omitempty\"` // Configuration items for the scrape") + ret = append(ret, "Settings configtypes.ScrapeSettings `json:\"settings,omitempty\"` // Configuration items for the scrape") } ret = append(ret, "Globals globals.GlobalOptions `json:\"globals,omitempty\"` // The global options") ret = append(ret, "Conn *rpc.Connection `json:\"conn,omitempty\"` // The connection to the RPC server") diff --git a/src/dev_tools/indexManager/diskUsage.go b/src/dev_tools/indexManager/diskUsage.go index effb14da7c..401dc4b67c 100644 --- a/src/dev_tools/indexManager/diskUsage.go +++ b/src/dev_tools/indexManager/diskUsage.go @@ -22,8 +22,8 @@ type DiskUsage struct { // getDiscUsage gathers disk usage information from multiple machines concurrently // It returns a slice of DiskUsage structs and an error if any occurred during the process -func getDiscUsage(configPath string) ([]DiskUsage, error) { - config, err := loadConfig(configPath) +func getDiscUsage() ([]DiskUsage, error) { + config, err := loadConfig() if err != nil { return nil, fmt.Errorf("error loading configuration: %w", err) } @@ -140,7 +140,7 @@ type Config struct { } // loadConfig returns a map of machine names to their aliases -func loadConfig(path string) (Config, error) { +func loadConfig() (Config, error) { var config Config config.Machines = []string{ "wildmolasses.local", @@ -148,7 +148,7 @@ func loadConfig(path string) (Config, error) { "laptop.local", "desktop.local", "unchainedindex.io", - "192.34.63.136", + "dalledress.io", } config.Aliases = map[string]string{ "laptop.local": "1.0-Laptop", @@ -156,7 +156,7 @@ func loadConfig(path string) (Config, error) { "wildmolasses.local": "4.0-WildMolasses", "linux.local": "3.0-Linux", "unchainedindex.io": "5.0-UnchainedIndex", - "192.34.63.136": "6.0-Testing", + "dalledress.io": "6.0-Testing/DalleDress", } return config, nil } diff --git a/src/dev_tools/indexManager/main.go b/src/dev_tools/indexManager/main.go index f47f970305..6a00accfe4 100644 --- a/src/dev_tools/indexManager/main.go +++ b/src/dev_tools/indexManager/main.go @@ -9,7 +9,7 @@ import ( ) func main() { - allUsages, err := getDiscUsage("./config.json") + allUsages, err := getDiscUsage() if err != nil { fmt.Printf("Error returned from getDiscUsage: %v\n", err) return diff --git a/src/dev_tools/indexManager/utils.go b/src/dev_tools/indexManager/utils.go index b2739c611d..2b284417a0 100644 --- a/src/dev_tools/indexManager/utils.go +++ b/src/dev_tools/indexManager/utils.go @@ -18,7 +18,7 @@ func copyToRemote(localFile, remoteUser, remoteHost, remotePath string) (string, err := cmd.Run() msg := "" if err == nil { - msg = fmt.Sprintf("File copied to %s@%s:%s\n", remoteUser, remoteHost, remotePath) + msg = fmt.Sprintf("File (%s) copied to %s@%s:%s\n", localFile, remoteUser, remoteHost, remotePath) } return msg, err } diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index 99ebedf064..7d7219ae49 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -51,7 +51,7 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.4.1 // indirect github.com/multiformats/go-varint v0.0.7 // indirect - github.com/panjf2000/ants/v2 v2.7.0 // indirect + github.com/panjf2000/ants/v2 v2.10.0 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index c5a72e0061..4516648de5 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -468,8 +468,8 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/panjf2000/ants/v2 v2.7.0 h1:Y3Bgpfo9HDkBoHNVFbMfY5mAvi5TAA17y3HbzQ74p5Y= -github.com/panjf2000/ants/v2 v2.7.0/go.mod h1:KIBmYG9QQX5U2qzFP/yQJaq/nSb6rahS9iEHkrCMgM8= +github.com/panjf2000/ants/v2 v2.10.0 h1:zhRg1pQUtkyRiOFo2Sbqwjp0GfBNo9cUY2/Grpx1p+8= +github.com/panjf2000/ants/v2 v2.10.0/go.mod h1:7ZxyxsqE4vvW0M7LSD8aI3cKwgFhBHbxnlN8mDqHa1I= github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= @@ -555,7 +555,7 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= @@ -693,7 +693,7 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index 2863cdbf0f..42a4a906bb 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -53,7 +53,7 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.4.1 // indirect github.com/multiformats/go-varint v0.0.7 // indirect - github.com/panjf2000/ants/v2 v2.7.0 // indirect + github.com/panjf2000/ants/v2 v2.10.0 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index c5a72e0061..4516648de5 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -468,8 +468,8 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/panjf2000/ants/v2 v2.7.0 h1:Y3Bgpfo9HDkBoHNVFbMfY5mAvi5TAA17y3HbzQ74p5Y= -github.com/panjf2000/ants/v2 v2.7.0/go.mod h1:KIBmYG9QQX5U2qzFP/yQJaq/nSb6rahS9iEHkrCMgM8= +github.com/panjf2000/ants/v2 v2.10.0 h1:zhRg1pQUtkyRiOFo2Sbqwjp0GfBNo9cUY2/Grpx1p+8= +github.com/panjf2000/ants/v2 v2.10.0/go.mod h1:7ZxyxsqE4vvW0M7LSD8aI3cKwgFhBHbxnlN8mDqHa1I= github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= @@ -555,7 +555,7 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= @@ -693,7 +693,7 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/src/other/migrations/CHANGES-PRIOR-TO-3.0.0.md b/src/other/migrations/CHANGES-PRIOR-TO-3.0.0.md index 8f60c73d0f..91388233ae 100644 --- a/src/other/migrations/CHANGES-PRIOR-TO-3.0.0.md +++ b/src/other/migrations/CHANGES-PRIOR-TO-3.0.0.md @@ -150,7 +150,7 @@ chifra scrape: ## v2.5.8 (2024/02/09) - Bumped version number to v2.5.8. -- Bumped required GoLang version to ^1.22. +- Bumped required GoLang version to 1.22. **bug fixes** diff --git a/src/other/migrations/README-v0.14.0.md b/src/other/migrations/README-v0.14.0.md index f77c5d5949..809c2f447b 100644 --- a/src/other/migrations/README-v0.14.0.md +++ b/src/other/migrations/README-v0.14.0.md @@ -1,4 +1,4 @@ -# v0.14.0 Go Version of Chifra +# v0.14.0 goLang version of Chifra ---