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

Use existing array for precompile result #7001

Merged
merged 3 commits into from
May 9, 2024
Merged

Use existing array for precompile result #7001

merged 3 commits into from
May 9, 2024

Conversation

benaadams
Copy link
Member

Changes

  • Use existing array for precompile result, when Memory array backed and size same

Types of changes

What types of changes does your code introduce?

  • Optimization

Testing

Requires testing

  • No

@@ -29,7 +29,7 @@ public long DataGasCost(in ReadOnlyMemory<byte> inputData, IReleaseSpec releaseS

public (ReadOnlyMemory<byte>, bool) Run(in ReadOnlyMemory<byte> inputData, IReleaseSpec releaseSpec)
{
return (inputData, true);
return (inputData.ToArray(), true);
Copy link
Member Author

Choose a reason for hiding this comment

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

Not enturely sure why, but IdentityPrecompile isn't really used so shouldn't really matter

@benaadams benaadams requested a review from LukaszRozmej May 8, 2024 23:09
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.

Also would it be better to be bool TryRun(in ReadOnlyMemory<byte> inputData, IReleaseSpec releaseSpec, out ReadOnlyMemory<byte> result) ?

@benaadams
Copy link
Member Author

Also would it be better to be bool TryRun(in ReadOnlyMemory<byte> inputData, IReleaseSpec releaseSpec, out ReadOnlyMemory<byte> result) ?

More of a break if another chain has their own precompiles? (Don't know if they do)

@LukaszRozmej
Copy link
Member

LukaszRozmej commented May 9, 2024

Also would it be better to be bool TryRun(in ReadOnlyMemory<byte> inputData, IReleaseSpec releaseSpec, out ReadOnlyMemory<byte> result) ?

More of a break if another chain has their own precompiles? (Don't know if they do)

huh why? I am askung about just changing interface, bool can go via register, or the whole tuple goes via registers?

@benaadams
Copy link
Member Author

Also would it be better to be bool TryRun(in ReadOnlyMemory<byte> inputData, IReleaseSpec releaseSpec, out ReadOnlyMemory<byte> result) ?

More of a break if another chain has their own precompiles? (Don't know if they do)

huh why? I am askung about just changing interface, bool can go via register, or the whole tuple goes via registers?

I mean if any existing extenal precompiles/plugin as they would need to change their signiture to upgrade?

@benaadams
Copy link
Member Author

Would be a better signiture though :)

@benaadams benaadams merged commit 632dc71 into master May 9, 2024
67 checks passed
@benaadams benaadams deleted the precompile branch May 9, 2024 14:40
@LukaszRozmej
Copy link
Member

Also would it be better to be bool TryRun(in ReadOnlyMemory<byte> inputData, IReleaseSpec releaseSpec, out ReadOnlyMemory<byte> result) ?

More of a break if another chain has their own precompiles? (Don't know if they do)

huh why? I am askung about just changing interface, bool can go via register, or the whole tuple goes via registers?

I mean if any existing extenal precompiles/plugin as they would need to change their signiture to upgrade?

I don't think there are any, and if yes this is trivial change

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