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

Consensus rule on cellbase outputs maturity period #54

Closed
4 tasks done
doitian opened this issue Dec 4, 2018 · 6 comments
Closed
4 tasks done

Consensus rule on cellbase outputs maturity period #54

doitian opened this issue Dec 4, 2018 · 6 comments
Assignees
Labels
p:should-have Priority: important but not necessary for delivery in the current delivery timebox s:available Status: This issue is available for implementation. t:enhancement Type: Feature, refactoring.

Comments

@doitian
Copy link
Member

doitian commented Dec 4, 2018

  • Propose an RFC for this feature.
  • Add a consensus spec configuration COINBASE_MATURITY
  • Index whether a TX is a cellbase in the chain.
  • Cellbase outputs must mature 100 blocks before they can be spent. If a tx uses an output of cellbase in block N, it can only be committed in block M where M - N >= COINBASE_MATURITY
@doitian doitian added enhancement good first issue Good for newcomers labels Dec 4, 2018
@doitian doitian changed the title Add consensus rule on cellbase outputs cool down Consensus rule on cellbase outputs maturity period Dec 4, 2018
@u2
Copy link
Contributor

u2 commented Dec 20, 2018

This issue can be assigned to me. :)

@u2
Copy link
Contributor

u2 commented Dec 25, 2018

https://github.com/nervosnetwork/ckb/blob/develop/core/src/transaction_meta.rs#L20

In TransactionMeta, we already have a BitVec for output_spent, there are two options:

  1. Add a bool indicating whether it's a cellbase;
  2. As https://github.com/paritytech/parity-bitcoin/blob/master/storage/src/transaction_meta.rs#L14, the first bit for the cellbase tx, share the same BitVec

@quake
Copy link
Member

quake commented Dec 25, 2018

@u2 we will remove TransactionMeta in favor of MMR, may need alternative solution.

@u2
Copy link
Contributor

u2 commented Dec 25, 2018

Thanks, I will consider it.

@doitian doitian added s:available Status: This issue is available for implementation. m:consensus t:enhancement Type: Feature, refactoring. and removed enhancement labels Dec 27, 2018
@doitian doitian added next p:should-have Priority: important but not necessary for delivery in the current delivery timebox and removed next labels Jan 7, 2019
bors bot added a commit that referenced this issue Mar 25, 2019
336: feature: index whether a tx is a cellbase in the chain r=quake a=u2

Index whether a tx is a cellbase in the chain, prepare for the cellbase outputs maturity checking.

Now saving the cellbase index and block number in the `TransactionMeta`, there is another implementation which creates a `HashMap<tx_hash, number>`. The second one may be a little memory saving, but this one is more simple. I think both are ok.

#54

Co-authored-by: u2 <[email protected]>
@doitian doitian mentioned this issue Mar 27, 2019
@u2
Copy link
Contributor

u2 commented Apr 16, 2019

add on:

Make this a configurable option in chain spec.
Only enable it in testnet chain spec. Disable it in dev and integration.

@u2
Copy link
Contributor

u2 commented Apr 16, 2019

#481 I think this issue can be closed.

@doitian doitian closed this as completed Apr 22, 2019
bors bot added a commit that referenced this issue Nov 3, 2020
2338: chore(deps): bump numext-fixed-uint from 1.4.0 to 1.6.0 r=doitian,driftluo a=yangby-cryptape

Bumps [numext-fixed-uint](https://github.com/cryptape/rust-numext) from 0.1.4 to 0.1.6.

<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/cryptape/rust-numext/blob/v0.1.6/CHANGELOG.md">rust-numext's changelog</a>.</em></p>
<blockquote>

### Major Updates

- Use features to let all structs be optional.
- Should NOT consider hashes as numbers.
  - Add methods to replace numerical methods for hashes.
    - `zero() -> empty()`
    - `is_zero() -> is_empty()`
    - `is_max() -> is_full()`
  - **BREAKING CHANGE** Remove `checked_neg(..)` for hashes.
- Upgrade dependencies.
  - `quote v0.6 -> v1.0`
  - `syn v0.15 -> v1.0`
  - `proc-macro2 v0.4 -> v1.0`
  - Remove dependencies "proc-macro-hack" for crates in the workspace.
    - Update the minimum supported version of rust toolchain to `1.45.0` for the feature: [Stabilizing function-like procedural macros in expressions, patterns, and statements](https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html#stabilizing-function-like-procedural-macros-in-expressions-patterns-and-statements).
  - Use `thiserror` instead of `failure` since `failure` is officially deprecated.

### Fixed Bugs

- Constructors can not handle short inputs correctly ([#42]).
- `as_fixed_bytes_mut(&mut self)` return an immutable reference ([#42]).
- Avoid trigger [a rustc bug](rust-lang/rust#75533) which causes errors when build with target `wasm32-unknown-unknown` ([#54]).

</blockquote>
</details>

Full commits viewable in [compare view](cryptape/rust-numext@v0.1.4...v0.1.6).

You can trigger a rebase of this PR by commenting `@yangby-cryptape rebase`.

<small>

#### Notice

**The latest rust tool chain is not friendly for old proc-macros (there are a lot of issues, for example: compile errors).**
**But after this PR, we still have few crates depend on very old proc-macros crates: `enum-display-derive` and `wasm-*`.**

</small>

[#42]: cryptape/rust-numext#42
[#54]: cryptape/rust-numext#54

Co-authored-by: Boyu Yang <[email protected]>
bors bot added a commit that referenced this issue Nov 3, 2020
2338: chore(deps): bump numext-fixed-uint from 1.4.0 to 1.6.0 r=doitian,driftluo a=yangby-cryptape

Bumps [numext-fixed-uint](https://github.com/cryptape/rust-numext) from 0.1.4 to 0.1.6.

<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/cryptape/rust-numext/blob/v0.1.6/CHANGELOG.md">rust-numext's changelog</a>.</em></p>
<blockquote>

### Major Updates

- Use features to let all structs be optional.
- Should NOT consider hashes as numbers.
  - Add methods to replace numerical methods for hashes.
    - `zero() -> empty()`
    - `is_zero() -> is_empty()`
    - `is_max() -> is_full()`
  - **BREAKING CHANGE** Remove `checked_neg(..)` for hashes.
- Upgrade dependencies.
  - `quote v0.6 -> v1.0`
  - `syn v0.15 -> v1.0`
  - `proc-macro2 v0.4 -> v1.0`
  - Remove dependencies "proc-macro-hack" for crates in the workspace.
    - Update the minimum supported version of rust toolchain to `1.45.0` for the feature: [Stabilizing function-like procedural macros in expressions, patterns, and statements](https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html#stabilizing-function-like-procedural-macros-in-expressions-patterns-and-statements).
  - Use `thiserror` instead of `failure` since `failure` is officially deprecated.

### Fixed Bugs

- Constructors can not handle short inputs correctly ([#42]).
- `as_fixed_bytes_mut(&mut self)` return an immutable reference ([#42]).
- Avoid trigger [a rustc bug](rust-lang/rust#75533) which causes errors when build with target `wasm32-unknown-unknown` ([#54]).

</blockquote>
</details>

Full commits viewable in [compare view](cryptape/rust-numext@v0.1.4...v0.1.6).

You can trigger a rebase of this PR by commenting `@yangby-cryptape rebase`.

<small>

#### Notice

**The latest rust tool chain is not friendly for old proc-macros (there are a lot of issues, for example: compile errors).**
**But after this PR, we still have few crates depend on very old proc-macros crates: `enum-display-derive` and `wasm-*`.**

</small>

[#42]: cryptape/rust-numext#42
[#54]: cryptape/rust-numext#54

Co-authored-by: Boyu Yang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p:should-have Priority: important but not necessary for delivery in the current delivery timebox s:available Status: This issue is available for implementation. t:enhancement Type: Feature, refactoring.
Projects
None yet
Development

No branches or pull requests

3 participants