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

CCP and LDC errors if given a buffer size less than the contract size. #2672

Closed
netrome opened this issue Feb 5, 2025 · 3 comments · Fixed by #2673
Closed

CCP and LDC errors if given a buffer size less than the contract size. #2672

netrome opened this issue Feb 5, 2025 · 3 comments · Fixed by #2673
Assignees
Labels
bug Something isn't working

Comments

@netrome
Copy link
Contributor

netrome commented Feb 5, 2025

Discovered by @rymnc, observable in the following commit in the zkvm-primitives repo FuelLabs/zkvm-primitives@ca4ef6e

How to reproduce

Check out the above commit and run

cargo nextest run fuel-zkvm-primitives-test-fixtures opcodes::tests::test_contract_instruction_ccp

Bug description

When calling CCP the caller specifies a contract ID, and a number of bytes to read. If this number isn't the same as the number of bytes in the contract we get the following error:

VmExecution { error: "Storage error: Buffer size is not equal to the value size", transaction_id: 9fb5fb513aeebfd5ddadcd84e9ff9aae699bdbd52df955d7c6cd79dd0fc946e7 }

The expected behavior is to successfully copy the provided number of bytes.

@netrome netrome added the bug Something isn't working label Feb 5, 2025
@netrome
Copy link
Contributor Author

netrome commented Feb 5, 2025

We need to sync with @Voxelot and/or @xgreenx to align on how we want this to behave.

@xgreenx
Copy link
Collaborator

xgreenx commented Feb 5, 2025

We forgot to add support for offset inside of this function

Image

@netrome
Copy link
Contributor Author

netrome commented Feb 5, 2025

This affects all 0.41.x releases up to 0.41.5. This change has been uploaded in STF version 19 and 20 on devnet. No STF on testnet or mainnet has been affected.

@AurelienFT AurelienFT self-assigned this Feb 5, 2025
AurelienFT added a commit that referenced this issue Feb 5, 2025
… allow not equal buf size (#2673)

## Linked Issues/PRs
#2672

## Description
Change code of `read` of `InMemoryTransaction` to match the other `read`
functions

Tests had been added and the error in `read` function has been improved
to be more clear.

## 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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants