Skip to content

Commit

Permalink
feat(code): Starknet host integration (#236)
Browse files Browse the repository at this point in the history
* Add `starknet-host` crate

* Add Starknet Host actor

* Cleanup

* Implement `GetValue` for `StarknetHost`

* Implement `GetReceivedValue` for `StarknetHost`

* Implement `ReceivedBlockPart` for `StarknetHost` actor

* Cleanup

* Use non-thread safe PartStore

* Add `starknet-app` crate

* Use StarknetHost in CLI

* Move `ValueBuilder` trait into `test-app` crate

* Send Update to mempool to remove all the tx-es included in the block

* Call into Starknet context to notify of decided block

* wip: investigate lack of progress

* Fix decision when received all block parts

* Cleanup

* Fix testapp spawning code

* Track unwraps with FIXME

* Fix bug in test Value proto encoding

* Fix coverage on nightly

* Add `--app=[starknet|test]` flag to `init` and `testnet` commands

* Add `--overwrite` flag to `init` command

* Add integration test for starknet-app crate

* Formatting

* Deduplicate test code between `starknet-app` and `test-app` (#240)

* Cleanup

* Launch the app specified in the config in `start` command

* Add validity check when building the value from parts

* Trim last tx batch block part when max block size is reached

* Clear the mempool on update for now

* Check that we have received all block parts before building value

* Less verbose logs on decision

* Relax round check in tests

* Remove txes from proposal content

* Cleanup

* Fix unwraps in consensus actor

* Move Protobuf encoding to and decoding from bytes into gossip crates

* Replace unprovable assertion by a check

* Replace another unprovable assertion by a check

* Only show `Connected to peer` log when we havent seen that peer already

* Show message when gossip actors have stopped

* Explicitly set default GossipSub parameters and use Blake3 as message id function

* Change default config and instrument with cargo-instruments

* Update spawning script for instrumentation with lldb

* Update default config file

* Fix spawning script

* Emit message when node has stopped normally

* Emit messages when supervised actors either fail or terminate

* Rename `SendDriverInput` to `ApplyDriverInput`

* Ensure we never apply votes or proposals with height/round different than the drivers current height/round

* Fix spawning script

* Formatting

* Make logs less noisy
  • Loading branch information
romac authored Jun 26, 2024
1 parent 158ec63 commit 7874a54
Show file tree
Hide file tree
Showing 89 changed files with 3,798 additions and 1,319 deletions.
1 change: 1 addition & 0 deletions code/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/x
/y
4 changes: 4 additions & 0 deletions code/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ malachite-round = { version = "0.1.0", path = "crates/round" }
malachite-test = { version = "0.1.0", path = "crates/test" }
malachite-test-app = { version = "0.1.0", path = "crates/test-app" }
malachite-vote = { version = "0.1.0", path = "crates/vote" }
malachite-starknet-host = { version = "0.1.0", path = "crates/starknet-host" }
malachite-starknet-app = { version = "0.1.0", path = "crates/starknet-app" }

async-trait = "0.1.77"
axum = "0.7"
base64 = "0.22.0"
blake3 = "1.5"
bytesize = "1.3"
clap = "4.5.4"
color-eyre = "0.6"
Expand Down Expand Up @@ -75,6 +78,7 @@ serde_json = "1.0"
serde_with = "3.7"
sha2 = "0.10.8"
signature = "2.2.0"
subtle-encoding = "0.5.0"
thiserror = "1.0"
tokio = "1.36.0"
tokio-stream = "0.1"
Expand Down
16 changes: 11 additions & 5 deletions code/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
### Main Base Config Options ###
#######################################################################

# The name of the application to runtime
# Available values: starknet, test
# Override with MALACHITE__APP env variable
app = "starknet"

# A custom human readable name for this node
# Override with MALACHITE__MONIKER env variable
moniker = "malachite"

#######################################################
Expand All @@ -16,7 +22,7 @@ max_block_size = "1 MiB"
## Timeouts
# How long we wait for a proposal block before prevoting nil
# Override with MALACHITE__CONSENSUS__TIMEOUT_PROPOSE env variable
timeout_propose = "3s"
timeout_propose = "5s"

# How much timeout_propose increases with each round
timeout_propose_delta = "500ms"
Expand All @@ -39,7 +45,7 @@ timeout_precommit_delta = "500ms"
# height (this gives us a chance to receive some more precommits, even
# though we already have +2/3).
# Override with MALACHITE__CONSENSUS__TIMEOUT_COMMIT env variable
timeout_commit = "1s"
timeout_commit = "0s"

#######################################################
### Consensus P2P Configuration Options ###
Expand Down Expand Up @@ -99,10 +105,10 @@ flavor = "single_threaded"

[test]
# Override with MALACHITE__TEST__TX_SIZE env variable
tx_size = "256 B"
tx_size = "1 KiB"
# Override with MALACHITE__TEST__TXS_PER_PART env variable
txs_per_part = 200
txs_per_part = 256
# Override with MALACHITE__TEST__TIME_ALLOWANCE_FACTOR env variable
time_allowance_factor = 0.7
time_allowance_factor = 0.3
# Override with MALACHITE__TEST__EXEC_TIME_PER_TX env variable
exec_time_per_tx = "1ms"
3 changes: 0 additions & 3 deletions code/crates/actors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ malachite-proto.workspace = true
malachite-vote.workspace = true

async-trait = { workspace = true }
eyre = { workspace = true }
derive-where = { workspace = true }
libp2p = { workspace = true }
prost = { workspace = true }
prost-types = { workspace = true }
ractor = { workspace = true, features = ["async-trait"] }
rand = { workspace = true }
tokio = { workspace = true, features = ["full"] }
Expand Down
Loading

0 comments on commit 7874a54

Please sign in to comment.