-
Notifications
You must be signed in to change notification settings - Fork 52
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 trait to encode objects for the advice map #677
Comments
Well, I wrote the above thinking that populating the advice map would be sufficient because I was thinking mostly about miden-base/miden-lib/asm/miden/kernels/tx/account.masm Lines 396 to 398 in 3834055
But there are other procedures which would also be great to test in isolation, that require advice stack data too, like miden-base/miden-lib/asm/miden/kernels/tx/prologue.masm Lines 423 to 427 in 3834055
maybe another trait for stack inputs would also be useful. I also proposed more general traits in the crypto crate 0xPolygonMiden/crypto#312 which could be useful. |
One potential issue here is that the way an object is to be added to the advice provider is not an intrinsic property of an object but rather a property of the program which will use this object. So, for example, the transaction kernel may expect a block header to be inserted into the advice map in one way, while block header may expect it to be inserted in another way. Not to say that this will always happen (and maybe in case of the block header it will be the same in both cases), but it is definitely possible. This was the primary reason for introducing Would it not be possible to implement |
What should be done?
Currently there is a single trait to convert the different types of transactions to advice inputs:
miden-base/miden-lib/src/transaction/inputs.rs
Lines 18 to 22 in 3834055
However, there is not trait to convert individual structs into advice map data, so the whole map is populated via standalone functions:
miden-base/miden-lib/src/transaction/inputs.rs
Lines 85 to 98 in 3834055
This creates a problem while testing, because to populate the advice for testing, a transaction is needed, to create a transaction, one needs a the block header and account, and so on. This results in a lot of setup code to write tests and hides the important details.
To facilitate testing, it would be good to have a trait similar to the following (just a sketch, needs further work)
It should make it easier to write tests without requiring creating the whole mock state.
How should it be done?
When is this task done?
After adding a strategy to simplify tests, perhaps with the trait above, and there is a test example to demonstrate the new approach.
Additional context
The motivation for this is testing of the new account verification code, which currently runs the complete prologue because there is no easy way to provide just the account seed:
miden-base/miden-lib/src/tests/test_prologue.rs
Lines 341 to 361 in 3834055
The text was updated successfully, but these errors were encountered: