-
Notifications
You must be signed in to change notification settings - Fork 95
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
Unified Create
and Script
logic via ChargeableTransaction
#706
Conversation
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
#[derive(fuel_types::canonical::Deserialize, fuel_types::canonical::Serialize)] | ||
#[derivative(Eq, PartialEq, Hash, Debug)] | ||
pub struct ChargeableTransaction<Body, MetadataBody> { | ||
pub(crate) body: Body, |
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.
The change is breaking because now old fields live under the body
subfield. We could avoid it by flattening(serde(flatten)
) the inner structure, but it is not supported properly by serde for the bincode.
# Conflicts: # fuel-tx/src/transaction/consensus_parameters.rs # fuel-vm/src/tests/validation.rs
What's the difference between |
Hmm, basically no difference=D We also could use the name I decided to call it "chargeable" because any executable transaction is chargeable by default, but not any chargeable transaction is executable. Executable transactions mean that they support predicate execution as well. |
I mean there's already an fuel-vm/fuel-vm/src/interpreter.rs Line 359 in d5824dd
This is only implemented for |
This PR |
…ansaction # Conflicts: # fuel-tx/src/transaction/types/script.rs # fuel-vm/src/interpreter.rs
@@ -51,7 +51,6 @@ impl MintMetadata { | |||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | |||
#[derive(fuel_types::canonical::Deserialize, fuel_types::canonical::Serialize)] | |||
#[canonical(prefix = TransactionRepr::Mint)] | |||
#[cfg_attr(feature = "typescript", wasm_bindgen::prelude::wasm_bindgen)] |
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.
Why is this removed?
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.
The wasm_bindgen
doesn't know how to work with generics, so it is not possible to inherit for Create
and Script
transactions. So, I reworked how we are passing any transaction to typescript.
Co-authored-by: Hannes Karppila <hannes.karppila@gmail.com>
Now has conflicts, but looks correct otherwise. |
# Conflicts: # CHANGELOG.md # fuel-tx/src/transaction/types/create.rs # fuel-tx/src/transaction/types/script.rs
The merge-base changed after approval.
Created
ChargeableTransaction
that accumulates common logic of theCreate
andScript
transactions. The same logic can be applied to any chargeable transaction. TheMint
transaction is free and created by the block producer, so it is not chargeable and doesn't have policies, inputs, outputs, and witnesses.Side changes:
canonical(skip)
. We already partially supported that, but if the skipped field used a generic, we required that generic to implement the corresponding trait. After the change, skipped fields don't impact the generic's constraints.The change is breaking because affects JSON serialization and deserialization. Now
Script
andCreate
transactions havebody
fields that include unique transactions.