Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
ed24231
feat(p2p): Add and use `on_init` callbacks for p2p RPC requests
tizoc Sep 3, 2024
ff34e50
feat(transition_frontier): Use more callbacks on ledger requests
tizoc Sep 3, 2024
ca7d6e9
chore: Formatting
tizoc Sep 3, 2024
39f9424
Merge pull request #628 from openmina/feat/more-callbacks
tizoc Sep 4, 2024
f8aeea7
docs(architecture): Explain conditional dispatch alternative using ca…
tizoc Sep 4, 2024
4446662
Merge pull request #629 from openmina/docs/callbacks-docs
tizoc Sep 4, 2024
450d1e0
docs: tweak
tizoc Sep 4, 2024
ce492d7
fix: Panics in vrf/producer
Sep 4, 2024
9f45e21
feat(node/web): expose rpcs necessary for dashboard FE
binier Sep 4, 2024
3ee4757
Merge pull request #630 from openmina/feat/node/web
binier Sep 4, 2024
8e33e46
feat(transition_frontier): Reuse the previous root snarked ledger if …
tizoc Sep 4, 2024
f796395
Merge pull request #631 from openmina/feat/root-ledger-resync
tizoc Sep 4, 2024
4086e66
feat(p2p-messages): Add `ZkappUri` and `TokenSymbol` type with size l…
tizoc Sep 4, 2024
ec2d4d2
Merge pull request #632 from openmina/feat/limited-strings
tizoc Sep 4, 2024
67fc52b
feat(mina-p2p-messages): Combine implementations of bounded strings
tizoc Sep 5, 2024
ad80f7c
Merge pull request #633 from openmina/feat/merge-bounded-strings
tizoc Sep 5, 2024
1da0f5b
Staging environment & Webnode integration first steps
binier Sep 3, 2024
2a8a269
Frontend - Staging environment & Webnode integration first steps #634
directcuteo Sep 5, 2024
dc808d9
Staging
directcuteo Sep 5, 2024
7bd0d3d
Frontend - Append Dashboard Page to Staging #635
directcuteo Sep 5, 2024
94a3130
Dockerfile frontend
directcuteo Sep 5, 2024
f6170a1
Frontend - Dockerfile Staging Merge pull request #636 from openmina/f…
directcuteo Sep 5, 2024
72c91f3
Removed duplicate mod
0xMimir Sep 5, 2024
788d267
Merge pull request #637 from 0xMimir/fix/build
0xMimir Sep 5, 2024
c458895
fix(node): panic caused by scan-state/summary rpc
binier Sep 5, 2024
ba6f03a
Merge pull request #639 from openmina/fix/rpc/scan_state/summary/panic
binier Sep 5, 2024
f26e9c3
Replace fallible from implementations by try_from version
Sep 5, 2024
396a066
Merge pull request #640 from openmina/p2p_remove_panic
tizoc Sep 5, 2024
a7c09d1
fix(tx-pool): Temporary workaround to avoid panic after reorgs
tizoc Sep 5, 2024
31c9173
Dashboard fix
directcuteo Sep 6, 2024
be60658
Frontend - Block production added Discarded key #643
directcuteo Sep 6, 2024
e46da67
feat(cli/node): load provers index if block producer is configured AS…
binier Sep 6, 2024
69d2f74
feat(block_producer): improve logging
binier Sep 6, 2024
905de5e
Merge pull request #644 from openmina/fix/block_producer/logs_and_stats
binier Sep 6, 2024
b79eb79
fix(docker): block production fails because circuit-blobs are missing…
binier Sep 6, 2024
76615c2
Remove more panics in the tx pool
sebastiencs Sep 6, 2024
4c48949
Merge pull request #645 from openmina/fix/docker/block_producer
binier Sep 6, 2024
1ee18e5
Merge pull request #642 from openmina/fix/tx-pool-panic
tizoc Sep 6, 2024
8bd1b6c
feat(configure-keypair): implement compatible with OCaml Mina way to …
vlad9486 Sep 6, 2024
9527c86
Merge pull request #641 from openmina/fix/vrf-error-handling
tizoc Sep 6, 2024
9e573ce
Merge pull request #647 from openmina/feat/configure-keypair
vlad9486 Sep 6, 2024
13799c1
fix(configure-keypair): fix env variable name to not collide with pro…
vlad9486 Sep 6, 2024
0f12044
Merge pull request #648 from openmina/fix/configure-keypair
tizoc Sep 6, 2024
25b2665
chore: Update CHANGELOG
tizoc Sep 6, 2024
3f88bfe
chore: Bump version to 0.8.2
tizoc Sep 6, 2024
cabf8b5
chore: Update Cargo.lock
tizoc Sep 6, 2024
a583177
chore: Update version in docker compose files
tizoc Sep 6, 2024
ca70746
Merge pull request #646 from openmina/prepare-release/v0.8.2
tizoc Sep 6, 2024
3c91f95
Merge branch 'main' into develop
tizoc Sep 6, 2024
0671b5e
Merge branch 'main' into develop
tizoc Sep 6, 2024
412adcd
feat(ledger): Add `OPENMINA_CIRCUIT_BLOBS_BASE_DIR` env var to contro…
tizoc Sep 6, 2024
7d280fb
fix(docker): Put circuit blobs in the right place
tizoc Sep 6, 2024
8d4d09e
Merge pull request #650 from openmina/fix/docker-circuit-blobs
tizoc Sep 6, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
runs-on: ubuntu-arm64
configuration:
- build_configuration: compose
- build_configuration: block_producers
- build_configuration: staging
runs-on: ${{ matrix.arch.runs-on }}
steps:
- name: Prepare
Expand Down Expand Up @@ -175,7 +175,7 @@ jobs:
configuration:
- build_configuration: compose
tag_suffix: ""
- build_configuration: block_producers
- build_configuration: staging
tag_suffix: "-producer-demo"
runs-on: ubuntu-latest
needs:
Expand Down
90 changes: 90 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -860,3 +860,93 @@ if let Some((callback, block_hash)) = callback_and_arg {

dispatcher.push(SnarkBlockVerifyAction::Finish { req_id: *req_id });
```

#### Callbacks instead of conditional dispatches

A common pattern seen in the current code is conditional dispatches:

```rust
if store.dispatch(SomeAction) {
store.dispatch(SomeOtherAction);
}
```

The equivalent with queueing is to use `dispatcher.push_if_enabled` which will return `true` if the enabling condition for that action returns `true`. This will work most of the time, but it is possible for the state to change between the time the action was enqueued and when it is finally going to be dispatched, so the enabling condition may not be `true` anymore. This means that the equivalence is not strict.

A better approach is to add a callback to the first action. This ensures that the second action only happens when intended, avoiding the potential race condition of the state changing between enqueuing and dispatching.

First a callback is added to the action:

```diff
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum LedgerWriteAction {
- Init { request: LedgerWriteRequest },
+ Init {
+ request: LedgerWriteRequest,
+ on_init: redux::Callback<LedgerWriteRequest>,
+ },
Pending,
// ...
```

Then in the handling code is updated to dispatch the callback:

```diff
match action {
LedgerAction::Write(a) => match a {
- LedgerWriteAction::Init { request } => {
- store.service.write_init(request);
+ LedgerWriteAction::Init { request, on_init } => {
+ store.service.write_init(request.clone());
store.dispatch(LedgerWriteAction::Pending);
+ store.dispatch_callback(on_init, request);
}
```

Finally the dispatching of that action is update to provide a callback that will return the same action that was inside the body of the conditional dispatch:

```diff
- if store.dispatch(LedgerWriteAction::Init {
+ store.dispatch(LedgerWriteAction::Init {
request: LedgerWriteRequest::StagedLedgerDiffCreate {
pred_block: pred_block.clone(),
global_slot_since_genesis: won_slot
// ...
supercharge_coinbase,
transactions_by_fee,
},
- }) {
- store.dispatch(BlockProducerAction::StagedLedgerDiffCreatePending);
- }
+ on_init: redux::callback!(
+ on_staged_ledger_diff_create_init(_request: LedgerWriteRequest) -> crate::Action {
+ BlockProducerAction::StagedLedgerDiffCreatePending
+ }
+ ),
+ });
```

In the above example the passed argument is not used, but for other callbacks it is useful. Consider this example where we need the block hash for the next action, which can be extracted from the data contained in the request:

```diff
- if store.dispatch(LedgerWriteAction::Init {
+ store.dispatch(LedgerWriteAction::Init {
request: LedgerWriteRequest::BlockApply { block, pred_block },
- }) {
- store.dispatch(TransitionFrontierSyncAction::BlocksNextApplyPending {
- hash: hash.clone(),
- });
- }
+ on_init: redux::callback!(
+ on_block_next_apply_init(request: LedgerWriteRequest) -> crate::Action {
+ let LedgerWriteRequest::BlockApply { block, .. } = request
+ else {
+ // Cannot happen because this is the same value we passed above
+ unreachable!()
+ };
+ let hash = block.hash().clone();
+ TransitionFrontierSyncAction::BlocksNextApplyPending { hash }
+ }
+ ),
+ });
```
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.8.2] - 2024-09-06

### Fixed

- Include circuit blobs in docker images, required for block production.
- Add missing bounds to ZkAppUri and TokenSymbol fields.
- Various stability improvements to make sure the node will not crash in certain circumstances.

### Changed

- Root snarked ledger re-syncs now reuse the previously in-progress root snarked ledger instead of starting again from the next-epoch ledger.
- Added `--libp2p-keypair=<path to json>` flag to specify encrypted secret key (with passphrase from `MINA_LIBP2P_PASS` environment variable).

## [0.8.1] - 2024-09-02

### Fixed
Expand Down Expand Up @@ -215,7 +228,8 @@ First public release.
- Alpha version of the node which can connect and syncup to the berkeleynet network, and keep applying new blocks to maintain consensus state and ledger up to date.
- Web-based frontend for the node.

[Unreleased]: https://github.com/openmina/openmina/compare/v0.8.1...develop
[Unreleased]: https://github.com/openmina/openmina/compare/v0.8.2...develop
[0.8.2]: https://github.com/openmina/openmina/releases/tag/v0.8.1...v0.8.2
[0.8.1]: https://github.com/openmina/openmina/releases/tag/v0.8.0...v0.8.1
[0.8.0]: https://github.com/openmina/openmina/releases/tag/v0.7.0...v0.8.0
[0.7.0]: https://github.com/openmina/openmina/releases/tag/v0.6.0...v0.7.0
Expand Down
52 changes: 27 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ mina-poseidon = {git = "https://github.com/openmina/proof-systems", branch = "le
poly-commitment = {git = "https://github.com/openmina/proof-systems", branch = "ledger-newtypes-rampup4-vrf"}
libp2p = { git = "https://github.com/openmina/rust-libp2p", rev = "5c44c7d9", default-features = false }
vrf = { path = "vrf" }
openmina-node-account = { path = "node/account" }
redux = { git = "https://github.com/openmina/redux-rs.git", rev = "588dd76c", features = ["serde"] }
serde = "1.0.190"
serde_json = "1.0.107"
Expand Down
Loading
Loading