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

Conversation

Projects
None yet
2 participants
@antonlerner
Copy link
Collaborator

antonlerner commented Dec 25, 2018

No description provided.

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

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

This comment has been minimized.

@y0sher

y0sher Dec 27, 2018

Collaborator

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


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

This comment has been minimized.

@y0sher

y0sher Dec 27, 2018

Collaborator

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")

This comment has been minimized.

@y0sher

y0sher Dec 27, 2018

Collaborator

why not return an error ?

This comment has been minimized.

@antonlerner

antonlerner Dec 30, 2018

Collaborator

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)

This comment has been minimized.

@y0sher

y0sher Dec 27, 2018

Collaborator

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

Show resolved Hide resolved state/processor.go
@y0sher
Copy link
Collaborator

y0sher left a comment

Check the comments

@y0sher

y0sher approved these changes Dec 30, 2018

Copy link
Collaborator

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

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment