diff --git a/components/dashboard/explorer_routes.go b/components/dashboard/explorer_routes.go index ade3c3622..4918fc2f8 100644 --- a/components/dashboard/explorer_routes.go +++ b/components/dashboard/explorer_routes.go @@ -105,7 +105,7 @@ func createExplorerBlock(block *model.Block, cachedBlock *blocks.Block, metadata var payloadJSON []byte basicBlock, isBasic := block.BasicBlock() if isBasic { - payloadJSON, err = lo.PanicOnErr(deps.Protocol.APIForVersion(iotaBlk.ProtocolVersion)).JSONEncode(basicBlock.Payload) + payloadJSON, err = lo.PanicOnErr(deps.Protocol.APIForVersion(iotaBlk.Header.ProtocolVersion)).JSONEncode(basicBlock.Payload) if err != nil { return nil } @@ -113,16 +113,16 @@ func createExplorerBlock(block *model.Block, cachedBlock *blocks.Block, metadata t := &ExplorerBlock{ ID: block.ID().ToHex(), - NetworkID: iotaBlk.NetworkID, - ProtocolVersion: iotaBlk.ProtocolVersion, + NetworkID: iotaBlk.Header.NetworkID, + ProtocolVersion: iotaBlk.Header.ProtocolVersion, SolidificationTimestamp: 0, - IssuanceTimestamp: iotaBlk.IssuingTime.Unix(), + IssuanceTimestamp: iotaBlk.Header.IssuingTime.Unix(), SequenceNumber: 0, - IssuerID: iotaBlk.IssuerID.ToHex(), + IssuerID: iotaBlk.Header.IssuerID.ToHex(), Signature: hexutil.EncodeHex(sigBytes), - StrongParents: iotaBlk.Block.StrongParentIDs().ToHex(), - WeakParents: iotaBlk.Block.WeakParentIDs().ToHex(), - ShallowLikedParents: iotaBlk.Block.ShallowLikeParentIDs().ToHex(), + StrongParents: iotaBlk.Body.StrongParentIDs().ToHex(), + WeakParents: iotaBlk.Body.WeakParentIDs().ToHex(), + ShallowLikedParents: iotaBlk.Body.ShallowLikeParentIDs().ToHex(), PayloadType: func() iotago.PayloadType { if isBasic && basicBlock.Payload != nil { @@ -152,8 +152,8 @@ func createExplorerBlock(block *model.Block, cachedBlock *blocks.Block, metadata return "" }(), - CommitmentID: iotaBlk.SlotCommitmentID.ToHex(), - LatestConfirmedSlot: uint64(iotaBlk.LatestFinalizedSlot), + CommitmentID: iotaBlk.Header.SlotCommitmentID.ToHex(), + LatestConfirmedSlot: uint64(iotaBlk.Header.LatestFinalizedSlot), } if cachedBlock != nil { diff --git a/components/dashboard/visualizer.go b/components/dashboard/visualizer.go index 305348031..3788bbf76 100644 --- a/components/dashboard/visualizer.go +++ b/components/dashboard/visualizer.go @@ -48,9 +48,9 @@ func sendVertex(blk *blocks.Block, confirmed bool) { broadcastWsBlock(&wsblk{MsgTypeVertex, &vertex{ ID: blk.ID().ToHex(), - StrongParents: blk.ProtocolBlock().Block.StrongParentIDs().ToHex(), - WeakParents: blk.ProtocolBlock().Block.WeakParentIDs().ToHex(), - ShallowLikedParents: blk.ProtocolBlock().Block.ShallowLikeParentIDs().ToHex(), + StrongParents: blk.ProtocolBlock().Body.StrongParentIDs().ToHex(), + WeakParents: blk.ProtocolBlock().Body.WeakParentIDs().ToHex(), + ShallowLikedParents: blk.ProtocolBlock().Body.ShallowLikeParentIDs().ToHex(), IsConfirmed: confirmed, IsTx: isTx, IsTxAccepted: func() bool { diff --git a/components/debugapi/debug_models.go b/components/debugapi/debug_models.go index 3ec7eba94..8343b91af 100644 --- a/components/debugapi/debug_models.go +++ b/components/debugapi/debug_models.go @@ -72,8 +72,8 @@ func BlockMetadataResponseFromBlock(block *blocks.Block) *BlockMetadataResponse return &BlockMetadataResponse{ BlockID: block.ID().String(), StrongParents: lo.Map(block.StrongParents(), func(blockID iotago.BlockID) string { return blockID.String() }), - WeakParents: lo.Map(block.ProtocolBlock().Block.WeakParentIDs(), func(blockID iotago.BlockID) string { return blockID.String() }), - ShallowLikeParents: lo.Map(block.ProtocolBlock().Block.ShallowLikeParentIDs(), func(blockID iotago.BlockID) string { return blockID.String() }), + WeakParents: lo.Map(block.ProtocolBlock().Body.WeakParentIDs(), func(blockID iotago.BlockID) string { return blockID.String() }), + ShallowLikeParents: lo.Map(block.ProtocolBlock().Body.ShallowLikeParentIDs(), func(blockID iotago.BlockID) string { return blockID.String() }), Solid: block.IsSolid(), Invalid: block.IsInvalid(), Booked: block.IsBooked(), diff --git a/components/inx/server_blocks.go b/components/inx/server_blocks.go index 77a5e9b77..63b6b076e 100644 --- a/components/inx/server_blocks.go +++ b/components/inx/server_blocks.go @@ -126,7 +126,7 @@ func (s *Server) SubmitBlock(ctx context.Context, rawBlock *inx.RawBlock) (*inx. return s.attachBlock(ctx, block) } -func (s *Server) attachBlock(ctx context.Context, block *iotago.ProtocolBlock) (*inx.BlockId, error) { +func (s *Server) attachBlock(ctx context.Context, block *iotago.Block) (*inx.BlockId, error) { mergedCtx, mergedCtxCancel := contextutils.MergeContexts(ctx, Component.Daemon().ContextStopped()) defer mergedCtxCancel() diff --git a/components/metrics/metrics_accounts.go b/components/metrics/metrics_accounts.go index a6950ba5e..ec7f7e3e5 100644 --- a/components/metrics/metrics_accounts.go +++ b/components/metrics/metrics_accounts.go @@ -23,7 +23,7 @@ var AccountMetrics = collector.NewCollection(accountNamespace, collector.WithPruningDelay(10*time.Minute), collector.WithInitFunc(func() { deps.Protocol.Events.Engine.BlockGadget.BlockAccepted.Hook(func(block *blocks.Block) { - accountData, exists, _ := deps.Protocol.MainEngineInstance().Ledger.Account(block.ProtocolBlock().IssuerID, deps.Protocol.MainEngineInstance().SyncManager.LatestCommitment().Slot()) + accountData, exists, _ := deps.Protocol.MainEngineInstance().Ledger.Account(block.ProtocolBlock().Header.IssuerID, deps.Protocol.MainEngineInstance().SyncManager.LatestCommitment().Slot()) if exists { deps.Collector.Update(accountNamespace, credits, float64(accountData.Credits.Value), accountData.ID.String()) } diff --git a/components/metrics/metrics_scheduler.go b/components/metrics/metrics_scheduler.go index 2d2896584..f23b17221 100644 --- a/components/metrics/metrics_scheduler.go +++ b/components/metrics/metrics_scheduler.go @@ -38,22 +38,22 @@ var SchedulerMetrics = collector.NewCollection(schedulerNamespace, collector.WithHelp("Current size of each node's queue (in work units)."), collector.WithInitFunc(func() { deps.Protocol.Events.Engine.Scheduler.BlockEnqueued.Hook(func(block *blocks.Block) { - deps.Collector.Update(schedulerNamespace, queueSizePerNodeWork, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueWork(block.ProtocolBlock().IssuerID)), block.ProtocolBlock().IssuerID.String()) + deps.Collector.Update(schedulerNamespace, queueSizePerNodeWork, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueWork(block.ProtocolBlock().Header.IssuerID)), block.ProtocolBlock().Header.IssuerID.String()) }, event.WithWorkerPool(Component.WorkerPool)) deps.Protocol.Events.Engine.Scheduler.BlockSkipped.Hook(func(block *blocks.Block) { - deps.Collector.Update(schedulerNamespace, queueSizePerNodeWork, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueWork(block.ProtocolBlock().IssuerID)), block.ProtocolBlock().IssuerID.String()) + deps.Collector.Update(schedulerNamespace, queueSizePerNodeWork, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueWork(block.ProtocolBlock().Header.IssuerID)), block.ProtocolBlock().Header.IssuerID.String()) }, event.WithWorkerPool(Component.WorkerPool)) deps.Protocol.Events.Engine.Scheduler.BlockDropped.Hook(func(block *blocks.Block, _ error) { - deps.Collector.Update(schedulerNamespace, queueSizePerNodeWork, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueWork(block.ProtocolBlock().IssuerID)), block.ProtocolBlock().IssuerID.String()) + deps.Collector.Update(schedulerNamespace, queueSizePerNodeWork, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueWork(block.ProtocolBlock().Header.IssuerID)), block.ProtocolBlock().Header.IssuerID.String()) }, event.WithWorkerPool(Component.WorkerPool)) deps.Protocol.Events.Engine.Scheduler.BlockScheduled.Hook(func(block *blocks.Block) { - deps.Collector.Update(schedulerNamespace, queueSizePerNodeWork, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueWork(block.ProtocolBlock().IssuerID)), block.ProtocolBlock().IssuerID.String()) + deps.Collector.Update(schedulerNamespace, queueSizePerNodeWork, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueWork(block.ProtocolBlock().Header.IssuerID)), block.ProtocolBlock().Header.IssuerID.String()) }, event.WithWorkerPool(Component.WorkerPool)) }), @@ -66,25 +66,25 @@ var SchedulerMetrics = collector.NewCollection(schedulerNamespace, collector.WithInitFunc(func() { deps.Protocol.Events.Engine.Scheduler.BlockEnqueued.Hook(func(block *blocks.Block) { if _, isBasic := block.BasicBlock(); isBasic { - deps.Collector.Update(schedulerNamespace, queueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueBlockCount(block.ProtocolBlock().IssuerID)), block.ProtocolBlock().IssuerID.String()) + deps.Collector.Update(schedulerNamespace, queueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueBlockCount(block.ProtocolBlock().Header.IssuerID)), block.ProtocolBlock().Header.IssuerID.String()) } }, event.WithWorkerPool(Component.WorkerPool)) deps.Protocol.Events.Engine.Scheduler.BlockSkipped.Hook(func(block *blocks.Block) { if _, isBasic := block.BasicBlock(); isBasic { - deps.Collector.Update(schedulerNamespace, queueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueBlockCount(block.ProtocolBlock().IssuerID)), block.ProtocolBlock().IssuerID.String()) + deps.Collector.Update(schedulerNamespace, queueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueBlockCount(block.ProtocolBlock().Header.IssuerID)), block.ProtocolBlock().Header.IssuerID.String()) } }, event.WithWorkerPool(Component.WorkerPool)) deps.Protocol.Events.Engine.Scheduler.BlockDropped.Hook(func(block *blocks.Block, _ error) { if _, isBasic := block.BasicBlock(); isBasic { - deps.Collector.Update(schedulerNamespace, queueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueBlockCount(block.ProtocolBlock().IssuerID)), block.ProtocolBlock().IssuerID.String()) + deps.Collector.Update(schedulerNamespace, queueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueBlockCount(block.ProtocolBlock().Header.IssuerID)), block.ProtocolBlock().Header.IssuerID.String()) } }, event.WithWorkerPool(Component.WorkerPool)) deps.Protocol.Events.Engine.Scheduler.BlockScheduled.Hook(func(block *blocks.Block) { if _, isBasic := block.BasicBlock(); isBasic { - deps.Collector.Update(schedulerNamespace, queueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueBlockCount(block.ProtocolBlock().IssuerID)), block.ProtocolBlock().IssuerID.String()) + deps.Collector.Update(schedulerNamespace, queueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.IssuerQueueBlockCount(block.ProtocolBlock().Header.IssuerID)), block.ProtocolBlock().Header.IssuerID.String()) } }, event.WithWorkerPool(Component.WorkerPool)) }), @@ -97,25 +97,25 @@ var SchedulerMetrics = collector.NewCollection(schedulerNamespace, collector.WithInitFunc(func() { deps.Protocol.Events.Engine.Scheduler.BlockEnqueued.Hook(func(block *blocks.Block) { if _, isValidation := block.ValidationBlock(); isValidation { - deps.Collector.Update(schedulerNamespace, validatorQueueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.ValidatorQueueBlockCount(block.ProtocolBlock().IssuerID)), block.ProtocolBlock().IssuerID.String()) + deps.Collector.Update(schedulerNamespace, validatorQueueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.ValidatorQueueBlockCount(block.ProtocolBlock().Header.IssuerID)), block.ProtocolBlock().Header.IssuerID.String()) } }, event.WithWorkerPool(Component.WorkerPool)) deps.Protocol.Events.Engine.Scheduler.BlockSkipped.Hook(func(block *blocks.Block) { if _, isValidation := block.ValidationBlock(); isValidation { - deps.Collector.Update(schedulerNamespace, validatorQueueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.ValidatorQueueBlockCount(block.ProtocolBlock().IssuerID)), block.ProtocolBlock().IssuerID.String()) + deps.Collector.Update(schedulerNamespace, validatorQueueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.ValidatorQueueBlockCount(block.ProtocolBlock().Header.IssuerID)), block.ProtocolBlock().Header.IssuerID.String()) } }, event.WithWorkerPool(Component.WorkerPool)) deps.Protocol.Events.Engine.Scheduler.BlockDropped.Hook(func(block *blocks.Block, _ error) { if _, isValidation := block.ValidationBlock(); isValidation { - deps.Collector.Update(schedulerNamespace, validatorQueueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.ValidatorQueueBlockCount(block.ProtocolBlock().IssuerID)), block.ProtocolBlock().IssuerID.String()) + deps.Collector.Update(schedulerNamespace, validatorQueueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.ValidatorQueueBlockCount(block.ProtocolBlock().Header.IssuerID)), block.ProtocolBlock().Header.IssuerID.String()) } }, event.WithWorkerPool(Component.WorkerPool)) deps.Protocol.Events.Engine.Scheduler.BlockScheduled.Hook(func(block *blocks.Block) { if _, isValidation := block.ValidationBlock(); isValidation { - deps.Collector.Update(schedulerNamespace, validatorQueueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.ValidatorQueueBlockCount(block.ProtocolBlock().IssuerID)), block.ProtocolBlock().IssuerID.String()) + deps.Collector.Update(schedulerNamespace, validatorQueueSizePerNodeCount, float64(deps.Protocol.MainEngineInstance().Scheduler.ValidatorQueueBlockCount(block.ProtocolBlock().Header.IssuerID)), block.ProtocolBlock().Header.IssuerID.String()) } }, event.WithWorkerPool(Component.WorkerPool)) }), @@ -127,14 +127,14 @@ var SchedulerMetrics = collector.NewCollection(schedulerNamespace, collector.WithHelp("Current amount of mana of each issuer in the queue."), collector.WithInitFunc(func() { deps.Protocol.Events.Engine.Scheduler.BlockEnqueued.Hook(func(block *blocks.Block) { - mana, err := deps.Protocol.MainEngineInstance().Ledger.ManaManager().GetManaOnAccount(block.ProtocolBlock().IssuerID, block.SlotCommitmentID().Slot()) + mana, err := deps.Protocol.MainEngineInstance().Ledger.ManaManager().GetManaOnAccount(block.ProtocolBlock().Header.IssuerID, block.SlotCommitmentID().Slot()) if err != nil { - deps.Protocol.MainEngineInstance().ErrorHandler("metrics")(ierrors.Wrapf(err, "failed to retrieve mana on account %s for slot %d", block.ProtocolBlock().IssuerID, block.SlotCommitmentID().Slot())) + deps.Protocol.MainEngineInstance().ErrorHandler("metrics")(ierrors.Wrapf(err, "failed to retrieve mana on account %s for slot %d", block.ProtocolBlock().Header.IssuerID, block.SlotCommitmentID().Slot())) return } - deps.Collector.Update(schedulerNamespace, manaAmountPerNode, float64(mana), block.ProtocolBlock().IssuerID.String()) + deps.Collector.Update(schedulerNamespace, manaAmountPerNode, float64(mana), block.ProtocolBlock().Header.IssuerID.String()) }, event.WithWorkerPool(Component.WorkerPool)) }), )), diff --git a/components/restapi/core/blocks.go b/components/restapi/core/blocks.go index 5db11730f..554fdfa08 100644 --- a/components/restapi/core/blocks.go +++ b/components/restapi/core/blocks.go @@ -75,7 +75,7 @@ func blockIssuanceBySlot(slotIndex iotago.SlotIndex) (*apimodels.IssuanceBlockHe } func sendBlock(c echo.Context) (*apimodels.BlockCreatedResponse, error) { - iotaBlock, err := httpserver.ParseRequestByHeader(c, deps.Protocol.CommittedAPI(), iotago.ProtocolBlockFromBytes(deps.Protocol)) + iotaBlock, err := httpserver.ParseRequestByHeader(c, deps.Protocol.CommittedAPI(), iotago.BlockFromBytes(deps.Protocol)) if err != nil { return nil, ierrors.Wrapf(err, "failed to parse iotablock") } diff --git a/components/validator/issuer.go b/components/validator/issuer.go index 8a748b58f..038fb9e78 100644 --- a/components/validator/issuer.go +++ b/components/validator/issuer.go @@ -101,7 +101,7 @@ func issueValidatorBlock(ctx context.Context) { return } - Component.LogDebugf("Issued validator block: %s - commitment %s %d - latest finalized slot %d", modelBlock.ID(), modelBlock.ProtocolBlock().SlotCommitmentID, modelBlock.ProtocolBlock().SlotCommitmentID.Slot(), modelBlock.ProtocolBlock().LatestFinalizedSlot) + Component.LogDebugf("Issued validator block: %s - commitment %s %d - latest finalized slot %d", modelBlock.ID(), modelBlock.ProtocolBlock().Header.SlotCommitmentID, modelBlock.ProtocolBlock().Header.SlotCommitmentID.Slot(), modelBlock.ProtocolBlock().Header.LatestFinalizedSlot) } func reviveChain(issuingTime time.Time) (*iotago.Commitment, iotago.BlockID, error) { diff --git a/go.mod b/go.mod index 2fa655a8c..ec5d2d7d5 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-20231020115340-13da292c580b github.com/iotaledger/hive.go/app v0.0.0-20231020115340-13da292c580b - github.com/iotaledger/hive.go/constraints v0.0.0-20231020115340-13da292c580b + github.com/iotaledger/hive.go/constraints v0.0.0-20231027195901-620bd7470e42 github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231020115340-13da292c580b - github.com/iotaledger/hive.go/crypto v0.0.0-20231020115340-13da292c580b + github.com/iotaledger/hive.go/crypto v0.0.0-20231027195901-620bd7470e42 github.com/iotaledger/hive.go/ds v0.0.0-20231020115340-13da292c580b - github.com/iotaledger/hive.go/ierrors v0.0.0-20231020115340-13da292c580b + github.com/iotaledger/hive.go/ierrors v0.0.0-20231027195901-620bd7470e42 github.com/iotaledger/hive.go/kvstore v0.0.0-20231020115340-13da292c580b - github.com/iotaledger/hive.go/lo v0.0.0-20231020115340-13da292c580b + github.com/iotaledger/hive.go/lo v0.0.0-20231027195901-620bd7470e42 github.com/iotaledger/hive.go/logger v0.0.0-20231020115340-13da292c580b - github.com/iotaledger/hive.go/runtime v0.0.0-20231020115340-13da292c580b + github.com/iotaledger/hive.go/runtime v0.0.0-20231027195901-620bd7470e42 github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231020115340-13da292c580b - github.com/iotaledger/hive.go/stringify v0.0.0-20231020115340-13da292c580b - github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231026154618-820b8eaed2cc - github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231026154523-9ee0c47a283a - github.com/iotaledger/iota.go/v4 v4.0.0-20231026154111-efd63ff4f03d + github.com/iotaledger/hive.go/stringify v0.0.0-20231027195901-620bd7470e42 + github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231028104239-869296c43f26 + github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231028104044-69b02af0058d + github.com/iotaledger/iota.go/v4 v4.0.0-20231028103644-b834fd54b02a github.com/labstack/echo/v4 v4.11.2 github.com/labstack/gommon v0.4.0 github.com/libp2p/go-libp2p v0.31.0 diff --git a/go.sum b/go.sum index d8951f2a0..4bf13faa4 100644 --- a/go.sum +++ b/go.sum @@ -281,36 +281,36 @@ github.com/iotaledger/hive.go/ads v0.0.0-20231020115340-13da292c580b h1:D68khiAF github.com/iotaledger/hive.go/ads v0.0.0-20231020115340-13da292c580b/go.mod h1:IFh0gDfeMgZtfCo+5afK59IDR4xXh+cTR9YtLnZPcbY= github.com/iotaledger/hive.go/app v0.0.0-20231020115340-13da292c580b h1:mX3NXaTMLEwZnEs4IlxEvXY0YZo8qbb8M1xM39FS6qY= github.com/iotaledger/hive.go/app v0.0.0-20231020115340-13da292c580b/go.mod h1:8ZbIKR84oQd/3iQ5eeT7xpudO9/ytzXP7veIYnk7Orc= -github.com/iotaledger/hive.go/constraints v0.0.0-20231020115340-13da292c580b h1:HF4e0wz0JMIT4m3saqdQ//T9nWHV9d5sLMtEwNDuykM= -github.com/iotaledger/hive.go/constraints v0.0.0-20231020115340-13da292c580b/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/constraints v0.0.0-20231027195901-620bd7470e42 h1:drmpgLlJy7kZ09Dt1qKSnbILU+27Qu2jp4VdPDNwbFk= +github.com/iotaledger/hive.go/constraints v0.0.0-20231027195901-620bd7470e42/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231020115340-13da292c580b h1:ZERXxhQBUBV1AqTE6cUI4vTxSx4JrnsMuLZFgj32xLM= github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231020115340-13da292c580b/go.mod h1:Mc+ACqBGPxrPMIPUBOm6/HL0J6m0iVMwjtIEKW3uow8= -github.com/iotaledger/hive.go/crypto v0.0.0-20231020115340-13da292c580b h1:ZUUqRRO6XnQmVcXlXyx07vqySn28+bln6jp9KagYCjY= -github.com/iotaledger/hive.go/crypto v0.0.0-20231020115340-13da292c580b/go.mod h1:h3o6okvMSEK3KOX6pOp3yq1h9ohTkTfo6X8MzEadeb0= +github.com/iotaledger/hive.go/crypto v0.0.0-20231027195901-620bd7470e42 h1:r8TkdQJB7/bJd8cF8z5GQ+rX/7JpbPdPoN7wMoV1OCM= +github.com/iotaledger/hive.go/crypto v0.0.0-20231027195901-620bd7470e42/go.mod h1:h3o6okvMSEK3KOX6pOp3yq1h9ohTkTfo6X8MzEadeb0= github.com/iotaledger/hive.go/ds v0.0.0-20231020115340-13da292c580b h1:8b2sH+2Vf0y5BDYTMwKa09iQr3JF9JrzTI64DkXb+9U= github.com/iotaledger/hive.go/ds v0.0.0-20231020115340-13da292c580b/go.mod h1:3XkUSKfHaVxGbT0XAvjNlVYqPzhfLTGhDtdNA5UBPco= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231020115340-13da292c580b h1:JJPnr231djUTgTnE4oGz847WE9VA7Py6E6fgZwT5TQo= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231020115340-13da292c580b/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231027195901-620bd7470e42 h1:QMxd32Y/veVhTDPCiOFgetjUbG7sr9MryF29/rSPkMA= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231027195901-620bd7470e42/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= github.com/iotaledger/hive.go/kvstore v0.0.0-20231020115340-13da292c580b h1:LusmtjpfG/q8lc15Fp9W3kABbN3tArKx/zw2ibdY1DU= github.com/iotaledger/hive.go/kvstore v0.0.0-20231020115340-13da292c580b/go.mod h1:O/U3jtiUDeqqM0MZQFu2UPqS9fUm0C5hNISxlmg/thE= -github.com/iotaledger/hive.go/lo v0.0.0-20231020115340-13da292c580b h1:UvFWI8wQJS/XQOeWHpPsaFVeS2nxJ7nIGFr+IFjrnVw= -github.com/iotaledger/hive.go/lo v0.0.0-20231020115340-13da292c580b/go.mod h1:s4kzx9QY1MVWHJralj+3q5kI0eARtrJhphYD/iBbPfo= +github.com/iotaledger/hive.go/lo v0.0.0-20231027195901-620bd7470e42 h1:AvNLzONVMspwx7nD/NyYUgb5Hi7/zgzIOegr1uRD/M8= +github.com/iotaledger/hive.go/lo v0.0.0-20231027195901-620bd7470e42/go.mod h1:s4kzx9QY1MVWHJralj+3q5kI0eARtrJhphYD/iBbPfo= github.com/iotaledger/hive.go/log v0.0.0-20231020115340-13da292c580b h1:IwhoeOeRu25mBdrimuOOvbbhHYX0QipibV69ubn8nX0= github.com/iotaledger/hive.go/log v0.0.0-20231020115340-13da292c580b/go.mod h1:JvokzmpmFZPDskMlUqqjgHtD8usVJU4nAY/TNMGge8M= github.com/iotaledger/hive.go/logger v0.0.0-20231020115340-13da292c580b h1:EhVgAU/f2J3VYZwP60dRdyfAeDU3c/gBzX9blKtQGKA= github.com/iotaledger/hive.go/logger v0.0.0-20231020115340-13da292c580b/go.mod h1:aBfAfIB2GO/IblhYt5ipCbyeL9bXSNeAwtYVA3hZaHg= -github.com/iotaledger/hive.go/runtime v0.0.0-20231020115340-13da292c580b h1:O68POYIqBLnoHN+HIszc58QwAI2qocYq0WKGfVrXmMg= -github.com/iotaledger/hive.go/runtime v0.0.0-20231020115340-13da292c580b/go.mod h1:jRw8yFipiPaqmTPHh7hTcxAP9u6pjRGpByS3REJKkbY= +github.com/iotaledger/hive.go/runtime v0.0.0-20231027195901-620bd7470e42 h1:1QMJ39qXIx/IZVzus3+97IV7Pa++e+d340TvbMjhiBU= +github.com/iotaledger/hive.go/runtime v0.0.0-20231027195901-620bd7470e42/go.mod h1:jRw8yFipiPaqmTPHh7hTcxAP9u6pjRGpByS3REJKkbY= github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231020115340-13da292c580b h1:zaXZn9yV/95SRDkgCZQeBbSbmcJTKSZbCB7oBd71Qwg= github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231020115340-13da292c580b/go.mod h1:SdK26z8/VhWtxaqCuQrufm80SELgowQPmu9T/8eUQ8g= -github.com/iotaledger/hive.go/stringify v0.0.0-20231020115340-13da292c580b h1:MDZhTZTVDiydXcW5j4TA7HixVCyAdToIMPhHfJee7cE= -github.com/iotaledger/hive.go/stringify v0.0.0-20231020115340-13da292c580b/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231026154618-820b8eaed2cc h1:Foz7Q1vNh0Ts+YTEODHO3LSKVGM/uNV3RqbBJS6u7yA= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231026154618-820b8eaed2cc/go.mod h1:gaQbe/L+wjjUeQj5N8+o/XdZnSosFmDQfxmfyrK05hc= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231026154523-9ee0c47a283a h1:8JbC44pNud1rT091fJA4bDC+35MozksapuCXf8M1kmg= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231026154523-9ee0c47a283a/go.mod h1:iXG/tO+GQZQzgIUyITnQDigb6Ny1wSueHFIYne4HBkc= -github.com/iotaledger/iota.go/v4 v4.0.0-20231026154111-efd63ff4f03d h1:gcJz0J3xFELIPT7y4xqW+q25oOcK6QMlxNnrfFu8srA= -github.com/iotaledger/iota.go/v4 v4.0.0-20231026154111-efd63ff4f03d/go.mod h1:jqbLYq4a/FwuiPBqFfkAwwxU8vs3+kReRq2/tyX5qRA= +github.com/iotaledger/hive.go/stringify v0.0.0-20231027195901-620bd7470e42 h1:OlDhgvJ48bZxcvTeebJ1b96xtNnJAddejd2Q4rlH1mU= +github.com/iotaledger/hive.go/stringify v0.0.0-20231027195901-620bd7470e42/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231028104239-869296c43f26 h1:ZZs7IzdxrogQWGF1HfUUfR3KW8WhfxE4hUbfwZCDXFY= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231028104239-869296c43f26/go.mod h1:aFS0dN6QgKGgZakGgEv57NOLw+pLGdEiGcfDZ3h9GL0= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231028104044-69b02af0058d h1:0SVvkN04C+Ylc2puM/c77HuvRMmHRl0BkNjlZx1YWeA= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231028104044-69b02af0058d/go.mod h1:WFa5hHen6fi3RBX4K6r4fzhGpoh+7KJVIyFztZHdM84= +github.com/iotaledger/iota.go/v4 v4.0.0-20231028103644-b834fd54b02a h1:WLW4iaJAx4N9Pujv+gzHklnnjCt5MPrtXyVcK3UXdNc= +github.com/iotaledger/iota.go/v4 v4.0.0-20231028103644-b834fd54b02a/go.mod h1:jqbLYq4a/FwuiPBqFfkAwwxU8vs3+kReRq2/tyX5qRA= github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= diff --git a/pkg/blockhandler/blockissuer.go b/pkg/blockhandler/blockissuer.go index ed6c99f01..b712bab88 100644 --- a/pkg/blockhandler/blockissuer.go +++ b/pkg/blockhandler/blockissuer.go @@ -94,7 +94,7 @@ func (i *BlockHandler) SubmitBlockAndAwaitEvent(ctx context.Context, block *mode } } -func (i *BlockHandler) AttachBlock(ctx context.Context, iotaBlock *iotago.ProtocolBlock) (iotago.BlockID, error) { +func (i *BlockHandler) AttachBlock(ctx context.Context, iotaBlock *iotago.Block) (iotago.BlockID, error) { modelBlock, err := model.BlockFromBlock(iotaBlock) if err != nil { return iotago.EmptyBlockID, ierrors.Wrap(err, "error serializing block to model block") diff --git a/pkg/model/block.go b/pkg/model/block.go index d5c212153..a41c491c0 100644 --- a/pkg/model/block.go +++ b/pkg/model/block.go @@ -11,45 +11,45 @@ import ( type Block struct { blockID iotago.BlockID - data []byte - protocolBlock *iotago.ProtocolBlock + data []byte + block *iotago.Block } -func newBlock(blockID iotago.BlockID, iotaBlock *iotago.ProtocolBlock, data []byte) (*Block, error) { +func newBlock(blockID iotago.BlockID, iotaBlock *iotago.Block, data []byte) (*Block, error) { block := &Block{ - blockID: blockID, - data: data, - protocolBlock: iotaBlock, + blockID: blockID, + data: data, + block: iotaBlock, } return block, nil } -func BlockFromBlock(protocolBlock *iotago.ProtocolBlock, opts ...serix.Option) (*Block, error) { - data, err := protocolBlock.API.Encode(protocolBlock, opts...) +func BlockFromBlock(block *iotago.Block, opts ...serix.Option) (*Block, error) { + data, err := block.API.Encode(block, opts...) if err != nil { return nil, err } - blockID, err := protocolBlock.ID() + blockID, err := block.ID() if err != nil { return nil, err } - return newBlock(blockID, protocolBlock, data) + return newBlock(blockID, block, data) } func BlockFromIDAndBytes(blockID iotago.BlockID, data []byte, api iotago.API, opts ...serix.Option) (*Block, error) { - protocolBlock := new(iotago.ProtocolBlock) - if _, err := api.Decode(data, protocolBlock, opts...); err != nil { + block := new(iotago.Block) + if _, err := api.Decode(data, block, opts...); err != nil { return nil, err } - return newBlock(blockID, protocolBlock, data) + return newBlock(blockID, block, data) } func BlockFromBytes(data []byte, apiProvider iotago.APIProvider) (*Block, error) { - iotaBlock, _, err := iotago.ProtocolBlockFromBytes(apiProvider)(data) + iotaBlock, _, err := iotago.BlockFromBytes(apiProvider)(data) if err != nil { return nil, err } @@ -85,8 +85,8 @@ func (blk *Block) Bytes() ([]byte, error) { return blk.data, nil } -func (blk *Block) ProtocolBlock() *iotago.ProtocolBlock { - return blk.protocolBlock +func (blk *Block) ProtocolBlock() *iotago.Block { + return blk.block } func (blk *Block) Payload() iotago.Payload { @@ -109,18 +109,18 @@ func (blk *Block) SignedTransaction() (tx *iotago.SignedTransaction, isTransacti return tx, isTransaction } -func (blk *Block) BasicBlock() (basicBlock *iotago.BasicBlock, isBasicBlock bool) { - basicBlock, isBasicBlock = blk.ProtocolBlock().Block.(*iotago.BasicBlock) +func (blk *Block) BasicBlock() (basicBlock *iotago.BasicBlockBody, isBasicBlock bool) { + basicBlock, isBasicBlock = blk.ProtocolBlock().Body.(*iotago.BasicBlockBody) return basicBlock, isBasicBlock } -func (blk *Block) ValidationBlock() (validationBlock *iotago.ValidationBlock, isValidationBlock bool) { - validationBlock, isValidationBlock = blk.ProtocolBlock().Block.(*iotago.ValidationBlock) +func (blk *Block) ValidationBlock() (validationBlock *iotago.ValidationBlockBody, isValidationBlock bool) { + validationBlock, isValidationBlock = blk.ProtocolBlock().Body.(*iotago.ValidationBlockBody) return validationBlock, isValidationBlock } func (blk *Block) String() string { - encode, err := blk.protocolBlock.API.JSONEncode(blk.ProtocolBlock()) + encode, err := blk.block.API.JSONEncode(blk.ProtocolBlock()) if err != nil { panic(err) } diff --git a/pkg/model/signaled_block.go b/pkg/model/signaled_block.go index e620b243d..c4bf457d4 100644 --- a/pkg/model/signaled_block.go +++ b/pkg/model/signaled_block.go @@ -15,10 +15,10 @@ type SignaledBlock struct { ProtocolParametersHash iotago.Identifier `serix:"3"` } -func NewSignaledBlock(blockID iotago.BlockID, block *iotago.ProtocolBlock, validationBlock *iotago.ValidationBlock) *SignaledBlock { +func NewSignaledBlock(blockID iotago.BlockID, block *iotago.Block, validationBlock *iotago.ValidationBlockBody) *SignaledBlock { return &SignaledBlock{ ID: blockID, - IssuingTime: block.IssuingTime, + IssuingTime: block.Header.IssuingTime, HighestSupportedVersion: validationBlock.HighestSupportedVersion, ProtocolParametersHash: validationBlock.ProtocolParametersHash, } diff --git a/pkg/network/protocols/core/protocol.go b/pkg/network/protocols/core/protocol.go index d67ab7b06..0ced4c663 100644 --- a/pkg/network/protocols/core/protocol.go +++ b/pkg/network/protocols/core/protocol.go @@ -76,7 +76,7 @@ func (p *Protocol) SendAttestations(cm *model.Commitment, attestations []*iotago encodedAttestations := marshalutil.New() encodedAttestations.WriteUint32(uint32(len(attestations))) for _, att := range attestations { - iotagoAPI := lo.PanicOnErr(p.apiProvider.APIForVersion(att.ProtocolVersion)) + iotagoAPI := lo.PanicOnErr(p.apiProvider.APIForVersion(att.Header.ProtocolVersion)) encodedAttestations.WriteBytes(lo.PanicOnErr(iotagoAPI.Encode(att))) } diff --git a/pkg/protocol/block_dispatcher.go b/pkg/protocol/block_dispatcher.go index 4737fe5da..15b2fcfa3 100644 --- a/pkg/protocol/block_dispatcher.go +++ b/pkg/protocol/block_dispatcher.go @@ -67,7 +67,7 @@ func NewBlockDispatcher(protocol *Protocol, opts ...options.Option[BlockDispatch // Dispatch dispatches the given block to the correct engine instance. func (b *BlockDispatcher) Dispatch(block *model.Block, src peer.ID) error { - slotCommitment := b.protocol.ChainManager.LoadCommitmentOrRequestMissing(block.ProtocolBlock().SlotCommitmentID) + slotCommitment := b.protocol.ChainManager.LoadCommitmentOrRequestMissing(block.ProtocolBlock().Header.SlotCommitmentID) if !slotCommitment.SolidEvent().WasTriggered() { if !b.unsolidCommitmentBlocks.Add(slotCommitment.ID(), types.NewTuple(block, src)) { return ierrors.Errorf("failed to add block %s to unsolid commitment buffer", block.ID()) @@ -353,7 +353,7 @@ func (b *BlockDispatcher) inSyncWindow(engine *engine.Engine, block *model.Block return true } - slotCommitmentID := block.ProtocolBlock().SlotCommitmentID + slotCommitmentID := block.ProtocolBlock().Header.SlotCommitmentID latestCommitmentSlot := engine.Storage.Settings().LatestCommitment().Slot() maxCommittableAge := engine.APIForSlot(slotCommitmentID.Slot()).ProtocolParameters().MaxCommittableAge() diff --git a/pkg/protocol/commitment_verifier.go b/pkg/protocol/commitment_verifier.go index 85e715d89..1315071e3 100644 --- a/pkg/protocol/commitment_verifier.go +++ b/pkg/protocol/commitment_verifier.go @@ -39,9 +39,9 @@ func (c *CommitmentVerifier) verifyCommitment(commitment *model.Commitment, atte iotago.AccountID.Bytes, iotago.AccountIDFromBytes, func(attestation *iotago.Attestation) ([]byte, error) { - apiForVersion, err := c.engine.APIForVersion(attestation.ProtocolVersion) + apiForVersion, err := c.engine.APIForVersion(attestation.Header.ProtocolVersion) if err != nil { - return nil, ierrors.Wrapf(err, "failed to get API for version %d", attestation.ProtocolVersion) + return nil, ierrors.Wrapf(err, "failed to get API for version %d", attestation.Header.ProtocolVersion) } return apiForVersion.Encode(attestation) @@ -64,8 +64,8 @@ func (c *CommitmentVerifier) verifyCommitment(commitment *model.Commitment, atte ) for _, att := range attestations { - if err := tree.Set(att.IssuerID, att); err != nil { - return nil, 0, ierrors.Wrapf(err, "failed to set attestation for issuerID %s", att.IssuerID) + if err := tree.Set(att.Header.IssuerID, att); err != nil { + return nil, 0, ierrors.Wrapf(err, "failed to set attestation for issuerID %s", att.Header.IssuerID) } } if !iotago.VerifyProof(merkleProof, tree.Root(), commitment.RootsID()) { @@ -119,11 +119,11 @@ func (c *CommitmentVerifier) verifyAttestations(attestations []*iotago.Attestati // 1. The attestation might be fake. // 2. The issuer might have added a new public key in the meantime, but we don't know about it yet // since we only have the ledger state at the forking point. - accountData, exists := c.validatorAccountsAtFork[att.IssuerID] + accountData, exists := c.validatorAccountsAtFork[att.Header.IssuerID] // We always need to have the accountData for a validator. if !exists { - return nil, 0, ierrors.Errorf("accountData for issuerID %s does not exist", att.IssuerID) + return nil, 0, ierrors.Errorf("accountData for issuerID %s does not exist", att.Header.IssuerID) } switch signature := att.Signature.(type) { @@ -147,8 +147,8 @@ func (c *CommitmentVerifier) verifyAttestations(attestations []*iotago.Attestati } // 3. A valid set of attestations can't contain multiple attestations from the same issuerID. - if visitedIdentities.Has(att.IssuerID) { - return nil, 0, ierrors.Errorf("issuerID %s contained in multiple attestations", att.IssuerID) + if visitedIdentities.Has(att.Header.IssuerID) { + return nil, 0, ierrors.Errorf("issuerID %s contained in multiple attestations", att.Header.IssuerID) } // TODO: this might differ if we have a Accounts with changing weights depending on the Slot/epoch @@ -162,11 +162,11 @@ func (c *CommitmentVerifier) verifyAttestations(attestations []*iotago.Attestati return nil, 0, ierrors.Errorf("committee for slot %d does not exist", attestationBlockID.Slot()) } - if _, seatExists := committee.GetSeat(att.IssuerID); seatExists { + if _, seatExists := committee.GetSeat(att.Header.IssuerID); seatExists { seatCount++ } - visitedIdentities.Add(att.IssuerID) + visitedIdentities.Add(att.Header.IssuerID) blockID, err := att.BlockID() if err != nil { diff --git a/pkg/protocol/engine/accounts/accountsledger/manager.go b/pkg/protocol/engine/accounts/accountsledger/manager.go index 53459cb0c..0d47ec95a 100644 --- a/pkg/protocol/engine/accounts/accountsledger/manager.go +++ b/pkg/protocol/engine/accounts/accountsledger/manager.go @@ -98,7 +98,7 @@ func (m *Manager) TrackBlock(block *blocks.Block) { if validationBlock, isValidationBlock := block.ValidationBlock(); isValidationBlock { newSignaledBlock := model.NewSignaledBlock(block.ID(), block.ProtocolBlock(), validationBlock) - m.latestSupportedVersionSignals.Get(block.ID().Slot(), true).Compute(block.ProtocolBlock().IssuerID, func(currentValue *model.SignaledBlock, exists bool) *model.SignaledBlock { + m.latestSupportedVersionSignals.Get(block.ID().Slot(), true).Compute(block.ProtocolBlock().Header.IssuerID, func(currentValue *model.SignaledBlock, exists bool) *model.SignaledBlock { if !exists { return newSignaledBlock } @@ -469,9 +469,9 @@ func (m *Manager) computeBlockBurnsForSlot(slot iotago.SlotIndex, rmc iotago.Man return nil, ierrors.Errorf("cannot apply the new diff, block %s not found in the block cache", blockID) } if _, isBasicBlock := block.BasicBlock(); isBasicBlock { - burns[block.ProtocolBlock().IssuerID] += iotago.Mana(block.WorkScore()) * rmc + burns[block.ProtocolBlock().Header.IssuerID] += iotago.Mana(block.WorkScore()) * rmc } else if _, isValidationBlock := block.ValidationBlock(); isValidationBlock { - validationBlockCount[block.ProtocolBlock().IssuerID]++ + validationBlockCount[block.ProtocolBlock().Header.IssuerID]++ } } validationBlocksPerSlot := int(apiForSlot.ProtocolParameters().ValidationBlocksPerSlot()) diff --git a/pkg/protocol/engine/accounts/accountsledger/testsuite_test.go b/pkg/protocol/engine/accounts/accountsledger/testsuite_test.go index b090c64c5..64d7f8152 100644 --- a/pkg/protocol/engine/accounts/accountsledger/testsuite_test.go +++ b/pkg/protocol/engine/accounts/accountsledger/testsuite_test.go @@ -190,7 +190,7 @@ func (t *TestSuite) ApplySlotActions(slot iotago.SlotIndex, rmc iotago.Mana, act func (t *TestSuite) createBlockWithRMC(accountID iotago.AccountID, slot iotago.SlotIndex, rmc iotago.Mana) *blocks.Block { innerBlock := tpkg.RandBasicBlockWithIssuerAndRMC(tpkg.TestAPI, accountID, rmc) - innerBlock.IssuingTime = tpkg.TestAPI.TimeProvider().SlotStartTime(slot) + innerBlock.Header.IssuingTime = tpkg.TestAPI.TimeProvider().SlotStartTime(slot) modelBlock, err := model.BlockFromBlock(innerBlock) require.NoError(t.T, err) diff --git a/pkg/protocol/engine/attestation/slotattestation/manager.go b/pkg/protocol/engine/attestation/slotattestation/manager.go index 6b27b5b2d..437a00631 100644 --- a/pkg/protocol/engine/attestation/slotattestation/manager.go +++ b/pkg/protocol/engine/attestation/slotattestation/manager.go @@ -156,7 +156,7 @@ func (m *Manager) AddAttestationFromValidationBlock(block *blocks.Block) error { return ierrors.Errorf("committee for slot %d does not exist", block.ID().Slot()) } // Only track attestations of active committee members. - if _, exists := committee.GetSeat(block.ProtocolBlock().IssuerID); !exists { + if _, exists := committee.GetSeat(block.ProtocolBlock().Header.IssuerID); !exists { return nil } @@ -171,7 +171,7 @@ func (m *Manager) AddAttestationFromValidationBlock(block *blocks.Block) error { newAttestation := iotago.NewAttestation(m.apiProvider.APIForSlot(block.ID().Slot()), block.ProtocolBlock()) // We keep only the latest attestation for each committee member. - m.futureAttestations.Get(block.ID().Slot(), true).Compute(block.ProtocolBlock().IssuerID, func(currentValue *iotago.Attestation, exists bool) *iotago.Attestation { + m.futureAttestations.Get(block.ID().Slot(), true).Compute(block.ProtocolBlock().Header.IssuerID, func(currentValue *iotago.Attestation, exists bool) *iotago.Attestation { if !exists { return newAttestation } @@ -188,13 +188,13 @@ func (m *Manager) AddAttestationFromValidationBlock(block *blocks.Block) error { } func (m *Manager) applyToPendingAttestations(attestation *iotago.Attestation, cutoffSlot iotago.SlotIndex) { - if attestation.SlotCommitmentID.Slot() < cutoffSlot { + if attestation.Header.SlotCommitmentID.Slot() < cutoffSlot { return } updated := true - updatedAttestation := m.pendingAttestations.Get(cutoffSlot, true).Compute(attestation.IssuerID, func(currentValue *iotago.Attestation, exists bool) *iotago.Attestation { + updatedAttestation := m.pendingAttestations.Get(cutoffSlot, true).Compute(attestation.Header.IssuerID, func(currentValue *iotago.Attestation, exists bool) *iotago.Attestation { if !exists { return attestation } @@ -214,8 +214,8 @@ func (m *Manager) applyToPendingAttestations(attestation *iotago.Attestation, cu return } - for i := cutoffSlot; i <= updatedAttestation.SlotCommitmentID.Slot(); i++ { - m.pendingAttestations.Get(i, true).Set(attestation.IssuerID, updatedAttestation) + for i := cutoffSlot; i <= updatedAttestation.Header.SlotCommitmentID.Slot(); i++ { + m.pendingAttestations.Get(i, true).Set(attestation.Header.IssuerID, updatedAttestation) } } @@ -267,9 +267,9 @@ func (m *Manager) Commit(slot iotago.SlotIndex) (newCW uint64, attestationsRoot for _, a := range attestations { // TODO: which weight are we using here? The current one? Or the one of the slot of the attestation/commitmentID? - if _, exists := committee.GetSeat(a.IssuerID); exists { - if err := tree.Set(a.IssuerID, a); err != nil { - return 0, iotago.Identifier{}, ierrors.Wrapf(err, "failed to set attestation %s in tree", a.IssuerID) + if _, exists := committee.GetSeat(a.Header.IssuerID); exists { + if err := tree.Set(a.Header.IssuerID, a); err != nil { + return 0, iotago.Identifier{}, ierrors.Wrapf(err, "failed to set attestation %s in tree", a.Header.IssuerID) } m.lastCumulativeWeight++ diff --git a/pkg/protocol/engine/attestation/slotattestation/snapshot.go b/pkg/protocol/engine/attestation/slotattestation/snapshot.go index 12f70bd4a..ec2ae69fd 100644 --- a/pkg/protocol/engine/attestation/slotattestation/snapshot.go +++ b/pkg/protocol/engine/attestation/slotattestation/snapshot.go @@ -90,9 +90,9 @@ func (m *Manager) Export(writer io.WriteSeeker, targetSlot iotago.SlotIndex) err if err = stream.WriteCollection(writer, func() (uint64, error) { for _, a := range attestations { - apiForVersion, err := m.apiProvider.APIForVersion(a.ProtocolVersion) + apiForVersion, err := m.apiProvider.APIForVersion(a.Header.ProtocolVersion) if err != nil { - return 0, ierrors.Wrapf(err, "failed to get API for version %d", a.ProtocolVersion) + return 0, ierrors.Wrapf(err, "failed to get API for version %d", a.Header.ProtocolVersion) } bytes, err := apiForVersion.Encode(a) if err != nil { diff --git a/pkg/protocol/engine/attestation/slotattestation/storage.go b/pkg/protocol/engine/attestation/slotattestation/storage.go index b5c198e30..6f74e60c0 100644 --- a/pkg/protocol/engine/attestation/slotattestation/storage.go +++ b/pkg/protocol/engine/attestation/slotattestation/storage.go @@ -53,7 +53,7 @@ func (m *Manager) writeToDisk() error { attestations := m.determineAttestationsFromWindow(i) for _, a := range attestations { - if err := storage.Set(a.IssuerID, a); err != nil { + if err := storage.Set(a.Header.IssuerID, a); err != nil { return ierrors.Wrapf(err, "failed to set attestation %v", a) } } diff --git a/pkg/protocol/engine/blockdag/inmemoryblockdag/blockdag.go b/pkg/protocol/engine/blockdag/inmemoryblockdag/blockdag.go index b368f1278..6fe5944b0 100644 --- a/pkg/protocol/engine/blockdag/inmemoryblockdag/blockdag.go +++ b/pkg/protocol/engine/blockdag/inmemoryblockdag/blockdag.go @@ -48,7 +48,7 @@ func NewProvider(opts ...options.Option[BlockDAG]) module.Provider[*engine.Engin e.Events.Filter.BlockPreAllowed.Hook(func(block *model.Block) { if _, _, err := b.Attach(block); err != nil { - b.errorHandler(ierrors.Wrapf(err, "failed to attach block with %s (issuerID: %s)", block.ID(), block.ProtocolBlock().IssuerID)) + b.errorHandler(ierrors.Wrapf(err, "failed to attach block with %s (issuerID: %s)", block.ID(), block.ProtocolBlock().Header.IssuerID)) } }, event.WithWorkerPool(wp)) @@ -188,7 +188,7 @@ func (b *BlockDAG) attach(data *model.Block) (block *blocks.Block, wasAttached b 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) - return false, ierrors.Errorf("block data with %s is too old (issued at: %s)", data.ID(), data.ProtocolBlock().IssuingTime) + return false, ierrors.Errorf("block data with %s is too old (issued at: %s)", data.ID(), data.ProtocolBlock().Header.IssuingTime) } storedBlock, storedBlockExists := b.blockCache.Block(data.ID()) diff --git a/pkg/protocol/engine/blocks/block.go b/pkg/protocol/engine/blocks/block.go index 33de43b2e..10df6cbb5 100644 --- a/pkg/protocol/engine/blocks/block.go +++ b/pkg/protocol/engine/blocks/block.go @@ -139,7 +139,7 @@ func NewMissingBlock(blockID iotago.BlockID) *Block { } } -func (b *Block) ProtocolBlock() *iotago.ProtocolBlock { +func (b *Block) ProtocolBlock() *iotago.Block { if b.modelBlock == nil { return nil } @@ -152,7 +152,7 @@ func (b *Block) Parents() (parents []iotago.BlockID) { } func (b *Block) StrongParents() (parents []iotago.BlockID) { - return b.modelBlock.ProtocolBlock().Block.StrongParentIDs() + return b.modelBlock.ProtocolBlock().Body.StrongParentIDs() } // ParentsWithType returns the parents of the block with their type. @@ -185,7 +185,7 @@ func (b *Block) SignedTransaction() (tx *iotago.SignedTransaction, hasTransactio return b.modelBlock.SignedTransaction() } -func (b *Block) BasicBlock() (basicBlock *iotago.BasicBlock, isBasicBlock bool) { +func (b *Block) BasicBlock() (basicBlock *iotago.BasicBlockBody, isBasicBlock bool) { if b.modelBlock == nil { return nil, false } @@ -193,7 +193,7 @@ func (b *Block) BasicBlock() (basicBlock *iotago.BasicBlock, isBasicBlock bool) return b.modelBlock.BasicBlock() } -func (b *Block) ValidationBlock() (validationBlock *iotago.ValidationBlock, isValidationBlock bool) { +func (b *Block) ValidationBlock() (validationBlock *iotago.ValidationBlockBody, isValidationBlock bool) { if b.modelBlock == nil { return nil, false } @@ -232,7 +232,7 @@ func (b *Block) IssuingTime() time.Time { return b.rootBlock.issuingTime } - return b.modelBlock.ProtocolBlock().IssuingTime + return b.modelBlock.ProtocolBlock().Header.IssuingTime } func (b *Block) SlotCommitmentID() iotago.CommitmentID { @@ -247,7 +247,7 @@ func (b *Block) SlotCommitmentID() iotago.CommitmentID { return b.rootBlock.commitmentID } - return b.modelBlock.ProtocolBlock().SlotCommitmentID + return b.modelBlock.ProtocolBlock().Header.SlotCommitmentID } // IsMissing returns a flag that indicates if the underlying Block data hasn't been stored, yet. diff --git a/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter.go b/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter.go index 2b0f878c9..a088c3d88 100644 --- a/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter.go +++ b/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter.go @@ -65,11 +65,11 @@ func (c *CommitmentFilter) ProcessPreFilteredBlock(block *blocks.Block) { func (c *CommitmentFilter) evaluateBlock(block *blocks.Block) { // check if the account exists in the specified slot. - accountData, exists, err := c.accountRetrieveFunc(block.ProtocolBlock().IssuerID, block.SlotCommitmentID().Slot()) + accountData, exists, err := c.accountRetrieveFunc(block.ProtocolBlock().Header.IssuerID, block.SlotCommitmentID().Slot()) if err != nil { c.events.BlockFiltered.Trigger(&commitmentfilter.BlockFilteredEvent{ Block: block, - Reason: ierrors.Join(iotago.ErrIssuerAccountNotFound, ierrors.Wrapf(err, "could not retrieve account information for block issuer %s", block.ProtocolBlock().IssuerID)), + Reason: ierrors.Join(iotago.ErrIssuerAccountNotFound, ierrors.Wrapf(err, "could not retrieve account information for block issuer %s", block.ProtocolBlock().Header.IssuerID)), }) return @@ -77,22 +77,22 @@ func (c *CommitmentFilter) evaluateBlock(block *blocks.Block) { if !exists { c.events.BlockFiltered.Trigger(&commitmentfilter.BlockFilteredEvent{ Block: block, - Reason: ierrors.Join(iotago.ErrIssuerAccountNotFound, ierrors.Errorf("block issuer account %s does not exist in slot commitment %s", block.ProtocolBlock().IssuerID, block.ProtocolBlock().SlotCommitmentID.Slot())), + Reason: ierrors.Join(iotago.ErrIssuerAccountNotFound, ierrors.Errorf("block issuer account %s does not exist in slot commitment %s", block.ProtocolBlock().Header.IssuerID, block.ProtocolBlock().Header.SlotCommitmentID.Slot())), }) return } // get the api for the block - blockAPI, err := c.apiProvider.APIForVersion(block.ProtocolBlock().BlockHeader.ProtocolVersion) + blockAPI, err := c.apiProvider.APIForVersion(block.ProtocolBlock().Header.ProtocolVersion) if err != nil { c.events.BlockFiltered.Trigger(&commitmentfilter.BlockFilteredEvent{ Block: block, - Reason: ierrors.Join(iotago.ErrBlockVersionInvalid, ierrors.Wrapf(err, "could not retrieve API for block version %d", block.ProtocolBlock().BlockHeader.ProtocolVersion)), + Reason: ierrors.Join(iotago.ErrBlockVersionInvalid, ierrors.Wrapf(err, "could not retrieve API for block version %d", block.ProtocolBlock().Header.ProtocolVersion)), }) } // check that the block burns sufficient Mana, use slot index of the commitment - rmcSlot := block.ProtocolBlock().SlotCommitmentID.Slot() + rmcSlot := block.ProtocolBlock().Header.SlotCommitmentID.Slot() rmc, err := c.rmcRetrieveFunc(rmcSlot) if err != nil { @@ -114,7 +114,7 @@ func (c *CommitmentFilter) evaluateBlock(block *blocks.Block) { if basicBlock.MaxBurnedMana < manaCost { c.events.BlockFiltered.Trigger(&commitmentfilter.BlockFilteredEvent{ Block: block, - Reason: ierrors.Join(iotago.ErrBurnedInsufficientMana, ierrors.Errorf("block issuer account %s burned insufficient Mana, required %d, burned %d", block.ProtocolBlock().IssuerID, manaCost, basicBlock.MaxBurnedMana)), + Reason: ierrors.Join(iotago.ErrBurnedInsufficientMana, ierrors.Errorf("block issuer account %s burned insufficient Mana, required %d, burned %d", block.ProtocolBlock().Header.IssuerID, manaCost, basicBlock.MaxBurnedMana)), }) return @@ -125,17 +125,17 @@ func (c *CommitmentFilter) evaluateBlock(block *blocks.Block) { if accountData.Credits.Value < 0 { c.events.BlockFiltered.Trigger(&commitmentfilter.BlockFilteredEvent{ Block: block, - Reason: ierrors.Wrapf(iotago.ErrNegativeBIC, "block issuer account %s is locked due to negative BIC", block.ProtocolBlock().IssuerID), + Reason: ierrors.Wrapf(iotago.ErrNegativeBIC, "block issuer account %s is locked due to negative BIC", block.ProtocolBlock().Header.IssuerID), }) return } // Check that the account is not expired - if accountData.ExpirySlot < block.ProtocolBlock().SlotCommitmentID.Slot() { + if accountData.ExpirySlot < block.ProtocolBlock().Header.SlotCommitmentID.Slot() { c.events.BlockFiltered.Trigger(&commitmentfilter.BlockFilteredEvent{ Block: block, - Reason: ierrors.Wrapf(iotago.ErrAccountExpired, "block issuer account %s is expired, expiry slot %d in commitment %d", block.ProtocolBlock().IssuerID, accountData.ExpirySlot, block.ProtocolBlock().SlotCommitmentID.Slot()), + Reason: ierrors.Wrapf(iotago.ErrAccountExpired, "block issuer account %s is expired, expiry slot %d in commitment %d", block.ProtocolBlock().Header.IssuerID, accountData.ExpirySlot, block.ProtocolBlock().Header.SlotCommitmentID.Slot()), }) return @@ -155,7 +155,7 @@ func (c *CommitmentFilter) evaluateBlock(block *blocks.Block) { if !isBikPubKeyHash || bikPubKeyHash.PublicKeyHash != iotago.Ed25519PublicKeyHashBlockIssuerKeyFromPublicKey(signature.PublicKey[:]).PublicKeyHash { c.events.BlockFiltered.Trigger(&commitmentfilter.BlockFilteredEvent{ Block: block, - Reason: ierrors.Wrapf(iotago.ErrInvalidSignature, "block issuer account %s does not have block issuer key corresponding to public key %s in slot %d", block.ProtocolBlock().IssuerID, signature.PublicKey, block.ProtocolBlock().SlotCommitmentID.Index()), + Reason: ierrors.Wrapf(iotago.ErrInvalidSignature, "block issuer account %s does not have block issuer key corresponding to public key %s in slot %d", block.ProtocolBlock().Header.IssuerID, signature.PublicKey, block.ProtocolBlock().Header.SlotCommitmentID.Index()), }) return diff --git a/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter_test.go b/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter_test.go index dfb7c02a6..127c5fb1c 100644 --- a/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter_test.go +++ b/pkg/protocol/engine/commitmentfilter/accountsfilter/commitmentfilter_test.go @@ -85,7 +85,7 @@ func (t *TestFramework) AddRMCData(slot iotago.SlotIndex, rmcData iotago.Mana) { // q: how to get an engine block.Block from protocol block -func (t *TestFramework) processBlock(alias string, block *iotago.ProtocolBlock) { +func (t *TestFramework) processBlock(alias string, block *iotago.Block) { modelBlock, err := model.BlockFromBlock(block) require.NoError(t.Test, err) diff --git a/pkg/protocol/engine/congestioncontrol/scheduler/drr/drrbuffer.go b/pkg/protocol/engine/congestioncontrol/scheduler/drr/drrbuffer.go index 0fa45bc4d..c283bbaba 100644 --- a/pkg/protocol/engine/congestioncontrol/scheduler/drr/drrbuffer.go +++ b/pkg/protocol/engine/congestioncontrol/scheduler/drr/drrbuffer.go @@ -147,7 +147,7 @@ func (b *BufferQueue) dropTail(quantumFunc func(iotago.AccountID) Deficit, maxBu // Unsubmit removes a block from the submitted blocks. // If that block is already marked as ready, Unsubmit has no effect. func (b *BufferQueue) Unsubmit(block *blocks.Block) bool { - issuerID := block.ProtocolBlock().IssuerID + issuerID := block.ProtocolBlock().Header.IssuerID issuerQueue := b.IssuerQueue(issuerID) if issuerQueue == nil { @@ -165,7 +165,7 @@ func (b *BufferQueue) Unsubmit(block *blocks.Block) bool { // Ready marks a previously submitted block as ready to be scheduled. func (b *BufferQueue) Ready(block *blocks.Block) bool { - issuerQueue := b.IssuerQueue(block.ProtocolBlock().IssuerID) + issuerQueue := b.IssuerQueue(block.ProtocolBlock().Header.IssuerID) if issuerQueue == nil { return false } diff --git a/pkg/protocol/engine/congestioncontrol/scheduler/drr/issuerqueue.go b/pkg/protocol/engine/congestioncontrol/scheduler/drr/issuerqueue.go index 6b26acbc5..80fc750b9 100644 --- a/pkg/protocol/engine/congestioncontrol/scheduler/drr/issuerqueue.go +++ b/pkg/protocol/engine/congestioncontrol/scheduler/drr/issuerqueue.go @@ -61,7 +61,7 @@ func (q *IssuerQueue) IssuerID() iotago.AccountID { // Submit submits a block for the queue. func (q *IssuerQueue) Submit(element *blocks.Block) bool { // this is just a debugging check, it will never happen in practice - if blkIssuerID := element.ProtocolBlock().IssuerID; q.issuerID != blkIssuerID { + if blkIssuerID := element.ProtocolBlock().Header.IssuerID; q.issuerID != blkIssuerID { panic(fmt.Sprintf("issuerqueue: queue issuer ID(%x) and issuer ID(%x) does not match.", q.issuerID, blkIssuerID)) } diff --git a/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go b/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go index 034ead081..d688c03c1 100644 --- a/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go +++ b/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go @@ -250,7 +250,7 @@ func (s *Scheduler) enqueueBasicBlock(block *blocks.Block) { slot := s.latestCommittedSlot() - issuerID := block.ProtocolBlock().IssuerID + issuerID := block.ProtocolBlock().Header.IssuerID issuerQueue, err := s.basicBuffer.GetIssuerQueue(issuerID) if err != nil { // this should only ever happen if the issuer has been removed due to insufficient Mana. @@ -296,9 +296,9 @@ func (s *Scheduler) enqueueValidationBlock(block *blocks.Block) { s.bufferMutex.Lock() defer s.bufferMutex.Unlock() - _, exists := s.validatorBuffer.Get(block.ProtocolBlock().IssuerID) + _, exists := s.validatorBuffer.Get(block.ProtocolBlock().Header.IssuerID) if !exists { - s.addValidator(block.ProtocolBlock().IssuerID) + s.addValidator(block.ProtocolBlock().Header.IssuerID) } droppedBlock, submitted := s.validatorBuffer.Submit(block, int(s.apiProvider.CommittedAPI().ProtocolParameters().CongestionControlParameters().MaxValidationBufferSize)) if !submitted { @@ -472,7 +472,7 @@ func (s *Scheduler) selectBasicBlockWithoutLocking() { // remove the block from the buffer and adjust issuer's deficit block := s.basicBuffer.PopFront() - issuerID := block.ProtocolBlock().IssuerID + issuerID := block.ProtocolBlock().Header.IssuerID err := s.updateDeficit(issuerID, -s.deficitFromWork(block.WorkScore())) if err != nil { @@ -508,7 +508,7 @@ func (s *Scheduler) selectIssuer(start *IssuerQueue, slot iotago.SlotIndex) (Def continue } - issuerID := block.ProtocolBlock().IssuerID + issuerID := block.ProtocolBlock().Header.IssuerID // compute how often the deficit needs to be incremented until the block can be scheduled deficit, exists := s.deficits.Get(issuerID) @@ -672,7 +672,7 @@ func (s *Scheduler) ready(block *blocks.Block) { } func (s *Scheduler) readyValidationBlock(block *blocks.Block) { - if validatorQueue, exists := s.validatorBuffer.Get(block.ProtocolBlock().IssuerID); exists { + if validatorQueue, exists := s.validatorBuffer.Get(block.ProtocolBlock().Header.IssuerID); exists { validatorQueue.Ready(block) } } diff --git a/pkg/protocol/engine/congestioncontrol/scheduler/drr/validatorqueue.go b/pkg/protocol/engine/congestioncontrol/scheduler/drr/validatorqueue.go index 8d2fd0aaf..900262b82 100644 --- a/pkg/protocol/engine/congestioncontrol/scheduler/drr/validatorqueue.go +++ b/pkg/protocol/engine/congestioncontrol/scheduler/drr/validatorqueue.go @@ -53,7 +53,7 @@ func (q *ValidatorQueue) AccountID() iotago.AccountID { } func (q *ValidatorQueue) Submit(block *blocks.Block, maxBuffer int) (*blocks.Block, bool) { - if blkAccountID := block.ProtocolBlock().IssuerID; q.accountID != blkAccountID { + if blkAccountID := block.ProtocolBlock().Header.IssuerID; q.accountID != blkAccountID { panic(fmt.Sprintf("issuerqueue: queue issuer ID(%x) and issuer ID(%x) does not match.", q.accountID, blkAccountID)) } @@ -202,7 +202,7 @@ func (b *ValidatorBuffer) Set(accountID iotago.AccountID, validatorQueue *Valida } func (b *ValidatorBuffer) Submit(block *blocks.Block, maxBuffer int) (*blocks.Block, bool) { - validatorQueue, exists := b.buffer.Get(block.ProtocolBlock().IssuerID) + validatorQueue, exists := b.buffer.Get(block.ProtocolBlock().Header.IssuerID) if !exists { return nil, false } diff --git a/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/gadget.go b/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/gadget.go index 9ee2becde..3e973f7c6 100644 --- a/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/gadget.go +++ b/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/gadget.go @@ -109,7 +109,7 @@ func (g *Gadget) isCommitteeValidationBlock(block *blocks.Block) (seat account.S } // Only accept blocks for issuers that are part of the committee. - return committee.GetSeat(block.ProtocolBlock().IssuerID) + return committee.GetSeat(block.ProtocolBlock().Header.IssuerID) } func anyChildInSet(block *blocks.Block, set ds.Set[iotago.BlockID]) bool { diff --git a/pkg/protocol/engine/consensus/slotgadget/totalweightslotgadget/gadget.go b/pkg/protocol/engine/consensus/slotgadget/totalweightslotgadget/gadget.go index ed1e4fae8..9dd33e104 100644 --- a/pkg/protocol/engine/consensus/slotgadget/totalweightslotgadget/gadget.go +++ b/pkg/protocol/engine/consensus/slotgadget/totalweightslotgadget/gadget.go @@ -99,7 +99,7 @@ func (g *Gadget) trackVotes(block *blocks.Block) { return slottracker.NewSlotTracker() }) - prevLatestSlot, latestSlot, updated := tracker.TrackVotes(block.SlotCommitmentID().Slot(), block.ProtocolBlock().IssuerID, g.lastFinalizedSlot) + prevLatestSlot, latestSlot, updated := tracker.TrackVotes(block.SlotCommitmentID().Slot(), block.ProtocolBlock().Header.IssuerID, g.lastFinalizedSlot) if !updated { return nil } diff --git a/pkg/protocol/engine/engine.go b/pkg/protocol/engine/engine.go index 1bb299aa8..1cee3527b 100644 --- a/pkg/protocol/engine/engine.go +++ b/pkg/protocol/engine/engine.go @@ -443,7 +443,7 @@ func (e *Engine) setupEvictionState() { e.errorHandler(ierrors.Errorf("cannot store root block (%s) because it is missing", parent.ID)) return } - e.EvictionState.AddRootBlock(parentBlock.ID(), parentBlock.ProtocolBlock().SlotCommitmentID) + e.EvictionState.AddRootBlock(parentBlock.ID(), parentBlock.ProtocolBlock().Header.SlotCommitmentID) } }) }, event.WithWorkerPool(wp)) diff --git a/pkg/protocol/engine/filter/blockfilter/filter.go b/pkg/protocol/engine/filter/blockfilter/filter.go index 0ed6900ec..77950c5c3 100644 --- a/pkg/protocol/engine/filter/blockfilter/filter.go +++ b/pkg/protocol/engine/filter/blockfilter/filter.go @@ -68,10 +68,10 @@ func New(apiProvider iotago.APIProvider, opts ...options.Option[Filter]) *Filter func (f *Filter) ProcessReceivedBlock(block *model.Block, source peer.ID) { // Verify the block's version corresponds to the protocol version for the slot. apiForSlot := f.apiProvider.APIForSlot(block.ID().Slot()) - if apiForSlot.Version() != block.ProtocolBlock().ProtocolVersion { + if apiForSlot.Version() != block.ProtocolBlock().Header.ProtocolVersion { f.events.BlockPreFiltered.Trigger(&filter.BlockPreFilteredEvent{ Block: block, - Reason: ierrors.Wrapf(ErrInvalidBlockVersion, "invalid protocol version %d (expected %d) for epoch %d", block.ProtocolBlock().ProtocolVersion, apiForSlot.Version(), apiForSlot.TimeProvider().EpochFromSlot(block.ID().Slot())), + Reason: ierrors.Wrapf(ErrInvalidBlockVersion, "invalid protocol version %d (expected %d) for epoch %d", block.ProtocolBlock().Header.ProtocolVersion, apiForSlot.Version(), apiForSlot.TimeProvider().EpochFromSlot(block.ID().Slot())), Source: source, }) @@ -79,7 +79,7 @@ func (f *Filter) ProcessReceivedBlock(block *model.Block, source peer.ID) { } // Verify the timestamp is not too far in the future. - timeDelta := time.Since(block.ProtocolBlock().IssuingTime) + timeDelta := time.Since(block.ProtocolBlock().Header.IssuingTime) if timeDelta < -f.optsMaxAllowedWallClockDrift { f.events.BlockPreFiltered.Trigger(&filter.BlockPreFilteredEvent{ Block: block, @@ -91,7 +91,7 @@ func (f *Filter) ProcessReceivedBlock(block *model.Block, source peer.ID) { } if _, isValidation := block.ValidationBlock(); isValidation { - blockSlot := block.ProtocolBlock().API.TimeProvider().SlotFromTime(block.ProtocolBlock().IssuingTime) + blockSlot := block.ProtocolBlock().API.TimeProvider().SlotFromTime(block.ProtocolBlock().Header.IssuingTime) committee, exists := f.committeeFunc(blockSlot) if !exists { f.events.BlockPreFiltered.Trigger(&filter.BlockPreFilteredEvent{ @@ -103,10 +103,10 @@ func (f *Filter) ProcessReceivedBlock(block *model.Block, source peer.ID) { return } - if !committee.HasAccount(block.ProtocolBlock().IssuerID) { + if !committee.HasAccount(block.ProtocolBlock().Header.IssuerID) { f.events.BlockPreFiltered.Trigger(&filter.BlockPreFilteredEvent{ Block: block, - Reason: ierrors.Wrapf(ErrValidatorNotInCommittee, "validation block issuer %s is not part of the committee for slot %d", block.ProtocolBlock().IssuerID, blockSlot), + Reason: ierrors.Wrapf(ErrValidatorNotInCommittee, "validation block issuer %s is not part of the committee for slot %d", block.ProtocolBlock().Header.IssuerID, blockSlot), Source: source, }) diff --git a/pkg/protocol/engine/filter/blockfilter/filter_test.go b/pkg/protocol/engine/filter/blockfilter/filter_test.go index 02646bb56..6f1b4bdc4 100644 --- a/pkg/protocol/engine/filter/blockfilter/filter_test.go +++ b/pkg/protocol/engine/filter/blockfilter/filter_test.go @@ -44,7 +44,7 @@ func NewTestFramework(t *testing.T, apiProvider iotago.APIProvider, optsFilter . return tf } -func (t *TestFramework) processBlock(alias string, block *iotago.ProtocolBlock) error { +func (t *TestFramework) processBlock(alias string, block *iotago.Block) error { modelBlock, err := model.BlockFromBlock(block, serix.WithValidation()) if err != nil { return err diff --git a/pkg/protocol/engine/ledger/ledger/ledger.go b/pkg/protocol/engine/ledger/ledger/ledger.go index a6c177204..31632f082 100644 --- a/pkg/protocol/engine/ledger/ledger/ledger.go +++ b/pkg/protocol/engine/ledger/ledger/ledger.go @@ -746,14 +746,14 @@ func (l *Ledger) resolveState(stateRef mempool.StateReference) *promise.Promise[ } func (l *Ledger) blockPreAccepted(block *blocks.Block) { - voteRank := ledger.NewBlockVoteRank(block.ID(), block.ProtocolBlock().IssuingTime) + voteRank := ledger.NewBlockVoteRank(block.ID(), block.ProtocolBlock().Header.IssuingTime) committee, exists := l.sybilProtection.SeatManager().CommitteeInSlot(block.ID().Slot()) if !exists { panic("committee should exist because we pre-accepted the block") } - seat, exists := committee.GetSeat(block.ProtocolBlock().IssuerID) + seat, exists := committee.GetSeat(block.ProtocolBlock().Header.IssuerID) if !exists { return } diff --git a/pkg/protocol/engine/upgrade/signalingupgradeorchestrator/orchestrator.go b/pkg/protocol/engine/upgrade/signalingupgradeorchestrator/orchestrator.go index 4e5ee6026..bca67f268 100644 --- a/pkg/protocol/engine/upgrade/signalingupgradeorchestrator/orchestrator.go +++ b/pkg/protocol/engine/upgrade/signalingupgradeorchestrator/orchestrator.go @@ -151,7 +151,7 @@ func (o *Orchestrator) TrackValidationBlock(block *blocks.Block) { return } - seat, exists := committee.GetSeat(block.ProtocolBlock().IssuerID) + seat, exists := committee.GetSeat(block.ProtocolBlock().Header.IssuerID) if !exists { return } diff --git a/pkg/protocol/sybilprotection/seatmanager/poa/poa.go b/pkg/protocol/sybilprotection/seatmanager/poa/poa.go index 8a0256e61..d73ce7191 100644 --- a/pkg/protocol/sybilprotection/seatmanager/poa/poa.go +++ b/pkg/protocol/sybilprotection/seatmanager/poa/poa.go @@ -66,9 +66,9 @@ func NewProvider(opts ...options.Option[SeatManager]) module.Provider[*engine.En panic(ierrors.Errorf("committee not selected for slot %d, but received block in that slot", block.ID().Slot())) } - seat, exists := committee.GetSeat(block.ProtocolBlock().IssuerID) + seat, exists := committee.GetSeat(block.ProtocolBlock().Header.IssuerID) if exists { - s.activityTracker.MarkSeatActive(seat, block.ProtocolBlock().IssuerID, block.IssuingTime()) + s.activityTracker.MarkSeatActive(seat, block.ProtocolBlock().Header.IssuerID, block.IssuingTime()) } s.events.BlockProcessed.Trigger(block) diff --git a/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers.go b/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers.go index 5d85f85bf..4d572c888 100644 --- a/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers.go +++ b/pkg/protocol/sybilprotection/seatmanager/topstakers/topstakers.go @@ -67,9 +67,9 @@ func NewProvider(opts ...options.Option[SeatManager]) module.Provider[*engine.En panic(ierrors.Errorf("committee not selected for slot %d, but received block in that slot", block.ID().Slot())) } - seat, exists := committee.GetSeat(block.ProtocolBlock().IssuerID) + seat, exists := committee.GetSeat(block.ProtocolBlock().Header.IssuerID) if exists { - s.activityTracker.MarkSeatActive(seat, block.ProtocolBlock().IssuerID, block.IssuingTime()) + s.activityTracker.MarkSeatActive(seat, block.ProtocolBlock().Header.IssuerID, block.IssuingTime()) } s.events.BlockProcessed.Trigger(block) diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/performance.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/performance.go index 37f061d5d..a798ff647 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/performance.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/performance.go @@ -64,9 +64,9 @@ func (t *Tracker) TrackValidationBlock(block *blocks.Block) { t.performanceFactorsMutex.Lock() defer t.performanceFactorsMutex.Unlock() - isCommitteeMember, err := t.isCommitteeMember(block.ID().Slot(), block.ProtocolBlock().IssuerID) + isCommitteeMember, err := t.isCommitteeMember(block.ID().Slot(), block.ProtocolBlock().Header.IssuerID) if err != nil { - t.errHandler(ierrors.Wrapf(err, "error while checking if account %s is a committee member in slot %d", block.ProtocolBlock().IssuerID, block.ID().Slot())) + t.errHandler(ierrors.Wrapf(err, "error while checking if account %s is a committee member in slot %d", block.ProtocolBlock().Header.IssuerID, block.ID().Slot())) return } @@ -87,7 +87,7 @@ func (t *Tracker) TrackCandidateBlock(block *blocks.Block) { } var rollback bool - t.nextEpochCommitteeCandidates.Compute(block.ProtocolBlock().IssuerID, func(currentValue iotago.SlotIndex, exists bool) iotago.SlotIndex { + t.nextEpochCommitteeCandidates.Compute(block.ProtocolBlock().Header.IssuerID, func(currentValue iotago.SlotIndex, exists bool) iotago.SlotIndex { if !exists || currentValue > block.ID().Slot() { committeeCandidatesStore, err := t.committeeCandidatesInEpochFunc(blockEpoch) if err != nil { @@ -100,7 +100,7 @@ func (t *Tracker) TrackCandidateBlock(block *blocks.Block) { return currentValue } - err = committeeCandidatesStore.Set(block.ProtocolBlock().IssuerID[:], block.ID().Slot().MustBytes()) + err = committeeCandidatesStore.Set(block.ProtocolBlock().Header.IssuerID[:], block.ID().Slot().MustBytes()) if err != nil { // if there is an error, and we don't register a candidate, then we might eventually create a different commitment t.errHandler(ierrors.Wrapf(err, "error while updating candidate activity for epoch %d", blockEpoch)) @@ -120,7 +120,7 @@ func (t *Tracker) TrackCandidateBlock(block *blocks.Block) { // if there was an error when computing the value, // and it was the first entry for the given issuer, then remove the entry if rollback { - t.nextEpochCommitteeCandidates.Delete(block.ProtocolBlock().IssuerID) + t.nextEpochCommitteeCandidates.Delete(block.ProtocolBlock().Header.IssuerID) } } @@ -313,7 +313,7 @@ func (t *Tracker) isCommitteeMember(slot iotago.SlotIndex, accountID iotago.Acco return committee.Has(accountID), nil } -func (t *Tracker) trackCommitteeMemberPerformance(validationBlock *iotago.ValidationBlock, block *blocks.Block) { +func (t *Tracker) trackCommitteeMemberPerformance(validationBlock *iotago.ValidationBlockBody, block *blocks.Block) { validatorPerformances, err := t.validatorPerformancesFunc(block.ID().Slot()) if err != nil { t.errHandler(ierrors.Errorf("failed to load performance factor for slot %s", block.ID().Slot())) @@ -321,9 +321,9 @@ func (t *Tracker) trackCommitteeMemberPerformance(validationBlock *iotago.Valida return } - validatorPerformance, err := validatorPerformances.Load(block.ProtocolBlock().IssuerID) + validatorPerformance, err := validatorPerformances.Load(block.ProtocolBlock().Header.IssuerID) if err != nil { - t.errHandler(ierrors.Errorf("failed to load performance factor for account %s", block.ProtocolBlock().IssuerID)) + t.errHandler(ierrors.Errorf("failed to load performance factor for account %s", block.ProtocolBlock().Header.IssuerID)) return } @@ -334,7 +334,7 @@ func (t *Tracker) trackCommitteeMemberPerformance(validationBlock *iotago.Valida } // set a bit at subslotIndex to 1 to indicate activity in that subslot - validatorPerformance.SlotActivityVector = validatorPerformance.SlotActivityVector | (1 << t.subslotIndex(block.ID().Slot(), block.ProtocolBlock().IssuingTime)) + validatorPerformance.SlotActivityVector = validatorPerformance.SlotActivityVector | (1 << t.subslotIndex(block.ID().Slot(), block.ProtocolBlock().Header.IssuingTime)) apiForSlot := t.apiProvider.APIForSlot(block.ID().Slot()) @@ -349,8 +349,8 @@ func (t *Tracker) trackCommitteeMemberPerformance(validationBlock *iotago.Valida Hash: validationBlock.ProtocolParametersHash, } - if err = validatorPerformances.Store(block.ProtocolBlock().IssuerID, validatorPerformance); err != nil { - t.errHandler(ierrors.Errorf("failed to store performance factor for account %s", block.ProtocolBlock().IssuerID)) + if err = validatorPerformances.Store(block.ProtocolBlock().Header.IssuerID, validatorPerformance); err != nil { + t.errHandler(ierrors.Errorf("failed to store performance factor for account %s", block.ProtocolBlock().Header.IssuerID)) } } diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go index 6615023d4..684e21916 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/testsuite_test.go @@ -289,14 +289,14 @@ func (t *TestSuite) applyPerformanceFactor(accountID iotago.AccountID, epoch iot for i := uint64(0); i < validationBlocksSentPerSlot; i++ { valBlock := tpkg.RandValidationBlock(t.api) - block := tpkg.RandProtocolBlock(valBlock, t.api, 10) - block.IssuerID = accountID + block := tpkg.RandBlock(valBlock, t.api, 10) + block.Header.IssuerID = accountID subslotIndex := i // issued more than one block in the same slot to reduce performance factor if i >= slotPerformanceFactor { subslotIndex = 0 } - block.IssuingTime = t.api.TimeProvider().SlotStartTime(slot).Add(time.Duration(subslotIndex)*subslotDur + 1*time.Nanosecond) + block.Header.IssuingTime = t.api.TimeProvider().SlotStartTime(slot).Add(time.Duration(subslotIndex)*subslotDur + 1*time.Nanosecond) modelBlock, err := model.BlockFromBlock(block) t.Instance.TrackValidationBlock(blocks.NewBlock(modelBlock)) require.NoError(t.T, err) diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/tracker_test.go b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/tracker_test.go index 49a1a95bf..1eddb125d 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/performance/tracker_test.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/performance/tracker_test.go @@ -96,20 +96,20 @@ func TestManager_Candidates(t *testing.T) { issuer2 := tpkg.RandAccountID() issuer3 := tpkg.RandAccountID() { - block1 := tpkg.RandProtocolBlock(tpkg.RandBasicBlock(ts.api, iotago.PayloadCandidacyAnnouncement), ts.api, 0) + block1 := tpkg.RandBlock(tpkg.RandBasicBlock(ts.api, iotago.PayloadCandidacyAnnouncement), ts.api, 0) - block1.IssuingTime = ts.api.TimeProvider().SlotStartTime(1) - block1.IssuerID = issuer1 + block1.Header.IssuingTime = ts.api.TimeProvider().SlotStartTime(1) + block1.Header.IssuerID = issuer1 - block2 := tpkg.RandProtocolBlock(tpkg.RandBasicBlock(ts.api, iotago.PayloadCandidacyAnnouncement), ts.api, 0) + block2 := tpkg.RandBlock(tpkg.RandBasicBlock(ts.api, iotago.PayloadCandidacyAnnouncement), ts.api, 0) - block2.IssuingTime = ts.api.TimeProvider().SlotStartTime(2) - block2.IssuerID = issuer2 + block2.Header.IssuingTime = ts.api.TimeProvider().SlotStartTime(2) + block2.Header.IssuerID = issuer2 - block3 := tpkg.RandProtocolBlock(tpkg.RandBasicBlock(ts.api, iotago.PayloadCandidacyAnnouncement), ts.api, 0) + block3 := tpkg.RandBlock(tpkg.RandBasicBlock(ts.api, iotago.PayloadCandidacyAnnouncement), ts.api, 0) - block3.IssuingTime = ts.api.TimeProvider().SlotStartTime(3) - block3.IssuerID = issuer3 + block3.Header.IssuingTime = ts.api.TimeProvider().SlotStartTime(3) + block3.Header.IssuerID = issuer3 ts.Instance.TrackCandidateBlock(blocks.NewBlock(lo.PanicOnErr(model.BlockFromBlock(block1)))) ts.Instance.TrackCandidateBlock(blocks.NewBlock(lo.PanicOnErr(model.BlockFromBlock(block2)))) @@ -117,19 +117,19 @@ func TestManager_Candidates(t *testing.T) { } { - block4 := tpkg.RandProtocolBlock(tpkg.RandBasicBlock(ts.api, iotago.PayloadCandidacyAnnouncement), ts.api, 0) - block4.IssuingTime = ts.api.TimeProvider().SlotStartTime(4) - block4.IssuerID = issuer1 + block4 := tpkg.RandBlock(tpkg.RandBasicBlock(ts.api, iotago.PayloadCandidacyAnnouncement), ts.api, 0) + block4.Header.IssuingTime = ts.api.TimeProvider().SlotStartTime(4) + block4.Header.IssuerID = issuer1 - block5 := tpkg.RandProtocolBlock(tpkg.RandBasicBlock(ts.api, iotago.PayloadCandidacyAnnouncement), ts.api, 0) + block5 := tpkg.RandBlock(tpkg.RandBasicBlock(ts.api, iotago.PayloadCandidacyAnnouncement), ts.api, 0) - block5.IssuingTime = ts.api.TimeProvider().SlotStartTime(5) - block5.IssuerID = issuer2 + block5.Header.IssuingTime = ts.api.TimeProvider().SlotStartTime(5) + block5.Header.IssuerID = issuer2 - block6 := tpkg.RandProtocolBlock(tpkg.RandBasicBlock(ts.api, iotago.PayloadCandidacyAnnouncement), ts.api, 0) + block6 := tpkg.RandBlock(tpkg.RandBasicBlock(ts.api, iotago.PayloadCandidacyAnnouncement), ts.api, 0) - block6.IssuingTime = ts.api.TimeProvider().SlotStartTime(6) - block6.IssuerID = issuer3 + block6.Header.IssuingTime = ts.api.TimeProvider().SlotStartTime(6) + block6.Header.IssuerID = issuer3 ts.Instance.TrackCandidateBlock(blocks.NewBlock(lo.PanicOnErr(model.BlockFromBlock(block4)))) ts.Instance.TrackCandidateBlock(blocks.NewBlock(lo.PanicOnErr(model.BlockFromBlock(block5)))) diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go b/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go index 1e15ec4e2..2ebd75b0c 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go @@ -106,9 +106,9 @@ func (o *SybilProtection) TrackBlock(block *blocks.Block) { return } - accountData, exists, err := o.ledger.Account(block.ProtocolBlock().IssuerID, block.SlotCommitmentID().Slot()) + accountData, exists, err := o.ledger.Account(block.ProtocolBlock().Header.IssuerID, block.SlotCommitmentID().Slot()) if err != nil { - o.errHandler(ierrors.Wrapf(err, "error while retrieving account from account %s in slot %d from accounts ledger", block.ProtocolBlock().IssuerID, block.SlotCommitmentID().Slot())) + o.errHandler(ierrors.Wrapf(err, "error while retrieving account from account %s in slot %d from accounts ledger", block.ProtocolBlock().Header.IssuerID, block.SlotCommitmentID().Slot())) return } diff --git a/pkg/storage/testframework_test.go b/pkg/storage/testframework_test.go index c88a32ff2..290f180dd 100644 --- a/pkg/storage/testframework_test.go +++ b/pkg/storage/testframework_test.go @@ -90,7 +90,7 @@ func (t *TestFramework) GeneratePrunableData(epoch iotago.EpochIndex, size int64 endSlot := apiForEpoch.TimeProvider().EpochEnd(epoch) var createdBytes int64 for createdBytes < size { - block := tpkg.RandProtocolBlock(&iotago.BasicBlock{ + block := tpkg.RandBlock(&iotago.BasicBlockBody{ StrongParents: tpkg.SortedRandBlockIDs(1 + rand.Intn(iotago.BlockMaxParents)), Payload: &iotago.TaggedData{Data: make([]byte, 8192)}, MaxBurnedMana: 1000, diff --git a/pkg/testsuite/mock/blockissuer.go b/pkg/testsuite/mock/blockissuer.go index 527bcff19..9d7e26793 100644 --- a/pkg/testsuite/mock/blockissuer.go +++ b/pkg/testsuite/mock/blockissuer.go @@ -188,7 +188,7 @@ func (i *BlockIssuer) IssueValidationBlock(ctx context.Context, alias string, no validationBlock, _ := block.ValidationBlock() - fmt.Printf("Issued ValidationBlock: %s - slot %d - commitment %s %d - latest finalized slot %d - version: %d - highestSupportedVersion: %d, hash: %s\n", block.ID(), block.ID().Slot(), block.SlotCommitmentID(), block.SlotCommitmentID().Slot(), block.ProtocolBlock().LatestFinalizedSlot, block.ProtocolBlock().ProtocolVersion, validationBlock.HighestSupportedVersion, validationBlock.ProtocolParametersHash) + fmt.Printf("Issued ValidationBlock: %s - slot %d - commitment %s %d - latest finalized slot %d - version: %d - highestSupportedVersion: %d, hash: %s\n", block.ID(), block.ID().Slot(), block.SlotCommitmentID(), block.SlotCommitmentID().Slot(), block.ProtocolBlock().Header.LatestFinalizedSlot, block.ProtocolBlock().Header.ProtocolVersion, validationBlock.HighestSupportedVersion, validationBlock.ProtocolParametersHash) return block } @@ -283,7 +283,7 @@ func (i *BlockIssuer) IssueBasicBlock(ctx context.Context, alias string, node *N require.NoErrorf(i.Testing, i.IssueBlock(block.ModelBlock(), node), "%s > failed to issue block with alias %s", i.Name, alias) - fmt.Printf("%s > Issued block: %s - slot %d - commitment %s %d - latest finalized slot %d\n", i.Name, block.ID(), block.ID().Slot(), block.SlotCommitmentID(), block.SlotCommitmentID().Slot(), block.ProtocolBlock().LatestFinalizedSlot) + fmt.Printf("%s > Issued block: %s - slot %d - commitment %s %d - latest finalized slot %d\n", i.Name, block.ID(), block.ID().Slot(), block.SlotCommitmentID(), block.SlotCommitmentID().Slot(), block.ProtocolBlock().Header.LatestFinalizedSlot) return block } @@ -361,30 +361,30 @@ func (i *BlockIssuer) IssueBlockAndAwaitEvent(ctx context.Context, block *model. } } -func (i *BlockIssuer) AttachBlock(ctx context.Context, iotaBlock *iotago.ProtocolBlock, node *Node, optIssuerAccount ...Account) (iotago.BlockID, error) { +func (i *BlockIssuer) AttachBlock(ctx context.Context, iotaBlock *iotago.Block, node *Node, optIssuerAccount ...Account) (iotago.BlockID, error) { // if anything changes, need to make a new signature var resign bool - apiForVersion, err := node.Protocol.APIForVersion(iotaBlock.ProtocolVersion) + apiForVersion, err := node.Protocol.APIForVersion(iotaBlock.Header.ProtocolVersion) if err != nil { - return iotago.EmptyBlockID, ierrors.Wrapf(ErrBlockAttacherInvalidBlock, "protocolVersion invalid: %d", iotaBlock.ProtocolVersion) + return iotago.EmptyBlockID, ierrors.Wrapf(ErrBlockAttacherInvalidBlock, "protocolVersion invalid: %d", iotaBlock.Header.ProtocolVersion) } protoParams := apiForVersion.ProtocolParameters() - if iotaBlock.NetworkID == 0 { - iotaBlock.NetworkID = protoParams.NetworkID() + if iotaBlock.Header.NetworkID == 0 { + iotaBlock.Header.NetworkID = protoParams.NetworkID() resign = true } - if iotaBlock.SlotCommitmentID == iotago.EmptyCommitmentID { - iotaBlock.SlotCommitmentID = node.Protocol.MainEngineInstance().Storage.Settings().LatestCommitment().Commitment().MustID() - iotaBlock.LatestFinalizedSlot = node.Protocol.MainEngineInstance().Storage.Settings().LatestFinalizedSlot() + if iotaBlock.Header.SlotCommitmentID == iotago.EmptyCommitmentID { + iotaBlock.Header.SlotCommitmentID = node.Protocol.MainEngineInstance().Storage.Settings().LatestCommitment().Commitment().MustID() + iotaBlock.Header.LatestFinalizedSlot = node.Protocol.MainEngineInstance().Storage.Settings().LatestFinalizedSlot() resign = true } - switch innerBlock := iotaBlock.Block.(type) { - case *iotago.BasicBlock: + switch innerBlock := iotaBlock.Body.(type) { + case *iotago.BasicBlockBody: switch payload := innerBlock.Payload.(type) { case *iotago.SignedTransaction: if payload.Transaction.NetworkID != protoParams.NetworkID() { @@ -404,7 +404,7 @@ func (i *BlockIssuer) AttachBlock(ctx context.Context, iotaBlock *iotago.Protoco resign = true } - case *iotago.ValidationBlock: + case *iotago.ValidationBlockBody: //nolint:revive,staticcheck //temporarily disable if len(iotaBlock.Parents()) == 0 { // TODO: implement tipselection for validator blocks @@ -412,20 +412,20 @@ func (i *BlockIssuer) AttachBlock(ctx context.Context, iotaBlock *iotago.Protoco } references := make(model.ParentReferences) - references[iotago.StrongParentType] = iotaBlock.Block.StrongParentIDs().RemoveDupsAndSort() - references[iotago.WeakParentType] = iotaBlock.Block.WeakParentIDs().RemoveDupsAndSort() - references[iotago.ShallowLikeParentType] = iotaBlock.Block.ShallowLikeParentIDs().RemoveDupsAndSort() - if iotaBlock.IssuingTime.Equal(time.Unix(0, 0)) { - iotaBlock.IssuingTime = time.Now().UTC() + references[iotago.StrongParentType] = iotaBlock.Body.StrongParentIDs().RemoveDupsAndSort() + references[iotago.WeakParentType] = iotaBlock.Body.WeakParentIDs().RemoveDupsAndSort() + references[iotago.ShallowLikeParentType] = iotaBlock.Body.ShallowLikeParentIDs().RemoveDupsAndSort() + if iotaBlock.Header.IssuingTime.Equal(time.Unix(0, 0)) { + iotaBlock.Header.IssuingTime = time.Now().UTC() resign = true } - if err = i.validateReferences(iotaBlock.IssuingTime, iotaBlock.SlotCommitmentID.Slot(), references, node); err != nil { + if err = i.validateReferences(iotaBlock.Header.IssuingTime, iotaBlock.Header.SlotCommitmentID.Slot(), references, node); err != nil { return iotago.EmptyBlockID, ierrors.Wrapf(ErrBlockAttacherAttachingNotPossible, "invalid block references, error: %w", err) } - if basicBlock, isBasicBlock := iotaBlock.Block.(*iotago.BasicBlock); isBasicBlock && basicBlock.MaxBurnedMana == 0 { - rmcSlot, err := safemath.SafeSub(apiForVersion.TimeProvider().SlotFromTime(iotaBlock.IssuingTime), apiForVersion.ProtocolParameters().MaxCommittableAge()) + if basicBlock, isBasicBlock := iotaBlock.Body.(*iotago.BasicBlockBody); isBasicBlock && basicBlock.MaxBurnedMana == 0 { + rmcSlot, err := safemath.SafeSub(apiForVersion.TimeProvider().SlotFromTime(iotaBlock.Header.IssuingTime), apiForVersion.ProtocolParameters().MaxCommittableAge()) if err != nil { rmcSlot = 0 } @@ -442,10 +442,10 @@ func (i *BlockIssuer) AttachBlock(ctx context.Context, iotaBlock *iotago.Protoco resign = true } - if iotaBlock.IssuerID.Empty() || resign { + if iotaBlock.Header.IssuerID.Empty() || resign { if i.optsIncompleteBlockAccepted && len(optIssuerAccount) > 0 { issuerAccount := optIssuerAccount[0] - iotaBlock.IssuerID = issuerAccount.ID() + iotaBlock.Header.IssuerID = issuerAccount.ID() signature, signatureErr := iotaBlock.Sign(iotago.NewAddressKeysForEd25519Address(issuerAccount.Address().(*iotago.Ed25519Address), issuerAccount.PrivateKey())) if signatureErr != nil { @@ -468,7 +468,7 @@ func (i *BlockIssuer) AttachBlock(ctx context.Context, iotaBlock *iotago.Protoco return iotago.EmptyBlockID, ierrors.Wrap(err, "error serializing block to model block") } - if !i.optsRateSetterEnabled || node.Protocol.MainEngineInstance().Scheduler.IsBlockIssuerReady(modelBlock.ProtocolBlock().IssuerID) { + if !i.optsRateSetterEnabled || node.Protocol.MainEngineInstance().Scheduler.IsBlockIssuerReady(modelBlock.ProtocolBlock().Header.IssuerID) { i.events.BlockConstructed.Trigger(modelBlock) if err = i.IssueBlockAndAwaitEvent(ctx, modelBlock, node, node.Protocol.Events.Engine.BlockDAG.BlockAttached); err != nil { diff --git a/pkg/testsuite/mock/node.go b/pkg/testsuite/mock/node.go index afca4da93..229a9ecdf 100644 --- a/pkg/testsuite/mock/node.go +++ b/pkg/testsuite/mock/node.go @@ -354,19 +354,19 @@ func (n *Node) attachEngineLogsWithName(failOnBlockFiltered bool, instance *engi }) events.BlockGadget.BlockPreAccepted.Hook(func(block *blocks.Block) { - fmt.Printf("%s > [%s] Consensus.BlockGadget.BlockPreAccepted: %s %s\n", n.Name, engineName, block.ID(), block.ProtocolBlock().SlotCommitmentID) + fmt.Printf("%s > [%s] Consensus.BlockGadget.BlockPreAccepted: %s %s\n", n.Name, engineName, block.ID(), block.ProtocolBlock().Header.SlotCommitmentID) }) events.BlockGadget.BlockAccepted.Hook(func(block *blocks.Block) { - fmt.Printf("%s > [%s] Consensus.BlockGadget.BlockAccepted: %s @ slot %s committing to %s\n", n.Name, engineName, block.ID(), block.ID().Slot(), block.ProtocolBlock().SlotCommitmentID) + fmt.Printf("%s > [%s] Consensus.BlockGadget.BlockAccepted: %s @ slot %s committing to %s\n", n.Name, engineName, block.ID(), block.ID().Slot(), block.ProtocolBlock().Header.SlotCommitmentID) }) events.BlockGadget.BlockPreConfirmed.Hook(func(block *blocks.Block) { - fmt.Printf("%s > [%s] Consensus.BlockGadget.BlockPreConfirmed: %s %s\n", n.Name, engineName, block.ID(), block.ProtocolBlock().SlotCommitmentID) + fmt.Printf("%s > [%s] Consensus.BlockGadget.BlockPreConfirmed: %s %s\n", n.Name, engineName, block.ID(), block.ProtocolBlock().Header.SlotCommitmentID) }) events.BlockGadget.BlockConfirmed.Hook(func(block *blocks.Block) { - fmt.Printf("%s > [%s] Consensus.BlockGadget.BlockConfirmed: %s %s\n", n.Name, engineName, block.ID(), block.ProtocolBlock().SlotCommitmentID) + fmt.Printf("%s > [%s] Consensus.BlockGadget.BlockConfirmed: %s %s\n", n.Name, engineName, block.ID(), block.ProtocolBlock().Header.SlotCommitmentID) }) events.SlotGadget.SlotFinalized.Hook(func(slot iotago.SlotIndex) { diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index 554b4ebab..0fa7e6386 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -59,21 +59,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-20231020115340-13da292c580b // indirect - github.com/iotaledger/hive.go/constraints v0.0.0-20231020115340-13da292c580b // indirect + github.com/iotaledger/hive.go/constraints v0.0.0-20231027195901-620bd7470e42 // indirect github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231020115340-13da292c580b // indirect - github.com/iotaledger/hive.go/crypto v0.0.0-20231020115340-13da292c580b // indirect + github.com/iotaledger/hive.go/crypto v0.0.0-20231027195901-620bd7470e42 // indirect github.com/iotaledger/hive.go/ds v0.0.0-20231020115340-13da292c580b // indirect - github.com/iotaledger/hive.go/ierrors v0.0.0-20231020115340-13da292c580b // indirect + github.com/iotaledger/hive.go/ierrors v0.0.0-20231027195901-620bd7470e42 // indirect github.com/iotaledger/hive.go/kvstore v0.0.0-20231020115340-13da292c580b // indirect - github.com/iotaledger/hive.go/lo v0.0.0-20231020115340-13da292c580b // indirect + github.com/iotaledger/hive.go/lo v0.0.0-20231027195901-620bd7470e42 // indirect github.com/iotaledger/hive.go/log v0.0.0-20231020115340-13da292c580b // indirect github.com/iotaledger/hive.go/logger v0.0.0-20231020115340-13da292c580b // indirect - github.com/iotaledger/hive.go/runtime v0.0.0-20231020115340-13da292c580b // indirect + github.com/iotaledger/hive.go/runtime v0.0.0-20231027195901-620bd7470e42 // indirect github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231020115340-13da292c580b // indirect - github.com/iotaledger/hive.go/stringify v0.0.0-20231020115340-13da292c580b // indirect - github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231026154618-820b8eaed2cc // indirect - github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231026154523-9ee0c47a283a // indirect - github.com/iotaledger/iota.go/v4 v4.0.0-20231026154111-efd63ff4f03d // indirect + github.com/iotaledger/hive.go/stringify v0.0.0-20231027195901-620bd7470e42 // indirect + github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231028104239-869296c43f26 // indirect + github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231028104044-69b02af0058d // indirect + github.com/iotaledger/iota.go/v4 v4.0.0-20231028103644-b834fd54b02a // indirect github.com/ipfs/boxo v0.13.1 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect diff --git a/tools/gendoc/go.sum b/tools/gendoc/go.sum index b5bc4c338..955217c98 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -285,36 +285,36 @@ github.com/iotaledger/hive.go/app v0.0.0-20231020115340-13da292c580b h1:mX3NXaTM github.com/iotaledger/hive.go/app v0.0.0-20231020115340-13da292c580b/go.mod h1:8ZbIKR84oQd/3iQ5eeT7xpudO9/ytzXP7veIYnk7Orc= 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-20231020115340-13da292c580b h1:HF4e0wz0JMIT4m3saqdQ//T9nWHV9d5sLMtEwNDuykM= -github.com/iotaledger/hive.go/constraints v0.0.0-20231020115340-13da292c580b/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/constraints v0.0.0-20231027195901-620bd7470e42 h1:drmpgLlJy7kZ09Dt1qKSnbILU+27Qu2jp4VdPDNwbFk= +github.com/iotaledger/hive.go/constraints v0.0.0-20231027195901-620bd7470e42/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231020115340-13da292c580b h1:ZERXxhQBUBV1AqTE6cUI4vTxSx4JrnsMuLZFgj32xLM= github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231020115340-13da292c580b/go.mod h1:Mc+ACqBGPxrPMIPUBOm6/HL0J6m0iVMwjtIEKW3uow8= -github.com/iotaledger/hive.go/crypto v0.0.0-20231020115340-13da292c580b h1:ZUUqRRO6XnQmVcXlXyx07vqySn28+bln6jp9KagYCjY= -github.com/iotaledger/hive.go/crypto v0.0.0-20231020115340-13da292c580b/go.mod h1:h3o6okvMSEK3KOX6pOp3yq1h9ohTkTfo6X8MzEadeb0= +github.com/iotaledger/hive.go/crypto v0.0.0-20231027195901-620bd7470e42 h1:r8TkdQJB7/bJd8cF8z5GQ+rX/7JpbPdPoN7wMoV1OCM= +github.com/iotaledger/hive.go/crypto v0.0.0-20231027195901-620bd7470e42/go.mod h1:h3o6okvMSEK3KOX6pOp3yq1h9ohTkTfo6X8MzEadeb0= github.com/iotaledger/hive.go/ds v0.0.0-20231020115340-13da292c580b h1:8b2sH+2Vf0y5BDYTMwKa09iQr3JF9JrzTI64DkXb+9U= github.com/iotaledger/hive.go/ds v0.0.0-20231020115340-13da292c580b/go.mod h1:3XkUSKfHaVxGbT0XAvjNlVYqPzhfLTGhDtdNA5UBPco= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231020115340-13da292c580b h1:JJPnr231djUTgTnE4oGz847WE9VA7Py6E6fgZwT5TQo= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231020115340-13da292c580b/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231027195901-620bd7470e42 h1:QMxd32Y/veVhTDPCiOFgetjUbG7sr9MryF29/rSPkMA= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231027195901-620bd7470e42/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= github.com/iotaledger/hive.go/kvstore v0.0.0-20231020115340-13da292c580b h1:LusmtjpfG/q8lc15Fp9W3kABbN3tArKx/zw2ibdY1DU= github.com/iotaledger/hive.go/kvstore v0.0.0-20231020115340-13da292c580b/go.mod h1:O/U3jtiUDeqqM0MZQFu2UPqS9fUm0C5hNISxlmg/thE= -github.com/iotaledger/hive.go/lo v0.0.0-20231020115340-13da292c580b h1:UvFWI8wQJS/XQOeWHpPsaFVeS2nxJ7nIGFr+IFjrnVw= -github.com/iotaledger/hive.go/lo v0.0.0-20231020115340-13da292c580b/go.mod h1:s4kzx9QY1MVWHJralj+3q5kI0eARtrJhphYD/iBbPfo= +github.com/iotaledger/hive.go/lo v0.0.0-20231027195901-620bd7470e42 h1:AvNLzONVMspwx7nD/NyYUgb5Hi7/zgzIOegr1uRD/M8= +github.com/iotaledger/hive.go/lo v0.0.0-20231027195901-620bd7470e42/go.mod h1:s4kzx9QY1MVWHJralj+3q5kI0eARtrJhphYD/iBbPfo= github.com/iotaledger/hive.go/log v0.0.0-20231020115340-13da292c580b h1:IwhoeOeRu25mBdrimuOOvbbhHYX0QipibV69ubn8nX0= github.com/iotaledger/hive.go/log v0.0.0-20231020115340-13da292c580b/go.mod h1:JvokzmpmFZPDskMlUqqjgHtD8usVJU4nAY/TNMGge8M= github.com/iotaledger/hive.go/logger v0.0.0-20231020115340-13da292c580b h1:EhVgAU/f2J3VYZwP60dRdyfAeDU3c/gBzX9blKtQGKA= github.com/iotaledger/hive.go/logger v0.0.0-20231020115340-13da292c580b/go.mod h1:aBfAfIB2GO/IblhYt5ipCbyeL9bXSNeAwtYVA3hZaHg= -github.com/iotaledger/hive.go/runtime v0.0.0-20231020115340-13da292c580b h1:O68POYIqBLnoHN+HIszc58QwAI2qocYq0WKGfVrXmMg= -github.com/iotaledger/hive.go/runtime v0.0.0-20231020115340-13da292c580b/go.mod h1:jRw8yFipiPaqmTPHh7hTcxAP9u6pjRGpByS3REJKkbY= +github.com/iotaledger/hive.go/runtime v0.0.0-20231027195901-620bd7470e42 h1:1QMJ39qXIx/IZVzus3+97IV7Pa++e+d340TvbMjhiBU= +github.com/iotaledger/hive.go/runtime v0.0.0-20231027195901-620bd7470e42/go.mod h1:jRw8yFipiPaqmTPHh7hTcxAP9u6pjRGpByS3REJKkbY= github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231020115340-13da292c580b h1:zaXZn9yV/95SRDkgCZQeBbSbmcJTKSZbCB7oBd71Qwg= github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231020115340-13da292c580b/go.mod h1:SdK26z8/VhWtxaqCuQrufm80SELgowQPmu9T/8eUQ8g= -github.com/iotaledger/hive.go/stringify v0.0.0-20231020115340-13da292c580b h1:MDZhTZTVDiydXcW5j4TA7HixVCyAdToIMPhHfJee7cE= -github.com/iotaledger/hive.go/stringify v0.0.0-20231020115340-13da292c580b/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231026154618-820b8eaed2cc h1:Foz7Q1vNh0Ts+YTEODHO3LSKVGM/uNV3RqbBJS6u7yA= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231026154618-820b8eaed2cc/go.mod h1:gaQbe/L+wjjUeQj5N8+o/XdZnSosFmDQfxmfyrK05hc= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231026154523-9ee0c47a283a h1:8JbC44pNud1rT091fJA4bDC+35MozksapuCXf8M1kmg= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231026154523-9ee0c47a283a/go.mod h1:iXG/tO+GQZQzgIUyITnQDigb6Ny1wSueHFIYne4HBkc= -github.com/iotaledger/iota.go/v4 v4.0.0-20231026154111-efd63ff4f03d h1:gcJz0J3xFELIPT7y4xqW+q25oOcK6QMlxNnrfFu8srA= -github.com/iotaledger/iota.go/v4 v4.0.0-20231026154111-efd63ff4f03d/go.mod h1:jqbLYq4a/FwuiPBqFfkAwwxU8vs3+kReRq2/tyX5qRA= +github.com/iotaledger/hive.go/stringify v0.0.0-20231027195901-620bd7470e42 h1:OlDhgvJ48bZxcvTeebJ1b96xtNnJAddejd2Q4rlH1mU= +github.com/iotaledger/hive.go/stringify v0.0.0-20231027195901-620bd7470e42/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231028104239-869296c43f26 h1:ZZs7IzdxrogQWGF1HfUUfR3KW8WhfxE4hUbfwZCDXFY= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231028104239-869296c43f26/go.mod h1:aFS0dN6QgKGgZakGgEv57NOLw+pLGdEiGcfDZ3h9GL0= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231028104044-69b02af0058d h1:0SVvkN04C+Ylc2puM/c77HuvRMmHRl0BkNjlZx1YWeA= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231028104044-69b02af0058d/go.mod h1:WFa5hHen6fi3RBX4K6r4fzhGpoh+7KJVIyFztZHdM84= +github.com/iotaledger/iota.go/v4 v4.0.0-20231028103644-b834fd54b02a h1:WLW4iaJAx4N9Pujv+gzHklnnjCt5MPrtXyVcK3UXdNc= +github.com/iotaledger/iota.go/v4 v4.0.0-20231028103644-b834fd54b02a/go.mod h1:jqbLYq4a/FwuiPBqFfkAwwxU8vs3+kReRq2/tyX5qRA= github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= diff --git a/tools/genesis-snapshot/go.mod b/tools/genesis-snapshot/go.mod index 4a1a2b7ab..aaab649cb 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-20231020115340-13da292c580b - github.com/iotaledger/hive.go/ierrors v0.0.0-20231020115340-13da292c580b - github.com/iotaledger/hive.go/lo v0.0.0-20231020115340-13da292c580b - github.com/iotaledger/hive.go/runtime v0.0.0-20231020115340-13da292c580b + github.com/iotaledger/hive.go/crypto v0.0.0-20231027195901-620bd7470e42 + github.com/iotaledger/hive.go/ierrors v0.0.0-20231027195901-620bd7470e42 + github.com/iotaledger/hive.go/lo v0.0.0-20231027195901-620bd7470e42 + github.com/iotaledger/hive.go/runtime v0.0.0-20231027195901-620bd7470e42 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20231026154111-efd63ff4f03d + github.com/iotaledger/iota.go/v4 v4.0.0-20231028103644-b834fd54b02a github.com/mr-tron/base58 v1.2.0 github.com/spf13/pflag v1.0.5 golang.org/x/crypto v0.14.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-20231020115340-13da292c580b // indirect - github.com/iotaledger/hive.go/constraints v0.0.0-20231020115340-13da292c580b // indirect + github.com/iotaledger/hive.go/constraints v0.0.0-20231027195901-620bd7470e42 // indirect github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231020115340-13da292c580b // indirect github.com/iotaledger/hive.go/ds v0.0.0-20231020115340-13da292c580b // indirect github.com/iotaledger/hive.go/kvstore v0.0.0-20231020115340-13da292c580b // indirect github.com/iotaledger/hive.go/log v0.0.0-20231020115340-13da292c580b // indirect github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231020115340-13da292c580b // indirect - github.com/iotaledger/hive.go/stringify v0.0.0-20231020115340-13da292c580b // indirect + github.com/iotaledger/hive.go/stringify v0.0.0-20231027195901-620bd7470e42 // 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 1d01d2de8..3dbf42773 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-20231020115340-13da292c580b h1:D68khiAFb9DwTvjZc2nc4R0E6wUdKyYCUXkmdaMzuoQ= github.com/iotaledger/hive.go/ads v0.0.0-20231020115340-13da292c580b/go.mod h1:IFh0gDfeMgZtfCo+5afK59IDR4xXh+cTR9YtLnZPcbY= -github.com/iotaledger/hive.go/constraints v0.0.0-20231020115340-13da292c580b h1:HF4e0wz0JMIT4m3saqdQ//T9nWHV9d5sLMtEwNDuykM= -github.com/iotaledger/hive.go/constraints v0.0.0-20231020115340-13da292c580b/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= +github.com/iotaledger/hive.go/constraints v0.0.0-20231027195901-620bd7470e42 h1:drmpgLlJy7kZ09Dt1qKSnbILU+27Qu2jp4VdPDNwbFk= +github.com/iotaledger/hive.go/constraints v0.0.0-20231027195901-620bd7470e42/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s= github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231020115340-13da292c580b h1:ZERXxhQBUBV1AqTE6cUI4vTxSx4JrnsMuLZFgj32xLM= github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231020115340-13da292c580b/go.mod h1:Mc+ACqBGPxrPMIPUBOm6/HL0J6m0iVMwjtIEKW3uow8= -github.com/iotaledger/hive.go/crypto v0.0.0-20231020115340-13da292c580b h1:ZUUqRRO6XnQmVcXlXyx07vqySn28+bln6jp9KagYCjY= -github.com/iotaledger/hive.go/crypto v0.0.0-20231020115340-13da292c580b/go.mod h1:h3o6okvMSEK3KOX6pOp3yq1h9ohTkTfo6X8MzEadeb0= +github.com/iotaledger/hive.go/crypto v0.0.0-20231027195901-620bd7470e42 h1:r8TkdQJB7/bJd8cF8z5GQ+rX/7JpbPdPoN7wMoV1OCM= +github.com/iotaledger/hive.go/crypto v0.0.0-20231027195901-620bd7470e42/go.mod h1:h3o6okvMSEK3KOX6pOp3yq1h9ohTkTfo6X8MzEadeb0= github.com/iotaledger/hive.go/ds v0.0.0-20231020115340-13da292c580b h1:8b2sH+2Vf0y5BDYTMwKa09iQr3JF9JrzTI64DkXb+9U= github.com/iotaledger/hive.go/ds v0.0.0-20231020115340-13da292c580b/go.mod h1:3XkUSKfHaVxGbT0XAvjNlVYqPzhfLTGhDtdNA5UBPco= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231020115340-13da292c580b h1:JJPnr231djUTgTnE4oGz847WE9VA7Py6E6fgZwT5TQo= -github.com/iotaledger/hive.go/ierrors v0.0.0-20231020115340-13da292c580b/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231027195901-620bd7470e42 h1:QMxd32Y/veVhTDPCiOFgetjUbG7sr9MryF29/rSPkMA= +github.com/iotaledger/hive.go/ierrors v0.0.0-20231027195901-620bd7470e42/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8= github.com/iotaledger/hive.go/kvstore v0.0.0-20231020115340-13da292c580b h1:LusmtjpfG/q8lc15Fp9W3kABbN3tArKx/zw2ibdY1DU= github.com/iotaledger/hive.go/kvstore v0.0.0-20231020115340-13da292c580b/go.mod h1:O/U3jtiUDeqqM0MZQFu2UPqS9fUm0C5hNISxlmg/thE= -github.com/iotaledger/hive.go/lo v0.0.0-20231020115340-13da292c580b h1:UvFWI8wQJS/XQOeWHpPsaFVeS2nxJ7nIGFr+IFjrnVw= -github.com/iotaledger/hive.go/lo v0.0.0-20231020115340-13da292c580b/go.mod h1:s4kzx9QY1MVWHJralj+3q5kI0eARtrJhphYD/iBbPfo= +github.com/iotaledger/hive.go/lo v0.0.0-20231027195901-620bd7470e42 h1:AvNLzONVMspwx7nD/NyYUgb5Hi7/zgzIOegr1uRD/M8= +github.com/iotaledger/hive.go/lo v0.0.0-20231027195901-620bd7470e42/go.mod h1:s4kzx9QY1MVWHJralj+3q5kI0eARtrJhphYD/iBbPfo= github.com/iotaledger/hive.go/log v0.0.0-20231020115340-13da292c580b h1:IwhoeOeRu25mBdrimuOOvbbhHYX0QipibV69ubn8nX0= github.com/iotaledger/hive.go/log v0.0.0-20231020115340-13da292c580b/go.mod h1:JvokzmpmFZPDskMlUqqjgHtD8usVJU4nAY/TNMGge8M= -github.com/iotaledger/hive.go/runtime v0.0.0-20231020115340-13da292c580b h1:O68POYIqBLnoHN+HIszc58QwAI2qocYq0WKGfVrXmMg= -github.com/iotaledger/hive.go/runtime v0.0.0-20231020115340-13da292c580b/go.mod h1:jRw8yFipiPaqmTPHh7hTcxAP9u6pjRGpByS3REJKkbY= +github.com/iotaledger/hive.go/runtime v0.0.0-20231027195901-620bd7470e42 h1:1QMJ39qXIx/IZVzus3+97IV7Pa++e+d340TvbMjhiBU= +github.com/iotaledger/hive.go/runtime v0.0.0-20231027195901-620bd7470e42/go.mod h1:jRw8yFipiPaqmTPHh7hTcxAP9u6pjRGpByS3REJKkbY= github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231020115340-13da292c580b h1:zaXZn9yV/95SRDkgCZQeBbSbmcJTKSZbCB7oBd71Qwg= github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231020115340-13da292c580b/go.mod h1:SdK26z8/VhWtxaqCuQrufm80SELgowQPmu9T/8eUQ8g= -github.com/iotaledger/hive.go/stringify v0.0.0-20231020115340-13da292c580b h1:MDZhTZTVDiydXcW5j4TA7HixVCyAdToIMPhHfJee7cE= -github.com/iotaledger/hive.go/stringify v0.0.0-20231020115340-13da292c580b/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/iota.go/v4 v4.0.0-20231026154111-efd63ff4f03d h1:gcJz0J3xFELIPT7y4xqW+q25oOcK6QMlxNnrfFu8srA= -github.com/iotaledger/iota.go/v4 v4.0.0-20231026154111-efd63ff4f03d/go.mod h1:jqbLYq4a/FwuiPBqFfkAwwxU8vs3+kReRq2/tyX5qRA= +github.com/iotaledger/hive.go/stringify v0.0.0-20231027195901-620bd7470e42 h1:OlDhgvJ48bZxcvTeebJ1b96xtNnJAddejd2Q4rlH1mU= +github.com/iotaledger/hive.go/stringify v0.0.0-20231027195901-620bd7470e42/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= +github.com/iotaledger/iota.go/v4 v4.0.0-20231028103644-b834fd54b02a h1:WLW4iaJAx4N9Pujv+gzHklnnjCt5MPrtXyVcK3UXdNc= +github.com/iotaledger/iota.go/v4 v4.0.0-20231028103644-b834fd54b02a/go.mod h1:jqbLYq4a/FwuiPBqFfkAwwxU8vs3+kReRq2/tyX5qRA= 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=