Skip to content

vanity move address - #1229

Open
Primata wants to merge 12 commits into
mainfrom
vanity-address
Open

vanity move address#1229
Primata wants to merge 12 commits into
mainfrom
vanity-address

Conversation

@Primata

@Primata Primata commented May 14, 2025

Copy link
Copy Markdown
Contributor

Summary

  • RFCs: scripts.

Adds util to mine move vanity addresses.

Vanity Addresses are widely used across crypto for flex or informing the user of address legitimacy. It does not make calldata tx cost to 00 padded addresses cheaper like EVM does though.

Changelog

util/vanity/*

Testing

  1. cargo build -p vanity to build the vanity target
  2. cargo test -p vanity

Outstanding issues

Copilot AI review requested due to automatic review settings May 14, 2025 00:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new CLI tool called "vanity" for mining Move addresses with customizable prefix/suffix patterns. Key changes include the addition of a mining utility in miner.rs, a CLI interface in main.rs and cli.rs with pattern validation, and integration into the overall workspace via configuration files and documentation.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
util/vanity/src/miner.rs Implements the vanity address mining logic using Rayon’s thread pool.
util/vanity/src/main.rs Provides the CLI entry point that invokes the mining utility.
util/vanity/src/cli.rs Adds pattern parsing and validation logic for user inputs.
util/vanity/README.md Documents the tool and its usage, with installation instructions.
util/vanity/Cargo.toml Defines the package and its dependencies.
util/vanity/.gitignore Excludes the target directory from version control.
Cargo.toml Integrates the vanity tool into the workspace.

Comment thread util/vanity/README.md Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread util/vanity/Cargo.toml Outdated
Comment thread util/vanity/README.md Outdated

@0xmovses 0xmovses left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks cool, can you explain a bit the intention of this tool. Why would I want to use it? I think it's worth adding a few unit tests to demonstrate its usage.

Comment thread util/vanity/src/main.rs Outdated
Comment thread util/vanity/src/main.rs Outdated
@0xmovses

Copy link
Copy Markdown
Contributor

It's so that I can add prefix/suffix patterns to an address right?

@Primata
Primata requested a review from l-monninger May 14, 2025 14:50

@0xmovses 0xmovses left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you write some unit tests for this? Then if all is good happy to approve, I support freedom of expression.

@Primata

Primata commented May 19, 2025

Copy link
Copy Markdown
Contributor Author

Glad you do 🏴‍☠️ 🌈

@0xmovses

Copy link
Copy Markdown
Contributor

Thanks for the test, will run after programme review.

@0xmovses 0xmovses left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGayTM

@ganymedio ganymedio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like a Cargo Format check is failing and I got a few failing tests in the vanity package:

   Compiling vanity v0.2.1 (/Users/andygmove/Downloads/repos/movement/util/vanity)
warning: unused import: `tracing`
  --> util/vanity/src/miner.rs:10:5
   |
10 | use tracing;
   |     ^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: unused import: `predicates::prelude`
  --> util/vanity/src/cli.rs:70:6
   |
70 |     use predicates::prelude::*;
   |         ^^^^^^^^^^^^^^^^^^^

warning: `vanity` (bin "vanity" test) generated 2 warnings (run `cargo fix --bin "vanity" --tests` to apply 1 suggestion)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 1m 22s
     Running unittests src/main.rs (target/debug/deps/vanity-c8535288652eb800)

running 5 tests
test cli::tests::test_valid_pattern ... ok
test cli::tests::test_cli_runs_with_ends ... FAILED
test cli::tests::test_cli_runs_with_starts ... FAILED
test cli::tests::test_cli_runs_with_starts_and_ends ... FAILED
test cli::tests::test_cli_parsing_starts_pattern ... ok

A couple Rust warnings in there to clean up.

Otherwise LGodlyTM. I tested it locally and it produced a valid keypair with my desired vanity address.

@ganymedio ganymedio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, I hadn't ran cargo build -p vanity first before running the tests. I did it just now and all passed.

I ran a cargo fmt to fix the Cargo Format CI failure and committed; I think this is good to merge.

Comment thread util/vanity/src/cli.rs Outdated
Comment thread util/vanity/src/cli.rs Outdated
Comment thread util/vanity/src/cli.rs Outdated
pub enum Vanity {
Move {
#[clap(long)]
starts: Option<String>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You probably want to invalidate the case where both --starts and --ends are None. You can either do this in the implementation or use ArgGroup.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You're still not invalidating this case. Is there a reason you don't want to do this?

Comment thread util/vanity/Cargo.toml
Comment thread util/vanity/src/main.rs Outdated
Comment thread util/vanity/src/lib.rs
/// Pattern parsing errors.
#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)]
pub enum PatternError {
#[error("the pattern's length exceeds 39 characters or the pattern is empty")]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If this is the case, why not make it pub struct Pattern(Box<[u8;39]>). That's a fixed-size, heap allocated byte-array with buffer that is always 39 characters and never any 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