@@ -95,10 +95,11 @@ func TestTransactionByHashNotFoundInPreConfirmedBlock(t *testing.T) {
9595
9696func TestTransactionByHash (t * testing.T ) {
9797 tests := map [string ]struct {
98- hash string
99- network * utils.Network
100- expected string
101- responseFlags rpcv10.ResponseFlags
98+ hash string
99+ network * utils.Network
100+ expected string
101+ responseFlags rpcv10.ResponseFlags
102+ withProofFacts bool
102103 }{
103104 "DECLARE v1" : {
104105 hash : "0x1b4d9f09276629d496af1af8ff00173c11ff146affacb1b5c858d7aa89001ae" ,
@@ -437,6 +438,57 @@ func TestTransactionByHash(t *testing.T) {
437438 }` ,
438439 },
439440 "INVOKE v3 with response flags" : {
441+ hash : "0x49728601e0bb2f48ce506b0cbd9c0e2a9e50d95858aa41463f46386dca489fd" ,
442+ network : & utils .Integration ,
443+ withProofFacts : true ,
444+ expected : `{
445+ "type": "INVOKE",
446+ "transaction_hash": "0x49728601e0bb2f48ce506b0cbd9c0e2a9e50d95858aa41463f46386dca489fd",
447+ "version": "0x3",
448+ "signature": [
449+ "0x71a9b2cd8a8a6a4ca284dcddcdefc6c4fd20b92c1b201bd9836e4ce376fad16",
450+ "0x6bef4745194c9447fdc8dd3aec4fc738ab0a560b0d2c7bf62fbf58aef3abfc5"
451+ ],
452+ "nonce": "0xe97",
453+ "resource_bounds": {
454+ "l1_gas": {
455+ "max_amount": "0x186a0",
456+ "max_price_per_unit": "0x5af3107a4000"
457+ },
458+ "l1_data_gas": {
459+ "max_amount": "0x186a0",
460+ "max_price_per_unit": "0x5af3107a4000"
461+ },
462+ "l2_gas": { "max_amount": "0x0", "max_price_per_unit": "0x0" }
463+ },
464+ "tip": "0x0",
465+ "paymaster_data": [],
466+ "sender_address": "0x3f6f3bc663aedc5285d6013cc3ffcbc4341d86ab488b8b68d297f8258793c41",
467+ "calldata": [
468+ "0x2",
469+ "0x450703c32370cf7ffff540b9352e7ee4ad583af143a361155f2b485c0c39684",
470+ "0x27c3334165536f239cfd400ed956eabff55fc60de4fb56728b6a4f6b87db01c",
471+ "0x0",
472+ "0x4",
473+ "0x4c312760dfd17a954cdd09e76aa9f149f806d88ec3e402ffaf5c4926f568a42",
474+ "0x5df99ae77df976b4f0e5cf28c7dcfe09bd6e81aab787b19ac0c08e03d928cf",
475+ "0x4",
476+ "0x1",
477+ "0x5",
478+ "0x450703c32370cf7ffff540b9352e7ee4ad583af143a361155f2b485c0c39684",
479+ "0x5df99ae77df976b4f0e5cf28c7dcfe09bd6e81aab787b19ac0c08e03d928cf",
480+ "0x1",
481+ "0x7fe4fd616c7fece1244b3616bb516562e230be8c9f29668b46ce0369d5ca829",
482+ "0x287acddb27a2f9ba7f2612d72788dc96a5b30e401fc1e8072250940e024a587"
483+ ],
484+ "account_deployment_data": [],
485+ "nonce_data_availability_mode": "L1",
486+ "fee_data_availability_mode": "L1",
487+ "proof_facts": ["0x64", "0xc8"]
488+ }` ,
489+ responseFlags : rpcv10.ResponseFlags {IncludeProofFacts : true },
490+ },
491+ "INVOKE v3 with response flags and no proof facts" : {
440492 hash : "0x49728601e0bb2f48ce506b0cbd9c0e2a9e50d95858aa41463f46386dca489fd" ,
441493 network : & utils .Integration ,
442494 expected : `{
@@ -482,7 +534,7 @@ func TestTransactionByHash(t *testing.T) {
482534 "account_deployment_data": [],
483535 "nonce_data_availability_mode": "L1",
484536 "fee_data_availability_mode": "L1",
485- "proof_facts": ["0x64", "0xc8" ]
537+ "proof_facts": []
486538 }` ,
487539 responseFlags : rpcv10.ResponseFlags {IncludeProofFacts : true },
488540 },
@@ -503,7 +555,7 @@ func TestTransactionByHash(t *testing.T) {
503555 }
504556 // Mock the gateway to include proof_facts for "INVOKE v3 with response flags" test
505557 invokeTx , ok := tx .(* core.InvokeTransaction )
506- if ok && invokeTx . Version . Is ( 3 ) && test .responseFlags . IncludeProofFacts {
558+ if ok && test .withProofFacts {
507559 invokeTx .ProofFacts = []felt.Felt {
508560 felt.FromUint64 [felt.Felt ](100 ),
509561 felt.FromUint64 [felt.Felt ](200 ),
@@ -797,6 +849,21 @@ func TestTransactionByBlockIdAndIndex(t *testing.T) {
797849 require .NotNil (t , tx )
798850 require .Nil (t , tx .ProofFacts )
799851 })
852+
853+ blockID2 := rpcv10 .BlockIDFromNumber (2 )
854+ mockReader .EXPECT ().TransactionByBlockNumberAndIndex (uint64 (2 ), uint64 (0 )).
855+ Return (invokeTxCore , nil )
856+ t .Run ("WithResponseFlag and empty proof facts" , func (t * testing.T ) {
857+ tx , rpcErr := h .TransactionByBlockIDAndIndex (
858+ & blockID2 ,
859+ 0 ,
860+ rpcv10.ResponseFlags {IncludeProofFacts : true },
861+ )
862+ require .Nil (t , rpcErr )
863+ require .NotNil (t , tx )
864+ require .NotNil (t , tx .ProofFacts )
865+ require .Empty (t , * tx .ProofFacts )
866+ })
800867 })
801868}
802869
0 commit comments