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

Fix: specify log exception. #3089

Merged
merged 9 commits into from
Feb 2, 2024
Merged

Conversation

Jim8y
Copy link
Contributor

@Jim8y Jim8y commented Jan 13, 2024

Description

The RuntimeLog interface failed to speficy the exception message, though it takes arbitrary byte array as parameter, it only accept UTF8 sequence.

Fixes # (issue) #3088

Type of change

  • 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?

  • Test TestInvalidUtf8LogMessage()

Test Configuration:
Run TestInvalidUtf8LogMessage in UT_ApplicationEngine.Runtime.cs

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

}
catch
{
throw new ArgumentException("Failed to convert byte array to string: Invalid or non-printable UTF-8 sequence detected.", nameof(state));
Copy link
Member

Choose a reason for hiding this comment

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

Add the failed data in hex?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure, cause user passes in bytes, if you show them hex, does that help at all?

Copy link
Member

Choose a reason for hiding this comment

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

It's the message, both options are good for me

Jim8y added 4 commits January 13, 2024 19:10
…to specify-log-exception

* 'specify-log-exception' of github.com:Liaojinghui/neo:
  Update: list all existing pligins when checking plugin list, not just installed (neo-project#3080)
@Jim8y Jim8y mentioned this pull request Jan 13, 2024
12 tasks
@Jim8y
Copy link
Contributor Author

Jim8y commented Jan 17, 2024

@shargon

@@ -458,6 +458,7 @@ public virtual VerifyResult VerifyStateIndependent(ProtocolSettings settings)

public StackItem ToStackItem(ReferenceCounter referenceCounter)
{
if (_signers == null || _signers.Length == 0) throw new ArgumentException("Sender is not specified in the transaction.");
Copy link
Member

Choose a reason for hiding this comment

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

Will this change fork something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it will still fault. Originally it fault, now it still fault, but fault with different exception, a more reasonable exception message.

@Jim8y
Copy link
Contributor Author

Jim8y commented Feb 2, 2024

@shargon

@shargon shargon merged commit 92d487c into neo-project:master Feb 2, 2024
1 of 2 checks passed
@Jim8y Jim8y deleted the specify-log-exception branch February 3, 2024 00:09
@roman-khimov roman-khimov added this to the v3.7.0 milestone Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants