Skip to content

Commit dccbdfd

Browse files
authored
Merge pull request #54 from base/rayyanalam/adapt-b20-install-api
Adapt --base precompile install to observer/upgrade API
2 parents f4370bc + 6a06cb0 commit dccbdfd

4 files changed

Lines changed: 33 additions & 28 deletions

File tree

Cargo.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/common/fmt/src/dynamic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ fn _serialize_value_as_json(value: DynSolValue, defs: &StructDefinitions) -> Res
224224
DynSolValue::Tuple(values) => Ok(Value::Array(
225225
values.into_iter().map(|v| _serialize_value_as_json(v, defs)).collect::<Result<_>>()?,
226226
)),
227-
DynSolValue::Function(_) => eyre::bail!("cannot serialize function pointer"),
227+
DynSolValue::Function(_) => Err(eyre::eyre!("cannot serialize function pointer")),
228228
}
229229
}
230230

@@ -275,9 +275,9 @@ impl StructDefinitions {
275275
match matches.len() {
276276
0 => Ok(None),
277277
1 => Ok(Some(matches[0])),
278-
_ => eyre::bail!(
278+
_ => Err(eyre::eyre!(
279279
"there are several structs with the same name. Use `<contract_name>.{key}` instead."
280-
),
280+
)),
281281
}
282282
}
283283
}

crates/evm/networks/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ alloy-primitives = { workspace = true, features = [
2929
# github.com/base/base; bump via ./script/bump-base.sh. To iterate against a
3030
# local base/base checkout instead, uncomment the [patch] block at the bottom
3131
# of the workspace root Cargo.toml.
32-
base-common-precompiles = { git = "https://github.com/base/base.git", rev = "401ffe4d60f3d0e9c34168c865521a3b186339df" }
33-
base-common-chains = { git = "https://github.com/base/base.git", rev = "401ffe4d60f3d0e9c34168c865521a3b186339df" }
32+
base-common-precompiles = { git = "https://github.com/base/base.git", rev = "3ce1275095c21506d9e1173b7bd08425357112b7" }
33+
base-common-chains = { git = "https://github.com/base/base.git", rev = "3ce1275095c21506d9e1173b7bd08425357112b7" }
3434

3535
revm = { workspace = true, features = [
3636
"std",

crates/evm/networks/src/lib.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ use alloy_primitives::{Address, U256, address, keccak256, map::AddressHashMap};
1616
use base_common_chains::BaseUpgrade;
1717
use base_common_precompiles::{
1818
ActivationFeature, ActivationRegistry, ActivationRegistryStorage, B20Factory,
19-
B20FactoryStorage, BerylLookup, PolicyRegistryPrecompile, PolicyRegistryStorage,
19+
B20FactoryStorage, BerylLookup, NoopPrecompileCallObserver, PolicyRegistryPrecompile,
20+
PolicyRegistryStorage,
2021
};
2122
use clap::Parser;
2223
use serde::{Deserialize, Serialize};
@@ -158,17 +159,21 @@ impl NetworkConfigs {
158159
});
159160
}
160161
if self.base {
161-
// Mirrors `BasePrecompiles::install` for the Beryl upgrade in
162-
// base/base/crates/common/precompiles/src/provider.rs. Three
163-
// singleton precompiles plus the versioned B-20 prefix dispatcher.
164-
// `BerylLookup::install` owns the dispatcher and threads the Base
165-
// upgrade so each B-20 token resolves its logic version per-call
166-
// (e.g. Stablecoin V1 at Beryl). Pinned to Beryl until `--base-fork`
167-
// (BOP-428) makes the fork selectable at runtime.
162+
// Mirrors `BasePrecompiles::install_with_observer` for the Beryl
163+
// upgrade in base/base/crates/common/precompiles/src/provider.rs.
164+
// Three singleton precompiles plus the versioned B-20 prefix
165+
// dispatcher. `BerylLookup::install` owns the dispatcher and
166+
// threads the Base upgrade so each B-20 token resolves its logic
167+
// version per-call (e.g. Stablecoin V1 at Beryl). Pinned to Beryl
168+
// until `--base-fork` (BOP-428) makes the fork selectable at runtime.
169+
//
170+
// Factory/policy take a no-op observer: metrics observation is
171+
// scoped to the B-20 token call path, which anvil does not wire up.
168172
let admin = Some(self.base_activation_admin());
169-
B20Factory::install(precompiles);
170-
BerylLookup::install(precompiles, BaseUpgrade::Beryl);
171-
PolicyRegistryPrecompile::install(precompiles);
173+
let upgrade = BaseUpgrade::Beryl;
174+
B20Factory::install_with_observer(precompiles, upgrade, NoopPrecompileCallObserver);
175+
BerylLookup::install(precompiles, upgrade);
176+
PolicyRegistryPrecompile::install(precompiles, upgrade);
172177
ActivationRegistry::install(precompiles, admin);
173178
}
174179
}

0 commit comments

Comments
 (0)