Skip to content

Commit

Permalink
test: add tests for convertSubnetTx complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
erictaylor committed Oct 22, 2024
1 parent ce3abbf commit e301e0b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/serializable/fxs/pvm/convertSubnetValidator.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {
convertSubnetValidator,
convertSubnetValidatorBytes,
} from '../../../fixtures/pvm';
import { testSerialization } from '../../../fixtures/utils/serializable';
import { ConvertSubnetValidator } from './convertSubnetValidator';

testSerialization(
'ConvertSubnetValidator',
ConvertSubnetValidator,
convertSubnetValidator,
convertSubnetValidatorBytes,
);
21 changes: 21 additions & 0 deletions src/vms/pvm/txs/fee/fixtures/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
INTRINSIC_ADD_PERMISSIONLESS_VALIDATOR_TX_COMPLEXITIES,
INTRINSIC_ADD_SUBNET_VALIDATOR_TX_COMPLEXITIES,
INTRINSIC_BASE_TX_COMPLEXITIES,
INTRINSIC_CONVERT_SUBNET_TX_COMPLEXITIES,
INTRINSIC_CONVERT_SUBNET_VALIDATOR_COMPLEXITIES,
INTRINSIC_CREATE_CHAIN_TX_COMPLEXITIES,
INTRINSIC_CREATE_SUBNET_TX_COMPLEXITIES,
INTRINSIC_EXPORT_TX_COMPLEXITIES,
Expand Down Expand Up @@ -275,6 +277,25 @@ export const TEST_TRANSACTIONS: ReadonlyArray<{
}),
expectedDynamicFee: 173_600n,
},

{
name: 'ConvertSubnetTx',
txHex:
'00000000002300003039000000000000000000000000000000000000000000000000000000000000000000000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db00000007002386f234262960000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c00000001705f3d4415f990225d3df5ce437d7af2aa324b1bbce854ee34ab6f39882250d200000000dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db00000005002386f26fc0f94e000000010000000000000000a0673b4ee5ec44e57c8ab250dd7cd7b68d04421f64bd6559a4284a3ee358ff2b705f3d4415f990225d3df5ce437d7af2aa324b1bbce854ee34ab6f39882250d2000000000000000100000014c582872c37c81efa2c94ea347af49cdc23a830aa000000000000c137000000003b9aca00a3783a891cb41cadbfcf456da149f30e7af972677a162b984bef0779f254baac51ec042df1781d1295df80fb41c801269731fc6c25e1e5940dc3cb8509e30348fa712742cfdc83678acc9f95908eb98b89b28802fb559b4a2a6ff3216707c07f0ceb0b45a95f4f9a9540bbd3331d8ab4f233bffa4abb97fad9d59a1695f31b92a2b89e365facf7ab8c30de7c4a496d1e000000000000000000000000000000000000000a00000001000000000000000200000009000000011430759900fdf516cdeff6a1390dd7438585568a89c06142c44b3bf1178c4cae4bff44e955b19da08f0359d396a7a738b989bb46377e7465cd858ddd1e8dd3790100000009000000011430759900fdf516cdeff6a1390dd7438585568a89c06142c44b3bf1178c4cae4bff44e955b19da08f0359d396a7a738b989bb46377e7465cd858ddd1e8dd37901',
expectedComplexity: createDimensions({
bandwidth: 656,
dbRead:
INTRINSIC_CONVERT_SUBNET_TX_COMPLEXITIES[FeeDimensions.DBRead] +
INTRINSIC_INPUT_DB_READ,
dbWrite:
INTRINSIC_CONVERT_SUBNET_TX_COMPLEXITIES[FeeDimensions.DBWrite] +
INTRINSIC_INPUT_DB_WRITE +
INTRINSIC_OUTPUT_DB_WRITE +
INTRINSIC_CONVERT_SUBNET_VALIDATOR_COMPLEXITIES[FeeDimensions.DBWrite],
compute: 0, // TODO: Implement
}),
expectedDynamicFee: 365_600n,
},
];

export const TEST_UNSUPPORTED_TRANSACTIONS = [
Expand Down

0 comments on commit e301e0b

Please sign in to comment.