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

Implement missing gRPC filters #4462

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft

Conversation

aoudiamoncef
Copy link
Contributor

@aoudiamoncef aoudiamoncef commented Oct 9, 2023

  • document all added functions
  • try in sandbox /simulation/labnet
    • if part of node-launch, checked using the resync_check flag
  • unit tests on the added/changed features
    • make tests compile
    • make tests pass
  • add logs allowing easy debugging in case the changes caused problems
  • if the API has changed, update the API specification

fix #4443

We have some TODOs in massa-proto and make it more defensive to avoid flooding the clients.

// NewSlotExecutionOutputs Filter
message NewSlotExecutionOutputsFilter {
  // Filter
  oneof filter {
    //TODO add ALL to receive all the slot execution outputs. Same for all
    // Execution output status
    massa.model.v1.ExecutionOutputStatus status = 1;
    // Slot range
    massa.model.v1.SlotRange slot_range = 2;
    //TODO by default nothing is returned, we should add a filter to receive all the slot execution outputs ALL
    // AsyncPoolChangesFilter
    AsyncPoolChangesFilter async_pool_changes_filter = 3;
	...
  }
}

// AsyncPoolChangesFilter
message AsyncPoolChangesFilter {
  // Filter
  oneof filter {
    //TODO to be replaced by ALL
    // Do not return any message
    massa.model.v1.Empty none = 1;
    ```
    
The changes above are breaking the gRPC API and should be continued when builders requires those features and are ready to upgrade.

@aoudiamoncef aoudiamoncef changed the title Implement missing filter parsing Implement missing gRPC filters Oct 9, 2023
@aoudiamoncef aoudiamoncef force-pushed the feature/add-missing-filters branch from 1ed67b6 to 1e86981 Compare October 10, 2023 13:46
@aoudiamoncef aoudiamoncef marked this pull request as ready for review October 10, 2023 17:03
@aoudiamoncef aoudiamoncef requested a review from modship October 11, 2023 13:06
return false;
};
}
//TODO to be confirmed
Copy link
Contributor Author

@aoudiamoncef aoudiamoncef Oct 11, 2023

Choose a reason for hiding this comment

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

@AurelienFT could you confirm this information about emitter_address ?

Copy link
Contributor

Choose a reason for hiding this comment

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

No the emitter address should be the back of the callstack. But currently in the code it's inverted see : #4409 but we are not correcting it now because it could break too much projects : #4422 (comment) (I'm not fully agree with this but not the subject) So I suggest that you match the wrong behaviour and use .front() like here

}
}
//TODO to be confirmed
if let Some(handlers) = &async_pool_changes_filter.handlers {
Copy link
Contributor Author

@aoudiamoncef aoudiamoncef Oct 11, 2023

Choose a reason for hiding this comment

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

@AurelienFT same here about handler

Copy link
Contributor

Choose a reason for hiding this comment

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

I have renamed handler to function because it was his real usage. So yes handler before == function now.

}
}
//TODO to be confirmed
massa_ledger_exports::SetOrKeep::Keep => {
Copy link
Contributor Author

@aoudiamoncef aoudiamoncef Oct 11, 2023

Choose a reason for hiding this comment

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

@AurelienFT if It's a Keep, we can't compare to anything, should we do something or act like there is nothing to compare ?

Copy link
Contributor

Choose a reason for hiding this comment

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

If a change is here with a function set to Keep then there is at least another change that is here with a Set and so the choice of returning it or not should depends on the choice on the field that have the Set

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'll take a decision when this PR will be prioritised.

@aoudiamoncef aoudiamoncef force-pushed the feature/add-missing-filters branch from 6d519da to 85a8a1a Compare October 11, 2023 13:11
Copy link
Member

@modship modship left a comment

Choose a reason for hiding this comment

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

can u make good unit test for new_slot_execution_output

@aoudiamoncef
Copy link
Contributor Author

aoudiamoncef commented Oct 12, 2023

can u make good unit test for new_slot_execution_output

This won't fit in one big test, we tons of case to cover.... But i'm trying to reuse existing test tools functions to generate test data to have more accurate tests. Stay tuned

@aoudiamoncef aoudiamoncef force-pushed the feature/add-missing-filters branch from 85a8a1a to 736e5f5 Compare October 12, 2023 22:12
@aoudiamoncef
Copy link
Contributor Author

aoudiamoncef commented Oct 16, 2023

I made a small refactoring in bootstrap tests to be able to extract the tools module and make it public.

@aoudiamoncef
Copy link
Contributor Author

@modship I've added some basic tests which covers filters usage. But there if a lot of combinations to test

@aoudiamoncef aoudiamoncef requested a review from modship October 17, 2023 15:53
@aoudiamoncef aoudiamoncef force-pushed the feature/add-missing-filters branch from cd83ef2 to 00c66b8 Compare October 17, 2023 19:43
@aoudiamoncef aoudiamoncef added blocked Issues that can't be done for now. enhancement New feature or request labels Oct 18, 2023
@aoudiamoncef aoudiamoncef marked this pull request as draft October 18, 2023 10:22
filters.push(filter);

tx_request
.send(NewSlotExecutionOutputsRequest { filters })
Copy link
Member

Choose a reason for hiding this comment

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

to improve readability please remove the vector filters and create the vec here

.unwrap()
.state_changes
.unwrap();
assert!(state_changes.async_pool_changes.len() == 2);
Copy link
Member

Choose a reason for hiding this comment

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

use assert_eq! when you check specific value

.state_changes
.unwrap();
assert!(state_changes.async_pool_changes.len() == 2);
assert!(state_changes.executed_ops_changes.len() == 1);
Copy link
Member

Choose a reason for hiding this comment

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

use assert_eq! when you check specific value

@modship modship linked an issue Oct 19, 2023 that may be closed by this pull request
70 tasks
@Leo-Besancon Leo-Besancon changed the base branch from main to securnet_wip November 6, 2023 15:01
@Leo-Besancon Leo-Besancon changed the base branch from securnet_wip to buildnet_wip November 8, 2023 15:07
@Leo-Besancon Leo-Besancon changed the base branch from buildnet_wip to pre_mainnet_wip November 28, 2023 08:41
Base automatically changed from pre_mainnet_wip to main May 28, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Issues that can't be done for now. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement remaining filters on NewSlotExecutionOutputs API unit tests
4 participants