-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
object "EcAdd" { | ||
code { } | ||
object "EcAdd_deployed" { | ||
code { | ||
//////////////////////////////////////////////////////////////// | ||
// CONSTANTS | ||
//////////////////////////////////////////////////////////////// | ||
|
||
function ZERO() -> zero { | ||
zero := 0x0 | ||
} | ||
|
||
function ONE() -> one { | ||
one := 0x1 | ||
} | ||
|
||
// Retrieve the coordinates from the calldata | ||
let x1 := calldataload(0) | ||
let y1 := calldataload(32) | ||
let x2 := calldataload(64) | ||
let y2 := calldataload(96) | ||
|
||
// Retrieve the curve parameters from the calldata | ||
let a := calldataload(128) | ||
let b := calldataload(160) | ||
|
||
// Retrieve the field modulus from the calldata | ||
let p := calldataload(192) | ||
|
||
// Ensure p is valid | ||
|
||
// Ensure that the points are in the curve | ||
|
||
// Ensure that the point is in the right subgroup (if needed) | ||
|
||
// Add the points | ||
|
||
// Ensure that the resulting point is in the curve | ||
|
||
// Return the result | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
object "EcMul" { | ||
code { } | ||
object "EcMul_deployed" { | ||
code { | ||
//////////////////////////////////////////////////////////////// | ||
// CONSTANTS | ||
//////////////////////////////////////////////////////////////// | ||
|
||
function ZERO() -> zero { | ||
zero := 0x0 | ||
} | ||
|
||
function ONE() -> one { | ||
one := 0x1 | ||
} | ||
|
||
// Retrieve the coordinates from the calldata | ||
let x1 := calldataload(0) | ||
let y1 := calldataload(32) | ||
|
||
// Retrieve the scalar from the calldata | ||
let m := calldataload(64) | ||
|
||
// Retrieve the curve parameters from the calldata | ||
let a := calldataload(128) | ||
let b := calldataload(160) | ||
|
||
// Retrieve the field modulus from the calldata | ||
let p := calldataload(192) | ||
|
||
// Ensure p is valid | ||
|
||
// Ensure that the point is in the curve | ||
|
||
// Ensure that the point is in the right subgroup (if needed) | ||
|
||
// Multiply the point by the scalar | ||
|
||
// Check that the resulting point is in the curve | ||
|
||
// Return the result | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
object "EcPairing" { | ||
code { } | ||
object "EcPairing_deployed" { | ||
code { | ||
// Note: this check assumes that the curve is bn256, this is not final and could not be right in the future. | ||
if not(eq(mod(calldatasize(), 0xc0), 0)) { | ||
// Bad pairing input | ||
revert(0,0) | ||
} | ||
} | ||
} | ||
} |