-
Notifications
You must be signed in to change notification settings - Fork 320
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
Fix test_cli_program_extend_program #1115
Fix test_cli_program_extend_program #1115
Conversation
dca2b45
to
b6cac1b
Compare
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, thanks for catching! I saw this CI failure a couple times and meant to check on it myself as well.
As for the confusing API, what do you think about changing the flag to no longer require a value, and simply be a flag-only option, like --no-auto-extend
? Happy to make this change myself.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1115 +/- ##
=========================================
- Coverage 82.2% 82.2% -0.1%
=========================================
Files 880 880
Lines 235631 235626 -5
=========================================
- Hits 193718 193706 -12
- Misses 41913 41920 +7 |
I think it's already a flag-only option? Lines 278 to 283 in 1cdaa6d
Line 2544 in 1cdaa6d
Wdyt @buffalojoec ? |
Ahh nuts, you're right it is. 😁
This was actually what I originally sought to avoid in the PR that introduced the change. The original implementation was doing what you suggested. My thinking was that most people would run into the transaction error and then turn around and pass the flag, so I felt it was better for DevEx to let those who specifically wanted to opt-out of auto-extend provide the flag, while everyone else got the auto-extend by default. Smoother for newbies. |
Yes, I'm not suggesting changing the behavior for cli users. I'm suggesting flopping the internal logic so it's less of a foot-gun for core contributors. I'll just PR it. |
I was also looking at this test, and the double negation is pretty much everywhere and seems unnecessary. |
@ilya-bobyr #1119 |
This call happens before we perform any operations, IIUC.
It is interesting that the length of the program is different, though... Line 1108 in 5b3390b
The trick is that because the test is not precise enough, any error causes it to pass. If I change the test code to
It seems like it comes from here: Lines 2896 to 2916 in 5b3390b
Are we somehow ignoring errors during the buffer update and just fail when we attempt to finalize the program? I would expect it to fail here instead: Lines 2880 to 2891 in 5b3390b
But when the test succeeds with
It originates here: Lines 2807 to 2808 in 5b3390b
It seems like it is the buffer extend operation itself that fails? |
Separately, I would like to point out that this test has two issues:
|
the default is to spend the user's money, rather than have them opt-in to it? |
Good question. There is some reasoning here: #791 (comment)
Looking at the rent except calculation here: Lines 73 to 77 in 9403ca6
I get:
73 SOL is about $9k in today prices. So I am not sure people would really allocate 10MBs just to save some computation. Even at $20, it is $1,460. |
Problem
test_cli_program_extend_program()
expects a program account to be too small for a specific program, but #791 extends during deploy by default.The api is confusing because of the double negatives, eg
no_extend: false
,!no_extend
Summary of Changes
Set
no_extend: true
throughouttest_cli_program_extend_program()
I'm okay with using the
--no-extend
flag, but I would recommend we rewrite the fields and logic to remove the double negatives.I am not sure why the test passes sometimes. I printed out the length of the account after the command at L1091 and sometimes it's 4820 (the one-byte-too-small size) and sometimes it's 4821. With the change in this PR, it's always 4820.
Possibly the
extend
transaction hadn't actually completed by the time this was called?agave/cli/src/program.rs
Lines 2548 to 2550 in 5b3390b
Commitment seems consistent across all commands and client, though.
The deploy command must be failing for some other reason in the cases the test passes.
Fixes #1114