Skip to content

As/full system test#51

Merged
alsala merged 24 commits into
devfrom
as/full_system_test
May 4, 2026
Merged

As/full system test#51
alsala merged 24 commits into
devfrom
as/full_system_test

Conversation

@alsala

@alsala alsala commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Adds the WalletDriver test harness and 15 fullstack tests that drive the full production path through the wallet CLI layer against the vela fullstack suite.

  • wallet/testutil.WalletDriver: per-test wallet.conf + user-signed chain client per command; wrappers for DeployApp, RegisterUser, Deposit, Withdraw, PrivateTransfer, GetPrivateBalance,
    ClaimPendingPayments, RequestReport, DownloadReport, AddToken, SetApplicationID; NewWalletDriverNoDeployerRole variant for access-control tests.
  • Wallet refactors: Exec(ctx) error on 8 commands (deposit, withdraw, privatetransfer, requestreport, downloadreport, registeruser, claim, getpublicbalance); parseAssetAmount/resolveContext
    helpers; getpublicbalance now has an injectable Client, real ERC-20 balanceOf, hermetic test (replaces the live base-sepolia.drpc.org call); shared runtime/wasm-go/testhelpers de-dupes WASM build
    helpers across test folders.
  • 15 fullstack tests covering: happy paths (deploy/deposit/withdraw, ERC-20 end-to-end, private transfer, real-round-trip deanonymize, multi-app isolation, coupled-restart keyset recovery, fee refund
    claim) + negative/security/robustness (unlisted-token revert, DEPLOYER_ROLE enforcement, non-manager stateUpdate, TEE attestation rejection, invalid prevStateRoot, unauthorized authority deanonymize,
    private-transfer to unregistered recipient, multi-token/non-18-decimals isolation).
  • Bytes32 event-subtype migration + system_tests/payment_app_system_test.go fix for the zero-subtype path.

Note: Currently refers to local vela repo on branch as/full_system_test. CI is not passing as of now, until a tag is used.

alsala added 20 commits April 15, 2026 15:46
… add WalletDriver.AddToken for ERC-20 token registration in tests
…es when on-chain TEE signer mismatches the executor's real signing key
…h fullstack tests (catches silent retry-and-recover regressions)
@alsala alsala requested review from andreanistico, paolocappelletti and saratnt and removed request for saratnt April 24, 2026 13:29
@alsala alsala marked this pull request as ready for review April 24, 2026 14:18

@saratnt saratnt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Only some minor comments

Comment thread wallet/cmd/decryptreport_test.go Outdated
//create client
testHelper := pestestutil.NewSimTestHelper(t, true, true, nil, teeKey.PublicKey().Bytes())
autoMining, useMockContracts := true, true
testHelper := pestestutil.NewSimTestHelper(t, autoMining, useMockContracts, nil, teeKey.PublicKey().Bytes())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Considering that every where NewSimTestHelper is called the only param that changes is the last one, that can be nil or teeKey.PublicKey().Bytes(), consider creating an utility function like this:

func SetupDefaultTestHelper(pubKey []byte) *pestestutil.SimTestHelper {
     autoMining, useMockContracts := true, true
	return pestestutil.NewSimTestHelper(t, autoMining, useMockContracts, nil, pubKey)
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, done

@@ -25,7 +25,8 @@ func TestGetPendingPaymentsCmd(t *testing.T) {
key1, err := crypto.GeneratePrivateKeySecp256k1()
require.NoError(t, err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getpendingpayments.go wasn't refactored with the Exec function, everything is still in Run

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right, the Exec refactor was driven by WalletDriver, every other command got it because some fullstack test needed to drive that command through the wallet path. No fullstack test had needed to drive getpendingpayments yet, so it was missed. I've refactored it, added the corresponding WalletDriver.GetPendingPayments wrapper, and written a new fullstack test that exercises both.

@alsala alsala requested a review from saratnt April 28, 2026 16:04
// error string.
_, err = driver.RequestReport(t.Context(), "balances", "100 wei")
require.Error(t, err, "deanonymize request from unauthorized account must fail at submitRequest time")
require.True(t,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

here and in other lines, you can use require.Contains (https://pkg.go.dev/github.com/stretchr/testify/require#Contains)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, done

Comment thread wallet/cmd/constants.go
var ETH_TOKEN = ethCommon.Address{}
// ETH_TOKEN is the package-local alias for the canonical native-token sentinel
// in vela-common-go. Matches Structs.sol: address constant ETH_TOKEN = address(0).
var ETH_TOKEN = velacommon.ETH_TOKEN

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe it should be const instead of var?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ethCommon.Address is [20]byte, and Go does not allow const arrays. A func ETH_TOKEN() would give true immutability, but it forces ETH_TOKEN() at every call site so I prefer to keep it as it is

// Step 4: snapshot the user's on-chain balance before the claim. After
// the claim we expect this to increase by exactly refundTotal (deployer
// pays the gas in step 5).
ctx := context.Background()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you can use t.Context() as in other points

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, done

@andreanistico andreanistico left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

left comments

// refundAmount and the contract crediting pendingClaims.
sim := suite.GetSimTestHelper()
ethAddr := ethCommon.Address{}
ethAddr := velacommon.ETH_TOKEN

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why in vela it is used NativeTokenAddress() and in vela-nova ETH_TOKEN?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right, we should uniform the usage. There are pros and cons on using either, I finally opted for using ETH_TOKEN, same name as in sol contract.

@alsala alsala merged commit edbf4e3 into dev May 4, 2026
3 checks passed
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