Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

feat(sync): synchronization epoch #9

Merged
merged 8 commits into from
Oct 28, 2019
Merged

feat(sync): synchronization epoch #9

merged 8 commits into from
Oct 28, 2019

Conversation

KaoImin
Copy link

@KaoImin KaoImin commented Sep 26, 2019

What type of PR is this?

feature

What this PR does / why we need it:

  • develop synchronization process
  • develop pull epoch and transitions Rpc call
  • fix a bug when create a new mempool

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

@KaoImin KaoImin requested a review from a team September 26, 2019 12:49
@KaoImin KaoImin changed the title feat: synchronization epoch feat(sync): synchronization epoch Sep 26, 2019
.call::<ConsensusRpcRequest, ConsensusRpcResponse>(
ctx,
end,
ConsensusRpcRequest::PullEpochs(msg),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use protobuf? There is no requirement for serialization consistency in a network.

&self,
ctx: Context,
hashes: Vec<Hash>,
end: &str,
Copy link
Contributor

Choose a reason for hiding this comment

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

end?

Copy link
Author

Choose a reason for hiding this comment

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

This is request by RPC.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, it's "endpoint".

}

// Lock the consensus engine, block commit process.
self.engine.lock.lock().await;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a problem if you have multiple threads competing for locks at the same time.

First, these threads will get the lock-in turn, and then they will all execute the synchronization process once, although possibly repeatedly.

// 2. Save the signed transactions.
// 3. Save the latest proof.
// 4. Save the new epoch.
let exec_resp = self
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. save receipt

where
EF: ExecutorFactory<DB>,
G: Gossip + Sync + Send,
R: Rpc + Sync + Send,
Copy link
Contributor

Choose a reason for hiding this comment

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

Combine G and R, since network handle implement both traits.

&self,
ctx: Context,
hashes: Vec<Hash>,
end: &str,
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, it's "endpoint".

core/consensus/src/message.rs Outdated Show resolved Hide resolved
.engine
.get_epoch_by_id(ctx.clone(), current_epoch_id)
.await?;
let mut current_hash = Hash::digest(current_epoch.encode().await?);
Copy link
Contributor

Choose a reason for hiding this comment

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

No rlp ?

Copy link
Author

Choose a reason for hiding this comment

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

Use protobuf temporarily.

@KaoImin KaoImin requested a review from a team October 23, 2019 09:58
@KaoImin KaoImin force-pushed the dev-synchronous branch 2 times, most recently from 8cb7e5a to 3bae434 Compare October 27, 2019 12:48
Eason Gao added 2 commits October 27, 2019 20:56
* feat: develop merkle root

* refactor arguments

* remove useless code

dev synchronization

dev synchronization

dev network handler

refactor update current status

cargo fmt

refactor mempool test

add iql

fix synchronous bug

cargo update

dev synchronization

tmp

update cache status

fix(mempool): Resize the queue to ensure correct switching. (#18)

* fix(mempool): Resize the queue to ensure correct switching.

* resize map.

* resize map.

cargo fmt

add log

cargo fmt

feat: synchronization

cargo clippy

fix: save proof and locks

fix sync

cargo clippy

fix a bug

cargo fmt

tmp config

fix

tmp commit

fix mempool
@@ -0,0 +1,42 @@
# chain id
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

@@ -0,0 +1,53 @@
# chain id
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

@@ -0,0 +1,53 @@
# chain id
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

@@ -0,0 +1,53 @@
# chain id
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

core/consensus/Cargo.toml Outdated Show resolved Hide resolved
@yejiayu
Copy link
Contributor

yejiayu commented Oct 28, 2019

Resolve conflict @KaoImin

@yejiayu yejiayu merged commit fb4bf0d into master Oct 28, 2019
yejiayu pushed a commit to yejiayu/muta that referenced this pull request Oct 31, 2019
* add adapter, crypto, env, utils

* add env, utils

* refactor test and bench

* add test_mempool_package test_mempool_flush

* adjust code style

* add ophelia

* fix ophelia unstable feature

* combine all test files into only one file

* add some new tests and refer ophelia to common-crypto

* add test_sync_propose_txs
yejiayu pushed a commit to yejiayu/muta that referenced this pull request Oct 31, 2019
* feat: develop merkle root (nervosnetwork#17)

* feat: develop merkle root

* refactor arguments

* remove useless code

dev synchronization

dev synchronization

dev network handler

refactor update current status

cargo fmt

refactor mempool test

add iql

fix synchronous bug

cargo update

dev synchronization

tmp

update cache status

fix(mempool): Resize the queue to ensure correct switching. (nervosnetwork#18)

* fix(mempool): Resize the queue to ensure correct switching.

* resize map.

* resize map.

cargo fmt

add log

cargo fmt

feat: synchronization

cargo clippy

fix: save proof and locks

fix sync

cargo clippy

fix a bug

cargo fmt

tmp config

fix

tmp commit

fix mempool

* fix synchronization

* fix CI

* remove debug config files

* Update core/consensus/Cargo.toml

Co-Authored-By: Jiayu Ye <[email protected]>

* update Cargo lock

* fix cargo toml
@yejiayu yejiayu deleted the dev-synchronous branch December 4, 2019 07:59
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.

4 participants