Skip to content

Commit

Permalink
Update according to comments. Revert ssz
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheusFranco99 committed Oct 10, 2023
1 parent b2bfaff commit 2132271
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 167 deletions.
21 changes: 1 addition & 20 deletions types/domain_type.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package types

import (
"crypto/sha256"

"github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/pkg/errors"
)
Expand Down Expand Up @@ -42,7 +40,7 @@ type ForkData struct {
// Epoch in which the fork happened
Epoch phase0.Epoch
// Domain for the new fork
Domain DomainType `ssz-size:"4"`
Domain DomainType
}

func (n NetworkID) Byte() byte {
Expand Down Expand Up @@ -88,23 +86,6 @@ func (d DomainType) GetNetworkID() NetworkID {
return NetworkID{d[2]}
}

func (f ForkData) GetRoot() ([]byte, error) {
byts, err := f.MarshalSSZ()
if err != nil {
return nil, errors.Wrap(err, "could not marshal ForkData")
}
ret := sha256.Sum256(byts)
return ret[:], nil
}

func (f *ForkData) Encode() ([]byte, error) {
return f.MarshalSSZ()
}

func (f *ForkData) Decode(data []byte) error {
return f.UnmarshalSSZ(data)
}

// mainnetForks returns all forks for the mainnet chain
func mainnetForks() []*ForkData {
return []*ForkData{
Expand Down
74 changes: 0 additions & 74 deletions types/domain_type_encoding.go

This file was deleted.

3 changes: 0 additions & 3 deletions types/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,3 @@ package types

//go:generate rm -f ./consensus_data_encoding.go
//go:generate go run github.com/ferranbt/fastssz/sszgen --path consensus_data.go --include ./operator.go,./signer.go,./partial_sig_message.go,./beacon_types.go,$GOPATH/pkg/mod/github.com/attestantio/go-eth2-client@v0.16.3/spec/phase0,$GOPATH/pkg/mod/github.com/attestantio/go-eth2-client@v0.16.3/spec,$GOPATH/pkg/mod/github.com/attestantio/go-eth2-client@v0.16.3/spec/altair --exclude-objs Contributions,BeaconNetwork,BeaconRole

//go:generate rm -f ./domain_type_encoding.go
//go:generate go run github.com/ferranbt/fastssz/sszgen --path domain_type.go --include $GOPATH/pkg/mod/github.com/attestantio/go-eth2-client@v0.16.3/spec/phase0 --exclude-objs NetworkID,DomainType
3 changes: 0 additions & 3 deletions types/spectest/all_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/bloxapp/ssv-spec/types/spectest/tests/beacon"
"github.com/bloxapp/ssv-spec/types/spectest/tests/consensusdata"
consensusdataproposer "github.com/bloxapp/ssv-spec/types/spectest/tests/consensusdata/proposer"
"github.com/bloxapp/ssv-spec/types/spectest/tests/forkdata"
"github.com/bloxapp/ssv-spec/types/spectest/tests/ssz"

"github.com/bloxapp/ssv-spec/types/spectest/tests/encryption"
Expand Down Expand Up @@ -65,6 +64,4 @@ var AllTests = []SpecTest{
ssz.SSZWithdrawalsMarshaling(),

beacon.DepositData(),

forkdata.Encoding(),
}
2 changes: 1 addition & 1 deletion types/spectest/generate/tests.json

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions types/spectest/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/bloxapp/ssv-spec/types/spectest/tests/consensusdata"
consensusdataproposer "github.com/bloxapp/ssv-spec/types/spectest/tests/consensusdata/proposer"
"github.com/bloxapp/ssv-spec/types/spectest/tests/encryption"
"github.com/bloxapp/ssv-spec/types/spectest/tests/forkdata"
"github.com/bloxapp/ssv-spec/types/spectest/tests/partialsigmessage"
"github.com/bloxapp/ssv-spec/types/spectest/tests/share"
"github.com/bloxapp/ssv-spec/types/spectest/tests/ssvmsg"
Expand Down Expand Up @@ -97,12 +96,6 @@ func TestJson(t *testing.T) {
typedTest := &beacon.DepositDataSpecTest{}
require.NoError(t, json.Unmarshal(byts, &typedTest))
typedTest.Run(t)
case reflect.TypeOf(&forkdata.EncodingTest{}).String():
byts, err := json.Marshal(test)
require.NoError(t, err)
typedTest := &forkdata.EncodingTest{}
require.NoError(t, json.Unmarshal(byts, &typedTest))
typedTest.Run(t)
default:
t.Fatalf("unknown test")
}
Expand Down
25 changes: 0 additions & 25 deletions types/spectest/tests/forkdata/encoding.go

This file was deleted.

34 changes: 0 additions & 34 deletions types/spectest/tests/forkdata/test_encoding.go

This file was deleted.

0 comments on commit 2132271

Please sign in to comment.