From 4bd144ffb91d3c2ad777215ff58c474e007effb9 Mon Sep 17 00:00:00 2001 From: Gary <982483+gmalouf@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:37:30 -0500 Subject: [PATCH] Introduce test ensuring indexer handles indexing into shared addresses properly when group resource sharing occurs. (#1591) --- api/handlers_test.go | 11 +++++++++++ api/test_resources/resource_sharing_1.response | 1 + api/test_resources/resource_sharing_1.txn | 1 + api/test_resources/resource_sharing_2.response | 1 + api/test_resources/resource_sharing_2.txn | Bin 0 -> 323 bytes 5 files changed, 14 insertions(+) create mode 100644 api/test_resources/resource_sharing_1.response create mode 100644 api/test_resources/resource_sharing_1.txn create mode 100644 api/test_resources/resource_sharing_2.response create mode 100644 api/test_resources/resource_sharing_2.txn diff --git a/api/handlers_test.go b/api/handlers_test.go index 28a37c74b..431c62b59 100644 --- a/api/handlers_test.go +++ b/api/handlers_test.go @@ -614,6 +614,17 @@ func TestFetchTransactions(t *testing.T) { loadTransactionFromFile("test_resources/app_call_inner_acfg.response"), }, }, + { + name: "Conditionally index into shared addresses when sharing resources across a group", + txnBytes: [][]byte{ + loadResourceFileOrPanic("test_resources/resource_sharing_1.txn"), + loadResourceFileOrPanic("test_resources/resource_sharing_2.txn"), + }, + response: []generated.Transaction{ + loadTransactionFromFile("test_resources/resource_sharing_1.response"), + loadTransactionFromFile("test_resources/resource_sharing_2.response"), + }, + }, { name: "State Proof Txn", txnBytes: [][]byte{ diff --git a/api/test_resources/resource_sharing_1.response b/api/test_resources/resource_sharing_1.response new file mode 100644 index 000000000..9d5566275 --- /dev/null +++ b/api/test_resources/resource_sharing_1.response @@ -0,0 +1 @@ +{"application-transaction":{"accounts":["EDEQH62ERDNLASADCOKJLXUMYCP2S2CPKXFHB72OQKR6IXOQFAYFSHK53M"],"application-args":["IMkD+0SI2rBIAxOUld6MwJ+paE9VynD/ToKj5F3QKDA="],"application-id":1001,"foreign-apps":[],"foreign-assets":[],"global-state-schema":{"num-byte-slice":0,"num-uint":0},"local-state-schema":{"num-byte-slice":0,"num-uint":0},"on-completion":"noop"},"close-rewards":0,"closing-amount":0,"confirmed-round":1,"fee":1000,"first-valid":1351,"group":"JTcCx8AgKTI2VSTUnW7nDbimwramhGQrFEdMr+pWDWY=","id":"CDMG3FIQ6BN7B5POTZC5BKIA3MG2PJKLLBAPV7TG6V6ZICVSBK4A","intra-round-offset":2,"last-valid":2351,"local-state-delta":[{"address":"EDEQH62ERDNLASADCOKJLXUMYCP2S2CPKXFHB72OQKR6IXOQFAYFSHK53M","delta":[{"key":"a2V5","value":{"action":1,"bytes":"SIVReg6hjevVNotXmOooUYxm55kMwYeBgiWI/f0lhbA=","uint":0}}]}],"receiver-rewards":0,"round-time":1704475560,"sender":"OBQEUTTE5HSAXNYDZ2XWPZHBPZKCIVSUGTDVBJ2O7SA2TUD2BPMCJMZ2TQ","sender-rewards":0,"signature":{"sig":"SaR0dSN0FKoUGq2gGD9DQeBdNeAex7Ywa6E96EsrFj0/9v10POQ0FSjV13sNfp1+2eHR4yZxXqTW2rgc4ePUBw=="},"tx-type":"appl"} \ No newline at end of file diff --git a/api/test_resources/resource_sharing_1.txn b/api/test_resources/resource_sharing_1.txn new file mode 100644 index 000000000..f6311582a --- /dev/null +++ b/api/test_resources/resource_sharing_1.txn @@ -0,0 +1 @@ +dtldkeyatbs HQz6W(Qf %%sig@Itu#t?CA]5Ƕ0k=K+=?t<4({ ~~&q^ڸtxnapaa DڰHތhOUpN](0apat DڰHތhOUpN](0apidfeefvGgrp %7 )26U$ԝn ¶d+GLV flv /snd p`JNd ίg~T$VT4PNz ؤtypeappl \ No newline at end of file diff --git a/api/test_resources/resource_sharing_2.response b/api/test_resources/resource_sharing_2.response new file mode 100644 index 000000000..baf56bfc4 --- /dev/null +++ b/api/test_resources/resource_sharing_2.response @@ -0,0 +1 @@ +{"application-transaction":{"accounts":[],"application-args":["IMkD+0SI2rBIAxOUld6MwJ+paE9VynD/ToKj5F3QKDA="],"application-id":1001,"foreign-apps":[],"foreign-assets":[],"global-state-schema":{"num-byte-slice":0,"num-uint":0},"local-state-schema":{"num-byte-slice":0,"num-uint":0},"on-completion":"noop"},"close-rewards":0,"closing-amount":0,"confirmed-round":1,"fee":1000,"first-valid":1351,"group":"JTcCx8AgKTI2VSTUnW7nDbimwramhGQrFEdMr+pWDWY=","id":"IJAXJSCF5QBIKSCAV5QFSTPJRY32LHYV24WL4372EJZYSHEXQFFA","intra-round-offset":2,"last-valid":2351,"local-state-delta":[{"address":"EDEQH62ERDNLASADCOKJLXUMYCP2S2CPKXFHB72OQKR6IXOQFAYFSHK53M","delta":[{"key":"a2V5","value":{"action":1,"bytes":"MOR8jSb/U6XxPy6v2NbXqqBnRg2Eu/A/G2RdJ2kAwGU=","uint":0}}]}],"receiver-rewards":0,"round-time":1704475560,"sender":"OBQEUTTE5HSAXNYDZ2XWPZHBPZKCIVSUGTDVBJ2O7SA2TUD2BPMCJMZ2TQ","sender-rewards":0,"signature":{"sig":"xFP3/rHrizQo7Luo/TJgc9yXgs5Sy+2WwmffUUakRl6+r4S68USBRNh9CeySpGW87y4LAzhcF/YeRO6SJmIWAw=="},"tx-type":"appl"} \ No newline at end of file diff --git a/api/test_resources/resource_sharing_2.txn b/api/test_resources/resource_sharing_2.txn new file mode 100644 index 0000000000000000000000000000000000000000..dd014381f5ed7f6fd62f1eeee4e2c781d0492542 GIT binary patch literal 323 zcmZo(lv2{PC?}0Hq1x6=-#-w$+K;ug1Weao(oE{!fXYB}Fb zT9Ufwy&gBSMU412IhS{n)RM%Q7nfAzbu39NNF>Hept{VIv&=6Sr=_NzWqz?Jt?VqT z`{MMXf+Gs5=1j*AC}