From a1219a4955ac955047d754d85a0318c59dc1ffc6 Mon Sep 17 00:00:00 2001 From: rianhughes Date: Tue, 22 Aug 2023 13:59:40 +0300 Subject: [PATCH] rpcv03_declareTxn --- rpc/block_test.go | 42 +++------------------------------------- rpc/transaction.go | 5 ----- rpc/types_transaction.go | 18 ----------------- 3 files changed, 3 insertions(+), 62 deletions(-) diff --git a/rpc/block_test.go b/rpc/block_test.go index e542c833..ebb20604 100644 --- a/rpc/block_test.go +++ b/rpc/block_test.go @@ -340,34 +340,6 @@ func TestBlockWithTxsAndDeployOrDeclare(t *testing.T) { }, } - var fullBlockGoerli300114 = Block{ - BlockHeader: BlockHeader{ - BlockHash: utils.TestHexToFelt(t, "0x184268bfbce24766fa53b65c9c8b30b295e145e8281d543a015b46308e27fdf"), - ParentHash: utils.TestHexToFelt(t, "0x7307cb0d7fa65c111e71cdfb6209bdc90d2454d4c0f34d8bf5a3fe477826c3c"), - SequencerAddress: utils.TestHexToFelt(t, "0x46a89ae102987331d369645031b49c27738ed096f2789c24449966da4c6de6b"), - BlockNumber: 300114, - NewRoot: utils.TestHexToFelt(t, "0x239a44410e78665f41f7a65ef3b5ed244ce411965498a83f80f904e22df1045"), - Timestamp: 1660701246, - }, - Status: "ACCEPTED_ON_L1", - Transactions: []Transaction{ - DeclareTxnV0{ - CommonTransaction: CommonTransaction{ - TransactionHash: utils.TestHexToFelt(t, "0x46a9f52a96b2d226407929e04cb02507e531f7c78b9196fc8c910351d8c33f3"), - BroadcastedTxnCommonProperties: BroadcastedTxnCommonProperties{ - Type: TransactionType_Declare, - MaxFee: &felt.Zero, - Version: TransactionV0, - Signature: []*felt.Felt{}, - Nonce: &felt.Zero, - }, - }, - ClassHash: utils.TestHexToFelt(t, "0x6feb117d1c3032b0ae7bd3b50cd8ec4a78c621dca0d63ddc17890b78a6c3b49"), - SenderAddress: utils.TestHexToFelt(t, "0x1"), - }, - }, - } - var fullBlockGoerli848622 = Block{ BlockHeader: BlockHeader{ BlockHash: utils.TestHexToFelt(t, "0x32964e2e407bb9e71b2de8d9d9829b0537df7c4624e1816e6cece80781ab9cc"), @@ -446,13 +418,6 @@ func TestBlockWithTxsAndDeployOrDeclare(t *testing.T) { LookupTxnPositionInExpected: 0, ExpectedBlockWithTxs: &fullBlockGoerli310843, }, - { - BlockID: WithBlockNumber(300114), - ExpectedError: nil, - LookupTxnPositionInOriginal: 3, - LookupTxnPositionInExpected: 0, - ExpectedBlockWithTxs: &fullBlockGoerli300114, - }, { BlockID: WithBlockNumber(849399), ExpectedError: nil, @@ -566,8 +531,8 @@ func TestCaptureUnsupportedBlockTxn(t *testing.T) { "mock": {}, "testnet": { { - StartBlock: 375919, - EndBlock: 376000, + StartBlock: 381000, + EndBlock: 381001, }, }, "mainnet": {}, @@ -586,12 +551,11 @@ func TestCaptureUnsupportedBlockTxn(t *testing.T) { _, okv1 := v.(InvokeTxnV1) _, okv0 := v.(InvokeTxnV0) _, okl1 := v.(L1HandlerTxn) - _, okdec0 := v.(DeclareTxnV0) _, okdec1 := v.(DeclareTxnV1) _, okdec2 := v.(DeclareTxnV2) _, okdep := v.(DeployTxn) _, okdepac := v.(DeployAccountTxn) - if !okv0 && !okv1 && !okl1 && !okdec0 && !okdec1 && !okdec2 && !okdep && !okdepac { + if !okv0 && !okv1 && !okl1 && !okdec1 && !okdec2 && !okdep && !okdepac { t.Fatalf("New Type Detected %T at Block(%d)/Txn(%d)", v, i, k) } } diff --git a/rpc/transaction.go b/rpc/transaction.go index c8062399..9957f8c0 100644 --- a/rpc/transaction.go +++ b/rpc/transaction.go @@ -21,12 +21,7 @@ func adaptTransaction(t TXN) (Transaction, error) { json.Unmarshal(txMarshalled, &tx) return tx, nil case TransactionType_Declare: - switch t.Version { - case &felt.Zero: - var tx DeclareTxnV0 - json.Unmarshal(txMarshalled, &tx) - return tx, nil case felt.Zero.SetUint64(1): var tx DeclareTxnV1 json.Unmarshal(txMarshalled, &tx) diff --git a/rpc/types_transaction.go b/rpc/types_transaction.go index cc6040b6..7b465d70 100644 --- a/rpc/types_transaction.go +++ b/rpc/types_transaction.go @@ -93,16 +93,6 @@ func (tx L1HandlerTxn) Hash() *felt.Felt { return tx.TransactionHash } -type DeclareTxnV0 struct { - CommonTransaction - - // SenderAddress the address of the account contract sending the declaration transaction - SenderAddress *felt.Felt `json:"sender_address"` - - DeprecatedContractClass `json:"contract_class,omitempty"` - ClassHash *felt.Felt `json:"class_hash,omitempty"` -} - type DeclareTxnV1 struct { CommonTransaction @@ -127,10 +117,6 @@ type DeclareTxnV2 struct { ClassHash *felt.Felt `json:"class_hash,omitempty"` } -func (tx DeclareTxnV0) Hash() *felt.Felt { - return tx.TransactionHash -} - func (tx DeclareTxnV1) Hash() *felt.Felt { return tx.TransactionHash } @@ -228,10 +214,6 @@ func unmarshalTxn(t interface{}) (Transaction, error) { case TransactionType_Declare: switch TransactionType(casted["version"].(string)) { - case "0x0": - var txn DeclareTxnV0 - remarshal(casted, &txn) - return txn, nil case "0x1": var txn DeclareTxnV1 remarshal(casted, &txn)