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:
parazyd
2023-05-30 00:23:37 +02:00
parent 0ced789759
commit d59d3cd21a
14 changed files with 601 additions and 31 deletions

View File

@@ -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
}