-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add zk opcodes #2439
base: master
Are you sure you want to change the base?
Add zk opcodes #2439
Conversation
Allow big script data in transactions
## Linked Issues/PRs #2237 ## Description This PR is on top of `add_zk_opcodes` so that the change of gas cost will be efective with the new `GasCostsValueV5`. The benchmark was incorrect because of https://github.com/FuelLabs/fuel-core/blob/afbfef20fb78921cc6dc365878fb5b3a790ee769/crates/storage/src/vm_storage.rs#L291 . In benches the block_height was `0`. If we use the `DBBench` it works because the block height used is 1. However, if we want to add blocks in the db we also need the `DBBench` to use an higher block height. This PR solves all of this. This PR also simplify and comment the preparation code. ## Checklist - [x] Breaking changes are clearly marked as such in the PR description and changelog - [x] New behavior is reflected in tests - [x] [The specification](https://github.com/FuelLabs/fuel-specs/) matches the implemented behavior (link update PR if changes are needed) ### Before requesting review - [x] I have reviewed the code myself - [x] I have created follow-up issues caused by this PR and linked them here ### After merging, notify other teams [Add or remove entries as needed] - [ ] [Rust SDK](https://github.com/FuelLabs/fuels-rs/) - [ ] [Sway compiler](https://github.com/FuelLabs/sway/) - [ ] [Platform documentation](https://github.com/FuelLabs/devrel-requests/issues/new?assignees=&labels=new+request&projects=&template=NEW-REQUEST.yml&title=%5BRequest%5D%3A+) (for out-of-organization contributors, the person merging the PR will do this) - [ ] Someone else? --------- Co-authored-by: Green Baneling <[email protected]>
run_group_ref( | ||
&mut c.benchmark_group("ecop"), | ||
"ecop", | ||
VmBench::new(op::ecop(0x10, 0x00, 0x01, 0x10)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can perhaps use RegId::ZERO instead of 0x00
here
run_group_ref( | ||
&mut bench_epar, | ||
format!("{i}"), | ||
VmBench::new(op::epar(0x12, 0x00, 0x11, 0x10)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, as prev comment
.with_data(points_bytearray) | ||
.with_prepare_script(vec![ | ||
op::movi(0x11, i), | ||
op::gtf_args(0x10, 0x00, GTFArgs::ScriptData), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as prev comment
); | ||
consensus_params.set_fee_params(FeeParameters::default().with_gas_per_byte(0)); | ||
consensus_params.set_gas_costs(GasCosts::free()); | ||
consensus_params.set_script_params( | ||
ScriptParameters::default() | ||
.with_max_script_length(64 * 1024 * 1024) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe 64*1024*1024
should be defined as a constant above and reused in this params
// Add block height to 0x11 | ||
op::movi(0x11, 0xc9), | ||
]) | ||
.with_height(0xca.into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
random height chosen here? should it have been the latest height?
@@ -48,6 +48,19 @@ fn aloc_bytearray<const S: usize>(reg: u8, v: [u8; S]) -> Vec<Instruction> { | |||
ops | |||
} | |||
|
|||
/// Allocates a byte array of a variable size from heap and initializes it. Then points `reg` to it. | |||
pub fn aloc_bytearray_vec(reg: u8, v: Vec<u8>) -> Vec<Instruction> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couldn't find a usage of this function, should it be removed?
Description
FuelLabs/fuel-specs#615
Checklist
Before requesting review
After merging, notify other teams
[Add or remove entries as needed]