diff --git a/go.mod b/go.mod index ad29cdd90..484cbaff6 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/iotaledger/hive.go/stringify v0.0.0-20230929122509-67f34bfed40d github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231001095511-32be422a567e github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231001095356-923e8f138951 - github.com/iotaledger/iota.go/v4 v4.0.0-20231003122130-2871888a9297 + github.com/iotaledger/iota.go/v4 v4.0.0-20231003154311-26aa2f0fd388 github.com/labstack/echo/v4 v4.11.1 github.com/labstack/gommon v0.4.0 github.com/libp2p/go-libp2p v0.30.0 diff --git a/go.sum b/go.sum index 9052996eb..2fd9470ee 100644 --- a/go.sum +++ b/go.sum @@ -305,8 +305,8 @@ github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231001095511-32be422a567e h1:Mwoe7 github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231001095511-32be422a567e/go.mod h1:jhzexR5X8m6qcmrwt5OX477O/ZwT7Ak9sPT83ByPkAo= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231001095356-923e8f138951 h1:qUf1W0fE1IyZzVy3Exv0Kj+SKECXG3S26c9m2ETb07U= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231001095356-923e8f138951/go.mod h1:c5778OnWpLq108YE+Eb2m8Ri/t/4ydV0TvI/Sy5YivQ= -github.com/iotaledger/iota.go/v4 v4.0.0-20231003122130-2871888a9297 h1:kbpsa/gF0x6Cxu5lN9TL8u5EdaGv1P3/OKKPW0w83Og= -github.com/iotaledger/iota.go/v4 v4.0.0-20231003122130-2871888a9297/go.mod h1:+e3bsJFDr9HxmUMe+eQOLNut5wfcB/ivhJdouOJgOnE= +github.com/iotaledger/iota.go/v4 v4.0.0-20231003154311-26aa2f0fd388 h1:IGqHrJRmrzfalf1py+FGWzkWoaA5o6avBSYWznVG08s= +github.com/iotaledger/iota.go/v4 v4.0.0-20231003154311-26aa2f0fd388/go.mod h1:+e3bsJFDr9HxmUMe+eQOLNut5wfcB/ivhJdouOJgOnE= github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY= github.com/ipfs/boxo v0.10.0/go.mod h1:Fg+BnfxZ0RPzR0nOodzdIq3A7KgoWAOWsEIImrIQdBM= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= diff --git a/pkg/protocol/engine/accounts/mana.go b/pkg/protocol/engine/accounts/mana.go index 8131a8fe2..207e19a24 100644 --- a/pkg/protocol/engine/accounts/mana.go +++ b/pkg/protocol/engine/accounts/mana.go @@ -22,6 +22,7 @@ func NewMana(value iotago.Mana, excessBaseTokens iotago.BaseToken, updateTime io } } +// Update is applied when the account output is transitioned, updating the total value and excess base tokens. func (m *Mana) Update(value iotago.Mana, excessBaseTokens iotago.BaseToken, updateTime iotago.SlotIndex) { m.mutex.Lock() defer m.mutex.Unlock() @@ -31,6 +32,7 @@ func (m *Mana) Update(value iotago.Mana, excessBaseTokens iotago.BaseToken, upda m.updateTime = updateTime } +// UpdateValue is applied when the total decayed value is updated but the account output is not changed. func (m *Mana) UpdateValue(value iotago.Mana, updateTime iotago.SlotIndex) { m.mutex.Lock() defer m.mutex.Unlock() diff --git a/pkg/protocol/engine/accounts/mana/manager.go b/pkg/protocol/engine/accounts/mana/manager.go index 7ea1a90e8..726cc6996 100644 --- a/pkg/protocol/engine/accounts/mana/manager.go +++ b/pkg/protocol/engine/accounts/mana/manager.go @@ -9,6 +9,7 @@ import ( "github.com/iotaledger/hive.go/lo" "github.com/iotaledger/hive.go/runtime/module" "github.com/iotaledger/hive.go/runtime/syncutils" + "github.com/iotaledger/iota-core/pkg/model" "github.com/iotaledger/iota-core/pkg/protocol/engine/accounts" "github.com/iotaledger/iota-core/pkg/protocol/engine/utxoledger" iotago "github.com/iotaledger/iota.go/v4" @@ -24,15 +25,18 @@ type Manager struct { accountOutputResolveFunc func(iotago.AccountID, iotago.SlotIndex) (*utxoledger.Output, error) + accountRetrieveFunc func(iotago.AccountID, iotago.SlotIndex) (*accounts.AccountData, bool, error) + mutex syncutils.Mutex module.Module } -func NewManager(apiProvider iotago.APIProvider, accountOutputResolveFunc func(iotago.AccountID, iotago.SlotIndex) (*utxoledger.Output, error)) *Manager { +func NewManager(apiProvider iotago.APIProvider, accountOutputResolveFunc func(iotago.AccountID, iotago.SlotIndex) (*utxoledger.Output, error), accountRetrieveFunc func(iotago.AccountID, iotago.SlotIndex) (*accounts.AccountData, bool, error)) *Manager { return &Manager{ apiProvider: apiProvider, accountOutputResolveFunc: accountOutputResolveFunc, + accountRetrieveFunc: accountRetrieveFunc, manaVectorCache: cache.New[iotago.AccountID, *accounts.Mana](10000), } } @@ -55,7 +59,17 @@ func (m *Manager) GetManaOnAccount(accountID iotago.AccountID, currentSlot iotag if err != nil { excessBaseTokens = 0 } - mana = accounts.NewMana(output.StoredMana(), excessBaseTokens, output.SlotCreated()) + + decayedBIC, err := m.getDecayedBIC(accountID, currentSlot) + if err != nil { + return 0, ierrors.Wrapf(err, "failed to get decayed BIC for %s", accountID) + } + totalMana, err := safemath.SafeAdd(output.StoredMana(), decayedBIC) + if err != nil { + return 0, ierrors.Wrapf(err, "overflow when adding stored mana and decayed BIC for account %s", accountID) + } + + mana = accounts.NewMana(totalMana, excessBaseTokens, output.SlotCreated()) if !exists { m.manaVectorCache.Put(accountID, mana) @@ -67,7 +81,7 @@ func (m *Manager) GetManaOnAccount(accountID iotago.AccountID, currentSlot iotag } manaDecayProvider := m.apiProvider.CurrentAPI().ManaDecayProvider() - // apply decay to stored Mana and potential that was added on last update + // apply decay to stored, allotted and potential that was added on last update manaStored, err := manaDecayProvider.ManaWithDecay(mana.Value(), mana.UpdateTime(), currentSlot) if err != nil { return 0, err @@ -79,14 +93,26 @@ func (m *Manager) GetManaOnAccount(accountID iotago.AccountID, currentSlot iotag if err != nil { return 0, err } - updatedValue += manaPotential + updatedValue, err = safemath.SafeAdd(updatedValue, manaPotential) + if err != nil { + return 0, ierrors.Wrapf(err, "overflow when adding stored and potential mana for account %s", accountID) + } + + decayedBIC, err := m.getDecayedBIC(accountID, currentSlot) + if err != nil { + return 0, ierrors.Wrapf(err, "failed to get decayed BIC for %s", accountID) + } + updatedValue, err = safemath.SafeAdd(updatedValue, decayedBIC) + if err != nil { + return 0, ierrors.Wrapf(err, "overflow when adding stored, potential and decayed BIC for account %s", accountID) + } mana.UpdateValue(updatedValue, currentSlot) return mana.Value(), nil } -func (m *Manager) ApplyDiff(slot iotago.SlotIndex, destroyedAccounts ds.Set[iotago.AccountID], accountOutputs map[iotago.AccountID]*utxoledger.Output) { +func (m *Manager) ApplyDiff(slot iotago.SlotIndex, destroyedAccounts ds.Set[iotago.AccountID], accountOutputs map[iotago.AccountID]*utxoledger.Output, accountDiffs map[iotago.AccountID]*model.AccountDiff) error { m.mutex.Lock() defer m.mutex.Unlock() @@ -94,15 +120,51 @@ func (m *Manager) ApplyDiff(slot iotago.SlotIndex, destroyedAccounts ds.Set[iota m.manaVectorCache.Remove(accountID) }) - for accountID, output := range accountOutputs { + for accountID := range accountDiffs { mana, exists := m.manaVectorCache.Get(accountID) if exists { - minDeposit := lo.PanicOnErr(m.apiProvider.CurrentAPI().RentStructure().MinDeposit(output.Output())) - excessBaseTokens, err := safemath.SafeSub(output.BaseTokenAmount(), minDeposit) + var excessBaseTokens iotago.BaseToken + var storedMana iotago.Mana + var err error + if output, has := accountOutputs[accountID]; has { + minDeposit := lo.PanicOnErr(m.apiProvider.CurrentAPI().RentStructure().MinDeposit(output.Output())) + excessBaseTokens, err = safemath.SafeSub(output.BaseTokenAmount(), minDeposit) + if err != nil { + excessBaseTokens = 0 + } + storedMana = output.StoredMana() + } + decayedBIC, err := m.getDecayedBIC(accountID, slot) + if err != nil { + return err + } + totalMana, err := safemath.SafeAdd(decayedBIC, storedMana) if err != nil { - excessBaseTokens = 0 + return ierrors.Wrapf(err, "overflow when adding stored mana and decayed BIC for account %s", accountID) } - mana.Update(output.StoredMana(), excessBaseTokens, slot) + + mana.Update(totalMana, excessBaseTokens, slot) } } + + return nil +} + +func (m *Manager) getDecayedBIC(accountID iotago.AccountID, slot iotago.SlotIndex) (iotago.Mana, error) { + accountBIC, exists, err := m.accountRetrieveFunc(accountID, slot) + if err != nil { + return 0, ierrors.Wrapf(err, "failed to retrieve account data for %s in slot %s", accountID, slot) + } + if !exists { + return 0, ierrors.Errorf("account data for %s in slot %s does not exist", accountID, slot) + } + if accountBIC.Credits.Value <= 0 { + return 0, nil + } + decayedBIC, err := m.apiProvider.CurrentAPI().ManaDecayProvider().ManaWithDecay(iotago.Mana(accountBIC.Credits.Value), accountBIC.Credits.UpdateTime, slot) + if err != nil { + return 0, ierrors.Wrapf(err, "failed to apply mana decay for account %s", accountID) + } + + return decayedBIC, nil } diff --git a/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go b/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go index 6603b45d8..8eb606cd3 100644 --- a/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go +++ b/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go @@ -88,12 +88,9 @@ func NewProvider(opts ...options.Option[Scheduler]) module.Provider[*engine.Engi return 0, err } - minMana := s.apiProvider.CurrentAPI().ProtocolParameters().CongestionControlParameters().MinMana - if mana < minMana { - return 0, ierrors.Errorf("account %s has insufficient Mana for block to be scheduled: account Mana %d, min Mana %d", accountID, mana, minMana) - } + mana = lo.Min(mana, iotago.Mana(s.maxDeficit()-1)) - return Deficit(mana / minMana), nil + return 1 + Deficit(mana), nil } }) s.TriggerConstructed() diff --git a/pkg/protocol/engine/ledger/ledger/ledger.go b/pkg/protocol/engine/ledger/ledger/ledger.go index 5818a92ba..5889c1548 100644 --- a/pkg/protocol/engine/ledger/ledger/ledger.go +++ b/pkg/protocol/engine/ledger/ledger/ledger.go @@ -71,7 +71,7 @@ func NewProvider() module.Provider[*engine.Engine, ledger.Ledger] { l.memPool = mempoolv1.New(NewVM(l), l.resolveState, e.Workers.CreateGroup("MemPool"), l.conflictDAG, l.errorHandler, mempoolv1.WithForkAllTransactions[ledger.BlockVoteRank](true)) e.EvictionState.Events.SlotEvicted.Hook(l.memPool.Evict) - l.manaManager = mana.NewManager(l.apiProvider, l.resolveAccountOutput) + l.manaManager = mana.NewManager(l.apiProvider, l.resolveAccountOutput, l.accountsLedger.Account) latestCommittedSlot := e.Storage.Settings().LatestCommitment().Slot() l.accountsLedger.SetLatestCommittedSlot(latestCommittedSlot) l.rmcManager.SetLatestCommittedSlot(latestCommittedSlot) @@ -170,9 +170,6 @@ func (l *Ledger) CommitSlot(slot iotago.SlotIndex) (stateRoot iotago.Identifier, l.prepareAccountDiffs(accountDiffs, slot, consumedAccounts, createdAccounts) // Commit the changes - // Update the mana manager's cache - l.manaManager.ApplyDiff(slot, destroyedAccounts, createdAccounts) - // Update the UTXO ledger if err = l.utxoLedger.ApplyDiff(slot, outputs, spends); err != nil { return iotago.Identifier{}, iotago.Identifier{}, iotago.Identifier{}, ierrors.Errorf("failed to apply diff to UTXO ledger for slot %d: %w", slot, err) @@ -190,6 +187,11 @@ func (l *Ledger) CommitSlot(slot iotago.SlotIndex) (stateRoot iotago.Identifier, return iotago.Identifier{}, iotago.Identifier{}, iotago.Identifier{}, ierrors.Errorf("failed to apply diff to Accounts ledger for slot %d: %w", slot, err) } + // Update the mana manager's cache + if err = l.manaManager.ApplyDiff(slot, destroyedAccounts, createdAccounts, accountDiffs); err != nil { + return iotago.Identifier{}, iotago.Identifier{}, iotago.Identifier{}, ierrors.Errorf("failed to apply diff to mana manager for slot %d: %w", slot, err) + } + // Mark each transaction as committed so the mempool can evict it stateDiff.ExecutedTransactions().ForEach(func(_ iotago.TransactionID, tx mempool.TransactionMetadata) bool { tx.Commit() diff --git a/pkg/tests/upgrade_signaling_test.go b/pkg/tests/upgrade_signaling_test.go index 0423a590e..d30e6ee85 100644 --- a/pkg/tests/upgrade_signaling_test.go +++ b/pkg/tests/upgrade_signaling_test.go @@ -96,7 +96,7 @@ func Test_Upgrade_Signaling(t *testing.T) { ts.AssertAccountData(&accounts.AccountData{ ID: ts.Node("nodeA").AccountID, - Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits, UpdateTime: 0}, + Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits / 2, UpdateTime: 0}, ExpirySlot: iotago.MaxSlotIndex, OutputID: iotago.OutputIDFromTransactionIDAndIndex(snapshotcreator.GenesisTransactionID, 1), BlockIssuerKeys: iotago.NewBlockIssuerKeys(iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(ts.Node("nodeA").PubKey))), @@ -109,7 +109,7 @@ func Test_Upgrade_Signaling(t *testing.T) { ts.AssertAccountData(&accounts.AccountData{ ID: ts.Node("nodeF").AccountID, - Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits, UpdateTime: 0}, + Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits / 2, UpdateTime: 0}, ExpirySlot: iotago.MaxSlotIndex, OutputID: iotago.OutputIDFromTransactionIDAndIndex(snapshotcreator.GenesisTransactionID, 6), BlockIssuerKeys: iotago.NewBlockIssuerKeys(iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(ts.Node("nodeF").PubKey))), @@ -133,7 +133,7 @@ func Test_Upgrade_Signaling(t *testing.T) { // check account data before all nodes set the current version ts.AssertAccountData(&accounts.AccountData{ ID: ts.Node("nodeA").AccountID, - Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits, UpdateTime: 0}, + Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits / 2, UpdateTime: 0}, ExpirySlot: iotago.MaxSlotIndex, OutputID: iotago.OutputIDFromTransactionIDAndIndex(snapshotcreator.GenesisTransactionID, 1), BlockIssuerKeys: iotago.NewBlockIssuerKeys(iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(ts.Node("nodeA").PubKey))), @@ -146,7 +146,7 @@ func Test_Upgrade_Signaling(t *testing.T) { ts.AssertAccountData(&accounts.AccountData{ ID: ts.Node("nodeD").AccountID, - Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits, UpdateTime: 0}, + Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits / 2, UpdateTime: 0}, ExpirySlot: iotago.MaxSlotIndex, OutputID: iotago.OutputIDFromTransactionIDAndIndex(snapshotcreator.GenesisTransactionID, 4), BlockIssuerKeys: iotago.NewBlockIssuerKeys(iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(ts.Node("nodeD").PubKey))), @@ -167,7 +167,7 @@ func Test_Upgrade_Signaling(t *testing.T) { ts.AssertAccountData(&accounts.AccountData{ ID: ts.Node("nodeA").AccountID, - Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits, UpdateTime: 0}, + Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits / 2, UpdateTime: 0}, ExpirySlot: iotago.MaxSlotIndex, OutputID: iotago.OutputIDFromTransactionIDAndIndex(snapshotcreator.GenesisTransactionID, 1), BlockIssuerKeys: iotago.NewBlockIssuerKeys(iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(ts.Node("nodeA").PubKey))), @@ -340,7 +340,7 @@ func Test_Upgrade_Signaling(t *testing.T) { // check account data at the end of the test ts.AssertAccountData(&accounts.AccountData{ ID: ts.Node("nodeA").AccountID, - Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits, UpdateTime: 0}, + Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits / 2, UpdateTime: 0}, ExpirySlot: iotago.MaxSlotIndex, OutputID: iotago.OutputIDFromTransactionIDAndIndex(snapshotcreator.GenesisTransactionID, 1), BlockIssuerKeys: iotago.NewBlockIssuerKeys(iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(ts.Node("nodeA").PubKey))), @@ -353,7 +353,7 @@ func Test_Upgrade_Signaling(t *testing.T) { ts.AssertAccountData(&accounts.AccountData{ ID: ts.Node("nodeD").AccountID, - Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits, UpdateTime: 0}, + Credits: &accounts.BlockIssuanceCredits{Value: iotago.MaxBlockIssuanceCredits / 2, UpdateTime: 0}, ExpirySlot: iotago.MaxSlotIndex, OutputID: iotago.OutputIDFromTransactionIDAndIndex(snapshotcreator.GenesisTransactionID, 4), BlockIssuerKeys: iotago.NewBlockIssuerKeys(iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(ts.Node("nodeD").PubKey))), diff --git a/pkg/testsuite/testsuite.go b/pkg/testsuite/testsuite.go index c9a29042c..ab5e67b5a 100644 --- a/pkg/testsuite/testsuite.go +++ b/pkg/testsuite/testsuite.go @@ -57,7 +57,6 @@ type TestSuite struct { optsRMCIncreaseThreshold iotago.WorkScore optsRMCDecreaseThreshold iotago.WorkScore optsSchedulerRate iotago.WorkScore - optsMinMana iotago.Mana optsMaxBufferSize uint32 optsAccounts []snapshotcreator.AccountDetails optsSnapshotOptions []options.Option[snapshotcreator.Options] @@ -98,7 +97,6 @@ func NewTestSuite(testingT *testing.T, opts ...options.Option[TestSuite]) *TestS optsRMCIncreaseThreshold: 8 * schedulerRate, optsRMCDecreaseThreshold: 5 * schedulerRate, optsSchedulerRate: schedulerRate, - optsMinMana: 1, optsMaxBufferSize: 100 * iotago.MaxBlockSize, }, opts, func(t *TestSuite) { fmt.Println("Setup TestSuite -", testingT.Name(), " @ ", time.Now()) @@ -136,7 +134,6 @@ func NewTestSuite(testingT *testing.T, opts ...options.Option[TestSuite]) *TestS t.optsRMCIncreaseThreshold, t.optsRMCDecreaseThreshold, t.optsSchedulerRate, - t.optsMinMana, t.optsMaxBufferSize, t.optsMaxBufferSize, ), @@ -357,7 +354,7 @@ func (t *TestSuite) addNodeToPartition(name string, partition string, validator Mana: iotago.Mana(amount), IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(node.PubKey)), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 2, } if validator { accountDetails.StakedAmount = accountDetails.Amount diff --git a/tools/evil-spammer/go.mod b/tools/evil-spammer/go.mod index be4d5ccb5..1fe7c131b 100644 --- a/tools/evil-spammer/go.mod +++ b/tools/evil-spammer/go.mod @@ -17,7 +17,7 @@ require ( github.com/iotaledger/hive.go/runtime v0.0.0-20230929122509-67f34bfed40d github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 github.com/iotaledger/iota-core/tools/genesis-snapshot v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20231003122130-2871888a9297 + github.com/iotaledger/iota.go/v4 v4.0.0-20231003154311-26aa2f0fd388 github.com/mr-tron/base58 v1.2.0 go.uber.org/atomic v1.11.0 ) diff --git a/tools/evil-spammer/go.sum b/tools/evil-spammer/go.sum index 6388ee5b3..2da3ca0c4 100644 --- a/tools/evil-spammer/go.sum +++ b/tools/evil-spammer/go.sum @@ -195,8 +195,8 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230929122509-67f34bf github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230929122509-67f34bfed40d/go.mod h1:IJgaaxbgKCsNat18jlJJEAxCY2oVYR3F30B+M4vJ89I= github.com/iotaledger/hive.go/stringify v0.0.0-20230929122509-67f34bfed40d h1:ekHWRypoaiCXgrJVUQS7rCewsK3FuG1gTbPxu5jYn9c= github.com/iotaledger/hive.go/stringify v0.0.0-20230929122509-67f34bfed40d/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/iota.go/v4 v4.0.0-20231003122130-2871888a9297 h1:kbpsa/gF0x6Cxu5lN9TL8u5EdaGv1P3/OKKPW0w83Og= -github.com/iotaledger/iota.go/v4 v4.0.0-20231003122130-2871888a9297/go.mod h1:+e3bsJFDr9HxmUMe+eQOLNut5wfcB/ivhJdouOJgOnE= +github.com/iotaledger/iota.go/v4 v4.0.0-20231003154311-26aa2f0fd388 h1:IGqHrJRmrzfalf1py+FGWzkWoaA5o6avBSYWznVG08s= +github.com/iotaledger/iota.go/v4 v4.0.0-20231003154311-26aa2f0fd388/go.mod h1:+e3bsJFDr9HxmUMe+eQOLNut5wfcB/ivhJdouOJgOnE= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index 06bd92756..97a51cd75 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -72,7 +72,7 @@ require ( github.com/iotaledger/hive.go/stringify v0.0.0-20230929122509-67f34bfed40d // indirect github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231001095511-32be422a567e // indirect github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231001095356-923e8f138951 // indirect - github.com/iotaledger/iota.go/v4 v4.0.0-20231003122130-2871888a9297 // indirect + github.com/iotaledger/iota.go/v4 v4.0.0-20231003154311-26aa2f0fd388 // indirect github.com/ipfs/boxo v0.10.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect diff --git a/tools/gendoc/go.sum b/tools/gendoc/go.sum index 5e53af302..d35f5a5a3 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -311,8 +311,8 @@ github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231001095511-32be422a567e h1:Mwoe7 github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231001095511-32be422a567e/go.mod h1:jhzexR5X8m6qcmrwt5OX477O/ZwT7Ak9sPT83ByPkAo= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231001095356-923e8f138951 h1:qUf1W0fE1IyZzVy3Exv0Kj+SKECXG3S26c9m2ETb07U= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231001095356-923e8f138951/go.mod h1:c5778OnWpLq108YE+Eb2m8Ri/t/4ydV0TvI/Sy5YivQ= -github.com/iotaledger/iota.go/v4 v4.0.0-20231003122130-2871888a9297 h1:kbpsa/gF0x6Cxu5lN9TL8u5EdaGv1P3/OKKPW0w83Og= -github.com/iotaledger/iota.go/v4 v4.0.0-20231003122130-2871888a9297/go.mod h1:+e3bsJFDr9HxmUMe+eQOLNut5wfcB/ivhJdouOJgOnE= +github.com/iotaledger/iota.go/v4 v4.0.0-20231003154311-26aa2f0fd388 h1:IGqHrJRmrzfalf1py+FGWzkWoaA5o6avBSYWznVG08s= +github.com/iotaledger/iota.go/v4 v4.0.0-20231003154311-26aa2f0fd388/go.mod h1:+e3bsJFDr9HxmUMe+eQOLNut5wfcB/ivhJdouOJgOnE= github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY= github.com/ipfs/boxo v0.10.0/go.mod h1:Fg+BnfxZ0RPzR0nOodzdIq3A7KgoWAOWsEIImrIQdBM= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= diff --git a/tools/genesis-snapshot/go.mod b/tools/genesis-snapshot/go.mod index 8a4a3785d..09c576a38 100644 --- a/tools/genesis-snapshot/go.mod +++ b/tools/genesis-snapshot/go.mod @@ -10,7 +10,7 @@ require ( github.com/iotaledger/hive.go/lo v0.0.0-20230929122509-67f34bfed40d github.com/iotaledger/hive.go/runtime v0.0.0-20230929122509-67f34bfed40d github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20231003122130-2871888a9297 + github.com/iotaledger/iota.go/v4 v4.0.0-20231003154311-26aa2f0fd388 github.com/mr-tron/base58 v1.2.0 github.com/spf13/pflag v1.0.5 golang.org/x/crypto v0.13.0 diff --git a/tools/genesis-snapshot/go.sum b/tools/genesis-snapshot/go.sum index fcf0ce336..105293b91 100644 --- a/tools/genesis-snapshot/go.sum +++ b/tools/genesis-snapshot/go.sum @@ -50,8 +50,8 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230929122509-67f34bf github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230929122509-67f34bfed40d/go.mod h1:IJgaaxbgKCsNat18jlJJEAxCY2oVYR3F30B+M4vJ89I= github.com/iotaledger/hive.go/stringify v0.0.0-20230929122509-67f34bfed40d h1:ekHWRypoaiCXgrJVUQS7rCewsK3FuG1gTbPxu5jYn9c= github.com/iotaledger/hive.go/stringify v0.0.0-20230929122509-67f34bfed40d/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/iota.go/v4 v4.0.0-20231003122130-2871888a9297 h1:kbpsa/gF0x6Cxu5lN9TL8u5EdaGv1P3/OKKPW0w83Og= -github.com/iotaledger/iota.go/v4 v4.0.0-20231003122130-2871888a9297/go.mod h1:+e3bsJFDr9HxmUMe+eQOLNut5wfcB/ivhJdouOJgOnE= +github.com/iotaledger/iota.go/v4 v4.0.0-20231003154311-26aa2f0fd388 h1:IGqHrJRmrzfalf1py+FGWzkWoaA5o6avBSYWznVG08s= +github.com/iotaledger/iota.go/v4 v4.0.0-20231003154311-26aa2f0fd388/go.mod h1:+e3bsJFDr9HxmUMe+eQOLNut5wfcB/ivhJdouOJgOnE= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= diff --git a/tools/genesis-snapshot/presets/presets.go b/tools/genesis-snapshot/presets/presets.go index dbfee7494..e39a86667 100644 --- a/tools/genesis-snapshot/presets/presets.go +++ b/tools/genesis-snapshot/presets/presets.go @@ -25,7 +25,7 @@ var Base = []options.Option[snapshotcreator.Options]{ iotago.WithTimeProviderOptions(time.Now().Unix(), 10, 13), iotago.WithLivenessOptions(30, 30, 7, 14, 30), // increase/decrease threshold = fraction * slotDurationInSeconds * schedulerRate - iotago.WithCongestionControlOptions(500, 500, 500, 800000, 500000, 100000, 1, 1000, 100), + iotago.WithCongestionControlOptions(500, 500, 500, 800000, 500000, 100000, 1000, 100), iotago.WithWorkScoreOptions(25, 1, 100, 50, 10, 10, 50, 1, 10, 250), ), ), @@ -43,7 +43,7 @@ var Docker = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinValidatorAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x293dc170d9a59474e6d81cfba7f7d924c09b25d7166bcfba606e53114d0a758b")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 2, StakingEpochEnd: iotago.MaxEpochIndex, FixedCost: 1, StakedAmount: testsuite.MinValidatorAccountAmount, @@ -55,7 +55,7 @@ var Docker = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinValidatorAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x05c1de274451db8de8182d64c6ee0dca3ae0c9077e0b4330c976976171d79064")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 2, StakingEpochEnd: iotago.MaxEpochIndex, FixedCost: 1, StakedAmount: testsuite.MinValidatorAccountAmount, @@ -67,7 +67,7 @@ var Docker = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinValidatorAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x1e4b21eb51dcddf65c20db1065e1f1514658b23a3ddbf48d30c0efc926a9a648")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 2, StakingEpochEnd: iotago.MaxEpochIndex, FixedCost: 1, StakedAmount: testsuite.MinValidatorAccountAmount, @@ -79,7 +79,7 @@ var Docker = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinIssuerAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0xa54fafa44a88e4a6a37796526ea884f613a24d84337871226eb6360f022d8b39")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 2, Mana: iotago.Mana(testsuite.MinIssuerAccountAmount), }, snapshotcreator.AccountDetails{ // nomana2 @@ -88,7 +88,7 @@ var Docker = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinIssuerAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0xcb5ea14175ce649149ee41217c44aa70c3205b9939968449eae408727a71f91b")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 2, Mana: iotago.Mana(testsuite.MinIssuerAccountAmount), }, ), @@ -99,7 +99,7 @@ var Docker = []options.Option[snapshotcreator.Options]{ iotago.WithTimeProviderOptions(time.Now().Unix(), 10, 13), iotago.WithLivenessOptions(30, 30, 7, 14, 30), // increase/decrease threshold = fraction * slotDurationInSeconds * schedulerRate - iotago.WithCongestionControlOptions(500, 500, 500, 800000, 500000, 100000, 1, 1000, 100), + iotago.WithCongestionControlOptions(500, 500, 500, 800000, 500000, 100000, 1000, 100), iotago.WithWorkScoreOptions(25, 1, 100, 50, 10, 10, 50, 1, 10, 250), ), ), @@ -115,7 +115,7 @@ var Feature = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinValidatorAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x01fb6b9db5d96240aef00bc950d1c67a6494513f6d7cf784e57b4972b96ab2fe")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 2, StakingEpochEnd: iotago.MaxEpochIndex, FixedCost: 1, StakedAmount: testsuite.MinValidatorAccountAmount, @@ -127,7 +127,7 @@ var Feature = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinValidatorAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x83e7f71a440afd48981a8b4684ddae24434b7182ce5c47cfb56ac528525fd4b6")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 2, StakingEpochEnd: iotago.MaxEpochIndex, FixedCost: 1, StakedAmount: testsuite.MinValidatorAccountAmount, @@ -139,7 +139,7 @@ var Feature = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinValidatorAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0xac628986b2ef52a1679f2289fcd7b4198476976dea4c30ae34ff04ae52e14805")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 2, StakingEpochEnd: iotago.MaxEpochIndex, FixedCost: 1, StakedAmount: testsuite.MinValidatorAccountAmount, @@ -153,7 +153,7 @@ var Feature = []options.Option[snapshotcreator.Options]{ iotago.WithTimeProviderOptions(1689848996, 10, 13), iotago.WithLivenessOptions(30, 30, 10, 20, 30), // increase/decrease threshold = fraction * slotDurationInSeconds * schedulerRate - iotago.WithCongestionControlOptions(500, 500, 500, 800000, 500000, 100000, 1, 1000, 100), + iotago.WithCongestionControlOptions(500, 500, 500, 800000, 500000, 100000, 1000, 100), iotago.WithWorkScoreOptions(25, 1, 100, 50, 10, 10, 50, 1, 10, 250), ), ),