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

Add address and swap endianness to vm opcode dump for hashes #3115

Merged
merged 1 commit into from
Sep 4, 2023

Conversation

tatiana-nspcc
Copy link
Contributor

Problem

Having difficulties manually converting hashes in opcode dumps.
The problem is described in #3030

Solution

If the parameter in the opcode dump is a 20-byte value, then add converted values, such as the address and the swapped endianness.

Close #3030

@codecov
Copy link

codecov bot commented Sep 3, 2023

Codecov Report

Merging #3115 (259cbc3) into master (5180305) will increase coverage by 0.06%.
The diff coverage is 62.50%.

@@            Coverage Diff             @@
##           master    #3115      +/-   ##
==========================================
+ Coverage   84.84%   84.90%   +0.06%     
==========================================
  Files         330      330              
  Lines       44343    44349       +6     
==========================================
+ Hits        37621    37656      +35     
+ Misses       5210     5178      -32     
- Partials     1512     1515       +3     
Files Changed Coverage Δ
pkg/vm/vm.go 93.00% <62.50%> (-0.19%) ⬇️

... and 4 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

pkg/vm/vm.go Outdated
// if the parameter is a 20-byte value.
u, err := util.Uint160DecodeBytesBE(parameter)
if err == nil {
desc = fmt.Sprintf("%x (Address:%q, Swap Endianness:%q)", parameter, address.Uint160ToString(u), "0x"+hex.EncodeToString(slice.CopyReverse(parameter)))
Copy link
Member

Choose a reason for hiding this comment

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

I'd avoid "address:" and "swap endianness:", the first one is obvious, the second is also not that hard to understand (Neo uses "0x..." notation for stringified reversed hashes all over the place).

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.

If the parameter in the opcode dump is a 20-byte value, the converted values,
such as the address and the swapped endianness, have been added.

Signed-off-by: Tatiana Nesterenko <[email protected]>
@roman-khimov roman-khimov merged commit a59fd50 into master Sep 4, 2023
13 of 18 checks passed
@roman-khimov roman-khimov deleted the 3030-opcode-dumps branch September 4, 2023 09:05
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.

Add reverse hash/address to opcode dumps for hashes
2 participants