diff --git a/components/dashboard/explorer_routes.go b/components/dashboard/explorer_routes.go index f5a73d25d..812c6c9f9 100644 --- a/components/dashboard/explorer_routes.go +++ b/components/dashboard/explorer_routes.go @@ -11,11 +11,10 @@ import ( "github.com/iotaledger/inx-app/pkg/httpserver" "github.com/iotaledger/iota-core/pkg/model" "github.com/iotaledger/iota-core/pkg/protocol/engine/blocks" - restapipkg "github.com/iotaledger/iota-core/pkg/restapi" "github.com/iotaledger/iota-core/pkg/retainer" iotago "github.com/iotaledger/iota.go/v4" + "github.com/iotaledger/iota.go/v4/api" "github.com/iotaledger/iota.go/v4/hexutil" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" ) // SearchResult defines the struct of the SearchResult. @@ -27,8 +26,8 @@ type SearchResult struct { } func setupExplorerRoutes(routeGroup *echo.Group) { - routeGroup.GET("/block/:"+restapipkg.ParameterBlockID, func(c echo.Context) (err error) { - blockID, err := httpserver.ParseBlockIDParam(c, restapipkg.ParameterBlockID) + routeGroup.GET("/block/:"+api.ParameterBlockID, func(c echo.Context) (err error) { + blockID, err := httpserver.ParseBlockIDParam(c, api.ParameterBlockID) if err != nil { return ierrors.Errorf("parse block ID error: %w", err) } @@ -41,17 +40,17 @@ func setupExplorerRoutes(routeGroup *echo.Group) { return c.JSON(http.StatusOK, t) }) - routeGroup.GET("/transaction/:"+restapipkg.ParameterTransactionID, getTransaction) + routeGroup.GET("/transaction/:"+api.ParameterTransactionID, getTransaction) routeGroup.GET("/transaction/:transactionID/metadata", getTransactionMetadata) // routeGroup.GET("/transaction/:transactionID/attachments", ledgerstateAPI.GetTransactionAttachments) - routeGroup.GET("/output/:"+restapipkg.ParameterOutputID, getOutput) + routeGroup.GET("/output/:"+api.ParameterOutputID, getOutput) // routeGroup.GET("/output/:outputID/metadata", ledgerstateAPI.GetOutputMetadata) // routeGroup.GET("/output/:outputID/consumers", ledgerstateAPI.GetOutputConsumers) // routeGroup.GET("/conflict/:conflictID", ledgerstateAPI.GetConflict) // routeGroup.GET("/conflict/:conflictID/children", ledgerstateAPI.GetConflictChildren) // routeGroup.GET("/conflict/:conflictID/conflicts", ledgerstateAPI.GetConflictConflicts) // routeGroup.GET("/conflict/:conflictID/voters", ledgerstateAPI.GetConflictVoters) - routeGroup.GET("/slot/commitment/:"+restapipkg.ParameterCommitmentID, getSlotDetailsByID) + routeGroup.GET("/slot/commitment/:"+api.ParameterCommitmentID, getSlotDetailsByID) routeGroup.GET("/search/:search", func(c echo.Context) error { search := c.Param("search") @@ -177,13 +176,13 @@ func createExplorerBlock(block *model.Block, cachedBlock *blocks.Block, metadata }) } else { switch metadata.BlockState { - case apimodels.BlockStateConfirmed, apimodels.BlockStateFinalized: + case api.BlockStateConfirmed, api.BlockStateFinalized: t.Solid = true t.Booked = true t.Acceptance = true t.Scheduled = true t.Confirmation = true - case apimodels.BlockStateFailed, apimodels.BlockStateRejected: + case api.BlockStateFailed, api.BlockStateRejected: t.ObjectivelyInvalid = true } } @@ -192,7 +191,7 @@ func createExplorerBlock(block *model.Block, cachedBlock *blocks.Block, metadata } func getTransaction(c echo.Context) error { - txID, err := httpserver.ParseTransactionIDParam(c, restapipkg.ParameterTransactionID) + txID, err := httpserver.ParseTransactionIDParam(c, api.ParameterTransactionID) if err != nil { return err } @@ -220,7 +219,7 @@ func getTransaction(c echo.Context) error { } func getTransactionMetadata(c echo.Context) error { - txID, err := httpserver.ParseTransactionIDParam(c, restapipkg.ParameterTransactionID) + txID, err := httpserver.ParseTransactionIDParam(c, api.ParameterTransactionID) if err != nil { return err } @@ -239,7 +238,7 @@ func getTransactionMetadata(c echo.Context) error { } func getOutput(c echo.Context) error { - outputID, err := httpserver.ParseOutputIDParam(c, restapipkg.ParameterOutputID) + outputID, err := httpserver.ParseOutputIDParam(c, api.ParameterOutputID) if err != nil { return err } @@ -253,7 +252,7 @@ func getOutput(c echo.Context) error { } func getSlotDetailsByID(c echo.Context) error { - commitmentID, err := httpserver.ParseCommitmentIDParam(c, restapipkg.ParameterCommitmentID) + commitmentID, err := httpserver.ParseCommitmentIDParam(c, api.ParameterCommitmentID) if err != nil { return err } diff --git a/components/debugapi/component.go b/components/debugapi/component.go index 045a5e2dd..5d4457ff5 100644 --- a/components/debugapi/component.go +++ b/components/debugapi/component.go @@ -22,18 +22,19 @@ import ( "github.com/iotaledger/iota-core/pkg/storage/database" "github.com/iotaledger/iota-core/pkg/storage/prunable" iotago "github.com/iotaledger/iota.go/v4" + "github.com/iotaledger/iota.go/v4/api" ) const ( RouteValidators = "/validators" - RouteBlockMetadata = "/blocks/:" + restapipkg.ParameterBlockID + "/metadata" + RouteBlockMetadata = "/blocks/:" + api.ParameterBlockID + "/metadata" RouteChainManagerAllChainsDot = "/all-chains" RouteChainManagerAllChainsRendered = "/all-chains/rendered" - RouteCommitmentByIndexBlockIDs = "/commitments/by-index/:" + restapipkg.ParameterSlotIndex + "/blocks" + RouteCommitmentBySlotBlockIDs = "/commitments/by-slot/:" + api.ParameterSlot + "/blocks" - RouteCommitmentByIndexTransactionIDs = "/commitments/by-index/:" + restapipkg.ParameterSlotIndex + "/transactions" + RouteCommitmentBySlotTransactionIDs = "/commitments/by-slot/:" + api.ParameterSlot + "/transactions" ) const ( @@ -148,7 +149,7 @@ func configure() error { }) routeGroup.GET(RouteBlockMetadata, func(c echo.Context) error { - blockID, err := httpserver.ParseBlockIDParam(c, restapipkg.ParameterBlockID) + blockID, err := httpserver.ParseBlockIDParam(c, api.ParameterBlockID) if err != nil { return err } @@ -206,8 +207,8 @@ func configure() error { return c.Blob(http.StatusOK, "image/png", renderedBytes) }) - routeGroup.GET(RouteCommitmentByIndexBlockIDs, func(c echo.Context) error { - slot, err := httpserver.ParseSlotParam(c, restapipkg.ParameterSlotIndex) + routeGroup.GET(RouteCommitmentBySlotBlockIDs, func(c echo.Context) error { + slot, err := httpserver.ParseSlotParam(c, api.ParameterSlot) if err != nil { return err } @@ -220,8 +221,8 @@ func configure() error { return httpserver.JSONResponse(c, http.StatusOK, resp) }) - routeGroup.GET(RouteCommitmentByIndexTransactionIDs, func(c echo.Context) error { - slot, err := httpserver.ParseSlotParam(c, restapipkg.ParameterSlotIndex) + routeGroup.GET(RouteCommitmentBySlotTransactionIDs, func(c echo.Context) error { + slot, err := httpserver.ParseSlotParam(c, api.ParameterSlot) if err != nil { return err } diff --git a/components/restapi/core/accounts.go b/components/restapi/core/accounts.go index 0efcdbb59..ee721bd45 100644 --- a/components/restapi/core/accounts.go +++ b/components/restapi/core/accounts.go @@ -13,11 +13,11 @@ import ( "github.com/iotaledger/iota-core/pkg/core/account" restapipkg "github.com/iotaledger/iota-core/pkg/restapi" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) -func congestionByAccountAddress(c echo.Context) (*apimodels.CongestionResponse, error) { - commitmentID, err := httpserver.ParseCommitmentIDQueryParam(c, restapipkg.ParameterCommitmentID) +func congestionByAccountAddress(c echo.Context) (*api.CongestionResponse, error) { + commitmentID, err := httpserver.ParseCommitmentIDQueryParam(c, api.ParameterCommitmentID) if err != nil { return nil, err } @@ -32,14 +32,14 @@ func congestionByAccountAddress(c echo.Context) (*apimodels.CongestionResponse, } hrp := deps.Protocol.CommittedAPI().ProtocolParameters().Bech32HRP() - address, err := httpserver.ParseBech32AddressParam(c, hrp, restapipkg.ParameterBech32Address) + address, err := httpserver.ParseBech32AddressParam(c, hrp, api.ParameterBech32Address) if err != nil { return nil, err } accountAddress, ok := address.(*iotago.AccountAddress) if !ok { - return nil, ierrors.Wrapf(httpserver.ErrInvalidParameter, "address %s is not an account address", c.Param(restapipkg.ParameterBech32Address)) + return nil, ierrors.Wrapf(httpserver.ErrInvalidParameter, "address %s is not an account address", c.Param(api.ParameterBech32Address)) } accountID := accountAddress.AccountID() @@ -51,7 +51,7 @@ func congestionByAccountAddress(c echo.Context) (*apimodels.CongestionResponse, return nil, ierrors.Wrapf(echo.ErrNotFound, "account not found: %s", accountID.ToHex()) } - return &apimodels.CongestionResponse{ + return &api.CongestionResponse{ Slot: commitment.Slot(), Ready: deps.Protocol.MainEngineInstance().Scheduler.IsBlockIssuerReady(accountID), ReferenceManaCost: commitment.ReferenceManaCost(), @@ -59,7 +59,7 @@ func congestionByAccountAddress(c echo.Context) (*apimodels.CongestionResponse, }, nil } -func validators(c echo.Context) (*apimodels.ValidatorsResponse, error) { +func validators(c echo.Context) (*api.ValidatorsResponse, error) { var err error pageSize := restapi.ParamsRestAPI.MaxPageSize if len(c.QueryParam(restapipkg.QueryParameterPageSize)) > 0 { @@ -100,7 +100,7 @@ func validators(c echo.Context) (*apimodels.ValidatorsResponse, error) { } page := registeredValidators[cursorIndex:lo.Min(cursorIndex+pageSize, uint32(len(registeredValidators)))] - resp := &apimodels.ValidatorsResponse{ + resp := &api.ValidatorsResponse{ Validators: page, PageSize: pageSize, } @@ -114,16 +114,16 @@ func validators(c echo.Context) (*apimodels.ValidatorsResponse, error) { return resp, nil } -func validatorByAccountAddress(c echo.Context) (*apimodels.ValidatorResponse, error) { +func validatorByAccountAddress(c echo.Context) (*api.ValidatorResponse, error) { hrp := deps.Protocol.CommittedAPI().ProtocolParameters().Bech32HRP() - address, err := httpserver.ParseBech32AddressParam(c, hrp, restapipkg.ParameterBech32Address) + address, err := httpserver.ParseBech32AddressParam(c, hrp, api.ParameterBech32Address) if err != nil { return nil, err } accountAddress, ok := address.(*iotago.AccountAddress) if !ok { - return nil, ierrors.Wrapf(httpserver.ErrInvalidParameter, "address %s is not an account address", c.Param(restapipkg.ParameterBech32Address)) + return nil, ierrors.Wrapf(httpserver.ErrInvalidParameter, "address %s is not an account address", c.Param(api.ParameterBech32Address)) } latestCommittedSlot := deps.Protocol.MainEngineInstance().SyncManager.LatestCommitment().Slot() @@ -144,7 +144,7 @@ func validatorByAccountAddress(c echo.Context) (*apimodels.ValidatorResponse, er return nil, ierrors.Wrapf(err, "failed to check if account %s is an active candidate", accountID.ToHex()) } - return &apimodels.ValidatorResponse{ + return &api.ValidatorResponse{ AddressBech32: accountID.ToAddress().Bech32(deps.Protocol.CommittedAPI().ProtocolParameters().Bech32HRP()), PoolStake: accountData.ValidatorStake + accountData.DelegationStake, ValidatorStake: accountData.ValidatorStake, @@ -156,18 +156,18 @@ func validatorByAccountAddress(c echo.Context) (*apimodels.ValidatorResponse, er }, nil } -func rewardsByOutputID(c echo.Context) (*apimodels.ManaRewardsResponse, error) { - outputID, err := httpserver.ParseOutputIDParam(c, restapipkg.ParameterOutputID) +func rewardsByOutputID(c echo.Context) (*api.ManaRewardsResponse, error) { + outputID, err := httpserver.ParseOutputIDParam(c, api.ParameterOutputID) if err != nil { - return nil, ierrors.Wrapf(err, "failed to parse output ID %s", c.Param(restapipkg.ParameterOutputID)) + return nil, ierrors.Wrapf(err, "failed to parse output ID %s", c.Param(api.ParameterOutputID)) } var slotIndex iotago.SlotIndex - if len(c.QueryParam(restapipkg.ParameterSlotIndex)) > 0 { + if len(c.QueryParam(api.ParameterSlot)) > 0 { var err error - slotIndex, err = httpserver.ParseSlotQueryParam(c, restapipkg.ParameterSlotIndex) + slotIndex, err = httpserver.ParseSlotQueryParam(c, api.ParameterSlot) if err != nil { - return nil, ierrors.Wrapf(err, "failed to parse slot index %s", c.Param(restapipkg.ParameterSlotIndex)) + return nil, ierrors.Wrapf(err, "failed to parse slot index %s", c.Param(api.ParameterSlot)) } genesisSlot := deps.Protocol.LatestAPI().ProtocolParameters().GenesisSlot() if slotIndex < genesisSlot { @@ -231,19 +231,19 @@ func rewardsByOutputID(c echo.Context) (*apimodels.ManaRewardsResponse, error) { return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to calculate reward for output %s: %s", outputID.ToHex(), err) } - return &apimodels.ManaRewardsResponse{ + return &api.ManaRewardsResponse{ EpochStart: actualStart, EpochEnd: actualEnd, Rewards: reward, }, nil } -func selectedCommittee(c echo.Context) (*apimodels.CommitteeResponse, error) { +func selectedCommittee(c echo.Context) (*api.CommitteeResponse, error) { timeProvider := deps.Protocol.CommittedAPI().TimeProvider() var slot iotago.SlotIndex - epoch, err := httpserver.ParseEpochQueryParam(c, restapipkg.ParameterEpochIndex) + epoch, err := httpserver.ParseEpochQueryParam(c, api.ParameterEpoch) if err != nil { // by default we return current epoch slot = timeProvider.SlotFromTime(time.Now()) @@ -254,7 +254,7 @@ func selectedCommittee(c echo.Context) (*apimodels.CommitteeResponse, error) { seatedAccounts, exists := deps.Protocol.MainEngineInstance().SybilProtection.SeatManager().CommitteeInSlot(slot) if !exists { - return &apimodels.CommitteeResponse{ + return &api.CommitteeResponse{ Epoch: epoch, }, nil } @@ -264,9 +264,9 @@ func selectedCommittee(c echo.Context) (*apimodels.CommitteeResponse, error) { return nil, ierrors.Wrapf(err, "failed to get accounts from committee for slot %d", slot) } - committee := make([]*apimodels.CommitteeMemberResponse, 0, accounts.Size()) + committee := make([]*api.CommitteeMemberResponse, 0, accounts.Size()) accounts.ForEach(func(accountID iotago.AccountID, seat *account.Pool) bool { - committee = append(committee, &apimodels.CommitteeMemberResponse{ + committee = append(committee, &api.CommitteeMemberResponse{ AddressBech32: accountID.ToAddress().Bech32(deps.Protocol.CommittedAPI().ProtocolParameters().Bech32HRP()), PoolStake: seat.PoolStake, ValidatorStake: seat.ValidatorStake, @@ -276,7 +276,7 @@ func selectedCommittee(c echo.Context) (*apimodels.CommitteeResponse, error) { return true }) - return &apimodels.CommitteeResponse{ + return &api.CommitteeResponse{ Epoch: epoch, Committee: committee, TotalStake: accounts.TotalStake(), diff --git a/components/restapi/core/blocks.go b/components/restapi/core/blocks.go index 95dd8696d..f9a3787ed 100644 --- a/components/restapi/core/blocks.go +++ b/components/restapi/core/blocks.go @@ -6,15 +6,14 @@ import ( "github.com/iotaledger/hive.go/ierrors" "github.com/iotaledger/inx-app/pkg/httpserver" "github.com/iotaledger/iota-core/pkg/blockhandler" - "github.com/iotaledger/iota-core/pkg/restapi" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) func blockByID(c echo.Context) (*iotago.Block, error) { - blockID, err := httpserver.ParseBlockIDParam(c, restapi.ParameterBlockID) + blockID, err := httpserver.ParseBlockIDParam(c, api.ParameterBlockID) if err != nil { - return nil, ierrors.Wrapf(err, "failed to parse block ID %s", c.Param(restapi.ParameterBlockID)) + return nil, ierrors.Wrapf(err, "failed to parse block ID %s", c.Param(api.ParameterBlockID)) } block, exists := deps.Protocol.MainEngineInstance().Block(blockID) @@ -25,7 +24,7 @@ func blockByID(c echo.Context) (*iotago.Block, error) { return block.ProtocolBlock(), nil } -func blockMetadataByBlockID(blockID iotago.BlockID) (*apimodels.BlockMetadataResponse, error) { +func blockMetadataByBlockID(blockID iotago.BlockID) (*api.BlockMetadataResponse, error) { blockMetadata, err := deps.Protocol.MainEngineInstance().Retainer.BlockMetadata(blockID) if err != nil { return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to get block metadata %s: %s", blockID.ToHex(), err) @@ -34,19 +33,19 @@ func blockMetadataByBlockID(blockID iotago.BlockID) (*apimodels.BlockMetadataRes return blockMetadata.BlockMetadataResponse(), nil } -func blockMetadataByID(c echo.Context) (*apimodels.BlockMetadataResponse, error) { - blockID, err := httpserver.ParseBlockIDParam(c, restapi.ParameterBlockID) +func blockMetadataByID(c echo.Context) (*api.BlockMetadataResponse, error) { + blockID, err := httpserver.ParseBlockIDParam(c, api.ParameterBlockID) if err != nil { - return nil, ierrors.Wrapf(err, "failed to parse block ID %s", c.Param(restapi.ParameterBlockID)) + return nil, ierrors.Wrapf(err, "failed to parse block ID %s", c.Param(api.ParameterBlockID)) } return blockMetadataByBlockID(blockID) } -func blockWithMetadataByID(c echo.Context) (*apimodels.BlockWithMetadataResponse, error) { - blockID, err := httpserver.ParseBlockIDParam(c, restapi.ParameterBlockID) +func blockWithMetadataByID(c echo.Context) (*api.BlockWithMetadataResponse, error) { + blockID, err := httpserver.ParseBlockIDParam(c, api.ParameterBlockID) if err != nil { - return nil, ierrors.Wrapf(err, "failed to parse block ID %s", c.Param(restapi.ParameterBlockID)) + return nil, ierrors.Wrapf(err, "failed to parse block ID %s", c.Param(api.ParameterBlockID)) } block, exists := deps.Protocol.MainEngineInstance().Block(blockID) @@ -59,19 +58,19 @@ func blockWithMetadataByID(c echo.Context) (*apimodels.BlockWithMetadataResponse return nil, err } - return &apimodels.BlockWithMetadataResponse{ + return &api.BlockWithMetadataResponse{ Block: block.ProtocolBlock(), Metadata: blockMetadata, }, nil } -func blockIssuance() (*apimodels.IssuanceBlockHeaderResponse, error) { +func blockIssuance() (*api.IssuanceBlockHeaderResponse, error) { references := deps.Protocol.MainEngineInstance().TipSelection.SelectTips(iotago.BasicBlockMaxParents) if len(references[iotago.StrongParentType]) == 0 { return nil, ierrors.Wrap(echo.ErrServiceUnavailable, "no strong parents available") } - resp := &apimodels.IssuanceBlockHeaderResponse{ + resp := &api.IssuanceBlockHeaderResponse{ StrongParents: references[iotago.StrongParentType], WeakParents: references[iotago.WeakParentType], ShallowLikeParents: references[iotago.ShallowLikeParentType], @@ -82,7 +81,7 @@ func blockIssuance() (*apimodels.IssuanceBlockHeaderResponse, error) { return resp, nil } -func sendBlock(c echo.Context) (*apimodels.BlockCreatedResponse, error) { +func sendBlock(c echo.Context) (*api.BlockCreatedResponse, error) { iotaBlock, err := httpserver.ParseRequestByHeader(c, deps.Protocol.CommittedAPI(), iotago.BlockFromBytes(deps.Protocol)) if err != nil { return nil, err @@ -102,7 +101,7 @@ func sendBlock(c echo.Context) (*apimodels.BlockCreatedResponse, error) { } } - return &apimodels.BlockCreatedResponse{ + return &api.BlockCreatedResponse{ BlockID: blockID, }, nil } diff --git a/components/restapi/core/commitment.go b/components/restapi/core/commitment.go index 2990f9b30..38f68cb84 100644 --- a/components/restapi/core/commitment.go +++ b/components/restapi/core/commitment.go @@ -6,7 +6,7 @@ import ( "github.com/iotaledger/hive.go/ierrors" "github.com/iotaledger/iota-core/pkg/model" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) func getCommitmentBySlot(slot iotago.SlotIndex, latestCommitment ...*model.Commitment) (*model.Commitment, error) { @@ -53,7 +53,7 @@ func getCommitmentByID(commitmentID iotago.CommitmentID, latestCommitment ...*mo return commitment, nil } -func getUTXOChanges(commitmentID iotago.CommitmentID) (*apimodels.UTXOChangesResponse, error) { +func getUTXOChanges(commitmentID iotago.CommitmentID) (*api.UTXOChangesResponse, error) { diffs, err := deps.Protocol.MainEngineInstance().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) @@ -70,7 +70,7 @@ func getUTXOChanges(commitmentID iotago.CommitmentID) (*apimodels.UTXOChangesRes consumedOutputs[i] = output.OutputID() } - return &apimodels.UTXOChangesResponse{ + return &api.UTXOChangesResponse{ CommitmentID: commitmentID, CreatedOutputs: createdOutputs, ConsumedOutputs: consumedOutputs, diff --git a/components/restapi/core/component.go b/components/restapi/core/component.go index 570929068..7fcfc5d8c 100644 --- a/components/restapi/core/component.go +++ b/components/restapi/core/component.go @@ -1,7 +1,6 @@ package core import ( - "fmt" "net/http" "strings" @@ -17,7 +16,7 @@ import ( "github.com/iotaledger/iota-core/pkg/blockhandler" protocolpkg "github.com/iotaledger/iota-core/pkg/protocol" restapipkg "github.com/iotaledger/iota-core/pkg/restapi" - "github.com/iotaledger/iota.go/v4/nodeclient" + "github.com/iotaledger/iota.go/v4/api" ) func init() { @@ -55,19 +54,15 @@ func configure() error { Component.LogPanicf("RestAPI plugin needs to be enabled to use the %s plugin", Component.Name) } - formatEndpoint := func(endpoint string, parameter string) string { - return fmt.Sprintf(endpoint, ":"+parameter) - } - - routeGroup := deps.RestRouteManager.AddRoute(nodeclient.CorePluginName) + routeGroup := deps.RestRouteManager.AddRoute(api.CorePluginName) - routeGroup.GET(nodeclient.CoreEndpointInfo, func(c echo.Context) error { + routeGroup.GET(api.CoreEndpointInfo, func(c echo.Context) error { resp := info() return responseByHeader(c, resp) }) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointBlock, restapipkg.ParameterBlockID), func(c echo.Context) error { + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointBlock), func(c echo.Context) error { resp, err := blockByID(c) if err != nil { return err @@ -76,7 +71,7 @@ func configure() error { return responseByHeader(c, resp) }) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointBlockMetadata, restapipkg.ParameterBlockID), func(c echo.Context) error { + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointBlockMetadata), func(c echo.Context) error { resp, err := blockMetadataByID(c) if err != nil { return err @@ -85,7 +80,7 @@ func configure() error { return responseByHeader(c, resp) }, checkNodeSynced()) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointBlockWithMetadata, restapipkg.ParameterBlockID), func(c echo.Context) error { + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointBlockWithMetadata), func(c echo.Context) error { resp, err := blockWithMetadataByID(c) if err != nil { return err @@ -94,7 +89,7 @@ func configure() error { return responseByHeader(c, resp) }, checkNodeSynced()) - routeGroup.POST(nodeclient.CoreEndpointBlocks, func(c echo.Context) error { + routeGroup.POST(api.CoreEndpointBlocks, func(c echo.Context) error { resp, err := sendBlock(c) if err != nil { return err @@ -104,7 +99,7 @@ func configure() error { return httpserver.JSONResponse(c, http.StatusCreated, resp) }, checkNodeSynced()) - routeGroup.GET(nodeclient.CoreEndpointBlockIssuance, func(c echo.Context) error { + routeGroup.GET(api.CoreEndpointBlockIssuance, func(c echo.Context) error { resp, err := blockIssuance() if err != nil { return err @@ -113,8 +108,8 @@ func configure() error { return responseByHeader(c, resp) }, checkNodeSynced()) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointCommitmentByID, restapipkg.ParameterCommitmentID), func(c echo.Context) error { - commitmentID, err := httpserver.ParseCommitmentIDParam(c, restapipkg.ParameterCommitmentID) + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointCommitmentByID), func(c echo.Context) error { + commitmentID, err := httpserver.ParseCommitmentIDParam(c, api.ParameterCommitmentID) if err != nil { return err } @@ -127,8 +122,8 @@ func configure() error { return responseByHeader(c, commitment.Commitment()) }) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointCommitmentByIDUTXOChanges, restapipkg.ParameterCommitmentID), func(c echo.Context) error { - commitmentID, err := httpserver.ParseCommitmentIDParam(c, restapipkg.ParameterCommitmentID) + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointCommitmentByIDUTXOChanges), func(c echo.Context) error { + commitmentID, err := httpserver.ParseCommitmentIDParam(c, api.ParameterCommitmentID) if err != nil { return err } @@ -147,8 +142,8 @@ func configure() error { return responseByHeader(c, resp) }) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointCommitmentByIndex, restapipkg.ParameterSlotIndex), func(c echo.Context) error { - index, err := httpserver.ParseSlotParam(c, restapipkg.ParameterSlotIndex) + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointCommitmentBySlot), func(c echo.Context) error { + index, err := httpserver.ParseSlotParam(c, api.ParameterSlot) if err != nil { return err } @@ -161,8 +156,8 @@ func configure() error { return responseByHeader(c, commitment.Commitment()) }) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointCommitmentByIndexUTXOChanges, restapipkg.ParameterSlotIndex), func(c echo.Context) error { - slot, err := httpserver.ParseSlotParam(c, restapipkg.ParameterSlotIndex) + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointCommitmentBySlotUTXOChanges), func(c echo.Context) error { + slot, err := httpserver.ParseSlotParam(c, api.ParameterSlot) if err != nil { return err } @@ -180,7 +175,7 @@ func configure() error { return responseByHeader(c, resp) }) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointOutput, restapipkg.ParameterOutputID), func(c echo.Context) error { + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointOutput), func(c echo.Context) error { resp, err := outputByID(c) if err != nil { return err @@ -189,7 +184,7 @@ func configure() error { return responseByHeader(c, resp) }) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointOutputMetadata, restapipkg.ParameterOutputID), func(c echo.Context) error { + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointOutputMetadata), func(c echo.Context) error { resp, err := outputMetadataByID(c) if err != nil { return err @@ -198,7 +193,7 @@ func configure() error { return responseByHeader(c, resp) }) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointOutputWithMetadata, restapipkg.ParameterOutputID), func(c echo.Context) error { + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointOutputWithMetadata), func(c echo.Context) error { resp, err := outputWithMetadataByID(c) if err != nil { return err @@ -207,7 +202,7 @@ func configure() error { return responseByHeader(c, resp) }) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointTransactionsIncludedBlock, restapipkg.ParameterTransactionID), func(c echo.Context) error { + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointTransactionsIncludedBlock), func(c echo.Context) error { block, err := blockByTransactionID(c) if err != nil { return err @@ -216,7 +211,7 @@ func configure() error { return responseByHeader(c, block.ProtocolBlock()) }) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointTransactionsIncludedBlockMetadata, restapipkg.ParameterTransactionID), func(c echo.Context) error { + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointTransactionsIncludedBlockMetadata), func(c echo.Context) error { resp, err := blockMetadataFromTransactionID(c) if err != nil { return err @@ -225,7 +220,7 @@ func configure() error { return responseByHeader(c, resp) }, checkNodeSynced()) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointCongestion, restapipkg.ParameterBech32Address), func(c echo.Context) error { + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointCongestion), func(c echo.Context) error { resp, err := congestionByAccountAddress(c) if err != nil { return err @@ -234,7 +229,7 @@ func configure() error { return responseByHeader(c, resp) }, checkNodeSynced()) - routeGroup.GET(nodeclient.CoreEndpointValidators, func(c echo.Context) error { + routeGroup.GET(api.CoreEndpointValidators, func(c echo.Context) error { resp, err := validators(c) if err != nil { return err @@ -243,7 +238,7 @@ func configure() error { return responseByHeader(c, resp) }, checkNodeSynced()) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointValidatorsAccount, restapipkg.ParameterBech32Address), func(c echo.Context) error { + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointValidatorsAccount), func(c echo.Context) error { resp, err := validatorByAccountAddress(c) if err != nil { return err @@ -252,7 +247,7 @@ func configure() error { return responseByHeader(c, resp) }, checkNodeSynced()) - routeGroup.GET(formatEndpoint(nodeclient.CoreEndpointRewards, restapipkg.ParameterOutputID), func(c echo.Context) error { + routeGroup.GET(api.EndpointWithEchoParameters(api.CoreEndpointRewards), func(c echo.Context) error { resp, err := rewardsByOutputID(c) if err != nil { return err @@ -261,7 +256,7 @@ func configure() error { return responseByHeader(c, resp) }, checkNodeSynced()) - routeGroup.GET(nodeclient.CoreEndpointCommittee, func(c echo.Context) error { + routeGroup.GET(api.CoreEndpointCommittee, func(c echo.Context) error { resp, err := selectedCommittee(c) if err != nil { return err diff --git a/components/restapi/core/node.go b/components/restapi/core/node.go index c6b829c87..5ddc1fcfa 100644 --- a/components/restapi/core/node.go +++ b/components/restapi/core/node.go @@ -1,11 +1,9 @@ package core -import ( - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" -) +import "github.com/iotaledger/iota.go/v4/api" -func protocolParameters() []*apimodels.InfoResProtocolParameters { - protoParams := make([]*apimodels.InfoResProtocolParameters, 0) +func protocolParameters() []*api.InfoResProtocolParameters { + protoParams := make([]*api.InfoResProtocolParameters, 0) provider := deps.Protocol.MainEngineInstance().Storage.Settings().APIProvider() for _, version := range provider.ProtocolEpochVersions() { protocolParams := provider.ProtocolParameters(version.Version) @@ -13,7 +11,7 @@ func protocolParameters() []*apimodels.InfoResProtocolParameters { continue } - protoParams = append(protoParams, &apimodels.InfoResProtocolParameters{ + protoParams = append(protoParams, &api.InfoResProtocolParameters{ StartEpoch: version.StartEpoch, Parameters: protocolParams, }) @@ -22,15 +20,15 @@ func protocolParameters() []*apimodels.InfoResProtocolParameters { return protoParams } -func info() *apimodels.InfoResponse { +func info() *api.InfoResponse { clSnapshot := deps.Protocol.MainEngineInstance().Clock.Snapshot() syncStatus := deps.Protocol.MainEngineInstance().SyncManager.SyncStatus() metrics := deps.MetricsTracker.NodeMetrics() - return &apimodels.InfoResponse{ + return &api.InfoResponse{ Name: deps.AppInfo.Name, Version: deps.AppInfo.Version, - Status: &apimodels.InfoResNodeStatus{ + Status: &api.InfoResNodeStatus{ IsHealthy: syncStatus.NodeSynced, AcceptedTangleTime: clSnapshot.AcceptedTime, RelativeAcceptedTangleTime: clSnapshot.RelativeAcceptedTime, @@ -42,13 +40,13 @@ func info() *apimodels.InfoResponse { LatestConfirmedBlockSlot: syncStatus.LastConfirmedBlockSlot, PruningEpoch: syncStatus.LastPrunedEpoch, }, - Metrics: &apimodels.InfoResNodeMetrics{ + Metrics: &api.InfoResNodeMetrics{ BlocksPerSecond: metrics.BlocksPerSecond, ConfirmedBlocksPerSecond: metrics.ConfirmedBlocksPerSecond, ConfirmationRate: metrics.ConfirmedRate, }, ProtocolParameters: protocolParameters(), - BaseToken: &apimodels.InfoResBaseToken{ + BaseToken: &api.InfoResBaseToken{ Name: deps.BaseToken.Name, TickerSymbol: deps.BaseToken.TickerSymbol, Unit: deps.BaseToken.Unit, diff --git a/components/restapi/core/transaction.go b/components/restapi/core/transaction.go index 93f660134..a37be7aca 100644 --- a/components/restapi/core/transaction.go +++ b/components/restapi/core/transaction.go @@ -6,15 +6,14 @@ import ( "github.com/iotaledger/hive.go/ierrors" "github.com/iotaledger/inx-app/pkg/httpserver" "github.com/iotaledger/iota-core/pkg/model" - restapipkg "github.com/iotaledger/iota-core/pkg/restapi" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) func blockIDByTransactionID(c echo.Context) (iotago.BlockID, error) { - txID, err := httpserver.ParseTransactionIDParam(c, restapipkg.ParameterTransactionID) + txID, err := httpserver.ParseTransactionIDParam(c, api.ParameterTransactionID) if err != nil { - return iotago.EmptyBlockID, ierrors.Wrapf(err, "failed to parse transaction ID %s", c.Param(restapipkg.ParameterTransactionID)) + return iotago.EmptyBlockID, ierrors.Wrapf(err, "failed to parse transaction ID %s", c.Param(api.ParameterTransactionID)) } return blockIDFromTransactionID(txID) @@ -50,7 +49,7 @@ func blockByTransactionID(c echo.Context) (*model.Block, error) { return block, nil } -func blockMetadataFromTransactionID(c echo.Context) (*apimodels.BlockMetadataResponse, error) { +func blockMetadataFromTransactionID(c echo.Context) (*api.BlockMetadataResponse, error) { blockID, err := blockIDByTransactionID(c) if err != nil { return nil, ierrors.Wrapf(echo.ErrBadRequest, "failed to get block ID by transaction ID: %s", err) diff --git a/components/restapi/core/utxo.go b/components/restapi/core/utxo.go index cec4f033e..a60b79450 100644 --- a/components/restapi/core/utxo.go +++ b/components/restapi/core/utxo.go @@ -6,14 +6,13 @@ import ( "github.com/iotaledger/hive.go/ierrors" "github.com/iotaledger/inx-app/pkg/httpserver" "github.com/iotaledger/iota-core/pkg/protocol/engine/utxoledger" - restapipkg "github.com/iotaledger/iota-core/pkg/restapi" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) -func outputByID(c echo.Context) (*apimodels.OutputResponse, error) { - outputID, err := httpserver.ParseOutputIDParam(c, restapipkg.ParameterOutputID) +func outputByID(c echo.Context) (*api.OutputResponse, error) { + outputID, err := httpserver.ParseOutputIDParam(c, api.ParameterOutputID) if err != nil { - return nil, ierrors.Wrapf(err, "failed to parse output ID %s", c.Param(restapipkg.ParameterOutputID)) + return nil, ierrors.Wrapf(err, "failed to parse output ID %s", c.Param(api.ParameterOutputID)) } output, err := deps.Protocol.MainEngineInstance().Ledger.Output(outputID) @@ -21,16 +20,16 @@ func outputByID(c echo.Context) (*apimodels.OutputResponse, error) { return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to get output %s from the Ledger: %s", outputID.ToHex(), err) } - return &apimodels.OutputResponse{ + return &api.OutputResponse{ Output: output.Output(), OutputIDProof: output.OutputIDProof(), }, nil } -func outputMetadataByID(c echo.Context) (*apimodels.OutputMetadata, error) { - outputID, err := httpserver.ParseOutputIDParam(c, restapipkg.ParameterOutputID) +func outputMetadataByID(c echo.Context) (*api.OutputMetadata, error) { + outputID, err := httpserver.ParseOutputIDParam(c, api.ParameterOutputID) if err != nil { - return nil, ierrors.Wrapf(err, "failed to parse output ID %s", c.Param(restapipkg.ParameterOutputID)) + return nil, ierrors.Wrapf(err, "failed to parse output ID %s", c.Param(api.ParameterOutputID)) } output, spent, err := deps.Protocol.MainEngineInstance().Ledger.OutputOrSpent(outputID) @@ -45,10 +44,10 @@ func outputMetadataByID(c echo.Context) (*apimodels.OutputMetadata, error) { return newOutputMetadataResponse(output) } -func outputWithMetadataByID(c echo.Context) (*apimodels.OutputWithMetadataResponse, error) { - outputID, err := httpserver.ParseOutputIDParam(c, restapipkg.ParameterOutputID) +func outputWithMetadataByID(c echo.Context) (*api.OutputWithMetadataResponse, error) { + outputID, err := httpserver.ParseOutputIDParam(c, api.ParameterOutputID) if err != nil { - return nil, ierrors.Wrapf(err, "failed to parse output ID %s", c.Param(restapipkg.ParameterOutputID)) + return nil, ierrors.Wrapf(err, "failed to parse output ID %s", c.Param(api.ParameterOutputID)) } output, spent, err := deps.Protocol.MainEngineInstance().Ledger.OutputOrSpent(outputID) @@ -62,7 +61,7 @@ func outputWithMetadataByID(c echo.Context) (*apimodels.OutputWithMetadataRespon return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to load spent output metadata: %s", err) } - return &apimodels.OutputWithMetadataResponse{ + return &api.OutputWithMetadataResponse{ Output: spent.Output().Output(), OutputIDProof: spent.Output().OutputIDProof(), Metadata: metadata, @@ -74,17 +73,17 @@ func outputWithMetadataByID(c echo.Context) (*apimodels.OutputWithMetadataRespon return nil, err } - return &apimodels.OutputWithMetadataResponse{ + return &api.OutputWithMetadataResponse{ Output: output.Output(), OutputIDProof: output.OutputIDProof(), Metadata: metadata, }, nil } -func newOutputMetadataResponse(output *utxoledger.Output) (*apimodels.OutputMetadata, error) { +func newOutputMetadataResponse(output *utxoledger.Output) (*api.OutputMetadata, error) { latestCommitment := deps.Protocol.MainEngineInstance().SyncManager.LatestCommitment() - resp := &apimodels.OutputMetadata{ + resp := &api.OutputMetadata{ BlockID: output.BlockID(), TransactionID: output.OutputID().TransactionID(), OutputIndex: output.OutputID().Index(), @@ -105,10 +104,10 @@ func newOutputMetadataResponse(output *utxoledger.Output) (*apimodels.OutputMeta return resp, nil } -func newSpentMetadataResponse(spent *utxoledger.Spent) (*apimodels.OutputMetadata, error) { +func newSpentMetadataResponse(spent *utxoledger.Spent) (*api.OutputMetadata, error) { latestCommitment := deps.Protocol.MainEngineInstance().SyncManager.LatestCommitment() - resp := &apimodels.OutputMetadata{ + resp := &api.OutputMetadata{ BlockID: spent.BlockID(), TransactionID: spent.OutputID().TransactionID(), OutputIndex: spent.OutputID().Index(), diff --git a/components/restapi/management/component.go b/components/restapi/management/component.go index b35ecd637..24a3d91dd 100644 --- a/components/restapi/management/component.go +++ b/components/restapi/management/component.go @@ -1,7 +1,6 @@ package management import ( - "fmt" "net/http" "github.com/labstack/echo/v4" @@ -12,7 +11,7 @@ import ( "github.com/iotaledger/iota-core/components/restapi" "github.com/iotaledger/iota-core/pkg/protocol" restapipkg "github.com/iotaledger/iota-core/pkg/restapi" - "github.com/iotaledger/iota.go/v4/nodeclient" + "github.com/iotaledger/iota.go/v4/api" ) func init() { @@ -44,13 +43,9 @@ func configure() error { Component.LogPanicf("RestAPI plugin needs to be enabled to use the %s plugin", Component.Name) } - formatEndpoint := func(endpoint string, parameter string) string { - return fmt.Sprintf(endpoint, ":"+parameter) - } - - routeGroup := deps.RestRouteManager.AddRoute(nodeclient.ManagementPluginName) + routeGroup := deps.RestRouteManager.AddRoute(api.ManagementPluginName) - routeGroup.GET(formatEndpoint(nodeclient.ManagementEndpointPeer, restapipkg.ParameterPeerID), func(c echo.Context) error { + routeGroup.GET(api.EndpointWithEchoParameters(api.ManagementEndpointPeer), func(c echo.Context) error { resp, err := getPeer(c) if err != nil { return err @@ -59,7 +54,7 @@ func configure() error { return httpserver.JSONResponse(c, http.StatusOK, resp) }) - routeGroup.DELETE(formatEndpoint(nodeclient.ManagementEndpointPeer, restapipkg.ParameterPeerID), func(c echo.Context) error { + routeGroup.DELETE(api.EndpointWithEchoParameters(api.ManagementEndpointPeer), func(c echo.Context) error { if err := removePeer(c); err != nil { return err } @@ -67,7 +62,7 @@ func configure() error { return c.NoContent(http.StatusNoContent) }) - routeGroup.GET(nodeclient.ManagementEndpointPeers, func(c echo.Context) error { + routeGroup.GET(api.ManagementEndpointPeers, func(c echo.Context) error { resp, err := listPeers(c) if err != nil { return err @@ -76,7 +71,7 @@ func configure() error { return httpserver.JSONResponse(c, http.StatusOK, resp) }) - routeGroup.POST(nodeclient.ManagementEndpointPeers, func(c echo.Context) error { + routeGroup.POST(api.ManagementEndpointPeers, func(c echo.Context) error { resp, err := addPeer(c, Component.Logger()) if err != nil { return err @@ -85,7 +80,7 @@ func configure() error { return httpserver.JSONResponse(c, http.StatusOK, resp) }) - routeGroup.POST(nodeclient.ManagementEndpointDatabasePrune, func(c echo.Context) error { + routeGroup.POST(api.ManagementEndpointDatabasePrune, func(c echo.Context) error { resp, err := pruneDatabase(c) if err != nil { return err @@ -94,7 +89,7 @@ func configure() error { return httpserver.JSONResponse(c, http.StatusOK, resp) }) - routeGroup.POST(nodeclient.ManagementEndpointSnapshotsCreate, func(c echo.Context) error { + routeGroup.POST(api.ManagementEndpointSnapshotsCreate, func(c echo.Context) error { resp, err := createSnapshots(c) if err != nil { return err diff --git a/components/restapi/management/peers.go b/components/restapi/management/peers.go index 254267e42..95af092a4 100644 --- a/components/restapi/management/peers.go +++ b/components/restapi/management/peers.go @@ -4,12 +4,12 @@ import ( "github.com/labstack/echo/v4" "github.com/iotaledger/hive.go/logger" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) /* // WrapInfoSnapshot wraps the given peer info snapshot with additional metadata, such as gossip protocol information. -func WrapInfoSnapshot(info *p2p.PeerInfoSnapshot) *apimodels.PeerResponse { +func WrapInfoSnapshot(info *p2p.PeerInfoSnapshot) *api.PeerResponse { var alias *string if info.Alias != "" { @@ -39,7 +39,7 @@ func WrapInfoSnapshot(info *p2p.PeerInfoSnapshot) *apimodels.PeerResponse { } */ -func getPeer(_ echo.Context) (*apimodels.PeerInfo, error) { +func getPeer(_ echo.Context) (*api.PeerInfo, error) { /* peerID, err := restapipkg.ParsePeerIDParam(c) if err != nil { @@ -74,7 +74,7 @@ func removePeer(_ echo.Context) error { } //nolint:unparam // even if the error is never used, the structure of all routes should be the same -func listPeers(_ echo.Context) (*apimodels.PeersResponse, error) { +func listPeers(_ echo.Context) (*api.PeersResponse, error) { /* peerInfos := deps.PeeringManager.PeerInfoSnapshots() results := make([]*PeerResponse, len(peerInfos)) @@ -89,7 +89,7 @@ func listPeers(_ echo.Context) (*apimodels.PeersResponse, error) { return nil, nil } -func addPeer(_ echo.Context, _ *logger.Logger) (*apimodels.PeerInfo, error) { +func addPeer(_ echo.Context, _ *logger.Logger) (*api.PeerInfo, error) { /* request := &addPeerRequest{} diff --git a/components/restapi/management/pruning.go b/components/restapi/management/pruning.go index 972646757..8f9af7399 100644 --- a/components/restapi/management/pruning.go +++ b/components/restapi/management/pruning.go @@ -6,15 +6,15 @@ import ( "github.com/iotaledger/hive.go/ierrors" "github.com/iotaledger/inx-app/pkg/httpserver" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) -func pruneDatabase(c echo.Context) (*apimodels.PruneDatabaseResponse, error) { +func pruneDatabase(c echo.Context) (*api.PruneDatabaseResponse, error) { if deps.Protocol.MainEngineInstance().Storage.IsPruning() { return nil, ierrors.Wrapf(echo.ErrServiceUnavailable, "node is already pruning") } - request := &apimodels.PruneDatabaseRequest{} + request := &api.PruneDatabaseRequest{} if err := c.Bind(request); err != nil { return nil, ierrors.Wrapf(httpserver.ErrInvalidParameter, "invalid request, error: %s", err) } @@ -60,7 +60,7 @@ func pruneDatabase(c echo.Context) (*apimodels.PruneDatabaseResponse, error) { targetEpoch++ } - return &apimodels.PruneDatabaseResponse{ + return &api.PruneDatabaseResponse{ Epoch: targetEpoch, }, nil } diff --git a/components/restapi/management/snapshots.go b/components/restapi/management/snapshots.go index 3f6f76317..bbcec37c6 100644 --- a/components/restapi/management/snapshots.go +++ b/components/restapi/management/snapshots.go @@ -3,10 +3,10 @@ package management import ( "github.com/labstack/echo/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) -func createSnapshots(_ echo.Context) (*apimodels.CreateSnapshotsResponse, error) { +func createSnapshots(_ echo.Context) (*api.CreateSnapshotsResponse, error) { /* if deps.SnapshotManager.IsSnapshotting() || deps.PruningManager.IsPruning() { return nil, errors.WithMessage(echo.ErrServiceUnavailable, "node is already creating a snapshot or pruning is running") diff --git a/components/restapi/routes.go b/components/restapi/routes.go index 0bf8f30c5..0ea71b46c 100644 --- a/components/restapi/routes.go +++ b/components/restapi/routes.go @@ -6,7 +6,7 @@ import ( "github.com/labstack/echo/v4" "github.com/iotaledger/inx-app/pkg/httpserver" - "github.com/iotaledger/iota.go/v4/nodeclient" + "github.com/iotaledger/iota.go/v4/api" ) type RoutesResponse struct { @@ -15,7 +15,7 @@ type RoutesResponse struct { func setupRoutes() { - deps.Echo.GET(nodeclient.RouteHealth, func(c echo.Context) error { + deps.Echo.GET(api.RouteHealth, func(c echo.Context) error { if deps.Protocol.MainEngineInstance().SyncManager.IsNodeSynced() { return c.NoContent(http.StatusOK) } @@ -23,7 +23,7 @@ func setupRoutes() { return c.NoContent(http.StatusServiceUnavailable) }) - deps.Echo.GET(nodeclient.RouteRoutes, func(c echo.Context) error { + deps.Echo.GET(api.RouteRoutes, func(c echo.Context) error { resp := &RoutesResponse{ Routes: deps.RestRouteManager.Routes(), } diff --git a/go.mod b/go.mod index 53a076de5..a22ffce64 100644 --- a/go.mod +++ b/go.mod @@ -12,20 +12,20 @@ require ( github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/iotaledger/hive.go/ads v0.0.0-20231110191152-7135670285dc github.com/iotaledger/hive.go/app v0.0.0-20231113110812-4ca2b6cc9a42 - github.com/iotaledger/hive.go/constraints v0.0.0-20231113110812-4ca2b6cc9a42 + github.com/iotaledger/hive.go/constraints v0.0.0-20231122112629-bdf1cc39fba7 github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231113110812-4ca2b6cc9a42 - github.com/iotaledger/hive.go/crypto v0.0.0-20231113110812-4ca2b6cc9a42 + github.com/iotaledger/hive.go/crypto v0.0.0-20231122112629-bdf1cc39fba7 github.com/iotaledger/hive.go/ds v0.0.0-20231113110812-4ca2b6cc9a42 - github.com/iotaledger/hive.go/ierrors v0.0.0-20231113110812-4ca2b6cc9a42 + github.com/iotaledger/hive.go/ierrors v0.0.0-20231122112629-bdf1cc39fba7 github.com/iotaledger/hive.go/kvstore v0.0.0-20231110191152-7135670285dc - github.com/iotaledger/hive.go/lo v0.0.0-20231113110812-4ca2b6cc9a42 + github.com/iotaledger/hive.go/lo v0.0.0-20231122112629-bdf1cc39fba7 github.com/iotaledger/hive.go/logger v0.0.0-20231113110812-4ca2b6cc9a42 - github.com/iotaledger/hive.go/runtime v0.0.0-20231113110812-4ca2b6cc9a42 + github.com/iotaledger/hive.go/runtime v0.0.0-20231122112629-bdf1cc39fba7 github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231113110812-4ca2b6cc9a42 - github.com/iotaledger/hive.go/stringify v0.0.0-20231113110812-4ca2b6cc9a42 - github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231122193640-8819c43be9c6 - github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231120082637-ccd5b8465251 - github.com/iotaledger/iota.go/v4 v4.0.0-20231123022049-52a0703d077f + github.com/iotaledger/hive.go/stringify v0.0.0-20231122112629-bdf1cc39fba7 + github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231123103852-bb039cbab83b + github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231123103318-f6ea945e2e98 + github.com/iotaledger/iota.go/v4 v4.0.0-20231123102955-eff367396512 github.com/labstack/echo/v4 v4.11.3 github.com/labstack/gommon v0.4.1 github.com/libp2p/go-libp2p v0.32.0 @@ -178,7 +178,7 @@ require ( golang.org/x/time v0.4.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-20231106174013-bbf56f31fb17 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect diff --git a/go.sum b/go.sum index c6a4d1611..4f00d72fe 100644 --- a/go.sum +++ b/go.sum @@ -279,36 +279,36 @@ github.com/iotaledger/hive.go/ads v0.0.0-20231110191152-7135670285dc h1:PsArE43U github.com/iotaledger/hive.go/ads v0.0.0-20231110191152-7135670285dc/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= github.com/iotaledger/hive.go/app v0.0.0-20231113110812-4ca2b6cc9a42 h1:K6VF23FOqHTRdk5OzsuBkYlGV008SZgKYqNwb0bp3rk= github.com/iotaledger/hive.go/app v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:+riYmeLApkLlj4+EpuJpEJAsj/KGfD7cqLGy7oTsPOM= -github.com/iotaledger/hive.go/constraints v0.0.0-20231113110812-4ca2b6cc9a42 h1:+PyLPZhRHy+Negjpuj0CSLaObpErEH7yI6HB2z5N6b0= -github.com/iotaledger/hive.go/constraints v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/constraints v0.0.0-20231122112629-bdf1cc39fba7 h1:ozpeM5nHHUjK3aKpTmwFEDG2bqxLJf0KBCTakjh+1FE= +github.com/iotaledger/hive.go/constraints v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231113110812-4ca2b6cc9a42 h1:3dW4gz0Vr9BogN826HRTp0OFlbngjhWcVPUfDhJ57Yw= github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231113110812-4ca2b6cc9a42/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= -github.com/iotaledger/hive.go/crypto v0.0.0-20231113110812-4ca2b6cc9a42 h1:t6EKe+O7XAmbe07cVHuM/3aBLEbVIY4D6yefANB4PUA= -github.com/iotaledger/hive.go/crypto v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= +github.com/iotaledger/hive.go/crypto v0.0.0-20231122112629-bdf1cc39fba7 h1:vLLhxGhipU6AH/paexuRX3zsOvcl8bdYcwJRAchUP8g= +github.com/iotaledger/hive.go/crypto v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= github.com/iotaledger/hive.go/ds v0.0.0-20231113110812-4ca2b6cc9a42 h1:QZiMlDxmikF64zimWQunTrsEGOK9ydRahUAz2I46JAk= github.com/iotaledger/hive.go/ds v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231113110812-4ca2b6cc9a42 h1:gxlZ4zL6EfLyqT0+hIFV3WVE0FrPVgV5cQdyn36vPXQ= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231122112629-bdf1cc39fba7 h1:tf7x4U+ZXnmFXhUmqYtn0kcgpOcGPIhbxR/akpzAU4U= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= github.com/iotaledger/hive.go/kvstore v0.0.0-20231110191152-7135670285dc h1:3fsqfM2NqfhrewVdlKT3MHcXxVNvUCSP7P32il1ypa0= github.com/iotaledger/hive.go/kvstore v0.0.0-20231110191152-7135670285dc/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= -github.com/iotaledger/hive.go/lo v0.0.0-20231113110812-4ca2b6cc9a42 h1:kcHkWyURZDVqO80OmJo5Z+wTJB6H+s52WAnU575vX0o= -github.com/iotaledger/hive.go/lo v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= +github.com/iotaledger/hive.go/lo v0.0.0-20231122112629-bdf1cc39fba7 h1:svFxB75LsjUOHt3crcn70GVk7ztdNv5CytC3GbGj9FQ= +github.com/iotaledger/hive.go/lo v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= github.com/iotaledger/hive.go/log v0.0.0-20231110191152-7135670285dc h1:joYrsSZuVG3DfAQR9iS3qjnMExJ0qNp2+369sxb1Y4g= github.com/iotaledger/hive.go/log v0.0.0-20231110191152-7135670285dc/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= github.com/iotaledger/hive.go/logger v0.0.0-20231113110812-4ca2b6cc9a42 h1:uD99UbTtBM5SIP9N3c/3BBLtb0frGYFsZ2lS8Zxtqr4= github.com/iotaledger/hive.go/logger v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:w1psHM2MuKsen1WdsPKrpqElYH7ZOQ+YdQIgJZg4HTo= -github.com/iotaledger/hive.go/runtime v0.0.0-20231113110812-4ca2b6cc9a42 h1:hpR++ME3Y3CcxA431Zg0PgcCJUNkbBqjNXxR/bs+NdI= -github.com/iotaledger/hive.go/runtime v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= +github.com/iotaledger/hive.go/runtime v0.0.0-20231122112629-bdf1cc39fba7 h1:NtR3ZeY6Mop9JcHu62Z6JPMRcijIV1ZCZPpOev8HZRw= +github.com/iotaledger/hive.go/runtime v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231113110812-4ca2b6cc9a42 h1:hepsnGvaS39azq80GV8DT9HlexoO/RqJbyiW5FXZ0HQ= github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231113110812-4ca2b6cc9a42/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= -github.com/iotaledger/hive.go/stringify v0.0.0-20231113110812-4ca2b6cc9a42 h1:9c7NiX2cnNPHR9UNWINDqNkolupXiDF3543pR6KLwIg= -github.com/iotaledger/hive.go/stringify v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231122193640-8819c43be9c6 h1:wMbfn6I8+5GNgifw3oxh0NR0aej+VyGOarzp1YloF5E= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231122193640-8819c43be9c6/go.mod h1:S0en1XmbHTXWFU3SZI9yxxOQdlz0fUANLnclKiAOnlI= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231120082637-ccd5b8465251 h1:bYGO8jXNXJNMGPG9etGW7WXfLbRU9ofx1xdd29/sS9M= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231120082637-ccd5b8465251/go.mod h1:chzj8FDIeXHIh3D52QTZ7imADlzdkhg7o7E2Qr85MJ8= -github.com/iotaledger/iota.go/v4 v4.0.0-20231123022049-52a0703d077f h1:CBSRHs4ysjR/NgrVb//4mm5SgzynIOOm0ZJ3IRIf3FY= -github.com/iotaledger/iota.go/v4 v4.0.0-20231123022049-52a0703d077f/go.mod h1:1CUJKGvkOUGXakxFZGAagEQDX9qYyhzIElmUHCHo9RM= +github.com/iotaledger/hive.go/stringify v0.0.0-20231122112629-bdf1cc39fba7 h1:h481Dn+giKO/1MamwuDZ8Mvzg4GbPx/asKD/X3Zs8wc= +github.com/iotaledger/hive.go/stringify v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231123103852-bb039cbab83b h1:T/9f4eYcP/fxe0G0pYa6TRZxD9rI9uMdDW89hnsNByU= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231123103852-bb039cbab83b/go.mod h1:c7ktZxoH5Wp2ixzJn/8RmM5v2QOCIu/79tDFvfLbyPs= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231123103318-f6ea945e2e98 h1:PjGs+njONeFaxFgQ3lxxlRs3wTYw3233f/yDyTV8/F8= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231123103318-f6ea945e2e98/go.mod h1:jFRt2SZO3KE74/mk+zeCjlhVROriEg86K8CJTxvfdP8= +github.com/iotaledger/iota.go/v4 v4.0.0-20231123102955-eff367396512 h1:E1m9Ja6d47sVkl0k2a8eU9f5COWqpyNY9ET3TyYLHiI= +github.com/iotaledger/iota.go/v4 v4.0.0-20231123102955-eff367396512/go.mod h1:aO+5iL0vTNwNfE4QMGHVIufGziSI1wTvwJY1ipSMgCk= 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= @@ -877,8 +877,8 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= diff --git a/pkg/protocol/chainmanager/testframework.go b/pkg/protocol/chainmanager/testframework.go index 8fdf41833..9d939b82b 100644 --- a/pkg/protocol/chainmanager/testframework.go +++ b/pkg/protocol/chainmanager/testframework.go @@ -12,7 +12,6 @@ import ( "github.com/iotaledger/hive.go/runtime/syncutils" "github.com/iotaledger/iota-core/pkg/model" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/api" ) type TestFramework struct { @@ -38,7 +37,7 @@ func NewTestFramework(test *testing.T, a iotago.API, opts ...options.Option[Test } return options.Apply(&TestFramework{ - Instance: NewManager(api.SingleVersionProvider(a), handleError), + Instance: NewManager(iotago.SingleVersionProvider(a), handleError), test: test, api: a, diff --git a/pkg/protocol/engine/blockdag/inmemoryblockdag/blockdag.go b/pkg/protocol/engine/blockdag/inmemoryblockdag/blockdag.go index 9d9e3b16f..85125a616 100644 --- a/pkg/protocol/engine/blockdag/inmemoryblockdag/blockdag.go +++ b/pkg/protocol/engine/blockdag/inmemoryblockdag/blockdag.go @@ -15,7 +15,7 @@ import ( "github.com/iotaledger/iota-core/pkg/protocol/engine/blocks" "github.com/iotaledger/iota-core/pkg/protocol/engine/eviction" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) // BlockDAG is a causally ordered DAG that forms the central data structure of the IOTA protocol. @@ -29,7 +29,7 @@ type BlockDAG struct { latestCommitmentFunc func() *model.Commitment uncommittedSlotBlocks *buffer.UnsolidCommitmentBuffer[*blocks.Block] - retainBlockFailure func(blockID iotago.BlockID, failureReason apimodels.BlockFailureReason) + retainBlockFailure func(blockID iotago.BlockID, failureReason api.BlockFailureReason) blockCache *blocks.Blocks @@ -159,7 +159,7 @@ func (b *BlockDAG) Shutdown() { b.workers.Shutdown() } -func (b *BlockDAG) setRetainBlockFailureFunc(retainBlockFailure func(blockID iotago.BlockID, failureReason apimodels.BlockFailureReason)) { +func (b *BlockDAG) setRetainBlockFailureFunc(retainBlockFailure func(blockID iotago.BlockID, failureReason api.BlockFailureReason)) { b.retainBlockFailure = retainBlockFailure } @@ -174,7 +174,7 @@ func (b *BlockDAG) attach(data *model.Block) (block *blocks.Block, wasAttached b block, evicted, updated := b.blockCache.StoreOrUpdate(data) if evicted { - b.retainBlockFailure(data.ID(), apimodels.BlockFailureIsTooOld) + b.retainBlockFailure(data.ID(), api.BlockFailureIsTooOld) return block, false, ierrors.New("cannot attach, block is too old, it was already evicted from the cache") } @@ -192,7 +192,7 @@ func (b *BlockDAG) attach(data *model.Block) (block *blocks.Block, wasAttached b // canAttach determines if the Block can be attached (does not exist and addresses a recent slot). func (b *BlockDAG) shouldAttach(data *model.Block) (shouldAttach bool, err error) { if b.evictionState.InRootBlockSlot(data.ID()) && !b.evictionState.IsRootBlock(data.ID()) { - b.retainBlockFailure(data.ID(), apimodels.BlockFailureIsTooOld) + b.retainBlockFailure(data.ID(), api.BlockFailureIsTooOld) return false, ierrors.Errorf("block data with %s is too old (issued at: %s)", data.ID(), data.ProtocolBlock().Header.IssuingTime) } @@ -216,7 +216,7 @@ func (b *BlockDAG) shouldAttach(data *model.Block) (shouldAttach bool, err error func (b *BlockDAG) canAttachToParents(modelBlock *model.Block) (parentsValid bool, err error) { for _, parentID := range modelBlock.ProtocolBlock().Parents() { if b.evictionState.InRootBlockSlot(parentID) && !b.evictionState.IsRootBlock(parentID) { - b.retainBlockFailure(modelBlock.ID(), apimodels.BlockFailureParentIsTooOld) + b.retainBlockFailure(modelBlock.ID(), api.BlockFailureParentIsTooOld) return false, ierrors.Errorf("parent %s of block %s is too old", parentID, modelBlock.ID()) } } diff --git a/pkg/protocol/engine/booker/inmemorybooker/booker.go b/pkg/protocol/engine/booker/inmemorybooker/booker.go index fb307866b..bae2873cf 100644 --- a/pkg/protocol/engine/booker/inmemorybooker/booker.go +++ b/pkg/protocol/engine/booker/inmemorybooker/booker.go @@ -15,7 +15,7 @@ import ( "github.com/iotaledger/iota-core/pkg/protocol/engine/mempool" "github.com/iotaledger/iota-core/pkg/protocol/engine/mempool/conflictdag" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) type Booker struct { @@ -27,7 +27,7 @@ type Booker struct { ledger ledger.Ledger - retainBlockFailure func(id iotago.BlockID, reason apimodels.BlockFailureReason) + retainBlockFailure func(id iotago.BlockID, reason api.BlockFailureReason) errorHandler func(error) apiProvider iotago.APIProvider @@ -92,7 +92,7 @@ func (b *Booker) Queue(block *blocks.Block) error { } if signedTransactionMetadata == nil { - b.retainBlockFailure(block.ID(), apimodels.BlockFailurePayloadInvalid) + b.retainBlockFailure(block.ID(), api.BlockFailurePayloadInvalid) return ierrors.Errorf("transaction in %s was not attached", block.ID()) } @@ -153,7 +153,7 @@ func (b *Booker) setupBlock(block *blocks.Block) { }) } -func (b *Booker) setRetainBlockFailureFunc(retainBlockFailure func(iotago.BlockID, apimodels.BlockFailureReason)) { +func (b *Booker) setRetainBlockFailureFunc(retainBlockFailure func(iotago.BlockID, api.BlockFailureReason)) { b.retainBlockFailure = retainBlockFailure } @@ -192,7 +192,7 @@ func (b *Booker) inheritConflicts(block *blocks.Block) (conflictIDs ds.Set[iotag for _, parent := range block.ParentsWithType() { parentBlock, exists := b.blockCache.Block(parent.ID) if !exists { - b.retainBlockFailure(block.ID(), apimodels.BlockFailureParentNotFound) + b.retainBlockFailure(block.ID(), api.BlockFailureParentNotFound) return nil, ierrors.Errorf("parent %s does not exist", parent.ID) } diff --git a/pkg/protocol/sybilprotection/sybilprotection.go b/pkg/protocol/sybilprotection/sybilprotection.go index 0968ec425..147e8580c 100644 --- a/pkg/protocol/sybilprotection/sybilprotection.go +++ b/pkg/protocol/sybilprotection/sybilprotection.go @@ -8,13 +8,13 @@ import ( "github.com/iotaledger/iota-core/pkg/protocol/engine/blocks" "github.com/iotaledger/iota-core/pkg/protocol/sybilprotection/seatmanager" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) type SybilProtection interface { TrackBlock(block *blocks.Block) EligibleValidators(epoch iotago.EpochIndex) (accounts.AccountsData, error) - OrderedRegisteredCandidateValidatorsList(epoch iotago.EpochIndex) ([]*apimodels.ValidatorResponse, error) + OrderedRegisteredCandidateValidatorsList(epoch iotago.EpochIndex) ([]*api.ValidatorResponse, error) IsCandidateActive(validatorID iotago.AccountID, epoch iotago.EpochIndex) (bool, error) // ValidatorReward returns the amount of mana that a validator has earned in a given epoch range. // The actual used epoch range is returned, only until usedEnd the decay was applied. diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go b/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go index f99050243..649ff5663 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go @@ -21,7 +21,7 @@ import ( "github.com/iotaledger/iota-core/pkg/protocol/sybilprotection/seatmanager/topstakers" "github.com/iotaledger/iota-core/pkg/protocol/sybilprotection/sybilprotectionv1/performance" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) type SybilProtection struct { @@ -327,7 +327,7 @@ func (o *SybilProtection) EligibleValidators(epoch iotago.EpochIndex) (accounts. } // OrderedRegisteredCandidateValidatorsList returns the currently known list of registered validator candidates for the given epoch. -func (o *SybilProtection) OrderedRegisteredCandidateValidatorsList(epoch iotago.EpochIndex) ([]*apimodels.ValidatorResponse, error) { +func (o *SybilProtection) OrderedRegisteredCandidateValidatorsList(epoch iotago.EpochIndex) ([]*api.ValidatorResponse, error) { candidates, err := o.performanceTracker.ValidatorCandidates(epoch) if err != nil { return nil, ierrors.Wrapf(err, "failed to retrieve candidates") @@ -338,7 +338,7 @@ func (o *SybilProtection) OrderedRegisteredCandidateValidatorsList(epoch iotago. return nil, ierrors.Wrapf(err, "failed to retrieve eligible candidates") } - validatorResp := make([]*apimodels.ValidatorResponse, 0, candidates.Size()) + validatorResp := make([]*api.ValidatorResponse, 0, candidates.Size()) if err := candidates.ForEach(func(candidate iotago.AccountID) error { accountData, exists, err := o.ledger.Account(candidate, o.lastCommittedSlot) if err != nil { @@ -352,7 +352,7 @@ func (o *SybilProtection) OrderedRegisteredCandidateValidatorsList(epoch iotago. return nil } active := activeCandidates.Has(candidate) - validatorResp = append(validatorResp, &apimodels.ValidatorResponse{ + validatorResp = append(validatorResp, &api.ValidatorResponse{ AddressBech32: accountData.ID.ToAddress().Bech32(o.apiProvider.CommittedAPI().ProtocolParameters().Bech32HRP()), StakingEpochEnd: accountData.StakeEndEpoch, PoolStake: accountData.ValidatorStake + accountData.DelegationStake, diff --git a/pkg/restapi/restapi.go b/pkg/restapi/restapi.go index 4c7f3de96..39afa8b29 100644 --- a/pkg/restapi/restapi.go +++ b/pkg/restapi/restapi.go @@ -6,33 +6,10 @@ import ( "github.com/iotaledger/hive.go/ierrors" "github.com/iotaledger/inx-app/pkg/httpserver" + "github.com/iotaledger/iota.go/v4/api" ) const ( - // ParameterBlockID is used to identify a block by its ID. - ParameterBlockID = "blockID" - - // ParameterTransactionID is used to identify a transaction by its ID. - ParameterTransactionID = "transactionID" - - // ParameterOutputID is used to identify an output by its ID. - ParameterOutputID = "outputID" - - // ParameterSlotIndex is used to identify a slot by index. - ParameterSlotIndex = "slotIndex" - - // ParameterEpochIndex is used to identify an epoch by index. - ParameterEpochIndex = "epochIndex" - - // ParameterCommitmentID is used to identify a slot commitment by its ID. - ParameterCommitmentID = "commitmentID" - - // ParameterBech32Address is used to to represent bech32 address. - ParameterBech32Address = "bech32Address" - - // ParameterPeerID is used to identify a peer. - ParameterPeerID = "peerID" - // QueryParameterPageSize is used to specify the page size. QueryParameterPageSize = "pageSize" @@ -41,7 +18,7 @@ const ( ) func ParsePeerIDParam(c echo.Context) (peer.ID, error) { - peerID, err := peer.Decode(c.Param(ParameterPeerID)) + peerID, err := peer.Decode(c.Param(api.ParameterPeerID)) if err != nil { return "", ierrors.Wrapf(httpserver.ErrInvalidParameter, "invalid peerID, error: %s", err) } diff --git a/pkg/retainer/block_metadata.go b/pkg/retainer/block_metadata.go index e829045fe..6d523f527 100644 --- a/pkg/retainer/block_metadata.go +++ b/pkg/retainer/block_metadata.go @@ -2,26 +2,26 @@ package retainer import ( iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) type BlockMetadata struct { BlockID iotago.BlockID - BlockState apimodels.BlockState - BlockFailureReason apimodels.BlockFailureReason - TransactionState apimodels.TransactionState - TransactionFailureReason apimodels.TransactionFailureReason + BlockState api.BlockState + BlockFailureReason api.BlockFailureReason + TransactionState api.TransactionState + TransactionFailureReason api.TransactionFailureReason } -func (b *BlockMetadata) BlockMetadataResponse() *apimodels.BlockMetadataResponse { - response := &apimodels.BlockMetadataResponse{ +func (b *BlockMetadata) BlockMetadataResponse() *api.BlockMetadataResponse { + response := &api.BlockMetadataResponse{ BlockID: b.BlockID, BlockState: b.BlockState.String(), BlockFailureReason: b.BlockFailureReason, TransactionFailureReason: b.TransactionFailureReason, } - if b.TransactionState != apimodels.TransactionStateNoTransaction { + if b.TransactionState != api.TransactionStateNoTransaction { response.TransactionState = b.TransactionState.String() } diff --git a/pkg/retainer/retainer.go b/pkg/retainer/retainer.go index ffcf24502..411e3c323 100644 --- a/pkg/retainer/retainer.go +++ b/pkg/retainer/retainer.go @@ -3,17 +3,17 @@ package retainer import ( "github.com/iotaledger/hive.go/runtime/module" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) // Retainer keeps and resolves all the information needed in the API and INX. type Retainer interface { BlockMetadata(blockID iotago.BlockID) (*BlockMetadata, error) - RegisteredValidatorsCache(uint32) ([]*apimodels.ValidatorResponse, bool) - RetainRegisteredValidatorsCache(uint32, []*apimodels.ValidatorResponse) + RegisteredValidatorsCache(uint32) ([]*api.ValidatorResponse, bool) + RetainRegisteredValidatorsCache(uint32, []*api.ValidatorResponse) - RetainBlockFailure(iotago.BlockID, apimodels.BlockFailureReason) + RetainBlockFailure(iotago.BlockID, api.BlockFailureReason) RetainTransactionFailure(iotago.BlockID, error) // Reset resets the component to a clean state as if it was created at the last commitment. diff --git a/pkg/retainer/retainer/errors.go b/pkg/retainer/retainer/errors.go index 88d9594f6..ffb2fb7d0 100644 --- a/pkg/retainer/retainer/errors.go +++ b/pkg/retainer/retainer/errors.go @@ -3,81 +3,81 @@ package retainer import ( "github.com/iotaledger/hive.go/ierrors" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) -var blocksErrorsFailureReasonMap = map[error]apimodels.BlockFailureReason{ - iotago.ErrIssuerAccountNotFound: apimodels.BlockFailureIssuerAccountNotFound, - iotago.ErrBurnedInsufficientMana: apimodels.BlockFailureBurnedInsufficientMana, - iotago.ErrBlockVersionInvalid: apimodels.BlockFailureVersionInvalid, - iotago.ErrRMCNotFound: apimodels.BlockFailureAccountInvalid, - iotago.ErrFailedToCalculateManaCost: apimodels.BlockFailureManaCostCalculationFailed, - iotago.ErrNegativeBIC: apimodels.BlockFailureAccountInvalid, - iotago.ErrAccountExpired: apimodels.BlockFailureAccountInvalid, - iotago.ErrInvalidSignature: apimodels.BlockFailureSignatureInvalid, +var blocksErrorsFailureReasonMap = map[error]api.BlockFailureReason{ + iotago.ErrIssuerAccountNotFound: api.BlockFailureIssuerAccountNotFound, + iotago.ErrBurnedInsufficientMana: api.BlockFailureBurnedInsufficientMana, + iotago.ErrBlockVersionInvalid: api.BlockFailureVersionInvalid, + iotago.ErrRMCNotFound: api.BlockFailureAccountInvalid, + iotago.ErrFailedToCalculateManaCost: api.BlockFailureManaCostCalculationFailed, + iotago.ErrNegativeBIC: api.BlockFailureAccountInvalid, + iotago.ErrAccountExpired: api.BlockFailureAccountInvalid, + iotago.ErrInvalidSignature: api.BlockFailureSignatureInvalid, } -func determineBlockFailureReason(err error) apimodels.BlockFailureReason { +func determineBlockFailureReason(err error) api.BlockFailureReason { for errKey, failureReason := range blocksErrorsFailureReasonMap { if ierrors.Is(err, errKey) { return failureReason } } // use most general failure reason - return apimodels.BlockFailureInvalid + return api.BlockFailureInvalid } -var txErrorsFailureReasonMap = map[error]apimodels.TransactionFailureReason{ +var txErrorsFailureReasonMap = map[error]api.TransactionFailureReason{ // unknown type / type casting errors - iotago.ErrTxTypeInvalid: apimodels.TxFailureTxTypeInvalid, - iotago.ErrUnknownInputType: apimodels.TxFailureUTXOInputInvalid, - iotago.ErrUTXOInputInvalid: apimodels.TxFailureUTXOInputInvalid, - iotago.ErrUnknownOutputType: apimodels.TxFailureUTXOInputInvalid, - iotago.ErrBICInputInvalid: apimodels.TxFailureBICInputInvalid, - iotago.ErrRewardInputInvalid: apimodels.TxFailureRewardInputInvalid, - iotago.ErrCommitmentInputMissing: apimodels.TxFailureCommitmentInputInvalid, - iotago.ErrCommitmentInputInvalid: apimodels.TxFailureCommitmentInputInvalid, - iotago.ErrUnlockBlockSignatureInvalid: apimodels.TxFailureUnlockBlockSignatureInvalid, + iotago.ErrTxTypeInvalid: api.TxFailureTxTypeInvalid, + iotago.ErrUnknownInputType: api.TxFailureUTXOInputInvalid, + iotago.ErrUTXOInputInvalid: api.TxFailureUTXOInputInvalid, + iotago.ErrUnknownOutputType: api.TxFailureUTXOInputInvalid, + iotago.ErrBICInputInvalid: api.TxFailureBICInputInvalid, + iotago.ErrRewardInputInvalid: api.TxFailureRewardInputInvalid, + iotago.ErrCommitmentInputMissing: api.TxFailureCommitmentInputInvalid, + iotago.ErrCommitmentInputInvalid: api.TxFailureCommitmentInputInvalid, + iotago.ErrUnlockBlockSignatureInvalid: api.TxFailureUnlockBlockSignatureInvalid, // context inputs errors - iotago.ErrNoStakingFeature: apimodels.TxFailureNoStakingFeature, - iotago.ErrFailedToClaimStakingReward: apimodels.TxFailureFailedToClaimStakingReward, - iotago.ErrFailedToClaimDelegationReward: apimodels.TxFailureFailedToClaimDelegationReward, + iotago.ErrNoStakingFeature: api.TxFailureNoStakingFeature, + iotago.ErrFailedToClaimStakingReward: api.TxFailureFailedToClaimStakingReward, + iotago.ErrFailedToClaimDelegationReward: api.TxFailureFailedToClaimDelegationReward, // UTXO errors - iotago.ErrTxConflicting: apimodels.TxFailureConflicting, - iotago.ErrInputAlreadySpent: apimodels.TxFailureUTXOInputAlreadySpent, + iotago.ErrTxConflicting: api.TxFailureConflicting, + iotago.ErrInputAlreadySpent: api.TxFailureUTXOInputAlreadySpent, // native token errors - iotago.ErrNativeTokenSetInvalid: apimodels.TxFailureGivenNativeTokensInvalid, - iotago.ErrNativeTokenSumUnbalanced: apimodels.TxFailureGivenNativeTokensInvalid, + iotago.ErrNativeTokenSetInvalid: api.TxFailureGivenNativeTokensInvalid, + iotago.ErrNativeTokenSumUnbalanced: api.TxFailureGivenNativeTokensInvalid, // vm errors - iotago.ErrInputOutputSumMismatch: apimodels.TxFailureSumOfInputAndOutputValuesDoesNotMatch, - iotago.ErrTimelockNotExpired: apimodels.TxFailureConfiguredTimelockNotYetExpired, - iotago.ErrReturnAmountNotFulFilled: apimodels.TxFailureReturnAmountNotFulfilled, - iotago.ErrInvalidInputUnlock: apimodels.TxFailureInputUnlockInvalid, - iotago.ErrSenderFeatureNotUnlocked: apimodels.TxFailureSenderNotUnlocked, - iotago.ErrChainTransitionInvalid: apimodels.TxFailureChainStateTransitionInvalid, - iotago.ErrInputOutputManaMismatch: apimodels.TxFailureManaAmountInvalid, - iotago.ErrManaAmountInvalid: apimodels.TxFailureManaAmountInvalid, - iotago.ErrInputCreationAfterTxCreation: apimodels.TxFailureInputCreationAfterTxCreation, + iotago.ErrInputOutputSumMismatch: api.TxFailureSumOfInputAndOutputValuesDoesNotMatch, + iotago.ErrTimelockNotExpired: api.TxFailureConfiguredTimelockNotYetExpired, + iotago.ErrReturnAmountNotFulFilled: api.TxFailureReturnAmountNotFulfilled, + iotago.ErrInvalidInputUnlock: api.TxFailureInputUnlockInvalid, + iotago.ErrSenderFeatureNotUnlocked: api.TxFailureSenderNotUnlocked, + iotago.ErrChainTransitionInvalid: api.TxFailureChainStateTransitionInvalid, + iotago.ErrInputOutputManaMismatch: api.TxFailureManaAmountInvalid, + iotago.ErrManaAmountInvalid: api.TxFailureManaAmountInvalid, + iotago.ErrInputCreationAfterTxCreation: api.TxFailureInputCreationAfterTxCreation, // tx capabilities errors - iotago.ErrTxCapabilitiesNativeTokenBurningNotAllowed: apimodels.TxFailureCapabilitiesNativeTokenBurningNotAllowed, - iotago.ErrTxCapabilitiesManaBurningNotAllowed: apimodels.TxFailureCapabilitiesManaBurningNotAllowed, - iotago.ErrTxCapabilitiesAccountDestructionNotAllowed: apimodels.TxFailureCapabilitiesAccountDestructionNotAllowed, - iotago.ErrTxCapabilitiesAnchorDestructionNotAllowed: apimodels.TxFailureCapabilitiesAnchorDestructionNotAllowed, - iotago.ErrTxCapabilitiesFoundryDestructionNotAllowed: apimodels.TxFailureCapabilitiesFoundryDestructionNotAllowed, - iotago.ErrTxCapabilitiesNFTDestructionNotAllowed: apimodels.TxFailureCapabilitiesNFTDestructionNotAllowed, + iotago.ErrTxCapabilitiesNativeTokenBurningNotAllowed: api.TxFailureCapabilitiesNativeTokenBurningNotAllowed, + iotago.ErrTxCapabilitiesManaBurningNotAllowed: api.TxFailureCapabilitiesManaBurningNotAllowed, + iotago.ErrTxCapabilitiesAccountDestructionNotAllowed: api.TxFailureCapabilitiesAccountDestructionNotAllowed, + iotago.ErrTxCapabilitiesAnchorDestructionNotAllowed: api.TxFailureCapabilitiesAnchorDestructionNotAllowed, + iotago.ErrTxCapabilitiesFoundryDestructionNotAllowed: api.TxFailureCapabilitiesFoundryDestructionNotAllowed, + iotago.ErrTxCapabilitiesNFTDestructionNotAllowed: api.TxFailureCapabilitiesNFTDestructionNotAllowed, } -func determineTxFailureReason(err error) apimodels.TransactionFailureReason { +func determineTxFailureReason(err error) api.TransactionFailureReason { for errKey, failureReason := range txErrorsFailureReasonMap { if ierrors.Is(err, errKey) { return failureReason } } // use most general failure reason - return apimodels.TxFailureSemanticValidationFailed + return api.TxFailureSemanticValidationFailed } diff --git a/pkg/retainer/retainer/retainer.go b/pkg/retainer/retainer/retainer.go index c61c1fdcd..3d8f06246 100644 --- a/pkg/retainer/retainer/retainer.go +++ b/pkg/retainer/retainer/retainer.go @@ -13,7 +13,7 @@ import ( "github.com/iotaledger/iota-core/pkg/retainer" "github.com/iotaledger/iota-core/pkg/storage/prunable/slotstore" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) type ( @@ -32,7 +32,7 @@ type Retainer struct { finalizedSlotFunc FinalizedSlotFunc errorHandler func(error) - stakersResponses *shrinkingmap.ShrinkingMap[uint32, []*apimodels.ValidatorResponse] + stakersResponses *shrinkingmap.ShrinkingMap[uint32, []*api.ValidatorResponse] workerPool *workerpool.WorkerPool @@ -43,7 +43,7 @@ func New(workersGroup *workerpool.Group, retainerFunc RetainerFunc, latestCommit return &Retainer{ workerPool: workersGroup.CreatePool("Retainer", workerpool.WithWorkerCount(1)), store: retainerFunc, - stakersResponses: shrinkingmap.New[uint32, []*apimodels.ValidatorResponse](), + stakersResponses: shrinkingmap.New[uint32, []*api.ValidatorResponse](), latestCommittedSlotFunc: latestCommittedSlotFunc, finalizedSlotFunc: finalizedSlotFunc, errorHandler: errorHandler, @@ -84,7 +84,7 @@ func NewProvider() module.Provider[*engine.Engine, retainer.Retainer] { }, asyncOpt) e.Events.Scheduler.BlockDropped.Hook(func(b *blocks.Block, err error) { - r.RetainBlockFailure(b.ID(), apimodels.BlockFailureDroppedDueToCongestion) + r.RetainBlockFailure(b.ID(), api.BlockFailureDroppedDueToCongestion) }) e.HookInitialized(func() { @@ -153,13 +153,13 @@ func (r *Retainer) Shutdown() { func (r *Retainer) BlockMetadata(blockID iotago.BlockID) (*retainer.BlockMetadata, error) { blockStatus, blockFailureReason := r.blockStatus(blockID) - if blockStatus == apimodels.BlockStateUnknown { + if blockStatus == api.BlockStateUnknown { return nil, ierrors.Errorf("block %s not found", blockID.ToHex()) } // we do not expose accepted flag - if blockStatus == apimodels.BlockStateAccepted { - blockStatus = apimodels.BlockStatePending + if blockStatus == api.BlockStateAccepted { + blockStatus = api.BlockStatePending } txStatus, txFailureReason := r.transactionStatus(blockID) @@ -173,7 +173,7 @@ func (r *Retainer) BlockMetadata(blockID iotago.BlockID) (*retainer.BlockMetadat }, nil } -func (r *Retainer) RetainBlockFailure(blockID iotago.BlockID, failureCode apimodels.BlockFailureReason) { +func (r *Retainer) RetainBlockFailure(blockID iotago.BlockID, failureCode api.BlockFailureReason) { store, err := r.store(blockID.Slot()) if err != nil { r.errorHandler(ierrors.Wrapf(err, "could not get retainer store for slot %d", blockID.Slot())) @@ -197,11 +197,11 @@ func (r *Retainer) RetainTransactionFailure(blockID iotago.BlockID, err error) { } } -func (r *Retainer) RegisteredValidatorsCache(index uint32) ([]*apimodels.ValidatorResponse, bool) { +func (r *Retainer) RegisteredValidatorsCache(index uint32) ([]*api.ValidatorResponse, bool) { return r.stakersResponses.Get(index) } -func (r *Retainer) RetainRegisteredValidatorsCache(index uint32, resp []*apimodels.ValidatorResponse) { +func (r *Retainer) RetainRegisteredValidatorsCache(index uint32, resp []*api.ValidatorResponse) { r.stakersResponses.Set(index, resp) if r.stakersResponses.Size() > MaxStakersResponsesCacheNum { keys := r.stakersResponses.Keys() @@ -215,52 +215,52 @@ func (r *Retainer) RetainRegisteredValidatorsCache(index uint32, resp []*apimode } } -func (r *Retainer) blockStatus(blockID iotago.BlockID) (apimodels.BlockState, apimodels.BlockFailureReason) { +func (r *Retainer) blockStatus(blockID iotago.BlockID) (api.BlockState, api.BlockFailureReason) { store, err := r.store(blockID.Slot()) if err != nil { r.errorHandler(ierrors.Wrapf(err, "could not get retainer store for slot %d", blockID.Slot())) - return apimodels.BlockStateUnknown, apimodels.BlockFailureNone + return api.BlockStateUnknown, api.BlockFailureNone } blockData, exists := store.GetBlock(blockID) if !exists { - return apimodels.BlockStateUnknown, apimodels.BlockFailureNone + return api.BlockStateUnknown, api.BlockFailureNone } switch blockData.State { - case apimodels.BlockStatePending: + case api.BlockStatePending: if blockID.Slot() <= r.latestCommittedSlotFunc() { - return apimodels.BlockStateRejected, blockData.FailureReason + return api.BlockStateRejected, blockData.FailureReason } - case apimodels.BlockStateAccepted, apimodels.BlockStateConfirmed: + case api.BlockStateAccepted, api.BlockStateConfirmed: if blockID.Slot() <= r.finalizedSlotFunc() { - return apimodels.BlockStateFinalized, apimodels.BlockFailureNone + return api.BlockStateFinalized, api.BlockFailureNone } } return blockData.State, blockData.FailureReason } -func (r *Retainer) transactionStatus(blockID iotago.BlockID) (apimodels.TransactionState, apimodels.TransactionFailureReason) { +func (r *Retainer) transactionStatus(blockID iotago.BlockID) (api.TransactionState, api.TransactionFailureReason) { store, err := r.store(blockID.Slot()) if err != nil { r.errorHandler(ierrors.Wrapf(err, "could not get retainer store for slot %d", blockID.Slot())) - return apimodels.TransactionStateNoTransaction, apimodels.TxFailureNone + return api.TransactionStateNoTransaction, api.TxFailureNone } txData, exists := store.GetTransaction(blockID) if !exists { - return apimodels.TransactionStateNoTransaction, apimodels.TxFailureNone + return api.TransactionStateNoTransaction, api.TxFailureNone } // for confirmed and finalized we need to check for the block status - if txData.State == apimodels.TransactionStateAccepted { + if txData.State == api.TransactionStateAccepted { blockState, _ := r.blockStatus(blockID) switch blockState { - case apimodels.BlockStateConfirmed: - return apimodels.TransactionStateConfirmed, apimodels.TxFailureNone - case apimodels.BlockStateFinalized: - return apimodels.TransactionStateFinalized, apimodels.TxFailureNone + case api.BlockStateConfirmed: + return api.TransactionStateConfirmed, api.TxFailureNone + case api.BlockStateFinalized: + return api.TransactionStateFinalized, api.TxFailureNone } } @@ -300,7 +300,7 @@ func (r *Retainer) onTransactionAttached(blockID iotago.BlockID) error { return ierrors.Wrapf(err, "could not get retainer store for slot %d", blockID.Slot()) } - return store.StoreTransactionNoFailureStatus(blockID, apimodels.TransactionStatePending) + return store.StoreTransactionNoFailureStatus(blockID, api.TransactionStatePending) } func (r *Retainer) onTransactionAccepted(blockID iotago.BlockID) error { @@ -309,7 +309,7 @@ func (r *Retainer) onTransactionAccepted(blockID iotago.BlockID) error { return ierrors.Wrapf(err, "could not get retainer store for slot %d", blockID.Slot()) } - return store.StoreTransactionNoFailureStatus(blockID, apimodels.TransactionStateAccepted) + return store.StoreTransactionNoFailureStatus(blockID, api.TransactionStateAccepted) } func (r *Retainer) onAttachmentUpdated(prevID iotago.BlockID, newID iotago.BlockID, accepted bool) error { @@ -328,8 +328,8 @@ func (r *Retainer) onAttachmentUpdated(prevID iotago.BlockID, newID iotago.Block } if accepted { - return store.StoreTransactionNoFailureStatus(newID, apimodels.TransactionStateAccepted) + return store.StoreTransactionNoFailureStatus(newID, api.TransactionStateAccepted) } - return store.StoreTransactionNoFailureStatus(newID, apimodels.TransactionStatePending) + return store.StoreTransactionNoFailureStatus(newID, api.TransactionStatePending) } diff --git a/pkg/storage/permanent/options.go b/pkg/storage/permanent/options.go index 300615baa..2f05814c3 100644 --- a/pkg/storage/permanent/options.go +++ b/pkg/storage/permanent/options.go @@ -2,10 +2,10 @@ package permanent import ( "github.com/iotaledger/hive.go/runtime/options" - "github.com/iotaledger/iota.go/v4/api" + iotago "github.com/iotaledger/iota.go/v4" ) -func WithEpochBasedProviderOptions(opts ...options.Option[api.EpochBasedProvider]) options.Option[Permanent] { +func WithEpochBasedProviderOptions(opts ...options.Option[iotago.EpochBasedProvider]) options.Option[Permanent] { return func(p *Permanent) { p.optsEpochBasedProvider = append(p.optsEpochBasedProvider, opts...) } diff --git a/pkg/storage/permanent/permanent.go b/pkg/storage/permanent/permanent.go index fd576d9c6..c91ccca7e 100644 --- a/pkg/storage/permanent/permanent.go +++ b/pkg/storage/permanent/permanent.go @@ -11,7 +11,6 @@ import ( "github.com/iotaledger/iota-core/pkg/protocol/engine/utxoledger" "github.com/iotaledger/iota-core/pkg/storage/database" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/api" ) const ( @@ -34,7 +33,7 @@ type Permanent struct { accounts kvstore.KVStore latestNonEmptySlot kvstore.KVStore - optsEpochBasedProvider []options.Option[api.EpochBasedProvider] + optsEpochBasedProvider []options.Option[iotago.EpochBasedProvider] } // New returns a new permanent storage instance. diff --git a/pkg/storage/permanent/settings.go b/pkg/storage/permanent/settings.go index afa3aece9..a9bf979b2 100644 --- a/pkg/storage/permanent/settings.go +++ b/pkg/storage/permanent/settings.go @@ -16,7 +16,6 @@ import ( "github.com/iotaledger/hive.go/stringify" "github.com/iotaledger/iota-core/pkg/model" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/api" ) const ( @@ -42,11 +41,11 @@ type Settings struct { storeFutureProtocolParameters *kvstore.TypedStore[iotago.Version, *types.Tuple[iotago.EpochIndex, iotago.Identifier]] storeProtocolParameters *kvstore.TypedStore[iotago.Version, iotago.ProtocolParameters] - apiProvider *api.EpochBasedProvider + apiProvider *iotago.EpochBasedProvider } -func NewSettings(store kvstore.KVStore, opts ...options.Option[api.EpochBasedProvider]) (settings *Settings) { - apiProvider := api.NewEpochBasedProvider(opts...) +func NewSettings(store kvstore.KVStore, opts ...options.Option[iotago.EpochBasedProvider]) (settings *Settings) { + apiProvider := iotago.NewEpochBasedProvider(opts...) s := &Settings{ store: store, @@ -176,7 +175,7 @@ func (s *Settings) loadFutureProtocolParameters() { } } -func (s *Settings) APIProvider() *api.EpochBasedProvider { +func (s *Settings) APIProvider() *iotago.EpochBasedProvider { return s.apiProvider } diff --git a/pkg/storage/prunable/slotstore/retainer.go b/pkg/storage/prunable/slotstore/retainer.go index 646ed7913..44099e4b9 100644 --- a/pkg/storage/prunable/slotstore/retainer.go +++ b/pkg/storage/prunable/slotstore/retainer.go @@ -6,7 +6,7 @@ import ( "github.com/iotaledger/hive.go/lo" "github.com/iotaledger/hive.go/serializer/v2/stream" iotago "github.com/iotaledger/iota.go/v4" - "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" + "github.com/iotaledger/iota.go/v4/api" ) const ( @@ -15,8 +15,8 @@ const ( ) type BlockRetainerData struct { - State apimodels.BlockState - FailureReason apimodels.BlockFailureReason + State api.BlockState + FailureReason api.BlockFailureReason } func (b *BlockRetainerData) Bytes() ([]byte, error) { @@ -38,10 +38,10 @@ func BlockRetainerDataFromBytes(bytes []byte) (*BlockRetainerData, int, error) { var err error b := new(BlockRetainerData) - if b.State, err = stream.Read[apimodels.BlockState](byteReader); err != nil { + if b.State, err = stream.Read[api.BlockState](byteReader); err != nil { return nil, 0, ierrors.Wrap(err, "failed to read block state") } - if b.FailureReason, err = stream.Read[apimodels.BlockFailureReason](byteReader); err != nil { + if b.FailureReason, err = stream.Read[api.BlockFailureReason](byteReader); err != nil { return nil, 0, ierrors.Wrap(err, "failed to read block failure reason") } @@ -49,8 +49,8 @@ func BlockRetainerDataFromBytes(bytes []byte) (*BlockRetainerData, int, error) { } type TransactionRetainerData struct { - State apimodels.TransactionState - FailureReason apimodels.TransactionFailureReason + State api.TransactionState + FailureReason api.TransactionFailureReason } func (t *TransactionRetainerData) Bytes() ([]byte, error) { @@ -72,10 +72,10 @@ func TransactionRetainerDataFromBytes(bytes []byte) (*TransactionRetainerData, i var err error t := new(TransactionRetainerData) - if t.State, err = stream.Read[apimodels.TransactionState](byteReader); err != nil { + if t.State, err = stream.Read[api.TransactionState](byteReader); err != nil { return nil, 0, ierrors.Wrap(err, "failed to read transaction state") } - if t.FailureReason, err = stream.Read[apimodels.TransactionFailureReason](byteReader); err != nil { + if t.FailureReason, err = stream.Read[api.TransactionFailureReason](byteReader); err != nil { return nil, 0, ierrors.Wrap(err, "failed to read transaction failure reason") } @@ -109,8 +109,8 @@ func NewRetainer(slot iotago.SlotIndex, store kvstore.KVStore) (newRetainer *Ret func (r *Retainer) StoreBlockAttached(blockID iotago.BlockID) error { return r.blockStore.Set(blockID, &BlockRetainerData{ - State: apimodels.BlockStatePending, - FailureReason: apimodels.BlockFailureNone, + State: api.BlockStatePending, + FailureReason: api.BlockFailureNone, }) } @@ -134,33 +134,33 @@ func (r *Retainer) GetTransaction(blockID iotago.BlockID) (*TransactionRetainerD func (r *Retainer) StoreBlockAccepted(blockID iotago.BlockID) error { return r.blockStore.Set(blockID, &BlockRetainerData{ - State: apimodels.BlockStateAccepted, - FailureReason: apimodels.BlockFailureNone, + State: api.BlockStateAccepted, + FailureReason: api.BlockFailureNone, }) } func (r *Retainer) StoreBlockConfirmed(blockID iotago.BlockID) error { return r.blockStore.Set(blockID, &BlockRetainerData{ - State: apimodels.BlockStateConfirmed, - FailureReason: apimodels.BlockFailureNone, + State: api.BlockStateConfirmed, + FailureReason: api.BlockFailureNone, }) } func (r *Retainer) StoreTransactionPending(blockID iotago.BlockID) error { return r.transactionStore.Set(blockID, &TransactionRetainerData{ - State: apimodels.TransactionStatePending, - FailureReason: apimodels.TxFailureNone, + State: api.TransactionStatePending, + FailureReason: api.TxFailureNone, }) } -func (r *Retainer) StoreTransactionNoFailureStatus(blockID iotago.BlockID, status apimodels.TransactionState) error { - if status == apimodels.TransactionStateFailed { +func (r *Retainer) StoreTransactionNoFailureStatus(blockID iotago.BlockID, status api.TransactionState) error { + if status == api.TransactionStateFailed { return ierrors.Errorf("failed to retain transaction status, status cannot be failed, blockID: %s", blockID.String()) } return r.transactionStore.Set(blockID, &TransactionRetainerData{ State: status, - FailureReason: apimodels.TxFailureNone, + FailureReason: api.TxFailureNone, }) } @@ -168,16 +168,16 @@ func (r *Retainer) DeleteTransactionData(prevID iotago.BlockID) error { return r.transactionStore.Delete(prevID) } -func (r *Retainer) StoreBlockFailure(blockID iotago.BlockID, failureType apimodels.BlockFailureReason) error { +func (r *Retainer) StoreBlockFailure(blockID iotago.BlockID, failureType api.BlockFailureReason) error { return r.blockStore.Set(blockID, &BlockRetainerData{ - State: apimodels.BlockStateFailed, + State: api.BlockStateFailed, FailureReason: failureType, }) } -func (r *Retainer) StoreTransactionFailure(blockID iotago.BlockID, failureType apimodels.TransactionFailureReason) error { +func (r *Retainer) StoreTransactionFailure(blockID iotago.BlockID, failureType api.TransactionFailureReason) error { return r.transactionStore.Set(blockID, &TransactionRetainerData{ - State: apimodels.TransactionStateFailed, + State: api.TransactionStateFailed, FailureReason: failureType, }) } diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index 809c6aa96..4a8c51f46 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -58,21 +58,21 @@ require ( github.com/iancoleman/orderedmap v0.3.0 // indirect github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 // indirect github.com/iotaledger/hive.go/ads v0.0.0-20231110191152-7135670285dc // indirect - github.com/iotaledger/hive.go/constraints v0.0.0-20231113110812-4ca2b6cc9a42 // indirect + github.com/iotaledger/hive.go/constraints v0.0.0-20231122112629-bdf1cc39fba7 // indirect github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231113110812-4ca2b6cc9a42 // indirect - github.com/iotaledger/hive.go/crypto v0.0.0-20231113110812-4ca2b6cc9a42 // indirect + github.com/iotaledger/hive.go/crypto v0.0.0-20231122112629-bdf1cc39fba7 // indirect github.com/iotaledger/hive.go/ds v0.0.0-20231113110812-4ca2b6cc9a42 // indirect - github.com/iotaledger/hive.go/ierrors v0.0.0-20231113110812-4ca2b6cc9a42 // indirect + github.com/iotaledger/hive.go/ierrors v0.0.0-20231122112629-bdf1cc39fba7 // indirect github.com/iotaledger/hive.go/kvstore v0.0.0-20231110191152-7135670285dc // indirect - github.com/iotaledger/hive.go/lo v0.0.0-20231113110812-4ca2b6cc9a42 // indirect + github.com/iotaledger/hive.go/lo v0.0.0-20231122112629-bdf1cc39fba7 // indirect github.com/iotaledger/hive.go/log v0.0.0-20231110191152-7135670285dc // indirect github.com/iotaledger/hive.go/logger v0.0.0-20231113110812-4ca2b6cc9a42 // indirect - github.com/iotaledger/hive.go/runtime v0.0.0-20231113110812-4ca2b6cc9a42 // indirect + github.com/iotaledger/hive.go/runtime v0.0.0-20231122112629-bdf1cc39fba7 // indirect github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231113110812-4ca2b6cc9a42 // indirect - github.com/iotaledger/hive.go/stringify v0.0.0-20231113110812-4ca2b6cc9a42 // indirect - github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231122193640-8819c43be9c6 // indirect - github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231120082637-ccd5b8465251 // indirect - github.com/iotaledger/iota.go/v4 v4.0.0-20231123022049-52a0703d077f // indirect + github.com/iotaledger/hive.go/stringify v0.0.0-20231122112629-bdf1cc39fba7 // indirect + github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231123103852-bb039cbab83b // indirect + github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231123103318-f6ea945e2e98 // indirect + github.com/iotaledger/iota.go/v4 v4.0.0-20231123102955-eff367396512 // 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 @@ -178,7 +178,7 @@ require ( golang.org/x/time v0.4.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-20231106174013-bbf56f31fb17 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/tools/gendoc/go.sum b/tools/gendoc/go.sum index 649ae85f4..eee98d60b 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -283,36 +283,36 @@ github.com/iotaledger/hive.go/app v0.0.0-20231113110812-4ca2b6cc9a42 h1:K6VF23FO github.com/iotaledger/hive.go/app v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:+riYmeLApkLlj4+EpuJpEJAsj/KGfD7cqLGy7oTsPOM= github.com/iotaledger/hive.go/apputils v0.0.0-20230829152614-7afc7a4d89b3 h1:4aVJTc0KS77uEw0Tny4r0n1ORwcbAQDECaCclgf/6lE= github.com/iotaledger/hive.go/apputils v0.0.0-20230829152614-7afc7a4d89b3/go.mod h1:TZeAqieDu+xDOZp2e9+S+8pZp1PrfgcwLUnxmd8IgLU= -github.com/iotaledger/hive.go/constraints v0.0.0-20231113110812-4ca2b6cc9a42 h1:+PyLPZhRHy+Negjpuj0CSLaObpErEH7yI6HB2z5N6b0= -github.com/iotaledger/hive.go/constraints v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/constraints v0.0.0-20231122112629-bdf1cc39fba7 h1:ozpeM5nHHUjK3aKpTmwFEDG2bqxLJf0KBCTakjh+1FE= +github.com/iotaledger/hive.go/constraints v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231113110812-4ca2b6cc9a42 h1:3dW4gz0Vr9BogN826HRTp0OFlbngjhWcVPUfDhJ57Yw= github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231113110812-4ca2b6cc9a42/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= -github.com/iotaledger/hive.go/crypto v0.0.0-20231113110812-4ca2b6cc9a42 h1:t6EKe+O7XAmbe07cVHuM/3aBLEbVIY4D6yefANB4PUA= -github.com/iotaledger/hive.go/crypto v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= +github.com/iotaledger/hive.go/crypto v0.0.0-20231122112629-bdf1cc39fba7 h1:vLLhxGhipU6AH/paexuRX3zsOvcl8bdYcwJRAchUP8g= +github.com/iotaledger/hive.go/crypto v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= github.com/iotaledger/hive.go/ds v0.0.0-20231113110812-4ca2b6cc9a42 h1:QZiMlDxmikF64zimWQunTrsEGOK9ydRahUAz2I46JAk= github.com/iotaledger/hive.go/ds v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231113110812-4ca2b6cc9a42 h1:gxlZ4zL6EfLyqT0+hIFV3WVE0FrPVgV5cQdyn36vPXQ= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231122112629-bdf1cc39fba7 h1:tf7x4U+ZXnmFXhUmqYtn0kcgpOcGPIhbxR/akpzAU4U= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= github.com/iotaledger/hive.go/kvstore v0.0.0-20231110191152-7135670285dc h1:3fsqfM2NqfhrewVdlKT3MHcXxVNvUCSP7P32il1ypa0= github.com/iotaledger/hive.go/kvstore v0.0.0-20231110191152-7135670285dc/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= -github.com/iotaledger/hive.go/lo v0.0.0-20231113110812-4ca2b6cc9a42 h1:kcHkWyURZDVqO80OmJo5Z+wTJB6H+s52WAnU575vX0o= -github.com/iotaledger/hive.go/lo v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= +github.com/iotaledger/hive.go/lo v0.0.0-20231122112629-bdf1cc39fba7 h1:svFxB75LsjUOHt3crcn70GVk7ztdNv5CytC3GbGj9FQ= +github.com/iotaledger/hive.go/lo v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= github.com/iotaledger/hive.go/log v0.0.0-20231110191152-7135670285dc h1:joYrsSZuVG3DfAQR9iS3qjnMExJ0qNp2+369sxb1Y4g= github.com/iotaledger/hive.go/log v0.0.0-20231110191152-7135670285dc/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= github.com/iotaledger/hive.go/logger v0.0.0-20231113110812-4ca2b6cc9a42 h1:uD99UbTtBM5SIP9N3c/3BBLtb0frGYFsZ2lS8Zxtqr4= github.com/iotaledger/hive.go/logger v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:w1psHM2MuKsen1WdsPKrpqElYH7ZOQ+YdQIgJZg4HTo= -github.com/iotaledger/hive.go/runtime v0.0.0-20231113110812-4ca2b6cc9a42 h1:hpR++ME3Y3CcxA431Zg0PgcCJUNkbBqjNXxR/bs+NdI= -github.com/iotaledger/hive.go/runtime v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= +github.com/iotaledger/hive.go/runtime v0.0.0-20231122112629-bdf1cc39fba7 h1:NtR3ZeY6Mop9JcHu62Z6JPMRcijIV1ZCZPpOev8HZRw= +github.com/iotaledger/hive.go/runtime v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231113110812-4ca2b6cc9a42 h1:hepsnGvaS39azq80GV8DT9HlexoO/RqJbyiW5FXZ0HQ= github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231113110812-4ca2b6cc9a42/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= -github.com/iotaledger/hive.go/stringify v0.0.0-20231113110812-4ca2b6cc9a42 h1:9c7NiX2cnNPHR9UNWINDqNkolupXiDF3543pR6KLwIg= -github.com/iotaledger/hive.go/stringify v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231122193640-8819c43be9c6 h1:wMbfn6I8+5GNgifw3oxh0NR0aej+VyGOarzp1YloF5E= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231122193640-8819c43be9c6/go.mod h1:S0en1XmbHTXWFU3SZI9yxxOQdlz0fUANLnclKiAOnlI= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231120082637-ccd5b8465251 h1:bYGO8jXNXJNMGPG9etGW7WXfLbRU9ofx1xdd29/sS9M= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231120082637-ccd5b8465251/go.mod h1:chzj8FDIeXHIh3D52QTZ7imADlzdkhg7o7E2Qr85MJ8= -github.com/iotaledger/iota.go/v4 v4.0.0-20231123022049-52a0703d077f h1:CBSRHs4ysjR/NgrVb//4mm5SgzynIOOm0ZJ3IRIf3FY= -github.com/iotaledger/iota.go/v4 v4.0.0-20231123022049-52a0703d077f/go.mod h1:1CUJKGvkOUGXakxFZGAagEQDX9qYyhzIElmUHCHo9RM= +github.com/iotaledger/hive.go/stringify v0.0.0-20231122112629-bdf1cc39fba7 h1:h481Dn+giKO/1MamwuDZ8Mvzg4GbPx/asKD/X3Zs8wc= +github.com/iotaledger/hive.go/stringify v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231123103852-bb039cbab83b h1:T/9f4eYcP/fxe0G0pYa6TRZxD9rI9uMdDW89hnsNByU= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231123103852-bb039cbab83b/go.mod h1:c7ktZxoH5Wp2ixzJn/8RmM5v2QOCIu/79tDFvfLbyPs= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231123103318-f6ea945e2e98 h1:PjGs+njONeFaxFgQ3lxxlRs3wTYw3233f/yDyTV8/F8= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231123103318-f6ea945e2e98/go.mod h1:jFRt2SZO3KE74/mk+zeCjlhVROriEg86K8CJTxvfdP8= +github.com/iotaledger/iota.go/v4 v4.0.0-20231123102955-eff367396512 h1:E1m9Ja6d47sVkl0k2a8eU9f5COWqpyNY9ET3TyYLHiI= +github.com/iotaledger/iota.go/v4 v4.0.0-20231123102955-eff367396512/go.mod h1:aO+5iL0vTNwNfE4QMGHVIufGziSI1wTvwJY1ipSMgCk= 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= @@ -881,8 +881,8 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= diff --git a/tools/genesis-snapshot/go.mod b/tools/genesis-snapshot/go.mod index 936e0cc42..58cfbb210 100644 --- a/tools/genesis-snapshot/go.mod +++ b/tools/genesis-snapshot/go.mod @@ -5,12 +5,12 @@ go 1.21 replace github.com/iotaledger/iota-core => ../../ require ( - github.com/iotaledger/hive.go/crypto v0.0.0-20231113110812-4ca2b6cc9a42 - github.com/iotaledger/hive.go/ierrors v0.0.0-20231113110812-4ca2b6cc9a42 - github.com/iotaledger/hive.go/lo v0.0.0-20231113110812-4ca2b6cc9a42 - github.com/iotaledger/hive.go/runtime v0.0.0-20231113110812-4ca2b6cc9a42 + github.com/iotaledger/hive.go/crypto v0.0.0-20231122112629-bdf1cc39fba7 + github.com/iotaledger/hive.go/ierrors v0.0.0-20231122112629-bdf1cc39fba7 + github.com/iotaledger/hive.go/lo v0.0.0-20231122112629-bdf1cc39fba7 + github.com/iotaledger/hive.go/runtime v0.0.0-20231122112629-bdf1cc39fba7 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20231123022049-52a0703d077f + github.com/iotaledger/iota.go/v4 v4.0.0-20231123102955-eff367396512 github.com/mr-tron/base58 v1.2.0 github.com/spf13/pflag v1.0.5 golang.org/x/crypto v0.15.0 @@ -27,13 +27,13 @@ require ( github.com/iancoleman/orderedmap v0.3.0 // indirect github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 // indirect github.com/iotaledger/hive.go/ads v0.0.0-20231110191152-7135670285dc // indirect - github.com/iotaledger/hive.go/constraints v0.0.0-20231113110812-4ca2b6cc9a42 // indirect + github.com/iotaledger/hive.go/constraints v0.0.0-20231122112629-bdf1cc39fba7 // indirect github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231113110812-4ca2b6cc9a42 // indirect github.com/iotaledger/hive.go/ds v0.0.0-20231113110812-4ca2b6cc9a42 // indirect github.com/iotaledger/hive.go/kvstore v0.0.0-20231110191152-7135670285dc // indirect github.com/iotaledger/hive.go/log v0.0.0-20231110191152-7135670285dc // indirect github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231113110812-4ca2b6cc9a42 // indirect - github.com/iotaledger/hive.go/stringify v0.0.0-20231113110812-4ca2b6cc9a42 // indirect + github.com/iotaledger/hive.go/stringify v0.0.0-20231122112629-bdf1cc39fba7 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/kr/text v0.2.0 // indirect diff --git a/tools/genesis-snapshot/go.sum b/tools/genesis-snapshot/go.sum index f17261c00..f2962a3ca 100644 --- a/tools/genesis-snapshot/go.sum +++ b/tools/genesis-snapshot/go.sum @@ -30,30 +30,30 @@ github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 h1:dTrD7X2PT github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7/go.mod h1:ZRdPu684P0fQ1z8sXz4dj9H5LWHhz4a9oCtvjunkSrw= github.com/iotaledger/hive.go/ads v0.0.0-20231110191152-7135670285dc h1:PsArE43UkLymmDy9r7n42Yd1pv1iq4FwSx3iv2Mo+vc= github.com/iotaledger/hive.go/ads v0.0.0-20231110191152-7135670285dc/go.mod h1:gbUvr01B5ha530GnNm8K2OsHXOd2BtzBYOMxyTX3iDg= -github.com/iotaledger/hive.go/constraints v0.0.0-20231113110812-4ca2b6cc9a42 h1:+PyLPZhRHy+Negjpuj0CSLaObpErEH7yI6HB2z5N6b0= -github.com/iotaledger/hive.go/constraints v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/constraints v0.0.0-20231122112629-bdf1cc39fba7 h1:ozpeM5nHHUjK3aKpTmwFEDG2bqxLJf0KBCTakjh+1FE= +github.com/iotaledger/hive.go/constraints v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231113110812-4ca2b6cc9a42 h1:3dW4gz0Vr9BogN826HRTp0OFlbngjhWcVPUfDhJ57Yw= github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231113110812-4ca2b6cc9a42/go.mod h1:CdixkrB7VdQzEDlVuwsxPtsiJL/WXrQgz3PELIqlLko= -github.com/iotaledger/hive.go/crypto v0.0.0-20231113110812-4ca2b6cc9a42 h1:t6EKe+O7XAmbe07cVHuM/3aBLEbVIY4D6yefANB4PUA= -github.com/iotaledger/hive.go/crypto v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= +github.com/iotaledger/hive.go/crypto v0.0.0-20231122112629-bdf1cc39fba7 h1:vLLhxGhipU6AH/paexuRX3zsOvcl8bdYcwJRAchUP8g= +github.com/iotaledger/hive.go/crypto v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:OQ9EVTTQT1mkO/16BgwSIyQlAhEg+Cptud/yutevWsI= github.com/iotaledger/hive.go/ds v0.0.0-20231113110812-4ca2b6cc9a42 h1:QZiMlDxmikF64zimWQunTrsEGOK9ydRahUAz2I46JAk= github.com/iotaledger/hive.go/ds v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:JE8cbZSvzbB5TrwXibg6M0B7ck35YxF30ItHBzQRlgc= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231113110812-4ca2b6cc9a42 h1:gxlZ4zL6EfLyqT0+hIFV3WVE0FrPVgV5cQdyn36vPXQ= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231122112629-bdf1cc39fba7 h1:tf7x4U+ZXnmFXhUmqYtn0kcgpOcGPIhbxR/akpzAU4U= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= github.com/iotaledger/hive.go/kvstore v0.0.0-20231110191152-7135670285dc h1:3fsqfM2NqfhrewVdlKT3MHcXxVNvUCSP7P32il1ypa0= github.com/iotaledger/hive.go/kvstore v0.0.0-20231110191152-7135670285dc/go.mod h1:ytfKoHr/nF8u0y0G4mamfG0yjFtJiJVk0kgjnPOtsSY= -github.com/iotaledger/hive.go/lo v0.0.0-20231113110812-4ca2b6cc9a42 h1:kcHkWyURZDVqO80OmJo5Z+wTJB6H+s52WAnU575vX0o= -github.com/iotaledger/hive.go/lo v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= +github.com/iotaledger/hive.go/lo v0.0.0-20231122112629-bdf1cc39fba7 h1:svFxB75LsjUOHt3crcn70GVk7ztdNv5CytC3GbGj9FQ= +github.com/iotaledger/hive.go/lo v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:6Ee7i6b4tuTHuRYnPP8VUb0wr9XFI5qlqtnttBd9jRg= github.com/iotaledger/hive.go/log v0.0.0-20231110191152-7135670285dc h1:joYrsSZuVG3DfAQR9iS3qjnMExJ0qNp2+369sxb1Y4g= github.com/iotaledger/hive.go/log v0.0.0-20231110191152-7135670285dc/go.mod h1:vzO4/wRkEJDEZb/9fD10oKU9k1bj4qLir2Uhl5U1FkM= -github.com/iotaledger/hive.go/runtime v0.0.0-20231113110812-4ca2b6cc9a42 h1:hpR++ME3Y3CcxA431Zg0PgcCJUNkbBqjNXxR/bs+NdI= -github.com/iotaledger/hive.go/runtime v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= +github.com/iotaledger/hive.go/runtime v0.0.0-20231122112629-bdf1cc39fba7 h1:NtR3ZeY6Mop9JcHu62Z6JPMRcijIV1ZCZPpOev8HZRw= +github.com/iotaledger/hive.go/runtime v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:DrZPvUvLarK8C2qb+3H2vdypp/MuhpQmB3iMJbDCr/Q= github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231113110812-4ca2b6cc9a42 h1:hepsnGvaS39azq80GV8DT9HlexoO/RqJbyiW5FXZ0HQ= github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231113110812-4ca2b6cc9a42/go.mod h1:FoH3T6yKlZJp8xm8K+zsQiibSynp32v21CpWx8xkek8= -github.com/iotaledger/hive.go/stringify v0.0.0-20231113110812-4ca2b6cc9a42 h1:9c7NiX2cnNPHR9UNWINDqNkolupXiDF3543pR6KLwIg= -github.com/iotaledger/hive.go/stringify v0.0.0-20231113110812-4ca2b6cc9a42/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/iota.go/v4 v4.0.0-20231123022049-52a0703d077f h1:CBSRHs4ysjR/NgrVb//4mm5SgzynIOOm0ZJ3IRIf3FY= -github.com/iotaledger/iota.go/v4 v4.0.0-20231123022049-52a0703d077f/go.mod h1:1CUJKGvkOUGXakxFZGAagEQDX9qYyhzIElmUHCHo9RM= +github.com/iotaledger/hive.go/stringify v0.0.0-20231122112629-bdf1cc39fba7 h1:h481Dn+giKO/1MamwuDZ8Mvzg4GbPx/asKD/X3Zs8wc= +github.com/iotaledger/hive.go/stringify v0.0.0-20231122112629-bdf1cc39fba7/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/iota.go/v4 v4.0.0-20231123102955-eff367396512 h1:E1m9Ja6d47sVkl0k2a8eU9f5COWqpyNY9ET3TyYLHiI= +github.com/iotaledger/iota.go/v4 v4.0.0-20231123102955-eff367396512/go.mod h1:aO+5iL0vTNwNfE4QMGHVIufGziSI1wTvwJY1ipSMgCk= 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=