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

updated core enums in state changes. #6495

Merged
merged 22 commits into from
Nov 4, 2024
Merged

Conversation

cristure
Copy link
Contributor

Reasoning behind the pull request

  • Update enums in mx-chain-core-go

Proposed changes

  • Fix references to updated enums.

Testing procedure

  • Usual PR checks should suffice.

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@cristure
Copy link
Contributor Author

This PR should be taken into consideration too: multiversx/mx-chain-core-go#324

Base automatically changed from state-changes-read-operations to feat/state-changes October 25, 2024 12:11
ssd04
ssd04 previously approved these changes Oct 25, 2024
errors/errors.go Outdated
@@ -601,3 +601,6 @@ var ErrNilEpochSystemSCProcessor = errors.New("nil epoch system SC processor")

// ErrNilRelayedTxV3Processor signals that a nil relayed tx v3 processor has been provided
var ErrNilRelayedTxV3Processor = errors.New("nil relayed tx v3 processor")

// ErrOnlyReadStateChangesToCollect signals that only read state changes to collect have been configured to be collected.
var ErrOnlyReadStateChangesToCollect = errors.New("cannot collect only read state changes")
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right. will remove it

config/config.go Outdated
SnapshotsEnabled bool
AccountsStatePruningEnabled bool
PeerStatePruningEnabled bool
StateChangesDataAnalysis bool
Copy link
Contributor

Choose a reason for hiding this comment

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

this change needs to be reflected also in config.toml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

"github.com/stretchr/testify/require"
)

func TestStateComponents_ParseStateChangesTypesToCollect(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

add tests for error cases?

// Publish will export state changes
func (scc *dataAnalysisCollector) Publish() error {
// Publish will retrieve the state changes linked with the tx hash.
func (scc *dataAnalysisCollector) Publish() (map[string]*data.StateChanges, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this correct? this is the same as for normal collector.
my suggestion was to store into levelDB on this Publish, and avoid having Store function, since this component is used only for data analysis, not for the production flow, at least currently

Copy link
Contributor

Choose a reason for hiding this comment

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

this will also save normal state changes to outport driver when running in data analysis mode, which i don't think we want

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, but in the current implementation if you don't have the outport driver configured you will never publish, hence the store function. If you have data analysis enabled and the host driver off, you will still have them persisted in leveldb.

@@ -122,34 +125,48 @@ func (scf *stateComponentsFactory) Create() (*stateComponents, error) {
}

func (scf *stateComponentsFactory) createStateChangesCollector() (state.StateChangesCollector, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

state changes collector is created 2 times in this file, it should be creating only once for main accounts db and then passed to peer accounts

Copy link
Contributor

Choose a reason for hiding this comment

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

not related to this PR, but please fix this here

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should have a different collector for PeerAccounts that can be disabled separately from config.

@@ -122,34 +125,48 @@ func (scf *stateComponentsFactory) Create() (*stateComponents, error) {
}

func (scf *stateComponentsFactory) createStateChangesCollector() (state.StateChangesCollector, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should have a different collector for PeerAccounts that can be disabled separately from config.

opts = append(opts, stateChanges.WithCollectRead())
}
if collectWrite {
opts = append(opts, stateChanges.WithCollectRead())
Copy link
Contributor

Choose a reason for hiding this comment

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

.WithCollectWrite()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@cristure cristure merged commit 5450ae1 into feat/state-changes Nov 4, 2024
5 checks passed
@cristure cristure deleted the update_enums_state branch November 4, 2024 11:51
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