eth2.0-specs/test_libs/pyspec/eth2spec/test/helpers/voluntary_exits.py

11 lines
376 B
Python
Raw Normal View History

2019-12-20 06:41:46 +00:00
from eth2spec.utils import bls
2019-05-15 17:31:02 +00:00
2019-05-30 20:57:18 +00:00
def sign_voluntary_exit(spec, state, voluntary_exit, privkey):
2019-12-17 10:04:56 +00:00
domain = spec.get_domain(state, spec.DOMAIN_VOLUNTARY_EXIT, voluntary_exit.epoch)
2020-01-07 12:07:09 +00:00
signing_root = spec.compute_signing_root(voluntary_exit, domain)
2019-11-21 22:13:45 +00:00
return spec.SignedVoluntaryExit(
message=voluntary_exit,
2020-01-07 12:07:09 +00:00
signature=bls.Sign(privkey, signing_root)
2019-05-15 16:36:32 +00:00
)