Skip to content

Commit

Permalink
Merge pull request #700 from iotaledger/fix/docker-test-framework
Browse files Browse the repository at this point in the history
Fix docker test framework
  • Loading branch information
muXxer authored Jan 25, 2024
2 parents fdc1df7 + ce03b2b commit af804ae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
7 changes: 4 additions & 3 deletions tools/docker-network/tests/dockerframework.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
10 changes: 5 additions & 5 deletions tools/docker-network/tests/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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)),
Expand Down
3 changes: 2 additions & 1 deletion tools/docker-network/tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit af804ae

Please sign in to comment.