Start constructor migration

This commit is contained in:
Patrick O'Grady 2020-10-26 16:29:41 -07:00
parent 8000c85a66
commit 832ab7d346
No known key found for this signature in database
GPG key ID: 8DE11C985C0C8D85
4 changed files with 138 additions and 116 deletions

View file

@ -207,10 +207,9 @@ in recently processed blocks to save to disk.
## Testing with rosetta-cli ## Testing with rosetta-cli
To validate `rosetta-bitcoin`, [install `rosetta-cli`](https://github.com/coinbase/rosetta-cli#install) To validate `rosetta-bitcoin`, [install `rosetta-cli`](https://github.com/coinbase/rosetta-cli#install)
and run one of the following commands: and run one of the following commands:
* `rosetta-cli check:data --configuration-file rosetta-cli-conf/bitcoin_testnet.json` * `rosetta-cli check:data --configuration-file rosetta-cli-conf/testnet/config.json`
* `rosetta-cli check:construction --configuration-file rosetta-cli-conf/bitcoin_testnet.json` * `rosetta-cli check:construction --configuration-file rosetta-cli-conf/testnet/config.json`
* `rosetta-cli check:data --configuration-file rosetta-cli-conf/bitcoin_mainnet.json` * `rosetta-cli check:data --configuration-file rosetta-cli-conf/mainnet/config.json`
* `rosetta-cli check:construction --configuration-file rosetta-cli-conf/bitcoin_mainnet.json`
## Future Work ## Future Work
* Publish benchamrks for sync speed, storage usage, and load testing * Publish benchamrks for sync speed, storage usage, and load testing

View file

@ -1,87 +1,88 @@
{ request_funds(1) {
"network": { find_account{
"blockchain": "Bitcoin", currency = {"symbol":"tBTC", "decimals":8};
"network": "Testnet3" random_account = find_balance({
}, "minimum_balance":{
"data_directory": "bitcoin-testnet-data", "value": "0",
"http_timeout": 300, "currency": {{currency}}
"max_retries": 5, },
"retry_elapsed_time": 0, "create_limit":1
"max_online_connections": 0, });
"max_sync_concurrency": 0, },
"tip_delay": 1800,
"log_configuration": false, // Create a separate scenario to request funds so that
"construction": { // the address we are using to request funds does not
"max_offline_connections": 0, // get rolled back if funds do not yet exist.
"stale_depth": 0, request{
"broadcast_limit": 0, loaded_account = find_balance({
"ignore_broadcast_failures": false, "account_identifier": {{random_account.account_identifier}},
"clear_broadcasts": false, "minimum_balance":{
"broadcast_behind_tip": false, "value": "1000000",
"block_broadcast_limit": 0, "currency": {{currency}}
"rebroadcast_all": false, }
"workflows": [ });
{ }
"name": "request_funds", }
"concurrency": 1,
"scenarios": [ create_account(1){
{ create{
"name": "find_account", network = {"network":"Testnet3", "blockchain":"Bitcoin"};
"actions": [ key = generate_key({"curve_type": "secp256k1"});
{ account = derive({
"input": "{\"symbol\":\"tBTC\", \"decimals\":8}", "network_identifier": {{network}},
"type": "set_variable", "public_key": {{key.public_key}}
"output_path": "currency" });
},
{ // If the account is not saved, the key will be lost!
"input": "{\"minimum_balance\":{\"value\": \"0\", \"currency\": {{currency}}}, \"create_limit\":1}", save_account({
"type": "find_balance", "account_identifier": {{account.account_identifier}},
"output_path": "random_account" "keypair": {{key}}
} });
] }
}, }
{
"name": "request", transfer(10){
"actions": [ transfer_dry_run{
{ transfer_dry_run.network = {"network":"Testnet3", "blockchain":"Bitcoin"};
"input": "{\"account_identifier\": {{random_account.account_identifier}}, \"minimum_balance\":{\"value\": \"1000000\", \"currency\": {{currency}}}}", currency = {"symbol":"tBTC", "decimals":8};
"type": "find_balance",
"output_path": "loaded_account" // We set the max_fee_amount to know how much buffer we should
} // leave for fee payment when selecting a sender account.
] dust_amount = "600";
} max_fee_amount = "1200";
] send_buffer = {{dust_amount}} + {{max_fee_amount}};
},
{ // reserved_amount is max_fee_amount + min_utxo size x 2
"name": "create_account", reserved_amount = "2400";
"concurrency": 1, sender = find_balance({
"scenarios": [ "minimum_balance":{
{ "value": {{reserved_amount}},
"name": "create_account", "currency": {{currency}}
"actions": [ },
{ "require_coin": true
"input": "{\"network\":\"Testnet3\", \"blockchain\":\"Bitcoin\"}", });
"type": "set_variable",
"output_path": "network" available_amount = {{sender.balance.value}} - {{send_buffer}};
}, recipient_amount = random_number({
{ "minimum": {{dust_amount}},
"input": "{\"curve_type\": \"secp256k1\"}", "maximum": {{available_amount}}
"type": "generate_key", });
"output_path": "key" print_message({
}, "recipient_amount":{{recipient_amount}}
{ });
"input": "{\"network_identifier\": {{network}}, \"public_key\": {{key.public_key}}}",
"type": "derive", total_change_amount = {{sender.balance.value}} - {{recipient_amount}};
"output_path": "account" change_amount = {{total_change_amount}} - {{max_fee_amount}};
}, print_message({
{ "change_amount":{{change_amount}}
"input": "{\"account_identifier\": {{account.account_identifier}}, \"keypair\": {{key}}}", });
"type": "save_account"
} sender_amount = 0 - {{sender.balance.value}};
]
} },
] transfer{
}, },
}
{ {
"name": "transfer", "name": "transfer",
"concurrency": 10, "concurrency": 10,
@ -350,31 +351,3 @@
} }
] ]
} }
],
"end_conditions": {
"create_account": 10,
"transfer": 10
}
},
"data": {
"active_reconciliation_concurrency": 0,
"inactive_reconciliation_concurrency": 0,
"inactive_reconciliation_frequency": 0,
"log_blocks": false,
"log_transactions": false,
"log_balance_changes": false,
"log_reconciliations": false,
"ignore_reconciliation_error": false,
"exempt_accounts": "",
"bootstrap_balances": "",
"interesting_accounts": "",
"reconciliation_disabled": false,
"inactive_discrepency_search_disabled": false,
"balance_tracking_disabled": false,
"coin_tracking_disabled": false,
"end_conditions": {
"reconciliation_coverage": 0.95
},
"results_output_file": ""
}
}

View file

@ -0,0 +1,50 @@
{
"network": {
"blockchain": "Bitcoin",
"network": "Testnet3"
},
"data_directory": "bitcoin-testnet-data",
"http_timeout": 300,
"max_retries": 5,
"retry_elapsed_time": 0,
"max_online_connections": 0,
"max_sync_concurrency": 0,
"tip_delay": 1800,
"log_configuration": false,
"construction": {
"max_offline_connections": 0,
"stale_depth": 0,
"broadcast_limit": 0,
"ignore_broadcast_failures": false,
"clear_broadcasts": false,
"broadcast_behind_tip": false,
"block_broadcast_limit": 0,
"rebroadcast_all": false,
"constructor_dsl_file": "bitcoin.ros",
"end_conditions": {
"create_account": 10,
"transfer": 10
}
},
"data": {
"active_reconciliation_concurrency": 0,
"inactive_reconciliation_concurrency": 0,
"inactive_reconciliation_frequency": 0,
"log_blocks": false,
"log_transactions": false,
"log_balance_changes": false,
"log_reconciliations": false,
"ignore_reconciliation_error": false,
"exempt_accounts": "",
"bootstrap_balances": "",
"interesting_accounts": "",
"reconciliation_disabled": false,
"inactive_discrepency_search_disabled": false,
"balance_tracking_disabled": false,
"coin_tracking_disabled": false,
"end_conditions": {
"reconciliation_coverage": 0.95
},
"results_output_file": ""
}
}