-
Notifications
You must be signed in to change notification settings - Fork 698
Add programPrepare and programRequiresPrepare wasm imports #4013
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
base: master
Are you sure you want to change the base?
Conversation
❌ 4 Tests Failed:
View the top 3 failed tests by shortest run time
📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
2fb49b5 to
fcc1383
Compare
fcc1383 to
5355d3f
Compare
rauljordan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes are pretty straightforward, LGTM
tsahee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small request
arbos/programs/programs.go
Outdated
| statedb.AddStylusPages(program.footprint) | ||
| defer statedb.SetStylusPagesOpen(open) | ||
|
|
||
| handleProgramPrepare(statedb, moduleHash, contract.Address(), contract.Code, contract.CodeHash, params.MaxWasmSize, params.PageLimit, evm.Context.Time, debugMode, program, runCtx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's take it one small step forward:
- have handleProgramPrepare return localAsm []byte.
- have the native implementation be current lines 230.. 238 that calls getCompiledProgram and extracts just the correct impl from the map
- remove getCompiledProgram from the wasm implementation and replace it with what you currently have for handleProgramPrepare + return nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 8d0988e . I kept the current panic in case getCompiledProgram returns an error. Let me know if we prefer handleProgramPrepare to return an error instead.
6be417c to
c661d08
Compare
|
labeling it after-next-version, by which I mean after arbos 52 with customDA support |
tsahee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4013 +/- ##
==========================================
+ Coverage 33.35% 35.15% +1.80%
==========================================
Files 453 453
Lines 55536 55539 +3
==========================================
+ Hits 18524 19527 +1003
+ Misses 33774 32566 -1208
- Partials 3238 3446 +208 |
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
ProgramPrepare needs the same parameters as handleProgramPrepare so we could either move ProgramPrepare closer to handleProgramPrepare or inside of it. In light that ProgramPrepare can update in the future we move it closer to handleProgramPrepare Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Update handleProgramPrepare() to return localAsm []byte Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
e2e3c58 to
63fc9b7
Compare
|
Added required changelog file |
Fixes NIT-4074
Adds 2 new wasm imports:
programPrepareprogramRequiresPrepareprogram_requires_prepare:Arguments:
Returns:
booleanCalled just beforecall to
newProgram.Jit/arbitrator implementation: always return false
program_prepare:Arguments:
Returns: nothing
Only called if
program_requires_preparereturnstrue.Arbitrator / jit implementation: nop
In order to make implementation easier and more maintainable we create a
handleProgramPrepareso that we can get access to all parametersprogram_preparerequires.