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: add support for --sbf-program flag in test-validator #1393

Merged
merged 3 commits into from
Dec 15, 2024

Conversation

sergeytimoshin
Copy link
Contributor

This allows adding SBF programs to the genesis configuration with upgrades disabled. The flag accepts pairs of arguments (address and path) to specify programs, and validates input to ensure correct usage.

This allows adding SBF programs to the genesis configuration with upgrades disabled. The flag accepts pairs of arguments (address and path) to specify programs, and validates input to ensure correct usage.
@ananas-block
Copy link
Contributor

ananas-block commented Dec 14, 2024

Thanks for the pr!

can you add tests?

additionally can you adapt the template we use in light init and test it with that as well?
(I think we don't have test coverage for light init right now at all which is not ideal. The inited project can either be in gitignore (thats how we did it for psp init commands) or the target folder.)

Does this work with multiple programs as inputs like this?
light test-validator --sbf-program 2tzfijPBGbrR5PboyFUFKzfEoLTwdDSHUjANCw929wyt e2e_test --sbf-program asft4qfijPBGbrR5PboyFUFKzfEoLTwdDSHUjANCw929wyt other_test_program

@ananas-block
Copy link
Contributor

Can you add a check for duplicates and collisions with our system programs?
(solana test-validator just doesn't deploy sth if it is a duplicate which is an annoying foot gun.)

cli/test/commands/test-validator/index.test.ts Dismissed Show dismissed Hide dismissed
cli/test/commands/test-validator/index.test.ts Dismissed Show dismissed Hide dismissed
cli/test/commands/test-validator/index.test.ts Dismissed Show dismissed Hide dismissed
cli/test/commands/test-validator/index.test.ts Dismissed Show dismissed Hide dismissed
@sergeytimoshin
Copy link
Contributor Author

can you add tests?

Done (and while adding tests found a bug with the indexer-port flag: it only worked if we simulateonusely pass the database-url flag, fixed).

additionally can you adapt the template we use in light init and test it with that as well? (I think we don't have test coverage for light init right now at all which is not ideal. The inited project can either be in gitignore (thats how we did it for psp init commands) or the target folder.)

Hm, the only place where we load sbf programs in template is https://github.com/Lightprotocol/compressed-program-template/blob/main/programs/%7B%7Brust-name%7D%7D/tests/test.rs#L27, but it's solana runtime, unrelated to our typescript cli, am I missed something?

Does this work with multiple programs as inputs like this? light test-validator --sbf-program 2tzfijPBGbrR5PboyFUFKzfEoLTwdDSHUjANCw929wyt e2e_test --sbf-program asft4qfijPBGbrR5PboyFUFKzfEoLTwdDSHUjANCw929wyt other_test_program

Yes.

@ananas-block
Copy link
Contributor

Wrt template, you are right the template doesn't have a typescript right now. I thought it would be nice to have the correct command to run the test command with a correctly configured light cli already even though its not used yet. But we can add this as well once we have added a ts test to the template.

Copy link
Contributor

@ananas-block ananas-block left a comment

Choose a reason for hiding this comment

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

Thanks for adding the tests!
Looks great! Just have one more assert I would like to see.

… test-validator command

* added test check to validate the program deployment and ensure the account is executable
Copy link
Contributor

@ananas-block ananas-block left a comment

Choose a reason for hiding this comment

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

lgtm feel free to merge once green!

@sergeytimoshin sergeytimoshin merged commit 204895c into main Dec 15, 2024
8 checks passed
@sergeytimoshin sergeytimoshin deleted the sergey/cli-sbf-program-flag branch December 15, 2024 19:48
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