-
Notifications
You must be signed in to change notification settings - Fork 88
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
A new Upgrade
transaction to perform network upgrades
#707
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reduced default `MAX_SIZE` to be 110kb. Reduced default `MAX_CONTRACT_SIZE` to be 100kb.
# Conflicts: # CHANGELOG.md # fuel-tx/src/builder.rs # fuel-tx/src/tests/valid_cases/transaction.rs # fuel-tx/src/transaction/consensus_parameters.rs # fuel-vm/src/checked_transaction.rs # fuel-vm/src/tests/limits.rs # fuel-vm/src/tests/validation.rs
…ed by all chargeable transactions
…ction # Conflicts: # fuel-tx/src/transaction/consensus_parameters.rs
xgreenx
changed the title
A new Upgrade transaction to perform network upgrades
A new Mar 25, 2024
Upgrade
transaction to perform network upgrades
# Conflicts: # fuel-tx/src/transaction/consensus_parameters.rs # fuel-vm/src/tests/validation.rs
Dentosal
reviewed
Apr 4, 2024
Dentosal
reviewed
Apr 5, 2024
Comment on lines
+225
to
+228
let serialized_consensus_parameters = postcard::to_allocvec(consensus_parameters) | ||
.map_err(|_| { | ||
ValidityError::TransactionUpgradeConsensusParametersSerialization | ||
})?; |
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.
nit: I'm pretty sure this is never supposed to fail
Dentosal
previously approved these changes
Apr 5, 2024
Dentosal
previously approved these changes
Apr 8, 2024
MitchTurner
reviewed
Apr 8, 2024
xgreenx
added a commit
to FuelLabs/fuel-specs
that referenced
this pull request
Apr 9, 2024
Corresponding implementation: FuelLabs/fuel-vm#707 The change adds a new `Upgrade` transaction that allows upgrading either consensus parameters or state transition function used by the network to produce future blocks. The purpose of the upgrade is defined by the `Upgrade Purpose` type. The `Upgrade` transaction is chargeable, and the sender should pay for it. Transaction inputs should contain only base assets. Only the privileged address can upgrade the network. The privileged address can be either a real account or a predicate. We use postcard algorithm to serialize and deserialize consensus parameters during the upgrade. This algorithm works with numbers in a more sufficient way and compresses them well.
MitchTurner
approved these changes
Apr 9, 2024
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related FuelLabs/fuel-core#1753 and FuelLabs/fuel-specs#567
The change adds a new
Upgrade
transaction that allows upgrading either consensus parameters or state transition function used by the network to produce future blocks.The purpose of the upgrade is defined by the
Upgrade Purpose
type:The
Upgrade
transaction is chargeable, and the sender should pay for it. Transaction inputs should contain only base assets.Only the privileged address can upgrade the network. The privileged address can be either a real account or a predicate.
Since serialized consensus parameters are small(< 2kb), they can be part of the upgrade transaction and live inside of witness data. The bytecode of the blockchain state transition function is huge ~1.6MB(relative to consensus parameters), and it is impossible to fit it into one transaction. So when we perform the upgrade of the state transition function, it should already be available on the blockchain. The transaction to actually upload the bytecode(
Upload
transaction) will implemented in the FuelLabs/fuel-core#1754.Side changes:
Moved
fuel-tx-test-helpers
logic into thefuel_tx::test_helpers
module.The combination of
serde
andpostcard
is used to serialize and deserializeConsensusParameters
during the upgrade. This means the protocol and state transition function requires theserde
feature by default forConsensusParameters
andfuel-types
.Added a new rule for
Create
transaction: all inputs should use base asset otherwise it returnsTransactionInputContainsNonBaseAssetId
error.Renamed some errors because now they are used for several transactions(
Upgrade
uses some errors fromCreate
and some fromScript
transactions):TransactionScriptOutputContractCreated
->TransactionOutputContainsContractCreated
.TransactionCreateOutputContract
->TransactionOutputContainsContract
.TransactionCreateOutputVariable
->TransactionOutputContainsVariable
.TransactionCreateOutputChangeNotBaseAsset
->TransactionChangeChangeUsesNotBaseAsset
.TransactionCreateInputContract
->TransactionInputContainsContract
.TransactionCreateMessageData
->TransactionInputContainsMessageData
.Used the same pattern everywhere:
Instead of: