Skip to content

feat: Add a transaction hash to TransactionInfo #2259

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kulikthebird
Copy link
Member

No description provided.

@kulikthebird kulikthebird force-pushed the tkulik/feat/transaction_hash branch 2 times, most recently from 00bd0e5 to 1163f33 Compare May 16, 2025 14:42
@kulikthebird kulikthebird force-pushed the tkulik/feat/transaction_hash branch from 1163f33 to 70e69c4 Compare May 19, 2025 14:51
@kulikthebird kulikthebird marked this pull request as ready for review May 19, 2025 14:51
Copy link

codecov bot commented May 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.18%. Comparing base (adea2f9) to head (70e69c4).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2259   +/-   ##
=======================================
  Coverage   45.18%   45.18%           
=======================================
  Files          79       79           
  Lines       10934    10935    +1     
=======================================
+ Hits         4940     4941    +1     
  Misses       5556     5556           
  Partials      438      438           
Files with missing lines Coverage Δ
x/wasm/types/types.go 60.42% <100.00%> (+0.16%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kulikthebird kulikthebird requested a review from chipshort May 19, 2025 15:13
@@ -291,7 +292,8 @@ func NewEnv(ctx sdk.Context, contractAddr sdk.AccAddress) wasmvmtypes.Env {
},
}
if txCounter, ok := TXCounter(ctx); ok {
env.Transaction = &wasmvmtypes.TransactionInfo{Index: txCounter}
hash := sha256.Sum256(ctx.TxBytes())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same hash that is used in Cosmos SDK / CometBFT? A quick scan through the CometBFT code looks to me like they use something called tmhash. Not sure if that's the correct one though. We should test that.
We want to have the same hash here that is also shown on the cli when you submit the transaction (e.g. when you run wasmd tx wasm instantiate) and that is used to query information about the transaction (e.g. using wasmd q tx ...).

@chipshort chipshort self-requested a review May 27, 2025 11:32
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.

2 participants