sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Self.Anything is parsed as an address

Open fulltimemike opened this issue 3 years ago • 1 comments

🐛 Bug Report

Self.anything will be parsed as an address. Self.caller parses correctly, however; self.a or self.b will parse as addresses.

Steps to Reproduce

Code snippet to reproduce

program bug.aleo;

record bug:
    owner as address.private;
    gates as u64.private;
    a as address.private;
    b as address.private;
    not_an_aleo_opcode as address.private;

function example:
    cast self.caller 0u64 self.a self.b self.not_an_aleo_opcode into r0 as bug.record;

    output r0 as bug.record;

Stack trace & error message

➡️  Output

 • {
  owner: aleo1pas6kcc8nwqawwqu9fhz99anqkk9ccd9q0fk3nc3wzsr0utt7cxq5klu4k.private,
  gates: 0u64.private,
  a: aleo1c0k9657psh8qzr2usfw6u7a7yu6mwe6wh2ypup4t2ugpx784wsrqp53rdl.private,
  b: aleo1wk535qg0h9tarqeu40zkmpr0qv5mhdfa5lue6qcdcwtwgqm2pq9q2ezssx.private,
  not_an_aleo_opcode: aleo13h4g6epkv8a6z48waewdr9jp5gf4xmnuamhwy3a8n936t73j8vrq9uaz39.private,
  _nonce: 5582012585678402213691137563223232720299537956048903574854357996637224826608group.public
}

Expected Behavior

Only implemented attributes of self in aleo should parse (like self.caller and self.parent in the future), and should otherwise throw an error. Note, each of the addresses parsed (self.a, self.b, self.not_an_aleo_opcode) are deterministic -- repeated runs on different machines will yield the same address, so the self.[trait_name] is likely being hashed here in snarkVM. I'm including this in case it helps with pinpointing the bug's location.

Your Environment

  • Aleo Version https://github.com/AleoHQ/aleo/commit/901453f1a9f1f38c5b3efaef0b1eddf21060c0bc
  • rustup 1.25.1
  • MacOS

fulltimemike avatar Oct 14 '22 03:10 fulltimemike

How to solve this debug issue?

tlam2007 avatar Nov 26 '22 11:11 tlam2007