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

Refactor dBFT APIs #84

Closed
AnnaShaleva opened this issue Nov 17, 2023 · 2 comments · Fixed by #104
Closed

Refactor dBFT APIs #84

AnnaShaleva opened this issue Nov 17, 2023 · 2 comments · Fixed by #104
Labels
enhancement Improving existing functionality I2 Regular impact S1 Highly significant U3 Regular
Milestone

Comments

@AnnaShaleva
Copy link
Member

Is your feature request related to a problem? Please describe.

Some of dBFT APIs are not used since WithNewBlockFromContext addition. E.g. WithGetConsensusAddress always returns an empty address in NeoGo.

Describe the solution you'd like

We need to review all unused dBFT APIs and remove them.

@AnnaShaleva AnnaShaleva added the enhancement Improving existing functionality label Nov 17, 2023
@roman-khimov roman-khimov added U3 Regular S1 Highly significant I2 Regular impact labels Dec 20, 2023
AnnaShaleva added a commit to nspcc-dev/neo-go that referenced this issue Dec 21, 2023
dBFT doesn't use validators got from this call to GetValidators callback,
because NeoGo doesn't properly set WithGetConsensusAddress, and thus
this call can be safely skipped. Instead, NeoGo fills NextConsensus field
by itself in NewBlockFromContext callback.

This commit technically doesn't perform any functional changes and doesn't
affect the problem described in #3253 in any way. This commit is just a
removal of the code that was never used by NeoGo library.

This commit is a direct consequence of nspcc-dev/dbft#84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit to nspcc-dev/neo-go that referenced this issue Dec 21, 2023
dBFT doesn't use validators got from this call to GetValidators callback,
because NeoGo doesn't properly set WithGetConsensusAddress, and thus
this call can be safely skipped. Instead, NeoGo fills NextConsensus field
by itself in NewBlockFromContext callback.

This commit technically doesn't perform any functional changes and doesn't
affect the problem described in #3253 in any way. This commit is just a
removal of the code that was never used by NeoGo library.

This commit is a direct consequence of nspcc-dev/dbft#84.

Signed-off-by: Anna Shaleva <[email protected]>
@AnnaShaleva AnnaShaleva added this to the v0.2.0 milestone Feb 13, 2024
@AnnaShaleva AnnaShaleva changed the title Remove duplicated dBFT APIs Refactor dBFT APIs Mar 4, 2024
@AnnaShaleva
Copy link
Member Author

Also implement #97 (comment).

@roman-khimov
Copy link
Member

That's mostly about setters, we want some set of New* and then interface would just expose the data to dbft. Setters are useless here, we never change these values except for initialization of a new payload (either generated one to send or received from the network).

AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 5, 2024
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
NextConsensus API is not used by the users of dBFT. NextConsensus
handling (proposal, verification and agrreement) is moved to the upper
level of dBFT users. Starting from this commit NextConsensus
verification should be performed by dBFT user manually in
WithVerifyPrepareRequest callback.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
NextConsensus API is not used by the users of dBFT. NextConsensus
handling (proposal, verification and agrreement) is moved to the upper
level of dBFT users. Starting from this commit NextConsensus
verification should be performed by dBFT user manually in
WithVerifyPrepareRequest callback.

Close #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
NextConsensus API is not used by the users of dBFT. NextConsensus
handling (proposal, verification and agrreement) is moved to the upper
level of dBFT users. Starting from this commit NextConsensus
verification should be performed by dBFT user manually in
WithVerifyPrepareRequest callback.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
It's unused by dBFT, and thus, it's not needed in this interface. If
this property is used by dBFT user, then the user need to convert dBFT
Block to user's Block and retrieve all necessary info.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
All dBFT payloads implementations should be kept in the same package or
have exported fields. It's inevitable since dBFT user have to refer to
payload fields via converting dBFT interfaces to user-defined local
structures.

dBFT test (`dbft_test` package) imports custom payloads implementations
from `internal`. Since all payloads will be moved to the same package,
we need to split this package from `main` package of simulation.

A consequence of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
It's needed to be able to cast dBFT payload interfaces to local
user-defined payloads implementations during consensus service
functioning.

A psrt of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
It's unused by dBFT and thus, should be removed from Block interface. If
user need to access this data, then he should convert dbft.Block to the
local user-defined Block implementation.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
This API is unused by dBFT. If a user needs to access ChangeView
timestamp, he has to convert dbft.ChangeView to the user-defined
ChangeView implementation.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
This API is unused. In it's essence it's important for the dBFT to know
that RecoveryRequest is received, no timestamp information required for
its handling.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
NextConsensus API is not used by the users of dBFT. NextConsensus
handling (proposal, verification and agrreement) is moved to the upper
level of dBFT users. Starting from this commit NextConsensus
verification should be performed by dBFT user manually in
WithVerifyPrepareRequest callback.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
Version context field is always set to 0. There is no API to change
Version in dBFT context. Given a possibility of Block version change, we
either need to introduce this Version initializer or need to move
Version handling out of dBFT. The latter case is chosen, because in this
case block/PrepareRequest version can be handled directly by node
depending on block index fetched from dBFT context.

Also remove Version() block API, it's unused.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
It's unused by dBFT, and thus, it's not needed in this interface. If
this property is used by dBFT user, then the user need to convert dBFT
Block to user's Block and retrieve all necessary info.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
All dBFT payloads implementations should be kept in the same package or
have exported fields. It's inevitable since dBFT user have to refer to
payload fields via converting dBFT interfaces to user-defined local
structures.

dBFT test (`dbft_test` package) imports custom payloads implementations
from `internal`. Since all payloads will be moved to the same package,
we need to split this package from `main` package of simulation.

A consequence of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
It's needed to be able to cast dBFT payload interfaces to local
user-defined payloads implementations during consensus service
functioning.

A psrt of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
It's unused by dBFT and thus, should be removed from Block interface. If
user need to access this data, then he should convert dbft.Block to the
local user-defined Block implementation.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
This API is unused by dBFT. If a user needs to access ChangeView
timestamp, he has to convert dbft.ChangeView to the user-defined
ChangeView implementation.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
Store Timer interface along with other dBFT interfaces and provide
default timer implementation in `timer` package.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
Also add a record to CHANGELOG.md.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
Store Timer interface along with other dBFT interfaces and provide
default timer implementation in `timer` package.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
Also add a record to CHANGELOG.md.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
Version context field is always set to 0. There is no API to change
Version in dBFT context. Given a possibility of Block version change, we
either need to introduce this Version initializer or need to move
Version handling out of dBFT. The latter case is chosen, because in this
case block/PrepareRequest version can be handled directly by node
depending on block index fetched from dBFT context.

Also remove Version() block API, it's unused.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
It's unused by dBFT, and thus, it's not needed in this interface. If
this property is used by dBFT user, then the user need to convert dBFT
Block to user's Block and retrieve all necessary info.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
All dBFT payloads implementations should be kept in the same package or
have exported fields. It's inevitable since dBFT user have to refer to
payload fields via converting dBFT interfaces to user-defined local
structures.

dBFT test (`dbft_test` package) imports custom payloads implementations
from `internal`. Since all payloads will be moved to the same package,
we need to split this package from `main` package of simulation.

A consequence of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
It's needed to be able to cast dBFT payload interfaces to local
user-defined payloads implementations during consensus service
functioning.

A psrt of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
It's unused by dBFT and thus, should be removed from Block interface. If
user need to access this data, then he should convert dbft.Block to the
local user-defined Block implementation.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
This API is unused by dBFT. If a user needs to access ChangeView
timestamp, he has to convert dbft.ChangeView to the user-defined
ChangeView implementation.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
Store Timer interface along with other dBFT interfaces and provide
default timer implementation in `timer` package.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 6, 2024
Also add a record to CHANGELOG.md.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 8, 2024
Store Timer interface along with other dBFT interfaces and provide
default timer implementation in `timer` package. Create `dbft.HV`
interface and configuration for its customisation. Provide default
implementation of `dbft.HV` in `timer` package.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 8, 2024
Also add a record to CHANGELOG.md.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 8, 2024
Store Timer interface along with other dBFT interfaces and provide
default timer implementation in `timer` package. Create `dbft.HV`
interface and configuration for its customisation. Provide default
implementation of `dbft.HV` in `timer` package.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit that referenced this issue Mar 8, 2024
Also add a record to CHANGELOG.md.

A part of #84.

Signed-off-by: Anna Shaleva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving existing functionality I2 Regular impact S1 Highly significant U3 Regular
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants