Skip to content

Commit

Permalink
Bug-Fix: Implement BlockHdrCached + miscellany (#1162)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzaffi authored Aug 3, 2022
1 parent 66b8583 commit 6b61b08
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ coverage.txt

# mac OS
.DS_store

# asdf
.tool-versions
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SRCPATH := $(shell pwd)
VERSION := $(shell $(SRCPATH)/mule/scripts/compute_build_number.sh)
OS_TYPE ?= $(shell $(SRCPATH)/mule/scripts/ostype.sh)
ARCH ?= $(shell $(SRCPATH)/mule/scripts/archtype.sh)
ARCH ?= $(shell $(SRCPATH)/mule/scripts/archtype.sh)
PKG_DIR = $(SRCPATH)/tmp/node_pkgs/$(OS_TYPE)/$(ARCH)/$(VERSION)
ifeq ($(OS_TYPE), darwin)
ifeq ($(ARCH), arm64)
Expand Down
2 changes: 1 addition & 1 deletion misc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ RUN pip3 install -r misc/requirements.txt

ENV INDEXER_DATA="${HOME}/indexer/"
# Run test script
ENTRYPOINT ["/bin/bash", "-c", "sleep 5 && python3 misc/e2elive.py --connection-string \"$CONNECTION_STRING\" --indexer-bin /opt/go/indexer/cmd/algorand-indexer/algorand-indexer --indexer-port 9890"]
ENTRYPOINT ["/bin/bash", "-c", "sleep 5 && python3 misc/e2elive.py --connection-string \"$CONNECTION_STRING\" --s3-source-net \"$CI_E2E_FILENAME\" --indexer-bin /opt/go/indexer/cmd/algorand-indexer/algorand-indexer --indexer-port 9890"]
1 change: 1 addition & 0 deletions misc/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
dockerfile: ./misc/Dockerfile
environment:
CONNECTION_STRING: "host=e2e-db port=5432 user=algorand password=algorand dbname=indexer_db sslmode=disable"
CI_E2E_FILENAME: "rel-nightly"

e2e-db:
image: "postgres:13-alpine"
Expand Down
11 changes: 9 additions & 2 deletions misc/e2elive.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def main():
"--source-net",
help="Path to test network directory containing Primary and other nodes. May be a tar file.",
)
ap.add_argument(
"--s3-source-net",
help="AWS S3 key suffix to test network tarball containing Primary and other nodes. Must be a tar bz2 file.",
)
ap.add_argument("--verbose", default=False, action="store_true")
args = ap.parse_args()
if args.verbose:
Expand All @@ -68,14 +72,18 @@ def main():
else:
logger.info("leaving temp dir %r", tempdir)
if not (source_is_tar or (sourcenet and os.path.isdir(sourcenet))):
tarname = args.s3_source_net
if not tarname:
raise Exception("Must provide either local or s3 network to run test against")
tarname = f"{tarname}.tar.bz2"

# fetch test data from S3
bucket = "algorand-testdata"
import boto3
from botocore.config import Config
from botocore import UNSIGNED

s3 = boto3.client("s3", config=Config(signature_version=UNSIGNED))
tarname = "net_done.tar.bz2"
tarpath = os.path.join(tempdir, tarname)
prefix = "indexer/e2e4"
success = firstFromS3Prefix(s3, bucket, prefix, tarname, outpath=tarpath)
Expand All @@ -94,7 +102,6 @@ def main():
os.path.join(tempdir, "net", "Primary", "*", "*.block.sqlite")
)
lastblock = countblocks(blockfiles[0])
# subprocess.run(['find', tempnet, '-type', 'f'])
try:
xrun(["goal", "network", "start", "-r", tempnet])
except Exception:
Expand Down
2 changes: 1 addition & 1 deletion processor/eval/ledger_for_evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,5 @@ func (l LedgerForEvaluator) LatestTotals() (ledgercore.AccountTotals, error) {

// BlockHdrCached is part of go-algorand's indexerLedgerForEval interface.
func (l LedgerForEvaluator) BlockHdrCached(round basics.Round) (bookkeeping.BlockHeader, error) {
panic("not implemented")
return l.Ledger.BlockHdrCached(round)
}

0 comments on commit 6b61b08

Please sign in to comment.