Skip to content

Commit

Permalink
Merge branch 'main' into fix-typos
Browse files Browse the repository at this point in the history
  • Loading branch information
pls148 authored Jan 10, 2025
2 parents ed58390 + fa44122 commit b37c10d
Show file tree
Hide file tree
Showing 30 changed files with 796 additions and 473 deletions.
1 change: 0 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ ESPRESSO_SEQUENCER_L1_PORT=8545
ESPRESSO_SEQUENCER_L1_POLLING_INTERVAL=100ms
ESPRESSO_SEQUENCER_L1_WS_PORT=8546
ESPRESSO_SEQUENCER_L1_PROVIDER=http://demo-l1-network:${ESPRESSO_SEQUENCER_L1_PORT}
ESPRESSO_SEQUENCER_L1_WS_PROVIDER=ws://demo-l1-network:${ESPRESSO_SEQUENCER_L1_WS_PORT}
ESPRESSO_NODE_VALIDATOR_PORT=9000

# Only allow 1 block to be processed for events at a time, simulating a very bad L1 provider.
Expand Down
41 changes: 24 additions & 17 deletions Cargo.lock

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

15 changes: 9 additions & 6 deletions builder/src/bin/permissionless-builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ struct NonPermissionedBuilderOptions {
eth_account_index: u32,

/// Url we will use for RPC communication with L1.
#[clap(long, env = "ESPRESSO_BUILDER_L1_PROVIDER")]
l1_provider_url: Url,
#[clap(
long,
env = "ESPRESSO_BUILDER_L1_PROVIDER",
value_delimiter = ',',
num_args = 1..,
)]
l1_provider_url: Vec<Url>,

/// Peer nodes use to fetch missing state
#[clap(long, env = "ESPRESSO_SEQUENCER_STATE_PEERS", value_delimiter = ',')]
Expand Down Expand Up @@ -133,7 +138,7 @@ async fn run<V: Versions>(
opt: NonPermissionedBuilderOptions,
) -> anyhow::Result<()> {
let l1_params = L1Params {
url: opt.l1_provider_url,
urls: opt.l1_provider_url,
options: Default::default(),
};

Expand All @@ -143,9 +148,7 @@ async fn run<V: Versions>(
let builder_server_url: Url = format!("http://0.0.0.0:{}", opt.port).parse().unwrap();

let instance_state =
build_instance_state::<V>(genesis.chain_config, l1_params, opt.state_peers)
.await
.unwrap();
build_instance_state::<V>(genesis.chain_config, l1_params, opt.state_peers);

let base_fee = genesis.max_base_fee();
tracing::info!(?base_fee, "base_fee");
Expand Down
11 changes: 5 additions & 6 deletions builder/src/non_permissioned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ pub struct BuilderConfig {
pub hotshot_builder_apis_url: Url,
}

pub async fn build_instance_state<V: Versions>(
pub fn build_instance_state<V: Versions>(
chain_config: ChainConfig,
l1_params: L1Params,
state_peers: Vec<Url>,
) -> anyhow::Result<NodeState> {
let l1_client = l1_params.options.connect(l1_params.url).await?;
let instance_state = NodeState::new(
) -> NodeState {
let l1_client = l1_params.options.connect(l1_params.urls);
NodeState::new(
u64::MAX, // dummy node ID, only used for debugging
chain_config,
l1_client,
Expand All @@ -57,8 +57,7 @@ pub async fn build_instance_state<V: Versions>(
&NoMetrics,
)),
V::Base::VERSION,
);
Ok(instance_state)
)
}

impl BuilderConfig {
Expand Down
2 changes: 1 addition & 1 deletion contract-bindings/artifacts/LightClientMock_bytecode.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contract-bindings/artifacts/LightClient_bytecode.json

Large diffs are not rendered by default.

68 changes: 68 additions & 0 deletions contract-bindings/src/light_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ pub mod light_client {
state_mutability: ::ethers::core::abi::ethabi::StateMutability::View,
},],
),
(
::std::borrow::ToOwned::to_owned("currentBlockNumber"),
::std::vec![::ethers::core::abi::ethabi::Function {
name: ::std::borrow::ToOwned::to_owned("currentBlockNumber"),
inputs: ::std::vec![],
outputs: ::std::vec![::ethers::core::abi::ethabi::Param {
name: ::std::string::String::new(),
kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,),
internal_type: ::core::option::Option::Some(
::std::borrow::ToOwned::to_owned("uint256"),
),
},],
constant: ::core::option::Option::None,
state_mutability: ::ethers::core::abi::ethabi::StateMutability::View,
},],
),
(
::std::borrow::ToOwned::to_owned("disablePermissionedProverMode"),
::std::vec![::ethers::core::abi::ethabi::Function {
Expand Down Expand Up @@ -959,6 +975,14 @@ pub mod light_client {
.method_hash([173, 60, 177, 204], ())
.expect("method not found (this should never happen)")
}
///Calls the contract's `currentBlockNumber` (0x378ec23b) function
pub fn current_block_number(
&self,
) -> ::ethers::contract::builders::ContractCall<M, ::ethers::core::types::U256> {
self.0
.method_hash([55, 142, 194, 59], ())
.expect("method not found (this should never happen)")
}
///Calls the contract's `disablePermissionedProverMode` (0x69cc6a04) function
pub fn disable_permissioned_prover_mode(
&self,
Expand Down Expand Up @@ -2214,6 +2238,21 @@ pub mod light_client {
abi = "UPGRADE_INTERFACE_VERSION()"
)]
pub struct UpgradeInterfaceVersionCall;
///Container type for all input parameters for the `currentBlockNumber` function with signature `currentBlockNumber()` and selector `0x378ec23b`
#[derive(
Clone,
::ethers::contract::EthCall,
::ethers::contract::EthDisplay,
serde::Serialize,
serde::Deserialize,
Default,
Debug,
PartialEq,
Eq,
Hash,
)]
#[ethcall(name = "currentBlockNumber", abi = "currentBlockNumber()")]
pub struct CurrentBlockNumberCall;
///Container type for all input parameters for the `disablePermissionedProverMode` function with signature `disablePermissionedProverMode()` and selector `0x69cc6a04`
#[derive(
Clone,
Expand Down Expand Up @@ -2589,6 +2628,7 @@ pub mod light_client {
#[derive(Clone, ::ethers::contract::EthAbiType, serde::Serialize, serde::Deserialize)]
pub enum LightClientCalls {
UpgradeInterfaceVersion(UpgradeInterfaceVersionCall),
CurrentBlockNumber(CurrentBlockNumberCall),
DisablePermissionedProverMode(DisablePermissionedProverModeCall),
FinalizedState(FinalizedStateCall),
GenesisStakeTableState(GenesisStakeTableStateCall),
Expand Down Expand Up @@ -2622,6 +2662,11 @@ pub mod light_client {
{
return Ok(Self::UpgradeInterfaceVersion(decoded));
}
if let Ok(decoded) =
<CurrentBlockNumberCall as ::ethers::core::abi::AbiDecode>::decode(data)
{
return Ok(Self::CurrentBlockNumber(decoded));
}
if let Ok(decoded) =
<DisablePermissionedProverModeCall as ::ethers::core::abi::AbiDecode>::decode(data)
{
Expand Down Expand Up @@ -2733,6 +2778,9 @@ pub mod light_client {
Self::UpgradeInterfaceVersion(element) => {
::ethers::core::abi::AbiEncode::encode(element)
}
Self::CurrentBlockNumber(element) => {
::ethers::core::abi::AbiEncode::encode(element)
}
Self::DisablePermissionedProverMode(element) => {
::ethers::core::abi::AbiEncode::encode(element)
}
Expand Down Expand Up @@ -2786,6 +2834,7 @@ pub mod light_client {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
match self {
Self::UpgradeInterfaceVersion(element) => ::core::fmt::Display::fmt(element, f),
Self::CurrentBlockNumber(element) => ::core::fmt::Display::fmt(element, f),
Self::DisablePermissionedProverMode(element) => {
::core::fmt::Display::fmt(element, f)
}
Expand Down Expand Up @@ -2820,6 +2869,11 @@ pub mod light_client {
Self::UpgradeInterfaceVersion(value)
}
}
impl ::core::convert::From<CurrentBlockNumberCall> for LightClientCalls {
fn from(value: CurrentBlockNumberCall) -> Self {
Self::CurrentBlockNumber(value)
}
}
impl ::core::convert::From<DisablePermissionedProverModeCall> for LightClientCalls {
fn from(value: DisablePermissionedProverModeCall) -> Self {
Self::DisablePermissionedProverMode(value)
Expand Down Expand Up @@ -2944,6 +2998,20 @@ pub mod light_client {
Hash,
)]
pub struct UpgradeInterfaceVersionReturn(pub ::std::string::String);
///Container type for all return fields from the `currentBlockNumber` function with signature `currentBlockNumber()` and selector `0x378ec23b`
#[derive(
Clone,
::ethers::contract::EthAbiType,
::ethers::contract::EthAbiCodec,
serde::Serialize,
serde::Deserialize,
Default,
Debug,
PartialEq,
Eq,
Hash,
)]
pub struct CurrentBlockNumberReturn(pub ::ethers::core::types::U256);
///Container type for all return fields from the `finalizedState` function with signature `finalizedState()` and selector `0x9fdb54a7`
#[derive(
Clone,
Expand Down
Loading

0 comments on commit b37c10d

Please sign in to comment.