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

Allow setting block timestamp and block number when using TransactionContextBuilder #788

Open
partylikeits1983 opened this issue Jul 4, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@partylikeits1983
Copy link
Contributor

Feature description

It would be useful to be able to set the block timestamp and the block number when using TransactionContextBuilder for notes that have time based logic.

The logic of setting the timestamp and block number is the in the seal_block function:

mock_chain.seal_block();

Why is this feature needed?

Testing of notes with time based logic.

@partylikeits1983 partylikeits1983 added the enhancement New feature or request label Jul 4, 2024
@bobbinth
Copy link
Contributor

cc @igamigo

@igamigo
Copy link
Collaborator

igamigo commented Jul 23, 2024

I think setting the block number makes sense, but is there any real use case in terms of transaction or note scripts related to timestamps?

@partylikeits1983
Copy link
Contributor Author

I think setting the block number makes sense, but is there any real use case in terms of transaction or note scripts related to timestamps?

Having the timestamp available inside the kernel would be useful, but it isn't absolutely necessary. You could create some "timelock" account and compute the time until unlock by knowing the Miden blocktime * number_of_blocks.

Setting the block number in the TransactionContextBuilder would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants