Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion z2/resources/chain-specs/zq2-mainnet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ consensus.contract_upgrades = { deposit_v5 = { height = 0, reinitialise_params =
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 }
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, scilla_call_gas_exempt_addrs_v2 = [] }
consensus.forks = [
{ at_height = 4770088, executable_blocks = true },
{ at_height = 4854500, scilla_delta_maps_are_applied_correctly = true },
Expand All @@ -38,4 +38,5 @@ consensus.forks = [
{ at_height = 10153271, failed_zil_transfers_to_eoa_proper_fee_deduction = true },
{ at_height = 13514400, validator_jailing = true },
{ at_height = 99999999, scilla_empty_maps_are_encoded_correctly = true },
{ at_height = 99999999, scilla_call_gas_exempt_addrs_v2 = [] },
]
4 changes: 3 additions & 1 deletion z2/resources/chain-specs/zq2-testnet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ consensus.contract_upgrades = { deposit_v5 = { height = 0, reinitialise_params =
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 }
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, scilla_call_gas_exempt_addrs_v2 = [] }
consensus.forks = [
{ at_height = 8099088, executable_blocks = true },
{ at_height = 8371376, scilla_delta_maps_are_applied_correctly = true },
Expand All @@ -91,4 +91,6 @@ consensus.forks = [
{ at_height = 12998790, failed_zil_transfers_to_eoa_proper_fee_deduction = true },
{ at_height = 14997600, validator_jailing = true },
{ at_height = 99999999, scilla_empty_maps_are_encoded_correctly = true },
{ at_height = 99999999, scilla_call_gas_exempt_addrs_v2 = ["0x0F8aeCCaCA7FEE297cC2aBf7fFC9a81e7122A727"] },

]
14 changes: 14 additions & 0 deletions z2/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ impl Chain {
"failed_zil_transfers_to_eoa_proper_fee_deduction": false,
"validator_jailing": false,
"scilla_empty_maps_are_encoded_correctly": false,
"scilla_call_gas_exempt_addrs_v2": [],
})),
Chain::Zq2Mainnet => Some(json!({
"at_height": 0,
Expand Down Expand Up @@ -218,6 +219,7 @@ impl Chain {
"failed_zil_transfers_to_eoa_proper_fee_deduction": false,
"validator_jailing": false,
"scilla_empty_maps_are_encoded_correctly": false,
"scilla_call_gas_exempt_addrs_v2": [],
})),
_ => None,
}
Expand Down Expand Up @@ -267,6 +269,12 @@ impl Chain {
json!({ "at_height": 14997600, "validator_jailing": true}),
// estimated: arbitrary high block number no reachable before next fork
json!({ "at_height": 99999999, "scilla_empty_maps_are_encoded_correctly": true}),
// estimated: arbitrary high block number no reachable before next fork
json!({
"at_height": 99999999,
"scilla_call_gas_exempt_addrs_v2": [
],
}),
]),
Chain::Zq2Mainnet => Some(vec![
json!({ "at_height": 4770088, "executable_blocks": true }),
Expand Down Expand Up @@ -313,6 +321,12 @@ impl Chain {
json!({ "at_height": 13514400, "validator_jailing": true}),
// estimated: arbitrary high block number no reachable before next fork
json!({ "at_height": 99999999, "scilla_empty_maps_are_encoded_correctly": true}),
json!({
"at_height": 99999999,
"scilla_call_gas_exempt_addrs_v2": [
"0x0F8aeCCaCA7FEE297cC2aBf7fFC9a81e7122A727",
],
}),
]),
_ => None,
}
Expand Down
17 changes: 17 additions & 0 deletions zilliqa/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,9 @@ impl Forks {
ForkName::InjectAccessList => fork.inject_access_list,
ForkName::UseMaxGasPriorityFee => fork.use_max_gas_priority_fee,
ForkName::ValidatorJailing => fork.validator_jailing,
ForkName::ScillaCallGasExemptAddrsV2 => {
fork.scilla_call_gas_exempt_addrs_v2.length() != 0
}
} {
return Some(fork.at_height);
}
Expand Down Expand Up @@ -752,6 +755,7 @@ pub struct Fork {
pub failed_zil_transfers_to_eoa_proper_fee_deduction: bool,
pub validator_jailing: bool,
pub scilla_empty_maps_are_encoded_correctly: bool,
pub scilla_call_gas_exempt_addrs_v2: Vec<Address>,
}

pub enum ForkName {
Expand All @@ -778,6 +782,7 @@ pub enum ForkName {
InjectAccessList,
UseMaxGasPriorityFee,
ValidatorJailing,
ScillaCallGasExemptAddrsV2,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
Expand Down Expand Up @@ -892,6 +897,9 @@ pub struct ForkDelta {
pub validator_jailing: Option<bool>,
/// if true, empty scilla maps having no presence in state are encoded as empty maps, not empty values
pub scilla_empty_maps_are_encoded_correctly: Option<bool>,
// See comment for scilla_call_gas_exempt_addrs
#[serde(default)]
pub scilla_call_gas_exempt_addrs_v2: Vec<Address>,
}

impl Fork {
Expand Down Expand Up @@ -997,6 +1005,11 @@ impl Fork {
scilla_empty_maps_are_encoded_correctly: delta
.scilla_empty_maps_are_encoded_correctly
.unwrap_or(self.scilla_empty_maps_are_encoded_correctly),
scilla_call_gas_exempt_addrs_v2: {
let mut addrs = self.scilla_call_gas_exempt_addrs_v2.clone();
addrs.extend_from_slice(&delta.scilla_call_gas_exempt_addrs_v2);
addrs
},
}
}
}
Expand Down Expand Up @@ -1099,6 +1112,7 @@ pub fn genesis_fork_default() -> Fork {
failed_zil_transfers_to_eoa_proper_fee_deduction: true,
validator_jailing: true,
scilla_empty_maps_are_encoded_correctly: true,
scilla_call_gas_exempt_addrs_v2: vec![],
}
}

Expand Down Expand Up @@ -1534,6 +1548,7 @@ mod tests {
failed_zil_transfers_to_eoa_proper_fee_deduction: true,
validator_jailing: true,
scilla_empty_maps_are_encoded_correctly: true,
scilla_call_gas_exempt_addrs_v2: vec![],
},
forks: vec![],
..Default::default()
Expand Down Expand Up @@ -1584,6 +1599,7 @@ mod tests {
failed_zil_transfers_to_eoa_proper_fee_deduction: None,
validator_jailing: None,
scilla_empty_maps_are_encoded_correctly: None,
scilla_call_gas_exempt_addrs_v2: vec![],
},
ForkDelta {
at_height: 20,
Expand Down Expand Up @@ -1621,6 +1637,7 @@ mod tests {
failed_zil_transfers_to_eoa_proper_fee_deduction: None,
validator_jailing: None,
scilla_empty_maps_are_encoded_correctly: None,
scilla_call_gas_exempt_addrs_v2: vec![],
},
],
..Default::default()
Expand Down
7 changes: 6 additions & 1 deletion zilliqa/src/precompiles/scilla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,12 @@ impl ContextPrecompile for ScillaCall {
.chain
.fork
.scilla_call_gas_exempt_addrs
.contains(&input.caller_address);
.contains(&input.caller_address)
|| ctx
.chain
.fork
.scilla_call_gas_exempt_addrs_v2
.contains(&input.caller_address);

// Record access of scilla precompile
ctx.chain.has_called_scilla_precompile = true;
Expand Down
Loading