Created
June 12, 2025 22:01
-
-
Save areshand/76f49d32dbe94456d7fe1eedf51fc16a to your computer and use it in GitHub Desktop.
feature comparison
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to generate CSV comparison of Aptos and Movement features for testnet and mainnet | |
set -e | |
# Colors | |
GREEN='\033[0;32m' | |
BLUE='\033[0;34m' | |
CYAN='\033[0;36m' | |
BOLD='\033[1m' | |
RED='\033[0;31m' | |
YELLOW='\033[1;33m' | |
NC='\033[0m' | |
# Network URLs | |
APTOS_MAINNET="https://fullnode.mainnet.aptoslabs.com" | |
MOVEMENT_MAINNET="https://mainnet.movementnetwork.xyz" | |
APTOS_TESTNET="https://fullnode.testnet.aptoslabs.com" | |
MOVEMENT_TESTNET="https://full.testnet.movementinfra.xyz" | |
# Function to get feature name | |
get_feature_name() { | |
case $1 in | |
1) echo "CODE_DEPENDENCY_CHECK" ;; | |
2) echo "TREAT_FRIEND_AS_PRIVATE" ;; | |
3) echo "SHA_512_AND_RIPEMD_160_NATIVES" ;; | |
4) echo "APTOS_STD_CHAIN_ID_NATIVES" ;; | |
5) echo "VM_BINARY_FORMAT_V6" ;; | |
6) echo "COLLECT_AND_DISTRIBUTE_GAS_FEES" ;; | |
7) echo "MULTI_ED25519_PK_VALIDATE_V2_NATIVES" ;; | |
8) echo "BLAKE2B_256_NATIVE" ;; | |
9) echo "RESOURCE_GROUPS" ;; | |
10) echo "MULTISIG_ACCOUNTS" ;; | |
11) echo "DELEGATION_POOLS" ;; | |
12) echo "CRYPTOGRAPHY_ALGEBRA_NATIVES" ;; | |
13) echo "BLS12_381_STRUCTURES" ;; | |
14) echo "ED25519_PUBKEY_VALIDATE_RETURN_FALSE_WRONG_LENGTH" ;; | |
15) echo "STRUCT_CONSTRUCTORS" ;; | |
16) echo "PERIODICAL_REWARD_RATE_DECREASE" ;; | |
17) echo "PARTIAL_GOVERNANCE_VOTING" ;; | |
18) echo "SIGNATURE_CHECKER_V2" ;; | |
19) echo "STORAGE_SLOT_METADATA" ;; | |
20) echo "CHARGE_INVARIANT_VIOLATION" ;; | |
21) echo "DELEGATION_POOL_PARTIAL_GOVERNANCE_VOTING" ;; | |
22) echo "GAS_PAYER_ENABLED" ;; | |
23) echo "APTOS_UNIQUE_IDENTIFIERS" ;; | |
24) echo "BULLETPROOFS_NATIVES" ;; | |
25) echo "SIGNER_NATIVE_FORMAT_FIX" ;; | |
26) echo "MODULE_EVENT" ;; | |
27) echo "EMIT_FEE_STATEMENT" ;; | |
28) echo "STORAGE_DELETION_REFUND" ;; | |
29) echo "SIGNATURE_CHECKER_V2_SCRIPT_FIX" ;; | |
30) echo "AGGREGATOR_V2_API" ;; | |
31) echo "SAFER_RESOURCE_GROUPS" ;; | |
32) echo "SAFER_METADATA" ;; | |
33) echo "SINGLE_SENDER_AUTHENTICATOR" ;; | |
34) echo "SPONSORED_AUTOMATIC_ACCOUNT_V1_CREATION" ;; | |
35) echo "FEE_PAYER_ACCOUNT_OPTIONAL" ;; | |
36) echo "AGGREGATOR_V2_DELAYED_FIELDS" ;; | |
37) echo "CONCURRENT_TOKEN_V2" ;; | |
38) echo "LIMIT_MAX_IDENTIFIER_LENGTH" ;; | |
39) echo "OPERATOR_BENEFICIARY_CHANGE" ;; | |
40) echo "VM_BINARY_FORMAT_V7" ;; | |
41) echo "RESOURCE_GROUPS_SPLIT_IN_VM_CHANGE_SET" ;; | |
42) echo "COMMISSION_CHANGE_DELEGATION_POOL" ;; | |
43) echo "BN254_STRUCTURES" ;; | |
44) echo "WEBAUTHN_SIGNATURE" ;; | |
45) echo "RECONFIGURE_WITH_DKG" ;; | |
46) echo "KEYLESS_ACCOUNTS" ;; | |
47) echo "KEYLESS_BUT_ZKLESS_ACCOUNTS" ;; | |
48) echo "REMOVE_DETAILED_ERROR_FROM_HASH" ;; | |
49) echo "JWK_CONSENSUS" ;; | |
50) echo "CONCURRENT_FUNGIBLE_ASSETS" ;; | |
51) echo "REFUNDABLE_BYTES" ;; | |
52) echo "OBJECT_CODE_DEPLOYMENT" ;; | |
53) echo "MAX_OBJECT_NESTING_CHECK" ;; | |
54) echo "KEYLESS_ACCOUNTS_WITH_PASSKEYS" ;; | |
55) echo "MULTISIG_V2_ENHANCEMENT" ;; | |
56) echo "DELEGATION_POOL_ALLOWLISTING" ;; | |
57) echo "MODULE_EVENT_MIGRATION" ;; | |
58) echo "REJECT_UNSTABLE_BYTECODE" ;; | |
59) echo "TRANSACTION_CONTEXT_EXTENSION" ;; | |
60) echo "COIN_TO_FUNGIBLE_ASSET_MIGRATION" ;; | |
61) echo "PRIMARY_APT_FUNGIBLE_STORE_AT_USER_ADDRESS" ;; | |
62) echo "OBJECT_NATIVE_DERIVED_ADDRESS" ;; | |
63) echo "DISPATCHABLE_FUNGIBLE_ASSET" ;; | |
64) echo "NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE" ;; | |
65) echo "OPERATIONS_DEFAULT_TO_FA_APT_STORE" ;; | |
66) echo "AGGREGATOR_V2_IS_AT_LEAST_API" ;; | |
67) echo "CONCURRENT_FUNGIBLE_BALANCE" ;; | |
68) echo "DEFAULT_TO_CONCURRENT_FUNGIBLE_BALANCE" ;; | |
69) echo "LIMIT_VM_TYPE_SIZE" ;; | |
70) echo "ABORT_IF_MULTISIG_PAYLOAD_MISMATCH" ;; | |
71) echo "DISALLOW_USER_NATIVES" ;; | |
72) echo "ALLOW_SERIALIZED_SCRIPT_ARGS" ;; | |
73) echo "USE_COMPATIBILITY_CHECKER_V2" ;; | |
74) echo "ENABLE_ENUM_TYPES" ;; | |
75) echo "ENABLE_RESOURCE_ACCESS_CONTROL" ;; | |
76) echo "REJECT_UNSTABLE_BYTECODE_FOR_SCRIPT" ;; | |
77) echo "FEDERATED_KEYLESS" ;; | |
78) echo "TRANSACTION_SIMULATION_ENHANCEMENT" ;; | |
79) echo "COLLECTION_OWNER" ;; | |
80) echo "NATIVE_MEMORY_OPERATIONS" ;; | |
81) echo "ENABLE_LOADER_V2" ;; | |
82) echo "DISALLOW_INIT_MODULE_TO_PUBLISH_MODULES" ;; | |
83) echo "ENABLE_CALL_TREE_AND_INSTRUCTION_VM_CACHE" ;; | |
84) echo "PERMISSIONED_SIGNER" ;; | |
85) echo "ACCOUNT_ABSTRACTION" ;; | |
86) echo "VM_BINARY_FORMAT_V8" ;; | |
87) echo "BULLETPROOFS_BATCH_NATIVES" ;; | |
88) echo "DOMAIN_ACCOUNT_ABSTRACTION" ;; | |
89) echo "ENABLE_FUNCTION_VALUES" ;; | |
*) echo "UNKNOWN_FEATURE_$1" ;; | |
esac | |
} | |
# Function to fetch and parse features using curl (more accurate) | |
fetch_and_parse_features() { | |
local network_name=$1 | |
local network_url=$2 | |
echo "Fetching features from ${network_name}..." >&2 | |
# Use curl to directly query the Features resource | |
local features_hex=$(curl -s "$network_url/v1/accounts/0x1/resource/0x1::features::Features" 2>/dev/null | \ | |
jq -r '.data.features' 2>/dev/null) | |
if [[ -n "$features_hex" && "$features_hex" != "null" ]]; then | |
python3 -c " | |
hex_str = '$features_hex' | |
if hex_str.startswith('0x'): | |
hex_str = hex_str[2:] | |
try: | |
features_int = int(hex_str, 16) | |
enabled_features = [] | |
for i in range(1, 90): | |
if features_int & (1 << (i-1)): | |
enabled_features.append(str(i)) | |
for feature in enabled_features: | |
print(feature) | |
except: | |
pass | |
" 2>/dev/null | sort -n | |
fi | |
} | |
# Generate CSV output | |
generate_csv() { | |
echo "Feature_ID,Feature_Name,Aptos_Mainnet,Movement_Mainnet,Aptos_Testnet,Movement_Testnet" | |
# Get all unique features | |
all_features=$(echo -e "$aptos_mainnet_features\n$movement_mainnet_features\n$aptos_testnet_features\n$movement_testnet_features" | sort -nu | grep -v '^$') | |
for feature_id in $all_features; do | |
if [[ -n "$feature_id" ]]; then | |
feature_name=$(get_feature_name "$feature_id") | |
# Check each network | |
aptos_mainnet_status="DISABLED" | |
if echo "$aptos_mainnet_features" | grep -q "^$feature_id$"; then | |
aptos_mainnet_status="ENABLED" | |
fi | |
movement_mainnet_status="DISABLED" | |
if echo "$movement_mainnet_features" | grep -q "^$feature_id$"; then | |
movement_mainnet_status="ENABLED" | |
fi | |
aptos_testnet_status="DISABLED" | |
if echo "$aptos_testnet_features" | grep -q "^$feature_id$"; then | |
aptos_testnet_status="ENABLED" | |
fi | |
movement_testnet_status="DISABLED" | |
if echo "$movement_testnet_features" | grep -q "^$feature_id$"; then | |
movement_testnet_status="ENABLED" | |
fi | |
echo "$feature_id,$feature_name,$aptos_mainnet_status,$movement_mainnet_status,$aptos_testnet_status,$movement_testnet_status" | |
fi | |
done | |
} | |
echo -e "${CYAN}========================================================" | |
echo -e "GENERATING FEATURE COMPARISON CSV" | |
echo -e "========================================================${NC}" | |
# Fetch features from all networks | |
echo -e "${YELLOW}Fetching feature data from all networks...${NC}" | |
aptos_mainnet_features=$(fetch_and_parse_features "Aptos Mainnet" "$APTOS_MAINNET") | |
movement_mainnet_features=$(fetch_and_parse_features "Movement Mainnet" "$MOVEMENT_MAINNET") | |
aptos_testnet_features=$(fetch_and_parse_features "Aptos Testnet" "$APTOS_TESTNET") | |
movement_testnet_features=$(fetch_and_parse_features "Movement Testnet" "$MOVEMENT_TESTNET") | |
echo | |
echo -e "${CYAN}========================================================" | |
echo -e "CSV OUTPUT" | |
echo -e "========================================================${NC}" | |
# Generate and display CSV | |
generate_csv | |
echo | |
echo -e "${CYAN}========================================================" | |
echo -e "SUMMARY" | |
echo -e "========================================================${NC}" | |
aptos_mainnet_count=$(echo "$aptos_mainnet_features" | grep -c . || echo "0") | |
movement_mainnet_count=$(echo "$movement_mainnet_features" | grep -c . || echo "0") | |
aptos_testnet_count=$(echo "$aptos_testnet_features" | grep -c . || echo "0") | |
movement_testnet_count=$(echo "$movement_testnet_features" | grep -c . || echo "0") | |
echo -e "${BLUE}APTOS MAINNET: $aptos_mainnet_count features enabled${NC}" | |
echo -e "${BLUE}MOVEMENT MAINNET: $movement_mainnet_count features enabled${NC}" | |
echo -e "${BLUE}APTOS TESTNET: $aptos_testnet_count features enabled${NC}" | |
echo -e "${BLUE}MOVEMENT TESTNET: $movement_testnet_count features enabled${NC}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment