Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
85e6799
fork!: Change PoW algorithm to make proposal-switching free
Sword-Smith Oct 1, 2025
706d345
style: Move some declarations around is guess_worker
Sword-Smith Oct 14, 2025
8410301
refactor(`GuesserBuffer`): Exfiltrate field `mast_auth_paths`
aszepieniec Oct 15, 2025
3b7164f
test: Verify node can handle hardfork-alpha transition
Sword-Smith Oct 13, 2025
c6926af
feat(mine_loop): Allow for deterministic guessing
Sword-Smith Oct 21, 2025
0b07314
refactor(mine_loop): Allow mining without peers if not on main net
Sword-Smith Oct 21, 2025
f2fc831
style: Factor out const for testnet hardfork block height
Sword-Smith Oct 22, 2025
9f8a220
test: Pull test-helper function out to shared module
Sword-Smith Oct 22, 2025
d13dba5
test(peer_loop): add hardfork-alpha test to peer_loop
Sword-Smith Oct 22, 2025
63e35dc
test: Ensure main loop does not do verification
Sword-Smith Oct 22, 2025
9066214
test: Verify bitreverse algorithm
Sword-Smith Oct 23, 2025
f4e66d8
fix(pow): Ensure indices cannot be reused across proposals after HF-a…
Sword-Smith Oct 23, 2025
cb8cbe9
test(peer_loop): Harden harfork-alpha-related test
Sword-Smith Oct 23, 2025
591520a
test(peer_loop): Add two negative pow-related tests
Sword-Smith Oct 24, 2025
8c1fedf
fix: Insert commented-out code again
Sword-Smith Oct 24, 2025
d1e6a37
style: Review feedback
Sword-Smith Oct 24, 2025
33f473c
test(pow): Make pow-solver for tests deterministic
Sword-Smith Oct 28, 2025
02c6a6d
test: Verify that transactions work on HF-a rule set
Sword-Smith Oct 30, 2025
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
9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,14 @@ build-override.opt-level = 3
build-override.opt-level = 3

[profile.dev]
build-override.opt-level = 3
build-override.opt-level = 2
opt-level = 0
debug = false
incremental = true
debug-assertions = false
overflow-checks = false
lto = false
panic = "abort"

# The profile that 'dist' will build with
[profile.dist]
Expand Down
80 changes: 80 additions & 0 deletions neptune-core/src/application/loops/main_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3134,6 +3134,86 @@ mod tests {
mod peer_messages {
use super::*;

#[traced_test]
#[apply(shared_tokio_runtime)]
async fn main_loop_does_not_do_verification() {
// Ensure that the main loop does no validation of block validity
// or PoW, as these checks belong in the peer loop, or elsewhere.
let network = Network::Main;
let cli = cli_args::Args::default_with_network(network);
let TestSetup {
mut main_loop_handler,
..
} = setup(1, 1, cli).await;
let mut main_loop_state = main_loop_handler.mutable();

let genesis = Block::genesis(network);
let block1 = invalid_empty_block(&genesis, network);
assert!(
!block1
.is_valid(&genesis, block1.header().timestamp, network)
.await
);
assert!(!block1.has_proof_of_work(network, genesis.header()));

let block2 = invalid_empty_block(&block1, network);
assert!(
!block2
.is_valid(&genesis, block2.header().timestamp, network)
.await
);
assert!(!block2.has_proof_of_work(network, block1.header()));

assert_eq!(
BlockHeight::genesis(),
main_loop_handler
.global_state_lock
.lock_guard()
.await
.chain
.light_state()
.header()
.height
);
main_loop_handler
.handle_peer_task_message(
PeerTaskToMain::NewBlocks(vec![block1.clone()]),
&mut main_loop_state,
)
.await
.unwrap();
assert_eq!(
block1.header().height,
main_loop_handler
.global_state_lock
.lock_guard()
.await
.chain
.light_state()
.header()
.height
);

main_loop_handler
.handle_peer_task_message(
PeerTaskToMain::NewBlocks(vec![block1.clone(), block2.clone()]),
&mut main_loop_state,
)
.await
.unwrap();
assert_eq!(
block2.header().height,
main_loop_handler
.global_state_lock
.lock_guard()
.await
.chain
.light_state()
.header()
.height
);
}

#[traced_test]
#[apply(shared_tokio_runtime)]
async fn new_block_from_peer_invokes_block_notify() {
Expand Down
Loading
Loading