Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1774 commits
Select commit Hold shift + click to select a range
e5066a0
fix tests
zhangchiqing Aug 15, 2025
25df43b
Merge branch 'leo/dbops-follower' into jord/pebble/add-lockctx
zhangchiqing Aug 15, 2025
f42133f
Merge branch 'jord/pebble/add-lockctx' into leo/deferred-dbops
zhangchiqing Aug 15, 2025
b761725
fix: add nolint:govet comment to suppress copylocks warning in test mock
zhangchiqing Aug 15, 2025
63c554c
Merge branch 'leo/deferred-dbops' into leo/dbops-collection-cluster
zhangchiqing Aug 15, 2025
00ebc6d
Merge branch 'jord/pebble/add-lockctx' into leo/util-support-both-bad…
zhangchiqing Aug 15, 2025
ac729ab
Merge branch 'leo/dbops-collection-cluster' into leo/add-block-view-i…
zhangchiqing Aug 15, 2025
ec31dba
Merge branch 'master' into gregor/callbacks/04-contract-integration
janezpodhostnik Aug 15, 2025
51a91be
fix light collections issue
zhangchiqing Aug 15, 2025
2240fb8
fix storing collection
zhangchiqing Aug 15, 2025
6de29ec
refactor unsynchronized collections
zhangchiqing Aug 15, 2025
922d5c6
fix tests
zhangchiqing Aug 15, 2025
7a847c9
fix tests
zhangchiqing Aug 15, 2025
238be42
Merge branch 'master' into fxamacker/rename-public-key-count-in-accou…
fxamacker Aug 15, 2025
21f7a67
fix store collections
zhangchiqing Aug 15, 2025
74413b8
remove locks
zhangchiqing Aug 15, 2025
38482a1
remove commits.Store
zhangchiqing Aug 15, 2025
3adc66b
commits.BatchStore check consistent
zhangchiqing Aug 15, 2025
ca84bf8
fix tests
zhangchiqing Aug 15, 2025
f039a7b
remove chained
zhangchiqing Aug 16, 2025
b8a5334
fix lint
zhangchiqing Aug 16, 2025
8378662
extended, refined goDoc
AlexHentschel Aug 16, 2025
7a5f2e8
Merge branch 'jord/pebble/add-lockctx' of github.com:onflow/flow-go i…
AlexHentschel Aug 16, 2025
93c3f30
extended, refined goDoc
AlexHentschel Aug 16, 2025
45cb259
extended, refined goDoc
AlexHentschel Aug 16, 2025
667e6b3
extended, refined goDoc
AlexHentschel Aug 16, 2025
51265d7
add duplicate check in header
zhangchiqing Aug 18, 2025
148fd6f
fix tests
zhangchiqing Aug 18, 2025
62c3f69
fix tests and badger cluster state
zhangchiqing Aug 18, 2025
5cc06ba
add locking to index new block
zhangchiqing Aug 18, 2025
ed6cbcf
fix tests
zhangchiqing Aug 18, 2025
c3ce620
fix lint
zhangchiqing Aug 18, 2025
0977d9a
Add flag for setting directory for vote file
sjonpaulbrown Aug 18, 2025
5c46ceb
Update push-root-block-vote to leverage new flag
sjonpaulbrown Aug 18, 2025
83cb0a5
Update unWrapFile function to support input & output paths
sjonpaulbrown Aug 18, 2025
ab828a7
add locking to update children
zhangchiqing Aug 18, 2025
66518b2
Update test to use updated unWrapFile function args
sjonpaulbrown Aug 18, 2025
c6820c2
Add new flag variables
sjonpaulbrown Aug 18, 2025
36ba131
Add new flag to generate-root-block-vote command for setting output d…
sjonpaulbrown Aug 18, 2025
f81b9a4
Update generate-root-block-vote to conditionally use output directory…
sjonpaulbrown Aug 18, 2025
2558290
Update unWrapFile usage in pull to leverage new function args
sjonpaulbrown Aug 18, 2025
357aa8f
Add new output directory flag to pull-root-block command
sjonpaulbrown Aug 18, 2025
01695ab
Update pull-root-block command to conditionally use output directory …
sjonpaulbrown Aug 18, 2025
fc98798
update indexing cluster payload
zhangchiqing Aug 18, 2025
6b7d626
fix test case
zhangchiqing Aug 18, 2025
a031950
refactor height indexing
zhangchiqing Aug 18, 2025
12675f6
fix lint
zhangchiqing Aug 18, 2025
d02ffd0
Merge branch 'master' into sre/jp/703/add-folder-config-to-transit
sjonpaulbrown Aug 18, 2025
50484ad
Merge branch 'leo/add-block-view-index' into leo/refactor-storing-col…
zhangchiqing Aug 18, 2025
06c29c0
Merge branch 'leo/refactor-storing-collection' into leo/dbops-unique-…
zhangchiqing Aug 18, 2025
97fdfcb
fix assertion
turbolent Aug 18, 2025
ef46295
Merge pull request #7735 from onflow/bastian/update-cadence-v1.7.0-pr…
turbolent Aug 18, 2025
6c6b42c
• extended, refined goDoc
AlexHentschel Aug 18, 2025
9f8acdf
minor extension of goDoc
AlexHentschel Aug 18, 2025
5e6b71b
Apply suggestions from code review
sjonpaulbrown Aug 18, 2025
670b3fd
Merge branch 'master' into sre/jp/703/add-folder-config-to-transit
sjonpaulbrown Aug 18, 2025
c0f316d
Merge pull request #7364 from onflow/jord/pebble/add-lockctx
zhangchiqing Aug 18, 2025
d62968e
Merge branch 'leo/dbops-follower' into leo/deferred-dbops
zhangchiqing Aug 18, 2025
fe275cc
extended & refined goDoc
AlexHentschel Aug 19, 2025
379e6c1
rename to InsertQuorumCertificate
zhangchiqing Aug 19, 2025
bf663e3
Merge branch 'leo/deferred-dbops' of github.com:onflow/flow-go into l…
AlexHentschel Aug 19, 2025
e8cacab
extended & refined goDoc
AlexHentschel Aug 19, 2025
4554199
refined `storage/store/approvals_test.go` so both go-routines attempt…
AlexHentschel Aug 19, 2025
9da49a5
extended & refined goDoc
AlexHentschel Aug 19, 2025
a5b418e
changed `expectedApproval` to atomic in test `engine/verification/ver…
AlexHentschel Aug 19, 2025
a2ce7a1
extended & refined goDoc
AlexHentschel Aug 19, 2025
32817d4
added test to `storage/store/qcs_test.go` which verifies that BatchSt…
AlexHentschel Aug 19, 2025
9091a1e
extended & refined goDoc
AlexHentschel Aug 19, 2025
7e0e6ed
removed ambiguity and discrepancy from the documentation of `QuorumCe…
AlexHentschel Aug 19, 2025
0360bd7
Update to Cadence v1.7.0-preview.1
turbolent Aug 19, 2025
e5573f5
Update CI workflow to remove unneeded environment check
sjonpaulbrown Aug 19, 2025
ea886ba
Merge pull request #7746 from onflow/auto-update-onflow-cadence-v1.7.…
turbolent Aug 19, 2025
2abba86
Add suggestions that include improvements to comments and flags
sjonpaulbrown Aug 19, 2025
6271495
removed repeated instantiation of LockManagers within the _same_ tests
AlexHentschel Aug 19, 2025
73b65ae
Address issues with pull-root-block & generate-root-block-vote
sjonpaulbrown Aug 19, 2025
56682fe
• extended & refined goDoc;
AlexHentschel Aug 19, 2025
d2848ec
Merge branch 'master' into sre/jp/remove-unnecessary-env-check
sjonpaulbrown Aug 20, 2025
74c199e
Merge pull request #7693 from onflow/fxamacker/rename-public-key-coun…
fxamacker Aug 20, 2025
c77a184
Merge branch 'master' into sre/jp/remove-unnecessary-env-check
sjonpaulbrown Aug 20, 2025
41f94d6
add missing lock
zhangchiqing Aug 20, 2025
c1a397e
remove duplicated locks functions
zhangchiqing Aug 20, 2025
6cf3932
Merge branch 'leo/deferred-dbops' into leo/dbops-collection-cluster
zhangchiqing Aug 20, 2025
5318410
fix lint
zhangchiqing Aug 20, 2025
66fdb3e
fix pebble migration tests
zhangchiqing Aug 20, 2025
3f08635
Merge branch 'leo/dbops-collection-cluster' into leo/add-block-view-i…
zhangchiqing Aug 20, 2025
59b951f
Merge branch 'leo/add-block-view-index' into leo/refactor-storing-col…
zhangchiqing Aug 20, 2025
527a74e
Merge branch 'leo/refactor-storing-collection' into leo/dbops-unique-…
zhangchiqing Aug 20, 2025
7ecbb63
resolve lock manager
zhangchiqing Aug 20, 2025
6eacaf0
Merge branch 'master' into sre/jp/703/add-folder-config-to-transit
sjonpaulbrown Aug 20, 2025
6ae3e92
fix the usage of lock manager
zhangchiqing Aug 20, 2025
aa41dbc
fix lock manager usage
zhangchiqing Aug 20, 2025
cc410b0
address review comments
zhangchiqing Aug 20, 2025
a712d75
Merge branch 'leo/refactor-storing-collection' into leo/dbops-unique-…
zhangchiqing Aug 20, 2025
263167e
refactor lock manager usage
zhangchiqing Aug 20, 2025
4d7b119
• extended & refined goDoc;
AlexHentschel Aug 21, 2025
618a866
clarified source of the error.
AlexHentschel Aug 21, 2025
1b4217d
godoc: improved punctuation and marginal polishing
AlexHentschel Aug 21, 2025
ce7dc3e
Merge pull request #7609 from onflow/leo/deferred-dbops
zhangchiqing Aug 21, 2025
bbbae0d
Merge branch 'leo/dbops-follower' into leo/dbops-collection-cluster
zhangchiqing Aug 21, 2025
ca3981d
Merge remote-tracking branch 'origin/leo/dbops-collection-cluster' in…
zhangchiqing Aug 21, 2025
af8d48c
address review comments
zhangchiqing Aug 21, 2025
c8e5cc4
Merge pull request #7734 from onflow/sre/jp/703/add-folder-config-to-…
sjonpaulbrown Aug 21, 2025
613f430
logging failure to download random beacon key as fatal instead of inf…
vishalchangrani Aug 22, 2025
07efacd
minor revisions of goDoc
AlexHentschel Aug 22, 2025
64228dd
Update cmd/bootstrap/transit/cmd/pull_root_block.go
vishalchangrani Aug 22, 2025
87069a1
revisions of goDoc and applied already a couple review comments.
AlexHentschel Aug 22, 2025
d5efd0d
applied already review comment
AlexHentschel Aug 22, 2025
50e4ed7
cleanup
AlexHentschel Aug 22, 2025
e74759c
Merge branch 'master' into peter/custom-lint-target
peterargue Aug 22, 2025
86f8ac6
Merge pull request #7727 from onflow/peter/custom-lint-target
peterargue Aug 22, 2025
7835549
Merge pull request #7757 from onflow/vishal/transit_script_update
vishalchangrani Aug 22, 2025
ccbed6a
Merge branch 'master' into sre/jp/remove-unnecessary-env-check
sjonpaulbrown Aug 22, 2025
280591d
Merge pull request #7747 from onflow/sre/jp/remove-unnecessary-env-check
sjonpaulbrown Aug 22, 2025
c23f43c
Merge branch 'leo/dbops-follower' into leo/util-support-both-badger-p…
zhangchiqing Aug 22, 2025
acb9756
goDoc revisions and extensions
AlexHentschel Aug 22, 2025
b31be14
goDoc revisions and extensions
AlexHentschel Aug 22, 2025
1d272df
extended test `storage/procedure/cluster_test.go` to cover check beha…
AlexHentschel Aug 22, 2025
6ceb21e
remove transaction store from persister
zhangchiqing Aug 22, 2025
481a074
Merge branch 'leo/refactor-storing-collection' into leo/dbops-unique-…
zhangchiqing Aug 22, 2025
50409e1
Fix bugs in transit generate and pull-root-block
sjonpaulbrown Aug 22, 2025
a4f5091
refactor locks in BatchStoreAndIndexByTransaction
zhangchiqing Aug 22, 2025
b0ba0e9
address review comments
zhangchiqing Aug 22, 2025
aff02a2
address review comments
zhangchiqing Aug 22, 2025
7d7a389
removed repeated instantiation of LockManagers within the _same_ tests
AlexHentschel Aug 22, 2025
67c8ff9
improve error handling in commits
zhangchiqing Aug 23, 2025
4bf995b
fix lock manager usage
zhangchiqing Aug 23, 2025
b03bf96
• condensed implementation (removed unnecessary wrappers of very shor…
AlexHentschel Aug 23, 2025
5723cfa
minor linting (organized inputs in one test and removed bloating whit…
AlexHentschel Aug 23, 2025
1013553
revised documentation of method `ParticipantState.checkOutdatedExtens…
AlexHentschel Aug 23, 2025
9528baf
improved specificity regarding the handling of orphaned blocks in the…
AlexHentschel Aug 23, 2025
b9f7887
Merge pull request #7762 from onflow/sre/jp/update-transit
vishalchangrani Aug 23, 2025
fb40d3c
fixed my documentation of concurrency limitations of `ParticipantStat…
AlexHentschel Aug 23, 2025
b495191
Merge branch 'leo/dbops-collection-cluster' into leo/add-block-view-i…
AlexHentschel Aug 23, 2025
561c90e
fixing tests
AlexHentschel Aug 23, 2025
c89a16f
minor cleanup: removing bloating white spaces
AlexHentschel Aug 24, 2025
139f0e0
minor polishing of test documentation and code clarity
AlexHentschel Aug 24, 2025
eeecb44
minor refinement of mutator docs
AlexHentschel Aug 24, 2025
7e9e63c
reduced probability for subtle flakey tests (tests running indefinite…
AlexHentschel Aug 24, 2025
d8dbf0f
constrained usage of `BlockWithParentFixtureAndUniqueView` or `BlockW…
AlexHentschel Aug 24, 2025
54001f7
fixed tests
AlexHentschel Aug 24, 2025
7c9059f
minor polishing of comments
AlexHentschel Aug 24, 2025
0ee2441
minor polishing of comments
AlexHentschel Aug 24, 2025
b3561f9
• deduplicated storage codes `storage/badger/operation/prefix.go` and…
AlexHentschel Aug 24, 2025
ed685f6
removed storage codes that were specified for both pebble (file `stor…
AlexHentschel Aug 24, 2025
45cf22e
Review changes
devbugging Aug 25, 2025
93a53bc
Merge branch 'master' into gregor/callbacks/04-contract-integration
devbugging Aug 25, 2025
12a1c88
Update core contracts to temp latest
devbugging Aug 25, 2025
3e91944
Update changes in the scheduled contract
devbugging Aug 25, 2025
063ee87
refactor with multierror
zhangchiqing Aug 25, 2025
3774cf3
rename to EnsureBadgerFolder
zhangchiqing Aug 25, 2025
9c94c59
add pebble.SafeOpen
zhangchiqing Aug 25, 2025
23b31b5
fix pebble version
zhangchiqing Aug 25, 2025
53d8ece
fix IsPebbleFolder method
zhangchiqing Aug 25, 2025
df9cad0
update mocks
zhangchiqing Aug 25, 2025
99a1cb0
add should open pebble test
zhangchiqing Aug 25, 2025
5779ed3
Merge pull request #7469 from onflow/leo/util-support-both-badger-pebble
zhangchiqing Aug 25, 2025
e4cc9b3
Update a change in the contracts evn
devbugging Aug 25, 2025
09ced90
Merge branch 'leo/dbops-follower' into leo/dbops-collection-cluster
zhangchiqing Aug 25, 2025
5f56510
fix lint
zhangchiqing Aug 25, 2025
51ff6f6
Update to latest scheduler contracts
devbugging Aug 25, 2025
3a6aa5f
Lint fix
devbugging Aug 25, 2025
c06dfb6
Merge pull request #7452 from onflow/leo/dbops-collection-cluster
zhangchiqing Aug 25, 2025
3c0df29
Merge pull request #7579 from devbugging/gregor/callbacks/04-contract…
janezpodhostnik Aug 25, 2025
660ff31
Merge branch 'leo/dbops-follower' into leo/add-block-view-index
zhangchiqing Aug 25, 2025
8978d84
fix for-loop
zhangchiqing Aug 25, 2025
9eaa018
Merge branch 'leo/add-block-view-index' into leo/refactor-storing-col…
zhangchiqing Aug 25, 2025
027e7b5
Merge branch 'leo/refactor-storing-collection' into leo/dbops-unique-…
zhangchiqing Aug 25, 2025
0fe2897
fix tests
zhangchiqing Aug 25, 2025
96b8b0d
Merge pull request #6933 from onflow/leo/add-block-view-index
zhangchiqing Aug 25, 2025
dd64b36
fix cluster test
zhangchiqing Aug 25, 2025
eb3f30a
Merge branch 'master' into leo/dbops-follower
zhangchiqing Aug 25, 2025
192a0ea
Merge branch 'leo/dbops-follower' into leo/refactor-storing-collection
zhangchiqing Aug 25, 2025
d0f792c
Merge branch 'leo/refactor-storing-collection' into leo/dbops-unique-…
zhangchiqing Aug 25, 2025
a91396b
update chdp config default
zhangchiqing Aug 25, 2025
e2eb602
add commits back
zhangchiqing Aug 26, 2025
feb9526
• removed repeated instantiation of testing lock manager within the s…
AlexHentschel Aug 26, 2025
e55e55d
remove the badgerpebble migration
zhangchiqing Aug 26, 2025
00837a0
remove Acquiring LockInsertBlock when inserting cluster block
zhangchiqing Aug 26, 2025
09ed4ee
Merge branch 'leo/refactor-storing-collection' into leo/dbops-unique-…
zhangchiqing Aug 26, 2025
0376824
add comments for UpdateExecutedBlock
zhangchiqing Aug 26, 2025
2ac7eb9
remove lock manager from persister
zhangchiqing Aug 26, 2025
7c8320c
remove lock manager from persister
zhangchiqing Aug 26, 2025
95d5561
remove comments
zhangchiqing Aug 26, 2025
5f46501
Merge branch 'leo/refactor-storing-collection' into leo/dbops-unique-…
zhangchiqing Aug 26, 2025
5e5a24d
extended and polished goDoc of low-level storage operations:
AlexHentschel Aug 26, 2025
81d9bd2
Merge branch 'leo/dbops-unique-checks' of github.com:onflow/flow-go i…
AlexHentschel Aug 26, 2025
bef5194
refactor lock usage in in memory indexer test
zhangchiqing Aug 26, 2025
e095614
add lockManager to InitProtocolState
zhangchiqing Aug 26, 2025
8b3dc30
refactor NewTestingLockManager in tests
zhangchiqing Aug 26, 2025
043eb91
refactor NewTestingLockManager in tests
zhangchiqing Aug 26, 2025
d4721ed
refactor NewTestingLockManager in tests
zhangchiqing Aug 26, 2025
2cdc0c3
fix lint
zhangchiqing Aug 26, 2025
f151a25
fix lint
zhangchiqing Aug 26, 2025
c0dc443
moving NewContext outside of WithReaderBatchWriter
zhangchiqing Aug 26, 2025
f4ad9c9
remove duplicated NewTestingLockManager
zhangchiqing Aug 26, 2025
c1432c6
remove duplicated lock manager
zhangchiqing Aug 26, 2025
458c3b7
Merge branch 'feature/pebble' into leo/dbops-follower
zhangchiqing Aug 26, 2025
63dac5e
Merge branch 'leo/dbops-follower' into leo/refactor-storing-collection
zhangchiqing Aug 26, 2025
2819527
Merge branch 'leo/refactor-storing-collection' into leo/dbops-unique-…
zhangchiqing Aug 26, 2025
50263dd
Merge branch 'leo/dbops-unique-checks' of github.com:onflow/flow-go i…
AlexHentschel Aug 26, 2025
9d08f29
Merge pull request #7262 from onflow/leo/dbops-follower
zhangchiqing Aug 26, 2025
987be96
• fixed tests that were acquiring incorrect or to many storage locks;
AlexHentschel Aug 27, 2025
bcc975a
• renamed variable in `module/finalizer/consensus/finalizer_test.go` …
AlexHentschel Aug 27, 2025
2f28d08
Merge branch 'feature/pebble' into leo/refactor-storing-collection
zhangchiqing Aug 27, 2025
561ead1
fix block persisters
zhangchiqing Aug 27, 2025
8153091
Merge pull request #7736 from onflow/leo/refactor-storing-collection
zhangchiqing Aug 27, 2025
f6a16bc
Merge branch 'feature/pebble' into leo/dbops-unique-checks
zhangchiqing Aug 27, 2025
1429862
Merge branch 'leo/dbops-unique-checks' of github.com:onflow/flow-go i…
AlexHentschel Aug 27, 2025
bac0d59
fix lock in rollback executed height
zhangchiqing Aug 27, 2025
f9aa700
fix dead lock in storage
zhangchiqing Aug 27, 2025
7e475e1
refactor IndexCertifiedViewByBlockID
zhangchiqing Aug 27, 2025
d025001
Merge branch 'leo/dbops-unique-checks' of github.com:onflow/flow-go i…
AlexHentschel Aug 27, 2025
7637150
Merge branch 'leo/dbops-unique-checks' into leo/refactor-testing-lock…
zhangchiqing Aug 27, 2025
8d19070
extension of storage methods; useful as example for AI to generate do…
AlexHentschel Aug 28, 2025
b748cd0
Large batch of goDoc extensions and revisions for the low-level stora…
AlexHentschel Aug 28, 2025
718a45f
Extension and polishing of goDoc for the low-level storage operations…
AlexHentschel Aug 28, 2025
402b661
Merge branch 'leo/dbops-unique-checks' into leo/refactor-testing-lock…
zhangchiqing Aug 28, 2025
880899e
refactor withLock with unittest.WithLock
zhangchiqing Aug 28, 2025
224891d
refactor lock usage
zhangchiqing Aug 28, 2025
715f8c9
fix lock usage
zhangchiqing Aug 28, 2025
861dc15
fix deadlock in tests
zhangchiqing Aug 28, 2025
eb97607
fix dead lock in tests
zhangchiqing Aug 28, 2025
fc9fd63
reverted incorrect variable renaming
AlexHentschel Aug 28, 2025
7c9d753
minor test cleanup:
AlexHentschel Aug 29, 2025
c2d98e2
minor test cleanup:
AlexHentschel Aug 29, 2025
7e6eeac
moved lock manager right next to database for better visibility
AlexHentschel Aug 29, 2025
dd40df7
moved lock manager right next to database for better visibility
AlexHentschel Aug 29, 2025
939b1ee
fix duplicated TestLockManager in indexer_core_test.go
zhangchiqing Aug 29, 2025
fa13a3f
renaming into common.OpenProtocolState
zhangchiqing Aug 29, 2025
a287d08
Merge pull request #7773 from onflow/leo/refactor-testing-lock-manage…
zhangchiqing Aug 29, 2025
56023c4
Merge pull request #7741 from onflow/leo/dbops-unique-checks
zhangchiqing Aug 29, 2025
de837a6
Revert "Merge pull request #7631 from onflow/devin/1753461163-remove-…
jordanschalm Sep 2, 2025
ff0f9d7
fix lint
zhangchiqing Sep 2, 2025
b7fb8e3
Revert "Merge pull request #7635 from onflow/devin/1753718157-remove-…
jordanschalm Sep 2, 2025
6577401
make tidy
jordanschalm Sep 2, 2025
82f1e69
Merge branch 'jord/v0.42.4-pebble.0--with-7631-reverted' of github.co…
jordanschalm Sep 2, 2025
9e53a97
Merge pull request #7808 from onflow/jord/v0.42.4-pebble.0--with-7631…
zhangchiqing Sep 2, 2025
48540ad
revert cadence to v1.6.5
zhangchiqing Sep 2, 2025
0f79128
revert fvm changes
zhangchiqing Sep 2, 2025
b52ae85
revert cadence version for integration
zhangchiqing Sep 2, 2025
cc32fc4
revert go sdk
zhangchiqing Sep 3, 2025
4ab243d
update go mod
zhangchiqing Sep 3, 2025
630b6bd
update go sdk
zhangchiqing Sep 3, 2025
ba0cdc5
revert execution state change
zhangchiqing Sep 4, 2025
9cf65cb
change cadence version to v1.6.4-rc.1-public
zhangchiqing Sep 4, 2025
1b6d064
Merge branch 'feature/pebble' into leo/v0.42.4-revert-cadence.1.7.0
zhangchiqing Sep 4, 2025
458addf
Backfill blocks on mainnet26 AN1
peterargue Oct 22, 2025
7a0b338
always accept blocks
peterargue Oct 22, 2025
c507cf2
increase log level
peterargue Oct 22, 2025
0f44dc3
allow ENs to responde to sync requests
peterargue Oct 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Empty file added .cursor/rules/.gitkeep
Empty file.
317 changes: 317 additions & 0 deletions .cursor/rules/coding_conventions.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,317 @@
---
description: Coding Conventions
globs: *.go
alwaysApply: false
---
# Coding Conventions

## High-Assurance Software Engineering Principles

Flow is a high-assurance software project where the cost of bugs that slip through can be catastrophically high. We consider all inputs to be potentially byzantine. This fundamentally shapes our approach to error handling and code correctness:

### Inversion of Default Safety Assumptions
- Traditional software engineering often assumes code paths are safe unless proven dangerous
- In Flow, we invert this: **no code path is considered safe unless explicitly proven and documented to be safe**
- The mere absence of known failure cases is NOT sufficient evidence of safety
- We require conclusive arguments for why each code path will always behave correctly

### Context-Dependent Error Classification

A critical rule in Flow's error handling is that **the same error type can be benign in one context but an exception in another**. Error classification depends on the caller's context, not the error's type.

Key principles:
- An error type alone CANNOT determine whether it's benign or an exception
- The caller's context and expectations determine the error's severity
- The same error type may be handled differently in different contexts
- Documentation *must* specify which errors are benign in which contexts

Example of context-dependent error handling, where `storage.ErrNotFound` is _benign_:
```go
// We're checking if we need to request a block from another node
//
// No Expected errors during normal operations.
func (s *Synchronizer) checkBlockExists(blockID flow.Identifier) error {
_, err := s.storage.ByBlockID(blockID)
if errors.Is(err, storage.ErrNotFound) {
// Expected during normal operation - request block from peer.
return s.requestBlockFromPeer(blockID) // Expecting no errors from this call under normal operations
}
if err != nil {
// Other storage errors are unexpected
return fmt.Errorf("unexpected storage error: %w", err)
}
return nil
}
```

However, in this context, the same `storage.ErrNotFound` is not expected during normal operations (we term unexpected errors as "exceptions"):
```go
// We're trying to read a block we know was finalized
//
// No Expected errors during normal operations.
func (s *State) GetFinalizedBlock(height uint64) (*flow.Block, error) {
blockID, err := s.storage.FinalizedBlockID(height)
if err != nil {
return nil, fmt.Errorf("could not get finalized block ID: %w", err)
}

// At this point, we KNOW the block should exist
block, err := s.storage.ByBlockID(blockID)
if err != nil {
// Any error here (including ErrNotFound) indicates a bug or corruption
return nil, irrecoverable.NewExceptionf(
"storage corrupted - failed to get finalized block %v: %w",
blockID, err)
}
return block, nil
}
```

### Rules for Error Classification

1. **Documentation Requirements**
- Functions MUST document which error types are benign in their context
- Documentation MUST explain WHY an error is considered benign
- Absence of documentation means an error is treated as an exception

2. **Error Propagation**
- When propagating errors, evaluate if they remain benign in the new context
- If a benign error from a lower layer indicates a critical failure in your context, wrap it as an exception
- Use `irrecoverable.NewExceptionf` when elevating a benign error to an exception

3. **Testing Requirements**
- Tests MUST verify error handling in different contexts
- Test that benign errors in one context are properly elevated to exceptions in another
- Mock dependencies to test both benign and exceptional paths

### Error Handling Philosophy
- All errors are considered potentially fatal by default
- Only explicitly documented benign errors are safe to recover from
- For any undocumented error case, we must assume the execution state is corrupted
- Recovery from undocumented errors requires node restart from last known safe state
- This conservative approach prioritizes safety over continuous operation

Example of proper high-assurance error handling:
```go
func (e *engine) process(event interface{}) error {
// Step 1: type checking of input
switch v := event.(type) {
case *ValidEvent:
// explicitly documented safe path
return e.handleValidEvent(v)
default:
// undocumented event type - unsafe to proceed
return fmt.Errorf("unexpected event type %T: %w", event, ErrInvalidEventType)
}
}

func (e *engine) Submit(event interface{}) {
err := e.process(event)
if errors.Is(err, ErrInvalidEventType) {
// This is a documented benign error - safe to handle
metrics.InvalidEventsCounter.Inc()
return
}
if err != nil {
// Any other error is potentially fatal
// We cannot prove it's safe to continue
e.log.Fatal().Err(err).Msg("potentially corrupted state - must restart")
return
}
}
```

## 1. Code Documentation
- Every interface must have clear documentation
- Copy and extend interface documentation in implementations
- Include clear explanations for any deviations from conventions
- Document all public functions individually
- Document error handling strategies and expected error types

Example of proper error documentation:
```go
// foo does abc.
// Expected errors during normal operations:
// - ErrXFailed: if x failed
func foo() err {
...
return fmt.Errorf("details about failure: %w", ErrXFailed)
}
```

## 2. Code Structure
- Follow the component-based architecture
- Each component must implement the `Component` interface
- Clearly differentiate between trusted (internal) and untrusted (external) inputs
- Components should have dedicated worker pools
- Proper resource management with worker limits
- Proper state management and recovery

## 3. Error Categories and Handling Philosophy

### a. Benign Errors
- Component remains fully functional despite the error
- Expected during normal operations
- Must be handled within the component
- Must be documented in the component's context
- Must be represented as typed sentinel errors
- Cannot be represented by generic/untyped errors unless explicitly documented as an optional simplification for components that solely return benign errors

Example of proper benign error handling:
```go
// Expected errors during normal operations:
// * ErrXFailed: if x failed
func benignErrorExample() error {
err := foo()
if err != nil {
return fmt.Errorf("failed to do foo: %w", err)
}
return nil
}
```

### b. Exceptions
- Potential symptoms of internal state corruption
- Unexpected failures that may compromise component state
- Should lead to component restart or node termination
- Strongly encouraged to wrap with context when bubbling up

Example of proper exception handling:
```go
err := foo()
if errors.Is(err, XFailedErr) {
// expected error
return
}
if err != nil {
log.Fatal().Err(err).Msg("unexpected internal error")
return
}
```

### c. Sentinel Error Requirements
- Must be properly typed
- Must be documented in GoDoc
- Must avoid generic error formats
- Must always wrap with context when bubbling up the call stack
- Must document all expected error types
- Must handle at the appropriate level where context is available
- Must use proper error wrapping for stack traces

Example of proper sentinel error definition and usage:
```go
ErrXFailed := errors.New("x failed")

// bar does ...
// Expected error returns during normal operations:
// * XFailedErr: if x failed
func bar() err {
...
err := foo()
if err != nil {
return fmt.Errorf("failed to do foo: %w", err)
}
...
}
```

## 4. Additional Best Practices
- Prioritize safety over liveness
- Don't continue on "best-effort" basis when encountering unexpected errors
- Testing Error Handling:
- Test both benign error cases and exceptions
- Must verify that documented sentinel errors are returned in their specified situations
- Must verify that unexpected errors (exceptions) from lower layers or their mocks are not misinterpreted as benign errors
- Verify proper error propagation
- Test component recovery from errors
- Validate error handling in both trusted and untrusted contexts

Example of proper error handling in components:
```go
func (e *engine) process(event interface{}) error {
switch v := event.(type) {
...
default:
return fmt.Errorf("invalid input type %T: %w", event, InvalidMessageType)
}
}

func (e *engine) Process(chan network.Channel, originID flow.Identifier, event interface{}) error {
err := e.process(event)
if err != nil {
if errors.Is(err, InvalidMessageType) {
// this is EXPECTED during normal operations
}
// this is unexpected during normal operations
e.log.Fatal().Err(err).Msg("unexpected internal error")
}
}

func (e *engine) ProcessLocal(event interface{}) {
err := e.process(event)
if err != nil {
if errors.Is(err, InvalidMessageType) {
// this is a CRITICAL BUG
}
// this is unexpected during normal operations
e.log.Fatal().Err(err).Msg("unexpected internal error")
}
}
```

## 5. Anti-patterns to Avoid
- Don't use generic error logging without proper handling
- Don't swallow errors silently
- Don't continue execution after unexpected errors
- Don't use untyped errors unless explicitly documented as benign

Example of an anti-pattern to avoid:
```go
// DON'T DO THIS:
err := foo()
if err != nil {
log.Error().Err(err).Msg("foo failed")
return
}
```

Instead, implement proper error handling:
```go
func (e *engine) Submit(chan network.Channel, originID flow.Identifier, event interface{}) {
e.unit.Launch(func() {
err := e.process(event)
if errors.Is(err, InvalidMessageType) {
// invalid input: ignore or slash
return
}
if err != nil {
// unexpected input: for now we prioritize safety over liveness and just crash
// TODO: restart engine from known good state
e.log.Fatal().Err(err).Msg("unexpected internal error")
}
})
}
```

## 6. Security Considerations
- Treat all external inputs as potentially byzantine
- Handle byzantine inputs gracefully
- Prevent state corruption from malicious inputs
- Use proper error types for security-related issues

Example of handling untrusted inputs:
```go
func (e *engine) Submit(event interface{}) {
e.unit.Launch(func() {
err := e.process(event)
if errors.Is(err, InvalidMessageType) {
// invalid input from external source: ignore or slash
return
}
if err != nil {
// unexpected input: prioritize safety over liveness
e.log.Fatal().Err(err).Msg("unexpected internal error")
}
})
}
```
45 changes: 45 additions & 0 deletions .cursor/rules/core.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
description: Cursor Operational Doctrine
globs:
alwaysApply: true
---
# Cursor Operational Doctrine

You are an AI with extensive expertise in byzantine-fault-tolerant, distributed software engineering. You will consider scalability, reliability, maintainability, and security in your recommendations.

You are working in a pair-programming setting with a senior engineer. Their time is valuable, so work time-efficiently. They prefer an iterative working style, where you take one step at a time, confirm the direction is correct and then proceed.
Critically reflect on your work. Ask if you are not sure. Avoid confirmation bias - speak up (short and concisely reasoning, followed by tangible suggestions) if something should be changed or approached differently in your opinion.

## Primary directive

Your peer's instructions, questions, requests **always** take precedence over any general rules (such as the ones below).

## Interactions with your peer
- Never use apologies.
- Acknowledge if you missunderstood something, and concisely summarize what you have learned.
- Only when explicitly requested, provide feedback about your understanding of comments, documentation, code
- Don't show or discuss the current implementation unless specifically requested.
- State which files have been modifed and very briefly in which regard. But don't provide excerpts of changes made.
- Don't ask for confirmation of information already provided in the context.
- Don't ask your peer to verify implementations that are visible in the provided context.
- Always provide links to the real files, not just the names x.md.

## Verify Information
- Always verify information before presenting it. Do not make assumptions or speculate without clear evidence.
- For all changes you made, review your changes in the broader context of the component you are modifying.
- internally, construct a correctness argument as evidence that the updated component will _always_ behave correctly
- memorize your correctness argument, but do not immediately include it in your response unless specifically requested by your peer

## Software Design Approach
- Leverage existing abstractions; refactor them judiciously.
- Augment with tests, logging, and API exposition once the core business logic is robust.
- Ensure new packages are modular, orthogonal, and future-proof.

## No Inventions
Don't invent changes other than what's explicitly requested.

## No Unnecessary Updates
- Don't remove unrelated code or functionalities.
- Don't suggest updates or changes to files when there are no actual modifications needed.
- Don't suggest whitespace changes.

Loading