Skip to content

test: deterministic EVM tx tests from on-chain Spark transactions#4

Merged
RaghavSood merged 1 commit intomainfrom
feat/evm-tx-integration-tests
Feb 24, 2026
Merged

test: deterministic EVM tx tests from on-chain Spark transactions#4
RaghavSood merged 1 commit intomainfrom
feat/evm-tx-integration-tests

Conversation

@RaghavSood
Copy link
Collaborator

Summary

  • Adds deterministic test suite (internal/tools/evm_tx_test.go) that verifies MCP tool invocations against real Ethereum mainnet Spark protocol transactions from 0xE721dd7a654D7E95518014526f6897deF6A44933
  • Adds GitHub Actions CI workflow (.github/workflows/test.yml) for go vet + go test on push/PR to main

Test Coverage (22 test cases)

ABI Encoding (7 cases) — verifies calldata matches on-chain tx input data:

  • approve(address,uint256) reset to 0 (USDT pattern)
  • approve(address,uint256) with 1 USDT
  • deposit(uint256,address) for Spark ERC-4626 vault
  • withdraw(uint256,address,address) with accrued interest (2.000029 USDT)
  • allowance(address,address), maxWithdraw(address), assetsOf(address) read calls

Unit Conversion (5 cases) — USDT 6-decimal conversions (to_base / to_human)

Transaction Building (5 cases) — builds EIP-1559 txs with exact on-chain parameters (nonces 7-13), decodes via recipes.DecodeUnsignedPayload to verify round-trip correctness

Vault Info (2 cases) — stores vault keys, validates missing chain_code error

End-to-End Workflows (2 cases):

  • Full Spark deposit flow: convert_amountabi_encode approve(0) → approve(amount) → deposit → build_evm_tx for each
  • Full Spark withdraw flow: abi_encode maxWithdraw → withdraw → build_evm_tx

Determinism (1 case) — verifies identical unsigned_tx_hex output across repeated builds

Test plan

  • All 22 test cases pass locally (go test ./... -count=1)
  • go vet ./... passes
  • CI workflow runs successfully on this PR

🤖 Generated with Claude Code

Verify ABI encoding, tx building, unit conversion, and vault info tools
against real Ethereum mainnet transactions from address
0xE721dd7a654D7E95518014526f6897deF6A44933. Tests cover the full Spark
deposit/withdraw lifecycle including USDT approval reset patterns.

Also adds GitHub Actions CI workflow for go vet + go test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@RaghavSood RaghavSood merged commit b6e0c2a into main Feb 24, 2026
1 check 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.

1 participant