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

feat: adding basic tally structure #272

Merged
merged 31 commits into from
Jun 21, 2024
Merged

feat: adding basic tally structure #272

merged 31 commits into from
Jun 21, 2024

Conversation

hacheigriega
Copy link
Member

@hacheigriega hacheigriega commented May 17, 2024

Explanation of Changes

This PR implements the basic tally structure in the endblocker of the wasm-storage module. The endblocker first fetches tally-ready data requests from the SEDA contract, whose address is registered during the instantiation process. Then, the tally wasm associated with each of the data requests is executed on tally VM. The major missing parts are:

  • Filtering phase
  • Providing correct arguments (such as correct reveals and outlier reveals) and environments to tally VM
  • Posting tally execution results to contract
  • Building with tally VM shared library
  • Improve error handling

The PR also includes:

  • Added missing collections schema initialization
  • Fixed invalid collections names
  • Wasm-storage module keeper refactor (to enhance clarity and to enable mock testing)

Testing

Currently, the tally mechanism is tested using a mock function that mocks the SEDA contract's requests_by_status query endpoint.

Closes #127 and #53 and #281

@hacheigriega hacheigriega marked this pull request as ready for review June 5, 2024 21:13
@hacheigriega hacheigriega changed the title feat: adding tally VM feat: adding basic tally structure Jun 6, 2024
@hacheigriega hacheigriega requested a review from a team June 17, 2024 17:44
x/wasm-storage/keeper/abci.go Outdated Show resolved Hide resolved
x/wasm-storage/keeper/abci.go Show resolved Hide resolved
x/wasm-storage/keeper/abci.go Show resolved Hide resolved
}

// 4. Post result.
// msg := []byte("{\"data_requests\": {}}")
Copy link
Contributor

Choose a reason for hiding this comment

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

x/wasm-storage/keeper/abci_test.go Outdated Show resolved Hide resolved
@hacheigriega hacheigriega requested a review from gluax June 18, 2024 19:33
@hacheigriega hacheigriega requested a review from a team June 18, 2024 20:06
@hacheigriega
Copy link
Member Author

hacheigriega commented Jun 18, 2024

Should be ready to be merged now as tally works until VM execution, which fails with an error. The execution phase can be addressed in a new PR.

Copy link
Contributor

@DeshErBojhaa DeshErBojhaa left a comment

Choose a reason for hiding this comment

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

Great work 🎉
some minor nitpicks.

x/wasm-storage/keeper/abci.go Show resolved Hide resolved
Comment on lines +98 to +103
keys := make([]string, len(req.Reveals))
i := 0
for k := range req.Reveals {
keys[i] = k
i++
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
keys := make([]string, len(req.Reveals))
i := 0
for k := range req.Reveals {
keys[i] = k
i++
}
keys := make([]string, 0, len(req.Reveals))
for k := range req.Reveals {
keys = append(keys, k)
}

@hacheigriega hacheigriega merged commit 64a6499 into main Jun 21, 2024
32 of 34 checks passed
@hacheigriega hacheigriega deleted the hy/tally2 branch June 21, 2024 14:55
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.

✨ x/tally: Fetching phase
3 participants