Skip to content

feat(code): Add actor integrated application that uses proposal only#1066

Draft
ancazamfir wants to merge 29 commits intomainfrom
anca/actor-proposal-only
Draft

feat(code): Add actor integrated application that uses proposal only#1066
ancazamfir wants to merge 29 commits intomainfrom
anca/actor-proposal-only

Conversation

@ancazamfir
Copy link
Contributor

@ancazamfir ancazamfir commented Jun 2, 2025

WIP
Closes: #XXX
Helper app for #953

Not completely Part agnostic because:

  • context trait requires the ProposalPart type
  • signing requires part signing and signature verification
  • network requires ProtobufCodec: Codec<types::proposal::ProposalPart>

PR author checklist

For all contributors

For external contributors

}

message SyncResponse {
ValueResponse value_response = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field should probably be explicitly optional and handled as such, cf. https://github.com/informalsystems/malachite/issues/1074#issuecomment-2939030159

@romac
Copy link
Contributor

romac commented Jun 16, 2025

Moved the application to https://github.com/informalsystems/malachite-apps/pull/2

@romac romac force-pushed the anca/actor-proposal-only branch from 00456e7 to 4b3ae5b Compare June 16, 2025 12:23
@romac
Copy link
Contributor

romac commented Jun 16, 2025

Re-instated the app code so that Nenad can post his pending comments and push a few commits

Copy link
Contributor

@nenadmilosevic95 nenadmilosevic95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments added

Comment on lines +14 to +24
pub const fn as_u64(&self) -> u64 {
self.0
}

pub fn increment(&self) -> Self {
Self(self.0 + 1)
}

pub fn decrement(&self) -> Option<Self> {
self.0.checked_sub(1).map(Self)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we put this inside impl malachitebft_core_types::Height for Height block ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we could. Maybe we open an issue to discuss and solve across all apps. If we move all methods out of the concrete implementation then the app code will have to do calls like:

use malachitebft_core_types::CommitCertificate, Height as HeightTrait;

let start_height = HeightTrait::increment(&latest_block_height);

btw, the Height trait implements increment() and decrement() already.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some changes in db158ed so you see how it would look.

Comment on lines +74 to +76
pub fn id(&self) -> ValueId {
ValueId::new(self.value.block_hash.clone())
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we define this method two times?


state.consensus = Some(consensus.clone());

tokio::time::sleep(Duration::from_millis(200)).await;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this sleep here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is see it's removed. We do this sleep in all apps, @romac mentioned something around connection errors. We should probably investigate and clean the others if not required.


// If we have already built or seen one or more values for this height and round,
// feed them back to consensus. This may happen when we are restarting after a crash.
replay_undecided_values(state, height, round).await?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are we replaying here?

adizere

This comment was marked as outdated.

@adizere
Copy link
Contributor

adizere commented Jul 10, 2025

To discuss sync:

  • Most of Nenad's comments
  • Can we reuse malachitebft_test::Height in this example & more generally reuse other test types so that we deduplicate them
  • We should mark the distributed-testnet command as unimplemented (as we do in the channel-based app example)
  • What do we do with the Notes.md and more generally documentation for this example -- related to being moved to the apps repo

I'll schedule a sync soon.

..
} => on_decided(state, &consensus, certificate, &self.metrics).await,

HostMsg::GetDecidedValue { height, reply_to } => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants