Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
387e085
Update for Dencun
yrong Sep 21, 2023
846065a
build geth&lodestar from source
yrong Sep 25, 2023
65272d4
Fix makeTrie
yrong Sep 25, 2023
d2f0d66
Merge branch 'main' into ron/dencun
yrong Nov 21, 2023
63b0f07
Update go ethereum to v1.13.5
yrong Nov 21, 2023
faf5d01
Update packages & Speedup e2e setup
yrong Nov 21, 2023
c179311
Update lodestar to v1.12.0
yrong Nov 21, 2023
d728f48
Remove unused
yrong Nov 21, 2023
28f23dd
Remove unrelated changes
yrong Nov 21, 2023
cce7714
Ignore build geth when binary exist
yrong Nov 21, 2023
48cc44f
Cleanup for deprecated ethashproof
yrong Nov 22, 2023
fe1e191
Update with VersionedExecutionPayloadHeader
yrong Nov 22, 2023
d37a736
Fix breaking tests
yrong Nov 22, 2023
1aa5a0a
Merge branch 'main' into ron/dencun
yrong Dec 1, 2023
545e267
Update node package
yrong Dec 1, 2023
1c5b33d
Update git modules
yrong Dec 1, 2023
647f57e
Sync packages with nix
yrong Dec 1, 2023
40daff1
Merge branch 'main' of https://github.com/Snowfork/snowbridge into ro…
yrong Dec 4, 2023
565cd83
Update sdk
yrong Dec 4, 2023
7414746
Update contract binding
yrong Dec 5, 2023
70d017b
More cleanup
yrong Dec 5, 2023
585dc78
For deneb(1)
yrong Dec 5, 2023
ba67bf3
For deneb(2)
yrong Dec 5, 2023
f9f7458
Update sdk
yrong Dec 5, 2023
d542799
For deneb(3)
yrong Dec 5, 2023
904e97a
Update sdk
yrong Dec 5, 2023
99c0304
For deneb(4)
yrong Dec 5, 2023
8a50ced
Enable deneb for local setup
yrong Dec 5, 2023
e5c2381
Fix tests
yrong Dec 5, 2023
29a2afe
Fix BeaconStateDeneb & more tests
yrong Dec 6, 2023
3f6cb38
Merge branch 'main' into ron/dencun
yrong Dec 6, 2023
4aae19a
Generate test fixture for Deneb and more tests accordingly
yrong Dec 7, 2023
79e79dd
Merge branch 'main' into ron/dencun
yrong Dec 7, 2023
ed69a35
Fix parse empty field
yrong Dec 7, 2023
1c1ca20
Setup for switchover test
yrong Dec 7, 2023
8f95e8a
Test workflow specific for deneb
yrong Dec 7, 2023
ba5957e
Ignore change detect building polkadot binary
yrong Dec 11, 2023
9673b21
Encode with error handling
yrong Dec 11, 2023
e767e6e
Fix format
yrong Dec 11, 2023
e5120e8
Merge branch 'main' into ron/dencun
yrong Dec 13, 2023
6a38f79
Update lodestar
yrong Dec 14, 2023
c246f70
Improve scripts setting up nodes for production
yrong Dec 14, 2023
6892678
Merge branch 'main' into ron/dencun
yrong Dec 27, 2023
b76a4dd
Sync execution update on demand
yrong Dec 31, 2023
bdec747
Merge branch 'main' into ron/dencun
yrong Jan 11, 2024
99f5a6d
Fix import
yrong Jan 11, 2024
3580c4d
Reorganize deneb primitives
yrong Jan 11, 2024
d1a5b86
Update go mod
yrong Jan 12, 2024
ad65ebd
Fix format
yrong Jan 12, 2024
53e4fa6
Remove obsolete
yrong Jan 12, 2024
d069f97
Fix import
yrong Jan 12, 2024
da3d338
Merge branch 'main' into ron/dencun
yrong Jan 12, 2024
58a28bd
Merge branch 'main' into ron/dencun
yrong Jan 17, 2024
61dadc9
Fix the deneb ForkVersion
yrong Jan 17, 2024
328d541
Upgrade geth and lodestar
yrong Jan 17, 2024
9d633e2
Merge branch 'ron/dencun' into ron/execution-update-on-demand
yrong Jan 18, 2024
d37ee40
Download geth release to replace the nix default
yrong Jan 18, 2024
d4bc62b
Naming consistently
yrong Jan 18, 2024
0c14e49
Update lodestar with the mock hack
yrong Jan 18, 2024
0ed243a
Fix generate mainnet fixture
yrong Jan 18, 2024
810fa47
Merge branch 'ron/dencun' into ron/execution-update-on-demand
yrong Jan 18, 2024
53c6fb8
Remove fixture unused
yrong Jan 18, 2024
4cdfa96
Backward compatible
yrong Jan 18, 2024
b5ea6b2
Check execution_branch
yrong Jan 18, 2024
6bd6723
Remove build geth
yrong Jan 18, 2024
b892f77
Remove cross check
yrong Jan 18, 2024
a646a4e
sync all lagging periods
yrong Jan 18, 2024
ee71d1a
Clean up
yrong Jan 18, 2024
79247a2
More refactoring
yrong Jan 18, 2024
49800bd
Cleanup scripts
yrong Jan 18, 2024
cdc7165
Update sdk
yrong Jan 18, 2024
072c3f0
Merge branch 'main' into ron/execution-update-on-demand
yrong Jan 19, 2024
c42d0af
Ignore go.work
yrong Jan 19, 2024
5bc2526
Rename function
yrong Jan 19, 2024
f465995
Merge branch 'main' into ron/execution-update-on-demand
yrong Jan 24, 2024
dd866bb
Fix test
yrong Jan 24, 2024
afe2b43
Fix populate checkpoint
yrong Jan 24, 2024
018c565
Fix smoke test
yrong Jan 24, 2024
775e56a
Merge branch 'main' into ron/execution-update-on-demand
yrong Jan 28, 2024
3f0f027
Merge branch 'main' into ron/execution-update-on-demand
yrong Jan 30, 2024
1d67967
Merge branch 'main' into ron/execution-update-on-demand
yrong Feb 6, 2024
7b5e1e3
Update lodestar & polkadot-sdk
yrong Feb 6, 2024
e8557c7
Merge branch 'main' into ron/execution-update-on-demand
yrong Mar 12, 2024
af93289
Check execution already exist before submit
yrong Mar 12, 2024
888ce4d
Update relayer/cmd/generate_beacon_data.go
yrong Mar 12, 2024
5213ba8
Update relayer/relays/beacon/header/header.go
yrong Mar 12, 2024
ddf7e6a
Rename to OptionalExecutionHeader
yrong Mar 12, 2024
cd85cb9
Rename import alias
yrong Mar 12, 2024
03bdb5c
Improve logs
yrong Mar 12, 2024
ef8c27a
Fetch checkpoint on chain from history
yrong Mar 12, 2024
ab191f9
Remove LastExecutionHeaderState & Remove execution header from update
yrong Mar 13, 2024
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
Prev Previous commit
Next Next commit
For deneb(4)
  • Loading branch information
yrong committed Dec 5, 2023
commit 99c0304de409a9f3303292c5b1b2d041d77197f2
4 changes: 3 additions & 1 deletion parachain/pallets/ethereum-beacon-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,9 @@ pub mod pallet {

/// Returns the fork version based on the current epoch.
pub(super) fn select_fork_version(fork_versions: &ForkVersions, epoch: u64) -> ForkVersion {
if epoch >= fork_versions.deneb.epoch {
return fork_versions.deneb.version
}
if epoch >= fork_versions.capella.epoch {
return fork_versions.capella.version
}
Expand All @@ -797,7 +800,6 @@ pub mod pallet {
if epoch >= fork_versions.altair.epoch {
return fork_versions.altair.version
}

fork_versions.genesis.version
}

Expand Down
1 change: 1 addition & 0 deletions parachain/primitives/beacon/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub struct ForkVersions {
pub altair: Fork,
pub bellatrix: Fork,
pub capella: Fork,
pub deneb: Fork,
}

#[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug, TypeInfo)]
Expand Down
104 changes: 104 additions & 0 deletions relayer/relays/beacon/header/syncer/api/api_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,16 @@ func (b BeaconBlockResponse) ToFastSSZ(activeSpec config.ActiveSpec, isDeneb boo
return nil, err
}

blobGasUsed, err := util.ToUint64(executionPayload.BlobGasUsed)
if err != nil {
return nil, err
}

excessBlobGas, err := util.ToUint64(executionPayload.ExcessBlobGas)
if err != nil {
return nil, err
}

syncCommitteeBits, err := util.HexStringToByteArray(body.SyncAggregate.SyncCommitteeBits)
if err != nil {
return nil, err
Expand Down Expand Up @@ -677,6 +687,53 @@ func (b BeaconBlockResponse) ToFastSSZ(activeSpec config.ActiveSpec, isDeneb boo
}

if activeSpec == config.Minimal {
if isDeneb {
return &state.BeaconBlockDenebMinimal{
Slot: slot,
ProposerIndex: proposerIndex,
ParentRoot: parentRoot,
StateRoot: stateRoot,
Body: &state.BeaconBlockBodyDenebMinimal{
RandaoReveal: randaoReveal,
Eth1Data: &state.Eth1Data{
DepositRoot: eth1DepositRoot,
DepositCount: eth1DepositCount,
BlockHash: eth1BlockHash,
},
Graffiti: graffiti,
ProposerSlashings: proposerSlashings,
AttesterSlashings: attesterSlashings,
Attestations: attestations,
Deposits: deposits,
VoluntaryExits: voluntaryExits,
SyncAggregate: &state.SyncAggregateMinimal{
SyncCommitteeBits: syncCommitteeBits,
SyncCommitteeSignature: syncCommitteeSignature,
},
ExecutionPayload: &state.ExecutionPayloadDeneb{
ParentHash: parentHash,
FeeRecipient: feeRecipient,
StateRoot: executionStateRoot,
ReceiptsRoot: receiptsRoot,
LogsBloom: logsBloom,
PrevRandao: prevRando,
BlockNumber: blockNumber,
GasLimit: gasLimit,
GasUsed: gasUsed,
Timestamp: timestamp,
ExtraData: extraData,
BaseFeePerGas: baseFeePerGasBytes,
BlockHash: blockHash,
Transactions: transactions,
Withdrawals: withdrawals,
BlobGasUsed: blobGasUsed, // new for Deneb
ExcessBlobGas: excessBlobGas, // new for Deneb
},
BlsToExecutionChanges: blsExecutionChanges,
BlobKzgCommitments: kzgCommitments, // new for Deneb
},
}, nil
}
return &state.BeaconBlockCapellaMinimal{
Slot: slot,
ProposerIndex: proposerIndex,
Expand Down Expand Up @@ -720,6 +777,53 @@ func (b BeaconBlockResponse) ToFastSSZ(activeSpec config.ActiveSpec, isDeneb boo
},
}, nil
} else {
if isDeneb {
return &state.BeaconBlockDenebMainnet{
Slot: slot,
ProposerIndex: proposerIndex,
ParentRoot: parentRoot,
StateRoot: stateRoot,
Body: &state.BeaconBlockBodyDenebMainnet{
RandaoReveal: randaoReveal,
Eth1Data: &state.Eth1Data{
DepositRoot: eth1DepositRoot,
DepositCount: eth1DepositCount,
BlockHash: eth1BlockHash,
},
Graffiti: graffiti,
ProposerSlashings: proposerSlashings,
AttesterSlashings: attesterSlashings,
Attestations: attestations,
Deposits: deposits,
VoluntaryExits: voluntaryExits,
SyncAggregate: &state.SyncAggregateMainnet{
SyncCommitteeBits: syncCommitteeBits,
SyncCommitteeSignature: syncCommitteeSignature,
},
ExecutionPayload: &state.ExecutionPayloadDeneb{
ParentHash: parentHash,
FeeRecipient: feeRecipient,
StateRoot: executionStateRoot,
ReceiptsRoot: receiptsRoot,
LogsBloom: logsBloom,
PrevRandao: prevRando,
BlockNumber: blockNumber,
GasLimit: gasLimit,
GasUsed: gasUsed,
Timestamp: timestamp,
ExtraData: extraData,
BaseFeePerGas: baseFeePerGasBytes,
BlockHash: blockHash,
Transactions: transactions,
Withdrawals: withdrawals,
BlobGasUsed: blobGasUsed, // new for Deneb
ExcessBlobGas: excessBlobGas, // new for Deneb
},
BlsToExecutionChanges: blsExecutionChanges,
BlobKzgCommitments: kzgCommitments, // new for Deneb
},
}, nil
}
return &state.BeaconBlockCapellaMainnet{
Slot: slot,
ProposerIndex: proposerIndex,
Expand Down
16 changes: 14 additions & 2 deletions relayer/relays/beacon/header/syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,25 @@ func (s *Syncer) GetBlockRoots(slot uint64) (scale.BlockRootProof, error) {
var blockRootsContainer state.BlockRootsContainer

data, err := s.Client.DownloadBeaconState(strconv.FormatUint(slot, 10))
if err != nil {
return blockRootProof, fmt.Errorf("download beacon state failed: %w", err)
}
isDeneb := s.DenebForked(slot)

if s.activeSpec == config.Minimal {
blockRootsContainer = &state.BlockRootsContainerMinimal{}
beaconState = &state.BeaconStateCapellaMinimal{}
if isDeneb {
beaconState = &state.BeaconStateDenebMinimal{}
} else {
beaconState = &state.BeaconStateCapellaMinimal{}
}
} else {
blockRootsContainer = &state.BlockRootsContainerMainnet{}
beaconState = &state.BeaconStateCapellaMainnet{}
if isDeneb {
beaconState = &state.BeaconStateDenebMainnet{}
} else {
beaconState = &state.BeaconStateCapellaMainnet{}
}
}

err = beaconState.UnmarshalSSZ(data)
Expand Down
32 changes: 16 additions & 16 deletions relayer/relays/beacon/state/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,6 @@ func (b *BeaconBlockCapellaMinimal) GetBeaconSlot() uint64 {
return b.Slot
}

func (b *BeaconBlockCapellaMinimal) CapallaExecutionPayload() *ExecutionPayloadCapella {
return b.Body.ExecutionPayload
}

func (b *BeaconBlockCapellaMinimal) DenebExecutionPayload() *ExecutionPayloadDeneb {
return nil
}

func (b *BeaconBlockCapellaMinimal) GetBlockBodyTree() (*ssz.Node, error) {
return b.Body.GetTree()
}
Expand All @@ -383,14 +375,6 @@ func (b *BeaconBlockCapellaMainnet) GetBeaconSlot() uint64 {
return b.Slot
}

func (b *BeaconBlockCapellaMainnet) CapallaExecutionPayload() *ExecutionPayloadCapella {
return b.Body.ExecutionPayload
}

func (b *BeaconBlockCapellaMainnet) DenebExecutionPayload() *ExecutionPayloadDeneb {
return nil
}

func (b *BeaconBlockCapellaMainnet) GetBlockBodyTree() (*ssz.Node, error) {
return b.Body.GetTree()
}
Expand Down Expand Up @@ -422,3 +406,19 @@ func (b *BeaconStateCapellaMainnet) GetBlockRoots() [][]byte {
func (b *BeaconStateCapellaMainnet) SetBlockRoots(blockRoots [][]byte) {
b.BlockRoots = blockRoots
}

func (b *BeaconBlockCapellaMainnet) CapallaExecutionPayload() *ExecutionPayloadCapella {
return b.Body.ExecutionPayload
}

func (b *BeaconBlockCapellaMainnet) DenebExecutionPayload() *ExecutionPayloadDeneb {
return nil
}

func (b *BeaconBlockCapellaMinimal) CapallaExecutionPayload() *ExecutionPayloadCapella {
return b.Body.ExecutionPayload
}

func (b *BeaconBlockCapellaMinimal) DenebExecutionPayload() *ExecutionPayloadDeneb {
return nil
}
36 changes: 18 additions & 18 deletions relayer/relays/beacon/state/beacon_deneb.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type BeaconBlockBodyDenebMinimal struct {
SyncAggregate *SyncAggregateMinimal `json:"sync_aggregate"`
ExecutionPayload *ExecutionPayloadDeneb `json:"execution_payload"`
BlsToExecutionChanges []*SignedBLSToExecutionChange `json:"bls_to_execution_changes,omitempty" ssz-max:"16"`
BlobKzgCommitments [][]byte `json:"blob_kzg_commitments,omitempty" ssz-max:"16" ssz-size:"?,48"`
BlobKzgCommitments [][48]byte `json:"blob_kzg_commitments,omitempty" ssz-max:"16" ssz-size:"?,48"`
}

type BeaconBlockBodyDenebMainnet struct {
Expand All @@ -87,7 +87,7 @@ type BeaconBlockBodyDenebMainnet struct {
SyncAggregate *SyncAggregateMainnet `json:"sync_aggregate"`
ExecutionPayload *ExecutionPayloadDeneb `json:"execution_payload"`
BlsToExecutionChanges []*SignedBLSToExecutionChange `json:"bls_to_execution_changes,omitempty" ssz-max:"16"`
BlobKzgCommitments [][]byte `json:"blob_kzg_commitments,omitempty" ssz-max:"4096" ssz-size:"?,48"`
BlobKzgCommitments [][48]byte `json:"blob_kzg_commitments,omitempty" ssz-max:"4096" ssz-size:"?,48"`
}

type BeaconStateDenebMainnet struct {
Expand Down Expand Up @@ -156,14 +156,6 @@ func (b *BeaconBlockDenebMinimal) GetBeaconSlot() uint64 {
return b.Slot
}

func (b *BeaconBlockDenebMinimal) DenebExecutionPayload() *ExecutionPayloadDeneb {
return b.Body.ExecutionPayload
}

func (b *BeaconBlockDenebMinimal) CapellaExecutionPayload() *ExecutionPayloadCapella {
return nil
}

func (b *BeaconBlockDenebMinimal) GetBlockBodyTree() (*ssz.Node, error) {
return b.Body.GetTree()
}
Expand All @@ -172,14 +164,6 @@ func (b *BeaconBlockDenebMainnet) GetBeaconSlot() uint64 {
return b.Slot
}

func (b *BeaconBlockDenebMainnet) DenebExecutionPayload() *ExecutionPayloadDeneb {
return b.Body.ExecutionPayload
}

func (b *BeaconBlockDenebMainnet) CapellaExecutionPayload() *ExecutionPayloadCapella {
return nil
}

func (b *BeaconBlockDenebMainnet) GetBlockBodyTree() (*ssz.Node, error) {
return b.Body.GetTree()
}
Expand Down Expand Up @@ -211,3 +195,19 @@ func (b *BeaconStateDenebMainnet) GetBlockRoots() [][]byte {
func (b *BeaconStateDenebMainnet) SetBlockRoots(blockRoots [][]byte) {
b.BlockRoots = blockRoots
}

func (b *BeaconBlockDenebMainnet) CapallaExecutionPayload() *ExecutionPayloadCapella {
return nil
}

func (b *BeaconBlockDenebMainnet) DenebExecutionPayload() *ExecutionPayloadDeneb {
return b.Body.ExecutionPayload
}

func (b *BeaconBlockDenebMinimal) CapallaExecutionPayload() *ExecutionPayloadCapella {
return nil
}

func (b *BeaconBlockDenebMinimal) DenebExecutionPayload() *ExecutionPayloadDeneb {
return b.Body.ExecutionPayload
}
40 changes: 9 additions & 31 deletions relayer/relays/beacon/state/beacon_deneb_encoding.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion relayer/relays/beacon/state/beacon_encoding.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.