dusk-blockchain icon indicating copy to clipboard operation
dusk-blockchain copied to clipboard

Extract logging related information from Chain methods that verify and accept Blocks

Open autholykos opened this issue 3 years ago • 0 comments

Describe what you want implemented A dedicated struct to encapsulate the log.Entry that is now passed as parameter to the methods

Describe "Why" this is needed For maintainability reasons, we should not pollute method signatures with logging information.

Describe alternatives Leaving the code as is

Additional Context I noticed that the signatures of the method related to validation and handling of the Block (isValid, executeStateTransition, etc) accept a log.Entry as parameter. I don't think it is a big deal, but I am not particularly fond of passing logger-related objects in the signature. Maybe incapsulating it into a logger-aware struct where the Entry is passed in the constructor would be a bit more idiomatic. That way in the future we could extract a Blockacceptor interface (or however we wanna call it) if we want to, and keep the signatures clean.

Originally posted by @autholykos in https://github.com/dusk-network/dusk-blockchain/pull/1173#pullrequestreview-789027782

autholykos avatar Oct 26 '21 08:10 autholykos