Skip to content

Commit

Permalink
Merge pull request #25 from qd-qd/fix/ci
Browse files Browse the repository at this point in the history
👷 fix forge commands
  • Loading branch information
rdubois-crypto authored Oct 18, 2023
2 parents e83c75d + 38eeece commit a8c9c8f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/webauthn-forge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- master
# This action will only run on pull requests that include changes to the following files
paths:
- "tests/WebAuthn_forge/**/*"
- "solidity/**/*"
- "sage/FCL_ecdsa_precompute/FCL_ecdsa_precompute.sage"

env:
Expand Down Expand Up @@ -64,16 +64,14 @@ jobs:
version: nightly

- name: Run Forge build
working-directory: tests/WebAuthn_forge
run: |
forge --version
forge build --sizes
forge build --root solidity/tests/WebAuthn_forge --sizes
id: build

- name: Run Forge tests
working-directory: tests/WebAuthn_forge
run: |
forge test -vvvv --ffi
forge test --root solidity/tests/WebAuthn_forge -vvvv --ffi
id: test

lint:
Expand All @@ -93,14 +91,12 @@ jobs:
version: nightly

- name: Run Forge build
working-directory: tests/WebAuthn_forge
run: |
forge --version
forge build --sizes
forge build --root solidity/tests/WebAuthn_forge --sizes
id: build

- name: Run Forge fmt
working-directory: tests/WebAuthn_forge
run: |
forge fmt --check
forge fmt --check --root solidity/tests/WebAuthn_forge
id: lint
3 changes: 0 additions & 3 deletions solidity/tests/WebAuthn_forge/test/FCL_ecdsa.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ import "@external/ECops.sol";
//echo "itsakindofmagic" | sha256sum, used as a label to find precomputations inside bytecode
uint256 constant _MAGIC_ENCODING = 0x9a8295d6f225e4f07313e2e1440ab76e26d4c6ed2d1eb4cbaa84827c8b7caa8d;




// library elliptic solidity from orbs network
contract wrap_ecdsa_orbs {
uint256 constant gx = 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;
Expand Down
16 changes: 7 additions & 9 deletions solidity/tests/WebAuthn_forge/test/FCL_elliptic.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -168,28 +168,26 @@ contract ArithmeticTest is Test {
assertEq(radd, raddN);
}

function test_Fuzz_SigVerif(uint256 k, uint256 kpriv, uint256 message) public
{
function test_Fuzz_SigVerif(uint256 k, uint256 kpriv, uint256 message) public {
vm.assume(k < FCL_Elliptic_ZZ.n);
vm.assume(k > 1);
vm.assume(kpriv < FCL_Elliptic_ZZ.n);
vm.assume(kpriv > 1);

vm.assume(message < FCL_Elliptic_ZZ.n);
vm.assume(message > 1);

uint256 xpub=FCL_Elliptic_ZZ.ecZZ_mulmuladd_S_asm(0,0, kpriv, 0); //deriv public key
uint256 xpub = FCL_Elliptic_ZZ.ecZZ_mulmuladd_S_asm(0, 0, kpriv, 0); //deriv public key
uint256 ypub = FCL_Elliptic_ZZ.ec_Decompress(xpub, 0);
uint256 r;
uint256 s;
assertEq(FCL_Elliptic_ZZ.ecAff_isOnCurve(xpub, ypub), true);

(r,s)= FCL_Elliptic_ZZ.ecdsa_sign(bytes32(message), k, kpriv);

(r, s) = FCL_Elliptic_ZZ.ecdsa_sign(bytes32(message), k, kpriv);

bool res1=FCL_Elliptic_ZZ.ecdsa_verify(bytes32(message), r,s, xpub, ypub);
bool res2=FCL_Elliptic_ZZ.ecdsa_verify(bytes32(message), r,s, xpub, p-ypub);
bool res=res1||res2;
bool res1 = FCL_Elliptic_ZZ.ecdsa_verify(bytes32(message), r, s, xpub, ypub);
bool res2 = FCL_Elliptic_ZZ.ecdsa_verify(bytes32(message), r, s, xpub, p - ypub);
bool res = res1 || res2;

assertEq(res, true);
}
Expand Down

0 comments on commit a8c9c8f

Please sign in to comment.