Skip to content

Conversation

@algorandskiy
Copy link
Contributor

@algorandskiy algorandskiy commented Aug 5, 2021

Summary

  • Make sure there is no overflow on TotalExtraAppPages calculation + test

Test Plan

One new test for overflow check on subtract

Copy link
Contributor

Choose a reason for hiding this comment

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

a typo in the comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not following why br.TotalExtraAppPages==expTotalExtraPages-1. isn't it set to expTotalExtraPages on line 1116?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

expTotalExtraPages is a poor name, it should be initTotalExtraPages

Copy link
Contributor

Choose a reason for hiding this comment

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

if we got below zero here, then we have a bug elsewhere. I'm not sure what the best course of action here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kind of agree but 1) it should not never happen :) 2) I guess being error tolerate here is fine

Copy link
Contributor

Choose a reason for hiding this comment

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

What, if anything, do we do during the same calculation on schemas?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nothing,

	totalSchema = totalSchema.SubSchema(globalSchema)
	record.TotalAppSchema = totalSchema

would set it to zeros

@codecov-commenter
Copy link

codecov-commenter commented Aug 5, 2021

Codecov Report

Merging #2694 (10dbce6) into master (39be0c7) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2694      +/-   ##
==========================================
- Coverage   47.07%   47.06%   -0.01%     
==========================================
  Files         349      349              
  Lines       55858    55878      +20     
==========================================
+ Hits        26294    26301       +7     
- Misses      26617    26624       +7     
- Partials     2947     2953       +6     
Impacted Files Coverage Δ
protocol/consensus.go 0.00% <ø> (ø)
config/consensus.go 84.01% <100.00%> (+0.22%) ⬆️
data/basics/overflow.go 43.42% <100.00%> (+12.77%) ⬆️
ledger/apply/application.go 80.59% <100.00%> (+2.20%) ⬆️
ledger/blockqueue.go 81.03% <0.00%> (-4.03%) ⬇️
network/wsPeer.go 72.14% <0.00%> (-2.23%) ⬇️
catchup/peerSelector.go 98.95% <0.00%> (-1.05%) ⬇️
ledger/acctupdates.go 61.88% <0.00%> (-0.42%) ⬇️
network/wsNetwork.go 60.73% <0.00%> (-0.19%) ⬇️
catchup/service.go 69.35% <0.00%> (+0.77%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 39be0c7...10dbce6. Read the comment docs.

@algorandskiy algorandskiy force-pushed the pavel/extra-page-upgrade branch from 760def1 to b598a3d Compare August 5, 2021 20:38
@algorandskiy algorandskiy self-assigned this Aug 5, 2021
@algorandskiy algorandskiy force-pushed the pavel/extra-page-upgrade branch from b598a3d to 10dbce6 Compare August 5, 2021 21:46
@algorandskiy algorandskiy changed the title WIP: Consensus upgrade for ExtraProgramPages fix Consensus upgrade for ExtraProgramPages fix Aug 5, 2021
jannotti
jannotti previously approved these changes Aug 5, 2021
Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

The changes is this PR, as far as I can tell, are flawless.
However, I found an issue in the previous EnableExtraPagesOnAppUpdate implementation:

  • updateApplication:
    The code tests len(ac.ApprovalProgram) + len(ac.ClearStateProgram) against int(1+params.ExtraProgramPages) * proto.MaxAppProgramLen, which is incorrect.
    It should test each of the programs against int(1+params.ExtraProgramPages) * proto.MaxAppProgramLen and test the sum of their length against MaxAppTotalProgramLen

@shiqizng
Copy link
Contributor

shiqizng commented Aug 6, 2021

The changes is this PR, as far as I can tell, are flawless.
However, I found an issue in the previous EnableExtraPagesOnAppUpdate implementation:

  • updateApplication:
    The code tests len(ac.ApprovalProgram) + len(ac.ClearStateProgram) against int(1+params.ExtraProgramPages) * proto.MaxAppProgramLen, which is incorrect.
    It should test each of the programs against int(1+params.ExtraProgramPages) * proto.MaxAppProgramLen and test the sum of their length against MaxAppTotalProgramLen

I believe program size calculation has been combined for approval and clear state. MaxAppProgramLen is increased to 2048 in v28.

@tsachiherman
Copy link
Contributor

The changes is this PR, as far as I can tell, are flawless.
However, I found an issue in the previous EnableExtraPagesOnAppUpdate implementation:

  • updateApplication:
    The code tests len(ac.ApprovalProgram) + len(ac.ClearStateProgram) against int(1+params.ExtraProgramPages) * proto.MaxAppProgramLen, which is incorrect.
    It should test each of the programs against int(1+params.ExtraProgramPages) * proto.MaxAppProgramLen and test the sum of their length against MaxAppTotalProgramLen

I believe program size calculation has been combined for approval and clear state. MaxAppProgramLen is increased to 2048 in v28.

Correct - the total size was updated to be 2048. But the check in the updateApplication should align with the check in the WellFormed for new apps. I believe that it's not an issue as long as the MaxAppProgramLen == MaxAppTotalProgramLen, but it could be an issue if they differ.
i.e. if we increase the size of MaxAppTotalProgramLen to 4096, for instance, we could create an app with two programs (1K+1K) or with (2K+2K), but we won't be able to them to be (2K+2K).

* Make sure there is no overflow on TotalExtraAppPages calculation + test
* proto.MaxAppTotalProgramLen is used in updateApplication
@algorandskiy algorandskiy force-pushed the pavel/extra-page-upgrade branch from 90bef2b to 696c34e Compare August 6, 2021 15:13
@algorandskiy
Copy link
Contributor Author

Thank you, changed to MaxAppTotalProgramLen. Merged-in a e2e test from @jasonpaulos

shiqizng
shiqizng previously approved these changes Aug 6, 2021
jasonpaulos
jasonpaulos previously approved these changes Aug 6, 2021
@algorandskiy algorandskiy dismissed stale reviews from jasonpaulos and shiqizng via c38d8dd August 6, 2021 15:36
Comment on lines +439 to +443
func (client RestClient) PendingTransactionInformationV2(transactionID string) (response generatedV2.PendingTransactionResponse, err error) {
transactionID = stripTransaction(transactionID)
err = client.get(&response, fmt.Sprintf("/v2/transactions/pending/%s", transactionID), nil)
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be implemented with versionAffinity, but it doesn't have to be implemented with that on this PR.

@algojohnlee algojohnlee merged commit f3671c0 into algorand:master Aug 6, 2021
onetechnical pushed a commit to algorand/indexer that referenced this pull request Aug 6, 2021
…ate (#604)

Consensus upgrade for ExtraProgramPages: algorand/go-algorand#2694
Added EnableExtraPagesOnAppUpdate to v29 update.
onetechnical pushed a commit to algorand/indexer that referenced this pull request Aug 6, 2021
…ate (#604)

Consensus upgrade for ExtraProgramPages: algorand/go-algorand#2694
Added EnableExtraPagesOnAppUpdate to v29 update.
bricerisingalgorand pushed a commit that referenced this pull request Aug 6, 2021
Make sure there is no overflow on TotalExtraAppPages calculation + test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants