From d0a695f8877967a3b64735e53a552e4d6a263542 Mon Sep 17 00:00:00 2001 From: Patrick O'Grady Date: Sun, 16 Jan 2022 16:30:43 -0800 Subject: [PATCH] tweaks to lifeline --- chain/claim_tx.go | 8 ++++---- chain/genesis.go | 9 ++++----- chain/lifeline_tx.go | 7 ++++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/chain/claim_tx.go b/chain/claim_tx.go index 64c6a8bd..b6e14dce 100644 --- a/chain/claim_tx.go +++ b/chain/claim_tx.go @@ -63,13 +63,13 @@ func (c *ClaimTx) Execute(t *TransactionContext) error { return nil } -// [spaceUnits] requires the caller to pay more to get spaces of +// [spaceNameUnits] requires the caller to pay more to get spaces of // a shorter length because they are more desirable. This creates a "lottery" // mechanism where the people that spend the most mining power will win the // space. // -// [spaceUnits] should only be called on a space that is valid -func spaceUnits(g *Genesis, s string) uint64 { +// [spaceNameUnits] should only be called on a space that is valid +func spaceNameUnits(g *Genesis, s string) uint64 { desirability := uint64(parser.MaxIdentifierSize - len(s)) if uint64(len(s)) > g.ClaimTier2Size { return desirability * g.ClaimTier3Multiplier @@ -81,7 +81,7 @@ func spaceUnits(g *Genesis, s string) uint64 { } func (c *ClaimTx) FeeUnits(g *Genesis) uint64 { - return c.LoadUnits(g) + spaceUnits(g, c.Space) + return c.LoadUnits(g) + spaceNameUnits(g, c.Space) } func (c *ClaimTx) LoadUnits(g *Genesis) uint64 { diff --git a/chain/genesis.go b/chain/genesis.go index 3f654fdb..21602e8d 100644 --- a/chain/genesis.go +++ b/chain/genesis.go @@ -51,7 +51,7 @@ type Genesis struct { ClaimTier1Multiplier uint64 `serialize:"true" json:"claimTier1Multiplier"` // Lifeline Params - PrefixRenewalDiscount uint64 `serialize:"true" json:"prefixRenewalDiscount"` + SpaceRenewalDiscount uint64 `serialize:"true" json:"prefixRenewalDiscount"` // Reward Params ClaimReward uint64 `serialize:"true" json:"claimReward"` @@ -91,11 +91,10 @@ func DefaultGenesis() *Genesis { ClaimTier1Multiplier: 25, // Lifeline Params - PrefixRenewalDiscount: 5, + SpaceRenewalDiscount: 10, // Reward Params - ClaimReward: 60 * 60 * 24 * 15, // 15 Days - LifelineUnitReward: 60 * 60, // 1 Hours Per Fee Unit + ClaimReward: 60 * 60 * 24 * 30, // 30 Days // Lottery Reward (80% of tx.FeeUnits() * block.Price) LotteryRewardMultipler: 80, @@ -105,7 +104,7 @@ func DefaultGenesis() *Genesis { BlockTarget: 1, // 1 Block per Second LookbackTarget: 1500 * 60, // 1500 Units Per Block (~768KB of SetTx) MaxBlockSize: 2000, // 2000 Units (~1MB) - MinPrice: 1, // (50 for easiest claim) + MinPrice: 1, } } diff --git a/chain/lifeline_tx.go b/chain/lifeline_tx.go index bca72517..2d2ac921 100644 --- a/chain/lifeline_tx.go +++ b/chain/lifeline_tx.go @@ -43,20 +43,21 @@ func (l *LifelineTx) Execute(t *TransactionContext) error { } // Lifeline spread across all units lastExpiry := i.Expiry - i.Expiry += g.LifelineUnitReward * l.Units / i.Units + adjUnits := l.Units + 1 + i.Expiry += (g.ClaimReward * adjUnits) / i.Units return PutSpaceInfo(t.Database, []byte(l.Space), i, lastExpiry) } func (l *LifelineTx) FeeUnits(g *Genesis) uint64 { // FeeUnits are discounted so that, all else equal, it is easier for an owner // to retain their space than for another to claim it. - discountedPrefixUnits := spaceUnits(g, l.Space) / g.PrefixRenewalDiscount + dSpaceNameUnits := spaceNameUnits(g, l.Space) / g.SpaceRenewalDiscount // The more desirable the space, the more it costs to maintain it. // // Note, this heavy base cost incentivizes users to send fewer transactions // to extend their space's life instead of many small ones. - return l.LoadUnits(g) + discountedPrefixUnits + l.Units + return l.LoadUnits(g) + dSpaceNameUnits*l.Units } func (l *LifelineTx) Copy() UnsignedTransaction {