libplanet icon indicating copy to clipboard operation
libplanet copied to clipboard

Provide a sensible way to inject `IBlockPolicy<T>` to `Agent`

Open greymistcube opened this issue 3 years ago • 1 comments

Using Planet Clicker as a reference, if we were to provide a simpler interface such as LibplanetUnity.Agent, additional options should be easily accessible by game developers. I would assume game developers would be most interested in providing their own BlockPolicy.BlockAction and BlockPolicy.BlockInterval. 😗

Proper updatable policy API design is no easy task, as its current implementation is quite convoluted in order to accommodate NineChronicles chain. If we do not want to revisit the pitfalls of Lib9c, we should tread carefully.

Some thoughts:

  • There is some discrepancy between what is fixed and what isn't.
    • Variable HashAlgorithmType was introduced in order to allow different hashing algorithms.
    • Variable MaxBlockBytes was introduced to bypass block size limit.
    • Variable MinTransactionsPerBlock was introduced to prevent selfish mining.
    • Variable MaxTransactionsPerBlock was introduced due to TPS tuning when the network was unstable.
    • Variable MaxTransactionsPerSignerPerBlock was introduced to defend against Transaciton<T> spamming.
  • On top of these, there are ad hoc policies in Lib9c such as AuthorizedMinersPolicy, etc. adding a substantial amount of constraint on allowing BlockPolicy to be more fluid.
  • However, variable BlockAction and BlockInterval are not implemented, even though these might be most useful. 🙄

greymistcube avatar Apr 26 '22 17:04 greymistcube

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

stale[bot] avatar Jul 31 '22 01:07 stale[bot]