2021-09-21 18:11:16 +00:00
|
|
|
package slashings
|
2021-01-11 23:59:17 +00:00
|
|
|
|
2024-02-15 05:46:47 +00:00
|
|
|
import ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
2021-01-11 23:59:17 +00:00
|
|
|
|
|
|
|
// IsSurround checks if an attestation, a, is surrounding
|
2021-06-26 19:00:33 +00:00
|
|
|
// another one, b, based on the Ethereum slashing conditions specified
|
2021-01-11 23:59:17 +00:00
|
|
|
// by @protolambda https://github.com/protolambda/eth2-surround#definition.
|
|
|
|
//
|
2022-11-03 16:55:44 +00:00
|
|
|
// s: source
|
|
|
|
// t: target
|
2021-01-11 23:59:17 +00:00
|
|
|
//
|
2022-11-03 16:55:44 +00:00
|
|
|
// a surrounds b if: s_a < s_b and t_b < t_a
|
2021-01-11 23:59:17 +00:00
|
|
|
func IsSurround(a, b *ethpb.IndexedAttestation) bool {
|
|
|
|
return a.Data.Source.Epoch < b.Data.Source.Epoch && b.Data.Target.Epoch < a.Data.Target.Epoch
|
|
|
|
}
|