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

State rollback #360

Merged
merged 7 commits into from Dec 30, 2018
Merged

State rollback #360

merged 7 commits into from Dec 30, 2018

Conversation

@antonlerner
Copy link
Member

@antonlerner antonlerner commented Dec 25, 2018

No description provided.

state/processor.go Show resolved Hide resolved
state/processor.go Show resolved Hide resolved
}
}

//should receive sort predicate
func (tp *TransactionProcessor) ApplyTransactions(transactions Transactions) error{
func (tp *TransactionProcessor) ApplyTransactions(layer LayerID, transactions Transactions) error{
Copy link
Contributor

@y0sher y0sher Dec 27, 2018

comment about this method relationship with Reset and why it's locked.


tp.globalState = newState
//lock mutex
tp.pruneAfterRevert(layer)
Copy link
Contributor

@y0sher y0sher Dec 27, 2018

defer tp.mu.Unlock() happens after this. is this by design ?

newState, err := New(state, tp.globalState.db)
log.Info("reverted, new root %x", newState.IntermediateRoot(false))
if err != nil {
panic("wtf")
Copy link
Contributor

@y0sher y0sher Dec 27, 2018

why not return an error ?

Copy link
Member Author

@antonlerner antonlerner Dec 30, 2018

This is not something recoverable i think. anyway I'd like for this to be a panic for now, if we notice we get this one a lot during our testing we can think of why. but processing shouldn't continue after

func (tp *TransactionProcessor) Process(transactions Transactions, trnsBySender map[common.Address][]*Transaction) error{
bySender := make(map[common.Hash]bool)
func (tp *TransactionProcessor) Process(transactions Transactions, trnsBySender map[common.Address][]*Transaction) {
senderPut := make(map[common.Address]bool)
Copy link
Contributor

@y0sher y0sher Dec 27, 2018

if the bool doesn't mean anything, struct{} is cheaper

state/processor.go Show resolved Hide resolved
Copy link
Contributor

@y0sher y0sher left a comment

Check the comments

y0sher
y0sher approved these changes Dec 30, 2018
Copy link
Contributor

@y0sher y0sher left a comment

Good job, you just have to rebase on develop

@antonlerner antonlerner merged commit fc62a65 into develop Dec 30, 2018
1 check passed
@y0sher y0sher deleted the state_rollback branch Jun 25, 2019
noamnelke
Copy link
Member

noamnelke commented on 53cb553 Dec 29, 2019

@antonlerner this actually removes the state root you just added (instead of the oldest one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants