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

fix(staking): return single struct responses for queries #1734

Merged
merged 7 commits into from
Aug 31, 2023

Conversation

Vvaradinov
Copy link
Contributor

@Vvaradinov Vvaradinov commented Aug 30, 2023

Description

This PR refactors some of the queries that previously were wrapped in a slice to avoid errors. Now they return a single struct response as expected from their Cosmos SDK return types.


Closes ENG-2005

@linear
Copy link

linear bot commented Aug 30, 2023

ENG-2005 Single struct return from precompile queries - Staking precompile

Current

We were wrapping single struct responses in an array because there was an issue with returning the single struct directly. The solution was to wrap the struct in another struct so it can be packed correctly by the ABI in go-ethereum.

Expected

Modify the queries and transactions that are wrapping the response in an array to return single struct responses to be more user friendly for SC developers and map correctly to the Cosmos SDK return types.

@Vvaradinov Vvaradinov changed the title fix(staking): Return single struct responses for queries fix(staking): return single struct responses for queries Aug 30, 2023
@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Merging #1734 (0fc06b6) into main (147bfa0) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1734      +/-   ##
==========================================
+ Coverage   70.33%   70.34%   +0.01%     
==========================================
  Files         297      297              
  Lines       22275    22283       +8     
==========================================
+ Hits        15667    15675       +8     
  Misses       5841     5841              
  Partials      767      767              
Files Changed Coverage
precompiles/staking/query.go 100.00%
precompiles/staking/types.go 100.00%

@Vvaradinov Vvaradinov marked this pull request as ready for review August 30, 2023 08:46
@Vvaradinov Vvaradinov requested a review from a team as a code owner August 30, 2023 08:46
@Vvaradinov Vvaradinov requested review from MalteHerrmann and GAtom22 and removed request for a team August 30, 2023 08:46
Copy link
Contributor

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

This API breaking. Can you add a changelog entry

@Vvaradinov Vvaradinov merged commit e47d230 into main Aug 31, 2023
32 of 33 checks passed
@Vvaradinov Vvaradinov deleted the Vvaradinov/staking-single-response branch August 31, 2023 07:06
@Vvaradinov
Copy link
Contributor Author

https://github.com/Mergifyio backport release/v14.0.x

@mergify
Copy link
Contributor

mergify bot commented Sep 5, 2023

backport release/v14.0.x

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Sep 5, 2023
* fix: modify Staking interface and regenerate abi.json

* fix: adjust return responses

* fix: convert return types for queries into single structs

* add CHANGELOG

* fix: CHANGELOG

(cherry picked from commit e47d230)

# Conflicts:
#	CHANGELOG.md
@GAtom22
Copy link
Contributor

GAtom22 commented Oct 16, 2023

https://github.com/Mergifyio backport release/v15.0.x

@mergify
Copy link
Contributor

mergify bot commented Oct 16, 2023

backport release/v15.0.x

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Oct 16, 2023
* fix: modify Staking interface and regenerate abi.json

* fix: adjust return responses

* fix: convert return types for queries into single structs

* add CHANGELOG

* fix: CHANGELOG

(cherry picked from commit e47d230)

# Conflicts:
#	CHANGELOG.md
#	precompiles/staking/testdata/StakingCaller.json
Vvaradinov added a commit that referenced this pull request Oct 17, 2023
) (#1895)

* fix(staking): return single struct responses for queries (#1734)

* fix: modify Staking interface and regenerate abi.json

* fix: adjust return responses

* fix: convert return types for queries into single structs

* add CHANGELOG

* fix: CHANGELOG

(cherry picked from commit e47d230)

# Conflicts:
#	CHANGELOG.md
#	precompiles/staking/testdata/StakingCaller.json

* fix conflicts

* fix conflicts

* fix: regenerate ABI

---------

Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com>
Co-authored-by: tom <tomasguerraalda@hotmail.com>
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.

None yet

3 participants