-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(server): Support cannon events (#181)
- Loading branch information
Showing
6 changed files
with
227 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...server/service/event-ingester/event/beacon/eth/v2/beacon_block_bls_to_execution_change.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package v2 | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
"github.com/ethpandaops/xatu/pkg/proto/xatu" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
const ( | ||
BeaconBlockBLSToExecutionChangeType = "BEACON_API_ETH_V2_BEACON_BLOCK_BLS_TO_EXECUTION_CHANGE" | ||
) | ||
|
||
type BeaconBlockBLSToExecutionChange struct { | ||
log logrus.FieldLogger | ||
event *xatu.DecoratedEvent | ||
} | ||
|
||
func NewBeaconBlockBLSToExecutionChange(log logrus.FieldLogger, event *xatu.DecoratedEvent) *BeaconBlockBLSToExecutionChange { | ||
return &BeaconBlockBLSToExecutionChange{ | ||
log: log.WithField("event", BeaconBlockBLSToExecutionChangeType), | ||
event: event, | ||
} | ||
} | ||
|
||
func (b *BeaconBlockBLSToExecutionChange) Type() string { | ||
return BeaconBlockBLSToExecutionChangeType | ||
} | ||
|
||
func (b *BeaconBlockBLSToExecutionChange) Validate(ctx context.Context) error { | ||
_, ok := b.event.Data.(*xatu.DecoratedEvent_EthV2BeaconBlockBlsToExecutionChange) | ||
if !ok { | ||
return errors.New("failed to cast event data") | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (b *BeaconBlockBLSToExecutionChange) Filter(ctx context.Context) bool { | ||
return false | ||
} |
42 changes: 42 additions & 0 deletions
42
pkg/server/service/event-ingester/event/beacon/eth/v2/beacon_block_deposit.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package v2 | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
"github.com/ethpandaops/xatu/pkg/proto/xatu" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
const ( | ||
BeaconBlockDepositType = "BEACON_API_ETH_V2_BEACON_BLOCK_DEPOSIT" | ||
) | ||
|
||
type BeaconBlockDeposit struct { | ||
log logrus.FieldLogger | ||
event *xatu.DecoratedEvent | ||
} | ||
|
||
func NewBeaconBlockDeposit(log logrus.FieldLogger, event *xatu.DecoratedEvent) *BeaconBlockDeposit { | ||
return &BeaconBlockDeposit{ | ||
log: log.WithField("event", BeaconBlockDepositType), | ||
event: event, | ||
} | ||
} | ||
|
||
func (b *BeaconBlockDeposit) Type() string { | ||
return BeaconBlockDepositType | ||
} | ||
|
||
func (b *BeaconBlockDeposit) Validate(ctx context.Context) error { | ||
_, ok := b.event.Data.(*xatu.DecoratedEvent_EthV2BeaconBlockDeposit) | ||
if !ok { | ||
return errors.New("failed to cast event data") | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (b *BeaconBlockDeposit) Filter(ctx context.Context) bool { | ||
return false | ||
} |
42 changes: 42 additions & 0 deletions
42
pkg/server/service/event-ingester/event/beacon/eth/v2/beacon_block_execution_transaction.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package v2 | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
"github.com/ethpandaops/xatu/pkg/proto/xatu" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
const ( | ||
BeaconBlockExecutionTransactionType = "BEACON_API_ETH_V2_BEACON_BLOCK_EXECUTION_TRANSACTION" | ||
) | ||
|
||
type BeaconBlockExecutionTransaction struct { | ||
log logrus.FieldLogger | ||
event *xatu.DecoratedEvent | ||
} | ||
|
||
func NewBeaconBlockExecutionTransaction(log logrus.FieldLogger, event *xatu.DecoratedEvent) *BeaconBlockExecutionTransaction { | ||
return &BeaconBlockExecutionTransaction{ | ||
log: log.WithField("event", BeaconBlockExecutionTransactionType), | ||
event: event, | ||
} | ||
} | ||
|
||
func (b *BeaconBlockExecutionTransaction) Type() string { | ||
return BeaconBlockExecutionTransactionType | ||
} | ||
|
||
func (b *BeaconBlockExecutionTransaction) Validate(ctx context.Context) error { | ||
_, ok := b.event.Data.(*xatu.DecoratedEvent_EthV2BeaconBlockExecutionTransaction) | ||
if !ok { | ||
return errors.New("failed to cast event data") | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (b *BeaconBlockExecutionTransaction) Filter(ctx context.Context) bool { | ||
return false | ||
} |
42 changes: 42 additions & 0 deletions
42
pkg/server/service/event-ingester/event/beacon/eth/v2/beacon_block_proposer_slashing.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package v2 | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
"github.com/ethpandaops/xatu/pkg/proto/xatu" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
const ( | ||
BeaconBlockProposerSlashingType = "BEACON_API_ETH_V2_BEACON_BLOCK_PROPOSER_SLASHING" | ||
) | ||
|
||
type BeaconBlockProposerSlashing struct { | ||
log logrus.FieldLogger | ||
event *xatu.DecoratedEvent | ||
} | ||
|
||
func NewBeaconBlockProposerSlashing(log logrus.FieldLogger, event *xatu.DecoratedEvent) *BeaconBlockProposerSlashing { | ||
return &BeaconBlockProposerSlashing{ | ||
log: log.WithField("event", BeaconBlockProposerSlashingType), | ||
event: event, | ||
} | ||
} | ||
|
||
func (b *BeaconBlockProposerSlashing) Type() string { | ||
return BeaconBlockProposerSlashingType | ||
} | ||
|
||
func (b *BeaconBlockProposerSlashing) Validate(ctx context.Context) error { | ||
_, ok := b.event.Data.(*xatu.DecoratedEvent_EthV2BeaconBlockProposerSlashing) | ||
if !ok { | ||
return errors.New("failed to cast event data") | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (b *BeaconBlockProposerSlashing) Filter(ctx context.Context) bool { | ||
return false | ||
} |
42 changes: 42 additions & 0 deletions
42
pkg/server/service/event-ingester/event/beacon/eth/v2/beacon_block_voluntary_exit.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package v2 | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
"github.com/ethpandaops/xatu/pkg/proto/xatu" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
const ( | ||
BeaconBlockVoluntaryExitType = "BEACON_API_ETH_V2_BEACON_BLOCK_VOLUNTARY_EXIT" | ||
) | ||
|
||
type BeaconBlockVoluntaryExit struct { | ||
log logrus.FieldLogger | ||
event *xatu.DecoratedEvent | ||
} | ||
|
||
func NewBeaconBlockVoluntaryExit(log logrus.FieldLogger, event *xatu.DecoratedEvent) *BeaconBlockVoluntaryExit { | ||
return &BeaconBlockVoluntaryExit{ | ||
log: log.WithField("event", BeaconBlockVoluntaryExitType), | ||
event: event, | ||
} | ||
} | ||
|
||
func (b *BeaconBlockVoluntaryExit) Type() string { | ||
return BeaconBlockVoluntaryExitType | ||
} | ||
|
||
func (b *BeaconBlockVoluntaryExit) Validate(ctx context.Context) error { | ||
_, ok := b.event.Data.(*xatu.DecoratedEvent_EthV2BeaconBlockVoluntaryExit) | ||
if !ok { | ||
return errors.New("failed to cast event data") | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (b *BeaconBlockVoluntaryExit) Filter(ctx context.Context) bool { | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters