Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Contract runtime polishing #601

Merged
merged 12 commits into from
Sep 1, 2018
Merged

Contract runtime polishing #601

merged 12 commits into from
Sep 1, 2018

Conversation

pepyakin
Copy link
Contributor

@pepyakin pepyakin commented Aug 24, 2018

This PR contains various fixes for the contract runtime, all of which isn't big enough to warrant a PR. So here they are as individual commits: I recommend reviewing them one by one.

@pepyakin pepyakin force-pushed the ser-contract-polish-runtime branch 2 times, most recently from 35a06d2 to 374dc2f Compare August 30, 2018 14:53
There are several tests where gas was changed. This is due to shrinking
the name and consequently a size of contracts.
Specifically, make fixes that allows to use a function without arguments (apart from ctx).
For example:

```rust
ext_return_42(ctx) -> u32 => {
    Ok(42)
}
```

Also, add impl ConvertibleToWasm for u64.
This allows the transaction initiator to pass some input data that can be accessed from the executed contract.

However, this only works for the top-level contract. The contract still cannot pass input data to the callee contract. The reason for that is that API doesn't support this presently.
This will be addressed in the following commits.
`ext_call` now takes a buffer (or more specifically, pointer  to the start of and size of a buffer).

This allows contracts to pass input data while calling into other contracts.
Same as previous commit but for `ext_create`.
Instead, if callee doesn't complete successfuly, return a non-zero status code.

This will prevent cascading traps up to the top-level. Due to this some tests were altered so that they now expect successful transfer instead of a failure.
Same as previous commit but for ext_create.
@pepyakin pepyakin added A0-please_review Pull request needs code review. M4-core and removed A1-onice labels Aug 30, 2018
@gavofyork gavofyork added A8-looksgood and removed A0-please_review Pull request needs code review. labels Sep 1, 2018
@gavofyork gavofyork merged commit ee2b68e into master Sep 1, 2018
@gavofyork gavofyork deleted the ser-contract-polish-runtime branch September 1, 2018 10:02
gguoss pushed a commit to chainx-org/substrate that referenced this pull request Sep 3, 2018
* Rename ext_transfer → ext_call

There are several tests where gas was changed. This is due to shrinking
the name and consequently a size of contracts.

* Fix macros

Specifically, make fixes that allows to use a function without arguments (apart from ctx).
For example:

```rust
ext_return_42(ctx) -> u32 => {
    Ok(42)
}
```

Also, add impl ConvertibleToWasm for u64.

* Implement passing input data buffer from top-level

This allows the transaction initiator to pass some input data that can be accessed from the executed contract.

However, this only works for the top-level contract. The contract still cannot pass input data to the callee contract. The reason for that is that API doesn't support this presently.
This will be addressed in the following commits.

* Input data passing thru `ext_call`

`ext_call` now takes a buffer (or more specifically, pointer  to the start of and size of a buffer).

This allows contracts to pass input data while calling into other contracts.

* Input data passing thru `ext_create`

Same as previous commit but for `ext_create`.

* Trap on decoding error instead of panicking

* Don't cascade failure in ext_call

Instead, if callee doesn't complete successfuly, return a non-zero status code.

This will prevent cascading traps up to the top-level. Due to this some tests were altered so that they now expect successful transfer instead of a failure.

* Don't cascade failure in ext_create

Same as previous commit but for ext_create.

* Specify how much gas to allot for a call

* Specify how much gas to allot for a create

* Update tests.rs
dvdplm added a commit that referenced this pull request Sep 3, 2018
…rs-generic-over-hasher-and-rlpcodec

* origin/master: (26 commits)
  Contract runtime polishing (#601)
  WIP on chain heap (#639)
  Events to track extrinsic success (#640)
  Install llvm-tools-preview component (#643)
  fix wasm executor compile error (#631)
  random fixes (#638)
  Empty becomes (), reflecting convention (#637)
  Allow to build_upon skipped entries, but don't walk back (#635)
  Separate out staking module into balances and payment (#629)
  Update .gitlab-ci.yml (#633)
  Do not attempt to rustup if in CI. This is taken care of by the base (#621)
  Avoid need for ident strings in storage (#624)
  rename to panic_handler as panic_implementation is deprecated in nightly (#626)
  5 random fixes (#2) (#623)
  fix one typo in README (#627)
  Misspelled words (#625)
  Contracts: Per block gas limit (#506)
  Make sure to ban invalid transactions. (#615) (#620)
  Forward-port BFT fixes from v0.2 and restructure agreement cancelling (#619)
  Allow specifying listening multiaddresses (#577)
  ...
dvdplm added a commit that referenced this pull request Sep 4, 2018
* master: (22 commits)
  Introduce treasury and document (#646)
  Off-the-table staking preference (#656)
  Implement function `json_metadata` in `decl_module!` (#654)
  Fix warnings in networking (#652)
  Add a reputation system (#645)
  Check for pruned block state (#648)
  Contract runtime polishing (#601)
  WIP on chain heap (#639)
  Events to track extrinsic success (#640)
  Install llvm-tools-preview component (#643)
  fix wasm executor compile error (#631)
  random fixes (#638)
  Empty becomes (), reflecting convention (#637)
  Allow to build_upon skipped entries, but don't walk back (#635)
  Separate out staking module into balances and payment (#629)
  Update .gitlab-ci.yml (#633)
  Do not attempt to rustup if in CI. This is taken care of by the base (#621)
  Avoid need for ident strings in storage (#624)
  rename to panic_handler as panic_implementation is deprecated in nightly (#626)
  5 random fixes (#2) (#623)
  ...
liuchengxu pushed a commit to chainx-org/substrate that referenced this pull request Aug 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants