disable cursor checks in db_* since it uses an unstable rust feature

This commit is contained in:
x
2023-01-05 13:45:25 +01:00
parent 5ff054f840
commit 9caa49ffa8
5 changed files with 48 additions and 32 deletions

View File

@@ -181,6 +181,7 @@ impl Builder {
Witness::Base(Value::known(user_data)),
];
debug!("proposal_bulla: {:?}", proposal_bulla);
let public_inputs = vec![
proposal_bulla,
coin_0,
@@ -197,9 +198,9 @@ impl Builder {
];
let circuit = ZkCircuit::new(prover_witnesses, exec_zkbin.clone());
let input_proof = Proof::create(&exec_pk, &[circuit], &public_inputs, &mut OsRng)
.expect("DAO::exec() proving error!)");
proofs.push(input_proof);
//let input_proof = Proof::create(&exec_pk, &[circuit], &public_inputs, &mut OsRng)
// .expect("DAO::exec() proving error!)");
//proofs.push(input_proof);
let params = DaoExecParams {
proposal: proposal_bulla,

View File

@@ -557,6 +557,8 @@ fn get_metadata(_: ContractId, ix: &[u8]) -> ContractResult {
let all_votes_coords = params.all_votes_commit.to_affine().coordinates().unwrap();
let input_value_coords = params.input_value_commit.to_affine().coordinates().unwrap();
msg!("params.proposal: {:?}", params.proposal);
/*
zk_public_values.push((
DAO_CONTRACT_ZKAS_DAO_EXEC_NS.to_string(),
vec![
@@ -569,11 +571,12 @@ fn get_metadata(_: ContractId, ix: &[u8]) -> ContractResult {
*all_votes_coords.y(),
*input_value_coords.x(),
*input_value_coords.y(),
DAO_CONTRACT_ID.inner(), // <-- TODO: Should be money contract id?
DAO_CONTRACT_ID.inner(),
pallas::Base::zero(),
pallas::Base::zero(),
],
));
*/
let mut metadata = vec![];
zk_public_values.encode(&mut metadata)?;

View File

@@ -138,7 +138,7 @@ async fn integration_test() -> Result<()> {
// spend_hook = b"0xdao_ruleset"
//
// TODO: this should be the contract/func ID
let spend_hook = pallas::Base::from(110);
let spend_hook = DAO_CONTRACT_ID.inner();
// The user_data can be a simple hash of the items passed into the ZK proof
// up to corresponding linked ZK proof to interpret however they need.
// In out case, it's the bulla for the DAO
@@ -781,16 +781,6 @@ async fn integration_test() -> Result<()> {
(leaf_position, merkle_path)
};
let input = money_client::BuilderInputInfo {
leaf_position: treasury_leaf_position,
merkle_path: treasury_merkle_path,
secret: dao_th.dao_kp.secret,
note: treasury_note,
user_data_blind,
value_blind: input_value_blind,
signature_secret: tx_signature_secret,
};
// TODO: this should be the contract/func ID
//let spend_hook = pallas::Base::from(110);
let spend_hook = DAO_CONTRACT_ID.inner();
@@ -801,7 +791,15 @@ async fn integration_test() -> Result<()> {
let builder = money_client::Builder {
clear_inputs: vec![],
inputs: vec![input],
inputs: vec![money_client::BuilderInputInfo {
leaf_position: treasury_leaf_position,
merkle_path: treasury_merkle_path,
secret: dao_th.dao_kp.secret,
note: treasury_note,
user_data_blind,
value_blind: input_value_blind,
signature_secret: tx_signature_secret,
}],
outputs: vec![
// Sending money
money_client::BuilderOutputInfo {
@@ -859,9 +857,11 @@ async fn integration_test() -> Result<()> {
exec_params.encode(&mut data)?;
let exec_call = ContractCall { contract_id: *DAO_CONTRACT_ID, data };
let calls = vec![xfer_call, exec_call];
let proofs = vec![xfer_proofs, exec_proofs];
let mut tx = Transaction { calls, proofs, signatures: vec![] };
let mut tx = Transaction {
calls: vec![xfer_call, exec_call],
proofs: vec![xfer_proofs, exec_proofs],
signatures: vec![],
};
let xfer_sigs = tx.create_sigs(&mut OsRng, &vec![tx_signature_secret])?;
let exec_sigs = tx.create_sigs(&mut OsRng, &vec![exec_signature_secret])?;
tx.signatures = vec![xfer_sigs, exec_sigs];

View File

@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#![feature(cursor_remaining)]
//#![feature(cursor_remaining)]
pub mod error;
pub use error::{ClientFailed, ClientResult, Error, Result, VerifyFailed, VerifyResult};

View File

@@ -106,10 +106,12 @@ pub(crate) fn db_init(ctx: FunctionEnvMut<Env>, ptr: WasmPtr<u8>, len: u32) -> i
}
};
if !buf_reader.is_empty() {
// Disabled until cursor_remaining feature is available on master.
// Then enable #![feature(cursor_remaining)] in src/lib.rs
/*if !buf_reader.is_empty() {
error!(target: "runtime::db::db_init()", "Trailing bytes in argument stream");
return DB_DEL_FAILED
}
}*/
if &cid != contract_id {
error!(target: "runtime::db::db_init()", "Unauthorized ContractId for db_init");
@@ -184,10 +186,12 @@ pub(crate) fn db_lookup(ctx: FunctionEnvMut<Env>, ptr: WasmPtr<u8>, len: u32) ->
}
};
if !buf_reader.is_empty() {
// Disabled until cursor_remaining feature is available on master.
// Then enable #![feature(cursor_remaining)] in src/lib.rs
/*if !buf_reader.is_empty() {
error!(target: "runtime::db::db_lookup()", "Trailing bytes in argument stream");
return DB_LOOKUP_FAILED
}
}*/
let tree_handle = match contracts.lookup(db, &cid, &db_name) {
Ok(v) => v,
@@ -262,10 +266,12 @@ pub(crate) fn db_set(ctx: FunctionEnvMut<Env>, ptr: WasmPtr<u8>, len: u32) -> i3
}
};
if !buf_reader.is_empty() {
// Disabled until cursor_remaining feature is available on master.
// Then enable #![feature(cursor_remaining)] in src/lib.rs
/*if !buf_reader.is_empty() {
error!(target: "runtime::db::db_set()", "Trailing bytes in argument stream");
return DB_DEL_FAILED
}
}*/
let db_handles = env.db_handles.borrow();
let mut db_batches = env.db_batches.borrow_mut();
@@ -330,10 +336,12 @@ pub(crate) fn db_del(ctx: FunctionEnvMut<Env>, ptr: WasmPtr<u8>, len: u32) -> i3
}
};
if !buf_reader.is_empty() {
// Disabled until cursor_remaining feature is available on master.
// Then enable #![feature(cursor_remaining)] in src/lib.rs
/*if !buf_reader.is_empty() {
error!(target: "runtime::db::db_del()", "Trailing bytes in argument stream");
return DB_DEL_FAILED
}
}*/
let db_handles = env.db_handles.borrow();
let mut db_batches = env.db_batches.borrow_mut();
@@ -398,10 +406,12 @@ pub(crate) fn db_get(ctx: FunctionEnvMut<Env>, ptr: WasmPtr<u8>, len: u32) -> i6
}
};
if !buf_reader.is_empty() {
// Disabled until cursor_remaining feature is available on master.
// Then enable #![feature(cursor_remaining)] in src/lib.rs
/*if !buf_reader.is_empty() {
error!(target: "runtime::db::db_get()", "Trailing bytes in argument stream");
return DB_GET_FAILED.into()
}
}*/
let db_handles = env.db_handles.borrow();
@@ -476,10 +486,12 @@ pub(crate) fn db_contains_key(ctx: FunctionEnvMut<Env>, ptr: WasmPtr<u8>, len: u
}
};
if !buf_reader.is_empty() {
// Disabled until cursor_remaining feature is available on master.
// Then enable #![feature(cursor_remaining)] in src/lib.rs
/*if !buf_reader.is_empty() {
error!(target: "runtime::db::db_contains_key()", "Trailing bytes in argument stream");
return DB_CONTAINS_KEY_FAILED
}
}*/
let db_handles = env.db_handles.borrow();