Skip to content

Commit

Permalink
chore(starknet_batcher): in block builder use the consensus suplied s…
Browse files Browse the repository at this point in the history
…equncer address
  • Loading branch information
ArniStarkware committed Dec 3, 2024
1 parent 87dd372 commit a8aab7c
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 51 deletions.
10 changes: 0 additions & 10 deletions config/sequencer/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@
"privacy": "Public",
"value": 0
},
"batcher_config.block_builder_config.sequencer_address": {
"description": "The address of the sequencer.",
"pointer_target": "sequencer_address",
"privacy": "Public"
},
"batcher_config.block_builder_config.tx_chunk_size": {
"description": "The size of the transaction chunk.",
"privacy": "Public",
Expand Down Expand Up @@ -944,11 +939,6 @@
"privacy": "Public",
"value": ""
},
"sequencer_address": {
"description": "A required param! The sequencer address.",
"param_type": "String",
"privacy": "TemporaryValue"
},
"strk_fee_token_address": {
"description": "A required param! Address of the STRK fee token.",
"param_type": "String",
Expand Down
1 change: 0 additions & 1 deletion config/sequencer/presets/config-batcher.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
"strk_fee_token_address": "0x7",
"batcher_config.storage.db_config.path_prefix": "/data",
"batcher_config.storage.db_config.enforce_file_exists": false,
"sequencer_address": "0x1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ use tokio::sync::Notify;
use tokio::task::JoinHandle;
use tracing::{debug, debug_span, error, info, trace, warn, Instrument};

// TODO(Dan, Matan): Remove this once and replace with real gas prices.
// TODO(Dan, Matan): Remove these and replace with real gas prices and real sequencer address.
const TEMPORARY_SEQUENCER_ADDRESS: u16 = 1991;
const TEMPORARY_GAS_PRICES: GasPrices = GasPrices {
eth_gas_prices: GasPriceVector {
l1_gas_price: NonzeroGasPrice::MIN,
Expand Down Expand Up @@ -179,7 +180,7 @@ impl ConsensusContext for SequencerConsensusContext {
now.timestamp().try_into().expect("Failed to convert timestamp"),
),
use_kzg_da: true,
sequencer_address: proposal_init.proposer,
sequencer_address: ValidatorId::from(TEMPORARY_SEQUENCER_ADDRESS),
},
};
// TODO: Should we be returning an error?
Expand Down Expand Up @@ -363,7 +364,7 @@ impl SequencerConsensusContext {
async fn validate_current_round_proposal(
&mut self,
height: BlockNumber,
proposer: ValidatorId,
_proposer: ValidatorId,
timeout: Duration,
content_receiver: mpsc::Receiver<ProposalPart>,
fin_sender: oneshot::Sender<(ProposalContentId, ProposalFin)>,
Expand Down Expand Up @@ -394,7 +395,7 @@ impl SequencerConsensusContext {
now.timestamp().try_into().expect("Failed to convert timestamp"),
),
use_kzg_da: true,
sequencer_address: proposer,
sequencer_address: ValidatorId::from(TEMPORARY_SEQUENCER_ADDRESS),
},
};
batcher.validate_block(input).await.expect("Failed to initiate proposal validation");
Expand Down
15 changes: 1 addition & 14 deletions crates/starknet_batcher/src/block_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use papyrus_state_reader::papyrus_state::PapyrusReader;
use papyrus_storage::StorageReader;
use serde::{Deserialize, Serialize};
use starknet_api::block::{BlockHashAndNumber, BlockInfo};
use starknet_api::core::ContractAddress;
use starknet_api::executable_transaction::Transaction;
use starknet_api::transaction::TransactionHash;
use thiserror::Error;
Expand Down Expand Up @@ -253,7 +252,6 @@ pub struct BlockBuilderConfig {
pub chain_info: ChainInfo,
pub execute_config: TransactionExecutorConfig,
pub bouncer_config: BouncerConfig,
pub sequencer_address: ContractAddress,
pub tx_chunk_size: usize,
pub versioned_constants_overrides: VersionedConstantsOverrides,
}
Expand All @@ -265,7 +263,6 @@ impl Default for BlockBuilderConfig {
chain_info: ChainInfo::default(),
execute_config: TransactionExecutorConfig::default(),
bouncer_config: BouncerConfig::default(),
sequencer_address: ContractAddress::default(),
tx_chunk_size: 100,
versioned_constants_overrides: VersionedConstantsOverrides::default(),
}
Expand All @@ -277,12 +274,6 @@ impl SerializeConfig for BlockBuilderConfig {
let mut dump = append_sub_config_name(self.chain_info.dump(), "chain_info");
dump.append(&mut append_sub_config_name(self.execute_config.dump(), "execute_config"));
dump.append(&mut append_sub_config_name(self.bouncer_config.dump(), "bouncer_config"));
dump.append(&mut BTreeMap::from([ser_param(
"sequencer_address",
&self.sequencer_address,
"The address of the sequencer.",
ParamPrivacyInput::Public,
)]));
dump.append(&mut BTreeMap::from([ser_param(
"tx_chunk_size",
&self.tx_chunk_size,
Expand Down Expand Up @@ -310,15 +301,11 @@ impl BlockBuilderFactory {
) -> BlockBuilderResult<TransactionExecutor<PapyrusReader>> {
let height = block_metadata.block_info.block_number;
let block_builder_config = self.block_builder_config.clone();
let block_info = BlockInfo {
sequencer_address: block_builder_config.sequencer_address,
..block_metadata.block_info
};
let versioned_constants = VersionedConstants::get_versioned_constants(
block_builder_config.versioned_constants_overrides,
);
let block_context = BlockContext::new(
block_info,
block_metadata.block_info,
block_builder_config.chain_info,
versioned_constants,
block_builder_config.bouncer_config,
Expand Down
1 change: 0 additions & 1 deletion crates/starknet_integration_tests/src/config_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ pub(crate) fn dump_config_file_changes(
required_params.chain_id,
required_params.eth_fee_token_address,
required_params.strk_fee_token_address,
required_params.sequencer_address,
config.rpc_state_reader_config.json_rpc_version,
config.rpc_state_reader_config.url,
config.batcher_config.storage.db_config.path_prefix,
Expand Down
11 changes: 1 addition & 10 deletions crates/starknet_integration_tests/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ use papyrus_network::network_manager::BroadcastTopicChannels;
use papyrus_protobuf::consensus::{ProposalPart, StreamMessage};
use papyrus_storage::StorageConfig;
use starknet_api::block::BlockNumber;
use starknet_api::contract_address;
use starknet_api::core::ContractAddress;
use starknet_api::rpc_transaction::RpcTransaction;
use starknet_api::transaction::TransactionHash;
use starknet_batcher::block_builder::BlockBuilderConfig;
Expand Down Expand Up @@ -64,7 +62,6 @@ pub async fn create_config(
chain_id: chain_info.chain_id,
eth_fee_token_address: fee_token_addresses.eth_fee_token_address,
strk_fee_token_address: fee_token_addresses.strk_fee_token_address,
sequencer_address: ContractAddress::from(1312_u128), // Arbitrary non-zero value.
},
consensus_proposals_channels,
)
Expand Down Expand Up @@ -224,15 +221,9 @@ pub fn create_batcher_config(
chain_info: ChainInfo,
) -> BatcherConfig {
// TODO(Arni): Create BlockBuilderConfig create for testing method and use here.
const SEQUENCER_ADDRESS_FOR_TESTING: u128 = 1991;

BatcherConfig {
storage: batcher_storage_config,
block_builder_config: BlockBuilderConfig {
chain_info,
sequencer_address: contract_address!(SEQUENCER_ADDRESS_FOR_TESTING),
..Default::default()
},
block_builder_config: BlockBuilderConfig { chain_info, ..Default::default() },
..Default::default()
}
}
9 changes: 0 additions & 9 deletions crates/starknet_sequencer_node/src/config/node_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,6 @@ pub static CONFIG_POINTERS: LazyLock<ConfigPointers> = LazyLock::new(|| {
"gateway_config.chain_info.fee_token_addresses.strk_fee_token_address",
]),
),
// TODO(tsabary): set as a regular required parameter.
(
ser_pointer_target_required_param(
"sequencer_address",
SerializationType::String,
"The sequencer address.",
),
set_pointing_param_paths(&["batcher_config.block_builder_config.sequencer_address"]),
),
];
let mut common_execution_config = generate_struct_pointer(
"versioned_constants_overrides".to_owned(),
Expand Down
2 changes: 0 additions & 2 deletions crates/starknet_sequencer_node/src/config/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ pub struct RequiredParams {
pub chain_id: ChainId,
pub eth_fee_token_address: ContractAddress,
pub strk_fee_token_address: ContractAddress,
pub sequencer_address: ContractAddress,
}

impl RequiredParams {
Expand All @@ -20,7 +19,6 @@ impl RequiredParams {
chain_id: ChainId::create_for_testing(),
eth_fee_token_address: ContractAddress::from(2_u128),
strk_fee_token_address: ContractAddress::from(3_u128),
sequencer_address: ContractAddress::from(17_u128),
}
}
}
Expand Down

0 comments on commit a8aab7c

Please sign in to comment.