Skip to content

Remove unused ModuleProgram #321

@LesterEvSe

Description

@LesterEvSe

While researching implementation of the mod keyword related to issue #318, I found an unnecessary ModuleProgram struct.

Researching further, I found that it is used inside current simplicity-webide. The main flow currently lives in program_tab.rs L66 and follows by the simple Web IDE P2PK example:

mod witness {
    const ALICE_SIGNATURE: [u8; 64] = 0xf12fb2ed7d1d42bf20fb6c8aff9f9f6bcd53632a80e4f50541dd0f2e41a987e74444624e143ee72a85473667a6af783d8b1577be5028568233f5d3f7c6379d41;
}

mod param {
    const ALICE_PUBLIC_KEY: u256 = 0x9bef8d556d80e43ae7e0becb3a7e6838b95defe45896ed6075bb9035d06c9964;
}

fn main() {
    jet::bip_0340_verify((param::ALICE_PUBLIC_KEY, jet::sig_all_hash()), witness::ALICE_SIGNATURE)
}

The current pipeline works as follows:

  1. Parse arguments: Extract param block from SimplicityHL source, ignoring all other code (handled by SimplicityHL itself).
  2. Compile: Run the SimplicityHL compiler with the parsed params, ignoring all mod keywords.
  3. Parse witness: Extract witness data and attach it to the compiled program (handled by SimplicityHL too).

As a result, I think we need a better approach here and ModuleProgram does not seem necessary for it.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestinvalidThis doesn't seem right

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions