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

t8n input processing #7690

Merged
merged 9 commits into from
Oct 31, 2024
Merged

t8n input processing #7690

merged 9 commits into from
Oct 31, 2024

Conversation

yerke26
Copy link
Contributor

@yerke26 yerke26 commented Oct 30, 2024

  • read input params from files / console
  • handle errors
  • validate input

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Optional. Remove if not applicable.

Documentation

Requires documentation update

  • Yes
  • No

If yes, link the PR to the docs update or the issue with the details labeled docs. Remove if not applicable.

Requires explanation in Release Notes

  • Yes
  • No

If yes, fill in the details here. Remove if not applicable.

Remarks

Optional. Remove if not applicable.

@yerke26 yerke26 requested a review from LukaszRozmej October 30, 2024 22:51
Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

Fix inner exception handling
use is null and is not null


public class T8NException : Exception, IExceptionWithExitCode
{
public T8NException(Exception e, int exitCode) : base(e.Message)
Copy link
Member

Choose a reason for hiding this comment

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


public static class T8NInputProcessor
{
private static readonly TxDecoder TxDecoder = TxDecoder.Instance;
Copy link
Member

Choose a reason for hiding this comment

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

We can now potentially register transaction types (including RLP and JSON parsing) from plugins. I expect this won't be able to generate tests around those injected tx types. Maybe worth to consider adding plugins support.

}
catch (NotSupportedException e)
{
throw new T8NException(e, T8NErrorCodes.ErrorConfig);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
throw new T8NException(e, T8NErrorCodes.ErrorConfig);
throw new T8NException("Failed to parse spec", T8NErrorCodes.ErrorConfig, e);

Comment on lines 63 to 70
catch (FileNotFoundException)
{
throw new T8NException("failed reading {filePath} file: {description}", T8NErrorCodes.ErrorIO);
}
catch (JsonException)
{
throw new T8NException($"failed unmarshalling {filePath} file: {description}", T8NErrorCodes.ErrorJson);
}
Copy link
Member

Choose a reason for hiding this comment

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

pass exceptions down


namespace Evm.t8n.JsonTypes;

public class TransactionJson
Copy link
Member

Choose a reason for hiding this comment

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

Does this differ substantially from TransactionForRPC or maybe it can be reused here?

@yerke26 yerke26 merged commit 65055f1 into master Oct 31, 2024
75 checks passed
@yerke26 yerke26 deleted the feature/t8n-input-processor branch October 31, 2024 10:46
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.

2 participants