Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflect through submissionRejected JSON body from FFTM/EVMConnect #1436

Merged
merged 10 commits into from
Dec 21, 2023

Conversation

peterbroadhurst
Copy link
Contributor

@peterbroadhurst peterbroadhurst commented Dec 21, 2023

On invoke contract or deploy contract, with idempotencyKey set, we were previously leaving operation status as Initialized after failing to submit a transaction due to a revert during transaction submission.

This PR allows the blockchain connectors to return a submissionRejected: true boolean in the JSON response to the submission, to state that the failure is not a temporary infrastructure issue that is retryable in nature, and rather a rejection of the transaction as invalid. In that case, the status will be Failed.

FF Core part of #1435

Works with hyperledger/firefly-transaction-manager#104

Depends on the following (new E2E test should fail without these):

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
@codecov-commenter
Copy link

codecov-commenter commented Dec 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4645f28) 99.99% compared to head (5084926) 99.99%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1436   +/-   ##
=======================================
  Coverage   99.99%   99.99%           
=======================================
  Files         321      321           
  Lines       23092    23105   +13     
=======================================
+ Hits        23090    23103   +13     
  Misses          1        1           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@peterbroadhurst
Copy link
Contributor Author

peterbroadhurst commented Dec 21, 2023

While writing E2E test I found this possible EOF REST API return from /generate that I'm fixing too:

2023/12/21 16:46:57 http: panic serving 172.21.0.1:62278: runtime error: invalid memory address or nil pointer dereference
goroutine 5783 [running]:
net/http.(*conn).serve.func1()
	/usr/local/go/src/net/http/server.go:1850 +0xb8
panic({0xe68ba0, 0x17a9e10})
	/usr/local/go/src/runtime/panic.go:890 +0x260
github.com/hyperledger/firefly/internal/blockchain/ethereum.(*Ethereum).GenerateFFI(0x52a8?, {0x11d4538, 0x40009da1b0}, 0x4000b60690)
	/firefly/internal/blockchain/ethereum/ethereum.go:1003 +0x94
github.com/hyperledger/firefly/internal/contracts.(*contractManager).GenerateFFI(0x4000392b60, {0x11d4538, 0x40009da1b0}, 0xeee9c0?)
	/firefly/internal/contracts/manager.go:1004 +0x124
github.com/hyperledger/firefly/internal/apiserver.glob..func186(0x11e2b30?, 0x4000e6abc0)
	/firefly/internal/apiserver/route_post_contract_interface_generate.go:44 +0x70
github.com/hyperledger/firefly/internal/apiserver.(*apiServer).routeHandler.func1(0x400007d980)
	/firefly/internal/apiserver/server.go:232 +0x3a4
github.com/hyperledger/firefly-common/pkg/ffapi.(*HandlerFactory).RouteHandler.func1({0x11d36b8, 0x4000443ee0}, 0x40007b7f00)
	/go/pkg/mod/github.com/hyperledger/firefly-common@v1.3.1-0.20230912221149-2b028031e84a/pkg/ffapi/handler.go:201 +0x63c
github.com/hyperledger/firefly-common/pkg/ffapi.(*HandlerFactory).APIWrapper.func1({0x11d36b8?, 0x4000443ee0}, 0x40007b7e00)
	/go/pkg/mod/github.com/hyperledger/firefly-common@v1.3.1-0.20230912221149-2b028031e84a/pkg/ffapi/handler.go:303 +0x29c
net/http.HandlerFunc.ServeHTTP(0x40009da090?, {0x11d36b8?, 0x4000443ee0?}, 0x20?)
	/usr/local/go/src/net/http/server.go:2109 +0x38
gitlab.com/hfuss/mux-prometheus/pkg/middleware.(*Instrumentation).Middleware.func1({0x11d3a78?, 0x4000347a40}, 0x40007b7e00)
	/go/pkg/mod/gitlab.com/hfuss/mux-prometheus@v0.0.5/pkg/middleware/middleware.go:69 +0xbc
net/http.HandlerFunc.ServeHTTP(0x40007b7d00?, {0x11d3a78?, 0x4000347a40?}, 0x693c59ef487720ad?)
	/usr/local/go/src/net/http/server.go:2109 +0x38
github.com/gorilla/mux.(*Router).ServeHTTP(0x400039e180, {0x11d3a78, 0x4000347a40}, 0x40007b7c00)
	/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0x1a4
github.com/rs/cors.(*Cors).Handler.func1({0x11d3a78, 0x4000347a40}, 0x40007b7c00)
	/go/pkg/mod/github.com/rs/cors@v1.8.3/cors.go:236 +0x1e4
net/http.HandlerFunc.ServeHTTP(0x0?, {0x11d3a78?, 0x4000347a40?}, 0x69d034?)
	/usr/local/go/src/net/http/server.go:2109 +0x38
net/http.serverHandler.ServeHTTP({0x11d1978?}, {0x11d3a78, 0x4000347a40}, 0x40007b7c00)
	/usr/local/go/src/net/http/server.go:2947 +0x2cc
net/http.(*conn).serve(0x4000a73cc0, {0x11d4538, 0x4000317560})
	/usr/local/go/src/net/http/server.go:1991 +0x544
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:3102 +0x43c

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
@peterbroadhurst peterbroadhurst marked this pull request as ready for review December 21, 2023 17:33
@peterbroadhurst peterbroadhurst requested a review from a team as a code owner December 21, 2023 17:33
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants