Auditing RGB consensus and underlying libraries #169
dr-orlovsky
started this conversation in
General
Replies: 1 comment
-
Ты крут, док! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Structure of the libraries involved in the audit
A possible RGB consensus audit should consist of two blocks:
Client-side validation commitment schemes
Client-side validation uses a hierarchy of commitment schemata, implemented as different rust modules, abstracted from each other and designed to solve specific tasks required for the overall commitment structure to work. These tasks include:
There are two main repositories containing all the above four components:
client_side_validation
, withcommit_verify
crate in it, which most critical parts arebp-core
, withbp-dbc
andbp-seals
crates in them, where the main parts areRGB consensus
The whole of RGB consensus code exists in
rgb-core
repository and consists of the following components (structured as crate modules/directories undersrc
):schema
: a declarative formalism for defining RGB smart contracts. The schema allows defining types of RGB contract state (which can be owned by some party via bitcoin UTXO - or be global) and rules for state transitions. Additionally, for implementing complex parts of business logic schema may contain validation scripts (which further restricts rules of state transition validation) written for AluVM virtual machine using AluVM bytecode (see below).contract
: data types and structures of how the contract data are stored by the client (genesis, state transitions etc).validation
: the main code performing verification of the contract state run by each user when it receives an RGB transfer. Verification iterates through a DAG of past RGB state transitions for a single given contract (different contracts are abstracted from each other) up to genesis and checks the satisfaction of two conditions for each DAG node (RGB operation):vm
: RGB-specific components for AluVM virtual machine, which includes calls to the AluVM and RGB-specific additional operation codes related to Pedersen commitments extending basic AluVM instruction set architecture doing arithmetics, string operations, hash functions and Secp256k1 elliptic curves.Questions the audit should answer:
Are the cryptographic commitment schemes used in the RGB and client-side validation secure under the assumption of the SHA-256 hash function and Secp256k1 curve being secure?
Is there a possible way for creating double commitments which opens a way to exploit double-spending at both levels of client-side-validation libraries (doing the commitment schemes) or how does RGB validation code call these libraries?
Does the code contain any backdoors or a functionality which is not required and may be misused?
Which possible attack vectors on the external/underlying dependencies can exist which may lead/introduce double-spending vulnerabilities into the RGB?
Does the RGB verification code perform all necessary validation for each of the RGB operations for both single-use seal commitments and RGB schema and script?
Does the RGB verification code verify all possible rules which can be defined using RGB schema language and AluVM scripts?
Beta Was this translation helpful? Give feedback.
All reactions