├── scripts ├── old │ └── ci │ │ ├── validate-minor-blocks.sh │ │ └── data │ │ └── devnet.json ├── imports.sh ├── images │ └── ci-golang │ │ └── Dockerfile ├── delve-in-docker.sh ├── pre-commit.sh ├── devnet-init-run.sh └── ops │ └── fix │ ├── DANGEROUS-rebuild-acc-db.sh │ ├── fix-bvn-ports.sh │ ├── 3-increase-tx-size-limit.sh │ ├── 4-increase-mempool-size.sh │ ├── 5-increase-mempool-to-15k.sh │ ├── NUKE-STATE.sh │ └── shrink-db.sh ├── test ├── testdata │ ├── .gitignore │ ├── reserved.csv │ ├── governance.csv │ ├── index.md │ ├── database-v1.0.0.snapshot │ ├── api-v2-consistency.json.xz │ ├── executor-v1-consistency.json.xz │ └── testdata.go ├── cmd │ └── eth_signTypedData │ │ ├── .gitignore │ │ ├── package.json │ │ ├── execute.sh │ │ └── main.js ├── simulator │ ├── recorder_enums.yml │ ├── consensus │ │ └── enums.yml │ └── task_queue.go ├── e2e │ └── testdata │ │ └── fuzz │ │ ├── FuzzEnvelopeDecode │ │ └── d21fbb7dd731609f27d8c9ffece8b1de6bf3fb8b79497d73c582a492f08d874d │ │ └── FuzzUpdateAccountAuth │ │ └── 3b7dc6f01f1cb2793775e870aa70a2707e1e15b7c77e424c70534cbb909e9d99 ├── data │ └── pkg_database_values_BenchmarkNotFound │ │ ├── 754e303a85b7804f5a707825bd954d2f2e835af7.cpuprof │ │ ├── 754e303a85b7804f5a707825bd954d2f2e835af7.memprof │ │ ├── 7cebf291ec424692b98fb5828ceaddfe49e31cca.cpuprof │ │ ├── 7cebf291ec424692b98fb5828ceaddfe49e31cca.memprof │ │ ├── e82e6eb18834e22d941b450a8305eed4155d746b.cpuprof │ │ ├── e82e6eb18834e22d941b450a8305eed4155d746b.memprof │ │ ├── README.md │ │ ├── 754e303a85b7804f5a707825bd954d2f2e835af7.bench │ │ ├── 7cebf291ec424692b98fb5828ceaddfe49e31cca.bench │ │ └── e82e6eb18834e22d941b450a8305eed4155d746b.bench ├── e2e2 │ ├── bob.md │ ├── alice.md │ └── example_test.md ├── testing │ ├── types.go │ ├── debug.go │ ├── merkle_testdata.go │ ├── httpshim.go │ └── router.go └── util │ ├── context.go │ ├── goroutine_leaks_test.go │ └── fuzz │ └── parse.go ├── internal ├── bsn │ ├── notes.md │ ├── types.yml │ ├── types.go │ └── idx_common.go ├── core │ ├── execute │ │ ├── v1 │ │ │ ├── chain │ │ │ │ ├── testdata │ │ │ │ │ └── fuzz │ │ │ │ │ │ ├── FuzzCreateToken │ │ │ │ │ │ ├── 9267eb73f799b96509eec07bfb70a70f1c6805c901861733fbfa64cb84a0a57c │ │ │ │ │ │ ├── oom-db148e290d1b4870f6e33f9676bc4026b465e9c5 │ │ │ │ │ │ ├── oom-bb837fbff2083d462ac8047e29536d40801498da │ │ │ │ │ │ ├── oom-09467469d90e1f8e1cbaa5fc2b4a89d49a62f228 │ │ │ │ │ │ ├── oom-6b3f546e8f513c315a79c757ae3c9b444f0013f3 │ │ │ │ │ │ ├── oom-c3bfc6fb80858b3d814fe3a241ad9bef8d25ba91 │ │ │ │ │ │ ├── slow-unit-70291fc28e70b92912bdfd51d8117a15bd5c80f1 │ │ │ │ │ │ ├── slow-unit-737383f2d76a3ad00e26ce0ef55f6e882c9c9417 │ │ │ │ │ │ ├── slow-unit-a3c71e144e4af29ca10dd2ab6219b424896dfc34 │ │ │ │ │ │ ├── slow-unit-bd3aeb65795d211d65809f6d2a64c7da8cfa984d │ │ │ │ │ │ └── slow-unit-80004c6cebf4e81482340b87fedadf014f141ffc │ │ │ │ │ │ ├── FuzzCreateIdentity │ │ │ │ │ │ └── b4cb83d7b64e70795a9bf5e3aed0cc015b524440b3e267fdb6bf3f2bad768c1a │ │ │ │ │ │ ├── FuzzCreateKeyBook │ │ │ │ │ │ ├── 16aa1092698af46db8221d94d7b86063dbd75ac08cc9cd34ce905f717097b95e │ │ │ │ │ │ └── 25e392cc3a191fcab5bb4cd21e6061ee192836b73decaa568fe4bef4b3d10cef │ │ │ │ │ │ ├── FuzzCreateDataAccount │ │ │ │ │ │ └── e7f7cb07b4531fd12d6f238d4117566ddd03ddf6ebbf096bfc4ff5adbb0cbf34 │ │ │ │ │ │ ├── FuzzCreateTokenAccount │ │ │ │ │ │ └── df878f101e069b898c2088c5469f96dc91c22d2d874fc23f031cc9945a714755 │ │ │ │ │ │ ├── FuzzIssueTokens │ │ │ │ │ │ ├── e1995f4d99fdae79b86682b9869c158a2ffe6413af27239a9992673b4fe891c1 │ │ │ │ │ │ ├── oom-e38d2231bcc0203c4f8b7c085a59c76694cbf5bb │ │ │ │ │ │ ├── oom-12869ce34baf6101bf74adb91d633d6a1a1cd545 │ │ │ │ │ │ ├── oom-2594627c4b829f2e748cd26a5a6adf2c669c9e87 │ │ │ │ │ │ ├── oom-c538b578f24a35d18e9027ef8af11d1c27708433 │ │ │ │ │ │ ├── slow-unit-c0f3679ca90455c441301460b96ef47037ae854b │ │ │ │ │ │ └── slow-unit-b7f492ce77281de3555052b45fce37ea85dc2431 │ │ │ │ │ │ ├── FuzzSendTokens │ │ │ │ │ │ ├── 632e324fc8d05229a57d64c9595dfaa0d417cf0359d34083463ab6cbe314a77f │ │ │ │ │ │ └── oom-69d2bf59ac009693967e409f01678e5cd409c8c7 │ │ │ │ │ │ ├── FuzzWriteData_Lite │ │ │ │ │ │ ├── e6917e99631cec1e126d317e127d800db22c3162c719164c7d25f2fce122f154 │ │ │ │ │ │ └── 2c2507695443717343fa66b2d0088c66835455603f4785e0be294026d188cec5 │ │ │ │ │ │ ├── FuzzUpdateAccountAuth │ │ │ │ │ │ └── b8944896610358a2d7ad7c0a6090cc62995f2c09efbc808ac960e6ffa553a3df │ │ │ │ │ │ ├── FuzzAcmeFaucet │ │ │ │ │ │ └── df3c0b51f84ba6305a2b3284b8147f2af7cbe5d108bd4e32f9c98bd3208dbf0e │ │ │ │ │ │ ├── FuzzCreateKeyPage │ │ │ │ │ │ ├── slow-unit-1aa583865e6936ad5b69e1a7290ad58ebc42751d │ │ │ │ │ │ ├── slow-unit-2cbc0e51c31f4757cff063722eed20aa9a77ea64 │ │ │ │ │ │ ├── slow-unit-d054842c5b1142eec0c58eb639925319ed8db275 │ │ │ │ │ │ ├── slow-unit-d94477dfe7da32f5710d799ca1da05fc9ba24210 │ │ │ │ │ │ ├── slow-unit-fdeeddcf13b66c0c23ff7daeec5c3c6f01767237 │ │ │ │ │ │ ├── slow-unit-36909e3f5a438d10e41097feab458d0c8faf7494 │ │ │ │ │ │ └── slow-unit-edf1911ad4047bb7239c44674573c1f366e9fdf6 │ │ │ │ │ │ ├── FuzzWriteDataTo │ │ │ │ │ │ └── 62a765fa8f1bae5ecb4af67f36fa36b37bdcc042af088d976aba086415d87b33 │ │ │ │ │ │ ├── FuzzLockAccount │ │ │ │ │ │ ├── oom-3869b30653a59efb4ace0568a594024abb579aa1 │ │ │ │ │ │ ├── oom-6ef247b26cb6a8f759ddeef345fb07e82222c697 │ │ │ │ │ │ ├── oom-9165157c3eb70c0facf15fbce2ac4aeaf86ad2da │ │ │ │ │ │ ├── oom-f5441abe4747b48e9cf70404d107c24cfa81e370 │ │ │ │ │ │ ├── slow-unit-9a4b1bd50309e481e96fecde8f0dff9043b8ce2c │ │ │ │ │ │ ├── slow-unit-a3e8a386e0b59c4bf121fd5fe050d73d03ed9a33 │ │ │ │ │ │ └── oom-f8fc905724e04551aa953c674525ca68eaab11b8 │ │ │ │ │ │ └── FuzzBurnTokens │ │ │ │ │ │ └── slow-unit-a333676adee402243b135da9b2f8cd141e44d7b9 │ │ │ │ └── fuzz_synth_txn_test.go │ │ │ ├── block │ │ │ │ ├── executor_mainnet.go │ │ │ │ ├── executor_testnet.go │ │ │ │ ├── null_dispatcher.go │ │ │ │ └── enums.yml │ │ │ └── simulator │ │ │ │ └── tb.go │ │ ├── v2 │ │ │ ├── signing.md │ │ │ ├── block │ │ │ │ ├── txn_common.go │ │ │ │ └── enums.yml │ │ │ └── chain │ │ │ │ └── _fuzz_synth_txn_test.go │ │ └── events.go │ ├── hash │ │ └── compat.go │ ├── healing │ │ ├── types.go │ │ └── types.yml │ ├── compat.go │ ├── consts.go │ ├── hash.go │ └── events │ │ └── event.go ├── database │ ├── snapshot │ │ └── types.go │ ├── utils_test.go │ ├── smt │ │ ├── storage │ │ │ └── compat.go │ │ └── common │ │ │ └── RandHash_test.go │ ├── hash_test.go │ ├── types.go │ ├── indexing │ │ └── transaction.go │ ├── record │ │ └── types.go │ ├── compare.go │ └── schema.yml ├── node │ ├── web │ │ ├── web_embed.go │ │ ├── web_local.go │ │ └── web.go │ ├── daemon │ │ ├── types.go │ │ ├── disk_unix.go │ │ └── disk_windows.go │ ├── docs.go │ ├── abci │ │ ├── abci.go │ │ └── utils_test.go │ ├── genesis │ │ └── factom_test.go │ └── config │ │ └── enums.yml ├── api │ ├── v2 │ │ ├── jrpc_utils_test.go │ │ ├── faucet_test.go │ │ └── enums.yml │ ├── private │ │ ├── types.yml │ │ └── api.go │ └── routing │ │ └── simple.go ├── util │ ├── pool │ │ └── pool.go │ ├── io │ │ └── compat.go │ ├── indexing │ │ └── file.go │ ├── sort │ │ ├── slice_test.go │ │ └── slice.go │ └── cmd │ │ └── errors.go └── logging │ ├── debug_prod.go │ ├── null.go │ ├── debug_dev.go │ └── recover.go ├── .dockerignore ├── tools ├── cmd │ ├── debug │ │ ├── enums.yml │ │ ├── db.go │ │ └── types.go │ ├── gen-api │ │ ├── java.go │ │ └── java.tmpl │ ├── gen-enum │ │ ├── java.go │ │ ├── dependencies.go │ │ ├── typescript.go │ │ ├── c.go │ │ └── go.go │ ├── golangci-lint │ │ ├── testdata │ │ │ ├── nodebug.go │ │ │ └── noprint.go │ │ ├── custom.go │ │ ├── debug.go │ │ ├── custom_test.go │ │ └── main.go │ ├── snapshot │ │ ├── Dockerfile │ │ └── main.go │ ├── simulator │ │ └── Dockerfile │ ├── gen-types │ │ └── c_union_header.tmpl │ ├── gen-model │ │ └── templates.go │ └── genesis │ │ └── main.go └── internal │ └── factom │ ├── types.go │ ├── convert.go │ ├── types.yml │ └── header.go ├── .gitmodules ├── AUTHORS ├── pkg ├── accumulate │ ├── checkpoint-mainnet.snap │ ├── api_test.go │ └── checkpoint.go ├── database │ ├── bpt │ │ ├── model_test.yml │ │ ├── model.yml │ │ └── types.go │ ├── keyvalue │ │ ├── badger │ │ │ ├── compat.go │ │ │ ├── slogger.go │ │ │ └── v2_test.go │ │ ├── remote │ │ │ ├── whitebox_test.go │ │ │ ├── enums.yml │ │ │ └── stream.go │ │ ├── atomic.go │ │ ├── block │ │ │ ├── utils.go │ │ │ └── types.go │ │ ├── memory │ │ │ └── changeset_test.go │ │ ├── bolt │ │ │ └── changeset_test.go │ │ └── overlay │ │ │ └── overlay_test.go │ ├── merkle │ │ ├── enums.yml │ │ └── types.go │ ├── snapshot │ │ ├── types.go │ │ └── enums.yml │ ├── indexing │ │ ├── model.yml │ │ └── types.go │ ├── not_found.go │ └── values │ │ └── bench_test.go ├── errors │ ├── debug_prod.go │ ├── debug_dev.go │ ├── error.yml │ └── types.go ├── types │ ├── record │ │ ├── debug_prod.go │ │ ├── debug_dev.go │ │ └── types.go │ ├── network │ │ ├── types.go │ │ └── types.yml │ ├── messaging │ │ ├── synthetic.go │ │ └── enums.yml │ ├── encoding │ │ ├── writer_test.go │ │ ├── machine_test.go │ │ └── types.go │ └── merkle │ │ └── compat.go ├── api │ ├── v3 │ │ ├── p2p │ │ │ ├── enums.yml │ │ │ ├── types.go │ │ │ ├── types.yml │ │ │ ├── dial │ │ │ │ └── tracker_fake.go │ │ │ └── sim_test.go │ │ ├── websocket │ │ │ ├── enums.yml │ │ │ ├── types.go │ │ │ └── types.yml │ │ ├── message │ │ │ ├── private.yml │ │ │ └── docs.go │ │ ├── address_test.go │ │ ├── events.yml │ │ └── assert.go │ └── ethereum │ │ ├── generate.go │ │ └── services.go ├── client │ └── signing │ │ └── timestamp.go └── build │ └── key_page_entry.go ├── .vscode ├── extensions.json └── tasks.json ├── exp ├── loki │ ├── generate.sh │ └── loki.proto ├── ioutil │ ├── pkg.go │ ├── constraints.go │ └── discard.go ├── torrent │ ├── torrent.go │ ├── types.go │ └── types.yml ├── light │ ├── pkg.go │ ├── types.go │ ├── types.yml │ └── range_test.go ├── apiutil │ ├── types.go │ ├── routing.go │ └── types.yml ├── ioc │ ├── pkg.go │ └── promised.go ├── lxrand │ └── lxrand_test.go └── checkpoint │ └── checkpoint_test.go ├── .gitlab-ci.yml ├── CODEOWNERS ├── .gitlab ├── merge-request.gitlab-ci.yml ├── scan.gitlab-ci.yml └── common.gitlab-ci.yml ├── .gitattributes ├── _archive └── smt │ ├── storage │ └── memory │ │ ├── debug_prod.go │ │ └── debug_dev.go │ └── pmt │ ├── bench_test.go │ ├── value_test.go │ ├── loaded.go │ └── entry.go ├── vdk ├── node │ ├── daemon.go │ └── executor.go ├── utils │ ├── utils_darwin.go │ ├── utils_linux.go │ ├── utils.go │ └── utils_windows.go └── logger │ ├── multi_writer.go │ └── rotate_writer.go ├── cmd ├── play-accumulate │ └── main.go ├── accumulated-faucet │ └── Dockerfile ├── accumulated-bootstrap │ └── Dockerfile ├── accumulated-http │ └── Dockerfile └── accumulated │ ├── utils_darwin.go │ ├── utils_linux.go │ ├── run │ ├── disk_unix.go │ ├── utils_test.go │ └── disk_windows.go │ └── utils_windows.go ├── protocol ├── 1_mainnet.go ├── 2_testnet.go ├── errors.yml ├── query.yml ├── bug_test.go ├── transaction_results.yml ├── rational.go ├── routing.go ├── format_test.go ├── lock.go ├── system.md ├── txid_set.go └── operations.yml ├── .github └── workflows │ ├── merge.yml │ └── lint.yml ├── version.go ├── .gitignore ├── dependencies.go ├── Dockerfile └── LICENSE /scripts/old/ci/validate-minor-blocks.sh: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/testdata/.gitignore: -------------------------------------------------------------------------------- 1 | /api-v2-consistency.json -------------------------------------------------------------------------------- /test/cmd/eth_signTypedData/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules -------------------------------------------------------------------------------- /internal/bsn/notes.md: -------------------------------------------------------------------------------- 1 | # TODO 2 | 3 | - BPT for the BSN -------------------------------------------------------------------------------- /test/testdata/reserved.csv: -------------------------------------------------------------------------------- 1 | ethan.acme,marketplace.acme/book -------------------------------------------------------------------------------- /test/testdata/governance.csv: -------------------------------------------------------------------------------- 1 | accumulate.acme 2 | marketplace.acme -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .nodes 2 | .factom 3 | .genesis 4 | *.exe 5 | .git 6 | */Dockerfile 7 | .test 8 | -------------------------------------------------------------------------------- /scripts/imports.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | go run github.com/rinchsan/gosimports/cmd/gosimports -w . -------------------------------------------------------------------------------- /tools/cmd/debug/enums.yml: -------------------------------------------------------------------------------- 1 | DbPatchOpType: 2 | Put: 3 | value: 1 4 | Delete: 5 | value: 2 -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "test/testdata/sdk"] 2 | path = test/testdata/sdk 3 | url = ../sdk/test-data.git 4 | -------------------------------------------------------------------------------- /test/cmd/eth_signTypedData/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@metamask/eth-sig-util": "^7.0.2" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/testdata/index.md: -------------------------------------------------------------------------------- 1 | - Preallocate ADIs 2 | - governance.csv 3 | - reserved.csv 4 | - Factom import 5 | - objects-0.dat -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Ethan Reesor 2 | Paul Snow 3 | Dennis Bunfield 4 | Sander Postma 5 | Abhishek Ranjan 6 | Jathin Jagannath 7 | Anton Ilzheev -------------------------------------------------------------------------------- /pkg/accumulate/checkpoint-mainnet.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AccumulateNetwork/accumulate/HEAD/pkg/accumulate/checkpoint-mainnet.snap -------------------------------------------------------------------------------- /test/testdata/database-v1.0.0.snapshot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AccumulateNetwork/accumulate/HEAD/test/testdata/database-v1.0.0.snapshot -------------------------------------------------------------------------------- /scripts/images/ci-golang/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VERSION=1.20 2 | FROM golang:${VERSION} 3 | 4 | RUN apt update -y && apt install -y git-lfs nodejs npm 5 | -------------------------------------------------------------------------------- /test/testdata/api-v2-consistency.json.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AccumulateNetwork/accumulate/HEAD/test/testdata/api-v2-consistency.json.xz -------------------------------------------------------------------------------- /test/testdata/executor-v1-consistency.json.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AccumulateNetwork/accumulate/HEAD/test/testdata/executor-v1-consistency.json.xz -------------------------------------------------------------------------------- /test/simulator/recorder_enums.yml: -------------------------------------------------------------------------------- 1 | recordSectionType: 2 | Header: 3 | value: 1 4 | Snapshot: 5 | value: 2 6 | Block: 7 | value: 3 8 | Messages: 9 | value: 4 -------------------------------------------------------------------------------- /pkg/database/bpt/model_test.yml: -------------------------------------------------------------------------------- 1 | - name: ChangeSet 2 | type: entity 3 | root: true 4 | attributes: 5 | - name: BPT 6 | type: other 7 | dataType: BPT 8 | pointer: true -------------------------------------------------------------------------------- /test/e2e/testdata/fuzz/FuzzEnvelopeDecode/d21fbb7dd731609f27d8c9ffece8b1de6bf3fb8b79497d73c582a492f08d874d: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x9b\xa6\xb2\xb2\xb2\xd6\xd6\xd6\xd6\x01") 3 | -------------------------------------------------------------------------------- /test/e2e/testdata/fuzz/FuzzUpdateAccountAuth/3b7dc6f01f1cb2793775e870aa70a2707e1e15b7c77e424c70534cbb909e9d99: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x15\x02\xef\xef\xef\xef\xefcc://foo.acmf") 3 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "golang.go", 4 | "eamodio.gitlens", 5 | "GitLab.gitlab-workflow", 6 | "streetsidesoftware.code-spell-checker" 7 | ] 8 | } -------------------------------------------------------------------------------- /exp/loki/generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd "$(dirname "${BASH_SOURCE[0]}")" 4 | 5 | protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative loki.proto -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateToken/9267eb73f799b96509eec07bfb70a70f1c6805c901861733fbfa64cb84a0a57c: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x0eACC://A2A11200") 3 | []byte("\x01\b") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateIdentity/b4cb83d7b64e70795a9bf5e3aed0cc015b524440b3e267fdb6bf3f2bad768c1a: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x0eacc://fom.acme") 3 | []byte("\x01\x01") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateKeyBook/16aa1092698af46db8221d94d7b86063dbd75ac08cc9cd34ce905f717097b95e: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x0eacc://aaa.aaaa") 3 | []byte("\x01\r") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateDataAccount/e7f7cb07b4531fd12d6f238d4117566ddd03ddf6ebbf096bfc4ff5adbb0cbf34: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x0eacc://foo.acme") 3 | []byte("\x01\x04") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateTokenAccount/df878f101e069b898c2088c5469f96dc91c22d2d874fc23f031cc9945a714755: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x0eacc://foo.acme") 3 | []byte("\x01\x02") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzIssueTokens/e1995f4d99fdae79b86682b9869c158a2ffe6413af27239a9992673b4fe891c1: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x0e00000000000000") 3 | []byte("\x01\t\x04\x13 000000000000000000") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzSendTokens/632e324fc8d05229a57d64c9595dfaa0d417cf0359d34083463ab6cbe314a77f: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x0eACC://00A.acme") 3 | []byte("\x01\x03\x04\x13 000000000000000000") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzWriteData_Lite/e6917e99631cec1e126d317e127d800db22c3162c719164c7d25f2fce122f154: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x93\xfb\xff\x83\x05\x00") 3 | []byte("\x01\x93\xfb\xff\x83\x05\x000") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateKeyBook/25e392cc3a191fcab5bb4cd21e6061ee192836b73decaa568fe4bef4b3d10cef: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x0eACC://00000000") 3 | []byte("\x01\r\x02\x12ACC#00000000000000\x05\x00") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzUpdateAccountAuth/b8944896610358a2d7ad7c0a6090cc62995f2c09efbc808ac960e6ffa553a3df: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x0eACC://00A.acme") 3 | []byte("\x01\x15\x02\x12\x01\x02 000000000000000") 4 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | include: 2 | - local: /.gitlab/common.gitlab-ci.yml 3 | - local: /.gitlab/all.gitlab-ci.yml 4 | - local: /.gitlab/merge-request.gitlab-ci.yml 5 | - local: /.gitlab/release.gitlab-ci.yml 6 | - local: /.gitlab/scan.gitlab-ci.yml 7 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzAcmeFaucet/df3c0b51f84ba6305a2b3284b8147f2af7cbe5d108bd4e32f9c98bd3208dbf0e: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01;acc://0000A00a00a0000a00a000aa00000000aaaa00aaa0a00aa0/AAAA") 3 | []byte("\x01\a") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateKeyPage/slow-unit-1aa583865e6936ad5b69e1a7290ad58ebc42751d: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x94\x00II@I.acme?%@I%890888\xff\xff") 3 | []byte("\x01\f\x02\x00\x19\x01I++\x00\x00\xf6,'\x01") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateKeyPage/slow-unit-2cbc0e51c31f4757cff063722eed20aa9a77ea64: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x94\x00II@I.acme?%@I%722722\xff\xff") 3 | []byte("\x01\f\x02\x00\x19\x01I++\x00\x00\xf6,'\x01") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateKeyPage/slow-unit-d054842c5b1142eec0c58eb639925319ed8db275: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x94\x00II@I.acme?%@I%445444\xff\xff") 3 | []byte("\x01\f\x02\x00\x19\x01I++\x00\x00\xf6,'\x01") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateKeyPage/slow-unit-d94477dfe7da32f5710d799ca1da05fc9ba24210: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x94\x00II@I.acme?%@I%998179\xff\xff") 3 | []byte("\x01\f\x02\x00\x19\x01I++\x00\x00\xf6,'\x01") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateKeyPage/slow-unit-fdeeddcf13b66c0c23ff7daeec5c3c6f01767237: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x94\x00II@I.acme?%@I%890888\xff\xff") 3 | []byte("\x01\f\x02\x00\x19\x01I++\x00\x00\xf6,'\x01") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzIssueTokens/oom-e38d2231bcc0203c4f8b7c085a59c76694cbf5bb: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01*I.acme?Ѳ\x99\x99x\x99\x99\x9cfff\x96\x99%23PvfC0:%3033666#333_\x1b\xe3\x01\t\x00") 3 | []byte("\x01\t") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateKeyPage/slow-unit-36909e3f5a438d10e41097feab458d0c8faf7494: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x94\x00II@I.acme?%@I%722722\xff\xff") 3 | []byte("\x01\f\x02\x00\x19\x01I+\x00\x03\xf6,'\x01\xff") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzIssueTokens/oom-12869ce34baf6101bf74adb91d633d6a1a1cd545: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01*I.acme?Ѳ\x99\x99\x99\x99\x99\x9cfff\x96\x99%23PnfC0:%3033666#333_\x1b\xe3\x01\t\x00") 3 | []byte("\x01\t") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzIssueTokens/oom-2594627c4b829f2e748cd26a5a6adf2c669c9e87: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01*I.acme?Ѳ\x99\x99\x99\x99\x99\x9cfff\x96\x99%23PvfC0:%3033676#333_\x1b\xe3\x01\t\x00") 3 | []byte("\x01\t") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzIssueTokens/oom-c538b578f24a35d18e9027ef8af11d1c27708433: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01*I.acme?Ѳ\x99\x99\x99\x99\x99\x9cfff\x96\x99%46PvfC0:%3033666#333_\x1b\xe3\x01\t\x00") 3 | []byte("\x01\t") 4 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | [Core] 2 | * @firelizzard @bunfield @PaulSnow 3 | 4 | [Documentation] 5 | *.md @firelizzard @bunfield @PaulSnow 6 | docs @firelizzard @bunfield @PaulSnow 7 | 8 | [SMT] 9 | smt/ @PaulSnow 10 | 11 | [CI] 12 | .gitlab-ci.yml @firelizzard -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateToken/oom-db148e290d1b4870f6e33f9676bc4026b465e9c5: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\aȝ.acme\a") 3 | []byte("\x01\b\x02.a\xff\xffe/-%25- 666-%25- 6666666=65\xde5 ! W \xa4\x00\x00\x16 ") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzIssueTokens/slow-unit-c0f3679ca90455c441301460b96ef47037ae854b: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01*I.acme?Ѳ\x99\x99\x99\x99\x99\x9cfff\x96\x99%23PvfC0:%3033666#333_\x1b\xe3\x01\t\x00") 3 | []byte("\x01\t") 4 | -------------------------------------------------------------------------------- /test/data/pkg_database_values_BenchmarkNotFound/754e303a85b7804f5a707825bd954d2f2e835af7.cpuprof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AccumulateNetwork/accumulate/HEAD/test/data/pkg_database_values_BenchmarkNotFound/754e303a85b7804f5a707825bd954d2f2e835af7.cpuprof -------------------------------------------------------------------------------- /test/data/pkg_database_values_BenchmarkNotFound/754e303a85b7804f5a707825bd954d2f2e835af7.memprof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AccumulateNetwork/accumulate/HEAD/test/data/pkg_database_values_BenchmarkNotFound/754e303a85b7804f5a707825bd954d2f2e835af7.memprof -------------------------------------------------------------------------------- /test/data/pkg_database_values_BenchmarkNotFound/7cebf291ec424692b98fb5828ceaddfe49e31cca.cpuprof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AccumulateNetwork/accumulate/HEAD/test/data/pkg_database_values_BenchmarkNotFound/7cebf291ec424692b98fb5828ceaddfe49e31cca.cpuprof -------------------------------------------------------------------------------- /test/data/pkg_database_values_BenchmarkNotFound/7cebf291ec424692b98fb5828ceaddfe49e31cca.memprof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AccumulateNetwork/accumulate/HEAD/test/data/pkg_database_values_BenchmarkNotFound/7cebf291ec424692b98fb5828ceaddfe49e31cca.memprof -------------------------------------------------------------------------------- /test/data/pkg_database_values_BenchmarkNotFound/e82e6eb18834e22d941b450a8305eed4155d746b.cpuprof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AccumulateNetwork/accumulate/HEAD/test/data/pkg_database_values_BenchmarkNotFound/e82e6eb18834e22d941b450a8305eed4155d746b.cpuprof -------------------------------------------------------------------------------- /test/data/pkg_database_values_BenchmarkNotFound/e82e6eb18834e22d941b450a8305eed4155d746b.memprof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AccumulateNetwork/accumulate/HEAD/test/data/pkg_database_values_BenchmarkNotFound/e82e6eb18834e22d941b450a8305eed4155d746b.memprof -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzWriteDataTo/62a765fa8f1bae5ecb4af67f36fa36b37bdcc042af088d976aba086415d87b33: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x010000000000000000000000000000000000000000000000000") 3 | []byte("\x01\x06\x03\v\x01\x02 00000000") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateToken/oom-bb837fbff2083d462ac8047e29536d40801498da: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\aȝ.acme\a") 3 | []byte("\x01\b\x02.a\xff\xffe/-%25- 666-%25- 6666666;65\xde5 ! W \xe0\xde \xa4\x00\x00\x16 ") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateToken/oom-09467469d90e1f8e1cbaa5fc2b4a89d49a62f228: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\aȝ.acme\a") 3 | []byte("\x01\b\x02.a\xff\xff\xffcme/q\xc6Aql2qq\x83q--%25q\x8f\x8e\x8eʎΌ\x91a-%25--4588884\r/\x9eq\x8f\x8e\x9f\x93q\xcbolq") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateToken/oom-6b3f546e8f513c315a79c757ae3c9b444f0013f3: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\aȝ.acme\a") 3 | []byte("\x01\b\x02.a\xff\xff\xff\xffcme/\xc6qAqlqqqqq--%25q\x8f\x8e\x8eʎΌ\x91-a%25-3549766\r/\x9eq\x8f\x8eȝ./\x9eq\x8f") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateToken/oom-c3bfc6fb80858b3d814fe3a241ad9bef8d25ba91: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\aȝ.acme\a") 3 | []byte("\x01\b\x02.a\xff\xff\xff\xffcme/q\xc6Aql2qq\x83q--%25q\x8f\x8eʎΌ\x91-a%25--5488884\r/\x9eq\x8f\x8e\x9fzq\xcbolq") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateToken/slow-unit-70291fc28e70b92912bdfd51d8117a15bd5c80f1: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\aȝ.acme\a") 3 | []byte("\x01\b\x02.a\xff\xff\xff\xffcme/\xc6qAqlqqqqq--%25q\x8f\x8e\x8eʎΌ\x91-a%25-1774884\r/\x9eq\x8f\x8eȝ./\x9eq\n") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateToken/slow-unit-737383f2d76a3ad00e26ce0ef55f6e882c9c9417: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\aȝ.acme\a") 3 | []byte("\x01\b\x02.a\xff\xff\xff\xffcme/\xc6qAqlqqqqq--%25q\x8f\x8e\x8eʎΌ\x91-a%25-1774442\r/\x9eq\x8f\x8eȝ.acme") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateToken/slow-unit-a3c71e144e4af29ca10dd2ab6219b424896dfc34: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\aȝ.acme\a") 3 | []byte("\x01\b\x02.\xffa\xff\xff\xffcme/\xc6qAqlqqqqq--%25q\x8f\x8e\x8eʎΌ\x91-a%25-1774884\r/\x9eq\x8f\x8eȝ./\x9eq\n") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateToken/slow-unit-bd3aeb65795d211d65809f6d2a64c7da8cfa984d: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\aȝ.acme\a") 3 | []byte("\x01\b\x02.a\xff\xff\xff\xffcme/\xc6qAqlqqqqq--%25q\x8f\x8e\x8eʎΌ\x91-a%25-1774442\r/\x9eq\x8f\x8eȝ.acme") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzLockAccount/oom-3869b30653a59efb4ace0568a594024abb579aa1: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x012p.acme?///5/./%\xff\xff\xff\xff%25%2%7270272e7%27%27%\xd0///\xff<>/<\x19=\xff\b\b5\xff\u007f\x9e\n\n\x02@\x028\t\b") 3 | []byte("\x01\x10") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzLockAccount/oom-6ef247b26cb6a8f759ddeef345fb07e82222c697: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x012p.acme?///5/./%\xff\xff\xff\xff%2%%722727.72e7%27%27%\xd0///\xff<>/<\x19=k\b\b5\xff\u007f\x9e\n\n\x02@\x028\t\b") 3 | []byte("\x01\x10") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzLockAccount/oom-9165157c3eb70c0facf15fbce2ac4aeaf86ad2da: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x012p.acme?///5/./%\xff\xff\xff\xff%26%2%727027e27%27%27%\xd0///\xff<>4<\x19=\xff\b\b4\xff\u007f\x9e\n\n\x02@\x028\t\b") 3 | []byte("\x01\x10") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzLockAccount/oom-f5441abe4747b48e9cf70404d107c24cfa81e370: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x012p.acme?///5/./%\xff\xff\xff\xff%26%2%727027e27%27%27%\xd0///\xff<>4<\x19=\xff\b\b5\xff\u007f\x9e\n\n\x02@\x028\t\b") 3 | []byte("\x01\x10") 4 | -------------------------------------------------------------------------------- /test/data/pkg_database_values_BenchmarkNotFound/README.md: -------------------------------------------------------------------------------- 1 | Executed with `go test -benchtime 500000x -run=- -bench BenchmarkNotFound -cpuprofile $x.cpuprof -memprofile $x.memprof ./pkg/database/values -benchmem > $x.bench`. e82e6eb1 is the original, 7cebf291 is after optimization. -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateToken/slow-unit-80004c6cebf4e81482340b87fedadf014f141ffc: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\aȝ.acme\a") 3 | []byte("\x01\b\x02.a\xff\xff\xff\xffcme/\xc6qAqlqqqqq--%25q\x8f\x8e\x8eʎΌ\x91-a%25-1774884\r/\x9eq\x8f\x8eȝ./\x9eq\x8f") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzLockAccount/slow-unit-9a4b1bd50309e481e96fecde8f0dff9043b8ce2c: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x012p.acme?///5/./%\xff\xff\xff\xff%26%2%927027e27%27%27%\xd0///\xff<>4<\x19=\xff\b\b5\xff\u007f\x9e\n\n\x02@\x028\t\b") 3 | []byte("\x01\x10") 4 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzLockAccount/slow-unit-a3e8a386e0b59c4bf121fd5fe050d73d03ed9a33: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x012p.acme?///5/./%\xff\xff\xff\xff%28%27%2702277e%27%27%\xd0///\xff<>/<\x19=\xff\b\b5\xff\u007f\x9e\n\n\x02@\x024\t\b") 3 | []byte("\x01\x10") 4 | -------------------------------------------------------------------------------- /.gitlab/merge-request.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | mr bott: 2 | stage: test 3 | needs: [] 4 | rules: 5 | - if: $CI_PIPELINE_SOURCE == 'merge_request_event' 6 | variables: 7 | PROJECT: $CI_PROJECT_PATH 8 | MERGE_REQUEST: $CI_MERGE_REQUEST_IID 9 | trigger: accumulatenetwork/core/gitlab-bot -------------------------------------------------------------------------------- /test/cmd/eth_signTypedData/execute.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # CD to the directory containing this file 4 | cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null 5 | 6 | # Make sure dependencies are installed 7 | npm ci &> /dev/null 8 | 9 | # Run the script 10 | node main.js "$@" -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzWriteData_Lite/2c2507695443717343fa66b2d0088c66835455603f4785e0be294026d188cec5: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\xa0\xa0\xa0\xa0\x050000000000000000000000000000000000000000\x8000000008000000000000000/0") 3 | []byte("\x01\xa0\xa0\xa0\xa0\x05") 4 | -------------------------------------------------------------------------------- /test/cmd/eth_signTypedData/main.js: -------------------------------------------------------------------------------- 1 | const eth = require('@metamask/eth-sig-util'); 2 | 3 | const privateKey = Buffer.from(process.argv[2], 'hex'); 4 | const data = JSON.parse(process.argv[3]); 5 | const sig = eth.signTypedData({ privateKey, data, version: 'V4' }); 6 | process.stdout.write(sig); -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzLockAccount/oom-f8fc905724e04551aa953c674525ca68eaab11b8: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01Fbvn-BBBPGetLo+LBBBFB@BԵBBBAl.acme?\xd4B\xc1'CBB/-B\xbc'A/%.\xd9\xd8\xd8\xce.\xd0\xdf\xd8''/%8432020\x06 \x01\x030\xd8\xdcY\x01\x147]c") 3 | []byte("\x01\x10") 4 | -------------------------------------------------------------------------------- /exp/ioutil/pkg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | // Package ioutil contains various I/O helpers. 8 | package ioutil 9 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzIssueTokens/slow-unit-b7f492ce77281de3555052b45fce37ea85dc2431: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01%N.acme?/;\xe0ù\xdap\xb9\xb9\xb91%D2%+1%FF%909090RP)\v\f\xf4\xf3\xb2\xf5\xff\xff\xff\xf7\x00\x00\x008\x04\xd2\xff\xf6\xf4=") 3 | []byte("\x01\t\t\x02\x92/+M\xb9\xdap\xb9\x00") 4 | -------------------------------------------------------------------------------- /scripts/delve-in-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Launches delve within a container and attaches it to PID 1 4 | # 5 | # Usage: ./scripts/delve-in-docker.sh 6 | 7 | SCRIPT="dlv attach 1 --headless --listen=:2345 --accept-multiclient --api-version=2" 8 | 9 | docker exec --privileged -it "$1" bash -c "$SCRIPT" -------------------------------------------------------------------------------- /scripts/pre-commit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ -n "$NOMOCK" ]; then 6 | SKIP="-skip=.*mockery.*" 7 | fi 8 | 9 | go mod tidy 10 | go generate -x $SKIP ./... 11 | go run github.com/rinchsan/gosimports/cmd/gosimports -w . 12 | go run ./tools/cmd/golangci-lint run --verbose --timeout=10m 13 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzSendTokens/oom-69d2bf59ac009693967e409f01678e5cd409c8c7: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01\x8c\x01a8a88a@8JJJJJJJJ.acme?///(////////////////////////////////////8D%\xc8L\xc9\xc7О\x9d\xd7C8%9788888\xc8\xc2JJJJJJJJJ%C6%90%C7%BCyAsIn%C7%ByACs%C7%BCyAsInJJ%\x97.acme\xb4") 3 | []byte("\x01\x03\t\x80\x91") 4 | -------------------------------------------------------------------------------- /exp/torrent/torrent.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package torrent 8 | 9 | import "errors" 10 | 11 | var ErrBadHash = errors.New("hash does not match") 12 | -------------------------------------------------------------------------------- /pkg/errors/debug_prod.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build production 8 | // +build production 9 | 10 | package errors 11 | 12 | const trackLocation = false 13 | -------------------------------------------------------------------------------- /pkg/types/record/debug_prod.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build production 8 | // +build production 9 | 10 | package record 11 | 12 | const debugKeys = false 13 | -------------------------------------------------------------------------------- /scripts/devnet-init-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | go run ./cmd/accumulated \ 4 | init devnet \ 5 | -w .nodes \ 6 | --reset \ 7 | --faucet-seed ci \ 8 | --globals '{"executorVersion": "v2", "oracle": { "price": 50000000 } }' \ 9 | "$@" 10 | 11 | go run ./cmd/accumulated \ 12 | run devnet \ 13 | -w .nodes \ 14 | --faucet-seed ci -------------------------------------------------------------------------------- /tools/internal/factom/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package factom 8 | 9 | //go:generate go run ../../cmd/gen-types --language go-alt --package factom types.yml 10 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Render playbooks as markdown 2 | *.play gitlab-language=markdown 3 | 4 | # Collapse go.sum in merge requests 5 | go.sum gitlab-generated 6 | 7 | # LFS files 8 | *.dat filter=lfs diff=lfs merge=lfs -text 9 | test/testdata/executor-v1-consistency.json filter=lfs merge=lfs -text 10 | test/testdata/api-v2-consistency.json filter=lfs merge=lfs -text 11 | -------------------------------------------------------------------------------- /_archive/smt/storage/memory/debug_prod.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build production 8 | // +build production 9 | 10 | package memory 11 | 12 | const debugLogWrites = false 13 | -------------------------------------------------------------------------------- /exp/light/pkg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | // Package light implements an Accumulate light client. 8 | // 9 | // # THIS PACKAGE IS EXPERIMENTAL AND SUBJECT TO CHANGE. 10 | package light 11 | -------------------------------------------------------------------------------- /internal/core/hash/compat.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package hash 8 | 9 | import "gitlab.com/accumulatenetwork/accumulate/pkg/database/merkle" 10 | 11 | type Hasher = merkle.Hasher 12 | -------------------------------------------------------------------------------- /internal/core/healing/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package healing 8 | 9 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package healing types.yml 10 | -------------------------------------------------------------------------------- /vdk/node/daemon.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package node 8 | 9 | import accumulated "gitlab.com/accumulatenetwork/accumulate/internal/node/daemon" 10 | 11 | type Daemon = accumulated.Daemon 12 | -------------------------------------------------------------------------------- /exp/apiutil/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package apiutil 8 | 9 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package apiutil --language go-alt types.yml 10 | -------------------------------------------------------------------------------- /exp/torrent/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package torrent 8 | 9 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package torrent --language go-alt types.yml 10 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzBurnTokens/slow-unit-a333676adee402243b135da9b2f8cd141e44d7b9: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01(memo.acme/om?mr%FF%%D%1072927hea%D/%x0Ο\xdb\xcb\xcb\xcb\xcb") 3 | []byte("\x01\n\x02\x01P#\x01(memo.acme/om\xff\xff\xffx\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\b\x00\xff\xff") 4 | -------------------------------------------------------------------------------- /internal/database/snapshot/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package snapshot 8 | 9 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package snapshot types.yml 10 | -------------------------------------------------------------------------------- /cmd/play-accumulate/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import "gitlab.com/accumulatenetwork/accumulate/cmd/play-accumulate/cmd" 10 | 11 | func main() { 12 | _ = cmd.Command.Execute() 13 | } 14 | -------------------------------------------------------------------------------- /test/data/pkg_database_values_BenchmarkNotFound/754e303a85b7804f5a707825bd954d2f2e835af7.bench: -------------------------------------------------------------------------------- 1 | goos: linux 2 | goarch: amd64 3 | pkg: gitlab.com/accumulatenetwork/accumulate/pkg/database/values 4 | cpu: Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz 5 | BenchmarkNotFound-20 500000 3463 ns/op 1553 B/op 30 allocs/op 6 | PASS 7 | ok gitlab.com/accumulatenetwork/accumulate/pkg/database/values 1.942s 8 | -------------------------------------------------------------------------------- /test/data/pkg_database_values_BenchmarkNotFound/7cebf291ec424692b98fb5828ceaddfe49e31cca.bench: -------------------------------------------------------------------------------- 1 | goos: linux 2 | goarch: amd64 3 | pkg: gitlab.com/accumulatenetwork/accumulate/pkg/database/values 4 | cpu: Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz 5 | BenchmarkNotFound-20 500000 3178 ns/op 1657 B/op 34 allocs/op 6 | PASS 7 | ok gitlab.com/accumulatenetwork/accumulate/pkg/database/values 1.739s 8 | -------------------------------------------------------------------------------- /test/data/pkg_database_values_BenchmarkNotFound/e82e6eb18834e22d941b450a8305eed4155d746b.bench: -------------------------------------------------------------------------------- 1 | goos: linux 2 | goarch: amd64 3 | pkg: gitlab.com/accumulatenetwork/accumulate/pkg/database/values 4 | cpu: Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz 5 | BenchmarkNotFound-20 500000 4837 ns/op 2113 B/op 46 allocs/op 6 | PASS 7 | ok gitlab.com/accumulatenetwork/accumulate/pkg/database/values 2.655s 8 | -------------------------------------------------------------------------------- /.gitlab/scan.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | include: 2 | - template: Jobs/Dependency-Scanning.gitlab-ci.yml 3 | - template: Jobs/SAST.gitlab-ci.yml 4 | - template: Jobs/Secret-Detection.gitlab-ci.yml 5 | 6 | gemnasium-dependency_scanning: 7 | rules: 8 | - if: $CI_PIPELINE_SOURCE 9 | 10 | semgrep-sast: 11 | rules: 12 | - if: $CI_PIPELINE_SOURCE 13 | 14 | secret_detection: 15 | rules: 16 | - if: $CI_PIPELINE_SOURCE 17 | -------------------------------------------------------------------------------- /internal/core/execute/v2/signing.md: -------------------------------------------------------------------------------- 1 | - Given the prohibition on cross-domain data access, a signer cannot verify it 2 | is authorized to sign for an account if the signer is not local to the 3 | account; the account must be the one to verify that. Therefore verification 4 | should only happen once the account receives the authority signature. This is 5 | true whether the account is a transaction principal or a delegator. -------------------------------------------------------------------------------- /test/e2e2/bob.md: -------------------------------------------------------------------------------- 1 | # Bob 2 | 3 | Set up Bob with a basic identity: a single-sig key page and a token account. 4 | 5 | ```go 6 | bob := build. 7 | Identity("bob").Create("book"). 8 | Tokens("tokens").Create("ACME").Add(1e9).Identity(). 9 | Book("book").Page(1).Create().AddCredits(1e9).Book().Identity() 10 | bobKey := bob.Book("book").Page(1). 11 | GenerateKey(SignatureTypeED25519) 12 | _, _ = bob, bobKey 13 | ``` 14 | -------------------------------------------------------------------------------- /pkg/database/keyvalue/badger/compat.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package badger 8 | 9 | type Database = DatabaseV1 10 | 11 | func New(filepath string, o ...Option) (*Database, error) { 12 | return OpenV1(filepath, o...) 13 | } 14 | -------------------------------------------------------------------------------- /test/testdata/testdata.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package testdata 8 | 9 | import _ "embed" 10 | 11 | //go:embed test_factom_addresses 12 | var FactomAddresses string 13 | 14 | //go:embed merkle.yaml 15 | var Merkle string 16 | -------------------------------------------------------------------------------- /tools/cmd/gen-api/java.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | _ "embed" 11 | ) 12 | 13 | //go:embed java.tmpl 14 | var javaSrc string 15 | 16 | var _ = Templates.Register(javaSrc, "java", nil, "Java") 17 | -------------------------------------------------------------------------------- /tools/cmd/gen-enum/java.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | _ "embed" 11 | ) 12 | 13 | //go:embed java.tmpl 14 | var javaSrc string 15 | 16 | var _ = Templates.Register(javaSrc, "java", nil, "Java") 17 | -------------------------------------------------------------------------------- /exp/ioc/pkg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | // Package ioc provides Inversion of Control tools. 8 | package ioc 9 | 10 | import "reflect" 11 | 12 | type Descriptor interface { 13 | Type() reflect.Type 14 | Namespace() string 15 | } 16 | -------------------------------------------------------------------------------- /internal/node/web/web_embed.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build !web_local 8 | // +build !web_local 9 | 10 | package web 11 | 12 | import "net/http" 13 | 14 | func staticFS() http.FileSystem { 15 | return staticEmbedded() 16 | } 17 | -------------------------------------------------------------------------------- /internal/node/daemon/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package accumulated 8 | 9 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package accumulated types.yml --reference ../../../protocol/general.yml 10 | -------------------------------------------------------------------------------- /test/e2e2/alice.md: -------------------------------------------------------------------------------- 1 | # Alice 2 | 3 | Set up Alice with a basic identity: a single-sig key page and a token account. 4 | 5 | ```go 6 | alice := build. 7 | Identity("alice").Create("book"). 8 | Tokens("tokens").Create("ACME").Add(1e9).Identity(). 9 | Book("book").Page(1).Create().AddCredits(1e9).Book().Identity() 10 | aliceKey := alice.Book("book").Page(1). 11 | GenerateKey(SignatureTypeED25519) 12 | _, _ = alice, aliceKey 13 | ``` 14 | -------------------------------------------------------------------------------- /tools/cmd/golangci-lint/testdata/nodebug.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package pkg 8 | 9 | const debugFoo = false 10 | 11 | const debugBar = true // want `Flag debugBar is enabled` 12 | 13 | var debugBaz = true // want `Flag debugBaz is enabled` 14 | -------------------------------------------------------------------------------- /pkg/database/merkle/enums.yml: -------------------------------------------------------------------------------- 1 | ChainType: 2 | Unknown: 3 | value: 0 4 | description: is used when the chain type is not known 5 | Transaction: 6 | value: 1 7 | description: holds transaction hashes 8 | Anchor: 9 | value: 2 10 | description: holds chain anchors 11 | # Signature: 12 | # value: 3 13 | # description: holds signature hashes 14 | Index: 15 | value: 4 16 | description: indexes other chains -------------------------------------------------------------------------------- /protocol/1_mainnet.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build !testnet 8 | // +build !testnet 9 | 10 | package protocol 11 | 12 | const IsTestNet = false 13 | 14 | // InitialAcmeOracle is $0.50, the oracle value at activation. 15 | const InitialAcmeOracle = 0.50 16 | -------------------------------------------------------------------------------- /test/testing/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package testing 8 | 9 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --language go-alt --package testing types.yml --reference ../../protocol/accounts.yml,../../protocol/general.yml 10 | -------------------------------------------------------------------------------- /internal/node/docs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | // Package node provides functions to configure, initialize, and execute a 8 | // Tendermint node. It does not implement an ABCI application - that 9 | // implementation must be provided by the caller. 10 | package node 11 | -------------------------------------------------------------------------------- /pkg/types/network/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | // package network holds core protocol types and constants 8 | package network 9 | 10 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --language go-alt --package network types.yml 11 | -------------------------------------------------------------------------------- /exp/loki/loki.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | option go_package = "gitlab.com/accumulatenetwork/accumulate/exp/loki"; 3 | 4 | package logproto; 5 | 6 | import "google/protobuf/timestamp.proto"; 7 | 8 | 9 | message PushRequest { 10 | repeated Stream streams = 1; 11 | } 12 | 13 | message Stream { 14 | string labels = 1; 15 | repeated Entry entries = 2; 16 | } 17 | 18 | message Entry { 19 | google.protobuf.Timestamp timestamp = 1; 20 | string line = 2; 21 | } 22 | -------------------------------------------------------------------------------- /internal/core/compat.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package core 8 | 9 | import "gitlab.com/accumulatenetwork/accumulate/pkg/types/network" 10 | 11 | type GlobalValues = network.GlobalValues 12 | 13 | func NewGlobals(g *GlobalValues) *GlobalValues { return network.NewGlobals(g) } 14 | -------------------------------------------------------------------------------- /internal/database/utils_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package database 8 | 9 | import "gitlab.com/accumulatenetwork/accumulate/internal/database/record" 10 | 11 | func (b *Batch) ResolveAccountKey(key *record.Key) *record.Key { 12 | return b.resolveAccountKey(key) 13 | } 14 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "Init DevNet", 8 | "type": "shell", 9 | "command": "go run ./cmd/accumulated init devnet -w .nodes --reset -f 0 -v 1 -b 1 -s 0 --faucet-seed ci --globals '{\"executorVersion\": \"v2baikonur\"}'" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /cmd/accumulated-faucet/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.22 as build 2 | 3 | # Build 4 | WORKDIR /root 5 | COPY . . 6 | ENV CGO_ENABLED 0 7 | RUN go install github.com/go-delve/delve/cmd/dlv@latest 8 | RUN go build ./cmd/accumulated-faucet 9 | 10 | FROM alpine:3 11 | 12 | # Install tools 13 | RUN apk add --no-cache bash jq curl nano 14 | 15 | # Copy binaries 16 | COPY --from=build /root/accumulated-faucet /go/bin/dlv /bin/ 17 | 18 | ENTRYPOINT ["accumulated-faucet"] 19 | CMD ["help"] -------------------------------------------------------------------------------- /pkg/database/keyvalue/remote/whitebox_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package remote 8 | 9 | import ( 10 | "bufio" 11 | "io" 12 | ) 13 | 14 | func SendCommit(rd *bufio.Reader, wr io.Writer) error { 15 | _, err := roundTrip[*okResponse](rd, wr, &commitCall{}) 16 | return err 17 | } 18 | -------------------------------------------------------------------------------- /internal/core/execute/events.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package execute 8 | 9 | func (WillBeginBlock) IsEvent() {} 10 | func (WillCommitBlock) IsEvent() {} 11 | 12 | type WillBeginBlock struct { 13 | BlockParams 14 | } 15 | 16 | type WillCommitBlock struct { 17 | Block BlockState 18 | } 19 | -------------------------------------------------------------------------------- /internal/node/web/web_local.go: -------------------------------------------------------------------------------- 1 | //go:build web_local 2 | // +build web_local 3 | 4 | package web 5 | 6 | import ( 7 | "net/http" 8 | "os" 9 | "path/filepath" 10 | "runtime" 11 | ) 12 | 13 | func staticFS() http.FileSystem { 14 | _, file, _, ok := runtime.Caller(1) 15 | if !ok { 16 | return staticEmbedded() 17 | } 18 | 19 | _, err := os.Stat(file) 20 | if os.IsNotExist(err) { 21 | return staticEmbedded() 22 | } 23 | 24 | return http.Dir(filepath.Dir(file)) 25 | } 26 | -------------------------------------------------------------------------------- /test/simulator/consensus/enums.yml: -------------------------------------------------------------------------------- 1 | messageType: 2 | StartBlock: 3 | value: 0x10 4 | ProposeLeader: 5 | value: 0x11 6 | ProposeBlock: 7 | value: 0x12 8 | AcceptBlockProposal: 9 | value: 0x13 10 | FinalizedBlock: 11 | value: 0x14 12 | CommittedBlock: 13 | value: 0x15 14 | ExecutedBlock: 15 | value: 0x16 16 | 17 | SubmitEnvelope: 18 | value: 0x20 19 | AcceptedSubmission: 20 | value: 0x21 21 | EnvelopeSubmitted: 22 | value: 0x22 23 | -------------------------------------------------------------------------------- /test/util/context.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package testutil 8 | 9 | import ( 10 | "context" 11 | "testing" 12 | ) 13 | 14 | func ContextForTest(t testing.TB) context.Context { 15 | ctx, cancel := context.WithCancel(context.Background()) 16 | t.Cleanup(cancel) 17 | return ctx 18 | } 19 | -------------------------------------------------------------------------------- /cmd/accumulated-bootstrap/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.22 as build 2 | 3 | # Build 4 | WORKDIR /root 5 | COPY . . 6 | ENV CGO_ENABLED 0 7 | RUN go install github.com/go-delve/delve/cmd/dlv@latest 8 | RUN go build ./cmd/accumulated-bootstrap 9 | 10 | FROM alpine:3 11 | 12 | # Install tools 13 | RUN apk add --no-cache bash jq curl nano 14 | 15 | # Copy binaries 16 | COPY --from=build /root/accumulated-bootstrap /go/bin/dlv /bin/ 17 | 18 | ENTRYPOINT ["accumulated-bootstrap"] 19 | CMD ["help"] -------------------------------------------------------------------------------- /pkg/database/keyvalue/remote/enums.yml: -------------------------------------------------------------------------------- 1 | callType: 2 | Get: 3 | value: 1 4 | Put: 5 | value: 2 6 | Delete: 7 | value: 3 8 | ForEach: 9 | value: 4 10 | Commit: 11 | value: 5 12 | Batch: 13 | value: 6 14 | 15 | responseType: 16 | Ok: 17 | value: 1 18 | Error: 19 | value: 2 20 | NotFound: 21 | value: 3 22 | Value: 23 | value: 4 24 | Entry: 25 | value: 5 26 | Batch: 27 | value: 6 28 | UnsupportedCall: 29 | value: 7 30 | -------------------------------------------------------------------------------- /exp/light/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package light 8 | 9 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package light --language go-alt types.yml 10 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-model --package light model.yml 11 | -------------------------------------------------------------------------------- /test/testing/debug.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package testing 8 | 9 | import "gitlab.com/accumulatenetwork/accumulate/internal/logging" 10 | 11 | func EnableDebugFeatures() { 12 | logging.EnableDebugFeatures() 13 | } 14 | 15 | func DisableDebugFeatures() { 16 | logging.DisableDebugFeatures() 17 | } 18 | -------------------------------------------------------------------------------- /pkg/types/record/debug_dev.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build !production 8 | // +build !production 9 | 10 | package record 11 | 12 | var debugKeys = false 13 | 14 | func EnableKeyNameTracking() { 15 | debugKeys = true 16 | } 17 | 18 | func DisableKeyNameTracking() { 19 | debugKeys = false 20 | } 21 | -------------------------------------------------------------------------------- /pkg/errors/debug_dev.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build !production 8 | // +build !production 9 | 10 | package errors 11 | 12 | var trackLocation = false 13 | 14 | func EnableLocationTracking() { 15 | trackLocation = true 16 | } 17 | 18 | func DisableLocationTracking() { 19 | trackLocation = false 20 | } 21 | -------------------------------------------------------------------------------- /protocol/2_testnet.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build testnet 8 | // +build testnet 9 | 10 | package protocol 11 | 12 | const IsTestNet = true 13 | 14 | // InitialAcmeOracle is the oracle value at launch. Set the oracle super high to 15 | // make life easier on the testnet. 16 | const InitialAcmeOracle = 5000 17 | -------------------------------------------------------------------------------- /tools/cmd/debug/db.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | "github.com/spf13/cobra" 11 | ) 12 | 13 | var cmdDb = &cobra.Command{ 14 | Use: "database", 15 | Aliases: []string{"db"}, 16 | Short: "Database utilities", 17 | } 18 | 19 | func init() { 20 | cmd.AddCommand(cmdDb) 21 | } 22 | -------------------------------------------------------------------------------- /tools/cmd/snapshot/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.22 as build 2 | 3 | # Build 4 | WORKDIR /root 5 | COPY . . 6 | ENV CGO_ENABLED 0 7 | RUN go install github.com/go-delve/delve/cmd/dlv@latest 8 | RUN go build ./tools/cmd/snapshot 9 | 10 | FROM alpine:3 11 | 12 | # Install tools 13 | RUN apk add --no-cache bash nano 14 | 15 | # Copy scripts 16 | WORKDIR /scripts 17 | COPY scripts . 18 | 19 | # Copy binaries 20 | COPY --from=build /root/snapshot /go/bin/dlv /bin/ 21 | 22 | ENTRYPOINT ["snapshot"] 23 | CMD ["help"] -------------------------------------------------------------------------------- /_archive/smt/storage/memory/debug_dev.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build !production 8 | // +build !production 9 | 10 | package memory 11 | 12 | var debugLogWrites = false 13 | 14 | func EnableLogWrites() { 15 | debugLogWrites = true 16 | } 17 | 18 | func DisableLogWrites() { 19 | debugLogWrites = false 20 | } 21 | -------------------------------------------------------------------------------- /protocol/errors.yml: -------------------------------------------------------------------------------- 1 | ErrorCode: 2 | OK: 3 | value: 0 4 | description: indicates the request succeeded 5 | EncodingError: 6 | value: 1 7 | description: indicates something could not be decoded or encoded 8 | Failed: 9 | value: 2 10 | description: indicates the request failed 11 | DidPanic: 12 | value: 3 13 | description: indicates the request failed due to a fatal error 14 | UnknownError: 15 | value: 4 16 | description: indicates the request failed due to an unknown error 17 | -------------------------------------------------------------------------------- /protocol/query.yml: -------------------------------------------------------------------------------- 1 | # Request and response types used for querying 2 | 3 | MetricsRequest: 4 | fields: 5 | - name: Metric 6 | type: string 7 | - name: Duration 8 | type: duration 9 | 10 | MetricsResponse: 11 | non-binary: true 12 | incomparable: true 13 | fields: 14 | - name: Value 15 | type: any 16 | 17 | TransactionResultSet: 18 | fields: 19 | - name: Results 20 | type: TransactionStatus 21 | pointer: true 22 | marshal-as: reference 23 | repeatable: true 24 | -------------------------------------------------------------------------------- /tools/cmd/gen-enum/dependencies.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build tools 8 | // +build tools 9 | 10 | package main 11 | 12 | // Importing this ensures that it will show up as a transitive dependency of 13 | // modules that depend on this command 14 | import ( 15 | _ "github.com/rinchsan/gosimports/cmd/gosimports" 16 | ) 17 | -------------------------------------------------------------------------------- /pkg/api/v3/p2p/enums.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate enum generator: 3 | # tools/cmd/gen-enum 4 | # To regenerate enums_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-enum --package p2p enums.yml 6 | # DO NOT EDIT enums_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | eventType: 9 | ServiceRegistered: 10 | value: 1 -------------------------------------------------------------------------------- /scripts/ops/fix/DANGEROUS-rebuild-acc-db.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # image: registry.gitlab.com/accumulatenetwork/accumulate:v1-2-9 3 | 4 | node="$1" 5 | if [ -z "$node" ]; then 6 | node=/node 7 | fi 8 | if ! [ -d "$node" ]; then 9 | >&2 echo "Error: $node is not a directory" 10 | >&2 echo "Usage: $0 [node dir]" 11 | exit 1 12 | fi 13 | 14 | # Remove the Accumulate database 15 | mv "$node/dnn/data/accumulate.db" "$node/bak-dnn-$(date +%s).db" 16 | 17 | # Rollback consensus by one block 18 | cometbft rollback --home "$node/dnn" -------------------------------------------------------------------------------- /internal/core/execute/v2/block/txn_common.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package block 8 | 9 | import "gitlab.com/accumulatenetwork/accumulate/protocol" 10 | 11 | // TransactionContext is the context in which a transaction is executed. 12 | type TransactionContext struct { 13 | *MessageContext 14 | transaction *protocol.Transaction 15 | } 16 | -------------------------------------------------------------------------------- /internal/core/execute/v1/block/executor_mainnet.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build mainnet 8 | // +build mainnet 9 | 10 | package block 11 | 12 | import "gitlab.com/accumulatenetwork/accumulate/internal/core/execute/v1/chain" 13 | 14 | func addTestnetExecutors(x []chain.TransactionExecutor) []chain.TransactionExecutor { 15 | return x 16 | } 17 | -------------------------------------------------------------------------------- /cmd/accumulated-http/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.22 as build 2 | 3 | ARG GIT_DESCRIBE 4 | ARG GIT_COMMIT 5 | 6 | # Build 7 | WORKDIR /root 8 | COPY . . 9 | ENV CGO_ENABLED 0 10 | RUN make http GIT_DESCRIBE=$GIT_DESCRIBE GIT_COMMIT=$GIT_COMMIT 11 | RUN go install github.com/go-delve/delve/cmd/dlv@latest 12 | 13 | FROM alpine:3 14 | 15 | # Install tools 16 | RUN apk add --no-cache bash jq curl nano 17 | 18 | # Copy binaries 19 | COPY --from=build /root/accumulated-http /go/bin/dlv /bin/ 20 | 21 | ENTRYPOINT ["accumulated-http"] 22 | CMD ["help"] -------------------------------------------------------------------------------- /tools/cmd/gen-enum/typescript.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | _ "embed" 11 | "text/template" 12 | ) 13 | 14 | //go:embed main.ts.tmpl 15 | var tsSrc string 16 | 17 | var _ = Templates.Register(tsSrc, "typescript", template.FuncMap{ 18 | "valueName": func(v *TypeValue) string { return v.Key }, 19 | }, "TypeScript") 20 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/testdata/fuzz/FuzzCreateKeyPage/slow-unit-edf1911ad4047bb7239c44674573c1f366e9fdf6: -------------------------------------------------------------------------------- 1 | go test fuzz v1 2 | []byte("\x01E676CAssstss.acme/c/ssstss0acme/??rsssss %\xcaFFFF% 767600 ! \xff\xfd \x93-YF \xe0\xde ; p\x00\x00\x10\x10\x01\x00\x84\x00\x01\xa4@]\x015\x02\xa3\x11\x06x\x00") 3 | []byte("\x01\f\x02&\f\x00\x00\x00\x00\x00\x00\x00\xa3\x11\x06x\x00h\x01\x80\f\x02&\x01\x02\x02\x02\x02\f\x02\x02\x02\x02\x02\x02\x02\a\x02\x02\x00\x00 \x00\x11NA\x02*\x01\f= p\xc7\x00\x10_\xcc\x01E676CAssstss.acme/c/ssstss0\x10\x01\x00}\x00\x01]0@") 4 | -------------------------------------------------------------------------------- /protocol/bug_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package protocol 8 | 9 | import ( 10 | "encoding/json" 11 | "testing" 12 | 13 | "github.com/stretchr/testify/require" 14 | ) 15 | 16 | func TestNullSigners(t *testing.T) { 17 | var status *TransactionStatus 18 | err := json.Unmarshal([]byte(`{"signers": null}`), &status) 19 | require.NoError(t, err) 20 | } 21 | -------------------------------------------------------------------------------- /internal/core/consts.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package core 8 | 9 | import ( 10 | "regexp" 11 | 12 | "gitlab.com/accumulatenetwork/accumulate/pkg/types/network" 13 | ) 14 | 15 | const SnapshotMajorFormat = "snapshot-major-block-%09d.bpt" 16 | 17 | var SnapshotMajorRegexp = regexp.MustCompile(`snapshot-major-block-\d+.bpt`) 18 | 19 | var Cron = network.CronFormat 20 | -------------------------------------------------------------------------------- /internal/node/web/web.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package web 8 | 9 | import ( 10 | "embed" 11 | "net/http" 12 | ) 13 | 14 | //go:embed *.svg *.html 15 | var staticEmbeddedFS embed.FS 16 | 17 | func staticEmbedded() http.FileSystem { 18 | return http.FS(staticEmbeddedFS) 19 | } 20 | 21 | func Handler() http.Handler { 22 | return http.FileServer(staticFS()) 23 | } 24 | -------------------------------------------------------------------------------- /pkg/api/v3/websocket/enums.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate enum generator: 3 | # tools/cmd/gen-enum 4 | # To regenerate enums_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-enum --package websocket enums.yml 6 | # DO NOT EDIT enums_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | StreamStatus: 9 | Open: 10 | value: 1 11 | Closed: 12 | value: 2 -------------------------------------------------------------------------------- /protocol/transaction_results.yml: -------------------------------------------------------------------------------- 1 | EmptyResult: 2 | union: { type: result, value: Unknown } 3 | fields: [] 4 | 5 | WriteDataResult: 6 | union: { type: result } 7 | fields: 8 | - name: EntryHash 9 | type: hash 10 | - name: AccountUrl 11 | type: url 12 | pointer: true 13 | - name: AccountID 14 | type: bytes 15 | 16 | AddCreditsResult: 17 | union: { type: result } 18 | fields: 19 | - name: Amount 20 | type: bigint 21 | - name: Credits 22 | type: uvarint 23 | - name: Oracle 24 | type: uvarint -------------------------------------------------------------------------------- /pkg/api/ethereum/generate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package ethrpc 8 | 9 | //go:generate go run gitlab.com/accumulatenetwork/core/schema/cmd/generate schema schema.yml -w schema_gen.go 10 | //go:generate go run gitlab.com/accumulatenetwork/core/schema/cmd/generate types schema.yml -w types_gen.go 11 | //go:generate go run github.com/rinchsan/gosimports/cmd/gosimports -w . 12 | -------------------------------------------------------------------------------- /internal/api/v2/jrpc_utils_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package api 8 | 9 | import ( 10 | "fmt" 11 | 12 | "github.com/AccumulateNetwork/jsonrpc2/v15" 13 | ) 14 | 15 | func (m *JrpcMethods) GetMethod(name string) jsonrpc2.MethodFunc { 16 | method := m.methods[name] 17 | if method == nil { 18 | panic(fmt.Errorf("method %q not found", name)) 19 | } 20 | return method 21 | } 22 | -------------------------------------------------------------------------------- /internal/core/execute/v1/block/executor_testnet.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build !mainnet 8 | // +build !mainnet 9 | 10 | package block 11 | 12 | import "gitlab.com/accumulatenetwork/accumulate/internal/core/execute/v1/chain" 13 | 14 | func addTestnetExecutors(x []chain.TransactionExecutor) []chain.TransactionExecutor { 15 | return append(x, 16 | chain.AcmeFaucet{}, 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /internal/bsn/types.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate types generator: 3 | # tools/cmd/gen-types 4 | # To regenerate types_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package bsn types.yml 6 | # DO NOT EDIT types_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | LastBlock: 9 | fields: 10 | - name: Index 11 | type: uint 12 | - name: Time 13 | type: time 14 | -------------------------------------------------------------------------------- /pkg/api/v3/websocket/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package websocket 8 | 9 | // StreamStatus indicates the status of a sub-stream. 10 | type StreamStatus int 11 | 12 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-enum --package websocket enums.yml 13 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package websocket types.yml 14 | -------------------------------------------------------------------------------- /.github/workflows/merge.yml: -------------------------------------------------------------------------------- 1 | name: Merge 2 | 3 | on: 4 | pull_request: 5 | # Rerun when the PR is edited, such as changing the target 6 | types: [ opened, synchronize, edited, reopened ] 7 | 8 | jobs: 9 | merge: 10 | name: Merge 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Only merge into `develop` 14 | # Fail unless the base branch is 'develop' 15 | run: | 16 | if [ "$GITHUB_BASE_REF" != "develop" ]; then 17 | echo -e "\033[1;31mMerging into $GITHUB_BASE_REF is not allowed.\033[0m" 18 | false 19 | fi -------------------------------------------------------------------------------- /internal/util/pool/pool.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package pool 8 | 9 | import "sync" 10 | 11 | func New[T any]() *Pool[*T] { 12 | return (*Pool[*T])(&sync.Pool{New: func() any { return new(T) }}) 13 | } 14 | 15 | type Pool[T any] sync.Pool 16 | 17 | func (p *Pool[T]) Get() T { 18 | return (*sync.Pool)(p).Get().(T) 19 | } 20 | 21 | func (p *Pool[T]) Put(v T) { 22 | (*sync.Pool)(p).Put(v) 23 | } 24 | -------------------------------------------------------------------------------- /scripts/ops/fix/fix-bvn-ports.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # image: registry.gitlab.com/accumulatenetwork/accumulate:v1-2-9 3 | 4 | node="$1" 5 | if [ -z "$node" ]; then 6 | node=/node 7 | fi 8 | if ! [ -d "$node" ]; then 9 | >&2 echo "Error: $node is not a directory" 10 | >&2 echo "Usage: $0 [node dir]" 11 | exit 1 12 | fi 13 | 14 | # Replace 1679x with 1669x 15 | sed -i -re 's/1679([1-5])/1669\1/g' "$node/bvnn/config/accumulate.toml" 16 | sed -i -re 's/1679([1-5])/1669\1/g' "$node/bvnn/config/tendermint.toml" 17 | 18 | # Report port numbers 19 | cd "$node/bvnn/config" 20 | grep -nE '16\d9\d' *.toml -------------------------------------------------------------------------------- /internal/logging/debug_prod.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build production 8 | // +build production 9 | 10 | package logging 11 | 12 | import ( 13 | "log/slog" 14 | 15 | "github.com/fatih/color" 16 | ) 17 | 18 | func EnableDebugFeatures() { 19 | slog.Warn(color.RedString("Debugging features are not supported in production")) 20 | // os.Exit(1) 21 | } 22 | 23 | func DisableDebugFeatures() { 24 | } 25 | -------------------------------------------------------------------------------- /pkg/database/bpt/model.yml: -------------------------------------------------------------------------------- 1 | - name: BPT 2 | type: entity 3 | omitResolve: true 4 | customCommit: true 5 | customIsDirty: true 6 | omitWalk: true 7 | fields: 8 | - name: pending 9 | type: map[[32]byte]*mutation 10 | - name: loadedState 11 | type: '*stateData' 12 | attributes: 13 | - name: State 14 | private: true 15 | type: state 16 | key: Root 17 | dataType: stateData 18 | pointer: true 19 | - name: Root 20 | private: true 21 | omitAccessor: true 22 | omitConstructor: true 23 | type: other 24 | dataType: rootRecord 25 | pointer: true -------------------------------------------------------------------------------- /pkg/api/v3/message/private.yml: -------------------------------------------------------------------------------- 1 | PrivateSequenceRequest: 2 | union: { type: message } 3 | fields: 4 | - name: Source 5 | type: url 6 | pointer: true 7 | - name: Destination 8 | type: url 9 | pointer: true 10 | - name: SequenceNumber 11 | type: uint 12 | - type: private.SequenceOptions 13 | marshal-as: reference 14 | 15 | PrivateSequenceResponse: 16 | union: { type: message } 17 | fields: 18 | - name: Value 19 | type: { name: api.MessageRecord, parameters: [{ type: messaging.Message }] } 20 | marshal-as: reference 21 | pointer: true 22 | -------------------------------------------------------------------------------- /pkg/types/record/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package record 8 | 9 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-enum --package record -i TypeCode --rename TypeCode:typeCode ../../../tools/internal/typegen/enums.yml 10 | 11 | // typeCode is identical to tools/internal/typegen.TypeCode, but we can't use 12 | // that here because its internal, so we duplicate it. 13 | type typeCode uint64 14 | -------------------------------------------------------------------------------- /protocol/rational.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package protocol 8 | 9 | import "math" 10 | 11 | func (r *Rational) Set(num, denom uint64) { 12 | r.Numerator, r.Denominator = num, denom 13 | } 14 | 15 | // Threshold returns keyCount * num / denom rounded up. 16 | func (r *Rational) Threshold(keyCount int) uint64 { 17 | v := float64(keyCount) * float64(r.Numerator) / float64(r.Denominator) 18 | return uint64(math.Ceil(v)) 19 | } 20 | -------------------------------------------------------------------------------- /internal/logging/null.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package logging 8 | 9 | import "github.com/cometbft/cometbft/libs/log" 10 | 11 | type NullLogger struct{} 12 | 13 | func (NullLogger) Debug(msg string, keyVals ...interface{}) {} 14 | func (NullLogger) Info(msg string, keyVals ...interface{}) {} 15 | func (NullLogger) Error(msg string, keyVals ...interface{}) {} 16 | func (l NullLogger) With(keyVals ...interface{}) log.Logger { return l } 17 | -------------------------------------------------------------------------------- /internal/api/private/types.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate types generator: 3 | # tools/cmd/gen-types 4 | # To regenerate types_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package private types.yml 6 | # DO NOT EDIT types_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | 9 | SequenceOptions: 10 | fields: 11 | - name: NodeID 12 | type: p2p.PeerID 13 | marshal-as: union 14 | zero-value: '""' 15 | -------------------------------------------------------------------------------- /tools/cmd/gen-enum/c.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | _ "embed" 11 | ) 12 | 13 | // the c template will include source + header with a ACME_HEADER guard between source and header. 14 | // 15 | //go:embed c.tmpl 16 | var cSource string 17 | var _ = Templates.Register(cSource, "c", nil, "c-source") 18 | 19 | //go:embed c-header.tmpl 20 | var cHeader string 21 | var _ = Templates.Register(cHeader, "c-header", nil, "") 22 | -------------------------------------------------------------------------------- /exp/lxrand/lxrand_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package lxrand 8 | 9 | import ( 10 | "fmt" 11 | "testing" 12 | "time" 13 | 14 | "github.com/dustin/go-humanize" 15 | ) 16 | 17 | func TestSequence(t *testing.T) { 18 | var r Sequence 19 | start := time.Now() 20 | calls := 100000 21 | for i := 0; i < calls; i++ { 22 | r.Hash() 23 | } 24 | fmt.Printf("Time %10s/s\n", humanize.Comma(int64(float64(calls)/time.Since(start).Seconds()))) 25 | } 26 | -------------------------------------------------------------------------------- /internal/node/abci/abci.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | // Package abci implements the Accumulate ABCI applications. 8 | // 9 | // # Transaction Processing 10 | // 11 | // Tendermint processes transactions in the following phases: 12 | // 13 | // - BeginBlock 14 | // - [CheckTx] 15 | // - [DeliverTx] 16 | // - EndBlock 17 | // - Commit 18 | package abci 19 | 20 | // Version is the version of the ABCI applications. 21 | const Version uint64 = 0x2 22 | -------------------------------------------------------------------------------- /vdk/utils/utils_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package utils 8 | 9 | import ( 10 | "os" 11 | "os/signal" 12 | "syscall" 13 | 14 | "golang.org/x/sys/unix" 15 | ) 16 | 17 | func OnHUP(fn func()) { 18 | sigs := make(chan os.Signal, 1) 19 | signal.Notify(sigs, unix.SIGHUP) 20 | 21 | go func() { 22 | for range sigs { 23 | fn() 24 | } 25 | }() 26 | } 27 | 28 | func Interrupt(pid int) { 29 | _ = syscall.Kill(pid, syscall.SIGINT) 30 | } 31 | -------------------------------------------------------------------------------- /vdk/utils/utils_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package utils 8 | 9 | import ( 10 | "os" 11 | "os/signal" 12 | "syscall" 13 | 14 | "golang.org/x/sys/unix" 15 | ) 16 | 17 | func OnHUP(fn func()) { 18 | sigs := make(chan os.Signal, 1) 19 | signal.Notify(sigs, unix.SIGHUP) 20 | 21 | go func() { 22 | for range sigs { 23 | fn() 24 | } 25 | }() 26 | } 27 | 28 | func Interrupt(pid int) { 29 | _ = syscall.Kill(pid, syscall.SIGINT) 30 | } 31 | -------------------------------------------------------------------------------- /version.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package accumulate 8 | 9 | //go:generate go run github.com/vektra/mockery/v2 10 | //go:generate go run github.com/rinchsan/gosimports/cmd/gosimports -w test/mocks pkg/api/v3/p2p/dial pkg/api/v3/message internal/api/routing 11 | 12 | const unknownVersion = "version unknown" 13 | 14 | var Version = unknownVersion 15 | var Commit string 16 | 17 | func IsVersionKnown() bool { 18 | return Version != unknownVersion 19 | } 20 | -------------------------------------------------------------------------------- /cmd/accumulated/utils_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | "os" 11 | "os/signal" 12 | "syscall" 13 | 14 | "golang.org/x/sys/unix" 15 | ) 16 | 17 | func onHUP(fn func()) { 18 | sigs := make(chan os.Signal, 1) 19 | signal.Notify(sigs, unix.SIGHUP) 20 | 21 | go func() { 22 | for range sigs { 23 | fn() 24 | } 25 | }() 26 | } 27 | 28 | func interrupt(pid int) { 29 | _ = syscall.Kill(pid, syscall.SIGINT) 30 | } 31 | -------------------------------------------------------------------------------- /cmd/accumulated/utils_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | "os" 11 | "os/signal" 12 | "syscall" 13 | 14 | "golang.org/x/sys/unix" 15 | ) 16 | 17 | func onHUP(fn func()) { 18 | sigs := make(chan os.Signal, 1) 19 | signal.Notify(sigs, unix.SIGHUP) 20 | 21 | go func() { 22 | for range sigs { 23 | fn() 24 | } 25 | }() 26 | } 27 | 28 | func interrupt(pid int) { 29 | _ = syscall.Kill(pid, syscall.SIGINT) 30 | } 31 | -------------------------------------------------------------------------------- /pkg/types/messaging/synthetic.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package messaging 8 | 9 | func (s *BadSyntheticMessage) Data() *SynthFields { 10 | d := new(SynthFields) 11 | d.Message = s.Message 12 | d.Signature = s.Signature 13 | d.Proof = s.Proof 14 | return d 15 | } 16 | 17 | func (s *SyntheticMessage) Data() *SynthFields { 18 | d := new(SynthFields) 19 | d.Message = s.Message 20 | d.Signature = s.Signature 21 | d.Proof = s.Proof 22 | return d 23 | } 24 | -------------------------------------------------------------------------------- /tools/cmd/golangci-lint/custom.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | "golang.org/x/tools/go/analysis" 11 | ) 12 | 13 | type customLinter struct { 14 | LoadMode string 15 | Analyzer *analysis.Analyzer 16 | } 17 | 18 | func (c *customLinter) GetLoadMode() string { 19 | return c.LoadMode 20 | } 21 | 22 | func (c *customLinter) BuildAnalyzers() ([]*analysis.Analyzer, error) { 23 | return []*analysis.Analyzer{c.Analyzer}, nil 24 | } 25 | -------------------------------------------------------------------------------- /cmd/accumulated/run/disk_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build linux || darwin 8 | // +build linux darwin 9 | 10 | package run 11 | 12 | import ( 13 | "math" 14 | 15 | "golang.org/x/sys/unix" 16 | ) 17 | 18 | func diskUsage(path string) (float64, error) { 19 | var stat unix.Statfs_t 20 | err := unix.Statfs(path, &stat) 21 | if err != nil { 22 | return math.NaN(), err 23 | } 24 | 25 | return float64(stat.Bavail) / float64(stat.Blocks), nil 26 | } 27 | -------------------------------------------------------------------------------- /pkg/types/encoding/writer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package encoding_test 8 | 9 | import ( 10 | "io" 11 | "math/big" 12 | "testing" 13 | 14 | "github.com/stretchr/testify/require" 15 | . "gitlab.com/accumulatenetwork/accumulate/pkg/types/encoding" 16 | ) 17 | 18 | func TestWriter_WriteBigInt(t *testing.T) { 19 | w := NewWriter(io.Discard) 20 | 21 | w.WriteBigInt(1, big.NewInt(-1)) 22 | _, _, err := w.Reset(nil) 23 | require.Error(t, err) 24 | } 25 | -------------------------------------------------------------------------------- /tools/cmd/gen-enum/go.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | _ "embed" 11 | "text/template" 12 | ) 13 | 14 | //go:embed go.go.tmpl 15 | var goSrc string 16 | 17 | var _ = Templates.Register(goSrc, "go", template.FuncMap{ 18 | "valueName": func(v *TypeValue) string { 19 | if v.Name != "" { 20 | return v.Name 21 | } 22 | if flags.ShortNames { 23 | return v.Key 24 | } 25 | return v.Type.Name + v.Key 26 | }, 27 | }, "Go") 28 | -------------------------------------------------------------------------------- /internal/logging/debug_dev.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build !production 8 | // +build !production 9 | 10 | package logging 11 | 12 | import ( 13 | "github.com/AccumulateNetwork/jsonrpc2/v15" 14 | "gitlab.com/accumulatenetwork/accumulate/pkg/errors" 15 | ) 16 | 17 | func EnableDebugFeatures() { 18 | jsonrpc2.DebugMethodFunc = true 19 | errors.EnableLocationTracking() 20 | } 21 | 22 | func DisableDebugFeatures() { 23 | errors.DisableLocationTracking() 24 | } 25 | -------------------------------------------------------------------------------- /tools/internal/factom/convert.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package factom 8 | 9 | import ( 10 | "github.com/FactomProject/factomd/common/interfaces" 11 | "gitlab.com/accumulatenetwork/accumulate/protocol" 12 | ) 13 | 14 | func ConvertEntry(in interfaces.IEntry) *protocol.FactomDataEntry { 15 | out := new(protocol.FactomDataEntry) 16 | out.AccountId = in.GetChainID().Fixed() 17 | out.Data = in.GetContent() 18 | out.ExtIds = in.ExternalIDs() 19 | return out 20 | } 21 | -------------------------------------------------------------------------------- /exp/apiutil/routing.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package apiutil 8 | 9 | import ( 10 | "gitlab.com/accumulatenetwork/accumulate/internal/api/routing" 11 | "gitlab.com/accumulatenetwork/accumulate/pkg/url" 12 | "gitlab.com/accumulatenetwork/accumulate/protocol" 13 | ) 14 | 15 | func RouteAccount(table *protocol.RoutingTable, account *url.URL) (string, error) { 16 | return routing.NewRouter(routing.RouterOptions{ 17 | Initial: table, 18 | }).RouteAccount(account) 19 | } 20 | -------------------------------------------------------------------------------- /internal/node/daemon/disk_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build linux || darwin 8 | // +build linux darwin 9 | 10 | package accumulated 11 | 12 | import ( 13 | "math" 14 | 15 | "golang.org/x/sys/unix" 16 | ) 17 | 18 | func diskUsage(path string) (float64, error) { 19 | var stat unix.Statfs_t 20 | err := unix.Statfs(path, &stat) 21 | if err != nil { 22 | return math.NaN(), err 23 | } 24 | 25 | return float64(stat.Bavail) / float64(stat.Blocks), nil 26 | } 27 | -------------------------------------------------------------------------------- /pkg/client/signing/timestamp.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package signing 8 | 9 | import "sync/atomic" 10 | 11 | type Timestamp interface { 12 | Get() (uint64, error) 13 | } 14 | 15 | type TimestampFromValue uint64 16 | type TimestampFromVariable uint64 17 | 18 | func (t TimestampFromValue) Get() (uint64, error) { 19 | return uint64(t), nil 20 | } 21 | 22 | func (t *TimestampFromVariable) Get() (uint64, error) { 23 | return atomic.AddUint64((*uint64)(t), 1), nil 24 | } 25 | -------------------------------------------------------------------------------- /_archive/smt/pmt/bench_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package pmt 8 | 9 | import ( 10 | "testing" 11 | 12 | "github.com/stretchr/testify/require" 13 | "gitlab.com/accumulatenetwork/accumulate/internal/database/smt/common" 14 | ) 15 | 16 | func BenchmarkInsert(b *testing.B) { 17 | bpt := NewBPTManager(nil) 18 | 19 | var rh common.RandHash 20 | for i := 0; i < b.N; i++ { 21 | bpt.InsertKV(rh.NextA(), rh.NextA()) 22 | } 23 | require.NoError(b, bpt.Bpt.Update()) 24 | } 25 | -------------------------------------------------------------------------------- /test/e2e2/example_test.md: -------------------------------------------------------------------------------- 1 | # Example notebook test 2 | 3 | This is a simple example of a notebook-based test 4 | 5 | ### Setup 6 | 7 | ```go 8 | import "./alice.md" 9 | import "./bob.md" 10 | 11 | sim := NewSim(t, 12 | simulator.SimpleNetwork(t.Name(), 3, 3), 13 | simulator.Genesis(GenesisTime).With(alice, bob), 14 | ) 15 | ``` 16 | 17 | ### Send tokens from Alice to Bob 18 | 19 | ```go 20 | st := sim.BuildAndSubmitTxnSuccessfully( 21 | build.Transaction().For(alice, "tokens"). 22 | SendTokens(123, 0).To(bob, "tokens"). 23 | SignWith(alice, "book", "1").Version(1).Timestamp(1).PrivateKey(aliceKey)) 24 | 25 | sim.StepUntil( 26 | Txn(st.TxID).Completes()) 27 | ``` 28 | -------------------------------------------------------------------------------- /tools/cmd/simulator/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.23 as build 2 | 3 | ARG GIT_DESCRIBE 4 | ARG GIT_COMMIT 5 | 6 | # Build 7 | WORKDIR /root 8 | COPY . . 9 | ENV CGO_ENABLED 0 10 | RUN make sim GIT_DESCRIBE=$GIT_DESCRIBE GIT_COMMIT=$GIT_COMMIT 11 | RUN go install github.com/go-delve/delve/cmd/dlv@latest 12 | RUN mkdir /data 13 | 14 | FROM alpine:3 15 | 16 | # Install tools 17 | RUN apk add --no-cache bash jq curl nano 18 | 19 | # Copy binaries 20 | COPY --from=build /root/simulator /go/bin/dlv /bin/ 21 | 22 | EXPOSE 26660 23 | 24 | ENTRYPOINT ["simulator", "-b=1", "-v=1", "-s=100ms", "--database=/data", "--globals={\"executorVersion\": \"v2vandenberg\"}"] 25 | CMD ["-a=0.0.0.0"] -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries (mac, linux) 2 | accumulated 3 | accumulate 4 | play-accumulate 5 | golangci-lint 6 | !*/ 7 | tools/cmd/gen-types/gen-types 8 | tools/cmd/gen-enum/gen-enum 9 | tools/cmd/gen-types/go_build* 10 | tools/cmd/gen-enum/go_build* 11 | 12 | # Binaries and test data 13 | *.exe 14 | *.test 15 | .testdata 16 | __debug_bin* 17 | tmp 18 | 19 | # Temp and log files 20 | *~ 21 | *.kate-swp 22 | *.orig 23 | *.bak 24 | *.txt 25 | *.log 26 | *.swp 27 | *.out 28 | 29 | # macOS 30 | .DS_Store 31 | 32 | # Tooling 33 | .idea 34 | .nodes* 35 | .factom* 36 | .genesis 37 | .vagrant 38 | .terraform 39 | .terraform.lock.hcl 40 | /.vscode/settings.json 41 | 42 | #jj 43 | .newscripts 44 | -------------------------------------------------------------------------------- /protocol/routing.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package protocol 8 | 9 | import ( 10 | sortutil "gitlab.com/accumulatenetwork/accumulate/internal/util/sort" 11 | "gitlab.com/accumulatenetwork/accumulate/pkg/url" 12 | ) 13 | 14 | func (r *RoutingTable) AddOverride(account *url.URL, partition string) { 15 | ptr, _ := sortutil.BinaryInsert(&r.Overrides, func(o RouteOverride) int { 16 | return o.Account.Compare(account) 17 | }) 18 | ptr.Account = account 19 | ptr.Partition = partition 20 | } 21 | -------------------------------------------------------------------------------- /cmd/accumulated/run/utils_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package run 8 | 9 | import ( 10 | "testing" 11 | 12 | "github.com/stretchr/testify/require" 13 | ) 14 | 15 | func TestIpOffset(t *testing.T) { 16 | require.Equal(t, "/ip4/127.0.0.2", listen(nil, "/ip4/127.0.0.1", ipOffset(1)).String()) 17 | require.Equal(t, "/ip4/127.0.1.6", listen(nil, "/ip4/127.0.0.250", ipOffset(10)).String()) 18 | require.Equal(t, "/ip4/127.0.2.12", listen(nil, "/ip4/127.0.0.250", ipOffset(270)).String()) 19 | } 20 | -------------------------------------------------------------------------------- /pkg/database/merkle/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package merkle 8 | 9 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package merkle types.yml 10 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-enum --package merkle enums.yml 11 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-model --package merkle model.yml 12 | 13 | // ChainType is the type of a chain belonging to an account. 14 | type ChainType uint64 15 | -------------------------------------------------------------------------------- /tools/cmd/golangci-lint/debug.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | "bytes" 11 | "fmt" 12 | "go/ast" 13 | "go/printer" 14 | "go/token" 15 | "io" 16 | ) 17 | 18 | // retain this for debugging purposes 19 | // 20 | //nolint:unused,deadcode 21 | //lint:ignore U1000 Don't care 22 | func printNode(wr io.Writer, fset *token.FileSet, node ast.Node) { 23 | var buf bytes.Buffer 24 | printer.Fprint(&buf, fset, node) 25 | fmt.Fprintf(wr, "%s | %#v\n", buf.String(), node) 26 | } 27 | -------------------------------------------------------------------------------- /vdk/utils/utils.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package utils 8 | 9 | import ( 10 | "encoding/binary" 11 | "errors" 12 | ) 13 | 14 | var ErrNotEnoughData = errors.New("not enough data") 15 | var ErrOverflow = errors.New("overflow") 16 | 17 | var _ = UvarintUnmarshalBinary 18 | 19 | func UvarintUnmarshalBinary(b []byte) (uint64, error) { 20 | v, n := binary.Uvarint(b) 21 | if n == 0 { 22 | return 0, ErrNotEnoughData 23 | } 24 | if n < 0 { 25 | return 0, ErrOverflow 26 | } 27 | return v, nil 28 | } 29 | -------------------------------------------------------------------------------- /dependencies.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | //go:build tools 8 | // +build tools 9 | 10 | package accumulate 11 | 12 | import ( 13 | _ "github.com/FactomProject/factom" 14 | _ "github.com/golangci/golangci-lint/cmd/golangci-lint" 15 | _ "github.com/rinchsan/gosimports/cmd/gosimports" 16 | _ "github.com/vektra/mockery/v2" 17 | _ "golang.org/x/tools/cmd/goimports" 18 | _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" 19 | _ "google.golang.org/protobuf/cmd/protoc-gen-go" 20 | _ "gotest.tools/gotestsum" 21 | ) 22 | -------------------------------------------------------------------------------- /vdk/utils/utils_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package utils 8 | 9 | import ( 10 | "syscall" 11 | 12 | "golang.org/x/sys/windows" 13 | ) 14 | 15 | var dllKernel = windows.NewLazySystemDLL("kernel32.dll") 16 | var procGenerateConsoleCtrlEvent = dllKernel.NewProc("GenerateConsoleCtrlEvent") 17 | 18 | func OnHUP(fn func()) { 19 | // Windows does not support SIGHUP 20 | } 21 | 22 | func Interrupt(pid int) { 23 | _, _, _ = procGenerateConsoleCtrlEvent.Call(syscall.CTRL_BREAK_EVENT, uintptr(pid)) 24 | } 25 | -------------------------------------------------------------------------------- /cmd/accumulated/utils_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | "syscall" 11 | 12 | "golang.org/x/sys/windows" 13 | ) 14 | 15 | var dllKernel = windows.NewLazySystemDLL("kernel32.dll") 16 | var procGenerateConsoleCtrlEvent = dllKernel.NewProc("GenerateConsoleCtrlEvent") 17 | 18 | func onHUP(fn func()) { 19 | // Windows does not support SIGHUP 20 | } 21 | 22 | func interrupt(pid int) { 23 | _, _, _ = procGenerateConsoleCtrlEvent.Call(syscall.CTRL_BREAK_EVENT, uintptr(pid)) 24 | } 25 | -------------------------------------------------------------------------------- /internal/bsn/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package bsn 8 | 9 | import ( 10 | "bytes" 11 | 12 | "gitlab.com/accumulatenetwork/accumulate/protocol" 13 | ) 14 | 15 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package bsn types.yml 16 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-model --package bsn model.yml 17 | 18 | func compareSignatures(a, b protocol.KeySignature) int { 19 | return bytes.Compare(a.GetPublicKey(), b.GetPublicKey()) 20 | } 21 | -------------------------------------------------------------------------------- /internal/database/smt/storage/compat.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package storage 8 | 9 | import ( 10 | "gitlab.com/accumulatenetwork/accumulate/pkg/errors" 11 | "gitlab.com/accumulatenetwork/accumulate/pkg/types/record" 12 | ) 13 | 14 | const KeyLength = record.KeyHashLength 15 | 16 | type Key = record.KeyHash 17 | 18 | func MakeKey(v ...any) Key { 19 | return record.NewKey(v...).Hash() 20 | } 21 | 22 | // ErrNotFound is returned by KeyValueDB.Get if the key is not found. 23 | var ErrNotFound = errors.NotFound 24 | -------------------------------------------------------------------------------- /internal/core/hash.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package core 8 | 9 | import "crypto/sha256" 10 | 11 | type Hash []byte 12 | 13 | func (h Hash) Copy() Hash { 14 | g := make([]byte, len(h)) 15 | copy(g, h) 16 | return g 17 | } 18 | 19 | func (h Hash) Combine(g Hash) Hash { 20 | digest := sha256.New() 21 | _, _ = digest.Write(h) 22 | _, _ = digest.Write(g) 23 | return digest.Sum(nil) 24 | } 25 | 26 | func (h Hash) As32() [32]byte { 27 | return *(*[32]byte)(h) 28 | } 29 | 30 | func (h Hash) Bytes() []byte { 31 | return h 32 | } 33 | -------------------------------------------------------------------------------- /internal/core/execute/v1/chain/fuzz_synth_txn_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package chain 8 | 9 | // func FuzzSyntheticCreateIdentity(f *testing.F) 10 | 11 | // func FuzzSyntheticWriteData(f *testing.F) 12 | 13 | // func FuzzSyntheticDepositTokens(f *testing.F) 14 | 15 | // func FuzzSyntheticDepositCredits(f *testing.F) 16 | 17 | // func FuzzSyntheticBurnTokens(f *testing.F) 18 | 19 | // func FuzzDirectoryAnchor(f *testing.F) 20 | 21 | // func FuzzBlockValidatorAnchor(f *testing.F) 22 | 23 | // func FuzzSystemWriteData(f *testing.F) 24 | -------------------------------------------------------------------------------- /internal/core/execute/v2/chain/_fuzz_synth_txn_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package chain 8 | 9 | // func FuzzSyntheticCreateIdentity(f *testing.F) 10 | 11 | // func FuzzSyntheticWriteData(f *testing.F) 12 | 13 | // func FuzzSyntheticDepositTokens(f *testing.F) 14 | 15 | // func FuzzSyntheticDepositCredits(f *testing.F) 16 | 17 | // func FuzzSyntheticBurnTokens(f *testing.F) 18 | 19 | // func FuzzDirectoryAnchor(f *testing.F) 20 | 21 | // func FuzzBlockValidatorAnchor(f *testing.F) 22 | 23 | // func FuzzSystemWriteData(f *testing.F) 24 | -------------------------------------------------------------------------------- /scripts/ops/fix/3-increase-tx-size-limit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # image: registry.gitlab.com/accumulatenetwork/accumulate:v1-2-12 3 | 4 | set -e 5 | 6 | function update-config { 7 | awk '{gsub(/^max_tx_bytes = 1048576$/, "max_tx_bytes = 4194304");print$0}' $1 > /tmp/file 8 | cat /tmp/file > $1 9 | } 10 | 11 | node="$1" 12 | if [ -z "$node" ]; then 13 | node=/node 14 | fi 15 | if ! [ -d "$node" ]; then 16 | >&2 echo "Error: $node is not a directory" 17 | >&2 echo "Usage: $0 [node dir]" 18 | exit 1 19 | fi 20 | 21 | update-config "$node/dnn/config/tendermint.toml" 22 | update-config "$node/bvnn/config/tendermint.toml" 23 | 24 | grep -i max_tx_bytes "$node/dnn/config/tendermint.toml" "$node/bvnn/config/tendermint.toml" 25 | -------------------------------------------------------------------------------- /internal/database/hash_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package database 8 | 9 | import ( 10 | "bytes" 11 | "crypto/sha256" 12 | "testing" 13 | ) 14 | 15 | func TestHash(t *testing.T) { 16 | var h Hash 17 | var data = []byte("abc") 18 | h = doSha(data) 19 | h2 := h.Copy() 20 | if !bytes.Equal(h[:], h2[:]) { 21 | t.Error("copy failed") 22 | } 23 | h = h.Combine(h2) 24 | h3 := sha256.Sum256(data) 25 | result := sha256.Sum256(append(h3[:], h3[:]...)) 26 | if !bytes.Equal(h[:], result[:]) { 27 | t.Error("combine failed") 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /pkg/database/snapshot/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package snapshot 8 | 9 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-enum --package snapshot enums.yml 10 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package snapshot types.yml 11 | 12 | // SectionType is the type of a snapshot section. 13 | type SectionType uint64 14 | 15 | func (t SectionType) isOneOf(u ...SectionType) bool { 16 | for _, u := range u { 17 | if t == u { 18 | return true 19 | } 20 | } 21 | return false 22 | } 23 | -------------------------------------------------------------------------------- /pkg/errors/error.yml: -------------------------------------------------------------------------------- 1 | ErrorBase[Status statusType]: 2 | fields: 3 | - name: Message 4 | type: string 5 | - name: Code 6 | type: Status 7 | marshal-as: enum 8 | - { name: CodeID, type: uint, virtual: true, non-binary: true } 9 | - name: Cause 10 | type: { name: ErrorBase, parameters: [{ type: Status }] } 11 | marshal-as: reference 12 | pointer: true 13 | - name: CallStack 14 | type: CallSite 15 | marshal-as: reference 16 | pointer: true 17 | repeatable: true 18 | - name: Data 19 | type: rawJson 20 | 21 | CallSite: 22 | fields: 23 | - name: FuncName 24 | type: string 25 | - name: File 26 | type: string 27 | - name: Line 28 | type: int 29 | -------------------------------------------------------------------------------- /protocol/format_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package protocol 8 | 9 | import ( 10 | "testing" 11 | 12 | "github.com/stretchr/testify/assert" 13 | ) 14 | 15 | func TestFormatAmount(t *testing.T) { 16 | cases := []struct { 17 | Amount uint64 18 | Precision int 19 | Result string 20 | }{ 21 | {123, 0, "123"}, 22 | {123, 1, "12.3"}, 23 | {123, 2, "1.23"}, 24 | {123, 3, "0.123"}, 25 | {123, 4, "0.0123"}, 26 | } 27 | 28 | for _, c := range cases { 29 | assert.Equal(t, c.Result, FormatAmount(c.Amount, c.Precision)) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /scripts/ops/fix/4-increase-mempool-size.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # image: registry.gitlab.com/accumulatenetwork/accumulate:v1-2-11 3 | 4 | set -e 5 | 6 | function update-config { 7 | awk '{gsub(/^size = 5000$/, "size = 10000");print$0}' $1 > /tmp/file 8 | cat /tmp/file > $1 9 | } 10 | 11 | node="$1" 12 | if [ -z "$node" ]; then 13 | node=/node 14 | fi 15 | if ! [ -d "$node" ]; then 16 | >&2 echo "Error: $node is not a directory" 17 | >&2 echo "Usage: $0 [node dir]" 18 | exit 1 19 | fi 20 | 21 | update-config "$node/dnn/config/tendermint.toml" 22 | update-config "$node/bvnn/config/tendermint.toml" 23 | 24 | grep -A 1 "# Maximum number of transactions in the mempool" "$node/dnn/config/tendermint.toml" "$node/bvnn/config/tendermint.toml" 25 | -------------------------------------------------------------------------------- /scripts/ops/fix/5-increase-mempool-to-15k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # image: registry.gitlab.com/accumulatenetwork/accumulate:v1-2-11 3 | 4 | set -e 5 | 6 | function update-config { 7 | awk '{gsub(/^size = 10000$/, "size = 15000");print$0}' $1 > /tmp/file 8 | cat /tmp/file > $1 9 | } 10 | 11 | node="$1" 12 | if [ -z "$node" ]; then 13 | node=/node 14 | fi 15 | if ! [ -d "$node" ]; then 16 | >&2 echo "Error: $node is not a directory" 17 | >&2 echo "Usage: $0 [node dir]" 18 | exit 1 19 | fi 20 | 21 | update-config "$node/dnn/config/tendermint.toml" 22 | update-config "$node/bvnn/config/tendermint.toml" 23 | 24 | grep -A 1 "# Maximum number of transactions in the mempool" "$node/dnn/config/tendermint.toml" "$node/bvnn/config/tendermint.toml" 25 | -------------------------------------------------------------------------------- /internal/node/genesis/factom_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package genesis 8 | 9 | import ( 10 | "fmt" 11 | "strings" 12 | "testing" 13 | 14 | "github.com/stretchr/testify/require" 15 | "gitlab.com/accumulatenetwork/accumulate/test/testdata" 16 | ) 17 | 18 | func TestFactomAddressesUpload(t *testing.T) { 19 | value, err := LoadFactomAddressesAndBalances(strings.NewReader(testdata.FactomAddresses)) 20 | require.NoError(t, err) 21 | for _, v := range value { 22 | fmt.Print("Address : ", v.Address) 23 | fmt.Println("Balance : ", v.Balance) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /exp/ioutil/constraints.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package ioutil 8 | 9 | import "gitlab.com/accumulatenetwork/accumulate/pkg/types/encoding" 10 | 11 | // enumGet is a type constraint for an enum type that is comparable and 12 | // implements EnumValueGetter. 13 | type enumGet interface { 14 | comparable 15 | String() string 16 | encoding.EnumValueGetter 17 | } 18 | 19 | // enumSet is a type constraint for an enum type that implements EnumValueSetter 20 | // with a pointer receiver. 21 | type enumSet[V any] interface { 22 | *V 23 | encoding.EnumValueSetter 24 | } 25 | -------------------------------------------------------------------------------- /protocol/lock.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package protocol 8 | 9 | import "gitlab.com/accumulatenetwork/accumulate/pkg/errors" 10 | 11 | type LockableAccount interface { 12 | Account 13 | GetLockHeight() uint64 14 | SetLockHeight(uint64) error 15 | } 16 | 17 | func (l *LiteTokenAccount) GetLockHeight() uint64 { 18 | return l.LockHeight 19 | } 20 | 21 | func (l *LiteTokenAccount) SetLockHeight(v uint64) error { 22 | if v < l.LockHeight { 23 | return errors.BadRequest.WithFormat("cannot reduce lockup period") 24 | } 25 | l.LockHeight = v 26 | return nil 27 | } 28 | -------------------------------------------------------------------------------- /scripts/old/ci/data/devnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "DevNet", 3 | "bvns": [ 4 | { 5 | "id": "BVN1", 6 | "nodes": [ 7 | { 8 | "dnnType": "validator", 9 | "bvnnType": "validator", 10 | "basePort": 26656, 11 | "hostName": "127.0.1.1", 12 | "privValKey": "b25fb0d0b8f0972c86e1465f3b31f5c20f738974b34e83f8942bf3dd7155cfbbdc99828649e96ff414df7cd6872f10470f67ae2352794e422d11d3283b8ad1a8", 13 | "nodeKey": "77378cb7c6aed2f4b984a726d78a5f30e06bf7cd9a2db48ca82414368b0eaec9f9e3b946375ba1d5b0b47a3b8b01a616e5ecbf0b22634abd531cad57d3b2970e" 14 | } 15 | ] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /test/simulator/task_queue.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package simulator 8 | 9 | import ( 10 | "sync/atomic" 11 | 12 | "golang.org/x/sync/errgroup" 13 | ) 14 | 15 | type taskQueue struct { 16 | errg atomic.Pointer[errgroup.Group] 17 | } 18 | 19 | func newTaskQueue() *taskQueue { 20 | t := new(taskQueue) 21 | t.errg.Store(new(errgroup.Group)) 22 | return t 23 | } 24 | 25 | func (t *taskQueue) Go(fn func() error) { 26 | t.errg.Load().Go(fn) 27 | } 28 | 29 | func (t *taskQueue) Flush() error { 30 | return t.errg. 31 | Swap(new(errgroup.Group)). 32 | Wait() 33 | } 34 | -------------------------------------------------------------------------------- /_archive/smt/pmt/value_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package pmt_test 8 | 9 | import ( 10 | "crypto/sha256" 11 | "testing" 12 | 13 | . "gitlab.com/accumulatenetwork/accumulate/internal/database/smt/pmt" 14 | ) 15 | 16 | func TestValue_Equal(t *testing.T) { 17 | value := new(Value) 18 | value.Key = sha256.Sum256([]byte{1}) 19 | value.Hash = sha256.Sum256([]byte{2}) 20 | 21 | value2 := new(Value) 22 | value2.Key = sha256.Sum256([]byte{1}) 23 | value2.Hash = sha256.Sum256([]byte{2}) 24 | 25 | if !value.Equal(value2) { 26 | t.Error("value should be the same") 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /pkg/accumulate/api_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package accumulate 8 | 9 | import ( 10 | "testing" 11 | 12 | "github.com/stretchr/testify/require" 13 | ) 14 | 15 | func TestResolveWellKnownEndpoint(t *testing.T) { 16 | cases := map[string]string{ 17 | "mainnet": "https://mainnet.accumulatenetwork.io/v3", 18 | "https://mainnet.accumulatenetwork.io": "https://mainnet.accumulatenetwork.io/v3", 19 | } 20 | 21 | for input, expect := range cases { 22 | actual := ResolveWellKnownEndpoint(input, "v3") 23 | require.Equal(t, expect, actual) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /internal/database/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package database 8 | 9 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package database types.yml 10 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-model --package database model.yml 11 | //go:generate go run gitlab.com/accumulatenetwork/core/schema/cmd/generate schema schema.yml -w schema_gen.go 12 | //go:generate go run gitlab.com/accumulatenetwork/core/schema/cmd/generate types schema.yml -w types2_gen.go 13 | //go:generate go run github.com/rinchsan/gosimports/cmd/gosimports -w . 14 | -------------------------------------------------------------------------------- /internal/node/config/enums.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate enum generator: 3 | # tools/cmd/gen-enum 4 | # To regenerate enums_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-enum --package config enums.yml 6 | # DO NOT EDIT enums_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | 9 | NodeType: 10 | Validator: 11 | value: 1 12 | Follower: 13 | value: 2 14 | 15 | PortOffset: 16 | TendermintP2P: 17 | value: 0 18 | TendermintRpc: 19 | value: 1 20 | AccumulateP2P: 21 | value: 2 22 | Prometheus: 23 | value: 3 24 | AccumulateApi: 25 | value: 4 26 | -------------------------------------------------------------------------------- /pkg/api/v3/websocket/types.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate types generator: 3 | # tools/cmd/gen-types 4 | # To regenerate types_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package websocket types.yml 6 | # DO NOT EDIT types_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | Message: 9 | fields: 10 | - name: ID 11 | type: uint 12 | - name: Status 13 | type: StreamStatus 14 | marshal-as: enum 15 | - name: WebSocketMessage 16 | type: message.Message 17 | marshal-as: union 18 | elide-union-methods: true 19 | optional: true 20 | -------------------------------------------------------------------------------- /tools/cmd/gen-types/c_union_header.tmpl: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // GENERATED BY go run ./tools/cmd/gen-types (c_union_header). DO NOT EDIT. 4 | #include 5 | #include 6 | #include 7 | 8 | {{if not (eq .Type "result")}} 9 | typedef struct { 10 | {{.Enumeration}} Type; 11 | Bytes data; 12 | } {{.Enumeration}}Union; 13 | 14 | typedef union { 15 | {{.Enumeration}}Union *_u; 16 | {{- range .Members}} 17 | struct {{.Name}} *_{{.Name}}; 18 | {{- end}} 19 | } {{.Interface}}; 20 | 21 | {{- end}} 22 | {{if not (eq .Type "result")}}{{if (index .Members 0).IsBinary}} 23 | int read{{.Interface}}(Unmarshaler *m, {{.Interface}} *v); 24 | {{end}}{{end}} 25 | -------------------------------------------------------------------------------- /pkg/database/bpt/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package bpt 8 | 9 | //go:generate go run gitlab.com/accumulatenetwork/core/schema/cmd/generate schema schema.yml -w schema_gen.go 10 | //go:generate go run gitlab.com/accumulatenetwork/core/schema/cmd/generate types schema.yml -w types_gen.go 11 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-model --package bpt model.yml 12 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-model --package bpt --out model_gen_test.go model_test.yml 13 | //go:generate go run github.com/rinchsan/gosimports/cmd/gosimports -w . 14 | -------------------------------------------------------------------------------- /pkg/types/merkle/compat.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package merkle 8 | 9 | import "gitlab.com/accumulatenetwork/accumulate/pkg/database/merkle" 10 | 11 | const ( 12 | ChainTypeUnknown = merkle.ChainTypeUnknown 13 | ChainTypeTransaction = merkle.ChainTypeTransaction 14 | ChainTypeAnchor = merkle.ChainTypeAnchor 15 | ChainTypeIndex = merkle.ChainTypeIndex 16 | ) 17 | 18 | type ( 19 | ChainType = merkle.ChainType 20 | State = merkle.State 21 | Receipt = merkle.Receipt 22 | ReceiptEntry = merkle.ReceiptEntry 23 | ValidateOptions = merkle.ValidateOptions 24 | ) 25 | -------------------------------------------------------------------------------- /test/testing/merkle_testdata.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package testing 8 | 9 | import ( 10 | "encoding/hex" 11 | 12 | "gopkg.in/yaml.v3" 13 | ) 14 | 15 | type YamlHexString []byte 16 | 17 | func (s *YamlHexString) UnmarshalYAML(value *yaml.Node) error { 18 | var str string 19 | err := value.Decode(&str) 20 | if err != nil { 21 | return err 22 | } 23 | 24 | *s, err = hex.DecodeString(str) 25 | if err != nil { 26 | return err 27 | } 28 | 29 | return nil 30 | } 31 | 32 | type MerkleTestCase struct { 33 | Root YamlHexString 34 | Entries []YamlHexString 35 | Cascade []YamlHexString 36 | } 37 | -------------------------------------------------------------------------------- /pkg/api/v3/address_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package api_test 8 | 9 | import ( 10 | "encoding/json" 11 | "testing" 12 | 13 | "github.com/stretchr/testify/require" 14 | "gitlab.com/accumulatenetwork/accumulate/internal/api/private" 15 | "gitlab.com/accumulatenetwork/accumulate/pkg/api/v3" 16 | ) 17 | 18 | func TestServiceAddressJSON(t *testing.T) { 19 | a1 := private.ServiceTypeSequencer.AddressFor("foo") 20 | b, err := json.Marshal(a1) 21 | require.NoError(t, err) 22 | 23 | var a2 *api.ServiceAddress 24 | require.NoError(t, json.Unmarshal(b, &a2)) 25 | 26 | require.True(t, a1.Equal(a2)) 27 | } 28 | -------------------------------------------------------------------------------- /test/util/goroutine_leaks_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package testutil 8 | 9 | import ( 10 | "context" 11 | "testing" 12 | 13 | "github.com/stretchr/testify/require" 14 | ) 15 | 16 | func TestTrackGoroutines(t *testing.T) { 17 | ctx, cancel := context.WithCancel(context.Background()) 18 | 19 | err := track(ctx, t.Name(), func(ctx context.Context) { 20 | // Leak a goroutine 21 | go func() { <-ctx.Done() }() 22 | }) 23 | 24 | // Verify the leak is detected 25 | require.Error(t, err) 26 | require.IsType(t, (*LeakedGoroutines)(nil), err) 27 | 28 | // Release the goroutine 29 | cancel() 30 | } 31 | -------------------------------------------------------------------------------- /tools/cmd/golangci-lint/testdata/noprint.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package pkg 8 | 9 | import "fmt" 10 | 11 | func noprint_print() { 12 | print() // want `Use a logger instead of printing` 13 | } 14 | 15 | func noprint_println() { 16 | println() // want `Use a logger instead of printing` 17 | } 18 | 19 | func noprint_fmt_Print() { 20 | fmt.Print() // want `Use a logger instead of printing` 21 | } 22 | 23 | func noprint_fmt_Printf() { 24 | fmt.Printf("") // want `Use a logger instead of printing` 25 | } 26 | 27 | func noprint_fmt_Println() { 28 | fmt.Println() // want `Use a logger instead of printing` 29 | } 30 | -------------------------------------------------------------------------------- /pkg/database/keyvalue/atomic.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package keyvalue 8 | 9 | import "gitlab.com/accumulatenetwork/accumulate/pkg/database" 10 | 11 | // ChangeSet is a key-value change set. 12 | type ChangeSet interface { 13 | Store 14 | Beginner 15 | 16 | // Commit commits pending changes. 17 | Commit() error 18 | 19 | // Discard discards pending changes. 20 | Discard() 21 | } 22 | 23 | // A Beginner can begin key-value change sets. 24 | type Beginner interface { 25 | // Begin begins a transaction or sub-transaction with a prefix applied to keys. 26 | Begin(prefix *database.Key, writable bool) ChangeSet 27 | } 28 | -------------------------------------------------------------------------------- /pkg/api/v3/p2p/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package p2p 8 | 9 | import ( 10 | "gitlab.com/accumulatenetwork/accumulate/pkg/types/encoding" 11 | ) 12 | 13 | type eventType uint64 14 | 15 | type event interface { 16 | encoding.UnionValue 17 | Type() eventType 18 | } 19 | 20 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-enum --package p2p enums.yml 21 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package p2p types.yml 22 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --language go-union --package p2p --out unions_gen.go types.yml 23 | -------------------------------------------------------------------------------- /pkg/database/indexing/model.yml: -------------------------------------------------------------------------------- 1 | - name: Log 2 | type: entity 3 | typeParameters: 4 | - { name: V, constraint: any } 5 | fields: 6 | - name: blockSize 7 | type: uint 8 | 9 | # Head is empty if missing because a Log with no head should behave as if the 10 | # head was empty. However, Block is **not** empty if missing because an empty 11 | # block (except head) should never exist. 12 | 13 | attributes: 14 | - name: Head 15 | type: state 16 | private: true 17 | emptyIfMissing: true 18 | dataType: Block[V] 19 | pointer: true 20 | - name: Block 21 | parameters: 22 | - name: Level 23 | type: uint 24 | - name: Index 25 | type: uint 26 | type: state 27 | private: true 28 | dataType: Block[V] 29 | pointer: true 30 | -------------------------------------------------------------------------------- /tools/internal/factom/types.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate types generator: 3 | # tools/cmd/gen-types 4 | # To regenerate types_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package factom types.yml 6 | # DO NOT EDIT types_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | EntryMetadata: 9 | fields: 10 | - name: DBlockKeyMR 11 | type: hash 12 | - name: DBlockHeight 13 | type: uint 14 | keep-empty: true 15 | - name: EBlockKeyMR 16 | type: hash 17 | - name: EBlockSequenceNumber 18 | type: uint 19 | keep-empty: true 20 | - name: EntryIndex 21 | type: uint 22 | keep-empty: true -------------------------------------------------------------------------------- /pkg/api/v3/p2p/types.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate types generator: 3 | # tools/cmd/gen-types 4 | # To regenerate types_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package p2p types.yml 6 | # DO NOT EDIT types_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | serviceRegisteredEvent: 9 | union: { type: event, private: true } 10 | fields: 11 | - name: PeerID 12 | type: p2p.PeerID 13 | marshal-as: union 14 | zero-value: '""' 15 | - name: Network 16 | type: string 17 | - name: Address 18 | type: api.ServiceAddress 19 | marshal-as: reference 20 | pointer: true 21 | -------------------------------------------------------------------------------- /scripts/ops/fix/NUKE-STATE.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # image: registry.gitlab.com/accumulatenetwork/accumulate:v1-2-11 3 | 4 | node="$1" 5 | if [ -z "$node" ]; then 6 | node=/node 7 | fi 8 | if ! [ -d "$node" ]; then 9 | >&2 echo "Error: $node is not a directory" 10 | >&2 echo "Usage: $0 [node dir]" 11 | exit 1 12 | fi 13 | 14 | >&2 echo "This will delete all state. Are you sure you want to do that?" 15 | >&2 echo "Ctrl-C to abort or [Enter] to continue." 16 | read -s 17 | 18 | # Nuke all the state 19 | for i in {3..1}; do 20 | >&2 echo "$i" 21 | sleep 1 22 | done 23 | >&2 echo "Resetting state" 24 | rm -rf "$node"/{dnn,bvnn}/data/{*.db,cs.wal} 25 | echo '{"height": "0","round": 0,"step": 0}' > "$node"/dnn/data/priv_validator_state.json 26 | echo '{"height": "0","round": 0,"step": 0}' > "$node"/bvnn/data/priv_validator_state.json 27 | -------------------------------------------------------------------------------- /internal/api/private/api.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package private 8 | 9 | import ( 10 | "context" 11 | 12 | "gitlab.com/accumulatenetwork/accumulate/pkg/api/v3" 13 | "gitlab.com/accumulatenetwork/accumulate/pkg/types/messaging" 14 | "gitlab.com/accumulatenetwork/accumulate/pkg/url" 15 | ) 16 | 17 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package private types.yml 18 | 19 | const ServiceTypeSequencer api.ServiceType = 0xF001 20 | 21 | type Sequencer interface { 22 | Sequence(ctx context.Context, src, dst *url.URL, num uint64, opts SequenceOptions) (*api.MessageRecord[messaging.Message], error) 23 | } 24 | -------------------------------------------------------------------------------- /internal/database/indexing/transaction.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package indexing 8 | 9 | import ( 10 | "gitlab.com/accumulatenetwork/accumulate/internal/database" 11 | "gitlab.com/accumulatenetwork/accumulate/pkg/database/values" 12 | ) 13 | 14 | // TransactionChainIndexer indexes account chains against a transaction. 15 | type TransactionChainIndexer struct { 16 | values.Set[*database.TransactionChainEntry] 17 | } 18 | 19 | // TransactionChain returns a transaction chain indexer. 20 | func TransactionChain(batch *database.Batch, txid []byte) *TransactionChainIndexer { 21 | return &TransactionChainIndexer{batch.Transaction(txid).Chains()} 22 | } 23 | -------------------------------------------------------------------------------- /internal/node/abci/utils_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package abci_test 8 | 9 | import ( 10 | "crypto/ed25519" 11 | 12 | tmed25519 "github.com/cometbft/cometbft/crypto/ed25519" 13 | "gitlab.com/accumulatenetwork/accumulate/pkg/url" 14 | acctesting "gitlab.com/accumulatenetwork/accumulate/test/testing" 15 | ) 16 | 17 | var globalNonce uint64 18 | 19 | func generateKey() tmed25519.PrivKey { 20 | _, key, _ := ed25519.GenerateKey(rand) 21 | return tmed25519.PrivKey(key) 22 | } 23 | 24 | func mustParseOrigin(origin string) *url.URL { 25 | u, err := acctesting.ParseUrl(origin) 26 | if err != nil { 27 | panic(err) 28 | } 29 | return u 30 | } 31 | -------------------------------------------------------------------------------- /pkg/accumulate/checkpoint.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package accumulate 8 | 9 | import ( 10 | _ "embed" 11 | 12 | "gitlab.com/accumulatenetwork/accumulate/exp/ioutil" 13 | ) 14 | 15 | //go:embed checkpoint-mainnet.snap 16 | var checkpointMainnetSnap []byte 17 | 18 | var checkpointMainnetHash = [32]byte{ 19 | 0xdc, 0x62, 0x3c, 0x43, 0xce, 0x73, 0xde, 0xfb, 0xb9, 0x90, 0x99, 0xf8, 0xae, 0xea, 0x29, 0xe2, 0xfe, 0x7f, 0x35, 0xd7, 0xa4, 0xcd, 0x87, 0xf2, 0x54, 0xa8, 0x83, 0x58, 0xb7, 0xd8, 0xf0, 0x2f, 20 | } 21 | 22 | func MainNetCheckpoint() (ioutil.SectionReader, [32]byte) { 23 | return ioutil.NewBuffer(checkpointMainnetSnap), checkpointMainnetHash 24 | } 25 | -------------------------------------------------------------------------------- /pkg/database/not_found.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package database 8 | 9 | import ( 10 | "fmt" 11 | 12 | "gitlab.com/accumulatenetwork/accumulate/pkg/errors" 13 | ) 14 | 15 | type NotFoundError Key 16 | 17 | func (e *NotFoundError) Error() string { 18 | return fmt.Sprintf("%v not found", (*Key)(e)) 19 | } 20 | 21 | func (e *NotFoundError) Is(target error) bool { 22 | return errors.Is(target, errors.NotFound) 23 | } 24 | 25 | func (e *NotFoundError) As(target any) bool { 26 | switch target := target.(type) { 27 | case **errors.Error: 28 | *target = errors.NotFound.With(e.Error()) 29 | default: 30 | return false 31 | } 32 | return true 33 | } 34 | -------------------------------------------------------------------------------- /pkg/database/values/bench_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package values_test 8 | 9 | import ( 10 | "testing" 11 | 12 | "github.com/stretchr/testify/require" 13 | "gitlab.com/accumulatenetwork/accumulate/internal/database" 14 | "gitlab.com/accumulatenetwork/accumulate/pkg/errors" 15 | "gitlab.com/accumulatenetwork/accumulate/pkg/url" 16 | ) 17 | 18 | func BenchmarkNotFound(b *testing.B) { 19 | db := database.OpenInMemory(nil) 20 | foo := url.MustParse("foo") 21 | 22 | var err error 23 | for i := 0; i < b.N; i++ { 24 | batch := db.Begin(false) 25 | _, err = batch.Account(foo).Main().Get() 26 | } 27 | require.ErrorIs(b, err, errors.NotFound) 28 | } 29 | -------------------------------------------------------------------------------- /internal/core/execute/v1/block/null_dispatcher.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package block 8 | 9 | import ( 10 | "context" 11 | 12 | "gitlab.com/accumulatenetwork/accumulate/pkg/types/messaging" 13 | "gitlab.com/accumulatenetwork/accumulate/pkg/url" 14 | ) 15 | 16 | // nullDispatcher is a [Dispatcher] that discards everything. 17 | type nullDispatcher struct{} 18 | 19 | func (nullDispatcher) Close() { /* Nothing to do */ } 20 | 21 | func (nullDispatcher) Submit(context.Context, *url.URL, *messaging.Envelope) error { return nil } 22 | 23 | func (nullDispatcher) Send(context.Context) <-chan error { 24 | ch := make(chan error) 25 | close(ch) 26 | return ch 27 | } 28 | -------------------------------------------------------------------------------- /exp/torrent/types.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate types generator: 3 | # tools/cmd/gen-types 4 | # To regenerate types_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package torrent types.yml 6 | # DO NOT EDIT types_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | ChunkMetadata: 9 | fields: 10 | - name: Index 11 | type: uint 12 | - name: Size 13 | type: uint 14 | - name: Offset 15 | type: uint 16 | - name: Hash 17 | type: hash 18 | 19 | FileMetadata: 20 | fields: 21 | - name: Chunks 22 | type: ChunkMetadata 23 | marshal-as: reference 24 | pointer: true 25 | repeatable: true 26 | -------------------------------------------------------------------------------- /internal/core/execute/v1/simulator/tb.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package simulator 8 | 9 | import "fmt" 10 | 11 | type TB interface { 12 | Name() string 13 | Log(...interface{}) 14 | Fail() 15 | FailNow() 16 | Helper() 17 | } 18 | 19 | type tb struct { 20 | TB 21 | } 22 | 23 | func (t tb) Logf(format string, args ...interface{}) { 24 | t.Helper() 25 | t.Log(fmt.Sprintf(format, args...)) 26 | } 27 | 28 | func (t tb) Errorf(format string, args ...interface{}) { 29 | t.Helper() 30 | t.Logf(format, args...) 31 | t.Fail() 32 | } 33 | 34 | func (t tb) Fatalf(format string, args ...interface{}) { 35 | t.Helper() 36 | t.Logf(format, args...) 37 | t.FailNow() 38 | } 39 | -------------------------------------------------------------------------------- /internal/database/record/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package record 8 | 9 | import ( 10 | "gitlab.com/accumulatenetwork/accumulate/pkg/database" 11 | ) 12 | 13 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-model --package record_test --out model_gen_test.go model_test.yml 14 | 15 | type Key = database.Key 16 | type Record = database.Record 17 | type WalkOptions = database.WalkOptions 18 | type WalkFunc = database.WalkFunc 19 | type TerminalRecord = database.Value 20 | type Store = database.Store 21 | type ValueReader = database.Value 22 | type ValueWriter = database.Value 23 | 24 | func NewKey(v ...any) *Key { return database.NewKey(v...) } 25 | -------------------------------------------------------------------------------- /internal/util/io/compat.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package ioutil2 8 | 9 | import ( 10 | "io" 11 | 12 | "gitlab.com/accumulatenetwork/accumulate/exp/ioutil" 13 | ) 14 | 15 | type Buffer = ioutil.Buffer 16 | type SectionReader = ioutil.SectionReader 17 | type SectionWriter = ioutil.SectionWriter 18 | 19 | func NewBuffer(b []byte) *Buffer { return ioutil.NewBuffer(b) } 20 | 21 | func NewSectionReader(rd SectionReader, start, end int64) (*io.SectionReader, error) { 22 | return ioutil.NewSectionReader(rd, start, end) 23 | } 24 | 25 | func NewSectionWriter(wr io.WriteSeeker, start, end int64) (*SectionWriter, error) { 26 | return ioutil.NewSectionWriter(wr, start, end) 27 | } 28 | -------------------------------------------------------------------------------- /internal/util/indexing/file.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package indexing 8 | 9 | import ( 10 | "os" 11 | 12 | "github.com/edsrzf/mmap-go" 13 | ) 14 | 15 | type File struct { 16 | file *os.File 17 | mmap mmap.MMap 18 | valueSize int 19 | writeOffset int64 20 | didCreate bool 21 | } 22 | 23 | func OpenFile(filepath string, valueSize int, create bool) (*File, error) { 24 | var file *os.File 25 | var err error 26 | if create { 27 | file, err = os.Create(filepath) 28 | } else { 29 | file, err = os.Open(filepath) 30 | } 31 | if err != nil { 32 | return nil, err 33 | } 34 | return &File{file: file, valueSize: valueSize, didCreate: create}, nil 35 | } 36 | -------------------------------------------------------------------------------- /internal/database/compare.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package database 8 | 9 | import ( 10 | "bytes" 11 | "strings" 12 | ) 13 | 14 | func (e *TransactionChainEntry) Compare(f *TransactionChainEntry) int { 15 | v := e.Account.Compare(f.Account) 16 | if v != 0 { 17 | return v 18 | } 19 | return strings.Compare(e.Chain, f.Chain) 20 | } 21 | 22 | func (e *BlockStateSynthTxnEntry) Compare(f *BlockStateSynthTxnEntry) int { 23 | v := bytes.Compare(e.Transaction, f.Transaction) 24 | switch { 25 | case v != 0: 26 | return v 27 | case e.ChainEntry < f.ChainEntry: 28 | return -1 29 | case e.ChainEntry > f.ChainEntry: 30 | return +1 31 | default: 32 | return 0 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/testing/httpshim.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package testing 8 | 9 | import ( 10 | "gitlab.com/accumulatenetwork/accumulate/internal/api/v2" 11 | client "gitlab.com/accumulatenetwork/accumulate/pkg/client/api/v2" 12 | testhttp "gitlab.com/accumulatenetwork/accumulate/test/util/http" 13 | ) 14 | 15 | // DirectJrpcClient returns a client that executes HTTP requests directly 16 | // without going through a TCP connection. 17 | func DirectJrpcClient(jrpc *api.JrpcMethods) *client.Client { 18 | c, err := client.New("http://direct-jrpc-client") 19 | if err != nil { 20 | panic(err) 21 | } 22 | 23 | c.Client.Client = *testhttp.DirectHttpClient(jrpc.NewMux()) 24 | return c 25 | } 26 | -------------------------------------------------------------------------------- /internal/database/smt/common/RandHash_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package common 8 | 9 | import ( 10 | "testing" 11 | 12 | "github.com/stretchr/testify/require" 13 | ) 14 | 15 | func TestRandHash_GetRandInt64(t *testing.T) { 16 | var rh RandHash 17 | answers := []int64{ 18 | 0x66687aadf862bd77, 19 | 0x2b32db6c2c0a6235, 20 | 0x12771355e46cd47c, 21 | 0x7e15c0d3ebe314fa, 22 | 0x376da11fe3ab3d0e, 23 | 0x4391a5c79ffdc798, 24 | 0x5d1adcb5797c2eff, 25 | 0x6a9b711ce5d3749e, 26 | 0x4e6e6acef5953a6a, 27 | 0x713587bc89fe4882, 28 | } 29 | for i := 0; i < 10; i++ { 30 | v := rh.GetRandInt64() 31 | //fmt.Printf(" %x\n",v) 32 | require.True(t, answers[i] == v) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /pkg/database/keyvalue/block/utils.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package block 8 | 9 | import ( 10 | "bytes" 11 | "io" 12 | "sort" 13 | ) 14 | 15 | func closeIfError(err *error, closer io.Closer) { 16 | if *err != nil { 17 | _ = closer.Close() 18 | } 19 | } 20 | 21 | func searchIndex(index []byte, start, end int64, hash [32]byte) (int64, bool) { 22 | i := start + int64(sort.Search(int(end-start), func(i int) bool { 23 | offset := (start + int64(i)) * indexFileEntrySize 24 | return bytes.Compare(hash[:], index[offset:offset+32]) <= 0 25 | })) 26 | offset := i * indexFileEntrySize 27 | if i >= end { 28 | return i, false 29 | } 30 | return i, [32]byte(index[offset:offset+32]) == hash 31 | } 32 | -------------------------------------------------------------------------------- /vdk/node/executor.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | // This package will expose some internal capability and is subject to change, use at your own risk 8 | package node 9 | 10 | import ( 11 | "gitlab.com/accumulatenetwork/accumulate/internal/core/events" 12 | ) 13 | 14 | //expose the bus and events used by a node 15 | 16 | type Bus = events.Bus 17 | 18 | type Event = events.Event 19 | 20 | type DidCommitBlock = events.DidCommitBlock 21 | 22 | type DidSaveSnapshot = events.DidSaveSnapshot 23 | 24 | type FatalError = events.FatalError 25 | 26 | // SubscribeSync will expose the internal subscribe sync 27 | func SubscribeSync[T Event](b *Bus, sub func(T) error) { 28 | events.SubscribeSync(b, sub) 29 | } 30 | -------------------------------------------------------------------------------- /pkg/api/v3/events.yml: -------------------------------------------------------------------------------- 1 | ErrorEvent: 2 | union: { type: event } 3 | fields: 4 | - name: Err 5 | type: errors2.Error 6 | marshal-as: reference 7 | pointer: true 8 | 9 | BlockEvent: 10 | union: { type: event } 11 | fields: 12 | - name: Partition 13 | type: string 14 | - name: Index 15 | type: uint 16 | - name: Time 17 | type: time 18 | - name: Major 19 | type: uint 20 | - name: Entries 21 | type: { name: ChainEntryRecord, parameters: [{ type: Record }] } 22 | marshal-as: reference 23 | pointer: true 24 | repeatable: true 25 | 26 | GlobalsEvent: 27 | union: { type: event } 28 | fields: 29 | - name: Old 30 | type: core.GlobalValues 31 | marshal-as: reference 32 | pointer: true 33 | - name: New 34 | type: core.GlobalValues 35 | marshal-as: reference 36 | pointer: true 37 | -------------------------------------------------------------------------------- /tools/cmd/snapshot/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | "fmt" 11 | "os" 12 | 13 | "github.com/spf13/cobra" 14 | ) 15 | 16 | var cmd = &cobra.Command{ 17 | Use: "snapshot", 18 | Short: "Snapshot utilities", 19 | } 20 | 21 | func main() { 22 | _ = cmd.Execute() 23 | } 24 | 25 | func fatalf(format string, args ...interface{}) { 26 | fmt.Fprintf(os.Stderr, "Error: "+format+"\n", args...) 27 | os.Exit(1) 28 | } 29 | 30 | func check(err error) { 31 | if err != nil { 32 | fatalf("%+v", err) 33 | } 34 | } 35 | 36 | func checkf(err error, format string, otherArgs ...interface{}) { 37 | if err != nil { 38 | fatalf(format+": %+v", append(otherArgs, err)...) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tools/internal/factom/header.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package factom 8 | 9 | import "encoding/binary" 10 | 11 | type Header struct { 12 | Tag byte 13 | Size uint64 14 | } 15 | 16 | const ( 17 | TagDBlock = iota // Blockchain structs 18 | TagABlock 19 | TagFBlock 20 | TagECBlock 21 | TagEBlock 22 | TagEntry 23 | TagTX 24 | 25 | TagFCT // Balances 26 | TagEC 27 | ) 28 | 29 | func (h *Header) MarshalBinary() []byte { 30 | var data [9]byte 31 | data[0] = h.Tag 32 | binary.BigEndian.PutUint64(data[1:], h.Size) 33 | return data[:] 34 | } 35 | 36 | func (h *Header) UnmarshalBinary(data []byte) []byte { 37 | h.Tag = data[0] 38 | h.Size = binary.BigEndian.Uint64(data[1:]) 39 | return data[9:] 40 | } 41 | -------------------------------------------------------------------------------- /internal/logging/recover.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package logging 8 | 9 | import ( 10 | stdlog "log" 11 | "runtime/debug" 12 | 13 | "github.com/cometbft/cometbft/libs/log" 14 | ) 15 | 16 | func Recover(logger log.Logger, message string, values ...interface{}) { 17 | defer func() { 18 | if recover() != nil { 19 | println("Panicked while recovering from a panic") //nolint:noprint 20 | } 21 | }() 22 | 23 | err := recover() 24 | if err == nil { 25 | return 26 | } 27 | if logger == nil { 28 | stdlog.Printf("Panicked without a logger\n%v\n%s\n", err, debug.Stack()) 29 | return 30 | } 31 | 32 | values = append(values, "error", err, "stack", debug.Stack()) 33 | logger.Error(message, values...) 34 | } 35 | -------------------------------------------------------------------------------- /internal/api/routing/simple.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package routing 8 | 9 | import ( 10 | "gitlab.com/accumulatenetwork/accumulate/protocol" 11 | ) 12 | 13 | func BuildSimpleTable(bvns []string) []protocol.Route { 14 | return buildSimpleTable(bvns, 0, 0) 15 | } 16 | 17 | func buildSimpleTable(bvns []string, value, depth uint64) []protocol.Route { 18 | if len(bvns) > 1 { 19 | value <<= 1 20 | depth++ 21 | i := len(bvns) / 2 22 | a := buildSimpleTable(bvns[:i], value|0, depth) //nolint clarity 23 | b := buildSimpleTable(bvns[i:], value|1, depth) 24 | return append(a, b...) 25 | } 26 | 27 | return []protocol.Route{{ 28 | Length: depth, 29 | Value: value, 30 | Partition: bvns[0], 31 | }} 32 | } 33 | -------------------------------------------------------------------------------- /pkg/api/v3/assert.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package api 8 | 9 | import ( 10 | "gitlab.com/accumulatenetwork/accumulate/pkg/errors" 11 | "gitlab.com/accumulatenetwork/accumulate/pkg/types/messaging" 12 | ) 13 | 14 | func ChainEntryRecordAsMessage[T messaging.Message](r *ChainEntryRecord[Record]) (*ChainEntryRecord[*MessageRecord[T]], error) { 15 | m, err := ChainEntryRecordAs[*MessageRecord[messaging.Message]](r) 16 | if err != nil { 17 | return nil, errors.UnknownError.Wrap(err) 18 | } 19 | r.Value, err = MessageRecordAs[T](m.Value) 20 | if err != nil { 21 | return nil, errors.UnknownError.Wrap(err) 22 | } 23 | r2, err := ChainEntryRecordAs[*MessageRecord[T]](r) 24 | return r2, errors.UnknownError.Wrap(err) 25 | } 26 | -------------------------------------------------------------------------------- /pkg/errors/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package errors 8 | 9 | import "gitlab.com/accumulatenetwork/accumulate/pkg/types/encoding" 10 | 11 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-enum --package errors --short-names status.yml 12 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package errors --skip-generic-as error.yml 13 | 14 | type Error = ErrorBase[Status] 15 | 16 | // Status is a request status code. 17 | type Status uint64 18 | 19 | type statusType interface { 20 | ~int | ~int16 | ~int32 | ~int64 | ~uint | ~uint16 | ~uint32 | ~uint64 21 | comparable 22 | error 23 | String() string 24 | IsKnownError() bool 25 | encoding.EnumValueGetter 26 | } 27 | -------------------------------------------------------------------------------- /pkg/types/encoding/machine_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package encoding_test 8 | 9 | import ( 10 | "encoding/json" 11 | "testing" 12 | 13 | "github.com/stretchr/testify/require" 14 | "gitlab.com/accumulatenetwork/accumulate/pkg/errors" 15 | acctesting "gitlab.com/accumulatenetwork/accumulate/test/testing" 16 | ) 17 | 18 | func TestMachineJSON(t *testing.T) { 19 | acctesting.EnableDebugFeatures() 20 | 21 | x := errors.NotFound.With("I couldn't find the thing") 22 | x = errors.UnknownError.WithFormat("error doing thing: %w", x) 23 | 24 | b, err := json.Marshal(x) 25 | require.NoError(t, err) 26 | 27 | y := new(errors.Error) 28 | require.NoError(t, json.Unmarshal(b, y)) 29 | 30 | require.True(t, x.Equal(y)) 31 | } 32 | -------------------------------------------------------------------------------- /pkg/api/ethereum/services.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package ethrpc 8 | 9 | import ( 10 | "context" 11 | 12 | "gitlab.com/accumulatenetwork/accumulate/pkg/types/encoding" 13 | "gitlab.com/accumulatenetwork/accumulate/protocol" 14 | ) 15 | 16 | type Service interface { 17 | EthChainId(ctx context.Context) (*Number, error) 18 | EthBlockNumber(ctx context.Context) (*Number, error) 19 | EthGasPrice(ctx context.Context) (*Number, error) 20 | EthGetBalance(ctx context.Context, addr Address, block string) (*Number, error) 21 | EthGetBlockByNumber(ctx context.Context, block string, expand bool) (*BlockData, error) 22 | 23 | AccTypedData(context.Context, *protocol.Transaction, protocol.Signature) (*encoding.EIP712Call, error) 24 | } 25 | -------------------------------------------------------------------------------- /pkg/api/v3/p2p/dial/tracker_fake.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package dial 8 | 9 | import ( 10 | "github.com/libp2p/go-libp2p/core/peer" 11 | "github.com/multiformats/go-multiaddr" 12 | "gitlab.com/accumulatenetwork/accumulate/pkg/api/v3" 13 | ) 14 | 15 | var FakeTracker fakeTracker 16 | 17 | type fakeTracker struct{} 18 | 19 | var _ Tracker = fakeTracker{} 20 | 21 | func (fakeTracker) Mark(peer.ID, multiaddr.Multiaddr, api.KnownPeerStatus) {} 22 | func (fakeTracker) Status(peer.ID, multiaddr.Multiaddr) api.KnownPeerStatus { return 0 } 23 | func (fakeTracker) Next(multiaddr.Multiaddr, api.KnownPeerStatus) (peer.ID, bool) { return "", false } 24 | func (fakeTracker) All(multiaddr.Multiaddr, api.KnownPeerStatus) []peer.ID { return nil } 25 | -------------------------------------------------------------------------------- /tools/cmd/debug/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | "gitlab.com/accumulatenetwork/accumulate/pkg/database/keyvalue" 11 | "gitlab.com/accumulatenetwork/accumulate/pkg/types/encoding" 12 | ) 13 | 14 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-enum --package main enums.yml 15 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package main types.yml 16 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package main --language go-union --out unions_gen.go types.yml 17 | 18 | type DbPatchOpType int 19 | 20 | type DbPatchOp interface { 21 | encoding.UnionValue 22 | Type() DbPatchOpType 23 | Apply(keyvalue.ChangeSet) error 24 | } 25 | -------------------------------------------------------------------------------- /internal/core/healing/types.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate types generator: 3 | # tools/cmd/gen-types 4 | # To regenerate types_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package healing types.yml 6 | # DO NOT EDIT types_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | PeerInfo: 9 | non-binary: true 10 | fields: 11 | - name: ID 12 | type: p2p.PeerID 13 | marshal-as: none 14 | - name: Operator 15 | type: url 16 | pointer: true 17 | - name: Key 18 | type: hash 19 | - name: Status 20 | type: api.ConsensusStatus 21 | marshal-as: reference 22 | pointer: true 23 | - name: Addresses 24 | type: p2p.Multiaddr 25 | marshal-as: union 26 | repeatable: true 27 | -------------------------------------------------------------------------------- /tools/cmd/gen-model/templates.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | _ "embed" 11 | "fmt" 12 | "text/template" 13 | 14 | "gitlab.com/accumulatenetwork/accumulate/tools/internal/typegen" 15 | ) 16 | 17 | //go:embed state.yml.tmpl 18 | var ymlSrc string 19 | 20 | func init() { 21 | Templates.Register(ymlSrc, "yaml", nil) 22 | } 23 | 24 | var Templates = typegen.NewTemplateLibrary(template.FuncMap{ 25 | "lower": typegen.LowerFirstWord, 26 | "title": typegen.TitleCase, 27 | "natural": typegen.Natural, 28 | "debug": fmt.Printf, 29 | "excluded": func(r typegen.Record) bool { 30 | name := r.FullName() 31 | for _, n := range flags.Exclude { 32 | if n == name { 33 | return true 34 | } 35 | } 36 | return false 37 | }, 38 | }) 39 | -------------------------------------------------------------------------------- /exp/checkpoint/checkpoint_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package checkpoint 8 | 9 | import ( 10 | "encoding/json" 11 | "fmt" 12 | "testing" 13 | 14 | "github.com/stretchr/testify/require" 15 | "gitlab.com/accumulatenetwork/accumulate/protocol" 16 | ) 17 | 18 | func TestCheckpoint(t *testing.T) { 19 | c, err := LoadMainNet() 20 | require.NoError(t, err) 21 | 22 | var account *protocol.DataAccount 23 | err = c.Account(protocol.DnUrl().JoinPath(protocol.Network)).Main().GetAs(&account) 24 | require.NoError(t, err) 25 | 26 | value := new(protocol.NetworkDefinition) 27 | err = value.UnmarshalBinary(account.Entry.GetData()[0]) 28 | require.NoError(t, err) 29 | 30 | b, err := json.MarshalIndent(value, "", " ") 31 | require.NoError(t, err) 32 | fmt.Println(string(b)) 33 | } 34 | -------------------------------------------------------------------------------- /pkg/database/indexing/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package indexing 8 | 9 | import ( 10 | "io" 11 | 12 | "gitlab.com/accumulatenetwork/core/schema/pkg/binary" 13 | ) 14 | 15 | //go:generate go run gitlab.com/accumulatenetwork/core/schema/cmd/generate schema schema.yml -w schema_gen.go 16 | //go:generate go run gitlab.com/accumulatenetwork/core/schema/cmd/generate types schema.yml -w types_gen.go 17 | //go:generate go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-model --package indexing model.yml 18 | //go:generate go run github.com/rinchsan/gosimports/cmd/gosimports -w . 19 | 20 | func (b *Block[V]) CopyAsInterface() any { return b.Copy() } 21 | 22 | func (b *Block[V]) UnmarshalBinaryFrom(r io.Reader) error { 23 | return b.UnmarshalBinaryV2(binary.NewDecoder(r)) 24 | } 25 | -------------------------------------------------------------------------------- /cmd/accumulated/run/disk_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package run 8 | 9 | import ( 10 | "math" 11 | "unsafe" 12 | 13 | "golang.org/x/sys/windows" 14 | ) 15 | 16 | var kernel32 = windows.MustLoadDLL("kernel32.dll") 17 | var getDiskFreeSpaceExW = kernel32.MustFindProc("GetDiskFreeSpaceExW") 18 | 19 | func diskUsage(path string) (float64, error) { 20 | pathPtr, err := windows.UTF16PtrFromString(path) 21 | if err != nil { 22 | return math.NaN(), err 23 | } 24 | 25 | var free, total int64 26 | ok, _, err := getDiskFreeSpaceExW.Call( 27 | uintptr(unsafe.Pointer(pathPtr)), 28 | uintptr(unsafe.Pointer(&free)), 29 | uintptr(unsafe.Pointer(&total)), 30 | 0, 31 | ) 32 | if ok != 1 { 33 | return math.NaN(), err 34 | } 35 | 36 | return float64(free) / float64(total), nil 37 | } 38 | -------------------------------------------------------------------------------- /exp/ioutil/discard.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package ioutil 8 | 9 | import ( 10 | "errors" 11 | "io" 12 | ) 13 | 14 | // Discard is an [io.WriteSeeker] that discards all data written to it. 15 | type Discard struct { 16 | offset int64 17 | end int64 18 | } 19 | 20 | func (d *Discard) Write(p []byte) (n int, err error) { 21 | d.offset += int64(len(p)) 22 | return len(p), nil 23 | } 24 | 25 | func (d *Discard) Seek(offset int64, whence int) (int64, error) { 26 | if d.offset > d.end { 27 | d.end = d.offset 28 | } 29 | switch whence { 30 | case io.SeekCurrent: 31 | d.offset += offset 32 | case io.SeekStart: 33 | d.offset = offset 34 | case io.SeekEnd: 35 | d.offset = d.end + offset 36 | default: 37 | return 0, errors.New("invalid whence") 38 | } 39 | return d.offset, nil 40 | } 41 | -------------------------------------------------------------------------------- /tools/cmd/genesis/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | "fmt" 11 | "os" 12 | 13 | "github.com/spf13/cobra" 14 | ) 15 | 16 | var cmd = &cobra.Command{ 17 | Use: "genesis", 18 | Short: "Genesis utilities", 19 | } 20 | 21 | var flags = struct { 22 | LogLevel string 23 | UrlCol int 24 | OwnerCol int 25 | }{} 26 | 27 | func main() { 28 | _ = cmd.Execute() 29 | } 30 | 31 | func fatalf(format string, args ...interface{}) { 32 | fmt.Fprintf(os.Stderr, "Error: "+format+"\n", args...) 33 | os.Exit(1) 34 | } 35 | 36 | func check(err error) { 37 | if err != nil { 38 | fatalf("%v", err) 39 | } 40 | } 41 | 42 | func checkf(err error, format string, otherArgs ...interface{}) { 43 | if err != nil { 44 | fatalf(format+": %v", append(otherArgs, err)...) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /internal/api/v2/faucet_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package api_test 8 | 9 | import ( 10 | "testing" 11 | 12 | "github.com/stretchr/testify/require" 13 | "gitlab.com/accumulatenetwork/accumulate/internal/api/v2" 14 | "gitlab.com/accumulatenetwork/accumulate/protocol" 15 | acctesting "gitlab.com/accumulatenetwork/accumulate/test/testing" 16 | ) 17 | 18 | func init() { acctesting.EnableDebugFeatures() } 19 | 20 | func TestFaucet(t *testing.T) { 21 | alice := acctesting.GenerateKey(t.Name()) 22 | aliceUrl := acctesting.AcmeLiteAddressStdPriv(alice) 23 | 24 | txn := &protocol.AcmeFaucet{Url: aliceUrl} 25 | req, payload, err := api.Package{}.ConstructFaucetTxn(txn) 26 | require.NoError(t, err) 27 | 28 | _, err = api.Package{}.ProcessExecuteRequest(req, payload) 29 | require.NoError(t, err) 30 | } 31 | -------------------------------------------------------------------------------- /internal/node/daemon/disk_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package accumulated 8 | 9 | import ( 10 | "math" 11 | "unsafe" 12 | 13 | "golang.org/x/sys/windows" 14 | ) 15 | 16 | var kernel32 = windows.MustLoadDLL("kernel32.dll") 17 | var getDiskFreeSpaceExW = kernel32.MustFindProc("GetDiskFreeSpaceExW") 18 | 19 | func diskUsage(path string) (float64, error) { 20 | pathPtr, err := windows.UTF16PtrFromString(path) 21 | if err != nil { 22 | return math.NaN(), err 23 | } 24 | 25 | var free, total int64 26 | ok, _, err := getDiskFreeSpaceExW.Call( 27 | uintptr(unsafe.Pointer(pathPtr)), 28 | uintptr(unsafe.Pointer(&free)), 29 | uintptr(unsafe.Pointer(&total)), 30 | 0, 31 | ) 32 | if ok != 1 { 33 | return math.NaN(), err 34 | } 35 | 36 | return float64(free) / float64(total), nil 37 | } 38 | -------------------------------------------------------------------------------- /internal/util/sort/slice_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package sortutil 8 | 9 | import ( 10 | "fmt" 11 | "testing" 12 | 13 | "github.com/stretchr/testify/require" 14 | ) 15 | 16 | func TestFilterInPlace(t *testing.T) { 17 | cases := []struct { 18 | Before []int 19 | After []int 20 | }{ 21 | {[]int{1, 2, 3}, []int{1, 3}}, 22 | {[]int{2, 4}, []int{}}, 23 | {[]int{1, 3}, []int{1, 3}}, 24 | {[]int{1, 2, 4, 3}, []int{1, 3}}, 25 | {[]int{2, 1, 3, 4}, []int{1, 3}}, 26 | {[]int{1, 2, 3, 4}, []int{1, 3}}, 27 | {[]int{4, 3, 2, 1}, []int{1, 3}}, 28 | } 29 | 30 | for i, c := range cases { 31 | t.Run(fmt.Sprintf("Case #%d", i), func(t *testing.T) { 32 | l := FilterInPlace(c.Before, func(v int) bool { return v%2 != 0 }) 33 | require.ElementsMatch(t, c.After, l) 34 | }) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: [ push, pull_request ] 4 | 5 | jobs: 6 | lint: 7 | name: Lint 8 | runs-on: ubuntu-latest 9 | steps: 10 | 11 | - name: Set up Go 12 | uses: actions/setup-go@v2 13 | with: 14 | go-version: ^1.15 15 | id: go 16 | 17 | - name: Checkout 18 | uses: actions/checkout@v2 19 | 20 | - name: Vet 21 | run: go vet ./... 22 | 23 | - name: Verify go.mod is tidy 24 | run: | 25 | go mod tidy 26 | if ! git diff --quiet go.mod go.sum ; then 27 | echo -e "\033[1;31mGo mod files are not tidy. Please run \`go mod tidy\`.\033[0m" 28 | false 29 | fi 30 | 31 | - name: Verify generated files are up to date 32 | run: | 33 | go generate ./... 34 | if ! git diff --quiet ; then 35 | echo -e "\033[1;31mGenerated files are not up to date. Please run \`go generate ./...\`.\033[0m" 36 | false 37 | fi 38 | -------------------------------------------------------------------------------- /internal/core/execute/v1/block/enums.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate enum generator: 3 | # tools/cmd/gen-enum 4 | # To regenerate enums_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-enum --package block enums.yml 6 | # DO NOT EDIT enums_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | 9 | BlockTimerType: 10 | ExecuteEnvelope: 11 | value: 0x0 12 | ProcessSignature: 13 | value: 0x01 14 | BeginBlock: 15 | value: 0x02 16 | CheckTx: 17 | value: 0x03 18 | DeliverTx: 19 | value: 0x04 20 | EndBlock: 21 | value: 0x05 22 | Commit: 23 | value: 0x06 24 | Signing: 25 | value: 0x07 26 | NetworkAccountUpdates: 27 | value: 0x08 28 | ProcessRemoteSignatures: 29 | value: 0x09 30 | ProcessTransaction: 31 | value: 0x0a 32 | TransactionOffset: 33 | value: 0xF0 34 | 35 | 36 | -------------------------------------------------------------------------------- /internal/core/execute/v2/block/enums.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate enum generator: 3 | # tools/cmd/gen-enum 4 | # To regenerate enums_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-enum --package block enums.yml 6 | # DO NOT EDIT enums_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | 9 | BlockTimerType: 10 | ExecuteEnvelope: 11 | value: 0x0 12 | ProcessSignature: 13 | value: 0x01 14 | BeginBlock: 15 | value: 0x02 16 | CheckTx: 17 | value: 0x03 18 | DeliverTx: 19 | value: 0x04 20 | EndBlock: 21 | value: 0x05 22 | Commit: 23 | value: 0x06 24 | Signing: 25 | value: 0x07 26 | NetworkAccountUpdates: 27 | value: 0x08 28 | ProcessRemoteSignatures: 29 | value: 0x09 30 | ProcessTransaction: 31 | value: 0x0a 32 | TransactionOffset: 33 | value: 0xF0 34 | 35 | 36 | -------------------------------------------------------------------------------- /pkg/database/keyvalue/block/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package block 8 | 9 | import ( 10 | "encoding" 11 | "fmt" 12 | ) 13 | 14 | //go:generate go run gitlab.com/accumulatenetwork/core/schema/cmd/generate schema schema.yml -w schema_gen.go 15 | //go:generate go run gitlab.com/accumulatenetwork/core/schema/cmd/generate types schema.yml -w types_gen.go 16 | //go:generate go run github.com/rinchsan/gosimports/cmd/gosimports -w . 17 | 18 | type entry interface { 19 | Type() entryType 20 | encoding.BinaryMarshaler 21 | } 22 | 23 | func (b *blockID) String() string { 24 | if b.Part == 0 { 25 | return fmt.Sprint(b.ID) 26 | } 27 | return fmt.Sprintf("%d{%d}", b.ID, b.Part) 28 | } 29 | 30 | func (b *blockID) Compare(c *blockID) int { 31 | if b.ID != c.ID { 32 | return int(b.ID - c.ID) 33 | } 34 | return int(b.Part - c.Part) 35 | } 36 | -------------------------------------------------------------------------------- /pkg/types/network/types.yml: -------------------------------------------------------------------------------- 1 | GlobalValues: 2 | fields: 3 | - name: memoize 4 | type: globalValueMemos 5 | marshal-as: none 6 | - name: Oracle 7 | type: protocol.AcmeOracle 8 | marshal-as: reference 9 | pointer: true 10 | - name: Globals 11 | type: protocol.NetworkGlobals 12 | marshal-as: reference 13 | pointer: true 14 | - name: Network 15 | type: protocol.NetworkDefinition 16 | marshal-as: reference 17 | pointer: true 18 | - name: Routing 19 | type: protocol.RoutingTable 20 | marshal-as: reference 21 | pointer: true 22 | - name: ExecutorVersion 23 | description: is the active executor version 24 | type: protocol.ExecutorVersion 25 | marshal-as: enum 26 | optional: true 27 | - name: BvnExecutorVersions 28 | description: is the active executor version of each BVN 29 | type: protocol.PartitionExecutorVersion 30 | marshal-as: reference 31 | pointer: true 32 | repeatable: true 33 | -------------------------------------------------------------------------------- /protocol/system.md: -------------------------------------------------------------------------------- 1 | # System Accounts 2 | 3 | * `subnet` - Subnet ADI 4 | * `subnet/operators` - Key book containing all network operator keys (synchronized) 5 | * `subnet/validators` - Validator key book containing keys of the current validator set 6 | * `subnet/ledger` - Internal ledger, tracks subnet and block status 7 | * `#minor-root` - Subnet root chain 8 | * `#minor-root-index` - Index for root chain 9 | * `subnet/synthetic` - Synthetic transaction ledger, tracks status of produced and received synthetic transactions 10 | * `subnet/anchors` - Anchor pool, collects anchors from other subnets 11 | * `#{id}-root` - Anchor chain for subnet `{id}`'s root chain 12 | * `#{id}-bpt` - Anchor chain for subnet `{id}`'s BPT 13 | * `subnet/votes` - Records Tendermint votes 14 | * `subnet/evidence` - Records Tendermint evidence 15 | * `subnet/globals` - Global variables for the network (synchronized) 16 | * `subnet/oracle` - ACME oracle value (currently DN-only) 17 | * `subnet/network` - List of subnets and assignment of validators to subnets -------------------------------------------------------------------------------- /scripts/ops/fix/shrink-db.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # image: registry.gitlab.com/accumulatenetwork/accumulate:v1-2-13 3 | 4 | node="$1" 5 | if [ -z "$node" ]; then 6 | node=/node 7 | fi 8 | if ! [ -d "$node" ]; then 9 | >&2 echo "Error: $node is not a directory" 10 | >&2 echo "Usage: $0 [node dir]" 11 | exit 1 12 | fi 13 | 14 | node=/node 15 | >&2 printf '\033[0;33;1mThis will run forever in a loop.\033[0m\n' 16 | >&2 printf '\033[0;31;1mCtrl+C at any time to stop.\033[0m\n' 17 | >&2 printf '\033[1;33;1m[Enter] to continue.\033[0m\n' 18 | read -s 19 | 20 | while true; do 21 | >&2 printf '\033[0;33mFlatten DNN\033[0m\n' 22 | debug badger flatten "$node/dnn/data/accumulate.db" 23 | >&2 printf '\033[0;33mFlatten BVNN\033[0m\n' 24 | debug badger flatten "$node/bvnn/data/accumulate.db" 25 | >&2 printf '\033[0;33mCompact DNN\033[0m\n' 26 | debug badger compact "$node/dnn/data/accumulate.db" 27 | >&2 printf '\033[0;33mCompact BVNN\033[0m\n' 28 | debug badger compact "$node/bvnn/data/accumulate.db" 29 | done 30 | -------------------------------------------------------------------------------- /tools/cmd/golangci-lint/custom_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | "testing" 11 | 12 | "golang.org/x/tools/go/analysis" 13 | "golang.org/x/tools/go/analysis/analysistest" 14 | ) 15 | 16 | func TestRangeVarRef(t *testing.T) { 17 | analysistest.Run(t, analysistest.TestData(), &analysis.Analyzer{ 18 | Name: "rangevarref", 19 | Run: rangevarref, 20 | Doc: "x", 21 | }, "rangevarref.go") 22 | } 23 | 24 | func TestNoPrint(t *testing.T) { 25 | analysistest.Run(t, analysistest.TestData(), &analysis.Analyzer{ 26 | Name: "noprint", 27 | Run: noprint, 28 | Doc: "x", 29 | }, "noprint.go") 30 | } 31 | 32 | func TestNoDebug(t *testing.T) { 33 | analysistest.Run(t, analysistest.TestData(), &analysis.Analyzer{ 34 | Name: "nodebug", 35 | Run: nodebug, 36 | Doc: "x", 37 | }, "nodebug.go") 38 | } 39 | -------------------------------------------------------------------------------- /pkg/database/snapshot/enums.yml: -------------------------------------------------------------------------------- 1 | SectionType: 2 | Header: 3 | description: is the snapshot's header 4 | value: 1 5 | AccountsV1: 6 | description: contains accounts (v1) 7 | value: 2 8 | TransactionsV1: 9 | description: contains transactions (v1) 10 | value: 3 11 | SignaturesV1: 12 | description: contains signatures (v1) 13 | value: 4 14 | GzTransactionsV1: 15 | description: contains gzipped transactions (v1) 16 | value: 5 17 | Snapshot: 18 | description: contains another snapshot 19 | value: 6 20 | Records: 21 | description: contains records stored as (key, record) pairs 22 | value: 7 23 | RecordIndex: 24 | description: indexes record keys, including the offset and section number 25 | value: 8 26 | RawBPT: 27 | description: contains the BPT, as raw (key hash, value) pairs 28 | value: 9 29 | Consensus: 30 | description: contains consensus parameters 31 | value: 10 32 | BPT: 33 | description: contains the BPT, as records 34 | value: 11 35 | -------------------------------------------------------------------------------- /exp/light/types.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate types generator: 3 | # tools/cmd/gen-types 4 | # To regenerate types_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package light types.yml 6 | # DO NOT EDIT types_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | AnchorMetadata: 9 | fields: 10 | - name: Index 11 | type: uint 12 | - name: Hash 13 | type: hash 14 | - name: Anchor 15 | type: protocol.PartitionAnchor 16 | marshal-as: reference 17 | pointer: true 18 | - name: Transaction 19 | type: protocol.Transaction 20 | marshal-as: reference 21 | pointer: true 22 | 23 | EventMetadata: 24 | fields: 25 | - name: LocalBlock 26 | type: uint 27 | - name: LocalTime 28 | type: time 29 | - name: DirectoryBlock 30 | type: uint 31 | - name: DirectoryTime 32 | type: time 33 | -------------------------------------------------------------------------------- /internal/core/events/event.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package events 8 | 9 | import ( 10 | "time" 11 | 12 | "gitlab.com/accumulatenetwork/accumulate/internal/core" 13 | ) 14 | 15 | type Event interface { 16 | IsEvent() 17 | } 18 | 19 | func (DidCommitBlock) IsEvent() {} 20 | func (DidSaveSnapshot) IsEvent() {} 21 | func (WillChangeGlobals) IsEvent() {} 22 | func (FatalError) IsEvent() {} 23 | 24 | type DidCommitBlock struct { 25 | Init bool 26 | Index uint64 27 | Time time.Time 28 | Major uint64 29 | } 30 | 31 | type DidSaveSnapshot struct { 32 | MinorIndex uint64 33 | } 34 | 35 | type WillChangeGlobals struct { 36 | New, Old *core.GlobalValues 37 | } 38 | 39 | type FatalError struct { 40 | Err error 41 | } 42 | 43 | func (e FatalError) Error() string { return e.Err.Error() } 44 | func (e FatalError) Unwrap() error { return e.Err } 45 | -------------------------------------------------------------------------------- /internal/util/cmd/errors.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package cmdutil 8 | 9 | import ( 10 | "fmt" 11 | "os" 12 | 13 | "github.com/fatih/color" 14 | "golang.org/x/term" 15 | ) 16 | 17 | func Fatalf(format string, args ...interface{}) { 18 | fmt.Fprintf(os.Stderr, "Error: "+format+"\n", args...) 19 | os.Exit(1) 20 | } 21 | 22 | func Check(err error) { 23 | if err != nil { 24 | Fatalf("%v", err) 25 | } 26 | } 27 | 28 | func Checkf(err error, format string, otherArgs ...interface{}) { 29 | if err != nil { 30 | Fatalf(format+": %v", append(otherArgs, err)...) 31 | } 32 | } 33 | func Warnf(format string, args ...interface{}) { 34 | format = "WARNING: " + format + "\n" 35 | if term.IsTerminal(int(os.Stderr.Fd())) { 36 | fmt.Fprint(os.Stderr, color.RedString(format, args...)) 37 | } else { 38 | fmt.Fprintf(os.Stderr, format, args...) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vdk/logger/multi_writer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package logger 8 | 9 | import ( 10 | "errors" 11 | "fmt" 12 | "io" 13 | ) 14 | 15 | type multiWriter []io.Writer 16 | 17 | func (w multiWriter) Write(b []byte) (int, error) { 18 | for _, w := range w { 19 | n, err := w.Write(b) 20 | if err != nil { 21 | return n, err 22 | } 23 | if n != len(b) { 24 | return n, io.ErrShortWrite 25 | } 26 | } 27 | return len(b), nil 28 | } 29 | 30 | func (w multiWriter) Close() error { 31 | var errs []error 32 | for _, w := range w { 33 | c, ok := w.(io.Closer) 34 | if !ok { 35 | continue 36 | } 37 | err := c.Close() 38 | if err != nil { 39 | errs = append(errs, err) 40 | } 41 | } 42 | switch len(errs) { 43 | case 0: 44 | return nil 45 | case 1: 46 | return nil 47 | default: 48 | return errors.New(fmt.Sprint(errs)) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.22 as build 2 | 3 | ARG GIT_DESCRIBE 4 | ARG GIT_COMMIT 5 | 6 | # Build 7 | WORKDIR /root 8 | COPY . . 9 | ENV CGO_ENABLED 0 10 | ARG TAGS=production,mainnet 11 | RUN make -B TAGS=$TAGS GIT_DESCRIBE=$GIT_DESCRIBE GIT_COMMIT=$GIT_COMMIT 12 | RUN go install github.com/go-delve/delve/cmd/dlv@latest 13 | RUN go install github.com/cometbft/cometbft/cmd/cometbft 14 | RUN go build ./tools/cmd/snapshot 15 | RUN go build ./tools/cmd/dbrepair 16 | RUN go build ./tools/cmd/debug 17 | RUN go build ./cmd/accumulated-bootstrap 18 | 19 | FROM alpine:3 20 | 21 | # Install tools 22 | RUN apk add --no-cache bash jq curl nano 23 | 24 | # Copy scripts 25 | WORKDIR /scripts 26 | COPY scripts . 27 | 28 | # Copy binaries 29 | COPY --from=build /root/accumulated /root/snapshot /root/dbrepair /root/debug /root/accumulated-bootstrap /go/bin/cometbft /go/bin/dlv /bin/ 30 | 31 | # Set health check 32 | HEALTHCHECK CMD curl --fail --silent http://localhost:26660/status || exit 1 33 | 34 | ENTRYPOINT ["accumulated"] 35 | CMD ["run-dual", "/node/dnn", "/node/bvnn"] -------------------------------------------------------------------------------- /_archive/smt/pmt/loaded.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package pmt 8 | 9 | // Note that the tree considered here grows up by convention here, where 10 | // Parent nodes are at the bottom, and leaves are at the top. Obviously 11 | // mapping up to down and down to up is valid if a need to have the tree 12 | // grow down is viewed as important. 13 | 14 | // Node 15 | // A node in our binary patricia/merkle tree 16 | type NotLoaded struct { 17 | } 18 | 19 | var _ Entry = new(NotLoaded) 20 | 21 | func (n *NotLoaded) T() int { 22 | return TNotLoaded 23 | } 24 | 25 | func (n *NotLoaded) GetHash() []byte { 26 | return nil 27 | } 28 | 29 | func (n *NotLoaded) Marshal() []byte { 30 | return nil 31 | } 32 | func (n *NotLoaded) UnMarshal(data []byte) []byte { 33 | return data 34 | } 35 | func (n *NotLoaded) Equal(entry Entry) bool { 36 | return entry.T() == TNotLoaded 37 | } 38 | -------------------------------------------------------------------------------- /exp/ioc/promised.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package ioc 8 | 9 | import ( 10 | "gitlab.com/accumulatenetwork/accumulate/exp/promise" 11 | "gitlab.com/accumulatenetwork/accumulate/pkg/errors" 12 | ) 13 | 14 | type Promised interface { 15 | Resolve(any) error 16 | } 17 | 18 | type PromisedOf[T any] struct { 19 | promise promise.Promise[T] 20 | resolve func(T) 21 | } 22 | 23 | func NewPromisedOf[T any]() *PromisedOf[T] { 24 | p, r, _ := promise.New[T]() 25 | return &PromisedOf[T]{p, r} 26 | } 27 | 28 | func (r *PromisedOf[T]) Resolve(v any) error { 29 | u, ok := v.(T) 30 | if !ok { 31 | var z T 32 | return errors.Conflict.WithFormat("want %T, got %T", z, v) 33 | } 34 | r.resolve(u) 35 | return nil 36 | } 37 | 38 | func (r *PromisedOf[T]) Get() T { 39 | v, err := r.promise.Result().Get() 40 | if err != nil { 41 | panic(err) 42 | } 43 | return v 44 | } 45 | -------------------------------------------------------------------------------- /exp/apiutil/types.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate types generator: 3 | # tools/cmd/gen-types 4 | # To regenerate types_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-types --package apiutil types.yml 6 | # DO NOT EDIT types_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | 9 | MessageData: 10 | fields: 11 | - name: LastUpdated 12 | type: time 13 | - name: Chains 14 | type: ChainData 15 | marshal-as: reference 16 | pointer: true 17 | repeatable: true 18 | keep-empty: true 19 | 20 | ChainData: 21 | fields: 22 | - name: Account 23 | type: url 24 | pointer: true 25 | - name: Chain 26 | type: string 27 | - name: Block 28 | type: uint 29 | - name: Time 30 | type: time 31 | 32 | AnchorData: 33 | fields: 34 | - name: Block 35 | type: uint 36 | - name: Time 37 | type: time 38 | -------------------------------------------------------------------------------- /_archive/smt/pmt/entry.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package pmt 8 | 9 | // Entry 10 | // We only have two node types, a Node that builds the Patricia Tree, and 11 | // a Value that holds the values at the leaves. 12 | type Entry interface { 13 | T() int // Returns the type of entry 14 | GetHash() []byte // Returns the Hash for the entry 15 | Marshal() []byte // Serialize the state of the Node or Value 16 | UnMarshal(data []byte) []byte // Unmarshal the state into the Node or Value 17 | Equal(entry Entry) bool // Return Entry == entry 18 | } 19 | 20 | const ( 21 | TNil = iota + 1 // When persisting, this is the type for nils 22 | TNode // Type for Nodes 23 | TValue // Type for values 24 | TNotLoaded // When transitioning into a new Byte Block, the NotLoaded indicates a need to load from disk 25 | ) 26 | -------------------------------------------------------------------------------- /internal/util/sort/slice.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package sortutil 8 | 9 | // FilterInPlace removes elements of L that fail the predicate without 10 | // allocating with O(N) runtime. FilterInPlace may reorder L. 11 | // 12 | // This doesn't really fit in the sortutil package but 🤷 making a new package 13 | // for just this function would be excessive. 14 | func FilterInPlace[V any](l []V, predicate func(V) bool) []V { 15 | // I = 0..N-1 16 | for i, n := 0, len(l); i < n; { 17 | // Get the element I from the end 18 | j := n - i - 1 19 | v := l[j] 20 | 21 | // If the element passes the predicate, keep it and move on to the next 22 | if predicate(v) { 23 | i++ 24 | continue 25 | } 26 | 27 | // If V is not the last element, swap it for the last 28 | if i > 0 { 29 | l[j] = l[n-1] 30 | } 31 | 32 | // Truncate 33 | l = l[:n-1] 34 | n-- 35 | } 36 | 37 | return l 38 | } 39 | -------------------------------------------------------------------------------- /pkg/database/keyvalue/badger/slogger.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package badger 8 | 9 | import ( 10 | "fmt" 11 | "log/slog" 12 | "strings" 13 | ) 14 | 15 | type slogger struct{} 16 | 17 | func (l slogger) format(format string, args ...interface{}) string { 18 | s := fmt.Sprintf(format, args...) 19 | return strings.TrimRight(s, "\n") 20 | } 21 | 22 | func (l slogger) Errorf(format string, args ...interface{}) { 23 | slog.Error(l.format(format, args...), "module", "badger") 24 | } 25 | 26 | func (l slogger) Warningf(format string, args ...interface{}) { 27 | slog.Warn(l.format(format, args...), "module", "badger") 28 | } 29 | 30 | func (l slogger) Infof(format string, args ...interface{}) { 31 | slog.Info(l.format(format, args...), "module", "badger") 32 | } 33 | 34 | func (l slogger) Debugf(format string, args ...interface{}) { 35 | slog.Debug(l.format(format, args...), "module", "badger") 36 | } 37 | -------------------------------------------------------------------------------- /internal/bsn/idx_common.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package bsn 8 | 9 | import ( 10 | "gitlab.com/accumulatenetwork/accumulate/internal/database/record" 11 | "gitlab.com/accumulatenetwork/accumulate/pkg/types/messaging" 12 | ) 13 | 14 | type indexerFactory = func(ctx *SummaryContext, update *messaging.RecordUpdate, record record.Record, remainingKey *record.Key) error 15 | 16 | var indexerFactories []indexerFactory 17 | 18 | func registerIndexerFactory(f indexerFactory) { 19 | indexerFactories = append(indexerFactories, f) 20 | } 21 | 22 | type SummaryContext struct { 23 | *MessageContext 24 | 25 | summary *messaging.BlockSummary 26 | 27 | indexers []indexer 28 | } 29 | 30 | type indexer interface { 31 | Key() *record.Key 32 | Apply(*ChangeSet, *SummaryContext, record.Record) error 33 | } 34 | 35 | func (s *SummaryContext) index(indexer indexer) { 36 | s.indexers = append(s.indexers, indexer) 37 | } 38 | -------------------------------------------------------------------------------- /internal/api/v2/enums.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate enum generator: 3 | # tools/cmd/gen-enum 4 | # To regenerate enums_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-enum --package v2 enums.yml 6 | # DO NOT EDIT enums_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | 9 | TxFetchMode: 10 | Expand: 11 | value: 0 12 | description: expand the full transactions in the result set 13 | Ids: 14 | value: 1 15 | description: include the transaction IDs & count in the result set 16 | CountOnly: 17 | value: 2 18 | description: only include the transaction count in the result set 19 | Omit: 20 | value: 3 21 | description: omit all transaction info from the result set 22 | 23 | BlockFilterMode: 24 | ExcludeNone: 25 | value: 0 26 | description: return all blocks including empty ones 27 | ExcludeEmpty: 28 | value: 1 29 | description: exclude empty blocks 30 | -------------------------------------------------------------------------------- /pkg/database/keyvalue/memory/changeset_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package memory 8 | 9 | import ( 10 | "testing" 11 | 12 | "gitlab.com/accumulatenetwork/accumulate/pkg/database/keyvalue" 13 | "gitlab.com/accumulatenetwork/accumulate/pkg/database/keyvalue/kvtest" 14 | ) 15 | 16 | func open() kvtest.Opener { 17 | // Reuse the same in-memory database each time 18 | db := New(nil) 19 | return func() (keyvalue.Beginner, error) { return db, nil } 20 | } 21 | 22 | func TestDatabase(t *testing.T) { 23 | kvtest.TestDatabase(t, open()) 24 | } 25 | 26 | func TestIsolation(t *testing.T) { 27 | t.Skip("Isolation not supported") 28 | kvtest.TestIsolation(t, open()) 29 | } 30 | 31 | func TestSubBatch(t *testing.T) { 32 | kvtest.TestSubBatch(t, open()) 33 | } 34 | 35 | func TestPrefix(t *testing.T) { 36 | kvtest.TestPrefix(t, open()) 37 | } 38 | 39 | func TestDelete(t *testing.T) { 40 | kvtest.TestDelete(t, open()) 41 | } 42 | -------------------------------------------------------------------------------- /test/testing/router.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package testing 8 | 9 | import ( 10 | "context" 11 | 12 | "github.com/cometbft/cometbft/rpc/client" 13 | core "github.com/cometbft/cometbft/rpc/core/types" 14 | "gitlab.com/accumulatenetwork/accumulate/internal/api/routing" 15 | "gitlab.com/accumulatenetwork/accumulate/pkg/errors" 16 | "gitlab.com/accumulatenetwork/accumulate/pkg/types/messaging" 17 | "gitlab.com/accumulatenetwork/accumulate/pkg/url" 18 | ) 19 | 20 | type NullRouter struct{} 21 | 22 | var _ routing.Router = NullRouter{} 23 | 24 | func (NullRouter) RouteAccount(*url.URL) (string, error) { 25 | return "", nil 26 | } 27 | 28 | func (NullRouter) Route(...*messaging.Envelope) (string, error) { 29 | return "", nil 30 | } 31 | 32 | func (NullRouter) Query(ctx context.Context, partition string, query []byte, opts client.ABCIQueryOptions) (*core.ResultABCIQuery, error) { 33 | return nil, errors.NotFound 34 | } 35 | -------------------------------------------------------------------------------- /exp/light/range_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package light 8 | 9 | import ( 10 | "testing" 11 | 12 | "github.com/stretchr/testify/require" 13 | ) 14 | 15 | func TestRangeSet(t *testing.T) { 16 | r := rangeSet{{3, 3}, {6, 8}, {11, 12}} 17 | 18 | r.Add(1) 19 | require.Equal(t, rangeSet{{1, 1}, {3, 3}, {6, 8}, {11, 12}}, r) 20 | 21 | r.Add(2) 22 | require.Equal(t, rangeSet{{1, 3}, {6, 8}, {11, 12}}, r) 23 | 24 | r.Add(5) 25 | require.Equal(t, rangeSet{{1, 3}, {5, 8}, {11, 12}}, r) 26 | 27 | r.Add(9) 28 | require.Equal(t, rangeSet{{1, 3}, {5, 9}, {11, 12}}, r) 29 | 30 | r.Add(13) 31 | require.Equal(t, rangeSet{{1, 3}, {5, 9}, {11, 13}}, r) 32 | 33 | r.Add(20) 34 | require.Equal(t, rangeSet{{1, 3}, {5, 9}, {11, 13}, {20, 20}}, r) 35 | 36 | r.Add(10) 37 | require.Equal(t, rangeSet{{1, 3}, {5, 13}, {20, 20}}, r) 38 | 39 | r.Add(16) 40 | require.Equal(t, rangeSet{{1, 3}, {5, 13}, {16, 16}, {20, 20}}, r) 41 | } 42 | -------------------------------------------------------------------------------- /test/util/fuzz/parse.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package fuzzutil 8 | 9 | import ( 10 | "encoding" 11 | "math/big" 12 | "testing" 13 | 14 | "github.com/stretchr/testify/require" 15 | "gitlab.com/accumulatenetwork/accumulate/pkg/url" 16 | ) 17 | 18 | func AddValue(f *testing.F, v encoding.BinaryMarshaler) { 19 | data, err := v.MarshalBinary() 20 | require.NoError(f, err) 21 | f.Add(data) 22 | } 23 | 24 | func MustParseUrl(t testing.TB, v string) *url.URL { 25 | if v == "" { 26 | return nil 27 | } 28 | u, err := url.Parse(v) 29 | if err != nil { 30 | t.Skip() 31 | } 32 | return u 33 | } 34 | 35 | func MustParseHash(t testing.TB, v []byte) [32]byte { 36 | if len(v) != 32 { 37 | t.Skip() 38 | } 39 | return *(*[32]byte)(v) 40 | } 41 | 42 | func MustParseBigInt(t testing.TB, v string) big.Int { 43 | u := new(big.Int) 44 | u, ok := u.SetString(v, 10) 45 | if !ok { 46 | t.Skip() 47 | } 48 | return *u 49 | } 50 | -------------------------------------------------------------------------------- /pkg/api/v3/p2p/sim_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package p2p_test 8 | 9 | import ( 10 | "context" 11 | "net" 12 | "testing" 13 | 14 | "github.com/stretchr/testify/require" 15 | . "gitlab.com/accumulatenetwork/accumulate/test/harness" 16 | "gitlab.com/accumulatenetwork/accumulate/test/simulator" 17 | acctesting "gitlab.com/accumulatenetwork/accumulate/test/testing" 18 | ) 19 | 20 | func TestSim(t *testing.T) { 21 | acctesting.SkipCI(t, "Connections fail in CI") 22 | 23 | ctx, cancel := context.WithCancel(context.Background()) 24 | t.Cleanup(cancel) 25 | 26 | // Initialize 27 | sim := NewSim(t, 28 | simulator.LocalNetwork(t.Name(), 3, 3, net.ParseIP("127.0.1.1"), 12345), 29 | simulator.Genesis(GenesisTime), 30 | ) 31 | 32 | err := sim.S.ListenAndServe(ctx, simulator.ListenOptions{ 33 | ListenP2Pv3: true, 34 | ServeError: func(err error) { require.NoError(t, err) }, 35 | }) 36 | require.NoError(t, err) 37 | } 38 | -------------------------------------------------------------------------------- /vdk/logger/rotate_writer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package logger 8 | 9 | import ( 10 | "fmt" 11 | "os" 12 | "sync" 13 | ) 14 | 15 | type rotateWriter struct { 16 | file string 17 | w *os.File 18 | mu sync.Mutex 19 | } 20 | 21 | func (w *rotateWriter) Open() error { 22 | if w.w != nil { 23 | return nil 24 | } 25 | 26 | var err error 27 | w.w, err = os.Create(w.file) 28 | return err 29 | } 30 | 31 | func (w *rotateWriter) Write(b []byte) (int, error) { 32 | w.mu.Lock() 33 | defer w.mu.Unlock() 34 | 35 | err := w.Open() 36 | if err != nil { 37 | return 0, err 38 | } 39 | 40 | return w.w.Write(b) 41 | } 42 | 43 | func (w *rotateWriter) Rotate() { 44 | w.mu.Lock() 45 | defer w.mu.Unlock() 46 | 47 | if w.w == nil { 48 | return 49 | } 50 | 51 | err := w.w.Close() 52 | if err != nil { 53 | _, _ = fmt.Fprintf(os.Stderr, "rotate writer failed to close file: %v\n", err) 54 | } 55 | 56 | w.w = nil 57 | } 58 | -------------------------------------------------------------------------------- /protocol/txid_set.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package protocol 8 | 9 | import ( 10 | "bytes" 11 | 12 | sortutil "gitlab.com/accumulatenetwork/accumulate/internal/util/sort" 13 | "gitlab.com/accumulatenetwork/accumulate/pkg/url" 14 | ) 15 | 16 | func (s *TxIdSet) Add(txid *url.TxID) { 17 | ptr, new := sortutil.BinaryInsert(&s.Entries, func(x *url.TxID) int { 18 | return x.Compare(txid) 19 | }) 20 | if new { 21 | *ptr = txid 22 | } 23 | } 24 | 25 | func (s *TxIdSet) Remove(txid *url.TxID) { 26 | i, found := sortutil.Search(s.Entries, func(x *url.TxID) int { 27 | return x.Compare(txid) 28 | }) 29 | if found { 30 | copy(s.Entries[i:], s.Entries[i+1:]) 31 | s.Entries = s.Entries[:len(s.Entries)-1] 32 | } 33 | } 34 | 35 | func (s *TxIdSet) ContainsHash(hash []byte) bool { 36 | _, found := sortutil.Search(s.Entries, func(x *url.TxID) int { 37 | h := x.Hash() 38 | return bytes.Compare(h[:], hash) 39 | }) 40 | return found 41 | } 42 | -------------------------------------------------------------------------------- /internal/database/schema.yml: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- 2 | # This file is processed by the Accumulate schema generator: 3 | # tools/cmd/gen-schema 4 | # To regenerate schema_gen.go, run: 5 | # go run gitlab.com/accumulatenetwork/accumulate/tools/cmd/gen-schema --package database schema.yml 6 | # DO NOT EDIT schema_gen.go by hand; it is generated from this file. 7 | # -------------------------------------------------------------------------- 8 | $generate: 9 | widgets: true 10 | 11 | methods: 12 | json: true 13 | binary: true 14 | 15 | import: 16 | protocol: gitlab.com/accumulatenetwork/accumulate/protocol 17 | encoding: gitlab.com/accumulatenetwork/accumulate/pkg/types/encoding 18 | 19 | varPrefix: 20 | schema: s 21 | widget: w 22 | 23 | BlockLedger: 24 | class: composite 25 | fields: 26 | - name: Index 27 | type: uint 28 | - name: Time 29 | type: 30 | class: reference 31 | name: time.Time 32 | encode: 33 | withWidget: encoding.TimeWidget 34 | - name: Entries 35 | type: '[]*protocol.BlockEntry' 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 AccumulateNetwork 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /pkg/database/keyvalue/bolt/changeset_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package bolt 8 | 9 | import ( 10 | "path/filepath" 11 | "testing" 12 | 13 | "gitlab.com/accumulatenetwork/accumulate/pkg/database/keyvalue" 14 | "gitlab.com/accumulatenetwork/accumulate/pkg/database/keyvalue/kvtest" 15 | ) 16 | 17 | func open(t *testing.T) kvtest.Opener { 18 | dir := t.TempDir() 19 | return func() (keyvalue.Beginner, error) { 20 | return Open(filepath.Join(dir, "bolt.db"), WithPlainKeys) 21 | } 22 | } 23 | 24 | func TestDatabase(t *testing.T) { 25 | kvtest.TestDatabase(t, open(t)) 26 | } 27 | 28 | func TestIsolation(t *testing.T) { 29 | t.Skip("Deadlocks due to database locks") 30 | kvtest.TestIsolation(t, open(t)) 31 | } 32 | 33 | func TestSubBatch(t *testing.T) { 34 | kvtest.TestSubBatch(t, open(t)) 35 | } 36 | 37 | func TestPrefix(t *testing.T) { 38 | kvtest.TestPrefix(t, open(t)) 39 | } 40 | 41 | func TestDelete(t *testing.T) { 42 | kvtest.TestDelete(t, open(t)) 43 | } 44 | -------------------------------------------------------------------------------- /pkg/types/messaging/enums.yml: -------------------------------------------------------------------------------- 1 | MessageType: 2 | Transaction: 3 | value: 1 4 | description: is a transaction 5 | Signature: 6 | value: 2 7 | description: is a signature 8 | BadSynthetic: 9 | value: 3 10 | description: is deprecated 11 | BlockAnchor: 12 | value: 4 13 | description: is a block anchor signed by validator 14 | Sequenced: 15 | value: 5 16 | description: is a message that is part of a sequence 17 | SignatureRequest: 18 | value: 6 19 | description: is a request for additional signatures 20 | CreditPayment: 21 | value: 7 22 | description: is a payment of credits towards a transaction's fee 23 | BlockSummary: 24 | value: 8 25 | description: is a summary of a block 26 | Synthetic: 27 | value: 9 28 | description: is a message produced by the protocol, requiring proof 29 | NetworkUpdate: 30 | value: 10 31 | description: is an update to network parameters 32 | MakeMajorBlock: 33 | value: 11 34 | description: triggers a major block 35 | DidUpdateExecutorVersion: 36 | value: 12 37 | description: notifies the DN that a BVN updated the executor version 38 | -------------------------------------------------------------------------------- /pkg/api/v3/message/docs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | // Package message defines message types and implements binary message transport 8 | // for Accumulate API v3. 9 | // 10 | // # Message Routing 11 | // 12 | // [RoutedTransport] can be configured to route messages to the appropriate 13 | // network. However, some queries cannot be routed without a routing table. The 14 | // following is an example of how the message client can be initialized with a 15 | // routing table: 16 | // 17 | // router := new(routing.MessageRouter) 18 | // transport := &message.RoutedTransport{ 19 | // Network: "MainNet", 20 | // Dialer: node.DialNetwork(), 21 | // Router: router, 22 | // } 23 | // client := &message.Client{Transport: transport} 24 | // 25 | // ns, err := client.NetworkStatus(ctx, api.NetworkStatusOptions{}) 26 | // if err != nil { panic(err) } 27 | // 28 | // router.Router, err = routing.NewStaticRouter(ns.Routing, nil, nil) 29 | // if err != nil { panic(err) } 30 | package message 31 | -------------------------------------------------------------------------------- /tools/cmd/gen-api/java.tmpl: -------------------------------------------------------------------------------- 1 | /** 2 | GENERATED BY go run ./tools/cmd/gen-api. DO NOT EDIT. 3 | **/ 4 | 5 | package {{.Package}}.generated.apiv2; 6 | 7 | import {{.Package}}.generated.protocol.*; 8 | 9 | public enum RPCMethod { 10 | {{range .Methods}} 11 | {{.Name}} ("{{.RPC}}", {{if eq .Input ""}}null{{else}}{{.Input}}.class{{end}}),{{end}} 12 | ; 13 | 14 | private String apiMethod; 15 | private final Class requestClass; 16 | 17 | RPCMethod(String apiMethod, Class requestClass) { 18 | this.apiMethod = apiMethod; 19 | this.requestClass = requestClass; 20 | } 21 | 22 | public String getApiMethod() { 23 | return apiMethod; 24 | } 25 | 26 | public Class getRequestClass() { 27 | return requestClass; 28 | } 29 | 30 | public static RPCMethod fromClass(final Class aClass) { 31 | for (final var method : values()) { 32 | if (method.requestClass != null && method.requestClass.equals(aClass)) { 33 | return method; 34 | } 35 | } 36 | throw new IllegalArgumentException("No RPC method found for class " + aClass.getName()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /pkg/build/key_page_entry.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package build 8 | 9 | import "gitlab.com/accumulatenetwork/accumulate/protocol" 10 | 11 | type keyPageEntryBuilderArg[T any] interface { 12 | addEntry(protocol.KeySpecParams, []error) T 13 | } 14 | 15 | type KeyPageEntryBuilder[T keyPageEntryBuilderArg[T]] struct { 16 | t T 17 | parser 18 | entry protocol.KeySpecParams 19 | } 20 | 21 | func (b KeyPageEntryBuilder[T]) Owner(owner any, path ...string) KeyPageEntryBuilder[T] { 22 | b.entry.Delegate = b.parseUrl(owner, path...) 23 | return b 24 | } 25 | 26 | func (b KeyPageEntryBuilder[T]) Hash(hash any) KeyPageEntryBuilder[T] { 27 | b.entry.KeyHash = b.parseHash(hash) 28 | return b 29 | } 30 | 31 | func (b KeyPageEntryBuilder[T]) Key(key any, typ protocol.SignatureType) KeyPageEntryBuilder[T] { 32 | b.entry.KeyHash = b.hashKey(b.parseKey(key, typ, false)) 33 | return b 34 | } 35 | 36 | func (b KeyPageEntryBuilder[T]) FinishEntry() T { 37 | return b.t.addEntry(b.entry, b.errs) 38 | } 39 | -------------------------------------------------------------------------------- /protocol/operations.yml: -------------------------------------------------------------------------------- 1 | EnableAccountAuthOperation: 2 | union: { type: accountAuthOperation } 3 | fields: 4 | - name: Authority 5 | description: is the authority to enable authorization for 6 | type: url 7 | pointer: true 8 | 9 | DisableAccountAuthOperation: 10 | union: { type: accountAuthOperation } 11 | fields: 12 | - name: Authority 13 | description: is the authority to enable authorization for 14 | type: url 15 | pointer: true 16 | 17 | AddAccountAuthorityOperation: 18 | union: { type: accountAuthOperation, value: AddAuthority } 19 | fields: 20 | - name: Authority 21 | description: is the authority to add 22 | type: url 23 | pointer: true 24 | 25 | RemoveAccountAuthorityOperation: 26 | union: { type: accountAuthOperation, value: RemoveAuthority } 27 | fields: 28 | - name: Authority 29 | description: is the authority to add 30 | type: url 31 | pointer: true 32 | 33 | PendingTransactionGCOperation: 34 | union: { type: networkMaintenanceOperation, value: pendingTransactionGC } 35 | fields: 36 | - name: Account 37 | description: is the account to collect garbage from 38 | type: url 39 | pointer: true 40 | -------------------------------------------------------------------------------- /.gitlab/common.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - test 3 | 4 | variables: 5 | BOLD_RED: '\e[1;31m' 6 | NO_COLOR: '\e[0m' 7 | SECTION: '\e[0K' 8 | PRODUCTION_IMAGE: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG} 9 | GO_CI_VERSION: '1.22' 10 | GO_CI_IMAGE: ${CI_REGISTRY_IMAGE}/ci-golang:${GO_CI_VERSION} 11 | 12 | build-image:golang: 13 | stage: test 14 | image: docker:20 15 | needs: [] 16 | rules: 17 | - changes: 18 | - .gitlab/**/* 19 | - scripts/images/**/* 20 | services: 21 | - name: docker:20-dind 22 | command: [ --experimental ] # Do we need this? 23 | script: 24 | - docker build -t ${GO_CI_IMAGE} --build-arg VERSION=${GO_CI_VERSION} scripts/images/ci-golang 25 | - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY 26 | - docker push ${GO_CI_IMAGE} 27 | 28 | .go: 29 | stage: test 30 | image: ${GO_CI_IMAGE} 31 | cache: 32 | key: go-mod-cache 33 | paths: 34 | - .go-mod-cache 35 | - .golangci-cache 36 | variables: 37 | GOMODCACHE: ${CI_PROJECT_DIR}/.go-mod-cache 38 | GOLANGCI_LINT_CACHE: ${CI_PROJECT_DIR}/.golangci-cache 39 | 40 | .rules all: 41 | rules: 42 | - if: $CI_PIPELINE_SOURCE != '' -------------------------------------------------------------------------------- /tools/cmd/golangci-lint/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package main 8 | 9 | import ( 10 | "fmt" 11 | "os" 12 | "runtime/debug" 13 | 14 | "github.com/golangci/golangci-lint/pkg/commands" 15 | "github.com/golangci/golangci-lint/pkg/exitcodes" 16 | ) 17 | 18 | var ( 19 | // Populated by goreleaser during build 20 | version = "master" 21 | commit = "?" 22 | date = "" 23 | ) 24 | 25 | func main() { 26 | err := commands.Execute(commands.BuildInfo{ 27 | GoVersion: "go", 28 | Version: version, 29 | Commit: commit, 30 | Date: date, 31 | }) 32 | 33 | if err != nil { 34 | fmt.Fprintf(os.Stderr, "failed executing command with error %v\n", err) 35 | os.Exit(exitcodes.Failure) 36 | } 37 | } 38 | 39 | //nolint:gochecknoinits 40 | func init() { 41 | if info, available := debug.ReadBuildInfo(); available { 42 | if date == "" { 43 | version = info.Main.Version 44 | commit = fmt.Sprintf("(unknown, mod sum: %q)", info.Main.Sum) 45 | date = "(unknown)" 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /pkg/database/keyvalue/overlay/overlay_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package overlay 8 | 9 | import ( 10 | "testing" 11 | 12 | "gitlab.com/accumulatenetwork/accumulate/pkg/database/keyvalue" 13 | "gitlab.com/accumulatenetwork/accumulate/pkg/database/keyvalue/kvtest" 14 | "gitlab.com/accumulatenetwork/accumulate/pkg/database/keyvalue/memory" 15 | ) 16 | 17 | func open(*testing.T) kvtest.Opener { 18 | db := Open(memory.New(nil), memory.New(nil)) 19 | return func() (keyvalue.Beginner, error) { 20 | return db, nil 21 | } 22 | } 23 | 24 | func TestDatabase(t *testing.T) { 25 | kvtest.TestDatabase(t, open(t)) 26 | } 27 | 28 | func TestIsolation(t *testing.T) { 29 | t.Skip("Not supported by the underlying databases") 30 | kvtest.TestIsolation(t, open(t)) 31 | } 32 | 33 | func TestSubBatch(t *testing.T) { 34 | kvtest.TestSubBatch(t, open(t)) 35 | } 36 | 37 | func TestPrefix(t *testing.T) { 38 | kvtest.TestPrefix(t, open(t)) 39 | } 40 | 41 | func TestDelete(t *testing.T) { 42 | kvtest.TestDelete(t, open(t)) 43 | } 44 | -------------------------------------------------------------------------------- /pkg/database/keyvalue/remote/stream.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package remote 8 | 9 | import ( 10 | "bufio" 11 | "encoding/binary" 12 | "io" 13 | 14 | "gitlab.com/accumulatenetwork/accumulate/pkg/errors" 15 | "gitlab.com/accumulatenetwork/accumulate/pkg/types/encoding" 16 | ) 17 | 18 | func read[T any](rd *bufio.Reader, unmarshal func([]byte) (T, error)) (T, error) { 19 | var z T 20 | l, err := binary.ReadUvarint(rd) 21 | if err != nil { 22 | return z, err 23 | } 24 | 25 | b := make([]byte, l) 26 | _, err = io.ReadFull(rd, b) 27 | if err != nil { 28 | return z, err 29 | } 30 | 31 | return unmarshal(b) 32 | } 33 | 34 | func write[T encoding.BinaryValue](wr io.Writer, v T) error { 35 | b, err := v.MarshalBinary() 36 | if err != nil { 37 | return errors.EncodingError.Wrap(err) 38 | } 39 | 40 | var buf [10]byte 41 | n := binary.PutUvarint(buf[:], uint64(len(b))) 42 | _, err = wr.Write(buf[:n]) 43 | if err != nil { 44 | return err 45 | } 46 | 47 | _, err = wr.Write(b) 48 | return err 49 | } 50 | -------------------------------------------------------------------------------- /pkg/types/encoding/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package encoding 8 | 9 | import ( 10 | "crypto/sha256" 11 | "encoding" 12 | "fmt" 13 | "io" 14 | ) 15 | 16 | type Error struct { 17 | E error 18 | } 19 | 20 | func (e Error) Error() string { return e.E.Error() } 21 | func (e Error) Unwrap() error { return e.E } 22 | 23 | type EnumValueGetter interface { 24 | GetEnumValue() uint64 25 | } 26 | 27 | type EnumValueSetter interface { 28 | SetEnumValue(uint64) bool 29 | } 30 | 31 | type BinaryValue interface { 32 | encoding.BinaryMarshaler 33 | encoding.BinaryUnmarshaler 34 | CopyAsInterface() interface{} 35 | UnmarshalBinaryFrom(io.Reader) error 36 | } 37 | 38 | type UnionValue interface { 39 | BinaryValue 40 | UnmarshalFieldsFrom(reader *Reader) error 41 | } 42 | 43 | func Hash(m BinaryValue) [32]byte { 44 | // If this fails something is seriously wrong 45 | b, err := m.MarshalBinary() 46 | if err != nil { 47 | panic(fmt.Errorf("marshaling message: %w", err)) 48 | } 49 | return sha256.Sum256(b) 50 | } 51 | -------------------------------------------------------------------------------- /pkg/database/keyvalue/badger/v2_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Accumulate Authors 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file or at 5 | // https://opensource.org/licenses/MIT. 6 | 7 | package badger 8 | 9 | import ( 10 | "testing" 11 | 12 | "gitlab.com/accumulatenetwork/accumulate/pkg/database/keyvalue" 13 | "gitlab.com/accumulatenetwork/accumulate/pkg/database/keyvalue/kvtest" 14 | ) 15 | 16 | func BenchmarkV2Commit(b *testing.B) { 17 | kvtest.BenchmarkCommit(b, newOpenerV2(b)) 18 | } 19 | 20 | func BenchmarkV2ReadRandom(b *testing.B) { 21 | kvtest.BenchmarkReadRandom(b, newOpenerV2(b)) 22 | } 23 | 24 | func TestV2Database(t *testing.T) { 25 | kvtest.TestDatabase(t, newOpenerV2(t)) 26 | } 27 | 28 | func TestV2SubBatch(t *testing.T) { 29 | kvtest.TestSubBatch(t, newOpenerV2(t)) 30 | } 31 | 32 | func TestV2Prefix(t *testing.T) { 33 | kvtest.TestPrefix(t, newOpenerV2(t)) 34 | } 35 | 36 | func TestV2Delete(t *testing.T) { 37 | kvtest.TestDelete(t, newOpenerV2(t)) 38 | } 39 | 40 | func newOpenerV2(t testing.TB) kvtest.Opener { 41 | path := t.TempDir() 42 | return func() (keyvalue.Beginner, error) { 43 | return OpenV2(path) 44 | } 45 | } 46 | --------------------------------------------------------------------------------