diff --git a/go.mod b/go.mod index 6c5067c0..03eb421c 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ module github.com/eigerco/strawberry go 1.22.5 + +require github.com/ChainSafe/gossamer v0.9.0 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..4a31549e --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/ChainSafe/gossamer v0.9.0 h1:Xj2oRO+5JFIpE3qkC9L8pyR1fxTPv5fTGwvvD2BnmQQ= +github.com/ChainSafe/gossamer v0.9.0/go.mod h1:V/ePNNEpATpoP8IS65suyVT05waGwQT/EtyhMhqOTKk= diff --git a/internal/safrole/safrole.go b/internal/safrole/safrole.go new file mode 100644 index 00000000..971fa807 --- /dev/null +++ b/internal/safrole/safrole.go @@ -0,0 +1,270 @@ +package safrole + +import ( + "encoding/hex" + "encoding/json" + "fmt" + "github.com/ChainSafe/gossamer/pkg/scale" +) + +const ( + validatorsCount = 6 // 1023 on full test vectors + epochLength = 12 // 600 on full test vectors + + // Custom error codes as defined here https://github.com/w3f/jamtestvectors/blob/master/safrole/safrole.asn#L30 + + BadSlot CustomErrorCode = 0 // Timeslot value must be strictly monotonic. + UnexpectedTicket CustomErrorCode = 1 // Received a ticket while in epoch's tail. + BadTicketOrder CustomErrorCode = 2 // Tickets must be sorted. + BadTicketProof CustomErrorCode = 3 // Invalid ticket ring proof. + BadTicketAttempt CustomErrorCode = 4 // Invalid ticket attempt value. + Reserved CustomErrorCode = 5 // Reserved + DuplicateTicket CustomErrorCode = 6 // Found a ticket duplicate. +) + +var errorCodeMessages = map[CustomErrorCode]string{ + BadSlot: "bad_slot", + UnexpectedTicket: "unexpected_ticket", + BadTicketOrder: "bad_ticket_order", + BadTicketProof: "bad_ticket_proof", + BadTicketAttempt: "bad_ticket_attempt", + Reserved: "reserved", + DuplicateTicket: "duplicate_ticket", +} + +type OpaqueHash [32]byte +type Ed25519Key [32]uint8 +type BlsKey [144]uint8 +type BandersnatchKey [32]uint8 +type MetadataKey [128]uint8 +type GammaZ [144]uint8 + +type EpochKeys [epochLength]BandersnatchKey +type TicketsBodies [epochLength]TicketBody + +type Safrole struct { + Input Input `json:"input"` + PreState State `json:"pre_state"` + Output OutputOrError `json:"output"` + PostState State `json:"post_state"` +} + +type Input struct { + Slot uint32 `json:"slot"` + Entropy OpaqueHash `json:"entropy"` + Extrinsic []TicketEnvelope `json:"extrinsic"` +} + +type ValidatorData struct { + Bandersnatch BandersnatchKey `json:"bandersnatch"` + Ed25519 Ed25519Key `json:"ed25519"` + Bls BlsKey `json:"bls"` + Metadata MetadataKey `json:"metadata"` +} +type ValidatorsData [validatorsCount]ValidatorData + +type EpochMark struct { + Entropy OpaqueHash + Validators [validatorsCount]BandersnatchKey +} + +type TicketsMark [epochLength]TicketBody + +type OutputMarks struct { + EpochMark *EpochMark `json:"epoch_mark"` + TicketsMark *TicketsMark `json:"tickets_mark"` +} + +type CustomErrorCode int + +type State struct { + Tau uint32 `json:"tau"` + Eta [4]OpaqueHash `json:"eta"` + Lambda ValidatorsData `json:"lambda"` + Kappa ValidatorsData `json:"kappa"` + GammaK ValidatorsData `json:"gamma_k"` + Iota ValidatorsData `json:"iota"` + GammaA []TicketBody `json:"gamma_a"` + GammaS TicketsOrKeys `json:"gamma_s"` + GammaZ GammaZ `json:"gamma_z"` +} + +func (h OpaqueHash) MarshalJSON() ([]byte, error) { + return json.Marshal(fmt.Sprintf("0x%s", hex.EncodeToString(h[:]))) +} + +func (k Ed25519Key) MarshalJSON() ([]byte, error) { + return json.Marshal(fmt.Sprintf("0x%s", hex.EncodeToString(k[:]))) +} + +func (k BlsKey) MarshalJSON() ([]byte, error) { + return json.Marshal(fmt.Sprintf("0x%s", hex.EncodeToString(k[:]))) +} + +func (k GammaZ) MarshalJSON() ([]byte, error) { + return json.Marshal(fmt.Sprintf("0x%s", hex.EncodeToString(k[:]))) +} + +func (k BandersnatchKey) MarshalJSON() ([]byte, error) { + return json.Marshal(fmt.Sprintf("0x%s", hex.EncodeToString(k[:]))) +} + +func (k MetadataKey) MarshalJSON() ([]byte, error) { + return json.Marshal(fmt.Sprintf("0x%s", hex.EncodeToString(k[:]))) +} + +type TicketEnvelope struct { + Attempt uint8 + Signature [784]uint8 +} + +type TicketBody struct { + ID OpaqueHash + Attempt uint8 +} + +// TicketsOrKeys is enum +type TicketsOrKeys struct { + inner any +} + +type TicketsOrKeysValues interface { + EpochKeys | TicketsBodies +} + +func setTicketsOrKeys[Value TicketsOrKeysValues](tok *TicketsOrKeys, value Value) { + tok.inner = value +} + +func (tok *TicketsOrKeys) SetValue(value any) (err error) { + switch value := value.(type) { + case EpochKeys: + setTicketsOrKeys(tok, value) + return nil + case TicketsBodies: + setTicketsOrKeys(tok, value) + return nil + default: + return fmt.Errorf("unsupported type") + } +} + +func (tok TicketsOrKeys) IndexValue() (index uint, value any, err error) { + switch tok.inner.(type) { + case EpochKeys: + return 1, tok.inner, nil + case TicketsBodies: + return 2, tok.inner, nil + } + return 0, nil, scale.ErrUnsupportedVaryingDataTypeValue +} + +func (tok TicketsOrKeys) Value() (value any, err error) { + _, value, err = tok.IndexValue() + return +} + +func (tok TicketsOrKeys) ValueAt(index uint) (value any, err error) { + switch index { + case 1: + return EpochKeys{}, nil + case 2: + return TicketsBodies{}, nil + } + return nil, scale.ErrUnknownVaryingDataTypeValue +} + +func (tok TicketsOrKeys) MarshalJSON() ([]byte, error) { + value, err := tok.Value() + if err != nil { + return nil, err + } + + switch v := value.(type) { + case EpochKeys: + return json.Marshal(map[string]interface{}{ + "keys": v, + }) + case TicketsBodies: + return json.Marshal(map[string]interface{}{ + "tickets": v, + }) + default: + return nil, fmt.Errorf("unexpected type in TicketsOrKeys: %T", value) + } +} + +// OutputOrError is enum +type OutputOrError struct { + inner any +} + +type OutputOrErrorValues interface { + OutputMarks | CustomErrorCode +} + +func setOutputOrError[Value OutputOrErrorValues](oe *OutputOrError, value Value) { + oe.inner = value +} + +func (oe *OutputOrError) SetValue(value any) (err error) { + switch value := value.(type) { + case OutputMarks: + setOutputOrError(oe, value) + return nil + case CustomErrorCode: + setOutputOrError(oe, value) + return nil + default: + return fmt.Errorf("unsupported type") + } +} + +func (oe OutputOrError) IndexValue() (index uint, value any, err error) { + switch oe.inner.(type) { + case OutputMarks: + return 1, oe.inner, nil + case CustomErrorCode: + return 2, oe.inner, nil + } + return 0, nil, scale.ErrUnsupportedVaryingDataTypeValue +} + +func (oe OutputOrError) Value() (value any, err error) { + _, value, err = oe.IndexValue() + return +} + +func (oe OutputOrError) ValueAt(index uint) (value any, err error) { + switch index { + case 0: + return OutputMarks{}, nil + case 1: + return CustomErrorCode(0), nil + } + return nil, scale.ErrUnknownVaryingDataTypeValue +} + +func (oe OutputOrError) MarshalJSON() ([]byte, error) { + value, err := oe.Value() + if err != nil { + return nil, err + } + + switch v := value.(type) { + case OutputMarks: + return json.Marshal(map[string]interface{}{ + "ok": v, + }) + case CustomErrorCode: + message, ok := errorCodeMessages[v] + if !ok { + return nil, fmt.Errorf("unknown custom error code: %d", v) + } + return json.Marshal(map[string]interface{}{ + "err": message, + }) + default: + return nil, fmt.Errorf("unexpected type in OutputOrError: %T", value) + } +} diff --git a/tests/generated/enact-epoch-change-with-no-tickets-1.output.json b/tests/generated/enact-epoch-change-with-no-tickets-1.output.json new file mode 100644 index 00000000..3d6d8d97 --- /dev/null +++ b/tests/generated/enact-epoch-change-with-no-tickets-1.output.json @@ -0,0 +1,371 @@ +{ + "input": { + "slot": 1, + "entropy": "0x8c2e6d327dfaa6ff8195513810496949210ad20a96e2b0672a3e1b9335080801", + "extrinsic": [] + }, + "pre_state": { + "tau": 0, + "eta": [ + "0x03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314", + "0xee155ace9c40292074cb6aff8c9ccdd273c81648ff1149ef36bcea6ebb8a3e25", + "0xbb30a42c1e62f0afda5f0a4e8a562f7a13a24cea00ee81917b86b89e801314aa", + "0xe88bd757ad5b9bedf372d8d3f0cf6c962a469db61a265f6418e1ffed86da29ec" + ], + "lambda": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "kappa": [ + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_k": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "iota": [ + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_a": [], + "gamma_s": { + "keys": [ + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33" + ] + }, + "gamma_z": "0x96a4b479612d8d2770d6a4785fa2f44e0befca6f008b176de51e309e2ee796d2b596e315fcb044495b75c3cb5c7fd4cdae0959758cac93d4ab8789c6aec4ba8f683c6b103cf6888f70edfcb8dcbbc1d85a8fa3832e0cd4503c7a1796c8d0c3f792e630ae2b14e758ab0960e372172203f4c9a41777dadd529971d7ab9d23ab29fe0e9c85ec450505dde7f5ac038274cf" + }, + "output": { + "ok": { + "epoch_mark": null, + "tickets_mark": null + } + }, + "post_state": { + "tau": 1, + "eta": [ + "0xa0243a82952899598fcbc74aff0df58a71059a9882d4416919055c5d64bf2a45", + "0xee155ace9c40292074cb6aff8c9ccdd273c81648ff1149ef36bcea6ebb8a3e25", + "0xbb30a42c1e62f0afda5f0a4e8a562f7a13a24cea00ee81917b86b89e801314aa", + "0xe88bd757ad5b9bedf372d8d3f0cf6c962a469db61a265f6418e1ffed86da29ec" + ], + "lambda": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "kappa": [ + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_k": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "iota": [ + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_a": [], + "gamma_s": { + "keys": [ + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33" + ] + }, + "gamma_z": "0x96a4b479612d8d2770d6a4785fa2f44e0befca6f008b176de51e309e2ee796d2b596e315fcb044495b75c3cb5c7fd4cdae0959758cac93d4ab8789c6aec4ba8f683c6b103cf6888f70edfcb8dcbbc1d85a8fa3832e0cd4503c7a1796c8d0c3f792e630ae2b14e758ab0960e372172203f4c9a41777dadd529971d7ab9d23ab29fe0e9c85ec450505dde7f5ac038274cf" + } +} \ No newline at end of file diff --git a/tests/generated/enact-epoch-change-with-no-tickets-2.output.json b/tests/generated/enact-epoch-change-with-no-tickets-2.output.json new file mode 100644 index 00000000..b1864581 --- /dev/null +++ b/tests/generated/enact-epoch-change-with-no-tickets-2.output.json @@ -0,0 +1,368 @@ +{ + "input": { + "slot": 1, + "entropy": "0xe4b188579aa828f694f769a31a965a11f2017288fbfdfa8734aadc80685ffff7", + "extrinsic": [] + }, + "pre_state": { + "tau": 1, + "eta": [ + "0xa0243a82952899598fcbc74aff0df58a71059a9882d4416919055c5d64bf2a45", + "0xee155ace9c40292074cb6aff8c9ccdd273c81648ff1149ef36bcea6ebb8a3e25", + "0xbb30a42c1e62f0afda5f0a4e8a562f7a13a24cea00ee81917b86b89e801314aa", + "0xe88bd757ad5b9bedf372d8d3f0cf6c962a469db61a265f6418e1ffed86da29ec" + ], + "lambda": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "kappa": [ + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_k": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "iota": [ + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_a": [], + "gamma_s": { + "keys": [ + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33" + ] + }, + "gamma_z": "0x96a4b479612d8d2770d6a4785fa2f44e0befca6f008b176de51e309e2ee796d2b596e315fcb044495b75c3cb5c7fd4cdae0959758cac93d4ab8789c6aec4ba8f683c6b103cf6888f70edfcb8dcbbc1d85a8fa3832e0cd4503c7a1796c8d0c3f792e630ae2b14e758ab0960e372172203f4c9a41777dadd529971d7ab9d23ab29fe0e9c85ec450505dde7f5ac038274cf" + }, + "output": { + "err": "bad_slot" + }, + "post_state": { + "tau": 1, + "eta": [ + "0xa0243a82952899598fcbc74aff0df58a71059a9882d4416919055c5d64bf2a45", + "0xee155ace9c40292074cb6aff8c9ccdd273c81648ff1149ef36bcea6ebb8a3e25", + "0xbb30a42c1e62f0afda5f0a4e8a562f7a13a24cea00ee81917b86b89e801314aa", + "0xe88bd757ad5b9bedf372d8d3f0cf6c962a469db61a265f6418e1ffed86da29ec" + ], + "lambda": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "kappa": [ + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_k": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "iota": [ + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_a": [], + "gamma_s": { + "keys": [ + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33" + ] + }, + "gamma_z": "0x96a4b479612d8d2770d6a4785fa2f44e0befca6f008b176de51e309e2ee796d2b596e315fcb044495b75c3cb5c7fd4cdae0959758cac93d4ab8789c6aec4ba8f683c6b103cf6888f70edfcb8dcbbc1d85a8fa3832e0cd4503c7a1796c8d0c3f792e630ae2b14e758ab0960e372172203f4c9a41777dadd529971d7ab9d23ab29fe0e9c85ec450505dde7f5ac038274cf" + } +} \ No newline at end of file diff --git a/tests/scale_decode_test.go b/tests/scale_decode_test.go new file mode 100644 index 00000000..5b5aeb94 --- /dev/null +++ b/tests/scale_decode_test.go @@ -0,0 +1,107 @@ +package tests + +import ( + "encoding/json" + "fmt" + "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/eigerco/strawberry/internal/safrole" + "os" + "testing" +) + +func TestScaleDecode(t *testing.T) { + fileNames := []string{ + "enact-epoch-change-with-no-tickets-1", + "enact-epoch-change-with-no-tickets-2", + } + + for _, f := range fileNames { + t.Run(f, func(t *testing.T) { + // 1. Read scale file + b, err := os.ReadFile(fmt.Sprintf("vectors/%s.scale", f)) + if err != nil { + t.Errorf("Failed to read scale file: %v", err) + } + + // Unmarshal the .scale file + var unmarshaled safrole.Safrole + err = scale.Unmarshal(b, &unmarshaled) + if err != nil { + t.Errorf("Failed to unmarshal scale file: %v", err) + } + + if unmarshaled.Input.Extrinsic == nil { + unmarshaled.Input.Extrinsic = []safrole.TicketEnvelope{} + } + + if unmarshaled.PreState.GammaA == nil { + unmarshaled.PreState.GammaA = []safrole.TicketBody{} + } + if unmarshaled.PostState.GammaA == nil { + unmarshaled.PostState.GammaA = []safrole.TicketBody{} + } + + // Marshal the unmarshaled scale data to JSON + jsonData, err := json.MarshalIndent(unmarshaled, "", " ") + if err != nil { + t.Errorf("Failed to json marshal the unmarshalled scale file: %v", err) + } + + err = createDirIfNotExists("generated") + if err != nil { + t.Fatalf("Failed to create folder: %v", err) + } + + // Write the JSON data to a file + err = os.WriteFile(fmt.Sprintf("generated/%s.output.json", f), jsonData, 0644) + if err != nil { + t.Errorf("Failed to write JSON file: %v", err) + } + + // Read the expected JSON file + expectedData, err := os.ReadFile(fmt.Sprintf("vectors/%s.json", f)) + if err != nil { + t.Errorf("Failed to read expected JSON file: %v", err) + } + + // Unmarshal both JSON files into interface{} + var actual interface{} + var expected interface{} + + err = json.Unmarshal(jsonData, &actual) + if err != nil { + t.Errorf("Failed to unmarshal output JSON data: %v", err) + } + + err = json.Unmarshal(expectedData, &expected) + if err != nil { + t.Errorf("Failed to unmarshal expected JSON data: %v", err) + } + + // Marshal both interfaces back to JSON + actualNormalized, err := json.Marshal(actual) + if err != nil { + t.Errorf("Failed to marshal actual JSON data: %v", err) + } + + expectedNormalized, err := json.Marshal(expected) + if err != nil { + t.Errorf("Failed to marshal expected JSON data: %v", err) + } + + // Compare the normalized JSON strings + if string(actualNormalized) != string(expectedNormalized) { + t.Errorf("The output JSON does not match the expected JSON") + } + }) + } +} + +func createDirIfNotExists(dir string) error { + if _, err := os.Stat(dir); os.IsNotExist(err) { + if err := os.Mkdir(dir, os.ModePerm); err != nil { + return err + } + } + return nil +} diff --git a/tests/vectors/enact-epoch-change-with-no-tickets-1.json b/tests/vectors/enact-epoch-change-with-no-tickets-1.json new file mode 100644 index 00000000..9a4edb5d --- /dev/null +++ b/tests/vectors/enact-epoch-change-with-no-tickets-1.json @@ -0,0 +1,371 @@ +{ + "input": { + "slot": 1, + "entropy": "0x8c2e6d327dfaa6ff8195513810496949210ad20a96e2b0672a3e1b9335080801", + "extrinsic": [] + }, + "pre_state": { + "tau": 0, + "eta": [ + "0x03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314", + "0xee155ace9c40292074cb6aff8c9ccdd273c81648ff1149ef36bcea6ebb8a3e25", + "0xbb30a42c1e62f0afda5f0a4e8a562f7a13a24cea00ee81917b86b89e801314aa", + "0xe88bd757ad5b9bedf372d8d3f0cf6c962a469db61a265f6418e1ffed86da29ec" + ], + "lambda": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "kappa": [ + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_k": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "iota": [ + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_a": [], + "gamma_s": { + "keys": [ + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33" + ] + }, + "gamma_z": "0x96a4b479612d8d2770d6a4785fa2f44e0befca6f008b176de51e309e2ee796d2b596e315fcb044495b75c3cb5c7fd4cdae0959758cac93d4ab8789c6aec4ba8f683c6b103cf6888f70edfcb8dcbbc1d85a8fa3832e0cd4503c7a1796c8d0c3f792e630ae2b14e758ab0960e372172203f4c9a41777dadd529971d7ab9d23ab29fe0e9c85ec450505dde7f5ac038274cf" + }, + "output": { + "ok": { + "epoch_mark": null, + "tickets_mark": null + } + }, + "post_state": { + "tau": 1, + "eta": [ + "0xa0243a82952899598fcbc74aff0df58a71059a9882d4416919055c5d64bf2a45", + "0xee155ace9c40292074cb6aff8c9ccdd273c81648ff1149ef36bcea6ebb8a3e25", + "0xbb30a42c1e62f0afda5f0a4e8a562f7a13a24cea00ee81917b86b89e801314aa", + "0xe88bd757ad5b9bedf372d8d3f0cf6c962a469db61a265f6418e1ffed86da29ec" + ], + "lambda": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "kappa": [ + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_k": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "iota": [ + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_a": [], + "gamma_s": { + "keys": [ + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33" + ] + }, + "gamma_z": "0x96a4b479612d8d2770d6a4785fa2f44e0befca6f008b176de51e309e2ee796d2b596e315fcb044495b75c3cb5c7fd4cdae0959758cac93d4ab8789c6aec4ba8f683c6b103cf6888f70edfcb8dcbbc1d85a8fa3832e0cd4503c7a1796c8d0c3f792e630ae2b14e758ab0960e372172203f4c9a41777dadd529971d7ab9d23ab29fe0e9c85ec450505dde7f5ac038274cf" + } +} diff --git a/tests/vectors/enact-epoch-change-with-no-tickets-1.scale b/tests/vectors/enact-epoch-change-with-no-tickets-1.scale new file mode 100644 index 00000000..f87bdf94 Binary files /dev/null and b/tests/vectors/enact-epoch-change-with-no-tickets-1.scale differ diff --git a/tests/vectors/enact-epoch-change-with-no-tickets-2.json b/tests/vectors/enact-epoch-change-with-no-tickets-2.json new file mode 100644 index 00000000..a186e796 --- /dev/null +++ b/tests/vectors/enact-epoch-change-with-no-tickets-2.json @@ -0,0 +1,368 @@ +{ + "input": { + "slot": 1, + "entropy": "0xe4b188579aa828f694f769a31a965a11f2017288fbfdfa8734aadc80685ffff7", + "extrinsic": [] + }, + "pre_state": { + "tau": 1, + "eta": [ + "0xa0243a82952899598fcbc74aff0df58a71059a9882d4416919055c5d64bf2a45", + "0xee155ace9c40292074cb6aff8c9ccdd273c81648ff1149ef36bcea6ebb8a3e25", + "0xbb30a42c1e62f0afda5f0a4e8a562f7a13a24cea00ee81917b86b89e801314aa", + "0xe88bd757ad5b9bedf372d8d3f0cf6c962a469db61a265f6418e1ffed86da29ec" + ], + "lambda": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "kappa": [ + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_k": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "iota": [ + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_a": [], + "gamma_s": { + "keys": [ + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33" + ] + }, + "gamma_z": "0x96a4b479612d8d2770d6a4785fa2f44e0befca6f008b176de51e309e2ee796d2b596e315fcb044495b75c3cb5c7fd4cdae0959758cac93d4ab8789c6aec4ba8f683c6b103cf6888f70edfcb8dcbbc1d85a8fa3832e0cd4503c7a1796c8d0c3f792e630ae2b14e758ab0960e372172203f4c9a41777dadd529971d7ab9d23ab29fe0e9c85ec450505dde7f5ac038274cf" + }, + "output": { + "err": "bad_slot" + }, + "post_state": { + "tau": 1, + "eta": [ + "0xa0243a82952899598fcbc74aff0df58a71059a9882d4416919055c5d64bf2a45", + "0xee155ace9c40292074cb6aff8c9ccdd273c81648ff1149ef36bcea6ebb8a3e25", + "0xbb30a42c1e62f0afda5f0a4e8a562f7a13a24cea00ee81917b86b89e801314aa", + "0xe88bd757ad5b9bedf372d8d3f0cf6c962a469db61a265f6418e1ffed86da29ec" + ], + "lambda": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "kappa": [ + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_k": [ + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "iota": [ + { + "bandersnatch": "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "ed25519": "0xe68e0cf7f26c59f963b5846202d2327cc8bc0c4eff8cb9abd4012f9a71decf00", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "ed25519": "0x837ce344bc9defceb0d7de7e9e9925096768b7adb4dad932e532eb6551e0ea02", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "ed25519": "0x3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "ed25519": "0x5c7f34a4bd4f2d04076a8c6f9060a0c8d2c6bdd082ceb3eda7df381cb260faff", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0", + "ed25519": "0x22351e22105a19aabb42589162ad7f1ea0df1c25cebf0e4a9fcd261301274862", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + { + "bandersnatch": "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "ed25519": "0xb3e0e096b02e2ec98a3441410aeddd78c95e27a0da6f411a09c631c0f2bea6e9", + "bls": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "metadata": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ], + "gamma_a": [], + "gamma_s": { + "keys": [ + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc", + "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33", + "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3", + "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d", + "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33" + ] + }, + "gamma_z": "0x96a4b479612d8d2770d6a4785fa2f44e0befca6f008b176de51e309e2ee796d2b596e315fcb044495b75c3cb5c7fd4cdae0959758cac93d4ab8789c6aec4ba8f683c6b103cf6888f70edfcb8dcbbc1d85a8fa3832e0cd4503c7a1796c8d0c3f792e630ae2b14e758ab0960e372172203f4c9a41777dadd529971d7ab9d23ab29fe0e9c85ec450505dde7f5ac038274cf" + } +} diff --git a/tests/vectors/enact-epoch-change-with-no-tickets-2.scale b/tests/vectors/enact-epoch-change-with-no-tickets-2.scale new file mode 100644 index 00000000..41c88160 Binary files /dev/null and b/tests/vectors/enact-epoch-change-with-no-tickets-2.scale differ diff --git a/vendor/github.com/ChainSafe/gossamer/LICENSE b/vendor/github.com/ChainSafe/gossamer/LICENSE new file mode 100644 index 00000000..1ac01abe --- /dev/null +++ b/vendor/github.com/ChainSafe/gossamer/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/vendor/github.com/ChainSafe/gossamer/pkg/scale/README.md b/vendor/github.com/ChainSafe/gossamer/pkg/scale/README.md new file mode 100644 index 00000000..5ebc06f5 --- /dev/null +++ b/vendor/github.com/ChainSafe/gossamer/pkg/scale/README.md @@ -0,0 +1,334 @@ +# go-scale Codec + +Go implementation of the SCALE (Simple Concatenated Aggregate Little-Endian) data format for types used in the Parity Substrate framework. + +SCALE is a light-weight format which allows encoding (and decoding) which makes it highly suitable for resource-constrained execution environments like blockchain runtimes and low-power, low-memory devices. + +It is important to note that the encoding context (knowledge of how the types and data structures look) needs to be known separately at both encoding and decoding ends. The encoded data does not include this contextual information. + +This codec attempts to translate the primitive Go types to the associated types in SCALE. It also introduces a few custom types to implement Rust primitives that have no direct translation to a Go primitive type. + +## Translating From SCALE to Go + +When translating from SCALE to native Go data, +go-scale returns primitive Go data values for corresponding SCALE data +values. The table below shows how go-scale translates SCALE types to Go. + +### Primitives + +| SCALE/Rust | Go | +| ------------------ | ------------------------ | +| `i8` | `int8` | +| `u8` | `uint8` | +| `i16` | `int16` | +| `u16` | `uint16` | +| `i32` | `int32` | +| `u32` | `uint32` | +| `i64` | `int64` | +| `u64` | `uint64` | +| `i128` | `*big.Int` | +| `u128` | `*scale.Uint128` | +| `bytes` | `[]byte` | +| `string` | `string` | +| `enum` | `scale.VaryingDataType` | +| `struct` | `struct` | + +### Structs + +When decoding SCALE data, knowledge of the structure of the destination data type is required to decode. Structs are encoded as a SCALE Tuple, where each struct field is encoded in the sequence of the fields. + +#### Struct Tags + +go-scale uses a `scale` struct tag to modify the order of the field values during encoding. This is also used when decoding attributes back to the original type. This essentially allows you to modify struct field ordering but preserve the encoding/decoding ordering. + +See the [usage example](#Struct-Tag-Example). + +### Option + +For all `Option` a pointer to the underlying type is used in go-scale. In the `None` case the pointer value is `nil`. + +| SCALE/Rust | Go | +| ------------------ | ------------------------ | +| `Option` | `*int8` | +| `Option` | `*uint8` | +| `Option` | `*int16` | +| `Option` | `*uint16` | +| `Option` | `*int32` | +| `Option` | `*uint32` | +| `Option` | `*int64` | +| `Option` | `*uint64` | +| `Option` | `**big.Int` | +| `Option` | `**scale.Uint128` | +| `Option` | `*[]byte` | +| `Option` | `*string` | +| `Option` | `*scale.VaryingDataType` | +| `Option` | `*struct` | +| `None` | `nil` | + +### Compact Encoding + +SCALE uses a compact encoding for variable width unsigned integers. + +| SCALE/Rust | Go | +| ------------------ | ------------------------ | +| `Compact` | `uint` | +| `Compact` | `uint` | +| `Compact` | `uint` | +| `Compact` | `uint` | +| `Compact` | `*big.Int` | + +## Usage + +### Basic Example + +Basic example which encodes and decodes a `uint`. +```go +import ( + "fmt" + "github.com/ChainSafe/gossamer/pkg/scale" +) + +func ExampleBasic() { + // compact length encoded uint + var ui uint = 999 + bytes, err := scale.Marshal(ui) + if err != nil { + panic(err) + } + + var unmarshaled uint + err = scale.Unmarshal(bytes, &unmarshaled) + if err != nil { + panic(err) + } + + // 999 + fmt.Printf("%d", unmarshaled) +} +``` + +### Struct Tag Example + +Use the `scale` struct tag for struct fields to conform to specific encoding sequence of struct field values. A struct tag of `"-"` will be omitted from encoding and decoding. + +```go +import ( + "fmt" + "github.com/ChainSafe/gossamer/pkg/scale" +) + +func ExampleStruct() { + type MyStruct struct { + Baz bool `scale:"3"` + Bar int32 `scale:"2"` + Foo []byte `scale:"1"` + Ignored int64 `scale:"-"` + } + var ms = MyStruct{ + Baz: true, + Bar: 999, + Foo: []byte{1, 2}, + Ignored: 999 + } + bytes, err := scale.Marshal(ms) + if err != nil { + panic(err) + } + + var unmarshaled MyStruct + err = scale.Unmarshal(bytes, &unmarshaled) + if err != nil { + panic(err) + } + + // {Baz:true Bar:999 Foo:[1 2] Ignored:0} + fmt.Printf("%+v", unmarshaled) +} +``` + +### Result + +A `Result` is custom type analogous to a rust result. A `Result` needs to be constructed using the `NewResult` constructor. The two parameters accepted are the expected types that are associated to the `Ok`, and `Err` cases. + +``` +// Rust +Result = Ok(10) + +// go-scale +result := scale.NewResult(int32(0), int32(0) +result.Set(scale.Ok, 10) +``` + +```go +import ( + "fmt" + "github.com/ChainSafe/gossamer/pkg/scale" +) + +func ExampleResult() { + // pass in zero or non-zero values of the types for Ok and Err cases + res := scale.NewResult(bool(false), string("")) + + // set the OK case with a value of true, any values for OK that are not bool will return an error + err := res.Set(scale.OK, true) + if err != nil { + panic(err) + } + + bytes, err := scale.Marshal(res) + if err != nil { + panic(err) + } + + // [0x00, 0x01] + fmt.Printf("%v\n", bytes) + + res1 := scale.NewResult(bool(false), string("")) + + err = scale.Unmarshal(bytes, &res1) + if err != nil { + panic(err) + } + + // res1 should be Set with OK mode and value of true + ok, err := res1.Unwrap() + if err != nil { + panic(err) + } + + switch ok := ok.(type) { + case bool: + if !ok { + panic(fmt.Errorf("unexpected ok value: %v", ok)) + } + default: + panic(fmt.Errorf("unexpected type: %T", ok)) + } +} + +``` + +### Varying Data Type + +A `VaryingDataType` is analogous to a Rust enum. A `VaryingDataType` is an interface that needs to be implemented. From the Polkadot spec there are values associated to a `VaryingDataType`, which is analagous to a rust enum variant. Each value has an associated index integer value which is used to determine which value type go-scale should decode to. The following interface needs to be implemented for go-scale to be able to marshal from or unmarshal into. +```go +type EncodeVaryingDataType interface { + IndexValue() (index uint, value any, err error) + Value() (value any, err error) + ValueAt(index uint) (value any, err error) +} + +type VaryingDataType interface { + EncodeVaryingDataType + SetValue(value any) (err error) +} + +``` +Example implementation of `VaryingDataType`: +```go +import ( + "fmt" + "reflect" + + "github.com/ChainSafe/gossamer/pkg/scale" +) + +type MyStruct struct { + Baz bool + Bar uint32 + Foo []byte +} + +type MyOtherStruct struct { + Foo string + Bar uint64 + Baz uint +} + +type MyInt16 int16 + +type MyVaryingDataType struct { + inner any +} + +type MyVaryingDataTypeValues interface { + MyStruct | MyOtherStruct | MyInt16 +} + +func setMyVaryingDataType[Value MyVaryingDataTypeValues](mvdt *MyVaryingDataType, value Value) { + mvdt.inner = value +} + +func (mvdt *MyVaryingDataType) SetValue(value any) (err error) { + switch value := value.(type) { + case MyStruct: + setMyVaryingDataType(mvdt, value) + return + case MyOtherStruct: + setMyVaryingDataType(mvdt, value) + return + case MyInt16: + setMyVaryingDataType(mvdt, value) + return + default: + return fmt.Errorf("unsupported type") + } +} + +func (mvdt MyVaryingDataType) IndexValue() (index uint, value any, err error) { + switch mvdt.inner.(type) { + case MyStruct: + return 1, mvdt.inner, nil + case MyOtherStruct: + return 2, mvdt.inner, nil + case MyInt16: + return 3, mvdt.inner, nil + } + return 0, nil, scale.ErrUnsupportedVaryingDataTypeValue +} + +func (mvdt MyVaryingDataType) Value() (value any, err error) { + _, value, err = mvdt.IndexValue() + return +} + +func (mvdt MyVaryingDataType) ValueAt(index uint) (value any, err error) { + switch index { + case 1: + return MyStruct{}, nil + case 2: + return MyOtherStruct{}, nil + case 3: + return MyInt16(0), nil + } + return nil, scale.ErrUnknownVaryingDataTypeValue +} + +func ExampleVaryingDataType() { + vdt := MyVaryingDataType{} + + err := vdt.SetValue(MyStruct{ + Baz: true, + Bar: 999, + Foo: []byte{1, 2}, + }) + if err != nil { + panic(err) + } + + bytes, err := scale.Marshal(vdt) + if err != nil { + panic(err) + } + + dst := MyVaryingDataType{} + + err = scale.Unmarshal(bytes, &dst) + if err != nil { + panic(err) + } + + fmt.Println(reflect.DeepEqual(vdt, dst)) + // Output: true +} +``` \ No newline at end of file diff --git a/vendor/github.com/ChainSafe/gossamer/pkg/scale/decode.go b/vendor/github.com/ChainSafe/gossamer/pkg/scale/decode.go new file mode 100644 index 00000000..af52cf5c --- /dev/null +++ b/vendor/github.com/ChainSafe/gossamer/pkg/scale/decode.go @@ -0,0 +1,749 @@ +// Copyright 2021 ChainSafe Systems (ON) +// SPDX-License-Identifier: LGPL-3.0-only + +package scale + +import ( + "bytes" + "encoding/binary" + "errors" + "fmt" + "io" + "math" + "math/big" + "reflect" +) + +// indirect walks down v allocating pointers as needed, +// until it gets to a non-pointer. +func indirect(dstv reflect.Value) (elem reflect.Value) { + dstv0 := dstv + haveAddr := false + for { + // Load value from interface, but only if the result will be + // usefully addressable. + if dstv.Kind() == reflect.Interface && !dstv.IsNil() { + e := dstv.Elem() + if e.Kind() == reflect.Ptr && !e.IsNil() && e.Elem().Kind() == reflect.Ptr { + haveAddr = false + dstv = e + continue + } + } + if dstv.Kind() != reflect.Ptr { + break + } + if dstv.CanSet() { + break + } + // Prevent infinite loop if v is an interface pointing to its own address: + // var v interface{} + // v = &v + if dstv.Elem().Kind() == reflect.Interface && dstv.Elem().Elem() == dstv { + dstv = dstv.Elem() + break + } + if dstv.IsNil() { + dstv.Set(reflect.New(dstv.Type().Elem())) + } + if haveAddr { + dstv = dstv0 // restore original value after round-trip Value.Addr().Elem() + haveAddr = false + } else { + dstv = dstv.Elem() + } + } + elem = dstv + return +} + +// Unmarshal takes data and a destination pointer to unmarshal the data to. +func Unmarshal(data []byte, dst interface{}) (err error) { + dstv := reflect.ValueOf(dst) + if dstv.Kind() != reflect.Ptr || dstv.IsNil() { + err = fmt.Errorf("%w: %T", ErrUnsupportedDestination, dst) + return + } + + ds := decodeState{} + + ds.Reader = bytes.NewBuffer(data) + + err = ds.unmarshal(indirect(dstv)) + if err != nil { + return + } + return +} + +// Unmarshaler is the interface for custom SCALE unmarshalling for a given type +type Unmarshaler interface { + UnmarshalSCALE(io.Reader) error +} + +// Decoder is used to decode from an io.Reader +type Decoder struct { + decodeState +} + +// Decode accepts a pointer to a destination and decodes into supplied destination +func (d *Decoder) Decode(dst interface{}) (err error) { + dstv := reflect.ValueOf(dst) + if dstv.Kind() != reflect.Ptr || dstv.IsNil() { + err = fmt.Errorf("%w: %T", ErrUnsupportedDestination, dst) + return + } + + err = d.unmarshal(indirect(dstv)) + if err != nil { + return + } + return nil +} + +// NewDecoder is constructor for Decoder +func NewDecoder(r io.Reader) (d *Decoder) { + d = &Decoder{ + decodeState{r}, + } + return +} + +type decodeState struct { + io.Reader +} + +func (ds *decodeState) unmarshal(dstv reflect.Value) (err error) { + unmarshalerType := reflect.TypeOf((*Unmarshaler)(nil)).Elem() + if dstv.CanAddr() && dstv.Addr().Type().Implements(unmarshalerType) { + methodVal := dstv.Addr().MethodByName("UnmarshalSCALE") + values := methodVal.Call([]reflect.Value{reflect.ValueOf(ds.Reader)}) + if !values[0].IsNil() { + errIn := values[0].Interface() + err := errIn.(error) + return err + } + return + } + + if dstv.CanAddr() { + addr := dstv.Addr() + vdt, ok := addr.Interface().(VaryingDataType) + if ok { + err = ds.decodeVaryingDataType(vdt) + return + } + } + + in := dstv.Interface() + switch in.(type) { + case *big.Int: + err = ds.decodeBigInt(dstv) + case *Uint128: + err = ds.decodeUint128(dstv) + case int, uint: + err = ds.decodeUint(dstv) + case int8, uint8, int16, uint16, int32, uint32, int64, uint64: + err = ds.decodeFixedWidthInt(dstv) + case []byte: + err = ds.decodeBytes(dstv) + case string: + err = ds.decodeBytes(dstv) + case bool: + err = ds.decodeBool(dstv) + case Result: + err = ds.decodeResult(dstv) + default: + t := reflect.TypeOf(in) + switch t.Kind() { + case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64, reflect.String, reflect.Uint, + reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + err = ds.decodeCustomPrimitive(dstv) + case reflect.Ptr: + err = ds.decodePointer(dstv) + case reflect.Struct: + err = ds.decodeStruct(dstv) + case reflect.Array: + err = ds.decodeArray(dstv) + case reflect.Slice: + err = ds.decodeSlice(dstv) + case reflect.Map: + err = ds.decodeMap(dstv) + default: + err = fmt.Errorf("%w: %T", ErrUnsupportedType, in) + } + } + return +} + +func (ds *decodeState) decodeCustomPrimitive(dstv reflect.Value) (err error) { + in := dstv.Interface() + inType := reflect.TypeOf(in) + var temp reflect.Value + switch inType.Kind() { + case reflect.Bool: + temp = reflect.New(reflect.TypeOf(false)) + err = ds.unmarshal(temp.Elem()) + if err != nil { + break + } + case reflect.Int: + temp = reflect.New(reflect.TypeOf(int(1))) + err = ds.unmarshal(temp.Elem()) + if err != nil { + break + } + case reflect.Int8: + temp = reflect.New(reflect.TypeOf(int8(1))) + err = ds.unmarshal(temp.Elem()) + if err != nil { + break + } + case reflect.Int16: + temp = reflect.New(reflect.TypeOf(int16(1))) + err = ds.unmarshal(temp.Elem()) + if err != nil { + break + } + case reflect.Int32: + temp = reflect.New(reflect.TypeOf(int32(1))) + err = ds.unmarshal(temp.Elem()) + if err != nil { + break + } + case reflect.Int64: + temp = reflect.New(reflect.TypeOf(int64(1))) + err = ds.unmarshal(temp.Elem()) + if err != nil { + break + } + case reflect.String: + temp = reflect.New(reflect.TypeOf("")) + err = ds.unmarshal(temp.Elem()) + if err != nil { + break + } + case reflect.Uint: + temp = reflect.New(reflect.TypeOf(uint(0))) + err = ds.unmarshal(temp.Elem()) + if err != nil { + break + } + case reflect.Uint8: + temp = reflect.New(reflect.TypeOf(uint8(0))) + err = ds.unmarshal(temp.Elem()) + if err != nil { + break + } + case reflect.Uint16: + temp = reflect.New(reflect.TypeOf(uint16(0))) + err = ds.unmarshal(temp.Elem()) + if err != nil { + break + } + case reflect.Uint32: + temp = reflect.New(reflect.TypeOf(uint32(0))) + err = ds.unmarshal(temp.Elem()) + if err != nil { + break + } + case reflect.Uint64: + temp = reflect.New(reflect.TypeOf(uint64(0))) + err = ds.unmarshal(temp.Elem()) + if err != nil { + break + } + default: + err = fmt.Errorf("%w: %T", ErrUnsupportedType, in) + return + } + dstv.Set(temp.Elem().Convert(inType)) + return +} + +func (ds *decodeState) ReadByte() (byte, error) { + b := make([]byte, 1) // make buffer + _, err := ds.Reader.Read(b) // read what's in the Decoder's underlying buffer to our new buffer b + return b[0], err +} + +func (ds *decodeState) decodeResult(dstv reflect.Value) (err error) { + res := dstv.Interface().(Result) + var rb byte + rb, err = ds.ReadByte() + if err != nil { + return + } + switch rb { + case 0x00: + tempElem := reflect.New(reflect.TypeOf(res.ok)) + tempElem.Elem().Set(reflect.ValueOf(res.ok)) + err = ds.unmarshal(tempElem.Elem()) + if err != nil { + return + } + err = res.Set(OK, tempElem.Elem().Interface()) + if err != nil { + return + } + dstv.Set(reflect.ValueOf(res)) + case 0x01: + tempElem := reflect.New(reflect.TypeOf(res.err)) + tempElem.Elem().Set(reflect.ValueOf(res.err)) + err = ds.unmarshal(tempElem.Elem()) + if err != nil { + return + } + err = res.Set(Err, tempElem.Elem().Interface()) + if err != nil { + return + } + dstv.Set(reflect.ValueOf(res)) + default: + bytes, _ := io.ReadAll(ds.Reader) + err = fmt.Errorf("%w: value: %v, bytes: %v", ErrUnsupportedResult, rb, bytes) + } + return +} + +func (ds *decodeState) decodePointer(dstv reflect.Value) (err error) { + var rb byte + rb, err = ds.ReadByte() + if err != nil { + return + } + switch rb { + case 0x00: + // nil case + case 0x01: + switch dstv.IsZero() { + case false: + if dstv.Elem().Kind() == reflect.Ptr { + err = ds.unmarshal(dstv.Elem().Elem()) + } else { + err = ds.unmarshal(dstv.Elem()) + } + case true: + elemType := reflect.TypeOf(dstv.Interface()).Elem() + tempElem := reflect.New(elemType) + err = ds.unmarshal(tempElem.Elem()) + if err != nil { + return + } + dstv.Set(tempElem) + } + default: + bytes, _ := io.ReadAll(ds.Reader) + err = fmt.Errorf("%w: value: %v, bytes: %v", errUnsupportedOption, rb, bytes) + } + return +} + +func (ds *decodeState) decodeVaryingDataType(vdt VaryingDataType) (err error) { + var b byte + b, err = ds.ReadByte() + if err != nil { + return + } + + val, err := vdt.ValueAt(uint(b)) + if err != nil { + err = fmt.Errorf("%w: for key %d %v", ErrUnknownVaryingDataTypeValue, uint(b), err) + return + } + + tempVal := reflect.New(reflect.TypeOf(val)) + tempVal.Elem().Set(reflect.ValueOf(val)) + err = ds.unmarshal(tempVal.Elem()) + if err != nil { + return + } + err = vdt.SetValue(tempVal.Elem().Interface()) + return +} + +func (ds *decodeState) decodeSlice(dstv reflect.Value) (err error) { + l, err := ds.decodeLength() + if err != nil { + return + } + in := dstv.Interface() + temp := reflect.New(reflect.ValueOf(in).Type()) + for i := uint(0); i < l; i++ { + tempElemType := reflect.TypeOf(in).Elem() + tempElem := reflect.New(tempElemType).Elem() + + err = ds.unmarshal(tempElem) + if err != nil { + return + } + temp.Elem().Set(reflect.Append(temp.Elem(), tempElem)) + } + dstv.Set(temp.Elem()) + + return +} + +func (ds *decodeState) decodeArray(dstv reflect.Value) (err error) { + in := dstv.Interface() + temp := reflect.New(reflect.ValueOf(in).Type()) + for i := 0; i < temp.Elem().Len(); i++ { + elem := temp.Elem().Index(i) + err = ds.unmarshal(elem) + if err != nil { + return + } + } + dstv.Set(temp.Elem()) + return +} + +func (ds *decodeState) decodeMap(dstv reflect.Value) (err error) { + numberOfTuples, err := ds.decodeLength() + if err != nil { + return fmt.Errorf("decoding length: %w", err) + } + in := dstv.Interface() + + for i := uint(0); i < numberOfTuples; i++ { + tempKeyType := reflect.TypeOf(in).Key() + tempKey := reflect.New(tempKeyType).Elem() + err = ds.unmarshal(tempKey) + if err != nil { + return fmt.Errorf("decoding key %d of %d: %w", i+1, numberOfTuples, err) + } + + tempElemType := reflect.TypeOf(in).Elem() + tempElem := reflect.New(tempElemType).Elem() + err = ds.unmarshal(tempElem) + if err != nil { + return fmt.Errorf("decoding value %d of %d: %w", i+1, numberOfTuples, err) + } + + dstv.SetMapIndex(tempKey, tempElem) + } + + return nil +} + +// decodeStruct decodes a byte array representing a SCALE tuple. The order of data is +// determined by the source tuple in rust, or the struct field order in a go struct +func (ds *decodeState) decodeStruct(dstv reflect.Value) (err error) { + in := dstv.Interface() + _, indices, err := cache.fieldScaleIndices(in) + if err != nil { + return + } + temp := reflect.New(reflect.ValueOf(in).Type()) + for _, i := range indices { + field := temp.Elem().Field(i.fieldIndex) + if !field.CanInterface() { + continue + } + // if the value is not a zero value, set it as non-zero value from dst. + // this is required for VaryingDataTypeSlice and VaryingDataType + inv := reflect.ValueOf(in) + if inv.Field(i.fieldIndex).IsValid() && !inv.Field(i.fieldIndex).IsZero() { + field.Set(inv.Field(i.fieldIndex)) + } + err = ds.unmarshal(field) + if err != nil { + return fmt.Errorf("decoding struct: unmarshalling field at index %d: %w", i.fieldIndex, err) + } + } + dstv.Set(temp.Elem()) + return +} + +// decodeBool accepts a byte array representing a SCALE encoded bool and performs SCALE decoding +// of the bool then returns it. if invalid returns an error +func (ds *decodeState) decodeBool(dstv reflect.Value) (err error) { + rb, err := ds.ReadByte() + if err != nil { + return + } + + var b bool + switch rb { + case 0x00: + case 0x01: + b = true + default: + err = fmt.Errorf("%w", errDecodeBool) + } + dstv.Set(reflect.ValueOf(b)) + return +} + +// TODO: Should this be renamed to decodeCompactInt? +// decodeUint will decode unsigned integer +func (ds *decodeState) decodeUint(dstv reflect.Value) (err error) { + const maxUint32 = ^uint32(0) + const maxUint64 = ^uint64(0) + prefix, err := ds.ReadByte() + if err != nil { + return fmt.Errorf("reading byte: %w", err) + } + + in := dstv.Interface() + temp := reflect.New(reflect.TypeOf(in)) + // check mode of encoding, stored at 2 least significant bits + mode := prefix % 4 + var value uint64 + switch mode { + case 0: + // 0b00: single-byte mode; upper six bits are the LE encoding of the value (valid only for + // values of 0-63). + value = uint64(prefix >> 2) + case 1: + // 0b01: two-byte mode: upper six bits and the following byte is the LE encoding of the + // value (valid only for values 64-(2**14-1)) + buf, err := ds.ReadByte() + if err != nil { + return fmt.Errorf("reading byte: %w", err) + } + value = uint64(binary.LittleEndian.Uint16([]byte{prefix, buf}) >> 2) + if value <= 0b0011_1111 || value > 0b0111_1111_1111_1111 { + return fmt.Errorf("%w: %d (%b)", ErrU16OutOfRange, value, value) + } + case 2: + // 0b10: four-byte mode: upper six bits and the following three bytes are the LE encoding + // of the value (valid only for values (2**14)-(2**30-1)). + buf := make([]byte, 3) + _, err = ds.Read(buf) + if err != nil { + return fmt.Errorf("reading bytes: %w", err) + } + value = uint64(binary.LittleEndian.Uint32(append([]byte{prefix}, buf...)) >> 2) + if value <= 0b0011_1111_1111_1111 || value > uint64(maxUint32>>2) { + return fmt.Errorf("%w: %d (%b)", ErrU32OutOfRange, value, value) + } + case 3: + // 0b11: Big-integer mode: The upper six bits are the number of bytes following, plus four. + // The value is contained, LE encoded, in the bytes following. The final (most significant) + // byte must be non-zero. Valid only for values (2**30)-(2**536-1). + byteLen := (prefix >> 2) + 4 + buf := make([]byte, byteLen) + _, err = ds.Read(buf) + if err != nil { + return fmt.Errorf("reading bytes: %w", err) + } + switch byteLen { + case 4: + value = uint64(binary.LittleEndian.Uint32(buf)) + if value <= uint64(maxUint32>>2) { + return fmt.Errorf("%w: %d (%b)", ErrU32OutOfRange, value, value) + } + case 8: + const uintSize = 32 << (^uint(0) >> 32 & 1) + if uintSize == 32 { + return ErrU64NotSupported + } + tmp := make([]byte, 8) + copy(tmp, buf) + value = binary.LittleEndian.Uint64(tmp) + if value <= maxUint64>>8 { + return fmt.Errorf("%w: %d (%b)", ErrU64OutOfRange, value, value) + } + default: + return fmt.Errorf("%w: %d", ErrCompactUintPrefixUnknown, prefix) + } + } + temp.Elem().Set(reflect.ValueOf(value).Convert(reflect.TypeOf(in))) + dstv.Set(temp.Elem()) + return +} + +var ( + ErrU16OutOfRange = errors.New("uint16 out of range") + ErrU32OutOfRange = errors.New("uint32 out of range") + ErrU64OutOfRange = errors.New("uint64 out of range") + ErrU64NotSupported = errors.New("uint64 is not supported") + ErrCompactUintPrefixUnknown = errors.New("unknown prefix for compact uint") +) + +// decodeLength is helper method which calls decodeUint and casts to int +func (ds *decodeState) decodeLength() (l uint, err error) { + dstv := reflect.New(reflect.TypeOf(l)) + err = ds.decodeUint(dstv.Elem()) + if err != nil { + return 0, fmt.Errorf("decoding uint: %w", err) + } + l = dstv.Elem().Interface().(uint) + return +} + +// decodeBytes is used to decode with a destination of []byte or string type +func (ds *decodeState) decodeBytes(dstv reflect.Value) (err error) { + length, err := ds.decodeLength() + if err != nil { + return + } + + // bytes length in encoded as Compact, so it can't be more than math.MaxUint32 + if length > math.MaxUint32 { + return fmt.Errorf("byte array length %d exceeds max value of uint32", length) + } + + b := make([]byte, length) + + if length > 0 { + _, err = ds.Read(b) + if err != nil { + return + } + } + + in := dstv.Interface() + inType := reflect.TypeOf(in) + dstv.Set(reflect.ValueOf(b).Convert(inType)) + return +} + +// decodeSmallInt is used in the decodeUint and decodeBigInt functions when the mode is <= 2 +// need to pass in the first byte, since we assume it's already been read +func (ds *decodeState) decodeSmallInt(firstByte, mode byte) (out int64, err error) { + switch mode { + case 0: + out = int64(firstByte >> 2) + case 1: + var buf byte + buf, err = ds.ReadByte() + if err != nil { + break + } + out = int64(binary.LittleEndian.Uint16([]byte{firstByte, buf}) >> 2) + case 2: + buf := make([]byte, 3) + _, err = ds.Read(buf) + if err != nil { + break + } + out = int64(binary.LittleEndian.Uint32(append([]byte{firstByte}, buf...)) >> 2) + } + return +} + +// decodeBigInt decodes a SCALE encoded byte array into a *big.Int +// Works for all integers, including ints > 2**64 +func (ds *decodeState) decodeBigInt(dstv reflect.Value) (err error) { + b, err := ds.ReadByte() + if err != nil { + return + } + + var output *big.Int + // check mode of encoding, stored at 2 least significant bits + mode := b & 0x03 + switch { + case mode <= 2: + var tmp int64 + tmp, err = ds.decodeSmallInt(b, mode) + if err != nil { + break + } + output = big.NewInt(tmp) + + default: + // >4 byte mode + topSixBits := b >> 2 + byteLen := uint(topSixBits) + 4 + + buf := make([]byte, byteLen) + _, err = ds.Read(buf) + if err != nil { + err = fmt.Errorf("reading bytes: %w", err) + break + } + o := reverseBytes(buf) + output = big.NewInt(0).SetBytes(o) + } + dstv.Set(reflect.ValueOf(output)) + return +} + +// decodeFixedWidthInt decodes integers < 2**32 by reading the bytes in little endian +func (ds *decodeState) decodeFixedWidthInt(dstv reflect.Value) (err error) { + in := dstv.Interface() + var out interface{} + switch in.(type) { + case int8: + var b byte + b, err = ds.ReadByte() + if err != nil { + return + } + out = int8(b) + case uint8: + var b byte + b, err = ds.ReadByte() + if err != nil { + return + } + out = b + case int16: + buf := make([]byte, 2) + _, err = ds.Read(buf) + if err != nil { + return + } + out = int16(binary.LittleEndian.Uint16(buf)) + case uint16: + buf := make([]byte, 2) + _, err = ds.Read(buf) + if err != nil { + return + } + out = binary.LittleEndian.Uint16(buf) + case int32: + buf := make([]byte, 4) + _, err = ds.Read(buf) + if err != nil { + return + } + out = int32(binary.LittleEndian.Uint32(buf)) + case uint32: + buf := make([]byte, 4) + _, err = ds.Read(buf) + if err != nil { + return + } + out = binary.LittleEndian.Uint32(buf) + case int64: + buf := make([]byte, 8) + _, err = ds.Read(buf) + if err != nil { + return + } + out = int64(binary.LittleEndian.Uint64(buf)) + case uint64: + buf := make([]byte, 8) + _, err = ds.Read(buf) + if err != nil { + return + } + out = binary.LittleEndian.Uint64(buf) + default: + err = fmt.Errorf("invalid type: %T", in) + return + } + dstv.Set(reflect.ValueOf(out)) + return +} + +// decodeUint128 accepts a byte array representing a SCALE encoded +// common.Uint128 and performs SCALE decoding of the Uint128 +func (ds *decodeState) decodeUint128(dstv reflect.Value) (err error) { + buf := make([]byte, 16) + err = binary.Read(ds, binary.LittleEndian, buf) + if err != nil { + return + } + ui128, err := NewUint128(buf) + if err != nil { + return + } + dstv.Set(reflect.ValueOf(ui128)) + return +} diff --git a/vendor/github.com/ChainSafe/gossamer/pkg/scale/encode.go b/vendor/github.com/ChainSafe/gossamer/pkg/scale/encode.go new file mode 100644 index 00000000..9429fb0b --- /dev/null +++ b/vendor/github.com/ChainSafe/gossamer/pkg/scale/encode.go @@ -0,0 +1,432 @@ +// Copyright 2021 ChainSafe Systems (ON) +// SPDX-License-Identifier: LGPL-3.0-only + +package scale + +import ( + "bytes" + "encoding/binary" + "fmt" + "io" + "math/big" + "reflect" +) + +// Encoder scale encodes to a given io.Writer. +type Encoder struct { + encodeState +} + +// NewEncoder creates a new encoder with the given writer. +func NewEncoder(writer io.Writer) (encoder *Encoder) { + return &Encoder{ + encodeState: encodeState{ + Writer: writer, + fieldScaleIndicesCache: cache, + }, + } +} + +// Encode scale encodes value to the encoder writer. +func (e *Encoder) Encode(value interface{}) (err error) { + return e.marshal(value) +} + +// Marshal takes in an interface{} and attempts to marshal into []byte +func Marshal(v interface{}) (b []byte, err error) { + buffer := bytes.NewBuffer(nil) + es := encodeState{ + Writer: buffer, + fieldScaleIndicesCache: cache, + } + err = es.marshal(v) + if err != nil { + return + } + b = buffer.Bytes() + return +} + +// Marshaler is the interface for custom SCALE marshalling for a given type +type Marshaler interface { + MarshalSCALE() ([]byte, error) +} + +// MustMarshal runs Marshal and panics on error. +func MustMarshal(v interface{}) (b []byte) { + b, err := Marshal(v) + if err != nil { + panic(err) + } + return b +} + +type encodeState struct { + io.Writer + *fieldScaleIndicesCache +} + +func (es *encodeState) marshal(in interface{}) (err error) { + marshaler, ok := in.(Marshaler) + if ok { + var bytes []byte + bytes, err = marshaler.MarshalSCALE() + if err != nil { + return + } + _, err = es.Write(bytes) + return + } + + vdt, ok := in.(EncodeVaryingDataType) + if ok { + err = es.encodeVaryingDataType(vdt) + return + } + + switch in := in.(type) { + case int: + err = es.encodeUint(uint(in)) + case uint: + err = es.encodeUint(in) + case int8, uint8, int16, uint16, int32, uint32, int64, uint64: + err = es.encodeFixedWidthInt(in) + case *big.Int: + err = es.encodeBigInt(in) + case *Uint128: + err = es.encodeUint128(in) + case []byte: + err = es.encodeBytes(in) + case string: + err = es.encodeBytes([]byte(in)) + case bool: + err = es.encodeBool(in) + case Result: + err = es.encodeResult(in) + default: + switch reflect.TypeOf(in).Kind() { + case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64, reflect.String, reflect.Uint, + reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + err = es.encodeCustomPrimitive(in) + case reflect.Ptr: + // Assuming that anything that is a pointer is an Option to capture {nil, T} + elem := reflect.ValueOf(in).Elem() + switch elem.IsValid() { + case false: + _, err = es.Write([]byte{0}) + default: + _, err = es.Write([]byte{1}) + if err != nil { + return + } + err = es.marshal(elem.Interface()) + } + case reflect.Struct: + err = es.encodeStruct(in) + case reflect.Array: + err = es.encodeArray(in) + case reflect.Slice: + err = es.encodeSlice(in) + case reflect.Map: + err = es.encodeMap(in) + default: + err = fmt.Errorf("%w: %T", ErrUnsupportedType, in) + } + } + return +} + +func (es *encodeState) encodeCustomPrimitive(in interface{}) (err error) { + switch reflect.TypeOf(in).Kind() { + case reflect.Bool: + in = reflect.ValueOf(in).Convert(reflect.TypeOf(false)).Interface() + case reflect.Int: + in = reflect.ValueOf(in).Convert(reflect.TypeOf(int(0))).Interface() + case reflect.Int8: + in = reflect.ValueOf(in).Convert(reflect.TypeOf(int8(0))).Interface() + case reflect.Int16: + in = reflect.ValueOf(in).Convert(reflect.TypeOf(int16(0))).Interface() + case reflect.Int32: + in = reflect.ValueOf(in).Convert(reflect.TypeOf(int32(0))).Interface() + case reflect.Int64: + in = reflect.ValueOf(in).Convert(reflect.TypeOf(int64(0))).Interface() + case reflect.String: + in = reflect.ValueOf(in).Convert(reflect.TypeOf("")).Interface() + case reflect.Uint: + in = reflect.ValueOf(in).Convert(reflect.TypeOf(uint(0))).Interface() + case reflect.Uint8: + in = reflect.ValueOf(in).Convert(reflect.TypeOf(uint8(0))).Interface() + case reflect.Uint16: + in = reflect.ValueOf(in).Convert(reflect.TypeOf(uint16(0))).Interface() + case reflect.Uint32: + in = reflect.ValueOf(in).Convert(reflect.TypeOf(uint32(0))).Interface() + case reflect.Uint64: + in = reflect.ValueOf(in).Convert(reflect.TypeOf(uint64(0))).Interface() + default: + err = fmt.Errorf("%w: %T", ErrUnsupportedCustomPrimitive, in) + return + } + err = es.marshal(in) + return +} + +func (es *encodeState) encodeResult(res Result) (err error) { + if !res.IsSet() { + err = fmt.Errorf("%w: %+v", ErrResultNotSet, res) + return + } + + var in interface{} + switch res.mode { + case OK: + _, err = es.Write([]byte{0}) + if err != nil { + return + } + in = res.ok + case Err: + _, err = es.Write([]byte{1}) + if err != nil { + return + } + in = res.err + } + switch in := in.(type) { + case empty: + default: + err = es.marshal(in) + } + return +} + +func (es *encodeState) encodeVaryingDataType(vdt EncodeVaryingDataType) (err error) { + index, value, err := vdt.IndexValue() + if err != nil { + return + } + _, err = es.Write([]byte{byte(index)}) + if err != nil { + return + } + err = es.marshal(value) + return +} + +func (es *encodeState) encodeSlice(in interface{}) (err error) { + v := reflect.ValueOf(in) + err = es.encodeLength(v.Len()) + if err != nil { + return + } + for i := 0; i < v.Len(); i++ { + err = es.marshal(v.Index(i).Interface()) + if err != nil { + return + } + } + return +} + +// encodeArray encodes an interface where the underlying type is an array +// it encodes and writes each value in the Array. Arrays of known size do not +// have the length prepended since you know the length when decoding +func (es *encodeState) encodeArray(in interface{}) (err error) { + v := reflect.ValueOf(in) + for i := 0; i < v.Len(); i++ { + err = es.marshal(v.Index(i).Interface()) + if err != nil { + return + } + } + return +} + +func (es *encodeState) encodeMap(in interface{}) (err error) { + v := reflect.ValueOf(in) + err = es.encodeLength(v.Len()) + if err != nil { + return fmt.Errorf("encoding length: %w", err) + } + + iterator := v.MapRange() + for iterator.Next() { + key := iterator.Key() + err = es.marshal(key.Interface()) + if err != nil { + return fmt.Errorf("encoding map key: %w", err) + } + + mapValue := iterator.Value() + if !mapValue.CanInterface() { + continue + } + + err = es.marshal(mapValue.Interface()) + if err != nil { + return fmt.Errorf("encoding map value: %w", err) + } + } + return nil +} + +// encodeBigInt performs the same encoding as encodeInteger, except on a big.Int. +// if 2^30 <= n < 2^536 write +// [lower 2 bits of first byte = 11] [upper 6 bits of first byte = # of bytes following less 4] +// [append i as a byte array to the first byte] +func (es *encodeState) encodeBigInt(i *big.Int) (err error) { + switch { + case i == nil: + err = fmt.Errorf("%w", errBigIntIsNil) + case i.Cmp(new(big.Int).Lsh(big.NewInt(1), 6)) < 0: + err = binary.Write(es, binary.LittleEndian, uint8(i.Int64()<<2)) + case i.Cmp(new(big.Int).Lsh(big.NewInt(1), 14)) < 0: + err = binary.Write(es, binary.LittleEndian, uint16(i.Int64()<<2)+1) + case i.Cmp(new(big.Int).Lsh(big.NewInt(1), 30)) < 0: + err = binary.Write(es, binary.LittleEndian, uint32(i.Int64()<<2)+2) + default: + numBytes := len(i.Bytes()) + topSixBits := uint8(numBytes - 4) + lengthByte := topSixBits<<2 + 3 + + // write byte which encodes mode and length + err = binary.Write(es, binary.LittleEndian, lengthByte) + if err == nil { + // write integer itself + err = binary.Write(es, binary.LittleEndian, reverseBytes(i.Bytes())) + if err != nil { + err = fmt.Errorf("writing bytes %s: %w", i, err) + } + } + } + return +} + +// encodeBool performs the following: +// l = true -> write [1] +// l = false -> write [0] +func (es *encodeState) encodeBool(l bool) (err error) { + switch l { + case true: + _, err = es.Write([]byte{0x01}) + case false: + _, err = es.Write([]byte{0x00}) + } + return +} + +// encodeByteArray performs the following: +// b -> [encodeInteger(len(b)) b] +// it writes to the buffer a byte array where the first byte is the length of b encoded with SCALE, followed by the +// byte array b itself +func (es *encodeState) encodeBytes(b []byte) (err error) { + err = es.encodeLength(len(b)) + if err != nil { + return + } + + _, err = es.Write(b) + return +} + +// encodeFixedWidthInt encodes an int with size < 2**32 by putting it into little endian byte format +func (es *encodeState) encodeFixedWidthInt(i interface{}) (err error) { + switch i := i.(type) { + case int8: + err = binary.Write(es, binary.LittleEndian, byte(i)) + case uint8: + err = binary.Write(es, binary.LittleEndian, i) + case int16: + err = binary.Write(es, binary.LittleEndian, uint16(i)) + case uint16: + err = binary.Write(es, binary.LittleEndian, i) + case int32: + err = binary.Write(es, binary.LittleEndian, uint32(i)) + case uint32: + err = binary.Write(es, binary.LittleEndian, i) + case int64: + err = binary.Write(es, binary.LittleEndian, uint64(i)) + case uint64: + err = binary.Write(es, binary.LittleEndian, i) + default: + err = fmt.Errorf("invalid type: %T", i) + } + return +} + +// encodeStruct reads the number of fields in the struct and their types +// and writes to the buffer each of the struct fields encoded +// as their respective types +func (es *encodeState) encodeStruct(in interface{}) (err error) { + v, indices, err := es.fieldScaleIndices(in) + if err != nil { + return + } + for _, i := range indices { + field := v.Field(i.fieldIndex) + if !field.CanInterface() { + continue + } + err = es.marshal(field.Interface()) + if err != nil { + return + } + } + return +} + +// encodeLength is a helper function that calls encodeUint, which is the scale length encoding +func (es *encodeState) encodeLength(l int) (err error) { + return es.encodeUint(uint(l)) +} + +// encodeUint performs the following on integer i: +// i -> i^0...i^n where n is the length in bits of i +// note that the bit representation of i is in little endian; ie i^0 is the least significant bit of i, +// and i^n is the most significant bit +// if n < 2^6 write [00 i^2...i^8 ] [ 8 bits = 1 byte encoded ] +// if 2^6 <= n < 2^14 write [01 i^2...i^16] [ 16 bits = 2 byte encoded ] +// if 2^14 <= n < 2^30 write [10 i^2...i^32] [ 32 bits = 4 byte encoded ] +// if n >= 2^30 write [lower 2 bits of first byte = 11] [upper 6 bits of first byte = # of bytes following less 4] +// [append i as a byte array to the first byte] +func (es *encodeState) encodeUint(i uint) (err error) { + switch { + case i < 1<<6: + err = binary.Write(es, binary.LittleEndian, byte(i)<<2) + case i < 1<<14: + err = binary.Write(es, binary.LittleEndian, uint16(i<<2)+1) + case i < 1<<30: + err = binary.Write(es, binary.LittleEndian, uint32(i<<2)+2) + default: + o := make([]byte, 8) + m := i + var numBytes int + // calculate the number of bytes needed to store i + // the most significant byte cannot be zero + // each iteration, shift by 1 byte until the number is zero + // then break and save the numBytes needed + for numBytes = 0; numBytes < 256 && m != 0; numBytes++ { + m = m >> 8 + } + + topSixBits := uint8(numBytes - 4) + lengthByte := topSixBits<<2 + 3 + + err = binary.Write(es, binary.LittleEndian, lengthByte) + if err == nil { + binary.LittleEndian.PutUint64(o, uint64(i)) + err = binary.Write(es, binary.LittleEndian, o[0:numBytes]) + } + } + return +} + +// encodeUint128 encodes a Uint128 +func (es *encodeState) encodeUint128(i *Uint128) (err error) { + if i == nil { + err = fmt.Errorf("%w", errUint128IsNil) + return + } + err = binary.Write(es, binary.LittleEndian, padBytes(i.Bytes(), binary.LittleEndian)) + return +} diff --git a/vendor/github.com/ChainSafe/gossamer/pkg/scale/errors.go b/vendor/github.com/ChainSafe/gossamer/pkg/scale/errors.go new file mode 100644 index 00000000..b0a2030f --- /dev/null +++ b/vendor/github.com/ChainSafe/gossamer/pkg/scale/errors.go @@ -0,0 +1,24 @@ +// Copyright 2022 ChainSafe Systems (ON) +// SPDX-License-Identifier: LGPL-3.0-only + +package scale + +import "errors" + +var ( + ErrUnsupportedDestination = errors.New("must be a non-nil pointer to a destination") + errDecodeBool = errors.New("invalid byte for bool") + ErrUnsupportedType = errors.New("unsupported type") + ErrUnsupportedResult = errors.New("unsupported result") + errUnsupportedOption = errors.New("unsupported option") + ErrUnknownVaryingDataTypeValue = errors.New("unable to find VaryingDataTypeValue with index") + errUint128IsNil = errors.New("uint128 in nil") + ErrResultNotSet = errors.New("result not set") + ErrResultAlreadySet = errors.New("result already has an assigned value") + ErrUnsupportedVaryingDataTypeValue = errors.New("unsupported VaryingDataTypeValue") + ErrMustProvideVaryingDataTypeValue = errors.New("must provide at least one VaryingDataTypeValue") + errBigIntIsNil = errors.New("big int is nil") + ErrVaryingDataTypeNotSet = errors.New("varying data type not set") + ErrUnsupportedCustomPrimitive = errors.New("unsupported type for custom primitive") + ErrInvalidScaleIndex = errors.New("invalid scale index") +) diff --git a/vendor/github.com/ChainSafe/gossamer/pkg/scale/result.go b/vendor/github.com/ChainSafe/gossamer/pkg/scale/result.go new file mode 100644 index 00000000..7e4adf5c --- /dev/null +++ b/vendor/github.com/ChainSafe/gossamer/pkg/scale/result.go @@ -0,0 +1,132 @@ +// Copyright 2021 ChainSafe Systems (ON) +// SPDX-License-Identifier: LGPL-3.0-only + +package scale + +import ( + "fmt" + "reflect" +) + +// ResultMode is the mode the Result is set to +type ResultMode int + +const ( + // Unset ResultMode is zero value mode + Unset ResultMode = iota + // OK case + OK + // Err case + Err +) + +// Result encapsulates an Ok or an Err case +type Result struct { + ok interface{} + err interface{} + mode ResultMode +} + +// NewResult is constructor for Result. Use nil to represent empty tuple () in Rust. +func NewResult(okIn, errIn interface{}) (res Result) { + switch okIn { + case nil: + res.ok = empty{} + default: + res.ok = okIn + } + switch errIn { + case nil: + res.err = empty{} + default: + res.err = errIn + } + return +} + +// Set takes in a mode (OK/Err) and the associated interface and sets the Result value +func (r *Result) Set(mode ResultMode, in interface{}) (err error) { + if r.mode != Unset { + return ErrResultAlreadySet + } + + switch mode { + case OK: + if reflect.TypeOf(r.ok) == reflect.TypeOf(empty{}) && in == nil { + r.mode = mode + return + } else if reflect.TypeOf(r.ok) != reflect.TypeOf(in) { + err = fmt.Errorf("type mistmatch for result.ok: %T, and inputted: %T", r.ok, in) + return + } + r.ok = in + r.mode = mode + case Err: + if reflect.TypeOf(r.err) == reflect.TypeOf(empty{}) && in == nil { + r.mode = mode + return + } else if reflect.TypeOf(r.err) != reflect.TypeOf(in) { + err = fmt.Errorf("type mistmatch for result.err: %T, and inputted: %T", r.ok, in) + return + } + r.err = in + r.mode = mode + default: + err = fmt.Errorf("invalid ResultMode %v", mode) + } + + return +} + +// UnsetResult is error when Result is unset with a value. +type UnsetResult error + +// Unwrap returns the result in go standard wrapping the Err case in a ResultErr +func (r *Result) Unwrap() (ok interface{}, err error) { + if !r.IsSet() { + err = UnsetResult(fmt.Errorf("result is not set")) + return + } + switch r.mode { + case OK: + switch r.ok.(type) { + case empty: + ok = nil + default: + ok = r.ok + } + case Err: + switch r.err.(type) { + case empty: + err = WrappedErr{nil} + default: + err = WrappedErr{r.err} + } + } + return +} + +// IsSet returns whether the Result is set with an Ok or Err value. +func (r *Result) IsSet() bool { + if r.ok == nil || r.err == nil { + return false + } + switch r.mode { + case OK, Err: + default: + return false + } + return true +} + +type empty struct{} + +// WrappedErr is returned by Result.Unwrap(). The underlying Err value is wrapped and stored in Err attribute +type WrappedErr struct { + Err interface{} +} + +// Error fulfils the error interface +func (r WrappedErr) Error() string { + return fmt.Sprintf("ResultErr %+v", r.Err) +} diff --git a/vendor/github.com/ChainSafe/gossamer/pkg/scale/scale.go b/vendor/github.com/ChainSafe/gossamer/pkg/scale/scale.go new file mode 100644 index 00000000..91328338 --- /dev/null +++ b/vendor/github.com/ChainSafe/gossamer/pkg/scale/scale.go @@ -0,0 +1,105 @@ +// Copyright 2021 ChainSafe Systems (ON) +// SPDX-License-Identifier: LGPL-3.0-only + +package scale + +import ( + "fmt" + "reflect" + "sort" + "strconv" + "strings" + "sync" +) + +// package level cache for fieldScaleIndicies +var cache = &fieldScaleIndicesCache{ + cache: make(map[string]fieldScaleIndices), +} + +// fieldScaleIndex is used to map field index to scale index +type fieldScaleIndex struct { + fieldIndex int + scaleIndex *int +} +type fieldScaleIndices []fieldScaleIndex + +// fieldScaleIndicesCache stores the order of the fields per struct +type fieldScaleIndicesCache struct { + cache map[string]fieldScaleIndices + sync.RWMutex +} + +func (fsic *fieldScaleIndicesCache) fieldScaleIndices(in interface{}) ( + v reflect.Value, indices fieldScaleIndices, err error) { + t := reflect.TypeOf(in) + v = reflect.ValueOf(in) + key := fmt.Sprintf("%s.%s", t.PkgPath(), t.Name()) + if key != "." { + var ok bool + fsic.RLock() + indices, ok = fsic.cache[key] + fsic.RUnlock() + if ok { + return + } + } + + if !v.IsValid() { + err = fmt.Errorf("inputted value is not valid: %v", v) + return + } + + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + tag := field.Tag.Get("scale") + switch strings.TrimSpace(tag) { + case "": + indices = append(indices, fieldScaleIndex{ + fieldIndex: i, + }) + case "-": + // ignore this field + continue + default: + scaleIndex, indexErr := strconv.Atoi(tag) + if indexErr != nil { + err = fmt.Errorf("%w: %v", ErrInvalidScaleIndex, indexErr) + return + } + indices = append(indices, fieldScaleIndex{ + fieldIndex: i, + scaleIndex: &scaleIndex, + }) + } + } + + sort.Slice(indices[:], func(i, j int) bool { + switch { + case indices[i].scaleIndex == nil && indices[j].scaleIndex != nil: + return false + case indices[i].scaleIndex != nil && indices[j].scaleIndex == nil: + return true + case indices[i].scaleIndex == nil && indices[j].scaleIndex == nil: + return indices[i].fieldIndex < indices[j].fieldIndex + case indices[i].scaleIndex != nil && indices[j].scaleIndex != nil: + return *indices[i].scaleIndex < *indices[j].scaleIndex + } + return false + }) + + if key != "." { + fsic.Lock() + fsic.cache[key] = indices + fsic.Unlock() + } + return +} + +func reverseBytes(a []byte) []byte { + for i := len(a)/2 - 1; i >= 0; i-- { + opp := len(a) - 1 - i + a[i], a[opp] = a[opp], a[i] + } + return a +} diff --git a/vendor/github.com/ChainSafe/gossamer/pkg/scale/uint128.go b/vendor/github.com/ChainSafe/gossamer/pkg/scale/uint128.go new file mode 100644 index 00000000..5149c08d --- /dev/null +++ b/vendor/github.com/ChainSafe/gossamer/pkg/scale/uint128.go @@ -0,0 +1,168 @@ +// Copyright 2021 ChainSafe Systems (ON) +// SPDX-License-Identifier: LGPL-3.0-only + +package scale + +import ( + "encoding/binary" + "fmt" + "math/big" +) + +// Uint128 represents an unsigned 128 bit integer +type Uint128 struct { + Upper uint64 + Lower uint64 +} + +// MaxUint128 is the maximum uint128 value +var MaxUint128 = &Uint128{ + Upper: ^uint64(0), + Lower: ^uint64(0), +} + +// MustNewUint128 will panic if NewUint128 returns an error +func MustNewUint128(in interface{}, order ...binary.ByteOrder) (u *Uint128) { + u, err := NewUint128(in, order...) + if err != nil { + panic(err) + } + return +} + +func padBytes(b []byte, order binary.ByteOrder) []byte { + for len(b) != 16 { + switch order { + case binary.BigEndian: + b = append([]byte{0}, b...) + case binary.LittleEndian: + b = append(b, 0) + } + } + return b +} + +// NewUint128 is constructor for Uint128 that accepts an option binary.ByteOrder +// option is only used when inputted interface{} is of type []byte +// by default binary.LittleEndian is used for []byte since this is SCALE +func NewUint128(in interface{}, order ...binary.ByteOrder) (u *Uint128, err error) { + switch in := in.(type) { + case *big.Int: + bytes := in.Bytes() + if len(bytes) < 16 { + bytes = padBytes(bytes, binary.BigEndian) + } + u = &Uint128{ + Upper: binary.BigEndian.Uint64(bytes[:8]), + Lower: binary.BigEndian.Uint64(bytes[8:]), + } + case []byte: + var o binary.ByteOrder = binary.LittleEndian + if len(order) > 0 { + o = order[0] + } + if len(in) < 16 { + in = padBytes(in, o) + } + u = &Uint128{ + Upper: o.Uint64(in[8:]), + Lower: o.Uint64(in[:8]), + } + default: + err = fmt.Errorf("unsupported type: %T", in) + } + return +} + +// Bytes returns the Uint128 in little endian format by default. A variadic parameter +// order can be used to specify the binary.ByteOrder used +func (u *Uint128) Bytes(order ...binary.ByteOrder) (b []byte) { + var o binary.ByteOrder = binary.LittleEndian + if len(order) > 0 { + o = order[0] + } + b = make([]byte, 16) + switch o { + case binary.LittleEndian: + o.PutUint64(b[:8], u.Lower) + o.PutUint64(b[8:], u.Upper) + b = u.trimBytes(b, o) + case binary.BigEndian: + o.PutUint64(b[:8], u.Upper) + o.PutUint64(b[8:], u.Lower) + b = u.trimBytes(b, o) + } + return +} + +// String returns the string format from the Uint128 value +func (u *Uint128) String() string { + return fmt.Sprintf("%d", big.NewInt(0).SetBytes(u.Bytes())) +} + +// Compare returns 1 if the receiver is greater than other, 0 if they are equal, and -1 otherwise. +func (u *Uint128) Compare(other *Uint128) int { + switch { + case u.Upper > other.Upper: + return 1 + case u.Upper < other.Upper: + return -1 + case u.Upper == other.Upper: + switch { + case u.Lower > other.Lower: + return 1 + case u.Lower < other.Lower: + return -1 + } + } + return 0 +} + +func (*Uint128) trimBytes(b []byte, order binary.ByteOrder) []byte { + switch order { + case binary.LittleEndian: + for { + if len(b) == 0 { + return b + } + if b[len(b)-1] == 0 { + b = b[:len(b)-1] + } else { + break + } + } + case binary.BigEndian: + for { + if len(b) == 0 { + return b + } + if b[0] == 0 { + b = b[1:] + } else { + break + } + } + } + return b +} + +// UnmarshalJSON converts data to Uint128. +func (u *Uint128) UnmarshalJSON(data []byte) error { + intVal, ok := big.NewInt(0).SetString(string(data), 10) + if !ok { + return fmt.Errorf("failed to unmarshal Uint128") + } + + dec, err := NewUint128(intVal) + if err != nil { + return fmt.Errorf("creating uint128 from big integer: %w", err) + } + u.Upper = dec.Upper + u.Lower = dec.Lower + return nil +} + +// MarshalJSON converts Uint128 to []byte. +func (u Uint128) MarshalJSON() ([]byte, error) { + return []byte(u.String()), nil +} diff --git a/vendor/github.com/ChainSafe/gossamer/pkg/scale/varying_data_type.go b/vendor/github.com/ChainSafe/gossamer/pkg/scale/varying_data_type.go new file mode 100644 index 00000000..a829a78c --- /dev/null +++ b/vendor/github.com/ChainSafe/gossamer/pkg/scale/varying_data_type.go @@ -0,0 +1,18 @@ +// Copyright 2021 ChainSafe Systems (ON) +// SPDX-License-Identifier: LGPL-3.0-only + +package scale + +// EncodeVaryingDataType is used in VaryingDataType. It contains the methods required +// for encoding. +type EncodeVaryingDataType interface { + IndexValue() (index uint, value any, err error) + Value() (value any, err error) + ValueAt(index uint) (value any, err error) +} + +// VaryingDataType is analogous to a rust enum. Name is taken from polkadot spec. +type VaryingDataType interface { + EncodeVaryingDataType + SetValue(value any) (err error) +} diff --git a/vendor/modules.txt b/vendor/modules.txt new file mode 100644 index 00000000..d01469dc --- /dev/null +++ b/vendor/modules.txt @@ -0,0 +1,3 @@ +# github.com/ChainSafe/gossamer v0.9.0 +## explicit; go 1.21 +github.com/ChainSafe/gossamer/pkg/scale