Skip to content

Conversation

@chrismaree
Copy link
Member

@chrismaree chrismaree commented Nov 27, 2024

After playing with scripts last week, a number of the scripts were broken due to recent changes pre-audit.

This PR fixes this.

Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
@chrismaree chrismaree changed the title update scripts: feat: update scripts Nov 27, 2024

[provider]
cluster = "localnet"
wallet = "test/svm/keys/localnet-wallet.json"
Copy link
Contributor

Choose a reason for hiding this comment

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

this would break forking tests where we have overrided CCTP state with this key as permissioned actor

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, was not planning on committing when the PR is ready

@chrismaree chrismaree marked this pull request as ready for review December 2, 2024 08:28
@chrismaree chrismaree requested a review from Reinis-FRP December 2, 2024 08:41
const outputAmount = new BN(resolvedArgv.outputAmount);
const originChainId = new BN(resolvedArgv.originChainId);
const depositId = resolvedArgv.depositId;
const depositId = intToU8Array32(resolvedArgv.depositId);
Copy link
Contributor

Choose a reason for hiding this comment

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

this might not work with deterministic ids because of JS number size limitations. maybe better let resolvedArgv.depositId be string and parse it as BigNum->U8Array32 if it starts with 0x?

Copy link
Member Author

Choose a reason for hiding this comment

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

ye, this is a good point. I've updated accordingly and updated intToU8Array32 to support BN.

const outputAmount = new BN(resolvedArgv.outputAmount);
const originChainId = new BN(resolvedArgv.originChainId);
const depositId = intToU8Array32(resolvedArgv.depositId);
const depositId = intToU8Array32(new BN(resolvedArgv.depositId));
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think BN constructor automatically detects and parses hex strings

Copy link
Member Author

Choose a reason for hiding this comment

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

it's assumed its just a large number in a string so should be fine.

describe: "Ethereum address to convert",
}).argv;

async function logPublicKey(): Promise<void> {
Copy link
Contributor

@md0x md0x Dec 5, 2024

Choose a reason for hiding this comment

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

Do we want to add this to Anchor.toml scripts?

Copy link
Member Author

Choose a reason for hiding this comment

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

can run it with node as well but I'll add it, sure.

Copy link
Contributor

@md0x md0x left a comment

Choose a reason for hiding this comment

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

Looks good after addressing the BN issue that Reinis raised. Also, some scripts are not included in the Anchor.toml scripts section. Were they intended to be run differently than with anchor run?

Signed-off-by: chrismaree <christopher.maree@gmail.com>
@chrismaree chrismaree merged commit e23fab1 into master Dec 6, 2024
9 checks passed
@chrismaree chrismaree deleted the chrismaree/update-scripts branch December 6, 2024 09:57
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.

4 participants