diff --git a/components/dashboard/explorer_routes.go b/components/dashboard/explorer_routes.go index 21770ac50..703e8db62 100644 --- a/components/dashboard/explorer_routes.go +++ b/components/dashboard/explorer_routes.go @@ -132,8 +132,8 @@ func createExplorerBlock(block *model.Block, cachedBlock *blocks.Block, metadata return iotago.PayloadType(0) }(), Payload: func() json.RawMessage { - if isBasic && basicBlock.Payload != nil && basicBlock.Payload.PayloadType() == iotago.PayloadTransaction { - tx, _ := basicBlock.Payload.(*iotago.Transaction) + if isBasic && basicBlock.Payload != nil && basicBlock.Payload.PayloadType() == iotago.PayloadSignedTransaction { + tx, _ := basicBlock.Payload.(*iotago.SignedTransaction) txResponse := NewTransaction(tx) bytes, _ := json.Marshal(txResponse) @@ -143,8 +143,8 @@ func createExplorerBlock(block *model.Block, cachedBlock *blocks.Block, metadata return payloadJSON }(), TransactionID: func() string { - if isBasic && basicBlock.Payload != nil && basicBlock.Payload.PayloadType() == iotago.PayloadTransaction { - tx, _ := basicBlock.Payload.(*iotago.Transaction) + if isBasic && basicBlock.Payload != nil && basicBlock.Payload.PayloadType() == iotago.PayloadSignedTransaction { + tx, _ := basicBlock.Payload.(*iotago.SignedTransaction) id, _ := tx.ID() return id.ToHex() @@ -211,9 +211,9 @@ func getTransaction(c echo.Context) error { return ierrors.Errorf("block not found: %s", output.BlockID().ToHex()) } - iotaTX, isTX := block.Transaction() + iotaTX, isTX := block.SignedTransaction() if !isTX { - return ierrors.Errorf("payload is not a transaction: %s", output.BlockID().ToHex()) + return ierrors.Errorf("payload is not a signed transaction: %s", output.BlockID().ToHex()) } return httpserver.JSONResponse(c, http.StatusOK, NewTransaction(iotaTX)) diff --git a/components/dashboard/jsonresponse.go b/components/dashboard/jsonresponse.go index 93e33011b..4819642b6 100644 --- a/components/dashboard/jsonresponse.go +++ b/components/dashboard/jsonresponse.go @@ -116,7 +116,7 @@ func NewOutputID(outputID iotago.OutputID) *OutputID { // region Transaction ////////////////////////////////////////////////////////////////////////////////////////////////// -// Transaction represents the JSON model of a ledgerstate.Transaction. +// Transaction represents the JSON model of a iotago.SignedTransaction. type Transaction struct { TransactionID string `json:"txId"` NetworkID iotago.NetworkID `json:"networkId"` @@ -128,20 +128,20 @@ type Transaction struct { Payload []byte `json:"payload"` } -// NewTransaction returns a Transaction from the given ledgerstate.Transaction. -func NewTransaction(iotaTx *iotago.Transaction) *Transaction { - txID, err := iotaTx.ID() +// NewTransaction returns a Transaction from the given iotago.SignedTransaction. +func NewTransaction(signedTx *iotago.SignedTransaction) *Transaction { + txID, err := signedTx.ID() if err != nil { return nil } - inputs := make([]*Input, len(iotaTx.Essence.Inputs)) - for i, input := range iotaTx.Essence.Inputs { + inputs := make([]*Input, len(signedTx.Transaction.Inputs)) + for i, input := range signedTx.Transaction.Inputs { inputs[i] = NewInput(input) } - outputs := make([]*Output, len(iotaTx.Essence.Outputs)) - for i, output := range iotaTx.Essence.Outputs { + outputs := make([]*Output, len(signedTx.Transaction.Outputs)) + for i, output := range signedTx.Transaction.Outputs { outputs[i] = NewOutput(output) outputs[i].OutputID = &OutputID{ Hex: iotago.OutputIDFromTransactionIDAndIndex(txID, uint16(i)).ToHex(), @@ -150,19 +150,19 @@ func NewTransaction(iotaTx *iotago.Transaction) *Transaction { } } - unlockBlocks := make([]*UnlockBlock, len(iotaTx.Unlocks)) - for i, unlockBlock := range iotaTx.Unlocks { + unlockBlocks := make([]*UnlockBlock, len(signedTx.Unlocks)) + for i, unlockBlock := range signedTx.Unlocks { unlockBlocks[i] = NewUnlockBlock(unlockBlock) } dataPayload := make([]byte, 0) - if iotaTx.Essence.Payload != nil { - dataPayload, _ = deps.Protocol.CurrentAPI().Encode(iotaTx.Essence.Payload) + if signedTx.Transaction.Payload != nil { + dataPayload, _ = deps.Protocol.CurrentAPI().Encode(signedTx.Transaction.Payload) } return &Transaction{ - NetworkID: iotaTx.Essence.NetworkID, - CreationSlot: iotaTx.Essence.CreationSlot, + NetworkID: signedTx.Transaction.NetworkID, + CreationSlot: signedTx.Transaction.CreationSlot, Inputs: inputs, Outputs: outputs, Unlocks: unlockBlocks, @@ -174,7 +174,7 @@ func NewTransaction(iotaTx *iotago.Transaction) *Transaction { // region Input //////////////////////////////////////////////////////////////////////////////////////////////////////// -// Input represents the JSON model of a ledgerstate.Input. +// Input represents the JSON model of a iotago.Input. type Input struct { Type string `json:"type"` ReferencedOutputID *OutputID `json:"referencedOutputID,omitempty"` @@ -182,7 +182,7 @@ type Input struct { Output *Output `json:"output,omitempty"` } -// NewInput returns an Input from the given ledgerstate.Input. +// NewInput returns an Input from the given iotago.Input. func NewInput(input iotago.Input) *Input { utxoInput, isUtxoInput := input.(*iotago.UTXOInput) if !isUtxoInput { @@ -199,14 +199,14 @@ func NewInput(input iotago.Input) *Input { // region UnlockBlock ////////////////////////////////////////////////////////////////////////////////////////////////// -// UnlockBlock represents the JSON model of a ledgerstate.UnlockBlock. +// UnlockBlock represents the JSON model of a iotago.UnlockBlock. type UnlockBlock struct { Type string `json:"type"` SignatureType iotago.SignatureType `json:"signatureType,omitempty"` Signature json.RawMessage `json:"signature,omitempty"` } -// NewUnlockBlock returns an UnlockBlock from the given ledgerstate.UnlockBlock. +// NewUnlockBlock returns an UnlockBlock from the given UnlockBlock. func NewUnlockBlock(unlockBlock iotago.Unlock) *UnlockBlock { result := &UnlockBlock{ Type: unlockBlock.Type().String(), diff --git a/components/dashboard/visualizer.go b/components/dashboard/visualizer.go index f1b962f54..d9daffca2 100644 --- a/components/dashboard/visualizer.go +++ b/components/dashboard/visualizer.go @@ -43,7 +43,7 @@ type tipinfo struct { func sendVertex(blk *blocks.Block, confirmed bool) { modelBlk, _ := model.BlockFromBlock(blk.ProtocolBlock()) - tx, isTx := modelBlk.Transaction() + tx, isTx := modelBlk.SignedTransaction() broadcastWsBlock(&wsblk{MsgTypeVertex, &vertex{ ID: blk.ID().ToHex(), @@ -85,7 +85,7 @@ func runVisualizer(component *app.Component) { deps.Protocol.Events.Engine.BlockDAG.BlockAttached.Hook(func(block *blocks.Block) { sendVertex(block, false) - tx, hasTx := block.Transaction() + tx, hasTx := block.SignedTransaction() if hasTx { txMetadata, exists := deps.Protocol.MainEngineInstance().Ledger.MemPool().TransactionMetadata(lo.PanicOnErr(tx.ID())) if exists { diff --git a/go.mod b/go.mod index 472f2bdd9..628aacf43 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65 github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230927140518-622f63be6182 github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230927140257-bfa0bb0af2bd - github.com/iotaledger/iota.go/v4 v4.0.0-20230928103002-093e56bf1b19 + github.com/iotaledger/iota.go/v4 v4.0.0-20230928135522-335156827793 github.com/labstack/echo/v4 v4.11.1 github.com/labstack/gommon v0.4.0 github.com/libp2p/go-libp2p v0.30.0 diff --git a/go.sum b/go.sum index e64c0fb9a..e95ab9eb7 100644 --- a/go.sum +++ b/go.sum @@ -305,8 +305,8 @@ github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230927140518-622f63be6182 h1:lQikt github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230927140518-622f63be6182/go.mod h1:q24QEsS887ZWJVX76w2kwSgC84KS7wIKOy1otuqZ2ZM= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230927140257-bfa0bb0af2bd h1:nFG3Zq/zFA4KhBYFX2IezX1C74zfE0DqCt0LrgTa9Ig= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230927140257-bfa0bb0af2bd/go.mod h1:c5778OnWpLq108YE+Eb2m8Ri/t/4ydV0TvI/Sy5YivQ= -github.com/iotaledger/iota.go/v4 v4.0.0-20230928103002-093e56bf1b19 h1:4vN+jZJECvlfP0Bam8tonH9ndFBJoi8G0nMb4m1kpKk= -github.com/iotaledger/iota.go/v4 v4.0.0-20230928103002-093e56bf1b19/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= +github.com/iotaledger/iota.go/v4 v4.0.0-20230928135522-335156827793 h1:YyhI+h6r2PkFZE7PorDhlT4EwAOvVuW2NdNF80FshIQ= +github.com/iotaledger/iota.go/v4 v4.0.0-20230928135522-335156827793/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY= github.com/ipfs/boxo v0.10.0/go.mod h1:Fg+BnfxZ0RPzR0nOodzdIq3A7KgoWAOWsEIImrIQdBM= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= diff --git a/pkg/blockfactory/blockissuer.go b/pkg/blockfactory/blockissuer.go index c69ca9c6d..e28603b3f 100644 --- a/pkg/blockfactory/blockissuer.go +++ b/pkg/blockfactory/blockissuer.go @@ -292,9 +292,9 @@ func (i *BlockIssuer) AttachBlock(ctx context.Context, iotaBlock *iotago.Protoco switch innerBlock := iotaBlock.Block.(type) { case *iotago.BasicBlock: switch payload := innerBlock.Payload.(type) { - case *iotago.Transaction: - if payload.Essence.NetworkID != protoParams.NetworkID() { - return iotago.EmptyBlockID(), ierrors.Wrapf(ErrBlockAttacherInvalidBlock, "invalid payload, error: wrong networkID: %d", payload.Essence.NetworkID) + case *iotago.SignedTransaction: + if payload.Transaction.NetworkID != protoParams.NetworkID() { + return iotago.EmptyBlockID(), ierrors.Wrapf(ErrBlockAttacherInvalidBlock, "invalid payload, error: wrong networkID: %d", payload.Transaction.NetworkID) } } diff --git a/pkg/model/block.go b/pkg/model/block.go index bc5e604fd..557f715d0 100644 --- a/pkg/model/block.go +++ b/pkg/model/block.go @@ -83,13 +83,13 @@ func (blk *Block) Payload() iotago.Payload { return basicBlock.Payload } -func (blk *Block) Transaction() (tx *iotago.Transaction, isTransaction bool) { +func (blk *Block) SignedTransaction() (tx *iotago.SignedTransaction, isTransaction bool) { payload := blk.Payload() if payload == nil { return nil, false } - tx, isTransaction = payload.(*iotago.Transaction) + tx, isTransaction = payload.(*iotago.SignedTransaction) return tx, isTransaction } diff --git a/pkg/protocol/engine/blocks/block.go b/pkg/protocol/engine/blocks/block.go index b5f816f4c..a87d53467 100644 --- a/pkg/protocol/engine/blocks/block.go +++ b/pkg/protocol/engine/blocks/block.go @@ -162,12 +162,12 @@ func (b *Block) Payload() iotago.Payload { return b.modelBlock.Payload() } -func (b *Block) Transaction() (tx *iotago.Transaction, hasTransaction bool) { +func (b *Block) SignedTransaction() (tx *iotago.SignedTransaction, hasTransaction bool) { if b.modelBlock == nil { return nil, false } - return b.modelBlock.Transaction() + return b.modelBlock.SignedTransaction() } func (b *Block) BasicBlock() (basicBlock *iotago.BasicBlock, isBasicBlock bool) { diff --git a/pkg/protocol/engine/booker/inmemorybooker/booker.go b/pkg/protocol/engine/booker/inmemorybooker/booker.go index 93fabc322..2a9e123f5 100644 --- a/pkg/protocol/engine/booker/inmemorybooker/booker.go +++ b/pkg/protocol/engine/booker/inmemorybooker/booker.go @@ -171,7 +171,7 @@ func (b *Booker) inheritConflicts(block *blocks.Block) (conflictIDs ds.Set[iotag case iotago.ShallowLikeParentType: // Check whether the parent contains a conflicting TX, // otherwise reference is invalid and the block should be marked as invalid as well. - if tx, hasTx := parentBlock.Transaction(); !hasTx || !parentBlock.PayloadConflictIDs().Has(lo.PanicOnErr(tx.ID())) { + if tx, hasTx := parentBlock.SignedTransaction(); !hasTx || !parentBlock.PayloadConflictIDs().Has(lo.PanicOnErr(tx.ID())) { return nil, ierrors.Wrapf(err, "shallow like parent %s does not contain a conflicting transaction", parent.ID.String()) } diff --git a/pkg/protocol/engine/ledger/ledger/ledger.go b/pkg/protocol/engine/ledger/ledger/ledger.go index ba17893d4..f9bf12815 100644 --- a/pkg/protocol/engine/ledger/ledger/ledger.go +++ b/pkg/protocol/engine/ledger/ledger/ledger.go @@ -123,7 +123,7 @@ func (l *Ledger) OnTransactionAttached(handler func(transaction mempool.Transact } func (l *Ledger) AttachTransaction(block *blocks.Block) (transactionMetadata mempool.TransactionMetadata, containsTransaction bool) { - if transaction, hasTransaction := block.Transaction(); hasTransaction { + if transaction, hasTransaction := block.SignedTransaction(); hasTransaction { transactionMetadata, err := l.memPool.AttachTransaction(transaction, block.ID()) if err != nil { l.retainTransactionFailure(block.ID(), err) @@ -212,7 +212,7 @@ func (l *Ledger) AddGenesisUnspentOutput(unspentOutput *utxoledger.Output) error func (l *Ledger) TrackBlock(block *blocks.Block) { l.accountsLedger.TrackBlock(block) - if _, hasTransaction := block.Transaction(); hasTransaction { + if _, hasTransaction := block.SignedTransaction(); hasTransaction { l.memPool.MarkAttachmentIncluded(block.ID()) } @@ -584,7 +584,7 @@ func (l *Ledger) processStateDiffTransactions(stateDiff mempool.StateDiff) (spen accountDiffs = make(map[iotago.AccountID]*model.AccountDiff) stateDiff.ExecutedTransactions().ForEach(func(txID iotago.TransactionID, txWithMeta mempool.TransactionMetadata) bool { - tx, ok := txWithMeta.Transaction().(*iotago.Transaction) + tx, ok := txWithMeta.Transaction().(*iotago.SignedTransaction) if !ok { err = iotago.ErrTxTypeInvalid return false @@ -619,7 +619,7 @@ func (l *Ledger) processStateDiffTransactions(stateDiff mempool.StateDiff) (spen // process allotments { - for _, allotment := range tx.Essence.Allotments { + for _, allotment := range tx.Transaction.Allotments { // in case it didn't exist, allotments won't change the outputID of the Account, // so the diff defaults to empty new and previous outputIDs accountDiff := getAccountDiff(accountDiffs, allotment.AccountID) diff --git a/pkg/protocol/engine/ledger/ledger/vm.go b/pkg/protocol/engine/ledger/ledger/vm.go index 53a054cdc..714c85c01 100644 --- a/pkg/protocol/engine/ledger/ledger/vm.go +++ b/pkg/protocol/engine/ledger/ledger/vm.go @@ -11,17 +11,14 @@ import ( ) func (l *Ledger) executeStardustVM(_ context.Context, stateTransition mempool.Transaction, inputStates []mempool.OutputState, timeReference mempool.ContextState) ([]mempool.OutputState, error) { - tx, ok := stateTransition.(*iotago.Transaction) + tx, ok := stateTransition.(*iotago.SignedTransaction) if !ok { return nil, iotago.ErrTxTypeInvalid } inputSet := iotagovm.InputSet{} - for _, inputState := range inputStates { - inputSet[inputState.OutputID()] = iotagovm.OutputWithCreationSlot{ - Output: inputState.Output(), - CreationSlot: inputState.SlotCreated(), - } + for _, input := range inputStates { + inputSet[input.OutputID()] = input.Output() } resolvedInputs := iotagovm.ResolvedInputs{ InputSet: inputSet, @@ -122,7 +119,7 @@ func (l *Ledger) executeStardustVM(_ context.Context, stateTransition mempool.Tr created = append(created, &ExecutionOutput{ outputID: outputID, output: output, - creationSlot: tx.Essence.CreationSlot, + creationSlot: tx.Transaction.CreationSlot, }) } diff --git a/pkg/protocol/engine/utxoledger/database_prefixes.go b/pkg/protocol/engine/utxoledger/database_prefixes.go index 0f347dd2b..12dcd559e 100644 --- a/pkg/protocol/engine/utxoledger/database_prefixes.go +++ b/pkg/protocol/engine/utxoledger/database_prefixes.go @@ -46,7 +46,7 @@ const ( 1 byte + 34 bytes Value: - TargetTransactionID (iotago.TransactionID) + TransactionAcceptedSlotIndex (iotago.SlotIndex) + TransactionCreationSlot (time.Time) + TargetTransactionID (iotago.SignedTransactionID) + TransactionAcceptedSlotIndex (iotago.SlotIndex) + TransactionCreationSlot (time.Time) 32 bytes + 8 bytes + 8 bytes Unspent Output: diff --git a/pkg/protocol/engine/utxoledger/output.go b/pkg/protocol/engine/utxoledger/output.go index 6f93a26fe..86b557651 100644 --- a/pkg/protocol/engine/utxoledger/output.go +++ b/pkg/protocol/engine/utxoledger/output.go @@ -64,7 +64,7 @@ func (o *Output) SlotBooked() iotago.SlotIndex { } func (o *Output) SlotCreated() iotago.SlotIndex { - return o.outputID.CreationSlotIndex() + return o.outputID.CreationSlot() } func (o *Output) OutputType() iotago.OutputType { @@ -142,10 +142,10 @@ func NewOutput(apiProvider iotago.APIProvider, blockID iotago.BlockID, slotBooke } var output iotago.Output - if len(transaction.Essence.Outputs) <= int(index) { + if len(transaction.Outputs) <= int(index) { return nil, ierrors.New("output not found") } - output = transaction.Essence.Outputs[int(index)] + output = transaction.Outputs[int(index)] outputID := iotago.OutputIDFromTransactionIDAndIndex(txID, index) return CreateOutput(apiProvider, outputID, blockID, slotBooked, output), nil diff --git a/pkg/protocol/engine/utxoledger/tpkg/equal.go b/pkg/protocol/engine/utxoledger/tpkg/equal.go index 13491215e..f32290577 100644 --- a/pkg/protocol/engine/utxoledger/tpkg/equal.go +++ b/pkg/protocol/engine/utxoledger/tpkg/equal.go @@ -24,7 +24,7 @@ func EqualOutput(t *testing.T, expected *utxoledger.Output, actual *utxoledger.O case iotago.TransIndepIdentOutput: expectedIdent = output.Ident() case iotago.TransDepIdentOutput: - expectedIdent = output.Chain().ToAddress() + expectedIdent = output.ChainID().ToAddress() default: require.Fail(t, "unsupported output type") } @@ -34,7 +34,7 @@ func EqualOutput(t *testing.T, expected *utxoledger.Output, actual *utxoledger.O case iotago.TransIndepIdentOutput: actualIdent = output.Ident() case iotago.TransDepIdentOutput: - actualIdent = output.Chain().ToAddress() + actualIdent = output.ChainID().ToAddress() default: require.Fail(t, "unsupported output type") } diff --git a/pkg/tests/accounts_test.go b/pkg/tests/accounts_test.go index 1a9d326db..fca864f9a 100644 --- a/pkg/tests/accounts_test.go +++ b/pkg/tests/accounts_test.go @@ -102,7 +102,7 @@ func Test_TransitionAccount(t *testing.T) { PreviousUpdatedTime: 0, PreviousExpirySlot: 1, NewExpirySlot: 1, - NewOutputID: iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(ts.TransactionFramework.Transaction("TX1").ID()), 0), + NewOutputID: iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(ts.TransactionFramework.SignedTransaction("TX1").ID()), 0), PreviousOutputID: genesisAccount.OutputID(), BlockIssuerKeysRemoved: iotago.NewBlockIssuerKeys(), BlockIssuerKeysAdded: iotago.NewBlockIssuerKeys(newGenesisOutputKey), @@ -111,7 +111,7 @@ func Test_TransitionAccount(t *testing.T) { ts.AssertAccountData(&accounts.AccountData{ ID: genesisAccountOutput.AccountID, Credits: accounts.NewBlockIssuanceCredits(iotago.BlockIssuanceCredits(123), 0), - OutputID: iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(ts.TransactionFramework.Transaction("TX1").ID()), 0), + OutputID: iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(ts.TransactionFramework.SignedTransaction("TX1").ID()), 0), BlockIssuerKeys: iotago.NewBlockIssuerKeys(oldGenesisOutputKey, newGenesisOutputKey), ExpirySlot: 1, }, ts.Nodes()...) @@ -161,7 +161,7 @@ func Test_TransitionAccount(t *testing.T) { NewExpirySlot: 0, PreviousExpirySlot: 1, NewOutputID: iotago.EmptyOutputID, - PreviousOutputID: iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(ts.TransactionFramework.Transaction("TX1").ID()), 0), + PreviousOutputID: iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(ts.TransactionFramework.SignedTransaction("TX1").ID()), 0), BlockIssuerKeysAdded: iotago.NewBlockIssuerKeys(), BlockIssuerKeysRemoved: iotago.NewBlockIssuerKeys(oldGenesisOutputKey, newGenesisOutputKey), ValidatorStakeChange: 0, diff --git a/pkg/tests/booker_test.go b/pkg/tests/booker_test.go index 15e48560b..da743259b 100644 --- a/pkg/tests/booker_test.go +++ b/pkg/tests/booker_test.go @@ -26,24 +26,24 @@ func Test_IssuingTransactionsOutOfOrder(t *testing.T) { ts.IssuePayloadWithOptions("block1", node1, tx2) - ts.AssertTransactionsExist(ts.TransactionFramework.Transactions("tx2"), true, node1) - ts.AssertTransactionsExist(ts.TransactionFramework.Transactions("tx1"), false, node1) + ts.AssertTransactionsExist(ts.TransactionFramework.SignedTransactions("tx2"), true, node1) + ts.AssertTransactionsExist(ts.TransactionFramework.SignedTransactions("tx1"), false, node1) - ts.AssertTransactionsInCacheBooked(ts.TransactionFramework.Transactions("tx2"), false, node1) + ts.AssertTransactionsInCacheBooked(ts.TransactionFramework.SignedTransactions("tx2"), false, node1) // make sure that the block is not booked ts.IssuePayloadWithOptions("block2", node1, tx1) - ts.AssertTransactionsExist(ts.TransactionFramework.Transactions("tx1", "tx2"), true, node1) - ts.AssertTransactionsInCacheBooked(ts.TransactionFramework.Transactions("tx1", "tx2"), true, node1) + ts.AssertTransactionsExist(ts.TransactionFramework.SignedTransactions("tx1", "tx2"), true, node1) + ts.AssertTransactionsInCacheBooked(ts.TransactionFramework.SignedTransactions("tx1", "tx2"), true, node1) ts.AssertBlocksInCacheConflicts(map[*blocks.Block][]string{ ts.Block("block1"): {"tx2"}, ts.Block("block2"): {"tx1"}, }, node1) - ts.AssertTransactionInCacheConflicts(map[*iotago.Transaction][]string{ - ts.TransactionFramework.Transaction("tx2"): {"tx2"}, - ts.TransactionFramework.Transaction("tx1"): {"tx1"}, + ts.AssertTransactionInCacheConflicts(map[*iotago.SignedTransaction][]string{ + ts.TransactionFramework.SignedTransaction("tx2"): {"tx2"}, + ts.TransactionFramework.SignedTransaction("tx1"): {"tx1"}, }, node1) } @@ -69,17 +69,17 @@ func Test_DoubleSpend(t *testing.T) { ts.IssuePayloadWithOptions("block1", node1, tx1, blockfactory.WithStrongParents(ts.BlockID("Genesis"))) ts.IssuePayloadWithOptions("block2", node1, tx2, blockfactory.WithStrongParents(ts.BlockID("Genesis"))) - ts.AssertTransactionsExist(ts.TransactionFramework.Transactions("tx1", "tx2"), true, node1, node2) - ts.AssertTransactionsInCacheBooked(ts.TransactionFramework.Transactions("tx1", "tx2"), true, node1, node2) - ts.AssertTransactionsInCachePending(ts.TransactionFramework.Transactions("tx1", "tx2"), true, node1, node2) + ts.AssertTransactionsExist(ts.TransactionFramework.SignedTransactions("tx1", "tx2"), true, node1, node2) + ts.AssertTransactionsInCacheBooked(ts.TransactionFramework.SignedTransactions("tx1", "tx2"), true, node1, node2) + ts.AssertTransactionsInCachePending(ts.TransactionFramework.SignedTransactions("tx1", "tx2"), true, node1, node2) ts.AssertBlocksInCacheConflicts(map[*blocks.Block][]string{ ts.Block("block1"): {"tx1"}, ts.Block("block2"): {"tx2"}, }, node1, node2) - ts.AssertTransactionInCacheConflicts(map[*iotago.Transaction][]string{ - ts.TransactionFramework.Transaction("tx2"): {"tx2"}, - ts.TransactionFramework.Transaction("tx1"): {"tx1"}, + ts.AssertTransactionInCacheConflicts(map[*iotago.SignedTransaction][]string{ + ts.TransactionFramework.SignedTransaction("tx2"): {"tx2"}, + ts.TransactionFramework.SignedTransaction("tx1"): {"tx1"}, }, node1, node2) } @@ -92,14 +92,14 @@ func Test_DoubleSpend(t *testing.T) { ts.Block("block3"): {"tx1"}, ts.Block("block4"): {"tx2"}, }, node1, node2) - ts.AssertTransactionsInCachePending(ts.TransactionFramework.Transactions("tx1", "tx2"), true, node1, node2) + ts.AssertTransactionsInCachePending(ts.TransactionFramework.SignedTransactions("tx1", "tx2"), true, node1, node2) } // Issue an invalid block and assert that its vote is not cast. { ts.IssueValidationBlock("block5", node2, blockfactory.WithStrongParents(ts.BlockIDs("block3", "block4")...)) - ts.AssertTransactionsInCachePending(ts.TransactionFramework.Transactions("tx1", "tx2"), true, node1, node2) + ts.AssertTransactionsInCachePending(ts.TransactionFramework.SignedTransactions("tx1", "tx2"), true, node1, node2) } // Issue valid blocks that resolve the conflict. @@ -110,8 +110,8 @@ func Test_DoubleSpend(t *testing.T) { ts.AssertBlocksInCacheConflicts(map[*blocks.Block][]string{ ts.Block("block6"): {"tx2"}, }, node1, node2) - ts.AssertTransactionsInCacheAccepted(ts.TransactionFramework.Transactions("tx2"), true, node1, node2) - ts.AssertTransactionsInCacheRejected(ts.TransactionFramework.Transactions("tx1"), true, node1, node2) + ts.AssertTransactionsInCacheAccepted(ts.TransactionFramework.SignedTransactions("tx2"), true, node1, node2) + ts.AssertTransactionsInCacheRejected(ts.TransactionFramework.SignedTransactions("tx1"), true, node1, node2) } } @@ -148,8 +148,8 @@ func Test_MultipleAttachments(t *testing.T) { ts.Block("A.2"): {"tx1"}, ts.Block("B.2"): {"tx1"}, }), ts.Nodes()...) - ts.AssertTransactionInCacheConflicts(map[*iotago.Transaction][]string{ - ts.TransactionFramework.Transaction("tx1"): {"tx1"}, + ts.AssertTransactionInCacheConflicts(map[*iotago.SignedTransaction][]string{ + ts.TransactionFramework.SignedTransaction("tx1"): {"tx1"}, }, ts.Nodes()...) ts.AssertConflictsInCacheAcceptanceState([]string{"tx1"}, acceptance.Accepted, ts.Nodes()...) } @@ -171,8 +171,8 @@ func Test_MultipleAttachments(t *testing.T) { ts.AssertBlocksInCachePreAccepted(ts.Blocks("B.4", "A.5"), false, ts.Nodes()...) ts.AssertBlocksInCacheAccepted(ts.Blocks("A.3"), true, ts.Nodes()...) - ts.AssertTransactionsInCacheBooked(ts.TransactionFramework.Transactions("tx1", "tx2"), true, ts.Nodes()...) - ts.AssertTransactionsInCachePending(ts.TransactionFramework.Transactions("tx1", "tx2"), true, ts.Nodes()...) + ts.AssertTransactionsInCacheBooked(ts.TransactionFramework.SignedTransactions("tx1", "tx2"), true, ts.Nodes()...) + ts.AssertTransactionsInCachePending(ts.TransactionFramework.SignedTransactions("tx1", "tx2"), true, ts.Nodes()...) ts.AssertBlocksInCacheConflicts(lo.MergeMaps(blocksConflicts, map[*blocks.Block][]string{ ts.Block("A.3"): {"tx2"}, @@ -181,9 +181,9 @@ func Test_MultipleAttachments(t *testing.T) { ts.Block("A.5"): {}, ts.Block("B.4"): {}, }), ts.Nodes()...) - ts.AssertTransactionInCacheConflicts(map[*iotago.Transaction][]string{ - ts.TransactionFramework.Transaction("tx1"): {"tx1"}, - ts.TransactionFramework.Transaction("tx2"): {"tx2"}, + ts.AssertTransactionInCacheConflicts(map[*iotago.SignedTransaction][]string{ + ts.TransactionFramework.SignedTransaction("tx1"): {"tx1"}, + ts.TransactionFramework.SignedTransaction("tx2"): {"tx2"}, }, nodeA, nodeB) ts.AssertConflictsInCacheAcceptanceState([]string{"tx1", "tx2"}, acceptance.Accepted, ts.Nodes()...) } @@ -200,9 +200,9 @@ func Test_MultipleAttachments(t *testing.T) { ts.AssertBlocksInCacheAccepted(ts.Blocks("A.1", "B.1"), true, ts.Nodes()...) ts.AssertBlocksInCachePreAccepted(ts.Blocks("A.7", "B.6"), false, ts.Nodes()...) - ts.AssertTransactionsExist(ts.TransactionFramework.Transactions("tx1", "tx2"), true, ts.Nodes()...) - ts.AssertTransactionsInCacheBooked(ts.TransactionFramework.Transactions("tx1", "tx2"), true, ts.Nodes()...) - ts.AssertTransactionsInCacheAccepted(ts.TransactionFramework.Transactions("tx1", "tx2"), true, ts.Nodes()...) + ts.AssertTransactionsExist(ts.TransactionFramework.SignedTransactions("tx1", "tx2"), true, ts.Nodes()...) + ts.AssertTransactionsInCacheBooked(ts.TransactionFramework.SignedTransactions("tx1", "tx2"), true, ts.Nodes()...) + ts.AssertTransactionsInCacheAccepted(ts.TransactionFramework.SignedTransactions("tx1", "tx2"), true, ts.Nodes()...) ts.AssertBlocksInCacheConflicts(lo.MergeMaps(blocksConflicts, map[*blocks.Block][]string{ ts.Block("A.6"): {}, @@ -211,9 +211,9 @@ func Test_MultipleAttachments(t *testing.T) { ts.Block("B.6"): {}, }), ts.Nodes()...) - ts.AssertTransactionInCacheConflicts(map[*iotago.Transaction][]string{ - ts.TransactionFramework.Transaction("tx1"): {"tx1"}, - ts.TransactionFramework.Transaction("tx2"): {"tx2"}, + ts.AssertTransactionInCacheConflicts(map[*iotago.SignedTransaction][]string{ + ts.TransactionFramework.SignedTransaction("tx1"): {"tx1"}, + ts.TransactionFramework.SignedTransaction("tx2"): {"tx2"}, }, nodeA, nodeB) ts.AssertConflictsInCacheAcceptanceState([]string{"tx1", "tx2"}, acceptance.Accepted, nodeA, nodeB) } diff --git a/pkg/testsuite/blocks.go b/pkg/testsuite/blocks.go index 225df6b1e..11f65d693 100644 --- a/pkg/testsuite/blocks.go +++ b/pkg/testsuite/blocks.go @@ -122,7 +122,7 @@ func (t *TestSuite) AssertBlocksInCacheConflicts(blockConflicts map[*blocks.Bloc return ierrors.Errorf("AssertBlocksInCacheConflicts: %s: block %s is root block", node.Name, blockFromCache.ID()) } - expectedConflictIDs := ds.NewSet(lo.Map(conflictAliases, t.TransactionFramework.TransactionID)...) + expectedConflictIDs := ds.NewSet(lo.Map(conflictAliases, t.TransactionFramework.SignedTransactionID)...) actualConflictIDs := blockFromCache.ConflictIDs() if expectedConflictIDs.Size() != actualConflictIDs.Size() { diff --git a/pkg/testsuite/conflicts.go b/pkg/testsuite/conflicts.go index 7c7047da0..5e8ffd328 100644 --- a/pkg/testsuite/conflicts.go +++ b/pkg/testsuite/conflicts.go @@ -13,7 +13,7 @@ func (t *TestSuite) AssertConflictsInCacheAcceptanceState(expectedConflictAliase for _, node := range nodes { for _, conflictAlias := range expectedConflictAliases { t.Eventually(func() error { - acceptanceState := node.Protocol.MainEngineInstance().Ledger.ConflictDAG().AcceptanceState(ds.NewSet(t.TransactionFramework.TransactionID(conflictAlias))) + acceptanceState := node.Protocol.MainEngineInstance().Ledger.ConflictDAG().AcceptanceState(ds.NewSet(t.TransactionFramework.SignedTransactionID(conflictAlias))) if acceptanceState != expectedState { return ierrors.Errorf("assertTransactionsInCacheWithFunc: %s: conflict %s is %s, but expected %s", node.Name, conflictAlias, acceptanceState, expectedState) diff --git a/pkg/testsuite/transactions.go b/pkg/testsuite/transactions.go index 33dae4e3d..08fe93fb5 100644 --- a/pkg/testsuite/transactions.go +++ b/pkg/testsuite/transactions.go @@ -12,34 +12,34 @@ import ( iotago "github.com/iotaledger/iota.go/v4" ) -func (t *TestSuite) AssertTransaction(transaction *iotago.Transaction, node *mock.Node) mempool.Transaction { - var loadedTransaction mempool.TransactionMetadata - transactionID, err := transaction.ID() +func (t *TestSuite) AssertTransaction(signedTransaction *iotago.SignedTransaction, node *mock.Node) mempool.Transaction { + var loadedTransactionMetadata mempool.TransactionMetadata + signedTransactionID, err := signedTransaction.ID() require.NoError(t.Testing, err) t.Eventually(func() error { var exists bool - loadedTransaction, exists = node.Protocol.MainEngineInstance().Ledger.TransactionMetadata(transactionID) + loadedTransactionMetadata, exists = node.Protocol.MainEngineInstance().Ledger.TransactionMetadata(signedTransactionID) if !exists { - return ierrors.Errorf("AssertTransaction: %s: transaction %s does not exist", node.Name, transactionID) + return ierrors.Errorf("AssertTransaction: %s: signedTransaction %s does not exist", node.Name, signedTransactionID) } - if transactionID != loadedTransaction.ID() { - return ierrors.Errorf("AssertTransaction: %s: expected ID %s, got %s", node.Name, transactionID, loadedTransaction.ID()) + if signedTransactionID != loadedTransactionMetadata.ID() { + return ierrors.Errorf("AssertTransaction: %s: expected ID %s, got %s", node.Name, signedTransactionID, loadedTransactionMetadata.ID()) } //nolint: forcetypeassert // we are in a test and want to assert it anyway - if !cmp.Equal(transaction.Essence, loadedTransaction.Transaction().(*iotago.Transaction).Essence) { - return ierrors.Errorf("AssertTransaction: %s: expected %s, got %s", node.Name, transaction, loadedTransaction.Transaction()) + if !cmp.Equal(signedTransaction.Transaction, loadedTransactionMetadata.Transaction().(*iotago.SignedTransaction).Transaction) { + return ierrors.Errorf("AssertTransaction: %s: expected %s, got %s", node.Name, signedTransaction, loadedTransactionMetadata.Transaction()) } return nil }) - return loadedTransaction.Transaction() + return loadedTransactionMetadata.Transaction() } -func (t *TestSuite) AssertTransactionsExist(transactions []*iotago.Transaction, expectedExist bool, nodes ...*mock.Node) { +func (t *TestSuite) AssertTransactionsExist(transactions []*iotago.SignedTransaction, expectedExist bool, nodes ...*mock.Node) { mustNodes(nodes) for _, node := range nodes { @@ -66,7 +66,7 @@ func (t *TestSuite) AssertTransactionsExist(transactions []*iotago.Transaction, } } -func (t *TestSuite) assertTransactionsInCacheWithFunc(expectedTransactions []*iotago.Transaction, expectedPropertyState bool, propertyFunc func(mempool.TransactionMetadata) bool, nodes ...*mock.Node) { +func (t *TestSuite) assertTransactionsInCacheWithFunc(expectedTransactions []*iotago.SignedTransaction, expectedPropertyState bool, propertyFunc func(mempool.TransactionMetadata) bool, nodes ...*mock.Node) { mustNodes(nodes) for _, node := range nodes { @@ -92,31 +92,31 @@ func (t *TestSuite) assertTransactionsInCacheWithFunc(expectedTransactions []*io } } -func (t *TestSuite) AssertTransactionsInCacheAccepted(expectedTransactions []*iotago.Transaction, expectedFlag bool, nodes ...*mock.Node) { +func (t *TestSuite) AssertTransactionsInCacheAccepted(expectedTransactions []*iotago.SignedTransaction, expectedFlag bool, nodes ...*mock.Node) { t.assertTransactionsInCacheWithFunc(expectedTransactions, expectedFlag, mempool.TransactionMetadata.IsAccepted, nodes...) } -func (t *TestSuite) AssertTransactionsInCacheRejected(expectedTransactions []*iotago.Transaction, expectedFlag bool, nodes ...*mock.Node) { +func (t *TestSuite) AssertTransactionsInCacheRejected(expectedTransactions []*iotago.SignedTransaction, expectedFlag bool, nodes ...*mock.Node) { t.assertTransactionsInCacheWithFunc(expectedTransactions, expectedFlag, mempool.TransactionMetadata.IsRejected, nodes...) } -func (t *TestSuite) AssertTransactionsInCacheBooked(expectedTransactions []*iotago.Transaction, expectedFlag bool, nodes ...*mock.Node) { +func (t *TestSuite) AssertTransactionsInCacheBooked(expectedTransactions []*iotago.SignedTransaction, expectedFlag bool, nodes ...*mock.Node) { t.assertTransactionsInCacheWithFunc(expectedTransactions, expectedFlag, mempool.TransactionMetadata.IsBooked, nodes...) } -func (t *TestSuite) AssertTransactionsInCacheConflicting(expectedTransactions []*iotago.Transaction, expectedFlag bool, nodes ...*mock.Node) { +func (t *TestSuite) AssertTransactionsInCacheConflicting(expectedTransactions []*iotago.SignedTransaction, expectedFlag bool, nodes ...*mock.Node) { t.assertTransactionsInCacheWithFunc(expectedTransactions, expectedFlag, mempool.TransactionMetadata.IsConflicting, nodes...) } -func (t *TestSuite) AssertTransactionsInCacheInvalid(expectedTransactions []*iotago.Transaction, expectedFlag bool, nodes ...*mock.Node) { +func (t *TestSuite) AssertTransactionsInCacheInvalid(expectedTransactions []*iotago.SignedTransaction, expectedFlag bool, nodes ...*mock.Node) { t.assertTransactionsInCacheWithFunc(expectedTransactions, expectedFlag, mempool.TransactionMetadata.IsInvalid, nodes...) } -func (t *TestSuite) AssertTransactionsInCachePending(expectedTransactions []*iotago.Transaction, expectedFlag bool, nodes ...*mock.Node) { +func (t *TestSuite) AssertTransactionsInCachePending(expectedTransactions []*iotago.SignedTransaction, expectedFlag bool, nodes ...*mock.Node) { t.assertTransactionsInCacheWithFunc(expectedTransactions, expectedFlag, mempool.TransactionMetadata.IsPending, nodes...) } -func (t *TestSuite) AssertTransactionInCacheConflicts(transactionConflicts map[*iotago.Transaction][]string, nodes ...*mock.Node) { +func (t *TestSuite) AssertTransactionInCacheConflicts(transactionConflicts map[*iotago.SignedTransaction][]string, nodes ...*mock.Node) { for _, node := range nodes { for transaction, conflictAliases := range transactionConflicts { transactionID, err := transaction.ID() @@ -128,7 +128,7 @@ func (t *TestSuite) AssertTransactionInCacheConflicts(transactionConflicts map[* return ierrors.Errorf("AssertTransactionInCacheConflicts: %s: block %s does not exist", node.Name, transactionID) } - expectedConflictIDs := ds.NewSet(lo.Map(conflictAliases, t.TransactionFramework.TransactionID)...) + expectedConflictIDs := ds.NewSet(lo.Map(conflictAliases, t.TransactionFramework.SignedTransactionID)...) actualConflictIDs := transactionFromCache.ConflictIDs() if expectedConflictIDs.Size() != actualConflictIDs.Size() { diff --git a/pkg/testsuite/transactions_framework.go b/pkg/testsuite/transactions_framework.go index 00d4c66ac..967ac1065 100644 --- a/pkg/testsuite/transactions_framework.go +++ b/pkg/testsuite/transactions_framework.go @@ -21,7 +21,7 @@ type TransactionFramework struct { wallet *mock.HDWallet states map[string]*utxoledger.Output - transactions map[string]*iotago.Transaction + transactions map[string]*iotago.SignedTransaction } func NewTransactionFramework(protocol *protocol.Protocol, genesisSeed []byte, accounts ...snapshotcreator.AccountDetails) *TransactionFramework { @@ -34,7 +34,7 @@ func NewTransactionFramework(protocol *protocol.Protocol, genesisSeed []byte, ac tf := &TransactionFramework{ apiProvider: protocol, states: map[string]*utxoledger.Output{"Genesis:0": genesisOutput}, - transactions: make(map[string]*iotago.Transaction), + transactions: make(map[string]*iotago.SignedTransaction), wallet: mock.NewHDWallet("genesis", genesisSeed, 0), } @@ -50,7 +50,7 @@ func NewTransactionFramework(protocol *protocol.Protocol, genesisSeed []byte, ac return tf } -func (t *TransactionFramework) RegisterTransaction(alias string, transaction *iotago.Transaction) { +func (t *TransactionFramework) RegisterTransaction(alias string, transaction *iotago.SignedTransaction) { currentAPI := t.apiProvider.CurrentAPI() (lo.PanicOnErr(transaction.ID())).RegisterAlias(alias) @@ -69,7 +69,7 @@ func (t *TransactionFramework) RegisterTransaction(alias string, transaction *io } } -func (t *TransactionFramework) CreateTransactionWithOptions(alias string, signingWallets []*mock.HDWallet, opts ...options.Option[builder.TransactionBuilder]) (*iotago.Transaction, error) { +func (t *TransactionFramework) CreateTransactionWithOptions(alias string, signingWallets []*mock.HDWallet, opts ...options.Option[builder.TransactionBuilder]) (*iotago.SignedTransaction, error) { currentAPI := t.apiProvider.CurrentAPI() walletKeys := make([]iotago.AddressKeys, 0, len(signingWallets)*2) @@ -96,7 +96,7 @@ func (t *TransactionFramework) CreateTransactionWithOptions(alias string, signin return tx, err } -func (t *TransactionFramework) CreateSimpleTransaction(alias string, outputCount int, inputAliases ...string) (*iotago.Transaction, error) { +func (t *TransactionFramework) CreateSimpleTransaction(alias string, outputCount int, inputAliases ...string) (*iotago.SignedTransaction, error) { inputStates, outputStates, signingWallets := t.CreateBasicOutputsEqually(outputCount, inputAliases...) return t.CreateTransactionWithOptions(alias, signingWallets, WithInputs(inputStates), WithOutputs(outputStates)) @@ -348,7 +348,7 @@ func (t *TransactionFramework) OutputID(alias string) iotago.OutputID { return t.Output(alias).OutputID() } -func (t *TransactionFramework) Transaction(alias string) *iotago.Transaction { +func (t *TransactionFramework) SignedTransaction(alias string) *iotago.SignedTransaction { transaction, exists := t.transactions[alias] if !exists { panic(ierrors.Errorf("transaction with given alias does not exist %s", alias)) @@ -357,16 +357,16 @@ func (t *TransactionFramework) Transaction(alias string) *iotago.Transaction { return transaction } -func (t *TransactionFramework) TransactionID(alias string) iotago.TransactionID { - return lo.PanicOnErr(t.Transaction(alias).ID()) +func (t *TransactionFramework) SignedTransactionID(alias string) iotago.SignedTransactionID { + return lo.PanicOnErr(t.SignedTransaction(alias).ID()) } -func (t *TransactionFramework) Transactions(aliases ...string) []*iotago.Transaction { - return lo.Map(aliases, t.Transaction) +func (t *TransactionFramework) SignedTransactions(aliases ...string) []*iotago.SignedTransaction { + return lo.Map(aliases, t.SignedTransaction) } -func (t *TransactionFramework) TransactionIDs(aliases ...string) []iotago.TransactionID { - return lo.Map(aliases, t.TransactionID) +func (t *TransactionFramework) SignedTransactionIDs(aliases ...string) []iotago.SignedTransactionID { + return lo.Map(aliases, t.SignedTransactionID) } func (t *TransactionFramework) DefaultAddress(addressType ...iotago.AddressType) iotago.Address { @@ -502,7 +502,7 @@ func WithAccountNativeTokens(nativeTokens iotago.NativeTokens) options.Option[bu } } -// Transaction options +// TransactionBuilder options func WithInputs(inputs utxoledger.Outputs) options.Option[builder.TransactionBuilder] { return func(txBuilder *builder.TransactionBuilder) { diff --git a/tools/evil-spammer/go.mod b/tools/evil-spammer/go.mod index b9e5473d1..5699785bb 100644 --- a/tools/evil-spammer/go.mod +++ b/tools/evil-spammer/go.mod @@ -17,7 +17,7 @@ require ( github.com/iotaledger/hive.go/runtime v0.0.0-20230926122307-d671b36a4a65 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 github.com/iotaledger/iota-core/tools/genesis-snapshot v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20230928103002-093e56bf1b19 + github.com/iotaledger/iota.go/v4 v4.0.0-20230928135522-335156827793 github.com/mr-tron/base58 v1.2.0 go.uber.org/atomic v1.11.0 ) diff --git a/tools/evil-spammer/go.sum b/tools/evil-spammer/go.sum index c21f83a62..3c5cdb21c 100644 --- a/tools/evil-spammer/go.sum +++ b/tools/evil-spammer/go.sum @@ -195,8 +195,8 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230926122307-d671b36 github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230926122307-d671b36a4a65/go.mod h1:IJgaaxbgKCsNat18jlJJEAxCY2oVYR3F30B+M4vJ89I= github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65 h1:3OmUR8yYlCENhbosY99eM3bIJQJCiLijtebt+Q6sQEs= github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/iota.go/v4 v4.0.0-20230928103002-093e56bf1b19 h1:4vN+jZJECvlfP0Bam8tonH9ndFBJoi8G0nMb4m1kpKk= -github.com/iotaledger/iota.go/v4 v4.0.0-20230928103002-093e56bf1b19/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= +github.com/iotaledger/iota.go/v4 v4.0.0-20230928135522-335156827793 h1:YyhI+h6r2PkFZE7PorDhlT4EwAOvVuW2NdNF80FshIQ= +github.com/iotaledger/iota.go/v4 v4.0.0-20230928135522-335156827793/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= 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/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= diff --git a/tools/evil-spammer/spammer/spammer.go b/tools/evil-spammer/spammer/spammer.go index 4b870351e..19333aa2d 100644 --- a/tools/evil-spammer/spammer/spammer.go +++ b/tools/evil-spammer/spammer/spammer.go @@ -224,16 +224,16 @@ func (s *Spammer) StopSpamming() { // PostTransaction use provided client to issue a transaction. It chooses API method based on Spammer options. Counts errors, // counts transactions and provides debug logs. -func (s *Spammer) PostTransaction(tx *iotago.Transaction, clt wallet.Client) { - if tx == nil { +func (s *Spammer) PostTransaction(signedTx *iotago.SignedTransaction, clt wallet.Client) { + if signedTx == nil { s.log.Debug(ErrTransactionIsNil) s.ErrCounter.CountError(ErrTransactionIsNil) return } - txID := lo.PanicOnErr(tx.ID()) - allSolid := s.handleSolidityForReuseOutputs(clt, tx) + txID := lo.PanicOnErr(signedTx.ID()) + allSolid := s.handleSolidityForReuseOutputs(clt, signedTx) if !allSolid { s.log.Debug(ErrInputsNotSolid) s.ErrCounter.CountError(ierrors.Wrapf(ErrInputsNotSolid, "txID: %s", txID.ToHex())) @@ -241,7 +241,7 @@ func (s *Spammer) PostTransaction(tx *iotago.Transaction, clt wallet.Client) { return } - blockID, err := clt.PostTransaction(tx) + blockID, err := clt.PostTransaction(signedTx) if err != nil { s.log.Debug(ierrors.Wrapf(ErrFailPostTransaction, err.Error())) s.ErrCounter.CountError(ierrors.Wrapf(ErrFailPostTransaction, err.Error())) @@ -250,7 +250,7 @@ func (s *Spammer) PostTransaction(tx *iotago.Transaction, clt wallet.Client) { } if s.EvilScenario.OutputWallet.Type() == wallet.Reuse { var outputIDs iotago.OutputIDs - for index := range tx.Essence.Outputs { + for index := range signedTx.Transaction.Outputs { outputIDs = append(outputIDs, iotago.OutputIDFromTransactionIDAndIndex(txID, uint16(index))) } s.EvilWallet.SetTxOutputsSolid(outputIDs, clt.URL()) @@ -260,10 +260,10 @@ func (s *Spammer) PostTransaction(tx *iotago.Transaction, clt wallet.Client) { s.log.Debugf("%s: Last transaction sent, ID: %s, txCount: %d", blockID.ToHex(), txID.ToHex(), count) } -func (s *Spammer) handleSolidityForReuseOutputs(_ wallet.Client, _ *iotago.Transaction) (ok bool) { - // ok = s.EvilWallet.AwaitInputsSolidity(tx.Essence().Inputs(), clt) +func (s *Spammer) handleSolidityForReuseOutputs(_ wallet.Client, _ *iotago.SignedTransaction) (ok bool) { + // ok = s.EvilWallet.AwaitInputsSolidity(tx.SignedTransaction().Inputs(), clt) // if s.EvilScenario.OutputWallet.Type() == wallet.Reuse { - // s.EvilWallet.AddReuseOutputsToThePool(tx.Essence().Outputs()) + // s.EvilWallet.AddReuseOutputsToThePool(tx.SignedTransaction().Outputs()) // } return true } diff --git a/tools/evil-spammer/spammer/spamming_functions.go b/tools/evil-spammer/spammer/spamming_functions.go index 1473ce8cb..7eca19a76 100644 --- a/tools/evil-spammer/spammer/spamming_functions.go +++ b/tools/evil-spammer/spammer/spamming_functions.go @@ -50,7 +50,7 @@ func CustomConflictSpammingFunc(s *Spammer) { wg := sync.WaitGroup{} for i, tx := range txs { wg.Add(1) - go func(clt wallet.Client, tx *iotago.Transaction) { + go func(clt wallet.Client, tx *iotago.SignedTransaction) { defer wg.Done() // sleep randomly to avoid issuing blocks in different goroutines at once diff --git a/tools/evil-spammer/wallet/connector.go b/tools/evil-spammer/wallet/connector.go index cf7da96aa..e02c81b00 100644 --- a/tools/evil-spammer/wallet/connector.go +++ b/tools/evil-spammer/wallet/connector.go @@ -162,7 +162,7 @@ type Client interface { // URL returns a client API url. URL() (cltID string) // PostTransaction sends a transaction to the Tangle via a given client. - PostTransaction(tx *iotago.Transaction) (iotago.BlockID, error) + PostTransaction(tx *iotago.SignedTransaction) (iotago.BlockID, error) // PostData sends the given data (payload) by creating a block in the backend. PostData(data []byte) (blkID string, err error) // GetTransactionConfirmationState returns the AcceptanceState of a given transaction ID. @@ -172,7 +172,7 @@ type Client interface { // GetOutputConfirmationState gets the first unspent outputs of a given address. GetOutputConfirmationState(outputID iotago.OutputID) string // GetTransaction gets the transaction. - GetTransaction(txID iotago.TransactionID) (resp *iotago.Transaction, err error) + GetTransaction(txID iotago.TransactionID) (resp *iotago.SignedTransaction, err error) // GetBlockIssuance returns the latest commitment and data needed to create a new block. GetBlockIssuance() (resp *apimodels.IssuanceBlockHeaderResponse, err error) @@ -220,7 +220,7 @@ func NewWebClient(url string, opts ...options.Option[WebClient]) *WebClient { } // PostTransaction sends a transaction to the Tangle via a given client. -func (c *WebClient) PostTransaction(tx *iotago.Transaction) (blockID iotago.BlockID, err error) { +func (c *WebClient) PostTransaction(tx *iotago.SignedTransaction) (blockID iotago.BlockID, err error) { blockBuilder := builder.NewBasicBlockBuilder(c.client.CurrentAPI()) blockBuilder.Payload(tx) @@ -289,7 +289,7 @@ func (c *WebClient) GetTransactionConfirmationState(txID iotago.TransactionID) s } // GetTransaction gets the transaction. -func (c *WebClient) GetTransaction(txID iotago.TransactionID) (tx *iotago.Transaction, err error) { +func (c *WebClient) GetTransaction(txID iotago.TransactionID) (tx *iotago.SignedTransaction, err error) { resp, err := c.client.TransactionIncludedBlock(context.Background(), txID) if err != nil { return @@ -300,7 +300,7 @@ func (c *WebClient) GetTransaction(txID iotago.TransactionID) (tx *iotago.Transa return } - tx, _ = modelBlk.Transaction() + tx, _ = modelBlk.SignedTransaction() return tx, nil } diff --git a/tools/evil-spammer/wallet/evilwallet.go b/tools/evil-spammer/wallet/evilwallet.go index b1f8fe11e..05e41ae6f 100644 --- a/tools/evil-spammer/wallet/evilwallet.go +++ b/tools/evil-spammer/wallet/evilwallet.go @@ -291,27 +291,27 @@ func (e *EvilWallet) requestFaucetFunds(wallet *Wallet) (outputID *Output, err e txBuilder.AddTaggedDataPayload(&iotago.TaggedData{Tag: []byte("faucet funds"), Data: []byte("to addr" + receiveAddr.String())}) txBuilder.SetCreationSlot(clt.CurrentAPI().TimeProvider().SlotFromTime(time.Now())) - tx, err := txBuilder.Build(e.faucet.AddressSigner(faucetAddr)) + signedTx, err := txBuilder.Build(e.faucet.AddressSigner(faucetAddr)) if err != nil { return nil, err } // send transaction - _, err = clt.PostTransaction(tx) + _, err = clt.PostTransaction(signedTx) if err != nil { return nil, err } // requested output to split and use in spammer - output := e.outputManager.CreateOutputFromAddress(wallet, receiveAddr, faucetTokensPerRequest, iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(tx.ID()), 0), tx.Essence.Outputs[0]) + output := e.outputManager.CreateOutputFromAddress(wallet, receiveAddr, faucetTokensPerRequest, iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(signedTx.ID()), 0), signedTx.Transaction.Outputs[0]) // set remainder output to be reused by the faucet wallet e.faucet.AddUnspentOutput(&Output{ - OutputID: iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(tx.ID()), 1), + OutputID: iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(signedTx.ID()), 1), Address: faucetAddr, Index: 0, - Balance: tx.Essence.Outputs[1].BaseTokenAmount(), - OutputStruct: tx.Essence.Outputs[1], + Balance: signedTx.Transaction.Outputs[1].BaseTokenAmount(), + OutputStruct: signedTx.Transaction.Outputs[1], }) return output, nil @@ -325,18 +325,18 @@ func (e *EvilWallet) splitOutputs(splitOutput *Output, inputWallet, outputWallet input, outputs := e.handleInputOutputDuringSplitOutputs(splitOutput, FaucetRequestSplitNumber, outputWallet) - tx, err := e.CreateTransaction(WithInputs(input), WithOutputs(outputs), WithIssuer(inputWallet), WithOutputWallet(outputWallet)) + signedTx, err := e.CreateTransaction(WithInputs(input), WithOutputs(outputs), WithIssuer(inputWallet), WithOutputWallet(outputWallet)) if err != nil { return iotago.TransactionID{}, err } - _, err = e.connector.GetClient().PostTransaction(tx) + _, err = e.connector.GetClient().PostTransaction(signedTx) if err != nil { fmt.Println(err) return iotago.TransactionID{}, err } - return lo.PanicOnErr(tx.ID()), nil + return lo.PanicOnErr(signedTx.ID()), nil } func (e *EvilWallet) handleInputOutputDuringSplitOutputs(splitOutput *Output, splitNumber int, receiveWallet *Wallet) (input *Output, outputs []*OutputOption) { @@ -364,11 +364,11 @@ func (e *EvilWallet) ClearAllAliases() { e.aliasManager.ClearAllAliases() } -func (e *EvilWallet) PrepareCustomConflicts(conflictsMaps []ConflictSlice) (conflictBatch [][]*iotago.Transaction, err error) { +func (e *EvilWallet) PrepareCustomConflicts(conflictsMaps []ConflictSlice) (conflictBatch [][]*iotago.SignedTransaction, err error) { for _, conflictMap := range conflictsMaps { - var txs []*iotago.Transaction - for _, options := range conflictMap { - tx, err2 := e.CreateTransaction(options...) + var txs []*iotago.SignedTransaction + for _, conflictOptions := range conflictMap { + tx, err2 := e.CreateTransaction(conflictOptions...) if err2 != nil { return nil, err2 } @@ -396,9 +396,9 @@ func (e *EvilWallet) SendCustomConflicts(conflictsMaps []ConflictSlice) (err err wg := sync.WaitGroup{} for i, tx := range txs { wg.Add(1) - go func(clt Client, tx *iotago.Transaction) { + go func(clt Client, signedTx *iotago.SignedTransaction) { defer wg.Done() - _, _ = clt.PostTransaction(tx) + _, _ = clt.PostTransaction(signedTx) }(clients[i], tx) } wg.Wait() @@ -414,7 +414,7 @@ func (e *EvilWallet) SendCustomConflicts(conflictsMaps []ConflictSlice) (err err // Inputs of the transaction are determined in three ways: // 1 - inputs are provided directly without associated alias, 2- alias is provided, and input is already stored in an alias manager, // 3 - alias is provided, and there are no inputs assigned in Alias manager, so aliases are assigned to next ready inputs from input wallet. -func (e *EvilWallet) CreateTransaction(options ...Option) (tx *iotago.Transaction, err error) { +func (e *EvilWallet) CreateTransaction(options ...Option) (signedTx *iotago.SignedTransaction, err error) { buildOptions, err := NewOptions(options...) if err != nil { return nil, err @@ -445,23 +445,23 @@ func (e *EvilWallet) CreateTransaction(options ...Option) (tx *iotago.Transactio } } - tx, err = e.makeTransaction(inputs, outputs, buildOptions.inputWallet) + signedTx, err = e.makeTransaction(inputs, outputs, buildOptions.inputWallet) if err != nil { return nil, err } - e.addOutputsToOutputManager(tx, buildOptions.outputWallet, tempWallet, tempAddresses) - e.registerOutputAliases(tx, addrAliasMap) + e.addOutputsToOutputManager(signedTx, buildOptions.outputWallet, tempWallet, tempAddresses) + e.registerOutputAliases(signedTx, addrAliasMap) return } // addOutputsToOutputManager adds output to the OutputManager if. -func (e *EvilWallet) addOutputsToOutputManager(tx *iotago.Transaction, outWallet, tmpWallet *Wallet, tempAddresses map[string]types.Empty) { - for idx, o := range tx.Essence.Outputs { +func (e *EvilWallet) addOutputsToOutputManager(signedTx *iotago.SignedTransaction, outWallet, tmpWallet *Wallet, tempAddresses map[string]types.Empty) { + for idx, o := range signedTx.Transaction.Outputs { addr := o.UnlockConditionSet().Address().Address out := &Output{ - OutputID: iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(tx.ID()), uint16(idx)), + OutputID: iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(signedTx.ID()), uint16(idx)), Address: addr, Balance: o.BaseTokenAmount(), OutputStruct: o, @@ -498,13 +498,13 @@ func (e *EvilWallet) updateInputWallet(buildOptions *Options) error { return nil } -func (e *EvilWallet) registerOutputAliases(tx *iotago.Transaction, addrAliasMap map[string]string) { +func (e *EvilWallet) registerOutputAliases(signedTx *iotago.SignedTransaction, addrAliasMap map[string]string) { if len(addrAliasMap) == 0 { return } - for idx := range tx.Essence.Outputs { - id := iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(tx.ID()), uint16(idx)) + for idx := range signedTx.Transaction.Outputs { + id := iotago.OutputIDFromTransactionIDAndIndex(lo.PanicOnErr(signedTx.ID()), uint16(idx)) out := e.outputManager.GetOutput(id) // register output alias @@ -707,7 +707,7 @@ func (e *EvilWallet) updateOutputBalances(buildOptions *Options) (err error) { return } -func (e *EvilWallet) makeTransaction(inputs []*Output, outputs iotago.Outputs[iotago.Output], w *Wallet) (tx *iotago.Transaction, err error) { +func (e *EvilWallet) makeTransaction(inputs []*Output, outputs iotago.Outputs[iotago.Output], w *Wallet) (tx *iotago.SignedTransaction, err error) { clt := e.Connector().GetClient() txBuilder := builder.NewTransactionBuilder(clt.CurrentAPI()) @@ -741,9 +741,9 @@ func (e *EvilWallet) makeTransaction(inputs []*Output, outputs iotago.Outputs[io return txBuilder.Build(iotago.NewInMemoryAddressSigner(walletKeys...)) } -func (e *EvilWallet) PrepareCustomConflictsSpam(scenario *EvilScenario) (txs [][]*iotago.Transaction, allAliases ScenarioAlias, err error) { +func (e *EvilWallet) PrepareCustomConflictsSpam(scenario *EvilScenario) (signedTxs [][]*iotago.SignedTransaction, allAliases ScenarioAlias, err error) { conflicts, allAliases := e.prepareConflictSliceForScenario(scenario) - txs, err = e.PrepareCustomConflicts(conflicts) + signedTxs, err = e.PrepareCustomConflicts(conflicts) return } diff --git a/tools/evil-spammer/wallet/output_manager.go b/tools/evil-spammer/wallet/output_manager.go index 1ab6ffe47..559c8521f 100644 --- a/tools/evil-spammer/wallet/output_manager.go +++ b/tools/evil-spammer/wallet/output_manager.go @@ -239,7 +239,7 @@ func (o *OutputManager) RequestOutputsByTxID(txID iotago.TransactionID) (outputI return } - for index := range tx.Essence.Outputs { + for index := range tx.Transaction.Outputs { outputIDs = append(outputIDs, iotago.OutputIDFromTransactionIDAndIndex(txID, uint16(index))) } diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index ae1c79100..a0477489b 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -72,7 +72,7 @@ require ( github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65 // indirect github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230927140518-622f63be6182 // indirect github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230927140257-bfa0bb0af2bd // indirect - github.com/iotaledger/iota.go/v4 v4.0.0-20230928103002-093e56bf1b19 // indirect + github.com/iotaledger/iota.go/v4 v4.0.0-20230928135522-335156827793 // indirect github.com/ipfs/boxo v0.10.0 // 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 9c689ecab..3dd8f95cd 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -311,8 +311,8 @@ github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230927140518-622f63be6182 h1:lQikt github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230927140518-622f63be6182/go.mod h1:q24QEsS887ZWJVX76w2kwSgC84KS7wIKOy1otuqZ2ZM= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230927140257-bfa0bb0af2bd h1:nFG3Zq/zFA4KhBYFX2IezX1C74zfE0DqCt0LrgTa9Ig= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230927140257-bfa0bb0af2bd/go.mod h1:c5778OnWpLq108YE+Eb2m8Ri/t/4ydV0TvI/Sy5YivQ= -github.com/iotaledger/iota.go/v4 v4.0.0-20230928103002-093e56bf1b19 h1:4vN+jZJECvlfP0Bam8tonH9ndFBJoi8G0nMb4m1kpKk= -github.com/iotaledger/iota.go/v4 v4.0.0-20230928103002-093e56bf1b19/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= +github.com/iotaledger/iota.go/v4 v4.0.0-20230928135522-335156827793 h1:YyhI+h6r2PkFZE7PorDhlT4EwAOvVuW2NdNF80FshIQ= +github.com/iotaledger/iota.go/v4 v4.0.0-20230928135522-335156827793/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY= github.com/ipfs/boxo v0.10.0/go.mod h1:Fg+BnfxZ0RPzR0nOodzdIq3A7KgoWAOWsEIImrIQdBM= 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 efd34f5ac..16af91601 100644 --- a/tools/genesis-snapshot/go.mod +++ b/tools/genesis-snapshot/go.mod @@ -10,7 +10,7 @@ require ( github.com/iotaledger/hive.go/lo v0.0.0-20230926122307-d671b36a4a65 github.com/iotaledger/hive.go/runtime v0.0.0-20230926122307-d671b36a4a65 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20230928103002-093e56bf1b19 + github.com/iotaledger/iota.go/v4 v4.0.0-20230928135522-335156827793 github.com/mr-tron/base58 v1.2.0 github.com/spf13/pflag v1.0.5 golang.org/x/crypto v0.13.0 diff --git a/tools/genesis-snapshot/go.sum b/tools/genesis-snapshot/go.sum index 7e21bba5c..b3538992e 100644 --- a/tools/genesis-snapshot/go.sum +++ b/tools/genesis-snapshot/go.sum @@ -50,8 +50,8 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230926122307-d671b36 github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230926122307-d671b36a4a65/go.mod h1:IJgaaxbgKCsNat18jlJJEAxCY2oVYR3F30B+M4vJ89I= github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65 h1:3OmUR8yYlCENhbosY99eM3bIJQJCiLijtebt+Q6sQEs= github.com/iotaledger/hive.go/stringify v0.0.0-20230926122307-d671b36a4a65/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/iota.go/v4 v4.0.0-20230928103002-093e56bf1b19 h1:4vN+jZJECvlfP0Bam8tonH9ndFBJoi8G0nMb4m1kpKk= -github.com/iotaledger/iota.go/v4 v4.0.0-20230928103002-093e56bf1b19/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= +github.com/iotaledger/iota.go/v4 v4.0.0-20230928135522-335156827793 h1:YyhI+h6r2PkFZE7PorDhlT4EwAOvVuW2NdNF80FshIQ= +github.com/iotaledger/iota.go/v4 v4.0.0-20230928135522-335156827793/go.mod h1:wR9xBbsofns9hFyRHFZ2bDYIb861qsfmQPVMBKcPvDo= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= diff --git a/tools/genesis-snapshot/presets/presets.go b/tools/genesis-snapshot/presets/presets.go index 4167b8cde..dbfee7494 100644 --- a/tools/genesis-snapshot/presets/presets.go +++ b/tools/genesis-snapshot/presets/presets.go @@ -26,7 +26,7 @@ var Base = []options.Option[snapshotcreator.Options]{ iotago.WithLivenessOptions(30, 30, 7, 14, 30), // increase/decrease threshold = fraction * slotDurationInSeconds * schedulerRate iotago.WithCongestionControlOptions(500, 500, 500, 800000, 500000, 100000, 1, 1000, 100), - iotago.WithWorkScoreOptions(25, 1, 10, 100, 50, 10, 10, 50, 1, 10, 250, 2), + iotago.WithWorkScoreOptions(25, 1, 100, 50, 10, 10, 50, 1, 10, 250), ), ), snapshotcreator.WithRootBlocks(map[iotago.BlockID]iotago.CommitmentID{ @@ -43,7 +43,7 @@ var Docker = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinValidatorAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x293dc170d9a59474e6d81cfba7f7d924c09b25d7166bcfba606e53114d0a758b")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.BlockIssuanceCredits(iotago.MaxBlockIssuanceCredits), + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, StakingEpochEnd: iotago.MaxEpochIndex, FixedCost: 1, StakedAmount: testsuite.MinValidatorAccountAmount, @@ -55,7 +55,7 @@ var Docker = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinValidatorAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x05c1de274451db8de8182d64c6ee0dca3ae0c9077e0b4330c976976171d79064")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.BlockIssuanceCredits(iotago.MaxBlockIssuanceCredits), + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, StakingEpochEnd: iotago.MaxEpochIndex, FixedCost: 1, StakedAmount: testsuite.MinValidatorAccountAmount, @@ -67,7 +67,7 @@ var Docker = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinValidatorAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x1e4b21eb51dcddf65c20db1065e1f1514658b23a3ddbf48d30c0efc926a9a648")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.BlockIssuanceCredits(iotago.MaxBlockIssuanceCredits), + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, StakingEpochEnd: iotago.MaxEpochIndex, FixedCost: 1, StakedAmount: testsuite.MinValidatorAccountAmount, @@ -79,7 +79,7 @@ var Docker = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinIssuerAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0xa54fafa44a88e4a6a37796526ea884f613a24d84337871226eb6360f022d8b39")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.BlockIssuanceCredits(iotago.MaxBlockIssuanceCredits), + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, Mana: iotago.Mana(testsuite.MinIssuerAccountAmount), }, snapshotcreator.AccountDetails{ // nomana2 @@ -88,7 +88,7 @@ var Docker = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinIssuerAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0xcb5ea14175ce649149ee41217c44aa70c3205b9939968449eae408727a71f91b")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.BlockIssuanceCredits(iotago.MaxBlockIssuanceCredits), + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, Mana: iotago.Mana(testsuite.MinIssuerAccountAmount), }, ), @@ -100,7 +100,7 @@ var Docker = []options.Option[snapshotcreator.Options]{ iotago.WithLivenessOptions(30, 30, 7, 14, 30), // increase/decrease threshold = fraction * slotDurationInSeconds * schedulerRate iotago.WithCongestionControlOptions(500, 500, 500, 800000, 500000, 100000, 1, 1000, 100), - iotago.WithWorkScoreOptions(25, 1, 10, 100, 50, 10, 10, 50, 1, 10, 250, 2), + iotago.WithWorkScoreOptions(25, 1, 100, 50, 10, 10, 50, 1, 10, 250), ), ), } @@ -115,7 +115,7 @@ var Feature = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinValidatorAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x01fb6b9db5d96240aef00bc950d1c67a6494513f6d7cf784e57b4972b96ab2fe")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.BlockIssuanceCredits(iotago.MaxBlockIssuanceCredits), + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, StakingEpochEnd: iotago.MaxEpochIndex, FixedCost: 1, StakedAmount: testsuite.MinValidatorAccountAmount, @@ -127,7 +127,7 @@ var Feature = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinValidatorAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x83e7f71a440afd48981a8b4684ddae24434b7182ce5c47cfb56ac528525fd4b6")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.BlockIssuanceCredits(iotago.MaxBlockIssuanceCredits), + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, StakingEpochEnd: iotago.MaxEpochIndex, FixedCost: 1, StakedAmount: testsuite.MinValidatorAccountAmount, @@ -139,7 +139,7 @@ var Feature = []options.Option[snapshotcreator.Options]{ Amount: testsuite.MinValidatorAccountAmount, IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0xac628986b2ef52a1679f2289fcd7b4198476976dea4c30ae34ff04ae52e14805")))), ExpirySlot: iotago.MaxSlotIndex, - BlockIssuanceCredits: iotago.BlockIssuanceCredits(iotago.MaxBlockIssuanceCredits), + BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits, StakingEpochEnd: iotago.MaxEpochIndex, FixedCost: 1, StakedAmount: testsuite.MinValidatorAccountAmount, @@ -154,7 +154,7 @@ var Feature = []options.Option[snapshotcreator.Options]{ iotago.WithLivenessOptions(30, 30, 10, 20, 30), // increase/decrease threshold = fraction * slotDurationInSeconds * schedulerRate iotago.WithCongestionControlOptions(500, 500, 500, 800000, 500000, 100000, 1, 1000, 100), - iotago.WithWorkScoreOptions(25, 1, 10, 100, 50, 10, 10, 50, 1, 10, 250, 2), + iotago.WithWorkScoreOptions(25, 1, 100, 50, 10, 10, 50, 1, 10, 250), ), ), }