diff --git a/.vscode/settings.json b/.vscode/settings.json index e9d9543..883aaf8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,9 +3,6 @@ "cSpell.words": [ "ABIID", "Debugf", - "ffcapi", - "ffcapiconnector", - "ffcapiconnectormocks", "ffcmocks", "fftypes", "hashicorp", diff --git a/Makefile b/Makefile index ef6fafa..80ec1ad 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,6 @@ endef $(eval $(call makemock, internal/contractregistry, ContractStore, contractregistrymocks)) $(eval $(call makemock, internal/contractregistry, RemoteRegistry, contractregistrymocks)) $(eval $(call makemock, internal/eth, RPCClient, ethmocks)) -$(eval $(call makemock, internal/ffcapiconnector, FFCServer, ffcapiconnectormocks)) $(eval $(call makemock, internal/receipts, ReceiptStorePersistence, receiptsmocks)) $(eval $(call makemock, $$(SARAMA_PATH), Client, saramamocks)) $(eval $(call makemock, $$(SARAMA_PATH), ConsumerGroup, saramamocks)) diff --git a/README.md b/README.md index 73aeb86..310c51f 100644 --- a/README.md +++ b/README.md @@ -2,33 +2,13 @@ ## EthConnect - Hyperledger FireFly connector for Ethereum networks -This repo has evolved and now contains two related components of the Hyperledger FireFly -ecosystem. +This repo contains the original implementation of the FireFly Connector +for Ethereum networks. -## 1) FireFly EthConnect FFCAPI Connector - for public networks - -See [FireFly architecture for public chains](https://hyperledger.github.io/firefly/overview/public_vs_permissioned.html#firefly-architecture-for-public-chains) in the Hyperledger FireFly -documentation for details on how the requirements for transaction -management in public chains (confirmations, gas management, policy-based -transaction re-submission) are managed. - -In this architecture, the policy engine of -[FireFly Transaction Manager](https://github.com/hyperledger/firefly-transaction-manager) works in tandem with FireFly Core to form a sophisticated "brain" for managing -transactions through from submission to eventual mining (whether that -takes seconds, hours or days). - -The connectors themselves are highly pluggable, and easy to build for a new -blockchain ecosystem. The first reference implementation of the FireFly Connector API (FFCAPI) -is provided in this repo: - -- See the [internal/ffcapiconnector](./internal/ffcapiconnector) folder for that implementation - -> A separate trimmed-down repository containing just a reference FFCAPI connector -> for EVM-based blockchain networks is a roadmap item for the Hyperledger FireFly community. -> Related to this is the [hyperledger/firefly-signer](https://github.com/hyperledger/firefly-signer) -> repo, which contains RLP encoding, and signing utility functions (Apache 2.0 licensed). - -## 2) FireFly EthConnect REST Gateway - for permissioned chains +> For new projects, you are recommended to use the full Hyperledger FireFly +> project stack - and consider using the new\ +> [EVMConnect](https://github.com/hyperledger/firefly-evmconnect) connector +> for connectivity to your EVM based chains (whether public, or private). Since creation in 2018 a large amount of function has evolved through use in production projects. Primarily this function has been driven by diff --git a/go.mod b/go.mod index d6f65fe..65c79d9 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d - github.com/hyperledger/firefly-common v0.1.4 + github.com/hyperledger/firefly-common v1.1.1 github.com/icza/dyno v0.0.0-20210726202311-f1bafe5d9996 github.com/julienschmidt/httprouter v1.3.0 github.com/kaleido-io/ethbinding v0.0.0-20220405144420-999853435d9e @@ -34,13 +34,11 @@ require ( github.com/nwaples/rardecode v1.1.3 // indirect github.com/oklog/ulid/v2 v2.0.2 github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.1 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/sirupsen/logrus v1.8.1 github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cobra v1.4.0 - github.com/spf13/viper v1.11.0 // indirect - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/tidwall/gjson v1.14.1 github.com/tklauser/go-sysconf v0.3.10 // indirect @@ -49,12 +47,7 @@ require ( github.com/x-cray/logrus-prefixed-formatter v0.5.2 github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect - golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9 // indirect - golang.org/x/net v0.0.0-20220516155154-20f960328961 // indirect - golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a // indirect - golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 // indirect gopkg.in/yaml.v2 v2.4.0 - gopkg.in/yaml.v3 v3.0.0-20220512140231-539c8e751b99 // indirect ) replace github.com/kaleido-io/ethbinding => ../ethbinding diff --git a/go.sum b/go.sum index cd06cc1..40f586d 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,8 @@ cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= +cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= +cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= @@ -66,6 +68,7 @@ github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiU github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k= github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go v49.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= @@ -77,12 +80,16 @@ github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSW github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= +github.com/Azure/go-autorest/autorest v0.11.13/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw= github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= +github.com/Azure/go-autorest/autorest/adal v0.9.8/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= github.com/Azure/go-autorest/autorest/adal v0.9.14/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= +github.com/Azure/go-autorest/autorest/azure/auth v0.5.5/go.mod h1:ptW4D47I+eIUe/lulFLYTVfG4rAARZoXIe1vmTQ+ol8= +github.com/Azure/go-autorest/autorest/azure/cli v0.4.2/go.mod h1:7qkJkT+j6b+hIpzMOwPChJhTqS8VbsqqgULzMNRugoM= github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= @@ -91,17 +98,21 @@ github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxB github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= +github.com/Azure/go-autorest/autorest/to v0.4.0/go.mod h1:fE8iZBn7LQR7zH/9XU2NcPR4o9jEImooCeWJcYV/zLE= +github.com/Azure/go-autorest/autorest/validation v0.3.0/go.mod h1:yhLgjC0Wda5DYXl6JAsWyUe4KVNffhoDhG0zVzUMo3E= github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962/go.mod h1:kC29dT1vFpj7py2OvG1khBdQpo3kInWP+6QipLbdngo= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/squirrel v1.5.2/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= @@ -130,10 +141,12 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= +github.com/Shopify/sarama v1.30.0/go.mod h1:zujlQQx1kzHsh4jfV1USnptCQrHAEZ2Hk8fTKCulPVs= github.com/Shopify/sarama v1.32.0 h1:P+RUjEaRU0GMMbYexGMDyrMkLhbbBVUVISDywi+IlFU= github.com/Shopify/sarama v1.32.0/go.mod h1:+EmJJKZWVT/faR9RcOxJerP+LId4iWdQPBGLy1Y1Njs= github.com/Shopify/sarama v1.33.0 h1:2K4mB9M4fo46sAM7t6QTsmSO8dLX1OqznLM7vn3OjZ8= github.com/Shopify/sarama v1.33.0/go.mod h1:lYO7LwEBkE0iAeTl94UfPSrDaavFzSFlmn+5isARATQ= +github.com/Shopify/toxiproxy/v2 v2.1.6-0.20210914104332-15ea381dcdae/go.mod h1:/cvHQkZ1fst0EmZnA5dFtiQdWCNCFYzb+uE2vqVgvx0= github.com/Shopify/toxiproxy/v2 v2.3.0/go.mod h1:KvQTtB6RjCJY4zqNJn7C7JDFgsG5uoHYDirfUfpIm0c= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= @@ -150,6 +163,7 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/amoghe/go-crypt v0.0.0-20191109212615-b2ff80594b7f/go.mod h1:eFiR01PwTcpbzXtdMces7zxg6utvFM5puiWHpWB8D/k= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= @@ -164,6 +178,7 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.36.30/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= github.com/aws/aws-sdk-go-v2 v1.8.0/go.mod h1:xEFuWz+3TYdlPRuo+CqATbeDWIWyaT5uAPwPaWtgse0= github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= @@ -222,6 +237,8 @@ github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= +github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= +github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= github.com/btcsuite/btcd/btcec/v2 v2.1.2/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.1.3 h1:xM/n3yIhHAhHy04z4i43C8p4ehixJZMsnrVJkgl+MTE= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= @@ -386,6 +403,7 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -416,6 +434,7 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dhui/dktest v0.3.7/go.mod h1:nYMOkafiA07WchSwKnKFUSbGMb2hMm5DrCGiXYG6gwM= +github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= @@ -424,6 +443,7 @@ github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TT github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v1.6.2/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v20.10.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= @@ -436,6 +456,7 @@ github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNE github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q= github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo= @@ -463,14 +484,19 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= +github.com/ethereum/go-ethereum v1.10.16/go.mod h1:Anj6cxczl+AHy63o4X9O8yWNHuN5wMpfb8MAnHkWn7Y= github.com/ethereum/go-ethereum v1.10.17 h1:XEcumY+qSr1cZQaWsQs5Kck3FHB0V2RiMHPdTBJ+oT8= github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= +github.com/ethereum/go-ethereum v1.10.23 h1:Xk8XAT4/UuqcjMLIMF+7imjkg32kfVFKoeyQDaO2yWM= +github.com/ethereum/go-ethereum v1.10.23/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= @@ -490,11 +516,13 @@ github.com/fsouza/fake-gcs-server v1.17.0/go.mod h1:D1rTE4YCyHFNa99oyJJ5HyclvN/0 github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= github.com/gabriel-vasile/mimetype v1.3.1/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8= github.com/gabriel-vasile/mimetype v1.4.0/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8= +github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getkin/kin-openapi v0.94.1-0.20220401165309-136a868a30c2/go.mod h1:LWZfzOd7PRy8GJ1dJ6mCU6tNdSfOwRac1BUPam4aw6Q= +github.com/getkin/kin-openapi v0.96.0/go.mod h1:w4lRPHiyOdwGbOkLIyk+P0qCwlu7TXPCHD/64nSXzgE= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 h1:DujepqpGd1hyOd7aW59XpK7Qymp8iy83xq74fLr21is= @@ -529,9 +557,11 @@ github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUe github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= github.com/go-openapi/spec v0.20.5 h1:skHa8av4VnAtJU5zyAUXrrdK/NDiVX8lchbG+BfcdrE= github.com/go-openapi/spec v0.20.5/go.mod h1:QbfOSIVt3/sac+a1wzmKbbcLXm5NdZnyBZYtCijp43o= github.com/go-openapi/spec v0.20.6 h1:ich1RQ3WDbfoeTqTAb+5EIxNmpKVJZWBNah9RAT0jIQ= @@ -656,6 +686,7 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v35 v35.2.0/go.mod h1:s0515YVTI+IMrDoy9Y4pHt9ShGpzHvHO8rZ7L7acgvs= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -686,6 +717,7 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/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.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0/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= @@ -695,6 +727,7 @@ github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pf github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= +github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -722,6 +755,7 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= @@ -779,7 +813,9 @@ github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpT github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huin/goupnp v1.0.2/go.mod h1:0dxJBVBHqTMjIUMkESDTNgOOx/Mw5wYIfyFmdzSamkM= github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= +github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= github.com/hyperledger/firefly-common v0.1.2-0.20220505012722-b17e8af423d7 h1:Cac5/8GU4FgqC6fLEOWatPT44p2wgxpbpDNMqmmHL7w= github.com/hyperledger/firefly-common v0.1.2-0.20220505012722-b17e8af423d7/go.mod h1:ytB+404+Qg00wJKx602Yi/V6Spx9d0g65lZR9y5fzlo= @@ -787,6 +823,11 @@ github.com/hyperledger/firefly-common v0.1.2 h1:zwz7WAHrK5we8bku7FO1rGZSFY+N4sDO github.com/hyperledger/firefly-common v0.1.2/go.mod h1:ytB+404+Qg00wJKx602Yi/V6Spx9d0g65lZR9y5fzlo= github.com/hyperledger/firefly-common v0.1.4 h1:wjZgYZohimKVlBxF3lZmrymVbHwgUIZQshQtE2AQvgQ= github.com/hyperledger/firefly-common v0.1.4/go.mod h1:ytB+404+Qg00wJKx602Yi/V6Spx9d0g65lZR9y5fzlo= +github.com/hyperledger/firefly-common v0.1.13/go.mod h1:2NqPi5Ud9H6rSlZXkLbotxW7z4EAD89p3/8oNOpm9Gs= +github.com/hyperledger/firefly-common v1.1.1 h1:HZE8EP07M6ew1iY/38NpSZlAgkeQfKx1+QPaoqgCaUc= +github.com/hyperledger/firefly-common v1.1.1/go.mod h1:gMlv4Iy5JjnzXmSEdb+tWVDIc/2GhL9MRcgNX+VmI4M= +github.com/hyperledger/firefly-ethconnect v0.0.0-20220420003920-96678897259c/go.mod h1:tUS5S4MHLeojiDYofs6gFnOj9iZztkcUPXXOnnnOGoY= +github.com/hyperledger/firefly-signer v0.9.19/go.mod h1:GPQRUZOFOAjkLmg8GDjZUjEdUD0gcar+CSVhwltIwyw= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -810,6 +851,7 @@ github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19y github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= +github.com/invopop/yaml v0.1.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= @@ -948,6 +990,7 @@ github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4= +github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= @@ -1066,12 +1109,14 @@ github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+ github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8/go.mod h1:86wM1zFnC6/uDBfZGNwB65O+pR2OFi5q/YQaEUid1qA= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= +github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba/go.mod h1:ncO5VaFWh0Nrt+4KT4mOZboaczBZcLuHrG+/sUeP8gI= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= +github.com/nwaples/rardecode v1.1.2/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc= github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -1142,6 +1187,7 @@ github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwp github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= @@ -1150,6 +1196,7 @@ github.com/pelletier/go-toml/v2 v2.0.0-beta.8 h1:dy81yyLYJDwMTifq24Oi/IslOslRrDS github.com/pelletier/go-toml/v2 v2.0.0-beta.8/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU= github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= +github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= @@ -1183,6 +1230,7 @@ github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQ github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -1217,6 +1265,7 @@ github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qq github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= +github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -1237,6 +1286,7 @@ github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiB github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= github.com/sagikazarmark/crypt v0.5.0/go.mod h1:l+nzl7KWh51rpzp2h7t4MZWyiEWdhNpOAnclKvg+mdA= +github.com/sagikazarmark/crypt v0.6.0/go.mod h1:U8+INwJo3nBv1m6A/8OBXAq7Jnpspk5AxSgDyEQcea8= github.com/santhosh-tekuri/jsonschema/v5 v5.0.0 h1:TToq11gyfNlrMFZiYujSekIsPd9AmsA2Bj/iv+s4JHE= github.com/santhosh-tekuri/jsonschema/v5 v5.0.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= @@ -1276,6 +1326,7 @@ github.com/spf13/afero v1.7.1/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfA github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= @@ -1283,6 +1334,7 @@ github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155 github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= @@ -1296,10 +1348,13 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= +github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= +github.com/spf13/viper v1.12.1-0.20220712161005-5247643f0235/go.mod h1:f40df4ovE8V1ot0NXmYP1zUDS+X1D5AXGviq9fCJqZU= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -1308,6 +1363,8 @@ github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -1318,14 +1375,21 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= +github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo= +github.com/supranational/blst v0.3.8-0.20220526154634-513d2456b344/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= +github.com/tidwall/gjson v1.11.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.1 h1:iymTbGkQBhveq21bEvAQ81I0LEBork8BFe1CUZXdyuo= github.com/tidwall/gjson v1.14.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= @@ -1356,6 +1420,7 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/urfave/cli/v2 v2.10.2/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= @@ -1387,6 +1452,7 @@ github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMx github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1409,12 +1475,16 @@ go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3C go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= +go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/pkg/v3 v3.5.2/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= go.etcd.io/etcd/client/v2 v2.305.2/go.mod h1:2D7ZejHVMIfog1221iLSYlQRzrtECw3kz4I4VAQm3qI= +go.etcd.io/etcd/client/v2 v2.305.4/go.mod h1:Ud+VUwIi9/uQHOMA+4ekToJ12lTxlv0zB/+DHwTGEbU= +go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY= go.mongodb.org/mongo-driver v1.7.0/go.mod h1:Q4oFMbo1+MSNqICAdYMlC/zSTrwCogR4R8NzkI+yfU8= go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -1468,6 +1538,7 @@ golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210920023735-84f357641f63/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -1477,6 +1548,8 @@ golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrb golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9 h1:NUzdAbFtCJSXU20AOXgeqaUwg8Ypg4MPYmL+d+rsB5c= golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1556,6 +1629,7 @@ golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191021144547-ec77196f6094/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1596,10 +1670,12 @@ golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211013171255-e13a2654a71e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -1607,8 +1683,13 @@ golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2 h1:6mzvA99KwZxbOrxww4EvWVQUnN1+xEu9tafK5ZxkYeA= golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220516155154-20f960328961 h1:+W/iTMPG0EL7aW+/atntZwZrvSRIj3m3yX414dSULUU= golang.org/x/net v0.0.0-20220516155154-20f960328961/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220531201128-c960675eff93 h1:MYimHLfoXEpOhqd/zgoA/uoXzHB86AEky4LAx5ij9xA= +golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1644,11 +1725,13 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1776,14 +1859,19 @@ golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220403205710-6acee93ad0eb/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a h1:N2T1jUrTQE9Re6TFF5PhvEHXHCguynGhKjWVsIUt5cY= golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 h1:EH1Deb8WZJ0xc0WK//leUHXcX9aLE5SymusoTmMZye8= golang.org/x/term v0.0.0-20220411215600-e5f449aeb171/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 h1:CBpWXWQpIRjzmkkA+M7q9Fqnwd2mZr3AFqexg8YTfoM= +golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1838,6 +1926,7 @@ golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191126055441-b0650ceb63d9/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -1884,6 +1973,7 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= @@ -1932,6 +2022,9 @@ google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQ google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= +google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= +google.golang.org/api v0.81.0/go.mod h1:FA6Mb/bZxj706H2j+j2d6mHEEaHBmbbWnkfvmorOCko= google.golang.org/appengine v1.0.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -2026,6 +2119,12 @@ google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2 google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -2061,6 +2160,8 @@ google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ5 google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= 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= @@ -2088,11 +2189,15 @@ gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/h2non/gentleman.v1 v1.0.4/go.mod h1:JYuHVdFzS4MKOXe0o+chKJ4hCe6tqKKw9XH9YP6WFrg= +gopkg.in/h2non/gock.v1 v1.0.16/go.mod h1:XVuDAssexPLwgxCLMvDTWNU5eqklsydR6I5phZ9oPB8= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.6/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= @@ -2121,6 +2226,9 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20220512140231-539c8e751b99 h1:dbuHpmKjkDzSOMKAWl10QNlgaZUd3V1q99xc81tt2Kc= gopkg.in/yaml.v3 v3.0.0-20220512140231-539c8e751b99/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/postgres v1.0.8/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg= gorm.io/gorm v1.20.12/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.21.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= diff --git a/internal/ffcapiconnector/create_block_listener.go b/internal/ffcapiconnector/create_block_listener.go deleted file mode 100644 index acba9b5..0000000 --- a/internal/ffcapiconnector/create_block_listener.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "encoding/json" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - ethbinding "github.com/kaleido-io/ethbinding/pkg" -) - -func (s *ffcServer) createBlockListener(ctx context.Context, payload []byte) (interface{}, ffcapi.ErrorReason, error) { - - var req ffcapi.CreateBlockListenerRequest - err := json.Unmarshal(payload, &req) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, err - } - - var listenerID ethbinding.HexBigInt - err = s.rpc.CallContext(ctx, &listenerID, "eth_newBlockFilter") - if err != nil { - return nil, "", err - } - - return &ffcapi.CreateBlockListenerResponse{ - ListenerID: listenerID.String(), - }, "", nil - -} diff --git a/internal/ffcapiconnector/create_block_listener_test.go b/internal/ffcapiconnector/create_block_listener_test.go deleted file mode 100644 index cc27351..0000000 --- a/internal/ffcapiconnector/create_block_listener_test.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "fmt" - "testing" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - ethbinding "github.com/kaleido-io/ethbinding/pkg" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" -) - -const sampleCreateBlockListener = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "create_block_listener" - } -}` - -func TestCreateBlockListenerOK(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_newBlockFilter"). - Return(nil). - Run(func(args mock.Arguments) { - (args[1].(*ethbinding.HexBigInt)).ToInt().SetString("12345", 10) - }) - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getFilterChanges", mock.Anything).Return(nil).Maybe() - - iRes, reason, err := s.createBlockListener(ctx, []byte(sampleCreateBlockListener)) - assert.NoError(t, err) - assert.Empty(t, reason) - - res := iRes.(*ffcapi.CreateBlockListenerResponse) - assert.Equal(t, "0x3039", res.ListenerID) - -} - -func TestCreateBlockListenerFail(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_newBlockFilter"). - Return(fmt.Errorf("pop")) - - iRes, reason, err := s.createBlockListener(ctx, []byte(sampleCreateBlockListener)) - assert.Regexp(t, "pop", err) - assert.Empty(t, reason) - assert.Nil(t, iRes) - -} - -func TestCreateBlockListenerBadPayload(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.createBlockListener(ctx, []byte("!json")) - assert.Regexp(t, "invalid", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} diff --git a/internal/ffcapiconnector/error_mapping.go b/internal/ffcapiconnector/error_mapping.go deleted file mode 100644 index 6f2306a..0000000 --- a/internal/ffcapiconnector/error_mapping.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "strings" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" -) - -type ethRPCMethodCategory int - -const ( - filterRPCMethods ethRPCMethodCategory = iota - sendRPCMethods -) - -// mapErrorToReason provides a common place for mapping Ethereum client -// error strings, to a more consistent set of cross-client (and -// cross blockchain) reasons for errors defined by FFCPI for use by -// FireFly Transaction Manager. -// -// Sadly there is no place in Ethereum JSON/RPC where these are -// formally defined. So this logic may get complex over time to -// deal with the differences between client implementations. -func mapError(methodType ethRPCMethodCategory, err error) ffcapi.ErrorReason { - - errString := err.Error() - - switch methodType { - case filterRPCMethods: - switch { - case strings.Contains(errString, "filter not found"): - return ffcapi.ErrorReasonNotFound - } - case sendRPCMethods: - switch { - case strings.Contains(errString, "nonce too low"): - return ffcapi.ErrorReasonNonceTooLow - case strings.Contains(errString, "insufficient funds"): - return ffcapi.ErrorReasonInsufficientFunds - case strings.Contains(errString, "transaction underpriced"): - return ffcapi.ErrorReasonTransactionUnderpriced - case strings.Contains(errString, "known transaction"): - return ffcapi.ErrorKnownTransaction - default: - return "" - } - } - - // Best default in FFCAPI is to provide no mapping - return "" -} diff --git a/internal/ffcapiconnector/exec_query.go b/internal/ffcapiconnector/exec_query.go deleted file mode 100644 index 1a67baf..0000000 --- a/internal/ffcapiconnector/exec_query.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - "github.com/hyperledger/firefly-ethconnect/internal/errors" -) - -func (s *ffcServer) execQuery(ctx context.Context, payload []byte) (interface{}, ffcapi.ErrorReason, error) { - - // TODO - currently ethconnect returns parameters as a map, and this seems inconsistent. - // We should reconcile this in the FFCAPI implementation, while maintaining existing behavior for EthConnect default paths. - return nil, "", errors.Errorf(errors.FFCRequestTypeNotImplemented, ffcapi.RequestTypeExecQuery) - -} diff --git a/internal/ffcapiconnector/exec_query_test.go b/internal/ffcapiconnector/exec_query_test.go deleted file mode 100644 index 64e22cf..0000000 --- a/internal/ffcapiconnector/exec_query_test.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" -) - -const sampleExecQuery = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "exec_query" - }, - "from": "0xb480F96c0a3d6E9e9a263e4665a39bFa6c4d01E8", - "to": "0xe1a078b9e2b145d0a7387f09277c6ae1d9470771", - "nonce": "222", - "method": { - "inputs": [], - "name":"do", - "outputs":[], - "stateMutability":"nonpayable", - "type":"function" - }, - "method": { - "inputs": [ - { - "internalType":" uint256", - "name": "x", - "type": "uint256" - } - ], - "name":"set", - "outputs":[ - { - "internalType":" uint256", - "name": "y", - "type": "uint256" - } - ], - "stateMutability":"nonpayable", - "type":"function" - }, - "params": [ 4276993775 ] -}` - -func TestExecQueryNotSupported(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.execQuery(ctx, []byte(sampleExecQuery)) - assert.Regexp(t, "FFEC100217", err) - assert.Empty(t, reason) - assert.Nil(t, iRes) - -} diff --git a/internal/ffcapiconnector/get_block_info.go b/internal/ffcapiconnector/get_block_info.go deleted file mode 100644 index 1c9f77a..0000000 --- a/internal/ffcapiconnector/get_block_info.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "encoding/json" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - "github.com/hyperledger/firefly-common/pkg/fftypes" - "github.com/hyperledger/firefly-ethconnect/internal/errors" - ethbinding "github.com/kaleido-io/ethbinding/pkg" -) - -// blockInfoJSONRPC are the fields we parse from the JSON/RPC response -type blockInfoJSONRPC struct { - Number ethbinding.HexUint `json:"number"` - Hash ethbinding.Hash `json:"hash"` - ParentHash ethbinding.Hash `json:"parentHash"` - Timestamp ethbinding.HexUint `json:"timestamp"` - Transactions []ethbinding.Hash `json:"transactions"` -} - -func transformBlockInfo(bi *blockInfoJSONRPC, t *ffcapi.BlockInfo) { - t.BlockNumber = fftypes.NewFFBigInt(int64(bi.Number)) - t.BlockHash = bi.Hash.String() - t.ParentHash = bi.ParentHash.String() - stringHashes := make([]string, len(bi.Transactions)) - for i, th := range bi.Transactions { - stringHashes[i] = th.String() - } - t.TransactionHashes = stringHashes -} - -func (s *ffcServer) getBlockInfoByNumber(ctx context.Context, payload []byte) (interface{}, ffcapi.ErrorReason, error) { - - var req ffcapi.GetBlockInfoByNumberRequest - err := json.Unmarshal(payload, &req) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, err - } - - blockNumber := ethbinding.HexUint64(req.BlockNumber.Uint64()) - var blockInfo *blockInfoJSONRPC - err = s.rpc.CallContext(ctx, &blockInfo, "eth_getBlockByNumber", blockNumber, false /* only the txn hashes */) - if err != nil { - return nil, "", err - } - if blockInfo == nil { - return nil, ffcapi.ErrorReasonNotFound, errors.Errorf(errors.FFCBlockNotAvailable) - } - - res := &ffcapi.GetBlockInfoByNumberResponse{} - transformBlockInfo(blockInfo, &res.BlockInfo) - return res, "", nil - -} - -func (s *ffcServer) getBlockInfoByHash(ctx context.Context, payload []byte) (interface{}, ffcapi.ErrorReason, error) { - - var req ffcapi.GetBlockInfoByHashRequest - err := json.Unmarshal(payload, &req) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, err - } - - var blockInfo *blockInfoJSONRPC - err = s.rpc.CallContext(ctx, &blockInfo, "eth_getBlockByHash", req.BlockHash, false /* only the txn hashes */) - if err != nil { - return nil, "", err - } - if blockInfo == nil { - return nil, ffcapi.ErrorReasonNotFound, errors.Errorf(errors.FFCBlockNotAvailable) - } - - res := &ffcapi.GetBlockInfoByHashResponse{} - transformBlockInfo(blockInfo, &res.BlockInfo) - return res, "", nil - -} diff --git a/internal/ffcapiconnector/get_block_info_test.go b/internal/ffcapiconnector/get_block_info_test.go deleted file mode 100644 index dfc8c06..0000000 --- a/internal/ffcapiconnector/get_block_info_test.go +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "encoding/json" - "fmt" - "testing" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - ethbinding "github.com/kaleido-io/ethbinding/pkg" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" -) - -const sampleGetBlockInfoByNumber = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "get_block_info_by_number" - }, - "blockNumber": "12345" -}` - -const sampleGetBlockInfoByHash = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "get_block_info_by_hash" - }, - "blockHash": "0x6197ef1a58a2a592bb447efb651f0db7945de21aa8048801b250bd7b7431f9b6" -}` - -const sampleBlockJSONRPC = `{ - "difficulty": "0x2", - "extraData": "0xd683010a11846765746886676f312e3138856c696e7578000000000000000000ebe2ceb710450c390fbbf76e379cca8b5dac0444c2d49f5039b0fb61b9d6d0912ed4afe89227b39b21c78398824e9feb4b6d6f9f17c2b4c3bfa0e5975f3e12df01", - "gasLimit": "0x48112a", - "gasUsed": "0x8414", - "hash": "0x6197ef1a58a2a592bb447efb651f0db7945de21aa8048801b250bd7b7431f9b6", - "logsBloom": "0x00000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000100000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000", - "miner": "0x0000000000000000000000000000000000000000", - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "nonce": "0x0000000000000000", - "number": "0x3039", - "parentHash": "0x124ca6245d8ddd48203346c2f80b9bc07ce2fcdb8ccb3251b03d8748c1c73b92", - "receiptsRoot": "0x9b2a34bd8b935ade9cbdc016872e59d3abafe3f73d8471523cbb05b24fe2a620", - "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "size": "0x44c", - "stateRoot": "0x07990588ecb235a7d5a483e94347356b10c2a68e876c023c9eb78ee5706d4315", - "timestamp": "0x625829cc", - "totalDifficulty": "0xb", - "transactions": [ - "0x7d48ae971faf089878b57e3c28e3035540d34f38af395958d2c73c36c57c83a2" - ], - "transactionsRoot": "0x8ae1c0f1c985972257ed1719c6fb9524a3c5a43eaa5493fb83c00ca070d7a460", - "uncles": [] -}` - -func TestGetBlockInfoByNumberOK(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getBlockByNumber", - mock.MatchedBy( - func(blockNumber ethbinding.HexUint64) bool { - return blockNumber.String() == "0x3039" - }), - false). - Return(nil). - Run(func(args mock.Arguments) { - err := json.Unmarshal([]byte(sampleBlockJSONRPC), args[1]) - assert.NoError(t, err) - }) - - iRes, reason, err := s.getBlockInfoByNumber(ctx, []byte(sampleGetBlockInfoByNumber)) - assert.NoError(t, err) - assert.Empty(t, reason) - - res := iRes.(*ffcapi.GetBlockInfoByNumberResponse) - assert.Equal(t, "0x6197ef1a58a2a592bb447efb651f0db7945de21aa8048801b250bd7b7431f9b6", res.BlockHash) - assert.Equal(t, "0x124ca6245d8ddd48203346c2f80b9bc07ce2fcdb8ccb3251b03d8748c1c73b92", res.ParentHash) - assert.Equal(t, int64(12345), res.BlockNumber.Int64()) - -} - -func TestGetBlockInfoByNumberNotFound(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getBlockByNumber", mock.Anything, false). - Return(nil). - Run(func(args mock.Arguments) { - err := json.Unmarshal([]byte("null"), args[1]) - assert.NoError(t, err) - }) - - iRes, reason, err := s.getBlockInfoByNumber(ctx, []byte(sampleGetBlockInfoByNumber)) - assert.Regexp(t, "FFEC100218", err) - assert.Equal(t, ffcapi.ErrorReasonNotFound, reason) - assert.Nil(t, iRes) - -} - -func TestGetBlockInfoByNumberFail(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getBlockByNumber", mock.Anything, false). - Return(fmt.Errorf("pop")) - - iRes, reason, err := s.getBlockInfoByNumber(ctx, []byte(sampleGetBlockInfoByNumber)) - assert.Regexp(t, "pop", err) - assert.Empty(t, reason) - assert.Nil(t, iRes) - -} - -func TestGetBlockInfoByNumberBadPayload(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.getBlockInfoByNumber(ctx, []byte("!json")) - assert.Regexp(t, "invalid", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} - -func TestGetBlockInfoByHashOK(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getBlockByHash", "0x6197ef1a58a2a592bb447efb651f0db7945de21aa8048801b250bd7b7431f9b6", false). - Return(nil). - Run(func(args mock.Arguments) { - err := json.Unmarshal([]byte(sampleBlockJSONRPC), args[1]) - assert.NoError(t, err) - }) - - iRes, reason, err := s.getBlockInfoByHash(ctx, []byte(sampleGetBlockInfoByHash)) - assert.NoError(t, err) - assert.Empty(t, reason) - - res := iRes.(*ffcapi.GetBlockInfoByHashResponse) - assert.Equal(t, "0x6197ef1a58a2a592bb447efb651f0db7945de21aa8048801b250bd7b7431f9b6", res.BlockHash) - assert.Equal(t, "0x124ca6245d8ddd48203346c2f80b9bc07ce2fcdb8ccb3251b03d8748c1c73b92", res.ParentHash) - assert.Equal(t, int64(12345), res.BlockNumber.Int64()) - -} - -func TestGetBlockInfoByHashNotFound(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getBlockByHash", mock.Anything, false). - Return(nil). - Run(func(args mock.Arguments) { - err := json.Unmarshal([]byte("null"), args[1]) - assert.NoError(t, err) - }) - - iRes, reason, err := s.getBlockInfoByHash(ctx, []byte(sampleGetBlockInfoByHash)) - assert.Regexp(t, "FFEC100218", err) - assert.Equal(t, ffcapi.ErrorReasonNotFound, reason) - assert.Nil(t, iRes) - -} - -func TestGetBlockInfoByHashFail(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getBlockByHash", mock.Anything, false). - Return(fmt.Errorf("pop")) - - iRes, reason, err := s.getBlockInfoByHash(ctx, []byte(sampleGetBlockInfoByHash)) - assert.Regexp(t, "pop", err) - assert.Empty(t, reason) - assert.Nil(t, iRes) - -} - -func TestGetBlockInfoByHashBadPayload(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.getBlockInfoByHash(ctx, []byte("!json")) - assert.Regexp(t, "invalid", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} diff --git a/internal/ffcapiconnector/get_gas_price.go b/internal/ffcapiconnector/get_gas_price.go deleted file mode 100644 index 2f85477..0000000 --- a/internal/ffcapiconnector/get_gas_price.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "encoding/json" - "fmt" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - "github.com/hyperledger/firefly-common/pkg/fftypes" - ethbinding "github.com/kaleido-io/ethbinding/pkg" -) - -func (s *ffcServer) getGasPrice(ctx context.Context, payload []byte) (interface{}, ffcapi.ErrorReason, error) { - - var req ffcapi.GetGasPriceRequest - err := json.Unmarshal(payload, &req) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, err - } - - // Note we use simple (pre London fork) gas fee approach. - // See https://github.com/ethereum/pm/issues/328#issuecomment-853234014 for a bit of color - var gasPrice ethbinding.HexBigInt - err = s.rpc.CallContext(ctx, &gasPrice, "eth_gasPrice") - if err != nil { - return nil, "", err - } - - return &ffcapi.GetGasPriceResponse{ - GasPrice: fftypes.JSONAnyPtr(fmt.Sprintf(`"%s"`, gasPrice.ToInt().Text(10))), - }, "", nil - -} diff --git a/internal/ffcapiconnector/get_gas_price_test.go b/internal/ffcapiconnector/get_gas_price_test.go deleted file mode 100644 index 0780a9c..0000000 --- a/internal/ffcapiconnector/get_gas_price_test.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "fmt" - "testing" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - ethbinding "github.com/kaleido-io/ethbinding/pkg" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" -) - -const sampleGetGasPrice = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "get_next_nonce" - }, - "signer": "0x302259069aaa5b10dc6f29a9a3f72a8e52837cc3" -}` - -func TestGetGasPriceOK(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_gasPrice"). - Return(nil). - Run(func(args mock.Arguments) { - (args[1].(*ethbinding.HexBigInt)).ToInt().SetString("12345", 10) - }) - - iRes, reason, err := s.getGasPrice(ctx, []byte(sampleGetGasPrice)) - assert.NoError(t, err) - assert.Empty(t, reason) - - res := iRes.(*ffcapi.GetGasPriceResponse) - assert.Equal(t, `"12345"`, res.GasPrice.String()) - -} - -func TestGetGasPriceFail(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_gasPrice"). - Return(fmt.Errorf("pop")) - - iRes, reason, err := s.getGasPrice(ctx, []byte(sampleGetGasPrice)) - assert.Regexp(t, "pop", err) - assert.Empty(t, reason) - assert.Nil(t, iRes) - -} - -func TestGetGasPriceBadPayload(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.getGasPrice(ctx, []byte("!json")) - assert.Regexp(t, "invalid", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} diff --git a/internal/ffcapiconnector/get_new_block_hashes.go b/internal/ffcapiconnector/get_new_block_hashes.go deleted file mode 100644 index a1971b0..0000000 --- a/internal/ffcapiconnector/get_new_block_hashes.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "encoding/json" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - ethbinding "github.com/kaleido-io/ethbinding/pkg" -) - -func (s *ffcServer) getNewBlockHashes(ctx context.Context, payload []byte) (interface{}, ffcapi.ErrorReason, error) { - - var req ffcapi.GetNewBlockHashesRequest - err := json.Unmarshal(payload, &req) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, err - } - - var listenerID ethbinding.HexBigInt - listenerID.ToInt().SetString(req.ListenerID, 0 /* big.Int strips the 0x */) - var blockHashes []string - err = s.rpc.CallContext(ctx, &blockHashes, "eth_getFilterChanges", &listenerID) - if err != nil { - return nil, mapError(filterRPCMethods, err), err - } - - return &ffcapi.GetNewBlockHashesResponse{ - BlockHashes: blockHashes, - }, "", nil - -} diff --git a/internal/ffcapiconnector/get_new_block_hashes_test.go b/internal/ffcapiconnector/get_new_block_hashes_test.go deleted file mode 100644 index d1e1de2..0000000 --- a/internal/ffcapiconnector/get_new_block_hashes_test.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "fmt" - "testing" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - ethbinding "github.com/kaleido-io/ethbinding/pkg" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" -) - -const sampleGetNewBlockHashes = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "get_new_block_hashes" - }, - "listenerId": "0x3039" -}` - -func TestGetNewBlockHashesOK(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getFilterChanges", - mock.MatchedBy( - func(listenerID *ethbinding.HexBigInt) bool { - return listenerID.String() == "0x3039" - })). - Return(nil). - Run(func(args mock.Arguments) { - *(args[1].(*[]string)) = []string{"0x12345", "0x23456"} - }) - - iRes, reason, err := s.getNewBlockHashes(ctx, []byte(sampleGetNewBlockHashes)) - assert.NoError(t, err) - assert.Empty(t, reason) - - res := iRes.(*ffcapi.GetNewBlockHashesResponse) - assert.Equal(t, []string{"0x12345", "0x23456"}, res.BlockHashes) - -} - -func TestGetNewBlockHashesFail(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getFilterChanges", mock.Anything). - Return(fmt.Errorf("pop")) - - iRes, reason, err := s.getNewBlockHashes(ctx, []byte(sampleGetNewBlockHashes)) - assert.Regexp(t, "pop", err) - assert.Empty(t, reason) - assert.Nil(t, iRes) - -} - -func TestGetNewBlockHashesFailNotFound(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getFilterChanges", mock.Anything). - Return(fmt.Errorf("filter not found")) - - iRes, reason, err := s.getNewBlockHashes(ctx, []byte(sampleGetNewBlockHashes)) - assert.Regexp(t, "filter not found", err) - assert.Equal(t, ffcapi.ErrorReasonNotFound, reason) - assert.Nil(t, iRes) - -} - -func TestGetNewBlockHashesBadPayload(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.getNewBlockHashes(ctx, []byte("!json")) - assert.Regexp(t, "invalid", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} diff --git a/internal/ffcapiconnector/get_next_nonce.go b/internal/ffcapiconnector/get_next_nonce.go deleted file mode 100644 index 4a969fa..0000000 --- a/internal/ffcapiconnector/get_next_nonce.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "encoding/json" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - "github.com/hyperledger/firefly-common/pkg/fftypes" - ethbinding "github.com/kaleido-io/ethbinding/pkg" -) - -func (s *ffcServer) getNextNonce(ctx context.Context, payload []byte) (interface{}, ffcapi.ErrorReason, error) { - - var req ffcapi.GetNextNonceRequest - err := json.Unmarshal(payload, &req) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, err - } - - var txnCount ethbinding.HexUint64 - err = s.rpc.CallContext(ctx, &txnCount, "eth_getTransactionCount", req.Signer, "pending") - if err != nil { - return nil, "", err - } - - return &ffcapi.GetNextNonceResponse{ - Nonce: fftypes.NewFFBigInt(int64(txnCount)), - }, "", nil - -} diff --git a/internal/ffcapiconnector/get_next_nonce_test.go b/internal/ffcapiconnector/get_next_nonce_test.go deleted file mode 100644 index c60178e..0000000 --- a/internal/ffcapiconnector/get_next_nonce_test.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "fmt" - "testing" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - ethbinding "github.com/kaleido-io/ethbinding/pkg" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" -) - -const sampleGetNextNonce = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "get_next_nonce" - }, - "signer": "0x302259069aaa5b10dc6f29a9a3f72a8e52837cc3" -}` - -func TestGetNextNonceOK(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getTransactionCount", "0x302259069aaa5b10dc6f29a9a3f72a8e52837cc3", "pending"). - Return(nil). - Run(func(args mock.Arguments) { - *(args[1].(*ethbinding.HexUint64)) = 12345 - }) - - iRes, reason, err := s.getNextNonce(ctx, []byte(sampleGetNextNonce)) - assert.NoError(t, err) - assert.Empty(t, reason) - - res := iRes.(*ffcapi.GetNextNonceResponse) - assert.Equal(t, int64(12345), res.Nonce.Int64()) - -} - -func TestGetNextNonceFail(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getTransactionCount", "0x302259069aaa5b10dc6f29a9a3f72a8e52837cc3", "pending"). - Return(fmt.Errorf("pop")) - - iRes, reason, err := s.getNextNonce(ctx, []byte(sampleGetNextNonce)) - assert.Regexp(t, "pop", err) - assert.Empty(t, reason) - assert.Nil(t, iRes) - -} - -func TestGetNextNonceBadPayload(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.getNextNonce(ctx, []byte("!json")) - assert.Regexp(t, "invalid", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} diff --git a/internal/ffcapiconnector/get_receipt.go b/internal/ffcapiconnector/get_receipt.go deleted file mode 100644 index 2c39a12..0000000 --- a/internal/ffcapiconnector/get_receipt.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "encoding/json" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - "github.com/hyperledger/firefly-common/pkg/fftypes" - "github.com/hyperledger/firefly-ethconnect/internal/errors" - "github.com/hyperledger/firefly-ethconnect/internal/eth" -) - -func (s *ffcServer) getReceipt(ctx context.Context, payload []byte) (interface{}, ffcapi.ErrorReason, error) { - - var req ffcapi.GetReceiptRequest - err := json.Unmarshal(payload, &req) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, err - } - - // Get the receipt in the back-end JSON/RPC format - var ethReceipt eth.TxnReceipt - err = s.rpc.CallContext(ctx, ðReceipt, "eth_getTransactionReceipt", req.TransactionHash) - if err != nil { - return nil, "", err - } - isMined := ethReceipt.BlockHash != nil && ethReceipt.BlockNumber != nil && ethReceipt.BlockNumber.ToInt().Uint64() > 0 - if !isMined { - return nil, ffcapi.ErrorReasonNotFound, errors.Errorf(errors.FFCReceiptNotAvailable, req.TransactionHash) - } - isSuccess := (ethReceipt.Status != nil && ethReceipt.Status.ToInt().Int64() > 0) - - fullReceipt, _ := json.Marshal(ðReceipt) - - var txIndex int64 - if ethReceipt.TransactionIndex != nil { - txIndex = int64(*ethReceipt.TransactionIndex) - } - return &ffcapi.GetReceiptResponse{ - BlockNumber: (*fftypes.FFBigInt)(ethReceipt.BlockNumber.ToInt()), - TransactionIndex: fftypes.NewFFBigInt(txIndex), - BlockHash: ethReceipt.BlockHash.String(), - Success: isSuccess, - ExtraInfo: *fftypes.JSONAnyPtrBytes(fullReceipt), - }, "", nil - -} diff --git a/internal/ffcapiconnector/get_receipt_test.go b/internal/ffcapiconnector/get_receipt_test.go deleted file mode 100644 index b1cb458..0000000 --- a/internal/ffcapiconnector/get_receipt_test.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "encoding/json" - "fmt" - "testing" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" -) - -const sampleGetReceipt = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "get_receipt" - }, - "transactionHash": "0x7d48ae971faf089878b57e3c28e3035540d34f38af395958d2c73c36c57c83a2" -}` - -const sampleJSONRPCReceipt = `{ - "blockHash": "0x6197ef1a58a2a592bb447efb651f0db7945de21aa8048801b250bd7b7431f9b6", - "blockNumber": "0x7b9", - "contractAddress": null, - "cumulativeGasUsed": "0x8414", - "effectiveGasPrice": "0x0", - "from": "0x2b1c769ef5ad304a4889f2a07a6617cd935849ae", - "gasUsed": "0x8414", - "logs": [ - { - "address": "0x302259069aaa5b10dc6f29a9a3f72a8e52837cc3", - "topics": [ - "0x805721bc246bccc732581be0c0aa2dd8f7ec93e97ba4b307be84428c98b0a12f" - ], - "data": "0x0000000000000000000000002b1c769ef5ad304a4889f2a07a6617cd935849ae00000000000000000000000000000000000000000000000000000000625829cc00000000000000000000000000000000000000000000000000000000000000e01f64cabbf2b44bff810396f2cb08186c2d460c2bd1c44058bc058267d554e724973b16c67dbcade6c509329de6aad8037bb024b7a996129f731b9f68ac5fcd9f00000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000966665f73797374656d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002e516d546a587065445154326a377063583145347445764379334665554a71744374737036464c5762535553724a4e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014a1ad4027f59715bca7fd30dc0121be0542c713f7a2470c415e8b1d9e7df372c", - "blockNumber": "0x5", - "transactionHash": "0x7d48ae971faf089878b57e3c28e3035540d34f38af395958d2c73c36c57c83a2", - "transactionIndex": "0x0", - "blockHash": "0x6197ef1a58a2a592bb447efb651f0db7945de21aa8048801b250bd7b7431f9b6", - "logIndex": "0x0", - "removed": false - } - ], - "logsBloom": "0x00000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000100000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000", - "status": "0x1", - "to": "0x302259069aaa5b10dc6f29a9a3f72a8e52837cc3", - "transactionHash": "0x7d48ae971faf089878b57e3c28e3035540d34f38af395958d2c73c36c57c83a2", - "transactionIndex": "0x1e", - "type": "0x0" -}` - -func TestGetReceiptOkSuccess(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getTransactionReceipt", - mock.MatchedBy(func(txHash string) bool { - assert.Equal(t, "0x7d48ae971faf089878b57e3c28e3035540d34f38af395958d2c73c36c57c83a2", txHash) - return true - })). - Return(nil). - Run(func(args mock.Arguments) { - err := json.Unmarshal([]byte(sampleJSONRPCReceipt), args[1]) - assert.NoError(t, err) - }) - - iRes, reason, err := s.getReceipt(ctx, []byte(sampleGetReceipt)) - assert.NoError(t, err) - assert.Empty(t, reason) - - res := iRes.(*ffcapi.GetReceiptResponse) - assert.True(t, res.Success) - assert.Equal(t, int64(1977), res.BlockNumber.Int64()) - assert.Equal(t, int64(30), res.TransactionIndex.Int64()) - -} - -func TestGetReceiptNotFound(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getTransactionReceipt", mock.Anything). - Return(nil). - Run(func(args mock.Arguments) { - err := json.Unmarshal([]byte("null"), args[1]) - assert.NoError(t, err) - }) - - iRes, reason, err := s.getReceipt(ctx, []byte(sampleGetReceipt)) - assert.Regexp(t, "FFEC100216", err) - assert.Equal(t, ffcapi.ErrorReasonNotFound, reason) - assert.Nil(t, iRes) - -} - -func TestGetReceiptError(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_getTransactionReceipt", mock.Anything). - Return(fmt.Errorf("pop")) - - iRes, reason, err := s.getReceipt(ctx, []byte(sampleGetReceipt)) - assert.Regexp(t, "pop", err) - assert.Empty(t, "", reason) - assert.Nil(t, iRes) - -} - -func TestGetReceiptWithBadPayload(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.getReceipt(ctx, []byte("!json")) - assert.Regexp(t, "invalid", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} diff --git a/internal/ffcapiconnector/prepare_transaction.go b/internal/ffcapiconnector/prepare_transaction.go deleted file mode 100644 index f4c4272..0000000 --- a/internal/ffcapiconnector/prepare_transaction.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "encoding/json" - - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/hyperledger/firefly-common/pkg/ffcapi" - "github.com/hyperledger/firefly-common/pkg/fftypes" - "github.com/hyperledger/firefly-ethconnect/internal/errors" - "github.com/hyperledger/firefly-ethconnect/internal/eth" - "github.com/hyperledger/firefly-ethconnect/internal/messages" - ethbinding "github.com/kaleido-io/ethbinding/pkg" - log "github.com/sirupsen/logrus" -) - -func (s *ffcServer) prepareTransaction(ctx context.Context, payload []byte) (interface{}, ffcapi.ErrorReason, error) { - - var req ffcapi.PrepareTransactionRequest - err := json.Unmarshal(payload, &req) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, err - } - - // Parse the input over to the standard EthConnect format - sendTx, err := s.mapFFCAPIToEth(&req.TransactionInput) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, err - } - tx, err := eth.NewSendTxn(sendTx, nil) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, err - } - - gas := hexutil.Uint64(req.Gas.Int64()) - var data ethbinding.HexBytes - if uint64(gas) == 0 { - // If a value for gas has not been supplied, do a gas estimate - var reverted bool - data, gas, reverted, err = tx.Estimate(ctx, s.rpc, s.gasEstimationFactor) - if err != nil { - var reason ffcapi.ErrorReason - if reverted { - reason = ffcapi.ErrorReasonTransactionReverted - } - return nil, reason, err - } - } else { - // Otherwise just serialize the data - data = tx.EthTX.Data() - } - txHash := tx.EthTX.Hash().String() - log.Infof("Prepared transaction %s method=%s datalen=%d gas=%d", txHash, sendTx.Method.Name, len(data), gas) - - return &ffcapi.PrepareTransactionResponse{ - Gas: fftypes.NewFFBigInt(int64(gas)), - TransactionData: data.String(), - }, "", nil - -} - -func (s *ffcServer) mapFFCAPIToEth(req *ffcapi.TransactionInput) (*messages.SendTransaction, error) { - - // Parse the method ABI - var ethMethod *ethbinding.ABIElementMarshaling - err := json.Unmarshal([]byte(req.Method), ðMethod) - if err != nil { - return nil, errors.Errorf(errors.FFCUnmarshalABIFail, err) - } - - // Parse the params to go interface type, as handled by ethconnect standard SendTransaction handling - ethParams := make([]interface{}, len(req.Params)) - for i, p := range req.Params { - if p != nil { - err := json.Unmarshal([]byte(*p), ðParams[i]) - if err != nil { - return nil, errors.Errorf(errors.FFCUnmarshalParamFail, i, err) - } - } - } - - // First we need to encode the inputs - st := &messages.SendTransaction{ - To: req.To, - Method: ethMethod, - TransactionCommon: messages.TransactionCommon{ - From: req.From, - Parameters: ethParams, - }, - } - if req.Nonce != nil { - st.Nonce = json.Number(req.Nonce.Int().String()) - } - if req.Value != nil { - st.Value = json.Number(req.Value.Int().String()) - } - - return st, nil -} diff --git a/internal/ffcapiconnector/prepare_transaction_test.go b/internal/ffcapiconnector/prepare_transaction_test.go deleted file mode 100644 index 9b3fc7f..0000000 --- a/internal/ffcapiconnector/prepare_transaction_test.go +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "fmt" - "testing" - - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/hyperledger/firefly-common/pkg/ffcapi" - "github.com/hyperledger/firefly-common/pkg/fftypes" - "github.com/hyperledger/firefly-ethconnect/internal/eth" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" -) - -const samplePrepareTXWithGas = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "prepare_transaction" - }, - "from": "0xb480F96c0a3d6E9e9a263e4665a39bFa6c4d01E8", - "to": "0xe1a078b9e2b145d0a7387f09277c6ae1d9470771", - "gas": 1000000, - "nonce": "111", - "value": "12345678901234567890123456789", - "method": { - "inputs": [], - "name":"do", - "outputs":[], - "stateMutability":"nonpayable", - "type":"function" - }, - "params": [] -}` - -const samplePrepareTXEstimateGas = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "prepare_transaction" - }, - "from": "0xb480F96c0a3d6E9e9a263e4665a39bFa6c4d01E8", - "to": "0xe1a078b9e2b145d0a7387f09277c6ae1d9470771", - "nonce": "222", - "method": { - "inputs": [], - "name":"do", - "outputs":[], - "stateMutability":"nonpayable", - "type":"function" - }, - "method": { - "inputs": [ - { - "internalType":" uint256", - "name": "x", - "type": "uint256" - } - ], - "name":"set", - "outputs":[], - "stateMutability":"nonpayable", - "type":"function" - }, - "params": [ 4276993775 ] -}` - -const samplePrepareTXBadMethod = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "prepare_transaction" - }, - "from": "0xb480F96c0a3d6E9e9a263e4665a39bFa6c4d01E8", - "to": "0xe1a078b9e2b145d0a7387f09277c6ae1d9470771", - "gas": 1000000, - "method": false, - "params": [] -}` - -const samplePrepareTXBadParam = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "prepare_transaction" - }, - "from": "0xb480F96c0a3d6E9e9a263e4665a39bFa6c4d01E8", - "to": "0xe1a078b9e2b145d0a7387f09277c6ae1d9470771", - "gas": 1000000, - "nonce": "111", - "method": { - "inputs": [ - { - "internalType":" uint256", - "name": "x", - "type": "uint256" - } - ], - "name":"set", - "outputs":[], - "stateMutability":"nonpayable", - "type":"function" - }, - "params": [ "wrong type" ] -}` - -func TestPrepareTransactionOkNoEstimate(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - iRes, reason, err := s.prepareTransaction(ctx, []byte(samplePrepareTXWithGas)) - - assert.NoError(t, err) - assert.Empty(t, reason) - - res := iRes.(*ffcapi.PrepareTransactionResponse) - assert.Equal(t, int64(1000000), res.Gas.Int64()) - -} - -func TestPrepareTransactionWithEstimate(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_estimateGas", - mock.MatchedBy(func(st *eth.SendTXArgs) bool { - assert.Equal(t, "0x60fe47b100000000000000000000000000000000000000000000000000000000feedbeef", st.Data.String()) - return true - })). - Return(nil). - Run(func(args mock.Arguments) { - var gasEstimate hexutil.Uint64 = 12345 - **(args[1].(**hexutil.Uint64)) = gasEstimate - }) - - iRes, reason, err := s.prepareTransaction(ctx, []byte(samplePrepareTXEstimateGas)) - assert.NoError(t, err) - assert.Empty(t, reason) - - res := iRes.(*ffcapi.PrepareTransactionResponse) - assert.Equal(t, int64(14814) /* 1.2 uplift */, res.Gas.Int64()) - -} - -func TestPrepareTransactionWithEstimateFail(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_estimateGas", mock.Anything).Return(fmt.Errorf("pop")) - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_call", mock.Anything, "latest").Run( - func(args mock.Arguments) { - *(args[1].(*string)) = "0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000114d75707065747279206465746563746564000000000000000000000000000000" - }, - ).Return(nil) - - iRes, reason, err := s.prepareTransaction(ctx, []byte(samplePrepareTXEstimateGas)) - assert.Regexp(t, "FFEC100149", err) - assert.Equal(t, ffcapi.ErrorReasonTransactionReverted, reason) - assert.Nil(t, iRes) - -} - -func TestPrepareTransactionWithBadMethod(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.prepareTransaction(ctx, []byte(samplePrepareTXBadMethod)) - assert.Regexp(t, "FFEC100212", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} - -func TestPrepareTransactionWithBadParam(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.prepareTransaction(ctx, []byte(samplePrepareTXBadParam)) - assert.Regexp(t, "FFEC100160", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} - -func TestPrepareTransactionWithBadPayload(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.prepareTransaction(ctx, []byte("!json")) - assert.Regexp(t, "invalid", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} - -func TestMapFFCAPIToEthBadParams(t *testing.T) { - - s, _ := newTestFFCAPIServer() - - _, err := s.mapFFCAPIToEth(&ffcapi.TransactionInput{ - Method: "{}", - Params: []*fftypes.JSONAny{fftypes.JSONAnyPtr("!wrong")}, - }) - assert.Regexp(t, "FFEC100213", err) - -} diff --git a/internal/ffcapiconnector/send_transaction.go b/internal/ffcapiconnector/send_transaction.go deleted file mode 100644 index 9964dae..0000000 --- a/internal/ffcapiconnector/send_transaction.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "encoding/hex" - "encoding/json" - "strings" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - "github.com/hyperledger/firefly-ethconnect/internal/errors" - "github.com/hyperledger/firefly-ethconnect/internal/eth" -) - -func (s *ffcServer) sendTransaction(ctx context.Context, payload []byte) (interface{}, ffcapi.ErrorReason, error) { - - var req ffcapi.SendTransactionRequest - err := json.Unmarshal(payload, &req) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, err - } - - nonce := json.Number(req.Nonce.Int().String()) - gas := json.Number(req.Gas.Int().String()) - var gasPrice json.Number - if req.GasPrice != nil { - err := json.Unmarshal([]byte(*req.GasPrice), &gasPrice) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, errors.Errorf(errors.FFCInvalidGasPrice, string(*req.GasPrice), err) - } - } - var value json.Number - if req.Value != nil { - value = json.Number(req.Value.Int().String()) - } - txData, err := hex.DecodeString(strings.TrimPrefix(req.TransactionData, "0x")) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, errors.Errorf(errors.FFCInvalidTXData, req.TransactionData, err) - } - tx, err := eth.NewRawSendTxn(nil, req.From, req.To, nonce, value, gas, gasPrice, txData) - if err != nil { - return nil, ffcapi.ErrorReasonInvalidInputs, err - } - - err = tx.Send(ctx, s.rpc, s.gasEstimationFactor) - if err != nil { - return nil, mapError(sendRPCMethods, err), err - } - return &ffcapi.SendTransactionResponse{ - TransactionHash: tx.Hash, - }, "", nil - -} diff --git a/internal/ffcapiconnector/send_transaction_test.go b/internal/ffcapiconnector/send_transaction_test.go deleted file mode 100644 index 89df25b..0000000 --- a/internal/ffcapiconnector/send_transaction_test.go +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "fmt" - "testing" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - "github.com/hyperledger/firefly-ethconnect/internal/eth" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" -) - -const sampleSendTX = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "send_transaction" - }, - "from": "0xb480F96c0a3d6E9e9a263e4665a39bFa6c4d01E8", - "to": "0xe1a078b9e2b145d0a7387f09277c6ae1d9470771", - "gas": 1000000, - "nonce": "111", - "value": "12345678901234567890123456789", - "transactionData": "0x60fe47b100000000000000000000000000000000000000000000000000000000feedbeef" -}` - -const sampleSendTXBadInputs = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "send_transaction" - } -}` - -const sampleSendTXBadData = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "send_transaction" - }, - "transactionData": "not hex" -}` - -const sampleSendTXBadGasPrice = `{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "send_transaction" - }, - "gasPrice": "not a number" -}` - -func TestSendTransactionOK(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_sendTransaction", - mock.MatchedBy(func(st *eth.SendTXArgs) bool { - assert.Equal(t, "0x60fe47b100000000000000000000000000000000000000000000000000000000feedbeef", st.Data.String()) - return true - })). - Run(func(args mock.Arguments) { - *(args[1].(*string)) = "0x12345" - }). - Return(nil) - - iRes, reason, err := s.sendTransaction(ctx, []byte(sampleSendTX)) - assert.NoError(t, err) - assert.Empty(t, reason) - - res := iRes.(*ffcapi.SendTransactionResponse) - assert.Equal(t, "0x12345", res.TransactionHash) - - mRPC.AssertExpectations(t) - -} - -func TestSendTransactionFail(t *testing.T) { - - s, mRPC := newTestFFCAPIServer() - ctx := context.Background() - - mRPC.On("CallContext", mock.Anything, mock.Anything, "eth_sendTransaction", - mock.MatchedBy(func(st *eth.SendTXArgs) bool { - assert.Equal(t, "0x60fe47b100000000000000000000000000000000000000000000000000000000feedbeef", st.Data.String()) - return true - })). - Return(fmt.Errorf("pop")) - - iRes, reason, err := s.sendTransaction(ctx, []byte(sampleSendTX)) - assert.Regexp(t, "pop", err) - assert.Empty(t, reason) - assert.Nil(t, iRes) - - mRPC.AssertExpectations(t) - -} - -func TestSendErrorMapping(t *testing.T) { - - assert.Equal(t, ffcapi.ErrorReasonNonceTooLow, mapError(sendRPCMethods, fmt.Errorf("nonce too low"))) - assert.Equal(t, ffcapi.ErrorReasonInsufficientFunds, mapError(sendRPCMethods, fmt.Errorf("insufficient funds"))) - assert.Equal(t, ffcapi.ErrorReasonTransactionUnderpriced, mapError(sendRPCMethods, fmt.Errorf("transaction underpriced"))) - assert.Equal(t, ffcapi.ErrorKnownTransaction, mapError(sendRPCMethods, fmt.Errorf("known transaction"))) - -} - -func TestSendTransactionBadInputs(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.sendTransaction(ctx, []byte(sampleSendTXBadInputs)) - assert.Regexp(t, "FFEC100156", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} - -func TestSendTransactionBadData(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.sendTransaction(ctx, []byte(sampleSendTXBadData)) - assert.Regexp(t, "FFEC100215", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} - -func TestSendTransactionBadGasPrice(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.sendTransaction(ctx, []byte(sampleSendTXBadGasPrice)) - assert.Regexp(t, "FFEC100214", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} - -func TestSendTransactionBadPayload(t *testing.T) { - - s, _ := newTestFFCAPIServer() - ctx := context.Background() - - iRes, reason, err := s.sendTransaction(ctx, []byte("!not json!")) - assert.Regexp(t, "invalid", err) - assert.Equal(t, ffcapi.ErrorReasonInvalidInputs, reason) - assert.Nil(t, iRes) - -} diff --git a/internal/ffcapiconnector/server.go b/internal/ffcapiconnector/server.go deleted file mode 100644 index 411e81c..0000000 --- a/internal/ffcapiconnector/server.go +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "encoding/json" - "net/http" - "strconv" - - "github.com/Masterminds/semver" - "github.com/hyperledger/firefly-common/pkg/ffcapi" - "github.com/hyperledger/firefly-ethconnect/internal/errors" - "github.com/hyperledger/firefly-ethconnect/internal/eth" - log "github.com/sirupsen/logrus" -) - -var supportedAPIVersions = "1.0.x" - -type FFCServer interface { - ServeFFCAPI(ctx context.Context, payload []byte, w http.ResponseWriter) -} - -type FFCServerConf struct { - eth.EthCommonConf -} - -type ffcServer struct { - rpc eth.RPCClient - versionCheck *semver.Constraints - handlerMap map[ffcapi.RequestType]ffcHandler - - gasEstimationFactor float64 -} - -type ffcHandler func(ctx context.Context, payload []byte) (res interface{}, reason ffcapi.ErrorReason, err error) - -func NewFFCServer(rpc eth.RPCClient, conf *FFCServerConf) FFCServer { - s := &ffcServer{ - rpc: rpc, - gasEstimationFactor: conf.GasEstimationFactor, - } - s.handlerMap = map[ffcapi.RequestType]ffcHandler{ - ffcapi.RequestTypeCreateBlockListener: s.createBlockListener, - ffcapi.RequestTypeExecQuery: s.execQuery, - ffcapi.RequestTypeGetBlockInfoByHash: s.getBlockInfoByHash, - ffcapi.RequestTypeGetBlockInfoByNumber: s.getBlockInfoByNumber, - ffcapi.RequestTypeGetGasPrice: s.getGasPrice, - ffcapi.RequestTypeGetNewBlockHashes: s.getNewBlockHashes, - ffcapi.RequestTypeGetNextNonce: s.getNextNonce, - ffcapi.RequestTypeGetReceipt: s.getReceipt, - ffcapi.RequestTypePrepareTransaction: s.prepareTransaction, - ffcapi.RequestTypeSendTransaction: s.sendTransaction, - } - s.versionCheck, _ = semver.NewConstraint(supportedAPIVersions) - return s -} - -func (s *ffcServer) ServeFFCAPI(ctx context.Context, payload []byte, w http.ResponseWriter) { - var resBase ffcapi.RequestBase - _ = json.Unmarshal(payload, &resBase) - var resBody interface{} - status := 200 - reason := ffcapi.ErrorReasonInvalidInputs - handler, err := s.validateHeader(&resBase.FFCAPI) - if err == nil { - log.Tracef("--> %s %s", resBase.FFCAPI.RequestType, payload) - resBody, reason, err = handler(ctx, payload) - log.Tracef("<-- %s %s %v", resBase.FFCAPI.RequestType, reason, err) - } - if err != nil { - log.Errorf("Request failed: %s", err) - resBody = &ffcapi.ErrorResponse{Error: err.Error(), Reason: reason} - status = s.mapReasonStatus(reason) - } - w.Header().Set("Content-Type", "application/json") - resBytes, _ := json.Marshal(resBody) - w.Header().Set("Content-Length", strconv.FormatInt(int64(len(resBytes)), 10)) - w.WriteHeader(status) - _, _ = w.Write(resBytes) -} - -func (s *ffcServer) mapReasonStatus(reason ffcapi.ErrorReason) int { - switch reason { - case ffcapi.ErrorReasonNotFound: - return http.StatusNotFound - case ffcapi.ErrorReasonInvalidInputs: - return http.StatusBadRequest - default: - return http.StatusInternalServerError - } -} - -func (s *ffcServer) validateHeader(header *ffcapi.Header) (ffcHandler, error) { - v, err := semver.NewVersion(string(header.Version)) - if err != nil { - return nil, errors.Errorf(errors.FFCBadVersion, header.Version, err) - } - if !s.versionCheck.Check(v) { - return nil, errors.Errorf(errors.FFCUnsupportedVersion, header.Version) - } - if header.RequestID == nil { - return nil, errors.Errorf(errors.FFCMissingRequestID) - } - handler, ok := s.handlerMap[header.RequestType] - if !ok { - return nil, errors.Errorf(errors.FFCUnsupportedRequestType, header.RequestType) - } - return handler, nil -} diff --git a/internal/ffcapiconnector/server_test.go b/internal/ffcapiconnector/server_test.go deleted file mode 100644 index 3c59173..0000000 --- a/internal/ffcapiconnector/server_test.go +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright © 2022 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package ffcapiconnector - -import ( - "context" - "encoding/json" - "net/http/httptest" - "testing" - - "github.com/hyperledger/firefly-common/pkg/ffcapi" - "github.com/hyperledger/firefly-common/pkg/fftypes" - "github.com/hyperledger/firefly-ethconnect/mocks/ethmocks" - "github.com/stretchr/testify/assert" -) - -func newTestFFCAPIServer() (*ffcServer, *ethmocks.RPCClient) { - mRpc := ðmocks.RPCClient{} - return NewFFCServer(mRpc, &FFCServerConf{}).(*ffcServer), mRpc -} - -func TestServerBadVersion(t *testing.T) { - - s, _ := newTestFFCAPIServer() - recorder := httptest.NewRecorder() - s.ServeFFCAPI(context.Background(), []byte(`{ - "ffcapi": { - "version": "not a sem ver" - } - }`), recorder) - - assert.Equal(t, recorder.Result().StatusCode, 400) - var errRes ffcapi.ErrorResponse - err := json.NewDecoder(recorder.Body).Decode(&errRes) - assert.NoError(t, err) - assert.Regexp(t, "FFEC100208", errRes.Error) - assert.Regexp(t, ffcapi.ErrorReasonInvalidInputs, errRes.Reason) - -} - -func TestServerIncompatibleVersion(t *testing.T) { - - s, _ := newTestFFCAPIServer() - recorder := httptest.NewRecorder() - s.ServeFFCAPI(context.Background(), []byte(`{ - "ffcapi": { - "version": "v99.0.0" - } - }`), recorder) - - assert.Equal(t, recorder.Result().StatusCode, 400) - var errRes ffcapi.ErrorResponse - err := json.NewDecoder(recorder.Body).Decode(&errRes) - assert.NoError(t, err) - assert.Regexp(t, "FFEC100209", errRes.Error) - assert.Regexp(t, ffcapi.ErrorReasonInvalidInputs, errRes.Reason) - -} - -func TestServerMissingID(t *testing.T) { - - s, _ := newTestFFCAPIServer() - recorder := httptest.NewRecorder() - s.ServeFFCAPI(context.Background(), []byte(`{ - "ffcapi": { - "version": "v1.0.1" - } - }`), recorder) - - assert.Equal(t, recorder.Result().StatusCode, 400) - var errRes ffcapi.ErrorResponse - err := json.NewDecoder(recorder.Body).Decode(&errRes) - assert.NoError(t, err) - assert.Regexp(t, "FFEC100211", errRes.Error) - assert.Regexp(t, ffcapi.ErrorReasonInvalidInputs, errRes.Reason) - -} - -func TestServerUnknownRequestType(t *testing.T) { - - s, _ := newTestFFCAPIServer() - recorder := httptest.NewRecorder() - s.ServeFFCAPI(context.Background(), []byte(`{ - "ffcapi": { - "version": "v1.0.1", - "id": "`+fftypes.NewUUID().String()+`", - "type": "test" - } - }`), recorder) - - assert.Equal(t, recorder.Result().StatusCode, 400) - var errRes ffcapi.ErrorResponse - err := json.NewDecoder(recorder.Body).Decode(&errRes) - assert.NoError(t, err) - assert.Regexp(t, "FFEC100210", errRes.Error) - assert.Regexp(t, ffcapi.ErrorReasonInvalidInputs, errRes.Reason) - -} - -func TestServerUnknownRequestOK(t *testing.T) { - - s, _ := newTestFFCAPIServer() - s.handlerMap[ffcapi.RequestType("test")] = func(ctx context.Context, payload []byte) (res interface{}, reason ffcapi.ErrorReason, err error) { - return map[string]interface{}{ - "test": "data", - }, "", nil - } - recorder := httptest.NewRecorder() - s.ServeFFCAPI(context.Background(), []byte(`{ - "ffcapi": { - "version": "v1.0.1", - "id": "`+fftypes.NewUUID().String()+`", - "type": "test" - } - }`), recorder) - - assert.Equal(t, recorder.Result().StatusCode, 200) - var mapRes map[string]interface{} - err := json.NewDecoder(recorder.Body).Decode(&mapRes) - assert.NoError(t, err) - assert.Regexp(t, "data", mapRes["test"]) - -} - -func TestMapReasonStatus(t *testing.T) { - s, _ := newTestFFCAPIServer() - assert.Equal(t, 404, s.mapReasonStatus(ffcapi.ErrorReasonNotFound)) - assert.Equal(t, 400, s.mapReasonStatus(ffcapi.ErrorReasonInvalidInputs)) - assert.Equal(t, 500, s.mapReasonStatus("")) -} diff --git a/internal/messages/messages.go b/internal/messages/messages.go index 607f730..f5d949e 100644 --- a/internal/messages/messages.go +++ b/internal/messages/messages.go @@ -18,7 +18,6 @@ import ( "encoding/json" "reflect" - "github.com/hyperledger/firefly-common/pkg/ffcapi" "github.com/hyperledger/firefly-ethconnect/internal/errors" ethbinding "github.com/kaleido-io/ethbinding/pkg" ) @@ -79,7 +78,6 @@ type CommonHeaders struct { // RequestCommon is a common interface to all requests type RequestCommon struct { Headers RequestHeaders `json:"headers"` - FFCAPI *ffcapi.Header `json:"ffcapi,omitempty"` } // RequestHeaders are common to all replies diff --git a/internal/rest/webhooks.go b/internal/rest/webhooks.go index a37d339..e97f705 100644 --- a/internal/rest/webhooks.go +++ b/internal/rest/webhooks.go @@ -23,7 +23,6 @@ import ( "github.com/hyperledger/firefly-ethconnect/internal/contractgateway" "github.com/hyperledger/firefly-ethconnect/internal/errors" "github.com/hyperledger/firefly-ethconnect/internal/eth" - "github.com/hyperledger/firefly-ethconnect/internal/ffcapiconnector" "github.com/hyperledger/firefly-ethconnect/internal/messages" "github.com/hyperledger/firefly-ethconnect/internal/utils" "github.com/julienschmidt/httprouter" @@ -42,7 +41,6 @@ type webhooks struct { handler webhooksHandler receipts *receiptStore rpcClient eth.RPCClient - ffc ffcapiconnector.FFCServer } func newWebhooks(handler webhooksHandler, receipts *receiptStore, smartContractGW contractgateway.SmartContractGateway, rpcClient eth.RPCClient, ethCommonConf eth.EthCommonConf) *webhooks { @@ -51,9 +49,6 @@ func newWebhooks(handler webhooksHandler, receipts *receiptStore, smartContractG receipts: receipts, smartContractGW: smartContractGW, rpcClient: rpcClient, - ffc: ffcapiconnector.NewFFCServer(rpcClient, &ffcapiconnector.FFCServerConf{ - EthCommonConf: ethCommonConf, - }), } } @@ -100,14 +95,6 @@ func (w *webhooks) webhookHandler(res http.ResponseWriter, req *http.Request, ac return } - // FFCAPI calls are handled separately - _, exists := msg["ffcapi"] - if exists { - payload, _ := json.Marshal(msg) - w.ffc.ServeFFCAPI(req.Context(), payload, res) - return - } - log.Infof("--> %s %s", req.Method, req.URL) // Special body parameter on webhook to ask for an immediate receipt diff --git a/internal/rest/webhooks_test.go b/internal/rest/webhooks_test.go index fb9aa0a..e84ab3b 100644 --- a/internal/rest/webhooks_test.go +++ b/internal/rest/webhooks_test.go @@ -28,7 +28,6 @@ import ( "github.com/hyperledger/firefly-ethconnect/internal/messages" "github.com/hyperledger/firefly-ethconnect/internal/receipts" "github.com/hyperledger/firefly-ethconnect/mocks/ethmocks" - "github.com/hyperledger/firefly-ethconnect/mocks/ffcapiconnectormocks" "github.com/julienschmidt/httprouter" ethbinding "github.com/kaleido-io/ethbinding/pkg" "github.com/stretchr/testify/assert" @@ -231,40 +230,6 @@ func TestWebhookHandlerTransaction(t *testing.T) { assert.Regexp(regexp.MustCompile(`\w{8}-\w{4}-\w{4}-\w{4}-\w{12}`), asyncResponse.Request) } -func TestWebhookHandlerFFCAPI(t *testing.T) { - assert := assert.New(t) - - req, _ := http.NewRequest("POST", "/any", bytes.NewReader([]byte(`{ - "ffcapi": { - "version": "v1.0.0", - "id": "904F177C-C790-4B01-BDF4-F2B4E52E607E", - "type": "get_block_info_by_number" - }, - "blockNumber": "12345" - }`))) - ffcMocks := &ffcapiconnectormocks.FFCServer{} - ffcMocks.On("ServeFFCAPI", mock.Anything, mock.Anything, mock.Anything).Return().Run(func(args mock.Arguments) { - w := args[2].(http.ResponseWriter) - w.Write([]byte(`{"ok": true}`)) - }) - - w := &webhooks{ - smartContractGW: &mockContractGW{}, - handler: &mockHandler{}, - ffc: ffcMocks, - } - rec := httptest.NewRecorder() - w.webhookHandler(rec, req, false) - res := rec.Result() - assert.Equal(200, res.StatusCode) - - defer res.Body.Close() - var resMap map[string]interface{} - json.NewDecoder(res.Body).Decode(&resMap) - assert.True(resMap["ok"].(bool)) - -} - func TestWebhookHandlerTransactionWithID(t *testing.T) { assert := assert.New(t) diff --git a/mocks/ffcapiconnectormocks/ffc_server.go b/mocks/ffcapiconnectormocks/ffc_server.go deleted file mode 100644 index af9d48f..0000000 --- a/mocks/ffcapiconnectormocks/ffc_server.go +++ /dev/null @@ -1,21 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package ffcapiconnectormocks - -import ( - context "context" - - http "net/http" - - mock "github.com/stretchr/testify/mock" -) - -// FFCServer is an autogenerated mock type for the FFCServer type -type FFCServer struct { - mock.Mock -} - -// ServeFFCAPI provides a mock function with given fields: ctx, payload, w -func (_m *FFCServer) ServeFFCAPI(ctx context.Context, payload []byte, w http.ResponseWriter) { - _m.Called(ctx, payload, w) -}