diff --git a/go.mod b/go.mod index 9bd6b2427..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-20231204142547-416c9a87403d + 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 7a31029ce..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-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/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/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 1951737f7..16511364e 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..f99a5344f 100644 --- a/pkg/protocol/engine/attestation/slotattestation/testframework_test.go +++ b/pkg/protocol/engine/attestation/slotattestation/testframework_test.go @@ -70,10 +70,8 @@ func NewTestFramework(test *testing.T) *TestFramework { } 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), + iotago.NewV3TestProtocolParameters( + iotago.WithLivenessOptions(5, 5, 1, 2, 8), ), ) 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..247a23126 100644 --- a/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go +++ b/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go @@ -22,9 +22,7 @@ import ( func TestTopStakers_InitializeCommittee(t *testing.T) { var testAPI = iotago.V3API( - iotago.NewV3ProtocolParameters( - iotago.WithNetworkOptions("TestJungle", "tgl"), - iotago.WithSupplyOptions(2_779_530_283_277_761, 0, 0, 0, 0, 0, 0), + iotago.NewV3TestProtocolParameters( 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,9 +74,7 @@ func TestTopStakers_InitializeCommittee(t *testing.T) { func TestTopStakers_RotateCommittee(t *testing.T) { var testAPI = iotago.V3API( - iotago.NewV3ProtocolParameters( - iotago.WithNetworkOptions("TestJungle", "tgl"), - iotago.WithSupplyOptions(2_779_530_283_277_761, 0, 0, 0, 0, 0, 0), + iotago.NewV3TestProtocolParameters( 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 d27730805..ab1150c36 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go @@ -40,9 +40,10 @@ 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.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 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 3c2b2c15a..dc5a54e16 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 79654b44f..36b31c2e0 100644 --- a/pkg/tests/booker_test.go +++ b/pkg/tests/booker_test.go @@ -328,8 +328,8 @@ func Test_SpendRejectedCommittedRace(t *testing.T) { testsuite.DefaultSlotsPerEpochExponent, ), iotago.WithLivenessOptions( - testsuite.DefaultLivenessThresholdLowerBoundInSeconds, - testsuite.DefaultLivenessThresholdUpperBoundInSeconds, + 15, + 15, 2, 5, testsuite.DefaultEpochNearingThreshold, @@ -601,8 +601,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 2b3000f76..dbca89541 100644 --- a/pkg/tests/reward_test.go +++ b/pkg/tests/reward_test.go @@ -22,13 +22,7 @@ func setupRewardTestsuite(t *testing.T) (*testsuite.TestSuite, *mock.Node, *mock 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 511ca05c0..23cca166f 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.NewV3ProtocolParameters( + v5ProtocolParameters := iotago.NewV3TestProtocolParameters( append( ts.ProtocolParameterOptions, iotago.WithVersion(5), diff --git a/pkg/testsuite/accounts.go b/pkg/testsuite/accounts.go index 80d2b659f..d324e78d5 100644 --- a/pkg/testsuite/accounts.go +++ b/pkg/testsuite/accounts.go @@ -14,7 +14,6 @@ func (t *TestSuite) AssertAccountStake(accountID iotago.AccountID, validatorStak nodes ...*mock.Node) { for _, node := range nodes { t.Eventually(func() error { - 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") 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 da0f023e7..908b4d09b 100644 --- a/pkg/testsuite/testsuite.go +++ b/pkg/testsuite/testsuite.go @@ -32,50 +32,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, 11, 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 @@ -141,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(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 5f5d9aab9..9ed58d5dc 100644 --- a/pkg/testsuite/testsuite_options.go +++ b/pkg/testsuite/testsuite_options.go @@ -64,22 +64,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 a5ba98a30..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-20231204142547-416c9a87403d // 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 09a38ec6e..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-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/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 7d9bebabd..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-20231204142547-416c9a87403d + 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 ccad4de99..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-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/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= 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"), ) )