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

Require dry-run trxs to have authorization and add tests #1489

Merged
merged 5 commits into from
Aug 14, 2023

Conversation

heifner
Copy link
Member

@heifner heifner commented Aug 14, 2023

Add requirement for dry-run/compute transactions to require authorization.
Add tests for dry-run/compute transactions.
Also some minor cleanup to unneeded includes.

Resolves #1083

@heifner heifner added the OCI Work exclusive to OCI team label Aug 14, 2023
@heifner heifner added the documentation Improvements or additions to documentation label Aug 14, 2023
BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace->receipt->status);
// now push for real
trace = chain.push_transaction(trx);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably check the status again after the real execution.

getage_data = abi_ser.variant_to_binary("getage", mutable_variant_object()
("user", "alice"),
abi_serializer::create_yield_function( abi_serializer_max_time ));
produce_block();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we call produce_block() here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason, removed.

send_db_api_transaction("insert"_n, insert_data, vector<permission_level>{{"alice"_n, config::active_name}}, transaction_metadata::trx_type::dry_run);

// verify the dry-run insert was rolled back, use a read-only trx to query
BOOST_CHECK_EXCEPTION(send_db_api_transaction("getage"_n, getage_data, {}, transaction_metadata::trx_type::read_only), fc::exception,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this combination of using read_only transaction.

@heifner heifner merged commit ccf2bfa into main Aug 14, 2023
22 checks passed
@heifner heifner deleted the GH-1083-dry-run-tests branch August 14, 2023 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation OCI Work exclusive to OCI team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add dry-run unittests
3 participants