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

[x/programs] Add Engine and Store abstractions #657

Merged
merged 7 commits into from
Jan 5, 2024
Merged

Conversation

hexfusion
Copy link
Contributor

@hexfusion hexfusion commented Dec 14, 2023

This PR adds new types Engine and Store and also migrates the Meter out of runtime. This PR is one of many which will move towards owning our own types and having the runtime be a simple implementation of these types[1]. This PR also greatly simplifies the runtime.Config giving it basic configurations which affect the runtime implementation. The rest of the config is now directly part of the Engine. In the context of a VM a single engine should be used for the lifetime of the program. Very similar to a gRPC client. I hope to have the time to implement this as an example into the simulator.

In the previous implementation there was a 1:1 relationship between the Engine and the Store. But as each engine can have multiple stores we can reuse the engine in circumstances where we are making program to program calls. The allows us to have more fine grained controls on all of the stores with regards to termination. As a using Stop on a single engine will terminate all child stores.

[1] #631

Signed-off-by: Sam Batschelet <[email protected]>
Signed-off-by: Sam Batschelet <[email protected]>
@hexfusion hexfusion self-assigned this Dec 14, 2023
Signed-off-by: Sam Batschelet <[email protected]>
@hexfusion hexfusion marked this pull request as ready for review December 15, 2023 14:04
@MuffinsThaCat
Copy link

Will this make a difference in the way programs should be written?

samliok
samliok previously approved these changes Dec 19, 2023
Copy link
Contributor

@samliok samliok left a comment

Choose a reason for hiding this comment

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

Looks really good, the abstractions are real nice. Some comments about using inner and Inner() and a comment about bulk memory support otherwise lgtm

x/programs/engine/config.go Outdated Show resolved Hide resolved
x/programs/runtime/config.go Show resolved Hide resolved
x/programs/engine/engine.go Outdated Show resolved Hide resolved
x/programs/engine/store.go Show resolved Hide resolved
@hexfusion
Copy link
Contributor Author

Will this make a difference in the way programs should be written?

not this PR no

Signed-off-by: Sam Batschelet <[email protected]>
Signed-off-by: Sam Batschelet <[email protected]>
Signed-off-by: Sam Batschelet <[email protected]>
@dboehm-avalabs dboehm-avalabs enabled auto-merge (squash) January 5, 2024 18:55
@patrick-ogrady patrick-ogrady merged commit 1c21cfd into main Jan 5, 2024
18 checks passed
@patrick-ogrady patrick-ogrady deleted the refactor/engine branch January 5, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants