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

test: add differential test #3087

Closed
wants to merge 1 commit into from
Closed

test: add differential test #3087

wants to merge 1 commit into from

Conversation

exp7l
Copy link

@exp7l exp7l commented Feb 7, 2024

Overview

This implements a solution to #2519.

What is the problem?

The fuzz test that tests against the celestia-app's ABCI is not exact in asserting the number of transactions returned by PrepareProposal.

What is the solution? What other solutions did I consider?

A solution is to reuse square.Build to make a square out of the unfiltered and unordered transactions provided by the fuzz test. Then compare the number of transactions in this square with that returned by PrepareProposal. This basically reimplements some of PrepareProposal to differentially test it.

The other potential solution is somehow calculate how many transactions will end up in the block. It seems to me it'd be complicated to extract a formula. I was looking here https://github.com/celestiaorg/go-square/blob/cd8e5d1065842d958f11d85e8a2ad73cbce252b0/square/square.go#L27-L35.

Checklist

  • Rebase later to include the commits for go-square repo migration
  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

@exp7l exp7l changed the title fuzz_abci_test: add differential test using reconstruct fuzz_abci_test: add differential test Feb 7, 2024
@exp7l
Copy link
Author

exp7l commented Feb 7, 2024

Hi @rootulp, I'm curious what you think about the approach here.

(I still need to rebase onto main's HEAD later, but like for you to see if the approach makes sense before I figure out the rebasing)

@rootulp rootulp changed the title fuzz_abci_test: add differential test test: add differential test Feb 7, 2024
@rootulp
Copy link
Collaborator

rootulp commented Feb 7, 2024

Note: I updated the PR title to conform to conventional commits b/c the PR title will be used as the commit message if this PR gets merged

@rootulp
Copy link
Collaborator

rootulp commented Feb 7, 2024

I haven't looked deeply into the alternative approach this PR is proposing but it looks like the assertion still exists in this PR:

require.GreaterOrEqual(t, len(resp.BlockData.Txs), sendTxCount+1)

so I'm wondering if this PR would actually close #2519. TBH it's tough to say because #2519 doesn't have acceptance criteria so maybe we should work on clarifying the desirable outcome of that issue before we proceed with implementing a fix. cc: @evan-forbes

@exp7l
Copy link
Author

exp7l commented Feb 12, 2024

Any updates? @rootulp @evan-forbes

@exp7l
Copy link
Author

exp7l commented Feb 12, 2024

Thanks for assigning. @rootulp

To clarify myself above, I meant to ask: does my approach here provide "exactness with how many transactions are expected to be included in the block." (quote from issue)? If not, can you help me understand what is missing and what is the desirable outcome?

Perhaps @evan-forbes can help like you say.

Thanks

@exp7l
Copy link
Author

exp7l commented Feb 26, 2024

@rootulp Hi!

So I'm just wondering if you folks like to onboard people to contribute.
And is this draft going in the right direction or a different approach is needed?

I am quite curious about Celestia core dev work, and like to contribute as an outside contributor. It can be this issue or some other issue, if you folks are interested in bringing people on.

@rootulp
Copy link
Collaborator

rootulp commented Feb 28, 2024

Hi @exp7l sorry for our delay. We are interested in on-boarding new contributors but I don't think #2519 is easy to work on because it's not clear (at least to me) what that issue is asking for. I apologize because you already started working on it but are there other issues here that seem interesting to you?

// then compare the length of this list and the list returned by testApp.PrepareProposal.
// Discussion: https://github.com/celestiaorg/celestia-app/issues/2519
reconstrucedTxs := reconstruct(testApp, height, blockTime, coretypes.Txs(txs).ToSliceOfBytes(), encConf.TxConfig)
require.Equal(t, len(reconstrucedTxs), len(resp.BlockData.Txs))
Copy link
Member

@evan-forbes evan-forbes Feb 28, 2024

Choose a reason for hiding this comment

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

this is great work @exp7l !! its a good thing to test, but we already have tests that reconstruct the block data from the square and compare these things. per this comment I think that what we want is to compare the input to the square with the resulting txs from PrepareProposal

@evan-forbes
Copy link
Member

apologies for the delay @exp7l this slipped through my notifications

@rootulp
Copy link
Collaborator

rootulp commented Apr 4, 2024

Going to close this b/c it doesn't appear to be actively worked on.

@rootulp rootulp closed this Apr 4, 2024
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.

3 participants