From 774f26c1904ac3381bf7ef1c6c44348664404156 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 5 Dec 2023 15:28:09 +0000 Subject: [PATCH 01/30] incorporate protocol params with sanity checks --- go.mod | 2 +- go.sum | 4 +- pkg/protocol/chainmanager/manager_test.go | 20 +++---- .../accounts/accountsledger/testsuite_test.go | 8 +-- .../engine/accounts/mana/manager_test.go | 14 ++--- .../slotattestation/testframework_test.go | 8 +-- .../blockgadget/testframework_test.go | 10 ++-- pkg/protocol/engine/eviction/state_test.go | 20 +++---- .../post_solid_block_filter_test.go | 6 +- .../pre_solid_block_filter_test.go | 12 ++-- .../engine/mempool/v1/mempool_test.go | 4 +- .../engine/tipmanager/tests/testframework.go | 2 +- .../engine/utxoledger/iteration_test.go | 4 +- .../engine/utxoledger/manager_test.go | 4 +- pkg/protocol/engine/utxoledger/output_test.go | 20 +++---- .../engine/utxoledger/slot_diff_test.go | 6 +- .../engine/utxoledger/snapshot_test.go | 58 +++++++++---------- pkg/protocol/engine/utxoledger/tpkg/random.go | 4 +- .../seatmanager/topstakers/topstakers_test.go | 6 +- .../performance/testsuite_test.go | 4 +- pkg/storage/testframework_test.go | 2 +- pkg/tests/accounts_test.go | 58 +++---------------- pkg/tests/booker_test.go | 8 +-- pkg/tests/reward_test.go | 8 +-- pkg/tests/upgrade_signaling_test.go | 2 +- .../depositcalculator_test.go | 2 +- pkg/testsuite/testsuite.go | 48 +-------------- pkg/testsuite/testsuite_options.go | 33 ++++++----- tools/gendoc/go.mod | 2 +- tools/gendoc/go.sum | 4 +- tools/genesis-snapshot/go.mod | 2 +- tools/genesis-snapshot/go.sum | 4 +- tools/genesis-snapshot/presets/presets.go | 35 +++-------- 33 files changed, 154 insertions(+), 270 deletions(-) diff --git a/go.mod b/go.mod index 256f3d414..3042bf829 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/iotaledger/hive.go/stringify v0.0.0-20231128121006-331a9e522dfe github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 - github.com/iotaledger/iota.go/v4 v4.0.0-20231204084048-9c12053adaf6 + github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da github.com/labstack/echo/v4 v4.11.3 github.com/labstack/gommon v0.4.1 github.com/libp2p/go-libp2p v0.32.0 diff --git a/go.sum b/go.sum index 947972092..4fb7e6fa3 100644 --- a/go.sum +++ b/go.sum @@ -307,8 +307,8 @@ github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 h1:+ozra github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221/go.mod h1:6cLX3gnhP0WL+Q+mf3/rIqfACe5fWKVR8luPXWh2xiY= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 h1:XdhojOpZ0t0pJFyNO0zlBogSAUrhEI67eCpTC9H6sGM= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665/go.mod h1:obK1N42oafGA7EH6zC4VX2fKh7jTa3WnIa9h1azfxq0= -github.com/iotaledger/iota.go/v4 v4.0.0-20231204084048-9c12053adaf6 h1:Wuf8Ps3tzuZ5CCbl7LA5O2qwhfuXWo30RCOT0yhm4pg= -github.com/iotaledger/iota.go/v4 v4.0.0-20231204084048-9c12053adaf6/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= +github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da h1:oNgrEVzIa4613fN7Prw9RCePT1wIF5UB1MnhoV/ys4M= +github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= diff --git a/pkg/protocol/chainmanager/manager_test.go b/pkg/protocol/chainmanager/manager_test.go index 21d24c997..79eb107ae 100644 --- a/pkg/protocol/chainmanager/manager_test.go +++ b/pkg/protocol/chainmanager/manager_test.go @@ -15,7 +15,7 @@ import ( ) func TestManager(t *testing.T) { - tf := NewTestFramework(t, tpkg.TestAPI) + tf := NewTestFramework(t, tpkg.ZeroCostTestAPI) tf.CreateCommitment("1", "Genesis", 10) tf.CreateCommitment("2", "1", 20) tf.CreateCommitment("3", "2", 30) @@ -213,7 +213,7 @@ func TestManager(t *testing.T) { } func TestManagerForkDetectedAgain(t *testing.T) { - tf := NewTestFramework(t, tpkg.TestAPI) + tf := NewTestFramework(t, tpkg.ZeroCostTestAPI) tf.CreateCommitment("1", "Genesis", 10) tf.CreateCommitment("2", "1", 20) tf.CreateCommitment("3", "2", 30) @@ -296,7 +296,7 @@ func TestManagerForkDetectedAgain(t *testing.T) { } func TestManagerForkDetectedReorgChains(t *testing.T) { - tf := NewTestFramework(t, tpkg.TestAPI) + tf := NewTestFramework(t, tpkg.ZeroCostTestAPI) tf.CreateCommitment("1", "Genesis", 10) tf.CreateCommitment("2", "1", 20) tf.CreateCommitment("3", "2", 30) @@ -368,9 +368,9 @@ func TestManagerForkDetectedReorgChains(t *testing.T) { } func TestEvaluateAgainstRootCommitment(t *testing.T) { - rootCommitment := iotago.NewCommitment(tpkg.TestAPI.Version(), 1, iotago.CommitmentIDRepresentingData(1, []byte{9}), iotago.Identifier{}, 0, 0) + rootCommitment := iotago.NewCommitment(tpkg.ZeroCostTestAPI.Version(), 1, iotago.CommitmentIDRepresentingData(1, []byte{9}), iotago.Identifier{}, 0, 0) - modelRootCommitment, err := model.CommitmentFromCommitment(rootCommitment, tpkg.TestAPI) + modelRootCommitment, err := model.CommitmentFromCommitment(rootCommitment, tpkg.ZeroCostTestAPI) require.NoError(t, err) m := &Manager{ @@ -379,7 +379,7 @@ func TestEvaluateAgainstRootCommitment(t *testing.T) { m.rootCommitment.PublishCommitment(modelRootCommitment) - isBelow, isRootCommitment := m.evaluateAgainstRootCommitment(iotago.NewCommitment(tpkg.TestAPI.Version(), 0, iotago.CommitmentIDRepresentingData(0, []byte{}), iotago.Identifier{}, 0, 0)) + isBelow, isRootCommitment := m.evaluateAgainstRootCommitment(iotago.NewCommitment(tpkg.ZeroCostTestAPI.Version(), 0, iotago.CommitmentIDRepresentingData(0, []byte{}), iotago.Identifier{}, 0, 0)) require.True(t, isBelow, "commitment with index 0 should be below root commitment") require.False(t, isRootCommitment, "commitment with index 0 should not be the root commitment") @@ -387,21 +387,21 @@ func TestEvaluateAgainstRootCommitment(t *testing.T) { require.True(t, isBelow, "commitment with index 1 should be below root commitment") require.True(t, isRootCommitment, "commitment with index 1 should be the root commitment") - isBelow, isRootCommitment = m.evaluateAgainstRootCommitment(iotago.NewCommitment(tpkg.TestAPI.Version(), 1, iotago.CommitmentIDRepresentingData(1, []byte{1}), iotago.Identifier{}, 0, 0)) + isBelow, isRootCommitment = m.evaluateAgainstRootCommitment(iotago.NewCommitment(tpkg.ZeroCostTestAPI.Version(), 1, iotago.CommitmentIDRepresentingData(1, []byte{1}), iotago.Identifier{}, 0, 0)) require.True(t, isBelow, "commitment with index 1 should be below root commitment") require.False(t, isRootCommitment, "commitment with index 1 should be the root commitment") - isBelow, isRootCommitment = m.evaluateAgainstRootCommitment(iotago.NewCommitment(tpkg.TestAPI.Version(), 1, iotago.CommitmentIDRepresentingData(1, []byte{9}), iotago.Identifier{}, 0, 0)) + isBelow, isRootCommitment = m.evaluateAgainstRootCommitment(iotago.NewCommitment(tpkg.ZeroCostTestAPI.Version(), 1, iotago.CommitmentIDRepresentingData(1, []byte{9}), iotago.Identifier{}, 0, 0)) require.True(t, isBelow, "commitment with index 1 should be below root commitment") require.True(t, isRootCommitment, "commitment with index 1 should be the root commitment") - isBelow, isRootCommitment = m.evaluateAgainstRootCommitment(iotago.NewCommitment(tpkg.TestAPI.Version(), 2, iotago.CommitmentIDRepresentingData(2, []byte{}), iotago.Identifier{}, 0, 0)) + isBelow, isRootCommitment = m.evaluateAgainstRootCommitment(iotago.NewCommitment(tpkg.ZeroCostTestAPI.Version(), 2, iotago.CommitmentIDRepresentingData(2, []byte{}), iotago.Identifier{}, 0, 0)) require.False(t, isBelow, "commitment with index 2 should not be below root commitment") require.False(t, isRootCommitment, "commitment with index 2 should not be the root commitment") } func TestProcessCommitment(t *testing.T) { - tf := NewTestFramework(t, tpkg.TestAPI) + tf := NewTestFramework(t, tpkg.ZeroCostTestAPI) tf.CreateCommitment("1", "Genesis", 10) tf.CreateCommitment("2", "1", 20) diff --git a/pkg/protocol/engine/accounts/accountsledger/testsuite_test.go b/pkg/protocol/engine/accounts/accountsledger/testsuite_test.go index 51f2247bc..fecb06637 100644 --- a/pkg/protocol/engine/accounts/accountsledger/testsuite_test.go +++ b/pkg/protocol/engine/accounts/accountsledger/testsuite_test.go @@ -38,7 +38,7 @@ type TestSuite struct { } func NewTestSuite(test *testing.T) *TestSuite { - testAPI := tpkg.TestAPI + testAPI := tpkg.ZeroCostTestAPI t := &TestSuite{ T: test, @@ -65,7 +65,7 @@ func (t *TestSuite) initAccountLedger() *accountsledger.Manager { prunableStores[slot] = mapdb.NewMapDB() } - p := slotstore.NewAccountDiffs(slot, prunableStores[slot], tpkg.TestAPI) + p := slotstore.NewAccountDiffs(slot, prunableStores[slot], tpkg.ZeroCostTestAPI) return p, nil } @@ -187,8 +187,8 @@ func (t *TestSuite) ApplySlotActions(slot iotago.SlotIndex, rmc iotago.Mana, act } func (t *TestSuite) createBlockWithRMC(accountID iotago.AccountID, slot iotago.SlotIndex, rmc iotago.Mana) *blocks.Block { - innerBlock := tpkg.RandBasicBlockWithIssuerAndRMC(tpkg.TestAPI, accountID, rmc) - innerBlock.Header.IssuingTime = tpkg.TestAPI.TimeProvider().SlotStartTime(slot) + innerBlock := tpkg.RandBasicBlockWithIssuerAndRMC(tpkg.ZeroCostTestAPI, accountID, rmc) + innerBlock.Header.IssuingTime = tpkg.ZeroCostTestAPI.TimeProvider().SlotStartTime(slot) modelBlock, err := model.BlockFromBlock(innerBlock) require.NoError(t.T, err) diff --git a/pkg/protocol/engine/accounts/mana/manager_test.go b/pkg/protocol/engine/accounts/mana/manager_test.go index 62301750c..352b7857e 100644 --- a/pkg/protocol/engine/accounts/mana/manager_test.go +++ b/pkg/protocol/engine/accounts/mana/manager_test.go @@ -24,7 +24,7 @@ func TestManager_GetManaOnAccountOverflow(t *testing.T) { switch id { case accountIDOverflow: return utxoledger.CreateOutput( - iotago.SingleVersionProvider(tpkg.TestAPI), + iotago.SingleVersionProvider(tpkg.ZeroCostTestAPI), iotago.OutputIDFromTransactionIDAndIndex(iotago.NewTransactionID(0, tpkg.Rand32ByteArray()), 0), tpkg.RandBlockID(), tpkg.RandSlot(), @@ -33,11 +33,11 @@ func TestManager_GetManaOnAccountOverflow(t *testing.T) { Mana: iotago.MaxMana/2 + iotago.MaxMana/4, AccountID: accountIDOverflow, }, - lo.PanicOnErr(iotago.NewOutputIDProof(tpkg.TestAPI, tpkg.Rand32ByteArray(), tpkg.RandSlot(), iotago.TxEssenceOutputs{tpkg.RandBasicOutput(iotago.AddressEd25519)}, 0)), + lo.PanicOnErr(iotago.NewOutputIDProof(tpkg.ZeroCostTestAPI, tpkg.Rand32ByteArray(), tpkg.RandSlot(), iotago.TxEssenceOutputs{tpkg.RandBasicOutput(iotago.AddressEd25519)}, 0)), ), nil case accountIDRecentOutput: return utxoledger.CreateOutput( - iotago.SingleVersionProvider(tpkg.TestAPI), + iotago.SingleVersionProvider(tpkg.ZeroCostTestAPI), iotago.OutputIDFromTransactionIDAndIndex(iotago.NewTransactionID(1, tpkg.Rand32ByteArray()), 0), tpkg.RandBlockID(), tpkg.RandSlot(), @@ -46,11 +46,11 @@ func TestManager_GetManaOnAccountOverflow(t *testing.T) { Mana: iotago.MaxMana / 2, AccountID: id, }, - lo.PanicOnErr(iotago.NewOutputIDProof(tpkg.TestAPI, tpkg.Rand32ByteArray(), tpkg.RandSlot(), iotago.TxEssenceOutputs{tpkg.RandBasicOutput(iotago.AddressEd25519)}, 0)), + lo.PanicOnErr(iotago.NewOutputIDProof(tpkg.ZeroCostTestAPI, tpkg.Rand32ByteArray(), tpkg.RandSlot(), iotago.TxEssenceOutputs{tpkg.RandBasicOutput(iotago.AddressEd25519)}, 0)), ), nil default: return utxoledger.CreateOutput( - iotago.SingleVersionProvider(tpkg.TestAPI), + iotago.SingleVersionProvider(tpkg.ZeroCostTestAPI), iotago.OutputIDFromTransactionIDAndIndex(iotago.NewTransactionID(0, tpkg.Rand32ByteArray()), 0), tpkg.RandBlockID(), tpkg.RandSlot(), @@ -59,7 +59,7 @@ func TestManager_GetManaOnAccountOverflow(t *testing.T) { Mana: iotago.MaxMana / 2, AccountID: id, }, - lo.PanicOnErr(iotago.NewOutputIDProof(tpkg.TestAPI, tpkg.Rand32ByteArray(), tpkg.RandSlot(), iotago.TxEssenceOutputs{tpkg.RandBasicOutput(iotago.AddressEd25519)}, 0)), + lo.PanicOnErr(iotago.NewOutputIDProof(tpkg.ZeroCostTestAPI, tpkg.Rand32ByteArray(), tpkg.RandSlot(), iotago.TxEssenceOutputs{tpkg.RandBasicOutput(iotago.AddressEd25519)}, 0)), ), nil } } @@ -100,7 +100,7 @@ func TestManager_GetManaOnAccountOverflow(t *testing.T) { } } - manager := NewManager(iotago.SingleVersionProvider(tpkg.TestAPI), outputRetriever, accountRetriever) + manager := NewManager(iotago.SingleVersionProvider(tpkg.ZeroCostTestAPI), outputRetriever, accountRetriever) manaDecayProvider := manager.apiProvider.LatestAPI().ManaDecayProvider() // The value for this account will overflow because component values are too big. diff --git a/pkg/protocol/engine/attestation/slotattestation/testframework_test.go b/pkg/protocol/engine/attestation/slotattestation/testframework_test.go index ed0cef175..624158d66 100644 --- a/pkg/protocol/engine/attestation/slotattestation/testframework_test.go +++ b/pkg/protocol/engine/attestation/slotattestation/testframework_test.go @@ -69,13 +69,7 @@ func NewTestFramework(test *testing.T) *TestFramework { return accounts.SelectCommittee(members...), true } - t.testAPI = iotago.V3API( - iotago.NewV3ProtocolParameters( - iotago.WithNetworkOptions("TestJungle", "tgl"), - iotago.WithSupplyOptions(10000, 0, 0, 0, 0, 0, 0), - iotago.WithLivenessOptions(10, 10, 1, 2, 8), - ), - ) + t.testAPI = iotago.V3API(iotago.NewV3TestProtocolParameters()) t.apiProvider = iotago.SingleVersionProvider(t.testAPI) diff --git a/pkg/protocol/engine/consensus/blockgadget/testframework_test.go b/pkg/protocol/engine/consensus/blockgadget/testframework_test.go index aaea4179f..486b4a8c9 100644 --- a/pkg/protocol/engine/consensus/blockgadget/testframework_test.go +++ b/pkg/protocol/engine/consensus/blockgadget/testframework_test.go @@ -42,7 +42,7 @@ func NewTestFramework(test *testing.T) *TestFramework { T: test, blocks: shrinkingmap.New[string, *blocks.Block](), - SeatManager: mock.NewManualPOA(iotago.SingleVersionProvider(tpkg.TestAPI), epochstore.NewStore(kvstore.Realm{}, mapdb.NewMapDB(), 0, (*account.Accounts).Bytes, account.AccountsFromBytes)), + SeatManager: mock.NewManualPOA(iotago.SingleVersionProvider(tpkg.ZeroCostTestAPI), epochstore.NewStore(kvstore.Realm{}, mapdb.NewMapDB(), 0, (*account.Accounts).Bytes, account.AccountsFromBytes)), } evictionState := eviction.NewState(mapdb.NewMapDB(), func(slot iotago.SlotIndex) (*slotstore.Store[iotago.BlockID, iotago.CommitmentID], error) { @@ -53,10 +53,10 @@ func NewTestFramework(test *testing.T) *TestFramework { iotago.CommitmentIDFromBytes, ), nil }, func() iotago.BlockID { - return tpkg.TestAPI.ProtocolParameters().GenesisBlockID() + return tpkg.ZeroCostTestAPI.ProtocolParameters().GenesisBlockID() }) - t.blockCache = blocks.New(evictionState, iotago.SingleVersionProvider(tpkg.TestAPI)) + t.blockCache = blocks.New(evictionState, iotago.SingleVersionProvider(tpkg.ZeroCostTestAPI)) instance := thresholdblockgadget.New(t.blockCache, t.SeatManager, func(err error) { fmt.Printf(">> Gadget.Error: %s\n", err) }) @@ -64,7 +64,7 @@ func NewTestFramework(test *testing.T) *TestFramework { t.Events = instance.Events() t.Instance = instance - genesisBlock := blocks.NewRootBlock(tpkg.TestAPI.ProtocolParameters().GenesisBlockID(), iotago.NewEmptyCommitment(tpkg.TestAPI).MustID(), time.Unix(tpkg.TestAPI.TimeProvider().GenesisUnixTime(), 0)) + genesisBlock := blocks.NewRootBlock(tpkg.ZeroCostTestAPI.ProtocolParameters().GenesisBlockID(), iotago.NewEmptyCommitment(tpkg.ZeroCostTestAPI).MustID(), time.Unix(tpkg.ZeroCostTestAPI.TimeProvider().GenesisUnixTime(), 0)) t.blocks.Set("Genesis", genesisBlock) genesisBlock.ID().RegisterAlias("Genesis") evictionState.AddRootBlock(genesisBlock.ID(), genesisBlock.SlotCommitmentID()) @@ -106,7 +106,7 @@ func (t *TestFramework) CreateBlock(alias string, issuerAlias string, parents .. _, priv, err := ed25519.GenerateKey(nil) require.NoError(t, err) - block, err := builder.NewValidationBlockBuilder(tpkg.TestAPI). + block, err := builder.NewValidationBlockBuilder(tpkg.ZeroCostTestAPI). StrongParents(t.BlockIDs(parents...)). Sign(t.SeatManager.AccountID(issuerAlias), priv). IssuingTime(time.Now()). diff --git a/pkg/protocol/engine/eviction/state_test.go b/pkg/protocol/engine/eviction/state_test.go index 5d77aa992..515dae6da 100644 --- a/pkg/protocol/engine/eviction/state_test.go +++ b/pkg/protocol/engine/eviction/state_test.go @@ -19,24 +19,24 @@ func TestState_RootBlocks(t *testing.T) { prunableStorage := prunable.New(database.Config{ Engine: hivedb.EngineMapDB, Directory: t.TempDir(), - }, iotago.SingleVersionProvider(tpkg.TestAPI), errorHandler) + }, iotago.SingleVersionProvider(tpkg.ZeroCostTestAPI), errorHandler) ts := NewTestFramework(t, prunableStorage, eviction.NewState(mapdb.NewMapDB(), prunableStorage.RootBlocks, func() iotago.BlockID { - return tpkg.TestAPI.ProtocolParameters().GenesisBlockID() + return tpkg.ZeroCostTestAPI.ProtocolParameters().GenesisBlockID() }, eviction.WithRootBlocksEvictionDelay(3))) - ts.CreateAndAddRootBlock("Genesis", 0, iotago.NewEmptyCommitment(tpkg.TestAPI).MustID()) + ts.CreateAndAddRootBlock("Genesis", 0, iotago.NewEmptyCommitment(tpkg.ZeroCostTestAPI).MustID()) ts.RequireActiveRootBlocks("Genesis") ts.RequireLastEvictedSlot(0) ts.Instance.Initialize(0) - ts.CreateAndAddRootBlock("Root1.0", 1, iotago.NewEmptyCommitment(tpkg.TestAPI).MustID()) - ts.CreateAndAddRootBlock("Root1.1", 1, iotago.NewEmptyCommitment(tpkg.TestAPI).MustID()) - ts.CreateAndAddRootBlock("Root2.0", 2, iotago.NewEmptyCommitment(tpkg.TestAPI).MustID()) - ts.CreateAndAddRootBlock("Root3.0", 3, iotago.NewEmptyCommitment(tpkg.TestAPI).MustID()) - ts.CreateAndAddRootBlock("Root4.0", 4, iotago.NewEmptyCommitment(tpkg.TestAPI).MustID()) - ts.CreateAndAddRootBlock("Root4.1", 4, iotago.NewEmptyCommitment(tpkg.TestAPI).MustID()) - ts.CreateAndAddRootBlock("Root5.0", 5, iotago.NewEmptyCommitment(tpkg.TestAPI).MustID()) + ts.CreateAndAddRootBlock("Root1.0", 1, iotago.NewEmptyCommitment(tpkg.ZeroCostTestAPI).MustID()) + ts.CreateAndAddRootBlock("Root1.1", 1, iotago.NewEmptyCommitment(tpkg.ZeroCostTestAPI).MustID()) + ts.CreateAndAddRootBlock("Root2.0", 2, iotago.NewEmptyCommitment(tpkg.ZeroCostTestAPI).MustID()) + ts.CreateAndAddRootBlock("Root3.0", 3, iotago.NewEmptyCommitment(tpkg.ZeroCostTestAPI).MustID()) + ts.CreateAndAddRootBlock("Root4.0", 4, iotago.NewEmptyCommitment(tpkg.ZeroCostTestAPI).MustID()) + ts.CreateAndAddRootBlock("Root4.1", 4, iotago.NewEmptyCommitment(tpkg.ZeroCostTestAPI).MustID()) + ts.CreateAndAddRootBlock("Root5.0", 5, iotago.NewEmptyCommitment(tpkg.ZeroCostTestAPI).MustID()) ts.RequireActiveRootBlocks("Genesis") ts.RequireLastEvictedSlot(0) diff --git a/pkg/protocol/engine/filter/postsolidfilter/postsolidblockfilter/post_solid_block_filter_test.go b/pkg/protocol/engine/filter/postsolidfilter/postsolidblockfilter/post_solid_block_filter_test.go index e996b2990..10fff4fc3 100644 --- a/pkg/protocol/engine/filter/postsolidfilter/postsolidblockfilter/post_solid_block_filter_test.go +++ b/pkg/protocol/engine/filter/postsolidfilter/postsolidblockfilter/post_solid_block_filter_test.go @@ -117,7 +117,7 @@ func (t *TestFramework) IssueSignedBlockAtSlotWithBurnedMana(alias string, slot } func TestPostSolidFilter_NoAccount(t *testing.T) { - testAPI := tpkg.TestAPI + testAPI := tpkg.ZeroCostTestAPI tf := NewTestFramework(t, iotago.SingleVersionProvider(testAPI), @@ -179,7 +179,7 @@ func TestPostSolidFilter_NoAccount(t *testing.T) { } func TestPostSolidFilter_BurnedMana(t *testing.T) { - testAPI := tpkg.TestAPI + testAPI := tpkg.ZeroCostTestAPI tf := NewTestFramework(t, iotago.SingleVersionProvider(testAPI), @@ -227,7 +227,7 @@ func TestPostSolidFilter_BurnedMana(t *testing.T) { } func TestPostSolidFilter_Expiry(t *testing.T) { - testAPI := tpkg.TestAPI + testAPI := tpkg.ZeroCostTestAPI tf := NewTestFramework(t, iotago.SingleVersionProvider(testAPI), diff --git a/pkg/protocol/engine/filter/presolidfilter/presolidblockfilter/pre_solid_block_filter_test.go b/pkg/protocol/engine/filter/presolidfilter/presolidblockfilter/pre_solid_block_filter_test.go index df0809625..8496ac6d6 100644 --- a/pkg/protocol/engine/filter/presolidfilter/presolidblockfilter/pre_solid_block_filter_test.go +++ b/pkg/protocol/engine/filter/presolidfilter/presolidblockfilter/pre_solid_block_filter_test.go @@ -111,7 +111,7 @@ func mockedCommitteeFunc(validatorAccountID iotago.AccountID) func(iotago.SlotIn func TestFilter_WithMaxAllowedWallClockDrift(t *testing.T) { allowedDrift := 3 * time.Second - testAPI := tpkg.TestAPI + testAPI := tpkg.ZeroCostTestAPI tf := NewTestFramework(t, iotago.SingleVersionProvider(testAPI), @@ -137,12 +137,12 @@ func TestFilter_ProtocolVersion(t *testing.T) { apiProvider := iotago.NewEpochBasedProvider( iotago.WithAPIForMissingVersionCallback( func(params iotago.ProtocolParameters) (iotago.API, error) { - return iotago.V3API(iotago.NewV3ProtocolParameters(iotago.WithVersion(params.Version()))), nil + return iotago.V3API(iotago.NewV3TestProtocolParameters(iotago.WithVersion(params.Version()))), nil }, ), ) - apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3ProtocolParameters(iotago.WithVersion(3)), 0) - apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3ProtocolParameters(iotago.WithVersion(4)), 3) + apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3TestProtocolParameters(iotago.WithVersion(3)), 0) + apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3TestProtocolParameters(iotago.WithVersion(4)), 3) timeProvider := apiProvider.CommittedAPI().TimeProvider() @@ -187,7 +187,7 @@ func TestFilter_ProtocolVersion(t *testing.T) { valid.Add("G") require.NoError(t, tf.IssueBlockAtSlotWithVersion("G", timeProvider.EpochStart(5)+5, 4, apiProvider)) - apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3ProtocolParameters(iotago.WithVersion(5)), 10) + apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3TestProtocolParameters(iotago.WithVersion(5)), 10) valid.Add("H") require.NoError(t, tf.IssueBlockAtSlotWithVersion("H", timeProvider.EpochEnd(9), 4, apiProvider)) @@ -200,7 +200,7 @@ func TestFilter_ProtocolVersion(t *testing.T) { } func TestFilter_ValidationBlocks(t *testing.T) { - testAPI := tpkg.TestAPI + testAPI := tpkg.ZeroCostTestAPI tf := NewTestFramework(t, iotago.SingleVersionProvider(testAPI), diff --git a/pkg/protocol/engine/mempool/v1/mempool_test.go b/pkg/protocol/engine/mempool/v1/mempool_test.go index 13c786fee..606e02efd 100644 --- a/pkg/protocol/engine/mempool/v1/mempool_test.go +++ b/pkg/protocol/engine/mempool/v1/mempool_test.go @@ -39,7 +39,7 @@ func TestMempoolV1_ResourceCleanup(t *testing.T) { spendDAG := spenddagv1.New[iotago.TransactionID, mempool.StateID, vote.MockedRank](func() int { return 0 }) memPoolInstance := New[vote.MockedRank](new(mempooltests.VM), func(reference mempool.StateReference) *promise.Promise[mempool.State] { return ledgerState.ResolveOutputState(reference) - }, mutationsFunc, workers, spendDAG, iotago.SingleVersionProvider(tpkg.TestAPI), func(error) {}) + }, mutationsFunc, workers, spendDAG, iotago.SingleVersionProvider(tpkg.ZeroCostTestAPI), func(error) {}) tf := mempooltests.NewTestFramework(t, memPoolInstance, spendDAG, ledgerState, workers) @@ -149,5 +149,5 @@ func newTestFramework(t *testing.T) *mempooltests.TestFramework { return mempooltests.NewTestFramework(t, New[vote.MockedRank](new(mempooltests.VM), func(reference mempool.StateReference) *promise.Promise[mempool.State] { return ledgerState.ResolveOutputState(reference) - }, mutationsFunc, workers, spendDAG, iotago.SingleVersionProvider(tpkg.TestAPI), func(error) {}), spendDAG, ledgerState, workers) + }, mutationsFunc, workers, spendDAG, iotago.SingleVersionProvider(tpkg.ZeroCostTestAPI), func(error) {}), spendDAG, ledgerState, workers) } diff --git a/pkg/protocol/engine/tipmanager/tests/testframework.go b/pkg/protocol/engine/tipmanager/tests/testframework.go index 7b67a1524..781dc41b9 100644 --- a/pkg/protocol/engine/tipmanager/tests/testframework.go +++ b/pkg/protocol/engine/tipmanager/tests/testframework.go @@ -34,7 +34,7 @@ func NewTestFramework(test *testing.T) *TestFramework { tipMetadataByAlias: make(map[string]tipmanager.TipMetadata), blocksByID: make(map[iotago.BlockID]*blocks.Block), test: test, - API: tpkg.TestAPI, + API: tpkg.ZeroCostTestAPI, } t.blockIDsByAlias["Genesis"] = iotago.EmptyBlockID diff --git a/pkg/protocol/engine/utxoledger/iteration_test.go b/pkg/protocol/engine/utxoledger/iteration_test.go index 12a3ab370..b2243e2d6 100644 --- a/pkg/protocol/engine/utxoledger/iteration_test.go +++ b/pkg/protocol/engine/utxoledger/iteration_test.go @@ -14,7 +14,7 @@ import ( ) func TestUTXOComputeBalance(t *testing.T) { - manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) initialOutput := tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputBasic, iotago_tpkg.RandAddress(iotago.AddressEd25519), 2_134_656_365) require.NoError(t, manager.AddGenesisUnspentOutput(initialOutput)) @@ -51,7 +51,7 @@ func TestUTXOComputeBalance(t *testing.T) { } func TestUTXOIteration(t *testing.T) { - manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) outputs := utxoledger.Outputs{ tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, iotago_tpkg.RandAddress(iotago.AddressEd25519)), diff --git a/pkg/protocol/engine/utxoledger/manager_test.go b/pkg/protocol/engine/utxoledger/manager_test.go index 1e046fc27..0f2f179d3 100644 --- a/pkg/protocol/engine/utxoledger/manager_test.go +++ b/pkg/protocol/engine/utxoledger/manager_test.go @@ -14,7 +14,7 @@ import ( ) func TestConfirmationApplyAndRollbackToEmptyLedger(t *testing.T) { - manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) outputs := utxoledger.Outputs{ tpkg.RandLedgerStateOutputWithType(iotago.OutputBasic), @@ -88,7 +88,7 @@ func TestConfirmationApplyAndRollbackToEmptyLedger(t *testing.T) { } func TestConfirmationApplyAndRollbackToPreviousLedger(t *testing.T) { - manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) previousOutputs := utxoledger.Outputs{ tpkg.RandLedgerStateOutputWithType(iotago.OutputBasic), diff --git a/pkg/protocol/engine/utxoledger/output_test.go b/pkg/protocol/engine/utxoledger/output_test.go index 65968b7b5..c9ce53097 100644 --- a/pkg/protocol/engine/utxoledger/output_test.go +++ b/pkg/protocol/engine/utxoledger/output_test.go @@ -21,7 +21,7 @@ import ( func AssertOutputUnspentAndSpentTransitions(t *testing.T, output *utxoledger.Output, spent *utxoledger.Spent) { outputID := output.OutputID() - manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.NoError(t, manager.AddGenesisUnspentOutput(output)) @@ -80,7 +80,7 @@ func CreateOutputAndAssertSerialization(t *testing.T, blockID iotago.BlockID, in outputID, err := outputProof.OutputID(iotaOutput) require.NoError(t, err) - iotagoAPI := iotago_tpkg.TestAPI + iotagoAPI := iotago_tpkg.ZeroCostTestAPI output := utxoledger.CreateOutput(iotago.SingleVersionProvider(iotagoAPI), outputID, blockID, indexBooked, iotaOutput, outputProof) outputBytes, err := iotagoAPI.Encode(output.Output()) require.NoError(t, err) @@ -152,7 +152,7 @@ func TestBasicOutputOnEd25519WithoutSpendConstraintsSerialization(t *testing.T) }, } - outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.TestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) + outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.ZeroCostTestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) require.NoError(t, err) output := CreateOutputAndAssertSerialization(t, blockID, index, iotaOutput, outputProof) @@ -190,7 +190,7 @@ func TestBasicOutputOnEd25519WithSpendConstraintsSerialization(t *testing.T) { }, } - outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.TestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) + outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.ZeroCostTestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) require.NoError(t, err) output := CreateOutputAndAssertSerialization(t, blockID, index, iotaOutput, outputProof) @@ -229,7 +229,7 @@ func TestNFTOutputSerialization(t *testing.T) { }, } - outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.TestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) + outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.ZeroCostTestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) require.NoError(t, err) output := CreateOutputAndAssertSerialization(t, blockID, index, iotaOutput, outputProof) @@ -276,7 +276,7 @@ func TestNFTOutputWithSpendConstraintsSerialization(t *testing.T) { }, } - outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.TestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) + outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.ZeroCostTestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) require.NoError(t, err) output := CreateOutputAndAssertSerialization(t, blockID, index, iotaOutput, outputProof) @@ -318,7 +318,7 @@ func TestAccountOutputSerialization(t *testing.T) { }, } - outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.TestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) + outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.ZeroCostTestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) require.NoError(t, err) output := CreateOutputAndAssertSerialization(t, blockID, index, iotaOutput, outputProof) @@ -364,7 +364,7 @@ func TestAnchorOutputSerialization(t *testing.T) { }, } - outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.TestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) + outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.ZeroCostTestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) require.NoError(t, err) output := CreateOutputAndAssertSerialization(t, blockID, index, iotaOutput, outputProof) @@ -401,7 +401,7 @@ func TestFoundryOutputSerialization(t *testing.T) { ImmutableFeatures: iotago.FoundryOutputImmFeatures{}, } - outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.TestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) + outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.ZeroCostTestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) require.NoError(t, err) output := CreateOutputAndAssertSerialization(t, blockID, index, iotaOutput, outputProof) @@ -433,7 +433,7 @@ func TestDelegationOutputSerialization(t *testing.T) { }, } - outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.TestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) + outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.ZeroCostTestAPI, txCommitment, txCreationSlot, iotago.TxEssenceOutputs{iotaOutput}, 0) require.NoError(t, err) output := CreateOutputAndAssertSerialization(t, blockID, index, iotaOutput, outputProof) diff --git a/pkg/protocol/engine/utxoledger/slot_diff_test.go b/pkg/protocol/engine/utxoledger/slot_diff_test.go index e39a3b510..ad8982831 100644 --- a/pkg/protocol/engine/utxoledger/slot_diff_test.go +++ b/pkg/protocol/engine/utxoledger/slot_diff_test.go @@ -35,10 +35,10 @@ func TestSimpleSlotDiffSerialization(t *testing.T) { Features: iotago.BasicOutputFeatures{}, } - outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.TestAPI, txID.Identifier(), txID.Slot(), iotago.TxEssenceOutputs{iotaOutput}, 0) + outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.ZeroCostTestAPI, txID.Identifier(), txID.Slot(), iotago.TxEssenceOutputs{iotaOutput}, 0) require.NoError(t, err) - output := utxoledger.CreateOutput(iotago.SingleVersionProvider(iotago_tpkg.TestAPI), outputID, blockID, indexBooked, iotaOutput, outputProof) + output := utxoledger.CreateOutput(iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI), outputID, blockID, indexBooked, iotaOutput, outputProof) transactionIDSpent := iotago_tpkg.RandTransactionID() @@ -63,7 +63,7 @@ func TestSimpleSlotDiffSerialization(t *testing.T) { } func TestSlotDiffSerialization(t *testing.T) { - manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) outputs := utxoledger.Outputs{ tpkg.RandLedgerStateOutputWithType(iotago.OutputBasic), diff --git a/pkg/protocol/engine/utxoledger/snapshot_test.go b/pkg/protocol/engine/utxoledger/snapshot_test.go index ba1c5dd38..1e220077d 100644 --- a/pkg/protocol/engine/utxoledger/snapshot_test.go +++ b/pkg/protocol/engine/utxoledger/snapshot_test.go @@ -23,16 +23,16 @@ func TestOutput_SnapshotBytes(t *testing.T) { txID := iotago_tpkg.RandTransactionID() slotBooked := iotago_tpkg.RandSlot() iotaOutput := iotago_tpkg.RandOutput(iotago.OutputBasic) - iotaOutputBytes, err := iotago_tpkg.TestAPI.Encode(iotaOutput) + iotaOutputBytes, err := iotago_tpkg.ZeroCostTestAPI.Encode(iotaOutput) require.NoError(t, err) - proof, err := iotago.NewOutputIDProof(iotago_tpkg.TestAPI, txID.Identifier(), txID.Slot(), iotago.TxEssenceOutputs{iotaOutput}, 0) + proof, err := iotago.NewOutputIDProof(iotago_tpkg.ZeroCostTestAPI, txID.Identifier(), txID.Slot(), iotago.TxEssenceOutputs{iotaOutput}, 0) require.NoError(t, err) proofBytes, err := proof.Bytes() require.NoError(t, err) - output := utxoledger.NewOutput(iotago.SingleVersionProvider(iotago_tpkg.TestAPI), outputID, blockID, slotBooked, iotaOutput, iotaOutputBytes, proof, proofBytes) + output := utxoledger.NewOutput(iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI), outputID, blockID, slotBooked, iotaOutput, iotaOutputBytes, proof, proofBytes) snapshotBytes := output.SnapshotBytes() @@ -58,19 +58,19 @@ func TestOutputFromSnapshotReader(t *testing.T) { blockID := iotago_tpkg.RandBlockID() slotBooked := iotago_tpkg.RandSlot() iotaOutput := iotago_tpkg.RandOutput(iotago.OutputBasic) - iotaOutputBytes, err := iotago_tpkg.TestAPI.Encode(iotaOutput) + iotaOutputBytes, err := iotago_tpkg.ZeroCostTestAPI.Encode(iotaOutput) require.NoError(t, err) - outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.TestAPI, txID.Identifier(), txID.Slot(), iotago.TxEssenceOutputs{iotaOutput}, 0) + outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.ZeroCostTestAPI, txID.Identifier(), txID.Slot(), iotago.TxEssenceOutputs{iotaOutput}, 0) require.NoError(t, err) outputProofBytes, err := outputProof.Bytes() require.NoError(t, err) - output := utxoledger.NewOutput(iotago.SingleVersionProvider(iotago_tpkg.TestAPI), outputID, blockID, slotBooked, iotaOutput, iotaOutputBytes, outputProof, outputProofBytes) + output := utxoledger.NewOutput(iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI), outputID, blockID, slotBooked, iotaOutput, iotaOutputBytes, outputProof, outputProofBytes) snapshotBytes := output.SnapshotBytes() buf := bytes.NewReader(snapshotBytes) - readOutput, err := utxoledger.OutputFromSnapshotReader(buf, iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + readOutput, err := utxoledger.OutputFromSnapshotReader(buf, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.NoError(t, err) require.Equal(t, output, readOutput) @@ -82,15 +82,15 @@ func TestSpent_SnapshotBytes(t *testing.T) { blockID := iotago_tpkg.RandBlockID() slotBooked := iotago_tpkg.RandSlot() iotaOutput := iotago_tpkg.RandOutput(iotago.OutputBasic) - iotaOutputBytes, err := iotago_tpkg.TestAPI.Encode(iotaOutput) + iotaOutputBytes, err := iotago_tpkg.ZeroCostTestAPI.Encode(iotaOutput) require.NoError(t, err) - outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.TestAPI, txID.Identifier(), txID.Slot(), iotago.TxEssenceOutputs{iotaOutput}, 0) + outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.ZeroCostTestAPI, txID.Identifier(), txID.Slot(), iotago.TxEssenceOutputs{iotaOutput}, 0) require.NoError(t, err) outputProofBytes, err := outputProof.Bytes() require.NoError(t, err) - output := utxoledger.NewOutput(iotago.SingleVersionProvider(iotago_tpkg.TestAPI), outputID, blockID, slotBooked, iotaOutput, iotaOutputBytes, outputProof, outputProofBytes) + output := utxoledger.NewOutput(iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI), outputID, blockID, slotBooked, iotaOutput, iotaOutputBytes, outputProof, outputProofBytes) outputSnapshotBytes := output.SnapshotBytes() transactionID := iotago_tpkg.RandTransactionID() @@ -111,15 +111,15 @@ func TestSpentFromSnapshotReader(t *testing.T) { blockID := iotago_tpkg.RandBlockID() slotBooked := iotago_tpkg.RandSlot() iotaOutput := iotago_tpkg.RandOutput(iotago.OutputBasic) - iotaOutputBytes, err := iotago_tpkg.TestAPI.Encode(iotaOutput) + iotaOutputBytes, err := iotago_tpkg.ZeroCostTestAPI.Encode(iotaOutput) require.NoError(t, err) - outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.TestAPI, txID.Identifier(), txID.Slot(), iotago.TxEssenceOutputs{iotaOutput}, 0) + outputProof, err := iotago.NewOutputIDProof(iotago_tpkg.ZeroCostTestAPI, txID.Identifier(), txID.Slot(), iotago.TxEssenceOutputs{iotaOutput}, 0) require.NoError(t, err) outputProofBytes, err := outputProof.Bytes() require.NoError(t, err) - output := utxoledger.NewOutput(iotago.SingleVersionProvider(iotago_tpkg.TestAPI), outputID, blockID, slotBooked, iotaOutput, iotaOutputBytes, outputProof, outputProofBytes) + output := utxoledger.NewOutput(iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI), outputID, blockID, slotBooked, iotaOutput, iotaOutputBytes, outputProof, outputProofBytes) transactionID := iotago_tpkg.RandTransactionID() slotSpent := iotago_tpkg.RandSlot() @@ -128,7 +128,7 @@ func TestSpentFromSnapshotReader(t *testing.T) { snapshotBytes := spent.SnapshotBytes() buf := bytes.NewReader(snapshotBytes) - readSpent, err := utxoledger.SpentFromSnapshotReader(buf, iotago.SingleVersionProvider(iotago_tpkg.TestAPI), slotSpent) + readSpent, err := utxoledger.SpentFromSnapshotReader(buf, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI), slotSpent) require.NoError(t, err) require.Equal(t, spent, readSpent) @@ -154,7 +154,7 @@ func TestReadSlotDiffToSnapshotReader(t *testing.T) { require.NoError(t, err) reader := writer.Reader() - readSlotDiff, err := utxoledger.ReadSlotDiffToSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + readSlotDiff, err := utxoledger.ReadSlotDiffToSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.NoError(t, err) require.Equal(t, slotDiff.Slot, readSlotDiff.Slot) @@ -193,7 +193,7 @@ func TestWriteSlotDiffToSnapshotWriter(t *testing.T) { var snapshotOutputs utxoledger.Outputs for i := 0; i < len(slotDiff.Outputs); i++ { - readOutput, err := utxoledger.OutputFromSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + readOutput, err := utxoledger.OutputFromSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.NoError(t, err) snapshotOutputs = append(snapshotOutputs, readOutput) } @@ -206,7 +206,7 @@ func TestWriteSlotDiffToSnapshotWriter(t *testing.T) { var snapshotSpents utxoledger.Spents for i := 0; i < len(slotDiff.Spents); i++ { - readSpent, err := utxoledger.SpentFromSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.TestAPI), readSlot) + readSpent, err := utxoledger.SpentFromSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI), readSlot) require.NoError(t, err) snapshotSpents = append(snapshotSpents, readSpent) } @@ -216,7 +216,7 @@ func TestWriteSlotDiffToSnapshotWriter(t *testing.T) { func TestManager_Import(t *testing.T) { mapDB := mapdb.NewMapDB() - manager := utxoledger.New(mapDB, iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + manager := utxoledger.New(mapDB, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) output1 := tpkg.RandLedgerStateOutput() @@ -270,7 +270,7 @@ func TestManager_Import(t *testing.T) { reader := writer.Reader() - importedSlot2 := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + importedSlot2 := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.NoError(t, importedSlot2.Import(reader)) require.Equal(t, iotago.SlotIndex(2), lo.PanicOnErr(importedSlot2.ReadLedgerSlot())) @@ -284,10 +284,10 @@ func TestManager_Import(t *testing.T) { reader := writer.Reader() - importedSlot1 := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + importedSlot1 := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.NoError(t, importedSlot1.Import(reader)) - managerAtSlot1 := utxoledger.New(mapDBAtSlot1, iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + managerAtSlot1 := utxoledger.New(mapDBAtSlot1, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.Equal(t, iotago.SlotIndex(1), lo.PanicOnErr(importedSlot1.ReadLedgerSlot())) require.Equal(t, iotago.SlotIndex(1), lo.PanicOnErr(managerAtSlot1.ReadLedgerSlot())) @@ -301,10 +301,10 @@ func TestManager_Import(t *testing.T) { reader := writer.Reader() - importedSlot0 := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + importedSlot0 := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.NoError(t, importedSlot0.Import(reader)) - managerAtSlot0 := utxoledger.New(mapDBAtSlot0, iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + managerAtSlot0 := utxoledger.New(mapDBAtSlot0, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.Equal(t, iotago.SlotIndex(0), lo.PanicOnErr(importedSlot0.ReadLedgerSlot())) require.Equal(t, iotago.SlotIndex(0), lo.PanicOnErr(managerAtSlot0.ReadLedgerSlot())) @@ -314,7 +314,7 @@ func TestManager_Import(t *testing.T) { func TestManager_Export(t *testing.T) { mapDB := mapdb.NewMapDB() - manager := utxoledger.New(mapDB, iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + manager := utxoledger.New(mapDB, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) output1 := tpkg.RandLedgerStateOutput() @@ -367,7 +367,7 @@ func TestManager_Export(t *testing.T) { var snapshotOutputs utxoledger.Outputs for i := uint64(0); i < outputCount; i++ { - output, err := utxoledger.OutputFromSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + output, err := utxoledger.OutputFromSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.NoError(t, err) snapshotOutputs = append(snapshotOutputs, output) } @@ -400,7 +400,7 @@ func TestManager_Export(t *testing.T) { var snapshotOutputs utxoledger.Outputs for i := uint64(0); i < outputCount; i++ { - output, err := utxoledger.OutputFromSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + output, err := utxoledger.OutputFromSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.NoError(t, err) snapshotOutputs = append(snapshotOutputs, output) } @@ -415,7 +415,7 @@ func TestManager_Export(t *testing.T) { require.Equal(t, uint32(1), slotDiffCount) for i := uint32(0); i < slotDiffCount; i++ { - diff, err := utxoledger.ReadSlotDiffToSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + diff, err := utxoledger.ReadSlotDiffToSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.NoError(t, err) require.Equal(t, snapshotLedgerSlot-iotago.SlotIndex(i), diff.Slot) } @@ -438,7 +438,7 @@ func TestManager_Export(t *testing.T) { var snapshotOutputs utxoledger.Outputs for i := uint64(0); i < outputCount; i++ { - output, err := utxoledger.OutputFromSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + output, err := utxoledger.OutputFromSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.NoError(t, err) snapshotOutputs = append(snapshotOutputs, output) } @@ -453,7 +453,7 @@ func TestManager_Export(t *testing.T) { require.Equal(t, uint32(2), slotDiffCount) for i := uint32(0); i < slotDiffCount; i++ { - diff, err := utxoledger.ReadSlotDiffToSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.TestAPI)) + diff, err := utxoledger.ReadSlotDiffToSnapshotReader(reader, iotago.SingleVersionProvider(iotago_tpkg.ZeroCostTestAPI)) require.NoError(t, err) require.Equal(t, snapshotLedgerSlot-iotago.SlotIndex(i), diff.Slot) } diff --git a/pkg/protocol/engine/utxoledger/tpkg/random.go b/pkg/protocol/engine/utxoledger/tpkg/random.go index 627516475..20804f477 100644 --- a/pkg/protocol/engine/utxoledger/tpkg/random.go +++ b/pkg/protocol/engine/utxoledger/tpkg/random.go @@ -14,9 +14,9 @@ func RandLedgerStateOutput() *utxoledger.Output { func RandLedgerStateOutputWithOutput(output iotago.Output) *utxoledger.Output { outputs := iotago.TxEssenceOutputs{output} txID := tpkg.RandTransactionID() - proof := lo.PanicOnErr(iotago.NewOutputIDProof(tpkg.TestAPI, txID.Identifier(), txID.Slot(), outputs, 0)) + proof := lo.PanicOnErr(iotago.NewOutputIDProof(tpkg.ZeroCostTestAPI, txID.Identifier(), txID.Slot(), outputs, 0)) - return utxoledger.CreateOutput(iotago.SingleVersionProvider(tpkg.TestAPI), tpkg.RandOutputID(), tpkg.RandBlockID(), tpkg.RandSlot(), outputs[0], proof) + return utxoledger.CreateOutput(iotago.SingleVersionProvider(tpkg.ZeroCostTestAPI), tpkg.RandOutputID(), tpkg.RandBlockID(), tpkg.RandSlot(), outputs[0], proof) } func RandLedgerStateOutputWithType(outputType iotago.OutputType) *utxoledger.Output { diff --git a/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go b/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go index 53a49290a..317a1e824 100644 --- a/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go +++ b/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go @@ -22,8 +22,7 @@ import ( func TestTopStakers_InitializeCommittee(t *testing.T) { var testAPI = iotago.V3API( - iotago.NewV3ProtocolParameters( - iotago.WithNetworkOptions("TestJungle", "tgl"), + iotago.NewV3TestProtocolParameters( iotago.WithSupplyOptions(2_779_530_283_277_761, 0, 0, 0, 0, 0, 0), iotago.WithWorkScoreOptions(0, 1, 0, 0, 0, 0, 0, 0, 0, 0), // all zero except block offset gives all blocks workscore = 1 iotago.WithTargetCommitteeSize(3), @@ -76,8 +75,7 @@ func TestTopStakers_InitializeCommittee(t *testing.T) { func TestTopStakers_RotateCommittee(t *testing.T) { var testAPI = iotago.V3API( - iotago.NewV3ProtocolParameters( - iotago.WithNetworkOptions("TestJungle", "tgl"), + iotago.NewV3TestProtocolParameters( iotago.WithSupplyOptions(2_779_530_283_277_761, 0, 0, 0, 0, 0, 0), iotago.WithWorkScoreOptions(0, 1, 0, 0, 0, 0, 0, 0, 0, 0), // all zero except block offset gives all blocks workscore = 1 iotago.WithTargetCommitteeSize(10), diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go index c79086778..41d10103a 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go @@ -40,9 +40,9 @@ func NewTestSuite(t *testing.T) *TestSuite { poolRewards: make(map[iotago.EpochIndex]map[string]*model.PoolRewards), epochStats: make(map[iotago.EpochIndex]*model.PoolsStats), api: iotago.V3API( - iotago.NewV3ProtocolParameters( + iotago.NewV3TestProtocolParameters( iotago.WithTimeProviderOptions(0, time.Now().Unix(), 10, 3), - iotago.WithRewardsOptions(8, 8, 11, 1154, 2, 1), + iotago.WithRewardsOptions(8, 8, 11, 2, 1), ), ), } diff --git a/pkg/storage/testframework_test.go b/pkg/storage/testframework_test.go index e3a98772e..896812abe 100644 --- a/pkg/storage/testframework_test.go +++ b/pkg/storage/testframework_test.go @@ -48,7 +48,7 @@ func NewTestFramework(t *testing.T, baseDir string, storageOpts ...options.Optio storageFactoryFunc := func() *storage.Storage { instance := storage.Create(baseDir, 0, errorHandler, storageOpts...) - require.NoError(t, instance.Settings().StoreProtocolParametersForStartEpoch(iotago.NewV3ProtocolParameters(), 0)) + require.NoError(t, instance.Settings().StoreProtocolParametersForStartEpoch(iotago.NewV3TestProtocolParameters(), 0)) return instance } diff --git a/pkg/tests/accounts_test.go b/pkg/tests/accounts_test.go index 39a6deb69..7df17b35e 100644 --- a/pkg/tests/accounts_test.go +++ b/pkg/tests/accounts_test.go @@ -26,14 +26,7 @@ func Test_TransitionAndDestroyAccount(t *testing.T) { 0, testsuite.GenesisTimeWithOffsetBySlots(200, testsuite.DefaultSlotDurationInSeconds), testsuite.DefaultSlotDurationInSeconds, - 8, - ), - iotago.WithLivenessOptions( - testsuite.DefaultLivenessThresholdLowerBoundInSeconds, - testsuite.DefaultLivenessThresholdUpperBoundInSeconds, - testsuite.DefaultMinCommittableAge, - 100, - 120, + testsuite.DefaultSlotsPerEpochExponent, ), ), ) @@ -171,14 +164,7 @@ func Test_StakeDelegateAndDelayedClaim(t *testing.T) { 0, testsuite.GenesisTimeWithOffsetBySlots(100, testsuite.DefaultSlotDurationInSeconds), testsuite.DefaultSlotDurationInSeconds, - 8, - ), - iotago.WithLivenessOptions( - testsuite.DefaultLivenessThresholdLowerBoundInSeconds, - testsuite.DefaultLivenessThresholdUpperBoundInSeconds, - testsuite.DefaultMinCommittableAge, - 100, - 120, + testsuite.DefaultSlotsPerEpochExponent, ), ), ) @@ -355,14 +341,7 @@ func Test_ImplicitAccounts(t *testing.T) { 0, testsuite.GenesisTimeWithOffsetBySlots(100, testsuite.DefaultSlotDurationInSeconds), testsuite.DefaultSlotDurationInSeconds, - 8, - ), - iotago.WithLivenessOptions( - testsuite.DefaultLivenessThresholdLowerBoundInSeconds, - testsuite.DefaultLivenessThresholdUpperBoundInSeconds, - testsuite.DefaultMinCommittableAge, - 100, - 120, + testsuite.DefaultSlotsPerEpochExponent, ), ), ) @@ -483,14 +462,7 @@ func Test_NegativeBIC_BlockIssuerLocked(t *testing.T) { iotago.SlotIndex(0), testsuite.GenesisTimeWithOffsetBySlots(iotago.SlotIndex(200), testsuite.DefaultSlotDurationInSeconds), testsuite.DefaultSlotDurationInSeconds, - 8, - ), - iotago.WithLivenessOptions( - testsuite.DefaultLivenessThresholdLowerBoundInSeconds, - testsuite.DefaultLivenessThresholdUpperBoundInSeconds, - testsuite.DefaultMinCommittableAge, - 100, - testsuite.DefaultEpochNearingThreshold, + testsuite.DefaultSlotsPerEpochExponent, ), ), ) @@ -681,14 +653,7 @@ func Test_NegativeBIC_AccountOutput(t *testing.T) { 0, testsuite.GenesisTimeWithOffsetBySlots(200, testsuite.DefaultSlotDurationInSeconds), testsuite.DefaultSlotDurationInSeconds, - 8, - ), - iotago.WithLivenessOptions( - testsuite.DefaultLivenessThresholdLowerBoundInSeconds, - testsuite.DefaultLivenessThresholdUpperBoundInSeconds, - testsuite.DefaultMinCommittableAge, - 100, - testsuite.DefaultEpochNearingThreshold, + testsuite.DefaultSlotsPerEpochExponent, ), ), ) @@ -885,8 +850,8 @@ func Test_NegativeBIC_AccountOutput(t *testing.T) { // assert diff of the destroyed account. ts.AssertAccountDiff(wallet1.BlockIssuer.AccountID, block4Slot, &model.AccountDiff{ - BICChange: -iotago.BlockIssuanceCredits(9500), - PreviousUpdatedSlot: 21, + BICChange: -iotago.BlockIssuanceCredits(wallet1BIC), + PreviousUpdatedSlot: block3Slot, NewExpirySlot: 0, PreviousExpirySlot: newExpirySlot, NewOutputID: iotago.EmptyOutputID, @@ -908,14 +873,7 @@ func Test_NegativeBIC_AccountOwnedBasicOutputLocked(t *testing.T) { 0, testsuite.GenesisTimeWithOffsetBySlots(200, testsuite.DefaultSlotDurationInSeconds), testsuite.DefaultSlotDurationInSeconds, - 8, - ), - iotago.WithLivenessOptions( - testsuite.DefaultLivenessThresholdLowerBoundInSeconds, - testsuite.DefaultLivenessThresholdUpperBoundInSeconds, - testsuite.DefaultMinCommittableAge, - 100, - testsuite.DefaultEpochNearingThreshold, + testsuite.DefaultSlotsPerEpochExponent, ), ), ) diff --git a/pkg/tests/booker_test.go b/pkg/tests/booker_test.go index abd3db23b..1bf08572b 100644 --- a/pkg/tests/booker_test.go +++ b/pkg/tests/booker_test.go @@ -327,8 +327,8 @@ func Test_SpendRejectedCommittedRace(t *testing.T) { testsuite.DefaultSlotsPerEpochExponent, ), iotago.WithLivenessOptions( - testsuite.DefaultLivenessThresholdLowerBoundInSeconds, - testsuite.DefaultLivenessThresholdUpperBoundInSeconds, + 15, + 15, 2, 5, testsuite.DefaultEpochNearingThreshold, @@ -600,8 +600,8 @@ func Test_SpendPendingCommittedRace(t *testing.T) { testsuite.DefaultSlotsPerEpochExponent, ), iotago.WithLivenessOptions( - testsuite.DefaultLivenessThresholdLowerBoundInSeconds, - testsuite.DefaultLivenessThresholdUpperBoundInSeconds, + 15, + 15, 2, 5, testsuite.DefaultEpochNearingThreshold, diff --git a/pkg/tests/reward_test.go b/pkg/tests/reward_test.go index 67af8e176..3f11112f0 100644 --- a/pkg/tests/reward_test.go +++ b/pkg/tests/reward_test.go @@ -22,13 +22,7 @@ func setupDelegationTestsuite(t *testing.T) (*testsuite.TestSuite, *mock.Node, * testsuite.DefaultSlotDurationInSeconds, 8, ), - iotago.WithLivenessOptions( - testsuite.DefaultLivenessThresholdLowerBoundInSeconds, - testsuite.DefaultLivenessThresholdUpperBoundInSeconds, - testsuite.DefaultMinCommittableAge, - 100, - 120, - ), + iotago.WithStakingOptions(2, 10, 10), ), ) diff --git a/pkg/tests/upgrade_signaling_test.go b/pkg/tests/upgrade_signaling_test.go index 0a627d5e1..0c1bf1822 100644 --- a/pkg/tests/upgrade_signaling_test.go +++ b/pkg/tests/upgrade_signaling_test.go @@ -50,7 +50,7 @@ func Test_Upgrade_Signaling(t *testing.T) { defer ts.Shutdown() // We "pretend" to have version 5 but reuse the same protocol parameters as for version 3. - v5ProtocolParameters := iotago.NewV3ProtocolParameters( + v5ProtocolParameters := iotago.NewV3TestProtocolParameters( append( ts.ProtocolParameterOptions, iotago.WithVersion(5), diff --git a/pkg/testsuite/depositcalculator/depositcalculator_test.go b/pkg/testsuite/depositcalculator/depositcalculator_test.go index 562e1831a..9f8af3051 100644 --- a/pkg/testsuite/depositcalculator/depositcalculator_test.go +++ b/pkg/testsuite/depositcalculator/depositcalculator_test.go @@ -13,7 +13,7 @@ import ( func TestCalculate(t *testing.T) { - protocolParams := iotago.NewV3ProtocolParameters(iotago.WithVersion(3)) + protocolParams := iotago.NewV3TestProtocolParameters(iotago.WithVersion(3)) storageScoreStructure := iotago.NewStorageScoreStructure(protocolParams.StorageScoreParameters()) type test struct { diff --git a/pkg/testsuite/testsuite.go b/pkg/testsuite/testsuite.go index 76d7ecc75..bb2eb3b19 100644 --- a/pkg/testsuite/testsuite.go +++ b/pkg/testsuite/testsuite.go @@ -29,50 +29,6 @@ import ( "github.com/iotaledger/iota.go/v4/wallet" ) -func DefaultProtocolParameterOptions(networkName string) []options.Option[iotago.V3ProtocolParameters] { - return []options.Option[iotago.V3ProtocolParameters]{ - iotago.WithNetworkOptions( - networkName, - "rms", - ), - iotago.WithSupplyOptions( - 1_000_0000, - 100, - 1, - 10, - 100, - 100, - 100, - ), - iotago.WithRewardsOptions(8, 8, 31, 1154, 2, 1), - iotago.WithStakingOptions(1, 100, 1), - - iotago.WithTimeProviderOptions( - 0, - GenesisTimeWithOffsetBySlots(0, DefaultSlotDurationInSeconds), - DefaultSlotDurationInSeconds, - DefaultSlotsPerEpochExponent, - ), - iotago.WithLivenessOptions( - DefaultLivenessThresholdLowerBoundInSeconds, - DefaultLivenessThresholdUpperBoundInSeconds, - DefaultMinCommittableAge, - DefaultMaxCommittableAge, - DefaultEpochNearingThreshold, - ), - iotago.WithCongestionControlOptions( - DefaultMinReferenceManaCost, - DefaultRMCIncrease, - DefaultRMCDecrease, - DefaultRMCIncreaseThreshold, - DefaultRMCDecreaseThreshold, - DefaultSchedulerRate, - DefaultMaxBufferSize, - DefaultMaxValBufferSize, - ), - } -} - type WalletOptions struct { Amount iotago.BaseToken BlockIssuanceCredits iotago.BlockIssuanceCredits @@ -136,8 +92,8 @@ func NewTestSuite(testingT *testing.T, opts ...options.Option[TestSuite]) *TestS }, opts, func(t *TestSuite) { fmt.Println("Setup TestSuite -", testingT.Name(), " @ ", time.Now()) - t.ProtocolParameterOptions = append(DefaultProtocolParameterOptions(testingT.Name()), t.ProtocolParameterOptions...) - t.API = iotago.V3API(iotago.NewV3ProtocolParameters(t.ProtocolParameterOptions...)) + t.ProtocolParameterOptions = append(t.ProtocolParameterOptions, iotago.WithNetworkOptions(testingT.Name())) + t.API = iotago.V3API(iotago.NewV3TestProtocolParameters(t.ProtocolParameterOptions...)) genesisBlock := blocks.NewRootBlock(t.API.ProtocolParameters().GenesisBlockID(), iotago.NewEmptyCommitment(t.API).MustID(), time.Unix(t.API.ProtocolParameters().GenesisUnixTimestamp(), 0)) t.RegisterBlock("Genesis", genesisBlock) diff --git a/pkg/testsuite/testsuite_options.go b/pkg/testsuite/testsuite_options.go index 0f3991013..03bd728d6 100644 --- a/pkg/testsuite/testsuite_options.go +++ b/pkg/testsuite/testsuite_options.go @@ -57,22 +57,23 @@ func durationFromEnvOrDefault(defaultDuration time.Duration, envKey string) time return d } -const ( - DefaultSlotDurationInSeconds uint8 = 10 - DefaultSlotsPerEpochExponent uint8 = 5 +var ( + defaultProtocolParams = iotago.NewV3TestProtocolParameters() + DefaultSlotDurationInSeconds uint8 = defaultProtocolParams.SlotDurationInSeconds() + DefaultSlotsPerEpochExponent uint8 = defaultProtocolParams.SlotsPerEpochExponent() - DefaultLivenessThresholdLowerBoundInSeconds uint16 = 30 - DefaultLivenessThresholdUpperBoundInSeconds uint16 = 30 - DefaultMinCommittableAge iotago.SlotIndex = 10 - DefaultMaxCommittableAge iotago.SlotIndex = 20 - DefaultEpochNearingThreshold iotago.SlotIndex = 24 + DefaultLivenessThresholdLowerBoundInSeconds uint16 = uint16(defaultProtocolParams.LivenessThresholdLowerBound().Seconds()) + DefaultLivenessThresholdUpperBoundInSeconds uint16 = uint16(defaultProtocolParams.LivenessThresholdUpperBound().Seconds()) + DefaultMinCommittableAge iotago.SlotIndex = defaultProtocolParams.MinCommittableAge() + DefaultMaxCommittableAge iotago.SlotIndex = defaultProtocolParams.MaxCommittableAge() + DefaultEpochNearingThreshold iotago.SlotIndex = defaultProtocolParams.EpochNearingThreshold() - DefaultMinReferenceManaCost iotago.Mana = 500 - DefaultRMCIncrease iotago.Mana = 500 - DefaultRMCDecrease iotago.Mana = 500 - DefaultRMCIncreaseThreshold iotago.WorkScore = 8 * DefaultSchedulerRate - DefaultRMCDecreaseThreshold iotago.WorkScore = 5 * DefaultSchedulerRate - DefaultSchedulerRate iotago.WorkScore = 100000 - DefaultMaxBufferSize uint32 = 100 * iotago.MaxBlockSize - DefaultMaxValBufferSize uint32 = 100 * iotago.MaxBlockSize + DefaultMinReferenceManaCost iotago.Mana = defaultProtocolParams.CongestionControlParameters().MinReferenceManaCost + DefaultRMCIncrease iotago.Mana = defaultProtocolParams.CongestionControlParameters().Increase + DefaultRMCDecrease iotago.Mana = defaultProtocolParams.CongestionControlParameters().Decrease + DefaultRMCIncreaseThreshold iotago.WorkScore = defaultProtocolParams.CongestionControlParameters().IncreaseThreshold + DefaultRMCDecreaseThreshold iotago.WorkScore = defaultProtocolParams.CongestionControlParameters().DecreaseThreshold + DefaultSchedulerRate iotago.WorkScore = defaultProtocolParams.CongestionControlParameters().SchedulerRate + DefaultMaxBufferSize uint32 = defaultProtocolParams.CongestionControlParameters().MaxBufferSize + DefaultMaxValBufferSize uint32 = defaultProtocolParams.CongestionControlParameters().MaxValidationBufferSize ) diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index ee1992d2c..cecc30daa 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-20231128121006-331a9e522dfe // indirect github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 // indirect github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 // indirect - github.com/iotaledger/iota.go/v4 v4.0.0-20231204084048-9c12053adaf6 // indirect + github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da // indirect github.com/ipfs/boxo v0.13.1 // 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 734814b2e..eecb77c05 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.20231201123347-1c44b3f24221 h1:+ozra github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221/go.mod h1:6cLX3gnhP0WL+Q+mf3/rIqfACe5fWKVR8luPXWh2xiY= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 h1:XdhojOpZ0t0pJFyNO0zlBogSAUrhEI67eCpTC9H6sGM= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665/go.mod h1:obK1N42oafGA7EH6zC4VX2fKh7jTa3WnIa9h1azfxq0= -github.com/iotaledger/iota.go/v4 v4.0.0-20231204084048-9c12053adaf6 h1:Wuf8Ps3tzuZ5CCbl7LA5O2qwhfuXWo30RCOT0yhm4pg= -github.com/iotaledger/iota.go/v4 v4.0.0-20231204084048-9c12053adaf6/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= +github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da h1:oNgrEVzIa4613fN7Prw9RCePT1wIF5UB1MnhoV/ys4M= +github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= 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 416b59558..4ae3b94fd 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-20231128121006-331a9e522dfe github.com/iotaledger/hive.go/runtime v0.0.0-20231128121006-331a9e522dfe github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20231204084048-9c12053adaf6 + github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da github.com/mr-tron/base58 v1.2.0 github.com/spf13/pflag v1.0.5 golang.org/x/crypto v0.16.0 diff --git a/tools/genesis-snapshot/go.sum b/tools/genesis-snapshot/go.sum index 30c064306..172121c91 100644 --- a/tools/genesis-snapshot/go.sum +++ b/tools/genesis-snapshot/go.sum @@ -52,8 +52,8 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231127134220-90b88e3 github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231127134220-90b88e35bdb2/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= github.com/iotaledger/hive.go/stringify v0.0.0-20231128121006-331a9e522dfe h1:RcFUqhnJ+86+sA0XMrZ0q+086ULrdWQkWrjUt2OnJK4= github.com/iotaledger/hive.go/stringify v0.0.0-20231128121006-331a9e522dfe/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/iota.go/v4 v4.0.0-20231204084048-9c12053adaf6 h1:Wuf8Ps3tzuZ5CCbl7LA5O2qwhfuXWo30RCOT0yhm4pg= -github.com/iotaledger/iota.go/v4 v4.0.0-20231204084048-9c12053adaf6/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= +github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da h1:oNgrEVzIa4613fN7Prw9RCePT1wIF5UB1MnhoV/ys4M= +github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= 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 208e15859..bfbd492a2 100644 --- a/tools/genesis-snapshot/presets/presets.go +++ b/tools/genesis-snapshot/presets/presets.go @@ -1,8 +1,6 @@ package presets import ( - "time" - "golang.org/x/crypto/blake2b" "github.com/iotaledger/hive.go/crypto/ed25519" @@ -16,34 +14,19 @@ import ( ) var ( - protocolParamsBase = iotago.NewV3ProtocolParameters( - iotago.WithNetworkOptions("default", "rms"), - iotago.WithSupplyOptions(4_600_000_000_000_000, 250, 1, 1000, 100000, 500000, 100000), - iotago.WithTimeProviderOptions(0, 1696841745, 10, 13), - iotago.WithLivenessOptions(30, 30, 7, 14, 30), - // increase/decrease threshold = fraction * slotDurationInSeconds * schedulerRate - iotago.WithCongestionControlOptions(500, 500, 500, 800000, 500000, 100000, 1000, 100), - iotago.WithWorkScoreOptions(25, 1, 100, 50, 10, 10, 50, 1, 10, 250), + // use defaults from iota.go + protocolParamsBase = iotago.NewV3TestProtocolParameters( + iotago.WithNetworkOptions("default"), ) - protocolParamsDocker = iotago.NewV3ProtocolParameters( - iotago.WithNetworkOptions("docker", "rms"), - iotago.WithSupplyOptions(4_600_000_000_000_000, 250, 1, 1000, 100000, 500000, 100000), - iotago.WithTimeProviderOptions(5, 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, 1000, 100), - iotago.WithWorkScoreOptions(25, 1, 100, 50, 10, 10, 50, 1, 10, 250), + // use defaults from iota.go + protocolParamsDocker = iotago.NewV3TestProtocolParameters( + iotago.WithNetworkOptions("docker"), ) - protocolParamsFeature = iotago.NewV3ProtocolParameters( - iotago.WithNetworkOptions("feature", "rms"), - iotago.WithSupplyOptions(4_600_000_000_000_000, 250, 1, 1000, 100000, 500000, 100000), - iotago.WithTimeProviderOptions(666666, time.Now().Unix()-100_000, 10, 13), // Let's fix genesis at 10_000 slots back. - iotago.WithLivenessOptions(30, 30, 10, 20, 30), - // increase/decrease threshold = fraction * slotDurationInSeconds * schedulerRate - iotago.WithCongestionControlOptions(500, 500, 500, 800000, 500000, 100000, 1000, 100), - iotago.WithWorkScoreOptions(25, 1, 100, 50, 10, 10, 50, 1, 10, 250), + // use defaults from iota.go + protocolParamsFeature = iotago.NewV3TestProtocolParameters( + iotago.WithNetworkOptions("feature"), ) ) From b41e6aee14dcaaff21720179c363891ff11b6155 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 5 Dec 2023 16:16:54 +0000 Subject: [PATCH 02/30] fix engine getter --- pkg/testsuite/accounts.go | 4 ++-- pkg/testsuite/mock/wallet_transactions.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/testsuite/accounts.go b/pkg/testsuite/accounts.go index 212a17899..d324e78d5 100644 --- a/pkg/testsuite/accounts.go +++ b/pkg/testsuite/accounts.go @@ -14,12 +14,12 @@ func (t *TestSuite) AssertAccountStake(accountID iotago.AccountID, validatorStak nodes ...*mock.Node) { for _, node := range nodes { t.Eventually(func() error { - actualAccountData, exists, err := node.Protocol.MainEngineInstance().Ledger.Account(accountID, node.Protocol.MainEngineInstance().SyncManager.LatestCommitment().Slot()) + actualAccountData, exists, err := node.Protocol.Engines.Main.Get().Ledger.Account(accountID, node.Protocol.Engines.Main.Get().SyncManager.LatestCommitment().Slot()) if err != nil { return ierrors.Wrap(err, "AssertAccountData: failed to load account data") } if !exists { - return ierrors.Errorf("AssertAccountData: %s: account %s does not exist with latest committed slot %d", node.Name, accountID, node.Protocol.MainEngineInstance().SyncManager.LatestCommitment().Slot()) + return ierrors.Errorf("AssertAccountData: %s: account %s does not exist with latest committed slot %d", node.Name, accountID, node.Protocol.Engines.Main.Get().SyncManager.LatestCommitment().Slot()) } if accountID != actualAccountData.ID { diff --git a/pkg/testsuite/mock/wallet_transactions.go b/pkg/testsuite/mock/wallet_transactions.go index 76d48132d..911ba4622 100644 --- a/pkg/testsuite/mock/wallet_transactions.go +++ b/pkg/testsuite/mock/wallet_transactions.go @@ -101,7 +101,7 @@ func (w *Wallet) CreateDelegationFromInput(transactionName string, inputName str } func (w *Wallet) DelegationStartFromSlot(slot iotago.SlotIndex) iotago.EpochIndex { - latestCommitment := w.Node.Protocol.MainEngineInstance().Storage.Settings().LatestCommitment() + latestCommitment := w.Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment() apiForSlot := w.Node.Protocol.APIForSlot(slot) pastBoundedSlotIndex := latestCommitment.Slot() + apiForSlot.ProtocolParameters().MaxCommittableAge() @@ -117,7 +117,7 @@ func (w *Wallet) DelegationStartFromSlot(slot iotago.SlotIndex) iotago.EpochInde } func (w *Wallet) DelegationEndFromSlot(slot iotago.SlotIndex) iotago.EpochIndex { - latestCommitment := w.Node.Protocol.MainEngineInstance().Storage.Settings().LatestCommitment() + latestCommitment := w.Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment() apiForSlot := w.Node.Protocol.APIForSlot(slot) futureBoundedSlotIndex := latestCommitment.Slot() + apiForSlot.ProtocolParameters().MinCommittableAge() From 7dfdd64e1b5cbf91baee168904218da3ae844571 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 5 Dec 2023 16:35:03 +0000 Subject: [PATCH 03/30] go mod tidy --- go.sum | 56 +++++++++++++++++------------------ tools/gendoc/go.mod | 32 +++++++++----------- tools/gendoc/go.sum | 56 +++++++++++++++++------------------ tools/genesis-snapshot/go.mod | 24 +++++++-------- tools/genesis-snapshot/go.sum | 48 +++++++++++++++--------------- 5 files changed, 106 insertions(+), 110 deletions(-) diff --git a/go.sum b/go.sum index 4fb7e6fa3..0dfb50318 100644 --- a/go.sum +++ b/go.sum @@ -275,34 +275,34 @@ github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJ github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 h1:dTrD7X2PTNgli6EbS4tV9qu3QAm/kBU3XaYZV2xdzys= github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7/go.mod h1:ZRdPu684P0fQ1z8sXz4dj9H5LWHhz4a9oCtvjunkSrw= -github.com/iotaledger/hive.go/ads v0.0.0-20231127134220-90b88e35bdb2 h1:0FynHsnJTZgxQuXk3/maXNgzyvbwQ+TnuiwY48kYSr4= -github.com/iotaledger/hive.go/ads v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= -github.com/iotaledger/hive.go/app v0.0.0-20231127134220-90b88e35bdb2 h1:WI6MQCxeANDyO7fOTovefuIusma+wT8VUJ3BisQLZEA= -github.com/iotaledger/hive.go/app v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:+riYmeLApkLlj4+EpuJpEJAsj/KGfD7cqLGy7oTsPOM= -github.com/iotaledger/hive.go/constraints v0.0.0-20231128121006-331a9e522dfe h1:vgJj9kXM1IkLjbjWOV565Vil+RlzJwVhxG/KebMmrKE= -github.com/iotaledger/hive.go/constraints v0.0.0-20231128121006-331a9e522dfe/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231127134220-90b88e35bdb2 h1:ZL4cGO4zy7IwCIfHQgpvu3yMbNnFFRvSvTqaZM5Uj5U= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231127134220-90b88e35bdb2/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= -github.com/iotaledger/hive.go/crypto v0.0.0-20231128121006-331a9e522dfe h1:/+Qw7fe5oSE5Jxm8RPzcfBKHbwjJ/zwHu3UWdSOvKW8= -github.com/iotaledger/hive.go/crypto v0.0.0-20231128121006-331a9e522dfe/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= -github.com/iotaledger/hive.go/ds v0.0.0-20231127134220-90b88e35bdb2 h1:8YQlcFMexyYvjh3V/YSYzldeYjaDZd+1mHt8SUh8Uqs= -github.com/iotaledger/hive.go/ds v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231128121006-331a9e522dfe h1:kVkjbdBANpA8tyu9RM4/GeyVoyRfGcb4LT96PqHTIWc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231128121006-331a9e522dfe/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= -github.com/iotaledger/hive.go/kvstore v0.0.0-20231127134220-90b88e35bdb2 h1:b+AHpClIb7YAjpXgRHCsr+DRdBMuN4Q6k/wpFmT1wok= -github.com/iotaledger/hive.go/kvstore v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= -github.com/iotaledger/hive.go/lo v0.0.0-20231128121006-331a9e522dfe h1:dQBQ+ZOVwC6KJxTABHMMHjJto70gNU5Cn4dXeJp5xmM= -github.com/iotaledger/hive.go/lo v0.0.0-20231128121006-331a9e522dfe/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= -github.com/iotaledger/hive.go/log v0.0.0-20231127134220-90b88e35bdb2 h1:3B6UFIJ+IJEiGmUbLt5+Zokv0i8RUs70IuSR9sB60DA= -github.com/iotaledger/hive.go/log v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= -github.com/iotaledger/hive.go/logger v0.0.0-20231127134220-90b88e35bdb2 h1:1r4fY+R9p2q5CzEkiXMuFr/UCM8RX3yPUllXkjm5/Fk= -github.com/iotaledger/hive.go/logger v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:w1psHM2MuKsen1WdsPKrpqElYH7ZOQ+YdQIgJZg4HTo= -github.com/iotaledger/hive.go/runtime v0.0.0-20231128121006-331a9e522dfe h1:jewR0RJ7oTGWjzhTROdIwhMeBH4//frUHizKs/6Em+s= -github.com/iotaledger/hive.go/runtime v0.0.0-20231128121006-331a9e522dfe/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231127134220-90b88e35bdb2 h1:vTx/tPH+//CQcDjdC8DZv3s6x9KCqAfTqn3VTjYUUlw= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231127134220-90b88e35bdb2/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= -github.com/iotaledger/hive.go/stringify v0.0.0-20231128121006-331a9e522dfe h1:RcFUqhnJ+86+sA0XMrZ0q+086ULrdWQkWrjUt2OnJK4= -github.com/iotaledger/hive.go/stringify v0.0.0-20231128121006-331a9e522dfe/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 h1:jxoBAPgC4I73pAwvEWI2IUCxiI1xN68IaFZ5WC1D3ek= +github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= +github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39 h1:B+SzeGOUyIROHfGjoYLJRPT/GL2u2X8pe3bS5avBbZc= +github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39/go.mod h1:+riYmeLApkLlj4+EpuJpEJAsj/KGfD7cqLGy7oTsPOM= +github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 h1:zv6hp2CsJikP2jdkOjngJmpUVjhC2UfiIFN6yGvo4jA= +github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 h1:qAIj5vpAojkrORpOflrUYJ6iFL4osUkyP6Vr7/WK9BI= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= +github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 h1:5lXV8tI2PlMWraa9eT5xGasNdiMaAYd1159mzXdX1xM= +github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= +github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 h1:axE2+FtJQpAQ40KerOISEzHndqv79h7zYs8NZ7r0jNQ= +github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 h1:KpHT3dYj+WoFnAzkW4EPluWHuhzErTree0+AF/KVBTU= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 h1:Gp2h+Els9cTVYYnYsHX3zLuixb0XggIj2okK570aKww= +github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= +github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 h1:Di2G2i/hGyhe3D8j/MsnZqnx1yJBiMdbXDIrtbWpe8g= +github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= +github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 h1:kYj16hPQ0iH+1srDaIj4wZCGH5qrhsFpHkLbh3Ob1Bs= +github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= +github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39 h1:m4b7gNQu1HI+LH1m0oAvuFnpp7/EC/iPGHK7ImWNk3w= +github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39/go.mod h1:w1psHM2MuKsen1WdsPKrpqElYH7ZOQ+YdQIgJZg4HTo= +github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 h1:O6tJNVV544ts/DKIIfHQJNGXIPZgntR1DJ4e+jPR9rQ= +github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 h1:GPa5qfHm59jqY3pff0eCnt/mpWFm6fibVK/n/E+Pfyk= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= +github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 h1:gatLNIqLC/MAR5qlj+413/y0LmyfKC0QL2BKXLniD0M= +github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 h1:+ozrau44uPy2kYv2fuj2Wks8+VkXR62WB9zONOJgzdE= github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221/go.mod h1:6cLX3gnhP0WL+Q+mf3/rIqfACe5fWKVR8luPXWh2xiY= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 h1:XdhojOpZ0t0pJFyNO0zlBogSAUrhEI67eCpTC9H6sGM= diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index cecc30daa..8568863ed 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -5,7 +5,7 @@ go 1.21 replace github.com/iotaledger/iota-core => ../../ require ( - github.com/iotaledger/hive.go/app v0.0.0-20231127134220-90b88e35bdb2 + github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39 github.com/iotaledger/hive.go/apputils v0.0.0-20230829152614-7afc7a4d89b3 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 ) @@ -18,7 +18,6 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/docker/go-units v0.5.0 // indirect @@ -57,19 +56,19 @@ require ( github.com/huin/goupnp v1.3.0 // indirect github.com/iancoleman/orderedmap v0.3.0 // indirect github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 // indirect - github.com/iotaledger/hive.go/ads v0.0.0-20231127134220-90b88e35bdb2 // indirect - github.com/iotaledger/hive.go/constraints v0.0.0-20231128121006-331a9e522dfe // indirect - github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231127134220-90b88e35bdb2 // indirect - github.com/iotaledger/hive.go/crypto v0.0.0-20231128121006-331a9e522dfe // indirect - github.com/iotaledger/hive.go/ds v0.0.0-20231127134220-90b88e35bdb2 // indirect - github.com/iotaledger/hive.go/ierrors v0.0.0-20231128121006-331a9e522dfe // indirect - github.com/iotaledger/hive.go/kvstore v0.0.0-20231127134220-90b88e35bdb2 // indirect - github.com/iotaledger/hive.go/lo v0.0.0-20231128121006-331a9e522dfe // indirect - github.com/iotaledger/hive.go/log v0.0.0-20231127134220-90b88e35bdb2 // indirect - github.com/iotaledger/hive.go/logger v0.0.0-20231127134220-90b88e35bdb2 // indirect - github.com/iotaledger/hive.go/runtime v0.0.0-20231128121006-331a9e522dfe // indirect - github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231127134220-90b88e35bdb2 // indirect - github.com/iotaledger/hive.go/stringify v0.0.0-20231128121006-331a9e522dfe // indirect + github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 // indirect github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 // indirect github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 // indirect github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da // indirect @@ -134,7 +133,6 @@ require ( github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pokt-network/smt v0.6.1 // indirect github.com/polydawn/refmt v0.89.0 // indirect github.com/prometheus/client_golang v1.17.0 // indirect @@ -150,7 +148,6 @@ require ( github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/cast v1.5.1 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/testify v1.8.4 // indirect github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect @@ -182,6 +179,5 @@ require ( google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect ) diff --git a/tools/gendoc/go.sum b/tools/gendoc/go.sum index eecb77c05..11602051c 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -277,36 +277,36 @@ github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJ github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 h1:dTrD7X2PTNgli6EbS4tV9qu3QAm/kBU3XaYZV2xdzys= github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7/go.mod h1:ZRdPu684P0fQ1z8sXz4dj9H5LWHhz4a9oCtvjunkSrw= -github.com/iotaledger/hive.go/ads v0.0.0-20231127134220-90b88e35bdb2 h1:0FynHsnJTZgxQuXk3/maXNgzyvbwQ+TnuiwY48kYSr4= -github.com/iotaledger/hive.go/ads v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= -github.com/iotaledger/hive.go/app v0.0.0-20231127134220-90b88e35bdb2 h1:WI6MQCxeANDyO7fOTovefuIusma+wT8VUJ3BisQLZEA= -github.com/iotaledger/hive.go/app v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:+riYmeLApkLlj4+EpuJpEJAsj/KGfD7cqLGy7oTsPOM= +github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 h1:jxoBAPgC4I73pAwvEWI2IUCxiI1xN68IaFZ5WC1D3ek= +github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= +github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39 h1:B+SzeGOUyIROHfGjoYLJRPT/GL2u2X8pe3bS5avBbZc= +github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39/go.mod h1:+riYmeLApkLlj4+EpuJpEJAsj/KGfD7cqLGy7oTsPOM= github.com/iotaledger/hive.go/apputils v0.0.0-20230829152614-7afc7a4d89b3 h1:4aVJTc0KS77uEw0Tny4r0n1ORwcbAQDECaCclgf/6lE= github.com/iotaledger/hive.go/apputils v0.0.0-20230829152614-7afc7a4d89b3/go.mod h1:TZeAqieDu+xDOZp2e9+S+8pZp1PrfgcwLUnxmd8IgLU= -github.com/iotaledger/hive.go/constraints v0.0.0-20231128121006-331a9e522dfe h1:vgJj9kXM1IkLjbjWOV565Vil+RlzJwVhxG/KebMmrKE= -github.com/iotaledger/hive.go/constraints v0.0.0-20231128121006-331a9e522dfe/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231127134220-90b88e35bdb2 h1:ZL4cGO4zy7IwCIfHQgpvu3yMbNnFFRvSvTqaZM5Uj5U= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231127134220-90b88e35bdb2/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= -github.com/iotaledger/hive.go/crypto v0.0.0-20231128121006-331a9e522dfe h1:/+Qw7fe5oSE5Jxm8RPzcfBKHbwjJ/zwHu3UWdSOvKW8= -github.com/iotaledger/hive.go/crypto v0.0.0-20231128121006-331a9e522dfe/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= -github.com/iotaledger/hive.go/ds v0.0.0-20231127134220-90b88e35bdb2 h1:8YQlcFMexyYvjh3V/YSYzldeYjaDZd+1mHt8SUh8Uqs= -github.com/iotaledger/hive.go/ds v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231128121006-331a9e522dfe h1:kVkjbdBANpA8tyu9RM4/GeyVoyRfGcb4LT96PqHTIWc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231128121006-331a9e522dfe/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= -github.com/iotaledger/hive.go/kvstore v0.0.0-20231127134220-90b88e35bdb2 h1:b+AHpClIb7YAjpXgRHCsr+DRdBMuN4Q6k/wpFmT1wok= -github.com/iotaledger/hive.go/kvstore v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= -github.com/iotaledger/hive.go/lo v0.0.0-20231128121006-331a9e522dfe h1:dQBQ+ZOVwC6KJxTABHMMHjJto70gNU5Cn4dXeJp5xmM= -github.com/iotaledger/hive.go/lo v0.0.0-20231128121006-331a9e522dfe/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= -github.com/iotaledger/hive.go/log v0.0.0-20231127134220-90b88e35bdb2 h1:3B6UFIJ+IJEiGmUbLt5+Zokv0i8RUs70IuSR9sB60DA= -github.com/iotaledger/hive.go/log v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= -github.com/iotaledger/hive.go/logger v0.0.0-20231127134220-90b88e35bdb2 h1:1r4fY+R9p2q5CzEkiXMuFr/UCM8RX3yPUllXkjm5/Fk= -github.com/iotaledger/hive.go/logger v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:w1psHM2MuKsen1WdsPKrpqElYH7ZOQ+YdQIgJZg4HTo= -github.com/iotaledger/hive.go/runtime v0.0.0-20231128121006-331a9e522dfe h1:jewR0RJ7oTGWjzhTROdIwhMeBH4//frUHizKs/6Em+s= -github.com/iotaledger/hive.go/runtime v0.0.0-20231128121006-331a9e522dfe/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231127134220-90b88e35bdb2 h1:vTx/tPH+//CQcDjdC8DZv3s6x9KCqAfTqn3VTjYUUlw= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231127134220-90b88e35bdb2/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= -github.com/iotaledger/hive.go/stringify v0.0.0-20231128121006-331a9e522dfe h1:RcFUqhnJ+86+sA0XMrZ0q+086ULrdWQkWrjUt2OnJK4= -github.com/iotaledger/hive.go/stringify v0.0.0-20231128121006-331a9e522dfe/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 h1:zv6hp2CsJikP2jdkOjngJmpUVjhC2UfiIFN6yGvo4jA= +github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 h1:qAIj5vpAojkrORpOflrUYJ6iFL4osUkyP6Vr7/WK9BI= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= +github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 h1:5lXV8tI2PlMWraa9eT5xGasNdiMaAYd1159mzXdX1xM= +github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= +github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 h1:axE2+FtJQpAQ40KerOISEzHndqv79h7zYs8NZ7r0jNQ= +github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 h1:KpHT3dYj+WoFnAzkW4EPluWHuhzErTree0+AF/KVBTU= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 h1:Gp2h+Els9cTVYYnYsHX3zLuixb0XggIj2okK570aKww= +github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= +github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 h1:Di2G2i/hGyhe3D8j/MsnZqnx1yJBiMdbXDIrtbWpe8g= +github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= +github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 h1:kYj16hPQ0iH+1srDaIj4wZCGH5qrhsFpHkLbh3Ob1Bs= +github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= +github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39 h1:m4b7gNQu1HI+LH1m0oAvuFnpp7/EC/iPGHK7ImWNk3w= +github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39/go.mod h1:w1psHM2MuKsen1WdsPKrpqElYH7ZOQ+YdQIgJZg4HTo= +github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 h1:O6tJNVV544ts/DKIIfHQJNGXIPZgntR1DJ4e+jPR9rQ= +github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 h1:GPa5qfHm59jqY3pff0eCnt/mpWFm6fibVK/n/E+Pfyk= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= +github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 h1:gatLNIqLC/MAR5qlj+413/y0LmyfKC0QL2BKXLniD0M= +github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 h1:+ozrau44uPy2kYv2fuj2Wks8+VkXR62WB9zONOJgzdE= github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221/go.mod h1:6cLX3gnhP0WL+Q+mf3/rIqfACe5fWKVR8luPXWh2xiY= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 h1:XdhojOpZ0t0pJFyNO0zlBogSAUrhEI67eCpTC9H6sGM= diff --git a/tools/genesis-snapshot/go.mod b/tools/genesis-snapshot/go.mod index 4ae3b94fd..9b0f259af 100644 --- a/tools/genesis-snapshot/go.mod +++ b/tools/genesis-snapshot/go.mod @@ -5,10 +5,10 @@ go 1.21 replace github.com/iotaledger/iota-core => ../../ require ( - github.com/iotaledger/hive.go/crypto v0.0.0-20231128121006-331a9e522dfe - github.com/iotaledger/hive.go/ierrors v0.0.0-20231128121006-331a9e522dfe - github.com/iotaledger/hive.go/lo v0.0.0-20231128121006-331a9e522dfe - github.com/iotaledger/hive.go/runtime v0.0.0-20231128121006-331a9e522dfe + github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 + github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 + github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 + github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da github.com/mr-tron/base58 v1.2.0 @@ -26,14 +26,14 @@ require ( github.com/holiman/uint256 v1.2.4 // indirect github.com/iancoleman/orderedmap v0.3.0 // indirect github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 // indirect - github.com/iotaledger/hive.go/ads v0.0.0-20231127134220-90b88e35bdb2 // indirect - github.com/iotaledger/hive.go/constraints v0.0.0-20231128121006-331a9e522dfe // indirect - github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231127134220-90b88e35bdb2 // indirect - github.com/iotaledger/hive.go/ds v0.0.0-20231127134220-90b88e35bdb2 // indirect - github.com/iotaledger/hive.go/kvstore v0.0.0-20231127134220-90b88e35bdb2 // indirect - github.com/iotaledger/hive.go/log v0.0.0-20231127134220-90b88e35bdb2 // indirect - github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231127134220-90b88e35bdb2 // indirect - github.com/iotaledger/hive.go/stringify v0.0.0-20231128121006-331a9e522dfe // indirect + github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/kr/text v0.2.0 // indirect diff --git a/tools/genesis-snapshot/go.sum b/tools/genesis-snapshot/go.sum index 172121c91..16ec77a10 100644 --- a/tools/genesis-snapshot/go.sum +++ b/tools/genesis-snapshot/go.sum @@ -28,30 +28,30 @@ github.com/iancoleman/orderedmap v0.3.0 h1:5cbR2grmZR/DiVt+VJopEhtVs9YGInGIxAoMJ github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJDkXXS7VoV7XGE= github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 h1:dTrD7X2PTNgli6EbS4tV9qu3QAm/kBU3XaYZV2xdzys= github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7/go.mod h1:ZRdPu684P0fQ1z8sXz4dj9H5LWHhz4a9oCtvjunkSrw= -github.com/iotaledger/hive.go/ads v0.0.0-20231127134220-90b88e35bdb2 h1:0FynHsnJTZgxQuXk3/maXNgzyvbwQ+TnuiwY48kYSr4= -github.com/iotaledger/hive.go/ads v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= -github.com/iotaledger/hive.go/constraints v0.0.0-20231128121006-331a9e522dfe h1:vgJj9kXM1IkLjbjWOV565Vil+RlzJwVhxG/KebMmrKE= -github.com/iotaledger/hive.go/constraints v0.0.0-20231128121006-331a9e522dfe/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231127134220-90b88e35bdb2 h1:ZL4cGO4zy7IwCIfHQgpvu3yMbNnFFRvSvTqaZM5Uj5U= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231127134220-90b88e35bdb2/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= -github.com/iotaledger/hive.go/crypto v0.0.0-20231128121006-331a9e522dfe h1:/+Qw7fe5oSE5Jxm8RPzcfBKHbwjJ/zwHu3UWdSOvKW8= -github.com/iotaledger/hive.go/crypto v0.0.0-20231128121006-331a9e522dfe/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= -github.com/iotaledger/hive.go/ds v0.0.0-20231127134220-90b88e35bdb2 h1:8YQlcFMexyYvjh3V/YSYzldeYjaDZd+1mHt8SUh8Uqs= -github.com/iotaledger/hive.go/ds v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231128121006-331a9e522dfe h1:kVkjbdBANpA8tyu9RM4/GeyVoyRfGcb4LT96PqHTIWc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231128121006-331a9e522dfe/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= -github.com/iotaledger/hive.go/kvstore v0.0.0-20231127134220-90b88e35bdb2 h1:b+AHpClIb7YAjpXgRHCsr+DRdBMuN4Q6k/wpFmT1wok= -github.com/iotaledger/hive.go/kvstore v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= -github.com/iotaledger/hive.go/lo v0.0.0-20231128121006-331a9e522dfe h1:dQBQ+ZOVwC6KJxTABHMMHjJto70gNU5Cn4dXeJp5xmM= -github.com/iotaledger/hive.go/lo v0.0.0-20231128121006-331a9e522dfe/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= -github.com/iotaledger/hive.go/log v0.0.0-20231127134220-90b88e35bdb2 h1:3B6UFIJ+IJEiGmUbLt5+Zokv0i8RUs70IuSR9sB60DA= -github.com/iotaledger/hive.go/log v0.0.0-20231127134220-90b88e35bdb2/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= -github.com/iotaledger/hive.go/runtime v0.0.0-20231128121006-331a9e522dfe h1:jewR0RJ7oTGWjzhTROdIwhMeBH4//frUHizKs/6Em+s= -github.com/iotaledger/hive.go/runtime v0.0.0-20231128121006-331a9e522dfe/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231127134220-90b88e35bdb2 h1:vTx/tPH+//CQcDjdC8DZv3s6x9KCqAfTqn3VTjYUUlw= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231127134220-90b88e35bdb2/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= -github.com/iotaledger/hive.go/stringify v0.0.0-20231128121006-331a9e522dfe h1:RcFUqhnJ+86+sA0XMrZ0q+086ULrdWQkWrjUt2OnJK4= -github.com/iotaledger/hive.go/stringify v0.0.0-20231128121006-331a9e522dfe/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 h1:jxoBAPgC4I73pAwvEWI2IUCxiI1xN68IaFZ5WC1D3ek= +github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= +github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 h1:zv6hp2CsJikP2jdkOjngJmpUVjhC2UfiIFN6yGvo4jA= +github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 h1:qAIj5vpAojkrORpOflrUYJ6iFL4osUkyP6Vr7/WK9BI= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= +github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 h1:5lXV8tI2PlMWraa9eT5xGasNdiMaAYd1159mzXdX1xM= +github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= +github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 h1:axE2+FtJQpAQ40KerOISEzHndqv79h7zYs8NZ7r0jNQ= +github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 h1:KpHT3dYj+WoFnAzkW4EPluWHuhzErTree0+AF/KVBTU= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 h1:Gp2h+Els9cTVYYnYsHX3zLuixb0XggIj2okK570aKww= +github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= +github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 h1:Di2G2i/hGyhe3D8j/MsnZqnx1yJBiMdbXDIrtbWpe8g= +github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= +github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 h1:kYj16hPQ0iH+1srDaIj4wZCGH5qrhsFpHkLbh3Ob1Bs= +github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= +github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 h1:O6tJNVV544ts/DKIIfHQJNGXIPZgntR1DJ4e+jPR9rQ= +github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 h1:GPa5qfHm59jqY3pff0eCnt/mpWFm6fibVK/n/E+Pfyk= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= +github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 h1:gatLNIqLC/MAR5qlj+413/y0LmyfKC0QL2BKXLniD0M= +github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da h1:oNgrEVzIa4613fN7Prw9RCePT1wIF5UB1MnhoV/ys4M= github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= From 2f69778b672cc13033798b536784eac4231688f2 Mon Sep 17 00:00:00 2001 From: Alexander Sporn Date: Tue, 5 Dec 2023 16:54:42 +0100 Subject: [PATCH 04/30] Added missing workerpools to hooks in INX --- components/inx/server_commitments.go | 3 ++- components/inx/server_utxo.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/inx/server_commitments.go b/components/inx/server_commitments.go index 1e8fc3961..fafb7445e 100644 --- a/components/inx/server_commitments.go +++ b/components/inx/server_commitments.go @@ -8,6 +8,7 @@ import ( "github.com/iotaledger/hive.go/ierrors" "github.com/iotaledger/hive.go/kvstore" + "github.com/iotaledger/hive.go/runtime/event" "github.com/iotaledger/hive.go/runtime/workerpool" inx "github.com/iotaledger/inx/go" "github.com/iotaledger/iota-core/pkg/model" @@ -142,7 +143,7 @@ func (s *Server) ListenToCommitments(req *inx.SlotRangeRequest, srv inx.INX_List case done: cancel() } - }).Unhook + }, event.WithWorkerPool(wp)).Unhook <-ctx.Done() unhook() diff --git a/components/inx/server_utxo.go b/components/inx/server_utxo.go index fd815e01a..8724f5f90 100644 --- a/components/inx/server_utxo.go +++ b/components/inx/server_utxo.go @@ -346,7 +346,7 @@ func (s *Server) ListenToLedgerUpdates(req *inx.SlotRangeRequest, srv inx.INX_Li case done: cancel() } - }).Unhook + }, event.WithWorkerPool(wp)).Unhook <-ctx.Done() unhook() From 018698c358482be3a68251de2cf8ced75f00dc04 Mon Sep 17 00:00:00 2001 From: Alexander Sporn Date: Tue, 5 Dec 2023 16:56:34 +0100 Subject: [PATCH 05/30] Reduce contention in Settings since the TypedValue already locks inside --- pkg/storage/permanent/settings.go | 40 +++++++------------------------ 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/pkg/storage/permanent/settings.go b/pkg/storage/permanent/settings.go index a9bf979b2..96c89497b 100644 --- a/pkg/storage/permanent/settings.go +++ b/pkg/storage/permanent/settings.go @@ -30,13 +30,14 @@ const ( ) type Settings struct { - mutex syncutils.RWMutex store kvstore.KVStore storeSnapshotImported *kvstore.TypedValue[bool] storeLatestCommitment *kvstore.TypedValue[*model.Commitment] storeLatestFinalizedSlot *kvstore.TypedValue[iotago.SlotIndex] storeLatestProcessedSlot *kvstore.TypedValue[iotago.SlotIndex] storeLatestIssuedValidationBlock *kvstore.TypedValue[*model.Block] + + mutex syncutils.RWMutex storeProtocolVersionEpochMapping *kvstore.TypedStore[iotago.Version, iotago.EpochIndex] storeFutureProtocolParameters *kvstore.TypedStore[iotago.Version, *types.Tuple[iotago.EpochIndex, iotago.Identifier]] storeProtocolParameters *kvstore.TypedStore[iotago.Version, iotago.ProtocolParameters] @@ -235,30 +236,18 @@ func (s *Settings) StoreFutureProtocolParametersHash(version iotago.Version, has } func (s *Settings) IsSnapshotImported() bool { - s.mutex.RLock() - defer s.mutex.RUnlock() - return lo.PanicOnErr(s.storeSnapshotImported.Has()) } func (s *Settings) SetSnapshotImported() (err error) { - s.mutex.Lock() - defer s.mutex.Unlock() - return s.storeSnapshotImported.Set(true) } func (s *Settings) LatestCommitment() *model.Commitment { - s.mutex.RLock() - defer s.mutex.RUnlock() - return s.latestCommitment() } func (s *Settings) SetLatestCommitment(latestCommitment *model.Commitment) (err error) { - s.mutex.Lock() - defer s.mutex.Unlock() - s.apiProvider.SetCommittedSlot(latestCommitment.Slot()) // Delete the old future protocol parameters if they exist. @@ -280,13 +269,6 @@ func (s *Settings) latestCommitment() *model.Commitment { return commitment } -func (s *Settings) LatestFinalizedSlot() iotago.SlotIndex { - s.mutex.RLock() - defer s.mutex.RUnlock() - - return s.latestFinalizedSlot() -} - func (s *Settings) SetLatestFinalizedSlot(slot iotago.SlotIndex) (err error) { s.mutex.Lock() defer s.mutex.Unlock() @@ -294,7 +276,7 @@ func (s *Settings) SetLatestFinalizedSlot(slot iotago.SlotIndex) (err error) { return s.storeLatestFinalizedSlot.Set(slot) } -func (s *Settings) latestFinalizedSlot() iotago.SlotIndex { +func (s *Settings) LatestFinalizedSlot() iotago.SlotIndex { latestFinalizedSlot, err := s.storeLatestFinalizedSlot.Get() if err != nil { if ierrors.Is(err, kvstore.ErrKeyNotFound) { @@ -307,22 +289,19 @@ func (s *Settings) latestFinalizedSlot() iotago.SlotIndex { } func (s *Settings) LatestStoredSlot() iotago.SlotIndex { - s.mutex.RLock() - defer s.mutex.RUnlock() - return read(s.storeLatestProcessedSlot) } func (s *Settings) SetLatestStoredSlot(slot iotago.SlotIndex) (err error) { - s.mutex.Lock() - defer s.mutex.Unlock() - return s.storeLatestProcessedSlot.Set(slot) } func (s *Settings) AdvanceLatestStoredSlot(slot iotago.SlotIndex) (err error) { - s.mutex.Lock() - defer s.mutex.Unlock() + // We don't need to advance the latest stored slot if it's already ahead of the given slot. + // We check this before Compute to avoid contention inside the TypedValue. + if s.LatestStoredSlot() >= slot { + return nil + } if _, err = s.storeLatestProcessedSlot.Compute(func(latestStoredSlot iotago.SlotIndex, _ bool) (newValue iotago.SlotIndex, err error) { if latestStoredSlot >= slot { @@ -338,9 +317,6 @@ func (s *Settings) AdvanceLatestStoredSlot(slot iotago.SlotIndex) (err error) { } func (s *Settings) LatestIssuedValidationBlock() *model.Block { - s.mutex.RLock() - defer s.mutex.RUnlock() - return read(s.storeLatestIssuedValidationBlock) } From 49a50ea4a9b27010a56e2255021dc2a76bd06e21 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 6 Dec 2023 09:04:05 +0000 Subject: [PATCH 06/30] fix insane parameters --- .../attestation/slotattestation/testframework_test.go | 6 +++++- .../seatmanager/topstakers/topstakers_test.go | 1 - .../sybilprotectionv1/performance/testsuite_test.go | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/protocol/engine/attestation/slotattestation/testframework_test.go b/pkg/protocol/engine/attestation/slotattestation/testframework_test.go index 624158d66..f99a5344f 100644 --- a/pkg/protocol/engine/attestation/slotattestation/testframework_test.go +++ b/pkg/protocol/engine/attestation/slotattestation/testframework_test.go @@ -69,7 +69,11 @@ func NewTestFramework(test *testing.T) *TestFramework { return accounts.SelectCommittee(members...), true } - t.testAPI = iotago.V3API(iotago.NewV3TestProtocolParameters()) + t.testAPI = iotago.V3API( + iotago.NewV3TestProtocolParameters( + iotago.WithLivenessOptions(5, 5, 1, 2, 8), + ), + ) t.apiProvider = iotago.SingleVersionProvider(t.testAPI) diff --git a/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go b/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go index 317a1e824..43b53a0c2 100644 --- a/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go +++ b/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go @@ -23,7 +23,6 @@ import ( func TestTopStakers_InitializeCommittee(t *testing.T) { var testAPI = iotago.V3API( iotago.NewV3TestProtocolParameters( - iotago.WithSupplyOptions(2_779_530_283_277_761, 0, 0, 0, 0, 0, 0), iotago.WithWorkScoreOptions(0, 1, 0, 0, 0, 0, 0, 0, 0, 0), // all zero except block offset gives all blocks workscore = 1 iotago.WithTargetCommitteeSize(3), ), diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go index 4e495332e..ab1150c36 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go @@ -42,6 +42,7 @@ func NewTestSuite(t *testing.T) *TestSuite { api: iotago.V3API( iotago.NewV3TestProtocolParameters( iotago.WithTimeProviderOptions(0, time.Now().Unix(), 10, 3), + iotago.WithLivenessOptions(5, 5, 1, 2, 3), iotago.WithRewardsOptions(8, 8, 11, 2, 1), ), ), From 782544445a02081cf76b323f8073368e3643696f Mon Sep 17 00:00:00 2001 From: Piotr Macek <4007944+piotrm50@users.noreply.github.com> Date: Wed, 6 Dec 2023 10:13:03 +0100 Subject: [PATCH 07/30] Remove lock for reading scheduler metrics. --- .../scheduler/drr/drrbuffer.go | 16 +++++++++------- .../scheduler/drr/scheduler.go | 19 ++----------------- .../scheduler/drr/validatorqueue.go | 10 +++++----- 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/pkg/protocol/engine/congestioncontrol/scheduler/drr/drrbuffer.go b/pkg/protocol/engine/congestioncontrol/scheduler/drr/drrbuffer.go index 40207e998..9bdafe155 100644 --- a/pkg/protocol/engine/congestioncontrol/scheduler/drr/drrbuffer.go +++ b/pkg/protocol/engine/congestioncontrol/scheduler/drr/drrbuffer.go @@ -5,6 +5,8 @@ import ( "math" "time" + "go.uber.org/atomic" + "github.com/iotaledger/hive.go/ds/shrinkingmap" "github.com/iotaledger/hive.go/lo" "github.com/iotaledger/iota-core/pkg/protocol/engine/blocks" @@ -19,7 +21,7 @@ type BufferQueue struct { activeIssuers *shrinkingmap.ShrinkingMap[iotago.AccountID, *ring.Ring] ring *ring.Ring // size is the number of blocks in the buffer. - size int + size atomic.Int64 tokenBucket float64 lastScheduleTime time.Time @@ -57,7 +59,7 @@ func (b *BufferQueue) Clear() { // Size returns the total number of blocks in BufferQueue. func (b *BufferQueue) Size() int { - return b.size + return int(b.size.Load()) } // IssuerQueue returns the queue for the corresponding issuer. @@ -125,7 +127,7 @@ func (b *BufferQueue) RemoveIssuerQueue(issuerID iotago.AccountID) { if !isIQ { panic("buffer contains elements that are not issuer queues") } - b.size -= issuerQueue.Size() + b.size.Sub(int64(issuerQueue.Size())) b.ringRemove(element) b.activeIssuers.Delete(issuerID) @@ -156,7 +158,7 @@ func (b *BufferQueue) Submit(blk *blocks.Block, issuerQueue *IssuerQueue, quantu return nil, false } - b.size++ + b.size.Inc() // if max buffer size exceeded, drop from tail of the longest mana-scaled queue if b.Size() > maxBuffer { @@ -180,7 +182,7 @@ func (b *BufferQueue) Unsubmit(block *blocks.Block) bool { return false } - b.size-- + b.size.Dec() return true } @@ -268,7 +270,7 @@ func (b *BufferQueue) PopFront() *blocks.Block { } - b.size-- + b.size.Dec() return block } @@ -298,7 +300,7 @@ func (b *BufferQueue) dropTail(quantumFunc func(iotago.AccountID) Deficit, maxBu maxIssuerID := b.longestQueueIssuerID(quantumFunc) if longestQueue := b.IssuerQueue(maxIssuerID); longestQueue != nil { if tail := longestQueue.RemoveTail(); tail != nil { - b.size-- + b.size.Dec() droppedBlocks = append(droppedBlocks, tail) } } diff --git a/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go b/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go index 3bc5ac351..cb9a1da1c 100644 --- a/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go +++ b/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go @@ -171,25 +171,16 @@ func (s *Scheduler) Start() { // IssuerQueueBlockCount returns the number of blocks in the queue of the given issuer. func (s *Scheduler) IssuerQueueBlockCount(issuerID iotago.AccountID) int { - s.bufferMutex.RLock() - defer s.bufferMutex.RUnlock() - return s.basicBuffer.IssuerQueueBlockCount(issuerID) } // IssuerQueueWork returns the queue size of the given issuer in work units. func (s *Scheduler) IssuerQueueWork(issuerID iotago.AccountID) iotago.WorkScore { - s.bufferMutex.RLock() - defer s.bufferMutex.RUnlock() - return s.basicBuffer.IssuerQueueWork(issuerID) } // ValidatorQueueBlockCount returns the number of validation blocks in the validator queue of the given issuer. func (s *Scheduler) ValidatorQueueBlockCount(issuerID iotago.AccountID) int { - s.bufferMutex.RLock() - defer s.bufferMutex.RUnlock() - validatorQueue, exists := s.validatorBuffer.Get(issuerID) if !exists { return 0 @@ -198,18 +189,12 @@ func (s *Scheduler) ValidatorQueueBlockCount(issuerID iotago.AccountID) int { return validatorQueue.Size() } -// BufferSize returns the current buffer size of the Scheduler as block count. +// BasicBufferSize returns the current buffer size of the Scheduler as block count. func (s *Scheduler) BasicBufferSize() int { - s.bufferMutex.RLock() - defer s.bufferMutex.RUnlock() - return s.basicBuffer.Size() } func (s *Scheduler) ValidatorBufferSize() int { - s.bufferMutex.RLock() - defer s.bufferMutex.RUnlock() - return s.validatorBuffer.Size() } @@ -418,7 +403,7 @@ func (s *Scheduler) selectBlockToScheduleWithLocking() { s.validatorBuffer.buffer.ForEach(func(accountID iotago.AccountID, validatorQueue *ValidatorQueue) bool { if s.selectValidationBlockWithoutLocking(validatorQueue) { - s.validatorBuffer.size-- + s.validatorBuffer.size.Dec() } return true diff --git a/pkg/protocol/engine/congestioncontrol/scheduler/drr/validatorqueue.go b/pkg/protocol/engine/congestioncontrol/scheduler/drr/validatorqueue.go index 56542a0c8..f327ae556 100644 --- a/pkg/protocol/engine/congestioncontrol/scheduler/drr/validatorqueue.go +++ b/pkg/protocol/engine/congestioncontrol/scheduler/drr/validatorqueue.go @@ -176,7 +176,7 @@ func (q *ValidatorQueue) deductTokens(tokens float64) { type ValidatorBuffer struct { buffer *shrinkingmap.ShrinkingMap[iotago.AccountID, *ValidatorQueue] - size int + size atomic.Int64 } func NewValidatorBuffer() *ValidatorBuffer { @@ -190,7 +190,7 @@ func (b *ValidatorBuffer) Size() int { return 0 } - return b.size + return int(b.size.Load()) } func (b *ValidatorBuffer) Get(accountID iotago.AccountID) (*ValidatorQueue, bool) { @@ -208,10 +208,10 @@ func (b *ValidatorBuffer) Submit(block *blocks.Block, maxBuffer int) (*blocks.Bl } droppedBlock, submitted := validatorQueue.Submit(block, maxBuffer) if submitted { - b.size++ + b.size.Inc() } if droppedBlock != nil { - b.size-- + b.size.Dec() } return droppedBlock, submitted @@ -222,7 +222,7 @@ func (b *ValidatorBuffer) Delete(accountID iotago.AccountID) { if !exists { return } - b.size -= validatorQueue.Size() + b.size.Sub(int64(validatorQueue.Size())) b.buffer.Delete(accountID) } From b3974dcf582bdfed0596ad5b0459368f47d8ae86 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 6 Dec 2023 09:53:42 +0000 Subject: [PATCH 08/30] fix tests --- go.mod | 2 +- go.sum | 4 ++-- .../sybilprotection/seatmanager/topstakers/topstakers_test.go | 1 - tools/gendoc/go.mod | 2 +- tools/gendoc/go.sum | 4 ++-- tools/genesis-snapshot/go.mod | 2 +- tools/genesis-snapshot/go.sum | 4 ++-- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 15f0699a3..4612fa2fd 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 - github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da + github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559 github.com/labstack/echo/v4 v4.11.3 github.com/labstack/gommon v0.4.1 github.com/libp2p/go-libp2p v0.32.0 diff --git a/go.sum b/go.sum index 0dfb50318..c9c58caa2 100644 --- a/go.sum +++ b/go.sum @@ -307,8 +307,8 @@ github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 h1:+ozra github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221/go.mod h1:6cLX3gnhP0WL+Q+mf3/rIqfACe5fWKVR8luPXWh2xiY= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 h1:XdhojOpZ0t0pJFyNO0zlBogSAUrhEI67eCpTC9H6sGM= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665/go.mod h1:obK1N42oafGA7EH6zC4VX2fKh7jTa3WnIa9h1azfxq0= -github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da h1:oNgrEVzIa4613fN7Prw9RCePT1wIF5UB1MnhoV/ys4M= -github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= +github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559 h1:qCXtPHNkshYFS9DJZEV0WeJEkN50syEuhFZobJjAIbw= +github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= diff --git a/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go b/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go index 43b53a0c2..247a23126 100644 --- a/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go +++ b/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go @@ -75,7 +75,6 @@ func TestTopStakers_InitializeCommittee(t *testing.T) { func TestTopStakers_RotateCommittee(t *testing.T) { var testAPI = iotago.V3API( iotago.NewV3TestProtocolParameters( - iotago.WithSupplyOptions(2_779_530_283_277_761, 0, 0, 0, 0, 0, 0), iotago.WithWorkScoreOptions(0, 1, 0, 0, 0, 0, 0, 0, 0, 0), // all zero except block offset gives all blocks workscore = 1 iotago.WithTargetCommitteeSize(10), ), diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index 8568863ed..4b18fa073 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -71,7 +71,7 @@ require ( github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 // indirect github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 // indirect github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 // indirect - github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da // indirect + github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559 // indirect github.com/ipfs/boxo v0.13.1 // 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 11602051c..1de6c92f0 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.20231201123347-1c44b3f24221 h1:+ozra github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221/go.mod h1:6cLX3gnhP0WL+Q+mf3/rIqfACe5fWKVR8luPXWh2xiY= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 h1:XdhojOpZ0t0pJFyNO0zlBogSAUrhEI67eCpTC9H6sGM= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665/go.mod h1:obK1N42oafGA7EH6zC4VX2fKh7jTa3WnIa9h1azfxq0= -github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da h1:oNgrEVzIa4613fN7Prw9RCePT1wIF5UB1MnhoV/ys4M= -github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= +github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559 h1:qCXtPHNkshYFS9DJZEV0WeJEkN50syEuhFZobJjAIbw= +github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= 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 9b0f259af..89e6ab322 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-20231205131244-472357435a39 github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da + github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559 github.com/mr-tron/base58 v1.2.0 github.com/spf13/pflag v1.0.5 golang.org/x/crypto v0.16.0 diff --git a/tools/genesis-snapshot/go.sum b/tools/genesis-snapshot/go.sum index 16ec77a10..eadfe9072 100644 --- a/tools/genesis-snapshot/go.sum +++ b/tools/genesis-snapshot/go.sum @@ -52,8 +52,8 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-4723574 github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 h1:gatLNIqLC/MAR5qlj+413/y0LmyfKC0QL2BKXLniD0M= github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da h1:oNgrEVzIa4613fN7Prw9RCePT1wIF5UB1MnhoV/ys4M= -github.com/iotaledger/iota.go/v4 v4.0.0-20231205152647-c6d45e9076da/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= +github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559 h1:qCXtPHNkshYFS9DJZEV0WeJEkN50syEuhFZobJjAIbw= +github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= 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= From 2a02fb80701342b456043588eb1df5f9964f3e59 Mon Sep 17 00:00:00 2001 From: Piotr Macek <4007944+piotrm50@users.noreply.github.com> Date: Wed, 6 Dec 2023 12:47:44 +0100 Subject: [PATCH 09/30] Fix DebugAPI commitment graph generation --- components/debugapi/commitment.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/components/debugapi/commitment.go b/components/debugapi/commitment.go index 4319459c4..815d5319a 100644 --- a/components/debugapi/commitment.go +++ b/components/debugapi/commitment.go @@ -95,9 +95,17 @@ func prepareCommitmentGraph(g *graphviz.Graphviz, rootCommitment *protocol.Commi } func createNode(graph *cgraph.Graph, commitment *protocol.Commitment) (*cgraph.Node, error) { - node, err := graph.Node(fmt.Sprintf("%d: %s", commitment.ID().Slot(), commitment.ID().String()[:8])) + node, err := graph.CreateNode(fmt.Sprintf("%d-%s", commitment.ID().Slot(), commitment.ID().Identifier().String()[:8])) if err != nil { - return nil, ierrors.Wrapf(err, "could not create node %s", commitment.ID().String()[:8]) + return nil, ierrors.Wrapf(err, "could not retrieve node %s", commitment.ID().Identifier().String()[:8]) + } + if node != nil { + return node, nil + } + + node, err = graph.CreateNode(fmt.Sprintf("%d-%s", commitment.ID().Slot(), commitment.ID().Identifier().String()[:8])) + if err != nil { + return nil, ierrors.Wrapf(err, "could not create node %s", commitment.ID().Identifier().String()[:8]) } return node, nil From 2228ee212034eb77ebec2ac479b15b2346c777af Mon Sep 17 00:00:00 2001 From: Piotr Macek <4007944+piotrm50@users.noreply.github.com> Date: Wed, 6 Dec 2023 13:32:14 +0100 Subject: [PATCH 10/30] Upgrade hive.go --- go.mod | 30 +++++++++--------- go.sum | 60 +++++++++++++++++------------------ tools/gendoc/go.mod | 30 +++++++++--------- tools/gendoc/go.sum | 60 +++++++++++++++++------------------ tools/genesis-snapshot/go.mod | 26 +++++++-------- tools/genesis-snapshot/go.sum | 52 +++++++++++++++--------------- 6 files changed, 129 insertions(+), 129 deletions(-) diff --git a/go.mod b/go.mod index 9bd6b2427..b6a14e74a 100644 --- a/go.mod +++ b/go.mod @@ -10,20 +10,20 @@ require ( github.com/google/uuid v1.4.0 github.com/gorilla/websocket v1.5.1 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 - github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 - github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 - github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 + github.com/iotaledger/hive.go/ads v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/app v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/kvstore v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/log v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/logger v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 github.com/iotaledger/iota.go/v4 v4.0.0-20231204142547-416c9a87403d @@ -140,7 +140,7 @@ require ( github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect + github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pokt-network/smt v0.6.1 // indirect diff --git a/go.sum b/go.sum index 7a31029ce..a891318f8 100644 --- a/go.sum +++ b/go.sum @@ -275,34 +275,34 @@ github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJ github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 h1:dTrD7X2PTNgli6EbS4tV9qu3QAm/kBU3XaYZV2xdzys= github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7/go.mod h1:ZRdPu684P0fQ1z8sXz4dj9H5LWHhz4a9oCtvjunkSrw= -github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 h1:jxoBAPgC4I73pAwvEWI2IUCxiI1xN68IaFZ5WC1D3ek= -github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= -github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39 h1:B+SzeGOUyIROHfGjoYLJRPT/GL2u2X8pe3bS5avBbZc= -github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39/go.mod h1:+riYmeLApkLlj4+EpuJpEJAsj/KGfD7cqLGy7oTsPOM= -github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 h1:zv6hp2CsJikP2jdkOjngJmpUVjhC2UfiIFN6yGvo4jA= -github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 h1:qAIj5vpAojkrORpOflrUYJ6iFL4osUkyP6Vr7/WK9BI= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= -github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 h1:5lXV8tI2PlMWraa9eT5xGasNdiMaAYd1159mzXdX1xM= -github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= -github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 h1:axE2+FtJQpAQ40KerOISEzHndqv79h7zYs8NZ7r0jNQ= -github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 h1:KpHT3dYj+WoFnAzkW4EPluWHuhzErTree0+AF/KVBTU= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= -github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 h1:Gp2h+Els9cTVYYnYsHX3zLuixb0XggIj2okK570aKww= -github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= -github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 h1:Di2G2i/hGyhe3D8j/MsnZqnx1yJBiMdbXDIrtbWpe8g= -github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= -github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 h1:kYj16hPQ0iH+1srDaIj4wZCGH5qrhsFpHkLbh3Ob1Bs= -github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= -github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39 h1:m4b7gNQu1HI+LH1m0oAvuFnpp7/EC/iPGHK7ImWNk3w= -github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39/go.mod h1:w1psHM2MuKsen1WdsPKrpqElYH7ZOQ+YdQIgJZg4HTo= -github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 h1:O6tJNVV544ts/DKIIfHQJNGXIPZgntR1DJ4e+jPR9rQ= -github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 h1:GPa5qfHm59jqY3pff0eCnt/mpWFm6fibVK/n/E+Pfyk= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= -github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 h1:gatLNIqLC/MAR5qlj+413/y0LmyfKC0QL2BKXLniD0M= -github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/hive.go/ads v0.0.0-20231206114953-6a65a82e30ad h1:Sy6PPo5TWnWeZ3vdIf6NSvZ1RUf05IHY14oDvqD8rcY= +github.com/iotaledger/hive.go/ads v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:okMn9dNDf6jn46o72P3e55XCQObLNkzujM2abNXqW8E= +github.com/iotaledger/hive.go/app v0.0.0-20231206114953-6a65a82e30ad h1:v7dkbVLSsmzgOWT2vjvv1MdKQXvqFbvIkx8mvh6VK7g= +github.com/iotaledger/hive.go/app v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:hTHKGFbZnuiW8yEgDuuL7ZjQTCnl8bXyHLmj3LPa648= +github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad h1:4XL7IIvdsWHxSKQfU+sgq3H9egN54053LF9TwMfDcTg= +github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad h1:iNzb/Oy/nucIOXOzRcwSqqFsaeKwr2JZpZYSLp8xjlE= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad/go.mod h1:CO28KMA6Pp5LJPiigPQQ276zQofES+jMod08U5pyRFA= +github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad h1:pUL2UZbF4S8FIV7uKo9p+IGfZ658K1VNorQ6rzDMRvs= +github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:7vHoF//1Pt3nu0l8nDIw7bEgv2GfbL3kSgjp7Rdqhd4= +github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad h1:adLrD6dOEkM5Xdg6AOPt9/HYqy/pQ5FrprDpW4/VqUU= +github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:NmZRIoxtL6iQdVK6n5W+JOx58K/0Yn8k7WuSvpKPQ+M= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad h1:WDl58zJKHfwbzHs+ZB8Jq3YNgVQE5Neu2NeaX3FZuyU= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/kvstore v0.0.0-20231206114953-6a65a82e30ad h1:XD4VvKVwDfsXVUWCIEXMzW3zkNdYTBqUPu+3Z7CwfZY= +github.com/iotaledger/hive.go/kvstore v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:8t45SAcTjQfF+zcFERtSRKy16u/gSquTfOtoSdCeyq4= +github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad h1:qpCsjw+InLL824QPu3lY/osck4DhucBKhCs5/E8OH+A= +github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:ETXGXymFyNcUq2t4I9e7ZK18f9bxUWYat4pjZ9W0rWc= +github.com/iotaledger/hive.go/log v0.0.0-20231206114953-6a65a82e30ad h1:S46YvLM8TPjYTELNyeSeVIiqllR873lYxkEUvSqZtIc= +github.com/iotaledger/hive.go/log v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:Td3R6QmYw0svZI1GuZ/tN9s0VNaHassXSKLCc70aX9w= +github.com/iotaledger/hive.go/logger v0.0.0-20231206114953-6a65a82e30ad h1:fazCxogqOLDEPNDPWYDLTDpYmwgTJgIaC2Z6VN52S4M= +github.com/iotaledger/hive.go/logger v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:hVaVODS+Uik0obf3SVEHFQNruUko/uqIgD/GKwhn49M= +github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad h1:HpupWK8iqFt+Sdogkh2/N8ojalmevYy+FzhjOuy7Y7E= +github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:Z9NFsByMh1Kf98f3v3ifeZRycbS2db1hjswTQG1MxnE= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad h1:c8uwbBZDqpiCNN9/9Jji7Z4lL0GdVnORp8WMouiuknk= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= +github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad h1:VC3OgdSbyngY7/gxVj66fKd/nGmN6P0/myr348nx7vA= +github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 h1:+ozrau44uPy2kYv2fuj2Wks8+VkXR62WB9zONOJgzdE= github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221/go.mod h1:6cLX3gnhP0WL+Q+mf3/rIqfACe5fWKVR8luPXWh2xiY= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 h1:XdhojOpZ0t0pJFyNO0zlBogSAUrhEI67eCpTC9H6sGM= @@ -521,8 +521,8 @@ github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAv github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc h1:8bQZVK1X6BJR/6nYUPxQEP+ReTsceJTKizeuwjWOPUA= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= +github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index a5ba98a30..bb96824a1 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -5,7 +5,7 @@ go 1.21 replace github.com/iotaledger/iota-core => ../../ require ( - github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39 + github.com/iotaledger/hive.go/app v0.0.0-20231206114953-6a65a82e30ad github.com/iotaledger/hive.go/apputils v0.0.0-20230829152614-7afc7a4d89b3 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 ) @@ -56,19 +56,19 @@ require ( github.com/huin/goupnp v1.3.0 // indirect github.com/iancoleman/orderedmap v0.3.0 // indirect github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 // indirect - github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/ads v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/kvstore v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/log v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/logger v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad // indirect github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 // indirect github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 // indirect github.com/iotaledger/iota.go/v4 v4.0.0-20231204142547-416c9a87403d // indirect @@ -131,7 +131,7 @@ require ( github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect + github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pokt-network/smt v0.6.1 // indirect github.com/polydawn/refmt v0.89.0 // indirect diff --git a/tools/gendoc/go.sum b/tools/gendoc/go.sum index 09a38ec6e..b07f9c7c0 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -277,36 +277,36 @@ github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJ github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 h1:dTrD7X2PTNgli6EbS4tV9qu3QAm/kBU3XaYZV2xdzys= github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7/go.mod h1:ZRdPu684P0fQ1z8sXz4dj9H5LWHhz4a9oCtvjunkSrw= -github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 h1:jxoBAPgC4I73pAwvEWI2IUCxiI1xN68IaFZ5WC1D3ek= -github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= -github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39 h1:B+SzeGOUyIROHfGjoYLJRPT/GL2u2X8pe3bS5avBbZc= -github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39/go.mod h1:+riYmeLApkLlj4+EpuJpEJAsj/KGfD7cqLGy7oTsPOM= +github.com/iotaledger/hive.go/ads v0.0.0-20231206114953-6a65a82e30ad h1:Sy6PPo5TWnWeZ3vdIf6NSvZ1RUf05IHY14oDvqD8rcY= +github.com/iotaledger/hive.go/ads v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:okMn9dNDf6jn46o72P3e55XCQObLNkzujM2abNXqW8E= +github.com/iotaledger/hive.go/app v0.0.0-20231206114953-6a65a82e30ad h1:v7dkbVLSsmzgOWT2vjvv1MdKQXvqFbvIkx8mvh6VK7g= +github.com/iotaledger/hive.go/app v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:hTHKGFbZnuiW8yEgDuuL7ZjQTCnl8bXyHLmj3LPa648= github.com/iotaledger/hive.go/apputils v0.0.0-20230829152614-7afc7a4d89b3 h1:4aVJTc0KS77uEw0Tny4r0n1ORwcbAQDECaCclgf/6lE= github.com/iotaledger/hive.go/apputils v0.0.0-20230829152614-7afc7a4d89b3/go.mod h1:TZeAqieDu+xDOZp2e9+S+8pZp1PrfgcwLUnxmd8IgLU= -github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 h1:zv6hp2CsJikP2jdkOjngJmpUVjhC2UfiIFN6yGvo4jA= -github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 h1:qAIj5vpAojkrORpOflrUYJ6iFL4osUkyP6Vr7/WK9BI= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= -github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 h1:5lXV8tI2PlMWraa9eT5xGasNdiMaAYd1159mzXdX1xM= -github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= -github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 h1:axE2+FtJQpAQ40KerOISEzHndqv79h7zYs8NZ7r0jNQ= -github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 h1:KpHT3dYj+WoFnAzkW4EPluWHuhzErTree0+AF/KVBTU= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= -github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 h1:Gp2h+Els9cTVYYnYsHX3zLuixb0XggIj2okK570aKww= -github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= -github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 h1:Di2G2i/hGyhe3D8j/MsnZqnx1yJBiMdbXDIrtbWpe8g= -github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= -github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 h1:kYj16hPQ0iH+1srDaIj4wZCGH5qrhsFpHkLbh3Ob1Bs= -github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= -github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39 h1:m4b7gNQu1HI+LH1m0oAvuFnpp7/EC/iPGHK7ImWNk3w= -github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39/go.mod h1:w1psHM2MuKsen1WdsPKrpqElYH7ZOQ+YdQIgJZg4HTo= -github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 h1:O6tJNVV544ts/DKIIfHQJNGXIPZgntR1DJ4e+jPR9rQ= -github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 h1:GPa5qfHm59jqY3pff0eCnt/mpWFm6fibVK/n/E+Pfyk= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= -github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 h1:gatLNIqLC/MAR5qlj+413/y0LmyfKC0QL2BKXLniD0M= -github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad h1:4XL7IIvdsWHxSKQfU+sgq3H9egN54053LF9TwMfDcTg= +github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad h1:iNzb/Oy/nucIOXOzRcwSqqFsaeKwr2JZpZYSLp8xjlE= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad/go.mod h1:CO28KMA6Pp5LJPiigPQQ276zQofES+jMod08U5pyRFA= +github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad h1:pUL2UZbF4S8FIV7uKo9p+IGfZ658K1VNorQ6rzDMRvs= +github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:7vHoF//1Pt3nu0l8nDIw7bEgv2GfbL3kSgjp7Rdqhd4= +github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad h1:adLrD6dOEkM5Xdg6AOPt9/HYqy/pQ5FrprDpW4/VqUU= +github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:NmZRIoxtL6iQdVK6n5W+JOx58K/0Yn8k7WuSvpKPQ+M= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad h1:WDl58zJKHfwbzHs+ZB8Jq3YNgVQE5Neu2NeaX3FZuyU= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/kvstore v0.0.0-20231206114953-6a65a82e30ad h1:XD4VvKVwDfsXVUWCIEXMzW3zkNdYTBqUPu+3Z7CwfZY= +github.com/iotaledger/hive.go/kvstore v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:8t45SAcTjQfF+zcFERtSRKy16u/gSquTfOtoSdCeyq4= +github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad h1:qpCsjw+InLL824QPu3lY/osck4DhucBKhCs5/E8OH+A= +github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:ETXGXymFyNcUq2t4I9e7ZK18f9bxUWYat4pjZ9W0rWc= +github.com/iotaledger/hive.go/log v0.0.0-20231206114953-6a65a82e30ad h1:S46YvLM8TPjYTELNyeSeVIiqllR873lYxkEUvSqZtIc= +github.com/iotaledger/hive.go/log v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:Td3R6QmYw0svZI1GuZ/tN9s0VNaHassXSKLCc70aX9w= +github.com/iotaledger/hive.go/logger v0.0.0-20231206114953-6a65a82e30ad h1:fazCxogqOLDEPNDPWYDLTDpYmwgTJgIaC2Z6VN52S4M= +github.com/iotaledger/hive.go/logger v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:hVaVODS+Uik0obf3SVEHFQNruUko/uqIgD/GKwhn49M= +github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad h1:HpupWK8iqFt+Sdogkh2/N8ojalmevYy+FzhjOuy7Y7E= +github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:Z9NFsByMh1Kf98f3v3ifeZRycbS2db1hjswTQG1MxnE= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad h1:c8uwbBZDqpiCNN9/9Jji7Z4lL0GdVnORp8WMouiuknk= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= +github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad h1:VC3OgdSbyngY7/gxVj66fKd/nGmN6P0/myr348nx7vA= +github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 h1:+ozrau44uPy2kYv2fuj2Wks8+VkXR62WB9zONOJgzdE= github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221/go.mod h1:6cLX3gnhP0WL+Q+mf3/rIqfACe5fWKVR8luPXWh2xiY= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 h1:XdhojOpZ0t0pJFyNO0zlBogSAUrhEI67eCpTC9H6sGM= @@ -525,8 +525,8 @@ github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAv github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc h1:8bQZVK1X6BJR/6nYUPxQEP+ReTsceJTKizeuwjWOPUA= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= +github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/tools/genesis-snapshot/go.mod b/tools/genesis-snapshot/go.mod index 7d9bebabd..4611c5595 100644 --- a/tools/genesis-snapshot/go.mod +++ b/tools/genesis-snapshot/go.mod @@ -5,10 +5,10 @@ go 1.21 replace github.com/iotaledger/iota-core => ../../ require ( - github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 + github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 github.com/iotaledger/iota.go/v4 v4.0.0-20231204142547-416c9a87403d github.com/mr-tron/base58 v1.2.0 @@ -26,14 +26,14 @@ require ( github.com/holiman/uint256 v1.2.4 // indirect github.com/iancoleman/orderedmap v0.3.0 // indirect github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 // indirect - github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/ads v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/kvstore v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/log v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/kr/text v0.2.0 // indirect @@ -50,7 +50,7 @@ require ( github.com/otiai10/copy v1.14.0 // indirect github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect + github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pokt-network/smt v0.6.1 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect diff --git a/tools/genesis-snapshot/go.sum b/tools/genesis-snapshot/go.sum index ccad4de99..8ff9ca34a 100644 --- a/tools/genesis-snapshot/go.sum +++ b/tools/genesis-snapshot/go.sum @@ -28,30 +28,30 @@ github.com/iancoleman/orderedmap v0.3.0 h1:5cbR2grmZR/DiVt+VJopEhtVs9YGInGIxAoMJ github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJDkXXS7VoV7XGE= github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 h1:dTrD7X2PTNgli6EbS4tV9qu3QAm/kBU3XaYZV2xdzys= github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7/go.mod h1:ZRdPu684P0fQ1z8sXz4dj9H5LWHhz4a9oCtvjunkSrw= -github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 h1:jxoBAPgC4I73pAwvEWI2IUCxiI1xN68IaFZ5WC1D3ek= -github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= -github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 h1:zv6hp2CsJikP2jdkOjngJmpUVjhC2UfiIFN6yGvo4jA= -github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 h1:qAIj5vpAojkrORpOflrUYJ6iFL4osUkyP6Vr7/WK9BI= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= -github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 h1:5lXV8tI2PlMWraa9eT5xGasNdiMaAYd1159mzXdX1xM= -github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= -github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 h1:axE2+FtJQpAQ40KerOISEzHndqv79h7zYs8NZ7r0jNQ= -github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 h1:KpHT3dYj+WoFnAzkW4EPluWHuhzErTree0+AF/KVBTU= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= -github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 h1:Gp2h+Els9cTVYYnYsHX3zLuixb0XggIj2okK570aKww= -github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= -github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 h1:Di2G2i/hGyhe3D8j/MsnZqnx1yJBiMdbXDIrtbWpe8g= -github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= -github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 h1:kYj16hPQ0iH+1srDaIj4wZCGH5qrhsFpHkLbh3Ob1Bs= -github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= -github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 h1:O6tJNVV544ts/DKIIfHQJNGXIPZgntR1DJ4e+jPR9rQ= -github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 h1:GPa5qfHm59jqY3pff0eCnt/mpWFm6fibVK/n/E+Pfyk= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= -github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 h1:gatLNIqLC/MAR5qlj+413/y0LmyfKC0QL2BKXLniD0M= -github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/hive.go/ads v0.0.0-20231206114953-6a65a82e30ad h1:Sy6PPo5TWnWeZ3vdIf6NSvZ1RUf05IHY14oDvqD8rcY= +github.com/iotaledger/hive.go/ads v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:okMn9dNDf6jn46o72P3e55XCQObLNkzujM2abNXqW8E= +github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad h1:4XL7IIvdsWHxSKQfU+sgq3H9egN54053LF9TwMfDcTg= +github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad h1:iNzb/Oy/nucIOXOzRcwSqqFsaeKwr2JZpZYSLp8xjlE= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad/go.mod h1:CO28KMA6Pp5LJPiigPQQ276zQofES+jMod08U5pyRFA= +github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad h1:pUL2UZbF4S8FIV7uKo9p+IGfZ658K1VNorQ6rzDMRvs= +github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:7vHoF//1Pt3nu0l8nDIw7bEgv2GfbL3kSgjp7Rdqhd4= +github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad h1:adLrD6dOEkM5Xdg6AOPt9/HYqy/pQ5FrprDpW4/VqUU= +github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:NmZRIoxtL6iQdVK6n5W+JOx58K/0Yn8k7WuSvpKPQ+M= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad h1:WDl58zJKHfwbzHs+ZB8Jq3YNgVQE5Neu2NeaX3FZuyU= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/kvstore v0.0.0-20231206114953-6a65a82e30ad h1:XD4VvKVwDfsXVUWCIEXMzW3zkNdYTBqUPu+3Z7CwfZY= +github.com/iotaledger/hive.go/kvstore v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:8t45SAcTjQfF+zcFERtSRKy16u/gSquTfOtoSdCeyq4= +github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad h1:qpCsjw+InLL824QPu3lY/osck4DhucBKhCs5/E8OH+A= +github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:ETXGXymFyNcUq2t4I9e7ZK18f9bxUWYat4pjZ9W0rWc= +github.com/iotaledger/hive.go/log v0.0.0-20231206114953-6a65a82e30ad h1:S46YvLM8TPjYTELNyeSeVIiqllR873lYxkEUvSqZtIc= +github.com/iotaledger/hive.go/log v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:Td3R6QmYw0svZI1GuZ/tN9s0VNaHassXSKLCc70aX9w= +github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad h1:HpupWK8iqFt+Sdogkh2/N8ojalmevYy+FzhjOuy7Y7E= +github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:Z9NFsByMh1Kf98f3v3ifeZRycbS2db1hjswTQG1MxnE= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad h1:c8uwbBZDqpiCNN9/9Jji7Z4lL0GdVnORp8WMouiuknk= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= +github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad h1:VC3OgdSbyngY7/gxVj66fKd/nGmN6P0/myr348nx7vA= +github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= github.com/iotaledger/iota.go/v4 v4.0.0-20231204142547-416c9a87403d h1:MPklxa8jW4/EgDm/LEzf6orxjik7U+vMUW/ToGT1Zqg= github.com/iotaledger/iota.go/v4 v4.0.0-20231204142547-416c9a87403d/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= @@ -93,8 +93,8 @@ github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c/go.mod h1:1iCZ0433 github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc h1:8bQZVK1X6BJR/6nYUPxQEP+ReTsceJTKizeuwjWOPUA= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= +github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pokt-network/smt v0.6.1 h1:u5yTGNNND6edXv3vMQrAcjku1Ig4osehdu+EMYSXHUU= From f1ebea686091b1a58a47783deb911657db2637be Mon Sep 17 00:00:00 2001 From: muXxer Date: Wed, 6 Dec 2023 14:06:13 +0100 Subject: [PATCH 11/30] Add UTXOChangesFull endpoints --- components/restapi/core/commitment.go | 30 +++++++++++ components/restapi/core/component.go | 39 +++++++++++++++ go.mod | 36 +++++++------- go.sum | 72 +++++++++++++-------------- 4 files changed, 123 insertions(+), 54 deletions(-) diff --git a/components/restapi/core/commitment.go b/components/restapi/core/commitment.go index 7b9a1cd8d..12912f0d9 100644 --- a/components/restapi/core/commitment.go +++ b/components/restapi/core/commitment.go @@ -76,3 +76,33 @@ func getUTXOChanges(commitmentID iotago.CommitmentID) (*api.UTXOChangesResponse, ConsumedOutputs: consumedOutputs, }, nil } + +func getUTXOChangesFull(commitmentID iotago.CommitmentID) (*api.UTXOChangesFullResponse, error) { + diffs, err := deps.Protocol.Engines.Main.Get().Ledger.SlotDiffs(commitmentID.Slot()) + if err != nil { + return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to get slot diffs, commitmentID: %s, slot: %d, error: %w", commitmentID, commitmentID.Slot(), err) + } + + createdOutputs := make([]*api.OutputWithID, len(diffs.Outputs)) + consumedOutputs := make([]*api.OutputWithID, len(diffs.Spents)) + + for i, output := range diffs.Outputs { + createdOutputs[i] = &api.OutputWithID{ + OutputID: output.OutputID(), + Output: output.Output(), + } + } + + for i, output := range diffs.Spents { + consumedOutputs[i] = &api.OutputWithID{ + OutputID: output.OutputID(), + Output: output.Output().Output(), + } + } + + return &api.UTXOChangesFullResponse{ + CommitmentID: commitmentID, + CreatedOutputs: createdOutputs, + ConsumedOutputs: consumedOutputs, + }, nil +} diff --git a/components/restapi/core/component.go b/components/restapi/core/component.go index 603b0d375..cd6104963 100644 --- a/components/restapi/core/component.go +++ b/components/restapi/core/component.go @@ -142,6 +142,26 @@ func configure() error { return responseByHeader(c, resp) }) + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointCommitmentByIDUTXOChangesFull), func(c echo.Context) error { + commitmentID, err := httpserver.ParseCommitmentIDParam(c, api.ParameterCommitmentID) + if err != nil { + return err + } + + // load the commitment to check if it matches the given commitmentID + commitment, err := getCommitmentByID(commitmentID) + if err != nil { + return err + } + + resp, err := getUTXOChangesFull(commitment.ID()) + if err != nil { + return err + } + + return responseByHeader(c, resp) + }) + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointCommitmentBySlot), func(c echo.Context) error { index, err := httpserver.ParseSlotParam(c, api.ParameterSlot) if err != nil { @@ -175,6 +195,25 @@ func configure() error { return responseByHeader(c, resp) }) + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointCommitmentBySlotUTXOChangesFull), func(c echo.Context) error { + slot, err := httpserver.ParseSlotParam(c, api.ParameterSlot) + if err != nil { + return err + } + + commitment, err := getCommitmentBySlot(slot) + if err != nil { + return err + } + + resp, err := getUTXOChangesFull(commitment.ID()) + if err != nil { + return err + } + + return responseByHeader(c, resp) + }) + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointOutput), func(c echo.Context) error { resp, err := outputByID(c) if err != nil { diff --git a/go.mod b/go.mod index 4612fa2fd..2295c1ea1 100644 --- a/go.mod +++ b/go.mod @@ -11,22 +11,22 @@ require ( github.com/gorilla/websocket v1.5.1 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 - github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 + github.com/iotaledger/hive.go/app v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 - github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 - github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 - github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559 + github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/log v0.0.0-20231206113509-4b4ff95ac61c + github.com/iotaledger/hive.go/logger v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231206124511-b78dc962031f + github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231206124145-f773dfe3927e + github.com/iotaledger/iota.go/v4 v4.0.0-20231206123921-2af411eef0b5 github.com/labstack/echo/v4 v4.11.3 github.com/labstack/gommon v0.4.1 github.com/libp2p/go-libp2p v0.32.0 @@ -140,7 +140,7 @@ require ( github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect + github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pokt-network/smt v0.6.1 // indirect @@ -155,7 +155,7 @@ require ( github.com/raulk/go-watchdog v1.3.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/spf13/cast v1.5.1 // indirect + github.com/spf13/cast v1.6.0 // indirect github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect @@ -175,7 +175,7 @@ require ( golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.4.0 // indirect + golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.14.0 // indirect gonum.org/v1/gonum v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect diff --git a/go.sum b/go.sum index c9c58caa2..ea71d4d30 100644 --- a/go.sum +++ b/go.sum @@ -277,38 +277,38 @@ github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 h1:dTrD7X2PT github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7/go.mod h1:ZRdPu684P0fQ1z8sXz4dj9H5LWHhz4a9oCtvjunkSrw= github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 h1:jxoBAPgC4I73pAwvEWI2IUCxiI1xN68IaFZ5WC1D3ek= github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= -github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39 h1:B+SzeGOUyIROHfGjoYLJRPT/GL2u2X8pe3bS5avBbZc= -github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39/go.mod h1:+riYmeLApkLlj4+EpuJpEJAsj/KGfD7cqLGy7oTsPOM= -github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 h1:zv6hp2CsJikP2jdkOjngJmpUVjhC2UfiIFN6yGvo4jA= -github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 h1:qAIj5vpAojkrORpOflrUYJ6iFL4osUkyP6Vr7/WK9BI= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= -github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 h1:5lXV8tI2PlMWraa9eT5xGasNdiMaAYd1159mzXdX1xM= -github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= -github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 h1:axE2+FtJQpAQ40KerOISEzHndqv79h7zYs8NZ7r0jNQ= -github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 h1:KpHT3dYj+WoFnAzkW4EPluWHuhzErTree0+AF/KVBTU= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/app v0.0.0-20231206114953-6a65a82e30ad h1:v7dkbVLSsmzgOWT2vjvv1MdKQXvqFbvIkx8mvh6VK7g= +github.com/iotaledger/hive.go/app v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:hTHKGFbZnuiW8yEgDuuL7ZjQTCnl8bXyHLmj3LPa648= +github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad h1:4XL7IIvdsWHxSKQfU+sgq3H9egN54053LF9TwMfDcTg= +github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad h1:iNzb/Oy/nucIOXOzRcwSqqFsaeKwr2JZpZYSLp8xjlE= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad/go.mod h1:CO28KMA6Pp5LJPiigPQQ276zQofES+jMod08U5pyRFA= +github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad h1:pUL2UZbF4S8FIV7uKo9p+IGfZ658K1VNorQ6rzDMRvs= +github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:7vHoF//1Pt3nu0l8nDIw7bEgv2GfbL3kSgjp7Rdqhd4= +github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad h1:adLrD6dOEkM5Xdg6AOPt9/HYqy/pQ5FrprDpW4/VqUU= +github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:NmZRIoxtL6iQdVK6n5W+JOx58K/0Yn8k7WuSvpKPQ+M= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad h1:WDl58zJKHfwbzHs+ZB8Jq3YNgVQE5Neu2NeaX3FZuyU= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 h1:Gp2h+Els9cTVYYnYsHX3zLuixb0XggIj2okK570aKww= github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= -github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 h1:Di2G2i/hGyhe3D8j/MsnZqnx1yJBiMdbXDIrtbWpe8g= -github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= -github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 h1:kYj16hPQ0iH+1srDaIj4wZCGH5qrhsFpHkLbh3Ob1Bs= -github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= -github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39 h1:m4b7gNQu1HI+LH1m0oAvuFnpp7/EC/iPGHK7ImWNk3w= -github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39/go.mod h1:w1psHM2MuKsen1WdsPKrpqElYH7ZOQ+YdQIgJZg4HTo= -github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 h1:O6tJNVV544ts/DKIIfHQJNGXIPZgntR1DJ4e+jPR9rQ= -github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 h1:GPa5qfHm59jqY3pff0eCnt/mpWFm6fibVK/n/E+Pfyk= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= -github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 h1:gatLNIqLC/MAR5qlj+413/y0LmyfKC0QL2BKXLniD0M= -github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 h1:+ozrau44uPy2kYv2fuj2Wks8+VkXR62WB9zONOJgzdE= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221/go.mod h1:6cLX3gnhP0WL+Q+mf3/rIqfACe5fWKVR8luPXWh2xiY= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 h1:XdhojOpZ0t0pJFyNO0zlBogSAUrhEI67eCpTC9H6sGM= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665/go.mod h1:obK1N42oafGA7EH6zC4VX2fKh7jTa3WnIa9h1azfxq0= -github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559 h1:qCXtPHNkshYFS9DJZEV0WeJEkN50syEuhFZobJjAIbw= -github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= +github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad h1:qpCsjw+InLL824QPu3lY/osck4DhucBKhCs5/E8OH+A= +github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:ETXGXymFyNcUq2t4I9e7ZK18f9bxUWYat4pjZ9W0rWc= +github.com/iotaledger/hive.go/log v0.0.0-20231206113509-4b4ff95ac61c h1:Ksts6VjPj9y0o2Nis+2tHtDGWITNJ4yju87ZlHLPuOo= +github.com/iotaledger/hive.go/log v0.0.0-20231206113509-4b4ff95ac61c/go.mod h1:Td3R6QmYw0svZI1GuZ/tN9s0VNaHassXSKLCc70aX9w= +github.com/iotaledger/hive.go/logger v0.0.0-20231206114953-6a65a82e30ad h1:fazCxogqOLDEPNDPWYDLTDpYmwgTJgIaC2Z6VN52S4M= +github.com/iotaledger/hive.go/logger v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:hVaVODS+Uik0obf3SVEHFQNruUko/uqIgD/GKwhn49M= +github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad h1:HpupWK8iqFt+Sdogkh2/N8ojalmevYy+FzhjOuy7Y7E= +github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:Z9NFsByMh1Kf98f3v3ifeZRycbS2db1hjswTQG1MxnE= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad h1:c8uwbBZDqpiCNN9/9Jji7Z4lL0GdVnORp8WMouiuknk= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= +github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad h1:VC3OgdSbyngY7/gxVj66fKd/nGmN6P0/myr348nx7vA= +github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231206124511-b78dc962031f h1:V68Ijq1A64gB9r0Rhc4ybLGH66rXqZ2Ly0L4uuaLrMg= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231206124511-b78dc962031f/go.mod h1:Dy3Gv4Dn1zufB177x6IXETP3zTeiWQ1+HMVQR0Bt/ew= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231206124145-f773dfe3927e h1:jbtiUlmTpTdGiRBW1pniPSqRcDMJaIW8fGS+uORryas= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231206124145-f773dfe3927e/go.mod h1:zEb9onVHnDUStl5SsFBj7H0HBKfIN0c/pUND8Llfqp8= +github.com/iotaledger/iota.go/v4 v4.0.0-20231206123921-2af411eef0b5 h1:0KgQFpVRnKd6CdCwXo3Kg/SL27xkeKh2SMoU5G1TkZk= +github.com/iotaledger/iota.go/v4 v4.0.0-20231206123921-2af411eef0b5/go.mod h1:tiswk1O1wSAi9GE6tD1j43+bLmWU9Je07aZLaJ0+Ha0= github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= @@ -521,8 +521,8 @@ github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAv github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc h1:8bQZVK1X6BJR/6nYUPxQEP+ReTsceJTKizeuwjWOPUA= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= +github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -623,8 +623,8 @@ github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:Udh github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= -github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -831,8 +831,8 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.4.0 h1:Z81tqI5ddIoXDPvVQ7/7CC9TnLM7ubaFG2qXYd5BbYY= -golang.org/x/time v0.4.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From d26a7fc0626c33e54626ac71b34e08bb516cc8b8 Mon Sep 17 00:00:00 2001 From: muXxer Date: Wed, 6 Dec 2023 14:16:05 +0100 Subject: [PATCH 12/30] Update inx-app and iota.go --- .../slotattestation/testframework_test.go | 2 +- .../pre_solid_block_filter_test.go | 8 +-- .../seatmanager/topstakers/topstakers_test.go | 4 +- .../performance/testsuite_test.go | 2 +- pkg/storage/testframework_test.go | 2 +- pkg/tests/upgrade_signaling_test.go | 2 +- .../depositcalculator_test.go | 2 +- pkg/testsuite/testsuite.go | 4 +- pkg/testsuite/testsuite_options.go | 2 +- tools/gendoc/go.mod | 36 +++++----- tools/gendoc/go.sum | 72 +++++++++---------- tools/genesis-snapshot/go.mod | 24 +++---- tools/genesis-snapshot/go.sum | 48 ++++++------- tools/genesis-snapshot/presets/presets.go | 12 ++-- 14 files changed, 110 insertions(+), 110 deletions(-) diff --git a/pkg/protocol/engine/attestation/slotattestation/testframework_test.go b/pkg/protocol/engine/attestation/slotattestation/testframework_test.go index f99a5344f..67e428c0d 100644 --- a/pkg/protocol/engine/attestation/slotattestation/testframework_test.go +++ b/pkg/protocol/engine/attestation/slotattestation/testframework_test.go @@ -70,7 +70,7 @@ func NewTestFramework(test *testing.T) *TestFramework { } t.testAPI = iotago.V3API( - iotago.NewV3TestProtocolParameters( + iotago.NewV3SnapshotProtocolParameters( iotago.WithLivenessOptions(5, 5, 1, 2, 8), ), ) diff --git a/pkg/protocol/engine/filter/presolidfilter/presolidblockfilter/pre_solid_block_filter_test.go b/pkg/protocol/engine/filter/presolidfilter/presolidblockfilter/pre_solid_block_filter_test.go index 8496ac6d6..b1e24307a 100644 --- a/pkg/protocol/engine/filter/presolidfilter/presolidblockfilter/pre_solid_block_filter_test.go +++ b/pkg/protocol/engine/filter/presolidfilter/presolidblockfilter/pre_solid_block_filter_test.go @@ -137,12 +137,12 @@ func TestFilter_ProtocolVersion(t *testing.T) { apiProvider := iotago.NewEpochBasedProvider( iotago.WithAPIForMissingVersionCallback( func(params iotago.ProtocolParameters) (iotago.API, error) { - return iotago.V3API(iotago.NewV3TestProtocolParameters(iotago.WithVersion(params.Version()))), nil + return iotago.V3API(iotago.NewV3SnapshotProtocolParameters(iotago.WithVersion(params.Version()))), nil }, ), ) - apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3TestProtocolParameters(iotago.WithVersion(3)), 0) - apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3TestProtocolParameters(iotago.WithVersion(4)), 3) + apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3SnapshotProtocolParameters(iotago.WithVersion(3)), 0) + apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3SnapshotProtocolParameters(iotago.WithVersion(4)), 3) timeProvider := apiProvider.CommittedAPI().TimeProvider() @@ -187,7 +187,7 @@ func TestFilter_ProtocolVersion(t *testing.T) { valid.Add("G") require.NoError(t, tf.IssueBlockAtSlotWithVersion("G", timeProvider.EpochStart(5)+5, 4, apiProvider)) - apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3TestProtocolParameters(iotago.WithVersion(5)), 10) + apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3SnapshotProtocolParameters(iotago.WithVersion(5)), 10) valid.Add("H") require.NoError(t, tf.IssueBlockAtSlotWithVersion("H", timeProvider.EpochEnd(9), 4, apiProvider)) diff --git a/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go b/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go index 247a23126..a45851b45 100644 --- a/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go +++ b/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go @@ -22,7 +22,7 @@ import ( func TestTopStakers_InitializeCommittee(t *testing.T) { var testAPI = iotago.V3API( - iotago.NewV3TestProtocolParameters( + iotago.NewV3SnapshotProtocolParameters( iotago.WithWorkScoreOptions(0, 1, 0, 0, 0, 0, 0, 0, 0, 0), // all zero except block offset gives all blocks workscore = 1 iotago.WithTargetCommitteeSize(3), ), @@ -74,7 +74,7 @@ func TestTopStakers_InitializeCommittee(t *testing.T) { func TestTopStakers_RotateCommittee(t *testing.T) { var testAPI = iotago.V3API( - iotago.NewV3TestProtocolParameters( + iotago.NewV3SnapshotProtocolParameters( iotago.WithWorkScoreOptions(0, 1, 0, 0, 0, 0, 0, 0, 0, 0), // all zero except block offset gives all blocks workscore = 1 iotago.WithTargetCommitteeSize(10), ), diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go index ab1150c36..77c48a11c 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go @@ -40,7 +40,7 @@ func NewTestSuite(t *testing.T) *TestSuite { poolRewards: make(map[iotago.EpochIndex]map[string]*model.PoolRewards), epochStats: make(map[iotago.EpochIndex]*model.PoolsStats), api: iotago.V3API( - iotago.NewV3TestProtocolParameters( + iotago.NewV3SnapshotProtocolParameters( iotago.WithTimeProviderOptions(0, time.Now().Unix(), 10, 3), iotago.WithLivenessOptions(5, 5, 1, 2, 3), iotago.WithRewardsOptions(8, 8, 11, 2, 1), diff --git a/pkg/storage/testframework_test.go b/pkg/storage/testframework_test.go index 896812abe..8495409bf 100644 --- a/pkg/storage/testframework_test.go +++ b/pkg/storage/testframework_test.go @@ -48,7 +48,7 @@ func NewTestFramework(t *testing.T, baseDir string, storageOpts ...options.Optio storageFactoryFunc := func() *storage.Storage { instance := storage.Create(baseDir, 0, errorHandler, storageOpts...) - require.NoError(t, instance.Settings().StoreProtocolParametersForStartEpoch(iotago.NewV3TestProtocolParameters(), 0)) + require.NoError(t, instance.Settings().StoreProtocolParametersForStartEpoch(iotago.NewV3SnapshotProtocolParameters(), 0)) return instance } diff --git a/pkg/tests/upgrade_signaling_test.go b/pkg/tests/upgrade_signaling_test.go index 23cca166f..a9d81f508 100644 --- a/pkg/tests/upgrade_signaling_test.go +++ b/pkg/tests/upgrade_signaling_test.go @@ -49,7 +49,7 @@ func Test_Upgrade_Signaling(t *testing.T) { defer ts.Shutdown() // We "pretend" to have version 5 but reuse the same protocol parameters as for version 3. - v5ProtocolParameters := iotago.NewV3TestProtocolParameters( + v5ProtocolParameters := iotago.NewV3SnapshotProtocolParameters( append( ts.ProtocolParameterOptions, iotago.WithVersion(5), diff --git a/pkg/testsuite/depositcalculator/depositcalculator_test.go b/pkg/testsuite/depositcalculator/depositcalculator_test.go index 9f8af3051..b93271fe3 100644 --- a/pkg/testsuite/depositcalculator/depositcalculator_test.go +++ b/pkg/testsuite/depositcalculator/depositcalculator_test.go @@ -13,7 +13,7 @@ import ( func TestCalculate(t *testing.T) { - protocolParams := iotago.NewV3TestProtocolParameters(iotago.WithVersion(3)) + protocolParams := iotago.NewV3SnapshotProtocolParameters(iotago.WithVersion(3)) storageScoreStructure := iotago.NewStorageScoreStructure(protocolParams.StorageScoreParameters()) type test struct { diff --git a/pkg/testsuite/testsuite.go b/pkg/testsuite/testsuite.go index 908b4d09b..ea2b2a315 100644 --- a/pkg/testsuite/testsuite.go +++ b/pkg/testsuite/testsuite.go @@ -97,8 +97,8 @@ func NewTestSuite(testingT *testing.T, opts ...options.Option[TestSuite]) *TestS }, opts, func(t *TestSuite) { fmt.Println("Setup TestSuite -", testingT.Name(), " @ ", time.Now()) - t.ProtocolParameterOptions = append(t.ProtocolParameterOptions, iotago.WithNetworkOptions(testingT.Name())) - t.API = iotago.V3API(iotago.NewV3TestProtocolParameters(t.ProtocolParameterOptions...)) + t.ProtocolParameterOptions = append(t.ProtocolParameterOptions, iotago.WithNetworkOptions(testingT.Name(), iotago.PrefixTestnet)) + t.API = iotago.V3API(iotago.NewV3SnapshotProtocolParameters(t.ProtocolParameterOptions...)) genesisBlock := blocks.NewRootBlock(t.API.ProtocolParameters().GenesisBlockID(), iotago.NewEmptyCommitment(t.API).MustID(), time.Unix(t.API.ProtocolParameters().GenesisUnixTimestamp(), 0)) t.RegisterBlock("Genesis", genesisBlock) diff --git a/pkg/testsuite/testsuite_options.go b/pkg/testsuite/testsuite_options.go index 9ed58d5dc..79b4398f3 100644 --- a/pkg/testsuite/testsuite_options.go +++ b/pkg/testsuite/testsuite_options.go @@ -65,7 +65,7 @@ func durationFromEnvOrDefault(defaultDuration time.Duration, envKey string) time } var ( - defaultProtocolParams = iotago.NewV3TestProtocolParameters() + defaultProtocolParams = iotago.NewV3SnapshotProtocolParameters() DefaultSlotDurationInSeconds uint8 = defaultProtocolParams.SlotDurationInSeconds() DefaultSlotsPerEpochExponent uint8 = defaultProtocolParams.SlotsPerEpochExponent() diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index 4b18fa073..13874cbf0 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -5,7 +5,7 @@ go 1.21 replace github.com/iotaledger/iota-core => ../../ require ( - github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39 + github.com/iotaledger/hive.go/app v0.0.0-20231206114953-6a65a82e30ad github.com/iotaledger/hive.go/apputils v0.0.0-20230829152614-7afc7a4d89b3 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 ) @@ -57,21 +57,21 @@ require ( github.com/iancoleman/orderedmap v0.3.0 // indirect github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 // indirect github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad // indirect github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 // indirect - github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 // indirect - github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559 // indirect + github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/log v0.0.0-20231206113509-4b4ff95ac61c // indirect + github.com/iotaledger/hive.go/logger v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231206124511-b78dc962031f // indirect + github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231206124145-f773dfe3927e // indirect + github.com/iotaledger/iota.go/v4 v4.0.0-20231206123921-2af411eef0b5 // indirect github.com/ipfs/boxo v0.13.1 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect @@ -131,7 +131,7 @@ require ( github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect + github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pokt-network/smt v0.6.1 // indirect github.com/polydawn/refmt v0.89.0 // indirect @@ -146,7 +146,7 @@ require ( github.com/raulk/go-watchdog v1.3.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/spf13/cast v1.5.1 // indirect + github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect @@ -172,7 +172,7 @@ require ( golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.4.0 // indirect + golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.14.0 // indirect gonum.org/v1/gonum v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect diff --git a/tools/gendoc/go.sum b/tools/gendoc/go.sum index 1de6c92f0..3d2ccafdd 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -279,40 +279,40 @@ github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 h1:dTrD7X2PT github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7/go.mod h1:ZRdPu684P0fQ1z8sXz4dj9H5LWHhz4a9oCtvjunkSrw= github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 h1:jxoBAPgC4I73pAwvEWI2IUCxiI1xN68IaFZ5WC1D3ek= github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= -github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39 h1:B+SzeGOUyIROHfGjoYLJRPT/GL2u2X8pe3bS5avBbZc= -github.com/iotaledger/hive.go/app v0.0.0-20231205131244-472357435a39/go.mod h1:+riYmeLApkLlj4+EpuJpEJAsj/KGfD7cqLGy7oTsPOM= +github.com/iotaledger/hive.go/app v0.0.0-20231206114953-6a65a82e30ad h1:v7dkbVLSsmzgOWT2vjvv1MdKQXvqFbvIkx8mvh6VK7g= +github.com/iotaledger/hive.go/app v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:hTHKGFbZnuiW8yEgDuuL7ZjQTCnl8bXyHLmj3LPa648= github.com/iotaledger/hive.go/apputils v0.0.0-20230829152614-7afc7a4d89b3 h1:4aVJTc0KS77uEw0Tny4r0n1ORwcbAQDECaCclgf/6lE= github.com/iotaledger/hive.go/apputils v0.0.0-20230829152614-7afc7a4d89b3/go.mod h1:TZeAqieDu+xDOZp2e9+S+8pZp1PrfgcwLUnxmd8IgLU= -github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 h1:zv6hp2CsJikP2jdkOjngJmpUVjhC2UfiIFN6yGvo4jA= -github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 h1:qAIj5vpAojkrORpOflrUYJ6iFL4osUkyP6Vr7/WK9BI= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= -github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 h1:5lXV8tI2PlMWraa9eT5xGasNdiMaAYd1159mzXdX1xM= -github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= -github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 h1:axE2+FtJQpAQ40KerOISEzHndqv79h7zYs8NZ7r0jNQ= -github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 h1:KpHT3dYj+WoFnAzkW4EPluWHuhzErTree0+AF/KVBTU= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad h1:4XL7IIvdsWHxSKQfU+sgq3H9egN54053LF9TwMfDcTg= +github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad h1:iNzb/Oy/nucIOXOzRcwSqqFsaeKwr2JZpZYSLp8xjlE= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad/go.mod h1:CO28KMA6Pp5LJPiigPQQ276zQofES+jMod08U5pyRFA= +github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad h1:pUL2UZbF4S8FIV7uKo9p+IGfZ658K1VNorQ6rzDMRvs= +github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:7vHoF//1Pt3nu0l8nDIw7bEgv2GfbL3kSgjp7Rdqhd4= +github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad h1:adLrD6dOEkM5Xdg6AOPt9/HYqy/pQ5FrprDpW4/VqUU= +github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:NmZRIoxtL6iQdVK6n5W+JOx58K/0Yn8k7WuSvpKPQ+M= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad h1:WDl58zJKHfwbzHs+ZB8Jq3YNgVQE5Neu2NeaX3FZuyU= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 h1:Gp2h+Els9cTVYYnYsHX3zLuixb0XggIj2okK570aKww= github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= -github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 h1:Di2G2i/hGyhe3D8j/MsnZqnx1yJBiMdbXDIrtbWpe8g= -github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= -github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 h1:kYj16hPQ0iH+1srDaIj4wZCGH5qrhsFpHkLbh3Ob1Bs= -github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= -github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39 h1:m4b7gNQu1HI+LH1m0oAvuFnpp7/EC/iPGHK7ImWNk3w= -github.com/iotaledger/hive.go/logger v0.0.0-20231205131244-472357435a39/go.mod h1:w1psHM2MuKsen1WdsPKrpqElYH7ZOQ+YdQIgJZg4HTo= -github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 h1:O6tJNVV544ts/DKIIfHQJNGXIPZgntR1DJ4e+jPR9rQ= -github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 h1:GPa5qfHm59jqY3pff0eCnt/mpWFm6fibVK/n/E+Pfyk= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= -github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 h1:gatLNIqLC/MAR5qlj+413/y0LmyfKC0QL2BKXLniD0M= -github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221 h1:+ozrau44uPy2kYv2fuj2Wks8+VkXR62WB9zONOJgzdE= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231201123347-1c44b3f24221/go.mod h1:6cLX3gnhP0WL+Q+mf3/rIqfACe5fWKVR8luPXWh2xiY= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665 h1:XdhojOpZ0t0pJFyNO0zlBogSAUrhEI67eCpTC9H6sGM= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231201114846-3bb5c3fd5665/go.mod h1:obK1N42oafGA7EH6zC4VX2fKh7jTa3WnIa9h1azfxq0= -github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559 h1:qCXtPHNkshYFS9DJZEV0WeJEkN50syEuhFZobJjAIbw= -github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= +github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad h1:qpCsjw+InLL824QPu3lY/osck4DhucBKhCs5/E8OH+A= +github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:ETXGXymFyNcUq2t4I9e7ZK18f9bxUWYat4pjZ9W0rWc= +github.com/iotaledger/hive.go/log v0.0.0-20231206113509-4b4ff95ac61c h1:Ksts6VjPj9y0o2Nis+2tHtDGWITNJ4yju87ZlHLPuOo= +github.com/iotaledger/hive.go/log v0.0.0-20231206113509-4b4ff95ac61c/go.mod h1:Td3R6QmYw0svZI1GuZ/tN9s0VNaHassXSKLCc70aX9w= +github.com/iotaledger/hive.go/logger v0.0.0-20231206114953-6a65a82e30ad h1:fazCxogqOLDEPNDPWYDLTDpYmwgTJgIaC2Z6VN52S4M= +github.com/iotaledger/hive.go/logger v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:hVaVODS+Uik0obf3SVEHFQNruUko/uqIgD/GKwhn49M= +github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad h1:HpupWK8iqFt+Sdogkh2/N8ojalmevYy+FzhjOuy7Y7E= +github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:Z9NFsByMh1Kf98f3v3ifeZRycbS2db1hjswTQG1MxnE= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad h1:c8uwbBZDqpiCNN9/9Jji7Z4lL0GdVnORp8WMouiuknk= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= +github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad h1:VC3OgdSbyngY7/gxVj66fKd/nGmN6P0/myr348nx7vA= +github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231206124511-b78dc962031f h1:V68Ijq1A64gB9r0Rhc4ybLGH66rXqZ2Ly0L4uuaLrMg= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231206124511-b78dc962031f/go.mod h1:Dy3Gv4Dn1zufB177x6IXETP3zTeiWQ1+HMVQR0Bt/ew= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231206124145-f773dfe3927e h1:jbtiUlmTpTdGiRBW1pniPSqRcDMJaIW8fGS+uORryas= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231206124145-f773dfe3927e/go.mod h1:zEb9onVHnDUStl5SsFBj7H0HBKfIN0c/pUND8Llfqp8= +github.com/iotaledger/iota.go/v4 v4.0.0-20231206123921-2af411eef0b5 h1:0KgQFpVRnKd6CdCwXo3Kg/SL27xkeKh2SMoU5G1TkZk= +github.com/iotaledger/iota.go/v4 v4.0.0-20231206123921-2af411eef0b5/go.mod h1:tiswk1O1wSAi9GE6tD1j43+bLmWU9Je07aZLaJ0+Ha0= github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= @@ -525,8 +525,8 @@ github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAv github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc h1:8bQZVK1X6BJR/6nYUPxQEP+ReTsceJTKizeuwjWOPUA= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= +github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -627,8 +627,8 @@ github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:Udh github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= -github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -835,8 +835,8 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.4.0 h1:Z81tqI5ddIoXDPvVQ7/7CC9TnLM7ubaFG2qXYd5BbYY= -golang.org/x/time v0.4.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/tools/genesis-snapshot/go.mod b/tools/genesis-snapshot/go.mod index 89e6ab322..756d9ce51 100644 --- a/tools/genesis-snapshot/go.mod +++ b/tools/genesis-snapshot/go.mod @@ -5,12 +5,12 @@ go 1.21 replace github.com/iotaledger/iota-core => ../../ require ( - github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 - github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 + github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559 + github.com/iotaledger/iota.go/v4 v4.0.0-20231206123921-2af411eef0b5 github.com/mr-tron/base58 v1.2.0 github.com/spf13/pflag v1.0.5 golang.org/x/crypto v0.16.0 @@ -27,13 +27,13 @@ require ( github.com/iancoleman/orderedmap v0.3.0 // indirect github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 // indirect github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad // indirect github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 // indirect - github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 // indirect + github.com/iotaledger/hive.go/log v0.0.0-20231206113509-4b4ff95ac61c // indirect + github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/kr/text v0.2.0 // indirect @@ -50,7 +50,7 @@ require ( github.com/otiai10/copy v1.14.0 // indirect github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect + github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pokt-network/smt v0.6.1 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect diff --git a/tools/genesis-snapshot/go.sum b/tools/genesis-snapshot/go.sum index eadfe9072..578c00428 100644 --- a/tools/genesis-snapshot/go.sum +++ b/tools/genesis-snapshot/go.sum @@ -30,30 +30,30 @@ github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 h1:dTrD7X2PT github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7/go.mod h1:ZRdPu684P0fQ1z8sXz4dj9H5LWHhz4a9oCtvjunkSrw= github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39 h1:jxoBAPgC4I73pAwvEWI2IUCxiI1xN68IaFZ5WC1D3ek= github.com/iotaledger/hive.go/ads v0.0.0-20231205131244-472357435a39/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= -github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39 h1:zv6hp2CsJikP2jdkOjngJmpUVjhC2UfiIFN6yGvo4jA= -github.com/iotaledger/hive.go/constraints v0.0.0-20231205131244-472357435a39/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39 h1:qAIj5vpAojkrORpOflrUYJ6iFL4osUkyP6Vr7/WK9BI= -github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231205131244-472357435a39/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= -github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39 h1:5lXV8tI2PlMWraa9eT5xGasNdiMaAYd1159mzXdX1xM= -github.com/iotaledger/hive.go/crypto v0.0.0-20231205131244-472357435a39/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= -github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39 h1:axE2+FtJQpAQ40KerOISEzHndqv79h7zYs8NZ7r0jNQ= -github.com/iotaledger/hive.go/ds v0.0.0-20231205131244-472357435a39/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39 h1:KpHT3dYj+WoFnAzkW4EPluWHuhzErTree0+AF/KVBTU= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231205131244-472357435a39/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad h1:4XL7IIvdsWHxSKQfU+sgq3H9egN54053LF9TwMfDcTg= +github.com/iotaledger/hive.go/constraints v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad h1:iNzb/Oy/nucIOXOzRcwSqqFsaeKwr2JZpZYSLp8xjlE= +github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231206114953-6a65a82e30ad/go.mod h1:CO28KMA6Pp5LJPiigPQQ276zQofES+jMod08U5pyRFA= +github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad h1:pUL2UZbF4S8FIV7uKo9p+IGfZ658K1VNorQ6rzDMRvs= +github.com/iotaledger/hive.go/crypto v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:7vHoF//1Pt3nu0l8nDIw7bEgv2GfbL3kSgjp7Rdqhd4= +github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad h1:adLrD6dOEkM5Xdg6AOPt9/HYqy/pQ5FrprDpW4/VqUU= +github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:NmZRIoxtL6iQdVK6n5W+JOx58K/0Yn8k7WuSvpKPQ+M= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad h1:WDl58zJKHfwbzHs+ZB8Jq3YNgVQE5Neu2NeaX3FZuyU= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 h1:Gp2h+Els9cTVYYnYsHX3zLuixb0XggIj2okK570aKww= github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= -github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39 h1:Di2G2i/hGyhe3D8j/MsnZqnx1yJBiMdbXDIrtbWpe8g= -github.com/iotaledger/hive.go/lo v0.0.0-20231205131244-472357435a39/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= -github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39 h1:kYj16hPQ0iH+1srDaIj4wZCGH5qrhsFpHkLbh3Ob1Bs= -github.com/iotaledger/hive.go/log v0.0.0-20231205131244-472357435a39/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= -github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39 h1:O6tJNVV544ts/DKIIfHQJNGXIPZgntR1DJ4e+jPR9rQ= -github.com/iotaledger/hive.go/runtime v0.0.0-20231205131244-472357435a39/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39 h1:GPa5qfHm59jqY3pff0eCnt/mpWFm6fibVK/n/E+Pfyk= -github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231205131244-472357435a39/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= -github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39 h1:gatLNIqLC/MAR5qlj+413/y0LmyfKC0QL2BKXLniD0M= -github.com/iotaledger/hive.go/stringify v0.0.0-20231205131244-472357435a39/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559 h1:qCXtPHNkshYFS9DJZEV0WeJEkN50syEuhFZobJjAIbw= -github.com/iotaledger/iota.go/v4 v4.0.0-20231206094936-1d3d3ed96559/go.mod h1:lCk9rhP3B5pX9BKhzR+Jobq4xPd+GHlqgF4Ga+eQfWA= +github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad h1:qpCsjw+InLL824QPu3lY/osck4DhucBKhCs5/E8OH+A= +github.com/iotaledger/hive.go/lo v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:ETXGXymFyNcUq2t4I9e7ZK18f9bxUWYat4pjZ9W0rWc= +github.com/iotaledger/hive.go/log v0.0.0-20231206113509-4b4ff95ac61c h1:Ksts6VjPj9y0o2Nis+2tHtDGWITNJ4yju87ZlHLPuOo= +github.com/iotaledger/hive.go/log v0.0.0-20231206113509-4b4ff95ac61c/go.mod h1:Td3R6QmYw0svZI1GuZ/tN9s0VNaHassXSKLCc70aX9w= +github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad h1:HpupWK8iqFt+Sdogkh2/N8ojalmevYy+FzhjOuy7Y7E= +github.com/iotaledger/hive.go/runtime v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:Z9NFsByMh1Kf98f3v3ifeZRycbS2db1hjswTQG1MxnE= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad h1:c8uwbBZDqpiCNN9/9Jji7Z4lL0GdVnORp8WMouiuknk= +github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82e30ad/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= +github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad h1:VC3OgdSbyngY7/gxVj66fKd/nGmN6P0/myr348nx7vA= +github.com/iotaledger/hive.go/stringify v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/iota.go/v4 v4.0.0-20231206123921-2af411eef0b5 h1:0KgQFpVRnKd6CdCwXo3Kg/SL27xkeKh2SMoU5G1TkZk= +github.com/iotaledger/iota.go/v4 v4.0.0-20231206123921-2af411eef0b5/go.mod h1:tiswk1O1wSAi9GE6tD1j43+bLmWU9Je07aZLaJ0+Ha0= 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= @@ -93,8 +93,8 @@ github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c/go.mod h1:1iCZ0433 github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc h1:8bQZVK1X6BJR/6nYUPxQEP+ReTsceJTKizeuwjWOPUA= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= +github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pokt-network/smt v0.6.1 h1:u5yTGNNND6edXv3vMQrAcjku1Ig4osehdu+EMYSXHUU= diff --git a/tools/genesis-snapshot/presets/presets.go b/tools/genesis-snapshot/presets/presets.go index bfbd492a2..071477fca 100644 --- a/tools/genesis-snapshot/presets/presets.go +++ b/tools/genesis-snapshot/presets/presets.go @@ -15,18 +15,18 @@ import ( var ( // use defaults from iota.go - protocolParamsBase = iotago.NewV3TestProtocolParameters( - iotago.WithNetworkOptions("default"), + protocolParamsBase = iotago.NewV3SnapshotProtocolParameters( + iotago.WithNetworkOptions("default", iotago.PrefixTestnet), ) // use defaults from iota.go - protocolParamsDocker = iotago.NewV3TestProtocolParameters( - iotago.WithNetworkOptions("docker"), + protocolParamsDocker = iotago.NewV3SnapshotProtocolParameters( + iotago.WithNetworkOptions("docker", iotago.PrefixTestnet), ) // use defaults from iota.go - protocolParamsFeature = iotago.NewV3TestProtocolParameters( - iotago.WithNetworkOptions("feature"), + protocolParamsFeature = iotago.NewV3SnapshotProtocolParameters( + iotago.WithNetworkOptions("feature", iotago.PrefixTestnet), ) ) From 6adaa025e75baa1ed6756f271e5e5d663baa8f5b Mon Sep 17 00:00:00 2001 From: muXxer Date: Wed, 6 Dec 2023 14:19:37 +0100 Subject: [PATCH 13/30] Revert time provider option changes in presets --- tools/genesis-snapshot/presets/presets.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/genesis-snapshot/presets/presets.go b/tools/genesis-snapshot/presets/presets.go index 071477fca..a8e72f12e 100644 --- a/tools/genesis-snapshot/presets/presets.go +++ b/tools/genesis-snapshot/presets/presets.go @@ -1,6 +1,8 @@ package presets import ( + "time" + "golang.org/x/crypto/blake2b" "github.com/iotaledger/hive.go/crypto/ed25519" @@ -22,11 +24,13 @@ var ( // use defaults from iota.go protocolParamsDocker = iotago.NewV3SnapshotProtocolParameters( iotago.WithNetworkOptions("docker", iotago.PrefixTestnet), + iotago.WithTimeProviderOptions(5, time.Now().Unix(), 10, 13), ) // use defaults from iota.go protocolParamsFeature = iotago.NewV3SnapshotProtocolParameters( iotago.WithNetworkOptions("feature", iotago.PrefixTestnet), + iotago.WithTimeProviderOptions(666666, time.Now().Unix()-100_000, 10, 13), ) ) From 32a6b24ee2d8770ac95f060b780abd3ada09d2c7 Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Wed, 6 Dec 2023 16:09:15 +0800 Subject: [PATCH 14/30] Replace ChainSwitchingThreshold option in protocol with ProtocolParameter --- pkg/protocol/chains.go | 5 +++-- pkg/protocol/options.go | 14 +------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/pkg/protocol/chains.go b/pkg/protocol/chains.go index 9704fca55..97af7125f 100644 --- a/pkg/protocol/chains.go +++ b/pkg/protocol/chains.go @@ -55,7 +55,7 @@ func newChains(protocol *Protocol) *Chains { shutdown := lo.Batch( c.initLogger(protocol.NewChildLogger("Chains")), - c.initChainSwitching(protocol.Options.ChainSwitchingThreshold), + c.initChainSwitching(), protocol.Constructed.WithNonEmptyValue(func(_ bool) (shutdown func()) { return c.deriveLatestSeenSlot(protocol) @@ -92,7 +92,7 @@ func (c *Chains) initLogger(logger log.Logger, shutdownLogger func()) (shutdown } // initChainSwitching initializes the chain switching logic. -func (c *Chains) initChainSwitching(chainSwitchingThreshold iotago.SlotIndex) (shutdown func()) { +func (c *Chains) initChainSwitching() (shutdown func()) { mainChain := c.newChain() mainChain.StartEngine.Set(true) @@ -102,6 +102,7 @@ func (c *Chains) initChainSwitching(chainSwitchingThreshold iotago.SlotIndex) (s forkingPointBelowChainSwitchingThreshold := func(chain *Chain) func(_ *Commitment, latestCommitment *Commitment) bool { return func(_ *Commitment, latestCommitment *Commitment) bool { forkingPoint := chain.ForkingPoint.Get() + chainSwitchingThreshold := iotago.SlotIndex(c.protocol.APIForSlot(latestCommitment.Slot()).ProtocolParameters().ChainSwitchingThreshold()) return forkingPoint != nil && latestCommitment != nil && (latestCommitment.ID().Slot()-forkingPoint.ID().Slot()) > chainSwitchingThreshold } diff --git a/pkg/protocol/options.go b/pkg/protocol/options.go index ac9605bf8..c3b260923 100644 --- a/pkg/protocol/options.go +++ b/pkg/protocol/options.go @@ -51,10 +51,6 @@ type Options struct { // SnapshotPath is the path to the snapshot file that should be used to initialize the protocol. SnapshotPath string - // ChainSwitchingThreshold is the threshold that defines how far away a heavier chain needs to be from its forking - // point to be considered for switching. - ChainSwitchingThreshold iotago.SlotIndex - // EngineOptions contains the options for the Engines. EngineOptions []options.Option[engine.Engine] @@ -120,8 +116,7 @@ type Options struct { // NewDefaultOptions creates new default options instance for the Protocol. func NewDefaultOptions() *Options { return &Options{ - BaseDirectory: "", - ChainSwitchingThreshold: 3, + BaseDirectory: "", PreSolidFilterProvider: presolidblockfilter.NewProvider(), PostSolidFilterProvider: postsolidblockfilter.NewProvider(), @@ -157,13 +152,6 @@ func WithSnapshotPath(snapshot string) options.Option[Protocol] { } } -// WithChainSwitchingThreshold is an option for the Protocol that allows to set the chain switching threshold. -func WithChainSwitchingThreshold(threshold iotago.SlotIndex) options.Option[Protocol] { - return func(p *Protocol) { - p.Options.ChainSwitchingThreshold = threshold - } -} - // WithPreSolidFilterProvider is an option for the Protocol that allows to set the PreSolidFilterProvider. func WithPreSolidFilterProvider(optsFilterProvider module.Provider[*engine.Engine, presolidfilter.PreSolidFilter]) options.Option[Protocol] { return func(p *Protocol) { From c6249054419f72405c392697479d99a3b15f5a73 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 5 Dec 2023 18:18:58 +0100 Subject: [PATCH 15/30] Add LatestParentBlockIssuingTime to BlockIssuance endpoint --- components/restapi/core/blocks.go | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/components/restapi/core/blocks.go b/components/restapi/core/blocks.go index bab9de006..cd3b91bd0 100644 --- a/components/restapi/core/blocks.go +++ b/components/restapi/core/blocks.go @@ -1,6 +1,8 @@ package core import ( + "time" + "github.com/labstack/echo/v4" "github.com/iotaledger/hive.go/ierrors" @@ -84,12 +86,28 @@ func blockIssuance() (*api.IssuanceBlockHeaderResponse, error) { return nil, ierrors.Wrap(echo.ErrServiceUnavailable, "no strong parents available") } + // get the latest parent block issuing time + var latestParentBlockIssuingTime time.Time + for _, parentType := range []iotago.ParentsType{iotago.StrongParentType, iotago.WeakParentType, iotago.ShallowLikeParentType} { + for _, blockID := range references[parentType] { + block, exists := deps.Protocol.Engines.Main.Get().Block(blockID) + if !exists { + return nil, ierrors.Wrapf(echo.ErrNotFound, "no block found for parent, block ID: %s", blockID.ToHex()) + } + + if latestParentBlockIssuingTime.Before(block.ProtocolBlock().Header.IssuingTime) { + latestParentBlockIssuingTime = block.ProtocolBlock().Header.IssuingTime + } + } + } + resp := &api.IssuanceBlockHeaderResponse{ - StrongParents: references[iotago.StrongParentType], - WeakParents: references[iotago.WeakParentType], - ShallowLikeParents: references[iotago.ShallowLikeParentType], - LatestFinalizedSlot: deps.Protocol.Engines.Main.Get().SyncManager.LatestFinalizedSlot(), - LatestCommitment: deps.Protocol.Engines.Main.Get().SyncManager.LatestCommitment().Commitment(), + StrongParents: references[iotago.StrongParentType], + WeakParents: references[iotago.WeakParentType], + ShallowLikeParents: references[iotago.ShallowLikeParentType], + LatestParentBlockIssuingTime: latestParentBlockIssuingTime, + LatestFinalizedSlot: deps.Protocol.Engines.Main.Get().SyncManager.LatestFinalizedSlot(), + LatestCommitment: deps.Protocol.Engines.Main.Get().SyncManager.LatestCommitment().Commitment(), } return resp, nil From ee06784d321293389af36fef0d47fc8c6c8887e4 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Thu, 7 Dec 2023 10:49:18 +0100 Subject: [PATCH 16/30] Don't allocate empty values for performances --- .../sybilprotectionv1/performance/performance.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/performance.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/performance.go index 965c57562..f5b17b556 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/performance.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/performance.go @@ -212,7 +212,8 @@ func (t *Tracker) ApplyEpoch(epoch iotago.EpochIndex, committee *account.Account } committee.ForEach(func(accountID iotago.AccountID, pool *account.Pool) bool { - validatorPerformances := make([]*model.ValidatorPerformance, timeProvider.EpochDurationSlots()) + validatorPerformances := make([]*model.ValidatorPerformance, 0, timeProvider.EpochDurationSlots()) + for slot := epochStartSlot; slot <= epochEndSlot; slot++ { validatorSlotPerformances, err := t.validatorPerformancesFunc(slot) if err != nil { From fd445b99e4ad8c6e25462cbb5149f17491ff9328 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Thu, 7 Dec 2023 11:29:16 +0100 Subject: [PATCH 17/30] Implement validator test --- pkg/tests/validator_test.go | 221 ++++++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 pkg/tests/validator_test.go diff --git a/pkg/tests/validator_test.go b/pkg/tests/validator_test.go new file mode 100644 index 000000000..8e58d70e8 --- /dev/null +++ b/pkg/tests/validator_test.go @@ -0,0 +1,221 @@ +package tests + +import ( + "fmt" + "testing" + "time" + + "github.com/iotaledger/hive.go/core/safemath" + "github.com/iotaledger/hive.go/lo" + "github.com/iotaledger/hive.go/log" + "github.com/iotaledger/iota-core/pkg/testsuite" + "github.com/iotaledger/iota-core/pkg/testsuite/mock" + "github.com/stretchr/testify/require" + + iotago "github.com/iotaledger/iota.go/v4" +) + +type reward struct { + Mana iotago.Mana + ProfitMargin uint64 +} + +// Calculates the reward according to +// https://github.com/iotaledger/tips/blob/tip40/tips/TIP-0040/tip-0040.md#calculations-3. +// +// For testing purposes, assumes that the account's staking data is the same in the latest committed slot +// as in the epoch for which to calculate rewards. +func calculateEpochReward(t *testing.T, ts *testsuite.TestSuite, accountID iotago.AccountID, epoch iotago.EpochIndex, epochPerformanceFactor uint64, totalStake iotago.BaseToken, totalValidatorStake iotago.BaseToken) reward { + + latestCommittedSlot := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Slot() + targetReward := lo.PanicOnErr(ts.API.ProtocolParameters().RewardsParameters().TargetReward(epoch, ts.API)) + accountData, exists, err := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Ledger.Account(accountID, latestCommittedSlot) + if err != nil || !exists { + t.Fatal(exists, err) + } + + poolStake := accountData.ValidatorStake + accountData.DelegationStake + poolCoefficientExp := iotago.BaseToken(ts.API.ProtocolParameters().RewardsParameters().PoolCoefficientExponent) + + validationBlocksPerSlot := ts.API.ProtocolParameters().ValidationBlocksPerSlot() + poolCoefficient := ((poolStake << poolCoefficientExp) / totalStake) + (accountData.ValidatorStake<> (poolCoefficientExp + 1) + + profitMargin := (totalValidatorStake << iotago.BaseToken(ts.API.ProtocolParameters().RewardsParameters().ProfitMarginExponent)) / (totalValidatorStake + totalStake) + + return reward{Mana: poolReward, ProfitMargin: uint64(profitMargin)} +} + +// Calculates a validator's reward according to +// https://github.com/iotaledger/tips/blob/tip40/tips/TIP-0040/tip-0040.md#calculations-4. +func calculateValidatorReward(t *testing.T, ts *testsuite.TestSuite, accountID iotago.AccountID, rewards []reward, startEpoch iotago.EpochIndex, claimingEpoch iotago.EpochIndex) iotago.Mana { + latestCommittedSlot := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Slot() + accountData, exists, err := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Ledger.Account(accountID, latestCommittedSlot) + if err != nil || !exists { + t.Fatal(exists, err) + } + + profitMarginExponent := ts.API.ProtocolParameters().RewardsParameters().ProfitMarginExponent + stakedAmount := accountData.ValidatorStake + fixedCost := accountData.FixedCost + poolStake := accountData.ValidatorStake + accountData.DelegationStake + rewardEpoch := startEpoch + decayedRewards := iotago.Mana(0) + + for _, reward := range rewards { + if reward.Mana >= fixedCost { + rewardWithoutFixedCost := uint64(reward.Mana) - uint64(fixedCost) + + profitMarginComplement := (1 << profitMarginExponent) - reward.ProfitMargin + profitMarginFactor := (reward.ProfitMargin * rewardWithoutFixedCost) >> profitMarginExponent + + intermediate := ((profitMarginComplement * rewardWithoutFixedCost) >> profitMarginExponent) + residualValidatorFactor := lo.PanicOnErr(safemath.Safe64MulDiv(intermediate, uint64(stakedAmount), uint64(poolStake))) + + undecayedRewards := uint64(fixedCost) + profitMarginFactor + residualValidatorFactor + + decayedRewards += lo.PanicOnErr(ts.API.ManaDecayProvider().DecayManaByEpochs(iotago.Mana(undecayedRewards), rewardEpoch, claimingEpoch)) + } else { + decayedRewards += 0 + } + + rewardEpoch++ + } + + return decayedRewards +} + +func setupValidatorTestsuite(t *testing.T) (*testsuite.TestSuite, *mock.Node, *mock.Node, *mock.Node, iotago.BlockID) { + var slotDuration uint8 = 5 + var slotsPerEpochExponent uint8 = 5 + var validationBlocksPerSlot uint8 = 5 + + ts := testsuite.NewTestSuite(t, + testsuite.WithProtocolParametersOptions( + iotago.WithStakingOptions(1, validationBlocksPerSlot, 1), + iotago.WithTimeProviderOptions( + 0, + testsuite.GenesisTimeWithOffsetBySlots(1000, slotDuration), + slotDuration, + slotsPerEpochExponent, + ), + iotago.WithLivenessOptions( + testsuite.DefaultLivenessThresholdLowerBoundInSeconds, + testsuite.DefaultLivenessThresholdUpperBoundInSeconds, + 5, + 10, + 15, + ), + ), + ) + + // Add validator nodes to the network. This will add validator accounts to the snapshot. + vnode1 := ts.AddValidatorNode("node1", testsuite.WithWalletAmount(20_000_000)) + vnode2 := ts.AddValidatorNode("node2", testsuite.WithWalletAmount(25_000_000)) + // Add a non-validator node to the network. This will not add any accounts to the snapshot. + node3 := ts.AddNode("node3") + // Add a default block issuer to the network. This will add another block issuer account to the snapshot. + ts.AddDefaultWallet(vnode1) + + ts.Run(true) + + // For debugging set the log level appropriately. + vnode1.Protocol.SetLogLevel(log.LevelInfo) + vnode2.Protocol.SetLogLevel(log.LevelError) + node3.Protocol.SetLogLevel(log.LevelError) + + tip := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().TipSelection.SelectTips(1)[iotago.StrongParentType][0] + + ts.SetCurrentSlot(1) + + return ts, vnode1, vnode2, node3, tip +} + +func Test_ValidatorReward(t *testing.T) { + ts, vnode1, vnode2, _, tip := setupValidatorTestsuite(t) + defer ts.Shutdown() + + subslotDuration := time.Duration(ts.API.ProtocolParameters().SlotDurationInSeconds()/ts.API.ProtocolParameters().ValidationBlocksPerSlot()) * time.Second + + // Validate until the last slot of the epoch is definitely committed. + var epochEndSlot iotago.SlotIndex = ts.API.TimeProvider().EpochEnd(ts.API.TimeProvider().EpochFromSlot(ts.CurrentSlot())) + ts.API.ProtocolParameters().MaxCommittableAge() + subSlotBlockCounter := 0 + + for slot := ts.CurrentSlot(); slot <= epochEndSlot; slot++ { + slotStartTime := ts.API.TimeProvider().SlotStartTime(ts.CurrentSlot()).UTC() + + for subslotIdx := uint8(0); subslotIdx < ts.API.ProtocolParameters().ValidationBlocksPerSlot(); subslotIdx++ { + for _, node := range []*mock.Node{vnode1, vnode2} { + blockName := fmt.Sprintf("block-%s-%d/%d", node.Name, ts.CurrentSlot(), subslotIdx) + latestCommitment := node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Commitment() + + issuingTime := slotStartTime. + Add(subslotDuration * time.Duration(subslotIdx)). + Add(time.Duration(subSlotBlockCounter)) + + validationBlock := ts.IssueValidationBlockWithHeaderOptions(blockName, node, + mock.WithSlotCommitment(latestCommitment), + mock.WithIssuingTime(issuingTime), + mock.WithStrongParents(tip), + ) + + tip = validationBlock.ID() + subSlotBlockCounter += 1 + } + subSlotBlockCounter = 0 + } + + ts.SetCurrentSlot(slot + 1) + } + + ts.Wait(ts.Nodes()...) + + // Determine total stakes required for rewards calculation. + var totalStake iotago.BaseToken = 0 + var totalValidatorStake iotago.BaseToken = 0 + lo.ForEach(ts.Validators(), func(n *mock.Node) { + latestCommittedSlot := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Slot() + accountData, exists, err := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Ledger.Account(n.Validator.AccountID, latestCommittedSlot) + if err != nil || !exists { + t.Fatal(exists, err) + } + + totalStake += accountData.ValidatorStake + accountData.DelegationStake + totalValidatorStake += accountData.ValidatorStake + }) + + actualRewards := make(map[iotago.AccountID]iotago.Mana, len(ts.Validators())) + claimingEpoch := ts.API.TimeProvider().EpochFromSlot(ts.CurrentSlot()) + + for _, validatorAccount := range []string{"Genesis:1", "Genesis:2"} { + output := ts.DefaultWallet().Output(validatorAccount) + accId := output.Output().(*iotago.AccountOutput).AccountID + + rewardMana, _, _, err := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().SybilProtection.ValidatorReward( + accId, + output.Output().FeatureSet().Staking().StakedAmount, + output.Output().FeatureSet().Staking().StartEpoch, + claimingEpoch, + ) + if err != nil { + panic(err) + } + + actualRewards[accId] = rewardMana + } + + for accountID, actualReward := range actualRewards { + validationBlocksPerSlot := uint64(ts.API.ProtocolParameters().ValidationBlocksPerSlot()) + epochDurationSlots := uint64(ts.API.TimeProvider().EpochDurationSlots()) + + // A validator cannot issue blocks in slot 0, so we have to deduct those blocks from the performance factor. + epochPerformanceFactor := ((validationBlocksPerSlot * epochDurationSlots) - validationBlocksPerSlot) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()) + + calculatedReward := calculateEpochReward(t, ts, accountID, 0, epochPerformanceFactor, totalStake, totalValidatorStake) + expectedReward := calculateValidatorReward(t, ts, accountID, []reward{calculatedReward}, 0, claimingEpoch) + + require.Equal(t, expectedReward, actualReward, "expected reward for account %s to be %d, was %d", accountID, expectedReward, actualReward) + } +} From ffd7f65093aecd5b5cfce3ebcbbb15f9b373b7c2 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Thu, 7 Dec 2023 14:59:31 +0100 Subject: [PATCH 18/30] Make validator test reusable --- pkg/tests/validator_test.go | 79 ++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 22 deletions(-) diff --git a/pkg/tests/validator_test.go b/pkg/tests/validator_test.go index 8e58d70e8..3ac0e96a5 100644 --- a/pkg/tests/validator_test.go +++ b/pkg/tests/validator_test.go @@ -87,7 +87,7 @@ func calculateValidatorReward(t *testing.T, ts *testsuite.TestSuite, accountID i return decayedRewards } -func setupValidatorTestsuite(t *testing.T) (*testsuite.TestSuite, *mock.Node, *mock.Node, *mock.Node, iotago.BlockID) { +func setupValidatorTestsuite(t *testing.T) (*testsuite.TestSuite, *mock.Node, *mock.Node, *mock.Node) { var slotDuration uint8 = 5 var slotsPerEpochExponent uint8 = 5 var validationBlocksPerSlot uint8 = 5 @@ -95,6 +95,8 @@ func setupValidatorTestsuite(t *testing.T) (*testsuite.TestSuite, *mock.Node, *m ts := testsuite.NewTestSuite(t, testsuite.WithProtocolParametersOptions( iotago.WithStakingOptions(1, validationBlocksPerSlot, 1), + // Pick larger values for ManaShareCoefficient and DecayBalancingConstant for more precision in the calculations. + iotago.WithRewardsOptions(8, 8, 11, 1154, 200, 200), iotago.WithTimeProviderOptions( 0, testsuite.GenesisTimeWithOffsetBySlots(1000, slotDuration), @@ -126,28 +128,61 @@ func setupValidatorTestsuite(t *testing.T) (*testsuite.TestSuite, *mock.Node, *m vnode2.Protocol.SetLogLevel(log.LevelError) node3.Protocol.SetLogLevel(log.LevelError) - tip := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().TipSelection.SelectTips(1)[iotago.StrongParentType][0] - ts.SetCurrentSlot(1) - return ts, vnode1, vnode2, node3, tip + return ts, vnode1, vnode2, node3 +} + +type EpochPerformanceMap = map[iotago.EpochIndex]uint64 +type ValidatorTest struct { + ts *testsuite.TestSuite + + subslotDuration time.Duration + epochPerformanceFactors EpochPerformanceMap } -func Test_ValidatorReward(t *testing.T) { - ts, vnode1, vnode2, _, tip := setupValidatorTestsuite(t) +func Test_Validator_PerfectIssuance(t *testing.T) { + ts, _, _, _ := setupValidatorTestsuite(t) defer ts.Shutdown() subslotDuration := time.Duration(ts.API.ProtocolParameters().SlotDurationInSeconds()/ts.API.ProtocolParameters().ValidationBlocksPerSlot()) * time.Second + validationBlocksPerSlot := uint64(ts.API.ProtocolParameters().ValidationBlocksPerSlot()) + epochDurationSlots := uint64(ts.API.TimeProvider().EpochDurationSlots()) + + test := ValidatorTest{ + ts: ts, + subslotDuration: subslotDuration, + epochPerformanceFactors: EpochPerformanceMap{ + // A validator cannot issue blocks in the genesis slot, so we deduct one slot worth of blocks. + 0: (validationBlocksPerSlot * (epochDurationSlots - 1)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 1: (validationBlocksPerSlot * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 2: (validationBlocksPerSlot * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + }, + } + + validatorTest(t, test) +} + +func validatorTest(t *testing.T, test ValidatorTest) { + ts := test.ts + subslotDuration := test.subslotDuration + + tip := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().TipSelection.SelectTips(1)[iotago.StrongParentType][0] + startEpoch := iotago.EpochIndex(0) + endEpoch := iotago.EpochIndex(len(test.epochPerformanceFactors) - 1) + fmt.Printf("ValidatorTest: startEpoch=%d, endEpoch=%d\n", startEpoch, endEpoch) // Validate until the last slot of the epoch is definitely committed. - var epochEndSlot iotago.SlotIndex = ts.API.TimeProvider().EpochEnd(ts.API.TimeProvider().EpochFromSlot(ts.CurrentSlot())) + ts.API.ProtocolParameters().MaxCommittableAge() + var endEpochSlot iotago.SlotIndex = ts.API.TimeProvider().EpochEnd(endEpoch) + ts.API.ProtocolParameters().MaxCommittableAge() + // Needed to increase the block timestamp monotonically relative to the parent. subSlotBlockCounter := 0 - for slot := ts.CurrentSlot(); slot <= epochEndSlot; slot++ { - slotStartTime := ts.API.TimeProvider().SlotStartTime(ts.CurrentSlot()).UTC() + for slot := ts.CurrentSlot(); slot <= endEpochSlot; slot++ { + ts.SetCurrentSlot(slot) + slotStartTime := ts.API.TimeProvider().SlotStartTime(ts.CurrentSlot()).UTC() for subslotIdx := uint8(0); subslotIdx < ts.API.ProtocolParameters().ValidationBlocksPerSlot(); subslotIdx++ { - for _, node := range []*mock.Node{vnode1, vnode2} { + for _, node := range ts.Validators() { blockName := fmt.Sprintf("block-%s-%d/%d", node.Name, ts.CurrentSlot(), subslotIdx) latestCommitment := node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Commitment() @@ -166,8 +201,6 @@ func Test_ValidatorReward(t *testing.T) { } subSlotBlockCounter = 0 } - - ts.SetCurrentSlot(slot + 1) } ts.Wait(ts.Nodes()...) @@ -186,15 +219,16 @@ func Test_ValidatorReward(t *testing.T) { totalValidatorStake += accountData.ValidatorStake }) + // Determine the rewards the validators actually got. actualRewards := make(map[iotago.AccountID]iotago.Mana, len(ts.Validators())) claimingEpoch := ts.API.TimeProvider().EpochFromSlot(ts.CurrentSlot()) for _, validatorAccount := range []string{"Genesis:1", "Genesis:2"} { output := ts.DefaultWallet().Output(validatorAccount) - accId := output.Output().(*iotago.AccountOutput).AccountID + accountID := output.Output().(*iotago.AccountOutput).AccountID rewardMana, _, _, err := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().SybilProtection.ValidatorReward( - accId, + accountID, output.Output().FeatureSet().Staking().StakedAmount, output.Output().FeatureSet().Staking().StartEpoch, claimingEpoch, @@ -203,18 +237,19 @@ func Test_ValidatorReward(t *testing.T) { panic(err) } - actualRewards[accId] = rewardMana + actualRewards[accountID] = rewardMana } for accountID, actualReward := range actualRewards { - validationBlocksPerSlot := uint64(ts.API.ProtocolParameters().ValidationBlocksPerSlot()) - epochDurationSlots := uint64(ts.API.TimeProvider().EpochDurationSlots()) - - // A validator cannot issue blocks in slot 0, so we have to deduct those blocks from the performance factor. - epochPerformanceFactor := ((validationBlocksPerSlot * epochDurationSlots) - validationBlocksPerSlot) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()) + lastRewardEpoch := iotago.EpochIndex(len(test.epochPerformanceFactors)) + rewards := make([]reward, 0, lastRewardEpoch) + for epoch := iotago.EpochIndex(0); epoch < lastRewardEpoch; epoch++ { + epochPerformanceFactor := test.epochPerformanceFactors[epoch] + reward := calculateEpochReward(t, ts, accountID, epoch, epochPerformanceFactor, totalStake, totalValidatorStake) + rewards = append(rewards, reward) + } - calculatedReward := calculateEpochReward(t, ts, accountID, 0, epochPerformanceFactor, totalStake, totalValidatorStake) - expectedReward := calculateValidatorReward(t, ts, accountID, []reward{calculatedReward}, 0, claimingEpoch) + expectedReward := calculateValidatorReward(t, ts, accountID, rewards, startEpoch, claimingEpoch) require.Equal(t, expectedReward, actualReward, "expected reward for account %s to be %d, was %d", accountID, expectedReward, actualReward) } From 154d4e3559f01ee2aa4dd794e231891461bc612e Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Thu, 7 Dec 2023 15:20:05 +0100 Subject: [PATCH 19/30] Add overissuance test --- pkg/tests/validator_test.go | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/pkg/tests/validator_test.go b/pkg/tests/validator_test.go index 3ac0e96a5..c4620f335 100644 --- a/pkg/tests/validator_test.go +++ b/pkg/tests/validator_test.go @@ -137,7 +137,9 @@ type EpochPerformanceMap = map[iotago.EpochIndex]uint64 type ValidatorTest struct { ts *testsuite.TestSuite - subslotDuration time.Duration + // How many validation blocks per slot the validator test nodes are supposed to issue. + // Can be set to a different value than the protocol parameter to model under- or overissuance. + validationBlocksPerSlot uint8 epochPerformanceFactors EpochPerformanceMap } @@ -145,13 +147,12 @@ func Test_Validator_PerfectIssuance(t *testing.T) { ts, _, _, _ := setupValidatorTestsuite(t) defer ts.Shutdown() - subslotDuration := time.Duration(ts.API.ProtocolParameters().SlotDurationInSeconds()/ts.API.ProtocolParameters().ValidationBlocksPerSlot()) * time.Second validationBlocksPerSlot := uint64(ts.API.ProtocolParameters().ValidationBlocksPerSlot()) epochDurationSlots := uint64(ts.API.TimeProvider().EpochDurationSlots()) test := ValidatorTest{ - ts: ts, - subslotDuration: subslotDuration, + ts: ts, + validationBlocksPerSlot: ts.API.ProtocolParameters().ValidationBlocksPerSlot(), epochPerformanceFactors: EpochPerformanceMap{ // A validator cannot issue blocks in the genesis slot, so we deduct one slot worth of blocks. 0: (validationBlocksPerSlot * (epochDurationSlots - 1)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), @@ -163,25 +164,45 @@ func Test_Validator_PerfectIssuance(t *testing.T) { validatorTest(t, test) } +func Test_Validator_OverIssuance(t *testing.T) { + ts, _, _, _ := setupValidatorTestsuite(t) + defer ts.Shutdown() + + test := ValidatorTest{ + ts: ts, + // Issue one more block than supposed to. + validationBlocksPerSlot: ts.API.ProtocolParameters().ValidationBlocksPerSlot() + 1, + epochPerformanceFactors: EpochPerformanceMap{ + // We expect 0 rewards for overissuance. + // We model that in this test by setting performance factor to 0. + 0: 0, + 1: 0, + 2: 0, + }, + } + + validatorTest(t, test) +} + func validatorTest(t *testing.T, test ValidatorTest) { ts := test.ts - subslotDuration := test.subslotDuration tip := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().TipSelection.SelectTips(1)[iotago.StrongParentType][0] startEpoch := iotago.EpochIndex(0) endEpoch := iotago.EpochIndex(len(test.epochPerformanceFactors) - 1) fmt.Printf("ValidatorTest: startEpoch=%d, endEpoch=%d\n", startEpoch, endEpoch) + subslotDuration := time.Duration(ts.API.ProtocolParameters().SlotDurationInSeconds()/test.validationBlocksPerSlot) * time.Second // Validate until the last slot of the epoch is definitely committed. var endEpochSlot iotago.SlotIndex = ts.API.TimeProvider().EpochEnd(endEpoch) + ts.API.ProtocolParameters().MaxCommittableAge() // Needed to increase the block timestamp monotonically relative to the parent. - subSlotBlockCounter := 0 + subSlotBlockCounter := time.Duration(0) for slot := ts.CurrentSlot(); slot <= endEpochSlot; slot++ { ts.SetCurrentSlot(slot) slotStartTime := ts.API.TimeProvider().SlotStartTime(ts.CurrentSlot()).UTC() - for subslotIdx := uint8(0); subslotIdx < ts.API.ProtocolParameters().ValidationBlocksPerSlot(); subslotIdx++ { + for subslotIdx := uint8(0); subslotIdx < test.validationBlocksPerSlot; subslotIdx++ { for _, node := range ts.Validators() { blockName := fmt.Sprintf("block-%s-%d/%d", node.Name, ts.CurrentSlot(), subslotIdx) latestCommitment := node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Commitment() @@ -199,7 +220,6 @@ func validatorTest(t *testing.T, test ValidatorTest) { tip = validationBlock.ID() subSlotBlockCounter += 1 } - subSlotBlockCounter = 0 } } From ebbab17ec855f2bced072f14a2ae9854ddea586b Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Thu, 7 Dec 2023 15:26:53 +0100 Subject: [PATCH 20/30] Add underissuance test --- pkg/tests/validator_test.go | 174 ++++++++++++++++++++---------------- 1 file changed, 98 insertions(+), 76 deletions(-) diff --git a/pkg/tests/validator_test.go b/pkg/tests/validator_test.go index c4620f335..41df0fe45 100644 --- a/pkg/tests/validator_test.go +++ b/pkg/tests/validator_test.go @@ -15,79 +15,7 @@ import ( iotago "github.com/iotaledger/iota.go/v4" ) -type reward struct { - Mana iotago.Mana - ProfitMargin uint64 -} - -// Calculates the reward according to -// https://github.com/iotaledger/tips/blob/tip40/tips/TIP-0040/tip-0040.md#calculations-3. -// -// For testing purposes, assumes that the account's staking data is the same in the latest committed slot -// as in the epoch for which to calculate rewards. -func calculateEpochReward(t *testing.T, ts *testsuite.TestSuite, accountID iotago.AccountID, epoch iotago.EpochIndex, epochPerformanceFactor uint64, totalStake iotago.BaseToken, totalValidatorStake iotago.BaseToken) reward { - - latestCommittedSlot := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Slot() - targetReward := lo.PanicOnErr(ts.API.ProtocolParameters().RewardsParameters().TargetReward(epoch, ts.API)) - accountData, exists, err := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Ledger.Account(accountID, latestCommittedSlot) - if err != nil || !exists { - t.Fatal(exists, err) - } - - poolStake := accountData.ValidatorStake + accountData.DelegationStake - poolCoefficientExp := iotago.BaseToken(ts.API.ProtocolParameters().RewardsParameters().PoolCoefficientExponent) - - validationBlocksPerSlot := ts.API.ProtocolParameters().ValidationBlocksPerSlot() - poolCoefficient := ((poolStake << poolCoefficientExp) / totalStake) + (accountData.ValidatorStake<> (poolCoefficientExp + 1) - - profitMargin := (totalValidatorStake << iotago.BaseToken(ts.API.ProtocolParameters().RewardsParameters().ProfitMarginExponent)) / (totalValidatorStake + totalStake) - - return reward{Mana: poolReward, ProfitMargin: uint64(profitMargin)} -} - -// Calculates a validator's reward according to -// https://github.com/iotaledger/tips/blob/tip40/tips/TIP-0040/tip-0040.md#calculations-4. -func calculateValidatorReward(t *testing.T, ts *testsuite.TestSuite, accountID iotago.AccountID, rewards []reward, startEpoch iotago.EpochIndex, claimingEpoch iotago.EpochIndex) iotago.Mana { - latestCommittedSlot := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Slot() - accountData, exists, err := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Ledger.Account(accountID, latestCommittedSlot) - if err != nil || !exists { - t.Fatal(exists, err) - } - - profitMarginExponent := ts.API.ProtocolParameters().RewardsParameters().ProfitMarginExponent - stakedAmount := accountData.ValidatorStake - fixedCost := accountData.FixedCost - poolStake := accountData.ValidatorStake + accountData.DelegationStake - rewardEpoch := startEpoch - decayedRewards := iotago.Mana(0) - - for _, reward := range rewards { - if reward.Mana >= fixedCost { - rewardWithoutFixedCost := uint64(reward.Mana) - uint64(fixedCost) - - profitMarginComplement := (1 << profitMarginExponent) - reward.ProfitMargin - profitMarginFactor := (reward.ProfitMargin * rewardWithoutFixedCost) >> profitMarginExponent - - intermediate := ((profitMarginComplement * rewardWithoutFixedCost) >> profitMarginExponent) - residualValidatorFactor := lo.PanicOnErr(safemath.Safe64MulDiv(intermediate, uint64(stakedAmount), uint64(poolStake))) - - undecayedRewards := uint64(fixedCost) + profitMarginFactor + residualValidatorFactor - - decayedRewards += lo.PanicOnErr(ts.API.ManaDecayProvider().DecayManaByEpochs(iotago.Mana(undecayedRewards), rewardEpoch, claimingEpoch)) - } else { - decayedRewards += 0 - } - - rewardEpoch++ - } - - return decayedRewards -} - -func setupValidatorTestsuite(t *testing.T) (*testsuite.TestSuite, *mock.Node, *mock.Node, *mock.Node) { +func setupValidatorTestsuite(t *testing.T) *testsuite.TestSuite { var slotDuration uint8 = 5 var slotsPerEpochExponent uint8 = 5 var validationBlocksPerSlot uint8 = 5 @@ -130,7 +58,7 @@ func setupValidatorTestsuite(t *testing.T) (*testsuite.TestSuite, *mock.Node, *m ts.SetCurrentSlot(1) - return ts, vnode1, vnode2, node3 + return ts } type EpochPerformanceMap = map[iotago.EpochIndex]uint64 @@ -144,7 +72,7 @@ type ValidatorTest struct { } func Test_Validator_PerfectIssuance(t *testing.T) { - ts, _, _, _ := setupValidatorTestsuite(t) + ts := setupValidatorTestsuite(t) defer ts.Shutdown() validationBlocksPerSlot := uint64(ts.API.ProtocolParameters().ValidationBlocksPerSlot()) @@ -165,7 +93,7 @@ func Test_Validator_PerfectIssuance(t *testing.T) { } func Test_Validator_OverIssuance(t *testing.T) { - ts, _, _, _ := setupValidatorTestsuite(t) + ts := setupValidatorTestsuite(t) defer ts.Shutdown() test := ValidatorTest{ @@ -184,6 +112,28 @@ func Test_Validator_OverIssuance(t *testing.T) { validatorTest(t, test) } +func Test_Validator_UnderIssuance(t *testing.T) { + ts := setupValidatorTestsuite(t) + defer ts.Shutdown() + + // Issue less than supposed to. + validationBlocksPerSlot := uint64(ts.API.ProtocolParameters().ValidationBlocksPerSlot() - 2) + epochDurationSlots := uint64(ts.API.TimeProvider().EpochDurationSlots()) + + test := ValidatorTest{ + ts: ts, + validationBlocksPerSlot: uint8(validationBlocksPerSlot), + epochPerformanceFactors: EpochPerformanceMap{ + // A validator cannot issue blocks in the genesis slot, so we deduct one slot worth of blocks. + 0: (validationBlocksPerSlot * (epochDurationSlots - 1)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 1: (validationBlocksPerSlot * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 2: (validationBlocksPerSlot * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + }, + } + + validatorTest(t, test) +} + func validatorTest(t *testing.T, test ValidatorTest) { ts := test.ts @@ -274,3 +224,75 @@ func validatorTest(t *testing.T, test ValidatorTest) { require.Equal(t, expectedReward, actualReward, "expected reward for account %s to be %d, was %d", accountID, expectedReward, actualReward) } } + +type reward struct { + Mana iotago.Mana + ProfitMargin uint64 +} + +// Calculates the reward according to +// https://github.com/iotaledger/tips/blob/tip40/tips/TIP-0040/tip-0040.md#calculations-3. +// +// For testing purposes, assumes that the account's staking data is the same in the latest committed slot +// as in the epoch for which to calculate rewards. +func calculateEpochReward(t *testing.T, ts *testsuite.TestSuite, accountID iotago.AccountID, epoch iotago.EpochIndex, epochPerformanceFactor uint64, totalStake iotago.BaseToken, totalValidatorStake iotago.BaseToken) reward { + + latestCommittedSlot := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Slot() + targetReward := lo.PanicOnErr(ts.API.ProtocolParameters().RewardsParameters().TargetReward(epoch, ts.API)) + accountData, exists, err := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Ledger.Account(accountID, latestCommittedSlot) + if err != nil || !exists { + t.Fatal(exists, err) + } + + poolStake := accountData.ValidatorStake + accountData.DelegationStake + poolCoefficientExp := iotago.BaseToken(ts.API.ProtocolParameters().RewardsParameters().PoolCoefficientExponent) + + validationBlocksPerSlot := ts.API.ProtocolParameters().ValidationBlocksPerSlot() + poolCoefficient := ((poolStake << poolCoefficientExp) / totalStake) + (accountData.ValidatorStake<> (poolCoefficientExp + 1) + + profitMargin := (totalValidatorStake << iotago.BaseToken(ts.API.ProtocolParameters().RewardsParameters().ProfitMarginExponent)) / (totalValidatorStake + totalStake) + + return reward{Mana: poolReward, ProfitMargin: uint64(profitMargin)} +} + +// Calculates a validator's reward according to +// https://github.com/iotaledger/tips/blob/tip40/tips/TIP-0040/tip-0040.md#calculations-4. +func calculateValidatorReward(t *testing.T, ts *testsuite.TestSuite, accountID iotago.AccountID, rewards []reward, startEpoch iotago.EpochIndex, claimingEpoch iotago.EpochIndex) iotago.Mana { + latestCommittedSlot := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Slot() + accountData, exists, err := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Ledger.Account(accountID, latestCommittedSlot) + if err != nil || !exists { + t.Fatal(exists, err) + } + + profitMarginExponent := ts.API.ProtocolParameters().RewardsParameters().ProfitMarginExponent + stakedAmount := accountData.ValidatorStake + fixedCost := accountData.FixedCost + poolStake := accountData.ValidatorStake + accountData.DelegationStake + rewardEpoch := startEpoch + decayedRewards := iotago.Mana(0) + + for _, reward := range rewards { + if reward.Mana >= fixedCost { + rewardWithoutFixedCost := uint64(reward.Mana) - uint64(fixedCost) + + profitMarginComplement := (1 << profitMarginExponent) - reward.ProfitMargin + profitMarginFactor := (reward.ProfitMargin * rewardWithoutFixedCost) >> profitMarginExponent + + intermediate := ((profitMarginComplement * rewardWithoutFixedCost) >> profitMarginExponent) + residualValidatorFactor := lo.PanicOnErr(safemath.Safe64MulDiv(intermediate, uint64(stakedAmount), uint64(poolStake))) + + undecayedRewards := uint64(fixedCost) + profitMarginFactor + residualValidatorFactor + + decayedRewards += lo.PanicOnErr(ts.API.ManaDecayProvider().DecayManaByEpochs(iotago.Mana(undecayedRewards), rewardEpoch, claimingEpoch)) + } else { + decayedRewards += 0 + } + + rewardEpoch++ + } + + return decayedRewards +} From f9aec2c61d0c2fa6ad4708120cf5e2712b9ea383 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Thu, 7 Dec 2023 16:20:24 +0100 Subject: [PATCH 21/30] Prepend the issuing time in the testsuite --- pkg/testsuite/mock/blockissuer.go | 2 +- pkg/testsuite/testsuite_issue_blocks.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/testsuite/mock/blockissuer.go b/pkg/testsuite/mock/blockissuer.go index 10b848f9f..bf6ef6340 100644 --- a/pkg/testsuite/mock/blockissuer.go +++ b/pkg/testsuite/mock/blockissuer.go @@ -583,7 +583,7 @@ func (i *BlockIssuer) validateReferences(issuingTime time.Time, slotCommitmentIn } if b.IssuingTime().After(issuingTime) { - return ierrors.Errorf("cannot issue block if the parents issuingTime is ahead block's issuingTime: %s vs %s", b.IssuingTime(), issuingTime) + return ierrors.Errorf("cannot issue block if the parents issuingTime is ahead block's issuingTime: %s vs %s", b.IssuingTime(), issuingTime.UTC()) } if b.SlotCommitmentID().Slot() > slotCommitmentIndex { return ierrors.Errorf("cannot issue block if the commitment is ahead of its parents' commitment: %s vs %s", b.SlotCommitmentID().Slot(), slotCommitmentIndex) diff --git a/pkg/testsuite/testsuite_issue_blocks.go b/pkg/testsuite/testsuite_issue_blocks.go index 65d9e59f4..5c712216b 100644 --- a/pkg/testsuite/testsuite_issue_blocks.go +++ b/pkg/testsuite/testsuite_issue_blocks.go @@ -71,7 +71,8 @@ func (t *TestSuite) IssueValidationBlockWithHeaderOptions(blockName string, node timeProvider := t.API.TimeProvider() issuingTime := timeProvider.SlotStartTime(t.currentSlot).Add(time.Duration(t.uniqueBlockTimeCounter.Add(1))) - blockHeaderOptions := append(blockHeaderOpts, mock.WithIssuingTime(issuingTime)) + // Prepend the issuing time so it can be overridden via the passed options. + blockHeaderOptions := append([]options.Option[mock.BlockHeaderParams]{mock.WithIssuingTime(issuingTime)}, blockHeaderOpts...) block := node.IssueValidationBlock(context.Background(), blockName, mock.WithValidationBlockHeaderOptions(blockHeaderOptions...)) @@ -267,15 +268,21 @@ func (t *TestSuite) CommitUntilSlot(slot iotago.SlotIndex, parents ...iotago.Blo if latestCommittedSlot >= slot { return parents } + t.SetCurrentSlot(lo.Min(slot+t.API.ProtocolParameters().MinCommittableAge(), latestCommittedSlot+t.API.ProtocolParameters().MinCommittableAge())) + tips := parents chainIndex := 0 + for { // preacceptance of nextBlockSlot for _, node := range activeValidators { require.True(t.Testing, node.IsValidator(), "node: %s: is not a validator node", node.Name) + committeeAtBlockSlot, exists := node.Protocol.Engines.Main.Get().SybilProtection.SeatManager().CommitteeInSlot(t.currentSlot) + require.True(t.Testing, exists, "node: %s: does not have committee selected for slot %d", node.Name, t.currentSlot) + if committeeAtBlockSlot.HasAccount(node.Validator.AccountID) { blockName := fmt.Sprintf("chain-%s-%d-%s", parents[0].Alias(), chainIndex, node.Name) latestCommitment := node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Commitment() From 2afcc78a9cb274544372ab47e676bc887e811b69 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Thu, 7 Dec 2023 16:51:37 +0100 Subject: [PATCH 22/30] Add logger to performance tracker --- .../performance/performance.go | 19 +++++++++++++++---- .../performance/testsuite_test.go | 2 ++ .../sybilprotectionv1/sybilprotection.go | 4 ++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/performance.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/performance.go index f5b17b556..56c7249f0 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/performance.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/performance.go @@ -8,6 +8,7 @@ import ( "github.com/iotaledger/hive.go/ds/shrinkingmap" "github.com/iotaledger/hive.go/ierrors" "github.com/iotaledger/hive.go/kvstore" + "github.com/iotaledger/hive.go/log" "github.com/iotaledger/hive.go/runtime/syncutils" "github.com/iotaledger/iota-core/pkg/core/account" "github.com/iotaledger/iota-core/pkg/model" @@ -32,6 +33,8 @@ type Tracker struct { performanceFactorsMutex syncutils.RWMutex mutex syncutils.RWMutex + + log.Logger } func NewTracker( @@ -43,6 +46,7 @@ func NewTracker( latestAppliedEpoch iotago.EpochIndex, apiProvider iotago.APIProvider, errHandler func(error), + logger log.Logger, ) *Tracker { return &Tracker{ nextEpochCommitteeCandidates: shrinkingmap.New[iotago.AccountID, iotago.SlotIndex](), @@ -54,6 +58,7 @@ func NewTracker( latestAppliedEpoch: latestAppliedEpoch, apiProvider: apiProvider, errHandler: errHandler, + Logger: logger, } } @@ -218,7 +223,6 @@ func (t *Tracker) ApplyEpoch(epoch iotago.EpochIndex, committee *account.Account validatorSlotPerformances, err := t.validatorPerformancesFunc(slot) if err != nil { validatorPerformances = append(validatorPerformances, nil) - continue } @@ -234,8 +238,11 @@ func (t *Tracker) ApplyEpoch(epoch iotago.EpochIndex, committee *account.Account validatorPerformances = append(validatorPerformances, validatorPerformance) } - pf := t.aggregatePerformanceFactors(validatorPerformances, epoch) - if pf == 0 { + + // Aggregate the performance factor of the epoch which approximates the average of the slot's performance factor. + epochPerformanceFactor := t.aggregatePerformanceFactors(validatorPerformances, epoch) + + if epochPerformanceFactor == 0 { // no rewards for this pool, we do not set pool rewards at all, // to differientiate between situation when poolReward == fixedCost (no reward for delegators) @@ -248,11 +255,14 @@ func (t *Tracker) ApplyEpoch(epoch iotago.EpochIndex, committee *account.Account committee.TotalStake(), pool.PoolStake, pool.ValidatorStake, - pf, + epochPerformanceFactor, ) if err != nil { panic(ierrors.Wrapf(err, "failed to calculate pool rewards for account %s", accountID)) } + + t.LogDebug("PerformanceFactor", "accountID", accountID, "epochPerformanceFactor", epochPerformanceFactor, "poolReward", poolReward) + if err = rewardsMap.Set(accountID, &model.PoolRewards{ PoolStake: pool.PoolStake, PoolRewards: poolReward, @@ -287,6 +297,7 @@ func (t *Tracker) aggregatePerformanceFactors(slotActivityVector []*model.Valida if pf == nil { continue } + // each one bit represents at least one block issued in that subslot, // we reward not only total number of blocks issued, but also regularity based on block timestamp slotPerformanceFactor := bits.OnesCount32(pf.SlotActivityVector) diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go index d27730805..5e027f829 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go @@ -10,6 +10,7 @@ import ( "github.com/iotaledger/hive.go/kvstore" "github.com/iotaledger/hive.go/kvstore/mapdb" "github.com/iotaledger/hive.go/lo" + "github.com/iotaledger/hive.go/log" "github.com/iotaledger/iota-core/pkg/core/account" "github.com/iotaledger/iota-core/pkg/model" "github.com/iotaledger/iota-core/pkg/protocol/engine/blocks" @@ -89,6 +90,7 @@ func (t *TestSuite) InitPerformanceTracker() { t.latestCommittedEpoch, iotago.SingleVersionProvider(t.api), func(err error) {}, + log.NewLogger("PerfTestsuite"), ) } diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go b/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go index 487c1e0f3..326bb6f13 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go @@ -59,10 +59,10 @@ func NewProvider(opts ...options.Option[SybilProtection]) module.Provider[*engin e.Constructed.OnTrigger(func() { o.ledger = e.Ledger o.errHandler = e.ErrorHandler("SybilProtection") - + logger, _ := e.NewChildLogger("PerformanceTracker") latestCommittedSlot := e.Storage.Settings().LatestCommitment().Slot() latestCommittedEpoch := o.apiProvider.APIForSlot(latestCommittedSlot).TimeProvider().EpochFromSlot(latestCommittedSlot) - o.performanceTracker = performance.NewTracker(e.Storage.RewardsForEpoch, e.Storage.PoolStats(), e.Storage.Committee(), e.Storage.CommitteeCandidates, e.Storage.ValidatorPerformances, latestCommittedEpoch, e, o.errHandler) + o.performanceTracker = performance.NewTracker(e.Storage.RewardsForEpoch, e.Storage.PoolStats(), e.Storage.Committee(), e.Storage.CommitteeCandidates, e.Storage.ValidatorPerformances, latestCommittedEpoch, e, o.errHandler, logger) o.lastCommittedSlot = latestCommittedSlot if o.optsInitialCommittee != nil { From dc5724c06ed491c170adc8b7e8350743cb476e93 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Thu, 7 Dec 2023 17:09:01 +0100 Subject: [PATCH 23/30] Temporary fix for incorrect Validator Reward decay --- .../sybilprotection/sybilprotectionv1/performance/rewards.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go index 31d13e58d..0714e2e3b 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go @@ -26,6 +26,8 @@ func (t *Tracker) ValidatorReward(validatorID iotago.AccountID, stakeAmount iota var validatorReward iotago.Mana + claimingEpoch := epochEnd + // limit looping to committed epochs if epochEnd > t.latestAppliedEpoch { epochEnd = t.latestAppliedEpoch @@ -95,7 +97,7 @@ func (t *Tracker) ValidatorReward(validatorID iotago.AccountID, stakeAmount iota } decayProvider := t.apiProvider.APIForEpoch(epoch).ManaDecayProvider() - decayedEpochRewards, err := decayProvider.DecayManaByEpochs(iotago.Mana(unDecayedEpochRewards), epoch, epochEnd) + decayedEpochRewards, err := decayProvider.DecayManaByEpochs(iotago.Mana(unDecayedEpochRewards), epoch, claimingEpoch) if err != nil { return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate rewards with decay for epoch %d and validator accountID %s", epoch, validatorID) } From a13d5b0562176239f96593941fc750040d069c18 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Fri, 8 Dec 2023 09:47:42 +0100 Subject: [PATCH 24/30] Add fixed cost tests --- pkg/tests/validator_test.go | 68 ++++++++++++++++++++++++++++++------- pkg/testsuite/testsuite.go | 9 ++++- 2 files changed, 63 insertions(+), 14 deletions(-) diff --git a/pkg/tests/validator_test.go b/pkg/tests/validator_test.go index 41df0fe45..587c92acc 100644 --- a/pkg/tests/validator_test.go +++ b/pkg/tests/validator_test.go @@ -8,6 +8,7 @@ import ( "github.com/iotaledger/hive.go/core/safemath" "github.com/iotaledger/hive.go/lo" "github.com/iotaledger/hive.go/log" + "github.com/iotaledger/hive.go/runtime/options" "github.com/iotaledger/iota-core/pkg/testsuite" "github.com/iotaledger/iota-core/pkg/testsuite/mock" "github.com/stretchr/testify/require" @@ -15,7 +16,7 @@ import ( iotago "github.com/iotaledger/iota.go/v4" ) -func setupValidatorTestsuite(t *testing.T) *testsuite.TestSuite { +func setupValidatorTestsuite(t *testing.T, walletOpts ...options.Option[testsuite.WalletOptions]) *testsuite.TestSuite { var slotDuration uint8 = 5 var slotsPerEpochExponent uint8 = 5 var validationBlocksPerSlot uint8 = 5 @@ -42,8 +43,8 @@ func setupValidatorTestsuite(t *testing.T) *testsuite.TestSuite { ) // Add validator nodes to the network. This will add validator accounts to the snapshot. - vnode1 := ts.AddValidatorNode("node1", testsuite.WithWalletAmount(20_000_000)) - vnode2 := ts.AddValidatorNode("node2", testsuite.WithWalletAmount(25_000_000)) + vnode1 := ts.AddValidatorNode("node1", append(walletOpts, testsuite.WithWalletAmount(20_000_000))...) + vnode2 := ts.AddValidatorNode("node2", append(walletOpts, testsuite.WithWalletAmount(25_000_000))...) // Add a non-validator node to the network. This will not add any accounts to the snapshot. node3 := ts.AddNode("node3") // Add a default block issuer to the network. This will add another block issuer account to the snapshot. @@ -75,17 +76,38 @@ func Test_Validator_PerfectIssuance(t *testing.T) { ts := setupValidatorTestsuite(t) defer ts.Shutdown() - validationBlocksPerSlot := uint64(ts.API.ProtocolParameters().ValidationBlocksPerSlot()) + validationBlocksPerSlot := ts.API.ProtocolParameters().ValidationBlocksPerSlot() epochDurationSlots := uint64(ts.API.TimeProvider().EpochDurationSlots()) test := ValidatorTest{ ts: ts, - validationBlocksPerSlot: ts.API.ProtocolParameters().ValidationBlocksPerSlot(), + validationBlocksPerSlot: validationBlocksPerSlot, epochPerformanceFactors: EpochPerformanceMap{ // A validator cannot issue blocks in the genesis slot, so we deduct one slot worth of blocks. - 0: (validationBlocksPerSlot * (epochDurationSlots - 1)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), - 1: (validationBlocksPerSlot * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), - 2: (validationBlocksPerSlot * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 0: (uint64(validationBlocksPerSlot) * (epochDurationSlots - 1)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 1: (uint64(validationBlocksPerSlot) * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 2: (uint64(validationBlocksPerSlot) * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + }, + } + + validatorTest(t, test) +} + +func Test_Validator_PerfectIssuanceWithNonZeroFixedCost(t *testing.T) { + ts := setupValidatorTestsuite(t, testsuite.WithWalletFixedCost(1000)) + defer ts.Shutdown() + + validationBlocksPerSlot := ts.API.ProtocolParameters().ValidationBlocksPerSlot() + epochDurationSlots := uint64(ts.API.TimeProvider().EpochDurationSlots()) + + test := ValidatorTest{ + ts: ts, + validationBlocksPerSlot: validationBlocksPerSlot, + epochPerformanceFactors: EpochPerformanceMap{ + // A validator cannot issue blocks in the genesis slot, so we deduct one slot worth of blocks. + 0: (uint64(validationBlocksPerSlot) * (epochDurationSlots - 1)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 1: (uint64(validationBlocksPerSlot) * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 2: (uint64(validationBlocksPerSlot) * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), }, } @@ -117,17 +139,37 @@ func Test_Validator_UnderIssuance(t *testing.T) { defer ts.Shutdown() // Issue less than supposed to. - validationBlocksPerSlot := uint64(ts.API.ProtocolParameters().ValidationBlocksPerSlot() - 2) + validationBlocksPerSlot := ts.API.ProtocolParameters().ValidationBlocksPerSlot() - 2 epochDurationSlots := uint64(ts.API.TimeProvider().EpochDurationSlots()) test := ValidatorTest{ ts: ts, - validationBlocksPerSlot: uint8(validationBlocksPerSlot), + validationBlocksPerSlot: validationBlocksPerSlot, epochPerformanceFactors: EpochPerformanceMap{ // A validator cannot issue blocks in the genesis slot, so we deduct one slot worth of blocks. - 0: (validationBlocksPerSlot * (epochDurationSlots - 1)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), - 1: (validationBlocksPerSlot * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), - 2: (validationBlocksPerSlot * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 0: (uint64(validationBlocksPerSlot) * (epochDurationSlots - 1)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 1: (uint64(validationBlocksPerSlot) * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 2: (uint64(validationBlocksPerSlot) * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + }, + } + + validatorTest(t, test) +} + +func Test_Validator_FixedCostExceedsRewards(t *testing.T) { + ts := setupValidatorTestsuite(t, testsuite.WithWalletFixedCost(10_000_000)) + defer ts.Shutdown() + + validationBlocksPerSlot := ts.API.ProtocolParameters().ValidationBlocksPerSlot() + + test := ValidatorTest{ + ts: ts, + validationBlocksPerSlot: validationBlocksPerSlot, + epochPerformanceFactors: EpochPerformanceMap{ + // A validator cannot issue blocks in the genesis slot, so we deduct one slot worth of blocks. + 0: 0, + 1: 0, + 2: 0, }, } diff --git a/pkg/testsuite/testsuite.go b/pkg/testsuite/testsuite.go index da0f023e7..bdca497dd 100644 --- a/pkg/testsuite/testsuite.go +++ b/pkg/testsuite/testsuite.go @@ -78,6 +78,7 @@ func DefaultProtocolParameterOptions(networkName string) []options.Option[iotago type WalletOptions struct { Amount iotago.BaseToken + FixedCost iotago.Mana BlockIssuanceCredits iotago.BlockIssuanceCredits } @@ -87,6 +88,12 @@ func WithWalletAmount(amount iotago.BaseToken) options.Option[WalletOptions] { } } +func WithWalletFixedCost(fixedCost iotago.Mana) options.Option[WalletOptions] { + return func(opts *WalletOptions) { + opts.FixedCost = fixedCost + } +} + func WithWalletBlockIssuanceCredits(blockIssuanceCredits iotago.BlockIssuanceCredits) options.Option[WalletOptions] { return func(opts *WalletOptions) { opts.BlockIssuanceCredits = blockIssuanceCredits @@ -394,7 +401,7 @@ func (t *TestSuite) addNodeToPartition(name string, partition string, validator BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 2, StakedAmount: walletOptions.Amount, StakingEndEpoch: iotago.MaxEpochIndex, - FixedCost: iotago.Mana(0), + FixedCost: walletOptions.FixedCost, AccountID: node.Validator.AccountID, } From 58a74ea21feb43969585fe05afa17ac7f84c24d2 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Fri, 8 Dec 2023 11:17:05 +0100 Subject: [PATCH 25/30] Add huge stake test & fix protocol params --- pkg/tests/validator_test.go | 56 ++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/pkg/tests/validator_test.go b/pkg/tests/validator_test.go index 587c92acc..8ef2c0d31 100644 --- a/pkg/tests/validator_test.go +++ b/pkg/tests/validator_test.go @@ -16,6 +16,9 @@ import ( iotago "github.com/iotaledger/iota.go/v4" ) +// IOTA Mainnet Max Supply. +const MAX_SUPPLY = iotago.BaseToken(4_600_000_000_000_000) + func setupValidatorTestsuite(t *testing.T, walletOpts ...options.Option[testsuite.WalletOptions]) *testsuite.TestSuite { var slotDuration uint8 = 5 var slotsPerEpochExponent uint8 = 5 @@ -23,9 +26,12 @@ func setupValidatorTestsuite(t *testing.T, walletOpts ...options.Option[testsuit ts := testsuite.NewTestSuite(t, testsuite.WithProtocolParametersOptions( + iotago.WithSupplyOptions(MAX_SUPPLY, 63, 1, 17, 32, 21, 70), iotago.WithStakingOptions(1, validationBlocksPerSlot, 1), // Pick larger values for ManaShareCoefficient and DecayBalancingConstant for more precision in the calculations. - iotago.WithRewardsOptions(8, 8, 11, 1154, 200, 200), + iotago.WithRewardsOptions(8, 8, 11, 200, 200), + // Pick Increase/Decrease threshold in accordance with sanity checks (necessary because we changed slot duration). + iotago.WithCongestionControlOptions(1, 0, 0, 400_000, 300_000, 100_000, 1000, 100), iotago.WithTimeProviderOptions( 0, testsuite.GenesisTimeWithOffsetBySlots(1000, slotDuration), @@ -33,8 +39,8 @@ func setupValidatorTestsuite(t *testing.T, walletOpts ...options.Option[testsuit slotsPerEpochExponent, ), iotago.WithLivenessOptions( - testsuite.DefaultLivenessThresholdLowerBoundInSeconds, - testsuite.DefaultLivenessThresholdUpperBoundInSeconds, + 10, + 20, 5, 10, 15, @@ -43,8 +49,19 @@ func setupValidatorTestsuite(t *testing.T, walletOpts ...options.Option[testsuit ) // Add validator nodes to the network. This will add validator accounts to the snapshot. - vnode1 := ts.AddValidatorNode("node1", append(walletOpts, testsuite.WithWalletAmount(20_000_000))...) - vnode2 := ts.AddValidatorNode("node2", append(walletOpts, testsuite.WithWalletAmount(25_000_000))...) + vnode1 := ts.AddValidatorNode("node1", append( + []options.Option[testsuite.WalletOptions]{ + testsuite.WithWalletAmount(20_000_000), + }, + walletOpts..., + )...) + vnode2 := ts.AddValidatorNode("node2", append( + []options.Option[testsuite.WalletOptions]{ + testsuite.WithWalletAmount(25_000_000), + }, + walletOpts..., + )...) + // Add a non-validator node to the network. This will not add any accounts to the snapshot. node3 := ts.AddNode("node3") // Add a default block issuer to the network. This will add another block issuer account to the snapshot. @@ -114,6 +131,29 @@ func Test_Validator_PerfectIssuanceWithNonZeroFixedCost(t *testing.T) { validatorTest(t, test) } +func Test_Validator_PerfectIssuanceWithHugeStake(t *testing.T) { + // This gives both validators the max supply as stake, which is unrealistic, + // but is supposed to test if one validator with a huge stake causes an overflow in the rewards calculation. + ts := setupValidatorTestsuite(t, testsuite.WithWalletAmount(MAX_SUPPLY)) + defer ts.Shutdown() + + validationBlocksPerSlot := ts.API.ProtocolParameters().ValidationBlocksPerSlot() + epochDurationSlots := uint64(ts.API.TimeProvider().EpochDurationSlots()) + + test := ValidatorTest{ + ts: ts, + validationBlocksPerSlot: validationBlocksPerSlot, + epochPerformanceFactors: EpochPerformanceMap{ + // A validator cannot issue blocks in the genesis slot, so we deduct one slot worth of blocks. + 0: (uint64(validationBlocksPerSlot) * (epochDurationSlots - 1)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 1: (uint64(validationBlocksPerSlot) * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + 2: (uint64(validationBlocksPerSlot) * (epochDurationSlots)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), + }, + } + + validatorTest(t, test) +} + func Test_Validator_OverIssuance(t *testing.T) { ts := setupValidatorTestsuite(t) defer ts.Shutdown() @@ -157,7 +197,7 @@ func Test_Validator_UnderIssuance(t *testing.T) { } func Test_Validator_FixedCostExceedsRewards(t *testing.T) { - ts := setupValidatorTestsuite(t, testsuite.WithWalletFixedCost(10_000_000)) + ts := setupValidatorTestsuite(t, testsuite.WithWalletFixedCost(iotago.MaxMana)) defer ts.Shutdown() validationBlocksPerSlot := ts.API.ProtocolParameters().ValidationBlocksPerSlot() @@ -166,7 +206,6 @@ func Test_Validator_FixedCostExceedsRewards(t *testing.T) { ts: ts, validationBlocksPerSlot: validationBlocksPerSlot, epochPerformanceFactors: EpochPerformanceMap{ - // A validator cannot issue blocks in the genesis slot, so we deduct one slot worth of blocks. 0: 0, 1: 0, 2: 0, @@ -302,6 +341,9 @@ func calculateEpochReward(t *testing.T, ts *testsuite.TestSuite, accountID iotag // Calculates a validator's reward according to // https://github.com/iotaledger/tips/blob/tip40/tips/TIP-0040/tip-0040.md#calculations-4. +// +// For testing purposes, assumes that the account's staking data is the same in the latest committed slot +// as in the epoch for which to calculate rewards. func calculateValidatorReward(t *testing.T, ts *testsuite.TestSuite, accountID iotago.AccountID, rewards []reward, startEpoch iotago.EpochIndex, claimingEpoch iotago.EpochIndex) iotago.Mana { latestCommittedSlot := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Slot() accountData, exists, err := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Ledger.Account(accountID, latestCommittedSlot) From 2ea7bd1af9bf24e5fd0cb5aef3c9d0ff990e5c27 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Fri, 8 Dec 2023 14:15:01 +0100 Subject: [PATCH 26/30] Add claiming epoch param to Reward functions --- components/restapi/core/accounts.go | 27 ++++++---- pkg/protocol/engine/ledger/ledger/vm.go | 18 ++++--- .../sybilprotection/sybilprotection.go | 16 ++++-- .../sybilprotectionv1/performance/rewards.go | 50 ++++++++++-------- .../performance/testsuite_test.go | 51 +++++++++++++++---- .../sybilprotectionv1/sybilprotection.go | 8 +-- pkg/testsuite/mock/wallet_transactions.go | 19 ++++--- 7 files changed, 125 insertions(+), 64 deletions(-) diff --git a/components/restapi/core/accounts.go b/components/restapi/core/accounts.go index d6d379fd5..f324acc29 100644 --- a/components/restapi/core/accounts.go +++ b/components/restapi/core/accounts.go @@ -185,7 +185,7 @@ func rewardsByOutputID(c echo.Context) (*api.ManaRewardsResponse, error) { } var reward iotago.Mana - var actualStart, actualEnd iotago.EpochIndex + var firstRewardEpoch, lastRewardEpoch iotago.EpochIndex switch utxoOutput.OutputType() { case iotago.OutputAccount: //nolint:forcetypeassert @@ -198,33 +198,38 @@ func rewardsByOutputID(c echo.Context) (*api.ManaRewardsResponse, error) { //nolint:forcetypeassert stakingFeature := feature.(*iotago.StakingFeature) + apiForSlot := deps.Protocol.APIForSlot(slotIndex) + futureBoundedSlotIndex := slotIndex + apiForSlot.ProtocolParameters().MinCommittableAge() + claimingEpoch := apiForSlot.TimeProvider().EpochFromSlot(futureBoundedSlotIndex) + // check if the account is a validator - reward, actualStart, actualEnd, err = deps.Protocol.Engines.Main.Get().SybilProtection.ValidatorReward( + reward, firstRewardEpoch, lastRewardEpoch, err = deps.Protocol.Engines.Main.Get().SybilProtection.ValidatorReward( accountOutput.AccountID, - stakingFeature.StakedAmount, - stakingFeature.StartEpoch, - stakingFeature.EndEpoch, + stakingFeature, + claimingEpoch, ) case iotago.OutputDelegation: //nolint:forcetypeassert delegationOutput := utxoOutput.Output().(*iotago.DelegationOutput) delegationEnd := delegationOutput.EndEpoch + apiForSlot := deps.Protocol.APIForSlot(slotIndex) + futureBoundedSlotIndex := slotIndex + apiForSlot.ProtocolParameters().MinCommittableAge() + claimingEpoch := apiForSlot.TimeProvider().EpochFromSlot(futureBoundedSlotIndex) // If Delegation ID is zeroed, the output is in delegating state, which means its End Epoch is not set and we must use the // "last epoch" for the rewards calculation. // In this case the calculation must be consistent with the rewards calculation at execution time, so a client can specify // a slot index explicitly, which should be equal to the slot it uses as the commitment input for the claiming transaction. if delegationOutput.DelegationID.Empty() { - apiForSlot := deps.Protocol.APIForSlot(slotIndex) - futureBoundedSlotIndex := slotIndex + apiForSlot.ProtocolParameters().MinCommittableAge() - delegationEnd = apiForSlot.TimeProvider().EpochFromSlot(futureBoundedSlotIndex) - iotago.EpochIndex(1) + delegationEnd = claimingEpoch - iotago.EpochIndex(1) } - reward, actualStart, actualEnd, err = deps.Protocol.Engines.Main.Get().SybilProtection.DelegatorReward( + reward, firstRewardEpoch, lastRewardEpoch, err = deps.Protocol.Engines.Main.Get().SybilProtection.DelegatorReward( delegationOutput.ValidatorAddress.AccountID(), delegationOutput.DelegatedAmount, delegationOutput.StartEpoch, delegationEnd, + claimingEpoch, ) } if err != nil { @@ -232,8 +237,8 @@ func rewardsByOutputID(c echo.Context) (*api.ManaRewardsResponse, error) { } return &api.ManaRewardsResponse{ - StartEpoch: actualStart, - EndEpoch: actualEnd, + StartEpoch: firstRewardEpoch, + EndEpoch: lastRewardEpoch, Rewards: reward, }, nil } diff --git a/pkg/protocol/engine/ledger/ledger/vm.go b/pkg/protocol/engine/ledger/ledger/vm.go index f86162e61..78fb952fd 100644 --- a/pkg/protocol/engine/ledger/ledger/vm.go +++ b/pkg/protocol/engine/ledger/ledger/vm.go @@ -97,9 +97,13 @@ func (v *VM) ValidateSignatures(signedTransaction mempool.SignedTransaction, res accountID = iotago.AccountIDFromOutputID(outputID) } - reward, _, _, rewardErr := v.ledger.sybilProtection.ValidatorReward(accountID, stakingFeature.StakedAmount, stakingFeature.StartEpoch, stakingFeature.EndEpoch) + apiForSlot := v.ledger.apiProvider.APIForSlot(commitmentInput.Slot) + futureBoundedSlotIndex := commitmentInput.Slot + apiForSlot.ProtocolParameters().MinCommittableAge() + claimingEpoch := apiForSlot.TimeProvider().EpochFromSlot(futureBoundedSlotIndex) + + reward, _, _, rewardErr := v.ledger.sybilProtection.ValidatorReward(accountID, stakingFeature, claimingEpoch) if rewardErr != nil { - return nil, ierrors.Wrapf(iotago.ErrFailedToClaimStakingReward, "failed to get Validator reward for AccountOutput %s at index %d (StakedAmount: %d, StartEpoch: %d, EndEpoch: %d", outputID, inp.Index, stakingFeature.StakedAmount, stakingFeature.StartEpoch, stakingFeature.EndEpoch) + return nil, ierrors.Wrapf(iotago.ErrFailedToClaimStakingReward, "failed to get Validator reward for AccountOutput %s at index %d (StakedAmount: %d, StartEpoch: %d, EndEpoch: %d, claimingEpoch: %d", outputID, inp.Index, stakingFeature.StakedAmount, stakingFeature.StartEpoch, stakingFeature.EndEpoch, claimingEpoch) } rewardInputSet[accountID] = reward @@ -108,17 +112,19 @@ func (v *VM) ValidateSignatures(signedTransaction mempool.SignedTransaction, res delegationID := castOutput.DelegationID delegationEnd := castOutput.EndEpoch + apiForSlot := v.ledger.apiProvider.APIForSlot(commitmentInput.Slot) + futureBoundedSlotIndex := commitmentInput.Slot + apiForSlot.ProtocolParameters().MinCommittableAge() + claimingEpoch := apiForSlot.TimeProvider().EpochFromSlot(futureBoundedSlotIndex) + if delegationID.Empty() { delegationID = iotago.DelegationIDFromOutputID(outputID) // If Delegation ID is zeroed, the output is in delegating state, which means its End Epoch is not set and we must use the // "last epoch", which is the epoch index corresponding to the future bounded slot index minus 1. - apiForSlot := v.ledger.apiProvider.APIForSlot(commitmentInput.Slot) - futureBoundedSlotIndex := commitmentInput.Slot + apiForSlot.ProtocolParameters().MinCommittableAge() - delegationEnd = apiForSlot.TimeProvider().EpochFromSlot(futureBoundedSlotIndex) - iotago.EpochIndex(1) + delegationEnd = claimingEpoch - iotago.EpochIndex(1) } - reward, _, _, rewardErr := v.ledger.sybilProtection.DelegatorReward(castOutput.ValidatorAddress.AccountID(), castOutput.DelegatedAmount, castOutput.StartEpoch, delegationEnd) + reward, _, _, rewardErr := v.ledger.sybilProtection.DelegatorReward(castOutput.ValidatorAddress.AccountID(), castOutput.DelegatedAmount, castOutput.StartEpoch, delegationEnd, claimingEpoch) if rewardErr != nil { return nil, ierrors.Wrapf(iotago.ErrFailedToClaimDelegationReward, "failed to get Delegator reward for DelegationOutput %s at index %d (StakedAmount: %d, StartEpoch: %d, EndEpoch: %d", outputID, inp.Index, castOutput.DelegatedAmount, castOutput.StartEpoch, castOutput.EndEpoch) } diff --git a/pkg/protocol/sybilprotection/sybilprotection.go b/pkg/protocol/sybilprotection/sybilprotection.go index 147e8580c..675ee1f4a 100644 --- a/pkg/protocol/sybilprotection/sybilprotection.go +++ b/pkg/protocol/sybilprotection/sybilprotection.go @@ -16,12 +16,18 @@ type SybilProtection interface { EligibleValidators(epoch iotago.EpochIndex) (accounts.AccountsData, error) OrderedRegisteredCandidateValidatorsList(epoch iotago.EpochIndex) ([]*api.ValidatorResponse, error) IsCandidateActive(validatorID iotago.AccountID, epoch iotago.EpochIndex) (bool, error) - // ValidatorReward returns the amount of mana that a validator has earned in a given epoch range. - // The actual used epoch range is returned, only until usedEnd the decay was applied. - ValidatorReward(validatorID iotago.AccountID, stakeAmount iotago.BaseToken, epochStart, epochEnd iotago.EpochIndex) (validatorReward iotago.Mana, decayedStart, decayedEnd iotago.EpochIndex, err error) + // ValidatorReward returns the amount of mana that a validator with the given staking feature has earned in the feature's epoch range. + // + // The first epoch in which rewards existed is returned (firstRewardEpoch). + // Since the validator may still be active and the EndEpoch might be in the future, the epoch until which rewards were calculated is returned in addition to the first epoch in which rewards existed (lastRewardEpoch). + // The rewards are decayed until claimingEpoch, which should be set to the epoch in which the rewards would be claimed. + ValidatorReward(validatorID iotago.AccountID, stakingFeature *iotago.StakingFeature, claimingEpoch iotago.EpochIndex) (validatorReward iotago.Mana, firstRewardEpoch iotago.EpochIndex, lastRewardEpoch iotago.EpochIndex, err error) // DelegatorReward returns the amount of mana that a delegator has earned in a given epoch range. - // The actual used epoch range is returned, only until usedEnd the decay was applied. - DelegatorReward(validatorID iotago.AccountID, delegatedAmount iotago.BaseToken, epochStart, epochEnd iotago.EpochIndex) (delegatorsReward iotago.Mana, decayedStart, decayedEnd iotago.EpochIndex, err error) + // + // The first epoch in which rewards existed is returned (firstRewardEpoch). + // Since the Delegation Output's EndEpoch might be unset due to an ongoing delegation, the epoch until which rewards were calculated is also returned (lastRewardEpoch). + // The rewards are decayed until claimingEpoch, which should be set to the epoch in which the rewards would be claimed. + DelegatorReward(validatorID iotago.AccountID, delegatedAmount iotago.BaseToken, epochStart iotago.EpochIndex, epochEnd iotago.EpochIndex, claimingEpoch iotago.EpochIndex) (delegatorReward iotago.Mana, firstRewardEpoch iotago.EpochIndex, lastRewardEpoch iotago.EpochIndex, err error) SeatManager() seatmanager.SeatManager CommitSlot(iotago.SlotIndex) (iotago.Identifier, iotago.Identifier, error) Import(io.ReadSeeker) error diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go index 31d13e58d..271a6fc76 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go @@ -20,18 +20,21 @@ func (t *Tracker) RewardsRoot(epoch iotago.EpochIndex) (iotago.Identifier, error return m.Root(), nil } -func (t *Tracker) ValidatorReward(validatorID iotago.AccountID, stakeAmount iotago.BaseToken, epochStart iotago.EpochIndex, epochEnd iotago.EpochIndex) (iotago.Mana, iotago.EpochIndex, iotago.EpochIndex, error) { +func (t *Tracker) ValidatorReward(validatorID iotago.AccountID, stakingFeature *iotago.StakingFeature, claimingEpoch iotago.EpochIndex) (validatorReward iotago.Mana, firstRewardEpoch iotago.EpochIndex, lastRewardEpoch iotago.EpochIndex, err error) { t.mutex.RLock() defer t.mutex.RUnlock() - var validatorReward iotago.Mana + validatorReward = 0 + stakedAmount := stakingFeature.StakedAmount + firstRewardEpoch = stakingFeature.StartEpoch + lastRewardEpoch = stakingFeature.EndEpoch - // limit looping to committed epochs - if epochEnd > t.latestAppliedEpoch { - epochEnd = t.latestAppliedEpoch + // Limit reward fetching only to committed epochs. + if lastRewardEpoch > t.latestAppliedEpoch { + lastRewardEpoch = t.latestAppliedEpoch } - for epoch := epochStart; epoch <= epochEnd; epoch++ { + for epoch := firstRewardEpoch; epoch <= lastRewardEpoch; epoch++ { rewardsForAccountInEpoch, exists, err := t.rewardsForAccount(validatorID, epoch) if err != nil { return 0, 0, 0, ierrors.Wrapf(err, "failed to get rewards for account %s in epoch %d", validatorID, epoch) @@ -39,8 +42,8 @@ func (t *Tracker) ValidatorReward(validatorID iotago.AccountID, stakeAmount iota if !exists || rewardsForAccountInEpoch.PoolStake == 0 { // updating epoch start for beginning epochs without the reward - if epoch < epochEnd && epochStart == epoch { - epochStart = epoch + 1 + if epoch < lastRewardEpoch && firstRewardEpoch == epoch { + firstRewardEpoch = epoch + 1 } continue @@ -55,7 +58,7 @@ func (t *Tracker) ValidatorReward(validatorID iotago.AccountID, stakeAmount iota return 0, 0, 0, ierrors.Errorf("pool stats for epoch %d and validator accountID %s are nil", epoch, validatorID) } - // if validator's fixed cost is greater than earned reward, all reward goes for delegators + // If a validator's fixed cost is greater than the earned reward, all rewards go to the delegators. if rewardsForAccountInEpoch.PoolRewards < rewardsForAccountInEpoch.FixedCost { continue } @@ -79,7 +82,7 @@ func (t *Tracker) ValidatorReward(validatorID iotago.AccountID, stakeAmount iota return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate profit margin factor due to overflow for epoch %d and validator accountID %s", epoch, validatorID) } - residualValidatorFactor, err := safemath.Safe64MulDiv(result>>profitMarginExponent, uint64(stakeAmount), uint64(rewardsForAccountInEpoch.PoolStake)) + residualValidatorFactor, err := safemath.Safe64MulDiv(result>>profitMarginExponent, uint64(stakedAmount), uint64(rewardsForAccountInEpoch.PoolStake)) if err != nil { return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate residual validator factor due to overflow for epoch %d and validator accountID %s", epoch, validatorID) } @@ -89,13 +92,13 @@ func (t *Tracker) ValidatorReward(validatorID iotago.AccountID, stakeAmount iota return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate un-decayed epoch reward due to overflow for epoch %d and validator accountID %s", epoch, validatorID) } - unDecayedEpochRewards, err := safemath.SafeAdd(result, residualValidatorFactor) + undecayedEpochRewards, err := safemath.SafeAdd(result, residualValidatorFactor) if err != nil { return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate un-decayed epoch rewards due to overflow for epoch %d and validator accountID %s", epoch, validatorID) } decayProvider := t.apiProvider.APIForEpoch(epoch).ManaDecayProvider() - decayedEpochRewards, err := decayProvider.DecayManaByEpochs(iotago.Mana(unDecayedEpochRewards), epoch, epochEnd) + decayedEpochRewards, err := decayProvider.DecayManaByEpochs(iotago.Mana(undecayedEpochRewards), epoch, claimingEpoch) if err != nil { return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate rewards with decay for epoch %d and validator accountID %s", epoch, validatorID) } @@ -106,21 +109,24 @@ func (t *Tracker) ValidatorReward(validatorID iotago.AccountID, stakeAmount iota } } - return validatorReward, epochStart, epochEnd, nil + return validatorReward, firstRewardEpoch, lastRewardEpoch, nil } -func (t *Tracker) DelegatorReward(validatorID iotago.AccountID, delegatedAmount iotago.BaseToken, epochStart iotago.EpochIndex, epochEnd iotago.EpochIndex) (iotago.Mana, iotago.EpochIndex, iotago.EpochIndex, error) { +func (t *Tracker) DelegatorReward(validatorID iotago.AccountID, delegatedAmount iotago.BaseToken, epochStart iotago.EpochIndex, epochEnd iotago.EpochIndex, claimingEpoch iotago.EpochIndex) (delegatorReward iotago.Mana, firstRewardEpoch iotago.EpochIndex, lastRewardEpoch iotago.EpochIndex, err error) { t.mutex.RLock() defer t.mutex.RUnlock() var delegatorsReward iotago.Mana + firstRewardEpoch = epochStart + lastRewardEpoch = epochEnd + // limit looping to committed epochs - if epochEnd > t.latestAppliedEpoch { - epochEnd = t.latestAppliedEpoch + if lastRewardEpoch > t.latestAppliedEpoch { + lastRewardEpoch = t.latestAppliedEpoch } - for epoch := epochStart; epoch <= epochEnd; epoch++ { + for epoch := firstRewardEpoch; epoch <= lastRewardEpoch; epoch++ { rewardsForAccountInEpoch, exists, err := t.rewardsForAccount(validatorID, epoch) if err != nil { return 0, 0, 0, ierrors.Wrapf(err, "failed to get rewards for account %s in epoch %d", validatorID, epoch) @@ -128,8 +134,8 @@ func (t *Tracker) DelegatorReward(validatorID iotago.AccountID, delegatedAmount if !exists || rewardsForAccountInEpoch.PoolStake == 0 { // updating epoch start for beginning epochs without the reward - if epochStart == epoch { - epochStart = epoch + 1 + if firstRewardEpoch == epoch { + firstRewardEpoch = epoch + 1 } continue @@ -166,13 +172,13 @@ func (t *Tracker) DelegatorReward(validatorID iotago.AccountID, delegatedAmount return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate unDecayedEpochRewards due to overflow for epoch %d and validator accountID %s", epoch, validatorID) } - unDecayedEpochRewards, err := safemath.SafeDiv(result, uint64(rewardsForAccountInEpoch.PoolStake)) + undecayedEpochRewards, err := safemath.SafeDiv(result, uint64(rewardsForAccountInEpoch.PoolStake)) if err != nil { return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate unDecayedEpochRewards due to overflow for epoch %d and validator accountID %s", epoch, validatorID) } decayProvider := t.apiProvider.APIForEpoch(epoch).ManaDecayProvider() - decayedEpochRewards, err := decayProvider.DecayManaByEpochs(iotago.Mana(unDecayedEpochRewards), epoch, epochEnd) + decayedEpochRewards, err := decayProvider.DecayManaByEpochs(iotago.Mana(undecayedEpochRewards), epoch, claimingEpoch) if err != nil { return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate rewards with decay for epoch %d and validator accountID %s", epoch, validatorID) } @@ -180,7 +186,7 @@ func (t *Tracker) DelegatorReward(validatorID iotago.AccountID, delegatedAmount delegatorsReward += decayedEpochRewards } - return delegatorsReward, epochStart, epochEnd, nil + return delegatorsReward, firstRewardEpoch, lastRewardEpoch, nil } func (t *Tracker) rewardsMap(epoch iotago.EpochIndex) (ads.Map[iotago.Identifier, iotago.AccountID, *model.PoolRewards], error) { diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go index 77c48a11c..cf24c7047 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go @@ -164,14 +164,19 @@ func (t *TestSuite) AssertEpochRewards(epoch iotago.EpochIndex, actions map[stri poolRewards := t.poolRewards[epoch][alias].PoolRewards expectedValidatorReward := t.validatorReward(alias, epoch, t.epochStats[epoch].ProfitMargin, uint64(poolRewards), uint64(action.ValidatorStake), uint64(action.PoolStake), uint64(action.FixedCost), action) + mockStakingFeature := &iotago.StakingFeature{ + StakedAmount: actions[alias].ValidatorStake, + StartEpoch: epoch, + EndEpoch: epoch, + } accountID := t.Account(alias, true) - actualValidatorReward, _, _, err := t.Instance.ValidatorReward(accountID, actions[alias].ValidatorStake, epoch, epoch) + actualValidatorReward, _, _, err := t.Instance.ValidatorReward(accountID, mockStakingFeature, epoch) require.NoError(t.T, err) require.Equal(t.T, expectedValidatorReward, actualValidatorReward) for delegatedAmount := range action.Delegators { expectedDelegatorReward := t.delegatorReward(epoch, t.epochStats[epoch].ProfitMargin, uint64(poolRewards), uint64(delegatedAmount), uint64(action.PoolStake), uint64(action.FixedCost), action) - actualDelegatorReward, _, _, err := t.Instance.DelegatorReward(accountID, iotago.BaseToken(delegatedAmount), epoch, epoch) + actualDelegatorReward, _, _, err := t.Instance.DelegatorReward(accountID, iotago.BaseToken(delegatedAmount), epoch, epoch, epoch) require.NoError(t.T, err) require.Equal(t.T, expectedDelegatorReward, actualDelegatorReward) } @@ -180,29 +185,39 @@ func (t *TestSuite) AssertEpochRewards(epoch iotago.EpochIndex, actions map[stri } func (t *TestSuite) AssertNoReward(alias string, epoch iotago.EpochIndex, actions map[string]*EpochActions) { + mockStakingFeature := &iotago.StakingFeature{ + StakedAmount: actions[alias].ValidatorStake, + StartEpoch: epoch, + EndEpoch: epoch, + } accID := t.Account(alias, false) - actualValidatorReward, _, _, err := t.Instance.ValidatorReward(accID, actions[alias].ValidatorStake, epoch, epoch) + actualValidatorReward, _, _, err := t.Instance.ValidatorReward(accID, mockStakingFeature, epoch) require.NoError(t.T, err) require.Equal(t.T, iotago.Mana(0), actualValidatorReward) action, exists := actions[alias] require.True(t.T, exists) for delegatedAmount := range action.Delegators { - actualDelegatorReward, _, _, err := t.Instance.DelegatorReward(accID, iotago.BaseToken(delegatedAmount), epoch, epoch) + actualDelegatorReward, _, _, err := t.Instance.DelegatorReward(accID, iotago.BaseToken(delegatedAmount), epoch, epoch, epoch) require.NoError(t.T, err) require.Equal(t.T, iotago.Mana(0), actualDelegatorReward) } } func (t *TestSuite) AssertRewardForDelegatorsOnly(alias string, epoch iotago.EpochIndex, actions map[string]*EpochActions) { + mockStakingFeature := &iotago.StakingFeature{ + StakedAmount: actions[alias].ValidatorStake, + StartEpoch: epoch, + EndEpoch: epoch, + } accID := t.Account(alias, false) - actualValidatorReward, _, _, err := t.Instance.ValidatorReward(accID, actions[alias].ValidatorStake, epoch, epoch) + actualValidatorReward, _, _, err := t.Instance.ValidatorReward(accID, mockStakingFeature, epoch) require.NoError(t.T, err) require.Equal(t.T, iotago.Mana(0), actualValidatorReward) action, exists := actions[alias] require.True(t.T, exists) for delegatedAmount := range action.Delegators { - actualDelegatorReward, _, _, err := t.Instance.DelegatorReward(accID, iotago.BaseToken(delegatedAmount), epoch, epoch) + actualDelegatorReward, _, _, err := t.Instance.DelegatorReward(accID, iotago.BaseToken(delegatedAmount), epoch, epoch, epoch) expectedDelegatorReward := t.delegatorReward(epoch, t.epochStats[epoch].ProfitMargin, uint64(t.poolRewards[epoch][alias].PoolRewards), uint64(delegatedAmount), uint64(action.PoolStake), uint64(action.FixedCost), action) require.NoError(t.T, err) @@ -320,12 +335,18 @@ func (t *TestSuite) calculateExpectedRewards(epochsCount int, epochActions map[s delegatorRewardPerAccount[epoch] = make(map[string]iotago.Mana) validatorRewardPerAccount[epoch] = make(map[string]iotago.Mana) for aliasAccount := range epochActions { - reward, _, _, err := t.Instance.DelegatorReward(t.Account(aliasAccount, false), 1, epoch, epoch) + reward, _, _, err := t.Instance.DelegatorReward(t.Account(aliasAccount, false), 1, epoch, epoch, epoch) require.NoError(t.T, err) delegatorRewardPerAccount[epoch][aliasAccount] = reward } for aliasAccount := range epochActions { - reward, _, _, err := t.Instance.ValidatorReward(t.Account(aliasAccount, true), 1, epoch, epoch) + reward, _, _, err := t.Instance.ValidatorReward(t.Account(aliasAccount, true), + &iotago.StakingFeature{ + StakedAmount: 1, + StartEpoch: epoch, + EndEpoch: epoch, + }, + epoch) require.NoError(t.T, err) validatorRewardPerAccount[epoch][aliasAccount] = reward } @@ -334,12 +355,22 @@ func (t *TestSuite) calculateExpectedRewards(epochsCount int, epochActions map[s } func (t *TestSuite) AssertValidatorRewardGreaterThan(alias1 string, alias2 string, epoch iotago.EpochIndex, actions map[string]*EpochActions) { + mockStakingFeature1 := &iotago.StakingFeature{ + StakedAmount: actions[alias1].ValidatorStake, + StartEpoch: epoch, + EndEpoch: epoch, + } + mockStakingFeature2 := &iotago.StakingFeature{ + StakedAmount: actions[alias2].ValidatorStake, + StartEpoch: epoch, + EndEpoch: epoch, + } accID1 := t.Account(alias1, false) - actualValidatorReward1, _, _, err := t.Instance.ValidatorReward(accID1, actions[alias1].ValidatorStake, epoch, epoch) + actualValidatorReward1, _, _, err := t.Instance.ValidatorReward(accID1, mockStakingFeature1, epoch) require.NoError(t.T, err) accID2 := t.Account(alias2, false) - actualValidatorReward2, _, _, err := t.Instance.ValidatorReward(accID2, actions[alias2].ValidatorStake, epoch, epoch) + actualValidatorReward2, _, _, err := t.Instance.ValidatorReward(accID2, mockStakingFeature2, epoch) require.NoError(t.T, err) require.Greater(t.T, actualValidatorReward1, actualValidatorReward2) diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go b/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go index 487c1e0f3..a7b78e92c 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go @@ -246,12 +246,12 @@ func (o *SybilProtection) SeatManager() seatmanager.SeatManager { return o.seatManager } -func (o *SybilProtection) ValidatorReward(validatorID iotago.AccountID, stakeAmount iotago.BaseToken, epochStart iotago.EpochIndex, epochEnd iotago.EpochIndex) (validatorReward iotago.Mana, actualEpochStart iotago.EpochIndex, actualEpochEnd iotago.EpochIndex, err error) { - return o.performanceTracker.ValidatorReward(validatorID, stakeAmount, epochStart, epochEnd) +func (o *SybilProtection) ValidatorReward(validatorID iotago.AccountID, stakingFeature *iotago.StakingFeature, claimingEpoch iotago.EpochIndex) (validatorReward iotago.Mana, firstRewardEpoch iotago.EpochIndex, lastRewardEpoch iotago.EpochIndex, err error) { + return o.performanceTracker.ValidatorReward(validatorID, stakingFeature, claimingEpoch) } -func (o *SybilProtection) DelegatorReward(validatorID iotago.AccountID, delegatedAmount iotago.BaseToken, epochStart iotago.EpochIndex, epochEnd iotago.EpochIndex) (delegatorsReward iotago.Mana, actualEpochStart iotago.EpochIndex, actualEpochEnd iotago.EpochIndex, err error) { - return o.performanceTracker.DelegatorReward(validatorID, delegatedAmount, epochStart, epochEnd) +func (o *SybilProtection) DelegatorReward(validatorID iotago.AccountID, delegatedAmount iotago.BaseToken, epochStart iotago.EpochIndex, epochEnd iotago.EpochIndex, claimingEpoch iotago.EpochIndex) (delegatorReward iotago.Mana, firstRewardEpoch iotago.EpochIndex, lastRewardEpoch iotago.EpochIndex, err error) { + return o.performanceTracker.DelegatorReward(validatorID, delegatedAmount, epochStart, epochEnd, claimingEpoch) } func (o *SybilProtection) Import(reader io.ReadSeeker) error { diff --git a/pkg/testsuite/mock/wallet_transactions.go b/pkg/testsuite/mock/wallet_transactions.go index 911ba4622..62f489aad 100644 --- a/pkg/testsuite/mock/wallet_transactions.go +++ b/pkg/testsuite/mock/wallet_transactions.go @@ -453,17 +453,20 @@ func (w *Wallet) ClaimValidatorRewards(transactionName string, inputName string) panic(fmt.Sprintf("output with alias %s is not *iotago.AccountOutput", inputName)) } + apiForSlot := w.Node.Protocol.APIForSlot(w.currentSlot) + latestCommittedSlot := w.Node.Protocol.Chains.Main.Get().LatestCommitment.Get().Slot() + futureBoundedSlotIndex := latestCommittedSlot + apiForSlot.ProtocolParameters().MinCommittableAge() + claimingEpoch := apiForSlot.TimeProvider().EpochFromSlot(futureBoundedSlotIndex) + rewardMana, _, _, err := w.Node.Protocol.Engines.Main.Get().SybilProtection.ValidatorReward( inputAccount.AccountID, - inputAccount.FeatureSet().Staking().StakedAmount, - inputAccount.FeatureSet().Staking().StartEpoch, - inputAccount.FeatureSet().Staking().EndEpoch, + inputAccount.FeatureSet().Staking(), + claimingEpoch, ) if err != nil { panic(fmt.Sprintf("failed to calculate reward for output %s: %s", inputName, err)) } - apiForSlot := w.Node.Protocol.APIForSlot(w.currentSlot) potentialMana := w.PotentialMana(apiForSlot, input) storedMana := w.StoredMana(apiForSlot, input) @@ -541,12 +544,14 @@ func (w *Wallet) ClaimDelegatorRewards(transactionName string, inputName string) } apiForSlot := w.Node.Protocol.APIForSlot(w.currentSlot) + futureBoundedSlotIndex := w.currentSlot + apiForSlot.ProtocolParameters().MinCommittableAge() + claimingEpoch := apiForSlot.TimeProvider().EpochFromSlot(futureBoundedSlotIndex) + delegationEnd := inputDelegation.EndEpoch // If Delegation ID is zeroed, the output is in delegating state, which means its End Epoch is not set and we must use the // "last epoch" for the rewards calculation. if inputDelegation.DelegationID.Empty() { - futureBoundedSlotIndex := w.currentSlot + apiForSlot.ProtocolParameters().MinCommittableAge() - delegationEnd = apiForSlot.TimeProvider().EpochFromSlot(futureBoundedSlotIndex) - iotago.EpochIndex(1) + delegationEnd = claimingEpoch - iotago.EpochIndex(1) } rewardMana, _, _, err := w.Node.Protocol.Engines.Main.Get().SybilProtection.DelegatorReward( @@ -554,7 +559,9 @@ func (w *Wallet) ClaimDelegatorRewards(transactionName string, inputName string) inputDelegation.DelegatedAmount, inputDelegation.StartEpoch, delegationEnd, + claimingEpoch, ) + if err != nil { panic(fmt.Sprintf("failed to calculate reward for output %s: %s", inputName, err)) } From 960c5355ba46564be1c349345409a09f088afa3a Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Fri, 8 Dec 2023 15:09:10 +0100 Subject: [PATCH 27/30] Inline mocked staking features --- .../performance/testsuite_test.go | 65 ++++++++++--------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go index cf24c7047..6f47f856a 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go @@ -164,13 +164,14 @@ func (t *TestSuite) AssertEpochRewards(epoch iotago.EpochIndex, actions map[stri poolRewards := t.poolRewards[epoch][alias].PoolRewards expectedValidatorReward := t.validatorReward(alias, epoch, t.epochStats[epoch].ProfitMargin, uint64(poolRewards), uint64(action.ValidatorStake), uint64(action.PoolStake), uint64(action.FixedCost), action) - mockStakingFeature := &iotago.StakingFeature{ - StakedAmount: actions[alias].ValidatorStake, - StartEpoch: epoch, - EndEpoch: epoch, - } accountID := t.Account(alias, true) - actualValidatorReward, _, _, err := t.Instance.ValidatorReward(accountID, mockStakingFeature, epoch) + actualValidatorReward, _, _, err := t.Instance.ValidatorReward(accountID, + &iotago.StakingFeature{ + StakedAmount: actions[alias].ValidatorStake, + StartEpoch: epoch, + EndEpoch: epoch, + }, + epoch) require.NoError(t.T, err) require.Equal(t.T, expectedValidatorReward, actualValidatorReward) @@ -185,13 +186,14 @@ func (t *TestSuite) AssertEpochRewards(epoch iotago.EpochIndex, actions map[stri } func (t *TestSuite) AssertNoReward(alias string, epoch iotago.EpochIndex, actions map[string]*EpochActions) { - mockStakingFeature := &iotago.StakingFeature{ - StakedAmount: actions[alias].ValidatorStake, - StartEpoch: epoch, - EndEpoch: epoch, - } accID := t.Account(alias, false) - actualValidatorReward, _, _, err := t.Instance.ValidatorReward(accID, mockStakingFeature, epoch) + actualValidatorReward, _, _, err := t.Instance.ValidatorReward(accID, + &iotago.StakingFeature{ + StakedAmount: actions[alias].ValidatorStake, + StartEpoch: epoch, + EndEpoch: epoch, + }, + epoch) require.NoError(t.T, err) require.Equal(t.T, iotago.Mana(0), actualValidatorReward) action, exists := actions[alias] @@ -204,13 +206,14 @@ func (t *TestSuite) AssertNoReward(alias string, epoch iotago.EpochIndex, action } func (t *TestSuite) AssertRewardForDelegatorsOnly(alias string, epoch iotago.EpochIndex, actions map[string]*EpochActions) { - mockStakingFeature := &iotago.StakingFeature{ - StakedAmount: actions[alias].ValidatorStake, - StartEpoch: epoch, - EndEpoch: epoch, - } accID := t.Account(alias, false) - actualValidatorReward, _, _, err := t.Instance.ValidatorReward(accID, mockStakingFeature, epoch) + actualValidatorReward, _, _, err := t.Instance.ValidatorReward(accID, + &iotago.StakingFeature{ + StakedAmount: actions[alias].ValidatorStake, + StartEpoch: epoch, + EndEpoch: epoch, + }, + epoch) require.NoError(t.T, err) require.Equal(t.T, iotago.Mana(0), actualValidatorReward) action, exists := actions[alias] @@ -355,22 +358,24 @@ func (t *TestSuite) calculateExpectedRewards(epochsCount int, epochActions map[s } func (t *TestSuite) AssertValidatorRewardGreaterThan(alias1 string, alias2 string, epoch iotago.EpochIndex, actions map[string]*EpochActions) { - mockStakingFeature1 := &iotago.StakingFeature{ - StakedAmount: actions[alias1].ValidatorStake, - StartEpoch: epoch, - EndEpoch: epoch, - } - mockStakingFeature2 := &iotago.StakingFeature{ - StakedAmount: actions[alias2].ValidatorStake, - StartEpoch: epoch, - EndEpoch: epoch, - } accID1 := t.Account(alias1, false) - actualValidatorReward1, _, _, err := t.Instance.ValidatorReward(accID1, mockStakingFeature1, epoch) + actualValidatorReward1, _, _, err := t.Instance.ValidatorReward(accID1, + &iotago.StakingFeature{ + StakedAmount: actions[alias1].ValidatorStake, + StartEpoch: epoch, + EndEpoch: epoch, + }, + epoch) require.NoError(t.T, err) accID2 := t.Account(alias2, false) - actualValidatorReward2, _, _, err := t.Instance.ValidatorReward(accID2, mockStakingFeature2, epoch) + actualValidatorReward2, _, _, err := t.Instance.ValidatorReward(accID2, + &iotago.StakingFeature{ + StakedAmount: actions[alias2].ValidatorStake, + StartEpoch: epoch, + EndEpoch: epoch, + }, + epoch) require.NoError(t.T, err) require.Greater(t.T, actualValidatorReward1, actualValidatorReward2) From 0a4827f80fb04a53447864249fdcaba3acc0ebb6 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Fri, 8 Dec 2023 16:34:30 +0100 Subject: [PATCH 28/30] Decay rewards by one epoch fewer --- .../sybilprotectionv1/performance/rewards.go | 16 ++++++++++++++++ pkg/tests/validator_test.go | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go index 271a6fc76..1f3d10e4a 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go @@ -29,6 +29,14 @@ func (t *Tracker) ValidatorReward(validatorID iotago.AccountID, stakingFeature * firstRewardEpoch = stakingFeature.StartEpoch lastRewardEpoch = stakingFeature.EndEpoch + // When claiming rewards in epoch X for epoch X-1, decay of X-(X-1) = 1 would be applied. Since epoch X is the + // very first epoch in which one can claim those rewards, decaying by 1 is odd, as one could never claim the full reward then. + // Hence, deduct one epoch worth of decay. + claimingEpoch, err = safemath.SafeSub(claimingEpoch, 1) + if err != nil { + return 0, 0, 0, ierrors.Wrapf(err, "claimingEpoch must be set to at least 1") + } + // Limit reward fetching only to committed epochs. if lastRewardEpoch > t.latestAppliedEpoch { lastRewardEpoch = t.latestAppliedEpoch @@ -121,6 +129,14 @@ func (t *Tracker) DelegatorReward(validatorID iotago.AccountID, delegatedAmount firstRewardEpoch = epochStart lastRewardEpoch = epochEnd + // When claiming rewards in epoch X for epoch X-1, decay of X-(X-1) = 1 would be applied. Since epoch X is the + // very first epoch in which one can claim those rewards, decaying by 1 is odd, as one could never claim the full reward then. + // Hence, deduct one epoch worth of decay. + claimingEpoch, err = safemath.SafeSub(claimingEpoch, 1) + if err != nil { + return 0, 0, 0, ierrors.Wrapf(err, "claimingEpoch must be set to at least 1") + } + // limit looping to committed epochs if lastRewardEpoch > t.latestAppliedEpoch { lastRewardEpoch = t.latestAppliedEpoch diff --git a/pkg/tests/validator_test.go b/pkg/tests/validator_test.go index 0678e20cc..00d4b7192 100644 --- a/pkg/tests/validator_test.go +++ b/pkg/tests/validator_test.go @@ -369,7 +369,7 @@ func calculateValidatorReward(t *testing.T, ts *testsuite.TestSuite, accountID i undecayedRewards := uint64(fixedCost) + profitMarginFactor + residualValidatorFactor - decayedRewards += lo.PanicOnErr(ts.API.ManaDecayProvider().DecayManaByEpochs(iotago.Mana(undecayedRewards), rewardEpoch, claimingEpoch)) + decayedRewards += lo.PanicOnErr(ts.API.ManaDecayProvider().DecayManaByEpochs(iotago.Mana(undecayedRewards), rewardEpoch, claimingEpoch-1)) } else { decayedRewards += 0 } From 7102012ea4cbf43676f6ee3fc9de80a0016455e5 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Fri, 8 Dec 2023 17:07:50 +0100 Subject: [PATCH 29/30] Factor out decay end epoch into dedicated function --- .../sybilprotectionv1/performance/rewards.go | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go index 1f3d10e4a..61b344e69 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go @@ -4,6 +4,7 @@ import ( "github.com/iotaledger/hive.go/ads" "github.com/iotaledger/hive.go/core/safemath" "github.com/iotaledger/hive.go/ierrors" + "github.com/iotaledger/hive.go/lo" "github.com/iotaledger/iota-core/pkg/model" iotago "github.com/iotaledger/iota.go/v4" ) @@ -29,19 +30,13 @@ func (t *Tracker) ValidatorReward(validatorID iotago.AccountID, stakingFeature * firstRewardEpoch = stakingFeature.StartEpoch lastRewardEpoch = stakingFeature.EndEpoch - // When claiming rewards in epoch X for epoch X-1, decay of X-(X-1) = 1 would be applied. Since epoch X is the - // very first epoch in which one can claim those rewards, decaying by 1 is odd, as one could never claim the full reward then. - // Hence, deduct one epoch worth of decay. - claimingEpoch, err = safemath.SafeSub(claimingEpoch, 1) - if err != nil { - return 0, 0, 0, ierrors.Wrapf(err, "claimingEpoch must be set to at least 1") - } - // Limit reward fetching only to committed epochs. if lastRewardEpoch > t.latestAppliedEpoch { lastRewardEpoch = t.latestAppliedEpoch } + decayEndEpoch := t.decayEndEpoch(claimingEpoch, lastRewardEpoch) + for epoch := firstRewardEpoch; epoch <= lastRewardEpoch; epoch++ { rewardsForAccountInEpoch, exists, err := t.rewardsForAccount(validatorID, epoch) if err != nil { @@ -106,7 +101,7 @@ func (t *Tracker) ValidatorReward(validatorID iotago.AccountID, stakingFeature * } decayProvider := t.apiProvider.APIForEpoch(epoch).ManaDecayProvider() - decayedEpochRewards, err := decayProvider.DecayManaByEpochs(iotago.Mana(undecayedEpochRewards), epoch, claimingEpoch) + decayedEpochRewards, err := decayProvider.DecayManaByEpochs(iotago.Mana(undecayedEpochRewards), epoch, decayEndEpoch) if err != nil { return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate rewards with decay for epoch %d and validator accountID %s", epoch, validatorID) } @@ -129,19 +124,13 @@ func (t *Tracker) DelegatorReward(validatorID iotago.AccountID, delegatedAmount firstRewardEpoch = epochStart lastRewardEpoch = epochEnd - // When claiming rewards in epoch X for epoch X-1, decay of X-(X-1) = 1 would be applied. Since epoch X is the - // very first epoch in which one can claim those rewards, decaying by 1 is odd, as one could never claim the full reward then. - // Hence, deduct one epoch worth of decay. - claimingEpoch, err = safemath.SafeSub(claimingEpoch, 1) - if err != nil { - return 0, 0, 0, ierrors.Wrapf(err, "claimingEpoch must be set to at least 1") - } - // limit looping to committed epochs if lastRewardEpoch > t.latestAppliedEpoch { lastRewardEpoch = t.latestAppliedEpoch } + decayEndEpoch := t.decayEndEpoch(claimingEpoch, lastRewardEpoch) + for epoch := firstRewardEpoch; epoch <= lastRewardEpoch; epoch++ { rewardsForAccountInEpoch, exists, err := t.rewardsForAccount(validatorID, epoch) if err != nil { @@ -194,7 +183,7 @@ func (t *Tracker) DelegatorReward(validatorID iotago.AccountID, delegatedAmount } decayProvider := t.apiProvider.APIForEpoch(epoch).ManaDecayProvider() - decayedEpochRewards, err := decayProvider.DecayManaByEpochs(iotago.Mana(undecayedEpochRewards), epoch, claimingEpoch) + decayedEpochRewards, err := decayProvider.DecayManaByEpochs(iotago.Mana(undecayedEpochRewards), epoch, decayEndEpoch) if err != nil { return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate rewards with decay for epoch %d and validator accountID %s", epoch, validatorID) } @@ -205,6 +194,23 @@ func (t *Tracker) DelegatorReward(validatorID iotago.AccountID, delegatedAmount return delegatorsReward, firstRewardEpoch, lastRewardEpoch, nil } +// Returns the epoch until which rewards are decayed. +// +// When claiming rewards in epoch X for epoch X-1, decay of X-(X-1) = 1 would be applied. Since epoch X is the +// very first epoch in which one can claim those rewards, decaying by 1 is odd, as one could never claim the full reward then. +// Hence, one epoch worth of decay is deducted in general. +// +// The decay end epoch must however be greater or equal than the last epoch for which rewards are claimed, otherwise +// the decay operation would fail since the amount of epochs to decay would be negative. +// Hence, the smallest returned decay end epoch will be the lastRewardEpoch. +func (t *Tracker) decayEndEpoch(claimingEpoch iotago.EpochIndex, lastRewardEpoch iotago.EpochIndex) iotago.EpochIndex { + if claimingEpoch >= 1 { + claimingEpoch = claimingEpoch - 1 + } + + return lo.Max(claimingEpoch, lastRewardEpoch) +} + func (t *Tracker) rewardsMap(epoch iotago.EpochIndex) (ads.Map[iotago.Identifier, iotago.AccountID, *model.PoolRewards], error) { kv, err := t.rewardsStorePerEpochFunc(epoch) if err != nil { From 09c8696e1698ce501dfc0393c90bce6e1f479ce8 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Mon, 11 Dec 2023 09:44:06 +0100 Subject: [PATCH 30/30] Improve clarity of variable names --- pkg/tests/validator_test.go | 53 ++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/pkg/tests/validator_test.go b/pkg/tests/validator_test.go index 00d4b7192..b6aa29915 100644 --- a/pkg/tests/validator_test.go +++ b/pkg/tests/validator_test.go @@ -74,7 +74,7 @@ func setupValidatorTestsuite(t *testing.T, walletOpts ...options.Option[testsuit vnode2.Protocol.SetLogLevel(log.LevelError) node3.Protocol.SetLogLevel(log.LevelError) - ts.SetCurrentSlot(1) + ts.SetCurrentSlot(ts.API.ProtocolParameters().GenesisSlot() + 1) return ts } @@ -84,8 +84,10 @@ type ValidatorTest struct { ts *testsuite.TestSuite // How many validation blocks per slot the validator test nodes are supposed to issue. - // Can be set to a different value than the protocol parameter to model under- or overissuance. - validationBlocksPerSlot uint8 + // Can be set to a different value than validationBlocksPerSlot to model under- or overissuance. + issuancePerSlot uint8 + // The expected performance factor for each epoch. + // The length of the map determines how many epochs the validators issue blocks. epochPerformanceFactors EpochPerformanceMap } @@ -97,8 +99,8 @@ func Test_Validator_PerfectIssuance(t *testing.T) { epochDurationSlots := uint64(ts.API.TimeProvider().EpochDurationSlots()) test := ValidatorTest{ - ts: ts, - validationBlocksPerSlot: validationBlocksPerSlot, + ts: ts, + issuancePerSlot: validationBlocksPerSlot, epochPerformanceFactors: EpochPerformanceMap{ // A validator cannot issue blocks in the genesis slot, so we deduct one slot worth of blocks. 0: (uint64(validationBlocksPerSlot) * (epochDurationSlots - 1)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), @@ -118,8 +120,8 @@ func Test_Validator_PerfectIssuanceWithNonZeroFixedCost(t *testing.T) { epochDurationSlots := uint64(ts.API.TimeProvider().EpochDurationSlots()) test := ValidatorTest{ - ts: ts, - validationBlocksPerSlot: validationBlocksPerSlot, + ts: ts, + issuancePerSlot: validationBlocksPerSlot, epochPerformanceFactors: EpochPerformanceMap{ // A validator cannot issue blocks in the genesis slot, so we deduct one slot worth of blocks. 0: (uint64(validationBlocksPerSlot) * (epochDurationSlots - 1)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), @@ -141,8 +143,8 @@ func Test_Validator_PerfectIssuanceWithHugeStake(t *testing.T) { epochDurationSlots := uint64(ts.API.TimeProvider().EpochDurationSlots()) test := ValidatorTest{ - ts: ts, - validationBlocksPerSlot: validationBlocksPerSlot, + ts: ts, + issuancePerSlot: validationBlocksPerSlot, epochPerformanceFactors: EpochPerformanceMap{ // A validator cannot issue blocks in the genesis slot, so we deduct one slot worth of blocks. 0: (uint64(validationBlocksPerSlot) * (epochDurationSlots - 1)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), @@ -161,7 +163,7 @@ func Test_Validator_OverIssuance(t *testing.T) { test := ValidatorTest{ ts: ts, // Issue one more block than supposed to. - validationBlocksPerSlot: ts.API.ProtocolParameters().ValidationBlocksPerSlot() + 1, + issuancePerSlot: ts.API.ProtocolParameters().ValidationBlocksPerSlot() + 1, epochPerformanceFactors: EpochPerformanceMap{ // We expect 0 rewards for overissuance. // We model that in this test by setting performance factor to 0. @@ -183,8 +185,8 @@ func Test_Validator_UnderIssuance(t *testing.T) { epochDurationSlots := uint64(ts.API.TimeProvider().EpochDurationSlots()) test := ValidatorTest{ - ts: ts, - validationBlocksPerSlot: validationBlocksPerSlot, + ts: ts, + issuancePerSlot: validationBlocksPerSlot, epochPerformanceFactors: EpochPerformanceMap{ // A validator cannot issue blocks in the genesis slot, so we deduct one slot worth of blocks. 0: (uint64(validationBlocksPerSlot) * (epochDurationSlots - 1)) >> uint64(ts.API.ProtocolParameters().SlotsPerEpochExponent()), @@ -203,8 +205,8 @@ func Test_Validator_FixedCostExceedsRewards(t *testing.T) { validationBlocksPerSlot := ts.API.ProtocolParameters().ValidationBlocksPerSlot() test := ValidatorTest{ - ts: ts, - validationBlocksPerSlot: validationBlocksPerSlot, + ts: ts, + issuancePerSlot: validationBlocksPerSlot, epochPerformanceFactors: EpochPerformanceMap{ 0: 0, 1: 0, @@ -223,7 +225,8 @@ func validatorTest(t *testing.T, test ValidatorTest) { endEpoch := iotago.EpochIndex(len(test.epochPerformanceFactors) - 1) fmt.Printf("ValidatorTest: startEpoch=%d, endEpoch=%d\n", startEpoch, endEpoch) - subslotDuration := time.Duration(ts.API.ProtocolParameters().SlotDurationInSeconds()/test.validationBlocksPerSlot) * time.Second + // Calculate the period in which the validator will issue blocks. + issuancePeriod := time.Duration(ts.API.ProtocolParameters().SlotDurationInSeconds()/test.issuancePerSlot) * time.Second // Validate until the last slot of the epoch is definitely committed. var endEpochSlot iotago.SlotIndex = ts.API.TimeProvider().EpochEnd(endEpoch) + ts.API.ProtocolParameters().MaxCommittableAge() // Needed to increase the block timestamp monotonically relative to the parent. @@ -233,13 +236,13 @@ func validatorTest(t *testing.T, test ValidatorTest) { ts.SetCurrentSlot(slot) slotStartTime := ts.API.TimeProvider().SlotStartTime(ts.CurrentSlot()).UTC() - for subslotIdx := uint8(0); subslotIdx < test.validationBlocksPerSlot; subslotIdx++ { + for subslotIdx := uint8(0); subslotIdx < test.issuancePerSlot; subslotIdx++ { for _, node := range ts.Validators() { blockName := fmt.Sprintf("block-%s-%d/%d", node.Name, ts.CurrentSlot(), subslotIdx) latestCommitment := node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Commitment() issuingTime := slotStartTime. - Add(subslotDuration * time.Duration(subslotIdx)). + Add(issuancePeriod * time.Duration(subslotIdx)). Add(time.Duration(subSlotBlockCounter)) validationBlock := ts.IssueValidationBlockWithHeaderOptions(blockName, node, @@ -292,11 +295,11 @@ func validatorTest(t *testing.T, test ValidatorTest) { for accountID, actualReward := range actualRewards { lastRewardEpoch := iotago.EpochIndex(len(test.epochPerformanceFactors)) - rewards := make([]reward, 0, lastRewardEpoch) + rewards := make([]epochReward, 0, lastRewardEpoch) for epoch := iotago.EpochIndex(0); epoch < lastRewardEpoch; epoch++ { epochPerformanceFactor := test.epochPerformanceFactors[epoch] - reward := calculateEpochReward(t, ts, accountID, epoch, epochPerformanceFactor, totalStake, totalValidatorStake) - rewards = append(rewards, reward) + epochReward := calculateEpochReward(t, ts, accountID, epoch, epochPerformanceFactor, totalStake, totalValidatorStake) + rewards = append(rewards, epochReward) } expectedReward := calculateValidatorReward(t, ts, accountID, rewards, startEpoch, claimingEpoch) @@ -305,7 +308,7 @@ func validatorTest(t *testing.T, test ValidatorTest) { } } -type reward struct { +type epochReward struct { Mana iotago.Mana ProfitMargin uint64 } @@ -315,7 +318,7 @@ type reward struct { // // For testing purposes, assumes that the account's staking data is the same in the latest committed slot // as in the epoch for which to calculate rewards. -func calculateEpochReward(t *testing.T, ts *testsuite.TestSuite, accountID iotago.AccountID, epoch iotago.EpochIndex, epochPerformanceFactor uint64, totalStake iotago.BaseToken, totalValidatorStake iotago.BaseToken) reward { +func calculateEpochReward(t *testing.T, ts *testsuite.TestSuite, accountID iotago.AccountID, epoch iotago.EpochIndex, epochPerformanceFactor uint64, totalStake iotago.BaseToken, totalValidatorStake iotago.BaseToken) epochReward { latestCommittedSlot := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Slot() targetReward := lo.PanicOnErr(ts.API.ProtocolParameters().RewardsParameters().TargetReward(epoch, ts.API)) @@ -335,7 +338,7 @@ func calculateEpochReward(t *testing.T, ts *testsuite.TestSuite, accountID iotag profitMargin := (totalValidatorStake << iotago.BaseToken(ts.API.ProtocolParameters().RewardsParameters().ProfitMarginExponent)) / (totalValidatorStake + totalStake) - return reward{Mana: poolReward, ProfitMargin: uint64(profitMargin)} + return epochReward{Mana: poolReward, ProfitMargin: uint64(profitMargin)} } // Calculates a validator's reward according to @@ -343,7 +346,7 @@ func calculateEpochReward(t *testing.T, ts *testsuite.TestSuite, accountID iotag // // For testing purposes, assumes that the account's staking data is the same in the latest committed slot // as in the epoch for which to calculate rewards. -func calculateValidatorReward(t *testing.T, ts *testsuite.TestSuite, accountID iotago.AccountID, rewards []reward, startEpoch iotago.EpochIndex, claimingEpoch iotago.EpochIndex) iotago.Mana { +func calculateValidatorReward(t *testing.T, ts *testsuite.TestSuite, accountID iotago.AccountID, epochRewards []epochReward, startEpoch iotago.EpochIndex, claimingEpoch iotago.EpochIndex) iotago.Mana { latestCommittedSlot := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment().Slot() accountData, exists, err := ts.DefaultWallet().Node.Protocol.Engines.Main.Get().Ledger.Account(accountID, latestCommittedSlot) if err != nil || !exists { @@ -357,7 +360,7 @@ func calculateValidatorReward(t *testing.T, ts *testsuite.TestSuite, accountID i rewardEpoch := startEpoch decayedRewards := iotago.Mana(0) - for _, reward := range rewards { + for _, reward := range epochRewards { if reward.Mana >= fixedCost { rewardWithoutFixedCost := uint64(reward.Mana) - uint64(fixedCost)