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

ENG-314: copy monza crates to suzuka #47

Merged
merged 6 commits into from
May 10, 2024

Conversation

mzabaluev
Copy link
Collaborator

Create boilerplate for suzuka network and executor by copying the monza crates.

Shared crates renamed and moved under protocol-units/execution/aptos:

  • opt-executor
  • utils

mzabaluev added 2 commits May 10, 2024 10:04
Move and rename shared crates under protocol-units/execution/aptos:
- opt-executor
- utils
@mzabaluev mzabaluev requested a review from l-monninger May 10, 2024 07:09
@@ -1,5 +1,5 @@
[package]
name = "monza-opt-executor"
name = "movement-opt-executor"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would call this aptos-opt-executor

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This would make it look like one of the aptos-core crates, which would be confusing.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about suzuka-opt-executor?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is now shared between Monza and Suzuka, though I don't know if it will always be so.

@@ -1,5 +1,5 @@
[package]
name = "monza-execution-util"
name = "movement-execution-util"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again, if we're talking about extracting generalized aptos executors, I would title these as such.

use aptos_types::transaction::SignedTransaction;

#[derive(Clone)]
pub struct MonzaExecutorV1 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be called SuzukaExecutorV1. Similar updates elsewhere.

Copy link
Contributor

@0xmovses 0xmovses left a comment

Choose a reason for hiding this comment

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

Thanks! Just renaming comments and a few questions.

@@ -1,19 +1,19 @@
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Config {
pub execution_config : monza_execution_util::config::Config,
pub execution_config : movement_execution_util::config::Config,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the directory for this file still be monza/monza-config/? I think we want it renamed to networks/suzuka/suzuka-config/src/lib, or are we keeping these monza dir names? Seems confusing if we kept them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If I understood @l-monninger correctly, there is to be the common part of configuration, now in movement_execution_util, composed with the protocol-specific configuration like here in monza_config.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, that util will be shared across units using the movement-opt-executor -> maptos-opt-executor.

}

impl Config {

pub fn new(execution_config : monza_execution_util::config::Config) -> Self {
pub fn new(execution_config : movement_execution_util::config::Config) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub fn new(execution_config : movement_execution_util::config::Config) -> Self {
pub fn new(execution_config : suzuka_execution_util::config::Config) -> Self {

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above.


Url::from_str(
format!("http://{}", MONZA_CONFIG.monza_config.aptos_rest_listen_url.as_str()).as_str()
).unwrap()
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

#[tokio::test]
async fn test_example_interaction() -> Result<()> {
// :!:>section_1a
let rest_client = Client::new(NODE_URL.clone());
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we drop the comments //!:>section_1a they seem overally verbose

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Perhaps, I just copied this from the monza crate.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's because this is also a an example interaction copied from the Aptos upstream.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fine to leave for now IMO.

light_node_client: Arc<RwLock<LightNodeServiceClient<tonic::transport::Channel>>>,
}

impl <T : MonzaExecutor + Send + Sync + Clone>MonzaPartialFullNode<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
impl <T : MonzaExecutor + Send + Sync + Clone>MonzaPartialFullNode<T> {
impl <T : SuzukaExecutor + Send + Sync + Clone>SuzukaPartialFullNode<T> {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also it looks like proper formatting is not enforced in the workspace, which it should be. I'll look into adding a CI check.

@@ -0,0 +1,68 @@
[package]
name = "suzuka-executor"
Copy link
Contributor

Choose a reason for hiding this comment

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

👍



#[tonic::async_trait]
pub trait MonzaExecutor {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is going to be a generalised Executor :

Suggested change
pub trait MonzaExecutor {
pub trait MovementExecutor {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, this is a Suzuka-specific crate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But the trait itself could be migrated into a common crate if it needs to be, I haven't looked into such things yet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, this should be Suzuka specific.

/// The block is committed to the state, at this point
/// fork choices must be resolved otherwise the commitment and subsequent execution will fail.
Commit,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove this enum, its dead code now. And all its doc comments

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@l-monninger agree?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, I honestly thought I had already dropped this.

@mzabaluev
Copy link
Collaborator Author

These environment variable names are prefixed with MONZA, but the configuration is currently shared. Any ideas how to improve this?

@mzabaluev mzabaluev requested a review from l-monninger May 10, 2024 13:58
mzabaluev added 2 commits May 10, 2024 18:55
These names were confusing, rename to
MonzaPartialNode and SuzukaPartialNode
@mzabaluev mzabaluev force-pushed the mikhail/suzuka-network-boilerplate branch from 1b0c7b3 to 664e786 Compare May 10, 2024 15:55
@l-monninger
Copy link
Collaborator

These environment variable names are prefixed with MONZA, but the configuration is currently shared. Any ideas how to improve this?

I like prefixes targeting the particular unit. So, let's go with whatever we call the opt-executor. I think maptos is best, so MAPTOS.

@l-monninger
Copy link
Collaborator

Also, @mzabaluev, why are you force pushing? Is something up?

@l-monninger
Copy link
Collaborator

@mzabaluev @0xmovses maptos is a feature.

@l-monninger
Copy link
Collaborator

@mzabaluev
For me, we can call this good for now. But...

  1. We still need to rename the ENV vars. However, that will require updating the process-compose scripts.
  2. I am going to make a separate ticket for adding suzuka process-compose scripts.
  3. The finality mode bit is a little awkward because not necessarily all crates using maptos-opt-executor will have those finality modes, and they won't necessarily mean the exact same thing even if the name is the same. We may want to move that FinalityMode enum into monza.

I am going to approve. In particular, because Richard and I may have an easier time working on Suzuka over the weekend if this is merged. If you get a chance to merge, go for it.

@mzabaluev
Copy link
Collaborator Author

Also, @mzabaluev, why are you force pushing? Is something up?

No, just coalescing some fixup commits into larger topical changes, also rebased against latest main. If this is too disruptive for review, I will not do this. We should consider, as general pracitce, if we want to squash for the final merge to avoid many WIP and fixup commits that would be difficult to cherry-pick or revert later.

@l-monninger
Copy link
Collaborator

l-monninger commented May 10, 2024

No, just coalescing some fixup commits into larger topical changes, also rebased against latest main. If this is too disruptive for review, I will not do this. We should consider, as general pracitce, if we want to squash for the final merge to avoid many WIP and fixup commits that would be difficult to cherry-pick or revert later.

Idc. With PR flow it doesn't matter too much. Was just wondering.

@mzabaluev mzabaluev merged commit 4911871 into main May 10, 2024
0 of 4 checks passed
@mzabaluev mzabaluev deleted the mikhail/suzuka-network-boilerplate branch May 10, 2024 21:19
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.

3 participants