diff --git a/.github/workflows/local-interchain.yaml b/.github/workflows/local-interchain.yaml index 8e94e8748..cb7ebd727 100644 --- a/.github/workflows/local-interchain.yaml +++ b/.github/workflows/local-interchain.yaml @@ -13,8 +13,8 @@ env: jobs: build: - runs-on: ubuntu-latest name: build + runs-on: ubuntu-latest defaults: run: working-directory: ./local-interchain @@ -36,10 +36,9 @@ jobs: name: local-ic path: ~/go/bin/local-ic - # TOOO: put the python workflow here. (https://github.com/strangelove-ventures/interchaintest/pull/775) rust-e2e: - name: rust e2e + name: rust needs: build runs-on: ubuntu-latest defaults: @@ -75,5 +74,48 @@ jobs: - name: Run Rust Script run: cd rust && cargo run --package localic-bin --bin localic-bin + - name: Cleanup + run: killall local-ic && exit 0 + + python-e2e: + name: python + needs: build + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./local-interchain + strategy: + matrix: + test: + - ["api_test", 8081] + - ["ibc_contract", 8082] + fail-fast: false + + steps: + - name: checkout chain + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + cache: 'pip' + - run: pip install -r python/requirements.txt --break-system-packages + + - name: Download Tarball Artifact + uses: actions/download-artifact@v3 + with: + name: local-ic + path: /tmp + + - name: Make local-ic executable + run: chmod +x /tmp/local-ic + + - name: Start background ibc local-interchain + run: /tmp/local-ic start juno_ibc --api-port ${{ matrix.test[1] }} & + + - name: Run Python Script + run: python3 ./python/${{ matrix.test[0] }}.py --api-port ${{ matrix.test[1] }} + - name: Cleanup run: killall local-ic && exit 0 \ No newline at end of file diff --git a/go.work.sum b/go.work.sum index efa1b1b8a..4bf974455 100644 --- a/go.work.sum +++ b/go.work.sum @@ -51,6 +51,7 @@ cloud.google.com/go/essentialcontacts v1.6.2/go.mod h1:T2tB6tX+TRak7i88Fb2N9Ok3P cloud.google.com/go/eventarc v1.13.0/go.mod h1:mAFCW6lukH5+IZjkvrEss+jmt2kOdYlN8aMx3sRJiAI= cloud.google.com/go/filestore v1.7.1/go.mod h1:y10jsorq40JJnjR/lQ8AfFbbcGlw3g+Dp8oN7i7FjV4= cloud.google.com/go/firestore v1.11.0/go.mod h1:b38dKhgzlmNNGTNZZwe7ZRFEuRab1Hay3/DBsIGKKy4= +cloud.google.com/go/firestore v1.12.0/go.mod h1:b38dKhgzlmNNGTNZZwe7ZRFEuRab1Hay3/DBsIGKKy4= cloud.google.com/go/functions v1.15.1/go.mod h1:P5yNWUTkyU+LvW/S9O6V+V423VZooALQlqoXdoPz5AE= cloud.google.com/go/gkebackup v1.3.0/go.mod h1:vUDOu++N0U5qs4IhG1pcOnD1Mac79xWy6GoBFlWCWBU= cloud.google.com/go/gkeconnect v0.8.1/go.mod h1:KWiK1g9sDLZqhxB2xEuPV8V9NYzrqTUmQR9shJHpOZw= @@ -403,10 +404,12 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/oauth2 v0.0.0-20170207211851-4464e7848382/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= golang.org/x/perf v0.0.0-20230113213139-801c7ef9e5c5/go.mod h1:UBKtEnL8aqnd+0JHqZ+2qoMDwtuy6cYhhKNoHLBiTQc= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -428,6 +431,7 @@ golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -457,10 +461,12 @@ google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51 google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98/go.mod h1:S7mY02OqCJTD0E1OiQy1F72PWFB4bZJ87cAtLPYgDR0= google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/genproto/googleapis/rpc v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:8mL13HKkDa+IuJ8yruA3ci0q+0vsUz4m//+ottjwS5o= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I= google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v0.0.0-20170208002647-2a6bf6142e96/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= @@ -470,6 +476,7 @@ google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpX google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/local-interchain/go.mod b/local-interchain/go.mod index d35abd449..28673c68d 100644 --- a/local-interchain/go.mod +++ b/local-interchain/go.mod @@ -25,7 +25,7 @@ require ( ) require ( - cloud.google.com/go v0.110.6 // indirect + cloud.google.com/go v0.110.7 // indirect cloud.google.com/go/compute v1.23.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.1 // indirect @@ -115,7 +115,7 @@ require ( github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.3 // indirect - github.com/golang/glog v1.1.0 // indirect + github.com/golang/glog v1.1.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.3 // indirect @@ -124,7 +124,7 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/google/s2a-go v0.1.4 // indirect - github.com/google/uuid v1.3.0 // indirect + github.com/google/uuid v1.3.1 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect github.com/googleapis/gax-go/v2 v2.11.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect @@ -229,7 +229,7 @@ require ( golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/oauth2 v0.10.0 // indirect + golang.org/x/oauth2 v0.11.0 // indirect golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/term v0.13.0 // indirect @@ -238,10 +238,10 @@ require ( golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.126.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect + google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb // indirect - google.golang.org/grpc v1.58.3 // indirect + google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/local-interchain/go.sum b/local-interchain/go.sum index 5120d30ec..17b12f6bb 100644 --- a/local-interchain/go.sum +++ b/local-interchain/go.sum @@ -32,8 +32,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.110.6 h1:8uYAkj3YHTP/1iwReuHPxLSbdcyc+dSBbzFMrVwDR6Q= -cloud.google.com/go v0.110.6/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= +cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o= +cloud.google.com/go v0.110.7/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -544,8 +544,8 @@ github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2 github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= +github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -644,8 +644,9 @@ github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= @@ -1293,6 +1294,7 @@ golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1318,8 +1320,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= +golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= +golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1705,10 +1707,10 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= -google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e h1:z3vDksarJxsAKM5dmEGv0GHwE2hKJ096wZra71Vs4sw= -google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb h1:Isk1sSH7bovx8Rti2wZK0UZF6oraBDK74uoyLEEVFN0= google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -1752,8 +1754,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/local-interchain/python/api_test.py b/local-interchain/python/api_test.py new file mode 100644 index 000000000..16315a6d3 --- /dev/null +++ b/local-interchain/python/api_test.py @@ -0,0 +1,122 @@ +# flake8: noqa +""" +This test the rest server to ensures it functions properly. + +local-ic start base +""" + +import time + +from helpers.testing import poll_for_start +from helpers.transactions import RequestBuilder +from util_base import API_URL + +chain_id = "localjuno-1" +sleep_seconds = 3 + + +rb = RequestBuilder(API_URL, chain_id, sleep_seconds, log_output=True) + + +def main(): + poll_for_start(API_URL, waitSeconds=120) + + bin_test() + tx_test() + + +# Test to ensure the base layer works and returns data properly +def bin_test(): + res = rb.binary("keys list --keyring-backend=test --output=json") + assert len(res) > 0 + + res = rb.binary( + "tx decode ClMKUQobL2Nvc21vcy5nb3YudjFiZXRhMS5Nc2dWb3RlEjIIpwISK2p1bm8xZGM3a2MyZzVrZ2wycmdmZHllZGZ6MDl1YTlwZWo1eDNsODc3ZzcYARJmClAKRgofL2Nvc21vcy5jcnlwdG8uc2VjcDI1NmsxLlB1YktleRIjCiECxjGMmYp4MlxxfFWi9x4u+jOleJVde3Cru+HnxAVUJmgSBAoCCH8YNBISCgwKBXVqdW5vEgMyMDQQofwEGkDPE4dCQ4zUh6LIB9wqNXDBx+nMKtg0tEGiIYEH8xlw4H8dDQQStgAe6xFO7I/oYVSWwa2d9qUjs9qyB8r+V0Gy", + ignore_pause=True, + ) + print(res) + assert res == { + "body": { + "messages": [ + { + "@type": "/cosmos.gov.v1beta1.MsgVote", + "proposal_id": "295", + "voter": "juno1dc7kc2g5kgl2rgfdyedfz09ua9pej5x3l877g7", + "option": "VOTE_OPTION_YES", + } + ], + "memo": "", + "timeout_height": "0", + "extension_options": [], + "non_critical_extension_options": [], + }, + "auth_info": { + "signer_infos": [ + { + "public_key": { + "@type": "/cosmos.crypto.secp256k1.PubKey", + "key": "AsYxjJmKeDJccXxVovceLvozpXiVXXtwq7vh58QFVCZo", + }, + "mode_info": {"single": {"mode": "SIGN_MODE_LEGACY_AMINO_JSON"}}, + "sequence": "52", + } + ], + "fee": { + "amount": [{"denom": "ujuno", "amount": "204"}], + "gas_limit": "81441", + "payer": "", + "granter": "", + }, + "tip": None, + }, + "signatures": [ + "zxOHQkOM1IeiyAfcKjVwwcfpzCrYNLRBoiGBB/MZcOB/HQ0EErYAHusRTuyP6GFUlsGtnfalI7PasgfK/ldBsg==" + ], + } + + rb.binary("config keyring-backend test") + assert rb.binary("config") == { + "chain-id": "", + "keyring-backend": "test", + "output": "text", + "node": "tcp://localhost:26657", + "broadcast-mode": "sync", + "gas": "", + "gas-prices": "", + "gas-adjustment": "", + "fees": "", + "fee-granter": "", + "fee-payer": "", + "note": "", + } + + assert len(rb.binary("keys list --output=json")) > 0 + + # this query returns a dict with supply as the key, validate it is there + assert "supply" in rb.query("bank total") + + d = rb.query( + "bank balances juno10r39fueph9fq7a6lgswu4zdsg8t3gxlq670lt0 --output=json" + ) + assert len(d["balances"]) == 0 + + +# Test to ensure Transactions and getting that data returns properly +def tx_test(): + res = rb.binary( + "tx bank send acc0 juno10r39fueph9fq7a6lgswu4zdsg8t3gxlq670lt0 500ujuno --fees 5000ujuno --node %RPC% --chain-id=%CHAIN_ID% --yes --output json --keyring-backend=test" + ) + assert res["code"] == 0 + + tx_data = rb.query_tx(res) + print(tx_data) + + bal = rb.query( + "bank balances juno10r39fueph9fq7a6lgswu4zdsg8t3gxlq670lt0 --output=json" + ) + print(bal) + assert len(bal["balances"]) > 0 + + +if __name__ == "__main__": + main() diff --git a/local-interchain/scripts/daodao.py b/local-interchain/python/daodao.py similarity index 97% rename from local-interchain/scripts/daodao.py rename to local-interchain/python/daodao.py index 70591f3c4..ee1717267 100644 --- a/local-interchain/scripts/daodao.py +++ b/local-interchain/python/daodao.py @@ -10,6 +10,7 @@ import os from helpers import CosmWasm +from helpers.testing import poll_for_start from helpers.transactions import RequestBuilder from util_base import API_URL @@ -18,6 +19,8 @@ def main(): + poll_for_start(API_URL, waitSeconds=120) + rb = RequestBuilder(API_URL, chain_id) rb.binary("config keyring-backend test") diff --git a/local-interchain/scripts/helpers/__init__.py b/local-interchain/python/helpers/__init__.py similarity index 100% rename from local-interchain/scripts/helpers/__init__.py rename to local-interchain/python/helpers/__init__.py diff --git a/local-interchain/scripts/helpers/cosmwasm.py b/local-interchain/python/helpers/cosmwasm.py similarity index 97% rename from local-interchain/scripts/helpers/cosmwasm.py rename to local-interchain/python/helpers/cosmwasm.py index 2d27831cf..44fe83d09 100644 --- a/local-interchain/scripts/helpers/cosmwasm.py +++ b/local-interchain/python/helpers/cosmwasm.py @@ -1,10 +1,13 @@ +# flake8: noqa + import json import os from base64 import b64decode, b64encode +from httpx import get, post + from helpers.file_cache import Cache from helpers.transactions import RequestBuilder, get_transaction_response -from httpx import get, post fp = os.path.realpath(__file__) root_dir = os.path.dirname(os.path.dirname(os.path.dirname(fp))) @@ -61,16 +64,13 @@ def get_latest_tx_hash(self) -> str: def store_contract(self, key_name: str, abs_path: str) -> "CosmWasm": ictest_chain_start = Cache.get_chain_start_time_from_logs() if ictest_chain_start == -1: - return self - - Cache.default_contracts_json() + ictest_chain_start = 0 + Cache.reset_contracts_cache_json() contracts = Cache.get_cache_or_default({}, ictest_chain_start) - sha1 = Cache.get_file_hash(abs_path, self.chain_id) if sha1 in contracts["file_cache"]: self.code_id = contracts["file_cache"][sha1] - sub_file_path = abs_path.split("/")[-1] print(f"[Cache] CodeID={self.code_id} for {sub_file_path}") return self @@ -167,7 +167,11 @@ def remove_msg_spaces(msg: dict): def get_contract_address(rb: RequestBuilder, tx_hash: str) -> str: res_json = rb.query(f"tx {tx_hash} --output=json") - code = int(res_json["code"]) + try: + code = int(res_json["code"]) + except: + code = -1 + if code != 0: raw = res_json["raw_log"] return raw diff --git a/local-interchain/scripts/example_req.bash b/local-interchain/python/helpers/example_req.bash similarity index 100% rename from local-interchain/scripts/example_req.bash rename to local-interchain/python/helpers/example_req.bash diff --git a/local-interchain/scripts/helpers/file_cache.py b/local-interchain/python/helpers/file_cache.py similarity index 79% rename from local-interchain/scripts/helpers/file_cache.py rename to local-interchain/python/helpers/file_cache.py index 3c3297884..a0c194b9f 100644 --- a/local-interchain/scripts/helpers/file_cache.py +++ b/local-interchain/python/helpers/file_cache.py @@ -1,3 +1,4 @@ +# flakes8: noqa E501 import hashlib import json import os @@ -12,7 +13,7 @@ class Cache: @staticmethod - def default_contracts_json(): + def reset_contracts_cache_json(): if not os.path.exists(contracts_json_path): with open(contracts_json_path, "w") as f: f.write(json.dumps({"start_time": 0, "file_cache": {}})) @@ -22,15 +23,24 @@ def get_chain_start_time_from_logs() -> int: with open(logs_path, "r") as f: logs = dict(json.load(f)) - return int(logs.get("start_time", -1)) + res = logs.get("start_time", -1) + if isinstance(res, str): + res = res.replace("\n", "") + + return int(res) @staticmethod def get_cache_or_default(contracts: dict, ictest_chain_start: int) -> dict: - with open(contracts_json_path, "r") as f: - cache_time = dict(json.load(f)).get("start_time", 0) + cache_time: str | int = 0 + if os.path.exists(contracts_json_path): + with open(contracts_json_path, "r") as f: + c = dict(json.load(f)) + cache_time = c.get("start_time", 0) + if isinstance(cache_time, str): + cache_time = cache_time.replace("\n", "") if cache_time == 0 or cache_time != ictest_chain_start: - # reset cache, and set cache time to current interchain_test time # noqa + # reset cache, and set cache time to current interchain_test time contracts["start_time"] = ictest_chain_start contracts["file_cache"] = {} @@ -72,4 +82,4 @@ def get_file_hash(rel_file_path: str, chain_id: str) -> str: # We always run this to start. -Cache.default_contracts_json() +Cache.reset_contracts_cache_json() diff --git a/local-interchain/scripts/helpers/relayer.py b/local-interchain/python/helpers/relayer.py similarity index 100% rename from local-interchain/scripts/helpers/relayer.py rename to local-interchain/python/helpers/relayer.py diff --git a/local-interchain/python/helpers/testing.py b/local-interchain/python/helpers/testing.py new file mode 100644 index 000000000..0ea6c7b21 --- /dev/null +++ b/local-interchain/python/helpers/testing.py @@ -0,0 +1,17 @@ +import time + +import httpx + + +def poll_for_start(API_URL: str, waitSeconds=120): + for i in range(waitSeconds + 1): + try: + httpx.get(API_URL) + return + except Exception: + if i % 5 == 0: + print(f"waiting for server to start (iter:{i}) ({API_URL})") + + time.sleep(1) + + raise Exception("Local-IC REST API Server did not start") diff --git a/local-interchain/scripts/helpers/transactions.py b/local-interchain/python/helpers/transactions.py similarity index 85% rename from local-interchain/scripts/helpers/transactions.py rename to local-interchain/python/helpers/transactions.py index 6bca832c8..1be3e0c0f 100644 --- a/local-interchain/scripts/helpers/transactions.py +++ b/local-interchain/python/helpers/transactions.py @@ -1,6 +1,7 @@ import json from dataclasses import dataclass from enum import Enum +from time import sleep from httpx import post @@ -62,10 +63,14 @@ def to_json(self) -> dict: class RequestBuilder: - def __init__(self, api: str, chain_id: str, log_output: bool = False): + # sleep_sec only applies if the request cmd starts with 'tx' + def __init__( + self, api: str, chain_id: str, sleep_sec: int = 6, log_output: bool = False + ): self.api = api self.chain_id = chain_id self.log = log_output + self.sleep_sec = sleep_sec if self.api == "": raise Exception("RequestBuilder api is empty") @@ -73,10 +78,14 @@ def __init__(self, api: str, chain_id: str, log_output: bool = False): if self.chain_id == "": raise Exception("RequestBuilder chain_id is empty") - def binary(self, cmd: str, log_output: bool = False) -> dict: + def binary(self, cmd: str, ignore_pause=False, log_output: bool = False) -> dict: rb = RequestBase(self.api, self.chain_id, RequestType.BIN) return send_request( - rb, cmd, log_output=(log_output if log_output else self.log) + rb, + self.sleep_sec, + cmd, + ignore_pause, + log_output=(log_output if log_output else self.log), ) def query(self, cmd: str, log_output: bool = False) -> dict: @@ -87,7 +96,7 @@ def query(self, cmd: str, log_output: bool = False) -> dict: rb = RequestBase(self.api, self.chain_id, RequestType.QUERY) return send_request( - rb, cmd, log_output=(log_output if log_output else self.log) + rb, 0, cmd, log_output=(log_output if log_output else self.log) ) # What / when is response? @@ -105,7 +114,9 @@ def query_tx(self, response: str | dict, log_output: bool = False) -> dict: def send_request( base: RequestBase, + sleep_sec: int, cmd: str = "", + ignore_pause: bool = False, return_text: bool = False, log_output: bool = False, ) -> dict: @@ -126,6 +137,9 @@ def send_request( headers={"Content-Type": "application/json"}, ) + if cmd.startswith("tx") and not ignore_pause: + sleep(sleep_sec) + if log_output: if res.text != "{}": print("[send_request resp]", res.text) diff --git a/local-interchain/scripts/ibc_contract.py b/local-interchain/python/ibc_contract.py similarity index 94% rename from local-interchain/scripts/ibc_contract.py rename to local-interchain/python/ibc_contract.py index 98a5adcb3..f105a1f85 100644 --- a/local-interchain/scripts/ibc_contract.py +++ b/local-interchain/python/ibc_contract.py @@ -1,5 +1,6 @@ +# flake8: noqa # -# SHows how to relay between contracts +# Shows how to relay between contracts """. @@ -23,6 +24,7 @@ from helpers.cosmwasm import CosmWasm from helpers.relayer import Relayer +from helpers.testing import poll_for_start from helpers.transactions import RequestBuilder from util_base import API_URL @@ -48,6 +50,8 @@ def main(): relayer = Relayer(API_URL, chain_id) + poll_for_start(API_URL, waitSeconds=120) + if True: print("⚙️ Setting env configuration") setup_env( @@ -123,6 +127,7 @@ def main(): {"get_count": {"channel": "channel-1"}} ) print(f"{contract1_res=}") + assert contract1_res["data"]["count"] == 1 if __name__ == "__main__": diff --git a/local-interchain/python/requirements.txt b/local-interchain/python/requirements.txt new file mode 100644 index 000000000..79228389f --- /dev/null +++ b/local-interchain/python/requirements.txt @@ -0,0 +1 @@ +httpx \ No newline at end of file diff --git a/local-interchain/python/util_base.py b/local-interchain/python/util_base.py new file mode 100644 index 000000000..989dd9c1e --- /dev/null +++ b/local-interchain/python/util_base.py @@ -0,0 +1,40 @@ +import argparse +import json +import os + +current_dir = os.path.dirname(os.path.realpath(__file__)) +parent_dir = os.path.dirname(current_dir) + +contracts_path = os.path.join(parent_dir, "contracts") + +contracts_json_path = os.path.join(parent_dir, "configs", "contracts.json") + + +# create contracts folder if not already +if not os.path.exists(contracts_path): + os.mkdir(contracts_path) + +HOST = "127.0.0.1" +PORT = 8080 + +# == Setup global parsers == +parser = argparse.ArgumentParser( + prog="api_test.py", + description="Test the rest server to ensure it functions properly.", +) + +parser.add_argument( + "--api-address", + type=str, + default=HOST, + help="The host/address to use for the rest server.", +) +parser.add_argument( + "--api-port", + type=int, + default=PORT, + help="The port to use for the rest server.", +) +args = parser.parse_args() + +API_URL = f"http://{args.api_address}:{args.api_port}" diff --git a/local-interchain/scripts/api_test.py b/local-interchain/scripts/api_test.py deleted file mode 100644 index 739f4735c..000000000 --- a/local-interchain/scripts/api_test.py +++ /dev/null @@ -1,57 +0,0 @@ -# flake8: noqa -""" -This test the rest server to ensures it functions properly. - -local-ic start base -""" - - -from helpers.transactions import RequestBuilder -from util_base import API_URL - -chain_id = "localjuno-1" - - -rb = RequestBuilder(API_URL, chain_id, log_output=True) - - -def main(): - bin_test() - tx_test() - - -# Test to ensure the base layer works and returns data properly -def bin_test(): - rb.binary("keys list --keyring-backend=test --output=json") - - rb.binary( - "tx decode ClMKUQobL2Nvc21vcy5nb3YudjFiZXRhMS5Nc2dWb3RlEjIIpwISK2p1bm8xZGM3a2MyZzVrZ2wycmdmZHllZGZ6MDl1YTlwZWo1eDNsODc3ZzcYARJmClAKRgofL2Nvc21vcy5jcnlwdG8uc2VjcDI1NmsxLlB1YktleRIjCiECxjGMmYp4MlxxfFWi9x4u+jOleJVde3Cru+HnxAVUJmgSBAoCCH8YNBISCgwKBXVqdW5vEgMyMDQQofwEGkDPE4dCQ4zUh6LIB9wqNXDBx+nMKtg0tEGiIYEH8xlw4H8dDQQStgAe6xFO7I/oYVSWwa2d9qUjs9qyB8r+V0Gy" - ) - - rb.binary("config keyring-backend test") - rb.binary("config") - - rb.binary("keys list --output=json") - - rb.query("bank total") - - rb.query("bank balances juno10r39fueph9fq7a6lgswu4zdsg8t3gxlq670lt0 --output=json") - - -# Test to ensure Transactions and getting that data returns properly -def tx_test(): - res = rb.binary( - "tx bank send acc0 juno10r39fueph9fq7a6lgswu4zdsg8t3gxlq670lt0 500ujuno --fees 5000ujuno --node %RPC% --chain-id=%CHAIN_ID% --yes --output json --keyring-backend=test" - ) - tx_data = rb.query_tx(res) - print(tx_data) - - print( - rb.query( - "bank balances juno10r39fueph9fq7a6lgswu4zdsg8t3gxlq670lt0 --output=json" - ) - ) - - -if __name__ == "__main__": - main() diff --git a/local-interchain/scripts/util_base.py b/local-interchain/scripts/util_base.py deleted file mode 100644 index 29468c227..000000000 --- a/local-interchain/scripts/util_base.py +++ /dev/null @@ -1,28 +0,0 @@ -import json -import os - -from helpers.file_cache import Cache - -current_dir = os.path.dirname(os.path.realpath(__file__)) -parent_dir = os.path.dirname(current_dir) - -contracts_path = os.path.join(parent_dir, "contracts") - -contracts_json_path = os.path.join(parent_dir, "configs", "contracts.json") - - -Cache.default_contracts_json() - - -# create contracts folder if not already -if not os.path.exists(contracts_path): - os.mkdir(contracts_path) - -server_config = {} -with open(os.path.join(parent_dir, "configs", "server.json")) as f: - server_config = json.load(f)["server"] - -PORT = server_config["port"] -HOST = server_config["host"] - -API_URL = f"http://{HOST}:{PORT}"