From ee776eb6fd78459192a8cfc61198e62aa8f3fa9d Mon Sep 17 00:00:00 2001 From: keiff3r Date: Wed, 11 Dec 2024 16:30:40 +0100 Subject: [PATCH] test(init_contract): add a test with long name and params - Generate golden snapshots --- .../00000.png | Bin 0 -> 345 bytes .../00001.png | Bin 0 -> 943 bytes .../00002.png | Bin 0 -> 403 bytes .../00003.png | Bin 0 -> 598 bytes .../00004.png | Bin 0 -> 478 bytes .../00005.png | Bin 0 -> 424 bytes .../00006.png | Bin 0 -> 433 bytes .../00007.png | Bin 0 -> 491 bytes .../00000.png | Bin 0 -> 345 bytes .../00001.png | Bin 0 -> 943 bytes .../00002.png | Bin 0 -> 403 bytes .../00003.png | Bin 0 -> 598 bytes .../00004.png | Bin 0 -> 478 bytes .../00005.png | Bin 0 -> 424 bytes .../00006.png | Bin 0 -> 433 bytes .../00007.png | Bin 0 -> 491 bytes tests/test_init_contract.py | 40 ++++++++++++++++++ 17 files changed, 40 insertions(+) create mode 100644 tests/snapshots/nanosp/test_init_contract_long_name_and_params/00000.png create mode 100644 tests/snapshots/nanosp/test_init_contract_long_name_and_params/00001.png create mode 100644 tests/snapshots/nanosp/test_init_contract_long_name_and_params/00002.png create mode 100644 tests/snapshots/nanosp/test_init_contract_long_name_and_params/00003.png create mode 100644 tests/snapshots/nanosp/test_init_contract_long_name_and_params/00004.png create mode 100644 tests/snapshots/nanosp/test_init_contract_long_name_and_params/00005.png create mode 100644 tests/snapshots/nanosp/test_init_contract_long_name_and_params/00006.png create mode 100644 tests/snapshots/nanosp/test_init_contract_long_name_and_params/00007.png create mode 100644 tests/snapshots/nanox/test_init_contract_long_name_and_params/00000.png create mode 100644 tests/snapshots/nanox/test_init_contract_long_name_and_params/00001.png create mode 100644 tests/snapshots/nanox/test_init_contract_long_name_and_params/00002.png create mode 100644 tests/snapshots/nanox/test_init_contract_long_name_and_params/00003.png create mode 100644 tests/snapshots/nanox/test_init_contract_long_name_and_params/00004.png create mode 100644 tests/snapshots/nanox/test_init_contract_long_name_and_params/00005.png create mode 100644 tests/snapshots/nanox/test_init_contract_long_name_and_params/00006.png create mode 100644 tests/snapshots/nanox/test_init_contract_long_name_and_params/00007.png diff --git a/tests/snapshots/nanosp/test_init_contract_long_name_and_params/00000.png b/tests/snapshots/nanosp/test_init_contract_long_name_and_params/00000.png new file mode 100644 index 0000000000000000000000000000000000000000..71ff3918c09b0771e34447fbfeec1042aeaff7f3 GIT binary patch literal 345 zcmV-f0jBfzgK=3F000000002sUwn){fgjd& zeU3v2U0>{qrz|c&Jbq)Jqfem8`mkh$$v5r=->|yfiaC18Ape}i*XR>SJ+l+f>0K$C zD!+%OE5MfbB#B)QSWn~Mt4~2mWLI!;JcH?e0l5%DabEg+@cH~*9&fgv;2o*Kcxo_` z?2jb-Bi%Rq_r3Di$yvBW($8BDNP7M8>r%c9P+S;D-mvO1vF#9h``O#o8#-(W6gvv_ zHbW)ga3}SR=a`}u(SFUv8~M^^S&#`KwDfuM`ReL3#w-PBm(<|u&Yps{+~v1zOHS(# r&!yA~%?~$uyA%Kb000000C<&eKQ8z8hzu!#00000NkvXXu0mjf$7P!Z literal 0 HcmV?d00001 diff --git a/tests/snapshots/nanosp/test_init_contract_long_name_and_params/00001.png b/tests/snapshots/nanosp/test_init_contract_long_name_and_params/00001.png new file mode 100644 index 0000000000000000000000000000000000000000..a8adec124c21a4775eaaf0a00a876ff77d220b2a GIT binary patch literal 943 zcmV;g15o^lP)mY!EUC8LmBTttg73D2k#ej`Ovq@of;#bzQ%f%I_cN_vwy%QNqqS#MdPzmizmwIeW7ZjJ z`FuwDSGa?8z{009KLD#dDT<;f3XZRaN{OZ!yDGM5lS-r%dE{b|$~%@P(w_+Gjj#fi z!)mb|P9oHmvU*i5=IS>13_CfqJ^`D9h{LHHaT(l*1qYVuKUpHXEo(?v5C9{rfONR) zDA)+P6G%u4ifjm7L0B4WB7M;_YATca>MrxKzpSF=hU+agIBWzEngLHO*9}Ism|BsE z!|^vZz2wZq3P#eTwcsxLs2F!Ulh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d00001 diff --git a/tests/snapshots/nanosp/test_init_contract_long_name_and_params/00004.png b/tests/snapshots/nanosp/test_init_contract_long_name_and_params/00004.png new file mode 100644 index 0000000000000000000000000000000000000000..3e273d53fc5910cd6d4b5aafff7e28b0efabbafa GIT binary patch literal 478 zcmV<40U`d0P)aZW{mq0C2mn;hHI>J@NT`YB|m7 zM#*M@vyASgl*&x`=rTur@!@`ck5&73@(8M|5uu>wolh6IXybB4ZoNVgA-aSSy?#Cs)9sKk5=`s`aXe!wOK@ zV>H&3-GUnF>(m+J_fO3J?HX<*lUf6xF$b8??XA6>jlJ7sZy49w<3SVi{>p>I0 z0rJ?encJmtn9H?xozFd0SpBWBk(Q0SpP1jJCr-0lc)RNX@ahQw0D^iTlh;_}7&+ti zhU9$lXKT)2 zCio4igUsmPMj2{G|7OG>61z|&zQd8u4ex5lxM$?_%GF3XCL}K7f)RjV1Rxjz2u1)F zw%P&i894v|0BBh40QZcXUbz|x$ArXR!odhYFai*a00bid3tQ~~_lz6>001D~FFNUI UC=yYKg8%>k07*qoM6N<$f;=A|Zs0A%sV!-1C*DJnaNf#yJ200ARVFzG@+a>%x0qx>K!g zl&luG%NSk=p*o9nJnG!Lhx*%B?YqSAsnM6kviq0xzAPilH~REdOFQ=7tKF+llPnph zWIXk0E%|I_b+f|p&+1!M`j^rBbF0F@o1 zzNYLJ)J#9=G20a;WzIcJK>C807NSvZ&9*xheLX}`+u^aW*2-0gPMW=Hik zYY&iT24}97#z`*Lx-|BCt8g4cytuB7wKQ#i_@VhAEqPkg$hn3jV8}=S09Z(#A6DLR zhwq>20esm-yxyCGBR)sJ841|z+yumrAG1Fr+NOMt{uXc8fsamr{3&?9#Y5S34Bd4e zt@QGu2jTxJ2ASwDqlB91FGdb_VinqneRwCr3jhEB000000000000000O!Ehpkc`Y1 S> z**CfWfX1a;H~ZS;j{E=s02tz6_pf%+n>PFPTmNxxJby6^KJBd126owUMvwlL(1pH7 z>uOUmtMlDVsUfP8gTMltATHT#8&!~U?X~wzblSe6~#g;R?v)tPM)eTKs0~_xr ztuSeK8z+YPa3fS^(rE=8qxA(yX#1U)`WrD}qbIW#$v0xJMDm?*CvoZr08A!&MtZWF zvmlZ5`%Xdb#In3V#ly_%@y6Y`w#O{F?qj^Wy~}B8w^g~_)Euqo(SY4wlA(v1q7`v` z&Z`SqT9%t|>p348N zwGSZ}S@K4{XB%*L2*6|>vkiEiyuw_qPJU3$0EzlOf@B6H?-vU{gdmp+su{5TdOw7a zXM(r(gm3`%vJ+#>y)PFDRVkt<`c1z}JQ!3nKyIb? zklY9CtPum%3|IyN0053y;2AE0=gq)4&$|82yGfi-pIDR;s~Rgbvt)b9O+7`G=@@njo+))g&JJD%n-s{sH2 z005qtz8do0IT_CZ@Nz4n7AAW)f11sjGHR{j6$-1w#i0*zszDA4mV*MPpPcZL0XZXU z^FX84!d(FBW0Qks&5m}qS>W_ukdZK+WI;dG-(3cbNTf|cbb-Gs-2!h>aaw|4K_=dg h0RR910001hCqF>|Gp3I3#E}31002ovPDHLkV1g_t(ro|$ literal 0 HcmV?d00001 diff --git a/tests/snapshots/nanox/test_init_contract_long_name_and_params/00000.png b/tests/snapshots/nanox/test_init_contract_long_name_and_params/00000.png new file mode 100644 index 0000000000000000000000000000000000000000..71ff3918c09b0771e34447fbfeec1042aeaff7f3 GIT binary patch literal 345 zcmV-f0jBfzgK=3F000000002sUwn){fgjd& zeU3v2U0>{qrz|c&Jbq)Jqfem8`mkh$$v5r=->|yfiaC18Ape}i*XR>SJ+l+f>0K$C zD!+%OE5MfbB#B)QSWn~Mt4~2mWLI!;JcH?e0l5%DabEg+@cH~*9&fgv;2o*Kcxo_` z?2jb-Bi%Rq_r3Di$yvBW($8BDNP7M8>r%c9P+S;D-mvO1vF#9h``O#o8#-(W6gvv_ zHbW)ga3}SR=a`}u(SFUv8~M^^S&#`KwDfuM`ReL3#w-PBm(<|u&Yps{+~v1zOHS(# r&!yA~%?~$uyA%Kb000000C<&eKQ8z8hzu!#00000NkvXXu0mjf$7P!Z literal 0 HcmV?d00001 diff --git a/tests/snapshots/nanox/test_init_contract_long_name_and_params/00001.png b/tests/snapshots/nanox/test_init_contract_long_name_and_params/00001.png new file mode 100644 index 0000000000000000000000000000000000000000..a8adec124c21a4775eaaf0a00a876ff77d220b2a GIT binary patch literal 943 zcmV;g15o^lP)mY!EUC8LmBTttg73D2k#ej`Ovq@of;#bzQ%f%I_cN_vwy%QNqqS#MdPzmizmwIeW7ZjJ z`FuwDSGa?8z{009KLD#dDT<;f3XZRaN{OZ!yDGM5lS-r%dE{b|$~%@P(w_+Gjj#fi z!)mb|P9oHmvU*i5=IS>13_CfqJ^`D9h{LHHaT(l*1qYVuKUpHXEo(?v5C9{rfONR) zDA)+P6G%u4ifjm7L0B4WB7M;_YATca>MrxKzpSF=hU+agIBWzEngLHO*9}Ism|BsE z!|^vZz2wZq3P#eTwcsxLs2F!UlhG;xqZMpuZ~#&PI1{iz<18boCF8xHa(MFY_%lFy zsb**P;A-A8fW2{)3s%;I#qhwh^)B;SHqE*<_;?E@YIGSlP_%slU-iCA@VOeX6F61u zq{iS*Dhu6-)5$dkTan#6{%xqbUmv2)-IBRY@?a zV`3yTXjur}yegxrt+Vo=SWw~}81ku46Qu&|Vu=u`7Uj=~h9SjT2~>oc=sr z_TYg=gWc!O?`F@=vG8v@OzzyejF%8IY}IZhvoj!)f2>=IJk?i`(r&F< zso=Pi+RerJtT$r+pH+fwQ4~e-21pfw9?N~^^_L~BO#1xZVByfx4pUvwM^0@b>91n# zUi^(%RuIj?gv_9nCJV?-6LlNgVI@_|*h$$f%Q^~&o;3ql0Xzd}87tmFasxK4V|*1H zs7}tz&R5@v^$@dkP*!-%+Kt@s&pNVLJtdX9mU#vAHe^$fJQ)d9Hz!z)x;fCT2%1Z! zHDDI7UK`LUpAO z8GBt}_YEJmalc)(v2t1N(m)4&dG%pJms5gYoXW zce*8ext+RL?)0$S@li|IWqjrDzoHqBuC2Ln_#=CO$v=Tjwle!)n=X@Ry>wFZS8VdM v#x--AKkC+T@#g)#|8Sz=USQ}TgNB*F*+qk(I+l8Vnf)u{Ei8Jh67#< z9AFF_V9Xf~VAJUlId(|B43!)u?&mej(1Cg1F{hl?Q~*J+s>)tJf=3U4XgS;(^YqMGPzqT!NTm90_D=&05niWN0f zKp|YB@KmK2mD6bqk?w>QE}fm8euVEtUl~``z*gvjgHYO9>$AbIC1<&V^$zG%&MFX= z*>2$GkDC1nkJN@%38QosdwnR4&d`U1-|Q@}uFO2*fL6GWgb`ce`&pR-?$~sdC`uO9 zPg=QiR%xgStG0ajdKN}-KcYOOB@up1woueD)&~Fpa3a2HL;LU9hi8zTKK)Zw@Iih~ z**{E`^l`!&bwMSP`FqeD_wqmCOe>g#$sMe&5BM;QMUq!T{ns*1I4=af3^>3TUpYXR k0CdNk00000004Y1|27s5jJ<{$SO5S307*qoM6N<$g7!NMK>z>% literal 0 HcmV?d00001 diff --git a/tests/snapshots/nanox/test_init_contract_long_name_and_params/00004.png b/tests/snapshots/nanox/test_init_contract_long_name_and_params/00004.png new file mode 100644 index 0000000000000000000000000000000000000000..3e273d53fc5910cd6d4b5aafff7e28b0efabbafa GIT binary patch literal 478 zcmV<40U`d0P)aZW{mq0C2mn;hHI>J@NT`YB|m7 zM#*M@vyASgl*&x`=rTur@!@`ck5&73@(8M|5uu>wolh6IXybB4ZoNVgA-aSSy?#Cs)9sKk5=`s`aXe!wOK@ zV>H&3-GUnF>(m+J_fO3J?HX<*lUf6xF$b8??XA6>jlJ7sZy49w<3SVi{>p>I0 z0rJ?encJmtn9H?xozFd0SpBWBk(Q0SpP1jJCr-0lc)RNX@ahQw0D^iTlh;_}7&+ti zhU9$lXKT)2 zCio4igUsmPMj2{G|7OG>61z|&zQd8u4ex5lxM$?_%GF3XCL}K7f)RjV1Rxjz2u1)F zw%P&i894v|0BBh40QZcXUbz|x$ArXR!odhYFai*a00bid3tQ~~_lz6>001D~FFNUI UC=yYKg8%>k07*qoM6N<$f;=A|Zs0A%sV!-1C*DJnaNf#y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/test_init_contract.py index 073baf43..ec8ac144 100644 --- a/tests/test_init_contract.py +++ b/tests/test_init_contract.py @@ -47,3 +47,43 @@ def test_init_contract( assert response.data == bytes.fromhex( "64e166bcc41320198c6fa76ee70f2da8ff9fc365b284d57252635146446028ce5e06791ff422d89e2f73bff4a52b3d587f7ce8ee40ffd590ff37d71f20527809" ) + + +@pytest.mark.active_test_scope +def test_init_contract_long_name_and_params( + backend, firmware, navigator, test_name, default_screenshot_path +): + client = BoilerplateCommandSender(backend) + path = "m/1105/0/0/0/0/2/0/0" + header_and_type = bytes.fromhex( + "20a845815bd43a1999e90fbf971537a70392eb38f89e6bd32b3dd70e1a9551d7000000000000000a0000000000000064000000290000000063de5da701" + ) + amount = 0xFFFFFFFFFFFFFFFF + module_ref = bytes.fromhex( + "a00000000000000000000000000000000000000000000000000000000000000a" + ) + name = "This is the name of the smart contract i am making it way longer than it was before for testing purposes of course".encode( + "utf-8" + ) + name = bytes.fromhex(name.hex()) + params = bytes.fromhex( + "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff" + ) + + with client.init_contract( + path=path, + header_and_type=header_and_type, + amount=amount, + module_ref=module_ref, + name=name, + params=params, + ): + navigate_until_text_and_compare( + firmware, navigator, "Sign", default_screenshot_path, test_name + ) + response = client.get_async_response() + print(response.data.hex()) + assert response.status == 0x9000 + assert response.data == bytes.fromhex( + "9e67c936b7cfd593bf46f9f45f6695d972159aa6ec04549787c64bd0a96c7f861b55b3dc098f0a674f39547b3851eb79ac3942d499c39697ed3bff5fb5193200" + )