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

Remove defer transaction configuration options and block incoming delayed transactions #1643

Merged
merged 35 commits into from
Sep 29, 2023
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c69b589
Remove defer transaction options --max-scheduled-transaction-time-per…
linh2931 Sep 15, 2023
d233ed6
Merge branch 'main' into remove_defer_trx_config
linh2931 Sep 15, 2023
2578ead
remove _blacklisted_transactions, remove_expired_blacklisted_trxs, an…
linh2931 Sep 16, 2023
013b20f
retire expired deferred transactions
linh2931 Sep 18, 2023
c495ab1
use >= for expiration check and logging improvement
linh2931 Sep 18, 2023
8067ad2
Merge branch 'main' into remove_defer_trx_config
linh2931 Sep 18, 2023
eeea80d
add back missing num_processed++;
linh2931 Sep 18, 2023
191d07f
Merge branch 'remove_defer_trx_config' of https://github.com/Antelope…
linh2931 Sep 18, 2023
076e18a
changedeferred_trxs_deadline to 10ms
linh2931 Sep 19, 2023
840c05b
block delayed transactions
linh2931 Sep 19, 2023
fe45fc4
add and update tests for blocking delayed transactions
linh2931 Sep 21, 2023
4603c86
remove delay member from transaction_context class
linh2931 Sep 21, 2023
d995791
remove final trx.delay_sec left behind in transaction_context.cpp
linh2931 Sep 21, 2023
5b1f7f2
Merge branch 'main' into remove_defer_trx_config
linh2931 Sep 21, 2023
8ad615a
Merge branch 'main' into remove_defer_trx_config
linh2931 Sep 21, 2023
54c9384
Merge branch 'main' into remove_defer_trx_config
linh2931 Sep 23, 2023
0310c57
adapt protocol_feature_tests/no_duplicate_deferred_id_test for delay_…
linh2931 Sep 23, 2023
218f933
move delete_auth from delay_tests.cpp to auth_tests.cpp
linh2931 Sep 25, 2023
55c51c8
simplify delayed_action_blocked and minor refactor
linh2931 Sep 25, 2023
0b47abe
restore link_delay_direct_test and link_delay_direct_parent_permissio…
linh2931 Sep 25, 2023
41a5c3b
move generated_transaction_multi_index size checks to delayed_trx_blo…
linh2931 Sep 25, 2023
508397d
restore and adpat link_delay_direct_walk_parent_permissions_test
linh2931 Sep 25, 2023
de5e3c7
restore and adapt link_delay_permission_change_test
linh2931 Sep 25, 2023
b2418c9
restore and adapt link_delay_permission_change_with_delay_heirarchy_test
linh2931 Sep 25, 2023
41ceb75
restore and adapt link_delay_link_change_test
linh2931 Sep 25, 2023
7c78c44
restore and adapt link_delay_unlink_test
linh2931 Sep 25, 2023
43a5082
restore and adapt link_delay_link_change_heirarchy_test
linh2931 Sep 25, 2023
a4d2c5d
rewrite canceldelay_test
linh2931 Sep 26, 2023
604b0e1
rewrite canceldelay_test2
linh2931 Sep 27, 2023
c7032c5
restore max_transaction_delay_create
linh2931 Sep 27, 2023
0ef0175
update max_transaction_delay_execute
linh2931 Sep 27, 2023
c07caf2
minor refactoring
linh2931 Sep 27, 2023
2d7811d
incorporate review comments for producer_plugin.cpp
linh2931 Sep 27, 2023
907d54d
move modify_gto_for_canceldelay_test out of controller to delay_test
linh2931 Sep 27, 2023
35321c9
add missing permission delay back to link_delay_direct_parent_permiss…
linh2931 Sep 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update max_transaction_delay_execute
linh2931 committed Sep 27, 2023
commit 0ef0175764944f6137a446a820715194909fb898
57 changes: 57 additions & 0 deletions unittests/delay_tests.cpp
Original file line number Diff line number Diff line change
@@ -1584,4 +1584,61 @@ BOOST_AUTO_TEST_CASE( max_transaction_delay_create ) { try {
);
} FC_LOG_AND_RETHROW() } /// max_transaction_delay_create


BOOST_AUTO_TEST_CASE( max_transaction_delay_execute ) { try {
//assuming max transaction delay is 45 days (default in config.hpp)
validating_tester chain;
const auto& tester_account = "tester"_n;

create_accounts(chain);

chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object()
("issuer", "eosio.token" )
("maximum_supply", "9000000.0000 CUR" )
);
chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object()
("to", "tester")
("quantity", "100.0000 CUR")
("memo", "for stuff")
);

//create a permission level with delay 30 days and associate it with token transfer
auto trace = chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object()
("account", "tester")
("permission", "first")
("parent", "active")
("auth", authority(chain.get_public_key(tester_account, "first"), 30*86400)) // 30 days delay
);
BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace->receipt->status);

trace = chain.push_action(config::system_account_name, linkauth::get_name(), tester_account, fc::mutable_variant_object()
("account", "tester")
("code", "eosio.token")
("type", "transfer")
("requirement", "first"));
BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace->receipt->status);

chain.produce_blocks();

//change max_transaction_delay to 60 sec
auto params = chain.control->get_global_properties().configuration;
params.max_transaction_delay = 60;
chain.push_action( config::system_account_name, "setparams"_n, config::system_account_name, mutable_variant_object()
("params", params) );

chain.produce_blocks();
//should be able to create a msig transaction with delay 60 sec, despite permission delay being 30 days, because max_transaction_delay is 60 sec
constexpr name proposal_name = "prop1"_n;
propose_approve_msig_token_transfer_trx(chain, proposal_name, {{ "tester"_n, config::active_name }}, 60, "9.0000 CUR");

//check that the delayed msig transaction can be executed after after 60 sec
chain.produce_blocks(120);
exec_msig_trx(chain, proposal_name);

//check that the transfer really happened
auto liquid_balance = get_currency_balance(chain, "tester"_n);
BOOST_REQUIRE_EQUAL(asset::from_string("91.0000 CUR"), liquid_balance);

} FC_LOG_AND_RETHROW() } /// max_transaction_delay_execute

BOOST_AUTO_TEST_SUITE_END()