mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Update Deployer README, 80-character line length
This commit is contained in:
@@ -4,20 +4,26 @@ The deployer for Serai's Ethereum contracts.
|
|||||||
|
|
||||||
## Goals
|
## Goals
|
||||||
|
|
||||||
It should be possible to efficiently locate the Serai Router on an blockchain with the EVM, without
|
It should be possible to efficiently locate the Serai Router on a blockchain
|
||||||
relying on any centralized (or even federated) entities. While deploying and locating an instance of
|
with the EVM, without relying on any centralized (or even federated) entities.
|
||||||
the Router would be trivial, by using a fixed signature for the deployment transaction, the Router
|
While deploying and locating an instance of the Router would be trivial, by
|
||||||
must be constructed with the correct key for the Serai network (or set to have the correct key
|
using a fixed signature for the deployment transaction, the Router must be
|
||||||
post-construction). Since this cannot be guaranteed to occur, the process must be retryable and the
|
constructed with the correct key for the Serai network (or set to have the
|
||||||
first successful invocation must be efficiently findable.
|
correct key post-construction). Since this cannot be guaranteed to occur, the
|
||||||
|
process must be retryable and the first successful invocation must be
|
||||||
|
efficiently findable.
|
||||||
|
|
||||||
## Methodology
|
## Methodology
|
||||||
|
|
||||||
We define a contract, the Deployer, to deploy the router. This contract could use `CREATE2` with the
|
We define a contract, the Deployer, to deploy the Router. This contract could
|
||||||
key representing Serai as the salt, yet this would be open to collision attacks with just 2**80
|
use `CREATE2` with the key representing Serai as the salt, yet this would be
|
||||||
complexity. Instead, we use `CREATE` which would require 2**80 on-chain transactions (infeasible) to
|
open to collision attacks with just 2\*\*80 complexity. Instead, we use
|
||||||
use as the basis of a collision.
|
`CREATE` which would require 2\*\*80 on-chain transactions (infeasible) to use
|
||||||
|
as the basis of a collision.
|
||||||
|
|
||||||
In order to efficiently find the contract for a key, the Deployer contract saves the addresses of
|
In order to efficiently find the contract for a key, the Deployer contract
|
||||||
deployed contracts (indexed by the initialization code hash). This allows using a single call to a
|
saves the addresses of deployed contracts (indexed by the initialization code's
|
||||||
contract with a known address to find the proper Router.
|
hash). This allows using a single call to a contract with a known address to
|
||||||
|
find the proper Router. Saving the address to the state enables finding the
|
||||||
|
Router's address even if the connected-to node's logs have been pruned for
|
||||||
|
historical blocks.
|
||||||
|
|||||||
Reference in New Issue
Block a user