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

Add instruction limit when decoding XCMs #1227

Merged
merged 14 commits into from
Aug 29, 2023

Conversation

franciscoaguirre
Copy link
Contributor

@franciscoaguirre franciscoaguirre commented Aug 28, 2023

This PR makes XCM decoding fail if you go over a certain limit.

@franciscoaguirre franciscoaguirre added the T6-XCM This PR/Issue is related to XCM. label Aug 28, 2023
@franciscoaguirre franciscoaguirre marked this pull request as ready for review August 28, 2023 17:19
@franciscoaguirre
Copy link
Contributor Author

bot rebase

@command-bot
Copy link

command-bot bot commented Aug 28, 2023

@franciscoaguirre Unknown command "rebase". Refer to help docs and/or source code.

@franciscoaguirre
Copy link
Contributor Author

bot fmt

@command-bot
Copy link

command-bot bot commented Aug 28, 2023

@franciscoaguirre https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3460071 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 13-fa786025-1689-4201-8832-2f966189cf5f to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Aug 28, 2023

@franciscoaguirre Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3460071 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3460071/artifacts/download.

@KiChjang
Copy link
Contributor

Generally speaking, it is hard and sometimes impossible to measure the length of an input buffer, so what @bkchr suggested would be the best solution, even though it does change the API a bit.

@franciscoaguirre
Copy link
Contributor Author

@KiChjang @bkchr I'll change this to use a BoundedVec then 👍

@bkchr
Copy link
Member

bkchr commented Aug 28, 2023

I mean you can also copy the decode implementation from BoundedVec and achieve the same result without breaking the api.

@franciscoaguirre
Copy link
Contributor Author

I like that. Let me try it

@franciscoaguirre
Copy link
Contributor Author

bot fmt

@command-bot
Copy link

command-bot bot commented Aug 28, 2023

@franciscoaguirre https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3461674 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 14-06da03f4-bab5-41e0-901a-75d0626ec77a to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Aug 28, 2023

@franciscoaguirre Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3461674 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3461674/artifacts/download.

polkadot/xcm/src/v3/mod.rs Outdated Show resolved Hide resolved
@command-bot
Copy link

command-bot bot commented Aug 28, 2023

@franciscoaguirre Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3462613 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3462613/artifacts/download.

@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: test-linux-stable 3/3
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3462629

@franciscoaguirre
Copy link
Contributor Author

bot fmt

@command-bot
Copy link

command-bot bot commented Aug 28, 2023

@franciscoaguirre https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3463067 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 17-589ad713-534e-4bf4-8b3d-d4b7260f2804 to cancel this command or bot cancel to cancel all commands in this pull request.

@franciscoaguirre franciscoaguirre self-assigned this Aug 28, 2023
@command-bot
Copy link

command-bot bot commented Aug 28, 2023

@franciscoaguirre Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3463067 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3463067/artifacts/download.

@franciscoaguirre
Copy link
Contributor Author

@bkchr @ggwpez Could you take another look?

Copy link
Member

@gavofyork gavofyork left a comment

Choose a reason for hiding this comment

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

If we're not going to allow the upper decode length bound to be parameterisable now, then please make an issue for it to be picked up in a later XCM version and place it in the XCM horizon.

@franciscoaguirre franciscoaguirre merged commit fa3b842 into master Aug 29, 2023
11 of 13 checks passed
@franciscoaguirre franciscoaguirre deleted the cis-xcm-max-instructions branch August 29, 2023 12:30
Daanvdplas pushed a commit that referenced this pull request Sep 11, 2023
* Add instruction limit when decoding XCMs

* Make the instruction limit a constant

* Use vec for buffer

* ".git/.scripts/commands/fmt/fmt.sh"

* Go back on std

* Use BoundedVec's Decode implementation

* ".git/.scripts/commands/fmt/fmt.sh"

* Use an actual BoundedVec to decode XCMs

* Change comment location

* ".git/.scripts/commands/fmt/fmt.sh"

* Remove unused imports

* ".git/.scripts/commands/fmt/fmt.sh"

---------

Co-authored-by: command-bot <>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
* Add Beefy pallet to Rialto runtime

* Add Beefy gadget to Rialto node

* Add MMR pallet to Rialto runtime

* Add Beefy pallet to Millau runtime

* Add Beefy gadget to Millau node

* Add MMR pallet to Millau runtime

* Add pallet_beefy_mmr to Millau runtime

* Add pallet_beefy_mmr to Rialto runtime

* Implement MMR and BEEFY APIs in Rialto

* fix unit tests

- should_encode_bridge_send_message_call() tests for new
  runtime encoding resulted from newly added pallets.
- runtime size_of::<Call>() slightly increased from newly
  added pallets.

* fix grumbles

* tighten clippy allowances

* fix more grumbles

* Add MMR RPC to Rialto and Millau nodes

Also implement MmrApi in Millau runtime.

* rialto: use upstream polkadot_client::RuntimeApiCollection
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
* Add Beefy pallet to Rialto runtime

* Add Beefy gadget to Rialto node

* Add MMR pallet to Rialto runtime

* Add Beefy pallet to Millau runtime

* Add Beefy gadget to Millau node

* Add MMR pallet to Millau runtime

* Add pallet_beefy_mmr to Millau runtime

* Add pallet_beefy_mmr to Rialto runtime

* Implement MMR and BEEFY APIs in Rialto

* fix unit tests

- should_encode_bridge_send_message_call() tests for new
  runtime encoding resulted from newly added pallets.
- runtime size_of::<Call>() slightly increased from newly
  added pallets.

* fix grumbles

* tighten clippy allowances

* fix more grumbles

* Add MMR RPC to Rialto and Millau nodes

Also implement MmrApi in Millau runtime.

* rialto: use upstream polkadot_client::RuntimeApiCollection
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
* Add Beefy pallet to Rialto runtime

* Add Beefy gadget to Rialto node

* Add MMR pallet to Rialto runtime

* Add Beefy pallet to Millau runtime

* Add Beefy gadget to Millau node

* Add MMR pallet to Millau runtime

* Add pallet_beefy_mmr to Millau runtime

* Add pallet_beefy_mmr to Rialto runtime

* Implement MMR and BEEFY APIs in Rialto

* fix unit tests

- should_encode_bridge_send_message_call() tests for new
  runtime encoding resulted from newly added pallets.
- runtime size_of::<Call>() slightly increased from newly
  added pallets.

* fix grumbles

* tighten clippy allowances

* fix more grumbles

* Add MMR RPC to Rialto and Millau nodes

Also implement MmrApi in Millau runtime.

* rialto: use upstream polkadot_client::RuntimeApiCollection
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
* Add Beefy pallet to Rialto runtime

* Add Beefy gadget to Rialto node

* Add MMR pallet to Rialto runtime

* Add Beefy pallet to Millau runtime

* Add Beefy gadget to Millau node

* Add MMR pallet to Millau runtime

* Add pallet_beefy_mmr to Millau runtime

* Add pallet_beefy_mmr to Rialto runtime

* Implement MMR and BEEFY APIs in Rialto

* fix unit tests

- should_encode_bridge_send_message_call() tests for new
  runtime encoding resulted from newly added pallets.
- runtime size_of::<Call>() slightly increased from newly
  added pallets.

* fix grumbles

* tighten clippy allowances

* fix more grumbles

* Add MMR RPC to Rialto and Millau nodes

Also implement MmrApi in Millau runtime.

* rialto: use upstream polkadot_client::RuntimeApiCollection
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* Add Beefy pallet to Rialto runtime

* Add Beefy gadget to Rialto node

* Add MMR pallet to Rialto runtime

* Add Beefy pallet to Millau runtime

* Add Beefy gadget to Millau node

* Add MMR pallet to Millau runtime

* Add pallet_beefy_mmr to Millau runtime

* Add pallet_beefy_mmr to Rialto runtime

* Implement MMR and BEEFY APIs in Rialto

* fix unit tests

- should_encode_bridge_send_message_call() tests for new
  runtime encoding resulted from newly added pallets.
- runtime size_of::<Call>() slightly increased from newly
  added pallets.

* fix grumbles

* tighten clippy allowances

* fix more grumbles

* Add MMR RPC to Rialto and Millau nodes

Also implement MmrApi in Millau runtime.

* rialto: use upstream polkadot_client::RuntimeApiCollection
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* Add Beefy pallet to Rialto runtime

* Add Beefy gadget to Rialto node

* Add MMR pallet to Rialto runtime

* Add Beefy pallet to Millau runtime

* Add Beefy gadget to Millau node

* Add MMR pallet to Millau runtime

* Add pallet_beefy_mmr to Millau runtime

* Add pallet_beefy_mmr to Rialto runtime

* Implement MMR and BEEFY APIs in Rialto

* fix unit tests

- should_encode_bridge_send_message_call() tests for new
  runtime encoding resulted from newly added pallets.
- runtime size_of::<Call>() slightly increased from newly
  added pallets.

* fix grumbles

* tighten clippy allowances

* fix more grumbles

* Add MMR RPC to Rialto and Millau nodes

Also implement MmrApi in Millau runtime.

* rialto: use upstream polkadot_client::RuntimeApiCollection
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* Add Beefy pallet to Rialto runtime

* Add Beefy gadget to Rialto node

* Add MMR pallet to Rialto runtime

* Add Beefy pallet to Millau runtime

* Add Beefy gadget to Millau node

* Add MMR pallet to Millau runtime

* Add pallet_beefy_mmr to Millau runtime

* Add pallet_beefy_mmr to Rialto runtime

* Implement MMR and BEEFY APIs in Rialto

* fix unit tests

- should_encode_bridge_send_message_call() tests for new
  runtime encoding resulted from newly added pallets.
- runtime size_of::<Call>() slightly increased from newly
  added pallets.

* fix grumbles

* tighten clippy allowances

* fix more grumbles

* Add MMR RPC to Rialto and Millau nodes

Also implement MmrApi in Millau runtime.

* rialto: use upstream polkadot_client::RuntimeApiCollection
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* Add Beefy pallet to Rialto runtime

* Add Beefy gadget to Rialto node

* Add MMR pallet to Rialto runtime

* Add Beefy pallet to Millau runtime

* Add Beefy gadget to Millau node

* Add MMR pallet to Millau runtime

* Add pallet_beefy_mmr to Millau runtime

* Add pallet_beefy_mmr to Rialto runtime

* Implement MMR and BEEFY APIs in Rialto

* fix unit tests

- should_encode_bridge_send_message_call() tests for new
  runtime encoding resulted from newly added pallets.
- runtime size_of::<Call>() slightly increased from newly
  added pallets.

* fix grumbles

* tighten clippy allowances

* fix more grumbles

* Add MMR RPC to Rialto and Millau nodes

Also implement MmrApi in Millau runtime.

* rialto: use upstream polkadot_client::RuntimeApiCollection
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* Add Beefy pallet to Rialto runtime

* Add Beefy gadget to Rialto node

* Add MMR pallet to Rialto runtime

* Add Beefy pallet to Millau runtime

* Add Beefy gadget to Millau node

* Add MMR pallet to Millau runtime

* Add pallet_beefy_mmr to Millau runtime

* Add pallet_beefy_mmr to Rialto runtime

* Implement MMR and BEEFY APIs in Rialto

* fix unit tests

- should_encode_bridge_send_message_call() tests for new
  runtime encoding resulted from newly added pallets.
- runtime size_of::<Call>() slightly increased from newly
  added pallets.

* fix grumbles

* tighten clippy allowances

* fix more grumbles

* Add MMR RPC to Rialto and Millau nodes

Also implement MmrApi in Millau runtime.

* rialto: use upstream polkadot_client::RuntimeApiCollection
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* Add Beefy pallet to Rialto runtime

* Add Beefy gadget to Rialto node

* Add MMR pallet to Rialto runtime

* Add Beefy pallet to Millau runtime

* Add Beefy gadget to Millau node

* Add MMR pallet to Millau runtime

* Add pallet_beefy_mmr to Millau runtime

* Add pallet_beefy_mmr to Rialto runtime

* Implement MMR and BEEFY APIs in Rialto

* fix unit tests

- should_encode_bridge_send_message_call() tests for new
  runtime encoding resulted from newly added pallets.
- runtime size_of::<Call>() slightly increased from newly
  added pallets.

* fix grumbles

* tighten clippy allowances

* fix more grumbles

* Add MMR RPC to Rialto and Millau nodes

Also implement MmrApi in Millau runtime.

* rialto: use upstream polkadot_client::RuntimeApiCollection
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 10, 2024
* Add Beefy pallet to Rialto runtime

* Add Beefy gadget to Rialto node

* Add MMR pallet to Rialto runtime

* Add Beefy pallet to Millau runtime

* Add Beefy gadget to Millau node

* Add MMR pallet to Millau runtime

* Add pallet_beefy_mmr to Millau runtime

* Add pallet_beefy_mmr to Rialto runtime

* Implement MMR and BEEFY APIs in Rialto

* fix unit tests

- should_encode_bridge_send_message_call() tests for new
  runtime encoding resulted from newly added pallets.
- runtime size_of::<Call>() slightly increased from newly
  added pallets.

* fix grumbles

* tighten clippy allowances

* fix more grumbles

* Add MMR RPC to Rialto and Millau nodes

Also implement MmrApi in Millau runtime.

* rialto: use upstream polkadot_client::RuntimeApiCollection
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 10, 2024
* Add Beefy pallet to Rialto runtime

* Add Beefy gadget to Rialto node

* Add MMR pallet to Rialto runtime

* Add Beefy pallet to Millau runtime

* Add Beefy gadget to Millau node

* Add MMR pallet to Millau runtime

* Add pallet_beefy_mmr to Millau runtime

* Add pallet_beefy_mmr to Rialto runtime

* Implement MMR and BEEFY APIs in Rialto

* fix unit tests

- should_encode_bridge_send_message_call() tests for new
  runtime encoding resulted from newly added pallets.
- runtime size_of::<Call>() slightly increased from newly
  added pallets.

* fix grumbles

* tighten clippy allowances

* fix more grumbles

* Add MMR RPC to Rialto and Millau nodes

Also implement MmrApi in Millau runtime.

* rialto: use upstream polkadot_client::RuntimeApiCollection
bkchr pushed a commit that referenced this pull request Apr 10, 2024
* Add Beefy pallet to Rialto runtime

* Add Beefy gadget to Rialto node

* Add MMR pallet to Rialto runtime

* Add Beefy pallet to Millau runtime

* Add Beefy gadget to Millau node

* Add MMR pallet to Millau runtime

* Add pallet_beefy_mmr to Millau runtime

* Add pallet_beefy_mmr to Rialto runtime

* Implement MMR and BEEFY APIs in Rialto

* fix unit tests

- should_encode_bridge_send_message_call() tests for new
  runtime encoding resulted from newly added pallets.
- runtime size_of::<Call>() slightly increased from newly
  added pallets.

* fix grumbles

* tighten clippy allowances

* fix more grumbles

* Add MMR RPC to Rialto and Millau nodes

Also implement MmrApi in Millau runtime.

* rialto: use upstream polkadot_client::RuntimeApiCollection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T6-XCM This PR/Issue is related to XCM.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants