Managing Modules in MEV Plus: A Comprehensive Tutorial

Introduction to MEV Plus and Modules

MEV Plus is an innovative sidecar ecosystem designed to enhance the capabilities of consensus layer validators by facilitating communication with external applications such as PBS and the execution layer. It introduces a modular architecture, allowing for the integration of various applications or modules, each serving a specific purpose within the MEV Plus ecosystem. These modules can be thought of as plugins or extensions that add functionality to MEV Plus, enabling a wide range of applications from native delegation to PBS operations and beyond.

Modules in MEV Plus are designed to be highly extensible, allowing developers to customize and integrate them according to their specific needs. This modularity not only enhances the flexibility and scalability of MEV Plus but also supports the development of new features and functionalities that can be seamlessly integrated into the platform.

Understanding the MEV Plus Design Architecture

At the heart of MEV Plus lies the Core Service, which acts as the central hub for managing modules and facilitating communication between them. The Core Service is responsible for registering, configuring, starting, and stopping modules. It maintains a registry of all modules, manages their communication channels, and ensures that modules can interact with each other securely and efficiently.

Managing Modules in MEV Plus

Managing modules in MEV Plus involves adding, removing, listing, and updating modules to enhance or modify the platform’s functionality according to your needs. This tutorial will guide you through the process of managing modules in MEV Plus.

Ensure Prerequisites are satisfied:

  • Go 1.20+ installed on your system.
  • Clone the MEV Plus repository to your local machine. This module management is available from MEV Plus v1.0.0+, and requires the source code of MEV Plus.

To get help on how to use the module manager [modules] you can run the following in the MEV Plus sourcecode or binary:

go run mevPlus.go modules -help

The additional functionality to manage modules are explained below.

Listing Modules

To view a list of installed modules, run the command in the root of the repository:

go run mevPlus.go modules -list

This will display all installed modules within MEV Plus you can perform the same operation on the built version of MEV Plus, to access information on modules:

  • Name: The module name/namespace
  • Description: Description the authors provide about its functionality
  • Type: internal are inbuilt, external are user-installed
  • Package URL: Remote url the external module was installed from
  • Package Release Date: Release date that the module version

Adding Custom Modules

To add a custom module to MEV Plus, follow these steps using your MEV Plus source code:

  1. Install the Module: Use the command
go run mevPlus.go modules -install <module-package-url> 

to install a new module. Replace <module-package-url> with the URL of the module package you wish to install. This would access the package and analyze it securely for the service specification MEV Plus requires.

If you already have a given module installed, you can update the module to a different version by passing the package url with the specific version tag you want installed. This would cause MEV Plus to update (upgrade/downgrade) the module to the specified version if compatible.

  1. Build MEV Plus: Build the most recent version of MEV Plus into a binary for your system. It would be built with the module you just installed. And the source code would maintain the installed module with a back up of the previous modules in the moduleList directory.*

Removing Modules

To remove an existing module from MEV Plus, use the command in the root of your MEV Plus source code:

go run mevPlus.go modules -remove <module-name_or_module-package-url>

Replace <module-name_or_module-package-url> with the name or package URL of the module you wish to remove. The package url or name can be gotten from the module list command.

When a package is removed a backup is maintained in the moduleList directory of the previous modules before the removal.*

Updating Modules

To update an existing module, use the command in the root of your MEV Plus source code:

go run mevPlus.go modules -update <module-name_or_module-package-url>

Replace <module-name_or_module-package-url> with the name or package URL of the module you wish to update.

Using the module name ONLY would cause MEV Plus to search for the latest version of the module to update if out-of-date. This is also possible with the package url that has no version or has the @latest tag.

*It is recommended to not manually tamper with the files in moduleList unless to replace the existing moduleList.go file with the backup of the previous state

Using Custom Modules

Once you have installed, updated, or removed your custom module, you can use it within MEV Plus by building your modified MEV Plus binary and running it with the required flags. Your custom module should now be integrated into or removed from MEV Plus as per your changes.

To ensure that your module changes are maintained in your binary, run the command:

go run mevPlus.go modules -list

on your built binary to see the list of installed modules and their versions.

Any module successfully installed and available in MEV Plus would have its private flags available to MEV Plus in the CLI. To view the flags available in the normal start up of MEV Plus, run the following:

With the mevPlus.go file in the source code directory:

go run mevPlus.go -help

Or with a built mevPlus binary

mevPlus -help

When running MEV Plus you should see in the logs:

INFO[0000] Discovered module for core communication: <module_name> 

Depending on the logic within the module and how it is configured, the module may start some microservices in MEV Plus or run with MEV Plus if you pass its flags.

Conclusion

Managing modules in MEV Plus is a straightforward process that allows developers to customize and extend the platform’s functionality according to their specific needs. Whether you’re adding a new module, removing an existing one, or updating a module, MEV Plus provides a flexible and adaptable solution for various applications. By adhering to the service interface and incorporating the necessary components into your custom module, you can extend MEV Plus’s capabilities and make it a tailored solution for your unique requirements.