-
Notifications
You must be signed in to change notification settings - Fork 424
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
Implementation of ink! env (revision 3) #312
Conversation
Codecov Report
@@ Coverage Diff @@
## master #312 +/- ##
===========================================
+ Coverage 34.03% 63.82% +29.78%
===========================================
Files 73 69 -4
Lines 4906 5181 +275
===========================================
+ Hits 1670 3307 +1637
+ Misses 3236 1874 -1362
Continue to review full report at Codecov.
|
Also many other adjustments.
Co-Authored-By: Andrew Jones <ascjones@gmail.com>
Co-Authored-By: Andrew Jones <ascjones@gmail.com>
Co-Authored-By: Andrew Jones <ascjones@gmail.com>
Co-Authored-By: Andrew Jones <ascjones@gmail.com>
Co-Authored-By: Andrew Jones <ascjones@gmail.com>
Co-Authored-By: Andrew Jones <ascjones@gmail.com>
Co-Authored-By: Andrew Jones <ascjones@gmail.com>
Co-Authored-By: Andrew Jones <ascjones@gmail.com>
Well deserved taco. xD |
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
#194 Re-implementation of
env
module (revision 3)Issues that can be closed upon merging this:
invoke_runtime
to EnvAccessMut wrapper #301invoke_runtime
type #297ToDos
env
(revision 3)env
(revision 3)ext_random
)ink_lang2
forenv
(revision 3)Add dynamic allocator instance.(Follow-up PR)ink_lang2
crate that replace missingEnvAccess
types.ink_lang2_macro
to useenv
(revision 3).env
(revision 1) andenv
(revision 2) from ink! codebaseenv
(revision 1)env
(revision 2)env
(revision 1) andenv
(revision 2)env
(revision 1)env
(revision 2)env
(revision 3) asink_env
into its own ink! crate.ink_model
ink_model
ink! crateink_model
layer example contractsink_lang
(revision 1)ink_lang
(revision 1) ink! crateink_lang
(revision 1) example contractsink_core
-only example contractsOption<Result<T>>
forget_contract_storage
Move(Follow-up PR)ink_core::storage
intoink_storage
crateRemove(Follow-up PR)test-env
crate featureFollow-up PRs
ink_core::storage
intoink_storage
crateink_core::env
intoink_env
cratetest-env
crate feature and replace it in parts withink-test
crate featureCrate Dependency Graph
Anticipated dependency graph after planned follow-up PRs have been merged.
Description
env2
while still providing its efficiency guarantees.test-env
feature is going to be removed.no_std
+wasm32-unknown-unknown
orstd
(e.g. for off-chain testing). The environmental interface is generally the same for both configurations. However, in the case of#[cfg(test)]
there is going to be anothertest
sub module to allow for low-level off-chain testing environment manipulations.The interface has a typed and an untyped subset of APIs.
fn caller
since it returns aT::AccountId
whereT: EnvTypes
.fn get_contract_storage<T>
since it doesn't have any dependencies on a specificEnvTypes
provider.env2
all operations between the smart contract and its environment are still implicitly cached and buffered to avoid dynamic allocations. We could even reduce this to no dynamic allocations at all in this implementation by using a static buffer instead.env
(revision 2) took over the job to also provide dynamic allocators this is no longer true forenv
(revision 3) and will instead be handled in its own sub module (e.g.dyn_alloc
).The
env
revision 3 will replace all usage ofenv
(revision 1) andenv
(revision 2).Compiled Docs
The new off-chain test API
The contract calling and instantiation API
The general environment API
Contract Restoration
For the first time we also provide high-level APIs for contract restoration.
Runtime Emulation
Set certain runtime storage entries in the emulated off-chain runtime to allow querying them by the contract.
Initialize off-chain runtime dispatch handlers that emulate your runtime behaviour from the perspective of an invoking contract.