Skip to content

Commit

Permalink
Merge pull request #37 from gballet/verkle-support
Browse files Browse the repository at this point in the history
Initial verkle fork support
  • Loading branch information
pk910 authored Apr 8, 2024
2 parents a8597e0 + b71aec4 commit 41f63fe
Show file tree
Hide file tree
Showing 10 changed files with 171 additions and 3 deletions.
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@ require (
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.21.5 // indirect
github.com/aws/smithy-go v1.14.2 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/fatih/color v1.10.0 // indirect
github.com/ferranbt/fastssz v0.1.3 // indirect
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/goccy/go-yaml v1.9.2 // indirect
Expand All @@ -62,6 +67,7 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/r3labs/sse/v2 v2.10.0 // indirect
github.com/tdewolff/parse v2.3.4+incompatible // indirect
Expand All @@ -73,6 +79,7 @@ require (
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)

require (
Expand All @@ -91,3 +98,5 @@ require (
golang.org/x/crypto v0.10.0
golang.org/x/sys v0.12.0 // indirect
)

replace github.com/attestantio/go-eth2-client => github.com/pk910/go-eth2-client v0.0.0-20231217052657-39326b2b91a7
28 changes: 28 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.21.5 h1:CQBFElb0LS8RojMJlxRSo/HXipvT
github.com/aws/aws-sdk-go-v2/service/sts v1.21.5/go.mod h1:VC7JDqsqiwXukYEDjoHh9U0fOJtNWh04FPQz4ct4GGU=
github.com/aws/smithy-go v1.14.2 h1:MJU9hqBGbvWZdApzpvoF2WAIJDbtjK2NDJSiJP7HblQ=
github.com/aws/smithy-go v1.14.2/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHlV4j7NEo=
github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k=
Expand All @@ -58,11 +60,17 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ=
github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI=
github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M=
github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY=
github.com/coocood/freecache v1.2.3 h1:lcBwpZrwBZRZyLk/8EMyQVXRiFl663cCuMOrjCALeto=
github.com/coocood/freecache v1.2.3/go.mod h1:RBUWa/Cy+OHdfTGFEhEuE1pMCMX51Ncizj7rthiQ3vk=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUpz1KBmiF9bWrjEMacUEREV6MBi2ODnrfQ=
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand All @@ -82,6 +90,12 @@ github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGE
github.com/ferranbt/fastssz v0.1.3 h1:ZI+z3JH05h4kgmFXdHuR1aWYsgrg7o+Fw7/NCzM16Mo=
github.com/ferranbt/fastssz v0.1.3/go.mod h1:0Y9TEd/9XuFlh7mskMPfXiI2Dkw4Ddg9EyXt1W7MRvE=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/gballet/go-eth2-client v0.0.0-20231106105422-84cbc0dacfc0 h1:6C2KLeIxtsPBl+FO1mjCjdM1FguXptxRKY1XvD4oFfM=
github.com/gballet/go-eth2-client v0.0.0-20231106105422-84cbc0dacfc0/go.mod h1:TRKBwZwMKowNd/H6kPgf7EIZsLsWf0gO5qHzxU3fUuM=
github.com/gballet/go-eth2-client v0.0.0-20231121154023-5133912653e1 h1:RY4HMhzKAIT8VkWByJ83nPhagMHBT/0kyjAoDrqgFOo=
github.com/gballet/go-eth2-client v0.0.0-20231121154023-5133912653e1/go.mod h1:YKTloAuspHPDCFg8+jV14H1+UFoaDLqabb/C2hHg8Q4=
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE=
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
Expand Down Expand Up @@ -110,6 +124,7 @@ github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXi
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
Expand Down Expand Up @@ -221,9 +236,18 @@ github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo
github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY=
github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU=
github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
github.com/pk910/go-eth2-client v0.0.0-20231121142646-e2ec0cfcfb1a h1:eU6vVKVtSQ0QepEbon3yEACw6auCooOme/pT71JWHZ4=
github.com/pk910/go-eth2-client v0.0.0-20231121142646-e2ec0cfcfb1a/go.mod h1:YKTloAuspHPDCFg8+jV14H1+UFoaDLqabb/C2hHg8Q4=
github.com/pk910/go-eth2-client v0.0.0-20231123094450-58c09fc53504 h1:6869XCTP5R0xLRnETz7kByySbbUmJugM7JzLxorgOWg=
github.com/pk910/go-eth2-client v0.0.0-20231123094450-58c09fc53504/go.mod h1:YKTloAuspHPDCFg8+jV14H1+UFoaDLqabb/C2hHg8Q4=
github.com/pk910/go-eth2-client v0.0.0-20231217052657-39326b2b91a7 h1:JG2FFabNp3W1bmUbJeiAV4WPFuaNnVO4y4G9WXLsXPo=
github.com/pk910/go-eth2-client v0.0.0-20231217052657-39326b2b91a7/go.mod h1:YKTloAuspHPDCFg8+jV14H1+UFoaDLqabb/C2hHg8Q4=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down Expand Up @@ -327,6 +351,8 @@ golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -409,3 +435,5 @@ modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
modernc.org/sqlite v1.23.1 h1:nrSBg4aRQQwq59JpvGEQ15tNxoO5pX/kUjcRNwSAGQM=
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU=
rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA=
8 changes: 8 additions & 0 deletions handlers/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ func buildIndexPageData() (*models.IndexPageData, time.Duration) {
Active: uint64(currentEpoch) >= utils.Config.Chain.Config.DenebForkEpoch,
})
}
if utils.Config.Chain.Config.ElectraForkEpoch < uint64(18446744073709551615) && utils.Config.Chain.Config.ElectraForkVersion != "" {
pageData.NetworkForks = append(pageData.NetworkForks, &models.IndexPageDataForks{
Name: "Electra",
Epoch: utils.Config.Chain.Config.ElectraForkEpoch,
Version: utils.MustParseHex(utils.Config.Chain.Config.ElectraForkVersion),
Active: uint64(currentEpoch) >= utils.Config.Chain.Config.ElectraForkEpoch,
})
}

// load recent epochs
buildIndexPageRecentEpochsData(pageData, uint64(currentEpoch), finalizedEpoch, justifiedEpoch, recentEpochCount)
Expand Down
29 changes: 29 additions & 0 deletions handlers/slot.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func Slot(w http.ResponseWriter, r *http.Request) {
"slot/voluntary_exits.html",
"slot/slashings.html",
"slot/blobs.html",
"slot/stateless.html",
)
var notfoundTemplateFiles = append(layoutTemplateFiles,
"slot/notfound.html",
Expand Down Expand Up @@ -553,6 +554,34 @@ func getSlotPageBlockData(blockData *services.CombinedBlockResponse, assignments
BlockNumber: uint64(executionPayload.BlockNumber),
}
getSlotPageTransactions(pageData, executionPayload.Transactions)
case spec.DataVersionVerkle:
if blockData.Block.Verkle == nil {
break
}
executionPayload := blockData.Block.Verkle.Message.Body.ExecutionPayload
var baseFeePerGasBEBytes [32]byte
for i := 0; i < 32; i++ {
baseFeePerGasBEBytes[i] = executionPayload.BaseFeePerGas[32-1-i]
}
baseFeePerGas := new(big.Int).SetBytes(baseFeePerGasBEBytes[:])
pageData.ExecutionData = &models.SlotPageExecutionData{
ParentHash: executionPayload.ParentHash[:],
FeeRecipient: executionPayload.FeeRecipient[:],
StateRoot: executionPayload.StateRoot[:],
ReceiptsRoot: executionPayload.ReceiptsRoot[:],
LogsBloom: executionPayload.LogsBloom[:],
Random: executionPayload.PrevRandao[:],
GasLimit: uint64(executionPayload.GasLimit),
GasUsed: uint64(executionPayload.GasUsed),
Timestamp: uint64(executionPayload.Timestamp),
Time: time.Unix(int64(executionPayload.Timestamp), 0),
ExtraData: executionPayload.ExtraData,
BaseFeePerGas: baseFeePerGas.Uint64(),
BlockHash: executionPayload.BlockHash[:],
BlockNumber: uint64(executionPayload.BlockNumber),
}
pageData.ExecutionWitness = &models.SlotPageExecutionWitness{Witness: executionPayload.ExecutionWitness}
getSlotPageTransactions(pageData, executionPayload.Transactions)
}
}

Expand Down
17 changes: 17 additions & 0 deletions indexer/block_ssz.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/attestantio/go-eth2-client/spec/capella"
"github.com/attestantio/go-eth2-client/spec/deneb"
"github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/attestantio/go-eth2-client/spec/verkle"
"github.com/ethpandaops/dora/utils"
)

Expand Down Expand Up @@ -36,6 +37,9 @@ func MarshalVersionedSignedBeaconBlockSSZ(block *spec.VersionedSignedBeaconBlock
case spec.DataVersionDeneb:
version = uint64(block.Version)
ssz, err = block.Deneb.MarshalSSZ()
case spec.DataVersionVerkle:
version = uint64(block.Version)
ssz, err = block.Verkle.MarshalSSZ()
default:
err = fmt.Errorf("unknown block version")
}
Expand Down Expand Up @@ -75,6 +79,11 @@ func UnmarshalVersionedSignedBeaconBlockSSZ(version uint64, ssz []byte) (*spec.V
if err := block.Deneb.UnmarshalSSZ(ssz); err != nil {
return nil, fmt.Errorf("failed to decode deneb signed beacon block: %v", err)
}
case spec.DataVersionVerkle:
block.Verkle = &verkle.SignedBeaconBlock{}
if err := block.Verkle.UnmarshalSSZ(ssz); err != nil {
return nil, fmt.Errorf("failed to decode verkle signed beacon block: %v", err)
}
default:
return nil, fmt.Errorf("unknown block version")
}
Expand All @@ -98,6 +107,9 @@ func marshalVersionedSignedBeaconBlockJson(block *spec.VersionedSignedBeaconBloc
case spec.DataVersionDeneb:
version = uint64(block.Version) + jsonVersionOffset
jsonRes, err = block.Deneb.MarshalJSON()
case spec.DataVersionVerkle:
version = uint64(block.Version) + jsonVersionOffset
jsonRes, err = block.Verkle.MarshalJSON()
default:
err = fmt.Errorf("unknown block version")
}
Expand Down Expand Up @@ -137,6 +149,11 @@ func unmarshalVersionedSignedBeaconBlockJson(version uint64, ssz []byte) (*spec.
if err := block.Deneb.UnmarshalJSON(ssz); err != nil {
return nil, fmt.Errorf("failed to decode deneb signed beacon block: %v", err)
}
case spec.DataVersionVerkle:
block.Verkle = &verkle.SignedBeaconBlock{}
if err := block.Verkle.UnmarshalJSON(ssz); err != nil {
return nil, fmt.Errorf("failed to decode verkle signed beacon block: %v", err)
}
default:
return nil, fmt.Errorf("unknown block version")
}
Expand Down
3 changes: 3 additions & 0 deletions rpc/beaconapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ func (bc *BeaconClient) Initialize() error {
http.WithTimeout(10 * time.Minute),
// TODO (when upstream PR is merged)
//http.WithConnectionCheck(false),

// TODO Not good! Remove this before merging verkle-support!
http.WithEnforceJSON(true),
}

// set log level
Expand Down
26 changes: 25 additions & 1 deletion templates/slot/slot.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ <h1 class="h4 my-3 mb-md-0 h1-pager">
<a class="nav-link" id="blobSidecars-tab" data-bs-toggle="tab" href="#blobSidecars" role="tab" aria-controls="blobSidecars" aria-selected="false">Blob Sidecars <span class="badge bg-secondary text-white">{{ .Block.BlobsCount }}</span></a>
</li>
{{ end }}
{{ if .Block.ExecutionWitness }}
<li class="nav-item">
<a class="nav-link" id="deposits-tab" data-bs-toggle="tab" href="#stateless" role="tab" aria-controls="stateless" aria-selected="false">Stateless</a>
</li>
{{ end }}
{{ end }}
</ul>

Expand Down Expand Up @@ -195,7 +200,26 @@ <h3 class="h5 col-md-12 text-center"><b>Showing {{ .Block.BlobsCount }} Blob sid
{{ template "block_blobSidecar" . }}
</div>
{{ end }}

{{ if .Block.ExecutionWitness }}
<div class="tab-pane fade show active" id="stateless" role="tabpanel" aria-labelledby="stateless-tab">
<div class="card block-card">
<div style="margin-bottom: -.25rem;" class="card-body px-0 py-1">
<div class="row p-1 mx-0">
<h3 class="h5 col-md-12 text-center"><b>Showing Proven Locations</b></h3>
</div>
</div>
{{ template "block_execution_witness" . }}
</div>
<div class="card block-card">
<div style="margin-bottom: -.25rem;" class="card-body px-0 py-1">
<div class="row p-1 mx-0">
<h3 class="h5 col-md-12 text-center"><b>Reconstructed tree</b></h3>
</div>
</div>
{{ template "block_execution_pretree" . }}
</div>
</div>
{{ end }}
{{ end }}
</div>
<script type="text/javascript">
Expand Down
44 changes: 44 additions & 0 deletions templates/slot/stateless.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{ define "block_execution_witness" }}
<div class="table">
<table id="block_witness" class="table table-sm text-left">
<thead>
<tr>
<th class="border-0">Stem</th>
<th class="border-0">Suffix</th>
<th class="border-0">Current Value</th>
<th class="border-0">New Value</th>
</tr>
</thead>
<tbody style="word-break: break-all;">
{{ range $i, $statediff := .Block.ExecutionWitness.Witness.StateDiff }}
{{ range $j, $suffixdiff := $statediff.SuffixDiffs }}
<tr>
<td>{{ printf "%#x" $statediff.Stem }}</td>
<td>{{ printf "%#02x" $suffixdiff.Suffix }}</td>
<td>
{{ if $suffixdiff.CurrentValue }}
{{ printf "%#x" $suffixdiff.CurrentValue }}
{{ else }}
absent
{{ end }}
</td>
<td>
{{ if $suffixdiff.NewValue }}
{{ printf "%#x" $suffixdiff.NewValue }}
{{ else }}
unchanged
{{ end }}
</td>
</tr>
{{ end }}
{{ end }}
</tbody>
</table>
</div>
{{ end }}

{{ define "block_execution_pretree" }}
<div class="table">
{{ .Block.ExecutionWitness.Witness.VerkleProof }}
</div>
{{ end }}
4 changes: 2 additions & 2 deletions types/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ type ChainConfig struct {
CappellaForkEpoch uint64 `yaml:"CAPELLA_FORK_EPOCH"`
DenebForkVersion string `yaml:"DENEB_FORK_VERSION"`
DenebForkEpoch uint64 `yaml:"DENEB_FORK_EPOCH"`
ShardingForkVersion string `yaml:"SHARDING_FORK_VERSION"`
ShardingForkEpoch uint64 `yaml:"SHARDING_FORK_EPOCH"`
ElectraForkVersion string `yaml:"ELECTRA_FORK_VERSION"`
ElectraForkEpoch uint64 `yaml:"ELECTRA_FORK_EPOCH"`
SecondsPerSlot uint64 `yaml:"SECONDS_PER_SLOT"`
SecondsPerEth1Block uint64 `yaml:"SECONDS_PER_ETH1_BLOCK"`
MinValidatorWithdrawabilityDelay uint64 `yaml:"MIN_VALIDATOR_WITHDRAWABILITY_DELAY"`
Expand Down
6 changes: 6 additions & 0 deletions types/models/slot.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package models
import (
"time"

"github.com/attestantio/go-eth2-client/spec/verkle"
"github.com/ethpandaops/dora/types"
)

Expand Down Expand Up @@ -67,6 +68,7 @@ type SlotPageBlockData struct {
Withdrawals []*SlotPageWithdrawal `json:"withdrawals"` // Withdrawals included in this block
Blobs []*SlotPageBlob `json:"blobs"` // Blob sidecars included in this block
Transactions []*SlotPageTransaction `json:"transactions"` // Transactions included in this block
ExecutionWitness *SlotPageExecutionWitness `json:"executionWitness"`
}

type SlotPageExecutionData struct {
Expand Down Expand Up @@ -202,3 +204,7 @@ type SlotPageTransaction struct {
FuncSig string `json:"func_sig"`
Type uint64 `json:"type"`
}

type SlotPageExecutionWitness struct {
Witness *verkle.ExecutionWitness `json:"execution_witness"`
}

0 comments on commit 41f63fe

Please sign in to comment.