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

Limit the number of receipts to u16::MAX #535

Merged
merged 2 commits into from
Nov 10, 2023
Merged

Conversation

Dentosal
Copy link
Member

@Dentosal Dentosal commented Nov 9, 2023

Increases the receipt limit from u8::MAX to u16::MAX, leaving space for panic and script result. The old limit was not enforced, but FuelLabs/fuel-vm#633 is going to enforce the new rules defined here.

The number of receipts is limited separtely from gas, since adding more receipts slows down all instructions that operate on them. Moreover, this change makes the upper bound for memory use clear.

@Dentosal Dentosal added documentation Improvements or additions to documentation comp:FVM Component: FuelVM labels Nov 9, 2023
@Dentosal Dentosal self-assigned this Nov 9, 2023
@Dentosal Dentosal requested a review from xgreenx November 9, 2023 10:49
@Dentosal Dentosal marked this pull request as ready for review November 9, 2023 10:49
@@ -18,7 +18,7 @@ The ID of a message is computed as the [hash](../protocol/cryptographic-primitiv

### Message Nonce

The nonce value for `InputMessage` is determined by the sending system and is published at the time the message is sent. The nonce value for `OutputMessage` is computed as the [hash](../protocol/cryptographic-primitives.md#hashing) of the [Transaction ID](./transaction-id.md) that emitted the message and the index of the message receipt `uint8`: `hash(byte[32] ++ uint8)`.
The nonce value for `InputMessage` is determined by the sending system and is published at the time the message is sent. The nonce value for `OutputMessage` is computed as the [hash](../protocol/cryptographic-primitives.md#hashing) of the [Transaction ID](./transaction-id.md) that emitted the message and the index of the message receipt `uint16`: `hash(byte[32] ++ uint16)`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to highlight the uint16 uses canonical serialization?

Copy link
Member Author

Choose a reason for hiding this comment

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

Likely. The canonical serialization is just a u64, so it makes sense to highlight this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added that in 5a2dfe6

@Dentosal Dentosal merged commit 6403901 into master Nov 10, 2023
5 checks passed
@Dentosal Dentosal deleted the dento/receipt-limit branch November 10, 2023 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:FVM Component: FuelVM documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants