Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rianhughes committed Nov 22, 2023
1 parent 3c817de commit 457bea3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func tipAndResourcesHash(tip uint64, resourceBounds rpc.ResourceBoundsMapping) *
return crypto.PoseidonArray(new(felt.Felt).SetUint64(tip), l1Bounds, l2Bounds)
}

func dataAvailabilityMode(feeDAMode, nonceDAMode rpc.DAMode) (uint64, error) {
func dataAvailabilityMode(feeDAMode, nonceDAMode rpc.DataAvailabilityMode) (uint64, error) {
const dataAvailabilityModeBits = 32
fee64, err := feeDAMode.UInt64()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions rpc/types_broadcast_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ type BroadcastDeclareTxnV3 struct {
// The data needed to deploy the account contract from which this tx will be initiated
AccountDeploymentData *felt.Felt `json:"account_deployment_data"`
// The storage domain of the account's nonce (an account has a nonce per DA mode)
NonceDataMode DAMode `json:"nonce_data_availability_mode"`
NonceDataMode DataAvailabilityMode `json:"nonce_data_availability_mode"`
// The storage domain of the account's balance from which fee will be charged
FeeMode DAMode `json:"fee_data_availability_mode"`
FeeMode DataAvailabilityMode `json:"fee_data_availability_mode"`
}

type BroadcastDeployAccountTxn struct {
Expand Down
36 changes: 18 additions & 18 deletions rpc/types_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ type InvokeTxnV3 struct {
// The data needed to deploy the account contract from which this tx will be initiated
AccountDeploymentData []*felt.Felt `json:"account_deployment_data"`
// The storage domain of the account's nonce (an account has a nonce per DA mode)
NonceDataMode DAMode `json:"nonce_data_availability_mode"`
NonceDataMode DataAvailabilityMode `json:"nonce_data_availability_mode"`
// The storage domain of the account's balance from which fee will be charged
FeeMode DAMode `json:"fee_data_availability_mode"`
FeeMode DataAvailabilityMode `json:"fee_data_availability_mode"`
}

type L1HandlerTxn struct {
Expand Down Expand Up @@ -124,9 +124,9 @@ type DeclareTxnV3 struct {
// The data needed to deploy the account contract from which this tx will be initiated
AccountDeploymentData []*felt.Felt `json:"account_deployment_data"`
// The storage domain of the account's nonce (an account has a nonce per DA mode)
NonceDataMode DAMode `json:"nonce_data_availability_mode"`
NonceDataMode DataAvailabilityMode `json:"nonce_data_availability_mode"`
// The storage domain of the account's balance from which fee will be charged
FeeMode DAMode `json:"fee_data_availability_mode"`
FeeMode DataAvailabilityMode `json:"fee_data_availability_mode"`
}

type ResourceBoundsMapping struct {
Expand All @@ -136,14 +136,14 @@ type ResourceBoundsMapping struct {
L2Gas ResourceBounds `json:"l2_gas"`
}

type DAMode string
type DataAvailabilityMode string

const (
DAModeL1 DAMode = "L1"
DAModeL2 DAMode = "L2"
DAModeL1 DataAvailabilityMode = "L1"
DAModeL2 DataAvailabilityMode = "L2"
)

func (da *DAMode) UInt64() (uint64, error) {
func (da *DataAvailabilityMode) UInt64() (uint64, error) {
switch *da {
case DAModeL1:
return uint64(0), nil
Expand Down Expand Up @@ -221,9 +221,9 @@ type DeployAccountTxnV3 struct {
// The data needed to allow the paymaster to pay for the transaction in native tokens
PayMasterData []*felt.Felt `json:"paymaster_data"`
// The storage domain of the account's nonce (an account has a nonce per DA mode)
NonceDataMode DAMode `json:"nonce_data_availability_mode"`
NonceDataMode DataAvailabilityMode `json:"nonce_data_availability_mode"`
// The storage domain of the account's balance from which fee will be charged
FeeMode DAMode `json:"fee_data_availability_mode"`
FeeMode DataAvailabilityMode `json:"fee_data_availability_mode"`
}

type UnknownTransaction struct{ Transaction }
Expand Down Expand Up @@ -331,14 +331,14 @@ func remarshal(v interface{}, dst interface{}) error {
type TransactionVersion string

const (
TransactionV0 TransactionVersion = "0x0"
TransactionV0Variant TransactionVersion = "0x100000000000000000000000000000000"
TransactionV1 TransactionVersion = "0x1"
TransactionV1Variant TransactionVersion = "0x100000000000000000000000000000001"
TransactionV2 TransactionVersion = "0x2"
TransactionV2Variant TransactionVersion = "0x100000000000000000000000000000002"
TransactionV3 TransactionVersion = "0x3"
TransactionV3Variant TransactionVersion = "0x100000000000000000000000000000003"
TransactionV0 TransactionVersion = "0x0"
TransactionV0WithQueryBit TransactionVersion = "0x100000000000000000000000000000000"
TransactionV1 TransactionVersion = "0x1"
TransactionV1WithQueryBit TransactionVersion = "0x100000000000000000000000000000001"
TransactionV2 TransactionVersion = "0x2"
TransactionV2WithQueryBit TransactionVersion = "0x100000000000000000000000000000002"
TransactionV3 TransactionVersion = "0x3"
TransactionV3WithQueryBit TransactionVersion = "0x100000000000000000000000000000003"
)

// BigInt returns a big integer corresponding to the transaction version.
Expand Down

0 comments on commit 457bea3

Please sign in to comment.