Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix/rename-vm-namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
jbearer committed Mar 11, 2024
2 parents 09ffe79 + 160318a commit 9af0fed
Show file tree
Hide file tree
Showing 20 changed files with 282 additions and 111 deletions.
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ ESPRESSO_ORCHESTRATOR_PORT=40001
ESPRESSO_ORCHESTRATOR_NUM_NODES=5
ESPRESSO_ORCHESTRATOR_START_DELAY=5s
ESPRESSO_ORCHESTRATOR_NEXT_VIEW_TIMEOUT=30s
ESPRESSO_ORCHESTRATOR_MIN_TRANSACTIONS=1
ESPRESSO_ORCHESTRATOR_MIN_PROPOSE_TIME=0s
ESPRESSO_ORCHESTRATOR_MAX_PROPOSE_TIME=1s
ESPRESSO_ORCHESTRATOR_MIN_TRANSACTIONS=50
ESPRESSO_ORCHESTRATOR_MIN_PROPOSE_TIME=1s
ESPRESSO_ORCHESTRATOR_MAX_PROPOSE_TIME=2s
ESPRESSO_CONSENSUS_SERVER_PORT=40002
ESPRESSO_DA_SERVER_PORT=40003
ESPRESSO_SEQUENCER_DA_SERVER_URL=http://da-server:$ESPRESSO_WEB_SERVER_PORT
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ env:

jobs:
contracts:
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Install Nix
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/unused-deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on: [push]

name: udeps

env:
RUSTFLAGS: '--cfg async_executor_impl="async-std" --cfg async_channel_impl="async-std"'

jobs:
check:
name: Rust project
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true

- name: Run cargo-udeps
uses: aig787/cargo-udeps-action@v1
with:
version: 'latest'
args: '--all-targets'
44 changes: 20 additions & 24 deletions 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async-trait = "0.1.77"
clap = { version = "4.4", features = ["derive", "env"] }
cld = "0.5"
derive_more = "0.99.17"
ethers = { version = "2.0", features = ["ws"] }
ethers = { version = "2.0" }
futures = "0.3"
hotshot = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.20" }
hotshot-orchestrator = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.20" }
Expand Down
4 changes: 0 additions & 4 deletions contracts/rust/adapter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ ark-poly = { workspace = true }
ark-serialize = { workspace = true }
ark-std = { workspace = true }
contract-bindings = { path = "../../../contract-bindings" }
crs = { git = "https://github.com/alxiong/crs" }
diff-test-bn254 = { git = "https://github.com/EspressoSystems/solidity-bn254.git" }
ethers = { version = "2.0.4" }
hotshot-types = { workspace = true }
Expand All @@ -25,9 +24,6 @@ jf-utils = { workspace = true }
num-bigint = { version = "0.4", default-features = false }
num-traits = { version = "0.2", default-features = false }

[dev-dependencies]
hotshot-stake-table = { workspace = true }

[[bin]]
name = "eval-domain"
path = "src/bin/eval_domain.rs"
2 changes: 1 addition & 1 deletion contracts/rust/diff-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ ark-ec = { workspace = true }
ark-ed-on-bn254 = { workspace = true }
ark-ff = { workspace = true }
ark-poly = { workspace = true }
ark-srs = { git = "https://github.com/alxiong/ark-srs", tag = "v0.1.0" }
ark-std = { workspace = true }
clap = { version = "^4.4", features = ["derive"] }
crs = { git = "https://github.com/alxiong/crs" }
diff-test-bn254 = { git = "https://github.com/EspressoSystems/solidity-bn254.git" }
digest = { version = "0.10", default-features = false, features = ["alloc"] }
ethers = { version = "2.0.4" }
Expand Down
2 changes: 1 addition & 1 deletion contracts/rust/gen-vk-contract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = { workspace = true }
edition = { workspace = true }

[dependencies]
crs = { git = "https://github.com/alxiong/crs" }
ark-srs = { git = "https://github.com/alxiong/ark-srs", tag = "v0.1.0" }
hotshot-contract-adapter = { path = "../adapter" }
hotshot-stake-table = { workspace = true }
hotshot-state-prover = { path = "../../../hotshot-state-prover" }
Expand Down
4 changes: 2 additions & 2 deletions contracts/rust/gen-vk-contract/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use jf_primitives::pcs::prelude::UnivariateUniversalParams;
fn main() {
let srs = {
// load SRS from Aztec's ceremony
let srs =
crs::aztec20::kzg10_setup(2u64.pow(20) as usize + 2).expect("Aztec SRS fail to load");
let srs = ark_srs::aztec20::kzg10_setup(2u64.pow(20) as usize + 2)
.expect("Aztec SRS fail to load");
// convert to Jellyfish type
// TODO: (alex) use constructor instead https://github.com/EspressoSystems/jellyfish/issues/440
UnivariateUniversalParams {
Expand Down
2 changes: 1 addition & 1 deletion hotshot-state-prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ark-ec = { workspace = true }
ark-ed-on-bn254 = { workspace = true }
ark-ff = { workspace = true }
ark-serialize = { workspace = true }
ark-srs = { git = "https://github.com/alxiong/ark-srs", tag = "v0.1.0" }
ark-std = { workspace = true }
async-compatibility-layer = { workspace = true }
async-std = { workspace = true }
Expand All @@ -20,7 +21,6 @@ blake3 = "1.5"
clap = { workspace = true }
cld = { workspace = true }
contract-bindings = { path = "../contract-bindings" }
crs = { git = "https://github.com/alxiong/crs" }
derive_more = { workspace = true }
displaydoc = { version = "0.2.3", default-features = false }
ethers = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions hotshot-state-prover/src/mock_ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl MockLedger {

let srs = {
// load SRS from Aztec's ceremony
let srs = crs::aztec20::kzg10_setup(2u64.pow(16) as usize + 2)
let srs = ark_srs::aztec20::kzg10_setup(2u64.pow(16) as usize + 2)
.expect("Aztec SRS fail to load");
// convert to Jellyfish type
// TODO: (alex) use constructor instead https://github.com/EspressoSystems/jellyfish/issues/440
Expand Down Expand Up @@ -301,7 +301,7 @@ impl MockLedger {

let srs = {
// load SRS from Aztec's ceremony
let srs = crs::aztec20::kzg10_setup(2u64.pow(16) as usize + 2)
let srs = ark_srs::aztec20::kzg10_setup(2u64.pow(16) as usize + 2)
.expect("Aztec SRS fail to load");
// convert to Jellyfish type
// TODO: (alex) use constructor instead https://github.com/EspressoSystems/jellyfish/issues/440
Expand Down Expand Up @@ -430,7 +430,7 @@ pub fn gen_plonk_proof_for_test(
// 1. Simulate universal setup
let rng = &mut jf_utils::test_rng();
let srs = {
let aztec_srs = crs::aztec20::kzg10_setup(1024).expect("Aztec SRS fail to load");
let aztec_srs = ark_srs::aztec20::kzg10_setup(1024).expect("Aztec SRS fail to load");

UnivariateUniversalParams {
powers_of_g: aztec_srs.powers_of_g,
Expand Down
4 changes: 2 additions & 2 deletions hotshot-state-prover/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub fn load_proving_key() -> ProvingKey {

std::println!("Loading SRS from Aztec's ceremony...");
let srs_timer = Instant::now();
let srs = crs::aztec20::kzg10_setup(num_gates + 2).expect("Aztec SRS fail to load");
let srs = ark_srs::aztec20::kzg10_setup(num_gates + 2).expect("Aztec SRS fail to load");
let srs_elapsed = srs_timer.elapsed();
std::println!("Done in {srs_elapsed:.3}");

Expand Down Expand Up @@ -456,7 +456,7 @@ mod test {

let srs = {
// load SRS from Aztec's ceremony
let srs = crs::aztec20::kzg10_setup(2u64.pow(16) as usize + 2)
let srs = ark_srs::aztec20::kzg10_setup(2u64.pow(16) as usize + 2)
.expect("Aztec SRS fail to load");
// convert to Jellyfish type
// TODO: (alex) use constructor instead https://github.com/EspressoSystems/jellyfish/issues/440
Expand Down
2 changes: 0 additions & 2 deletions sequencer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ testing = ["hotshot-testing"]
[dev-dependencies]
espresso-macros = { git = "https://github.com/EspressoSystems/espresso-macros.git", tag = "0.1.0" }
hotshot-query-service = { workspace = true, features = ["testing"] }
hotshot-testing = { workspace = true }
portpicker = "0.1.1"
rand = "0.8.5"
tempfile = "3.9.0"
Expand Down Expand Up @@ -45,7 +44,6 @@ hotshot = { workspace = true }
hotshot-orchestrator = { workspace = true }
hotshot-query-service = { workspace = true }
hotshot-stake-table = { workspace = true }
hotshot-state-prover = { path = "../hotshot-state-prover" }
hotshot-task = { workspace = true }

# Dependencies for feature `testing`
Expand Down
47 changes: 19 additions & 28 deletions sequencer/src/block/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ mod test {
ns_proof_txs,
derived_ns
.tx_payloads
.clone()
.into_iter()
.map(|p| Transaction::new(ns_id, p))
.collect::<Vec<Transaction>>()
Expand Down Expand Up @@ -621,40 +622,30 @@ mod test {
);

// testing tx iterator
// TODO(746) incorporate this test into the following commented code when it's fixed
for tx_idx in 0..derived_ns.tx_table.len() {
let next_tx = block_iter.next().unwrap();
assert_eq!(ns_idx, next_tx.ns_idx);
assert_eq!(tx_idx, next_tx.tx_idx);

let idx = TxIndex { ns_idx, tx_idx };
let tx = block.transaction(&actual_ns_table, &idx).unwrap();
let tx_payload = derived_ns.tx_payloads[tx_idx].to_vec();
// test `transaction()`
assert_eq!(ns_id, tx.namespace());
assert_eq!(tx_payload, tx.payload());

// TODO(1010) transaction_with_proof for multiple namespaces
// test `transaction_with_proof()`
// let (tx, proof) = block
// .transaction_with_proof(&actual_ns_table, &idx)
// .unwrap();
// assert_eq!(tx_payload, tx.payload());
// proof
// .verify(&tx, idx, &vid, &disperse_data.commit, &disperse_data.common)
// .unwrap()
// .unwrap();
}

// tests for individual txs in this namespace
// TODO(746) rework this part
//
// let mut block_iter = block.iter(); // test iterator correctness
// for (tx_index, tx_payload) in ns.tx_payloads.iter().enumerate() {
// assert!(block_iter.next().is_some());
// let tx_index = TxIndex::try_from(tx_index + tx_index_offset).unwrap();
// tracing::info!("tx index {}", tx_index,);
//
// // test `transaction_with_proof()`
// let (tx, proof) = block.transaction_with_proof(&tx_index).unwrap();
// assert_eq!(tx_payload, tx.payload());
// proof
// .verify(
// &tx,
// tx_index,
// &vid,
// &disperse_data.commit,
// &disperse_data.common,
// )
// .unwrap()
// .unwrap();
// }
// assert!(block_iter.next().is_none());

// prepare for the next loop iteration
// tx_index_offset += actual_tx_table.len();
prev_entry = entry;
derived_block_payload.extend(derived_ns.payload_flat.clone());
}
Expand Down
Loading

0 comments on commit 9af0fed

Please sign in to comment.