Skip to content

Commit

Permalink
feat: update CheckProverBalance
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Jan 22, 2025
1 parent 7d6fc87 commit 7282c98
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
14 changes: 13 additions & 1 deletion packages/taiko-client/pkg/config/protocol_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"math/big"
"time"

"github.com/ethereum/go-ethereum/common"
ontakeBindings "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/ontake"
pacayaBindings "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/pacaya"
)
Expand All @@ -16,6 +17,7 @@ type ProtocolConfigs interface {
ForkHeightsOntake() uint64
ForkHeightsPacaya() uint64
LivenessBond() *big.Int
LivenessBondPerBlock() *big.Int
MaxProposals() uint64
ProvingWindow() (time.Duration, error)
}
Expand Down Expand Up @@ -65,6 +67,11 @@ func (c *OntakeProtocolConfigs) LivenessBond() *big.Int {
return c.configs.LivenessBond
}

// LivenessBondPerBlock implements the ProtocolConfigs interface.
func (c *OntakeProtocolConfigs) LivenessBondPerBlock() *big.Int {
return common.Big0
}

// MaxProposals implements the ProtocolConfigs interface.
func (c *OntakeProtocolConfigs) MaxProposals() uint64 {
return c.configs.BlockMaxProposals
Expand Down Expand Up @@ -107,7 +114,12 @@ func (c *PacayaProtocolConfigs) ForkHeightsPacaya() uint64 {

// MaxProposals implements the ProtocolConfigs interface.
func (c *PacayaProtocolConfigs) LivenessBond() *big.Int {
return c.configs.LivenessBondBase // TODO: add livenessBondPerBlock
return c.configs.LivenessBondBase
}

// LivenessBondPerBlock implements the ProtocolConfigs interface.
func (c *PacayaProtocolConfigs) LivenessBondPerBlock() *big.Int {
return c.configs.LivenessBondBase
}

// MaxProposals implements the ProtocolConfigs interface.
Expand Down
13 changes: 11 additions & 2 deletions packages/taiko-client/proposer/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,10 @@ func (p *Proposer) ProposeTxListOntake(
p.rpc,
proverAddress,
p.TaikoL1Address,
new(big.Int).Mul(p.protocolConfigs.LivenessBond(), new(big.Int).SetUint64(uint64(len(txLists)))),
new(big.Int).Mul(
p.protocolConfigs.LivenessBond(),
new(big.Int).SetUint64(uint64(len(txLists))),
),
)

if err != nil {
Expand Down Expand Up @@ -407,7 +410,13 @@ func (p *Proposer) ProposeTxListPacaya(
p.rpc,
proverAddress,
p.TaikoL1Address,
p.protocolConfigs.LivenessBond(),
new(big.Int).Add(
p.protocolConfigs.LivenessBond(),
new(big.Int).Mul(
p.protocolConfigs.LivenessBondPerBlock(),
new(big.Int).SetUint64(uint64(len(txBatch))),
),
),
)

if err != nil {
Expand Down

0 comments on commit 7282c98

Please sign in to comment.