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

revert: stalehash extension #2184

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 5 additions & 4 deletions e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions e2e/stateful-pallet-storage/handleItemized.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,7 @@ describe('📗 Stateful Pallet Storage', function () {
add_actions,
0
);
await assert.rejects(itemized_add_result_1.signAndSend('current'), {
name: 'RpcError',
message: /1010: Invalid Transaction: Custom error: 9/,
});
await assert.rejects(itemized_add_result_1.fundAndSend(fundingSource), { name: 'StalePageState' });
});
});

Expand Down Expand Up @@ -288,10 +285,7 @@ describe('📗 Stateful Pallet Storage', function () {
};
const remove_actions = [remove_action];
const op = ExtrinsicHelper.applyItemActions(providerKeys, schemaId_deletable, msa_id, remove_actions, 0);
await assert.rejects(op.signAndSend('current'), {
name: 'RpcError',
message: /1010: Invalid Transaction: Custom error: 9/,
});
await assert.rejects(op.fundAndSend(fundingSource), { name: 'StalePageState' });
});
});

Expand Down
20 changes: 2 additions & 18 deletions e2e/stateful-pallet-storage/handlePaginated.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ describe('📗 Stateful Pallet Storage', function () {

const paginated_add_result_1 = ExtrinsicHelper.upsertPage(providerKeys, schemaId, msa_id, page_id, payload_1, 0);
await assert.rejects(paginated_add_result_1.signAndSend('current'), {
name: 'RpcError',
message: /1010: Invalid Transaction: Custom error: 9/,
message: 'Target page hash does not match current page hash',
name: 'StalePageState',
});
});
});
Expand Down Expand Up @@ -232,22 +232,6 @@ describe('📗 Stateful Pallet Storage', function () {
section: 'statefulStorage',
});
});

it('🛑 should fail call to remove page for un-delegated attempts', async function () {
Copy link
Collaborator Author

@aramikm aramikm Oct 11, 2024

Choose a reason for hiding this comment

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

These tests are not correct and I had to remove since we are using a badMsaId which it's nonce is lower than current nonce for providerKeys it is throwing following error.

1010: Invalid Transaction: Transaction is outdated which might be a nonce check race condition issue which is not related to this specific pallet or extrinsic

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

On a second thought it is weird why this gets triggered

The following is the only place we are returning InvalidTransaction::Stale.

		// The default account (no account) has a nonce of 0.
		// If account nonce is not equal to the tx nonce (self.0), the tx is invalid.  Therefore, check if it is a stale or future tx.
		if self.0 != account.nonce {
			return Err(if self.0 < account.nonce {
				InvalidTransaction::Stale
			} else {
				InvalidTransaction::Future
			}
			.into())
		}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think it's a blocker for this PR merge but we should take a deeper look

const paginated_add_result_1 = ExtrinsicHelper.removePage(providerKeys, schemaId, badMsaId, 0, 0);
await assert.rejects(paginated_add_result_1.fundAndSend(fundingSource), {
name: 'UnauthorizedDelegate',
section: 'statefulStorage',
});
});

it('🛑 should fail call to remove page with stale target hash', async function () {
const paginated_add_result_1 = ExtrinsicHelper.removePage(providerKeys, schemaId, msa_id, 0, 1000);
await assert.rejects(paginated_add_result_1.signAndSend('current'), {
name: 'RpcError',
message: /1010: Invalid Transaction: Custom error: 9/,
});
});
});

describe('Paginated Storage RPC Tests', function () {
Expand Down
3 changes: 0 additions & 3 deletions node/cli/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use sp_core::{Encode, Pair};
use sp_keyring::Sr25519Keyring;
use sp_runtime::{OpaqueExtrinsic, SaturatedConversion};

use frequency_runtime::StaleHashCheckExtension;
use pallet_balances::Call as BalancesCall;
use pallet_msa;
use sp_inherents::InherentDataProvider;
Expand Down Expand Up @@ -133,7 +132,6 @@ pub fn create_benchmark_extrinsic(
pallet_frequency_tx_payment::ChargeFrqTransactionPayment::<runtime::Runtime>::from(0),
pallet_msa::CheckFreeExtrinsicUse::<runtime::Runtime>::new(),
pallet_handles::handles_signed_extension::HandlesSignedExtension::<runtime::Runtime>::new(),
StaleHashCheckExtension,
frame_metadata_hash_extension::CheckMetadataHash::<runtime::Runtime>::new(false),
cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim::<runtime::Runtime>::new(),
);
Expand All @@ -151,7 +149,6 @@ pub fn create_benchmark_extrinsic(
(),
(),
(),
(),
None,
(),
),
Expand Down
Loading
Loading