Skip to content

Commit

Permalink
wip optimize e1, e2, r2
Browse files Browse the repository at this point in the history
  • Loading branch information
lunfardo314 committed Feb 13, 2025
1 parent 03bb4ca commit a262a5e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions sequencer/task/proposer_endorse2.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ func endorse2ProposeGenerator(p *Proposer) (*attacher.IncrementalAttacher, bool)
}

if err := a.InsertEndorsement(endorsementCandidate); err == nil {
p.Task.slotData.markCombinationChecked(true, extending, endorsing, endorsementCandidate)
addedSecond = true
break //>>>> return attacher
} else {
p.Task.slotData.markCombinationChecked(false, extending, endorsing, endorsementCandidate)
}
p.Tracef(TraceTagEndorse2Proposer, "failed to include endorsement target %s", endorsementCandidate.IDShortString)
}
Expand Down
8 changes: 4 additions & 4 deletions sequencer/task/proposer_endorse2rnd.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ func endorse2RndProposeGenerator(p *Proposer) (*attacher.IncrementalAttacher, bo
}

if err := a.InsertEndorsement(endorsementCandidate); err == nil {
// remember triplet for the next check, same list for e2 and r2
//p.slotData.withWriteLock(func() {
// p.slotData.alreadyCheckedTriplets.Insert(triplet)
//})
p.Task.slotData.markCombinationChecked(true, extending, endorsing, endorsementCandidate)
addedSecond = true
break //>>>> return attacher
} else {
p.Task.slotData.markCombinationChecked(false, extending, endorsing, endorsementCandidate)
}

p.Tracef(TraceTagEndorse2RndProposer, "failed to include endorsement target %s", endorsementCandidate.IDShortString)
}
if !addedSecond {
Expand Down
6 changes: 5 additions & 1 deletion sequencer/task/proposer_endorse3.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"time"

"github.com/lunfardo314/proxima/core/attacher"
"github.com/lunfardo314/proxima/core/vertex"
)

const TraceTagEndorse3Proposer = "propose-endorse3"
Expand All @@ -25,7 +26,10 @@ func endorse3ProposeGenerator(p *Proposer) (*attacher.IncrementalAttacher, bool)
}

// Check all pairs, in descending order
a := p.ChooseFirstExtendEndorsePair(false, nil)
a := p.ChooseFirstExtendEndorsePair(false, func(extend vertex.WrappedOutput, endorse *vertex.WrappedTx) bool {
checked, consistent := p.Task.slotData.wasCombinationChecked(extend, endorse)
return !checked || consistent
})
if a == nil {
p.Tracef(TraceTagEndorse3Proposer, "propose: ChooseFirstExtendEndorsePair returned nil")
return nil, false
Expand Down

0 comments on commit a262a5e

Please sign in to comment.