Skip to content
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
265 commits
Select commit Hold shift + click to select a range
e1016e6
Using proper getters when accessing hotstuff
Olshansk Sep 23, 2022
a58926d
make develop_test passed
Olshansk Sep 24, 2022
fc904a0
Remove OLSH logs
Olshansk Sep 24, 2022
213892c
/s/aggregateMessage/m.aggregateMessage
Olshansk Sep 24, 2022
686c2ca
Updated validateBlockBasic
Olshansk Sep 24, 2022
78ed1d8
Removed PersistenceContext exposure from utility context interface
Olshansk Sep 24, 2022
1133438
Tests passing - commit before creating a new block type
Olshansk Sep 24, 2022
1507de3
Added a persistence block proto type
Olshansk Sep 24, 2022
f3fe3df
Rename block persistence proto name
Olshansk Sep 26, 2022
2144811
Rough non-functional completion of merkle tree flow
Olshansk Sep 26, 2022
1d5486c
Merged with main and resolve conflicts
Olshansk Sep 26, 2022
d9a1cf5
Remove test_persistence_state_hash
Olshansk Sep 26, 2022
798ea1f
Removed explicit MaxBlockBytes variable
Olshansk Sep 26, 2022
7cdc008
Update block.go
Olshansk Sep 26, 2022
e4a63a8
Fix typo in consensus proto
Olshansk Sep 26, 2022
b219468
Updated interface to findHighQC
Olshansk Sep 26, 2022
fa3a051
Reverted changes to the utility module to simplify the PR
Olshansk Sep 26, 2022
752992b
Reverted changes to the utility module interface
Olshansk Sep 26, 2022
844688f
Reverted changes to the persistence module interface
Olshansk Sep 26, 2022
d5a8a1f
Reverted changes to the persistence module files
Olshansk Sep 26, 2022
6245080
Using GetCodec().Marshal() where appropriate
Olshansk Sep 26, 2022
4672e65
Removed additional persistence related code
Olshansk Sep 26, 2022
5c83fd5
Added initialization flow for AppHash
Olshansk Sep 26, 2022
8c6a923
make develop_test passed
Olshansk Sep 26, 2022
62a51ea
Added call to StoreBlock back
Olshansk Sep 27, 2022
8f61b6f
Avoiding anypb in a few places in the consensus code
Olshansk Sep 27, 2022
1200203
Fixed unit tests
Olshansk Sep 27, 2022
0e03976
Add back stateHash implementation
Olshansk Sep 27, 2022
f2777a1
Isolate interface changes only
Olshansk Sep 27, 2022
242565c
Undo more change
Olshansk Sep 27, 2022
55df6cf
Update the interfaces
Olshansk Sep 27, 2022
3dab12f
Merge branch 'main' into issues/249/consensus_techdebt
Olshansk Sep 28, 2022
6370922
Added shouldElectNextLeader
Olshansk Sep 28, 2022
05e0118
Added a comment for getSignableBytes
Olshansk Sep 29, 2022
45da822
Check for nil in CreateProposeMessage
Olshansk Sep 29, 2022
2410521
Revert order of pacemaker defer and telemetry event emitting
Olshansk Sep 29, 2022
a478516
s/IdToValAddrMap/idToValAddrMap
Olshansk Sep 29, 2022
8faaf21
s/ValAddrToIdMap/valAddrToIdMap
Olshansk Sep 29, 2022
25971b7
s/NodeId/nodeId
Olshansk Sep 29, 2022
472473c
s/LeaderId/leaderId
Olshansk Sep 29, 2022
a5edce5
s/MessagePool/messagePool
Olshansk Sep 29, 2022
28f1ba0
Only a few remaining exported fields in ConsensusModule based on refl…
Olshansk Sep 29, 2022
a7207b9
Add TODO in sequence diagram flow
Olshansk Sep 29, 2022
a8e5f3d
Added isNodeLockedOnPastQC
Olshansk Sep 29, 2022
e39f0f8
Logging error when refreshUtilityContext fails
Olshansk Sep 29, 2022
a6990d2
Added shouldLogHotstuffDiscardMessage
Olshansk Sep 29, 2022
8a41361
Added shouldPrepareNewBlock
Olshansk Sep 29, 2022
7493dd3
Added TODO for 256
Olshansk Sep 29, 2022
4ce5792
Merge with main
Olshansk Sep 29, 2022
d30fbf5
Merge with main
Olshansk Oct 4, 2022
3f413bd
Added SetUtilityMod and made utilityContext private
Olshansk Oct 4, 2022
317e677
Updated a comment
Olshansk Oct 4, 2022
a576229
Merge branch 'main' into issues/249/consensus_techdebt
Olshansk Oct 4, 2022
070ba2a
Added a TODO for 283
Olshansk Oct 4, 2022
9902357
Merge with issues/249/consensus_techdebt
Olshansk Oct 5, 2022
6dafdea
Revert all changes back to main
Olshansk Oct 5, 2022
66bd483
Updated base to main for simplicity
Olshansk Oct 5, 2022
655d5d5
Updated shared changelog
Olshansk Oct 5, 2022
2d864be
Merge with issues/249/consensus_techdebt
Olshansk Oct 5, 2022
9ff0ddb
Checkout main again
Olshansk Oct 5, 2022
0ca02aa
Merge with interface changes
Olshansk Oct 5, 2022
aaffb79
Uplied diffs back
Olshansk Oct 5, 2022
342de6a
Temp checkout commit
Olshansk Oct 5, 2022
81837cf
Reapplied all changes from diff
Olshansk Oct 5, 2022
5e8ae53
Merge with interface changes
Olshansk Oct 5, 2022
185919c
another merge
Olshansk Oct 5, 2022
f909103
Tests failing but running
Olshansk Oct 5, 2022
593dac7
Commented out the business logic in storeBlock
Olshansk Oct 5, 2022
4f85c49
Merge with interface changes
Olshansk Oct 5, 2022
52ae666
Tests running and mostly passing
Olshansk Oct 5, 2022
c795b00
Merge with main
Olshansk Oct 6, 2022
35f1311
Made things work again
Olshansk Oct 6, 2022
b984c65
Consensus tests passing again
Olshansk Oct 6, 2022
5530241
Reverted files that shouldn't be part of the interface change
Olshansk Oct 6, 2022
ab42525
Cleaning up the interface
Olshansk Oct 6, 2022
f9a80ff
make develop_test passed
Olshansk Oct 6, 2022
6ead8ce
Replace data | ok with result, err_code
Olshansk Oct 6, 2022
bf27e10
Split and update the sequence diagrams
Olshansk Oct 6, 2022
1e2f758
Merge with interface changes
Olshansk Oct 6, 2022
e69456a
Update TODO keyword
Olshansk Oct 6, 2022
67c1cb5
Merge branch 'issues/251/statehash_interface' into issues/284/stateha…
Olshansk Oct 6, 2022
2760dc4
make develop_test passed
Olshansk Oct 6, 2022
c35f9db
Things kind of linking together
Olshansk Oct 6, 2022
5171d2d
Almost got a deterministic state hash
Olshansk Oct 7, 2022
ffcb91f
Test passed
Olshansk Oct 7, 2022
6317a84
Quick self review
Olshansk Oct 7, 2022
eacde91
Resolve merge conflicts
Olshansk Oct 17, 2022
3002911
Update shared/docs/flows/AppHash.md
Olshansk Oct 17, 2022
7ea5969
Update shared/docs/flows/AppHash.md
Olshansk Oct 17, 2022
ea2b201
Update shared/docs/flows/AppHash.md
Olshansk Oct 17, 2022
02f2a6b
Remove merge conflict file
Olshansk Oct 17, 2022
68ef680
Update changelog
Olshansk Oct 17, 2022
41c01a7
Minor changelog update
Olshansk Oct 17, 2022
558965c
Added activations and deactivations
Olshansk Oct 17, 2022
1f49dfb
Merge with main
Olshansk Oct 17, 2022
0d5df3a
Fix tests
Olshansk Oct 17, 2022
b1a9be1
Merge branch 'main' into issues/251/statehash_interface
Olshansk Oct 20, 2022
4c05a2c
Add call to tx exists
Olshansk Oct 20, 2022
6f97b56
Merge with main
Olshansk Oct 21, 2022
36aee3f
Fix up changelog
Olshansk Oct 21, 2022
8c5f71b
Merge with main - non fully functional
Olshansk Oct 22, 2022
79bba7d
Interim commit
Olshansk Oct 22, 2022
49453fe
Merge branch 'main' into issues/251/statehash_interface
Olshansk Oct 23, 2022
a1e9fe7
Merge branch 'issues/251/statehash_interface' into issues/284/stateha…
Olshansk Oct 23, 2022
ff0ed30
Merge branch 'main' into issues/251/statehash_interface
Olshansk Oct 25, 2022
5ad8135
Merge branch 'issues/251/statehash_interface' into issues/284/stateha…
Olshansk Oct 25, 2022
843d509
Replied to most comments
Olshansk Oct 25, 2022
27890a5
Tests passing
Olshansk Oct 25, 2022
5c10c72
Merge with issues/251
Olshansk Oct 25, 2022
f27bc50
Interim commit while utility tests are failing
Olshansk Oct 25, 2022
244318b
Make test_utility works
Olshansk Oct 26, 2022
dabfb0b
Most tests except for persistence pass
Olshansk Oct 26, 2022
a68e15e
Merge branch 'main' into issues/251/statehash_interface
Olshansk Oct 28, 2022
979b57c
Merge branch 'issues/251/statehash_interface' into issues/284/stateha…
Olshansk Oct 28, 2022
65cd81a
All tests finally passing except for deterministic hash
Olshansk Oct 28, 2022
6e953a1
Deterministic hash working with TxResult
Olshansk Oct 29, 2022
d21d5dc
Finished self review of all the simple code
Olshansk Oct 29, 2022
ade27af
Implemented Account trees
Olshansk Oct 30, 2022
1746268
WIP benchmarking
Olshansk Oct 30, 2022
91c2e68
Interim work on benchmarking
Olshansk Oct 31, 2022
158e2b7
Tests pass
Olshansk Oct 31, 2022
26eed85
Add configs & all tests pass
Olshansk Oct 31, 2022
6fb1ab7
Don't clear context
Olshansk Nov 1, 2022
46e050a
Fucking finally printing what's in my trees
Olshansk Nov 2, 2022
2100975
Made some progress on benchmarking
Olshansk Nov 3, 2022
82f0fd4
Exporting state correctly
Olshansk Nov 4, 2022
0d22faa
Added tx indexer
Olshansk Nov 4, 2022
a6333d9
Updated db_export_trees
Olshansk Nov 4, 2022
dbcb980
Self review upto consensus/block.go
Olshansk Nov 4, 2022
20b71ed
Merge with main
Olshansk Nov 4, 2022
5108240
WIP
Olshansk Nov 6, 2022
4152c14
Unit tests passing
Olshansk Nov 6, 2022
6e0259e
Updated some comments
Olshansk Nov 6, 2022
51e7ebe
Update most of the external interfaces
Olshansk Nov 6, 2022
e60e22a
Update comment
Olshansk Nov 6, 2022
51d1401
Self review of most parts of the code
Olshansk Nov 6, 2022
6bf28d5
Small commit
Olshansk Nov 6, 2022
d7deb63
First attempt at fixing things
Olshansk Nov 6, 2022
6e3f6c5
Merged with localnet fixes
Olshansk Nov 6, 2022
a9de397
Made things kind of work
Olshansk Nov 7, 2022
b72173e
Make code easier to understand
Olshansk Nov 7, 2022
8011f8d
Improve logging for p2p
Olshansk Nov 7, 2022
d0c68a8
Merge branch 'localnet_fixes' into issues/251/statehash_interface
Olshansk Nov 7, 2022
1686001
Removed persistence/docs/PROTOCOL_STATE_HASH.md from this commit
Olshansk Nov 7, 2022
6b7f556
Almost code random but determinstic test going
Olshansk Nov 8, 2022
3d86e23
Update persistence/module.go
Olshansk Nov 8, 2022
878501c
Update persistence/module.go
Olshansk Nov 8, 2022
dd13813
Merge branch 'localnet_fixes' into issues/251/statehash_interface
Olshansk Nov 8, 2022
03c4bc7
Minor release fixes
Olshansk Nov 8, 2022
27f803d
Finally got TestStateHash_RandomButDeterministic to pass
Olshansk Nov 8, 2022
ea4fb4a
Merge with main - tests pass but not done yet
Olshansk Nov 8, 2022
ccf240e
Minor code cleanup - about to remove SetLatestTxResults
Olshansk Nov 8, 2022
432d55b
Added comments
Olshansk Nov 8, 2022
e166e3b
Propogating proper QC in consensus
Olshansk Nov 9, 2022
cab5e63
Added QC back to SetProposalBlock
Olshansk Nov 9, 2022
a588240
StateHash test passing
Olshansk Nov 9, 2022
23df0cb
Removed export tree related work
Olshansk Nov 9, 2022
e3785f3
Moved persistence debug helpers into appropriate file
Olshansk Nov 9, 2022
353d4b0
Halfway through self review
Olshansk Nov 9, 2022
0ebbf52
Reverted unrelated changes
Olshansk Nov 9, 2022
7566bce
Got TestStateHash_ReplayingRandomTransactionsIsDeterministic working
Olshansk Nov 9, 2022
3336af6
Removed unnecessary merkleTreeToProtoSchema
Olshansk Nov 9, 2022
054b93a
make test_persistence passes
Olshansk Nov 9, 2022
60924aa
Merge with main
Olshansk Nov 11, 2022
300c8cb
Merge branch 'issues/251/statehash_interface' into issues/284/stateha…
Olshansk Nov 11, 2022
4dae396
Added TODO for #344R
Olshansk Nov 11, 2022
991fe30
Update persistence/test/benchmark_state_test.go
Olshansk Nov 11, 2022
898f4a7
Update persistence/account.go
Olshansk Nov 11, 2022
05db304
Tend to minor comments
Olshansk Nov 11, 2022
f5ca864
Remove height from callRandomDatabaseModifierFunc
Olshansk Nov 11, 2022
fa7a392
minor improvements to benchmarking code
Olshansk Nov 11, 2022
3f52358
Updated comments in persistence/HandleDebugMessage
Olshansk Nov 11, 2022
bb1069c
Append to nil slice
Olshansk Nov 11, 2022
4f9f87d
Update persistence/debug.go
Olshansk Nov 11, 2022
e442648
Update persistence/state.go
Olshansk Nov 11, 2022
4b86e6f
Remove unused height var when getting all accounts updated
Olshansk Nov 11, 2022
c353335
Removed unnecessary height param
Olshansk Nov 11, 2022
4ec2421
Added txsOrderInBlockHashDescending constant
Olshansk Nov 11, 2022
ca658f0
A few minor edits
Olshansk Nov 11, 2022
85078f3
Updated documentation for ComputeAppHash
Olshansk Nov 11, 2022
10c1acb
Merge branch 'main' into issues/251/statehash_interface
Olshansk Nov 11, 2022
b48e6e1
Merge with issues/251
Olshansk Nov 11, 2022
25439db
Added db_cli_node
Olshansk Nov 11, 2022
4e81e6a
Update utility/block.go
Olshansk Nov 11, 2022
e7c3455
Added unit tests for GetPoolsUpdated and GetAccountsUpdated
Olshansk Nov 11, 2022
8a9b130
Proper implementation of GetPrevHash
Olshansk Nov 11, 2022
93b94b1
Removed GetBlockHash
Olshansk Nov 11, 2022
f3164af
Update comment
Olshansk Nov 11, 2022
d0dc9c1
Minor code cleanup throughout
Olshansk Nov 12, 2022
741949f
Added TODO for #346
Olshansk Nov 12, 2022
e10b147
Consensus fixes
Olshansk Nov 15, 2022
b4e8007
Update shared/docs/PROTOCOL_STATE_HASH.md
Olshansk Nov 15, 2022
e413576
[Utility] Local Proof of Stake CLI - RPC server [part 2/2] - Issue #…
deblasis Nov 11, 2022
14c2ae3
[Utility] Local Proof of Stake CLI - Issue #112 (#169)
deblasis Nov 11, 2022
92897bf
Updated txResults comment
Olshansk Nov 14, 2022
0551bbc
Ticket #211: finding unnecessary public functions in the Persistence …
Jasonyou1995 Nov 14, 2022
131d08f
Remove unnecessary critical sections
Olshansk Nov 15, 2022
bc92358
Minor updates in documentation
Olshansk Nov 15, 2022
53e7dfc
Removed Latest from function names
Olshansk Nov 16, 2022
1afbc78
Updating references documents
Olshansk Nov 16, 2022
7e93272
Replace true | false with just false to simplify diagram
Olshansk Nov 16, 2022
ad042ba
Merge with main
Olshansk Nov 16, 2022
c1f5151
Updated the consensus changelog
Olshansk Nov 16, 2022
00c5378
Updated the persistence changelog
Olshansk Nov 16, 2022
6c41701
Fix numbering in the README
Olshansk Nov 16, 2022
8353e70
Updated shared/modules changelog
Olshansk Nov 16, 2022
4564c32
Updated utility changelog
Olshansk Nov 16, 2022
9ce3f4f
Merged with main
Olshansk Nov 16, 2022
d1f8086
Merge with issues/251
Olshansk Nov 16, 2022
c134b82
Added a weird bug related to errors in the non main thread
Olshansk Nov 16, 2022
9ff13ea
Updated the consensus changelog
Olshansk Nov 16, 2022
5468ccf
self review + test for TestGetValidatorUpdateAtHeigh
Olshansk Nov 16, 2022
069084c
Added unit tests for all the actor retriverals
Olshansk Nov 16, 2022
609c47f
Fixed ShowLatestBlockInStore
Olshansk Nov 16, 2022
dcb99e8
Temp changes
Olshansk Nov 22, 2022
5aa5ef5
Merge with main
Olshansk Nov 22, 2022
aca2b23
Improve diagram for high vs locked QC
Olshansk Nov 22, 2022
8b81f28
Merge with main and tests are passing
Olshansk Nov 22, 2022
f72aae7
Merge branch 'main' into issues/251/statehash_interface
Olshansk Nov 27, 2022
0aedd43
Merge with main and tests are passing
Olshansk Nov 27, 2022
e7f624e
Olshansky self-review; round 3
Olshansk Nov 27, 2022
f23651d
Update persistence/docs/PROTOCOL_STATE_HASH.md
Olshansk Nov 27, 2022
2d4717b
Rename finalQC to commitQC
Olshansk Nov 27, 2022
55a12ba
Merge branch 'issues/251/statehash_interface' into issues/284/stateha…
Olshansk Nov 27, 2022
365abe1
Merge branch 'main' into issues/284/statehash_impl
Olshansk Nov 28, 2022
9bdadb0
Import fix
Olshansk Nov 28, 2022
89b4cac
Consensus fixes
Olshansk Nov 15, 2022
754f3e9
First V1 tx in the books
Olshansk Nov 15, 2022
d26446f
Added pkeys and instructions
Olshansk Nov 15, 2022
1572ac8
Doing a proper broadcast from RPC
Olshansk Nov 15, 2022
cab6408
Update instructions for iter 3 demo
Olshansk Nov 15, 2022
caf6a0b
Minor updates to instructions
Olshansk Nov 15, 2022
7a5e1c3
Self review - in progress
Olshansk Nov 29, 2022
2d9906d
Merge with main after state hash changes
Olshansk Nov 30, 2022
2ab04e5
Merge branch 'main' into issues/364/end_to_end_tx
Olshansk Dec 6, 2022
c8bb77e
Rename DeleteTransaction to RemoveTransaction
Olshansk Dec 6, 2022
facfe9e
Code cleanup in the mempool
Olshansk Dec 6, 2022
e616efd
Added a few comments for clarification
Olshansk Dec 6, 2022
98a41ab
Changed the scope of CheckTransaction and related dependencies
Olshansk Dec 6, 2022
b49a313
Adding util_module.proto
Olshansk Dec 6, 2022
4002717
Successfully broadcasting message through mempool
Olshansk Dec 6, 2022
3d72ffe
Updated the documentation
Olshansk Dec 6, 2022
d77b55a
Update all the changelogs
Olshansk Dec 6, 2022
cb97c4a
Updated the documentation in docs/demos/iteration_3_end_to_end_tx.md
Olshansk Dec 6, 2022
84c5d16
Updated the documentation in docs/demos/iteration_3_end_to_end_tx.md …
Olshansk Dec 6, 2022
3847bf0
Updated the documentation in docs/demos/iteration_3_end_to_end_tx.md …
Olshansk Dec 6, 2022
6c50b50
Update the features section
Olshansk Dec 6, 2022
da72f41
Merge branch 'main' into issues/364/end_to_end_tx
Olshansk Dec 8, 2022
148c19d
Merge branch 'main' into issues/364/end_to_end_tx
Olshansk Dec 8, 2022
689f271
Fixed another unit test and created #388
Olshansk Dec 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/pkeys/val1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"6fd0bc54cc2dd205eaf226eebdb0451629b321f11d279013ce6fdd5a33059256b2eda2232ffb2750bf761141f70f75a03a025f65b2b2b417c7f8b3c9ca91e8e4"
1 change: 1 addition & 0 deletions build/pkeys/val2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"5db3e9d97d04d6d70359de924bb02039c602080d6bf01a692bad31ad5ef93524c16043323c83ffd901a8bf7d73543814b8655aa4695f7bfb49d01926fc161cdb"
1 change: 1 addition & 0 deletions build/pkeys/val3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"b37d3ba2f232060c41ba1177fea6008d885fcccad6826d64ee7d49f94d1dbc49a8b6be75d7551da093f788f7286c3a9cb885cfc8e52710eac5f1d5e5b4bf19b2"
1 change: 1 addition & 0 deletions build/pkeys/val4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"c6c136d010d07d7f5e9944aa3594a10f9210dd3e26ebc1bc1516a6d957fd0df353ee26c82826694ffe1773d7b60d5f20dd9e91bdf8745544711bec5ff9c6fb4a"
4 changes: 4 additions & 0 deletions consensus/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.0.11] - 2022-12-06

- Removed unused `consensus.UtilityMessage`

## [0.0.0.10] - 2022-11-30

- Propagate `highPrepareQC` if available to the block being created
Expand Down
1 change: 0 additions & 1 deletion consensus/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const (
ByzantineThreshold = float64(2) / float64(3)

HotstuffMessageContentType = "consensus.HotstuffMessage"
UtilityMessageContentType = "consensus.UtilityMessage"
)

var (
Expand Down
3 changes: 1 addition & 2 deletions consensus/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ func (m *consensusModule) GetPrivateKey() (cryptoPocket.PrivateKey, error) {
func (m *consensusModule) HandleMessage(message *anypb.Any) error {
m.m.Lock()
defer m.m.Unlock()

switch message.MessageName() {
case HotstuffMessageContentType:
msg, err := codec.GetCodec().FromAny(message)
Expand All @@ -248,8 +249,6 @@ func (m *consensusModule) HandleMessage(message *anypb.Any) error {
if err := m.handleHotstuffMessage(hotstuffMessage); err != nil {
return err
}
case UtilityMessageContentType:
panic("[WARN] UtilityMessage handling is not implemented by consensus yet...")
default:
return typesCons.ErrUnknownConsensusMessageType(message.MessageName())
}
Expand Down
134 changes: 134 additions & 0 deletions docs/demos/iteration_3_end_to_end_tx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Iteration 3 Demo <!-- omit in toc -->

**Table of Contents**

- [Goals](#goals)
- [Shell #1: Setup LocalNet](#shell-1-setup-localnet)
- [Shell #2: Setup Consensus debugger](#shell-2-setup-consensus-debugger)
- [Shell #3: Inspect the data in the database for node1](#shell-3-inspect-the-data-in-the-database-for-node1)
- [Shell #4: Inspect the data in the database for node3](#shell-4-inspect-the-data-in-the-database-for-node3)
- [Shell #5: Trigger a send transaction from the CLI](#shell-5-trigger-a-send-transaction-from-the-cli)
- [Available Commands](#available-commands)
- [First Transaction](#first-transaction)
- [Second Transaction](#second-transaction)
- [\[Optional\] Shell #6: See Swagger UI](#optional-shell-6-see-swagger-ui)

## Goals

The first video of this demo can be accessed [here](https://drive.google.com/file/d/1IOrzq-XJP04BJjyqPPpPu873aSfwrnur/view?usp=sharing).

The goal of iteration 3 was to have a success end-to-end transaction that:

- Uses docker-compose on LocalNet
- Is composed of 4 hard-coded validator nodes
- Starts the LocalNet from genesis
- Uses the CLI to send a transaction
- Uses a basic version of HotPOKT for consensus
- Uses a basic version of RainTree for brodcast

<img width="842" alt="Screenshot 2022-12-05 at 9 02 28 PM" src="https://user-images.githubusercontent.com/1892194/205820691-26e801e4-ff79-4132-a7a1-358860ca2335.png">

## Shell #1: Setup LocalNet

```bash
m̶a̶k̶e̶ ̶d̶o̶c̶k̶e̶r̶_̶w̶i̶p̶e̶ # [Optional] Clear everything (takes a long time)
make # show all the commands
make docker_wipe_nodes # clear all the 4 validator nodes
make db_drop # clear the existing database
make compose_and_watch # Start 4 validator node LocalNet
```

## Shell #2: Setup Consensus debugger

```bash
make client_start && make client_connect # start the consensus debugger
```

Use `TriggerNextView` and `PrintNodeState` to increment and inspect each node's `height/round/step`.

## Shell #3: Inspect the data in the database for node1

Connect to the SQL DB of node #1:

```bash
make db_show_schemas # show that there are 4 node schemas
make db_cli_node # connect to the default node 1
```

Query the blocks, accounts and pools from the DB:

```sql
show search_path;
select height, hash from block;
select * from account;
select * from pool;
```

## Shell #4: Inspect the data in the database for node3

```bash
psqlSchema=node3 make db_cli_node # connect to node 3
```

Query the blocks, accounts and pools from the DB:

```sql
show search_path;
select height, hash from block;
select * from account;
select * from pool;
```

## Shell #5: Trigger a send transaction from the CLI

### Available Commands

Show all the commands available in the CLI:

```bash
go run app/client/*.go
```

### First Transaction

Trigger a send transaction from validator 1 to validator 2.

```bash
go run app/client/*.go --path_to_private_key_file=/Users/olshansky/workspace/pocket/pocket/build/pkeys/val1.json Account Send 6f66574e1f50f0ef72dff748c3f11b9e0e89d32a 67eb3f0a50ae459fecf666be0e93176e92441317 1000
```

1. Use shell #2 to `TriggerNextView` and confirm height increased via `PrintNodeState`
- You may need to do this more than once in case there's a bug.
2. Use shell #3 to inspect how the balances changes
- You should see new records with the height `1`
- You should see that the `DAO` got some money
- You should see that funds were moved from one account to another
3. Use shell #4 to inspect how the balances changes
- You should see the same data as above
4. Use shell #2 to `ShowLatestBlockInStore`
- You should see the data for the block at height `1`

### Second Transaction

Trigger a send transaction from validator 2 to validator 1.

```bash
go run app/client/*.go --path_to_private_key_file=/Users/olshansky/workspace/pocket/pocket/build/pkeys/val2.json Account Send 67eb3f0a50ae459fecf666be0e93176e92441317 6f66574e1f50f0ef72dff748c3f11b9e0e89d32a 1000
```

1. Use shell #2 to `TriggerNextView` (one or more times) and confirm height increased via `PrintNodeState`
- You may need to do this more than once in case there's a bug.
2. Use shell #3 to inspect how the balances changes
- You should see new records with the height `2`
- You should see that the `DAO` got some money
- You should see that funds were moved from one account to another
3. Use shell #4 to inspect how the balances changes
- You should see the same data as above
4. Use shell #2 to `ShowLatestBlockInStore`
- You should see the data for the block at height `2`

## [Optional] Shell #6: See Swagger UI

```bash
make swagger-ui
```
4 changes: 4 additions & 0 deletions persistence/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ TODO: consolidate `persistence/docs/CHANGELOG` and `persistence/CHANGELOG.md`

## [Unreleased]

## [0.0.0.10] - 2022-12-06

- Changed the scope of `TransactionExists` from the `PostgresContext` to the `PersistenceModule`

## [0.0.0.9] - 2022-11-30

Core StateHash changes
Expand Down
32 changes: 16 additions & 16 deletions persistence/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ import (
"github.com/pokt-network/pocket/shared/codec"
)

func (p *persistenceModule) TransactionExists(transactionHash string) (bool, error) {
hash, err := hex.DecodeString(transactionHash)
if err != nil {
return false, err
}
res, err := p.txIndexer.GetByHash(hash)
if res == nil {
// check for not found
if err != nil && err.Error() == kvstore.BadgerKeyNotFoundError {
return false, nil
}
return false, err
}
return true, err
}

// OPTIMIZE: evaluate if it's faster to get this from the blockstore (or cache) than the SQL engine
func (p PostgresContext) GetLatestBlockHeight() (latestHeight uint64, err error) {
ctx, tx, err := p.getCtxAndTx()
Expand Down Expand Up @@ -40,22 +56,6 @@ func (p PostgresContext) GetHeight() (int64, error) {
return p.Height, nil
}

func (p PostgresContext) TransactionExists(transactionHash string) (bool, error) {
hash, err := hex.DecodeString(transactionHash)
if err != nil {
return false, err
}
res, err := p.txIndexer.GetByHash(hash)
if res == nil {
// check for not found
if err != nil && err.Error() == kvstore.BadgerKeyNotFoundError {
return false, nil
}
return false, err
}
return true, err
}

// DISCUSS: this might be retrieved from the block store - temporarily we will access it directly from the module
// following the pattern of the Consensus Module prior to pocket/issue-#315
// TODO(#284): Remove blockProtoBytes from the interface
Expand Down
2 changes: 1 addition & 1 deletion persistence/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func (m *persistenceModule) HandleDebugMessage(debugMessage *messaging.DebugMess
return nil
}

// IMPROVE: Add an iterator to the `kvstore` and use that instead
func (m *persistenceModule) showLatestBlockInStore(_ *messaging.DebugMessage) {
// TODO: Add an iterator to the `kvstore` and use that instead
height := m.GetBus().GetConsensusModule().CurrentHeight() - 1
blockBytes, err := m.GetBlockStore().Get(heightToBytes(int64(height)))
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions rpc/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.0.2] - 2022-12-06

- Updated `PostV1ClientBroadcastTxSync` to broadcast the transaction it receives
- Avoid creating an unnecessary utility context and use the utility module directly

## [0.0.0.1] - 2022-11-02

### Added
Expand Down
39 changes: 30 additions & 9 deletions rpc/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (

"github.com/labstack/echo/v4"
"github.com/pokt-network/pocket/app"
"github.com/pokt-network/pocket/shared/codec"
typesUtil "github.com/pokt-network/pocket/utility/types"
)

func (s *rpcServer) GetV1Health(ctx echo.Context) error {
Expand All @@ -18,24 +20,24 @@ func (s *rpcServer) GetV1Version(ctx echo.Context) error {
}

func (s *rpcServer) PostV1ClientBroadcastTxSync(ctx echo.Context) error {
params := new(RawTXRequest)
if err := ctx.Bind(params); err != nil {
txParams := new(RawTXRequest)
if err := ctx.Bind(txParams); err != nil {
return ctx.String(http.StatusBadRequest, "bad request")
}
bz, err := hex.DecodeString(params.RawHexBytes)

txBz, err := hex.DecodeString(txParams.RawHexBytes)
if err != nil {
return ctx.String(http.StatusBadRequest, "cannot decode tx bytes")
}
height := s.GetBus().GetConsensusModule().CurrentHeight()
uCtx, err := s.GetBus().GetUtilityModule().NewContext(int64(height))
if err != nil {
defer func() { log.Fatalf("[ERROR] Failed to create UtilityContext: %v", err) }()

if err = s.GetBus().GetUtilityModule().CheckTransaction(txBz); err != nil {
return ctx.String(http.StatusInternalServerError, err.Error())
}
err = uCtx.CheckTransaction(bz)
if err != nil {

if err := s.broadcastMessage(txBz); err != nil {
return ctx.String(http.StatusInternalServerError, err.Error())
}

return nil
}

Expand All @@ -47,3 +49,22 @@ func (s *rpcServer) GetV1ConsensusState(ctx echo.Context) error {
Step: int64(consensus.CurrentStep()),
})
}

// Broadcast to the entire validator set
func (s *rpcServer) broadcastMessage(msgBz []byte) error {
utilMsg := &typesUtil.TransactionGossipMessage{
Tx: msgBz,
}

anyUtilityMessage, err := codec.GetCodec().ToAny(utilMsg)
if err != nil {
log.Printf("[ERROR] Failed to create Any proto from transaction gossip: %v", err)
return err
}

if err := s.GetBus().GetP2PModule().Broadcast(anyUtilityMessage); err != nil {
log.Printf("[ERROR] Failed to broadcast utility message: %v", err)
return err
}
return nil
}
4 changes: 4 additions & 0 deletions shared/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.0.5] - 2022-12-06

- Change the `bus` to be a pointer receiver rather than a value receiver in all the functions it implements

## [0.0.0.4] - 2022-11-30

Debug:
Expand Down
20 changes: 10 additions & 10 deletions shared/bus.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,44 +128,44 @@ func CreateBusWithOptionalModules(
return bus
}

func (m bus) PublishEventToBus(e *messaging.PocketEnvelope) {
func (m *bus) PublishEventToBus(e *messaging.PocketEnvelope) {
m.channel <- *e
}

func (m bus) GetBusEvent() *messaging.PocketEnvelope {
func (m *bus) GetBusEvent() *messaging.PocketEnvelope {
e := <-m.channel
return &e
}

func (m bus) GetEventBus() modules.EventsChannel {
func (m *bus) GetEventBus() modules.EventsChannel {
return m.channel
}

func (m bus) GetPersistenceModule() modules.PersistenceModule {
func (m *bus) GetPersistenceModule() modules.PersistenceModule {
return m.persistence
}

func (m bus) GetP2PModule() modules.P2PModule {
func (m *bus) GetP2PModule() modules.P2PModule {
return m.p2p
}

func (m bus) GetUtilityModule() modules.UtilityModule {
func (m *bus) GetUtilityModule() modules.UtilityModule {
return m.utility
}

func (m bus) GetConsensusModule() modules.ConsensusModule {
func (m *bus) GetConsensusModule() modules.ConsensusModule {
return m.consensus
}

func (m bus) GetTelemetryModule() modules.TelemetryModule {
func (m *bus) GetTelemetryModule() modules.TelemetryModule {
return m.telemetry
}

func (m bus) GetLoggerModule() modules.LoggerModule {
func (m *bus) GetLoggerModule() modules.LoggerModule {
return m.logger
}

func (m bus) GetRPCModule() modules.RPCModule {
func (m *bus) GetRPCModule() modules.RPCModule {
return m.rpc
}

Expand Down
Loading