Substrate Chaoscope is a subxt based RPC Instrumentation toolkit for pallet-chaos.
Chaoscope makes Substrate Runtimes behave in ways that they're not supposed to, with the following goals:
- Explore Runtime edge cases.
- Explore Extrinsic weights and their economic implications.
- Expose Runtime Attack Vectors.
- Raise awareness about Benchmarking and Weight Design.
Substrate Runtimes can be seen as Distributed Virtual Machines (DVM), even when they’re not necessarily executing Smart Contracts. The difference is that Smart Contract-free Runtimes represent DVMs with static logic, and not really programmable via Smart Contracts bytecode. Such DVMs can however go through Runtime Upgrades, essentially upgrading DVM OpCodes.
Whenever the DVM needs to execute its State Transition Functions, there’s a specific cost attributed to the virtual computational resources allocated for such transformation. Such cost is covered in the form of fees charged to the user, so that the system can function in a sustainable manner.
The relationship between fees and computational resources allocated from the DVM is critical to the economical safety of the system. Poorly designed fees leave room for wide Denial of Service (DoS) attack surfaces. An attacker can flood the system with resource-expensive but economically-cheap operations, effectively denying service from a significant number of users, while only spending a small amount of tokens.
While Ethereum introduced the concept of Gas as a correlation between EVM resource consumption and economical fees, Substrate uses Weights so that Runtime Engineers can attribute appropriate fees for each extrinsic operation of their pallets. Properly engineered transaction fees are a fundamental property of a attack-resistant pallet.
- To deploy a test setup:
$ git clone https://github.com/paritytech/chaoscope.git
$ cd chaoscope
$ bash chaoscope.sh
The script will deploy a substrate-node-template
with pallet-chaos
, fire extrinsics to it and report the resutls.
-
overflow_adder
extrinsic implementation -
overflow_adder
subxt RPC -
clear_adder
extrinsic implementation -
clear_adder
subxt RPC -
drag_block_unit_weight
extrinsic implementation -
drag_block_unit_weight
subxt RPC -
substrate-node-chaos
(substrate-node-chaos
+pallet-chaos
) -
chaoscope.sh
- Relay Chain support on
chaoscope.sh
(polkadot
+[cumulus
+pallet-chaos
])