-
Notifications
You must be signed in to change notification settings - Fork 1
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
Don't execute smartcontracts twice on the leader #56
Comments
I believe this is because the whole Dela software doesn't treat one's own node differently from the other nodes. As such, when something needs to be processed by all nodes, it'll be sent for all nodes to process. In this particular case, I suspect the leader executes the contract once, when building a block and before proposing it to all the nodes (incl. itself), then a second time once the block is sent to all the nodes (incl. the leader itself) for validation/integration in the blockchain. |
So there should be a cache to avoid executing the contract twice. I'm not sure if my calculations are exact. But even for the worst case (meaning my calculations were right), voting time would go down from 100ms to 80ms. So I don't think it's worth it. But I keep it around in case we do need this small speedup. |
is this still an issue? |
It is an issue, but currently "premature optimization" :) If there are very slow smart contracts, it can double the transactions per second. |
Currently the leader executes each smartcontract twice. Probably once to know if the contract is legit, and then once with the
doPBFT
method.It should execute the contract only once. Either use the result of this run, or only run it in the
doPBFT
method.The text was updated successfully, but these errors were encountered: