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

automatically convert ASCII salt to hex #3257

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AyushSagar99
Copy link

No description provided.

Copy link

changeset-bot bot commented Oct 5, 2024

⚠️ No Changeset found

Latest commit: d952ff2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment on lines -117 to +119
Run 'echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > .env'
in your contracts directory to use the default anvil private key.`,
Run 'echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > .env'
in your contracts directory to use the default anvil private key.`,
Copy link
Member

Choose a reason for hiding this comment

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

let's not change the formatting here

Comment on lines -190 to -191
// We expect the worlds file to be committed and since local deployments are often
// a consistent address but different block number, we'll ignore the block number.
Copy link
Member

Choose a reason for hiding this comment

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

let's keep all these comments

Comment on lines +22 to +25
function encodeToHex(str: string): Hex {
return ("0x" + Buffer.from(str, "utf8").toString("hex")) as Hex;
}

Copy link
Member

Choose a reason for hiding this comment

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

there is a util from viem we can use instead: https://viem.sh/docs/utilities/toHex.html

const automine = await enableAutomine(client);

const startTime = Date.now();
const worldDeploy = await deploy({
config,
deployerAddress: opts.deployerAddress as Hex | undefined,
salt,
salt, // Use the new salt variable here
Copy link
Member

Choose a reason for hiding this comment

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

no need to add a comment here

Comment on lines +60 to +65
let salt: `0x${string}` | undefined = opts.salt as `0x${string}` | undefined;

if (salt != null) {
if (!isHex(salt)) {
salt = encodeToHex(salt) as `0x${string}`;
}
Copy link
Member

Choose a reason for hiding this comment

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

we can simplify this to const salt = opts.salt && !isHex(opts.salt) ? toHex(opts.salt) : opts.salt;

/**
* Given some CLI arguments, finds and resolves a MUD config, foundry profile, and runs a deploy.
* This is used by the deploy, test, and dev-contracts CLI commands.
*/
Copy link
Member

Choose a reason for hiding this comment

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

why were these comments removed?

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