Skip to content

Commit 7987d41

Browse files
committed
fulu block types
1 parent d50cead commit 7987d41

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

oracle/block.go

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ func (b *FullBlock) SetConsensusBlock(consensusBlock *spec.VersionedSignedBeacon
107107
proposerIndex = uint64(consensusBlock.Deneb.Message.ProposerIndex)
108108
} else if consensusBlock.Electra != nil {
109109
proposerIndex = uint64(consensusBlock.Electra.Message.ProposerIndex)
110+
} else if consensusBlock.Fulu != nil {
111+
proposerIndex = uint64(consensusBlock.Fulu.Message.ProposerIndex)
110112
} else {
111113
log.Fatal("Block was empty, cant get proposer index")
112114
}
@@ -658,6 +660,8 @@ func (b *FullBlock) GetFeeRecipient() string {
658660
feeRecipient = b.ConsensusBlock.Deneb.Message.Body.ExecutionPayload.FeeRecipient.String()
659661
} else if b.ConsensusBlock.Electra != nil {
660662
feeRecipient = b.ConsensusBlock.Electra.Message.Body.ExecutionPayload.FeeRecipient.String()
663+
} else if b.ConsensusBlock.Fulu != nil {
664+
feeRecipient = b.ConsensusBlock.Fulu.Message.Body.ExecutionPayload.FeeRecipient.String()
661665
} else {
662666
log.Fatal("Block was empty, cant get fee recipient")
663667
}
@@ -678,6 +682,8 @@ func (b *FullBlock) GetBlockTransactions() []bellatrix.Transaction {
678682
transactions = b.ConsensusBlock.Deneb.Message.Body.ExecutionPayload.Transactions
679683
} else if b.ConsensusBlock.Electra != nil {
680684
transactions = b.ConsensusBlock.Electra.Message.Body.ExecutionPayload.Transactions
685+
} else if b.ConsensusBlock.Fulu != nil {
686+
transactions = b.ConsensusBlock.Fulu.Message.Body.ExecutionPayload.Transactions
681687
} else {
682688
log.Fatal("Block was empty, cant get transactions")
683689
}
@@ -698,6 +704,8 @@ func (b *FullBlock) GetBlockNumber() uint64 {
698704
blockNumber = b.ConsensusBlock.Deneb.Message.Body.ExecutionPayload.BlockNumber
699705
} else if b.ConsensusBlock.Electra != nil {
700706
blockNumber = b.ConsensusBlock.Electra.Message.Body.ExecutionPayload.BlockNumber
707+
} else if b.ConsensusBlock.Fulu != nil {
708+
blockNumber = b.ConsensusBlock.Fulu.Message.Body.ExecutionPayload.BlockNumber
701709
} else {
702710
log.Fatal("Block was empty, cant get block number")
703711
}
@@ -723,6 +731,8 @@ func (b *FullBlock) GetSlot() phase0.Slot {
723731
slot = b.ConsensusBlock.Deneb.Message.Slot
724732
} else if b.ConsensusBlock.Electra != nil {
725733
slot = b.ConsensusBlock.Electra.Message.Slot
734+
} else if b.ConsensusBlock.Fulu != nil {
735+
slot = b.ConsensusBlock.Fulu.Message.Slot
726736
} else {
727737
log.Fatal("Block was empty, cant get slot")
728738
}
@@ -747,6 +757,8 @@ func (b *FullBlock) GetProposerIndex() phase0.ValidatorIndex {
747757
proposerIndex = b.ConsensusBlock.Deneb.Message.ProposerIndex
748758
} else if b.ConsensusBlock.Electra != nil {
749759
proposerIndex = b.ConsensusBlock.Electra.Message.ProposerIndex
760+
} else if b.ConsensusBlock.Fulu != nil {
761+
proposerIndex = b.ConsensusBlock.Fulu.Message.ProposerIndex
750762
} else {
751763
log.Fatal("Block was empty, cant get proposer index")
752764
}
@@ -771,6 +783,8 @@ func (b *FullBlock) GetGasUsed() uint64 {
771783
gasUsed = b.ConsensusBlock.Deneb.Message.Body.ExecutionPayload.GasUsed
772784
} else if b.ConsensusBlock.Electra != nil {
773785
gasUsed = b.ConsensusBlock.Electra.Message.Body.ExecutionPayload.GasUsed
786+
} else if b.ConsensusBlock.Fulu != nil {
787+
gasUsed = b.ConsensusBlock.Fulu.Message.Body.ExecutionPayload.GasUsed
774788
} else {
775789
log.Fatal("Block was empty, cant get gas used")
776790
}
@@ -799,12 +813,13 @@ func (b *FullBlock) GetBaseFeePerGas() [32]byte {
799813
}
800814

801815
} else if b.ConsensusBlock.Electra != nil {
802-
// Due to this change: https://github.com/attestantio/go-eth2-client/commit/acadd726168dac047ab3b13b4aceaf2a6103dab5
803-
// the base fee is no longer stored as a [32]byte little endian, but as a big endian. To avoid considering is as an special
804-
// case, we convert it to little endian, so that the interface is respected.
805816
baseFeePerGasBigEndian := b.ConsensusBlock.Electra.Message.Body.ExecutionPayload.BaseFeePerGas.Bytes32()
817+
for i := 0; i < 32; i++ {
818+
baseFeePerGas[i] = baseFeePerGasBigEndian[32-1-i]
819+
}
806820

807-
// big-endian to little-endian
821+
} else if b.ConsensusBlock.Fulu != nil {
822+
baseFeePerGasBigEndian := b.ConsensusBlock.Fulu.Message.Body.ExecutionPayload.BaseFeePerGas.Bytes32()
808823
for i := 0; i < 32; i++ {
809824
baseFeePerGas[i] = baseFeePerGasBigEndian[32-1-i]
810825
}

0 commit comments

Comments
 (0)