-
Notifications
You must be signed in to change notification settings - Fork 482
Sync with Substrate RC6 #478
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
Conversation
Previously returned Option<Result<R>> and now returns Result<Option<R>>. This change is more pragmatic.
- EncodeScope: for efficiently appending encoded values - ScopedBuffer: for efficiently chunking buffers
We should also rename this to simply "input" later.
Now also uses the new ReturnFlags abstraction.
- No more length - No more encodable - Only full range access
Changes have been implemented and I have been able to build the Flipper contract using Generated Wasm file header for the Flipper smart contract: |
We no longer support the get_runtime_storage host function. It will eventually be reintroduced at a later point through chain extensions.
Can be enabled by experimental crate feature: - unstable_chain_extensions
Codecov Report
@@ Coverage Diff @@
## master #478 +/- ##
==========================================
- Coverage 85.36% 84.99% -0.38%
==========================================
Files 127 127
Lines 5501 5497 -4
==========================================
- Hits 4696 4672 -24
- Misses 805 825 +20
Continue to review full report at Codecov.
|
athei
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.
My only complaint is the ReturnCode casting which seems unsound.
| } | ||
|
|
||
| /// Invokes the chain extension with the given parameters. | ||
| pub fn invoke<I, O>(&mut self, func_id: FuncId, input: &I) -> Result<O> |
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.
You rename it or keep it as invoke?
Co-authored-by: Alexander Theißen <[email protected]>
Not sure why the compiler didn't mention this return type failure ... Co-authored-by: Alexander Theißen <[email protected]>
* [core] remove get_runtime_storage and invoke_runtime * [core] invalidate all implementations and usages of ext functions * [core] adjust ext_ functions in ext.rs * [core] add ReturnFlags to public API * [core] remove off-chain impls for get_runtime_storage and invoke_runtime * [core] rename ext::ext_input -> ext::input * [core] change return type of get_contract_storage Previously returned Option<Result<R>> and now returns Result<Option<R>>. This change is more pragmatic. * [core] add conversion from ext::Error to EnvError * [core] on-chain: add new utilities for static buffer modifications - EncodeScope: for efficiently appending encoded values - ScopedBuffer: for efficiently chunking buffers * [core] add impls for on-chain property getters * [core] remove no longer needed utiltiy function * [core] on-chain: new impl for invoke_contract and eval_contract * [core] on-chain: new impl for get_contract_storage * [core] on-chain: new impl for decode_input We should also rename this to simply "input" later. * [core] on-chain: new impl for output Now also uses the new ReturnFlags abstraction. * [core] on-chain: new impl for instantiate_contract * [core] on-chain: remove unused API * [core] on-chain: move EncodeScope and ScopedBuffer to buffer.rs * [core] on-chain: implement rest of the on-chain API * [core] add ScopedBuffer::take_bytes * [core] Add Env::call_chain_extension trait method * [core] remove unused helper methods * [core] on-chain: simplify static buffer - No more length - No more encodable - Only full range access * [core] add env::call_chain_extension public API * [core] rename Env::output -> return_value * [core] off-chain: adjust a bunch of off-chain methods to new interfaces * [core] off-chain: adjust get_contract_storage return type * [core] off-chain: remove RuntimeCallHandler and RuntimeStorage facilities * [core] off-chain: adjust some tests * [core] off-chain: remove OffCall utility type * [core] off-chain: implement chain extension handler * [core] adjust panic message * [core] apply rustfmt * [core] apply clippy suggestion * [core] off-chain: re-export ChainExtension and ChainSpec types from test API * [core] on-chain: retain panic messages * [core] rename ext_ to seal_ for all on-chain functions * [alloc] fix some warnings and add some minor comments * [core] add wasm_import_module = "seal0" * [core] introduce new Seal error codes * [core] directly return ReturnCode from C-FII * [core] make transfer return Result * [core] improve some doc comments * rename some old errors to their new names * [core] remove unused env errors and rename some off-chain errors * [core] fix bug in ReturnFlags::set_reverted (formerly known as set_trapped) * [core] avoid From impl for () for OffChainError * [lang] adjust lang layer for changes in core - Remove invoke_runtime - Remove get_runtime_storage - Rename gas_price -> weight_to_fee - Add ReturnFlags to return_value call * [core] turn redundant asserts into debug_assert * [core] be more strict when handling ext::get_storage error * [core] implement clippy suggestion * [examples] remove no longer useful runtime-storage contract We no longer support the get_runtime_storage host function. It will eventually be reintroduced at a later point through chain extensions. * [core] disable chain extensions by default Can be enabled by experimental crate feature: - unstable_chain_extensions * [lang] apply clippy suggestion to use matches! macro * [core] fix docs for ext_return Co-authored-by: Alexander Theißen <[email protected]> * [core] fix return type of api::return_value Not sure why the compiler didn't mention this return type failure ... Co-authored-by: Alexander Theißen <[email protected]> * [core] fix doc comment of Env::return_value * [core] introduce RawReturnCode as a layer between Seal error codes and ink! * [alloc] make #[alloc_error_handler] private * [alloc, core] move alloc_handler from ink_alloc to ink_core * [core] replace useless intermediate ReturnCode type * [core] rename RawReturnCode -> ReturnCode * [core] apply rustfmt * [core] apply rustfmt * [core] off-chain: rename invoke -> eval for chain extension calling * [core] use Ptr32 and Ptr32Mut to encapsulate pointer -> u32 conversions * [core] make new Ptr32 and Ptr32Mut abstractions more type safe Co-authored-by: Alexander Theißen <[email protected]>

Closes #474