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 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 b6a14e74a..2295c1ea1 100644 --- a/go.mod +++ b/go.mod @@ -10,23 +10,23 @@ 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-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/ads 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-20231206114953-6a65a82e30ad + github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 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/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.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/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 @@ -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 a891318f8..ea71d4d30 100644 --- a/go.sum +++ b/go.sum @@ -275,8 +275,8 @@ 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-20231206114953-6a65a82e30ad h1:Sy6PPo5TWnWeZ3vdIf6NSvZ1RUf05IHY14oDvqD8rcY= -github.com/iotaledger/hive.go/ads v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:okMn9dNDf6jn46o72P3e55XCQObLNkzujM2abNXqW8E= +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-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= @@ -289,12 +289,12 @@ github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad h1:adLrD6dOE 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/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-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/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= @@ -303,12 +303,12 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82 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= -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/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= @@ -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= 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/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..67e428c0d 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.NewV3SnapshotProtocolParameters( + 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..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 @@ -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.NewV3SnapshotProtocolParameters(iotago.WithVersion(params.Version()))), nil }, ), ) - apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3ProtocolParameters(iotago.WithVersion(3)), 0) - apiProvider.AddProtocolParametersAtEpoch(iotago.NewV3ProtocolParameters(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.NewV3ProtocolParameters(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)) @@ -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/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) { diff --git a/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go b/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers_test.go index 53a49290a..a45851b45 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.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), ), @@ -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.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 d27730805..77c48a11c 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.NewV3SnapshotProtocolParameters( 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..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.NewV3ProtocolParameters(), 0)) + require.NoError(t, instance.Settings().StoreProtocolParametersForStartEpoch(iotago.NewV3SnapshotProtocolParameters(), 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..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.NewV3ProtocolParameters( + v5ProtocolParameters := iotago.NewV3SnapshotProtocolParameters( 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..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.NewV3ProtocolParameters(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 da0f023e7..ea2b2a315 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(), 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 5f5d9aab9..79b4398f3 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.NewV3SnapshotProtocolParameters() + 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 bb96824a1..13874cbf0 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -56,22 +56,22 @@ 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-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/ads 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-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/kvstore v0.0.0-20231205131244-472357435a39 // 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/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.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/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 @@ -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 b07f9c7c0..3d2ccafdd 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -277,8 +277,8 @@ 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-20231206114953-6a65a82e30ad h1:Sy6PPo5TWnWeZ3vdIf6NSvZ1RUf05IHY14oDvqD8rcY= -github.com/iotaledger/hive.go/ads v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:okMn9dNDf6jn46o72P3e55XCQObLNkzujM2abNXqW8E= +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-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= @@ -293,12 +293,12 @@ github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad h1:adLrD6dOE 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/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-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/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= @@ -307,12 +307,12 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231206114953-6a65a82 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= -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/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= @@ -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 4611c5595..756d9ce51 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-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/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 @@ -26,12 +26,12 @@ 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-20231206114953-6a65a82e30ad // indirect + github.com/iotaledger/hive.go/ads 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-20231206114953-6a65a82e30ad // indirect - github.com/iotaledger/hive.go/log 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-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 diff --git a/tools/genesis-snapshot/go.sum b/tools/genesis-snapshot/go.sum index 8ff9ca34a..578c00428 100644 --- a/tools/genesis-snapshot/go.sum +++ b/tools/genesis-snapshot/go.sum @@ -28,8 +28,8 @@ 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-20231206114953-6a65a82e30ad h1:Sy6PPo5TWnWeZ3vdIf6NSvZ1RUf05IHY14oDvqD8rcY= -github.com/iotaledger/hive.go/ads v0.0.0-20231206114953-6a65a82e30ad/go.mod h1:okMn9dNDf6jn46o72P3e55XCQObLNkzujM2abNXqW8E= +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-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= @@ -40,20 +40,20 @@ github.com/iotaledger/hive.go/ds v0.0.0-20231206114953-6a65a82e30ad h1:adLrD6dOE 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/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-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/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-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-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= diff --git a/tools/genesis-snapshot/presets/presets.go b/tools/genesis-snapshot/presets/presets.go index 208e15859..a8e72f12e 100644 --- a/tools/genesis-snapshot/presets/presets.go +++ b/tools/genesis-snapshot/presets/presets.go @@ -16,34 +16,21 @@ 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.NewV3SnapshotProtocolParameters( + iotago.WithNetworkOptions("default", iotago.PrefixTestnet), ) - protocolParamsDocker = iotago.NewV3ProtocolParameters( - iotago.WithNetworkOptions("docker", "rms"), - iotago.WithSupplyOptions(4_600_000_000_000_000, 250, 1, 1000, 100000, 500000, 100000), + // use defaults from iota.go + protocolParamsDocker = iotago.NewV3SnapshotProtocolParameters( + iotago.WithNetworkOptions("docker", iotago.PrefixTestnet), 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), ) - 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.NewV3SnapshotProtocolParameters( + iotago.WithNetworkOptions("feature", iotago.PrefixTestnet), + iotago.WithTimeProviderOptions(666666, time.Now().Unix()-100_000, 10, 13), ) )