Skip to content
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

Add StateRoot message #2079

Closed
wants to merge 12 commits into from

Conversation

ZhangTao1596
Copy link
Contributor

Add StateRoot message support in core.

  • Node relay StateRoot when there is no MPTPlugin.

this.DeserializeUnsigned(reader);
Witness[] arr = reader.ReadSerializableArray<Witness>();
if (arr.Length < 1)
Witness = null;
Copy link
Member

Choose a reason for hiding this comment

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

Does we need states without witness?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. The state root calculated locally has no witness.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should have two payloads, signed and unsigned, in order to prevent send of unsigned state roots.

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 add witness null check. But how can extra payload prevent sending unsigned roots?

Copy link
Member

Choose a reason for hiding this comment

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

We will send and receive only signed roots, the unsigned payload will be used locally, without p2p message.

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 want to store StateRoot with null witness first. After validated StateRoot received, I can replace the null witness with signed witness.

@shargon
Copy link
Member

shargon commented Nov 25, 2020

We will have the message in the core and the logic in modules?

@ZhangTao1596
Copy link
Contributor Author

ZhangTao1596 commented Nov 26, 2020

We will have the message in the core and the logic in modules?

I have thought of put all into plugin. But in that case message will only relay between node with specific plugin. It will not work, nodes with specific plugin are minority.

@Tommo-L
Copy link
Contributor

Tommo-L commented Dec 2, 2020

As #2101 , this pr need to be moved to neo-modules.

@ZhangTao1596
Copy link
Contributor Author

Will move to plugin.

@ZhangTao1596 ZhangTao1596 deleted the stateroot-message branch January 11, 2021 02:22
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.

3 participants