Skip to content

Commit

Permalink
cl: fix chiado (#12716)
Browse files Browse the repository at this point in the history
fixes below error:
```
[DBUG] [11-11|16:37:19.885] Gotten unexpected root got=0xd566eb4ba463ffbfd9bbe503d295cb5f28ba86fa90f700e2f0d7582dbc8a3814 expected=0x3af6a8f94d7d81e513eeb3a94d8ccda9a4d7d3f1de1e38b5e4c12cd6b4496346
```

due to `BeaconBody` `HashSSZ` root hash being inaccurate
it was affected by chain config params that are different in Gnosis as
per
[specs](https://github.com/gnosischain/specs/blob/master/beacon_chain.md)
  • Loading branch information
taratorio authored Nov 14, 2024
1 parent 59c424f commit c4f30a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cl/clparams/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,8 @@ func gnosisConfig() BeaconChainConfig {
cfg.InactivityScoreBias = 4
cfg.MaxWithdrawalsPerPayload = 8
cfg.MaxValidatorsPerWithdrawalsSweep = 8192
cfg.MaxBlobsPerBlock = 2
cfg.MinEpochsForBlobsSidecarsRequest = 16384
cfg.MaxPerEpochActivationChurnLimit = 2
cfg.InitializeForkSchedule()
return cfg
Expand Down Expand Up @@ -944,6 +946,10 @@ func chiadoConfig() BeaconChainConfig {
cfg.BaseRewardFactor = 25
cfg.SlotsPerEpoch = 16
cfg.EpochsPerSyncCommitteePeriod = 512
cfg.MaxWithdrawalsPerPayload = 8
cfg.MaxValidatorsPerWithdrawalsSweep = 8192
cfg.MaxBlobsPerBlock = 2
cfg.MinEpochsForBlobsSidecarsRequest = 16384
cfg.MaxPerEpochActivationChurnLimit = 2
cfg.InitializeForkSchedule()
return cfg
Expand Down Expand Up @@ -1148,6 +1154,7 @@ func SupportBackfilling(networkId uint64) bool {
return networkId == uint64(MainnetNetwork) ||
networkId == uint64(SepoliaNetwork) ||
networkId == uint64(GnosisNetwork) ||
networkId == uint64(ChiadoNetwork) ||
networkId == uint64(HoleskyNetwork)
}

Expand Down
3 changes: 2 additions & 1 deletion cl/phase1/core/checkpoint_sync/remote_checkpoint_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ func (r *RemoteCheckpointSync) GetLatestBeaconState(ctx context.Context) (*state
return nil, fmt.Errorf("checkpoint sync read failed %s", err)
}

epoch, err := utils.ExtractSlotFromSerializedBeaconState(marshaled)
slot, err := utils.ExtractSlotFromSerializedBeaconState(marshaled)
if err != nil {
return nil, fmt.Errorf("checkpoint sync read failed %s", err)
}

epoch := slot / r.beaconConfig.SlotsPerEpoch
beaconState := state.New(r.beaconConfig)
err = beaconState.DecodeSSZ(marshaled, int(r.beaconConfig.GetCurrentStateVersion(epoch)))
if err != nil {
Expand Down

0 comments on commit c4f30a3

Please sign in to comment.