-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Embedded elf guests for forks (#1495)
Co-authored-by: eyusufatik <[email protected]> Co-authored-by: jfldde <[email protected]>
- Loading branch information
1 parent
4ac3098
commit e645f33
Showing
39 changed files
with
545 additions
and
236 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 |
---|---|---|
|
@@ -132,6 +132,8 @@ jobs: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Check TOML | ||
uses: dprint/[email protected] | ||
- name: Build guests | ||
run: make build-risc0 | ||
- name: Run lint | ||
run: | | ||
if ! make lint ; then | ||
|
@@ -163,6 +165,8 @@ jobs: | |
uses: ./.github/actions/install-risc0 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build guests | ||
run: make build-risc0 | ||
- name: Run cargo-udeps | ||
env: | ||
RUSTFLAGS: -A warnings | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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,69 @@ | ||
use std::collections::HashMap; | ||
|
||
use citrea_risc0_adapter::Digest; | ||
use lazy_static::lazy_static; | ||
use risc0_binfmt::compute_image_id; | ||
use sov_rollup_interface::spec::SpecId; | ||
|
||
macro_rules! guest { | ||
($a:expr) => {{ | ||
let code = include_bytes!($a).to_vec(); | ||
let id = compute_image_id(&code).unwrap(); | ||
|
||
(id, code) | ||
}}; | ||
} | ||
|
||
lazy_static! { | ||
/// The following 2 are used as latest guest builds for tests that use mock DA. | ||
pub(crate) static ref BATCH_PROOF_LATEST_MOCK_GUESTS: HashMap<SpecId, (Digest, Vec<u8>)> = { | ||
let mut m = HashMap::new(); | ||
|
||
m.insert(SpecId::Genesis, (Digest::new(citrea_risc0::BATCH_PROOF_MOCK_ID), citrea_risc0::BATCH_PROOF_MOCK_ELF.to_vec())); | ||
m | ||
}; | ||
pub(crate) static ref LIGHT_CLIENT_LATEST_MOCK_GUESTS: HashMap<SpecId, (Digest, Vec<u8>)> = { | ||
let mut m = HashMap::new(); | ||
|
||
m.insert(SpecId::Genesis, (Digest::new(citrea_risc0::LIGHT_CLIENT_PROOF_MOCK_ID), citrea_risc0::LIGHT_CLIENT_PROOF_MOCK_ELF.to_vec())); | ||
m | ||
}; | ||
/// The following 2 are used as latest guest builds for tests that use Bitcoin DA. | ||
pub(crate) static ref BATCH_PROOF_LATEST_BITCOIN_GUESTS: HashMap<SpecId, (Digest, Vec<u8>)> = { | ||
let mut m = HashMap::new(); | ||
|
||
m.insert(SpecId::Genesis, (Digest::new(citrea_risc0::BATCH_PROOF_BITCOIN_ID), citrea_risc0::BATCH_PROOF_BITCOIN_ELF.to_vec())); | ||
m | ||
}; | ||
pub(crate) static ref LIGHT_CLIENT_LATEST_BITCOIN_GUESTS: HashMap<SpecId, (Digest, Vec<u8>)> = { | ||
let mut m = HashMap::new(); | ||
|
||
m.insert(SpecId::Genesis, (Digest::new(citrea_risc0::LIGHT_CLIENT_PROOF_BITCOIN_ID), citrea_risc0::LIGHT_CLIENT_PROOF_BITCOIN_ELF.to_vec())); | ||
m | ||
}; | ||
/// Production guests | ||
pub(crate) static ref BATCH_PROOF_MAINNET_GUESTS: HashMap<SpecId, (Digest, Vec<u8>)> = { | ||
let mut m = HashMap::new(); | ||
|
||
m.insert(SpecId::Genesis, guest!("../../../resources/guests/risc0/mainnet/batch-0.elf")); | ||
m | ||
}; | ||
pub(crate) static ref BATCH_PROOF_TESTNET_GUESTS: HashMap<SpecId, (Digest, Vec<u8>)> = { | ||
let mut m = HashMap::new(); | ||
|
||
m.insert(SpecId::Genesis, guest!("../../../resources/guests/risc0/testnet/batch-0.elf")); | ||
m | ||
}; | ||
pub(crate) static ref LIGHT_CLIENT_MAINNET_GUESTS: HashMap<SpecId, (Digest, Vec<u8>)> = { | ||
let mut m = HashMap::new(); | ||
|
||
m.insert(SpecId::Genesis, guest!("../../../resources/guests/risc0/mainnet/light-0.elf")); | ||
m | ||
}; | ||
pub(crate) static ref LIGHT_CLIENT_TESTNET_GUESTS: HashMap<SpecId, (Digest, Vec<u8>)> = { | ||
let mut m = HashMap::new(); | ||
|
||
m.insert(SpecId::Genesis, guest!("../../../resources/guests/risc0/testnet/light-0.elf")); | ||
m | ||
}; | ||
} |
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
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
Oops, something went wrong.