Skip to content

Commit b0121f5

Browse files
authored
fix: feature fixes (#409)
## What ❔ - Make basic bootloader compilable with no_std not only on risc_v - Remove testing feature on basic_bootloader when using api crate ## Why ❔ To have correct feature set and make it compilable in the sequencer ## Is this a breaking change? - [ ] Yes - [ ] No ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted.
1 parent 8251f4c commit b0121f5

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

api/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ categories.workspace = true
1111

1212
[dependencies]
1313

14-
forward_system = { path = "../forward_system"}
14+
forward_system = { path = "../forward_system", default-features = false}
1515
oracle_provider = { path = "../oracle_provider" }
1616
callable_oracles = { path = "../callable_oracles/" }
1717
zksync_os_runner = { path = "../zksync_os_runner"}
1818
risc_v_simulator = { workspace = true }
19-
zk_ee = { path = "../zk_ee" }
20-
crypto = { path = "../crypto" }
21-
basic_system = { path = "../basic_system" }
22-
evm_interpreter = { path = "../evm_interpreter" }
19+
zk_ee = { path = "../zk_ee", default-features = false }
20+
crypto = { path = "../crypto", default-features = false }
21+
basic_system = { path = "../basic_system", default-features = false }
22+
evm_interpreter = { path = "../evm_interpreter", default-features = false }
2323
ruint = { version = "1.12.3", default-features = false, features = ["alloc"] }
2424
alloy = { version = "=1", default-features = false, features = ["eip712", "consensus", "rpc-types", "signer-local", "dyn-abi", "network"] }
2525
zksync_os_interface = { workspace = true }

basic_bootloader/src/bootloader/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,10 @@ where
332332

333333
let l1_to_l2_tx_hash = Bytes32::from(l1_to_l2_txs_hasher.finalize());
334334

335+
// uses global alloc
335336
#[cfg(not(target_arch = "riscv32"))]
336337
cycle_marker::log_marker(
337-
format!(
338+
alloc::format!(
338339
"Spent ergs for [run_prepared]: {}",
339340
result_keeper.get_gas_used() * evm_interpreter::ERGS_PER_GAS
340341
)

basic_bootloader/src/bootloader/process_transaction.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,17 +754,20 @@ where
754754
+ intrinsic_computational_native_charged
755755
- main_native_used_for_pubdata;
756756

757+
// uses global alloc
757758
#[cfg(not(target_arch = "riscv32"))]
758759
cycle_marker::log_marker(
759-
format!(
760+
alloc::format!(
760761
"Spent ergs for [process_transaction]: {}",
761762
gas_used * ERGS_PER_GAS
762763
)
763764
.as_str(),
764765
);
766+
// uses global alloc
765767
#[cfg(not(target_arch = "riscv32"))]
766768
cycle_marker::log_marker(
767-
format!("Spent native for [process_transaction]: {computational_native_used}").as_str(),
769+
alloc::format!("Spent native for [process_transaction]: {computational_native_used}")
770+
.as_str(),
768771
);
769772

770773
Ok(TxProcessingResult {

zk_ee/src/system/errors/context/nonempty.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,33 @@ use super::{
99

1010
#[derive(Debug, Default, Clone, PartialEq, Eq)]
1111
pub struct ErrorContext {
12-
values: Vec<NamedContextElement>,
12+
values: alloc::vec::Vec<NamedContextElement>,
1313
}
1414

1515
impl IErrorContext for ErrorContext {
1616
#[inline(always)]
17-
fn get(&self, name: &str) -> Option<&String> {
17+
fn get(&self, name: &str) -> Option<&alloc::string::String> {
1818
self.values
1919
.iter()
2020
.find(|e| (e.name == name))
2121
.map(|e| &e.value)
2222
}
2323

2424
#[inline(always)]
25-
fn to_vec(&self) -> Option<Vec<NamedContextElement>> {
25+
fn to_vec(&self) -> Option<alloc::vec::Vec<NamedContextElement>> {
2626
Some(self.values.clone())
2727
}
2828

2929
#[inline(always)]
30-
fn into_vec(self) -> Option<Vec<NamedContextElement>> {
30+
fn into_vec(self) -> Option<alloc::vec::Vec<NamedContextElement>> {
3131
Some(self.values)
3232
}
3333

3434
#[inline(always)]
3535
fn push(
3636
mut self,
3737
name: &'static str,
38-
value: impl ToString,
38+
value: impl alloc::string::ToString,
3939
visibility: ValueVisibility,
4040
) -> Self {
4141
let mut perform_push_value = || {
@@ -57,7 +57,7 @@ impl IErrorContext for ErrorContext {
5757
#[inline(always)]
5858
fn push_lazy<F>(mut self, name: &'static str, f: F, visibility: ValueVisibility) -> Self
5959
where
60-
F: FnOnce() -> String,
60+
F: FnOnce() -> alloc::string::String,
6161
{
6262
let should_include = match visibility {
6363
ValueVisibility::AnyForwardRun => true,

0 commit comments

Comments
 (0)