fetchd icon indicating copy to clipboard operation
fetchd copied to clipboard

Block time is incorrect if mining interval is less than 1

Open dishmop opened this issue 3 years ago • 1 comments

Prerequisites

Expected Behavior

I expect the block.time.seconds() to go up about 1 every second

Current Behavior

If I run the node replacing 5 in the timeout_commit config with 0.25, then time rises about twice as quickly as realtime in the contracts. My initialisation script does this: sed -i 's/timeout_commit = "5s"/timeout_commit = "0.25s"/g' ~/.fetchd/config/config.toml

prior to calling fetchd start

I then ran a python script which every second queried a contract which returned the block.time. This is the table:

Rust: env.block.time.seconds(), Python time.time()
0.0, 0.0
3.0. 1.0
5.0, 2.0
7.0. 3.0
9.0. 4.0
11.0, 5.0
13.0, 6.0
15.0, 7.0
17.0, 8.0
19.0, 9.0

You can see that the contract time rises about twice as fast as the realtime (measured in python).

This is only an issue when the timeout_commit time is < 1. However, this is kind of crucial for us otherwise development becomes impossibly slow.

To Reproduce

Talk to Diarmid and I can point you to code.

Context

OSX Fetchd version (docker image) image: fetchai/fetchd:0.9.0-rc4

Failure Logs

No response

dishmop avatar Jun 16 '22 12:06 dishmop

These 3 seconds seem to match the timeout_propose parameter default value. You can try to adjust this as well. Other than this I have no clue how to configure tendermint to achieve what you want, probably worth you ask over https://github.com/tendermint/tendermint or reach on cosmos discord someone to help you.

daeMOn63 avatar Jun 16 '22 13:06 daeMOn63