-
Notifications
You must be signed in to change notification settings - Fork 94
vanity move address #1229
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
base: main
Are you sure you want to change the base?
vanity move address #1229
Conversation
There was a problem hiding this comment.
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. |
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
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.
It's so that I can add prefix/suffix patterns to an address right? |
There was a problem hiding this comment.
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.
Glad you do 🏴☠️ 🌈 |
Thanks for the test, will run after programme review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGayTM
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
util/vanity/src/cli.rs
Outdated
pub enum Vanity { | ||
Move { | ||
#[clap(long)] | ||
starts: Option<String>, |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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?
/// 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")] |
There was a problem hiding this comment.
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.
Summary
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
cargo build -p vanity
to build thevanity
targetcargo test -p vanity
Outstanding issues