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

backport 4011 4012 4015 #4014

Merged
merged 3 commits into from
Jun 16, 2023
Merged
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
5 changes: 1 addition & 4 deletions script/src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,6 @@ impl<DL: CellDataProvider + HeaderProvider + ExtensionProvider + Send + Sync + C
pub struct TransactionScriptsVerifier<DL> {
data_loader: DL,

debug_printer: DebugPrinter,

rtx: Arc<ResolvedTransaction>,

binaries_by_data_hash: HashMap<Byte32, LazyData>,
Expand Down Expand Up @@ -464,7 +462,6 @@ impl<DL: CellDataProvider + HeaderProvider + ExtensionProvider + Send + Sync + C
rtx,
lock_groups,
type_groups,
debug_printer,
#[cfg(test)]
skip_pause,
consensus,
Expand All @@ -483,7 +480,7 @@ impl<DL: CellDataProvider + HeaderProvider + ExtensionProvider + Send + Sync + C
/// * `hash: &Byte32`: this is the script hash of currently running script group.
/// * `message: &str`: message passed to the debug syscall.
pub fn set_debug_printer<F: Fn(&Byte32, &str) + Sync + Send + 'static>(&mut self, func: F) {
self.debug_printer = Arc::new(func);
self.generator.debug_printer = Arc::new(func);
}

#[cfg(test)]
Expand Down
9 changes: 9 additions & 0 deletions spec/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -797,9 +797,18 @@ impl Consensus {
epoch_duration_in_milliseconds,
} => {
if self.permanent_difficulty() {
let primary_epoch_reward =
self.primary_epoch_reward_of_next_epoch(&epoch).as_u64();
let block_reward =
Capacity::shannons(primary_epoch_reward / epoch.length());
let remainder_reward =
Capacity::shannons(primary_epoch_reward % epoch.length());

let dummy_epoch_ext = epoch
.clone()
.into_builder()
.base_block_reward(block_reward)
.remainder_reward(remainder_reward)
.number(epoch.number() + 1)
.last_block_hash_in_previous_epoch(header.hash())
.start_number(header.number() + 1)
Expand Down
8 changes: 7 additions & 1 deletion util/app-config/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! CKB command line arguments parser.
use ckb_build_info::Version;
use ckb_resource::{DEFAULT_P2P_PORT, DEFAULT_RPC_PORT, DEFAULT_SPEC};
use ckb_resource::{AVAILABLE_SPECS, DEFAULT_P2P_PORT, DEFAULT_RPC_PORT, DEFAULT_SPEC};
use clap::{Arg, ArgGroup, ArgMatches, Command};

/// binary file name(ckb)
Expand Down Expand Up @@ -414,6 +414,12 @@ fn init() -> Command {
Arg::new(ARG_CHAIN)
.short('c')
.long(ARG_CHAIN)
.value_parser(
AVAILABLE_SPECS
.iter()
.map(|v| v.to_string())
.collect::<Vec<_>>(),
)
.default_value(DEFAULT_SPEC)
.help("Initializes CKB directory for <chain>"),
)
Expand Down