Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3a79629
Randao support
bzawisto Dec 9, 2025
6dd8667
Merge branch 'local-randao-support' into randao-support
bzawisto Dec 9, 2025
37844d9
Fmt
bzawisto Dec 11, 2025
36938cf
Apply formatting changes to solidity files
bzawisto Dec 12, 2025
b1452d3
Merge branch 'main' into randao-support
bzawisto Jan 8, 2026
a80228a
Merge branch 'randao-support' of github.com:Zilliqa/zq2 into randao-s…
bzawisto Jan 8, 2026
6da4b90
Typo
bzawisto Jan 8, 2026
cf0d730
Compilation fixes
bzawisto Jan 8, 2026
256b33f
Bug fix
bzawisto Jan 8, 2026
8869b4b
Further fixes
bzawisto Jan 8, 2026
387fda9
Missing compiled file
bzawisto Jan 8, 2026
5989ae0
Update chainspec files
bzawisto Jan 8, 2026
28467b6
Bug fix
bzawisto Jan 8, 2026
08a59b8
Some tests fixes
bzawisto Jan 8, 2026
1b06bf9
Bug fix
bzawisto Jan 9, 2026
e091436
Another fix
bzawisto Jan 9, 2026
d80238a
Some progress
bzawisto Jan 14, 2026
e5c372d
Apply formatting changes to solidity files
bzawisto Jan 14, 2026
c004fba
Some cleanup
bzawisto Jan 14, 2026
0e442d2
Merge branch 'randao-support' of github.com:Zilliqa/zq2 into randao-s…
bzawisto Jan 14, 2026
894ca77
Further cleanup
bzawisto Jan 14, 2026
8e98f96
Further simplifications
bzawisto Jan 14, 2026
f97dbd5
Temp
bzawisto Jan 15, 2026
025b7f8
Further cleanup
bzawisto Jan 19, 2026
5f3bd83
Further cleanup
bzawisto Jan 19, 2026
75eb321
Further cleanup
bzawisto Jan 19, 2026
ecf8adc
Further cleanup
bzawisto Jan 19, 2026
703ee89
Merge branch 'main' into randao-support
bzawisto Jan 19, 2026
2b021a0
Clippy & fmt
bzawisto Jan 19, 2026
cd2b515
Refresh contract
bzawisto Jan 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion z2/resources/chain-specs/zq2-devnet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ consensus.minimum_stake = "10_000_000_000_000_000_000_000_000"
# Gas parameters
consensus.eth_block_gas_limit = 84000000
consensus.gas_price = "4_761_904_800_000"
consensus.contract_upgrades = { deposit_v5 = { height = 0, reinitialise_params = { withdrawal_period = 300 } }, deposit_v6 = { height = 0 }, deposit_v7 = { height = 0 } }
consensus.contract_upgrades = { deposit_v5 = { height = 0, reinitialise_params = { withdrawal_period = 300 } }, deposit_v6 = { height = 0 }, deposit_v7 = { height = 0 }, deposit_v8 = { height = 0 } }
consensus.new_view_broadcast_interval = { secs = 30, nanos = 0 }

api_servers = [{ default_quota = { balance = 500, period = 1 }, port = 4201, enabled_apis = [{ namespace = "eth", apis = ["blockNumber"] }] }, { port = 4202, enabled_apis = ["admin", "debug", "erigon", "eth", "net", "ots", "trace", "txpool", "web3", "zilliqa"] }]
5 changes: 3 additions & 2 deletions z2/resources/chain-specs/zq2-mainnet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ consensus.minimum_stake = "10_000_000_000_000_000_000_000_000"
# Gas parameters
consensus.eth_block_gas_limit = 84000000
consensus.gas_price = "4_761_904_800_000"
consensus.contract_upgrades = { deposit_v5 = { height = 0, reinitialise_params = { withdrawal_period = 1209600 } }, deposit_v6 = { height = 13514400 }, deposit_v7 = { height = 13514400, reinitialise_params = { withdrawal_period = 461680 } } }
consensus.contract_upgrades = { deposit_v5 = { height = 0, reinitialise_params = { withdrawal_period = 1209600 } }, deposit_v6 = { height = 13514400 }, deposit_v7 = { height = 13514400, reinitialise_params = { withdrawal_period = 461680 } }, deposit_v8 = { height = 99999999, reinitialise_params = { withdrawal_period = 461680 } } }
consensus.new_view_broadcast_interval = { secs = 30, nanos = 0 }

api_servers = [{ default_quota = { balance = 500, period = 1 }, port = 4201, enabled_apis = [{ namespace = "eth", apis = ["blockNumber"] }] }, { port = 4202, enabled_apis = ["admin", "debug", "erigon", "eth", "net", "ots", "trace", "txpool", "web3", "zilliqa"] }]
consensus.genesis_fork = { at_height = 0, executable_blocks = false, call_mode_1_sets_caller_to_parent_caller = true, failed_scilla_call_from_gas_exempt_caller_causes_revert = true, scilla_messages_can_call_evm_contracts = true, scilla_contract_creation_increments_account_balance = true, scilla_json_preserve_order = true, scilla_call_respects_evm_state_changes = true, only_mutated_accounts_update_state = true, scilla_call_gas_exempt_addrs = [], scilla_block_number_returns_current_block = true, scilla_maps_are_encoded_correctly = true, transfer_gas_fee_to_zero_account = true, apply_state_changes_only_if_transaction_succeeds = true, apply_scilla_delta_when_evm_succeeded = true, scilla_deduct_funds_from_actual_sender = true, fund_accounts_from_zero_account = [], scilla_delta_maps_are_applied_correctly = false, scilla_server_unlimited_response_size = false, scilla_failed_txn_correct_balance_deduction = false, scilla_transition_proper_order = false, evm_to_scilla_value_transfer_zero = false, restore_xsgd_contract = false, evm_exec_failure_causes_scilla_precompile_to_fail = false, revert_restore_xsgd_contract = false, scilla_fix_contract_code_removal_on_evm_tx = false, restore_ignite_wallet_contracts = false, prevent_zil_transfer_from_evm_to_scilla_contract = false, scilla_failed_txn_correct_gas_fee_charged = false, check_minimum_gas_price = false, inject_access_list = false, use_max_gas_priority_fee = false, failed_zil_transfers_to_eoa_proper_fee_deduction = false, validator_jailing = false, scilla_empty_maps_are_encoded_correctly = false, cancun_active = false, scilla_call_gas_exempt_addrs_v2 = [] }
consensus.genesis_fork = { at_height = 0, executable_blocks = false, call_mode_1_sets_caller_to_parent_caller = true, failed_scilla_call_from_gas_exempt_caller_causes_revert = true, scilla_messages_can_call_evm_contracts = true, scilla_contract_creation_increments_account_balance = true, scilla_json_preserve_order = true, scilla_call_respects_evm_state_changes = true, only_mutated_accounts_update_state = true, scilla_call_gas_exempt_addrs = [], scilla_block_number_returns_current_block = true, scilla_maps_are_encoded_correctly = true, transfer_gas_fee_to_zero_account = true, apply_state_changes_only_if_transaction_succeeds = true, apply_scilla_delta_when_evm_succeeded = true, scilla_deduct_funds_from_actual_sender = true, fund_accounts_from_zero_account = [], scilla_delta_maps_are_applied_correctly = false, scilla_server_unlimited_response_size = false, scilla_failed_txn_correct_balance_deduction = false, scilla_transition_proper_order = false, evm_to_scilla_value_transfer_zero = false, restore_xsgd_contract = false, evm_exec_failure_causes_scilla_precompile_to_fail = false, revert_restore_xsgd_contract = false, scilla_fix_contract_code_removal_on_evm_tx = false, restore_ignite_wallet_contracts = false, prevent_zil_transfer_from_evm_to_scilla_contract = false, scilla_failed_txn_correct_gas_fee_charged = false, check_minimum_gas_price = false, inject_access_list = false, use_max_gas_priority_fee = false, failed_zil_transfers_to_eoa_proper_fee_deduction = false, validator_jailing = false, scilla_empty_maps_are_encoded_correctly = false, cancun_active = false, scilla_call_gas_exempt_addrs_v2 = [], randao_support = false }
consensus.forks = [
{ at_height = 4770088, executable_blocks = true },
{ at_height = 4854500, scilla_delta_maps_are_applied_correctly = true },
Expand All @@ -40,4 +40,5 @@ consensus.forks = [
{ at_height = 99999999, scilla_empty_maps_are_encoded_correctly = true },
{ at_height = 99999999, cancun_active = true },
{ at_height = 99999999, scilla_call_gas_exempt_addrs_v2 = [] },
{ at_height = 99999999, randao_support = true },
]
5 changes: 3 additions & 2 deletions z2/resources/chain-specs/zq2-testnet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ consensus.minimum_stake = "10_000_000_000_000_000_000_000_000"
# Gas parameters
consensus.eth_block_gas_limit = 84000000
consensus.gas_price = "4_761_904_800_000"
consensus.contract_upgrades = { deposit_v5 = { height = 0, reinitialise_params = { withdrawal_period = 1209600 } }, deposit_v6 = { height = 14997600 }, deposit_v7 = { height = 17010000, reinitialise_params = { withdrawal_period = 461680 } } }
consensus.contract_upgrades = { deposit_v5 = { height = 0, reinitialise_params = { withdrawal_period = 1209600 } }, deposit_v6 = { height = 14997600 }, deposit_v7 = { height = 17010000, reinitialise_params = { withdrawal_period = 461680 } }, deposit_v8 = { height = 99999999, reinitialise_params = { withdrawal_period = 461680 } } }
consensus.new_view_broadcast_interval = { secs = 30, nanos = 0 }

api_servers = [{ default_quota = { balance = 500, period = 1 }, port = 4201, enabled_apis = [{ namespace = "eth", apis = ["blockNumber"] }] }, { port = 4202, enabled_apis = ["admin", "debug", "erigon", "eth", "net", "ots", "trace", "txpool", "web3", "zilliqa"] }]
consensus.genesis_fork = { at_height = 0, executable_blocks = false, call_mode_1_sets_caller_to_parent_caller = true, failed_scilla_call_from_gas_exempt_caller_causes_revert = true, scilla_messages_can_call_evm_contracts = true, scilla_contract_creation_increments_account_balance = true, scilla_json_preserve_order = true, scilla_call_respects_evm_state_changes = true, only_mutated_accounts_update_state = true, scilla_call_gas_exempt_addrs = [], scilla_block_number_returns_current_block = true, scilla_maps_are_encoded_correctly = true, transfer_gas_fee_to_zero_account = true, apply_state_changes_only_if_transaction_succeeds = true, apply_scilla_delta_when_evm_succeeded = true, scilla_deduct_funds_from_actual_sender = true, fund_accounts_from_zero_account = [], scilla_delta_maps_are_applied_correctly = false, scilla_server_unlimited_response_size = false, scilla_failed_txn_correct_balance_deduction = false, scilla_transition_proper_order = false, evm_to_scilla_value_transfer_zero = false, restore_xsgd_contract = false, evm_exec_failure_causes_scilla_precompile_to_fail = false, revert_restore_xsgd_contract = false, scilla_fix_contract_code_removal_on_evm_tx = false, restore_ignite_wallet_contracts = false, prevent_zil_transfer_from_evm_to_scilla_contract = false, scilla_failed_txn_correct_gas_fee_charged = false, check_minimum_gas_price = false, inject_access_list = false, use_max_gas_priority_fee = false, failed_zil_transfers_to_eoa_proper_fee_deduction = false, validator_jailing = false, scilla_empty_maps_are_encoded_correctly = false, cancun_active = false, scilla_call_gas_exempt_addrs_v2 = [] }
consensus.genesis_fork = { at_height = 0, executable_blocks = false, call_mode_1_sets_caller_to_parent_caller = true, failed_scilla_call_from_gas_exempt_caller_causes_revert = true, scilla_messages_can_call_evm_contracts = true, scilla_contract_creation_increments_account_balance = true, scilla_json_preserve_order = true, scilla_call_respects_evm_state_changes = true, only_mutated_accounts_update_state = true, scilla_call_gas_exempt_addrs = [], scilla_block_number_returns_current_block = true, scilla_maps_are_encoded_correctly = true, transfer_gas_fee_to_zero_account = true, apply_state_changes_only_if_transaction_succeeds = true, apply_scilla_delta_when_evm_succeeded = true, scilla_deduct_funds_from_actual_sender = true, fund_accounts_from_zero_account = [], scilla_delta_maps_are_applied_correctly = false, scilla_server_unlimited_response_size = false, scilla_failed_txn_correct_balance_deduction = false, scilla_transition_proper_order = false, evm_to_scilla_value_transfer_zero = false, restore_xsgd_contract = false, evm_exec_failure_causes_scilla_precompile_to_fail = false, revert_restore_xsgd_contract = false, scilla_fix_contract_code_removal_on_evm_tx = false, restore_ignite_wallet_contracts = false, prevent_zil_transfer_from_evm_to_scilla_contract = false, scilla_failed_txn_correct_gas_fee_charged = false, check_minimum_gas_price = false, inject_access_list = false, use_max_gas_priority_fee = false, failed_zil_transfers_to_eoa_proper_fee_deduction = false, validator_jailing = false, scilla_empty_maps_are_encoded_correctly = false, cancun_active = false, scilla_call_gas_exempt_addrs_v2 = [], randao_support = false }
consensus.forks = [
{ at_height = 8099088, executable_blocks = true },
{ at_height = 8371376, scilla_delta_maps_are_applied_correctly = true },
Expand All @@ -93,4 +93,5 @@ consensus.forks = [
{ at_height = 23685219, scilla_empty_maps_are_encoded_correctly = true },
{ at_height = 23685219, cancun_active = true },
{ at_height = 23685219, scilla_call_gas_exempt_addrs_v2 = [] },
{ at_height = 99999999, randao_support = true },
]
22 changes: 22 additions & 0 deletions z2/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ impl Chain {
height: 0,
reinitialise_params: None,
}),
deposit_v8: Some(ContractUpgradeConfig {
height: 0,
reinitialise_params: None,
}),
},
Self::Zq2Testnet => ContractUpgrades {
deposit_v3: None,
Expand All @@ -119,6 +123,12 @@ impl Chain {
withdrawal_period: 461680,
}), // https://github.com/Zilliqa/zq2/pull/3221
}),
deposit_v8: Some(ContractUpgradeConfig {
height: 99999999,
reinitialise_params: Some(ReinitialiseParams {
withdrawal_period: 461680,
}),
}),
},
Self::Zq2Mainnet => ContractUpgrades {
deposit_v3: None,
Expand All @@ -137,6 +147,12 @@ impl Chain {
withdrawal_period: 461680,
}), // https://github.com/Zilliqa/zq2/pull/3221
}),
deposit_v8: Some(ContractUpgradeConfig {
height: 99999999,
reinitialise_params: Some(ReinitialiseParams {
withdrawal_period: 461680,
}),
}),
},
_ => ContractUpgrades::default(),
}
Expand Down Expand Up @@ -183,6 +199,7 @@ impl Chain {
"scilla_empty_maps_are_encoded_correctly": false,
"cancun_active": false,
"scilla_call_gas_exempt_addrs_v2": [],
"randao_support": false,
})),
Chain::Zq2Mainnet => Some(json!({
"at_height": 0,
Expand Down Expand Up @@ -222,6 +239,7 @@ impl Chain {
"scilla_empty_maps_are_encoded_correctly": false,
"cancun_active": false,
"scilla_call_gas_exempt_addrs_v2": [],
"randao_support": false,
})),
_ => None,
}
Expand Down Expand Up @@ -278,6 +296,8 @@ impl Chain {
"scilla_call_gas_exempt_addrs_v2": [
],
}),
// estimated: arbitrary high block number no reachable before next fork
json!({ "at_height": 99999999, "randao_support": true}),
]),
Chain::Zq2Mainnet => Some(vec![
json!({ "at_height": 4770088, "executable_blocks": true }),
Expand Down Expand Up @@ -332,6 +352,8 @@ impl Chain {
"0x0F8aeCCaCA7FEE297cC2aBf7fFC9a81e7122A727",
],
}),
// estimated: arbitrary high block number no reachable before next fork
json!({ "at_height": 99999999, "randao_support": true}),
]),
_ => None,
}
Expand Down
4 changes: 4 additions & 0 deletions z2/src/converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,8 @@ pub async fn convert_persistence(
SystemTime::UNIX_EPOCH + Duration::from_micros(zq1_block.timestamp),
ScillaGas(zq1_block.gas_used).into(),
ScillaGas(zq1_block.gas_limit).into(),
None,
None,
);

// For each receipt update block hash. This can be done once all receipts build receipt_root_hash which is used for calculating block hash
Expand Down Expand Up @@ -651,6 +653,8 @@ fn create_empty_block_from_parent(
parent_block.header.timestamp,
parent_block.header.gas_used,
parent_block.header.gas_limit,
None,
None,
)
}

Expand Down
4 changes: 2 additions & 2 deletions z2/src/validators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,15 @@ impl SignerClient {
pub async fn get_future_stake(&self, public_key: &NodePublicKey) -> Result<u128> {
let client = self.get_signer().await?;

let data = contracts::deposit_v7::GET_FUTURE_STAKE
let data = contracts::deposit_v8::GET_FUTURE_STAKE
.encode_input(&[Token::Bytes(public_key.as_bytes())])
.unwrap();
let tx = TransactionRequest::default()
.to(contract_addr::DEPOSIT_PROXY)
.input(TransactionInput::both(data.into()));
let output = client.call(tx).await.unwrap();

let future_stake = contracts::deposit_v7::GET_FUTURE_STAKE
let future_stake = contracts::deposit_v8::GET_FUTURE_STAKE
.decode_output(&output)
.unwrap()[0]
.clone()
Expand Down
2 changes: 2 additions & 0 deletions zilliqa/benches/it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ fn process_empty(c: &mut Criterion) {
SystemTime::UNIX_EPOCH,
EvmGas(0),
EvmGas(0),
None,
None,
);
parent_hash = block.hash();

Expand Down
6 changes: 3 additions & 3 deletions zilliqa/src/api/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ fn get_block_by_number(params: Params, node: &Arc<Node>) -> Result<Option<eth::B
let block = node
.get_block(block_number)?
.ok_or_else(|| anyhow!("Block not found"))?;
let miner = node.get_proposer_reward_address(block.header)?;
let miner = node.get_proposer_reward_address(&block)?;
let block_gas_limit = block.gas_limit();
let result = eth::Block::from_block(&block, miner.unwrap_or_default(), block_gas_limit);
return Ok(Some(result));
Expand Down Expand Up @@ -674,7 +674,7 @@ pub fn get_eth_block(
None => return Ok(None),
};

let miner = node.get_proposer_reward_address(block.header)?;
let miner = node.get_proposer_reward_address(&block)?;
let block_gas_limit = block.gas_limit();
let mut result = eth::Block::from_block(&block, miner.unwrap_or_default(), block_gas_limit);

Expand Down Expand Up @@ -1031,7 +1031,7 @@ async fn subscribe(
.db
.get_transactionless_block(header.hash.into())?
.ok_or("Block not found")?;
let miner = node.get_proposer_reward_address(block.header)?;
let miner = node.get_proposer_reward_address(&block)?;
let block_gas_limit = block.gas_limit();
let eth_block =
eth::Block::from_block(&block, miner.unwrap_or_default(), block_gas_limit);
Expand Down
6 changes: 3 additions & 3 deletions zilliqa/src/api/ots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fn get_block_details(params: Params, node: &Arc<Node>) -> Result<Option<ots::Blo
let Some(ref block) = node.get_block(block_number)? else {
return Ok(None);
};
let miner = node.get_proposer_reward_address(block.header)?;
let miner = node.get_proposer_reward_address(block)?;

let block_gas_limit = node.config.consensus.eth_block_gas_limit;
Ok(Some(ots::BlockDetails::from_block(
Expand All @@ -116,7 +116,7 @@ fn get_block_details_by_hash(
let Some(ref block) = node.get_block(block_hash)? else {
return Ok(None);
};
let miner = node.get_proposer_reward_address(block.header)?;
let miner = node.get_proposer_reward_address(block)?;
let block_gas_limit = node.config.consensus.eth_block_gas_limit;
Ok(Some(ots::BlockDetails::from_block(
block,
Expand All @@ -138,7 +138,7 @@ fn get_block_transactions(
let Some(block) = node.get_block(block_number)? else {
return Ok(None);
};
let miner = node.get_proposer_reward_address(block.header)?;
let miner = node.get_proposer_reward_address(&block)?;
(
node.consensus.read().transaction_pool.clone(),
node.db.clone(),
Expand Down
2 changes: 1 addition & 1 deletion zilliqa/src/api/zilliqa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ fn get_tx_block_verbose(params: Params, node: &Arc<Node>) -> Result<Option<zil::
return Err(anyhow!("Block not finalized"));
}
let proposer = node
.get_proposer_reward_address(block.header)?
.get_proposer_reward_address(&block)?
.expect("No proposer");
(block, proposer, node.db.clone())
};
Expand Down
Loading
Loading