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

feat(cosmwasm): save salt in config file #217

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

jcs47
Copy link
Contributor

@jcs47 jcs47 commented Apr 24, 2024

No description provided.

@jcs47 jcs47 requested a review from a team as a code owner April 24, 2024 21:11
@jcs47 jcs47 requested review from cjcobb23 and milapsheth April 24, 2024 21:11
@@ -35,20 +35,21 @@ const uploadContract = async (client, wallet, config, options) => {
return client.upload(account.address, wasm, uploadFee).then(({ checksum, codeId }) => ({ checksum, codeId, account }));
})
.then(({ account, checksum, codeId }) => {
const usedSalt = salt || contractName.concat(chainNames);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const usedSalt = salt || contractName.concat(chainNames);
let salt = options.salt || contractName.concat(chainNames);

to reuse salt name

const address = instantiate2
? instantiate2Address(
fromHex(checksum),
account.address,
fromHex(getSaltFromKey(salt || contractName.concat(chainNames))),
fromHex(getSaltFromKey(usedSalt)),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fromHex(getSaltFromKey(usedSalt)),
fromHex(getSaltFromKey(salt)),

'axelar',
)
: null;

return { codeId, address };
return { codeId, address, usedSalt };
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return { codeId, address, usedSalt };
return { codeId, address, salt };

const address = instantiate2
? instantiate2Address(
fromHex(checksum),
account.address,
fromHex(getSaltFromKey(salt || contractName.concat(chainNames))),
fromHex(getSaltFromKey(usedSalt)),
Copy link
Member

Choose a reason for hiding this comment

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

Does the salt need to bytes32, or can it be a string? If the latter, then getSaltFromKey isn't needed. We could use the readable string as is

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.

2 participants