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

Illustrate why TestResourcesDataApp fails #4696

Closed
wants to merge 1 commit into from

Conversation

michaeldiamant
Copy link
Contributor

Illustrates why TestResourcesDataApp fails in https://app.circleci.com/pipelines/github/algorand/go-algorand/10048/workflows/dab1223e-f91d-4865-8824-ab00327a41f1/jobs/176490 by reverting https://github.com/algorand/go-algorand/pull/4669/files#diff-f98dee0358238dafbdeae29c761862fbc496f0af2335d85cdec69954a82ba848R214. The PR intends to generate discussion + agree on desired behavior.

Notes:

  • With this PR, go test ./ledger -run "TestResourcesDataApp" -count=1000 passes. Without the PR, it consistently fails.
  • Prior to this PR, TestResourcesDataApp fails because it assumes a randomly generated AppLocalState contains either a non-zero NumUint or non-zero NumByteSlice.
  • Though it's not immediately clear to me if the generator of test design needs to be changed (bolded is my assumption).

@michaeldiamant
Copy link
Contributor Author

Closing - Based on further source code inspection, I concluded the generator is correct without this PR and TestResourcesDataApp must be modified.

If folks feel I reached the wrong conclusion, let me know with a note here.

Rationale:

  • I see initialization AppLocalState initialization in ledger/apply passes the App's LocalStateSchema:
    localState := basics.AppLocalState{
    Schema: params.LocalStateSchema,
    }
  • Since App's must define local and app schemas at initialization, I think it's safe to conclude AppLocalState.Schema is always non-nil. 0 byteslice and 0 int local state usage is a valid use case. Consequently, this PR's change is incorrect because it artificially limits the range of valid examples.

@michaeldiamant michaeldiamant deleted the broken_test branch October 26, 2022 16:02
@michaeldiamant
Copy link
Contributor Author

For completeness - #4699 contains a proposed fix.

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.

1 participant