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

fixed error on withKeys #6247

Merged
merged 12 commits into from
Jul 17, 2024
Merged

Conversation

raduchis
Copy link
Contributor

@raduchis raduchis commented Jun 7, 2024

Reasoning behind the pull request

  • account with Keys does not work for empty accounts

Proposed changes

  • take into consideration empty accounts and check for nil

Testing procedure

  • run testnet and call address/:address?withKeys=true for multiple accounts, some with DataTries, some without and some not created yet

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

node/node.go Outdated
@@ -960,6 +960,10 @@ func (n *Node) GetAccountWithKeys(address string, options api.AccountQueryOption
return api.AccountResponse{}, api.BlockInfo{}, err
}

if accInfo.account == nil || accInfo.account.DataTrie() == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this method only used when options.WithKeys is set?

if yes then all good, otherwise maybe you need to move the check for DataTrie in the code block starting at line 968

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved inside the if on line 968

gabi-vuls
gabi-vuls previously approved these changes Jun 10, 2024
Copy link
Contributor

@gabi-vuls gabi-vuls left a comment

Choose a reason for hiding this comment

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

Normal allin test: 1.7.12-2a6916fbce -> MX-15556-Bugfix-Account-Wi-3dc4427bd2

--- Specific errors ---

block hash does not match 2133
wrong nonce in block 878
miniblocks does not match 0
num miniblocks does not match 0
miniblock hash does not match 0
block bodies does not match 1
receipts hash missmatch 0

/------/

--- Statistics ---

Nr. of all ERRORS: 0
Nr. of all WARNS: 599
Nr. of new ERRORS: 0
Nr. of new WARNS: 17
Nr. of PANICS: 0

/------/

--- ERRORS ---

/------/

--- WARNINGS ---

/------/

@mariusmihaic mariusmihaic self-requested a review June 12, 2024 10:46
mariusmihaic
mariusmihaic previously approved these changes Jun 12, 2024
AdoAdoAdo
AdoAdoAdo previously approved these changes Jul 9, 2024
@raduchis raduchis dismissed stale reviews from AdoAdoAdo and mariusmihaic via 3952387 July 12, 2024 13:46
}

if check.IfNil(userAccount.DataTrie()) {
return map[string]string{}, api.BlockInfo{}, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe just here return you need to return the blockinfo, the others with error should still return zero values

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

mariusmihaic
mariusmihaic previously approved these changes Jul 12, 2024
@lcswillems
Copy link
Contributor

lcswillems commented Jul 13, 2024

Copy link
Collaborator

@danidrasovean danidrasovean left a comment

Choose a reason for hiding this comment

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

Normal allin test: v1.7.13-dev-config-aebb55e8e0 -> MX-15556-Bugfix-Account-Wi-e520f75f28

--- Specific errors ---

block hash does not match 1165
wrong nonce in block 477
miniblocks does not match 0
num miniblocks does not match 0
miniblock hash does not match 0
block bodies does not match 0
receipts hash missmatch 0

/------/

--- Statistics ---

Nr. of all ERRORS: 1
Nr. of all WARNS: 675
Nr. of new ERRORS: 1
Nr. of new WARNS: 3
Nr. of PANICS: 0

/------/

@raduchis raduchis merged commit 3f3e5c4 into rc/v1.7.next1 Jul 17, 2024
8 checks passed
@raduchis raduchis deleted the MX-15556-Bugfix-Account-WithKeys branch July 17, 2024 10:29
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.

7 participants