Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version to 0.10 #83

Merged
merged 2 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ resolver = "2"
members = ["build", "contracts", "ffi", "relay", "relay/tests/methods", "steel"]

[workspace.package]
version = "0.9.0-alpha.1"
version = "0.10.0"
edition = "2021"
license = "Apache-2.0"
homepage = "https://risczero.com/"
repository = "https://github.com/risc0/risc0-ethereum/"

[workspace.dependencies]
# Intra-workspace dependencies
risc0-build-ethereum = { version = "0.9.0-alpha.1", default-features = false, path = "build" }
risc0-ethereum-contracts = { version = "0.9.0-alpha.1", default-features = false, path = "contracts" }
risc0-ethereum-relay = { version = "0.9.0-alpha.1", default-features = false, path = "relay" }
risc0-steel = { version = "0.9.0-alpha.1", default-features = false, path = "steel" }
risc0-forge-ffi = { version = "0.9.0-alpha.1", default-features = false, path = "ffi" }
risc0-build-ethereum = { version = "0.10.0", default-features = false, path = "build" }
risc0-ethereum-contracts = { version = "0.10.0", default-features = false, path = "contracts" }
risc0-ethereum-relay = { version = "0.10.0", default-features = false, path = "relay" }
risc0-steel = { version = "0.10.0", default-features = false, path = "steel" }
risc0-forge-ffi = { version = "0.10.0", default-features = false, path = "ffi" }

alloy-primitives = { version = "0.6.4", features = ["serde", "rlp", "std"] }
alloy-rlp = { version = "0.3.4", default-features = false }
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
> [!IMPORTANT]
> `main` is the development branch for this repository.
> Application developers should use the [latest release](https://github.com/risc0/risc0-ethereum/releases) instead.

# RISC Zero Ethereum

[RISC Zero] is a zero-knowledge verifiable general computing platform, with [Ethereum] integration.
Expand Down
6 changes: 1 addition & 5 deletions contracts/src/RiscZeroCheats.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ abstract contract RiscZeroCheats is CommonBase {
console2.log("Deployed RiscZeroGroth16VerifierTest to", address(verifier));
return verifier;
} else {
IRiscZeroVerifier verifier = new RiscZeroGroth16Verifier(
ControlID.CONTROL_ID_0,
ControlID.CONTROL_ID_1,
ControlID.BN254_CONTROL_ID
);
IRiscZeroVerifier verifier = new RiscZeroGroth16Verifier(ControlID.CONTROL_ID_0, ControlID.CONTROL_ID_1);
console2.log("Deployed RiscZeroGroth16Verifier to", address(verifier));
return verifier;
}
Expand Down
5 changes: 2 additions & 3 deletions contracts/src/groth16/ControlID.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
pragma solidity ^0.8.9;

library ControlID {
uint256 public constant CONTROL_ID_0 = 0x51a3d73938c3681118ba0a2549f7c188;
uint256 public constant CONTROL_ID_1 = 0x44f39e6e6cef91de6d743e7f5b7a1e67;
uint256 public constant BN254_CONTROL_ID = 0x10ff834dbef62ccbba201ecd26a772e3036a075aacbaf47200679a11dcdcf10d;
uint256 public constant CONTROL_ID_0 = 0x39ff805954f4eb2868d338764408f76d;
uint256 public constant CONTROL_ID_1 = 0x15cf3a5f4097269e3a6d921c18625531;
}
37 changes: 15 additions & 22 deletions contracts/src/groth16/Groth16Verifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,25 @@ contract Groth16Verifier {
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
uint256 constant deltax1 = 17459137677540232029121579111806194201335604911445641118023073971023969565095;
uint256 constant deltax2 = 16850927772192893321067430466725055468022063819919435552018169508037555801891;
uint256 constant deltay1 = 16440269342816906375775882524040730637133399248560416660251195197654028701204;
uint256 constant deltay2 = 20318668496029522144912607185068507665315850570859328375503723843595483973858;
uint256 constant deltax1 = 20637939757332191985219466750514112514830176492003070298908178796582256423445;
uint256 constant deltax2 = 21015870987554935578856562994563796394452175083269944606559673949460277152483;
uint256 constant deltay1 = 7308971620370004609743038871778988943972318366181842608509263947408591078846;
uint256 constant deltay2 = 19578762133483017273429849028797807252406479590275449312036317638112265649126;

uint256 constant IC0x = 8446592859352799428420270221449902464741693648963397251242447530457567083492;
uint256 constant IC0y = 1064796367193003797175961162477173481551615790032213185848276823815288302804;
uint256 constant IC0x = 4595639739788529313135927846153489513260052783364743523344328896305419933627;
uint256 constant IC0y = 13577843718844184042346095806470311065274840502864234728407198439361979518223;

uint256 constant IC1x = 3179835575189816632597428042194253779818690147323192973511715175294048485951;
uint256 constant IC1y = 20895841676865356752879376687052266198216014795822152491318012491767775979074;
uint256 constant IC1x = 19125733112813331880180112762042920784001527126678496097978721184513458499861;
uint256 constant IC1y = 470495054354753477176064253439657941845200056447070007550476843795069859530;

uint256 constant IC2x = 5332723250224941161709478398807683311971555792614491788690328996478511465287;
uint256 constant IC2y = 21199491073419440416471372042641226693637837098357067793586556692319371762571;
uint256 constant IC2x = 9798632009143333403145042225641105799474060066926099950339875153142594918323;
uint256 constant IC2y = 15467851970301286525906423722646678659414362276892586739627188622113917076355;

uint256 constant IC3x = 12457994489566736295787256452575216703923664299075106359829199968023158780583;
uint256 constant IC3y = 19706766271952591897761291684837117091856807401404423804318744964752784280790;
uint256 constant IC3x = 4677856832410602822119633312864839150180396112709578634305606190993420950086;
uint256 constant IC3y = 21413789555508871663216491538642005537595601774930793267108872091881334409985;

uint256 constant IC4x = 19617808913178163826953378459323299110911217259216006187355745713323154132237;
uint256 constant IC4y = 21663537384585072695701846972542344484111393047775983928357046779215877070466;

uint256 constant IC5x = 6834578911681792552110317589222010969491336870276623105249474534788043166867;
uint256 constant IC5y = 15060583660288623605191393599883223885678013570733629274538391874953353488393;
uint256 constant IC4x = 17622463197037705164686879153818888337611670039316323149958751021262085916949;
uint256 constant IC4y = 10546326028888365743245970980969672597991412490319907398941581639510925080455;

// Memory data
uint16 constant pVk = 0;
Expand All @@ -70,7 +67,7 @@ contract Groth16Verifier {
uint256[2] calldata _pA,
uint256[2][2] calldata _pB,
uint256[2] calldata _pC,
uint256[5] calldata _pubSignals
uint256[4] calldata _pubSignals
) public view returns (bool) {
assembly {
function checkField(v) {
Expand Down Expand Up @@ -123,8 +120,6 @@ contract Groth16Verifier {

g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))

g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))

// -A
mstore(_pPairing, calldataload(pA))
mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))
Expand Down Expand Up @@ -185,8 +180,6 @@ contract Groth16Verifier {

checkField(calldataload(add(_pubSignals, 128)))

checkField(calldataload(add(_pubSignals, 160)))

// Validate all evaluations
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)

Expand Down
6 changes: 2 additions & 4 deletions contracts/src/groth16/RiscZeroGroth16Verifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,10 @@ contract RiscZeroGroth16Verifier is IRiscZeroVerifier, Groth16Verifier {
/// obtained by running `cargo run --bin bonsai-ethereum-contracts -F control-id`
uint256 public immutable CONTROL_ID_0;
uint256 public immutable CONTROL_ID_1;
uint256 public immutable BN254_CONTROL_ID;

constructor(uint256 control_id_0, uint256 control_id_1, uint256 bn254_control_id) {
constructor(uint256 control_id_0, uint256 control_id_1) {
CONTROL_ID_0 = control_id_0;
CONTROL_ID_1 = control_id_1;
BN254_CONTROL_ID = bn254_control_id;
}

/// @notice splits a digest into two 128-bit words to use as public signal inputs.
Expand Down Expand Up @@ -135,6 +133,6 @@ contract RiscZeroGroth16Verifier is IRiscZeroVerifier, Groth16Verifier {
function verify_integrity(Receipt memory receipt) public view returns (bool) {
(uint256 claim0, uint256 claim1) = splitDigest(receipt.claim.digest());
Seal memory seal = abi.decode(receipt.seal, (Seal));
return this.verifyProof(seal.a, seal.b, seal.c, [CONTROL_ID_0, CONTROL_ID_1, claim0, claim1, BN254_CONTROL_ID]);
return this.verifyProof(seal.a, seal.b, seal.c, [CONTROL_ID_0, CONTROL_ID_1, claim0, claim1]);
}
}
10 changes: 2 additions & 8 deletions contracts/src/relay/BonsaiRelayTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,10 @@ abstract contract BonsaiRelayTest is Test, BonsaiRelayCheats {
// Use a long and unweildy environment variable name for overriding
// the expected chain ID for the test relay so that it is hard to
// trigger without thinking about it.
bonsaiTestRelay = new BonsaiTestRelay(
vm.envOr("BONSAI_TEST_RELAY_EXPECTED_CHAIN_ID", uint256(31337))
);
bonsaiTestRelay = new BonsaiTestRelay(vm.envOr("BONSAI_TEST_RELAY_EXPECTED_CHAIN_ID", uint256(31337)));
bonsaiRelay = new BonsaiRelayQueueWrapper(bonsaiTestRelay);
} else {
IRiscZeroVerifier verifier = new RiscZeroGroth16Verifier(
ControlID.CONTROL_ID_0,
ControlID.CONTROL_ID_1,
ControlID.BN254_CONTROL_ID
);
IRiscZeroVerifier verifier = new RiscZeroGroth16Verifier(ControlID.CONTROL_ID_0, ControlID.CONTROL_ID_1);
bonsaiVerifyingRelay = new BonsaiRelay(verifier);
bonsaiRelay = new BonsaiRelayQueueWrapper(bonsaiVerifyingRelay);
}
Expand Down
6 changes: 1 addition & 5 deletions contracts/test/RiscZeroGroth16Verifier.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ contract RiscZeroGroth16VerifierTest is Test {
IRiscZeroVerifier internal verifier;

function setUp() external {
verifier = new RiscZeroGroth16Verifier(
ControlID.CONTROL_ID_0,
ControlID.CONTROL_ID_1,
ControlID.BN254_CONTROL_ID
);
verifier = new RiscZeroGroth16Verifier(ControlID.CONTROL_ID_0, ControlID.CONTROL_ID_1);
}

function testVerifyKnownGoodReceipt() external view {
Expand Down
6 changes: 3 additions & 3 deletions contracts/test/TestReceipt.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ pragma solidity ^0.8.13;

library TestReceipt {
bytes public constant SEAL =
hex"16542a20d91154d977fb6215f8366e48f9034afb2c71c20b6b3080dc30e981252e9fa9660f4a378686b14afb1e0092180bef679a07752939f832283929011eb006796cca253ca629c6d5b2852b30370427d19c32f5a0fa7b791f68db789b775b20308dc1c19af9f2198e1d99c85be7771d63779bea244c7cf097bb90902601a601dc9c4464c797022372c3c3e9be96ff4cfec8a2a33161eae9e62c9d9175bbdc27839ff9bfbd03554980bec8affc43b4dba3e06e9ce201d0269fa3fd82157d5b091f9f0971190b276a4038f182855fc5f67ba806cdd2760d90d3eb4ef57e090f02ca9ee4e7120f6ca7ce7f5b901dfc2aa1df72aaeb78c44353d449134c363efa";
bytes32 public constant POST_DIGEST = bytes32(0x41b150d6ac003f55763d57ee5512652b0446d6c7bd2789e8c0c1f4a5bb3e87d8);
hex"24900daf58fe808c62915fd7bdb6824905e3fe1803ce5403f9f8d9dc7093a82427b1eebb7e758e809071b9c7b552453ab7c7350934fc692ac3378b9aabf615fa0570e34568aa3a1eb73e68ff2390ddb4fb93b7b2d970411fe80ba0e81fec787a2c970d93996fb4c77f1bd50857c76c855cfeb75146121e30d72aceda613968122b934d84e93bc51aae5a41587f0e33918db801631f03eeae6b31e534554b0f180f1f4cb9da9d57a75f6c5cfbe465cb147da61fc5ae7b2e30129fe162ec8ba86018a03bcbd34f8357022d2b1438936d10ffad01a225dbbead509a46d3f62ea43328a2112dc0a104e629366ad95e1eec3152df91865ed10fe0014c69f498906da1";
bytes32 public constant POST_DIGEST = bytes32(0x9a1a653b6ac4ab399d7ca5939ffc3ff35d6c8f225af26c80d9d7846e26ab77a8);
bytes public constant JOURNAL = hex"";
bytes32 public constant IMAGE_ID = bytes32(0x790b91e4c2efa939aea3ee4989c82564d82047977970d014e53d95e44c3230db);
bytes32 public constant IMAGE_ID = bytes32(0xb1b5572254d75b231b1cdcc07cfa7bdb61a0ef2701965a0483d207c25cd9a77f);
}
6 changes: 3 additions & 3 deletions examples/erc20-counter/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/erc20-counter/methods/guest/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions examples/erc20-counter/script/DeployCounter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ contract CounterrDeploy is Script {

vm.startBroadcast(deployerKey);

IRiscZeroVerifier verifier = new RiscZeroGroth16Verifier(
ControlID.CONTROL_ID_0,
ControlID.CONTROL_ID_1,
ControlID.BN254_CONTROL_ID
);
IRiscZeroVerifier verifier = new RiscZeroGroth16Verifier(ControlID.CONTROL_ID_0, ControlID.CONTROL_ID_1);
console2.log("Deployed RiscZeroGroth16Verifier to", address(verifier));

Counter counter = new Counter(verifier);
Expand Down
2 changes: 1 addition & 1 deletion examples/erc20/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/erc20/methods/guest/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading