Skip to content
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

refactor: Revise script structure #344

Merged
merged 14 commits into from
Mar 28, 2019
Merged

refactor: Revise script structure #344

merged 14 commits into from
Mar 28, 2019

Conversation

xxuejie
Copy link
Collaborator

@xxuejie xxuejie commented Mar 20, 2019

core/src/script.rs Outdated Show resolved Hide resolved
// following locations:
// 1. Data part of a dep cell in current transaction, reference hash
// must be the hash of the cell data so as to reference this cell
// 2. An embed item in current transaction, reference hash must be the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the embed item is a one-time data?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it's like the original binary but at a different place with more potential use cases

}
} else if cs.is_dead() {
for cs in &self.resolved_transaction.input_cells {
if cs.is_dead() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@u2
Copy link
Contributor

u2 commented Mar 20, 2019

Add some description for this PR. The linked issue is private.

@xxuejie xxuejie changed the title [WIP] refactor: Revise script structure refactor: Revise script structure Mar 22, 2019
@xxuejie xxuejie requested a review from a team March 22, 2019 02:40
@@ -29,6 +29,7 @@ enum CellField {
Capacity = 0,
Data = 1,
DataHash = 2,
Lock = 6,
Copy link
Contributor

@jjyr jjyr Mar 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this item under the TypeHash = 5 for consistency.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 2 ways to understand consistency here: first, we can sort them by the value of the enums, of course. But there's also another way which we can group the values based on the meeting, so we can do Data, DataHash, Lock, LockHash, this way it's easier to see what options are available here. Thoughts?

@doitian doitian added s:waiting-on-sdks Status: Waiting for SDK update s:rfc-revision-needed labels Mar 25, 2019
@doitian
Copy link
Member

doitian commented Mar 25, 2019

@xxuejie this PR conflicts with the #350

@xxuejie
Copy link
Collaborator Author

xxuejie commented Mar 25, 2019

@doitian Conflict is resolved now

@ashchan
Copy link
Contributor

ashchan commented Mar 25, 2019

SDKs haven't caught up yet, but I guess we can plan this for v0.8.0 which is RC frozen today (meaning develop during the RC period). How about that? @doitian @xxuejie

@Mine77
Copy link
Contributor

Mine77 commented Mar 27, 2019

are you considering updating the how-to-write-contract doc as well?

@doitian doitian mentioned this pull request Mar 27, 2019
4 tasks
@doitian
Copy link
Member

doitian commented Mar 27, 2019

bors r+

bors bot added a commit that referenced this pull request Mar 27, 2019
344: refactor: Revise script structure r=doitian a=xxuejie

* [x] rfc changes: nervosnetwork/rfcs#91
* [x] ckb-system-scripts: nervosnetwork/ckb-system-scripts#2
* [x] mruby-contracts: nervosnetwork/mruby-contracts#7
* [x] ruby sdk: nervosnetwork/ckb-demo-ruby#76
* [x] ruby scripts: nervosnetwork/ckb-ruby-scripts#9
* [ ] swift sdk
* [ ] java sdk
* [ ] js sdk

---

This is a **BREAKING CHANGE**.

Co-authored-by: Xuejie Xiao <[email protected]>
@doitian doitian added the hotfix Fixing that must be submit to RC branch. label Mar 27, 2019
@bors
Copy link
Contributor

bors bot commented Mar 27, 2019

Build failed

  • continuous-integration/travis-ci/push

@doitian
Copy link
Member

doitian commented Mar 27, 2019

Integration test stuck, cc @quake

@xxuejie
Copy link
Collaborator Author

xxuejie commented Mar 28, 2019

bors try

bors bot added a commit that referenced this pull request Mar 28, 2019
@doitian
Copy link
Member

doitian commented Mar 28, 2019

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 28, 2019

try

Build succeeded

  • continuous-integration/travis-ci/push

@bors
Copy link
Contributor

bors bot commented Mar 28, 2019

Merge conflict

@xxuejie
Copy link
Collaborator Author

xxuejie commented Mar 28, 2019

bors r+

bors bot added a commit that referenced this pull request Mar 28, 2019
344: refactor: Revise script structure r=xxuejie a=xxuejie

* [x] rfc changes: nervosnetwork/rfcs#91
* [x] ckb-system-scripts: nervosnetwork/ckb-system-scripts#2
* [x] mruby-contracts: nervosnetwork/mruby-contracts#7
* [x] ruby sdk: nervosnetwork/ckb-demo-ruby#76
* [x] ruby scripts: nervosnetwork/ckb-ruby-scripts#9
* [ ] swift sdk
* [ ] java sdk
* [ ] js sdk

---

This is a **BREAKING CHANGE**.

Co-authored-by: Xuejie Xiao <[email protected]>
@bors
Copy link
Contributor

bors bot commented Mar 28, 2019

Build succeeded

  • continuous-integration/travis-ci/push

@bors bors bot merged commit bba40a4 into nervosnetwork:develop Mar 28, 2019
@xxuejie xxuejie deleted the script-structure-refactoring branch March 28, 2019 06:45
@doitian doitian mentioned this pull request Apr 8, 2019
doitian added a commit that referenced this pull request Apr 22, 2019
🎉[ᚬmaster] Rc/v0.9.0

### Bug Fixes

* #410: network panic errors r=jjyr a=jjyr

    * Peer Store no such table
    * get peer index panic

* #386: flatbuffers vtable `num_fields` overflow r=zhangsoledad a=doitian

    Refs nervosnetwork/cfb#16

* #385: Upgrade p2p fix repeat connection bug r=jjyr a=TheWaWaR

    Related PR: nervosnetwork/tentacle#92

* #382: reset peer store connection status when setup r=TheWaWaR a=jjyr

    1. reset peer status
    2. remove banned addrs from peer_attemps result

* #424: many bug fixes of the p2p network issues fix a=TheWaWaR,zhangsoledad

### Features

* #491: update lock cell for segwit and address format a=classicalliu

* #368: segregated witness r=janx,quake a=zhangsoledad

* #409: remove uncle cellbase r=doitian a=zhangsoledad

* #369: Embed testnet chain spec in compiled binary r=doitian a=xxuejie

* #344: Revise script structure r=xxuejie a=xxuejie

* #425: Bundle app config in compiled binary a=doitian

### Improvements

* #392: avoid recursive lock a=zhangsoledad

### BREAKING CHANGES

This release has changed core data structure, please delete the old data directory.

The testnet chain spec is also changed, which is incompatible with previous versions.

Command line argument `-c` is removed, and a new command line argument `-C` is added. See `ckb help` for details.

Now the command `ckb` no longer searches the config file `nodes/default.toml`. It looks for the config file `ckb.toml` or `ckb-miner.toml` in current directory and uses the default config options when not found. A new command `ckb init` is added, see its usage with `ckb init --help`.

Config file `ckb.toml` changes:

- Removed `logger.file`, `db.path` and `network.path` from config file.
- Added config option `logger.log_to_stdout` and `logger.log_to_file`.
- Section `block_assembler` now accepts two options `binary_hash` and `args`. 
- Added a new option to set sentry DSN.

File `miner.toml` changes:

- Option `spec` is moved under `chain`, which is consistent with `ckb.toml`.
- Move miner own config options under section `miner`.
- Remove `logger.file` from config file.
- Add config option `logger.log_to_stdout` and `logger.log_to_file`.

It is recommended to export the config files via `ckb init`, then apply the
modifications upon the new config files.
bors bot added a commit that referenced this pull request Nov 6, 2019
1793: chore(deps): bump num_cpus from 1.10.1 to 1.11.0 r=doitian a=dependabot-preview[bot]

Bumps [num_cpus](https://github.com/seanmonstar/num_cpus) from 1.10.1 to 1.11.0.
<details>
<summary>Changelog</summary>

*Sourced from [num_cpus's changelog](https://github.com/seanmonstar/num_cpus/blob/master/CHANGELOG.md).*

> ## v1.11.0
> 
> #### Features
> 
> - add `hermit` target OS support
> - removes `bitrig` support
> 
> #### Fixes
> 
> - fix `get_physical` count with AMD hyperthreading.
</details>
<details>
<summary>Commits</summary>

- [`1904840`](seanmonstar/num_cpus@1904840) v1.11.0
- [`a8973cb`](seanmonstar/num_cpus@a8973cb) add support of the unikernel RustyHermit ([#88](https://github-redirect.dependabot.com/seanmonstar/num_cpus/issues/88))
- [`c3d2021`](seanmonstar/num_cpus@c3d2021) Refactor get_physical to sum 'cpu cores' per 'physical id' ([#86](https://github-redirect.dependabot.com/seanmonstar/num_cpus/issues/86))
- [`85d20df`](seanmonstar/num_cpus@85d20df) Avoid allocating a vector and double trimming in get_num_physical_cpus ([#87](https://github-redirect.dependabot.com/seanmonstar/num_cpus/issues/87))
- [`434d29c`](seanmonstar/num_cpus@434d29c) Use ptr::null_mut instead of 0 as *mut ([#84](https://github-redirect.dependabot.com/seanmonstar/num_cpus/issues/84))
- [`3a8994b`](seanmonstar/num_cpus@3a8994b) Remove bitrig support ([#78](https://github-redirect.dependabot.com/seanmonstar/num_cpus/issues/78))
- See full diff in [compare view](seanmonstar/num_cpus@v1.10.1...v1.11.0)
</details>
<br />

[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=num_cpus&package-manager=cargo&previous-version=1.10.1&new-version=1.11.0)](https://dependabot.com/compatibility-score.html?dependency-name=num_cpus&package-manager=cargo&previous-version=1.10.1&new-version=1.11.0)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)



</details>

1794: chore(deps): bump toml from 0.5.2 to 0.5.5 r=doitian a=dependabot-preview[bot]

Bumps [toml](https://github.com/alexcrichton/toml-rs) from 0.5.2 to 0.5.5.
<details>
<summary>Commits</summary>

- [`7512904`](toml-rs/toml-rs@7512904) Bump to 0.5.5
- [`1e6bfbc`](toml-rs/toml-rs@1e6bfbc) replace copied wit filter_map for rustc 1.35 compatibility ([#354](https://github-redirect.dependabot.com/alexcrichton/toml-rs/issues/354))
- [`4673cfd`](toml-rs/toml-rs@4673cfd) Replace the test added by [#349](https://github-redirect.dependabot.com/alexcrichton/toml-rs/issues/349) with a bench ([#351](https://github-redirect.dependabot.com/alexcrichton/toml-rs/issues/351))
- [`4b05a9d`](toml-rs/toml-rs@4b05a9d) update ([#352](https://github-redirect.dependabot.com/alexcrichton/toml-rs/issues/352))
- [`189d2b9`](toml-rs/toml-rs@189d2b9) Bump to 0.5.4
- [`c049b7a`](toml-rs/toml-rs@c049b7a) Decrease deserialization complexity from quadratic to linear ([#349](https://github-redirect.dependabot.com/alexcrichton/toml-rs/issues/349))
- [`ec21d60`](toml-rs/toml-rs@ec21d60) Support for dotted table spans ([#340](https://github-redirect.dependabot.com/alexcrichton/toml-rs/issues/340))
- [`e9f5290`](toml-rs/toml-rs@e9f5290) Switch from linked-hash-map to indexmap
- [`8995cef`](toml-rs/toml-rs@8995cef) Spanned: impl PartialEq, Eq, Hash, PartialOrd, Ord in terms of the value ([#344](https://github-redirect.dependabot.com/alexcrichton/toml-rs/issues/344))
- [`9ed2903`](toml-rs/toml-rs@9ed2903) Remove outdated Travis CI badge ([#346](https://github-redirect.dependabot.com/alexcrichton/toml-rs/issues/346))
- Additional commits viewable in [compare view](toml-rs/toml-rs@0.5.2...0.5.5)
</details>
<br />

[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=toml&package-manager=cargo&previous-version=0.5.2&new-version=0.5.5)](https://dependabot.com/compatibility-score.html?dependency-name=toml&package-manager=cargo&previous-version=0.5.2&new-version=0.5.5)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)



</details>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotfix Fixing that must be submit to RC branch. s:waiting-on-sdks Status: Waiting for SDK update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants