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 time for off-chain testing #1713

Closed
1 task
cmichi opened this issue Mar 14, 2023 · 4 comments
Closed
1 task

Allow setting block time for off-chain testing #1713

cmichi opened this issue Mar 14, 2023 · 4 comments
Assignees
Labels
B-enhancement New feature or request good first issue Good for newcomers

Comments

@cmichi
Copy link
Collaborator

cmichi commented Mar 14, 2023

Escalated from this StackExchange question: https://substrate.stackexchange.com/questions/7034/is-it-possible-to-override-ink-envtest-default-block-time.

ToDo

  • Add a method Engine::set_block_time(time: BlockTimestamp).
@cmichi cmichi added B-enhancement New feature or request good first issue Good for newcomers labels Mar 14, 2023
@CrommVardek
Copy link
Contributor

I'm working on this, but before submitting my PR, shouldn't the env_access (using Env api) also implement a ink_env::set_block_time() function ?

Sorry if I'm missing something here, first time digging into ink! code base.

@cmichi
Copy link
Collaborator Author

cmichi commented Mar 17, 2023

@CrommVardek It's best if you look at the function advance_block in crates/engine/src/test_api.rs and implement set_block_time analog to it. So in your IDE you can look for usages of advance_block and add set_block_time to all these places as well.

IIRC it should just be crates/env/src/engine/off_chain/test_api.rs.

@CrommVardek
Copy link
Contributor

PR #1721 opened

@cmichi
Copy link
Collaborator Author

cmichi commented Mar 27, 2023

Closed with #1721.

@cmichi cmichi closed this as completed Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants