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

Update bootstrap logic and README instructions to work with a local Emulator #138

Merged
merged 5 commits into from
Mar 7, 2024

Conversation

m-Peter
Copy link
Collaborator

@m-Peter m-Peter commented Mar 6, 2024

Description

  • Updates README with proper instructions on running the EVM Gateway with a local Emulator
  • Updates the bootstrap logic to work with live networks as well as a local Emulator
  • Updates the E2E tests

For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the standards mentioned here.
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@m-Peter m-Peter added this to the Flow-EVM-M2 milestone Mar 6, 2024
@m-Peter m-Peter self-assigned this Mar 6, 2024
@m-Peter m-Peter requested a review from devbugging March 6, 2024 10:12
@m-Peter m-Peter force-pushed the update-bootstrap-for-emulator branch from 863a1f5 to a916727 Compare March 6, 2024 10:48
@@ -14,6 +14,13 @@ import (
"github.com/onflow/flow-go/utils/io"
)

// Default InitCadenceHeight for initializing the database on a local emulator.
const EmulatorInitCadenceHeight = uint64(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

but this will cause the same issue with subscribing to events on the emulator right? the value 0 will be sent as the latest value to event subscription which will mean just get me the latest height. But if the evm-gateway misses some events on emulator and is then started it will also miss processing those events. I'm not sure how this is different?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Currently, it is not possible to use the Emulator locally. Starting the gateway fails with:

panic: failed to start event ingestion: failed to get provided cadence height: client: rpc error: code = NotFound desc = could not find block at height 1

That's because upon starting the Emulator, there is no block with height 1. On a live network, such block will most likely exist.

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand that, but the problem I described still exists. So if the emulator is started and then later evm-gateway the evm-gateway will miss all the events that happened before. Neither is great tbh. So I think the ultimate solution here would be to change the flow-go height 0 treated as special value. Until then we can probably use this solution, but add a todo with the issue linked saying that once this is merged we should remove all of this: onflow/flow-go#5481

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good. Added in 75a13ca

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe also add in readme an explanation that evm-gateway will be starting from latest emulator block, so if emulator is run before and transactions happen evm-gateway won't fetch those historically. You can also add a note that this will be improved soon.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea, let me do that quickly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated in 740d89c

@m-Peter m-Peter force-pushed the update-bootstrap-for-emulator branch from 75a13ca to 66756ea Compare March 6, 2024 19:12
@m-Peter m-Peter requested a review from devbugging March 6, 2024 19:13
@m-Peter m-Peter force-pushed the update-bootstrap-for-emulator branch from 66756ea to 95350f4 Compare March 7, 2024 08:05
Copy link
Contributor

@devbugging devbugging left a comment

Choose a reason for hiding this comment

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

Great, thank you

@devbugging devbugging merged commit e90aca9 into onflow:main Mar 7, 2024
1 check passed
@m-Peter m-Peter deleted the update-bootstrap-for-emulator branch March 20, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants