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

Option to display leading zeros in corset inspect #250

Open
OlivierBBB opened this issue Aug 22, 2024 · 0 comments
Open

Option to display leading zeros in corset inspect #250

OlivierBBB opened this issue Aug 22, 2024 · 0 comments
Assignees

Comments

@OlivierBBB
Copy link
Collaborator

OlivierBBB commented Aug 22, 2024

Main issue

Many columns, e.g. LIMB columns in represent 16B data limbs. For these the leading zeros are part of the data and ought to be shown upon inspection. There should be an option (similar to the :display option for opcodes) to display these columns in full, leading zeros included.

This option may be extremely useful for debugging certain modules. Examples of modules containing LIMB columns are: SHAKIRA, ECDATA, RLP_TXN, BLAKE_MODEXP, RLP_ADDR, etc ... and most importantly of all: MMIO.


One could even imagine to have a link between columns of the form

LIMB     :i128 :limb-column :nbytes-given-by nBYTES
nBYTES   :i4

Where in corset inspect the LIMB would be displayed like so

  • always 16 bytes long
  • first nBYTES are normal color
  • any remaining 16 - nBYTES bytes are grayed out

Probably that's asking a little much :)

Illustration of the issue

The following example illustrates the issue. I wrote a test where I was computing KECCAK's of variations on the hex string deadbeef:

.push(4) .push(1) .op(OpCode.SHA3) // KEC(0xDEADBEEF)
.push(5) .push(0) .op(OpCode.SHA3) // KEC(0x00DEADBEEF)
.push(6) .push(0) .op(OpCode.SHA3) // KEC(0x00DEADBEEF00)
.push(5) .push(1) .op(OpCode.SHA3) // KEC(0xDEADBEEF00)
.push(4) .push(6) .op(OpCode.SHA3) // KEC(0xDEADBEEF)
.push(5) .push(6) .op(OpCode.SHA3) // KEC(0xDEADBEEF00)
.push(6) .push(5) .op(OpCode.SHA3) // KEC(0x00DEADBEEF00)
.push(5) .push(5) .op(OpCode.SHA3) // KEC(0x00DEADBEEF)

When running corset inspect I thought initially the data was badly provided to the SHAKIRA module as the outputs looked identical for everything, even in terms of colours of the LIMB column, e.g.

KECCAK256(0xDEADBEEF)

image

KECCAK256(0x00DEADBEEF)

image

Both pictures look identical although we aren't hashing the same stuff.

And in full:

image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants