Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature: Removes logic dependency #1363

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8597f0c
Merge branch 'release/2.13.0'
Algo-devops-service Jul 27, 2022
9d143c2
Merge branch 'release/2.14.0'
Algo-devops-service Sep 6, 2022
5aa86aa
Merge branch 'release/2.14.1'
Algo-devops-service Oct 7, 2022
c2d2a88
Merge branch 'release/2.14.2'
Algo-devops-service Oct 24, 2022
103907b
Bump version to 2.15.0-rc1
Algo-devops-service Nov 2, 2022
896a415
Ignore no op asset transfers. (#1324)
winder Nov 10, 2022
b093e72
Bump version to 2.15.0-rc2
Algo-devops-service Nov 10, 2022
69e4e10
Bump version to 2.15.0
Algo-devops-service Nov 15, 2022
b67081a
Bump version to 2.15.0-rc3
Algo-devops-service Nov 22, 2022
7f031cf
Update go-algorand submodule to 3.12.2-beta
excalq Nov 22, 2022
7c6132e
Re-bump version to 2.15.0-rc3
Algo-devops-service Nov 23, 2022
f16b682
Re-bump version to 2.15.0-rc3
Algo-devops-service Nov 23, 2022
349f09c
Update submodule, oapi-codegen (#1341)
Eric-Warehime Nov 23, 2022
a2deb33
Re-bump version to 2.15.0-rc3
Algo-devops-service Nov 23, 2022
cfdc471
Bump version to 2.15.0
Algo-devops-service Nov 28, 2022
300b69f
Merge branch 'release/2.15.0'
Algo-devops-service Nov 30, 2022
8c49730
REST API: Add compression to REST API (#1390) (#1394)
Eric-Warehime Dec 27, 2022
9379435
API: Hotfix block endpoint (#1397)
Eric-Warehime Jan 3, 2023
b02b5ff
Bump version to 2.15.1-rc1
Algo-devops-service Jan 3, 2023
c7b3b78
API: Skip inner transaction fetching when possible. (#1402)
winder Jan 4, 2023
e1004f6
Bump version to 2.15.1
Algo-devops-service Jan 6, 2023
a9e856b
Merge branch 'hotfix/2.15.1'
Algo-devops-service Jan 6, 2023
1327cb6
Adding a link to the data directory documentation (#1287)
fabrice102 Nov 4, 2022
5f6c66a
conduit: Initial conduit pipeline tool. (#1326)
winder Nov 29, 2022
f47874b
Fix errors showing up w/ golanci-lint (#1358)
Eric-Warehime Nov 30, 2022
9e68771
merge: 2.15.0 release changes (#1359)
Eric-Warehime Dec 1, 2022
4c120ff
Add HOME/.local/bin to PATH for e2e tests (#1354)
Eric-Warehime Dec 2, 2022
0ead25a
Bug-Fix: pass failing `nightly_test_indexer_vs_algod` (#1364)
tzaffi Dec 5, 2022
8c266d9
metrics: Configurable conduit metrics prefix. (#1353)
winder Dec 5, 2022
bdea76c
conduit: Pass data dir to plugin config. (#1357)
winder Dec 6, 2022
732a7f0
Move eval package into blockprocessor. (#1367)
winder Dec 7, 2022
b62c6f1
tech debt: Indexer initialization improvements (#1352)
winder Dec 7, 2022
da513cd
conduit: Default to plugin data directory when possible. (#1366)
winder Dec 8, 2022
05bd181
Removes logic dependency
AlgoStephenAkiki Dec 2, 2022
cd80678
Added comment
AlgoStephenAkiki Dec 2, 2022
cc98a27
Removed redudant casts
AlgoStephenAkiki Dec 2, 2022
e17a2f8
PR comments
AlgoStephenAkiki Dec 7, 2022
1fbfc23
Removed more
AlgoStephenAkiki Dec 7, 2022
572f06f
Fix cast
AlgoStephenAkiki Dec 7, 2022
e0e261b
More casts
AlgoStephenAkiki Dec 7, 2022
205daeb
More casts
AlgoStephenAkiki Dec 7, 2022
16595ef
Import update
AlgoStephenAkiki Dec 8, 2022
6aea83b
Updated to us avm-abi
AlgoStephenAkiki Jan 6, 2023
ce43244
linting
AlgoStephenAkiki Jan 6, 2023
bac6824
Rebase
AlgoStephenAkiki Jan 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
- go/install:
version: << parameters.go_version >>
- install_dependencies
- install_linter
- run_tests
- codecov/upload
test_nightly:
Expand All @@ -65,6 +66,7 @@ jobs:
- go/install:
version: << parameters.go_version >>
- install_dependencies
- install_linter
- run_tests
- codecov/upload
- slack/notify: &slack-fail-event
Expand Down Expand Up @@ -114,18 +116,22 @@ commands:
sudo apt update
sudo apt -y install python3 python3-pip python3-setuptools python3-wheel libboost-math-dev libffi-dev
pip3 install -r misc/requirements.txt
pip3 install e2e_tests/

- run:
name: sync submodules (go-algorand)
command: |
git submodule sync
git submodule update --init

- run: echo 'export PATH=$PATH:/usr/local/go/bin' >> $BASH_ENV
- run: echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/.local/bin' >> $BASH_ENV

install_linter:
description: Install golangci-lint
steps:
- run:
name: Install golint
command: go install golang.org/x/lint/golint@latest
name: Install golangci-lint
command: go install github.com/golangci/golangci-lint/cmd/[email protected]

run_tests:
steps:
Expand All @@ -143,6 +149,7 @@ commands:
- run: make test-generate
- run: make fakepackage
- run: make e2e
- run: make e2e-conduit

run_indexer_vs_algod:
steps:
Expand Down
5 changes: 5 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ codecov:
require_ci_to_pass: no
branch: develop

ignore:
- "idb/mocks"
- "idb/dummy"
- "util/test"

coverage:
precision: 2
round: down
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Build artifacts
cmd/algorand-indexer/algorand-indexer
cmd/conduit/conduit
api/.3tmp.json
api/generate
tmp/
Expand Down Expand Up @@ -28,6 +29,9 @@ _*.json

# Python
__pycache__
e2e_tests/dist
e2e_tests/build
e2e_tests/*egg-info*
.venv

# jetbrains IDE
Expand All @@ -48,3 +52,6 @@ coverage.txt

# asdf
.tool-versions

# conduit example
cmd/conduit/data
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ linters:
enable:
- errcheck
- gofmt
- golint
- govet
- ineffassign
- misspell
- gci
- revive

linters-settings:
gci:
Expand All @@ -30,11 +30,11 @@ severity:
- linters:
- errcheck
- gofmt
- golint
- govet
- ineffassign
- misspell
- gci
- revive
severity: error

issues:
Expand Down
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.14.2
2.15.0
22 changes: 16 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ COVERPKG := $(shell go list ./... | grep -v '/cmd/' | egrep -v '(testing|test|m
# Used for e2e test
export GO_IMAGE = golang:$(shell go version | cut -d ' ' -f 3 | tail -c +3 )

# This is the default target, build the indexer:
# This is the default target, build everything:
all: conduit cmd/algorand-indexer/algorand-indexer go-algorand idb/postgres/internal/schema/setup_postgres_sql.go idb/mocks/IndexerDb.go

conduit: go-algorand
go generate ./... && cd cmd/conduit && go build

cmd/algorand-indexer/algorand-indexer: idb/postgres/internal/schema/setup_postgres_sql.go go-algorand
cd cmd/algorand-indexer && go build -ldflags="${GOLDFLAGS}"

Expand Down Expand Up @@ -56,7 +61,7 @@ test: idb/mocks/IndexerDb.go cmd/algorand-indexer/algorand-indexer
go test -coverpkg=$(COVERPKG) ./... -coverprofile=coverage.txt -covermode=atomic ${TEST_FLAG}

lint: go-algorand
golint -set_exit_status ./...
golangci-lint run -c .golangci.yml
go vet ./...

fmt:
Expand All @@ -68,7 +73,11 @@ integration: cmd/algorand-indexer/algorand-indexer
test/postgres_integration_test.sh

e2e: cmd/algorand-indexer/algorand-indexer
cd misc && docker-compose build --build-arg GO_IMAGE=${GO_IMAGE} && docker-compose up --exit-code-from e2e
cd e2e_tests/docker/indexer/ && docker-compose build --build-arg GO_IMAGE=${GO_IMAGE} && docker-compose up --exit-code-from e2e

e2e-conduit: conduit
cd third_party/go-algorand && make install
export PATH=$(PATH):$(shell go env GOPATH)/bin; pip3 install e2e_tests/ && e2econduit --s3-source-net ${CI_E2E_FILENAME} --conduit-bin cmd/conduit/conduit

deploy:
mule/deploy.sh
Expand Down Expand Up @@ -96,9 +105,10 @@ indexer-v-algod: nightly-setup indexer-v-algod-swagger nightly-teardown
# fetch and update submodule. it's default to latest rel/nightly branch.
# to use a different branch, update the branch in .gitmodules for CI build,
# and for local testing, you may checkout a specific branch in the submodule.
# after submodule is updated, CI_E2E_FILE in circleci/config.yml should also
# be updated to use a newer artifact. path copied from s3 bucket, s3://algorand-testdata/indexer/e2e4/
# after submodule is updated, CI_E2E_FILENAME in .circleci/config.yml should
# also be updated to use a newer artifact. path copied from s3 bucket,
# s3://algorand-testdata/indexer/e2e4/
update-submodule:
git submodule update --remote

.PHONY: test e2e integration fmt lint deploy sign test-package package fakepackage cmd/algorand-indexer/algorand-indexer idb/mocks/IndexerDb.go go-algorand indexer-v-algod
.PHONY: all test e2e integration fmt lint deploy sign test-package package fakepackage cmd/algorand-indexer/algorand-indexer idb/mocks/IndexerDb.go go-algorand indexer-v-algod conduit
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ Indexer is part of the [sandbox](https://github.com/algorand/sandbox) private ne
- Search and filter accounts, transactions, assets, and asset balances with many different parameters.
- Pagination of results.
- Enriched transaction and account data:
- Confirmation round (block containing the transaction)
- Confirmation time
- Signature type
- Close amounts
- Create/delete rounds.
- Confirmation round (block containing the transaction)
- Confirmation time
- Signature type
- Close amounts
- Create/delete rounds.
- Human readable field names instead of the space optimized protocol level names.

# Contributing
Expand All @@ -74,6 +74,9 @@ There are two primary modes of operation:

In both configurations, a postgres connection string is required. Both DSN and URL formats are supported, [details are available here](https://pkg.go.dev/github.com/jackc/pgx/v4/[email protected]#ParseConfig).

In addition, the indexer uses a data directory that stores data needed for runtime operation and configuration.
See the [Data Directory documentation](docs/DataDirectory.md) for how to (re-)initialize this directory in case it is lost or needs to be re-created.

### Database updater
In this mode, the database will be populated with data fetched from an [Algorand archival node](https://developer.algorand.org/docs/run-a-node/setup/types/#archival-mode). Because every block must be fetched to bootstrap the database, the initial import for a ledger with a long history will take a while. If the daemon is terminated, it will resume processing wherever it left off.

Expand Down
21 changes: 20 additions & 1 deletion accounting/eval_preload.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ import (
"github.com/algorand/go-algorand/protocol"
)

func isNoOpAssetXfer(stxnad *transactions.SignedTxnWithAD) bool {
txn := &stxnad.Txn
fields := &txn.AssetTransferTxnFields

if txn.Type != protocol.AssetTransferTx {
return false
}

return (fields.AssetAmount == 0) && (txn.Sender != fields.AssetReceiver) && // not an optin
fields.AssetCloseTo.IsZero() && // not a closeout
fields.AssetSender.IsZero() // not a clawback
}

// Add requests for asset and app creators to `assetsReq` and `appsReq` for the given
// transaction.
func addToCreatorsRequest(stxnad *transactions.SignedTxnWithAD, assetsReq map[basics.AssetIndex]struct{}, appsReq map[basics.AppIndex]struct{}) {
Expand All @@ -22,7 +35,8 @@ func addToCreatorsRequest(stxnad *transactions.SignedTxnWithAD, assetsReq map[ba
}
case protocol.AssetTransferTx:
fields := &txn.AssetTransferTxnFields
if fields.XferAsset != 0 {

if fields.XferAsset != 0 && !isNoOpAssetXfer(stxnad) {
assetsReq[fields.XferAsset] = struct{}{}
}
case protocol.AssetFreezeTx:
Expand Down Expand Up @@ -111,7 +125,12 @@ func addToAccountsResourcesRequest(stxnad *transactions.SignedTxnWithAD, assetCr
}
}
case protocol.AssetTransferTx:
if isNoOpAssetXfer(stxnad) {
break
}

fields := &txn.AssetTransferTxnFields

creatable := ledger.Creatable{
Index: basics.CreatableIndex(fields.XferAsset),
Type: basics.AssetCreatable,
Expand Down
13 changes: 8 additions & 5 deletions api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@ all: generated/v2/types.go generated/v2/routes.go generated/common/types.go gene
generate: oapi-codegen all

generated/v2/types.go: indexer.oas3.yml
oapi-codegen -package generated -type-mappings integer=uint64 -generate types -exclude-tags=common -o ./generated/v2/types.go indexer.oas3.yml
oapi-codegen -config ./generated/v2/v2_types.yml indexer.oas3.yml

generated/v2/routes.go: indexer.oas3.yml
oapi-codegen -package generated -type-mappings integer=uint64 -generate server,spec -exclude-tags=common -o ./generated/v2/routes.go indexer.oas3.yml
oapi-codegen -config ./generated/v2/v2_routes.yml indexer.oas3.yml

generated/common/types.go: indexer.oas3.yml
oapi-codegen -package common -type-mappings integer=uint64 -generate types -include-tags=common -o ./generated/common/types.go indexer.oas3.yml
oapi-codegen -config ./generated/common/common_types.yml indexer.oas3.yml

generated/common/routes.go: indexer.oas3.yml
oapi-codegen -package common -type-mappings integer=uint64 -generate server,spec -include-tags=common -o ./generated/common/routes.go indexer.oas3.yml
oapi-codegen -config ./generated/common/common_routes.yml indexer.oas3.yml

indexer.oas3.yml: .3tmp.json
python3 jsoncanon.py < .3tmp.json > indexer.oas3.yml

.3tmp.json: indexer.oas2.json
curl -s -X POST "https://converter.swagger.io/api/convert" -H "accept: application/json" -H "Content-Type: application/json" -d @./indexer.oas2.json -o .3tmp.json

clean:
rm -rf ./generated/common/types.go ./generated/common/routes.go ./generated/v2/types.go ./generated/v2/routes.go

oapi-codegen: .PHONY
go install "github.com/algorand/oapi-codegen/...@v1.3.7"
go install "github.com/algorand/oapi-codegen/...@v1.12.0-algorand.0"

.PHONY:
Loading