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

Simulate execute on solana SDK [DPA-1418] #250

Closed
wants to merge 6 commits into from
Closed

Conversation

ecPablo
Copy link
Collaborator

@ecPablo ecPablo commented Jan 21, 2025

Adds the simulate operation functionality for the solana SDK

Summary

This pull request introduces a new Simulator class for the Solana SDK, along with corresponding tests. The most important changes include the implementation of the Simulator class, a new test suite for the Simulator, and a helper function for mocking Solana transactions.

New Simulator class implementation:

  • sdk/solana/simulator.go: Added a new Simulator class with methods for simulating operations and setting roots. This includes the NewSimulator constructor and methods SimulateSetRoot and SimulateOperation.

Testing:

  • sdk/solana/simulator_test.go: Added tests for the Simulator class, including TestNewSimulator to test the constructor and TestSimulator_SimulateOperation to test the SimulateOperation method.

Helper function for mocking:

  • sdk/solana/utils_test.go: Added a new helper function mockSolanaSimulation to mock Solana transaction simulations in tests.

Copy link

changeset-bot bot commented Jan 21, 2025

🦋 Changeset detected

Latest commit: c99c960

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@smartcontractkit/mcms Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ecPablo ecPablo marked this pull request as ready for review January 22, 2025 23:15
@ecPablo ecPablo requested a review from a team as a code owner January 22, 2025 23:15
return fmt.Errorf("not implemented")
}

func (s *Simulator) SimulateOperation(
Copy link
Contributor

@graham-chainlink graham-chainlink Jan 24, 2025

Choose a reason for hiding this comment

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

this was kind of what i was trying to avoid in SetRoot - another implementation for simulation, thats why i was experimenting the simulatable framework so we can easily make the existing implementation simulatable.

With the framework, it would be only a few lines of change for you here i believe? And the benefit is we get to test the most of the actual implementation of ExecuteOperation. (same code)

@@ -153,6 +153,48 @@ func mockSolanaTransaction(
}).Once()
}

func mockSolanaSimulation(
Copy link
Contributor

Choose a reason for hiding this comment

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

haha damn, looks like we overlap again lol

@graham-chainlink
Copy link
Contributor

super seeded by #277

@graham-chainlink graham-chainlink deleted the simulate-execute branch February 3, 2025 03:23
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