Skip to content

Conversation

@howjmay
Copy link
Member

@howjmay howjmay commented Jan 19, 2026

No description provided.

@howjmay howjmay force-pushed the ql-all-3 branch 13 times, most recently from b13165e to 29b6891 Compare January 26, 2026 19:43
@howjmay howjmay force-pushed the ql-all-3 branch 2 times, most recently from e4b4a6c to 0630144 Compare January 30, 2026 09:30
avgDuration /= int64(len(durations))
require.Greater(t, avgDuration, int64(50))
require.Less(t, avgDuration, int64(100))
require.Less(t, avgDuration, int64(120))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it takes longer time now

@howjmay howjmay changed the title Ql all 3 fix: tests for graphql Jan 30, 2026
@howjmay howjmay force-pushed the ql-all-3 branch 2 times, most recently from 7be2017 to 134ed18 Compare January 30, 2026 17:27
@howjmay howjmay marked this pull request as ready for review February 1, 2026 14:01
run: make test-short
run: |
TEST_SHORT_PKGS="$(go list ./... \
| grep -v '/packages/vm/core/testcore' \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these triggered timeout

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not forget to reenable or fix them. These are important tests.

Copy link
Member Author

@howjmay howjmay Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#790 is solving the timeout issues too, so we will enable soon in the future

t.Run("callTracer", func(t *testing.T) {
_, err := env.traceTransactionWithCallTracer(tx.Hash())
require.ErrorContains(t, err, "expected exactly one top-level call")
require.ErrorContains(t, err, "transaction not found")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I remember, expected exactly one top-level call has been an annoying issue with the calltracer. Why is it suddenly "transaction not found"?

It seems like the transaction wasn't executed, therefore you get transaction not found.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Also, the change in graphql should not affect the EVM tests? Unless I'm missing something.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed this. It was caused by the amount coin returned by faucet is different now. I have added a test to ensure the const we used match the real amount

current *iotago.ObjectRef,
timeout time.Duration,
) (*iotago.ObjectRef, error) {
ticker := time.NewTicker(200 * time.Millisecond)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the ticker for?

Copy link
Member Author

@howjmay howjmay Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use it as a retry here, because the time for the node to index the TXs is too slow now. Or I should remove it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok... is polling like this the "official" way? I mean, is there something like a subscription API to be notified of the updated object ref? Just trying to avoid hardcoded delays and timeouts.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are trying to implement the subscription of graphql. However, I think UpdateObjectRef() is more like a one-off call. If we don't do retry here, we add to add it to all the tests. Not sure what is the best way to do it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, we should try to avoid hardcoded delays if possible. I would think there must be a proper way to subscribe to updates, but I'm not familiarized with the graphql api.

Anyway, if the retry delay is unavoidable, then at least maybe it should be a parameter or a const?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the tickingTime in GraphQLClient

run: make test-short
run: |
TEST_SHORT_PKGS="$(go list ./... \
| grep -v '/packages/vm/core/testcore' \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not forget to reenable or fix them. These are important tests.

func (c *GraphQLClient) waitForNewerObjectRef(
ctx context.Context,
current *iotago.ObjectRef,
timeout time.Duration,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we already receive a context, then maybe the timeout is redundant, because the caller could pass a ContextWithTimeout

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

var txnResponse *IotaTransactionBlockResponse
var gasPayments []*iotago.ObjectRef

for i := 0; i < 5; i++ {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the amount of retries and the delay should be parameters, or consts

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

t.Run("callTracer", func(t *testing.T) {
_, err := env.traceTransactionWithCallTracer(tx.Hash())
require.ErrorContains(t, err, "expected exactly one top-level call")
require.ErrorContains(t, err, "transaction not found")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Also, the change in graphql should not affect the EVM tests? Unless I'm missing something.

ctx, cancel := context.WithTimeout(env.ctx, 60*time.Second)
defer cancel()

ticker := time.NewTicker(250 * time.Millisecond)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this "permanent"? Time delays make tests unhappy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need it until we discard grahpql in solo

@howjmay howjmay force-pushed the ql-all-3 branch 2 times, most recently from 0a3fa86 to c48f7c8 Compare February 5, 2026 22:08
@howjmay howjmay requested review from dessaya and lmoe February 6, 2026 12:15

func getBalance(ctx context.Context, client *GraphQLClient, address *iotago.Address) *big.Int {
balance, err := client.GetBalance(ctx, GetBalanceRequest{Owner: address})
if err != nil || balance.TotalBalance == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if err != nil then maybe this should panic or return error

current *iotago.ObjectRef,
timeout time.Duration,
) (*iotago.ObjectRef, error) {
ticker := time.NewTicker(200 * time.Millisecond)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, we should try to avoid hardcoded delays if possible. I would think there must be a proper way to subscribe to updates, but I'm not familiarized with the graphql api.

Anyway, if the retry delay is unavoidable, then at least maybe it should be a parameter or a const?

var txnResponse *IotaTransactionBlockResponse
var gasPayments []*iotago.ObjectRef

for i := 0; i < maxRetries; i++ {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having to retry operations is suspicious... is the graphql api unreliable? Is it expected to have to retry? Perhaps we are using the api wrong somehow?

Maybe this is fine as a temporary measure but IMO we should at least leave TODOs to remove all delays and retries at some point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem was caused by the indexer performs really slow in the test scenario. Once we switch to Simulacrum, then the problem may be gone

@howjmay howjmay merged commit c225b9f into iotaledger:ql-dev Feb 8, 2026
3 checks passed
@howjmay howjmay deleted the ql-all-3 branch February 8, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants