Skip to content

Commit

Permalink
bet
Browse files Browse the repository at this point in the history
  • Loading branch information
TropicalDog17 committed Dec 2, 2024
1 parent 508dfb9 commit 1039e51
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 33 deletions.
20 changes: 10 additions & 10 deletions tests/interchaintest/helpers/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ import (

"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
)

const validatorKeyName = "validator"
func ExecOracleMsgAggragatePrevote(ctx context.Context, validator *cosmos.ChainNode, salt string, exchangeRate string) (error) {

func ExecOracleMsgAggragatePrevote(ctx context.Context, validator *cosmos.ChainNode, salt string, exchangeRate string) error {
args := []string{
"oracle", "aggregate-prevote",
salt,
"oracle", "aggregate-prevote",
salt,
exchangeRate,

}

command := validator.TxCommand(validatorKeyName, args...)

_, _, err := validator.Exec(ctx, command, nil)
_, _, err := validator.Exec(ctx, command, nil)
if err != nil {
return err
}
Expand All @@ -25,17 +26,16 @@ func ExecOracleMsgAggragatePrevote(ctx context.Context, validator *cosmos.ChainN

func ExecOracleMsgAggregateVote(ctx context.Context, validator *cosmos.ChainNode, salt string, exchangeRate string) error {
args := []string{
"oracle", "aggregate-vote",
salt,
"oracle", "aggregate-vote",
salt,
exchangeRate,

}

command := validator.TxCommand(validatorKeyName, args...)

_, _, err := validator.Exec(ctx, command, nil)
_, _, err := validator.Exec(ctx, command, nil)
if err != nil {
return err
}
return nil
}
}
40 changes: 17 additions & 23 deletions tests/interchaintest/oracle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestOracle(t *testing.T) {
val := val
go func(validator *cosmos.ChainNode) {
defer wg.Done()
for i := 0; i < 2; i++ {
for i := 0; i < 6; i++ {
if err := helpers.ExecOracleMsgAggragatePrevote(ctx, validator, "salt", "1.123uusd"); err != nil {
oracleErrCh <- err
return
Expand All @@ -92,14 +92,6 @@ func TestOracle(t *testing.T) {
oracleErrCh <- err
return
}
if err := helpers.ExecOracleMsgAggregateVote(ctx, validator, "salt", "1.123uusd"); err != nil {
oracleErrCh <- err
return
}
if err := testutil.WaitForBlocks(ctx, 5, terra); err != nil {
oracleErrCh <- err
return
}
}
}(val)
}
Expand All @@ -109,13 +101,15 @@ func TestOracle(t *testing.T) {
i := i
go func() {
defer wg.Done()
err := terra.SendFunds(ctx, users[i].KeyName(), ibc.WalletAmount{
Address: users[0].FormattedAddress(),
Denom: terra.Config().Denom,
Amount: sdk.OneInt(),
})
require.NoError(t, err)
require.NoError(t, testutil.WaitForBlocks(ctx, 1, terra))
for j := 0; j < 5; j++ {
err := terra.SendFunds(ctx, users[i].KeyName(), ibc.WalletAmount{
Address: users[0].FormattedAddress(),
Denom: terra.Config().Denom,
Amount: sdk.OneInt(),
})
require.NoError(t, err)
require.NoError(t, testutil.WaitForBlocks(ctx, 1, terra))
}
}()
}

Expand Down Expand Up @@ -169,14 +163,14 @@ func TestOracle(t *testing.T) {
require.NoError(t, err)
}

// Verify final validator state
stdout, _, err := terra.Validators[0].ExecQuery(ctx, "staking", "validators")
require.NoError(t, err)
require.NotEmpty(t, stdout)
// // Verify final validator state
// stdout, _, err := terra.Validators[0].ExecQuery(ctx, "staking", "validators")
// require.NoError(t, err)
// require.NotEmpty(t, stdout)

terraValidators, _, err := helpers.UnmarshalValidators(*config.EncodingConfig, stdout)
require.NoError(t, err)
require.Equal(t, len(terraValidators), 3)
// terraValidators, _, err := helpers.UnmarshalValidators(*config.EncodingConfig, stdout)
// require.NoError(t, err)
// require.Equal(t, len(terraValidators), 3)
}

type Tx struct {
Expand Down

0 comments on commit 1039e51

Please sign in to comment.