diff --git a/pulse/deposit_contract.go b/pulse/deposit_contract.go index 8ee1ed619..127c338bd 100644 --- a/pulse/deposit_contract.go +++ b/pulse/deposit_contract.go @@ -58,17 +58,14 @@ func replaceDepositContract(state *state.StateDB) { state.SetCode(ethereumDepositContractAddr, nilContractBytes) log.Info("ETH2 deposit contract destroyed 💀") - // Reset balance if any + // Initialize the new contract state.SetBalance(pulseDepositContractAddr, uint256.NewInt(0)) - - // Initialise zero hash array in the new deposit contract + state.SetCode(pulseDepositContractAddr, depositContractBytes) + state.SetNonce(pulseDepositContractAddr, 0) for i := 0; i < len(depositContractStorage); i++ { hash := common.HexToHash(depositContractStorage[i][0]) value := common.HexToHash(depositContractStorage[i][1]) state.SetState(pulseDepositContractAddr, hash, value) } - - // Deploy the new contract code - state.SetCode(pulseDepositContractAddr, depositContractBytes) log.Info("Deployed new beacon deposit contract ✨", "address", pulseDepositContractAddr) }