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

Wait for the transaction to finalize in relay test #55

Closed
ryanycw opened this issue Aug 24, 2023 · 4 comments
Closed

Wait for the transaction to finalize in relay test #55

ryanycw opened this issue Aug 24, 2023 · 4 comments
Assignees
Labels
bug Something isn't working relayer test test improvements

Comments

@ryanycw
Copy link
Member

ryanycw commented Aug 24, 2023

Describe the bug
In #25 the hardhat test won't wait for post transaction to finish. Need to find a way to wait for the transaction to finish. And make sure the synchronizer have get the transaction and update the db.

To Reproduce
yarn relay test

Expected behavior

it('should create a post', async () => {
    // FIXME: Look for fuzzer to test content
    const testContent = 'test content'

    const epochKeyProof = await userState.genEpochKeyProof({
        nonce: 0,
    })

    const res = await fetch(`${HTTP_SERVER}/api/post`, {
        method: 'POST',
        headers: {
            'content-type': 'application/json',
        },
        body: JSON.stringify(
            stringifyBigInts({
                content: testContent,
                publicSignals: epochKeyProof.publicSignals,
                proof: epochKeyProof.proof,
            })
        ),
    }).then((r) => r.json())
    //expect(res.status).equal(200)
    //expect(res.body).('postId')
    // TODO: verify post
    // [ ] verify transaction
    // [ ] fetch post
})

Make sure this test passed with the right checks, finishing the TODO

Additional context
Add any other context about the problem here.

@github-actions github-actions bot added bug Something isn't working test test improvements labels Aug 24, 2023
@ryanycw
Copy link
Member Author

ryanycw commented Aug 25, 2023

@andy78644 Do you have any progress on this? Cause I've solved my previous problem, and I can jump in to work on this with you.

@andy78644
Copy link
Collaborator

@ryanycw Just start. I think I can finish it today

@ryanycw
Copy link
Member Author

ryanycw commented Aug 25, 2023

@andy78644 I believe I've just solved it! Let me push the code in a bit, see if there is anything you want to solve.

@ryanycw
Copy link
Member Author

ryanycw commented Aug 25, 2023

I will close this issue for now, feel free to open new issue if there is anything to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working relayer test test improvements
Projects
None yet
Development

No branches or pull requests

2 participants