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

Change ed19 to work with arbitrary-length messages #795

Merged
merged 49 commits into from
Jul 27, 2024

Conversation

xgreenx
Copy link
Collaborator

@xgreenx xgreenx commented Jul 24, 2024

Closes #793. Spec PR FuelLabs/fuel-specs#600

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog

Before requesting review

  • I have reviewed the code myself

@@ -101,6 +100,10 @@ pub fn default_gas_costs() -> GasCostsValues {
base: 2,
units_per_gas: 214,
},
ed19: DependentCost::HeavyOperation {
base: 3000,
gas_per_unit: 0,
Copy link
Member

@Voxelot Voxelot Jul 24, 2024

Choose a reason for hiding this comment

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

is it heavy or light? I would've thought its light operation given that it's just doing a sha3-512 over the input and all the other hash opcodes are light.

Copy link
Member

Choose a reason for hiding this comment

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

I changed it to light and copied gas_per_unit from s256 which should be quite similar.

@Dentosal Dentosal changed the title Preparation for the ed19 modifications Change ed19 to work with arbitrary-length messages Jul 26, 2024
@Dentosal Dentosal added the breaking A breaking api change label Jul 26, 2024
Base automatically changed from dento/blob-tx to master July 26, 2024 18:35
CHANGELOG.md Outdated Show resolved Hide resolved
base: v3.ed19,
gas_per_unit: 0,
},
GasCostsValues::V4(v4) => v4.ed19,
Copy link
Member

Choose a reason for hiding this comment

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

Why was it HeavyOperation before, but LightOperation now?

Copy link
Member

Choose a reason for hiding this comment

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

Probably just an oversight. Brandon was wonderin which one it should be, and changing it seemed to make sense. #795 (comment)

@@ -59,7 +59,7 @@ where
))
})?,
);
if pc < self.registers[RegId::IS] || pc >= self.registers[RegId::SSP] {
if pc < self.registers[RegId::IS] || pc >= self.registers[RegId::SP] {
Copy link
Member

Choose a reason for hiding this comment

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

Why did this get changed to SP from SSP?

Copy link
Member

Choose a reason for hiding this comment

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

The PR originially included changes from an old version of the Blob TX PR. Git merged this part incorrectly and I missed it when reviewing the code myself. Removed in 1c56802.

Copy link
Member

Choose a reason for hiding this comment

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

I re-reviewed myself as well to make sure nothing else was missed.

#[test_case(31, 0 => (); "Zero defaults to 32")]
#[test_case(31, 100 => (); "Way over the end")]
#[test_case(0, 32 => (); "Empty range, goes over it")]
fn ed25519_verify_c_plus_d_gt_vmaxram(offset: u16, len: u32) {
Copy link
Member

Choose a reason for hiding this comment

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

I feel like the name should mention that we should expect it to "overflow". All of these tests have to do with the offset causing the overflow, so maybe the name should reflect that.

The test_case names don't really inform me that much either, but I think that has more to do with the base name not being clear enough.

Copy link
Member

Choose a reason for hiding this comment

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

The other tests were named like this as well, I was trying to be consistent. But I just fixed them all in eb11817 now.

Copy link
Member

@MitchTurner MitchTurner left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks for the changes, @Dentosal

@Dentosal Dentosal added this pull request to the merge queue Jul 27, 2024
Merged via the queue into master with commit 1bf892d Jul 27, 2024
39 checks passed
@Dentosal Dentosal deleted the feature/ed19-with-dynamic-price branch July 27, 2024 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking api change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for dynamic size on the ed19 opcode.
5 participants