Skip to content

Commit

Permalink
Merge pull request #581 from iotaledger/chore/move-rand-funcs-to-iota.go
Browse files Browse the repository at this point in the history
Move rand funcs to iota.go
  • Loading branch information
muXxer authored Dec 1, 2023
2 parents aefe705 + b3e0952 commit 4b243d0
Show file tree
Hide file tree
Showing 18 changed files with 142 additions and 451 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/iotaledger/hive.go/stringify v0.0.0-20231128121006-331a9e522dfe
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231128163614-c82e1fa40733
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231128162307-cc6b309e93ef
github.com/iotaledger/iota.go/v4 v4.0.0-20231128162016-23f1b4e12cec
github.com/iotaledger/iota.go/v4 v4.0.0-20231201103607-03a45ba3707f
github.com/labstack/echo/v4 v4.11.3
github.com/labstack/gommon v0.4.1
github.com/libp2p/go-libp2p v0.32.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231128163614-c82e1fa40733 h1:jdjFT
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231128163614-c82e1fa40733/go.mod h1:3ae5TFi3uaECV+F4d5ekKz+xcJQmVtCICcs/Rhvgn3w=
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231128162307-cc6b309e93ef h1:RImO23W0kL3U9egdLoi5OTmOIhE5rHfR/dKM/6XhZeE=
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231128162307-cc6b309e93ef/go.mod h1:bi0zndM3irf8FHYUg6MzG/Zk/t0fV8IwGXAdoT7wn98=
github.com/iotaledger/iota.go/v4 v4.0.0-20231128162016-23f1b4e12cec h1:u9SAuKHygJwqwYxoEd+PyHCU4fTftcPdV2ZUGSRZe8o=
github.com/iotaledger/iota.go/v4 v4.0.0-20231128162016-23f1b4e12cec/go.mod h1:aO+5iL0vTNwNfE4QMGHVIufGziSI1wTvwJY1ipSMgCk=
github.com/iotaledger/iota.go/v4 v4.0.0-20231201103607-03a45ba3707f h1:uT4ZKAyr/wk6lHcTQifAeEPb6WfBA5tdG7kEuyW7tDU=
github.com/iotaledger/iota.go/v4 v4.0.0-20231201103607-03a45ba3707f/go.mod h1:aO+5iL0vTNwNfE4QMGHVIufGziSI1wTvwJY1ipSMgCk=
github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI=
github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk=
github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s=
Expand Down
12 changes: 4 additions & 8 deletions pkg/core/account/accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package account_test

import (
"bytes"
"math/rand"
"testing"

"github.com/stretchr/testify/require"

"github.com/iotaledger/iota-core/pkg/core/account"
iotago "github.com/iotaledger/iota.go/v4"
"github.com/iotaledger/iota.go/v4/tpkg"
)

func TestAccounts(t *testing.T) {
Expand Down Expand Up @@ -49,7 +49,7 @@ func TestAccounts(t *testing.T) {
})

// check "Get" for non existing IDs
_, exists := accounts.Get([32]byte{0, randByte()})
_, exists := accounts.Get([32]byte{0, tpkg.RandByte()})
require.False(t, exists)

for id, stake := range issuers {
Expand Down Expand Up @@ -118,7 +118,7 @@ func TestAccounts(t *testing.T) {
/*
// Get a non existed account
_, exist = accounts.Get([32]byte{randByte()})
_, exist = accounts.Get([32]byte{tpkg.RandByte()})
require.False(t, exist)
*/
Expand All @@ -131,7 +131,7 @@ func generateAccounts(count int) (map[iotago.AccountID]iotago.BaseToken, iotago.
var totalStake iotago.BaseToken

for i := 0; i < count; i++ {
id := iotago.AccountID([32]byte{randByte()})
id := iotago.AccountID([32]byte{tpkg.RandByte()})
if _, exist := seenIDs[id]; exist {
i--
continue
Expand All @@ -145,7 +145,3 @@ func generateAccounts(count int) (map[iotago.AccountID]iotago.BaseToken, iotago.

return issuers, totalStake
}

func randByte() byte {
return byte(rand.Intn(256))
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/iotaledger/iota-core/pkg/protocol/engine/accounts/accountsledger"
"github.com/iotaledger/iota-core/pkg/protocol/engine/blocks"
"github.com/iotaledger/iota-core/pkg/storage/prunable/slotstore"
"github.com/iotaledger/iota-core/pkg/utils"
iotago "github.com/iotaledger/iota.go/v4"
"github.com/iotaledger/iota.go/v4/tpkg"
)
Expand Down Expand Up @@ -326,7 +325,7 @@ func (t *TestSuite) BlockIssuerKey(alias string, createIfNotExists bool) iotago.
panic(fmt.Sprintf("block issuer key with alias '%s' does not exist", alias))
}

t.blockIssuerKeys[alias] = utils.RandBlockIssuerKey()
t.blockIssuerKeys[alias] = tpkg.RandBlockIssuerKey()

return t.blockIssuerKeys[alias]
}
Expand Down
47 changes: 23 additions & 24 deletions pkg/protocol/engine/utxoledger/iteration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,25 @@ import (
"github.com/iotaledger/hive.go/kvstore/mapdb"
"github.com/iotaledger/iota-core/pkg/protocol/engine/utxoledger"
"github.com/iotaledger/iota-core/pkg/protocol/engine/utxoledger/tpkg"
"github.com/iotaledger/iota-core/pkg/utils"
iotago "github.com/iotaledger/iota.go/v4"
iotago_tpkg "github.com/iotaledger/iota.go/v4/tpkg"
)

func TestUTXOComputeBalance(t *testing.T) {
manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.TestAPI))

initialOutput := tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputBasic, utils.RandAddress(iotago.AddressEd25519), 2_134_656_365)
initialOutput := tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputBasic, iotago_tpkg.RandAddress(iotago.AddressEd25519), 2_134_656_365)
require.NoError(t, manager.AddGenesisUnspentOutput(initialOutput))
require.NoError(t, manager.AddGenesisUnspentOutput(tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputAccount, utils.RandAddress(iotago.AddressAccount), 56_549_524)))
require.NoError(t, manager.AddGenesisUnspentOutput(tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputAnchor, utils.RandAddress(iotago.AddressAccount), 56_549_524)))
require.NoError(t, manager.AddGenesisUnspentOutput(tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputFoundry, utils.RandAddress(iotago.AddressAccount), 25_548_858)))
require.NoError(t, manager.AddGenesisUnspentOutput(tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputNFT, utils.RandAddress(iotago.AddressEd25519), 545_699_656)))
require.NoError(t, manager.AddGenesisUnspentOutput(tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputBasic, utils.RandAddress(iotago.AddressAccount), 626_659_696)))
require.NoError(t, manager.AddGenesisUnspentOutput(tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputAccount, iotago_tpkg.RandAddress(iotago.AddressAccount), 56_549_524)))
require.NoError(t, manager.AddGenesisUnspentOutput(tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputAnchor, iotago_tpkg.RandAddress(iotago.AddressAccount), 56_549_524)))
require.NoError(t, manager.AddGenesisUnspentOutput(tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputFoundry, iotago_tpkg.RandAddress(iotago.AddressAccount), 25_548_858)))
require.NoError(t, manager.AddGenesisUnspentOutput(tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputNFT, iotago_tpkg.RandAddress(iotago.AddressEd25519), 545_699_656)))
require.NoError(t, manager.AddGenesisUnspentOutput(tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputBasic, iotago_tpkg.RandAddress(iotago.AddressAccount), 626_659_696)))

index := iotago.SlotIndex(756)

outputs := utxoledger.Outputs{
tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputBasic, utils.RandAddress(iotago.AddressNFT), 2_134_656_365),
tpkg.RandLedgerStateOutputOnAddressWithAmount(iotago.OutputBasic, iotago_tpkg.RandAddress(iotago.AddressNFT), 2_134_656_365),
}

spents := utxoledger.Spents{
Expand All @@ -55,22 +54,22 @@ func TestUTXOIteration(t *testing.T) {
manager := utxoledger.New(mapdb.NewMapDB(), iotago.SingleVersionProvider(iotago_tpkg.TestAPI))

outputs := utxoledger.Outputs{
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, utils.RandAddress(iotago.AddressEd25519)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, utils.RandAddress(iotago.AddressNFT)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, utils.RandAddress(iotago.AddressAccount)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, utils.RandAddress(iotago.AddressEd25519)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, utils.RandAddress(iotago.AddressNFT)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, utils.RandAddress(iotago.AddressAccount)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, utils.RandAddress(iotago.AddressEd25519)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputNFT, utils.RandAddress(iotago.AddressEd25519)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputNFT, utils.RandAddress(iotago.AddressAccount)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputNFT, utils.RandAddress(iotago.AddressNFT)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputNFT, utils.RandAddress(iotago.AddressAccount)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputAccount, utils.RandAddress(iotago.AddressEd25519)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputAnchor, utils.RandAddress(iotago.AddressEd25519)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputFoundry, utils.RandAddress(iotago.AddressAccount)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputFoundry, utils.RandAddress(iotago.AddressAccount)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputFoundry, utils.RandAddress(iotago.AddressAccount)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, iotago_tpkg.RandAddress(iotago.AddressEd25519)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, iotago_tpkg.RandAddress(iotago.AddressNFT)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, iotago_tpkg.RandAddress(iotago.AddressAccount)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, iotago_tpkg.RandAddress(iotago.AddressEd25519)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, iotago_tpkg.RandAddress(iotago.AddressNFT)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, iotago_tpkg.RandAddress(iotago.AddressAccount)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputBasic, iotago_tpkg.RandAddress(iotago.AddressEd25519)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputNFT, iotago_tpkg.RandAddress(iotago.AddressEd25519)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputNFT, iotago_tpkg.RandAddress(iotago.AddressAccount)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputNFT, iotago_tpkg.RandAddress(iotago.AddressNFT)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputNFT, iotago_tpkg.RandAddress(iotago.AddressAccount)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputAccount, iotago_tpkg.RandAddress(iotago.AddressEd25519)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputAnchor, iotago_tpkg.RandAddress(iotago.AddressEd25519)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputFoundry, iotago_tpkg.RandAddress(iotago.AddressAccount)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputFoundry, iotago_tpkg.RandAddress(iotago.AddressAccount)),
tpkg.RandLedgerStateOutputOnAddress(iotago.OutputFoundry, iotago_tpkg.RandAddress(iotago.AddressAccount)),
}

index := iotago.SlotIndex(756)
Expand Down
105 changes: 52 additions & 53 deletions pkg/protocol/engine/utxoledger/output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/iotaledger/hive.go/serializer/v2/byteutils"
"github.com/iotaledger/iota-core/pkg/protocol/engine/utxoledger"
"github.com/iotaledger/iota-core/pkg/protocol/engine/utxoledger/tpkg"
"github.com/iotaledger/iota-core/pkg/utils"
iotago "github.com/iotaledger/iota.go/v4"
iotago_tpkg "github.com/iotaledger/iota.go/v4/tpkg"
)
Expand Down Expand Up @@ -108,7 +107,7 @@ func CreateOutputAndAssertSerialization(t *testing.T, blockID iotago.BlockID, in
}

func CreateSpentAndAssertSerialization(t *testing.T, output *utxoledger.Output) *utxoledger.Spent {
transactionID := utils.RandTransactionID()
transactionID := iotago_tpkg.RandTransactionID()

indexSpent := iotago.SlotIndex(6788362)

Expand All @@ -128,13 +127,13 @@ func CreateSpentAndAssertSerialization(t *testing.T, output *utxoledger.Output)

func TestBasicOutputOnEd25519WithoutSpendConstraintsSerialization(t *testing.T) {
txCommitment := iotago_tpkg.Rand32ByteArray()
txCreationSlot := utils.RandSlotIndex()
blockID := utils.RandBlockID()
address := utils.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
senderAddress := utils.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
tag := utils.RandBytes(23)
txCreationSlot := iotago_tpkg.RandSlot()
blockID := iotago_tpkg.RandBlockID()
address := iotago_tpkg.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
senderAddress := iotago_tpkg.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
tag := iotago_tpkg.RandBytes(23)
amount := iotago_tpkg.RandBaseToken(iotago.MaxBaseToken)
index := utils.RandSlotIndex()
index := iotago_tpkg.RandSlot()

iotaOutput := &iotago.BasicOutput{
Amount: amount,
Expand Down Expand Up @@ -166,13 +165,13 @@ func TestBasicOutputOnEd25519WithoutSpendConstraintsSerialization(t *testing.T)

func TestBasicOutputOnEd25519WithSpendConstraintsSerialization(t *testing.T) {
txCommitment := iotago_tpkg.Rand32ByteArray()
txCreationSlot := utils.RandSlotIndex()
blockID := utils.RandBlockID()
address := utils.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
senderAddress := utils.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
txCreationSlot := iotago_tpkg.RandSlot()
blockID := iotago_tpkg.RandBlockID()
address := iotago_tpkg.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
senderAddress := iotago_tpkg.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
amount := iotago_tpkg.RandBaseToken(iotago.MaxBaseToken)
index := utils.RandSlotIndex()
timeLockUnlockSlot := utils.RandSlotIndex()
index := iotago_tpkg.RandSlot()
timeLockUnlockSlot := iotago_tpkg.RandSlot()

iotaOutput := &iotago.BasicOutput{
Amount: amount,
Expand Down Expand Up @@ -205,12 +204,12 @@ func TestBasicOutputOnEd25519WithSpendConstraintsSerialization(t *testing.T) {

func TestNFTOutputSerialization(t *testing.T) {
txCommitment := iotago_tpkg.Rand32ByteArray()
txCreationSlot := utils.RandSlotIndex()
blockID := utils.RandBlockID()
address := utils.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
nftID := utils.RandNFTID()
txCreationSlot := iotago_tpkg.RandSlot()
blockID := iotago_tpkg.RandBlockID()
address := iotago_tpkg.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
nftID := iotago_tpkg.RandNFTID()
amount := iotago_tpkg.RandBaseToken(iotago.MaxBaseToken)
index := utils.RandSlotIndex()
index := iotago_tpkg.RandSlot()

iotaOutput := &iotago.NFTOutput{
Amount: amount,
Expand All @@ -224,7 +223,7 @@ func TestNFTOutputSerialization(t *testing.T) {
ImmutableFeatures: iotago.NFTOutputImmFeatures{
&iotago.MetadataFeature{
Entries: iotago.MetadataFeatureEntries{
"data": utils.RandBytes(12),
"data": iotago_tpkg.RandBytes(12),
},
},
},
Expand All @@ -243,14 +242,14 @@ func TestNFTOutputSerialization(t *testing.T) {

func TestNFTOutputWithSpendConstraintsSerialization(t *testing.T) {
txCommitment := iotago_tpkg.Rand32ByteArray()
txCreationSlot := utils.RandSlotIndex()
blockID := utils.RandBlockID()
address := utils.RandNFTID()
issuerAddress := utils.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
nftID := utils.RandNFTID()
txCreationSlot := iotago_tpkg.RandSlot()
blockID := iotago_tpkg.RandBlockID()
address := iotago_tpkg.RandNFTID()
issuerAddress := iotago_tpkg.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
nftID := iotago_tpkg.RandNFTID()
amount := iotago_tpkg.RandBaseToken(iotago.MaxBaseToken)
index := utils.RandSlotIndex()
expirationUnlockSlot := utils.RandSlotIndex()
index := iotago_tpkg.RandSlot()
expirationUnlockSlot := iotago_tpkg.RandSlot()

iotaOutput := &iotago.NFTOutput{
Amount: amount,
Expand All @@ -268,7 +267,7 @@ func TestNFTOutputWithSpendConstraintsSerialization(t *testing.T) {
ImmutableFeatures: iotago.NFTOutputImmFeatures{
&iotago.MetadataFeature{
Entries: iotago.MetadataFeatureEntries{
"data": utils.RandBytes(12),
"data": iotago_tpkg.RandBytes(12),
},
},
&iotago.IssuerFeature{
Expand All @@ -290,14 +289,14 @@ func TestNFTOutputWithSpendConstraintsSerialization(t *testing.T) {

func TestAccountOutputSerialization(t *testing.T) {
txCommitment := iotago_tpkg.Rand32ByteArray()
txCreationSlot := utils.RandSlotIndex()
blockID := utils.RandBlockID()
aliasID := utils.RandAccountID()
address := utils.RandAccountID().ToAddress()
issuer := utils.RandNFTID()
sender := utils.RandAccountID()
txCreationSlot := iotago_tpkg.RandSlot()
blockID := iotago_tpkg.RandBlockID()
aliasID := iotago_tpkg.RandAccountID()
address := iotago_tpkg.RandAccountID().ToAddress()
issuer := iotago_tpkg.RandNFTID()
sender := iotago_tpkg.RandAccountID()
amount := iotago_tpkg.RandBaseToken(iotago.MaxBaseToken)
index := utils.RandSlotIndex()
index := iotago_tpkg.RandSlot()

iotaOutput := &iotago.AccountOutput{
Amount: amount,
Expand Down Expand Up @@ -332,15 +331,15 @@ func TestAccountOutputSerialization(t *testing.T) {

func TestAnchorOutputSerialization(t *testing.T) {
txCommitment := iotago_tpkg.Rand32ByteArray()
txCreationSlot := utils.RandSlotIndex()
blockID := utils.RandBlockID()
aliasID := utils.RandAnchorID()
stateController := utils.RandAnchorID()
governor := utils.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
issuer := utils.RandNFTID()
sender := utils.RandAnchorID()
txCreationSlot := iotago_tpkg.RandSlot()
blockID := iotago_tpkg.RandBlockID()
aliasID := iotago_tpkg.RandAnchorID()
stateController := iotago_tpkg.RandAnchorID()
governor := iotago_tpkg.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
issuer := iotago_tpkg.RandNFTID()
sender := iotago_tpkg.RandAnchorID()
amount := iotago_tpkg.RandBaseToken(iotago.MaxBaseToken)
index := utils.RandSlotIndex()
index := iotago_tpkg.RandSlot()

iotaOutput := &iotago.AnchorOutput{
Amount: amount,
Expand Down Expand Up @@ -378,16 +377,16 @@ func TestAnchorOutputSerialization(t *testing.T) {

func TestFoundryOutputSerialization(t *testing.T) {
txCommitment := iotago_tpkg.Rand32ByteArray()
txCreationSlot := utils.RandSlotIndex()
blockID := utils.RandBlockID()
aliasID := utils.RandAccountID()
txCreationSlot := iotago_tpkg.RandSlot()
blockID := iotago_tpkg.RandBlockID()
aliasID := iotago_tpkg.RandAccountID()
amount := iotago_tpkg.RandBaseToken(iotago.MaxBaseToken)
index := utils.RandSlotIndex()
index := iotago_tpkg.RandSlot()
supply := new(big.Int).SetUint64(iotago_tpkg.RandUint64(math.MaxUint64))

iotaOutput := &iotago.FoundryOutput{
Amount: amount,
SerialNumber: utils.RandUint32(math.MaxUint32),
SerialNumber: iotago_tpkg.RandUint32(math.MaxUint32),
TokenScheme: &iotago.SimpleTokenScheme{
MintedTokens: supply,
MeltedTokens: new(big.Int).SetBytes([]byte{0}),
Expand Down Expand Up @@ -415,17 +414,17 @@ func TestFoundryOutputSerialization(t *testing.T) {

func TestDelegationOutputSerialization(t *testing.T) {
txCommitment := iotago_tpkg.Rand32ByteArray()
txCreationSlot := utils.RandSlotIndex()
blockID := utils.RandBlockID()
address := utils.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
txCreationSlot := iotago_tpkg.RandSlot()
blockID := iotago_tpkg.RandBlockID()
address := iotago_tpkg.RandAddress(iotago.AddressEd25519).(*iotago.Ed25519Address)
amount := iotago_tpkg.RandBaseToken(iotago.MaxBaseToken)
index := utils.RandSlotIndex()
index := iotago_tpkg.RandSlot()

iotaOutput := &iotago.DelegationOutput{
Amount: amount,
DelegatedAmount: amount,
DelegationID: iotago_tpkg.RandDelegationID(),
ValidatorAddress: utils.RandAddress(iotago.AddressAccount).(*iotago.AccountAddress),
ValidatorAddress: iotago_tpkg.RandAddress(iotago.AddressAccount).(*iotago.AccountAddress),
StartEpoch: iotago_tpkg.RandEpoch(),
UnlockConditions: iotago.DelegationOutputUnlockConditions{
&iotago.AddressUnlockCondition{
Expand Down
Loading

0 comments on commit 4b243d0

Please sign in to comment.