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

chore(protocol): fix genesis tests and add minor changes #15741

Merged
merged 13 commits into from
Feb 13, 2024

Conversation

dantaik
Copy link
Contributor

@dantaik dantaik commented Feb 12, 2024

      - name: protocol - Deploy L1 Contracts
        working-directory: ./packages/protocol
        run: |
          anvil &
          while ! nc -z localhost 8545; do
            sleep 1
          done
          pnpm deploy:foundry

still fails.

Reverting nonReentrant implementation to the previous non-transient approach can make the test pass. Therefore, I guess the new nonReentrant implementation does have some side effect we need to figure out.

@Brechtpd may I suggest to keep the origiinal nonReentrant implementation in your PR then create a seperate PR for it?

Update

I removed some uncessary nonReentrant guards from some function, now the above script succeeds. It does reflect that the behavior of the new nonReentrant is different and we need to care. Please review carefully if these nonReentrant usage can be removed.

@dantaik dantaik requested a review from Brechtpd February 12, 2024 03:57
@dantaik dantaik marked this pull request as ready for review February 12, 2024 04:38
@dantaik dantaik changed the title suggested changes chore(protocol): add some suggested changes Feb 12, 2024
@dantaik dantaik changed the title chore(protocol): add some suggested changes chore(protocol): add some suggested changes & fix genesis test Feb 12, 2024
@dantaik dantaik requested a review from adaki2004 February 12, 2024 05:33
@dantaik dantaik changed the title chore(protocol): add some suggested changes & fix genesis test chore(protocol): add some suggested changes & fix tests Feb 12, 2024
@Brechtpd
Copy link
Contributor

Reverting nonReentrant implementation to the previous non-transient approach can make the test pass. Therefore, I guess the new nonReentrant implementation does have some side effect we need to figure out.

Oh that would be bad! If it is indeed different we have to check because it really should behave 100% identical (except for gas costs of course).

I removed some uncessary nonReentrant guards from some function, now the above script succeeds. It does reflect that the behavior of the new nonReentrant is different and we need to care. Please review carefully if these nonReentrant usage can be removed.

I think it's safer to keep all functions nonReentrant just in case. Even if a specific function does not need it itself, there can still be strange behavior when a nonReentrant function that can call an external contract can call into a function of itself that does state changes and doesn't have the guard. So ideally any function that does state changes should have the non-reentrant guard to make sure self calls never can have unexpected consequences.

@adaki2004
Copy link
Contributor

Reverting nonReentrant implementation to the previous non-transient approach can make the test pass. Therefore, I guess the new nonReentrant implementation does have some side effect we need to figure out.

Oh that would be bad! If it is indeed different we have to check because it really should behave 100% identical (except for gas costs of course).

Maybe bc. foundry does not suportts it yet ? It seems anvil does not.

#15741 (comment)

@Brechtpd
Copy link
Contributor

I also implemented transient storage for the bridge call context and that seems to work fine in the tests at least.

@dantaik
Copy link
Contributor Author

dantaik commented Feb 12, 2024

I'll revert the removal of nonEntrancy guards, but maybe Brecht you can revert the new nonEntrancy

I also implemented transient storage for the bridge call context and that seems to work fine in the tests at least.

The genesis tests depends on Anvil, I commented out a line to see if it works.

@dantaik
Copy link
Contributor Author

dantaik commented Feb 12, 2024

New all tests pass (removed a line from genesis test)

@Brechtpd
Copy link
Contributor

Looks like we may need to explicitly enable cancun in anvil like we currently have to do in forge to be able to use the latest opcodes.

image

But I have never run the deployment script so not sure how to best test this out.

@dantaik
Copy link
Contributor Author

dantaik commented Feb 13, 2024

Looks like we may need to explicitly enable cancun in anvil like we currently have to do in forge to be able to use the latest opcodes.

image

But I have never run the deployment script so not sure how to best test this out.

change the work flow to use anvil --hardfork cancun

@dantaik dantaik changed the title chore(protocol): add some suggested changes & fix tests chore(protocol): fix genesis tests and add minor changes Feb 13, 2024
@dantaik dantaik merged commit 479ac1a into brecht-review Feb 13, 2024
3 of 10 checks passed
@dantaik dantaik deleted the additional_changes branch February 13, 2024 08:14
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