Skip to content

Commit 90159f7

Browse files
docs: final doc version, extend EVM flow documentation (#442)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 0c05fe5 commit 90159f7

11 files changed

Lines changed: 72 additions & 140 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ Valence programs use a resource model to structure control flow, compiling to ta
77

88
## Status
99

10-
This project is under heavy development, however portions of the toolchain have stabilized to build programs for cross-chain liquidity deployment and multi-party agreements. Programs may be written in a constrained configuration language or using rust, though developer documentation for the latter is currently quite sparse.
10+
While this project is no longer under active development, portions of the toolchain have stabilized to build programs for cross-chain liquidity deployment and multi-party agreements. Programs may be written in a constrained configuration language or using rust, though developer documentation for the latter is currently quite sparse.
1111

12-
Valence currently supports connections to Cosmos and EVM domains, with SVM coming soon. Programs currently compile to WASM, with planned support for RISC zk circuits.
12+
Valence supports connections to Cosmos and EVM domains. Programs currently compile to WASM with support of SP1 zk circuits using the ZK Coprocessor.

docs/src/SUMMARY.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
- [Interchain Accounts](./accounts/interchain_accounts.md)
1010
- [Libraries and Functions](./components/libraries_and_functions.md)
1111
- [Programs and Authorizations](./components/programs_and_authorizations.md)
12-
- [Middleware](./components/middleware.md)
1312
- [Valence ZK System](./zk/_overview.md)
1413
- [System Overview](./zk/01_system_overview.md)
1514
- [Developing Coprocessor Apps](./zk/02_developing_coprocessor_apps.md)
@@ -26,6 +25,7 @@
2625
- [Instantiation](./authorizations_processors/authorization_instantiation.md)
2726
- [Owner Actions](./authorizations_processors/authorization_owner_actions.md)
2827
- [User Actions](./authorizations_processors/authorization_user_actions.md)
28+
- [EVM](./authorizations_processors/evm_authorization_contract.md)
2929
- [Processor Contract](./authorizations_processors/processor_contract.md)
3030
- [Processor](./authorizations_processors/processor.md)
3131
- [Lite Processor](./authorizations_processors/lite_processor.md)
@@ -94,5 +94,3 @@
9494
- [Example without Program Manager](./testing/without_program_manager.md)
9595
- [Example with Program Manager](./testing/with_program_manager.md)
9696
- [Security](./security.md)
97-
- [Deployment](./deployment/_overview.md)
98-
- [Local Deployment](./deployment/local.md)

docs/src/authorizations_processors/authorization_instantiation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ Once deployed, authorizations can be created and executed on the main domain. To
2121
- `storeCallbacks`: whether to persist processor callbacks on‑chain (otherwise only events are emitted)
2222

2323
EVM does not use sub‑owners; instead, the owner can add or remove admin addresses that are permitted to perform privileged updates. Cross‑domain routing is handled via Hyperlane mailboxes (set during Processor deployment), not at Authorization instantiation time.
24+
25+
For more information on how to deploy and interact with the EVM authorization contract, check the [EVM Authorization contract section](./evm_authorization_contract.md).
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# EVM Authorization Contract
2+
3+
If a general message passing protocol like Hyperlane wants to be avoided to not require the deployment of additional infrastructure, we also provide a Solidity version of the Authorization contract with similar functionality than the CosmWasm version.
4+
5+
These are the steps to set up our EVM program using the EVM Authorization contract instead of Hyperlane:
6+
7+
1) Deploy `Authorization.sol` providing the program owner, the lite processor address (previously deployed) and a flag specifying if we want to store the callbacks in the contract state or just emit them as events (less gas consumption):
8+
9+
```solidity
10+
constructor(address _owner, address _processor, bool _storeCallbacks) Ownable(_owner)
11+
```
12+
13+
2) Once it's deployed, we need to set the authorization contract as an authorized address on the processor.
14+
15+
```solidity
16+
function addAuthorizedAddress(address _address)
17+
```
18+
19+
This will allow processing the messages that the newly deployed authorization contract will forward to the processor.
20+
21+
3) Now we can start adding our authorizations:
22+
23+
```solidity
24+
/**
25+
* @notice Adds standard authorizations for a specific label
26+
* @dev Can only be called by the owner
27+
* @param _labels Array of labels for the authorizations
28+
* @param _users Array of arrays of user addresses associated with each label
29+
* @param _authorizationData Array of arrays of authorization data associated with each label
30+
*/
31+
function addStandardAuthorizations(
32+
string[] memory _labels,
33+
address[][] memory _users,
34+
AuthorizationData[][] memory _authorizationData
35+
)
36+
```
37+
38+
This method allows adding multiple authorizations at the same time using arrays, to optimize the gas consumption. The most important part here is the `AuthorizationData`, which is defined as follows:
39+
40+
```solidity
41+
/**
42+
* @notice Structure representing the data for the authorization label
43+
* @dev This structure contains the contract address and the function signature hash
44+
* @param contractAddress The address of the contract that is authorized to be called
45+
* @param useFunctionSelector Boolean indicating if the function selector should be used instead of callHash
46+
* @param functionSelector The function selector of the function that is authorized to be called
47+
* @param callHash The function signature hash of the function that is authorized to be called
48+
*/
49+
struct AuthorizationData {
50+
address contractAddress;
51+
bool useFunctionSelector;
52+
bytes4 functionSelector;
53+
bytes32 callHash;
54+
}
55+
```
56+
57+
As explained above, we have two ways of defining our authorization: using the function selector or a callHash. If we use a function selector, the authorized address is allowed to execute that specific function with **ANY** arguments. For example, if the function is `transfer(uint256 amount)` the address can specify any amount value when calling the authorization. On the other hand, if we want to restrict the call to a specific value, we provide the call hash so that only those specific call bytes can be executed. For example, we compute the `keccak256` hash of the encoded call data (e.g., `abi.encodeWithSignature("transfer(uint256)", 1000)`) and provide that as the `callHash`. Then the authorized address can **ONLY** call this authorization with that specific value.
58+
59+
As we can see this is less flexible than the CosmWasm version due to the nature of the Solidity language vs Rust but tends to be enough for most of the programs. If more flexibility is required, the option of using a message passing protocol with our encoding/decoding mechanisms or using the ZK Coprocessor is also available.
60+
61+
4) Now that everything is set up, we can execute our authorization like this:
62+
63+
```solidity
64+
function sendProcessorMessage(string calldata label, bytes calldata _message)
65+
```
66+
67+
We simply need to specify what label we want to execute and the encoded `ProcessorMessage` that will be forwarded to the Processor. This performs all the checks against our AuthorizationData, and if they all pass, the message will be forwarded to the processor, executed, and a callback will be received on the Authorization contract.

docs/src/components/_overview.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Valence currently supports CosmWasm and EVM. SVM support coming soon. The rest o
88
- [Accounts](../accounts/_overview.md)
99
- [Libraries and Functions](./libraries_and_functions.md)
1010
- [Programs and Authorizations](./programs_and_authorizations.md)
11-
- [Middleware](./middleware.md)
1211

1312
2. **Off-chain Execution via ZK Coprocessor**:
1413
Early specifications for the [Valence ZK System](./../zk/_overview.md). We aim to move as much computation off-chain as possible since off-chain computation is a more scalable approach to building a cross-chain execution environment.

docs/src/components/middleware.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

docs/src/deployment/_overview.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/src/deployment/local.md

Lines changed: 0 additions & 93 deletions
This file was deleted.

docs/src/introduction.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Introduction
22

3-
> 🚧 Valence Protocol architecture and developer documentation is still evolving rapidly. Portions of the toolchain have stabilized to build cross-chain vaults, and extending vaults with multi-party agreements. Send us a message on [X](https://x.com/valencezone) if you'd like to get started!
4-
53
**Valence** is a unified development environment that enables building *trust-minimized cross-chain DeFi applications*, called **Valence Programs**.
64

75
Valence Programs are:

docs/src/security.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
# Security
22
Valence Programs have been independently audited. Please find audit reports [here](https://github.com/timewave-computer/valence-protocol/tree/main/audits/).
3-
4-
If you believe you've found a security-related issue with Valence Programs, please disclose responsibly by contacting the Timewave team at [security@timewave.computer](mailto:security@timewave.computer).

0 commit comments

Comments
 (0)