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

Fix RLP marshal byte array and enhancements to stake manager #1461

Merged
merged 8 commits into from
May 15, 2023

Conversation

Nemanja0x
Copy link
Collaborator

@Nemanja0x Nemanja0x commented May 1, 2023

Description

A bug is discovered in the fastrlp library in the NewBytes method. We should use NewCopyBytes wherever we have a non-transient slice/array, since NewBytes was not resetting memory properly. In a meanwhile, fastrlp library was fixed by wrapping NewCopyBytes function within the NewBytes (umbracle/fastrlp#14), meaning that these two functions are interchangeable, so this PR updates the version of fastrlp library as well.
The stake manager is reverted to the behavior before the workaround for the bug in fastrlp is applied.

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backward-compatible and/or changes current functionality)

Breaking changes

Please complete this section if any breaking changes have been made, otherwise delete it

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

@igorcrevar igorcrevar changed the base branch from develop to RFC-201-205-stake-manager-db May 1, 2023 09:04
@igorcrevar igorcrevar force-pushed the testEventLogs branch 7 times, most recently from 9195cc3 to 3179304 Compare May 1, 2023 13:03
@goran-ethernal goran-ethernal force-pushed the testEventLogs branch 2 times, most recently from c76923c to 931771e Compare May 2, 2023 07:28
Base automatically changed from RFC-201-205-stake-manager-db to RFC-201-205-e2e-tests May 2, 2023 07:57
@igorcrevar igorcrevar force-pushed the testEventLogs branch 7 times, most recently from 07ce3ac to b162e55 Compare May 2, 2023 09:39
Base automatically changed from RFC-201-205-e2e-tests to feat/validator-storage-rework May 2, 2023 09:55
@igorcrevar igorcrevar force-pushed the testEventLogs branch 6 times, most recently from 8b48874 to a46117b Compare May 3, 2023 14:06
@igorcrevar igorcrevar marked this pull request as ready for review May 3, 2023 16:02
Makefile Outdated Show resolved Hide resolved
Copy link
Contributor

@goran-ethernal goran-ethernal left a comment

Choose a reason for hiding this comment

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

I left some comments, I think should be addressed.

Copy link
Contributor

@goran-ethernal goran-ethernal left a comment

Choose a reason for hiding this comment

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

Nice 💯

Copy link
Contributor

@Stefan-Ethernal Stefan-Ethernal left a comment

Choose a reason for hiding this comment

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

There are a few other places that uses arena.NewBytes in the Edge codebase. Should we change all of these to use NewCopyBytes instead?

consensus/polybft/stake_manager.go Outdated Show resolved Hide resolved
consensus/polybft/stake_manager.go Show resolved Hide resolved
consensus/polybft/stake_manager.go Show resolved Hide resolved
consensus/polybft/stake_manager_test.go Outdated Show resolved Hide resolved
consensus/polybft/stake_manager_test.go Outdated Show resolved Hide resolved
@igorcrevar igorcrevar force-pushed the testEventLogs branch 2 times, most recently from e525f9c to 758c396 Compare May 4, 2023 09:03
consensus/polybft/stake_manager.go Outdated Show resolved Hide resolved
@Stefan-Ethernal Stefan-Ethernal force-pushed the testEventLogs branch 2 times, most recently from c780fad to e7bead7 Compare May 15, 2023 06:40
@Stefan-Ethernal Stefan-Ethernal changed the title Fixes to rlp Marshal and enhancements to stake manager Fix RLP marshal byte array and enhancements to stake manager May 15, 2023
@Stefan-Ethernal Stefan-Ethernal merged commit 2ba202c into develop May 15, 2023
8 of 9 checks passed
@Stefan-Ethernal Stefan-Ethernal deleted the testEventLogs branch May 15, 2023 07:38
@github-actions github-actions bot locked and limited conversation to collaborators May 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fix Functionality that fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants