-
Notifications
You must be signed in to change notification settings - Fork 10
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
Procedure Verification #141
Comments
Proof of concept of validating safe procedures and syscalls is done, although nothing is integrated into CI and the like yet. Currently the build stage for wasm projects is usually
I propose, and have included in the proof of concept (currently on the validation branch) that we add a third step.
This is very similar in functionality to step 2, but does things that suit us instead. This has worked well, and will also help us when it comes to the execution guard, as it is a hook into the build process we didn't have before. One step still remaining is use a dummy wasm import that we will replace with this statically-linked syscall function. This will mean that rustc (at the start of the process) needs no knowledge of this, it just thinks it's linking to an external C library (or a web platform function, in the context of wasm). |
This is what a syscall looks like in wasm: (func $cap9_syscall_low (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) (param $p3 i32) (result i32)
call $env.gasleft
call $env.sender
get_local $p0
get_local $p1
get_local $p2
get_local $p3
call $env.dcall) The validator only allows The work flow is as follows:
|
A note regarding ewasm and pwasm: all the work done here seems applicable to both, a notable exception being the names (and possibly signatures) of the Ethereum functions changing, but that's trivial. |
Ok, so I was able to implement |
Now that #153 has been addressed I can link this more properly into the kernel. |
#157 is a new parser which will solve some of our issues integrating the validator into the kernel. |
New validation has been updated to consider |
Awaiting merge of #151. |
Closing with #151 |
Based on the ewasm interface and api we need a validator that checks:
#call
#callcode
#calldelegate
#storageStore
#create
#log{0,1,2,3,4}
#selfDestruct
Interface
Interface should be as follows:
cap9_code_validate
Return if the code passes validation
Parameters
code
: &[u8] immutable reference to code memory locationReturns
result
: Result<(), CodeValidationError> returns anOk()
on success or aErr(CodeValidationError)
on failureError Conditions
CodeIsEmpty
:code#length
was zeroCodeIsUnprotected
: Code does not contain an execution guard headerCodeIsIllegal
: an illegal EEI interface call from list as described above.Trap Conditions
#getGasLeft
reaches zero with kernel instance running out of gas#getBlockGasLimit
becomes less than gas spent which means the block gas limit is reachedThe text was updated successfully, but these errors were encountered: