Skip to content

Commit

Permalink
Merge pull request #1 from AlgoNode/NDLY-2-sync-with-upstream
Browse files Browse the repository at this point in the history
[WIP] NDLY-2: Sync with upstream
  • Loading branch information
urtho authored Sep 1, 2024
2 parents 52d70cf + 3fa33b9 commit b554515
Show file tree
Hide file tree
Showing 43 changed files with 1,495 additions and 1,058 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ workflows:
name: test_with_go_<< matrix.go_version >>
matrix: &go-version-matrix
parameters:
go_version: ["1.20.5"]
go_version: ["1.21.10"]

circleci_build_and_test_nightly:
triggers:
Expand All @@ -33,7 +33,7 @@ workflows:
context: lamprey-secrets
matrix: &go-version-matrix
parameters:
go_version: ["1.20.5"]
go_version: ["1.21.10"]
- indexer_vs_algod_nightly:
name: nightly_test_indexer_vs_algod
context: lamprey-secrets
Expand Down
66 changes: 17 additions & 49 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ jobs:
uses: actions/[email protected]
with:
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
- name: Install libraries
run: sudo apt-get -y -q install libboost-math-dev
- name: Install specific golang
uses: actions/[email protected]
with:
go-version: '1.20.5'
go-version: '1.21.10'
- name: reviewdog-golangci-lint
uses: reviewdog/action-golangci-lint@v2.3.1
uses: reviewdog/action-golangci-lint@v2.6.1
with:
golangci_lint_version: "v1.53.2"
go_version_file: go.mod
golangci_lint_version: "v1.58.0"
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
reporter: "github-pr-review"
reporter: "github-pr-check"
tool_name: "Lint Errors"
level: "error"
fail_on_error: true
filter_mode: "nofilter"
# Non-Blocking Warnings Section
reviewdog-warnings:
runs-on: ubuntu-latest
Expand All @@ -33,50 +33,18 @@ jobs:
uses: actions/[email protected]
with:
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
- name: Install libraries
run: sudo apt-get -y -q install libboost-math-dev
- name: Install specific golang
uses: actions/[email protected]
with:
go-version: '1.20.5'
- name: Add bin to PATH
run: |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH
- name: Create folders for golangci-lint
run: mkdir -p cicdtmp/golangci-lint
- name: Check if custom golangci-lint is already built
id: cache-golangci-lint
uses: actions/[email protected]
go-version: '1.21.10'
- name: reviewdog-golangci-lint
uses: reviewdog/[email protected]
with:
path: cicdtmp/golangci-lint/golangci-lint-cgo
key: cicd-golangci-lint-cgo-v0.0.2

- name: Build custom golangci-lint with CGO_ENABLED
if: steps.cache-golangci-lint.outputs.cache-hit != 'true'
run: |
cd cicdtmp/golangci-lint
git clone https://github.com/golangci/golangci-lint.git .
git checkout tags/v1.53.2
CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
./golangci-lint-cgo --version
cd ../../
- name: Install reviewdog
run: |
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.14.1/install.sh | sh -s
reviewdog --version
- name: Run golangci-lint with reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
./cicdtmp/golangci-lint/golangci-lint-cgo run
--out-format line-number
-c .golangci-warnings.yml
--allow-parallel-runners
| reviewdog
-f=golangci-lint
-name="Lint Warnings"
-reporter=github-check
-filter-mode=added
-fail-on-error=false
-level=warning
go_version_file: go.mod
golangci_lint_version: "v1.58.0"
golangci_lint_flags: "-c .golangci-warnings.yml --allow-parallel-runners"
reporter: "github-pr-check"
tool_name: "Lint Warnings"
level: "warning"
fail_on_error: false
filter_mode: "added"
6 changes: 0 additions & 6 deletions .golangci-warnings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ linters:
disable-all: true
enable:
- staticcheck
- structcheck
- typecheck
- varcheck
- deadcode
- gosimple
- unused

Expand Down Expand Up @@ -48,9 +45,6 @@ issues:
- path: _test\.go
linters:
- staticcheck
- structcheck
- typecheck
- varcheck
- deadcode
- gosimple
- unused
8 changes: 5 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ release:
draft: true
header: |
![GitHub Logo](https://raw.githubusercontent.com/algorand/go-algorand/master/release/release-banner.jpg)
## Important
Indexer {{ .Tag }} uses Conduit for data loading. This is a change from the 2.x version, which managed data loading internally. See our [Using Conduit to Populate an Indexer Database](https://github.com/algorand/conduit/blob/master/docs/tutorials/IndexerWriter.md) tutorial for more information on how to use Conduit.
## What's Changed
### Enhancements
* TODO 1
* TODO 2
* TODO 3
footer: |
**Full Changelog**: https://github.com/algorand/indexer/compare/{{ .PreviousTag }}...{{ .Tag }}
Expand Down
10 changes: 0 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
SRCPATH := $(shell pwd)
OS_TYPE ?= $(shell $(SRCPATH)/mule/scripts/ostype.sh)
ARCH ?= $(shell $(SRCPATH)/mule/scripts/archtype.sh)
ifeq ($(OS_TYPE), darwin)
ifeq ($(ARCH), arm64)
export CPATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib
endif
endif
export GOPATH := $(shell go env GOPATH)
GOPATH1 := $(firstword $(subst :, ,$(GOPATH)))

GOLDFLAGS += -X github.com/algorand/indexer/v3/version.Hash=$(shell git log -n 1 --pretty="%H")
GOLDFLAGS += -X github.com/algorand/indexer/v3/version.CompileTime=$(shell date -u +%Y-%m-%dT%H:%M:%S%z)
Expand Down
3 changes: 3 additions & 0 deletions accounting/rewind.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ func AccountAtRound(ctx context.Context, account models.Account, round uint64, d
acct.PendingRewards = 0
acct.Amount = acct.AmountWithoutPendingRewards

// MinBalance is not supported.
acct.MinBalance = 0

// TODO: Clear out the closed-at field as well. Like Rewards we cannot know this value for all accounts.
//acct.ClosedAt = 0

Expand Down
18 changes: 9 additions & 9 deletions api/converter_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,17 +645,17 @@ func (si *ServerImplementation) assetParamsToAssetQuery(params generated.SearchF
return idb.AssetsQuery{}, errors.New(errUnableToParseAddress)
}

var assetGreaterThan uint64 = 0
var assetGreaterThan *uint64
if params.Next != nil {
agt, err := strconv.ParseUint(*params.Next, 10, 64)
if err != nil {
return idb.AssetsQuery{}, fmt.Errorf("%s: %v", errUnableToParseNext, err)
}
assetGreaterThan = agt
assetGreaterThan = &agt
}

query := idb.AssetsQuery{
AssetID: uintOrDefault(params.AssetId),
AssetID: params.AssetId,
AssetIDGreaterThan: assetGreaterThan,
Creator: creator,
Name: strOrDefault(params.Name),
Expand All @@ -674,17 +674,17 @@ func (si *ServerImplementation) appParamsToApplicationQuery(params generated.Sea
return idb.ApplicationQuery{}, errors.New(errUnableToParseAddress)
}

var appGreaterThan uint64 = 0
var appGreaterThan *uint64
if params.Next != nil {
agt, err := strconv.ParseUint(*params.Next, 10, 64)
if err != nil {
return idb.ApplicationQuery{}, fmt.Errorf("%s: %v", errUnableToParseNext, err)
}
appGreaterThan = agt
appGreaterThan = &agt
}

return idb.ApplicationQuery{
ApplicationID: uintOrDefault(params.ApplicationId),
ApplicationID: params.ApplicationId,
ApplicationIDGreaterThan: appGreaterThan,
Address: addr,
IncludeDeleted: boolOrDefault(params.IncludeAll),
Expand All @@ -698,8 +698,8 @@ func (si *ServerImplementation) transactionParamsToTransactionFilter(params gene
// Integer
filter.MaxRound = uintOrDefault(params.MaxRound)
filter.MinRound = uintOrDefault(params.MinRound)
filter.AssetID = uintOrDefault(params.AssetId)
filter.ApplicationID = uintOrDefault(params.ApplicationId)
filter.AssetID = params.AssetId
filter.ApplicationID = params.ApplicationId
filter.Limit = min(uintOrDefaultValue(params.Limit, si.opts.DefaultTransactionsLimit), si.opts.MaxTransactionsLimit)
filter.Round = params.Round

Expand Down Expand Up @@ -730,7 +730,7 @@ func (si *ServerImplementation) transactionParamsToTransactionFilter(params gene
filter.RekeyTo = params.RekeyTo

// filter Algos or Asset but not both.
if filter.AssetID != 0 || filter.TypeEnum == idb.TypeEnumAssetTransfer {
if filter.AssetID != nil || filter.TypeEnum == idb.TypeEnumAssetTransfer {
filter.AssetAmountLT = params.CurrencyLessThan
filter.AssetAmountGT = params.CurrencyGreaterThan
} else {
Expand Down
Loading

0 comments on commit b554515

Please sign in to comment.