From ce03b2bdd5ccbe3b38545222377e05ab3cbbe942 Mon Sep 17 00:00:00 2001 From: muXxer Date: Thu, 25 Jan 2024 19:18:27 +0100 Subject: [PATCH] Fix docker test framework --- tools/docker-network/tests/dockerframework.go | 7 ++++--- tools/docker-network/tests/options.go | 10 +++++----- tools/docker-network/tests/utils.go | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tools/docker-network/tests/dockerframework.go b/tools/docker-network/tests/dockerframework.go index d025e1a26..3c3ac3d39 100644 --- a/tools/docker-network/tests/dockerframework.go +++ b/tools/docker-network/tests/dockerframework.go @@ -18,6 +18,7 @@ import ( "github.com/mr-tron/base58" "github.com/stretchr/testify/require" + hiveEd25519 "github.com/iotaledger/hive.go/crypto/ed25519" "github.com/iotaledger/hive.go/ierrors" "github.com/iotaledger/hive.go/lo" "github.com/iotaledger/hive.go/runtime/options" @@ -335,7 +336,7 @@ func (d *DockerTestFramework) CreateAccount(opts ...options.Option[builder.Accou // transition to a full account with new Ed25519 address and staking feature accEd25519Addr, accPrivateKey := d.getAddress(iotago.AddressEd25519) - accBlockIssuerKey := iotago.Ed25519PublicKeyHashBlockIssuerKeyFromPublicKey(accPrivateKey.Public().(ed25519.PublicKey)) + accBlockIssuerKey := iotago.Ed25519PublicKeyHashBlockIssuerKeyFromPublicKey(hiveEd25519.PublicKey(accPrivateKey.Public().(ed25519.PublicKey))) accountOutput := options.Apply(builder.NewAccountOutputBuilder(accEd25519Addr, implicitAccountOutput.BaseTokenAmount()), opts, func(b *builder.AccountOutputBuilder) { b.AccountID(accountID). @@ -364,7 +365,7 @@ func (d *DockerTestFramework) CreateAccount(opts ...options.Option[builder.Accou AddCommitmentInput(&iotago.CommitmentInput{CommitmentID: lo.Return1(issuerResp.LatestCommitment.ID())}). AddBlockIssuanceCreditInput(&iotago.BlockIssuanceCreditInput{AccountID: accountID}). WithTransactionCapabilities(iotago.TransactionCapabilitiesBitMaskWithCapabilities(iotago.WithTransactionCanDoAnything())). - AllotAllMana(currentSlot, accountID). + AllotAllMana(currentSlot, accountID, 0). Build(implicitAddrSigner) require.NoError(d.Testing, err) @@ -417,7 +418,7 @@ func (d *DockerTestFramework) DelegateToValidator(from *Account, validator *Node SetCreationSlot(currentSlot). AddCommitmentInput(&iotago.CommitmentInput{CommitmentID: lo.Return1(issuerResp.LatestCommitment.ID())}). WithTransactionCapabilities(iotago.TransactionCapabilitiesBitMaskWithCapabilities(iotago.WithTransactionCanDoAnything())). - AllotAllMana(currentSlot, from.AccountID). + AllotAllMana(currentSlot, from.AccountID, 0). Build(fundsAddrSigner) require.NoError(d.Testing, err) diff --git a/tools/docker-network/tests/options.go b/tools/docker-network/tests/options.go index 8a4ed2675..bd0bc4048 100644 --- a/tools/docker-network/tests/options.go +++ b/tools/docker-network/tests/options.go @@ -37,7 +37,7 @@ func DefaultAccountOptions(protocolParams *iotago.V3ProtocolParameters) []option AccountID: blake2b.Sum256(lo.PanicOnErr(hexutil.DecodeHex("0x293dc170d9a59474e6d81cfba7f7d924c09b25d7166bcfba606e53114d0a758b"))), Address: iotago.Ed25519AddressFromPubKey(lo.PanicOnErr(hexutil.DecodeHex("0x293dc170d9a59474e6d81cfba7f7d924c09b25d7166bcfba606e53114d0a758b"))), Amount: mock.MinValidatorAccountAmount(protocolParams), - IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x293dc170d9a59474e6d81cfba7f7d924c09b25d7166bcfba606e53114d0a758b")))), + IssuerKey: iotago.Ed25519PublicKeyHashBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x293dc170d9a59474e6d81cfba7f7d924c09b25d7166bcfba606e53114d0a758b")))), ExpirySlot: iotago.MaxSlotIndex, BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 5, StakingEndEpoch: iotago.MaxEpochIndex, @@ -57,7 +57,7 @@ func DefaultAccountOptions(protocolParams *iotago.V3ProtocolParameters) []option AccountID: blake2b.Sum256(lo.PanicOnErr(hexutil.DecodeHex("0x05c1de274451db8de8182d64c6ee0dca3ae0c9077e0b4330c976976171d79064"))), Address: iotago.Ed25519AddressFromPubKey(lo.PanicOnErr(hexutil.DecodeHex("0x05c1de274451db8de8182d64c6ee0dca3ae0c9077e0b4330c976976171d79064"))), Amount: mock.MinValidatorAccountAmount(protocolParams), - IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x05c1de274451db8de8182d64c6ee0dca3ae0c9077e0b4330c976976171d79064")))), + IssuerKey: iotago.Ed25519PublicKeyHashBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x05c1de274451db8de8182d64c6ee0dca3ae0c9077e0b4330c976976171d79064")))), ExpirySlot: iotago.MaxSlotIndex, BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 5, StakingEndEpoch: iotago.MaxEpochIndex, @@ -77,7 +77,7 @@ func DefaultAccountOptions(protocolParams *iotago.V3ProtocolParameters) []option AccountID: blake2b.Sum256(lo.PanicOnErr(hexutil.DecodeHex("0x1e4b21eb51dcddf65c20db1065e1f1514658b23a3ddbf48d30c0efc926a9a648"))), Address: iotago.Ed25519AddressFromPubKey(lo.PanicOnErr(hexutil.DecodeHex("0x1e4b21eb51dcddf65c20db1065e1f1514658b23a3ddbf48d30c0efc926a9a648"))), Amount: mock.MinValidatorAccountAmount(protocolParams), - IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x1e4b21eb51dcddf65c20db1065e1f1514658b23a3ddbf48d30c0efc926a9a648")))), + IssuerKey: iotago.Ed25519PublicKeyHashBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x1e4b21eb51dcddf65c20db1065e1f1514658b23a3ddbf48d30c0efc926a9a648")))), ExpirySlot: iotago.MaxSlotIndex, BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 5, StakingEndEpoch: iotago.MaxEpochIndex, @@ -98,7 +98,7 @@ func DefaultAccountOptions(protocolParams *iotago.V3ProtocolParameters) []option AccountID: blake2b.Sum256(lo.PanicOnErr(hexutil.DecodeHex("0xc9ceac37d293155a578381aa313ee74edfa3ac73ee930d045564aae7771e8ffe"))), Address: iotago.Ed25519AddressFromPubKey(lo.PanicOnErr(hexutil.DecodeHex("0xc9ceac37d293155a578381aa313ee74edfa3ac73ee930d045564aae7771e8ffe"))), Amount: mock.MinValidatorAccountAmount(protocolParams), - IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0xc9ceac37d293155a578381aa313ee74edfa3ac73ee930d045564aae7771e8ffe")))), + IssuerKey: iotago.Ed25519PublicKeyHashBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0xc9ceac37d293155a578381aa313ee74edfa3ac73ee930d045564aae7771e8ffe")))), ExpirySlot: iotago.MaxSlotIndex, BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 5, StakingEndEpoch: iotago.MaxEpochIndex, @@ -119,7 +119,7 @@ func DefaultAccountOptions(protocolParams *iotago.V3ProtocolParameters) []option AccountID: blake2b.Sum256(lo.PanicOnErr(hexutil.DecodeHex("0x997be92a22b1933f36e26fba5f721756f95811d6b4ae21564197c2bfa4f28270"))), Address: iotago.Ed25519AddressFromPubKey(lo.PanicOnErr(hexutil.DecodeHex("0x997be92a22b1933f36e26fba5f721756f95811d6b4ae21564197c2bfa4f28270"))), Amount: mock.MinIssuerAccountAmount(protocolParams), - IssuerKey: iotago.Ed25519PublicKeyBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x997be92a22b1933f36e26fba5f721756f95811d6b4ae21564197c2bfa4f28270")))), + IssuerKey: iotago.Ed25519PublicKeyHashBlockIssuerKeyFromPublicKey(ed25519.PublicKey(lo.PanicOnErr(hexutil.DecodeHex("0x997be92a22b1933f36e26fba5f721756f95811d6b4ae21564197c2bfa4f28270")))), ExpirySlot: iotago.MaxSlotIndex, BlockIssuanceCredits: iotago.MaxBlockIssuanceCredits / 5, Mana: iotago.Mana(mock.MinIssuerAccountAmount(protocolParams)), diff --git a/tools/docker-network/tests/utils.go b/tools/docker-network/tests/utils.go index 5b5fff8b1..256dc7276 100644 --- a/tools/docker-network/tests/utils.go +++ b/tools/docker-network/tests/utils.go @@ -13,13 +13,14 @@ import ( "os" "time" + "github.com/stretchr/testify/require" + "github.com/iotaledger/hive.go/ierrors" "github.com/iotaledger/hive.go/lo" "github.com/iotaledger/iota-crypto-demo/pkg/bip32path" iotago "github.com/iotaledger/iota.go/v4" "github.com/iotaledger/iota.go/v4/api" "github.com/iotaledger/iota.go/v4/wallet" - "github.com/stretchr/testify/require" ) // Eventually asserts that given condition will be met in opts.waitFor time,