neo-project / neo-modules

MIT License
60 stars 100 forks source link

Different Magic attribute value than to Network leads to errors when starting consensus #547

Open gsmachado opened 3 years ago

gsmachado commented 3 years ago

Describe the bug

When there's a mismatch of Magic and Network attributes, the consensus can't start.

Probably this is intended. In this case, however, better error messages should be provided.

Or, if this is not intended, can Magic be set to a value and Network to another one (in all Plugins of neo-modules)?

Another thing, is: Magic attribute in the ProtocolConfiguration is still necessary with the introduction of Network? If yes, for which use cases?

To Reproduce

If Magic is set to 769 in the ProtocolConfiguration but all other Network attributes are set to 5195086 (in all plugins):

image

If Magic is set to 5195086 in the ProtocolConfiguration but the wallet is not re-generated (i.e., wallet.json was generated still with 769):

image

Platform:

gsmachado commented 3 years ago

@superboyiii @cloud8little can you or someone else check this one?

cloud8little commented 3 years ago

@superboyiii @cloud8little can you or someone else check this one?

When there's a mismatch of Magic and Network attributes, the consensus can't start.

Yes, it is intended, when the network id mismatch, the plugin won't work. for all plugins, the same.

Different network configuration is used to connect to different Neo instance. It will used for NEOFs network in later design.

gsmachado commented 3 years ago

So, the Magic and Network attributes SHOULD be the same?

If yes:

If no:

ixje commented 3 years ago

I recently ran into this again, I think there should be a more friendly error message when the magic/network versions mismatch than "Object reference not set to an instance of of an object".