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

Flexidag #3987

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 59 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ members = [
"cmd/miner_client/api",
"cmd/db-exporter",
"cmd/genesis-nft-miner",
"flexidag",
]

default-members = [
Expand Down Expand Up @@ -217,6 +218,7 @@ default-members = [
"stratum",
"cmd/miner_client/api",
"cmd/db-exporter",
"flexidag",
]

[profile.dev]
Expand Down Expand Up @@ -246,7 +248,7 @@ api-limiter = { path = "commons/api-limiter" }
arc-swap = "1.5.1"
arrayref = "0.3"
ascii = "1.0.0"
async-std = "1.12"
async-std = { version = "1.12", features = ["attributes", "tokio1"] }
async-trait = "0.1.53"
asynchronous-codec = "0.5"
atomic-counter = "1.0.1"
Expand All @@ -257,6 +259,9 @@ bcs-ext = { path = "commons/bcs_ext" }
bech32 = "0.9"
bencher = "0.1.5"
bitflags = "1.3.2"
faster-hex = "0.6"
indexmap = "1.9.1"
bincode = { version = "1", default-features = false }
bs58 = "0.3.1"
byteorder = "1.3.4"
bytes = "1"
Expand Down Expand Up @@ -438,7 +443,7 @@ starcoin-chain-service = { path = "chain/service" }
starcoin-cmd = { path = "cmd/starcoin" }
starcoin-config = { path = "config" }
starcoin-consensus = { path = "consensus" }
starcoin-crypto = { git = "https://github.com/starcoinorg/starcoin-crypto", rev = "a742ddc0674022800341182cbb4c3681807b2f00" }
starcoin-crypto = { git = "https://github.com/starcoinorg/starcoin-crypto", rev = "8d41c280a227594ca0a2b6ecba580643518274ea" }
starcoin-decrypt = { path = "commons/decrypt" }
starcoin-dev = { path = "vm/dev" }
starcoin-executor = { path = "executor" }
Expand Down Expand Up @@ -496,6 +501,7 @@ starcoin-parallel-executor = { path = "vm/parallel-executor" }
starcoin-transaction-benchmarks = { path = "vm/transaction-benchmarks" }
starcoin-language-e2e-tests = { path = "vm/e2e-tests" }
starcoin-proptest-helpers = { path = "vm/proptest-helpers" }
starcoin-flexidag = { path = "flexidag" }

syn = { version = "1.0.107", features = [
"full",
Expand Down
2 changes: 1 addition & 1 deletion account/src/account_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ pub fn test_wallet_account() -> Result<()> {
);
//println!("verify result is {:?}", sign.verify(&raw_txn, &public_key)?);
println!("public key is {:?}", public_key.to_bytes().as_ref());
println!("hash value is {:?}", hash_value.as_ref());
println!("hash value is {:?}", hash_value);
println!("key is {:?}", key.derived_address());
println!("address is {:?},result is {:?}", address, result);

Expand Down
10 changes: 8 additions & 2 deletions benchmarks/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ impl ChainBencher {
Genesis::init_and_check_storage(&net, storage.clone(), temp_path.path())
.expect("init storage by genesis fail.");

let chain = BlockChain::new(net.time_service(), chain_info.head().id(), storage, None)
.expect("create block chain should success.");
let chain = BlockChain::new(
net.time_service(),
chain_info.head().id(),
storage,
net.id().clone(),
None,
)
.expect("create block chain should success.");
let miner_account = AccountInfo::random();

ChainBencher {
Expand Down
11 changes: 7 additions & 4 deletions block-relayer/src/block_relayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ impl BlockRelayer {
&self,
network: NetworkServiceRef,
executed_block: Arc<ExecutedBlock>,
tips_hash: Option<Vec<HashValue>>,
) {
if !self.is_nearly_synced() {
debug!("[block-relay] Ignore NewHeadBlock event because the node has not been synchronized yet.");
return;
}
let compact_block = executed_block.block().clone().into();
let compact_block_msg =
CompactBlockMessage::new(compact_block, executed_block.block_info.clone());
CompactBlockMessage::new(compact_block, executed_block.block_info.clone(), tips_hash);
network.broadcast(NotificationMessage::CompactBlock(Box::new(
compact_block_msg,
)));
Expand Down Expand Up @@ -203,7 +204,9 @@ impl BlockRelayer {
ctx: &mut ServiceContext<BlockRelayer>,
) -> Result<()> {
let network = ctx.get_shared::<NetworkServiceRef>()?;
let block_connector_service = ctx.service_ref::<BlockConnectorService>()?.clone();
let block_connector_service = ctx
.service_ref::<BlockConnectorService<TxPoolService>>()?
.clone();
let txpool = self.txpool.clone();
let metrics = self.metrics.clone();
let fut = async move {
Expand Down Expand Up @@ -286,7 +289,7 @@ impl EventHandler<Self, NewHeadBlock> for BlockRelayer {
return;
}
};
self.broadcast_compact_block(network, event.0);
self.broadcast_compact_block(network, event.0, event.1);
}
}

Expand All @@ -303,7 +306,7 @@ impl EventHandler<Self, NewBranch> for BlockRelayer {
return;
}
};
self.broadcast_compact_block(network, event.0);
self.broadcast_compact_block(network, event.0, event.1);
}
}

Expand Down
3 changes: 3 additions & 0 deletions chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ starcoin-types = { package = "starcoin-types", workspace = true }
starcoin-vm-types = { workspace = true }
starcoin-storage = { workspace = true }
thiserror = { workspace = true }
starcoin-network-rpc-api = { workspace = true }
async-std = { workspace = true }

[dev-dependencies]
proptest = { workspace = true }
Expand All @@ -39,6 +41,7 @@ stdlib = { workspace = true }
stest = { workspace = true }
test-helper = { workspace = true }
tokio = { features = ["full"], workspace = true }
starcoin-network-rpc-api = { workspace = true }

[features]
default = []
Expand Down
3 changes: 2 additions & 1 deletion chain/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ starcoin-time-service = { workspace = true }
starcoin-types = { workspace = true }
starcoin-vm-types = { workspace = true }
thiserror = { workspace = true }

starcoin-network-rpc-api = { workspace = true }
starcoin-config = { workspace = true }

[dev-dependencies]

Expand Down
10 changes: 9 additions & 1 deletion chain/api/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2

use anyhow::Result;
use starcoin_accumulator::accumulator_info::AccumulatorInfo;
use starcoin_config::ChainNetworkID;
use starcoin_crypto::HashValue;
use starcoin_state_api::ChainStateReader;
use starcoin_statedb::ChainStateDB;
Expand Down Expand Up @@ -80,7 +82,11 @@ pub trait ChainReader {
/// Verify block header and body, base current chain, but do not verify it execute state.
fn verify(&self, block: Block) -> Result<VerifiedBlock>;
/// Execute block and verify it execute state, and save result base current chain, but do not change current chain.
fn execute(&self, block: VerifiedBlock) -> Result<ExecutedBlock>;
fn execute(
&self,
block: VerifiedBlock,
transaction_parent: Option<HashValue>,
) -> Result<ExecutedBlock>;
/// Get chain transaction infos
fn get_transaction_infos(
&self,
Expand All @@ -100,6 +106,8 @@ pub trait ChainReader {
event_index: Option<u64>,
access_path: Option<AccessPath>,
) -> Result<Option<TransactionInfoWithProof>>;

fn net_id(&self) -> ChainNetworkID;
}

pub trait ChainWriter {
Expand Down
Loading
Loading