Skip to content

Commit 1d6ca9e

Browse files
committed
Avoid ambiguous state mismatch
1 parent dbadfd0 commit 1d6ca9e

7 files changed

Lines changed: 146 additions & 29 deletions

File tree

z2/resources/chain-specs/zq2-mainnet.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ consensus.contract_upgrades = { deposit_v5 = { height = 0, reinitialise_params =
2323
consensus.new_view_broadcast_interval = { secs = 30, nanos = 0 }
2424

2525
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"] }]
26-
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, evm_to_scilla_strings_encoded_properly = false, dont_overwrite_evm_accounts_from_stale_scilla_state = false }
26+
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, evm_to_scilla_strings_encoded_properly = false, dont_overwrite_evm_accounts_from_stale_scilla_state = false, make_transfers_in_scilla_precompiles_with_journal_api = false, disable_interop_native_zil_transfers_0 = false }
2727
consensus.forks = [
2828
{ at_height = 4770088, executable_blocks = true },
2929
{ at_height = 4854500, scilla_delta_maps_are_applied_correctly = true },
@@ -41,4 +41,6 @@ consensus.forks = [
4141
{ at_height = 19486411, scilla_call_gas_exempt_addrs_v2 = ["0x0F8aeCCaCA7FEE297cC2aBf7fFC9a81e7122A727"] },
4242
{ at_height = 25905600, randao_support = true, evm_to_scilla_strings_encoded_properly = true },
4343
{ at_height = 27081150, dont_overwrite_evm_accounts_from_stale_scilla_state = true },
44+
{ at_height = 27152370, disable_interop_native_zil_transfers_0 = true },
45+
{ at_height = 27152370, make_transfers_in_scilla_precompiles_with_journal_api = true },
4446
]

z2/resources/chain-specs/zq2-testnet.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ consensus.contract_upgrades = { deposit_v5 = { height = 0, reinitialise_params =
5252
consensus.new_view_broadcast_interval = { secs = 30, nanos = 0 }
5353

5454
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"] }]
55-
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, evm_to_scilla_strings_encoded_properly = false, dont_overwrite_evm_accounts_from_stale_scilla_state = false }
55+
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, evm_to_scilla_strings_encoded_properly = false, dont_overwrite_evm_accounts_from_stale_scilla_state = false, make_transfers_in_scilla_precompiles_with_journal_api = false, disable_interop_native_zil_transfers_0 = false }
5656
consensus.forks = [
5757
{ at_height = 8099088, executable_blocks = true },
5858
{ at_height = 8371376, scilla_delta_maps_are_applied_correctly = true },
@@ -74,4 +74,6 @@ consensus.forks = [
7474
{ at_height = 28281600, randao_support = true },
7575
{ at_height = 29230131, evm_to_scilla_strings_encoded_properly = true },
7676
{ at_height = 999999999, dont_overwrite_evm_accounts_from_stale_scilla_state = true },
77+
{ at_height = 999999999, disable_interop_native_zil_transfers_0 = true },
78+
{ at_height = 999999999, make_transfers_in_scilla_precompiles_with_journal_api = true },
7779
]

z2/src/chain.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ impl Chain {
202202
"randao_support": false,
203203
"evm_to_scilla_strings_encoded_properly": false,
204204
"dont_overwrite_evm_accounts_from_stale_scilla_state": false,
205+
"make_transfers_in_scilla_precompiles_with_journal_api": false,
206+
"disable_interop_native_zil_transfers_0": false,
205207
})),
206208
Chain::Zq2Mainnet => Some(json!({
207209
"at_height": 0,
@@ -244,6 +246,8 @@ impl Chain {
244246
"randao_support": false,
245247
"evm_to_scilla_strings_encoded_properly": false,
246248
"dont_overwrite_evm_accounts_from_stale_scilla_state": false,
249+
"make_transfers_in_scilla_precompiles_with_journal_api": false,
250+
"disable_interop_native_zil_transfers_0": false,
247251
})),
248252
_ => None,
249253
}
@@ -303,6 +307,8 @@ impl Chain {
303307
json!({ "at_height": 28281600, "randao_support": true}),
304308
json!({ "at_height": 29230131, "evm_to_scilla_strings_encoded_properly": true}),
305309
json!({ "at_height": 999999999, "dont_overwrite_evm_accounts_from_stale_scilla_state": true}),
310+
json!({ "at_height": 999999999, "disable_interop_native_zil_transfers_0": true}),
311+
json!({ "at_height": 999999999, "make_transfers_in_scilla_precompiles_with_journal_api": true}),
306312
]),
307313
Chain::Zq2Mainnet => Some(vec![
308314
json!({ "at_height": 4770088, "executable_blocks": true }),
@@ -360,6 +366,8 @@ impl Chain {
360366
}),
361367
json!({ "at_height": 25905600, "randao_support": true, "evm_to_scilla_strings_encoded_properly": true}),
362368
json!({ "at_height": 27081150, "dont_overwrite_evm_accounts_from_stale_scilla_state": true}),
369+
json!({ "at_height": 27152370, "disable_interop_native_zil_transfers_0": true}),
370+
json!({ "at_height": 27152370, "make_transfers_in_scilla_precompiles_with_journal_api": true}),
363371
]),
364372
_ => None,
365373
}

zilliqa/src/cfg.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,12 @@ impl Forks {
722722
ForkName::DontOverwriteAccountsFromStaleScillaState => {
723723
fork.dont_overwrite_evm_accounts_from_stale_scilla_state
724724
}
725+
ForkName::MakeTransfersInScillaPrecompilesWithJournalApi => {
726+
fork.make_transfers_in_scilla_precompiles_with_journal_api
727+
}
728+
ForkName::DisableInteropNativeZilTransfers0 => {
729+
fork.disable_interop_native_zil_transfers_0
730+
}
725731
} {
726732
return Some(fork.at_height);
727733
}
@@ -772,6 +778,8 @@ pub struct Fork {
772778
pub randao_support: bool,
773779
pub evm_to_scilla_strings_encoded_properly: bool,
774780
pub dont_overwrite_evm_accounts_from_stale_scilla_state: bool,
781+
pub make_transfers_in_scilla_precompiles_with_journal_api: bool,
782+
pub disable_interop_native_zil_transfers_0: bool,
775783
}
776784

777785
pub enum ForkName {
@@ -800,6 +808,8 @@ pub enum ForkName {
800808
ValidatorJailing,
801809
ScillaCallGasExemptAddrsV2,
802810
DontOverwriteAccountsFromStaleScillaState,
811+
MakeTransfersInScillaPrecompilesWithJournalApi,
812+
DisableInteropNativeZilTransfers0,
803813
}
804814

805815
#[derive(Clone, Debug, Serialize, Deserialize)]
@@ -925,6 +935,12 @@ pub struct ForkDelta {
925935
pub evm_to_scilla_strings_encoded_properly: Option<bool>,
926936
/// If true, addresses modified also by EVM are skipped while applying the Scilla state delta
927937
pub dont_overwrite_evm_accounts_from_stale_scilla_state: Option<bool>,
938+
/// If true, the `scilla_call` precompile performs its value refund through revm's journaled
939+
/// transfer API
940+
pub make_transfers_in_scilla_precompiles_with_journal_api: Option<bool>,
941+
/// If true, a call to the `scilla_call` precompile that carries a non-zero native ZIL value fails
942+
/// immediately.
943+
pub disable_interop_native_zil_transfers_0: Option<bool>,
928944
}
929945

930946
impl Fork {
@@ -1043,6 +1059,12 @@ impl Fork {
10431059
dont_overwrite_evm_accounts_from_stale_scilla_state: delta
10441060
.dont_overwrite_evm_accounts_from_stale_scilla_state
10451061
.unwrap_or(self.dont_overwrite_evm_accounts_from_stale_scilla_state),
1062+
make_transfers_in_scilla_precompiles_with_journal_api: delta
1063+
.make_transfers_in_scilla_precompiles_with_journal_api
1064+
.unwrap_or(self.make_transfers_in_scilla_precompiles_with_journal_api),
1065+
disable_interop_native_zil_transfers_0: delta
1066+
.disable_interop_native_zil_transfers_0
1067+
.unwrap_or(self.disable_interop_native_zil_transfers_0),
10461068
}
10471069
}
10481070
}
@@ -1150,6 +1172,8 @@ pub fn genesis_fork_default() -> Fork {
11501172
randao_support: true,
11511173
evm_to_scilla_strings_encoded_properly: true,
11521174
dont_overwrite_evm_accounts_from_stale_scilla_state: true,
1175+
make_transfers_in_scilla_precompiles_with_journal_api: true,
1176+
disable_interop_native_zil_transfers_0: true,
11531177
}
11541178
}
11551179

@@ -1330,6 +1354,8 @@ mod tests {
13301354
randao_support: None,
13311355
evm_to_scilla_strings_encoded_properly: None,
13321356
dont_overwrite_evm_accounts_from_stale_scilla_state: None,
1357+
make_transfers_in_scilla_precompiles_with_journal_api: None,
1358+
disable_interop_native_zil_transfers_0: None,
13331359
}],
13341360
..Default::default()
13351361
};
@@ -1392,6 +1418,8 @@ mod tests {
13921418
randao_support: Some(false),
13931419
evm_to_scilla_strings_encoded_properly: None,
13941420
dont_overwrite_evm_accounts_from_stale_scilla_state: None,
1421+
make_transfers_in_scilla_precompiles_with_journal_api: None,
1422+
disable_interop_native_zil_transfers_0: None,
13951423
},
13961424
ForkDelta {
13971425
at_height: 20,
@@ -1434,6 +1462,8 @@ mod tests {
14341462
randao_support: None,
14351463
evm_to_scilla_strings_encoded_properly: None,
14361464
dont_overwrite_evm_accounts_from_stale_scilla_state: None,
1465+
make_transfers_in_scilla_precompiles_with_journal_api: None,
1466+
disable_interop_native_zil_transfers_0: None,
14371467
},
14381468
],
14391469
..Default::default()
@@ -1513,6 +1543,8 @@ mod tests {
15131543
randao_support: None,
15141544
evm_to_scilla_strings_encoded_properly: None,
15151545
dont_overwrite_evm_accounts_from_stale_scilla_state: None,
1546+
make_transfers_in_scilla_precompiles_with_journal_api: None,
1547+
disable_interop_native_zil_transfers_0: None,
15161548
},
15171549
ForkDelta {
15181550
at_height: 10,
@@ -1555,6 +1587,8 @@ mod tests {
15551587
randao_support: None,
15561588
evm_to_scilla_strings_encoded_properly: None,
15571589
dont_overwrite_evm_accounts_from_stale_scilla_state: None,
1590+
make_transfers_in_scilla_precompiles_with_journal_api: None,
1591+
disable_interop_native_zil_transfers_0: None,
15581592
},
15591593
],
15601594
..Default::default()
@@ -1622,6 +1656,8 @@ mod tests {
16221656
randao_support: true,
16231657
evm_to_scilla_strings_encoded_properly: true,
16241658
dont_overwrite_evm_accounts_from_stale_scilla_state: true,
1659+
make_transfers_in_scilla_precompiles_with_journal_api: true,
1660+
disable_interop_native_zil_transfers_0: true,
16251661
},
16261662
forks: vec![],
16271663
..Default::default()
@@ -1677,6 +1713,8 @@ mod tests {
16771713
randao_support: None,
16781714
evm_to_scilla_strings_encoded_properly: None,
16791715
dont_overwrite_evm_accounts_from_stale_scilla_state: None,
1716+
make_transfers_in_scilla_precompiles_with_journal_api: None,
1717+
disable_interop_native_zil_transfers_0: None,
16801718
},
16811719
ForkDelta {
16821720
at_height: 20,
@@ -1719,6 +1757,8 @@ mod tests {
17191757
randao_support: None,
17201758
evm_to_scilla_strings_encoded_properly: None,
17211759
dont_overwrite_evm_accounts_from_stale_scilla_state: None,
1760+
make_transfers_in_scilla_precompiles_with_journal_api: None,
1761+
disable_interop_native_zil_transfers_0: None,
17221762
},
17231763
],
17241764
..Default::default()

0 commit comments

Comments
 (0)