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

TM2 Result/Response clarifications #968

Open
jaekwon opened this issue Jul 12, 2023 · 0 comments
Open

TM2 Result/Response clarifications #968

jaekwon opened this issue Jul 12, 2023 · 0 comments

Comments

@jaekwon
Copy link
Contributor

jaekwon commented Jul 12, 2023

Suggested changes:

diff --git a/tm2/pkg/bft/abci/types/types.go b/tm2/pkg/bft/abci/types/types.go
index 637d09b9..0ac05520 100644
--- a/tm2/pkg/bft/abci/types/types.go
+++ b/tm2/pkg/bft/abci/types/types.go
@@ -163,8 +163,8 @@ type ResponseBeginBlock struct {
 
 type ResponseCheckTx struct {
        ResponseBase
-       GasWanted int64 // nondeterministic
-       GasUsed   int64
+       GasWanted int64
+       GasUsed   int64 // nondeterminstic
 }
 
 type ResponseDeliverTx struct {
diff --git a/tm2/pkg/bft/types/results.go b/tm2/pkg/bft/types/results.go
index fd2c787f..c872b8b9 100644
--- a/tm2/pkg/bft/types/results.go
+++ b/tm2/pkg/bft/types/results.go
@@ -8,7 +8,10 @@ import (
 
 //-----------------------------------------------------------------------------
 
-// ABCIResult is the deterministic component of a ResponseDeliverTx.
+// ABCIResult is the deterministic component of a ResponseDeliverTx
+// which gets saved in the blockchain per block.
+// NOTE: ResponseCheckTx does not get stored separately since
+// ResponseDeliverTx includes any errors from the ante handler.
 // TODO: add tags and other fields
 // https://github.com/tendermint/classic/issues/1007
 type ABCIResult struct {
diff --git a/tm2/pkg/sdk/helpers.go b/tm2/pkg/sdk/helpers.go
index d61e8115..8f0cf761 100644
--- a/tm2/pkg/sdk/helpers.go
+++ b/tm2/pkg/sdk/helpers.go
@@ -37,6 +37,7 @@ func ABCIError(err error) abci.Error {
        return abci.ABCIErrorOrStringError(err)
 }
 
+// XXX rename to ResultFromError?
 func ABCIResultFromError(err error) (res Result) {
        res.Error = ABCIError(err)
        res.Log = fmt.Sprintf("%#v", err)
diff --git a/tm2/pkg/sdk/types.go b/tm2/pkg/sdk/types.go
index 47395362..2be8e133 100644
--- a/tm2/pkg/sdk/types.go
+++ b/tm2/pkg/sdk/types.go
@@ -20,7 +20,9 @@ type Handler interface {
        Query(ctx Context, req abci.RequestQuery) abci.ResponseQuery
 }
 
-// Result is the union of ResponseDeliverTx and ResponseCheckTx plus events.
+// Result is the result of processing a tx from the SDK.
+// It becomes either a ResponseDeliverTx or ResponseCheckTx
+// depending on the mode of execution.
 type Result struct {
        abci.ResponseBase
        GasWanted int64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🌟 Wanted for Launch
Development

No branches or pull requests

3 participants