mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
## Summary - Port 16 Moonbeam Moonwall E2E test suites to DataHaven, covering proxy, multisig, sudo, txpool, receipts, precompiles, polkadot-js API, and node RPC - Adapt all tests for DataHaven runtime differences: 2 inherents (timestamp + randomness) instead of Moonbeam's 4, different event ordering/counts from fee/treasury handling, no PoV constraints - Use resilient event-based lookups (`.find()`/`.some()`) instead of hardcoded array indices throughout - Add supporting Solidity contracts: `FailingConstructor`, `StorageLoop` ## New test suites | Suite | Category | Tests | |-------|----------|-------| | `test-proxy-balance` | common/proxy | Proxy with Balances type | | `test-proxy` | stagenet/proxy | Add/remove proxy, delayed & announced proxy (7 tests) | | `test-multisigs` | stagenet/multisig | Creation, approval, execution, cancellation | | `test-sudo` | stagenet/sudo | Dispatch, sudoAs, set/remove key | | `test-polkadot-api` | stagenet/polkadot-js | Genesis, headers, transfers, extrinsics, events | | `test-polkadot-chain-info` | stagenet/polkadot-js | Chain name/type queries | | `test-node-rpc-peer` | stagenet/node-rpc | `system_peers` RPC | | `test-precompile-bn128-bounds` | stagenet/precompile | bn128 add/mul/pairing edge cases | | `test-receipt` | stagenet/receipt | Receipt fields, effective gas price | | `test-receipt-revert` | stagenet/receipt | Receipt for reverted transactions | | `test-evm-store-storage-growth` | stagenet/storage-growth | EVM SSTORE storage growth | | `test-txpool-future` | stagenet/txpool | Future transaction pool | | `test-txpool-pending` | stagenet/txpool | Pending transaction pool | --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
80 lines
2.7 KiB
TypeScript
80 lines
2.7 KiB
TypeScript
import { describeSuite, expect } from "@moonwall/cli";
|
|
import {
|
|
ALITH_ADDRESS,
|
|
CHARLETH_ADDRESS,
|
|
baltathar,
|
|
} from "@moonwall/util";
|
|
|
|
describeSuite({
|
|
id: "D010502",
|
|
title: "Proxy: Balances",
|
|
foundationMethods: "dev",
|
|
testCases: ({ context, it, log }) => {
|
|
it({
|
|
id: "T01",
|
|
title: "should accept known proxy",
|
|
test: async () => {
|
|
const beforeCharlieBalance = await context.viem().getBalance({ address: CHARLETH_ADDRESS });
|
|
const { result } = await context.createBlock(
|
|
context.polkadotJs().tx.proxy.addProxy(baltathar.address, "Balances" as any, 0)
|
|
);
|
|
const proxyAdded = result!.events.find(
|
|
({ event }) => event.method === "ProxyAdded"
|
|
);
|
|
expect(proxyAdded).to.not.be.undefined;
|
|
expect(proxyAdded!.event.data[2].toString()).to.be.eq("Balances"); //ProxyType
|
|
expect(result!.events.some(({ event }) => event.method === "ExtrinsicSuccess")).to.be.true;
|
|
|
|
const { result: result2 } = await context.createBlock(
|
|
context
|
|
.polkadotJs()
|
|
.tx.proxy.proxy(
|
|
ALITH_ADDRESS,
|
|
null,
|
|
context.polkadotJs().tx.balances.transferAllowDeath(CHARLETH_ADDRESS, 100)
|
|
)
|
|
.signAsync(baltathar)
|
|
);
|
|
|
|
const proxyExecuted = result2!.events.find(
|
|
({ event }) => event.method === "ProxyExecuted"
|
|
);
|
|
expect(proxyExecuted).to.not.be.undefined;
|
|
expect(proxyExecuted!.event.data[0].toString()).to.be.eq("Ok");
|
|
expect(result2!.events.some(({ event }) => event.method === "ExtrinsicSuccess")).to.be
|
|
.true;
|
|
const afterCharlieBalance = await context.viem().getBalance({ address: CHARLETH_ADDRESS });
|
|
expect(afterCharlieBalance - beforeCharlieBalance).to.be.eq(100n);
|
|
},
|
|
});
|
|
|
|
it({
|
|
id: "T02",
|
|
title: "shouldn't accept other proxy types",
|
|
test: async () => {
|
|
await context.createBlock(
|
|
context.polkadotJs().tx.proxy.addProxy(baltathar.address, "Balances", 0)
|
|
);
|
|
|
|
const { result } = await context.createBlock(
|
|
context
|
|
.polkadotJs()
|
|
.tx.proxy.proxy(
|
|
ALITH_ADDRESS,
|
|
null,
|
|
context.polkadotJs().tx.system.remark("0x")
|
|
)
|
|
.signAsync(baltathar)
|
|
);
|
|
|
|
const proxyExecuted = result!.events.find(
|
|
({ event }) => event.method === "ProxyExecuted"
|
|
);
|
|
expect(proxyExecuted).to.not.be.undefined;
|
|
// Balances proxy type should not allow system.remark
|
|
expect(proxyExecuted!.event.data[0].toString()).to.not.be.eq("Ok");
|
|
expect(result!.events.some(({ event }) => event.method === "ExtrinsicSuccess")).to.be.true;
|
|
},
|
|
});
|
|
},
|
|
});
|