Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index all Action types #218

Open
Ishatt opened this issue Sep 26, 2023 · 1 comment
Open

Index all Action types #218

Ishatt opened this issue Sep 26, 2023 · 1 comment
Assignees

Comments

@Ishatt
Copy link
Contributor

Ishatt commented Sep 26, 2023

Generate index files that enumerate blocks for all contract actions: Transfer, AddKey, etc

Action list https://github.com/near/nearcore/blob/bf526b5a037187185c75d810557763de829d2317/runtime/near-vm-runner/src/logic/action.rs#L164

@Ishatt
Copy link
Contributor Author

Ishatt commented Sep 26, 2023

@eduohe : Agreed with @gabe Hamilton that we will breakdown per ActionType instead of method name.

Change from this:

SELECT 
    receipt_receiver_account_id as receiver_id,
    block_date,
    args:method_name as method_name,
    collect_list(block_height) as block_heights
    FROM hive_metastore.mainnet.silver_action_receipt_actions 
    WHERE action_kind = 'FUNCTION_CALL'
    AND block_height >= '{df_boundaries["first_indexed_block"]}' 
    AND block_height <= '{df_boundaries["last_indexed_block"]}' 
    GROUP BY receiver_id, block_date, method_name
    ORDER BY receiver_id, block_date, method_name

to this:

SELECT 
    receipt_receiver_account_id as receiver_id,
    block_date,
    action_kind,
    collect_list(block_height) as block_heights
    FROM hive_metastore.mainnet.silver_action_receipt_actions 
    WHERE block_height >= '{df_boundaries["first_indexed_block"]}' 
    AND block_height <= '{df_boundaries["last_indexed_block"]}' 
    GROUP BY receiver_id, block_date, action_kind
    ORDER BY receiver_id, block_date, action_kind

file content will look like this:

{
"heights": [
95339306,
95339307,
95339319,
95339320,
95339321,
95339322
],
"actions": [
{
"action_kind": "FUNCTION_CALL",
"block_heights": [
95339320,
95339306,
95339319
]
},
{
"action_kind": "TRANSFER",
"block_heights": [
95339320,
95339321,
95339307,
95339322
]
},
{
"action_kind": "CREATE_ACCOUNT",
"block_heights": [
95339307
]
},
{
"action_kind": "ADD_KEY",
"block_heights": [
95339307
]
},
{
"action_kind": "DEPLOY_CONTRACT",
"block_heights": [
95339307
]
}
]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants