Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/cluster-tests-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Cluster Tests Nightly

on:
pull_request:
branches: [ "develop" ]
schedule:
- cron: '0 2 * * *'
workflow_dispatch:

jobs:
cluster-tests:
name: Run cluster tests
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: "1.24.0"

- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Get dependencies
run: |
go get -v -t -d ./...

- name: Run cluster tests
run: |
make test-cluster


6 changes: 5 additions & 1 deletion clients/iota-go/iotaclient/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ func RequestFundsFromFaucet(ctx context.Context, address *iotago.Address, faucet
return err
}
if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusCreated && res.StatusCode != http.StatusAccepted {
return fmt.Errorf("post %v response code: %v", faucetUrl, res.Status)
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Printf("post %v response code: %v, error reading body: %v", faucetUrl, res.Status, err)
}
return fmt.Errorf("post %v response code: %v, body: %s", faucetUrl, res.Status, string(body))
}
defer res.Body.Close()

Expand Down
2 changes: 1 addition & 1 deletion clients/iscmove/iscmoveclient/client_assets_bag.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (c *Client) GetAssetsBagWithBalances(
return nil, fmt.Errorf("failed to call GetObject for Balance: %w", err)
}

if resGetObject.Data.Content == nil || resGetObject.Data.Content.Data.MoveObject == nil {
if resGetObject.Data == nil || resGetObject.Data.Content == nil || resGetObject.Data.Content.Data.MoveObject == nil {
return nil, fmt.Errorf("content data of AssetBag nil! (%s)", assetsBagID)
}
var coinBalance struct {
Expand Down
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"l1": {
"httpURL": "https://api.iota-rebased-alphanet.iota.cafe",
"websocketURL": "wss://api.iota-rebased-alphanet.iota.cafe",
"packageID": "0xa25cb7d5b6462009a471be13a241a2b604e66294e79a3a54d162d19e784c03b4",
"maxConnectionAttempts": 30,
"targetNetworkName": "IOTA"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/apilib/rundkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
// RunDistributedKeyGeneration runs DKG procedure on specific Wasp hosts: generates new keys and puts corresponding committee records
// into nodes. In case of success, generated address is returned
func RunDistributedKeyGeneration(ctx context.Context, client *apiclient.APIClient, peerPubKeys []string, threshold uint16, timeout ...time.Duration) (*cryptolib.Address, error) {
to := uint32(60 * 1000)
to := uint32(120 * 1000)
if len(timeout) > 0 {
n := timeout[0].Milliseconds()
if n < int64(math.MaxUint16) {
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/evmtest/Storage.abi
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"inputs":[{"internalType":"uint32","name":"_n","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"n","type":"uint32"}],"name":"Stored","type":"event"},{"inputs":[],"name":"retrieve","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_n","type":"uint32"}],"name":"store","outputs":[],"stateMutability":"nonpayable","type":"function"}]
[{"inputs":[{"internalType":"uint32","name":"_n","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"n","type":"uint32"}],"name":"Stored","type":"event"},{"inputs":[],"name":"increment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"retrieve","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_n","type":"uint32"}],"name":"store","outputs":[],"stateMutability":"nonpayable","type":"function"}]
2 changes: 1 addition & 1 deletion packages/evm/evmtest/Storage.bin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6080604052348015600e575f5ffd5b506040516102653803806102658339818101604052810190602e9190608a565b805f5f6101000a81548163ffffffff021916908363ffffffff1602179055505060b0565b5f5ffd5b5f63ffffffff82169050919050565b606c816056565b81146075575f5ffd5b50565b5f815190506084816065565b92915050565b5f60208284031215609c57609b6052565b5b5f60a7848285016078565b91505092915050565b6101a8806100bd5f395ff3fe608060405234801561000f575f5ffd5b5060043610610034575f3560e01c80632e64cec114610038578063b9e9538214610056575b5f5ffd5b610040610072565b60405161004d9190610100565b60405180910390f35b610070600480360381019061006b9190610147565b610089565b005b5f5f5f9054906101000a900463ffffffff16905090565b805f5f6101000a81548163ffffffff021916908363ffffffff1602179055507f1216415e6088a976b049b2d1fc9e52c96a2199b400aa37dc4aa9585710d03b87816040516100d79190610100565b60405180910390a150565b5f63ffffffff82169050919050565b6100fa816100e2565b82525050565b5f6020820190506101135f8301846100f1565b92915050565b5f5ffd5b610126816100e2565b8114610130575f5ffd5b50565b5f813590506101418161011d565b92915050565b5f6020828403121561015c5761015b610119565b5b5f61016984828501610133565b9150509291505056fea2646970667358221220511c1772ce98a11d06e833809d341bb69e31bab47b980d3e98730b60a578344664736f6c634300081d0033
6080604052348015600e575f5ffd5b506040516103653803806103658339818101604052810190602e9190608a565b805f5f6101000a81548163ffffffff021916908363ffffffff1602179055505060b0565b5f5ffd5b5f63ffffffff82169050919050565b606c816056565b81146075575f5ffd5b50565b5f815190506084816065565b92915050565b5f60208284031215609c57609b6052565b5b5f60a7848285016078565b91505092915050565b6102a8806100bd5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c80632e64cec114610043578063b9e9538214610061578063d09de08a1461007d575b5f5ffd5b61004b610087565b604051610058919061019c565b60405180910390f35b61007b600480360381019061007691906101e3565b61009e565b005b6100856100f7565b005b5f5f5f9054906101000a900463ffffffff16905090565b805f5f6101000a81548163ffffffff021916908363ffffffff1602179055507f1216415e6088a976b049b2d1fc9e52c96a2199b400aa37dc4aa9585710d03b87816040516100ec919061019c565b60405180910390a150565b60015f5f8282829054906101000a900463ffffffff16610117919061023b565b92506101000a81548163ffffffff021916908363ffffffff1602179055507f1216415e6088a976b049b2d1fc9e52c96a2199b400aa37dc4aa9585710d03b875f5f9054906101000a900463ffffffff16604051610174919061019c565b60405180910390a1565b5f63ffffffff82169050919050565b6101968161017e565b82525050565b5f6020820190506101af5f83018461018d565b92915050565b5f5ffd5b6101c28161017e565b81146101cc575f5ffd5b50565b5f813590506101dd816101b9565b92915050565b5f602082840312156101f8576101f76101b5565b5b5f610205848285016101cf565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6102458261017e565b91506102508361017e565b9250828201905063ffffffff81111561026c5761026b61020e565b5b9291505056fea2646970667358221220c86c70ada69370c5a6eee58a9ab5bf0f78e0a46925993338d6bbf65a7f6a059664736f6c634300081e0033
5 changes: 5 additions & 0 deletions packages/evm/evmtest/Storage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ contract Storage {
emit Stored(_n);
}

function increment() public {
n += 1;
emit Stored(n);
}

function retrieve() public view returns (uint32) {
return n;
}
Expand Down
62 changes: 0 additions & 62 deletions packages/util/timer.go

This file was deleted.

61 changes: 43 additions & 18 deletions tools/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"io"
"math"
"math/rand"
"net/http"
"os"
Expand Down Expand Up @@ -69,6 +70,19 @@ type waspCmd struct {
logScanner sync.WaitGroup
}

func Retry(fn func() error, retries int) error {
var err error
for i := 0; i < retries; i++ {
err = fn()
if err != nil {
time.Sleep(time.Duration(math.Pow(2, float64(i))) * 500 * time.Millisecond) // Exponential backoff
continue
}
break
}
return err
}

func New(name string, config *ClusterConfig, dataPath string, t *testing.T, log log.Logger, l1PacakgeID *iotago.PackageID) *Cluster {
if log == nil {
if t == nil {
Expand Down Expand Up @@ -209,37 +223,48 @@ func (clu *Cluster) InitDistributedKeyGeneration(committeeNodeCount int) ([]int,
}

func (clu *Cluster) RunDistributedKeyGeneration(committeeNodes []int, threshold uint16, timeout ...time.Duration) (*cryptolib.Address, error) {
if threshold == 0 {
threshold = (uint16(len(committeeNodes))*2)/3 + 1
}
apiHosts := clu.Config.APIHosts(committeeNodes)
var addr *cryptolib.Address
var err error
err = Retry(func() error {
if threshold == 0 {
threshold = (uint16(len(committeeNodes))*2)/3 + 1
}
apiHosts := clu.Config.APIHosts(committeeNodes)

peerPubKeys := make([]string, 0)
for _, i := range committeeNodes {
//nolint:bodyclose // false positive
peeringNodeInfo, _, err := clu.WaspClient(i).NodeAPI.GetPeeringIdentity(context.Background()).Execute()
if err != nil {
return nil, err
peerPubKeys := make([]string, 0)
for _, i := range committeeNodes {
//nolint:bodyclose // false positive
peeringNodeInfo, _, err := clu.WaspClient(i).NodeAPI.GetPeeringIdentity(context.Background()).Execute()
if err != nil {
return err
}

peerPubKeys = append(peerPubKeys, peeringNodeInfo.PublicKey)
}

peerPubKeys = append(peerPubKeys, peeringNodeInfo.PublicKey)
}
distKeyGenInitiatorIndex := rand.Intn(len(apiHosts))
client := clu.WaspClientFromHostName(apiHosts[distKeyGenInitiatorIndex])

distKeyGenInitiatorIndex := rand.Intn(len(apiHosts))
client := clu.WaspClientFromHostName(apiHosts[distKeyGenInitiatorIndex])
addr, err = apilib.RunDistributedKeyGeneration(context.Background(), client, peerPubKeys, threshold, timeout...)
return err
}, 5)

if err != nil {
return nil, err
}

return apilib.RunDistributedKeyGeneration(context.Background(), client, peerPubKeys, threshold, timeout...)
return addr, nil
}

func (clu *Cluster) DeployChainWithDistKeyGen(allPeers, committeeNodes []int, quorum uint16, blockKeepAmount ...int32) (*Chain, error) {
stateAddr, err := clu.RunDistributedKeyGeneration(committeeNodes, quorum)
if err != nil {
return nil, err
}
return clu.DeployChain(allPeers, committeeNodes, quorum, stateAddr, blockKeepAmount...)
return clu.DeployChain(allPeers, committeeNodes, quorum, stateAddr, false, blockKeepAmount...)
}

func (clu *Cluster) DeployChain(allPeers, committeeNodes []int, quorum uint16, stateAddr *cryptolib.Address, blockKeepAmount ...int32) (*Chain, error) {
func (clu *Cluster) DeployChain(allPeers, committeeNodes []int, quorum uint16, stateAddr *cryptolib.Address, deployTestContracts bool, blockKeepAmount ...int32) (*Chain, error) {
if len(allPeers) == 0 {
allPeers = clu.Config.AllNodes()
}
Expand Down Expand Up @@ -279,7 +304,7 @@ func (clu *Cluster) DeployChain(allPeers, committeeNodes []int, quorum uint16, s
isc.NewAddressAgentID(chain.OriginatorAddress()),
1074,
blockKeepAmountVal,
false,
deployTestContracts,
).Encode()

getCoinsRes, err := l1Client.GetCoins(
Expand Down
53 changes: 0 additions & 53 deletions tools/cluster/tests/README.md

This file was deleted.

Loading
Loading