Git Product home page Git Product logo

codechain's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codechain's Issues

Add --reseal-on-txs command line option

Specify which transactions should force the node to reseal a block.

  • none: never reseal on new transactions
  • own: reseal only on a new local transaction
  • ext: reseal only on a new external transaction
  • all: reseal on all new transactions.

The default is own.

Verify extra_data

Add maximum_extra_data_size field to CommonParams and reject transactions whose size exceed the maximum.

Snapshot synchronization

https://github.com/CodeChain-io/codechain/blob/master/spec/Block-Synchronization-Extension.md

Depends on: #1884

Todo:

  • Generate snapshots periodically (10/31~)
    • Compress/decompress chunk
    • Make a state into chunks
    • Read & verify chunks and recover the state
    • Make chunk snapshot and recover property test success #1844 (~11/13)
    • Add block event listener to snapshot periodically (~11/15) #1869
      • for the tendermint (~11/19) #1874
    • Snapshot configurations
      • Set the expiration date #1875
  • Update the sync extension for snapshot sync
    • Update network messages for snapshots (~11/14) #1843
    • Switch to full sync after the snapshot sync is finished #1855 (~11/15)
    • Make snapshot header importable
      • Make consensus extensions to work without parent header (~11/27) (@remagpie)
      • Make blockchain work without history (~11/15) #1862
      • Update sync extension to ignore total_score of status message (~11/19) #1864
    • Fetch snapshot header from peers (~11/15) #1862
    • Collect snapshots from peers (~11/22) #1872
  • RPC to query the snapshot information (~11/22) #1873
  • Test functionallity on testnet (~12/1)

Good To Have:

  • Make the snapshot period configurable

Group configs under [codechain] table

[codechain]
quiet = false
db_path = "db"
chain_type = "tendermint"
enable_block_sync = true
enable_tx_relay = true
secret_key = "0x0000000000000000000000000000000000000000000000000000000000000001"

Introduce sharding - 2nd wave

  • Modify state trie
    • move state shard to shard0 state trie
    • Add metadata under top-level shard
  • One shard parcel without shard validators

Report benign validators

Report the proposer if no proposal was received.

We may punish the proposer if it keeps not proposing blocks.

Need an assertion policy

Currently, we use debug_assert in most cases because we check the assertions in tests and we don't want to check them again in the release binary.

But it's not sustainable. Bugs will occur for any reason. It seems better to use assert to crash early because we have a plan to add a bug tracker.

I think we need a guideline to decide when to use assert or debug_assert.

Introduce sharding - 3rd wave

  • Make genesis block create shard
  • Handle CreateShard Parcel
  • Embed shard id in asset scheme address
  • Specify shard id on ChangeShardState parcel
  • Multiple shard parcel without validators

Add logging target constants

Don't use hardcoded target value when logging.

trace!(target: "txqueue",
       "Dropping transaction without sufficient balance: {:?} ({} < {})",
       tx.hash(),
       client_account.balance,
       tx.fee
);

We need pre-defined constants for targets.

Make extension API negotiate automatically

Currently, extension user must call negotiate API on node_added event.
It was designed to support the extension which doesn't want to negotiate with some peers.
But until now, there are no that kinds of extensions, and it just makes the control flow complicate.
So I suggest changing the API as below.

pub trait Api: Send + Sync {
    fn send(&self, node: &NodeId, message: &[u8]);
-   fn negotiate(&self, node: &NodeId);

    fn set_timer(&self, timer: TimerToken, d: Duration) -> Result<()>;
    fn set_timer_once(&self, timer: TimerToken, d: Duration) -> Result<()>;
    fn clear_timer(&self, timer: TimerToken) -> Result<()>;

    fn send_local_message(&self, message: &Encodable);
}

pub trait Extension: Send + Sync {
    fn name(&self) -> String;
    fn need_encryption(&self) -> bool;
+   fn versions(&self) -> Vec<Version>;

    fn on_initialize(&self, api: Arc<Api>);

-   fn on_node_added(&self, _node: &NodeId) {}
+   fn on_node_added(&self, version: Version, _node: &NodeId) {}
    fn on_node_removed(&self, _node: &NodeId) {}

-   fn on_negotiated(&self, _node: &NodeId) {}
-   fn on_negotiation_allowed(&self, _node: &NodeId) {}
-   fn on_negotiation_denied(&self, _node: &NodeId) {}

    fn on_message(&self, _node: &NodeId, _message: &[u8]) {}

    fn on_timeout(&self, _timer: TimerToken) {}

    fn on_local_message(&self, _message: &[u8]) {}
}

Unused methods

warning: method is never used: `exists_and_is_null`
  --> core/src/state/mod.rs:98:5
   |
98 |     fn exists_and_is_null(&self) -> bool {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `insert_cache_asset`
   --> core/src/state/mod.rs:395:5
    |
395 |     fn insert_cache_asset(&self, address: &AssetAddress, asset: Entry<Asset>) {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `note_cache_asset`
   --> core/src/state/mod.rs:419:5
    |
419 |     fn note_cache_asset(&self, address: &AssetAddress) {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `require_asset`
   --> core/src/state/mod.rs:801:5
    |
801 | /     fn require_asset<'a, F>(&'a self, a: &AssetAddress, default: F) -> trie::Result<RefMut<'a, Asset>>
802 | |     where
803 | |         F: FnOnce() -> Asset, {
804 | |         self.require_asset_or_from(a, default, |_| {})
805 | |     }
    | |_____^

warning: method is never used: `require_asset_or_from`
   --> core/src/state/mod.rs:851:5
    |
851 | /     fn require_asset_or_from<'a, F, G>(
852 | |         &'a self,
853 | |         a: &AssetAddress,
854 | |         default: F,
...   |
888 | |         }))
889 | |     }
    | |_____^

warning: struct is never used: `CanonVerifier`
  --> core/src/verification/canon_verifier.rs:25:1
   |
25 | pub struct CanonVerifier;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^

Clarify AssetMint interface

AssetMint creates an Asset object and an AssetScheme object. Each field is related to one between the two, but, currently, it is confused which is related to one or not.

Current:

AssetMint {
    metadata: String,
    lock_script_hash: H256,
    parameters: Vec<Bytes>,
    amount: Option<u64>,
    registrar: Option<Address>,
    nonce: u64,
},

Proposed:

AssetMint {
    metadata: String,
    registrar: Option<Address>,
    nonce: u32,
    output: AssetMintOutput
}

struct AssetMintOutput {
    lock_script_hash: H256,
    parameters: Vec<Bytes>,
    amount: u64,
}

Remove unknown warning

warning: warning: unknown warning option '-Wno-nonnull-compare'; did you mean '-Wno-enum-compare'? [-Wunknown-warning-option]
warning: warning: unknown warning option '-Wno-nonnull-compare'; did you mean '-Wno-enum-compare'? [-Wunknown-warning-option]

Punish Byzantine validators

Currently, there is no penalty for Byzantine validators. Make them deposit certain amount of CCC and slash it.

Unused method

warning: method is never used: `contains_registered`
  --> network/src/p2p/session_candidate.rs:40:5
   |
40 |     pub fn contains_registered(&self, nonce: &Nonce) -> bool {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(dead_code)] on by default

Introduce sharding - first wave

  • Struct rename
    • Transaction -> Parcel
    • Action -> Transaction
  • Parcel struct restructure
    • Transaction -> Vec
  • Multiple tx in one parcel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.