Skip to content

Conversation

@tzdybal
Copy link
Contributor

@tzdybal tzdybal commented Feb 21, 2021

Because Node is used directly (in tendermint/lazyledger-core and cosmos-sdk), there is no easy way to replace it.
Introduced interface opens a way to replacing Tendermint node in cosmos-sdk easily.

It would be great, if we can push similar change upstream.

Because Node is used directly (in lazyledger-core and cosmos-sdk),
there is no easy way to replace it. Introduced interface opens a way
to replacing Tendermint node in cosmos-sdk easily.
@tzdybal tzdybal requested review from liamsi and tac0turtle February 21, 2021 11:12
// don't run in parallel, or try to simulate an entire network in
// one process...
func New(node *nm.Node) *Local {
func New(node nm.NodeInterface) *Local {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this cause you would like to reuse the RPC in optimint?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that by reusing RPC have following pros:

Do you see any cons?

Copy link
Collaborator

@tac0turtle tac0turtle Feb 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you, dont see any cons outside the known issues within the RPC layer will be known issues in optimint. They mainly stem from event streaming and mutex contention (may not happen in optimiment)

@tzdybal
Copy link
Contributor Author

tzdybal commented Feb 21, 2021

@musalbas
Copy link
Member

musalbas commented Feb 22, 2021

Is there a reason why optimint can't simply use the Node struct, instead of defining a new NodeInterface interface? That way you can just have a function called NewOptiNode or similar that creates an Optimint Node, and also use that in cosmos-sdk. https://github.com/lazyledger/lazyledger-core/blob/8a8b8b5483ba4fc5fcc6c25452135417df539f37/node/node.go#L184

Edit: I assume most of the fields in the Node struct are only used by Tendermint.

@liamsi
Copy link
Member

liamsi commented Feb 22, 2021

Using a tendermint Node would have been the right approach if we decided to go with using tendermint and ripping out / stripping down the consensus reactor. The reactors are fields in Node struct and can be swapped out. Using an interface gives us absolute freedom on the optimint side though. That said, It would be possible to use the Node struct but it would be much more difficult to get right and the interface approach seems cleaner.

As a general remark: is this choice documented somewhere? I guess it's OK, to not use ADRs but we should certainly weigh pros and cons for choices like this. A summary in an issue, or an ADR, or a design document.

Also, there might be other ways to achieve the same. Their pros/cons should also briefly be considered.

@liamsi
Copy link
Member

liamsi commented Feb 22, 2021

It would be great, if we can push similar change upstream.

I agree and I would suggest to ping the SDK team on discord about this, or tag @robert-zaremba here and in the SDK pr.

@tzdybal tzdybal changed the base branch from master to master-optimint February 23, 2021 07:15
@tzdybal
Copy link
Contributor Author

tzdybal commented Feb 23, 2021

As agree it will be much cleaner to create own node type, instead of hacking with tendermint one. This was the reason behind my decision.

I changed target of this branch to master-optimint.

@tzdybal tzdybal marked this pull request as ready for review February 23, 2021 10:21
@tzdybal tzdybal requested a review from musalbas as a code owner February 23, 2021 10:21
ConfigureRPC() error
GetLogger() log.Logger
EventBus() *types.EventBus
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If feasible somehow it would be nice, if we could move this interface to where it is consumed and needed. Namely into the SDK. I have not thought this through and might not be feasible. If so, we can simply merge this here now and iterate from there.

Either way, it seems unlikely, that this gets upstreamed any time soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm closing the PR, and working on updates to other two.

@tzdybal tzdybal closed this Feb 26, 2021
@rootulp rootulp deleted the tzdybal/node_interface branch September 22, 2022 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants