LimeChain / Fruzhin

Java implementation of the Polkadot Host
Apache License 2.0
29 stars 1 forks source link

refactor(runtime)!: add runtime execution context #456

Closed David-Petrov closed 3 months ago

David-Petrov commented 3 months ago

Description

A rather big refactor striving to make runtime invocations sandboxable, i.e. decouple them from the spring app context (dependencies on its beans) and any dependencies on global singletons. We do this by introducing an explicit Context object to manage those dependencies. It gets injected into the runtime instance on construction, thus enabling us to create instances with different execution contexts.

Detailed description

A detailed description can be found in each of the commit's messages:

Anything not explicitly mentioned in the above list is trivial (or I've missed to mention it, so feel free to raise any noticed oddities).

Fixes #375, #376, and the first big half of #355


For traceability's sake: this PR is the realisation of the POC showcased in #413.

Checklist:

David-Petrov commented 3 months ago

For some reason, not yet known to me, BlockExecutorTest doesn't pass in GitHub's test environment. We gotta fix this before merging.

David-Petrov commented 3 months ago

I also don't like the structure of the runtime package as-is. It was initially decomposed more sanely, but when I got to staging files I figured we'd lose the entire history (+ the PR's diffs would've become incomprehensible with all of the moved files), so I left this as a final step for a separate PR (only moving things around) after this one's done being reviewed.

ablax commented 3 months ago

For some reason, not yet known to me, BlockExecutorTest doesn't pass in GitHub's test environment. We gotta fix this before merging.

It's because of the wasmer-java not being able to be used in github action runner. That's the reason it was disabled in the first place

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud