mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-08 22:28:12 -05:00
contract/deployooor: Initial impl of non-native smart contract deployment.
This supports (Re)Deployment of smart contracts, and additionally making them immutable after they have been deployed.
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
constant "DeployContract" {
|
||||
EcFixedPointBase NULLIFIER_K,
|
||||
}
|
||||
|
||||
witness "DeployContract" {
|
||||
# Amount of bytes to store on-chain
|
||||
Base bytes,
|
||||
# Deploy key used for signing and contract reference
|
||||
Base deploy_key,
|
||||
}
|
||||
|
||||
circuit "DeployContract" {
|
||||
# Derive a public key used for the signature and constrain
|
||||
# its coordinates:
|
||||
signature_public = ec_mul_base(deploy_key, NULLIFIER_K);
|
||||
signature_x = ec_get_x(signature_public);
|
||||
signature_y = ec_get_y(signature_public);
|
||||
constrain_instance(signature_x);
|
||||
constrain_instance(signature_y);
|
||||
|
||||
# Derive the contract address from the public key's coordinates
|
||||
address = poseidon_hash(signature_x, signature_y);
|
||||
constrain_instance(address);
|
||||
|
||||
# Constrain the byte size of the deployed binaries
|
||||
constrain_instance(bytes);
|
||||
|
||||
# TODO: Fee cost for storing this data on-chain
|
||||
}
|
||||
Reference in New Issue
Block a user