Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Commit

Permalink
bet
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdevbear committed Jun 1, 2024
1 parent 48c9b7a commit b574751
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 88 deletions.
15 changes: 13 additions & 2 deletions cosmos/runtime/miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,20 @@ func (m *Miner) submitPayloadForBuilding(ctx context.Context) error {
// to clock skew / rounding to commit two blocks in succession with the same
// unix time. This will prevent the block from being built.
prevBlockTs := uint64(0)
if finalBlock := m.bc.CurrentFinalBlock(); finalBlock != nil {
prevBlockTs = finalBlock.Time
if finalBlock := m.bc.GetBlockByNumber(uint64(sCtx.BlockHeight()) - 1); finalBlock != nil {
prevBlockTs = finalBlock.Time()
} else {
// If we fail to find the previous block, we minimum of the current time
// and the next block time, time.Now() is always increasing, so eventually
// time.Now() > sCtx.BlockTime() + 1.
prevBlockTs = min(uint64(time.Now().Unix()), uint64(sCtx.BlockTime().Unix())+1)
}

// Ensure that the block time is always increasing.
if prevBlockTs <= uint64(sCtx.BlockTime().Unix()) {
prevBlockTs = uint64(sCtx.BlockTime().Unix())
}

ts := max(uint64(sCtx.BlockTime().Unix()), prevBlockTs+1)

// Build Payload.
Expand Down
3 changes: 3 additions & 0 deletions e2e/testapp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ go 1.21.6
replace (
// use cosmos fork of keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
// github.com/cockroachdb/pebble => github.com/cockroachdb/pebble v0.0.0-20220817183557-09c6e030a677
// Use branch with the mempool race condition fix.
github.com/comet/cometbft => github.com/cometbft/cometbft v0.38.3-0.20240117033245-e65a966827e0
// We replace `go-ethereum` with `polaris-geth` in order include our required changes.
github.com/ethereum/go-ethereum => github.com/berachain/polaris-geth v1.13.10-2-polar
// replace broken goleveldb
Expand Down
Loading

0 comments on commit b574751

Please sign in to comment.