Skip to content

Conversation

@cschuchardt88
Copy link
Member

Description

using Wait() on a thread is bad and blocks syncing thread context like in debugging.

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit Testing

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@cschuchardt88 cschuchardt88 added Waiting for Review Easy-to-Review a simple edit; just a few lines labels Jun 16, 2025
shargon
shargon previously approved these changes Jun 16, 2025
Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

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

I think that both locks the thread until task is completed, no?

The difference is that now it throws the original exception directly (not wrapped such as AggregateException).

@cschuchardt88
Copy link
Member Author

cschuchardt88 commented Jun 16, 2025

I think that both locks the thread until task is completed, no?

The difference is that now it throws the original exception directly (not wrapped such as AggregateException).

The code GetAwaiter().GetResult() is commonly used in C# to synchronously block and wait for the completion of an asynchronous operation (like a Task or Task<T>) while also propagating exceptions in a way that's often preferred for debugging

Here's a breakdown:

  • GetAwaiter(): This method retrieves an object called an awaiter from the asynchronous operation. The awaiter is responsible for managing the asynchronous process and its completion.
  • GetResult(): This method on the awaiter blocks the calling thread until the asynchronous operation is finished. It then returns the result of the operation if it was successful, or throws an exception if it failed.

Why and when might you use it?

While the await keyword is generally the preferred way to handle asynchronous operations in C#, GetAwaiter().GetResult() can be used in specific situations where you need to:

  • Synchronously wait for an asynchronous operation: When you can't mark a method as async (e.g., in a constructor), but need to wait for an asynchronous operation to complete, this approach can be employed.
  • Handle exceptions directly: Unlike Task.Wait or Task.Result, which can wrap exceptions in an AggregateException, GetAwaiter().GetResult() rethrows the original exception directly. This can make it easier to catch and handle specific exceptions during debugging.
  • Run asynchronous code in a non-async context: You can use this method to execute an asynchronous method and wait for its completion synchronously.

Important Considerations:

  • Potential for deadlocks: Using GetAwaiter().GetResult() can potentially lead to deadlocks, especially in scenarios involving SynchronizationContext. The best practice is to avoid blocking on asynchronous code unless absolutely necessary.
  • Use Task.Run().GetAwaiter().GetResult() to avoid deadlocks: If you need to synchronously wait for an async operation in a situation where a SynchronizationContext is involved, using Task.Run().GetAwaiter().GetResult() can prevent deadlocks.
  • Use with ConfigureAwait(false): When using GetAwaiter().GetResult(), it's recommended to call ConfigureAwait(false) on the asynchronous operation to avoid capturing the current SynchronizationContext and potentially preventing deadlocks.

In essence, getawaiter().getresult() allows you to take control of how an asynchronous operation is awaited and how exceptions are handled, but it comes with potential risks and should be used with caution and careful consideration of its implications for your application's concurrency and thread management.

@Jim8y
Copy link
Contributor

Jim8y commented Jun 18, 2025

This pr achieved what it intends to, and fixed the potential issue, thus LGTM.

Copy link
Member

@superboyiii superboyiii left a comment

Choose a reason for hiding this comment

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

This avoid deadlock and get expection correctly.

@shargon shargon merged commit 5a01a56 into neo-project:dev Jun 18, 2025
7 checks passed
shargon added a commit that referenced this pull request Jul 8, 2025
* Fix: P/Invokes should not be visible (#4003)

* [Optimization] - Optimize key method (#4001)

* [Optimization] - Optimize Key method

* Update src/Neo.Cryptography.MPTTrie/Cache.cs

---------

Co-authored-by: Shargon <[email protected]>

* Fix Threading hanging with `NeoSystem` (#4005)

* Fix threading hanging with `NeoSystem`

* Fixed for deadlocks

---------

Co-authored-by: Christopher R. Schuchardt <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Style: unify json init style (#4004)

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>

* Update packages (#4006)

* Update packages

* more

* clean

---------

Co-authored-by: Jimmy <[email protected]>

* Restore DBFTPlugin Unit Tests (ConsensusService and Consensus Context) (#3473)

* Initial comit

* Fix paths

* Added `Neo.Plugins.DBFTPlugin.Tests` to `Neo` internals

* Added tests to github workflow

* Akka deps

* Advancing

* TestWallet is mocked

* Adding more steps

* Fixed Test mocking

* Timestamp testing

* Header and TestProbe

* format

* Huge advance! Test probe is now working. Now we go

* dotnet format

* Header looks like to be correct now

* Workaround for dbft settings

* build the mock system for solenode

* update to 7 nodes network mock system

* Comment original tests of the PR

* [`ut`] 100% Coverage Trie.Get (#3952)

* 100% Coverage Trie.Get

* fix ut

* feat: Add comprehensive DBFT consensus unit tests

- Add 34 comprehensive unit tests covering all DBFT scenarios
- Test normal consensus flows, abnormal scenarios, and recovery mechanisms
- Include Byzantine fault tolerance testing (f=1 and f=2 failures)
- Add network partition and message loss simulation
- Implement stress testing with multiple rounds and large transaction sets
- Create professional test infrastructure with TestWallet and ConsensusTestHelper
- Add comprehensive README documentation
- Ensure 100% test pass rate with robust error handling
- Cover complete DBFT protocol: PrepareRequest → PrepareResponse → Commit flow
- Validate view changes, recovery requests, and state synchronization

Test Coverage:
- UT_ConsensusService.cs (7 tests): Service lifecycle and message handling
- UT_DBFT.cs (6 tests): Basic consensus scenarios
- UT_DBFT_Integration.cs (4 tests): Integration scenarios
- UT_DBFT_NormalFlow.cs (3 tests): Complete normal consensus flows
- UT_DBFT_AbnormalScenarios.cs (4 tests): Failure and attack scenarios
- UT_DBFT_Recovery.cs (6 tests): Recovery mechanisms
- UT_DBFT_Robustness.cs (4 tests): Stress and edge case testing

All tests pass: 34/34 ✅

* chore: Update .NET SDK version to 9.0.203

- Update global.json to use .NET SDK 9.0.203 (from 9.0.102)
- Ensures compatibility with latest .NET 9 features and fixes

* fix: Revert .NET SDK version to 9.0.102

- Revert global.json to use .NET SDK 9.0.102 (available on build system)
- Ensures compatibility with current development environment
- Previous version 9.0.203 was not available on the build system

* style: Update copyright year to 2025

- Run dotnet format to apply code formatting standards
- Update copyright year in RecoveryMessageExtensions.cs from 2024 to 2025
- Maintain consistent code formatting across the project

* chore: Update .NET SDK version to 9.0.300

- Update global.json to use .NET SDK 9.0.300 (from 9.0.102)
- Ensures compatibility with latest .NET 9 features and improvements
- Maintains project build consistency with updated SDK

* fix: Resolve RpcServer test compilation errors

- Add Neo.IO using statement for ToHexString extension method
- Comment out problematic ToHexString calls in test setup
- Ensure RpcServer tests can compile alongside DBFT tests
- Maintain DBFT test functionality (34/34 tests passing)

* fix: Complete RpcServer test compilation fix

- Ensure all ToHexString extension method issues are resolved
- Maintain compatibility with DBFT tests (34/34 passing)
- Fix build errors in RpcServer test suite

* Revert changes except DBFT plugin tests

- Reverted all source files to match dev branch
- Reverted test files in Neo.UnitTests and Neo.Plugins.RpcServer.Tests
- Preserved all DBFT plugin test files and functionality
- Removed RecoveryMessageExtensions.cs (not in dev branch)

* Fix DBFT plugin tests API compatibility and accessibility

- Made ConsensusService class internal for test accessibility
- Added InternalsVisibleTo attributes for Neo core and DBFT plugin
- Updated test constructors to use current dev branch API:
  - Fixed NeoSystem constructor (2-parameter instead of 6-parameter)
  - Fixed Settings constructor to use IConfigurationSection
  - Added Microsoft.Extensions.Configuration packages
- Created TestBlockchain.CreateDefaultSettings() helper method
- Updated all test files to use compatible API calls
- All 1,401 tests passing including 34 DBFT plugin tests
- Code formatted with dotnet format

* Add comprehensive DBFT consensus message flow tests

- Implement proper consensus message flow monitoring as requested in GitHub comment
- Add UT_DBFT_ProperMessageFlow.cs with professional, working tests
- Update ConsensusTestHelper with async methods for natural message flow
- Clean up comments and code formatting with dotnet format
- All 38 DBFT plugin tests passing

Tests now properly:
- Send PrepareRequest and wait for natural PrepareResponse
- Monitor actual consensus message flow instead of forcing it
- Handle message validation, service resilience, and lifecycle testing
- Use simplified but effective message capture mechanism

* Update src/Plugins/DBFTPlugin/DBFTPlugin.csproj

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update src/Plugins/DBFTPlugin/DBFTPlugin.csproj

* refactor: Enhance DBFT consensus unit tests to professional standards - Consistent UT_xxx naming convention for all test files - Mock* pattern for all helper/utility classes - Enhanced assertions (7→19, +171% improvement) - Removed duplicate test methods (~140 lines eliminated) - Professional documentation aligned with implementation - Fixed project file syntax (InternalsVisibleTo) - 100% test pass rate maintained (34/34 tests) - Ready for production deployment

* Convert DBFT unit tests from xUnit to MSTest framework

- Remove xUnit package references (xunit, xunit.runner.visualstudio, Akka.TestKit.Xunit2)
- Add Akka.TestKit.MsTest package reference
- Update all test files to use MSTest TestKit instead of xUnit
- Fix test runner configuration to resolve "Zero tests ran" issue
- All 34 tests now pass successfully with MSTest framework
- Maintain existing test structure and TestKit inheritance

* Update DBFT unit tests README for MSTest framework

- Document MSTest framework usage instead of xUnit
- Update prerequisites to include MSTest and Akka.NET TestKit (MSTest version)
- Add note about Visual Studio Test Explorer integration
- Update performance timing to reflect current test execution (~33s)
- Emphasize production-ready testing capabilities

* Fix copyright header filenames in DBFT tests

- Correct UT_DBFT_Performance.cs header (was UT_DBFT_Robustness.cs)
- Correct UT_DBFT_Failures.cs header (was UT_DBFT_AbnormalScenarios.cs)
- Fix other copyright headers to match actual filenames
- Applied via dotnet format to ensure consistency

* Update tests/Neo.Plugins.DBFTPlugin.Tests/Neo.Plugins.DBFTPlugin.Tests.csproj

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_Core.cs

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_MessageFlow.cs

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_MessageFlow.cs

* Add coverage

---------

Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: Jimmy <[email protected]>

* Style: move MPT Benchamrk Project to benchmarks/ (#4011)

* [`improve`] nullable app logs (#4008)

* nullable app logs

* Update src/Plugins/ApplicationLogs/LogReader.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

* Apply suggestions from code review

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update src/Plugins/ApplicationLogs/Settings.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

---------

Co-authored-by: Christopher Schuchardt <[email protected]>

* Fix: remove FluentAssertions in notary tests (#4014)

* Add: SignClient Vsock support (#4002)

* Add: SignClient vsock support

* optimize: add const string

* optimize: use Uri parse endpoint

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>

* Comments: add Exception info for numeric ops (#4021)

---------

Co-authored-by: Will <[email protected]>
Co-authored-by: Alvaro <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher R. Schuchardt <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Vitor Nazário Coelho <[email protected]>
Co-authored-by: Jimmy <[email protected]>
shargon added a commit that referenced this pull request Jul 30, 2025
* Fix: P/Invokes should not be visible (#4003)

* [Optimization] - Optimize key method (#4001)

* [Optimization] - Optimize Key method

* Update src/Neo.Cryptography.MPTTrie/Cache.cs

---------

Co-authored-by: Shargon <[email protected]>

* Fix Threading hanging with `NeoSystem` (#4005)

* Fix threading hanging with `NeoSystem`

* Fixed for deadlocks

---------

Co-authored-by: Christopher R. Schuchardt <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Style: unify json init style (#4004)

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>

* Update packages (#4006)

* Update packages

* more

* clean

---------

Co-authored-by: Jimmy <[email protected]>

* Restore DBFTPlugin Unit Tests (ConsensusService and Consensus Context) (#3473)

* Initial comit

* Fix paths

* Added `Neo.Plugins.DBFTPlugin.Tests` to `Neo` internals

* Added tests to github workflow

* Akka deps

* Advancing

* TestWallet is mocked

* Adding more steps

* Fixed Test mocking

* Timestamp testing

* Header and TestProbe

* format

* Huge advance! Test probe is now working. Now we go

* dotnet format

* Header looks like to be correct now

* Workaround for dbft settings

* build the mock system for solenode

* update to 7 nodes network mock system

* Comment original tests of the PR

* [`ut`] 100% Coverage Trie.Get (#3952)

* 100% Coverage Trie.Get

* fix ut

* feat: Add comprehensive DBFT consensus unit tests

- Add 34 comprehensive unit tests covering all DBFT scenarios
- Test normal consensus flows, abnormal scenarios, and recovery mechanisms
- Include Byzantine fault tolerance testing (f=1 and f=2 failures)
- Add network partition and message loss simulation
- Implement stress testing with multiple rounds and large transaction sets
- Create professional test infrastructure with TestWallet and ConsensusTestHelper
- Add comprehensive README documentation
- Ensure 100% test pass rate with robust error handling
- Cover complete DBFT protocol: PrepareRequest → PrepareResponse → Commit flow
- Validate view changes, recovery requests, and state synchronization

Test Coverage:
- UT_ConsensusService.cs (7 tests): Service lifecycle and message handling
- UT_DBFT.cs (6 tests): Basic consensus scenarios
- UT_DBFT_Integration.cs (4 tests): Integration scenarios
- UT_DBFT_NormalFlow.cs (3 tests): Complete normal consensus flows
- UT_DBFT_AbnormalScenarios.cs (4 tests): Failure and attack scenarios
- UT_DBFT_Recovery.cs (6 tests): Recovery mechanisms
- UT_DBFT_Robustness.cs (4 tests): Stress and edge case testing

All tests pass: 34/34 ✅

* chore: Update .NET SDK version to 9.0.203

- Update global.json to use .NET SDK 9.0.203 (from 9.0.102)
- Ensures compatibility with latest .NET 9 features and fixes

* fix: Revert .NET SDK version to 9.0.102

- Revert global.json to use .NET SDK 9.0.102 (available on build system)
- Ensures compatibility with current development environment
- Previous version 9.0.203 was not available on the build system

* style: Update copyright year to 2025

- Run dotnet format to apply code formatting standards
- Update copyright year in RecoveryMessageExtensions.cs from 2024 to 2025
- Maintain consistent code formatting across the project

* chore: Update .NET SDK version to 9.0.300

- Update global.json to use .NET SDK 9.0.300 (from 9.0.102)
- Ensures compatibility with latest .NET 9 features and improvements
- Maintains project build consistency with updated SDK

* fix: Resolve RpcServer test compilation errors

- Add Neo.IO using statement for ToHexString extension method
- Comment out problematic ToHexString calls in test setup
- Ensure RpcServer tests can compile alongside DBFT tests
- Maintain DBFT test functionality (34/34 tests passing)

* fix: Complete RpcServer test compilation fix

- Ensure all ToHexString extension method issues are resolved
- Maintain compatibility with DBFT tests (34/34 passing)
- Fix build errors in RpcServer test suite

* Revert changes except DBFT plugin tests

- Reverted all source files to match dev branch
- Reverted test files in Neo.UnitTests and Neo.Plugins.RpcServer.Tests
- Preserved all DBFT plugin test files and functionality
- Removed RecoveryMessageExtensions.cs (not in dev branch)

* Fix DBFT plugin tests API compatibility and accessibility

- Made ConsensusService class internal for test accessibility
- Added InternalsVisibleTo attributes for Neo core and DBFT plugin
- Updated test constructors to use current dev branch API:
  - Fixed NeoSystem constructor (2-parameter instead of 6-parameter)
  - Fixed Settings constructor to use IConfigurationSection
  - Added Microsoft.Extensions.Configuration packages
- Created TestBlockchain.CreateDefaultSettings() helper method
- Updated all test files to use compatible API calls
- All 1,401 tests passing including 34 DBFT plugin tests
- Code formatted with dotnet format

* Add comprehensive DBFT consensus message flow tests

- Implement proper consensus message flow monitoring as requested in GitHub comment
- Add UT_DBFT_ProperMessageFlow.cs with professional, working tests
- Update ConsensusTestHelper with async methods for natural message flow
- Clean up comments and code formatting with dotnet format
- All 38 DBFT plugin tests passing

Tests now properly:
- Send PrepareRequest and wait for natural PrepareResponse
- Monitor actual consensus message flow instead of forcing it
- Handle message validation, service resilience, and lifecycle testing
- Use simplified but effective message capture mechanism

* Update src/Plugins/DBFTPlugin/DBFTPlugin.csproj

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update src/Plugins/DBFTPlugin/DBFTPlugin.csproj

* refactor: Enhance DBFT consensus unit tests to professional standards - Consistent UT_xxx naming convention for all test files - Mock* pattern for all helper/utility classes - Enhanced assertions (7→19, +171% improvement) - Removed duplicate test methods (~140 lines eliminated) - Professional documentation aligned with implementation - Fixed project file syntax (InternalsVisibleTo) - 100% test pass rate maintained (34/34 tests) - Ready for production deployment

* Convert DBFT unit tests from xUnit to MSTest framework

- Remove xUnit package references (xunit, xunit.runner.visualstudio, Akka.TestKit.Xunit2)
- Add Akka.TestKit.MsTest package reference
- Update all test files to use MSTest TestKit instead of xUnit
- Fix test runner configuration to resolve "Zero tests ran" issue
- All 34 tests now pass successfully with MSTest framework
- Maintain existing test structure and TestKit inheritance

* Update DBFT unit tests README for MSTest framework

- Document MSTest framework usage instead of xUnit
- Update prerequisites to include MSTest and Akka.NET TestKit (MSTest version)
- Add note about Visual Studio Test Explorer integration
- Update performance timing to reflect current test execution (~33s)
- Emphasize production-ready testing capabilities

* Fix copyright header filenames in DBFT tests

- Correct UT_DBFT_Performance.cs header (was UT_DBFT_Robustness.cs)
- Correct UT_DBFT_Failures.cs header (was UT_DBFT_AbnormalScenarios.cs)
- Fix other copyright headers to match actual filenames
- Applied via dotnet format to ensure consistency

* Update tests/Neo.Plugins.DBFTPlugin.Tests/Neo.Plugins.DBFTPlugin.Tests.csproj

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_Core.cs

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_MessageFlow.cs

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_MessageFlow.cs

* Add coverage

---------

Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: Jimmy <[email protected]>

* Style: move MPT Benchamrk Project to benchmarks/ (#4011)

* [`improve`] nullable app logs (#4008)

* nullable app logs

* Update src/Plugins/ApplicationLogs/LogReader.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

* Apply suggestions from code review

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update src/Plugins/ApplicationLogs/Settings.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

---------

Co-authored-by: Christopher Schuchardt <[email protected]>

* Fix: remove FluentAssertions in notary tests (#4014)

* Add: SignClient Vsock support (#4002)

* Add: SignClient vsock support

* optimize: add const string

* optimize: use Uri parse endpoint

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>

* Comments: add Exception info for numeric ops (#4021)

* Isolate ApplicationEngine events (#4016)

* Isolate Log Event

* Isolate instance events

* clean

* Update src/Neo/SmartContract/ApplicationEngine.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

* Apply suggestions from code review

Co-authored-by: Christopher Schuchardt <[email protected]>

* Fix compile

* udate format

* Unify names

---------

Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: jimmy <[email protected]>

* Cache nuget packages (#4034)

* Cache nuget packages

* move

* Update main.yml

* Update main.yml

* Style: more standard code style for Neo.VM (#4022)

Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: Shargon <[email protected]>

* Optimize: more semantics description and better impl for 'TestBit(this BigInteger value, int index)' (#4031)

Co-authored-by: Shargon <[email protected]>

* Improve exception messages throughout Neo codebase (#4032)

* Improve exception messages throughout Neo codebase

- Standardize exception message format for consistency
- Make messages more descriptive and professional
- Remove oversimplified and verbose exception messages
- Improve developer experience with clearer error context
- Apply consistent patterns for similar validation types
- Update messages across CLI, Smart Contracts, Cryptography, VM, and other modules

This change improves the quality of error reporting while maintaining
technical accuracy and providing better debugging information.

* Remove PR description file

* Improve exception messages in ECPoint.cs - only message content updated, no code logic changes

* format

* Fix UPnP unit test to expect InvalidOperationException

- Updated UT_UPnP.cs test to expect InvalidOperationException instead of Exception
- This aligns with the improved exception handling implemented in UPnP.cs
- Fixes test failure caused by more specific exception types
- All 1511 tests now pass successfully

* Update src/Neo.VM/Types/Integer.cs

---------

Co-authored-by: Shargon <[email protected]>

* Optimize: impl `GetLowestSetBit` by `TrailingZeroCount` if available (#4030)

* Optimize: impl GetLowestSetBit by TrailingZeroCount if available

* Update src/Neo.Extensions/BigIntegerExtensions.cs

---------

Co-authored-by: Shargon <[email protected]>

* [`style`] Style neo system (#4040)

* Style

* Update .editorconfig

Co-authored-by: Christopher Schuchardt <[email protected]>

* renames

---------

Co-authored-by: Christopher Schuchardt <[email protected]>

* Refactor MainService.Vote class (#4036)

* Refactor code and improve styles

* Update src/Neo.CLI/CLI/MainService.Vote.cs

Co-authored-by: Will <[email protected]>

* Apply dotnet format to fix whitespace formatting

- Remove trailing space after method signature
- Ensure proper alignment of expression-bodied member
- Comply with project .editorconfig standards

* Update src/Neo.CLI/CLI/MainService.Vote.cs

* Fix: add null arg to BuildNeoScript from UnVote. Rename BuildNativeScript to BuildNeoScript

---------

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>

* Doc: add document for plugin SignClient (#4049)

* Doc: add document for plugin SignClient

* Update docs/plugin-secure-sign-guide.md

Co-authored-by: Shargon <[email protected]>

* Update docs/plugin-secure-sign-guide.md

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update docs/plugin-secure-sign-guide.md

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update docs/plugin-secure-sign-guide.md

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update docs/plugin-secure-sign-guide.md

Co-authored-by: Christopher Schuchardt <[email protected]>

* Fix typo

* Remove unnecessary words

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>

* [`Fix`] RcpClient Directories and Naming (#4046)

Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Will <[email protected]>

* Optimize: no secaped char for command line input (#4044)

Co-authored-by: NGD Admin <[email protected]>

* Fix: tx.ToJson no 'cosigners' field (#4051)

* Fix: tx.ToJson no 'cosigners' field

* Rename methods

---------

Co-authored-by: Shargon <[email protected]>

* Fix: not matched error code if argument is null with RpcMethodWithParams (#4052)

Co-authored-by: Shargon <[email protected]>

* Renamed and Fix Properties with plugins (#4062)

* Renamed and Fix Properties with plugins

* Update src/Plugins/SignClient/SignSettings.cs

* Format

* Rename @shargon `ServerSettings` to RpcServersSettings`

* Added @shargon suggestion for `DbftSettings`

---------

Co-authored-by: Shargon <[email protected]>

* [`Add`] Indexer to EvaluationStack (#4050)

* [`Add`] Indexer to EvaluationStack

* Added indexer tests

* Added more tests

* Touch ups

* Use indexer instead

* use indexer instead

* Increase checks

* Update EvaluationStack.cs

* fixed @shargon broken code

* Added extra test for bigger value than length of `innerList`

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Comments: Add detail description for RPC Method (#4054)

* [`Add`] `TryCatch` & `TryCatchThrow` Extensions (#4038)

* [`Add`] `TryCatch` & `TryCatchThrow` Extensions

* fixes

* Add `TryCatch` to `Peers`

---------

Co-authored-by: Will <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Add: input cli command line with `--argument-name argument-value` (#4047)

* Add: input cli command line with --argument-name argument-value

* update help output

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Optimize: more detail for help command (#4067)

* Optimize: clearer parser for parameter Signers and Witnesses, and fix comments (#4066)

* [`Fix`] Async Ask Method (#4071)

Co-authored-by: Shargon <[email protected]>

* Move `install sc` out of `ConsoleServiceBase.Run` (#4048)

* Optimzie: install with sc.exe

* Update src/Neo.ConsoleService/ConsoleServiceBase.cs

Co-authored-by: Shargon <[email protected]>

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* [`Add`] `RandomNumberFactory` Class (#3987)

* Updated `RandomExtensions.NextBigIneger` to use `RandomNumberGenerator`

* Added `RandomNumberFactory` class to generate random numbers.

* changed namespace

* Fixed bugs

* fixed more bugs

* Fixed up tests and add more

* Update src/Neo.Extensions/Factories/RandomNumberFactory.cs

Co-authored-by: Shargon <[email protected]>

* Fixed per @shargon feedback

* Bug fix per @vncoelho

* Added more tests

* Bug Fix

* Fixed bugs in `NextBigInteger` unit tests

* Updated `RandomExtensions.NextBigIneger` to use `RandomNumberGenerator`

* Added `RandomNumberFactory` class to generate random numbers.

* changed namespace

* Fixed bugs

* fixed more bugs

* Fixed up tests and add more

* Fixed per @shargon feedback

* Update src/Neo.Extensions/Factories/RandomNumberFactory.cs

Co-authored-by: Shargon <[email protected]>

* Bug fix per @vncoelho

* Added more tests

* Bug Fix

* Fixed bugs in `NextBigInteger` unit tests

* Added more tests and add `NexrBigInteger` minmax

* Bug fixes

* `BigInteger` now uses negative numbers.

* Fixes to `NextBigInteger`

* Fixed `BigNextInteger(MaxValue)` to calulate correctly.

* Added @vncoelho suggestions

* Fixed `NextInteger` for faster resolve.

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: Vitor Nazário Coelho <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* [UT] - Add unit tests in NeoSystem (#3978)

* [UT] - Add unit tests in NeoSystem

* Fix: Isolate global state in UT_RoleManagement ResetStore in snapshot

* Fix: Removing CloneCache to isolate state per role

* Fix: Isolating state

* Fix: Isolate global state and filter Designation notifications due to shared ApplicationEngine.Notify handler

* Fix: Remove console.writeline

---------

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Fixed solutiuon file

* Fixed `neo-build.dev` branch for the changes in `dev`

---------

Co-authored-by: Will <[email protected]>
Co-authored-by: Alvaro <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher R. Schuchardt <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Vitor Nazário Coelho <[email protected]>
Co-authored-by: Jimmy <[email protected]>
shargon added a commit that referenced this pull request Aug 6, 2025
* Added `neo-build` new branch

* Add debug sink

* Add more debug logging and fixes

* Added Provider

* Fixes to ApplicationEngine Threading

* Fix: P/Invokes should not be visible (#4003)

* [Optimization] - Optimize key method (#4001)

* [Optimization] - Optimize Key method

* Update src/Neo.Cryptography.MPTTrie/Cache.cs

---------

Co-authored-by: Shargon <[email protected]>

* Fix Threading hanging with `NeoSystem` (#4005)

* Fix threading hanging with `NeoSystem`

* Fixed for deadlocks

---------

Co-authored-by: Christopher R. Schuchardt <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Style: unify json init style (#4004)

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>

* Update packages (#4006)

* Update packages

* more

* clean

---------

Co-authored-by: Jimmy <[email protected]>

* Restore DBFTPlugin Unit Tests (ConsensusService and Consensus Context) (#3473)

* Initial comit

* Fix paths

* Added `Neo.Plugins.DBFTPlugin.Tests` to `Neo` internals

* Added tests to github workflow

* Akka deps

* Advancing

* TestWallet is mocked

* Adding more steps

* Fixed Test mocking

* Timestamp testing

* Header and TestProbe

* format

* Huge advance! Test probe is now working. Now we go

* dotnet format

* Header looks like to be correct now

* Workaround for dbft settings

* build the mock system for solenode

* update to 7 nodes network mock system

* Comment original tests of the PR

* [`ut`] 100% Coverage Trie.Get (#3952)

* 100% Coverage Trie.Get

* fix ut

* feat: Add comprehensive DBFT consensus unit tests

- Add 34 comprehensive unit tests covering all DBFT scenarios
- Test normal consensus flows, abnormal scenarios, and recovery mechanisms
- Include Byzantine fault tolerance testing (f=1 and f=2 failures)
- Add network partition and message loss simulation
- Implement stress testing with multiple rounds and large transaction sets
- Create professional test infrastructure with TestWallet and ConsensusTestHelper
- Add comprehensive README documentation
- Ensure 100% test pass rate with robust error handling
- Cover complete DBFT protocol: PrepareRequest → PrepareResponse → Commit flow
- Validate view changes, recovery requests, and state synchronization

Test Coverage:
- UT_ConsensusService.cs (7 tests): Service lifecycle and message handling
- UT_DBFT.cs (6 tests): Basic consensus scenarios
- UT_DBFT_Integration.cs (4 tests): Integration scenarios
- UT_DBFT_NormalFlow.cs (3 tests): Complete normal consensus flows
- UT_DBFT_AbnormalScenarios.cs (4 tests): Failure and attack scenarios
- UT_DBFT_Recovery.cs (6 tests): Recovery mechanisms
- UT_DBFT_Robustness.cs (4 tests): Stress and edge case testing

All tests pass: 34/34 ✅

* chore: Update .NET SDK version to 9.0.203

- Update global.json to use .NET SDK 9.0.203 (from 9.0.102)
- Ensures compatibility with latest .NET 9 features and fixes

* fix: Revert .NET SDK version to 9.0.102

- Revert global.json to use .NET SDK 9.0.102 (available on build system)
- Ensures compatibility with current development environment
- Previous version 9.0.203 was not available on the build system

* style: Update copyright year to 2025

- Run dotnet format to apply code formatting standards
- Update copyright year in RecoveryMessageExtensions.cs from 2024 to 2025
- Maintain consistent code formatting across the project

* chore: Update .NET SDK version to 9.0.300

- Update global.json to use .NET SDK 9.0.300 (from 9.0.102)
- Ensures compatibility with latest .NET 9 features and improvements
- Maintains project build consistency with updated SDK

* fix: Resolve RpcServer test compilation errors

- Add Neo.IO using statement for ToHexString extension method
- Comment out problematic ToHexString calls in test setup
- Ensure RpcServer tests can compile alongside DBFT tests
- Maintain DBFT test functionality (34/34 tests passing)

* fix: Complete RpcServer test compilation fix

- Ensure all ToHexString extension method issues are resolved
- Maintain compatibility with DBFT tests (34/34 passing)
- Fix build errors in RpcServer test suite

* Revert changes except DBFT plugin tests

- Reverted all source files to match dev branch
- Reverted test files in Neo.UnitTests and Neo.Plugins.RpcServer.Tests
- Preserved all DBFT plugin test files and functionality
- Removed RecoveryMessageExtensions.cs (not in dev branch)

* Fix DBFT plugin tests API compatibility and accessibility

- Made ConsensusService class internal for test accessibility
- Added InternalsVisibleTo attributes for Neo core and DBFT plugin
- Updated test constructors to use current dev branch API:
  - Fixed NeoSystem constructor (2-parameter instead of 6-parameter)
  - Fixed Settings constructor to use IConfigurationSection
  - Added Microsoft.Extensions.Configuration packages
- Created TestBlockchain.CreateDefaultSettings() helper method
- Updated all test files to use compatible API calls
- All 1,401 tests passing including 34 DBFT plugin tests
- Code formatted with dotnet format

* Add comprehensive DBFT consensus message flow tests

- Implement proper consensus message flow monitoring as requested in GitHub comment
- Add UT_DBFT_ProperMessageFlow.cs with professional, working tests
- Update ConsensusTestHelper with async methods for natural message flow
- Clean up comments and code formatting with dotnet format
- All 38 DBFT plugin tests passing

Tests now properly:
- Send PrepareRequest and wait for natural PrepareResponse
- Monitor actual consensus message flow instead of forcing it
- Handle message validation, service resilience, and lifecycle testing
- Use simplified but effective message capture mechanism

* Update src/Plugins/DBFTPlugin/DBFTPlugin.csproj

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update src/Plugins/DBFTPlugin/DBFTPlugin.csproj

* refactor: Enhance DBFT consensus unit tests to professional standards - Consistent UT_xxx naming convention for all test files - Mock* pattern for all helper/utility classes - Enhanced assertions (7→19, +171% improvement) - Removed duplicate test methods (~140 lines eliminated) - Professional documentation aligned with implementation - Fixed project file syntax (InternalsVisibleTo) - 100% test pass rate maintained (34/34 tests) - Ready for production deployment

* Convert DBFT unit tests from xUnit to MSTest framework

- Remove xUnit package references (xunit, xunit.runner.visualstudio, Akka.TestKit.Xunit2)
- Add Akka.TestKit.MsTest package reference
- Update all test files to use MSTest TestKit instead of xUnit
- Fix test runner configuration to resolve "Zero tests ran" issue
- All 34 tests now pass successfully with MSTest framework
- Maintain existing test structure and TestKit inheritance

* Update DBFT unit tests README for MSTest framework

- Document MSTest framework usage instead of xUnit
- Update prerequisites to include MSTest and Akka.NET TestKit (MSTest version)
- Add note about Visual Studio Test Explorer integration
- Update performance timing to reflect current test execution (~33s)
- Emphasize production-ready testing capabilities

* Fix copyright header filenames in DBFT tests

- Correct UT_DBFT_Performance.cs header (was UT_DBFT_Robustness.cs)
- Correct UT_DBFT_Failures.cs header (was UT_DBFT_AbnormalScenarios.cs)
- Fix other copyright headers to match actual filenames
- Applied via dotnet format to ensure consistency

* Update tests/Neo.Plugins.DBFTPlugin.Tests/Neo.Plugins.DBFTPlugin.Tests.csproj

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_Core.cs

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_MessageFlow.cs

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_MessageFlow.cs

* Add coverage

---------

Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: Jimmy <[email protected]>

* Style: move MPT Benchamrk Project to benchmarks/ (#4011)

* [`improve`] nullable app logs (#4008)

* nullable app logs

* Update src/Plugins/ApplicationLogs/LogReader.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

* Apply suggestions from code review

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update src/Plugins/ApplicationLogs/Settings.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

---------

Co-authored-by: Christopher Schuchardt <[email protected]>

* Fix: remove FluentAssertions in notary tests (#4014)

* Add: SignClient Vsock support (#4002)

* Add: SignClient vsock support

* optimize: add const string

* optimize: use Uri parse endpoint

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>

* Comments: add Exception info for numeric ops (#4021)

* Fixes

* Ran `dotnet format`

* init project

* Changed method to static for lamda

* changed variable name

* Fixed extensions and add helper classes

* Switched to using Indexer

* Add executescript

* Added more tests

* Fixes and removal of used code

* Fix `using` statement

* Fixed tests

* Add snapshot storage events

* added `RandomNumberFactory`

* fixes

* Fixed breakpoints

* fixed bug with breakpoints

* fixed tests

* some name changes

* Fixed `IEquatable` for `Breakpoint`

* Added back `RandomNumberFactory` (core version)

---------

Co-authored-by: Christopher R. Schuchardt <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: Alvaro <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Vitor Nazário Coelho <[email protected]>
Co-authored-by: Jimmy <[email protected]>
cschuchardt88 added a commit to cschuchardt88/neo that referenced this pull request Sep 16, 2025
* Fix: P/Invokes should not be visible (neo-project#4003)

* [Optimization] - Optimize key method (neo-project#4001)

* [Optimization] - Optimize Key method

* Update src/Neo.Cryptography.MPTTrie/Cache.cs

---------

Co-authored-by: Shargon <[email protected]>

* Fix Threading hanging with `NeoSystem` (neo-project#4005)

* Fix threading hanging with `NeoSystem`

* Fixed for deadlocks

---------

Co-authored-by: Christopher R. Schuchardt <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Style: unify json init style (neo-project#4004)

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>

* Update packages (neo-project#4006)

* Update packages

* more

* clean

---------

Co-authored-by: Jimmy <[email protected]>

* Restore DBFTPlugin Unit Tests (ConsensusService and Consensus Context) (neo-project#3473)

* Initial comit

* Fix paths

* Added `Neo.Plugins.DBFTPlugin.Tests` to `Neo` internals

* Added tests to github workflow

* Akka deps

* Advancing

* TestWallet is mocked

* Adding more steps

* Fixed Test mocking

* Timestamp testing

* Header and TestProbe

* format

* Huge advance! Test probe is now working. Now we go

* dotnet format

* Header looks like to be correct now

* Workaround for dbft settings

* build the mock system for solenode

* update to 7 nodes network mock system

* Comment original tests of the PR

* [`ut`] 100% Coverage Trie.Get (neo-project#3952)

* 100% Coverage Trie.Get

* fix ut

* feat: Add comprehensive DBFT consensus unit tests

- Add 34 comprehensive unit tests covering all DBFT scenarios
- Test normal consensus flows, abnormal scenarios, and recovery mechanisms
- Include Byzantine fault tolerance testing (f=1 and f=2 failures)
- Add network partition and message loss simulation
- Implement stress testing with multiple rounds and large transaction sets
- Create professional test infrastructure with TestWallet and ConsensusTestHelper
- Add comprehensive README documentation
- Ensure 100% test pass rate with robust error handling
- Cover complete DBFT protocol: PrepareRequest → PrepareResponse → Commit flow
- Validate view changes, recovery requests, and state synchronization

Test Coverage:
- UT_ConsensusService.cs (7 tests): Service lifecycle and message handling
- UT_DBFT.cs (6 tests): Basic consensus scenarios
- UT_DBFT_Integration.cs (4 tests): Integration scenarios
- UT_DBFT_NormalFlow.cs (3 tests): Complete normal consensus flows
- UT_DBFT_AbnormalScenarios.cs (4 tests): Failure and attack scenarios
- UT_DBFT_Recovery.cs (6 tests): Recovery mechanisms
- UT_DBFT_Robustness.cs (4 tests): Stress and edge case testing

All tests pass: 34/34 ✅

* chore: Update .NET SDK version to 9.0.203

- Update global.json to use .NET SDK 9.0.203 (from 9.0.102)
- Ensures compatibility with latest .NET 9 features and fixes

* fix: Revert .NET SDK version to 9.0.102

- Revert global.json to use .NET SDK 9.0.102 (available on build system)
- Ensures compatibility with current development environment
- Previous version 9.0.203 was not available on the build system

* style: Update copyright year to 2025

- Run dotnet format to apply code formatting standards
- Update copyright year in RecoveryMessageExtensions.cs from 2024 to 2025
- Maintain consistent code formatting across the project

* chore: Update .NET SDK version to 9.0.300

- Update global.json to use .NET SDK 9.0.300 (from 9.0.102)
- Ensures compatibility with latest .NET 9 features and improvements
- Maintains project build consistency with updated SDK

* fix: Resolve RpcServer test compilation errors

- Add Neo.IO using statement for ToHexString extension method
- Comment out problematic ToHexString calls in test setup
- Ensure RpcServer tests can compile alongside DBFT tests
- Maintain DBFT test functionality (34/34 tests passing)

* fix: Complete RpcServer test compilation fix

- Ensure all ToHexString extension method issues are resolved
- Maintain compatibility with DBFT tests (34/34 passing)
- Fix build errors in RpcServer test suite

* Revert changes except DBFT plugin tests

- Reverted all source files to match dev branch
- Reverted test files in Neo.UnitTests and Neo.Plugins.RpcServer.Tests
- Preserved all DBFT plugin test files and functionality
- Removed RecoveryMessageExtensions.cs (not in dev branch)

* Fix DBFT plugin tests API compatibility and accessibility

- Made ConsensusService class internal for test accessibility
- Added InternalsVisibleTo attributes for Neo core and DBFT plugin
- Updated test constructors to use current dev branch API:
  - Fixed NeoSystem constructor (2-parameter instead of 6-parameter)
  - Fixed Settings constructor to use IConfigurationSection
  - Added Microsoft.Extensions.Configuration packages
- Created TestBlockchain.CreateDefaultSettings() helper method
- Updated all test files to use compatible API calls
- All 1,401 tests passing including 34 DBFT plugin tests
- Code formatted with dotnet format

* Add comprehensive DBFT consensus message flow tests

- Implement proper consensus message flow monitoring as requested in GitHub comment
- Add UT_DBFT_ProperMessageFlow.cs with professional, working tests
- Update ConsensusTestHelper with async methods for natural message flow
- Clean up comments and code formatting with dotnet format
- All 38 DBFT plugin tests passing

Tests now properly:
- Send PrepareRequest and wait for natural PrepareResponse
- Monitor actual consensus message flow instead of forcing it
- Handle message validation, service resilience, and lifecycle testing
- Use simplified but effective message capture mechanism

* Update src/Plugins/DBFTPlugin/DBFTPlugin.csproj

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update src/Plugins/DBFTPlugin/DBFTPlugin.csproj

* refactor: Enhance DBFT consensus unit tests to professional standards - Consistent UT_xxx naming convention for all test files - Mock* pattern for all helper/utility classes - Enhanced assertions (7→19, +171% improvement) - Removed duplicate test methods (~140 lines eliminated) - Professional documentation aligned with implementation - Fixed project file syntax (InternalsVisibleTo) - 100% test pass rate maintained (34/34 tests) - Ready for production deployment

* Convert DBFT unit tests from xUnit to MSTest framework

- Remove xUnit package references (xunit, xunit.runner.visualstudio, Akka.TestKit.Xunit2)
- Add Akka.TestKit.MsTest package reference
- Update all test files to use MSTest TestKit instead of xUnit
- Fix test runner configuration to resolve "Zero tests ran" issue
- All 34 tests now pass successfully with MSTest framework
- Maintain existing test structure and TestKit inheritance

* Update DBFT unit tests README for MSTest framework

- Document MSTest framework usage instead of xUnit
- Update prerequisites to include MSTest and Akka.NET TestKit (MSTest version)
- Add note about Visual Studio Test Explorer integration
- Update performance timing to reflect current test execution (~33s)
- Emphasize production-ready testing capabilities

* Fix copyright header filenames in DBFT tests

- Correct UT_DBFT_Performance.cs header (was UT_DBFT_Robustness.cs)
- Correct UT_DBFT_Failures.cs header (was UT_DBFT_AbnormalScenarios.cs)
- Fix other copyright headers to match actual filenames
- Applied via dotnet format to ensure consistency

* Update tests/Neo.Plugins.DBFTPlugin.Tests/Neo.Plugins.DBFTPlugin.Tests.csproj

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_Core.cs

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_MessageFlow.cs

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_MessageFlow.cs

* Add coverage

---------

Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: Jimmy <[email protected]>

* Style: move MPT Benchamrk Project to benchmarks/ (neo-project#4011)

* [`improve`] nullable app logs (neo-project#4008)

* nullable app logs

* Update src/Plugins/ApplicationLogs/LogReader.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

* Apply suggestions from code review

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update src/Plugins/ApplicationLogs/Settings.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

---------

Co-authored-by: Christopher Schuchardt <[email protected]>

* Fix: remove FluentAssertions in notary tests (neo-project#4014)

* Add: SignClient Vsock support (neo-project#4002)

* Add: SignClient vsock support

* optimize: add const string

* optimize: use Uri parse endpoint

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>

* Comments: add Exception info for numeric ops (neo-project#4021)

---------

Co-authored-by: Will <[email protected]>
Co-authored-by: Alvaro <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher R. Schuchardt <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Vitor Nazário Coelho <[email protected]>
Co-authored-by: Jimmy <[email protected]>
cschuchardt88 added a commit to cschuchardt88/neo that referenced this pull request Sep 16, 2025
* Fix: P/Invokes should not be visible (neo-project#4003)

* [Optimization] - Optimize key method (neo-project#4001)

* [Optimization] - Optimize Key method

* Update src/Neo.Cryptography.MPTTrie/Cache.cs

---------

Co-authored-by: Shargon <[email protected]>

* Fix Threading hanging with `NeoSystem` (neo-project#4005)

* Fix threading hanging with `NeoSystem`

* Fixed for deadlocks

---------

Co-authored-by: Christopher R. Schuchardt <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Style: unify json init style (neo-project#4004)

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>

* Update packages (neo-project#4006)

* Update packages

* more

* clean

---------

Co-authored-by: Jimmy <[email protected]>

* Restore DBFTPlugin Unit Tests (ConsensusService and Consensus Context) (neo-project#3473)

* Initial comit

* Fix paths

* Added `Neo.Plugins.DBFTPlugin.Tests` to `Neo` internals

* Added tests to github workflow

* Akka deps

* Advancing

* TestWallet is mocked

* Adding more steps

* Fixed Test mocking

* Timestamp testing

* Header and TestProbe

* format

* Huge advance! Test probe is now working. Now we go

* dotnet format

* Header looks like to be correct now

* Workaround for dbft settings

* build the mock system for solenode

* update to 7 nodes network mock system

* Comment original tests of the PR

* [`ut`] 100% Coverage Trie.Get (neo-project#3952)

* 100% Coverage Trie.Get

* fix ut

* feat: Add comprehensive DBFT consensus unit tests

- Add 34 comprehensive unit tests covering all DBFT scenarios
- Test normal consensus flows, abnormal scenarios, and recovery mechanisms
- Include Byzantine fault tolerance testing (f=1 and f=2 failures)
- Add network partition and message loss simulation
- Implement stress testing with multiple rounds and large transaction sets
- Create professional test infrastructure with TestWallet and ConsensusTestHelper
- Add comprehensive README documentation
- Ensure 100% test pass rate with robust error handling
- Cover complete DBFT protocol: PrepareRequest → PrepareResponse → Commit flow
- Validate view changes, recovery requests, and state synchronization

Test Coverage:
- UT_ConsensusService.cs (7 tests): Service lifecycle and message handling
- UT_DBFT.cs (6 tests): Basic consensus scenarios
- UT_DBFT_Integration.cs (4 tests): Integration scenarios
- UT_DBFT_NormalFlow.cs (3 tests): Complete normal consensus flows
- UT_DBFT_AbnormalScenarios.cs (4 tests): Failure and attack scenarios
- UT_DBFT_Recovery.cs (6 tests): Recovery mechanisms
- UT_DBFT_Robustness.cs (4 tests): Stress and edge case testing

All tests pass: 34/34 ✅

* chore: Update .NET SDK version to 9.0.203

- Update global.json to use .NET SDK 9.0.203 (from 9.0.102)
- Ensures compatibility with latest .NET 9 features and fixes

* fix: Revert .NET SDK version to 9.0.102

- Revert global.json to use .NET SDK 9.0.102 (available on build system)
- Ensures compatibility with current development environment
- Previous version 9.0.203 was not available on the build system

* style: Update copyright year to 2025

- Run dotnet format to apply code formatting standards
- Update copyright year in RecoveryMessageExtensions.cs from 2024 to 2025
- Maintain consistent code formatting across the project

* chore: Update .NET SDK version to 9.0.300

- Update global.json to use .NET SDK 9.0.300 (from 9.0.102)
- Ensures compatibility with latest .NET 9 features and improvements
- Maintains project build consistency with updated SDK

* fix: Resolve RpcServer test compilation errors

- Add Neo.IO using statement for ToHexString extension method
- Comment out problematic ToHexString calls in test setup
- Ensure RpcServer tests can compile alongside DBFT tests
- Maintain DBFT test functionality (34/34 tests passing)

* fix: Complete RpcServer test compilation fix

- Ensure all ToHexString extension method issues are resolved
- Maintain compatibility with DBFT tests (34/34 passing)
- Fix build errors in RpcServer test suite

* Revert changes except DBFT plugin tests

- Reverted all source files to match dev branch
- Reverted test files in Neo.UnitTests and Neo.Plugins.RpcServer.Tests
- Preserved all DBFT plugin test files and functionality
- Removed RecoveryMessageExtensions.cs (not in dev branch)

* Fix DBFT plugin tests API compatibility and accessibility

- Made ConsensusService class internal for test accessibility
- Added InternalsVisibleTo attributes for Neo core and DBFT plugin
- Updated test constructors to use current dev branch API:
  - Fixed NeoSystem constructor (2-parameter instead of 6-parameter)
  - Fixed Settings constructor to use IConfigurationSection
  - Added Microsoft.Extensions.Configuration packages
- Created TestBlockchain.CreateDefaultSettings() helper method
- Updated all test files to use compatible API calls
- All 1,401 tests passing including 34 DBFT plugin tests
- Code formatted with dotnet format

* Add comprehensive DBFT consensus message flow tests

- Implement proper consensus message flow monitoring as requested in GitHub comment
- Add UT_DBFT_ProperMessageFlow.cs with professional, working tests
- Update ConsensusTestHelper with async methods for natural message flow
- Clean up comments and code formatting with dotnet format
- All 38 DBFT plugin tests passing

Tests now properly:
- Send PrepareRequest and wait for natural PrepareResponse
- Monitor actual consensus message flow instead of forcing it
- Handle message validation, service resilience, and lifecycle testing
- Use simplified but effective message capture mechanism

* Update src/Plugins/DBFTPlugin/DBFTPlugin.csproj

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update src/Plugins/DBFTPlugin/DBFTPlugin.csproj

* refactor: Enhance DBFT consensus unit tests to professional standards - Consistent UT_xxx naming convention for all test files - Mock* pattern for all helper/utility classes - Enhanced assertions (7→19, +171% improvement) - Removed duplicate test methods (~140 lines eliminated) - Professional documentation aligned with implementation - Fixed project file syntax (InternalsVisibleTo) - 100% test pass rate maintained (34/34 tests) - Ready for production deployment

* Convert DBFT unit tests from xUnit to MSTest framework

- Remove xUnit package references (xunit, xunit.runner.visualstudio, Akka.TestKit.Xunit2)
- Add Akka.TestKit.MsTest package reference
- Update all test files to use MSTest TestKit instead of xUnit
- Fix test runner configuration to resolve "Zero tests ran" issue
- All 34 tests now pass successfully with MSTest framework
- Maintain existing test structure and TestKit inheritance

* Update DBFT unit tests README for MSTest framework

- Document MSTest framework usage instead of xUnit
- Update prerequisites to include MSTest and Akka.NET TestKit (MSTest version)
- Add note about Visual Studio Test Explorer integration
- Update performance timing to reflect current test execution (~33s)
- Emphasize production-ready testing capabilities

* Fix copyright header filenames in DBFT tests

- Correct UT_DBFT_Performance.cs header (was UT_DBFT_Robustness.cs)
- Correct UT_DBFT_Failures.cs header (was UT_DBFT_AbnormalScenarios.cs)
- Fix other copyright headers to match actual filenames
- Applied via dotnet format to ensure consistency

* Update tests/Neo.Plugins.DBFTPlugin.Tests/Neo.Plugins.DBFTPlugin.Tests.csproj

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_Core.cs

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_MessageFlow.cs

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_MessageFlow.cs

* Add coverage

---------

Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: Jimmy <[email protected]>

* Style: move MPT Benchamrk Project to benchmarks/ (neo-project#4011)

* [`improve`] nullable app logs (neo-project#4008)

* nullable app logs

* Update src/Plugins/ApplicationLogs/LogReader.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

* Apply suggestions from code review

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update src/Plugins/ApplicationLogs/Settings.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

---------

Co-authored-by: Christopher Schuchardt <[email protected]>

* Fix: remove FluentAssertions in notary tests (neo-project#4014)

* Add: SignClient Vsock support (neo-project#4002)

* Add: SignClient vsock support

* optimize: add const string

* optimize: use Uri parse endpoint

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>

* Comments: add Exception info for numeric ops (neo-project#4021)

* Isolate ApplicationEngine events (neo-project#4016)

* Isolate Log Event

* Isolate instance events

* clean

* Update src/Neo/SmartContract/ApplicationEngine.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

* Apply suggestions from code review

Co-authored-by: Christopher Schuchardt <[email protected]>

* Fix compile

* udate format

* Unify names

---------

Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: jimmy <[email protected]>

* Cache nuget packages (neo-project#4034)

* Cache nuget packages

* move

* Update main.yml

* Update main.yml

* Style: more standard code style for Neo.VM (neo-project#4022)

Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: Shargon <[email protected]>

* Optimize: more semantics description and better impl for 'TestBit(this BigInteger value, int index)' (neo-project#4031)

Co-authored-by: Shargon <[email protected]>

* Improve exception messages throughout Neo codebase (neo-project#4032)

* Improve exception messages throughout Neo codebase

- Standardize exception message format for consistency
- Make messages more descriptive and professional
- Remove oversimplified and verbose exception messages
- Improve developer experience with clearer error context
- Apply consistent patterns for similar validation types
- Update messages across CLI, Smart Contracts, Cryptography, VM, and other modules

This change improves the quality of error reporting while maintaining
technical accuracy and providing better debugging information.

* Remove PR description file

* Improve exception messages in ECPoint.cs - only message content updated, no code logic changes

* format

* Fix UPnP unit test to expect InvalidOperationException

- Updated UT_UPnP.cs test to expect InvalidOperationException instead of Exception
- This aligns with the improved exception handling implemented in UPnP.cs
- Fixes test failure caused by more specific exception types
- All 1511 tests now pass successfully

* Update src/Neo.VM/Types/Integer.cs

---------

Co-authored-by: Shargon <[email protected]>

* Optimize: impl `GetLowestSetBit` by `TrailingZeroCount` if available (neo-project#4030)

* Optimize: impl GetLowestSetBit by TrailingZeroCount if available

* Update src/Neo.Extensions/BigIntegerExtensions.cs

---------

Co-authored-by: Shargon <[email protected]>

* [`style`] Style neo system (neo-project#4040)

* Style

* Update .editorconfig

Co-authored-by: Christopher Schuchardt <[email protected]>

* renames

---------

Co-authored-by: Christopher Schuchardt <[email protected]>

* Refactor MainService.Vote class (neo-project#4036)

* Refactor code and improve styles

* Update src/Neo.CLI/CLI/MainService.Vote.cs

Co-authored-by: Will <[email protected]>

* Apply dotnet format to fix whitespace formatting

- Remove trailing space after method signature
- Ensure proper alignment of expression-bodied member
- Comply with project .editorconfig standards

* Update src/Neo.CLI/CLI/MainService.Vote.cs

* Fix: add null arg to BuildNeoScript from UnVote. Rename BuildNativeScript to BuildNeoScript

---------

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>

* Doc: add document for plugin SignClient (neo-project#4049)

* Doc: add document for plugin SignClient

* Update docs/plugin-secure-sign-guide.md

Co-authored-by: Shargon <[email protected]>

* Update docs/plugin-secure-sign-guide.md

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update docs/plugin-secure-sign-guide.md

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update docs/plugin-secure-sign-guide.md

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update docs/plugin-secure-sign-guide.md

Co-authored-by: Christopher Schuchardt <[email protected]>

* Fix typo

* Remove unnecessary words

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>

* [`Fix`] RcpClient Directories and Naming (neo-project#4046)

Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Will <[email protected]>

* Optimize: no secaped char for command line input (neo-project#4044)

Co-authored-by: NGD Admin <[email protected]>

* Fix: tx.ToJson no 'cosigners' field (neo-project#4051)

* Fix: tx.ToJson no 'cosigners' field

* Rename methods

---------

Co-authored-by: Shargon <[email protected]>

* Fix: not matched error code if argument is null with RpcMethodWithParams (neo-project#4052)

Co-authored-by: Shargon <[email protected]>

* Renamed and Fix Properties with plugins (neo-project#4062)

* Renamed and Fix Properties with plugins

* Update src/Plugins/SignClient/SignSettings.cs

* Format

* Rename @shargon `ServerSettings` to RpcServersSettings`

* Added @shargon suggestion for `DbftSettings`

---------

Co-authored-by: Shargon <[email protected]>

* [`Add`] Indexer to EvaluationStack (neo-project#4050)

* [`Add`] Indexer to EvaluationStack

* Added indexer tests

* Added more tests

* Touch ups

* Use indexer instead

* use indexer instead

* Increase checks

* Update EvaluationStack.cs

* fixed @shargon broken code

* Added extra test for bigger value than length of `innerList`

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Comments: Add detail description for RPC Method (neo-project#4054)

* [`Add`] `TryCatch` & `TryCatchThrow` Extensions (neo-project#4038)

* [`Add`] `TryCatch` & `TryCatchThrow` Extensions

* fixes

* Add `TryCatch` to `Peers`

---------

Co-authored-by: Will <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Add: input cli command line with `--argument-name argument-value` (neo-project#4047)

* Add: input cli command line with --argument-name argument-value

* update help output

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Optimize: more detail for help command (neo-project#4067)

* Optimize: clearer parser for parameter Signers and Witnesses, and fix comments (neo-project#4066)

* [`Fix`] Async Ask Method (neo-project#4071)

Co-authored-by: Shargon <[email protected]>

* Move `install sc` out of `ConsoleServiceBase.Run` (neo-project#4048)

* Optimzie: install with sc.exe

* Update src/Neo.ConsoleService/ConsoleServiceBase.cs

Co-authored-by: Shargon <[email protected]>

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* [`Add`] `RandomNumberFactory` Class (neo-project#3987)

* Updated `RandomExtensions.NextBigIneger` to use `RandomNumberGenerator`

* Added `RandomNumberFactory` class to generate random numbers.

* changed namespace

* Fixed bugs

* fixed more bugs

* Fixed up tests and add more

* Update src/Neo.Extensions/Factories/RandomNumberFactory.cs

Co-authored-by: Shargon <[email protected]>

* Fixed per @shargon feedback

* Bug fix per @vncoelho

* Added more tests

* Bug Fix

* Fixed bugs in `NextBigInteger` unit tests

* Updated `RandomExtensions.NextBigIneger` to use `RandomNumberGenerator`

* Added `RandomNumberFactory` class to generate random numbers.

* changed namespace

* Fixed bugs

* fixed more bugs

* Fixed up tests and add more

* Fixed per @shargon feedback

* Update src/Neo.Extensions/Factories/RandomNumberFactory.cs

Co-authored-by: Shargon <[email protected]>

* Bug fix per @vncoelho

* Added more tests

* Bug Fix

* Fixed bugs in `NextBigInteger` unit tests

* Added more tests and add `NexrBigInteger` minmax

* Bug fixes

* `BigInteger` now uses negative numbers.

* Fixes to `NextBigInteger`

* Fixed `BigNextInteger(MaxValue)` to calulate correctly.

* Added @vncoelho suggestions

* Fixed `NextInteger` for faster resolve.

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: Vitor Nazário Coelho <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* [UT] - Add unit tests in NeoSystem (neo-project#3978)

* [UT] - Add unit tests in NeoSystem

* Fix: Isolate global state in UT_RoleManagement ResetStore in snapshot

* Fix: Removing CloneCache to isolate state per role

* Fix: Isolating state

* Fix: Isolate global state and filter Designation notifications due to shared ApplicationEngine.Notify handler

* Fix: Remove console.writeline

---------

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Fixed solutiuon file

* Fixed `neo-build.dev` branch for the changes in `dev`

---------

Co-authored-by: Will <[email protected]>
Co-authored-by: Alvaro <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher R. Schuchardt <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Vitor Nazário Coelho <[email protected]>
Co-authored-by: Jimmy <[email protected]>
cschuchardt88 added a commit to cschuchardt88/neo that referenced this pull request Sep 16, 2025
* Added `neo-build` new branch

* Add debug sink

* Add more debug logging and fixes

* Added Provider

* Fixes to ApplicationEngine Threading

* Fix: P/Invokes should not be visible (neo-project#4003)

* [Optimization] - Optimize key method (neo-project#4001)

* [Optimization] - Optimize Key method

* Update src/Neo.Cryptography.MPTTrie/Cache.cs

---------

Co-authored-by: Shargon <[email protected]>

* Fix Threading hanging with `NeoSystem` (neo-project#4005)

* Fix threading hanging with `NeoSystem`

* Fixed for deadlocks

---------

Co-authored-by: Christopher R. Schuchardt <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Style: unify json init style (neo-project#4004)

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>

* Update packages (neo-project#4006)

* Update packages

* more

* clean

---------

Co-authored-by: Jimmy <[email protected]>

* Restore DBFTPlugin Unit Tests (ConsensusService and Consensus Context) (neo-project#3473)

* Initial comit

* Fix paths

* Added `Neo.Plugins.DBFTPlugin.Tests` to `Neo` internals

* Added tests to github workflow

* Akka deps

* Advancing

* TestWallet is mocked

* Adding more steps

* Fixed Test mocking

* Timestamp testing

* Header and TestProbe

* format

* Huge advance! Test probe is now working. Now we go

* dotnet format

* Header looks like to be correct now

* Workaround for dbft settings

* build the mock system for solenode

* update to 7 nodes network mock system

* Comment original tests of the PR

* [`ut`] 100% Coverage Trie.Get (neo-project#3952)

* 100% Coverage Trie.Get

* fix ut

* feat: Add comprehensive DBFT consensus unit tests

- Add 34 comprehensive unit tests covering all DBFT scenarios
- Test normal consensus flows, abnormal scenarios, and recovery mechanisms
- Include Byzantine fault tolerance testing (f=1 and f=2 failures)
- Add network partition and message loss simulation
- Implement stress testing with multiple rounds and large transaction sets
- Create professional test infrastructure with TestWallet and ConsensusTestHelper
- Add comprehensive README documentation
- Ensure 100% test pass rate with robust error handling
- Cover complete DBFT protocol: PrepareRequest → PrepareResponse → Commit flow
- Validate view changes, recovery requests, and state synchronization

Test Coverage:
- UT_ConsensusService.cs (7 tests): Service lifecycle and message handling
- UT_DBFT.cs (6 tests): Basic consensus scenarios
- UT_DBFT_Integration.cs (4 tests): Integration scenarios
- UT_DBFT_NormalFlow.cs (3 tests): Complete normal consensus flows
- UT_DBFT_AbnormalScenarios.cs (4 tests): Failure and attack scenarios
- UT_DBFT_Recovery.cs (6 tests): Recovery mechanisms
- UT_DBFT_Robustness.cs (4 tests): Stress and edge case testing

All tests pass: 34/34 ✅

* chore: Update .NET SDK version to 9.0.203

- Update global.json to use .NET SDK 9.0.203 (from 9.0.102)
- Ensures compatibility with latest .NET 9 features and fixes

* fix: Revert .NET SDK version to 9.0.102

- Revert global.json to use .NET SDK 9.0.102 (available on build system)
- Ensures compatibility with current development environment
- Previous version 9.0.203 was not available on the build system

* style: Update copyright year to 2025

- Run dotnet format to apply code formatting standards
- Update copyright year in RecoveryMessageExtensions.cs from 2024 to 2025
- Maintain consistent code formatting across the project

* chore: Update .NET SDK version to 9.0.300

- Update global.json to use .NET SDK 9.0.300 (from 9.0.102)
- Ensures compatibility with latest .NET 9 features and improvements
- Maintains project build consistency with updated SDK

* fix: Resolve RpcServer test compilation errors

- Add Neo.IO using statement for ToHexString extension method
- Comment out problematic ToHexString calls in test setup
- Ensure RpcServer tests can compile alongside DBFT tests
- Maintain DBFT test functionality (34/34 tests passing)

* fix: Complete RpcServer test compilation fix

- Ensure all ToHexString extension method issues are resolved
- Maintain compatibility with DBFT tests (34/34 passing)
- Fix build errors in RpcServer test suite

* Revert changes except DBFT plugin tests

- Reverted all source files to match dev branch
- Reverted test files in Neo.UnitTests and Neo.Plugins.RpcServer.Tests
- Preserved all DBFT plugin test files and functionality
- Removed RecoveryMessageExtensions.cs (not in dev branch)

* Fix DBFT plugin tests API compatibility and accessibility

- Made ConsensusService class internal for test accessibility
- Added InternalsVisibleTo attributes for Neo core and DBFT plugin
- Updated test constructors to use current dev branch API:
  - Fixed NeoSystem constructor (2-parameter instead of 6-parameter)
  - Fixed Settings constructor to use IConfigurationSection
  - Added Microsoft.Extensions.Configuration packages
- Created TestBlockchain.CreateDefaultSettings() helper method
- Updated all test files to use compatible API calls
- All 1,401 tests passing including 34 DBFT plugin tests
- Code formatted with dotnet format

* Add comprehensive DBFT consensus message flow tests

- Implement proper consensus message flow monitoring as requested in GitHub comment
- Add UT_DBFT_ProperMessageFlow.cs with professional, working tests
- Update ConsensusTestHelper with async methods for natural message flow
- Clean up comments and code formatting with dotnet format
- All 38 DBFT plugin tests passing

Tests now properly:
- Send PrepareRequest and wait for natural PrepareResponse
- Monitor actual consensus message flow instead of forcing it
- Handle message validation, service resilience, and lifecycle testing
- Use simplified but effective message capture mechanism

* Update src/Plugins/DBFTPlugin/DBFTPlugin.csproj

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update src/Plugins/DBFTPlugin/DBFTPlugin.csproj

* refactor: Enhance DBFT consensus unit tests to professional standards - Consistent UT_xxx naming convention for all test files - Mock* pattern for all helper/utility classes - Enhanced assertions (7→19, +171% improvement) - Removed duplicate test methods (~140 lines eliminated) - Professional documentation aligned with implementation - Fixed project file syntax (InternalsVisibleTo) - 100% test pass rate maintained (34/34 tests) - Ready for production deployment

* Convert DBFT unit tests from xUnit to MSTest framework

- Remove xUnit package references (xunit, xunit.runner.visualstudio, Akka.TestKit.Xunit2)
- Add Akka.TestKit.MsTest package reference
- Update all test files to use MSTest TestKit instead of xUnit
- Fix test runner configuration to resolve "Zero tests ran" issue
- All 34 tests now pass successfully with MSTest framework
- Maintain existing test structure and TestKit inheritance

* Update DBFT unit tests README for MSTest framework

- Document MSTest framework usage instead of xUnit
- Update prerequisites to include MSTest and Akka.NET TestKit (MSTest version)
- Add note about Visual Studio Test Explorer integration
- Update performance timing to reflect current test execution (~33s)
- Emphasize production-ready testing capabilities

* Fix copyright header filenames in DBFT tests

- Correct UT_DBFT_Performance.cs header (was UT_DBFT_Robustness.cs)
- Correct UT_DBFT_Failures.cs header (was UT_DBFT_AbnormalScenarios.cs)
- Fix other copyright headers to match actual filenames
- Applied via dotnet format to ensure consistency

* Update tests/Neo.Plugins.DBFTPlugin.Tests/Neo.Plugins.DBFTPlugin.Tests.csproj

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_Core.cs

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_MessageFlow.cs

* Update tests/Neo.Plugins.DBFTPlugin.Tests/UT_DBFT_MessageFlow.cs

* Add coverage

---------

Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: Jimmy <[email protected]>

* Style: move MPT Benchamrk Project to benchmarks/ (neo-project#4011)

* [`improve`] nullable app logs (neo-project#4008)

* nullable app logs

* Update src/Plugins/ApplicationLogs/LogReader.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

* Apply suggestions from code review

Co-authored-by: Christopher Schuchardt <[email protected]>

* Update src/Plugins/ApplicationLogs/Settings.cs

Co-authored-by: Christopher Schuchardt <[email protected]>

---------

Co-authored-by: Christopher Schuchardt <[email protected]>

* Fix: remove FluentAssertions in notary tests (neo-project#4014)

* Add: SignClient Vsock support (neo-project#4002)

* Add: SignClient vsock support

* optimize: add const string

* optimize: use Uri parse endpoint

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>

* Comments: add Exception info for numeric ops (neo-project#4021)

* Fixes

* Ran `dotnet format`

* init project

* Changed method to static for lamda

* changed variable name

* Fixed extensions and add helper classes

* Switched to using Indexer

* Add executescript

* Added more tests

* Fixes and removal of used code

* Fix `using` statement

* Fixed tests

* Add snapshot storage events

* added `RandomNumberFactory`

* fixes

* Fixed breakpoints

* fixed bug with breakpoints

* fixed tests

* some name changes

* Fixed `IEquatable` for `Breakpoint`

* Added back `RandomNumberFactory` (core version)

---------

Co-authored-by: Christopher R. Schuchardt <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: Alvaro <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Vitor Nazário Coelho <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Easy-to-Review a simple edit; just a few lines Ready to Merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants