Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
227 commits
Select commit Hold shift + click to select a range
37dbc22
README.md as committed to in the last retro + just for temporary fun:…
Jun 8, 2022
d583864
wrong box name
Jun 8, 2022
269cdfb
Update cmd/goal/README.md
tzaffi Jun 9, 2022
82bf313
add the TEAL code for app as well
Jun 9, 2022
a167359
Merge branch 'readme-examples-for-goal' of github.com:tzaffi/go-algor…
Jun 9, 2022
fe0f0c9
per CR suggestion - explain the expectations around go-algorand insta…
Jun 9, 2022
7824071
Update cmd/goal/examples/boxes.teal
tzaffi Jun 9, 2022
3472e15
clear program as well
Jun 9, 2022
28abc2b
Merge branch 'readme-examples-for-goal' of github.com:tzaffi/go-algor…
Jun 9, 2022
d61627b
Update cmd/goal/examples/justfile
tzaffi Jun 9, 2022
02a82ec
Update cmd/goal/examples/justfile
tzaffi Jun 9, 2022
40e29af
Update cmd/goal/examples/justfile
tzaffi Jun 9, 2022
48994e3
AVM: Add an unlimited global storage mechanism - Boxes. (#4001)
jannotti Jun 13, 2022
6635ffb
remove justfile
Jun 15, 2022
7866008
Merge remote-tracking branch 'algorand/feature/avm-box' into readme-e…
Jun 15, 2022
270d495
flesh out the readme with more examples and clearer instructions
Jun 15, 2022
f84af7e
Merge master to f/avm-box (#4138)
jannotti Jun 15, 2022
5d43a4a
Merge remote-tracking branch 'algorand/feature/avm-box' into readme-e…
Jun 15, 2022
b4e7edb
remove not my stuffs
ahangsu Jun 15, 2022
10e29e1
Merge pull request #4095 from tzaffi/readme-examples-for-goal
tzaffi Jun 15, 2022
d841a9a
per pr review, start e2e test in restClient test
ahangsu Jun 15, 2022
4077642
update e2e testcase
ahangsu Jun 15, 2022
073a71b
update handler to follow convension
ahangsu Jun 16, 2022
d2c7c46
Readme fix (#4141)
tzaffi Jun 16, 2022
bdae462
rewrite boxes param description per pr comment
ahangsu Jun 16, 2022
91a14fc
update e2e test
ahangsu Jun 16, 2022
1b451c9
per review comment
ahangsu Jun 17, 2022
4bedff5
use sql string
ahangsu Jun 17, 2022
4c377d8
better set of e2e test
ahangsu Jun 17, 2022
62f83e7
Choose a better key format, cache app account hashes (#4140)
jannotti Jun 17, 2022
715151c
Merge pull request #4122 from ahangsu/box-names-by-appid
ahangsu Jun 21, 2022
2ac8955
update testing frame
ahangsu Jun 21, 2022
8b5b70a
wild card percentage sign in sql, how can we escape that?
ahangsu Jun 21, 2022
bce44ca
new sql query checks start of a key matches exactly prefix passin in
ahangsu Jun 22, 2022
b9e87bc
code change to add to kvstore
ahangsu Jun 23, 2022
1451cbf
update unit test for lookupKeysByPrefix
ahangsu Jun 23, 2022
666318d
update benchmark on db
ahangsu Jun 24, 2022
15bfa1c
moar code cov
ahangsu Jun 27, 2022
02a3978
Change box search API query and move parsing functions from cmd/ to l…
algochoi Jun 27, 2022
8250c4e
linter
algochoi Jun 27, 2022
c81f9bc
minor
ahangsu Jun 27, 2022
1504f23
Change encoding order
algochoi Jun 28, 2022
220270e
Merge remote-tracking branch 'upstream/ahangsu/box-names-by-app-id' i…
algochoi Jun 28, 2022
bfe1061
Finish merging test changes
algochoi Jun 28, 2022
ae6606c
WIP Testing API for boxes
algochoi Jun 28, 2022
017a9b0
Add an integration test for box name searching
algochoi Jun 28, 2022
b0ecff9
Add more tests on box reads
algochoi Jun 29, 2022
66962a2
Revert back test parameters
algochoi Jun 29, 2022
1b37afb
per pr comments
ahangsu Jun 28, 2022
9cf837c
Move tests, regenerate APIs, and remove path parsing
algochoi Jun 29, 2022
3b498f8
Merge branch 'ahangsu/box-names-by-app-id' into algochoi/box-search-api
algochoi Jun 29, 2022
3ce52f3
Add parsing tests
algochoi Jun 29, 2022
d27c28a
Fix routes
algochoi Jun 29, 2022
6adda8e
Change API description and revise tests to add spaces
algochoi Jun 29, 2022
1b35697
testcase keep adding
ahangsu Jun 29, 2022
edd0509
Merge branch 'master' into feature/avm-box
jannotti Jun 29, 2022
e125be3
refactoring acctupdate test
ahangsu Jun 29, 2022
3f09fda
rm 404 response
ahangsu Jun 30, 2022
4975318
Merge pull request #4202 from jannotti/feature/avm-box
jannotti Jun 30, 2022
93e7ad6
Merge branch 'ahangsu/box-names-by-app-id' into algochoi/box-search-api
algochoi Jun 30, 2022
a957b50
minor, explaining test
ahangsu Jun 30, 2022
43435b7
per comments
ahangsu Jun 30, 2022
2e82799
Merge branch 'ahangsu/box-names-by-app-id' into algochoi/box-search-api
algochoi Jun 30, 2022
a155358
Regenerate routes
algochoi Jun 30, 2022
f59d3ac
Merge pull request #4183 from algochoi/algochoi/box-search-api
ahangsu Jun 30, 2022
176d3ea
minor, per pr comment
ahangsu Jul 1, 2022
f394799
Merge pull request #4154 from algorand/ahangsu/box-names-by-app-id
jannotti Jul 1, 2022
dd82278
basic box read db perf test
algoidurovic Jul 7, 2022
55c114a
improve test and add sub benchmark to gauge sqlite caching performanc…
algoidurovic Jul 7, 2022
6707b91
test
algoidurovic Jul 8, 2022
57c7058
box_len, box_put, and box_get to streamline simple uses (#4212)
jannotti Jul 12, 2022
34312c8
BoxesResponse: Fold names into top-level object (#4249)
michaeldiamant Jul 12, 2022
3d4e105
benchmark across different dimensions: boxSize, boxCount, and lookback
algoidurovic Jul 13, 2022
d601bb1
Merge remote-tracking branch 'upstream/master' into feature/avm-box
jannotti Jul 12, 2022
c67a28e
Merge pull request #4255 from jannotti/feature/avm-box
jannotti Jul 13, 2022
68c66cb
improve cache performance
algoidurovic Jul 14, 2022
e64f659
comments
algoidurovic Jul 15, 2022
4da767e
Allow algod client to pass in max box-names number (#4268)
ahangsu Jul 18, 2022
1b7d7ea
Goal box search (#4165)
jdtzmn Jul 19, 2022
ffe1585
implement box cache and corresponding unit tests
algoidurovic Jul 20, 2022
bcbdb1a
resolve merge conflicts
algoidurovic Jul 20, 2022
fcfd075
resolve todos
algoidurovic Jul 20, 2022
abaf6ca
remove todo
algoidurovic Jul 27, 2022
4a3faa6
kvstore table migration during consensus upgrade (#4229)
ahangsu Jul 27, 2022
e15b6da
fill in missing pieces of cache implementation
algoidurovic Jul 29, 2022
3bbee10
exercise box cache and enforce invariants through acctupdates test
algoidurovic Aug 1, 2022
f9f50b0
typo
algoidurovic Aug 1, 2022
6d7aca5
update old test
algoidurovic Aug 2, 2022
f40283e
rename threshold variable and reduce cache size
algoidurovic Aug 2, 2022
4fb59f5
unsaved changes
algoidurovic Aug 2, 2022
4ccc653
More details on spec (and unifiy the box opcodes a bit) (#4323)
jannotti Aug 2, 2022
0bd505d
Companion PR for for indexer's `tzaffi/box-ingest` (#4182)
tzaffi Aug 2, 2022
2473026
Merge branch 'master' into feature/avm-box
jannotti Aug 2, 2022
602cc66
Version fixes
jannotti Aug 2, 2022
a382f46
config value fixup
jannotti Aug 3, 2022
969e800
Fix test to consider AcctLookback instead of BalLookback
jannotti Aug 3, 2022
4618948
Merge pull request #4345 from jannotti/feature/avm-box
jannotti Aug 3, 2022
25946b4
rename boxes to KV
algoidurovic Aug 5, 2022
3bc5cac
Remove “contact us” from box name mismatch error (#4372)
jdtzmn Aug 9, 2022
856b59c
rename updatedBoxes
algoidurovic Aug 10, 2022
abb668d
Adding a goal boxes test case: txn group
Aug 14, 2022
c37ee44
Update test/scripts/e2e_subs/box-search.sh
tzaffi Aug 14, 2022
d726005
Update test/scripts/e2e_subs/box-search.sh
tzaffi Aug 14, 2022
18142ad
Update test/scripts/e2e_subs/box-search.sh
tzaffi Aug 14, 2022
491fc35
Explanatory headings
Aug 14, 2022
ce8f8d9
update py-algorand-sdk dependency in E2E tests to latest 1.16.0
Aug 14, 2022
f274100
Merge branch 'test-box-group-txn' of https://github.com/algorand/go-a…
Aug 14, 2022
88c93c6
per CR suggestion to drop 2nd --box in group txn + KISS with box value
Aug 15, 2022
313b870
Merge pull request #4409 from algorand/test-box-group-txn
tzaffi Aug 15, 2022
4688f93
Merge branch 'master' into feature/avm-box
jannotti Aug 16, 2022
cb9d8e2
reduce BytesPerBoxReference to limit memory consumption (#4413)
algoidurovic Aug 16, 2022
66f8e1c
Merge pull request #4417 from jannotti/feature/avm-box
jannotti Aug 16, 2022
fda8d5f
Merge branch 'feature/avm-box' of https://github.com/algorand/go-algo…
algoidurovic Aug 16, 2022
fb0cb6c
fix compile error
algoidurovic Aug 16, 2022
6458d41
rename and minor refactor for error handling
algoidurovic Aug 18, 2022
2b3a0ae
fix compile error
algoidurovic Aug 18, 2022
24ff56e
explicit nil error
algoidurovic Aug 18, 2022
31037ed
Merge pull request #4275 from algoidurovic/box_cache
algoidurovic Aug 18, 2022
f32a943
Merge branch 'master' into feature/avm-box
jannotti Sep 1, 2022
2301ec9
Adjust for consensus version change
jannotti Sep 2, 2022
d04e00f
Merge pull request #4505 from jannotti/feature/avm-box
jannotti Sep 2, 2022
fb9d5f6
add pingpong cli arg for number of boxes per app
algoidurovic Aug 30, 2022
797d852
improve min balance calculation
algoidurovic Sep 6, 2022
35accdc
improve mbr calculation
algoidurovic Sep 6, 2022
2f360f6
Exposes more of AccountData to AVM (#4491)
jannotti Sep 12, 2022
329a60e
Refactor MaxBoxSize configuration definition (#4542)
michaeldiamant Sep 13, 2022
2226ddb
Bump MaxAPIBoxPerApplication to 100,000 (#4541)
michaeldiamant Sep 13, 2022
bab6d99
Add kvstore to catchpoints (#4455)
jannotti Sep 13, 2022
a72316f
Merge branch 'master' into feature/avm-box
michaeldiamant Sep 13, 2022
7f7d2f2
rate control for funding txs
algoidurovic Sep 13, 2022
d8cc213
Fix regeneration of daemon/algod/api/server/v2/generated/routes.go
michaeldiamant Sep 13, 2022
4e95f8e
Merge branch 'master' into feature/avm-box (#4544)
michaeldiamant Sep 14, 2022
20367f9
Merge branch 'feature/avm-box' of github.com:algorand/go-algorand int…
michaeldiamant Sep 14, 2022
64c313f
Refactor to linearize ledger lookup in GetApplicationBoxes (#4543)
michaeldiamant Sep 14, 2022
b40ca47
Panic instead of implementing untouched mock
Sep 16, 2022
c462a41
Merge pull request #4560 from tzaffi/un-implement-mock-LookupKeysByPr…
ahangsu Sep 19, 2022
c3e9dea
Various improvements from my review
jasonpaulos Sep 19, 2022
3da61a7
Remove base64 statement
jasonpaulos Sep 19, 2022
5724864
msgp generate
jasonpaulos Sep 19, 2022
50b10b2
Add back box info long desc
jasonpaulos Sep 19, 2022
f3e4aeb
Revert goal box info changes
jasonpaulos Sep 19, 2022
5dd578b
Respond to feedback
jasonpaulos Sep 19, 2022
f26f915
Merge pull request #4562 from jasonpaulos/box-review-changes
jasonpaulos Sep 19, 2022
f5844c8
reduce cache size (#4311)
algoidurovic Sep 21, 2022
ce949d7
Miscellaney (#4576)
tzaffi Sep 26, 2022
1c60563
Box codereview (#4586)
jannotti Sep 26, 2022
8b7b3e9
use b.N
ahangsu Sep 26, 2022
053f6ff
Merge pull request #4591 from algorand/ahangsu/better-benchmark-display
ahangsu Sep 27, 2022
8f0a194
use kvstore.key comparison to trigger SEARCH rather than SCAN
ahangsu Sep 27, 2022
61c7a03
Rework TestCatchpointAfterTxns to assert balance (#4596)
michaeldiamant Sep 27, 2022
18b6984
take care of the corner case, and a new query statement
ahangsu Sep 27, 2022
fc103e1
Revert code change by go 1.19 fmt
ahangsu Sep 27, 2022
082de0c
Merge branch 'master' into feature/avm-box
michaeldiamant Sep 27, 2022
4f72e7c
Merge pull request #4598 from michaeldiamant/feature/avm-box
michaeldiamant Sep 27, 2022
c1c4858
minor test case for prefix interval preprocessing
ahangsu Sep 28, 2022
1df8841
annoying fmting change
ahangsu Sep 28, 2022
23217df
good find by Zeph on lexicographical order interval
ahangsu Sep 28, 2022
e939fcd
Small addition to `box_create` docs & implement `TestBoxReadBudget` (…
jasonpaulos Sep 28, 2022
2cc0a01
minor improved testcase
ahangsu Sep 28, 2022
2b30646
new test case
ahangsu Sep 28, 2022
a0905d3
Merge pull request #4597 from algorand/ahangsu/db-query-speed-flattening
ahangsu Sep 28, 2022
6691ecc
resolve merge conflicts
algoidurovic Sep 28, 2022
1f5b969
change error message to include more information
algoidurovic Sep 28, 2022
bcf66d9
undo error message change because test depends on specific output
algoidurovic Sep 28, 2022
e5742a3
Partition tests to spread load in CI (#4604)
michaeldiamant Sep 28, 2022
0cc5def
Update ledger/accountdb_test.go
michaeldiamant Sep 28, 2022
22d110a
tmp
algoidurovic Sep 28, 2022
9da87db
tmp
algoidurovic Sep 28, 2022
12cee71
tmp
algoidurovic Sep 28, 2022
36017ea
add new box workload
algoidurovic Oct 3, 2022
772e129
Merge remote-tracking branch 'upstream/master' into feature/avm-box
jannotti Oct 3, 2022
3981d20
Merge pull request #4624 from jannotti/feature/avm-box
jannotti Oct 3, 2022
3bc947e
Merge branch 'feature/avm-box' of https://github.com/algorand/go-algo…
algoidurovic Oct 3, 2022
77a19ad
bug fix
algoidurovic Oct 3, 2022
5a97c4f
add comments and README
algoidurovic Oct 5, 2022
c47bcf7
Update cmd/pingpong/README.md
algoidurovic Oct 5, 2022
e80585f
Update cmd/pingpong/README.md
algoidurovic Oct 5, 2022
a4f2146
move box ref array construction
algoidurovic Oct 7, 2022
75072ee
Merge branch 'box_pingpong' of github.com:algoidurovic/go-algorand in…
algoidurovic Oct 7, 2022
49b4ff8
update doc
algoidurovic Oct 7, 2022
129c021
keep readme content in scope
algoidurovic Oct 7, 2022
f4afb4a
Merge pull request #4511 from algoidurovic/box_pingpong
algoidurovic Oct 7, 2022
7c3dda4
Update data/transactions/json_test.go
michaeldiamant Oct 11, 2022
b780773
Fix source code reference in inline comment (#4647)
michaeldiamant Oct 14, 2022
85528b8
Persistent box account data
jasonpaulos Oct 15, 2022
1cdf8c0
Merge pull request #4654 from jasonpaulos/persistent-box-account-data
jannotti Oct 15, 2022
50cd6d7
New rule: write budget enforced continually
jannotti Oct 3, 2022
df6e6d6
Add tests for ClearStateOC
michaeldiamant Oct 4, 2022
ec51370
Add acct field tests, and improve field tests to check type
jannotti Oct 4, 2022
3d6c6bf
Track write budget in a simpler way - no more size tracking
jannotti Oct 10, 2022
727967f
Update available text for CSPs, per @algoidurovic
jannotti Oct 11, 2022
a835098
And some inner tests for boxes on the real ledger
jannotti Oct 11, 2022
4ede8b3
Simplify NewBox interface method
jannotti Oct 12, 2022
8e15fc7
Add some del/get/put in ledger tests
jannotti Oct 13, 2022
b348f4e
Track write budget in box_put more clearly
jannotti Oct 13, 2022
db3b244
Separate argchecking and dirty checking
jannotti Oct 14, 2022
8c16cd3
test equal to budget
jannotti Oct 14, 2022
461f340
Removed the DelBoxes that were there b/c of a previous testing flaw
jannotti Oct 14, 2022
a67dd03
Extend box tests
michaeldiamant Oct 13, 2022
9af97db
Fix reviewdog errors
michaeldiamant Oct 13, 2022
e691a98
More tests
jannotti Oct 15, 2022
2b7c3b8
Merge pull request #4622 from jannotti/box-write-bounds
jannotti Oct 15, 2022
0157afe
Refactor TestApplicationBoxesMaxKeys to reduce test length
michaeldiamant Oct 17, 2022
0f8b3e0
Merge pull request #4657 from michaeldiamant/TestApplicationBoxesMaxK…
jannotti Oct 17, 2022
452e220
extra test cases
cce Oct 17, 2022
5efe942
Pavel comments
jannotti Oct 17, 2022
f7dfc9d
Merge pull request #4660 from jannotti/box-codereview
jannotti Oct 18, 2022
9c1ed98
Off by one.
jannotti Oct 18, 2022
164e92f
Unify comments about walking the deltas
jannotti Oct 18, 2022
ef4c678
Merge pull request #4665 from jannotti/boxes-obo
jannotti Oct 18, 2022
b519b92
Fabrice's feedback
jannotti Oct 20, 2022
0dd2c0c
Merge pull request #4675 from jannotti/box-foundation-feedback
jannotti Oct 20, 2022
45b7d60
Three code review suggestions (#4681)
jannotti Oct 21, 2022
f26f38a
Merge branch 'master' into feature/avm-box
michaeldiamant Oct 24, 2022
6468e4b
Fix merge from master
michaeldiamant Oct 24, 2022
060b22b
Merge pull request #4687 from michaeldiamant/feature/avm-box
algorandskiy Oct 24, 2022
35765a6
Box bytes (#4686)
jannotti Oct 25, 2022
d56af81
Rename isFull to supportsAppEval (#4692)
michaeldiamant Oct 25, 2022
15890d4
Add test coverage for app local/global put errors (#4693)
michaeldiamant Oct 26, 2022
74e85e8
Add sanity check tests for AppCallBytes (#4691)
michaeldiamant Oct 26, 2022
6eee507
Require GetApplicationBoxes to return all Box names (#4689)
michaeldiamant Oct 26, 2022
354cfcd
Merge remote-tracking branch 'upstream/master' into feature/avm-box
jannotti Oct 27, 2022
5774356
Linters
jannotti Oct 27, 2022
260e226
Merge pull request #4701 from jannotti/feature/avm-box
jannotti Oct 27, 2022
f9fbae2
telemetry: add CatchpointRootUpdateEvent (#4704)
cce Oct 31, 2022
b396eeb
code review
jannotti Oct 31, 2022
238906c
Merge pull request #4709 from jannotti/box-specs-review
jannotti Oct 31, 2022
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
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ linters-settings:
- (*github.com/algorand/go-algorand/data/transactions/logic.OpStream).error
- (*github.com/algorand/go-algorand/data/transactions/logic.OpStream).warnf
- (*github.com/algorand/go-algorand/data/transactions/logic.OpStream).warn
# We do this 121 times and never check the error.
- (*github.com/spf13/cobra.Command).MarkFlagRequired
Comment thread
jannotti marked this conversation as resolved.
govet:
settings:
printf:
Expand Down
4 changes: 3 additions & 1 deletion catchup/ledgerFetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ func (lf *ledgerFetcher) getPeerLedger(ctx context.Context, peer network.HTTPPee
"writing balances to disk took %d seconds, "+
"writing creatables to disk took %d seconds, "+
"writing hashes to disk took %d seconds, "+
"writing kv pairs to disk took %d seconds, "+
"total duration is %d seconds",
downloadProgress.BalancesWriteDuration/time.Second,
downloadProgress.CreatablesWriteDuration/time.Second,
downloadProgress.HashesWriteDuration/time.Second,
downloadProgress.KVWriteDuration/time.Second,
writeDuration/time.Second)
}

Expand Down Expand Up @@ -191,5 +193,5 @@ func (lf *ledgerFetcher) getPeerLedger(ctx context.Context, peer network.HTTPPee
}

func (lf *ledgerFetcher) processBalancesBlock(ctx context.Context, sectionName string, bytes []byte, downloadProgress *ledger.CatchpointCatchupAccessorProgress) error {
return lf.accessor.ProgressStagingBalances(ctx, sectionName, bytes, downloadProgress)
return lf.accessor.ProcessStagingBalances(ctx, sectionName, bytes, downloadProgress)
}
68 changes: 66 additions & 2 deletions cmd/catchpointdump/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"bufio"
"context"
"database/sql"
"encoding/base64"
"encoding/json"
"fmt"
"io"
Expand All @@ -34,6 +35,7 @@ import (
"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/data/bookkeeping"
"github.com/algorand/go-algorand/data/transactions/logic"
"github.com/algorand/go-algorand/ledger"
"github.com/algorand/go-algorand/ledger/ledgercore"
"github.com/algorand/go-algorand/logging"
Expand Down Expand Up @@ -128,6 +130,10 @@ var fileCmd = &cobra.Command{
if err != nil {
reportErrorf("Unable to print account database : %v", err)
}
err = printKeyValueStore("./ledger.tracker.sqlite", outFile)
if err != nil {
reportErrorf("Unable to print key value store : %v", err)
}
}
},
}
Expand Down Expand Up @@ -176,7 +182,7 @@ func loadCatchpointIntoDatabase(ctx context.Context, catchupAccessor ledger.Catc
return fileHeader, err
}
}
err = catchupAccessor.ProgressStagingBalances(ctx, header.Name, balancesBlockBytes, &downloadProgress)
err = catchupAccessor.ProcessStagingBalances(ctx, header.Name, balancesBlockBytes, &downloadProgress)
if err != nil {
return fileHeader, err
}
Expand Down Expand Up @@ -380,7 +386,65 @@ func printAccountsDatabase(databaseName string, fileHeader ledger.CatchpointFile
}

// increase the deadline warning to disable the warning message.
db.ResetTransactionWarnDeadline(ctx, tx, time.Now().Add(5*time.Second))
_, _ = db.ResetTransactionWarnDeadline(ctx, tx, time.Now().Add(5*time.Second))
return err
})
}

func printKeyValue(writer *bufio.Writer, key, value []byte) {
var pretty string
ai, rest, err := logic.SplitBoxKey(string(key))
if err == nil {
pretty = fmt.Sprintf("box(%d, %s)", ai, base64.StdEncoding.EncodeToString([]byte(rest)))
} else {
pretty = base64.StdEncoding.EncodeToString(key)
}

fmt.Fprintf(writer, "%s : %v\n", pretty, base64.StdEncoding.EncodeToString(value))
}

func printKeyValueStore(databaseName string, outFile *os.File) error {
fmt.Printf("\n")
printDumpingCatchpointProgressLine(0, 50, 0)
lastProgressUpdate := time.Now()
progress := uint64(0)
defer printDumpingCatchpointProgressLine(0, 0, 0)

fileWriter := bufio.NewWriterSize(outFile, 1024*1024)
defer fileWriter.Flush()

dbAccessor, err := db.MakeAccessor(databaseName, true, false)
if err != nil || dbAccessor.Handle == nil {
return err
}

return dbAccessor.Atomic(func(ctx context.Context, tx *sql.Tx) error {
var rowsCount int64
err := tx.QueryRow("SELECT count(*) from catchpointkvstore").Scan(&rowsCount)
if err != nil {
return err
}

// ordered to make dumps more "diffable"
rows, err := tx.Query("SELECT key, value FROM catchpointkvstore order by key")
if err != nil {
return err
}
defer rows.Close()
for rows.Next() {
progress++
var key []byte
var value []byte
err := rows.Scan(&key, &value)
if err != nil {
return err
}
printKeyValue(fileWriter, key, value)
if time.Since(lastProgressUpdate) > 50*time.Millisecond {
lastProgressUpdate = time.Now()
printDumpingCatchpointProgressLine(int(float64(progress)*50.0/float64(rowsCount)), 50, int64(progress))
}
}
return nil
})
}
5 changes: 5 additions & 0 deletions cmd/catchpointdump/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ func loadAndDump(addr string, tarFile string, genesisInitState ledgercore.InitSt
if err != nil {
return err
}
err = printKeyValueStore("./ledger.tracker.sqlite", outFile)
if err != nil {
return err
}

}
return nil
}
147 changes: 147 additions & 0 deletions cmd/goal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Example `goal` Snippets

Unless otherwise noted, it is assumed that the working directory
begins at the top level of the `go-algorand` repo.

It is also assumed that the main README's installation instructions have been followed and `make install` run so that the `goal` executable has been rebuilt from the same source as this example and is available in the shell environment.
You can run `ls -l $(which goal)` after your `make install` and look at the installation time as a sanity check.

Finally, all the `goal` commands assume that `${ALGORAND_DATA}` has been set. See the first Q/A for how this is done.

## Starting a Single Node Dev Network

### Q: Having just completed a new build in go-algorand, how do I get a single node dev network up, with algos in an easily accessible wallet from goal?

### A:

```sh
# set this to where you want to keep the network files (and data dirs will go beneath)
NETWORKS=~/networks

# create a networks directory if you don't already have it
mkdir -p ${NETWORKS}

# set this to "name" your network
NAME=niftynetwork

# assuming here that are currently working out of the root directory of the go-algorand repo
goal network create -n ${NAME} -r ${NETWORKS}/${NAME} -t ./test/testdata/nettemplates/OneNodeFuture.json

# after the next command and for the rest of the README, we assume that `${ALGORAND_DATA}` is set
export ALGORAND_DATA=${NETWORKS}/${NAME}/Primary
echo $ALGORAND_DATA

# start the network
goal node start

# see if it worked (run a few times, note block increasing)
goal node status
sleep 4 # assuming you're copy/pasting this entire block
goal node status
sleep 4
goal node status

# find the account with all the money
goal account list

# put it in a variable
ACCOUNT=`goal account list | awk '{print $2}'`
echo $ACCOUNT

# send some money from the account to itself
goal clerk send --to ${ACCOUNT} --from ${ACCOUNT} --amount 10
```

## Creating Applications

### Q: How do I use goal to create an app?

### A:
Here's an example with the following assumptions:
* all the setup is as in the first question
* the approval program (which tests box functionality) has relative path `cmd/goal/examples/boxes.teal`
* the clear program has relative path `cmd/goal/examples/clear.teal`
* there are no local or global storage requirements

```sh
TEALDIR=cmd/goal/examples
echo $TEALDIR

# create the app and TAKE NOTE of its "app index"
goal app create --creator ${ACCOUNT} --approval-prog ${TEALDIR}/boxes.teal --clear-prog ${TEALDIR}/clear.teal --global-byteslices 0 --global-ints 0 --local-byteslices 0 --local-ints 0
```

For the following questions, you'll need to use the app index. That will be shown in the last line printed. EG:

```sh
Attempting to create app (approval size 125, hash RKWO3VXBKQXF77PC6EHRLFXD4YTJYTJTGPTPWQ46YH5ESGPZ5JIA; clear size 3, hash IS4FW6ZCRMQRTDIINAVAQHD2GK6DXUNQHQ52IQGZEVPP4OEU56QA)
Issued transaction from account ECRQFXZ7P3PLNK6QLIEVX7AXU6NTVQZHFUSEXTXMBKKOA2NTIV4PCX7XNY, txid SZK3U7AARMPQSZUICZIGYRLC7UDXJCVPV34JCBN5LIBXMF635UKA (fee 1000)
Transaction SZK3U7AARMPQSZUICZIGYRLC7UDXJCVPV34JCBN5LIBXMF635UKA still pending as of round 12
Transaction SZK3U7AARMPQSZUICZIGYRLC7UDXJCVPV34JCBN5LIBXMF635UKA still pending as of round 13
Transaction SZK3U7AARMPQSZUICZIGYRLC7UDXJCVPV34JCBN5LIBXMF635UKA committed in round 14
Created app with app index 2
```

## Funding App-Accounts

### Q: How do I fund the app account so that it can satisfy its boxes min-balance requirement and allow for box creation?

### A:
Assuming you followed the previous step, and that the _app index_ is 2:

```sh
# store the app index for later usage
APPID=2
echo $APPID

# store the app's account address into a variable
APP_ACCOUNT=`goal app info --app-id ${APPID} | grep "Application account" | awk '{print $3}'`
echo $APP_ACCOUNT

# fund the app's account (here we're being very conservative and sending 10 algos)
goal clerk send --to ${APP_ACCOUNT} --from ${ACCOUNT} --amount 10000000

# verify the balance of the app's account
goal account balance --address ${APP_ACCOUNT}
```

## Application Boxes in `goal`

### Q: How do I use boxes in goal? In particular, I'd like to make a goal app call which:
* accesses a particular box for a particular app
* stores an ABI type as its contents

### A:
Here's an example with the following assumptions:

* the caller's account is given by `${ACCOUNT}` (see first answer)
* the program used is `boxes.teal` referenced above. In particular:
* it routes to box subroutines using the app argument at index 0 as the method signifier
* the app id has been stored in `${APPID}` (see the previous answer)
* the box referenced in the first non-create app-call has name `greatBox`
* another referenced box is named `an_ABI_box`
* this second box is provided contents `[2,3,5]` of ABI-type `(uint8,uint8,uint8)`

```sh
# create a box with a simple non-ABI name. Note how the `--box` flag needs to be set so as to refer to the box being touched
goal app call --from $ACCOUNT --app-id ${APPID} --box "str:greatBox" --app-arg "str:create" --app-arg "str:greatBox"

# create another box
goal app call --from ${ACCOUNT} --app-id ${APPID} --box "str:an_ABI_box" --app-arg "str:create" --app-arg "str:an_ABI_box"

# set the contents to ABI type `(uint8,uint8,uint8)` with value `[2,3,5]`
goal app call --from ${ACCOUNT} --app-id ${APPID} --box "str:an_ABI_box" --app-arg "str:set" --app-arg "str:an_ABI_box" --app-arg "abi:(uint8,uint8,uint8):[2,3,5]"
```

### Q: How do I search for boxes in goal?

### A:
Assuming you followed the previous step to create `greatBox` and `an_ABI_box`:

```sh
# get all boxes for a given app
goal app box list --app-id ${APPID}

# get the box details for a given box
goal app box info --app-id ${APPID} --name "str:an_ABI_box"
```
Loading