Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mock-consensus: 🚀 test node can send an empty block #3822

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

cratelyn
Copy link
Contributor

@cratelyn cratelyn commented Feb 14, 2024

fixes #3792.

see #3588.

  • block module defining interfaces to build a tendermint block,
    holding a unique reference to the TestNode.
  • abci module defining TestNode interfaces that will send consensus
    requests to the application. this includes:
    • BeginBlock
    • DeliverTx
    • EndBlock
    • Commit
  • send_block module defining a TestNode interface to send the
    requisite abci requests, given a tendermint::Block.
  • documentation is added for assorted public interfaces.

this represents a huge, exciting step for work on the mock engine! we
can now initialize and send an (empty) block to the consensus service.

✨ 🎊 ✨ 🎊 ✨

what next?

this isn't a comprehensive set of interfaces.
penumbra_mock_consensus::block::Builder will certainly grow more
methods as it is iterated upon. we'll use work in porting tests
(see #3788) to drive which other fields are needed.

forthcoming work will build upon this to:

todo comments are left to that effect.


@cratelyn cratelyn added C-enhancement Category: an enhancement to the codebase A-mock-consensus Area: Relates to the mock consensus engine _P-high High priority labels Feb 14, 2024
@cratelyn cratelyn self-assigned this Feb 14, 2024
@cratelyn cratelyn force-pushed the katie/mock-consensus-block-builder branch from 30c54a5 to f0a9f98 Compare February 14, 2024 16:28
@cratelyn cratelyn changed the title mock-consensus: 🌸 test node exposes block builder (wip) mock-consensus: 🌸 test node sends a block Feb 14, 2024
@cratelyn
Copy link
Contributor Author

  2024-02-14T16:27:15.112293Z TRACE penumbra_mock_consensus: consensus service is now ready
    at crates/test/mock-consensus/src/lib.rs:58

  2024-02-14T16:27:15.112310Z  INFO penumbra_app::server::consensus: beginning block, time: Time(2024-02-14 16:27:15.112272209)
    at crates/core/app/src/server/consensus.rs:189

there is still more progress to be made, but i am making exciting headway.

fixes #3792.

see #3588.

* `block` module defining interfaces to build a tendermint block,
  holding a unique reference to the `TestNode`.
* `abci` module defining `TestNode` interfaces that will send consensus
  requests to the application. this includes:
  * BeginBlock
  * DeliverTx
  * EndBlock
  * Commit
* `send_block` module defining a `TestNode` interface to send the
  requisite abci requests, given a `tendermint::Block`.
* documentation is added for assorted public interfaces.

this represents a huge, exciting step for work on the mock engine! we
can now initialize and send an (empty) block to the consensus service.

✨ 🎊 ✨ 🎊 ✨

what next?

this isn't a _comprehensive_ set of interfaces.
`penumbra_mock_consensus::block::Builder` will certainly grow more
methods as it is iterated upon. we'll use work in porting tests
(see #3788) to drive which other fields are needed.

forthcoming work will build upon this to:

* introduce more builder methods to set other `Header` fields (e.g.
  timestamp, see #3759)
* use the reference to the test node to set other `Header` fields (e.g.
  height)

todo comments are left to that effect.

---

* #3588
* #3792
@cratelyn cratelyn force-pushed the katie/mock-consensus-block-builder branch from 5a5347f to e15809e Compare February 15, 2024 01:57
@cratelyn cratelyn changed the title mock-consensus: 🌸 test node sends a block mock-consensus: 🚀 test node can send an empty block Feb 15, 2024
@cratelyn
Copy link
Contributor Author


; RUST_LOG="warn,penumbra_mock_consensus=info,penumbra_app=info" cargo test --package penumbra-app mock_consensus_can_send_a_single_empty_block -- --nocapture
    Finished test [unoptimized + debuginfo] target(s) in 0.14s
     Running unittests src/lib.rs (target/debug/deps/penumbra_app-41ef6ed30f292e6b)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 3 filtered out; finished in 0.00s

     Running tests/mock_consensus.rs (target/debug/deps/mock_consensus-768e4e857471398c)

running 1 test
  2024-02-15T02:03:05.238498Z  INFO penumbra_app::server::consensus: genesis state is a full configuration
    at crates/core/app/src/server/consensus.rs:143

  2024-02-15T02:03:05.240890Z  INFO penumbra_app::server::consensus: finished init_chain, consensus_params: Params { block: Size { max_bytes: 1, max_gas: 1, time_iota_ms: 1 }, evidence: Params { max_age_num_blocks: 1, max_age_duration: Duration(1s), max_bytes: 1 }, validator: ValidatorParams { pub_key_types: [] }, version: Some(VersionParams { app: 1 }), abci: AbciParams { vote_extensions_enable_height: None } }, validators: [], app_hash: RootHash("5fc87d8a020365f0bc2cff7b1e8fc5dc3d14f862a7c860dc231e6d44fa847277")
    at crates/core/app/src/server/consensus.rs:153

  2024-02-15T02:03:05.241042Z  INFO penumbra_mock_consensus::send_block: sending block
    at crates/test/mock-consensus/src/send_block.rs:43
    in penumbra_mock_consensus::send_block::send_block with height: 1, time: 2024-02-15T02:03:05.240968549Z, app_hash: 

  2024-02-15T02:03:05.241097Z  INFO penumbra_app::server::consensus: beginning block, time: Time(2024-02-15 2:03:05.240968549)
    at crates/core/app/src/server/consensus.rs:189
    in penumbra_mock_consensus::send_block::send_block with height: 1, time: 2024-02-15T02:03:05.240968549Z, app_hash: 

  2024-02-15T02:03:05.241538Z  INFO penumbra_app::server::consensus: ending block, height: 1
    at crates/core/app/src/server/consensus.rs:220
    in penumbra_mock_consensus::send_block::send_block with height: 1, time: 2024-02-15T02:03:05.240968549Z, app_hash: 

  2024-02-15T02:03:05.249423Z  INFO penumbra_app::server::consensus: k: "anchor", v: "{\"inner\":\"M+y7x5shDKelpCpbBLmov/hSsA14YXPpamwiR3X/yAU=\"}"
    at crates/core/app/src/server/consensus.rs:26
    in penumbra_app::server::consensus::event with kind: "penumbra.core.component.sct.v1.EventAnchor"
    in penumbra_mock_consensus::send_block::send_block with height: 1, time: 2024-02-15T02:03:05.240968549Z, app_hash: 

  2024-02-15T02:03:05.249439Z  INFO penumbra_app::server::consensus: k: "height", v: "\"1\""
    at crates/core/app/src/server/consensus.rs:26
    in penumbra_app::server::consensus::event with kind: "penumbra.core.component.sct.v1.EventAnchor"
    in penumbra_mock_consensus::send_block::send_block with height: 1, time: 2024-02-15T02:03:05.240968549Z, app_hash: 

  2024-02-15T02:03:05.249462Z  INFO penumbra_app::server::consensus: k: "height", v: "\"1\""
    at crates/core/app/src/server/consensus.rs:26
    in penumbra_app::server::consensus::event with kind: "penumbra.core.component.sct.v1.EventBlockRoot"
    in penumbra_mock_consensus::send_block::send_block with height: 1, time: 2024-02-15T02:03:05.240968549Z, app_hash: 

  2024-02-15T02:03:05.249470Z  INFO penumbra_app::server::consensus: k: "root", v: "{\"inner\":\"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\"}"
    at crates/core/app/src/server/consensus.rs:26
    in penumbra_app::server::consensus::event with kind: "penumbra.core.component.sct.v1.EventBlockRoot"
    in penumbra_mock_consensus::send_block::send_block with height: 1, time: 2024-02-15T02:03:05.240968549Z, app_hash: 

  2024-02-15T02:03:05.250853Z  INFO penumbra_app::server::consensus: committed block, app_hash: RootHash("ae6ccf9eae1acd05631a06cd7247cff7ee8eb0900fa88bfc60f7fe157ee6dd95")
    at crates/core/app/src/server/consensus.rs:244
    in penumbra_mock_consensus::send_block::send_block with height: 1, time: 2024-02-15T02:03:05.240968549Z, app_hash: 

  2024-02-15T02:03:05.250904Z  INFO penumbra_mock_consensus::send_block: finished sending block
    at crates/test/mock-consensus/src/send_block.rs:51
    in penumbra_mock_consensus::send_block::send_block with height: 1, time: 2024-02-15T02:03:05.240968549Z, app_hash: 

test mock_consensus_can_send_a_single_empty_block ... ok

#3822 (comment)

Co-Authored-By: Henry de Valence <hdevalence@penumbralabs.xyz>
@hdevalence
Copy link
Member

Amazing!

@cratelyn cratelyn merged commit 2881327 into main Feb 15, 2024
6 checks passed
@cratelyn cratelyn deleted the katie/mock-consensus-block-builder branch February 15, 2024 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mock-consensus Area: Relates to the mock consensus engine C-enhancement Category: an enhancement to the codebase _P-high High priority
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

tests: 🧩 provide a block builder api in the mock consensus engine
2 participants