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

[TT-1936] Seth with simulated backend #1593

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Tofel
Copy link
Contributor

@Tofel Tofel commented Jan 22, 2025

This PR adds support for passing simulated.Client implementation to Seth, which includes both a client connected to a live RPC and a Simulated Backend.


Below is a summarization created by an LLM (gpt-4-0125-preview). Be mindful of hallucinations and verify accuracy.

Why

These changes introduce support for EIP-1559 transactions, adjust gas price estimation, and include various library updates. The modifications ensure compatibility with recent Ethereum network updates and improve the reliability of transaction processing and gas estimation.

What

  • seth.toml: Enabled EIP-1559 dynamic fees for more efficient gas price management on compatible networks.
  • seth/tracing.go: Updated RPC dialing to use the MustFirstNetworkURL function, ensuring the connectivity setup is more robust and error-handling is improved.
  • go.mod and go.sum: Updated dependencies for better compatibility and security. This includes updates to go-ethereum, which contains critical fixes and improvements for blockchain interactions.
  • seth/gas_bump_test.go: Modified gas bumping tests to reflect changes in gas management, particularly for EIP-1559 transactions.
  • seth/seth.toml: Adjusted default configurations for gas prices and transaction fees to align with the new EIP-1559 structures and the current network conditions.

@Tofel Tofel force-pushed the tt-1936-seth-simulated-backend branch from e076fb9 to 4af5ca6 Compare January 22, 2025 15:53
@Tofel Tofel marked this pull request as ready for review January 22, 2025 16:20
@Tofel Tofel requested a review from sebawo as a code owner January 22, 2025 16:20
@Tofel Tofel requested a review from a team as a code owner January 22, 2025 16:20
@cl-sonarqube-production
Copy link

@@ -64,7 +65,7 @@ var (
// Client is a vanilla go-ethereum client with enhanced debug logging
type Client struct {
Cfg *Config
Client *ethclient.Client
Client simulated.Client
Copy link

Choose a reason for hiding this comment

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

Does it replace the ethclient.Client completely? In the dev-platform CLI we're using seth.Client also in the production environment. Our question and request was to be able to swap the real client with a simualted one, so in unit/isolated tests we don't need to interact with Anvil (or similar), but rather in-memory simulated backend.

Here's example how we're constructing seth.Client: https://github.com/smartcontractkit/dev-platform/blob/main/cmd/client/eth_client.go#L94
And here's example how it's used to interact with capabilities registry contract: https://github.com/smartcontractkit/dev-platform/blob/main/cmd/client/capabilities_registry_client.go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it doesn't. simulated.Client is just an interface, you can pass *ethclient.Client as simulated.Client. Anyway, this only applies if you pass simulated backed explicitly to the builder like this WithEthClient(backend.Client()).. Otherwise it will use the URL provided and start a normal client.

Copy link

Choose a reason for hiding this comment

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

Ok, thanks for clarification 🙇

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.

2 participants