From 18a30972e55f5f73acd298c4ccda041d41e223e6 Mon Sep 17 00:00:00 2001 From: TAdev0 Date: Tue, 10 Sep 2024 15:56:30 +0200 Subject: [PATCH 1/2] make MaxFee field cleaner --- core/transaction.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/core/transaction.go b/core/transaction.go index 410f106270..15e06cdffa 100644 --- a/core/transaction.go +++ b/core/transaction.go @@ -224,13 +224,15 @@ func (d *DeployTransaction) Signature() []*felt.Felt { type DeployAccountTransaction struct { DeployTransaction - // The maximum fee that the sender is willing to pay for the transaction. - MaxFee *felt.Felt // Additional information given by the sender, used to validate the transaction. TransactionSignature []*felt.Felt // The transaction nonce. Nonce *felt.Felt + // Version 0 fields + // The maximum fee that the sender is willing to pay for the transaction. + MaxFee *felt.Felt + // Version 3 fields // See InvokeTransaction for descriptions of the fields. ResourceBounds map[Resource]ResourceBounds @@ -254,9 +256,6 @@ type InvokeTransaction struct { CallData []*felt.Felt // Additional information given by the sender, used to validate the transaction. TransactionSignature []*felt.Felt - // The maximum fee that the sender is willing to pay for the transaction - // Available in version 1 only - MaxFee *felt.Felt // The address of the contract invoked by this transaction. ContractAddress *felt.Felt // When the fields that comprise a transaction change, @@ -274,6 +273,10 @@ type InvokeTransaction struct { // The address of the sender of this transaction SenderAddress *felt.Felt + // Versions 0 and 1 fields + // The maximum fee that the sender is willing to pay for the transaction + MaxFee *felt.Felt + // Version 3 fields (there was no version 2) ResourceBounds map[Resource]ResourceBounds Tip uint64 @@ -305,9 +308,6 @@ type DeclareTransaction struct { ClassHash *felt.Felt // The address of the account initiating the transaction. SenderAddress *felt.Felt - // The maximum fee that the sender is willing to pay for the transaction. - // Available in versions 1, 2 - MaxFee *felt.Felt // Additional information given by the sender, used to validate the transaction. TransactionSignature []*felt.Felt // The transaction nonce. @@ -322,6 +322,10 @@ type DeclareTransaction struct { // Version 2 fields CompiledClassHash *felt.Felt + // Versions 0 (deprecated and unsupported), 1 and 2 fields + // The maximum fee that the sender is willing to pay for the transaction. + MaxFee *felt.Felt + // Version 3 fields // See InvokeTransaction for descriptions of the fields. ResourceBounds map[Resource]ResourceBounds From 299f1e3f0ff7bf97f81b1d62e0bfae645680b245 Mon Sep 17 00:00:00 2001 From: TAdev0 Date: Tue, 10 Sep 2024 16:07:29 +0200 Subject: [PATCH 2/2] improve overall comments --- core/transaction.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/core/transaction.go b/core/transaction.go index 15e06cdffa..70da35113c 100644 --- a/core/transaction.go +++ b/core/transaction.go @@ -256,8 +256,6 @@ type InvokeTransaction struct { CallData []*felt.Felt // Additional information given by the sender, used to validate the transaction. TransactionSignature []*felt.Felt - // The address of the contract invoked by this transaction. - ContractAddress *felt.Felt // When the fields that comprise a transaction change, // either with the addition of a new field or the removal of an existing field, // then the transaction version increases. @@ -266,18 +264,20 @@ type InvokeTransaction struct { // Version 0 fields // The encoding of the selector for the function invoked (the entry point in the contract) EntryPointSelector *felt.Felt + // The address of the contract invoked by this transaction. + ContractAddress *felt.Felt - // Version 1 fields + // Versions 0 and 1 fields + // The maximum fee that the sender is willing to pay for the transaction + MaxFee *felt.Felt + + // Version 1 and 3 fields // The transaction nonce. Nonce *felt.Felt // The address of the sender of this transaction SenderAddress *felt.Felt - // Versions 0 and 1 fields - // The maximum fee that the sender is willing to pay for the transaction - MaxFee *felt.Felt - - // Version 3 fields (there was no version 2) + // Version 3 fields ResourceBounds map[Resource]ResourceBounds Tip uint64 // From the RPC spec: data needed to allow the paymaster to pay for the transaction in native tokens @@ -319,13 +319,13 @@ type DeclareTransaction struct { // Transaction version 0 is deprecated and will be removed in a future version of Starknet. Version *TransactionVersion - // Version 2 fields - CompiledClassHash *felt.Felt - // Versions 0 (deprecated and unsupported), 1 and 2 fields // The maximum fee that the sender is willing to pay for the transaction. MaxFee *felt.Felt + // Versions 2 and 3 fields + CompiledClassHash *felt.Felt + // Version 3 fields // See InvokeTransaction for descriptions of the fields. ResourceBounds map[Resource]ResourceBounds