Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/issue/362-reduce-type-footprint'…
Browse files Browse the repository at this point in the history
… into issue/362-reduce-type-footprint
  • Loading branch information
goastler committed May 30, 2023
2 parents c098f15 + 3bebb62 commit 628bde3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
43 changes: 26 additions & 17 deletions contracts/captcha/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,16 @@ pub mod captcha {
#[derive(PartialEq, Debug, Eq, Clone, scale::Encode, scale::Decode)]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo, StorageLayout))]
pub struct Commit {
id: Hash, // the commitment id
user: AccountId, // the user who submitted the commitment
dataset_id: Hash, // the dataset id
status: CaptchaStatus, // the status of the commitment
dapp: AccountId, // the dapp which the user completed the captcha on
provider: AccountId, // the provider who supplied the challenge
requested_at: BlockNumber, // the block number at which the captcha was requested
completed_at: BlockNumber, // the block number at which the captcha was completed
user_signature: Vec<u8>, // the user's signature of the commitment
id: Hash, // the commitment id
user: AccountId, // the user who submitted the commitment
dataset_id: Hash, // the dataset id
status: CaptchaStatus, // the status of the commitment
dapp: AccountId, // the dapp which the user completed the captcha on
provider: AccountId, // the provider who supplied the challenge
requested_at: BlockNumber, // the block number at which the captcha was requested
completed_at: BlockNumber, // the block number at which the captcha was completed
user_signature_part1: [u8; 32], // the user's signature of the commitment
user_signature_part2: [u8; 32],
}

/// DApps are distributed apps who want their users to be verified by Providers, either paying
Expand Down Expand Up @@ -2740,7 +2741,8 @@ pub mod captcha {
completed_at: 0,
requested_at: 0,
id: solution_id,
user_signature: Vec::new(),
user_signature_part1: [0x0; 32],
user_signature_part2: [0x0; 32],
});
let commitment = contract
.captcha_solution_commitments
Expand All @@ -2764,7 +2766,8 @@ pub mod captcha {
completed_at: 0,
requested_at: 0,
id: solution_id,
user_signature: Vec::new(),
user_signature_part1: [0x0; 32],
user_signature_part2: [0x0; 32],
});
let commitment = contract
.captcha_solution_commitments
Expand Down Expand Up @@ -2839,7 +2842,8 @@ pub mod captcha {
completed_at: 0,
requested_at: 0,
id: solution_id,
user_signature: Vec::new(),
user_signature_part1: [0x0; 32],
user_signature_part2: [0x0; 32],
});
}

Expand Down Expand Up @@ -2904,7 +2908,8 @@ pub mod captcha {
completed_at: 0,
requested_at: 0,
id: solution_id,
user_signature: Vec::new(),
user_signature_part1: [0x0; 32],
user_signature_part2: [0x0; 32],
})
.unwrap();
let commitment = contract
Expand All @@ -2927,7 +2932,8 @@ pub mod captcha {
completed_at: 0,
requested_at: 0,
id: solution_id,
user_signature: Vec::new(),
user_signature_part1: [0x0; 32],
user_signature_part2: [0x0; 32],
});
let commitment = contract
.captcha_solution_commitments
Expand Down Expand Up @@ -3002,7 +3008,8 @@ pub mod captcha {
completed_at: 0,
requested_at: 0,
id: solution_id,
user_signature: Vec::new(),
user_signature_part1: [0x0; 32],
user_signature_part2: [0x0; 32],
});
let commitment = contract
.captcha_solution_commitments
Expand Down Expand Up @@ -3185,7 +3192,8 @@ pub mod captcha {
completed_at: 0,
requested_at: 0,
id: user_root1,
user_signature: Vec::new(),
user_signature_part1: [0x0; 32],
user_signature_part2: [0x0; 32],
});

// Get the commitment and make sure it is approved
Expand All @@ -3206,7 +3214,8 @@ pub mod captcha {
completed_at: 0,
requested_at: 0,
id: user_root2,
user_signature: Vec::new(),
user_signature_part1: [0x0; 32],
user_signature_part2: [0x0; 32],
});

// Get the commitment and make sure it is disapproved
Expand Down
6 changes: 3 additions & 3 deletions dev/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { readdirSync } from 'fs'
import { spawn } from 'child_process'
import { stdout, stderr, stdin } from 'process';

const exec = (command: string, pipe?: boolean) => {
const exec = (command: string, pipe?: boolean, returnOutput?: boolean) => {

console.log(`> ${command}`)

Expand All @@ -32,11 +32,11 @@ const exec = (command: string, pipe?: boolean) => {
return new Promise((resolve, reject) => {
prc.on('close', function (code) {
console.log("")
const output = {
const output = returnOutput ? {
stdout: stdoutData.join(''),
stderr: stderrData.join(''),
code,
}
} : undefined;
if (code === 0) {
resolve(output);
} else {
Expand Down

0 comments on commit 628bde3

Please sign in to comment.