From dab4fad7f45d73c9ef809447b10b800c9a309e15 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 21 Nov 2023 13:31:56 +0100 Subject: [PATCH 1/3] Add checks for correct commitmentIDs --- components/dashboard/explorer_routes.go | 4 ++ components/inx/server_commitments.go | 4 ++ components/inx/server_utxo.go | 10 +++- components/restapi/core/accounts.go | 12 +++++ components/restapi/core/commitment.go | 56 +++++++++++++++-------- components/restapi/core/component.go | 31 +++++++++---- components/restapi/core/utxo.go | 8 ++-- pkg/protocol/engine/committed_slot_api.go | 4 ++ 8 files changed, 96 insertions(+), 33 deletions(-) diff --git a/components/dashboard/explorer_routes.go b/components/dashboard/explorer_routes.go index 4918fc2f8..f5a73d25d 100644 --- a/components/dashboard/explorer_routes.go +++ b/components/dashboard/explorer_routes.go @@ -263,6 +263,10 @@ func getSlotDetailsByID(c echo.Context) error { return err } + if commitment.ID() != commitmentID { + return ierrors.Errorf("commitment in the store for slot %d does not match the given commitmentID (%s != %s)", commitmentID.Slot(), commitment.ID(), commitmentID) + } + diffs, err := deps.Protocol.MainEngineInstance().Ledger.SlotDiffs(commitmentID.Slot()) if err != nil { return err diff --git a/components/inx/server_commitments.go b/components/inx/server_commitments.go index a88448dd8..a071a5116 100644 --- a/components/inx/server_commitments.go +++ b/components/inx/server_commitments.go @@ -15,6 +15,10 @@ import ( ) func inxCommitment(commitment *model.Commitment) *inx.Commitment { + if commitment == nil { + return nil + } + return &inx.Commitment{ CommitmentId: inx.NewCommitmentId(commitment.ID()), Commitment: &inx.RawCommitment{ diff --git a/components/inx/server_utxo.go b/components/inx/server_utxo.go index d1e87561e..fe732b384 100644 --- a/components/inx/server_utxo.go +++ b/components/inx/server_utxo.go @@ -30,7 +30,10 @@ func NewLedgerOutput(o *utxoledger.Output) (*inx.LedgerOutput, error) { } includedSlot := o.SlotBooked() - if includedSlot > 0 && includedSlot <= latestCommitment.Slot() { + if includedSlot > 0 && + includedSlot <= latestCommitment.Slot() && + includedSlot >= deps.Protocol.CommittedAPI().ProtocolParameters().GenesisSlot() { + includedCommitment, err := deps.Protocol.MainEngineInstance().Storage.Commitments().Load(includedSlot) if err != nil { return nil, ierrors.Wrapf(err, "failed to load commitment with slot: %d", includedSlot) @@ -55,7 +58,10 @@ func NewLedgerSpent(s *utxoledger.Spent) (*inx.LedgerSpent, error) { latestCommitment := deps.Protocol.MainEngineInstance().SyncManager.LatestCommitment() spentSlot := s.SlotSpent() - if spentSlot > 0 && spentSlot <= latestCommitment.Slot() { + if spentSlot > 0 && + spentSlot <= latestCommitment.Slot() && + spentSlot >= deps.Protocol.CommittedAPI().ProtocolParameters().GenesisSlot() { + spentCommitment, err := deps.Protocol.MainEngineInstance().Storage.Commitments().Load(spentSlot) if err != nil { return nil, ierrors.Wrapf(err, "failed to load commitment with slot: %d", spentSlot) diff --git a/components/restapi/core/accounts.go b/components/restapi/core/accounts.go index 381c0105b..9b0eaffee 100644 --- a/components/restapi/core/accounts.go +++ b/components/restapi/core/accounts.go @@ -22,7 +22,19 @@ func congestionForAccountID(c echo.Context) (*apimodels.CongestionResponse, erro return nil, err } + commitmentID, err := httpserver.ParseCommitmentIDQueryParam(c, restapipkg.ParameterCommitmentID) + if err != nil { + return nil, err + } + commitment := deps.Protocol.MainEngineInstance().SyncManager.LatestCommitment() + if commitmentID != iotago.EmptyCommitmentID { + // a commitment ID was provided, so we use the commitment for that ID + commitment, err = getCommitmentByID(commitmentID, commitment) + if err != nil { + return nil, err + } + } acc, exists, err := deps.Protocol.MainEngineInstance().Ledger.Account(accountID, commitment.Slot()) if err != nil { diff --git a/components/restapi/core/commitment.go b/components/restapi/core/commitment.go index 48f2598d2..2990f9b30 100644 --- a/components/restapi/core/commitment.go +++ b/components/restapi/core/commitment.go @@ -4,39 +4,59 @@ import ( "github.com/labstack/echo/v4" "github.com/iotaledger/hive.go/ierrors" - "github.com/iotaledger/inx-app/pkg/httpserver" - restapipkg "github.com/iotaledger/iota-core/pkg/restapi" + "github.com/iotaledger/iota-core/pkg/model" iotago "github.com/iotaledger/iota.go/v4" "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" ) -func indexByCommitmentID(c echo.Context) (iotago.SlotIndex, error) { - commitmentID, err := httpserver.ParseCommitmentIDParam(c, restapipkg.ParameterCommitmentID) - if err != nil { - return iotago.SlotIndex(0), ierrors.Wrapf(err, "failed to parse commitment ID %s", c.Param(restapipkg.ParameterCommitmentID)) +func getCommitmentBySlot(slot iotago.SlotIndex, latestCommitment ...*model.Commitment) (*model.Commitment, error) { + var latest *model.Commitment + if len(latestCommitment) > 0 { + latest = latestCommitment[0] + } else { + latest = deps.Protocol.MainEngineInstance().SyncManager.LatestCommitment() } - return commitmentID.Slot(), nil -} + if slot > latest.Slot() { + return nil, ierrors.Wrapf(echo.ErrBadRequest, "commitment is from a future slot (%d > %d)", slot, latest.Slot()) + } -func getCommitmentDetails(index iotago.SlotIndex) (*iotago.Commitment, error) { - commitment, err := deps.Protocol.MainEngineInstance().Storage.Commitments().Load(index) + commitment, err := deps.Protocol.MainEngineInstance().Storage.Commitments().Load(slot) if err != nil { - return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to load commitment %d: %s", index, err) + return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to load commitment, slot: %d, error: %w", slot, err) } - return commitment.Commitment(), nil + return commitment, nil } -func getUTXOChanges(slot iotago.SlotIndex) (*apimodels.UTXOChangesResponse, error) { - diffs, err := deps.Protocol.MainEngineInstance().Ledger.SlotDiffs(slot) +func getCommitmentByID(commitmentID iotago.CommitmentID, latestCommitment ...*model.Commitment) (*model.Commitment, error) { + var latest *model.Commitment + if len(latestCommitment) > 0 { + latest = latestCommitment[0] + } else { + latest = deps.Protocol.MainEngineInstance().SyncManager.LatestCommitment() + } + + if commitmentID.Slot() > latest.Slot() { + return nil, ierrors.Wrapf(echo.ErrBadRequest, "commitment ID (%s) is from a future slot (%d > %d)", commitmentID, commitmentID.Slot(), latest.Slot()) + } + + commitment, err := deps.Protocol.MainEngineInstance().Storage.Commitments().Load(commitmentID.Slot()) if err != nil { - return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to get slot diffs %d: %s", slot, err) + return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to load commitment, commitmentID: %s, slot: %d, error: %w", commitmentID, commitmentID.Slot(), err) + } + + if commitment.ID() != commitmentID { + return nil, ierrors.Wrapf(echo.ErrBadRequest, "commitment in the store for slot %d does not match the given commitmentID (%s != %s)", commitmentID.Slot(), commitment.ID(), commitmentID) } - commitment, err := deps.Protocol.MainEngineInstance().Storage.Commitments().Load(diffs.Slot) + return commitment, nil +} + +func getUTXOChanges(commitmentID iotago.CommitmentID) (*apimodels.UTXOChangesResponse, error) { + diffs, err := deps.Protocol.MainEngineInstance().Ledger.SlotDiffs(commitmentID.Slot()) if err != nil { - return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to load commitment %d: %s", diffs.Slot, err) + return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to get slot diffs, commitmentID: %s, slot: %d, error: %w", commitmentID, commitmentID.Slot(), err) } createdOutputs := make(iotago.OutputIDs, len(diffs.Outputs)) @@ -51,7 +71,7 @@ func getUTXOChanges(slot iotago.SlotIndex) (*apimodels.UTXOChangesResponse, erro } return &apimodels.UTXOChangesResponse{ - CommitmentID: commitment.ID(), + CommitmentID: commitmentID, CreatedOutputs: createdOutputs, ConsumedOutputs: consumedOutputs, }, nil diff --git a/components/restapi/core/component.go b/components/restapi/core/component.go index 6785dc462..4494b3f1c 100644 --- a/components/restapi/core/component.go +++ b/components/restapi/core/component.go @@ -112,7 +112,7 @@ const ( RouteCommitmentByIndexUTXOChanges = "/commitments/by-index/:" + restapipkg.ParameterSlotIndex + "/utxo-changes" // RouteCongestion is the route for getting the current congestion state and all account related useful details as block issuance credits. - // GET returns the congestion state related to the specified account. + // GET returns the congestion state related to the specified account. (optional query parameters: "commitmentID" to specify the used commitment) // MIMEApplicationJSON => json. // MIMEApplicationVendorIOTASerializerV2 => bytes. RouteCongestion = "/accounts/:" + restapipkg.ParameterAccountID + "/congestion" @@ -235,26 +235,32 @@ func configure() error { }, checkNodeSynced()) routeGroup.GET(RouteCommitmentByID, func(c echo.Context) error { - index, err := indexByCommitmentID(c) + commitmentID, err := httpserver.ParseCommitmentIDParam(c, restapipkg.ParameterCommitmentID) if err != nil { return err } - commitment, err := getCommitmentDetails(index) + commitment, err := getCommitmentByID(commitmentID) if err != nil { return err } - return responseByHeader(c, commitment) + return responseByHeader(c, commitment.Commitment()) }) routeGroup.GET(RouteCommitmentByIDUTXOChanges, func(c echo.Context) error { - index, err := indexByCommitmentID(c) + commitmentID, err := httpserver.ParseCommitmentIDParam(c, restapipkg.ParameterCommitmentID) if err != nil { return err } - resp, err := getUTXOChanges(index) + // load the commitment to check if it matches the given commitmentID + commitment, err := getCommitmentByID(commitmentID) + if err != nil { + return err + } + + resp, err := getUTXOChanges(commitment.ID()) if err != nil { return err } @@ -268,21 +274,26 @@ func configure() error { return err } - resp, err := getCommitmentDetails(index) + commitment, err := getCommitmentBySlot(index) if err != nil { return err } - return responseByHeader(c, resp) + return responseByHeader(c, commitment.Commitment()) }) routeGroup.GET(RouteCommitmentByIndexUTXOChanges, func(c echo.Context) error { - index, err := httpserver.ParseSlotParam(c, restapipkg.ParameterSlotIndex) + slot, err := httpserver.ParseSlotParam(c, restapipkg.ParameterSlotIndex) + if err != nil { + return err + } + + commitment, err := getCommitmentBySlot(slot) if err != nil { return err } - resp, err := getUTXOChanges(index) + resp, err := getUTXOChanges(commitment.ID()) if err != nil { return err } diff --git a/components/restapi/core/utxo.go b/components/restapi/core/utxo.go index 2fd9a7fad..cec4f033e 100644 --- a/components/restapi/core/utxo.go +++ b/components/restapi/core/utxo.go @@ -93,7 +93,8 @@ func newOutputMetadataResponse(output *utxoledger.Output) (*apimodels.OutputMeta } includedSlotIndex := output.SlotBooked() - if includedSlotIndex <= latestCommitment.Slot() { + genesisSlot := deps.Protocol.MainEngineInstance().CommittedAPI().ProtocolParameters().GenesisSlot() + if includedSlotIndex <= latestCommitment.Slot() && includedSlotIndex >= genesisSlot { includedCommitment, err := deps.Protocol.MainEngineInstance().Storage.Commitments().Load(includedSlotIndex) if err != nil { return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to load commitment with index %d: %s", includedSlotIndex, err) @@ -117,7 +118,8 @@ func newSpentMetadataResponse(spent *utxoledger.Spent) (*apimodels.OutputMetadat } includedSlotIndex := spent.Output().SlotBooked() - if includedSlotIndex <= latestCommitment.Slot() { + genesisSlot := deps.Protocol.MainEngineInstance().CommittedAPI().ProtocolParameters().GenesisSlot() + if includedSlotIndex <= latestCommitment.Slot() && includedSlotIndex >= genesisSlot { includedCommitment, err := deps.Protocol.MainEngineInstance().Storage.Commitments().Load(includedSlotIndex) if err != nil { return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to load commitment with index %d: %s", includedSlotIndex, err) @@ -126,7 +128,7 @@ func newSpentMetadataResponse(spent *utxoledger.Spent) (*apimodels.OutputMetadat } spentSlotIndex := spent.SlotSpent() - if spentSlotIndex <= latestCommitment.Slot() { + if spentSlotIndex <= latestCommitment.Slot() && spentSlotIndex >= genesisSlot { spentCommitment, err := deps.Protocol.MainEngineInstance().Storage.Commitments().Load(spentSlotIndex) if err != nil { return nil, ierrors.Wrapf(echo.ErrInternalServerError, "failed to load commitment with index %d: %s", spentSlotIndex, err) diff --git a/pkg/protocol/engine/committed_slot_api.go b/pkg/protocol/engine/committed_slot_api.go index 2a2871b24..ad70e4785 100644 --- a/pkg/protocol/engine/committed_slot_api.go +++ b/pkg/protocol/engine/committed_slot_api.go @@ -30,6 +30,10 @@ func (c *CommittedSlotAPI) Commitment() (commitment *model.Commitment, err error return nil, ierrors.Wrapf(err, "failed to load commitment for slot %d", c.CommitmentID) } + if commitment.ID() != c.CommitmentID { + return nil, ierrors.Errorf("commitment in the store does not match the given commitmentID (%s != %s)", commitment.ID(), c.CommitmentID) + } + return commitment, nil } From b9f35d79be34aa238f81e20799545248877cb061 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 21 Nov 2023 13:32:35 +0100 Subject: [PATCH 2/3] Remove optional slot index in RouteBlockIssuance --- components/restapi/core/blocks.go | 20 +++----------------- components/restapi/core/component.go | 4 +--- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/components/restapi/core/blocks.go b/components/restapi/core/blocks.go index 0764cf329..b3baabf90 100644 --- a/components/restapi/core/blocks.go +++ b/components/restapi/core/blocks.go @@ -6,7 +6,6 @@ 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/model" "github.com/iotaledger/iota-core/pkg/restapi" iotago "github.com/iotaledger/iota.go/v4" "github.com/iotaledger/iota.go/v4/nodeclient/apimodels" @@ -66,23 +65,10 @@ func blockWithMetadataByID(c echo.Context) (*apimodels.BlockWithMetadataResponse }, nil } -func blockIssuanceBySlot(slotIndex iotago.SlotIndex) (*apimodels.IssuanceBlockHeaderResponse, error) { +func blockIssuance() (*apimodels.IssuanceBlockHeaderResponse, error) { references := deps.Protocol.MainEngineInstance().TipSelection.SelectTips(iotago.BasicBlockMaxParents) - - var slotCommitment *model.Commitment - var err error - // by default we use latest commitment - if slotIndex == 0 { - slotCommitment = deps.Protocol.MainEngineInstance().SyncManager.LatestCommitment() - } else { - slotCommitment, err = deps.Protocol.MainEngineInstance().Storage.Commitments().Load(slotIndex) - if err != nil { - return nil, ierrors.Wrapf(echo.ErrNotFound, "failed to load commitment for requested slot %d: %s", slotIndex, err) - } - } - if len(references[iotago.StrongParentType]) == 0 { - return nil, ierrors.Wrap(echo.ErrServiceUnavailable, "get references failed") + return nil, ierrors.Wrap(echo.ErrServiceUnavailable, "no strong parents available") } resp := &apimodels.IssuanceBlockHeaderResponse{ @@ -90,7 +76,7 @@ func blockIssuanceBySlot(slotIndex iotago.SlotIndex) (*apimodels.IssuanceBlockHe WeakParents: references[iotago.WeakParentType], ShallowLikeParents: references[iotago.ShallowLikeParentType], LatestFinalizedSlot: deps.Protocol.MainEngineInstance().SyncManager.LatestFinalizedSlot(), - Commitment: slotCommitment.Commitment(), + Commitment: deps.Protocol.MainEngineInstance().SyncManager.LatestCommitment().Commitment(), } return resp, nil diff --git a/components/restapi/core/component.go b/components/restapi/core/component.go index 4494b3f1c..806f8e37d 100644 --- a/components/restapi/core/component.go +++ b/components/restapi/core/component.go @@ -224,9 +224,7 @@ func configure() error { }, checkNodeSynced()) routeGroup.GET(RouteBlockIssuance, func(c echo.Context) error { - index, _ := httpserver.ParseSlotQueryParam(c, restapipkg.ParameterSlotIndex) - - resp, err := blockIssuanceBySlot(index) + resp, err := blockIssuance() if err != nil { return err } From 1da92c1c85f055000913a85446579573d88aa308 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 21 Nov 2023 14:16:33 +0100 Subject: [PATCH 3/3] Remove unused commitmentFunc in commitmentfilter --- go.mod | 2 +- go.sum | 4 ++-- .../commitmentfilter/accountsfilter/commitmentfilter.go | 6 ------ .../accountsfilter/commitmentfilter_test.go | 7 ------- tools/gendoc/go.mod | 2 +- tools/gendoc/go.sum | 4 ++-- 6 files changed, 6 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index 783007690..6b94f6ba8 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/iotaledger/hive.go/runtime v0.0.0-20231113110812-4ca2b6cc9a42 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.20231120094046-1308e2a5e072 + github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231121121055-b13a176c5180 github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231120082637-ccd5b8465251 github.com/iotaledger/iota.go/v4 v4.0.0-20231120063545-80c263f28140 github.com/labstack/echo/v4 v4.11.3 diff --git a/go.sum b/go.sum index d8a8e6585..1c560b442 100644 --- a/go.sum +++ b/go.sum @@ -303,8 +303,8 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231113110812-4ca2b6c 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.20231120094046-1308e2a5e072 h1:xbaW2dnDZy0ThcEcdK7ir3b+ynBXsn0R14lgxiFVuB0= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231120094046-1308e2a5e072/go.mod h1:iFiY6UukYeL8D3N1mtg4jh/9lxTBhzG0QgtD+w0gpps= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231121121055-b13a176c5180 h1:hAVWoyAF4FE+1gUd2IqvTBDTnQ4Z0GKE6qc8qw9QPqg= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231121121055-b13a176c5180/go.mod h1:iFiY6UukYeL8D3N1mtg4jh/9lxTBhzG0QgtD+w0gpps= 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-20231120063545-80c263f28140 h1:8zHRYT1KADR9bOLUg7Ia4XA3StBHzV4Tb2Qtp42KLN8= diff --git a/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter.go b/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter.go index 842f06c61..d5d1d8381 100644 --- a/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter.go +++ b/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter.go @@ -5,7 +5,6 @@ import ( "github.com/iotaledger/hive.go/ierrors" "github.com/iotaledger/hive.go/runtime/module" "github.com/iotaledger/hive.go/runtime/options" - "github.com/iotaledger/iota-core/pkg/model" "github.com/iotaledger/iota-core/pkg/protocol/engine" "github.com/iotaledger/iota-core/pkg/protocol/engine/accounts" "github.com/iotaledger/iota-core/pkg/protocol/engine/blocks" @@ -19,9 +18,6 @@ type CommitmentFilter struct { apiProvider iotago.APIProvider - // commitmentFunc is a function that returns the commitment corresponding to the given slot index. - commitmentFunc func(iotago.SlotIndex) (*model.Commitment, error) - rmcRetrieveFunc func(iotago.SlotIndex) (iotago.Mana, error) accountRetrieveFunc func(accountID iotago.AccountID, targetIndex iotago.SlotIndex) (*accounts.AccountData, bool, error) @@ -33,8 +29,6 @@ func NewProvider(opts ...options.Option[CommitmentFilter]) module.Provider[*engi return module.Provide(func(e *engine.Engine) commitmentfilter.CommitmentFilter { c := New(e, opts...) e.HookConstructed(func() { - c.commitmentFunc = e.Storage.Commitments().Load - c.accountRetrieveFunc = e.Ledger.Account e.Ledger.HookConstructed(func() { diff --git a/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter_test.go b/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter_test.go index 127c5fb1c..c7274801b 100644 --- a/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter_test.go +++ b/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter_test.go @@ -39,13 +39,6 @@ func NewTestFramework(t *testing.T, apiProvider iotago.APIProvider, optsFilter . } tf.CommitmentFilter = New(apiProvider, optsFilter...) - tf.CommitmentFilter.commitmentFunc = func(slot iotago.SlotIndex) (*model.Commitment, error) { - if commitment, ok := tf.commitments[slot]; ok { - return commitment, nil - } - return nil, ierrors.Errorf("no commitment available for slot index %d", slot) - } - tf.CommitmentFilter.accountRetrieveFunc = func(accountID iotago.AccountID, targetSlot iotago.SlotIndex) (*accounts.AccountData, bool, error) { if accountData, ok := tf.accountData[accountID]; ok { return accountData, true, nil diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index 9f913336e..87e0e6815 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -70,7 +70,7 @@ require ( github.com/iotaledger/hive.go/runtime v0.0.0-20231113110812-4ca2b6cc9a42 // 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.20231120094046-1308e2a5e072 // indirect + github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231121121055-b13a176c5180 // indirect github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231120082637-ccd5b8465251 // indirect github.com/iotaledger/iota.go/v4 v4.0.0-20231120063545-80c263f28140 // indirect github.com/ipfs/boxo v0.13.1 // indirect diff --git a/tools/gendoc/go.sum b/tools/gendoc/go.sum index 4c0a34b99..361798b9a 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -307,8 +307,8 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231113110812-4ca2b6c 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.20231120094046-1308e2a5e072 h1:xbaW2dnDZy0ThcEcdK7ir3b+ynBXsn0R14lgxiFVuB0= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231120094046-1308e2a5e072/go.mod h1:iFiY6UukYeL8D3N1mtg4jh/9lxTBhzG0QgtD+w0gpps= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231121121055-b13a176c5180 h1:hAVWoyAF4FE+1gUd2IqvTBDTnQ4Z0GKE6qc8qw9QPqg= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231121121055-b13a176c5180/go.mod h1:iFiY6UukYeL8D3N1mtg4jh/9lxTBhzG0QgtD+w0gpps= 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-20231120063545-80c263f28140 h1:8zHRYT1KADR9bOLUg7Ia4XA3StBHzV4Tb2Qtp42KLN8=