snarkVM icon indicating copy to clipboard operation
snarkVM copied to clipboard

[Feature] Add self.address to the Aleo instructions

Open snowtigersoft opened this issue 1 year ago • 1 comments

🚀 Feature

Add self.address to the Aleo instructions & Leo

Motivation

The ability to reference a program's own address within its instructions is a crucial feature that's currently missing in snarkVM. As it stands, to utilize a program's address within the program itself, one must pre-calculate this address before deployment. This process is prone to errors, especially during program upgrades, where there's a risk of mistakenly using an old program's address. Incorporating a self.address feature directly into the instructions would significantly streamline development, reduce errors, and facilitate smoother program upgrades.

This feature request is motivated by the practical need to reference the deploying program's address more dynamically and accurately within the Aleo ecosystem. It relates to the broader goal of enhancing developer experience and program reliability on the platform.

Implementation

To support this feature in snarkVM:

  • Introduce a new instruction, self.address, that when called, returns the address of the current program.
  • This addition would require modifications to the snarkVM instruction set and possibly the execution environment to correctly interpret and execute this new instruction.
  • Ensure that self.address an be seamlessly integrated into existing and future Aleo programs without breaking changes.

snowtigersoft avatar Feb 24 '24 17:02 snowtigersoft

Thank you! @d0cd is currently working on program upgradability, which may resolve the need for this issue!

vicsn avatar Mar 10 '25 19:03 vicsn