diff --git a/internal/app/consumer.go b/internal/app/consumer.go index 3ebfecaa..41f74172 100644 --- a/internal/app/consumer.go +++ b/internal/app/consumer.go @@ -34,7 +34,7 @@ func Consumer() { pos := pos.New(ethRPC) db.Start() - correctnessService := correctnessService.New(ethRPC) + correctnessService := correctnessService.New(ethRPC, pos) evmLogService := evmlogService.New(ethRPC, pos) uniswapService := uniswapService.New(ethRPC, pos) diff --git a/internal/datasets/bls.go b/internal/datasets/bls.go index 48eb7464..417ce0c1 100644 --- a/internal/datasets/bls.go +++ b/internal/datasets/bls.go @@ -15,14 +15,12 @@ type Signer struct { type Signature struct { Signature bls12381.G1Affine Signer Signer - Processed bool } func (s *Signature) Sia() *sia.Sia { return new(sia.Sia). AddByteArray8(s.Signature.Marshal()). - EmbedSia(s.Signer.Sia()). - AddBool(s.Processed) + EmbedSia(s.Signer.Sia()) } func (s *Signature) DeSia(sia *sia.Sia) *Signature { @@ -33,7 +31,6 @@ func (s *Signature) DeSia(sia *sia.Sia) *Signature { } s.Signer.DeSia(sia) - s.Processed = sia.ReadBool() return s } diff --git a/internal/ent/assetprice.go b/internal/ent/assetprice.go index bcf57736..98ee6b6d 100644 --- a/internal/ent/assetprice.go +++ b/internal/ent/assetprice.go @@ -31,6 +31,10 @@ type AssetPrice struct { Chain string `json:"chain,omitempty"` // Pair holds the value of the "pair" field. Pair string `json:"pair,omitempty"` + // Consensus holds the value of the "consensus" field. + Consensus bool `json:"consensus,omitempty"` + // Voted holds the value of the "voted" field. + Voted *helpers.BigInt `json:"voted,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the AssetPriceQuery when eager-loading is set. Edges AssetPriceEdges `json:"edges"` @@ -66,8 +70,10 @@ func (*AssetPrice) scanValues(columns []string) ([]any, error) { switch columns[i] { case assetprice.FieldSignature: values[i] = new([]byte) - case assetprice.FieldPrice: + case assetprice.FieldPrice, assetprice.FieldVoted: values[i] = new(helpers.BigInt) + case assetprice.FieldConsensus: + values[i] = new(sql.NullBool) case assetprice.FieldID, assetprice.FieldBlock, assetprice.FieldSignersCount: values[i] = new(sql.NullInt64) case assetprice.FieldAsset, assetprice.FieldChain, assetprice.FieldPair: @@ -136,6 +142,18 @@ func (ap *AssetPrice) assignValues(columns []string, values []any) error { } else if value.Valid { ap.Pair = value.String } + case assetprice.FieldConsensus: + if value, ok := values[i].(*sql.NullBool); !ok { + return fmt.Errorf("unexpected type %T for field consensus", values[i]) + } else if value.Valid { + ap.Consensus = value.Bool + } + case assetprice.FieldVoted: + if value, ok := values[i].(*helpers.BigInt); !ok { + return fmt.Errorf("unexpected type %T for field voted", values[i]) + } else if value != nil { + ap.Voted = value + } default: ap.selectValues.Set(columns[i], values[i]) } @@ -199,6 +217,12 @@ func (ap *AssetPrice) String() string { builder.WriteString(", ") builder.WriteString("pair=") builder.WriteString(ap.Pair) + builder.WriteString(", ") + builder.WriteString("consensus=") + builder.WriteString(fmt.Sprintf("%v", ap.Consensus)) + builder.WriteString(", ") + builder.WriteString("voted=") + builder.WriteString(fmt.Sprintf("%v", ap.Voted)) builder.WriteByte(')') return builder.String() } diff --git a/internal/ent/assetprice/assetprice.go b/internal/ent/assetprice/assetprice.go index 440c5aa9..e233d7d7 100644 --- a/internal/ent/assetprice/assetprice.go +++ b/internal/ent/assetprice/assetprice.go @@ -26,6 +26,10 @@ const ( FieldChain = "chain" // FieldPair holds the string denoting the pair field in the database. FieldPair = "pair" + // FieldConsensus holds the string denoting the consensus field in the database. + FieldConsensus = "consensus" + // FieldVoted holds the string denoting the voted field in the database. + FieldVoted = "voted" // EdgeSigners holds the string denoting the signers edge name in mutations. EdgeSigners = "signers" // Table holds the table name of the assetprice in the database. @@ -47,6 +51,8 @@ var Columns = []string{ FieldAsset, FieldChain, FieldPair, + FieldConsensus, + FieldVoted, } var ( @@ -68,6 +74,8 @@ func ValidColumn(column string) bool { var ( // SignatureValidator is a validator for the "signature" field. It is called by the builders before save. SignatureValidator func([]byte) error + // DefaultConsensus holds the default value on creation for the "consensus" field. + DefaultConsensus bool ) // OrderOption defines the ordering options for the AssetPrice queries. @@ -108,6 +116,16 @@ func ByPair(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPair, opts...).ToFunc() } +// ByConsensus orders the results by the consensus field. +func ByConsensus(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldConsensus, opts...).ToFunc() +} + +// ByVoted orders the results by the voted field. +func ByVoted(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldVoted, opts...).ToFunc() +} + // BySignersCount orders the results by signers count. func BySignersCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { diff --git a/internal/ent/assetprice/where.go b/internal/ent/assetprice/where.go index d4a9dbc2..6b749abb 100644 --- a/internal/ent/assetprice/where.go +++ b/internal/ent/assetprice/where.go @@ -89,6 +89,16 @@ func Pair(v string) predicate.AssetPrice { return predicate.AssetPrice(sql.FieldEQ(FieldPair, v)) } +// Consensus applies equality check predicate on the "consensus" field. It's identical to ConsensusEQ. +func Consensus(v bool) predicate.AssetPrice { + return predicate.AssetPrice(sql.FieldEQ(FieldConsensus, v)) +} + +// Voted applies equality check predicate on the "voted" field. It's identical to VotedEQ. +func Voted(v *helpers.BigInt) predicate.AssetPrice { + return predicate.AssetPrice(sql.FieldEQ(FieldVoted, v)) +} + // BlockEQ applies the EQ predicate on the "block" field. func BlockEQ(v uint64) predicate.AssetPrice { return predicate.AssetPrice(sql.FieldEQ(FieldBlock, v)) @@ -484,6 +494,56 @@ func PairContainsFold(v string) predicate.AssetPrice { return predicate.AssetPrice(sql.FieldContainsFold(FieldPair, v)) } +// ConsensusEQ applies the EQ predicate on the "consensus" field. +func ConsensusEQ(v bool) predicate.AssetPrice { + return predicate.AssetPrice(sql.FieldEQ(FieldConsensus, v)) +} + +// ConsensusNEQ applies the NEQ predicate on the "consensus" field. +func ConsensusNEQ(v bool) predicate.AssetPrice { + return predicate.AssetPrice(sql.FieldNEQ(FieldConsensus, v)) +} + +// VotedEQ applies the EQ predicate on the "voted" field. +func VotedEQ(v *helpers.BigInt) predicate.AssetPrice { + return predicate.AssetPrice(sql.FieldEQ(FieldVoted, v)) +} + +// VotedNEQ applies the NEQ predicate on the "voted" field. +func VotedNEQ(v *helpers.BigInt) predicate.AssetPrice { + return predicate.AssetPrice(sql.FieldNEQ(FieldVoted, v)) +} + +// VotedIn applies the In predicate on the "voted" field. +func VotedIn(vs ...*helpers.BigInt) predicate.AssetPrice { + return predicate.AssetPrice(sql.FieldIn(FieldVoted, vs...)) +} + +// VotedNotIn applies the NotIn predicate on the "voted" field. +func VotedNotIn(vs ...*helpers.BigInt) predicate.AssetPrice { + return predicate.AssetPrice(sql.FieldNotIn(FieldVoted, vs...)) +} + +// VotedGT applies the GT predicate on the "voted" field. +func VotedGT(v *helpers.BigInt) predicate.AssetPrice { + return predicate.AssetPrice(sql.FieldGT(FieldVoted, v)) +} + +// VotedGTE applies the GTE predicate on the "voted" field. +func VotedGTE(v *helpers.BigInt) predicate.AssetPrice { + return predicate.AssetPrice(sql.FieldGTE(FieldVoted, v)) +} + +// VotedLT applies the LT predicate on the "voted" field. +func VotedLT(v *helpers.BigInt) predicate.AssetPrice { + return predicate.AssetPrice(sql.FieldLT(FieldVoted, v)) +} + +// VotedLTE applies the LTE predicate on the "voted" field. +func VotedLTE(v *helpers.BigInt) predicate.AssetPrice { + return predicate.AssetPrice(sql.FieldLTE(FieldVoted, v)) +} + // HasSigners applies the HasEdge predicate on the "signers" edge. func HasSigners() predicate.AssetPrice { return predicate.AssetPrice(func(s *sql.Selector) { diff --git a/internal/ent/assetprice_create.go b/internal/ent/assetprice_create.go index 97b47cb8..7a77a196 100644 --- a/internal/ent/assetprice_create.go +++ b/internal/ent/assetprice_create.go @@ -97,6 +97,26 @@ func (apc *AssetPriceCreate) SetNillablePair(s *string) *AssetPriceCreate { return apc } +// SetConsensus sets the "consensus" field. +func (apc *AssetPriceCreate) SetConsensus(b bool) *AssetPriceCreate { + apc.mutation.SetConsensus(b) + return apc +} + +// SetNillableConsensus sets the "consensus" field if the given value is not nil. +func (apc *AssetPriceCreate) SetNillableConsensus(b *bool) *AssetPriceCreate { + if b != nil { + apc.SetConsensus(*b) + } + return apc +} + +// SetVoted sets the "voted" field. +func (apc *AssetPriceCreate) SetVoted(hi *helpers.BigInt) *AssetPriceCreate { + apc.mutation.SetVoted(hi) + return apc +} + // AddSignerIDs adds the "signers" edge to the Signer entity by IDs. func (apc *AssetPriceCreate) AddSignerIDs(ids ...int) *AssetPriceCreate { apc.mutation.AddSignerIDs(ids...) @@ -119,6 +139,7 @@ func (apc *AssetPriceCreate) Mutation() *AssetPriceMutation { // Save creates the AssetPrice in the database. func (apc *AssetPriceCreate) Save(ctx context.Context) (*AssetPrice, error) { + apc.defaults() return withHooks(ctx, apc.sqlSave, apc.mutation, apc.hooks) } @@ -144,6 +165,14 @@ func (apc *AssetPriceCreate) ExecX(ctx context.Context) { } } +// defaults sets the default values of the builder before save. +func (apc *AssetPriceCreate) defaults() { + if _, ok := apc.mutation.Consensus(); !ok { + v := assetprice.DefaultConsensus + apc.mutation.SetConsensus(v) + } +} + // check runs all checks and user-defined validators on the builder. func (apc *AssetPriceCreate) check() error { if _, ok := apc.mutation.Block(); !ok { @@ -160,6 +189,12 @@ func (apc *AssetPriceCreate) check() error { return &ValidationError{Name: "signature", err: fmt.Errorf(`ent: validator failed for field "AssetPrice.signature": %w`, err)} } } + if _, ok := apc.mutation.Consensus(); !ok { + return &ValidationError{Name: "consensus", err: errors.New(`ent: missing required field "AssetPrice.consensus"`)} + } + if _, ok := apc.mutation.Voted(); !ok { + return &ValidationError{Name: "voted", err: errors.New(`ent: missing required field "AssetPrice.voted"`)} + } if len(apc.mutation.SignersIDs()) == 0 { return &ValidationError{Name: "signers", err: errors.New(`ent: missing required edge "AssetPrice.signers"`)} } @@ -218,6 +253,14 @@ func (apc *AssetPriceCreate) createSpec() (*AssetPrice, *sqlgraph.CreateSpec) { _spec.SetField(assetprice.FieldPair, field.TypeString, value) _node.Pair = value } + if value, ok := apc.mutation.Consensus(); ok { + _spec.SetField(assetprice.FieldConsensus, field.TypeBool, value) + _node.Consensus = value + } + if value, ok := apc.mutation.Voted(); ok { + _spec.SetField(assetprice.FieldVoted, field.TypeUint, value) + _node.Voted = value + } if nodes := apc.mutation.SignersIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, @@ -406,6 +449,30 @@ func (u *AssetPriceUpsert) ClearPair() *AssetPriceUpsert { return u } +// SetConsensus sets the "consensus" field. +func (u *AssetPriceUpsert) SetConsensus(v bool) *AssetPriceUpsert { + u.Set(assetprice.FieldConsensus, v) + return u +} + +// UpdateConsensus sets the "consensus" field to the value that was provided on create. +func (u *AssetPriceUpsert) UpdateConsensus() *AssetPriceUpsert { + u.SetExcluded(assetprice.FieldConsensus) + return u +} + +// SetVoted sets the "voted" field. +func (u *AssetPriceUpsert) SetVoted(v *helpers.BigInt) *AssetPriceUpsert { + u.Set(assetprice.FieldVoted, v) + return u +} + +// UpdateVoted sets the "voted" field to the value that was provided on create. +func (u *AssetPriceUpsert) UpdateVoted() *AssetPriceUpsert { + u.SetExcluded(assetprice.FieldVoted) + return u +} + // UpdateNewValues updates the mutable fields using the new values that were set on create. // Using this option is equivalent to using: // @@ -586,6 +653,34 @@ func (u *AssetPriceUpsertOne) ClearPair() *AssetPriceUpsertOne { }) } +// SetConsensus sets the "consensus" field. +func (u *AssetPriceUpsertOne) SetConsensus(v bool) *AssetPriceUpsertOne { + return u.Update(func(s *AssetPriceUpsert) { + s.SetConsensus(v) + }) +} + +// UpdateConsensus sets the "consensus" field to the value that was provided on create. +func (u *AssetPriceUpsertOne) UpdateConsensus() *AssetPriceUpsertOne { + return u.Update(func(s *AssetPriceUpsert) { + s.UpdateConsensus() + }) +} + +// SetVoted sets the "voted" field. +func (u *AssetPriceUpsertOne) SetVoted(v *helpers.BigInt) *AssetPriceUpsertOne { + return u.Update(func(s *AssetPriceUpsert) { + s.SetVoted(v) + }) +} + +// UpdateVoted sets the "voted" field to the value that was provided on create. +func (u *AssetPriceUpsertOne) UpdateVoted() *AssetPriceUpsertOne { + return u.Update(func(s *AssetPriceUpsert) { + s.UpdateVoted() + }) +} + // Exec executes the query. func (u *AssetPriceUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { @@ -638,6 +733,7 @@ func (apcb *AssetPriceCreateBulk) Save(ctx context.Context) ([]*AssetPrice, erro for i := range apcb.builders { func(i int, root context.Context) { builder := apcb.builders[i] + builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*AssetPriceMutation) if !ok { @@ -929,6 +1025,34 @@ func (u *AssetPriceUpsertBulk) ClearPair() *AssetPriceUpsertBulk { }) } +// SetConsensus sets the "consensus" field. +func (u *AssetPriceUpsertBulk) SetConsensus(v bool) *AssetPriceUpsertBulk { + return u.Update(func(s *AssetPriceUpsert) { + s.SetConsensus(v) + }) +} + +// UpdateConsensus sets the "consensus" field to the value that was provided on create. +func (u *AssetPriceUpsertBulk) UpdateConsensus() *AssetPriceUpsertBulk { + return u.Update(func(s *AssetPriceUpsert) { + s.UpdateConsensus() + }) +} + +// SetVoted sets the "voted" field. +func (u *AssetPriceUpsertBulk) SetVoted(v *helpers.BigInt) *AssetPriceUpsertBulk { + return u.Update(func(s *AssetPriceUpsert) { + s.SetVoted(v) + }) +} + +// UpdateVoted sets the "voted" field to the value that was provided on create. +func (u *AssetPriceUpsertBulk) UpdateVoted() *AssetPriceUpsertBulk { + return u.Update(func(s *AssetPriceUpsert) { + s.UpdateVoted() + }) +} + // Exec executes the query. func (u *AssetPriceUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { diff --git a/internal/ent/assetprice_update.go b/internal/ent/assetprice_update.go index 74be2e13..5a71f59a 100644 --- a/internal/ent/assetprice_update.go +++ b/internal/ent/assetprice_update.go @@ -149,6 +149,26 @@ func (apu *AssetPriceUpdate) ClearPair() *AssetPriceUpdate { return apu } +// SetConsensus sets the "consensus" field. +func (apu *AssetPriceUpdate) SetConsensus(b bool) *AssetPriceUpdate { + apu.mutation.SetConsensus(b) + return apu +} + +// SetNillableConsensus sets the "consensus" field if the given value is not nil. +func (apu *AssetPriceUpdate) SetNillableConsensus(b *bool) *AssetPriceUpdate { + if b != nil { + apu.SetConsensus(*b) + } + return apu +} + +// SetVoted sets the "voted" field. +func (apu *AssetPriceUpdate) SetVoted(hi *helpers.BigInt) *AssetPriceUpdate { + apu.mutation.SetVoted(hi) + return apu +} + // AddSignerIDs adds the "signers" edge to the Signer entity by IDs. func (apu *AssetPriceUpdate) AddSignerIDs(ids ...int) *AssetPriceUpdate { apu.mutation.AddSignerIDs(ids...) @@ -278,6 +298,12 @@ func (apu *AssetPriceUpdate) sqlSave(ctx context.Context) (n int, err error) { if apu.mutation.PairCleared() { _spec.ClearField(assetprice.FieldPair, field.TypeString) } + if value, ok := apu.mutation.Consensus(); ok { + _spec.SetField(assetprice.FieldConsensus, field.TypeBool, value) + } + if value, ok := apu.mutation.Voted(); ok { + _spec.SetField(assetprice.FieldVoted, field.TypeUint, value) + } if apu.mutation.SignersCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, @@ -463,6 +489,26 @@ func (apuo *AssetPriceUpdateOne) ClearPair() *AssetPriceUpdateOne { return apuo } +// SetConsensus sets the "consensus" field. +func (apuo *AssetPriceUpdateOne) SetConsensus(b bool) *AssetPriceUpdateOne { + apuo.mutation.SetConsensus(b) + return apuo +} + +// SetNillableConsensus sets the "consensus" field if the given value is not nil. +func (apuo *AssetPriceUpdateOne) SetNillableConsensus(b *bool) *AssetPriceUpdateOne { + if b != nil { + apuo.SetConsensus(*b) + } + return apuo +} + +// SetVoted sets the "voted" field. +func (apuo *AssetPriceUpdateOne) SetVoted(hi *helpers.BigInt) *AssetPriceUpdateOne { + apuo.mutation.SetVoted(hi) + return apuo +} + // AddSignerIDs adds the "signers" edge to the Signer entity by IDs. func (apuo *AssetPriceUpdateOne) AddSignerIDs(ids ...int) *AssetPriceUpdateOne { apuo.mutation.AddSignerIDs(ids...) @@ -622,6 +668,12 @@ func (apuo *AssetPriceUpdateOne) sqlSave(ctx context.Context) (_node *AssetPrice if apuo.mutation.PairCleared() { _spec.ClearField(assetprice.FieldPair, field.TypeString) } + if value, ok := apuo.mutation.Consensus(); ok { + _spec.SetField(assetprice.FieldConsensus, field.TypeBool, value) + } + if value, ok := apuo.mutation.Voted(); ok { + _spec.SetField(assetprice.FieldVoted, field.TypeUint, value) + } if apuo.mutation.SignersCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, diff --git a/internal/ent/correctnessreport.go b/internal/ent/correctnessreport.go index 31285f70..99787efc 100644 --- a/internal/ent/correctnessreport.go +++ b/internal/ent/correctnessreport.go @@ -9,6 +9,7 @@ import ( "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/KenshiTech/unchained/internal/ent/correctnessreport" + "github.com/KenshiTech/unchained/internal/ent/helpers" ) // CorrectnessReport is the model entity for the CorrectnessReport schema. @@ -28,6 +29,10 @@ type CorrectnessReport struct { Topic []byte `json:"topic,omitempty"` // Correct holds the value of the "correct" field. Correct bool `json:"correct,omitempty"` + // Consensus holds the value of the "consensus" field. + Consensus bool `json:"consensus,omitempty"` + // Voted holds the value of the "voted" field. + Voted *helpers.BigInt `json:"voted,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the CorrectnessReportQuery when eager-loading is set. Edges CorrectnessReportEdges `json:"edges"` @@ -63,7 +68,9 @@ func (*CorrectnessReport) scanValues(columns []string) ([]any, error) { switch columns[i] { case correctnessreport.FieldSignature, correctnessreport.FieldHash, correctnessreport.FieldTopic: values[i] = new([]byte) - case correctnessreport.FieldCorrect: + case correctnessreport.FieldVoted: + values[i] = new(helpers.BigInt) + case correctnessreport.FieldCorrect, correctnessreport.FieldConsensus: values[i] = new(sql.NullBool) case correctnessreport.FieldID, correctnessreport.FieldSignersCount, correctnessreport.FieldTimestamp: values[i] = new(sql.NullInt64) @@ -124,6 +131,18 @@ func (cr *CorrectnessReport) assignValues(columns []string, values []any) error } else if value.Valid { cr.Correct = value.Bool } + case correctnessreport.FieldConsensus: + if value, ok := values[i].(*sql.NullBool); !ok { + return fmt.Errorf("unexpected type %T for field consensus", values[i]) + } else if value.Valid { + cr.Consensus = value.Bool + } + case correctnessreport.FieldVoted: + if value, ok := values[i].(*helpers.BigInt); !ok { + return fmt.Errorf("unexpected type %T for field voted", values[i]) + } else if value != nil { + cr.Voted = value + } default: cr.selectValues.Set(columns[i], values[i]) } @@ -182,6 +201,12 @@ func (cr *CorrectnessReport) String() string { builder.WriteString(", ") builder.WriteString("correct=") builder.WriteString(fmt.Sprintf("%v", cr.Correct)) + builder.WriteString(", ") + builder.WriteString("consensus=") + builder.WriteString(fmt.Sprintf("%v", cr.Consensus)) + builder.WriteString(", ") + builder.WriteString("voted=") + builder.WriteString(fmt.Sprintf("%v", cr.Voted)) builder.WriteByte(')') return builder.String() } diff --git a/internal/ent/correctnessreport/correctnessreport.go b/internal/ent/correctnessreport/correctnessreport.go index abcae921..bc6ba45c 100644 --- a/internal/ent/correctnessreport/correctnessreport.go +++ b/internal/ent/correctnessreport/correctnessreport.go @@ -24,6 +24,10 @@ const ( FieldTopic = "topic" // FieldCorrect holds the string denoting the correct field in the database. FieldCorrect = "correct" + // FieldConsensus holds the string denoting the consensus field in the database. + FieldConsensus = "consensus" + // FieldVoted holds the string denoting the voted field in the database. + FieldVoted = "voted" // EdgeSigners holds the string denoting the signers edge name in mutations. EdgeSigners = "signers" // Table holds the table name of the correctnessreport in the database. @@ -44,6 +48,8 @@ var Columns = []string{ FieldHash, FieldTopic, FieldCorrect, + FieldConsensus, + FieldVoted, } var ( @@ -69,6 +75,8 @@ var ( HashValidator func([]byte) error // TopicValidator is a validator for the "topic" field. It is called by the builders before save. TopicValidator func([]byte) error + // DefaultConsensus holds the default value on creation for the "consensus" field. + DefaultConsensus bool ) // OrderOption defines the ordering options for the CorrectnessReport queries. @@ -94,6 +102,16 @@ func ByCorrect(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCorrect, opts...).ToFunc() } +// ByConsensus orders the results by the consensus field. +func ByConsensus(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldConsensus, opts...).ToFunc() +} + +// ByVoted orders the results by the voted field. +func ByVoted(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldVoted, opts...).ToFunc() +} + // BySignersCount orders the results by signers count. func BySignersCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { diff --git a/internal/ent/correctnessreport/where.go b/internal/ent/correctnessreport/where.go index d0db9eac..c6341df6 100644 --- a/internal/ent/correctnessreport/where.go +++ b/internal/ent/correctnessreport/where.go @@ -5,6 +5,7 @@ package correctnessreport import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" + "github.com/KenshiTech/unchained/internal/ent/helpers" "github.com/KenshiTech/unchained/internal/ent/predicate" ) @@ -83,6 +84,16 @@ func Correct(v bool) predicate.CorrectnessReport { return predicate.CorrectnessReport(sql.FieldEQ(FieldCorrect, v)) } +// Consensus applies equality check predicate on the "consensus" field. It's identical to ConsensusEQ. +func Consensus(v bool) predicate.CorrectnessReport { + return predicate.CorrectnessReport(sql.FieldEQ(FieldConsensus, v)) +} + +// Voted applies equality check predicate on the "voted" field. It's identical to VotedEQ. +func Voted(v *helpers.BigInt) predicate.CorrectnessReport { + return predicate.CorrectnessReport(sql.FieldEQ(FieldVoted, v)) +} + // SignersCountEQ applies the EQ predicate on the "signersCount" field. func SignersCountEQ(v uint64) predicate.CorrectnessReport { return predicate.CorrectnessReport(sql.FieldEQ(FieldSignersCount, v)) @@ -293,6 +304,56 @@ func CorrectNEQ(v bool) predicate.CorrectnessReport { return predicate.CorrectnessReport(sql.FieldNEQ(FieldCorrect, v)) } +// ConsensusEQ applies the EQ predicate on the "consensus" field. +func ConsensusEQ(v bool) predicate.CorrectnessReport { + return predicate.CorrectnessReport(sql.FieldEQ(FieldConsensus, v)) +} + +// ConsensusNEQ applies the NEQ predicate on the "consensus" field. +func ConsensusNEQ(v bool) predicate.CorrectnessReport { + return predicate.CorrectnessReport(sql.FieldNEQ(FieldConsensus, v)) +} + +// VotedEQ applies the EQ predicate on the "voted" field. +func VotedEQ(v *helpers.BigInt) predicate.CorrectnessReport { + return predicate.CorrectnessReport(sql.FieldEQ(FieldVoted, v)) +} + +// VotedNEQ applies the NEQ predicate on the "voted" field. +func VotedNEQ(v *helpers.BigInt) predicate.CorrectnessReport { + return predicate.CorrectnessReport(sql.FieldNEQ(FieldVoted, v)) +} + +// VotedIn applies the In predicate on the "voted" field. +func VotedIn(vs ...*helpers.BigInt) predicate.CorrectnessReport { + return predicate.CorrectnessReport(sql.FieldIn(FieldVoted, vs...)) +} + +// VotedNotIn applies the NotIn predicate on the "voted" field. +func VotedNotIn(vs ...*helpers.BigInt) predicate.CorrectnessReport { + return predicate.CorrectnessReport(sql.FieldNotIn(FieldVoted, vs...)) +} + +// VotedGT applies the GT predicate on the "voted" field. +func VotedGT(v *helpers.BigInt) predicate.CorrectnessReport { + return predicate.CorrectnessReport(sql.FieldGT(FieldVoted, v)) +} + +// VotedGTE applies the GTE predicate on the "voted" field. +func VotedGTE(v *helpers.BigInt) predicate.CorrectnessReport { + return predicate.CorrectnessReport(sql.FieldGTE(FieldVoted, v)) +} + +// VotedLT applies the LT predicate on the "voted" field. +func VotedLT(v *helpers.BigInt) predicate.CorrectnessReport { + return predicate.CorrectnessReport(sql.FieldLT(FieldVoted, v)) +} + +// VotedLTE applies the LTE predicate on the "voted" field. +func VotedLTE(v *helpers.BigInt) predicate.CorrectnessReport { + return predicate.CorrectnessReport(sql.FieldLTE(FieldVoted, v)) +} + // HasSigners applies the HasEdge predicate on the "signers" edge. func HasSigners() predicate.CorrectnessReport { return predicate.CorrectnessReport(func(s *sql.Selector) { diff --git a/internal/ent/correctnessreport_create.go b/internal/ent/correctnessreport_create.go index 147980b6..cdb0c90f 100644 --- a/internal/ent/correctnessreport_create.go +++ b/internal/ent/correctnessreport_create.go @@ -11,6 +11,7 @@ import ( "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/KenshiTech/unchained/internal/ent/correctnessreport" + "github.com/KenshiTech/unchained/internal/ent/helpers" "github.com/KenshiTech/unchained/internal/ent/signer" ) @@ -58,6 +59,26 @@ func (crc *CorrectnessReportCreate) SetCorrect(b bool) *CorrectnessReportCreate return crc } +// SetConsensus sets the "consensus" field. +func (crc *CorrectnessReportCreate) SetConsensus(b bool) *CorrectnessReportCreate { + crc.mutation.SetConsensus(b) + return crc +} + +// SetNillableConsensus sets the "consensus" field if the given value is not nil. +func (crc *CorrectnessReportCreate) SetNillableConsensus(b *bool) *CorrectnessReportCreate { + if b != nil { + crc.SetConsensus(*b) + } + return crc +} + +// SetVoted sets the "voted" field. +func (crc *CorrectnessReportCreate) SetVoted(hi *helpers.BigInt) *CorrectnessReportCreate { + crc.mutation.SetVoted(hi) + return crc +} + // AddSignerIDs adds the "signers" edge to the Signer entity by IDs. func (crc *CorrectnessReportCreate) AddSignerIDs(ids ...int) *CorrectnessReportCreate { crc.mutation.AddSignerIDs(ids...) @@ -80,6 +101,7 @@ func (crc *CorrectnessReportCreate) Mutation() *CorrectnessReportMutation { // Save creates the CorrectnessReport in the database. func (crc *CorrectnessReportCreate) Save(ctx context.Context) (*CorrectnessReport, error) { + crc.defaults() return withHooks(ctx, crc.sqlSave, crc.mutation, crc.hooks) } @@ -105,6 +127,14 @@ func (crc *CorrectnessReportCreate) ExecX(ctx context.Context) { } } +// defaults sets the default values of the builder before save. +func (crc *CorrectnessReportCreate) defaults() { + if _, ok := crc.mutation.Consensus(); !ok { + v := correctnessreport.DefaultConsensus + crc.mutation.SetConsensus(v) + } +} + // check runs all checks and user-defined validators on the builder. func (crc *CorrectnessReportCreate) check() error { if _, ok := crc.mutation.SignersCount(); !ok { @@ -140,6 +170,12 @@ func (crc *CorrectnessReportCreate) check() error { if _, ok := crc.mutation.Correct(); !ok { return &ValidationError{Name: "correct", err: errors.New(`ent: missing required field "CorrectnessReport.correct"`)} } + if _, ok := crc.mutation.Consensus(); !ok { + return &ValidationError{Name: "consensus", err: errors.New(`ent: missing required field "CorrectnessReport.consensus"`)} + } + if _, ok := crc.mutation.Voted(); !ok { + return &ValidationError{Name: "voted", err: errors.New(`ent: missing required field "CorrectnessReport.voted"`)} + } if len(crc.mutation.SignersIDs()) == 0 { return &ValidationError{Name: "signers", err: errors.New(`ent: missing required edge "CorrectnessReport.signers"`)} } @@ -194,6 +230,14 @@ func (crc *CorrectnessReportCreate) createSpec() (*CorrectnessReport, *sqlgraph. _spec.SetField(correctnessreport.FieldCorrect, field.TypeBool, value) _node.Correct = value } + if value, ok := crc.mutation.Consensus(); ok { + _spec.SetField(correctnessreport.FieldConsensus, field.TypeBool, value) + _node.Consensus = value + } + if value, ok := crc.mutation.Voted(); ok { + _spec.SetField(correctnessreport.FieldVoted, field.TypeUint, value) + _node.Voted = value + } if nodes := crc.mutation.SignersIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, @@ -346,6 +390,30 @@ func (u *CorrectnessReportUpsert) UpdateCorrect() *CorrectnessReportUpsert { return u } +// SetConsensus sets the "consensus" field. +func (u *CorrectnessReportUpsert) SetConsensus(v bool) *CorrectnessReportUpsert { + u.Set(correctnessreport.FieldConsensus, v) + return u +} + +// UpdateConsensus sets the "consensus" field to the value that was provided on create. +func (u *CorrectnessReportUpsert) UpdateConsensus() *CorrectnessReportUpsert { + u.SetExcluded(correctnessreport.FieldConsensus) + return u +} + +// SetVoted sets the "voted" field. +func (u *CorrectnessReportUpsert) SetVoted(v *helpers.BigInt) *CorrectnessReportUpsert { + u.Set(correctnessreport.FieldVoted, v) + return u +} + +// UpdateVoted sets the "voted" field to the value that was provided on create. +func (u *CorrectnessReportUpsert) UpdateVoted() *CorrectnessReportUpsert { + u.SetExcluded(correctnessreport.FieldVoted) + return u +} + // UpdateNewValues updates the mutable fields using the new values that were set on create. // Using this option is equivalent to using: // @@ -484,6 +552,34 @@ func (u *CorrectnessReportUpsertOne) UpdateCorrect() *CorrectnessReportUpsertOne }) } +// SetConsensus sets the "consensus" field. +func (u *CorrectnessReportUpsertOne) SetConsensus(v bool) *CorrectnessReportUpsertOne { + return u.Update(func(s *CorrectnessReportUpsert) { + s.SetConsensus(v) + }) +} + +// UpdateConsensus sets the "consensus" field to the value that was provided on create. +func (u *CorrectnessReportUpsertOne) UpdateConsensus() *CorrectnessReportUpsertOne { + return u.Update(func(s *CorrectnessReportUpsert) { + s.UpdateConsensus() + }) +} + +// SetVoted sets the "voted" field. +func (u *CorrectnessReportUpsertOne) SetVoted(v *helpers.BigInt) *CorrectnessReportUpsertOne { + return u.Update(func(s *CorrectnessReportUpsert) { + s.SetVoted(v) + }) +} + +// UpdateVoted sets the "voted" field to the value that was provided on create. +func (u *CorrectnessReportUpsertOne) UpdateVoted() *CorrectnessReportUpsertOne { + return u.Update(func(s *CorrectnessReportUpsert) { + s.UpdateVoted() + }) +} + // Exec executes the query. func (u *CorrectnessReportUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { @@ -536,6 +632,7 @@ func (crcb *CorrectnessReportCreateBulk) Save(ctx context.Context) ([]*Correctne for i := range crcb.builders { func(i int, root context.Context) { builder := crcb.builders[i] + builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*CorrectnessReportMutation) if !ok { @@ -785,6 +882,34 @@ func (u *CorrectnessReportUpsertBulk) UpdateCorrect() *CorrectnessReportUpsertBu }) } +// SetConsensus sets the "consensus" field. +func (u *CorrectnessReportUpsertBulk) SetConsensus(v bool) *CorrectnessReportUpsertBulk { + return u.Update(func(s *CorrectnessReportUpsert) { + s.SetConsensus(v) + }) +} + +// UpdateConsensus sets the "consensus" field to the value that was provided on create. +func (u *CorrectnessReportUpsertBulk) UpdateConsensus() *CorrectnessReportUpsertBulk { + return u.Update(func(s *CorrectnessReportUpsert) { + s.UpdateConsensus() + }) +} + +// SetVoted sets the "voted" field. +func (u *CorrectnessReportUpsertBulk) SetVoted(v *helpers.BigInt) *CorrectnessReportUpsertBulk { + return u.Update(func(s *CorrectnessReportUpsert) { + s.SetVoted(v) + }) +} + +// UpdateVoted sets the "voted" field to the value that was provided on create. +func (u *CorrectnessReportUpsertBulk) UpdateVoted() *CorrectnessReportUpsertBulk { + return u.Update(func(s *CorrectnessReportUpsert) { + s.UpdateVoted() + }) +} + // Exec executes the query. func (u *CorrectnessReportUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { diff --git a/internal/ent/correctnessreport_update.go b/internal/ent/correctnessreport_update.go index 494a5c9d..81d604ed 100644 --- a/internal/ent/correctnessreport_update.go +++ b/internal/ent/correctnessreport_update.go @@ -11,6 +11,7 @@ import ( "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/KenshiTech/unchained/internal/ent/correctnessreport" + "github.com/KenshiTech/unchained/internal/ent/helpers" "github.com/KenshiTech/unchained/internal/ent/predicate" "github.com/KenshiTech/unchained/internal/ent/signer" ) @@ -102,6 +103,26 @@ func (cru *CorrectnessReportUpdate) SetNillableCorrect(b *bool) *CorrectnessRepo return cru } +// SetConsensus sets the "consensus" field. +func (cru *CorrectnessReportUpdate) SetConsensus(b bool) *CorrectnessReportUpdate { + cru.mutation.SetConsensus(b) + return cru +} + +// SetNillableConsensus sets the "consensus" field if the given value is not nil. +func (cru *CorrectnessReportUpdate) SetNillableConsensus(b *bool) *CorrectnessReportUpdate { + if b != nil { + cru.SetConsensus(*b) + } + return cru +} + +// SetVoted sets the "voted" field. +func (cru *CorrectnessReportUpdate) SetVoted(hi *helpers.BigInt) *CorrectnessReportUpdate { + cru.mutation.SetVoted(hi) + return cru +} + // AddSignerIDs adds the "signers" edge to the Signer entity by IDs. func (cru *CorrectnessReportUpdate) AddSignerIDs(ids ...int) *CorrectnessReportUpdate { cru.mutation.AddSignerIDs(ids...) @@ -226,6 +247,12 @@ func (cru *CorrectnessReportUpdate) sqlSave(ctx context.Context) (n int, err err if value, ok := cru.mutation.Correct(); ok { _spec.SetField(correctnessreport.FieldCorrect, field.TypeBool, value) } + if value, ok := cru.mutation.Consensus(); ok { + _spec.SetField(correctnessreport.FieldConsensus, field.TypeBool, value) + } + if value, ok := cru.mutation.Voted(); ok { + _spec.SetField(correctnessreport.FieldVoted, field.TypeUint, value) + } if cru.mutation.SignersCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, @@ -365,6 +392,26 @@ func (cruo *CorrectnessReportUpdateOne) SetNillableCorrect(b *bool) *Correctness return cruo } +// SetConsensus sets the "consensus" field. +func (cruo *CorrectnessReportUpdateOne) SetConsensus(b bool) *CorrectnessReportUpdateOne { + cruo.mutation.SetConsensus(b) + return cruo +} + +// SetNillableConsensus sets the "consensus" field if the given value is not nil. +func (cruo *CorrectnessReportUpdateOne) SetNillableConsensus(b *bool) *CorrectnessReportUpdateOne { + if b != nil { + cruo.SetConsensus(*b) + } + return cruo +} + +// SetVoted sets the "voted" field. +func (cruo *CorrectnessReportUpdateOne) SetVoted(hi *helpers.BigInt) *CorrectnessReportUpdateOne { + cruo.mutation.SetVoted(hi) + return cruo +} + // AddSignerIDs adds the "signers" edge to the Signer entity by IDs. func (cruo *CorrectnessReportUpdateOne) AddSignerIDs(ids ...int) *CorrectnessReportUpdateOne { cruo.mutation.AddSignerIDs(ids...) @@ -519,6 +566,12 @@ func (cruo *CorrectnessReportUpdateOne) sqlSave(ctx context.Context) (_node *Cor if value, ok := cruo.mutation.Correct(); ok { _spec.SetField(correctnessreport.FieldCorrect, field.TypeBool, value) } + if value, ok := cruo.mutation.Consensus(); ok { + _spec.SetField(correctnessreport.FieldConsensus, field.TypeBool, value) + } + if value, ok := cruo.mutation.Voted(); ok { + _spec.SetField(correctnessreport.FieldVoted, field.TypeUint, value) + } if cruo.mutation.SignersCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, diff --git a/internal/ent/entc.go b/internal/ent/entc.go index 6ff4df2f..356218e5 100644 --- a/internal/ent/entc.go +++ b/internal/ent/entc.go @@ -16,7 +16,7 @@ func main() { // the Ent schema in a file named ent.graphql. entgql.WithWhereInputs(true), entgql.WithSchemaGenerator(), - entgql.WithSchemaPath("gql/unchained.graphql"), + entgql.WithSchemaPath("transport/server/gql/unchained.graphql"), entgql.WithConfigPath("gqlgen.yml"), ) if err != nil { diff --git a/internal/ent/eventlog.go b/internal/ent/eventlog.go index 4cea82b5..f00834d5 100644 --- a/internal/ent/eventlog.go +++ b/internal/ent/eventlog.go @@ -11,6 +11,7 @@ import ( "entgo.io/ent/dialect/sql" "github.com/KenshiTech/unchained/internal/datasets" "github.com/KenshiTech/unchained/internal/ent/eventlog" + "github.com/KenshiTech/unchained/internal/ent/helpers" ) // EventLog is the model entity for the EventLog schema. @@ -36,6 +37,10 @@ type EventLog struct { Transaction []byte `json:"transaction,omitempty"` // Args holds the value of the "args" field. Args []datasets.EventLogArg `json:"args,omitempty"` + // Consensus holds the value of the "consensus" field. + Consensus bool `json:"consensus,omitempty"` + // Voted holds the value of the "voted" field. + Voted *helpers.BigInt `json:"voted,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the EventLogQuery when eager-loading is set. Edges EventLogEdges `json:"edges"` @@ -71,6 +76,10 @@ func (*EventLog) scanValues(columns []string) ([]any, error) { switch columns[i] { case eventlog.FieldSignature, eventlog.FieldTransaction, eventlog.FieldArgs: values[i] = new([]byte) + case eventlog.FieldVoted: + values[i] = new(helpers.BigInt) + case eventlog.FieldConsensus: + values[i] = new(sql.NullBool) case eventlog.FieldID, eventlog.FieldBlock, eventlog.FieldSignersCount, eventlog.FieldIndex: values[i] = new(sql.NullInt64) case eventlog.FieldAddress, eventlog.FieldChain, eventlog.FieldEvent: @@ -152,6 +161,18 @@ func (el *EventLog) assignValues(columns []string, values []any) error { return fmt.Errorf("unmarshal field args: %w", err) } } + case eventlog.FieldConsensus: + if value, ok := values[i].(*sql.NullBool); !ok { + return fmt.Errorf("unexpected type %T for field consensus", values[i]) + } else if value.Valid { + el.Consensus = value.Bool + } + case eventlog.FieldVoted: + if value, ok := values[i].(*helpers.BigInt); !ok { + return fmt.Errorf("unexpected type %T for field voted", values[i]) + } else if value != nil { + el.Voted = value + } default: el.selectValues.Set(columns[i], values[i]) } @@ -219,6 +240,12 @@ func (el *EventLog) String() string { builder.WriteString(", ") builder.WriteString("args=") builder.WriteString(fmt.Sprintf("%v", el.Args)) + builder.WriteString(", ") + builder.WriteString("consensus=") + builder.WriteString(fmt.Sprintf("%v", el.Consensus)) + builder.WriteString(", ") + builder.WriteString("voted=") + builder.WriteString(fmt.Sprintf("%v", el.Voted)) builder.WriteByte(')') return builder.String() } diff --git a/internal/ent/eventlog/eventlog.go b/internal/ent/eventlog/eventlog.go index 03c87df7..3ad5c92f 100644 --- a/internal/ent/eventlog/eventlog.go +++ b/internal/ent/eventlog/eventlog.go @@ -30,6 +30,10 @@ const ( FieldTransaction = "transaction" // FieldArgs holds the string denoting the args field in the database. FieldArgs = "args" + // FieldConsensus holds the string denoting the consensus field in the database. + FieldConsensus = "consensus" + // FieldVoted holds the string denoting the voted field in the database. + FieldVoted = "voted" // EdgeSigners holds the string denoting the signers edge name in mutations. EdgeSigners = "signers" // Table holds the table name of the eventlog in the database. @@ -53,6 +57,8 @@ var Columns = []string{ FieldEvent, FieldTransaction, FieldArgs, + FieldConsensus, + FieldVoted, } var ( @@ -76,6 +82,8 @@ var ( SignatureValidator func([]byte) error // TransactionValidator is a validator for the "transaction" field. It is called by the builders before save. TransactionValidator func([]byte) error + // DefaultConsensus holds the default value on creation for the "consensus" field. + DefaultConsensus bool ) // OrderOption defines the ordering options for the EventLog queries. @@ -116,6 +124,16 @@ func ByEvent(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldEvent, opts...).ToFunc() } +// ByConsensus orders the results by the consensus field. +func ByConsensus(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldConsensus, opts...).ToFunc() +} + +// ByVoted orders the results by the voted field. +func ByVoted(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldVoted, opts...).ToFunc() +} + // BySignersCount orders the results by signers count. func BySignersCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { diff --git a/internal/ent/eventlog/where.go b/internal/ent/eventlog/where.go index ba3152bd..fd1279c1 100644 --- a/internal/ent/eventlog/where.go +++ b/internal/ent/eventlog/where.go @@ -5,6 +5,7 @@ package eventlog import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" + "github.com/KenshiTech/unchained/internal/ent/helpers" "github.com/KenshiTech/unchained/internal/ent/predicate" ) @@ -93,6 +94,16 @@ func Transaction(v []byte) predicate.EventLog { return predicate.EventLog(sql.FieldEQ(FieldTransaction, v)) } +// Consensus applies equality check predicate on the "consensus" field. It's identical to ConsensusEQ. +func Consensus(v bool) predicate.EventLog { + return predicate.EventLog(sql.FieldEQ(FieldConsensus, v)) +} + +// Voted applies equality check predicate on the "voted" field. It's identical to VotedEQ. +func Voted(v *helpers.BigInt) predicate.EventLog { + return predicate.EventLog(sql.FieldEQ(FieldVoted, v)) +} + // BlockEQ applies the EQ predicate on the "block" field. func BlockEQ(v uint64) predicate.EventLog { return predicate.EventLog(sql.FieldEQ(FieldBlock, v)) @@ -488,6 +499,56 @@ func TransactionLTE(v []byte) predicate.EventLog { return predicate.EventLog(sql.FieldLTE(FieldTransaction, v)) } +// ConsensusEQ applies the EQ predicate on the "consensus" field. +func ConsensusEQ(v bool) predicate.EventLog { + return predicate.EventLog(sql.FieldEQ(FieldConsensus, v)) +} + +// ConsensusNEQ applies the NEQ predicate on the "consensus" field. +func ConsensusNEQ(v bool) predicate.EventLog { + return predicate.EventLog(sql.FieldNEQ(FieldConsensus, v)) +} + +// VotedEQ applies the EQ predicate on the "voted" field. +func VotedEQ(v *helpers.BigInt) predicate.EventLog { + return predicate.EventLog(sql.FieldEQ(FieldVoted, v)) +} + +// VotedNEQ applies the NEQ predicate on the "voted" field. +func VotedNEQ(v *helpers.BigInt) predicate.EventLog { + return predicate.EventLog(sql.FieldNEQ(FieldVoted, v)) +} + +// VotedIn applies the In predicate on the "voted" field. +func VotedIn(vs ...*helpers.BigInt) predicate.EventLog { + return predicate.EventLog(sql.FieldIn(FieldVoted, vs...)) +} + +// VotedNotIn applies the NotIn predicate on the "voted" field. +func VotedNotIn(vs ...*helpers.BigInt) predicate.EventLog { + return predicate.EventLog(sql.FieldNotIn(FieldVoted, vs...)) +} + +// VotedGT applies the GT predicate on the "voted" field. +func VotedGT(v *helpers.BigInt) predicate.EventLog { + return predicate.EventLog(sql.FieldGT(FieldVoted, v)) +} + +// VotedGTE applies the GTE predicate on the "voted" field. +func VotedGTE(v *helpers.BigInt) predicate.EventLog { + return predicate.EventLog(sql.FieldGTE(FieldVoted, v)) +} + +// VotedLT applies the LT predicate on the "voted" field. +func VotedLT(v *helpers.BigInt) predicate.EventLog { + return predicate.EventLog(sql.FieldLT(FieldVoted, v)) +} + +// VotedLTE applies the LTE predicate on the "voted" field. +func VotedLTE(v *helpers.BigInt) predicate.EventLog { + return predicate.EventLog(sql.FieldLTE(FieldVoted, v)) +} + // HasSigners applies the HasEdge predicate on the "signers" edge. func HasSigners() predicate.EventLog { return predicate.EventLog(func(s *sql.Selector) { diff --git a/internal/ent/eventlog_create.go b/internal/ent/eventlog_create.go index 22878146..206e1dd2 100644 --- a/internal/ent/eventlog_create.go +++ b/internal/ent/eventlog_create.go @@ -12,6 +12,7 @@ import ( "entgo.io/ent/schema/field" "github.com/KenshiTech/unchained/internal/datasets" "github.com/KenshiTech/unchained/internal/ent/eventlog" + "github.com/KenshiTech/unchained/internal/ent/helpers" "github.com/KenshiTech/unchained/internal/ent/signer" ) @@ -77,6 +78,26 @@ func (elc *EventLogCreate) SetArgs(dla []datasets.EventLogArg) *EventLogCreate { return elc } +// SetConsensus sets the "consensus" field. +func (elc *EventLogCreate) SetConsensus(b bool) *EventLogCreate { + elc.mutation.SetConsensus(b) + return elc +} + +// SetNillableConsensus sets the "consensus" field if the given value is not nil. +func (elc *EventLogCreate) SetNillableConsensus(b *bool) *EventLogCreate { + if b != nil { + elc.SetConsensus(*b) + } + return elc +} + +// SetVoted sets the "voted" field. +func (elc *EventLogCreate) SetVoted(hi *helpers.BigInt) *EventLogCreate { + elc.mutation.SetVoted(hi) + return elc +} + // AddSignerIDs adds the "signers" edge to the Signer entity by IDs. func (elc *EventLogCreate) AddSignerIDs(ids ...int) *EventLogCreate { elc.mutation.AddSignerIDs(ids...) @@ -99,6 +120,7 @@ func (elc *EventLogCreate) Mutation() *EventLogMutation { // Save creates the EventLog in the database. func (elc *EventLogCreate) Save(ctx context.Context) (*EventLog, error) { + elc.defaults() return withHooks(ctx, elc.sqlSave, elc.mutation, elc.hooks) } @@ -124,6 +146,14 @@ func (elc *EventLogCreate) ExecX(ctx context.Context) { } } +// defaults sets the default values of the builder before save. +func (elc *EventLogCreate) defaults() { + if _, ok := elc.mutation.Consensus(); !ok { + v := eventlog.DefaultConsensus + elc.mutation.SetConsensus(v) + } +} + // check runs all checks and user-defined validators on the builder. func (elc *EventLogCreate) check() error { if _, ok := elc.mutation.Block(); !ok { @@ -163,6 +193,12 @@ func (elc *EventLogCreate) check() error { if _, ok := elc.mutation.Args(); !ok { return &ValidationError{Name: "args", err: errors.New(`ent: missing required field "EventLog.args"`)} } + if _, ok := elc.mutation.Consensus(); !ok { + return &ValidationError{Name: "consensus", err: errors.New(`ent: missing required field "EventLog.consensus"`)} + } + if _, ok := elc.mutation.Voted(); !ok { + return &ValidationError{Name: "voted", err: errors.New(`ent: missing required field "EventLog.voted"`)} + } if len(elc.mutation.SignersIDs()) == 0 { return &ValidationError{Name: "signers", err: errors.New(`ent: missing required edge "EventLog.signers"`)} } @@ -229,6 +265,14 @@ func (elc *EventLogCreate) createSpec() (*EventLog, *sqlgraph.CreateSpec) { _spec.SetField(eventlog.FieldArgs, field.TypeJSON, value) _node.Args = value } + if value, ok := elc.mutation.Consensus(); ok { + _spec.SetField(eventlog.FieldConsensus, field.TypeBool, value) + _node.Consensus = value + } + if value, ok := elc.mutation.Voted(); ok { + _spec.SetField(eventlog.FieldVoted, field.TypeUint, value) + _node.Voted = value + } if nodes := elc.mutation.SignersIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, @@ -423,6 +467,30 @@ func (u *EventLogUpsert) UpdateArgs() *EventLogUpsert { return u } +// SetConsensus sets the "consensus" field. +func (u *EventLogUpsert) SetConsensus(v bool) *EventLogUpsert { + u.Set(eventlog.FieldConsensus, v) + return u +} + +// UpdateConsensus sets the "consensus" field to the value that was provided on create. +func (u *EventLogUpsert) UpdateConsensus() *EventLogUpsert { + u.SetExcluded(eventlog.FieldConsensus) + return u +} + +// SetVoted sets the "voted" field. +func (u *EventLogUpsert) SetVoted(v *helpers.BigInt) *EventLogUpsert { + u.Set(eventlog.FieldVoted, v) + return u +} + +// UpdateVoted sets the "voted" field to the value that was provided on create. +func (u *EventLogUpsert) UpdateVoted() *EventLogUpsert { + u.SetExcluded(eventlog.FieldVoted) + return u +} + // UpdateNewValues updates the mutable fields using the new values that were set on create. // Using this option is equivalent to using: // @@ -610,6 +678,34 @@ func (u *EventLogUpsertOne) UpdateArgs() *EventLogUpsertOne { }) } +// SetConsensus sets the "consensus" field. +func (u *EventLogUpsertOne) SetConsensus(v bool) *EventLogUpsertOne { + return u.Update(func(s *EventLogUpsert) { + s.SetConsensus(v) + }) +} + +// UpdateConsensus sets the "consensus" field to the value that was provided on create. +func (u *EventLogUpsertOne) UpdateConsensus() *EventLogUpsertOne { + return u.Update(func(s *EventLogUpsert) { + s.UpdateConsensus() + }) +} + +// SetVoted sets the "voted" field. +func (u *EventLogUpsertOne) SetVoted(v *helpers.BigInt) *EventLogUpsertOne { + return u.Update(func(s *EventLogUpsert) { + s.SetVoted(v) + }) +} + +// UpdateVoted sets the "voted" field to the value that was provided on create. +func (u *EventLogUpsertOne) UpdateVoted() *EventLogUpsertOne { + return u.Update(func(s *EventLogUpsert) { + s.UpdateVoted() + }) +} + // Exec executes the query. func (u *EventLogUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { @@ -662,6 +758,7 @@ func (elcb *EventLogCreateBulk) Save(ctx context.Context) ([]*EventLog, error) { for i := range elcb.builders { func(i int, root context.Context) { builder := elcb.builders[i] + builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*EventLogMutation) if !ok { @@ -960,6 +1057,34 @@ func (u *EventLogUpsertBulk) UpdateArgs() *EventLogUpsertBulk { }) } +// SetConsensus sets the "consensus" field. +func (u *EventLogUpsertBulk) SetConsensus(v bool) *EventLogUpsertBulk { + return u.Update(func(s *EventLogUpsert) { + s.SetConsensus(v) + }) +} + +// UpdateConsensus sets the "consensus" field to the value that was provided on create. +func (u *EventLogUpsertBulk) UpdateConsensus() *EventLogUpsertBulk { + return u.Update(func(s *EventLogUpsert) { + s.UpdateConsensus() + }) +} + +// SetVoted sets the "voted" field. +func (u *EventLogUpsertBulk) SetVoted(v *helpers.BigInt) *EventLogUpsertBulk { + return u.Update(func(s *EventLogUpsert) { + s.SetVoted(v) + }) +} + +// UpdateVoted sets the "voted" field to the value that was provided on create. +func (u *EventLogUpsertBulk) UpdateVoted() *EventLogUpsertBulk { + return u.Update(func(s *EventLogUpsert) { + s.UpdateVoted() + }) +} + // Exec executes the query. func (u *EventLogUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { diff --git a/internal/ent/eventlog_update.go b/internal/ent/eventlog_update.go index 07549208..bc4c6268 100644 --- a/internal/ent/eventlog_update.go +++ b/internal/ent/eventlog_update.go @@ -13,6 +13,7 @@ import ( "entgo.io/ent/schema/field" "github.com/KenshiTech/unchained/internal/datasets" "github.com/KenshiTech/unchained/internal/ent/eventlog" + "github.com/KenshiTech/unchained/internal/ent/helpers" "github.com/KenshiTech/unchained/internal/ent/predicate" "github.com/KenshiTech/unchained/internal/ent/signer" ) @@ -159,6 +160,26 @@ func (elu *EventLogUpdate) AppendArgs(dla []datasets.EventLogArg) *EventLogUpdat return elu } +// SetConsensus sets the "consensus" field. +func (elu *EventLogUpdate) SetConsensus(b bool) *EventLogUpdate { + elu.mutation.SetConsensus(b) + return elu +} + +// SetNillableConsensus sets the "consensus" field if the given value is not nil. +func (elu *EventLogUpdate) SetNillableConsensus(b *bool) *EventLogUpdate { + if b != nil { + elu.SetConsensus(*b) + } + return elu +} + +// SetVoted sets the "voted" field. +func (elu *EventLogUpdate) SetVoted(hi *helpers.BigInt) *EventLogUpdate { + elu.mutation.SetVoted(hi) + return elu +} + // AddSignerIDs adds the "signers" edge to the Signer entity by IDs. func (elu *EventLogUpdate) AddSignerIDs(ids ...int) *EventLogUpdate { elu.mutation.AddSignerIDs(ids...) @@ -295,6 +316,12 @@ func (elu *EventLogUpdate) sqlSave(ctx context.Context) (n int, err error) { sqljson.Append(u, eventlog.FieldArgs, value) }) } + if value, ok := elu.mutation.Consensus(); ok { + _spec.SetField(eventlog.FieldConsensus, field.TypeBool, value) + } + if value, ok := elu.mutation.Voted(); ok { + _spec.SetField(eventlog.FieldVoted, field.TypeUint, value) + } if elu.mutation.SignersCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, @@ -489,6 +516,26 @@ func (eluo *EventLogUpdateOne) AppendArgs(dla []datasets.EventLogArg) *EventLogU return eluo } +// SetConsensus sets the "consensus" field. +func (eluo *EventLogUpdateOne) SetConsensus(b bool) *EventLogUpdateOne { + eluo.mutation.SetConsensus(b) + return eluo +} + +// SetNillableConsensus sets the "consensus" field if the given value is not nil. +func (eluo *EventLogUpdateOne) SetNillableConsensus(b *bool) *EventLogUpdateOne { + if b != nil { + eluo.SetConsensus(*b) + } + return eluo +} + +// SetVoted sets the "voted" field. +func (eluo *EventLogUpdateOne) SetVoted(hi *helpers.BigInt) *EventLogUpdateOne { + eluo.mutation.SetVoted(hi) + return eluo +} + // AddSignerIDs adds the "signers" edge to the Signer entity by IDs. func (eluo *EventLogUpdateOne) AddSignerIDs(ids ...int) *EventLogUpdateOne { eluo.mutation.AddSignerIDs(ids...) @@ -655,6 +702,12 @@ func (eluo *EventLogUpdateOne) sqlSave(ctx context.Context) (_node *EventLog, er sqljson.Append(u, eventlog.FieldArgs, value) }) } + if value, ok := eluo.mutation.Consensus(); ok { + _spec.SetField(eventlog.FieldConsensus, field.TypeBool, value) + } + if value, ok := eluo.mutation.Voted(); ok { + _spec.SetField(eventlog.FieldVoted, field.TypeUint, value) + } if eluo.mutation.SignersCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, diff --git a/internal/ent/gql_collection.go b/internal/ent/gql_collection.go index febaf8a5..e0b483ba 100644 --- a/internal/ent/gql_collection.go +++ b/internal/ent/gql_collection.go @@ -82,6 +82,16 @@ func (ap *AssetPriceQuery) collectField(ctx context.Context, opCtx *graphql.Oper selectedFields = append(selectedFields, assetprice.FieldPair) fieldSeen[assetprice.FieldPair] = struct{}{} } + case "consensus": + if _, ok := fieldSeen[assetprice.FieldConsensus]; !ok { + selectedFields = append(selectedFields, assetprice.FieldConsensus) + fieldSeen[assetprice.FieldConsensus] = struct{}{} + } + case "voted": + if _, ok := fieldSeen[assetprice.FieldVoted]; !ok { + selectedFields = append(selectedFields, assetprice.FieldVoted) + fieldSeen[assetprice.FieldVoted] = struct{}{} + } case "id": case "__typename": default: @@ -208,6 +218,16 @@ func (cr *CorrectnessReportQuery) collectField(ctx context.Context, opCtx *graph selectedFields = append(selectedFields, correctnessreport.FieldCorrect) fieldSeen[correctnessreport.FieldCorrect] = struct{}{} } + case "consensus": + if _, ok := fieldSeen[correctnessreport.FieldConsensus]; !ok { + selectedFields = append(selectedFields, correctnessreport.FieldConsensus) + fieldSeen[correctnessreport.FieldConsensus] = struct{}{} + } + case "voted": + if _, ok := fieldSeen[correctnessreport.FieldVoted]; !ok { + selectedFields = append(selectedFields, correctnessreport.FieldVoted) + fieldSeen[correctnessreport.FieldVoted] = struct{}{} + } case "id": case "__typename": default: @@ -349,6 +369,16 @@ func (el *EventLogQuery) collectField(ctx context.Context, opCtx *graphql.Operat selectedFields = append(selectedFields, eventlog.FieldArgs) fieldSeen[eventlog.FieldArgs] = struct{}{} } + case "consensus": + if _, ok := fieldSeen[eventlog.FieldConsensus]; !ok { + selectedFields = append(selectedFields, eventlog.FieldConsensus) + fieldSeen[eventlog.FieldConsensus] = struct{}{} + } + case "voted": + if _, ok := fieldSeen[eventlog.FieldVoted]; !ok { + selectedFields = append(selectedFields, eventlog.FieldVoted) + fieldSeen[eventlog.FieldVoted] = struct{}{} + } case "id": case "__typename": default: diff --git a/internal/ent/gql_where_input.go b/internal/ent/gql_where_input.go index e181d18f..377615cd 100644 --- a/internal/ent/gql_where_input.go +++ b/internal/ent/gql_where_input.go @@ -114,6 +114,20 @@ type AssetPriceWhereInput struct { PairEqualFold *string `json:"pairEqualFold,omitempty"` PairContainsFold *string `json:"pairContainsFold,omitempty"` + // "consensus" field predicates. + Consensus *bool `json:"consensus,omitempty"` + ConsensusNEQ *bool `json:"consensusNEQ,omitempty"` + + // "voted" field predicates. + Voted *helpers.BigInt `json:"voted,omitempty"` + VotedNEQ *helpers.BigInt `json:"votedNEQ,omitempty"` + VotedIn []*helpers.BigInt `json:"votedIn,omitempty"` + VotedNotIn []*helpers.BigInt `json:"votedNotIn,omitempty"` + VotedGT *helpers.BigInt `json:"votedGT,omitempty"` + VotedGTE *helpers.BigInt `json:"votedGTE,omitempty"` + VotedLT *helpers.BigInt `json:"votedLT,omitempty"` + VotedLTE *helpers.BigInt `json:"votedLTE,omitempty"` + // "signers" edge predicates. HasSigners *bool `json:"hasSigners,omitempty"` HasSignersWith []*SignerWhereInput `json:"hasSignersWith,omitempty"` @@ -427,6 +441,36 @@ func (i *AssetPriceWhereInput) P() (predicate.AssetPrice, error) { if i.PairContainsFold != nil { predicates = append(predicates, assetprice.PairContainsFold(*i.PairContainsFold)) } + if i.Consensus != nil { + predicates = append(predicates, assetprice.ConsensusEQ(*i.Consensus)) + } + if i.ConsensusNEQ != nil { + predicates = append(predicates, assetprice.ConsensusNEQ(*i.ConsensusNEQ)) + } + if i.Voted != nil { + predicates = append(predicates, assetprice.VotedEQ(i.Voted)) + } + if i.VotedNEQ != nil { + predicates = append(predicates, assetprice.VotedNEQ(i.VotedNEQ)) + } + if len(i.VotedIn) > 0 { + predicates = append(predicates, assetprice.VotedIn(i.VotedIn...)) + } + if len(i.VotedNotIn) > 0 { + predicates = append(predicates, assetprice.VotedNotIn(i.VotedNotIn...)) + } + if i.VotedGT != nil { + predicates = append(predicates, assetprice.VotedGT(i.VotedGT)) + } + if i.VotedGTE != nil { + predicates = append(predicates, assetprice.VotedGTE(i.VotedGTE)) + } + if i.VotedLT != nil { + predicates = append(predicates, assetprice.VotedLT(i.VotedLT)) + } + if i.VotedLTE != nil { + predicates = append(predicates, assetprice.VotedLTE(i.VotedLTE)) + } if i.HasSigners != nil { p := assetprice.HasSigners() @@ -497,6 +541,20 @@ type CorrectnessReportWhereInput struct { Correct *bool `json:"correct,omitempty"` CorrectNEQ *bool `json:"correctNEQ,omitempty"` + // "consensus" field predicates. + Consensus *bool `json:"consensus,omitempty"` + ConsensusNEQ *bool `json:"consensusNEQ,omitempty"` + + // "voted" field predicates. + Voted *helpers.BigInt `json:"voted,omitempty"` + VotedNEQ *helpers.BigInt `json:"votedNEQ,omitempty"` + VotedIn []*helpers.BigInt `json:"votedIn,omitempty"` + VotedNotIn []*helpers.BigInt `json:"votedNotIn,omitempty"` + VotedGT *helpers.BigInt `json:"votedGT,omitempty"` + VotedGTE *helpers.BigInt `json:"votedGTE,omitempty"` + VotedLT *helpers.BigInt `json:"votedLT,omitempty"` + VotedLTE *helpers.BigInt `json:"votedLTE,omitempty"` + // "signers" edge predicates. HasSigners *bool `json:"hasSigners,omitempty"` HasSignersWith []*SignerWhereInput `json:"hasSignersWith,omitempty"` @@ -651,6 +709,36 @@ func (i *CorrectnessReportWhereInput) P() (predicate.CorrectnessReport, error) { if i.CorrectNEQ != nil { predicates = append(predicates, correctnessreport.CorrectNEQ(*i.CorrectNEQ)) } + if i.Consensus != nil { + predicates = append(predicates, correctnessreport.ConsensusEQ(*i.Consensus)) + } + if i.ConsensusNEQ != nil { + predicates = append(predicates, correctnessreport.ConsensusNEQ(*i.ConsensusNEQ)) + } + if i.Voted != nil { + predicates = append(predicates, correctnessreport.VotedEQ(i.Voted)) + } + if i.VotedNEQ != nil { + predicates = append(predicates, correctnessreport.VotedNEQ(i.VotedNEQ)) + } + if len(i.VotedIn) > 0 { + predicates = append(predicates, correctnessreport.VotedIn(i.VotedIn...)) + } + if len(i.VotedNotIn) > 0 { + predicates = append(predicates, correctnessreport.VotedNotIn(i.VotedNotIn...)) + } + if i.VotedGT != nil { + predicates = append(predicates, correctnessreport.VotedGT(i.VotedGT)) + } + if i.VotedGTE != nil { + predicates = append(predicates, correctnessreport.VotedGTE(i.VotedGTE)) + } + if i.VotedLT != nil { + predicates = append(predicates, correctnessreport.VotedLT(i.VotedLT)) + } + if i.VotedLTE != nil { + predicates = append(predicates, correctnessreport.VotedLTE(i.VotedLTE)) + } if i.HasSigners != nil { p := correctnessreport.HasSigners() @@ -772,6 +860,20 @@ type EventLogWhereInput struct { EventEqualFold *string `json:"eventEqualFold,omitempty"` EventContainsFold *string `json:"eventContainsFold,omitempty"` + // "consensus" field predicates. + Consensus *bool `json:"consensus,omitempty"` + ConsensusNEQ *bool `json:"consensusNEQ,omitempty"` + + // "voted" field predicates. + Voted *helpers.BigInt `json:"voted,omitempty"` + VotedNEQ *helpers.BigInt `json:"votedNEQ,omitempty"` + VotedIn []*helpers.BigInt `json:"votedIn,omitempty"` + VotedNotIn []*helpers.BigInt `json:"votedNotIn,omitempty"` + VotedGT *helpers.BigInt `json:"votedGT,omitempty"` + VotedGTE *helpers.BigInt `json:"votedGTE,omitempty"` + VotedLT *helpers.BigInt `json:"votedLT,omitempty"` + VotedLTE *helpers.BigInt `json:"votedLTE,omitempty"` + // "signers" edge predicates. HasSigners *bool `json:"hasSigners,omitempty"` HasSignersWith []*SignerWhereInput `json:"hasSignersWith,omitempty"` @@ -1061,6 +1163,36 @@ func (i *EventLogWhereInput) P() (predicate.EventLog, error) { if i.EventContainsFold != nil { predicates = append(predicates, eventlog.EventContainsFold(*i.EventContainsFold)) } + if i.Consensus != nil { + predicates = append(predicates, eventlog.ConsensusEQ(*i.Consensus)) + } + if i.ConsensusNEQ != nil { + predicates = append(predicates, eventlog.ConsensusNEQ(*i.ConsensusNEQ)) + } + if i.Voted != nil { + predicates = append(predicates, eventlog.VotedEQ(i.Voted)) + } + if i.VotedNEQ != nil { + predicates = append(predicates, eventlog.VotedNEQ(i.VotedNEQ)) + } + if len(i.VotedIn) > 0 { + predicates = append(predicates, eventlog.VotedIn(i.VotedIn...)) + } + if len(i.VotedNotIn) > 0 { + predicates = append(predicates, eventlog.VotedNotIn(i.VotedNotIn...)) + } + if i.VotedGT != nil { + predicates = append(predicates, eventlog.VotedGT(i.VotedGT)) + } + if i.VotedGTE != nil { + predicates = append(predicates, eventlog.VotedGTE(i.VotedGTE)) + } + if i.VotedLT != nil { + predicates = append(predicates, eventlog.VotedLT(i.VotedLT)) + } + if i.VotedLTE != nil { + predicates = append(predicates, eventlog.VotedLTE(i.VotedLTE)) + } if i.HasSigners != nil { p := eventlog.HasSigners() diff --git a/internal/ent/migrate/schema.go b/internal/ent/migrate/schema.go index e5a0e94d..0ae7b317 100644 --- a/internal/ent/migrate/schema.go +++ b/internal/ent/migrate/schema.go @@ -14,10 +14,12 @@ var ( {Name: "block", Type: field.TypeUint64}, {Name: "signers_count", Type: field.TypeUint64, Nullable: true}, {Name: "price", Type: field.TypeUint, SchemaType: map[string]string{"postgres": "numeric(78, 0)", "sqlite3": "numeric(78, 0)"}}, - {Name: "signature", Type: field.TypeBytes, Size: 96}, + {Name: "signature", Type: field.TypeBytes, Size: 48}, {Name: "asset", Type: field.TypeString, Nullable: true}, {Name: "chain", Type: field.TypeString, Nullable: true}, {Name: "pair", Type: field.TypeString, Nullable: true}, + {Name: "consensus", Type: field.TypeBool, Default: false}, + {Name: "voted", Type: field.TypeUint, SchemaType: map[string]string{"postgres": "numeric(78, 0)", "sqlite3": "numeric(78, 0)"}}, } // AssetPricesTable holds the schema information for the "asset_prices" table. AssetPricesTable = &schema.Table{ @@ -30,6 +32,11 @@ var ( Unique: true, Columns: []*schema.Column{AssetPricesColumns[1], AssetPricesColumns[6], AssetPricesColumns[5], AssetPricesColumns[7]}, }, + { + Name: "assetprice_block_chain_asset_pair_price_consensus", + Unique: false, + Columns: []*schema.Column{AssetPricesColumns[1], AssetPricesColumns[6], AssetPricesColumns[5], AssetPricesColumns[7], AssetPricesColumns[3], AssetPricesColumns[8]}, + }, }, } // CorrectnessReportsColumns holds the columns for the "correctness_reports" table. @@ -41,6 +48,8 @@ var ( {Name: "hash", Type: field.TypeBytes, Size: 64}, {Name: "topic", Type: field.TypeBytes, Size: 64}, {Name: "correct", Type: field.TypeBool}, + {Name: "consensus", Type: field.TypeBool, Default: false}, + {Name: "voted", Type: field.TypeUint, SchemaType: map[string]string{"postgres": "numeric(78, 0)", "sqlite3": "numeric(78, 0)"}}, } // CorrectnessReportsTable holds the schema information for the "correctness_reports" table. CorrectnessReportsTable = &schema.Table{ @@ -65,13 +74,15 @@ var ( {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "block", Type: field.TypeUint64}, {Name: "signers_count", Type: field.TypeUint64}, - {Name: "signature", Type: field.TypeBytes, Size: 96}, + {Name: "signature", Type: field.TypeBytes, Size: 48}, {Name: "address", Type: field.TypeString}, {Name: "chain", Type: field.TypeString}, {Name: "index", Type: field.TypeUint64}, {Name: "event", Type: field.TypeString}, {Name: "transaction", Type: field.TypeBytes, Size: 32}, {Name: "args", Type: field.TypeJSON}, + {Name: "consensus", Type: field.TypeBool, Default: false}, + {Name: "voted", Type: field.TypeUint, SchemaType: map[string]string{"postgres": "numeric(78, 0)", "sqlite3": "numeric(78, 0)"}}, } // EventLogsTable holds the schema information for the "event_logs" table. EventLogsTable = &schema.Table{ @@ -85,9 +96,9 @@ var ( Columns: []*schema.Column{EventLogsColumns[1], EventLogsColumns[8], EventLogsColumns[6]}, }, { - Name: "eventlog_block_address_event", + Name: "eventlog_block_address_event_consensus", Unique: false, - Columns: []*schema.Column{EventLogsColumns[1], EventLogsColumns[4], EventLogsColumns[7]}, + Columns: []*schema.Column{EventLogsColumns[1], EventLogsColumns[4], EventLogsColumns[7], EventLogsColumns[10]}, }, }, } diff --git a/internal/ent/mutation.go b/internal/ent/mutation.go index ba89dbc6..4e9e3e61 100644 --- a/internal/ent/mutation.go +++ b/internal/ent/mutation.go @@ -49,6 +49,8 @@ type AssetPriceMutation struct { asset *string chain *string pair *string + consensus *bool + voted **helpers.BigInt clearedFields map[string]struct{} signers map[int]struct{} removedsigners map[int]struct{} @@ -501,6 +503,78 @@ func (m *AssetPriceMutation) ResetPair() { delete(m.clearedFields, assetprice.FieldPair) } +// SetConsensus sets the "consensus" field. +func (m *AssetPriceMutation) SetConsensus(b bool) { + m.consensus = &b +} + +// Consensus returns the value of the "consensus" field in the mutation. +func (m *AssetPriceMutation) Consensus() (r bool, exists bool) { + v := m.consensus + if v == nil { + return + } + return *v, true +} + +// OldConsensus returns the old "consensus" field's value of the AssetPrice entity. +// If the AssetPrice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *AssetPriceMutation) OldConsensus(ctx context.Context) (v bool, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldConsensus is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldConsensus requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldConsensus: %w", err) + } + return oldValue.Consensus, nil +} + +// ResetConsensus resets all changes to the "consensus" field. +func (m *AssetPriceMutation) ResetConsensus() { + m.consensus = nil +} + +// SetVoted sets the "voted" field. +func (m *AssetPriceMutation) SetVoted(hi *helpers.BigInt) { + m.voted = &hi +} + +// Voted returns the value of the "voted" field in the mutation. +func (m *AssetPriceMutation) Voted() (r *helpers.BigInt, exists bool) { + v := m.voted + if v == nil { + return + } + return *v, true +} + +// OldVoted returns the old "voted" field's value of the AssetPrice entity. +// If the AssetPrice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *AssetPriceMutation) OldVoted(ctx context.Context) (v *helpers.BigInt, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldVoted is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldVoted requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldVoted: %w", err) + } + return oldValue.Voted, nil +} + +// ResetVoted resets all changes to the "voted" field. +func (m *AssetPriceMutation) ResetVoted() { + m.voted = nil +} + // AddSignerIDs adds the "signers" edge to the Signer entity by ids. func (m *AssetPriceMutation) AddSignerIDs(ids ...int) { if m.signers == nil { @@ -589,7 +663,7 @@ func (m *AssetPriceMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *AssetPriceMutation) Fields() []string { - fields := make([]string, 0, 7) + fields := make([]string, 0, 9) if m.block != nil { fields = append(fields, assetprice.FieldBlock) } @@ -611,6 +685,12 @@ func (m *AssetPriceMutation) Fields() []string { if m.pair != nil { fields = append(fields, assetprice.FieldPair) } + if m.consensus != nil { + fields = append(fields, assetprice.FieldConsensus) + } + if m.voted != nil { + fields = append(fields, assetprice.FieldVoted) + } return fields } @@ -633,6 +713,10 @@ func (m *AssetPriceMutation) Field(name string) (ent.Value, bool) { return m.Chain() case assetprice.FieldPair: return m.Pair() + case assetprice.FieldConsensus: + return m.Consensus() + case assetprice.FieldVoted: + return m.Voted() } return nil, false } @@ -656,6 +740,10 @@ func (m *AssetPriceMutation) OldField(ctx context.Context, name string) (ent.Val return m.OldChain(ctx) case assetprice.FieldPair: return m.OldPair(ctx) + case assetprice.FieldConsensus: + return m.OldConsensus(ctx) + case assetprice.FieldVoted: + return m.OldVoted(ctx) } return nil, fmt.Errorf("unknown AssetPrice field %s", name) } @@ -714,6 +802,20 @@ func (m *AssetPriceMutation) SetField(name string, value ent.Value) error { } m.SetPair(v) return nil + case assetprice.FieldConsensus: + v, ok := value.(bool) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetConsensus(v) + return nil + case assetprice.FieldVoted: + v, ok := value.(*helpers.BigInt) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetVoted(v) + return nil } return fmt.Errorf("unknown AssetPrice field %s", name) } @@ -838,6 +940,12 @@ func (m *AssetPriceMutation) ResetField(name string) error { case assetprice.FieldPair: m.ResetPair() return nil + case assetprice.FieldConsensus: + m.ResetConsensus() + return nil + case assetprice.FieldVoted: + m.ResetVoted() + return nil } return fmt.Errorf("unknown AssetPrice field %s", name) } @@ -940,6 +1048,8 @@ type CorrectnessReportMutation struct { hash *[]byte topic *[]byte correct *bool + consensus *bool + voted **helpers.BigInt clearedFields map[string]struct{} signers map[int]struct{} removedsigners map[int]struct{} @@ -1303,6 +1413,78 @@ func (m *CorrectnessReportMutation) ResetCorrect() { m.correct = nil } +// SetConsensus sets the "consensus" field. +func (m *CorrectnessReportMutation) SetConsensus(b bool) { + m.consensus = &b +} + +// Consensus returns the value of the "consensus" field in the mutation. +func (m *CorrectnessReportMutation) Consensus() (r bool, exists bool) { + v := m.consensus + if v == nil { + return + } + return *v, true +} + +// OldConsensus returns the old "consensus" field's value of the CorrectnessReport entity. +// If the CorrectnessReport object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *CorrectnessReportMutation) OldConsensus(ctx context.Context) (v bool, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldConsensus is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldConsensus requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldConsensus: %w", err) + } + return oldValue.Consensus, nil +} + +// ResetConsensus resets all changes to the "consensus" field. +func (m *CorrectnessReportMutation) ResetConsensus() { + m.consensus = nil +} + +// SetVoted sets the "voted" field. +func (m *CorrectnessReportMutation) SetVoted(hi *helpers.BigInt) { + m.voted = &hi +} + +// Voted returns the value of the "voted" field in the mutation. +func (m *CorrectnessReportMutation) Voted() (r *helpers.BigInt, exists bool) { + v := m.voted + if v == nil { + return + } + return *v, true +} + +// OldVoted returns the old "voted" field's value of the CorrectnessReport entity. +// If the CorrectnessReport object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *CorrectnessReportMutation) OldVoted(ctx context.Context) (v *helpers.BigInt, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldVoted is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldVoted requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldVoted: %w", err) + } + return oldValue.Voted, nil +} + +// ResetVoted resets all changes to the "voted" field. +func (m *CorrectnessReportMutation) ResetVoted() { + m.voted = nil +} + // AddSignerIDs adds the "signers" edge to the Signer entity by ids. func (m *CorrectnessReportMutation) AddSignerIDs(ids ...int) { if m.signers == nil { @@ -1391,7 +1573,7 @@ func (m *CorrectnessReportMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *CorrectnessReportMutation) Fields() []string { - fields := make([]string, 0, 6) + fields := make([]string, 0, 8) if m.signersCount != nil { fields = append(fields, correctnessreport.FieldSignersCount) } @@ -1410,6 +1592,12 @@ func (m *CorrectnessReportMutation) Fields() []string { if m.correct != nil { fields = append(fields, correctnessreport.FieldCorrect) } + if m.consensus != nil { + fields = append(fields, correctnessreport.FieldConsensus) + } + if m.voted != nil { + fields = append(fields, correctnessreport.FieldVoted) + } return fields } @@ -1430,6 +1618,10 @@ func (m *CorrectnessReportMutation) Field(name string) (ent.Value, bool) { return m.Topic() case correctnessreport.FieldCorrect: return m.Correct() + case correctnessreport.FieldConsensus: + return m.Consensus() + case correctnessreport.FieldVoted: + return m.Voted() } return nil, false } @@ -1451,6 +1643,10 @@ func (m *CorrectnessReportMutation) OldField(ctx context.Context, name string) ( return m.OldTopic(ctx) case correctnessreport.FieldCorrect: return m.OldCorrect(ctx) + case correctnessreport.FieldConsensus: + return m.OldConsensus(ctx) + case correctnessreport.FieldVoted: + return m.OldVoted(ctx) } return nil, fmt.Errorf("unknown CorrectnessReport field %s", name) } @@ -1502,6 +1698,20 @@ func (m *CorrectnessReportMutation) SetField(name string, value ent.Value) error } m.SetCorrect(v) return nil + case correctnessreport.FieldConsensus: + v, ok := value.(bool) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetConsensus(v) + return nil + case correctnessreport.FieldVoted: + v, ok := value.(*helpers.BigInt) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetVoted(v) + return nil } return fmt.Errorf("unknown CorrectnessReport field %s", name) } @@ -1596,6 +1806,12 @@ func (m *CorrectnessReportMutation) ResetField(name string) error { case correctnessreport.FieldCorrect: m.ResetCorrect() return nil + case correctnessreport.FieldConsensus: + m.ResetConsensus() + return nil + case correctnessreport.FieldVoted: + m.ResetVoted() + return nil } return fmt.Errorf("unknown CorrectnessReport field %s", name) } @@ -1703,6 +1919,8 @@ type EventLogMutation struct { transaction *[]byte args *[]datasets.EventLogArg appendargs []datasets.EventLogArg + consensus *bool + voted **helpers.BigInt clearedFields map[string]struct{} signers map[int]struct{} removedsigners map[int]struct{} @@ -2209,6 +2427,78 @@ func (m *EventLogMutation) ResetArgs() { m.appendargs = nil } +// SetConsensus sets the "consensus" field. +func (m *EventLogMutation) SetConsensus(b bool) { + m.consensus = &b +} + +// Consensus returns the value of the "consensus" field in the mutation. +func (m *EventLogMutation) Consensus() (r bool, exists bool) { + v := m.consensus + if v == nil { + return + } + return *v, true +} + +// OldConsensus returns the old "consensus" field's value of the EventLog entity. +// If the EventLog object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventLogMutation) OldConsensus(ctx context.Context) (v bool, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldConsensus is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldConsensus requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldConsensus: %w", err) + } + return oldValue.Consensus, nil +} + +// ResetConsensus resets all changes to the "consensus" field. +func (m *EventLogMutation) ResetConsensus() { + m.consensus = nil +} + +// SetVoted sets the "voted" field. +func (m *EventLogMutation) SetVoted(hi *helpers.BigInt) { + m.voted = &hi +} + +// Voted returns the value of the "voted" field in the mutation. +func (m *EventLogMutation) Voted() (r *helpers.BigInt, exists bool) { + v := m.voted + if v == nil { + return + } + return *v, true +} + +// OldVoted returns the old "voted" field's value of the EventLog entity. +// If the EventLog object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *EventLogMutation) OldVoted(ctx context.Context) (v *helpers.BigInt, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldVoted is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldVoted requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldVoted: %w", err) + } + return oldValue.Voted, nil +} + +// ResetVoted resets all changes to the "voted" field. +func (m *EventLogMutation) ResetVoted() { + m.voted = nil +} + // AddSignerIDs adds the "signers" edge to the Signer entity by ids. func (m *EventLogMutation) AddSignerIDs(ids ...int) { if m.signers == nil { @@ -2297,7 +2587,7 @@ func (m *EventLogMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *EventLogMutation) Fields() []string { - fields := make([]string, 0, 9) + fields := make([]string, 0, 11) if m.block != nil { fields = append(fields, eventlog.FieldBlock) } @@ -2325,6 +2615,12 @@ func (m *EventLogMutation) Fields() []string { if m.args != nil { fields = append(fields, eventlog.FieldArgs) } + if m.consensus != nil { + fields = append(fields, eventlog.FieldConsensus) + } + if m.voted != nil { + fields = append(fields, eventlog.FieldVoted) + } return fields } @@ -2351,6 +2647,10 @@ func (m *EventLogMutation) Field(name string) (ent.Value, bool) { return m.Transaction() case eventlog.FieldArgs: return m.Args() + case eventlog.FieldConsensus: + return m.Consensus() + case eventlog.FieldVoted: + return m.Voted() } return nil, false } @@ -2378,6 +2678,10 @@ func (m *EventLogMutation) OldField(ctx context.Context, name string) (ent.Value return m.OldTransaction(ctx) case eventlog.FieldArgs: return m.OldArgs(ctx) + case eventlog.FieldConsensus: + return m.OldConsensus(ctx) + case eventlog.FieldVoted: + return m.OldVoted(ctx) } return nil, fmt.Errorf("unknown EventLog field %s", name) } @@ -2450,6 +2754,20 @@ func (m *EventLogMutation) SetField(name string, value ent.Value) error { } m.SetArgs(v) return nil + case eventlog.FieldConsensus: + v, ok := value.(bool) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetConsensus(v) + return nil + case eventlog.FieldVoted: + v, ok := value.(*helpers.BigInt) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetVoted(v) + return nil } return fmt.Errorf("unknown EventLog field %s", name) } @@ -2565,6 +2883,12 @@ func (m *EventLogMutation) ResetField(name string) error { case eventlog.FieldArgs: m.ResetArgs() return nil + case eventlog.FieldConsensus: + m.ResetConsensus() + return nil + case eventlog.FieldVoted: + m.ResetVoted() + return nil } return fmt.Errorf("unknown EventLog field %s", name) } diff --git a/internal/ent/runtime.go b/internal/ent/runtime.go index 285bb8ad..7f0f0b4a 100644 --- a/internal/ent/runtime.go +++ b/internal/ent/runtime.go @@ -20,6 +20,10 @@ func init() { assetpriceDescSignature := assetpriceFields[3].Descriptor() // assetprice.SignatureValidator is a validator for the "signature" field. It is called by the builders before save. assetprice.SignatureValidator = assetpriceDescSignature.Validators[0].(func([]byte) error) + // assetpriceDescConsensus is the schema descriptor for consensus field. + assetpriceDescConsensus := assetpriceFields[7].Descriptor() + // assetprice.DefaultConsensus holds the default value on creation for the consensus field. + assetprice.DefaultConsensus = assetpriceDescConsensus.Default.(bool) correctnessreportFields := schema.CorrectnessReport{}.Fields() _ = correctnessreportFields // correctnessreportDescSignature is the schema descriptor for signature field. @@ -34,6 +38,10 @@ func init() { correctnessreportDescTopic := correctnessreportFields[4].Descriptor() // correctnessreport.TopicValidator is a validator for the "topic" field. It is called by the builders before save. correctnessreport.TopicValidator = correctnessreportDescTopic.Validators[0].(func([]byte) error) + // correctnessreportDescConsensus is the schema descriptor for consensus field. + correctnessreportDescConsensus := correctnessreportFields[6].Descriptor() + // correctnessreport.DefaultConsensus holds the default value on creation for the consensus field. + correctnessreport.DefaultConsensus = correctnessreportDescConsensus.Default.(bool) eventlogFields := schema.EventLog{}.Fields() _ = eventlogFields // eventlogDescSignature is the schema descriptor for signature field. @@ -44,6 +52,10 @@ func init() { eventlogDescTransaction := eventlogFields[7].Descriptor() // eventlog.TransactionValidator is a validator for the "transaction" field. It is called by the builders before save. eventlog.TransactionValidator = eventlogDescTransaction.Validators[0].(func([]byte) error) + // eventlogDescConsensus is the schema descriptor for consensus field. + eventlogDescConsensus := eventlogFields[9].Descriptor() + // eventlog.DefaultConsensus holds the default value on creation for the consensus field. + eventlog.DefaultConsensus = eventlogDescConsensus.Default.(bool) signerFields := schema.Signer{}.Fields() _ = signerFields // signerDescName is the schema descriptor for name field. diff --git a/internal/ent/schema/assetprice.go b/internal/ent/schema/assetprice.go index 861c6a12..c0548750 100644 --- a/internal/ent/schema/assetprice.go +++ b/internal/ent/schema/assetprice.go @@ -40,6 +40,16 @@ func (AssetPrice) Fields() []ent.Field { field.String("asset").Optional(), field.String("chain").Optional(), field.String("pair").Optional(), + field.Bool("consensus").Default(false). + Annotations(entgql.Type("Boolean")), + field.Uint("voted"). + GoType(new(helpers.BigInt)). + SchemaType(map[string]string{ + // Uint256 + dialect.SQLite: "numeric(78, 0)", + dialect.Postgres: "numeric(78, 0)", + }). + Annotations(entgql.Type("Uint")), } } @@ -55,6 +65,7 @@ func (AssetPrice) Edges() []ent.Edge { func (AssetPrice) Indexes() []ent.Index { return []ent.Index{ index.Fields("block", "chain", "asset", "pair").Unique(), + index.Fields("block", "chain", "asset", "pair", "price", "consensus"), } } diff --git a/internal/ent/schema/correctness.go b/internal/ent/schema/correctness.go index e009bf39..8c1516cc 100644 --- a/internal/ent/schema/correctness.go +++ b/internal/ent/schema/correctness.go @@ -3,10 +3,12 @@ package schema import ( "entgo.io/contrib/entgql" "entgo.io/ent" + "entgo.io/ent/dialect" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "entgo.io/ent/schema/index" + "github.com/KenshiTech/unchained/internal/ent/helpers" ) // DataSet holds the schema definition for the DataSet entity. @@ -37,6 +39,16 @@ func (CorrectnessReport) Fields() []ent.Field { MaxLen(HashMaxLen). Annotations(entgql.Type("Bytes")), field.Bool("correct"), + field.Bool("consensus").Default(false). + Annotations(entgql.Type("Boolean")), + field.Uint("voted"). + GoType(new(helpers.BigInt)). + SchemaType(map[string]string{ + // Uint256 + dialect.SQLite: "numeric(78, 0)", + dialect.Postgres: "numeric(78, 0)", + }). + Annotations(entgql.Type("Uint")), } } diff --git a/internal/ent/schema/eventlog.go b/internal/ent/schema/eventlog.go index 9c5ddcb3..64c974ae 100644 --- a/internal/ent/schema/eventlog.go +++ b/internal/ent/schema/eventlog.go @@ -3,11 +3,13 @@ package schema import ( "entgo.io/contrib/entgql" "entgo.io/ent" + "entgo.io/ent/dialect" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "entgo.io/ent/schema/index" "github.com/KenshiTech/unchained/internal/datasets" + "github.com/KenshiTech/unchained/internal/ent/helpers" ) // DataSet holds the schema definition for the DataSet entity. @@ -41,6 +43,16 @@ func (EventLog) Fields() []ent.Field { MaxLen(TransactionMaxLen). Annotations(entgql.Type("Bytes")), field.JSON("args", []datasets.EventLogArg{}), + field.Bool("consensus").Default(false). + Annotations(entgql.Type("Boolean")), + field.Uint("voted"). + GoType(new(helpers.BigInt)). + SchemaType(map[string]string{ + // Uint256 + dialect.SQLite: "numeric(78, 0)", + dialect.Postgres: "numeric(78, 0)", + }). + Annotations(entgql.Type("Uint")), } } @@ -56,7 +68,7 @@ func (EventLog) Edges() []ent.Edge { func (EventLog) Indexes() []ent.Index { return []ent.Index{ index.Fields("block", "transaction", "index").Unique(), - index.Fields("block", "address", "event"), + index.Fields("block", "address", "event", "consensus"), } } diff --git a/internal/gqlgen.yml b/internal/gqlgen.yml index 443f11b4..bb31fa5d 100644 --- a/internal/gqlgen.yml +++ b/internal/gqlgen.yml @@ -1,17 +1,17 @@ # schema tells gqlgen where the GraphQL schema is located. schema: - - gql/*.graphql + - transport/server/gql/*.graphql # resolver reports where the resolver implementations go. resolver: layout: follow-schema - dir: gql + dir: transport/server/gql package: gql filename_template: "{name}.resolvers.go" exec: layout: follow-schema - dir: gql/generated + dir: transport/server/gql/generated package: generated # gqlgen will search for any type names in the schema in these go packages @@ -24,7 +24,7 @@ autobind: - github.com/KenshiTech/unchained/internal/ent/assetprice - github.com/KenshiTech/unchained/internal/ent/eventlog - github.com/KenshiTech/unchained/internal/datasets - - github.com/KenshiTech/unchained/internal/gql/types + - github.com/KenshiTech/unchained/internal/transport/server/gql/types - github.com/99designs/gqlgen/graphql # This section declares type mapping between the GraphQL and Go type systems. @@ -46,7 +46,7 @@ models: - github.com/99designs/gqlgen/graphql.Uint32 Bytes: model: - - github.com/KenshiTech/unchained/internal/gql/types.Bytes + - github.com/KenshiTech/unchained/internal/transport/server/gql/types.Bytes Any: model: - github.com/99designs/gqlgen/graphql.Any diff --git a/internal/pos/pos.go b/internal/pos/pos.go index eddfa593..72fc229e 100644 --- a/internal/pos/pos.go +++ b/internal/pos/pos.go @@ -19,6 +19,7 @@ import ( type Repository struct { ethRPC *ethereum.Repository posContract *contracts.UnchainedStaking + posChain string votingPowers *xsync.MapOf[[20]byte, *big.Int] lastUpdated *xsync.MapOf[[20]byte, *big.Int] base *big.Int @@ -69,11 +70,20 @@ func (s *Repository) GetVotingPower(address [20]byte, block *big.Int) (*big.Int, return s.base, nil } -func (s *Repository) GetVotingPowerOfPublicKey(pkBytes [96]byte, block *big.Int) (*big.Int, error) { +func (s *Repository) GetVotingPowerOfPublicKeyAtBlock(pkBytes [96]byte, block *big.Int) (*big.Int, error) { _, addrHex := address.CalculateHex(pkBytes[:]) return s.GetVotingPower(addrHex, block) } +func (s *Repository) GetVotingPowerOfPublicKey(pkBytes [96]byte) (*big.Int, error) { + _, addrHex := address.CalculateHex(pkBytes[:]) + block, err := s.ethRPC.GetBlockNumber(s.posChain) + if err != nil { + return nil, err + } + return s.GetVotingPower(addrHex, big.NewInt(int64(block))) +} + func (s *Repository) VotingPowerToFloat(power *big.Int) *big.Float { decimalPlaces := big.NewInt(1e18) powerFloat := new(big.Float).SetInt(power) @@ -149,6 +159,7 @@ func New(ethRPC *ethereum.Repository) *Repository { } s.eip712Signer = eip712.New(chainID, config.App.ProofOfStake.Address) + s.posChain = config.App.ProofOfStake.Chain return s } diff --git a/internal/service/correctness/correctness.go b/internal/service/correctness/correctness.go index f1140901..b4d22f60 100644 --- a/internal/service/correctness/correctness.go +++ b/internal/service/correctness/correctness.go @@ -2,10 +2,18 @@ package correctness import ( "context" + "fmt" + "math/big" + "os" "sync" "time" + "github.com/KenshiTech/unchained/internal/address" "github.com/KenshiTech/unchained/internal/crypto/ethereum" + "github.com/KenshiTech/unchained/internal/log" + "github.com/KenshiTech/unchained/internal/pos" + "github.com/KenshiTech/unchained/internal/service/evmlog" + "github.com/puzpuzpuz/xsync/v3" "github.com/KenshiTech/unchained/internal/config" "github.com/KenshiTech/unchained/internal/crypto/bls" @@ -14,6 +22,7 @@ import ( "github.com/KenshiTech/unchained/internal/db" "github.com/KenshiTech/unchained/internal/ent" "github.com/KenshiTech/unchained/internal/ent/correctnessreport" + "github.com/KenshiTech/unchained/internal/ent/helpers" "github.com/KenshiTech/unchained/internal/ent/signer" "github.com/KenshiTech/unchained/internal/utils" bls12381 "github.com/consensys/gnark-crypto/ecc/bls12-381" @@ -29,13 +38,18 @@ type Conf struct { } type SaveSignatureArgs struct { - Info datasets.Correctness - Hash bls12381.G1Affine + Info datasets.Correctness + Hash bls12381.G1Affine + Consensus bool + Voted *big.Int } type Service struct { ethRPC *ethereum.Repository + pos *pos.Repository + + signatureCache *lru.Cache[bls12381.G1Affine, []datasets.Signature] + consensus *lru.Cache[Key, xsync.MapOf[bls12381.G1Affine, big.Int]] - signatureCache *lru.Cache[bls12381.G1Affine, []datasets.Signature] DebouncedSaveSignatures func(key bls12381.G1Affine, arg SaveSignatureArgs) signatureMutex *sync.Mutex supportedTopics map[[64]byte]bool @@ -53,6 +67,21 @@ func (s *Service) GetBlockNumber(network string) (*uint64, error) { return &blockNumber, nil } +func (s *Service) IsNewSigner(signature datasets.Signature, records []*ent.CorrectnessReport) bool { + // TODO: This isn't efficient, we should use a map + for _, record := range records { + for _, signer := range record.Edges.Signers { + if signature.Signer.PublicKey == [96]byte(signer.Key) { + return false + } + } + } + + return true +} + +// TODO: How should we handle older records? +// Possible Solution: Add a not after timestamp to the document. func (s *Service) RecordSignature( signature bls12381.G1Affine, signer datasets.Signer, @@ -82,16 +111,58 @@ func (s *Service) RecordSignature( packed := datasets.Signature{ Signature: signature, Signer: signer, - Processed: false, } + key := Key{ + Hash: fmt.Sprintf("%x", info.Hash), + Topic: fmt.Sprintf("%x", info.Topic), + Correct: info.Correct, + } + + if !s.consensus.Contains(key) { + s.consensus.Add(key, *xsync.NewMapOf[bls12381.G1Affine, big.Int]()) + } + + reportedValues, _ := s.consensus.Get(key) + isMajority := true + voted, ok := reportedValues.Load(hash) + if !ok { + voted = *big.NewInt(0) + } + + votingPower, err := s.pos.GetVotingPowerOfPublicKey(signer.PublicKey) + if err != nil { + log.Logger. + With("Address", address.Calculate(signer.PublicKey[:])). + With("Error", err). + Error("Failed to get voting power") + return + } + + totalVoted := new(big.Int).Add(votingPower, &voted) + + reportedValues.Range(func(_ bls12381.G1Affine, value big.Int) bool { + if value.Cmp(totalVoted) == 1 { + isMajority = false + } + return isMajority + }) + + reportedValues.Store(hash, *totalVoted) signatures = append(signatures, packed) s.signatureCache.Add(hash, signatures) + saveArgs := SaveSignatureArgs{ + Info: info, + Hash: hash, + Consensus: isMajority, + Voted: totalVoted, + } + if debounce { - s.DebouncedSaveSignatures(hash, SaveSignatureArgs{Hash: hash, Info: info}) + s.DebouncedSaveSignatures(hash, saveArgs) } else { - s.SaveSignatures(SaveSignatureArgs{Hash: hash, Info: info}) + s.SaveSignatures(saveArgs) } } @@ -114,30 +185,26 @@ func (s *Service) SaveSignatures(args SaveSignatureArgs) { keys = append(keys, signature.Signer.PublicKey[:]) } - currentRecord, err := dbClient.CorrectnessReport. + currentRecords, err := dbClient.CorrectnessReport. Query(). Where(correctnessreport.And( correctnessreport.Hash(args.Info.Hash[:]), correctnessreport.Topic(args.Info.Topic[:]), correctnessreport.Timestamp(args.Info.Timestamp), - correctnessreport.Correct(args.Info.Correct), )). - Only(ctx) + All(ctx) if err != nil && !ent.IsNotFound(err) { panic(err) } // Select the new signers and signatures + for i := range signatures { signature := signatures[i] - if currentRecord != nil { - for _, signer := range currentRecord.Edges.Signers { - if signature.Signer.PublicKey == [96]byte(signer.Key) { - continue - } - } + if !s.IsNewSigner(signature, currentRecords) { + continue } newSigners = append(newSigners, signature.Signer) @@ -177,14 +244,17 @@ func (s *Service) SaveSignatures(args SaveSignatureArgs) { var aggregate bls12381.G1Affine - if currentRecord != nil { - currentSignature, err := bls.RecoverSignature([48]byte(currentRecord.Signature)) + for _, record := range currentRecords { + if record.Correct == args.Info.Correct { + currentSignature, err := bls.RecoverSignature([48]byte(record.Signature)) - if err != nil { - panic(err) - } + if err != nil { + panic(err) + } - newSignatures = append(newSignatures, currentSignature) + newSignatures = append(newSignatures, currentSignature) + break + } } aggregate, err = bls.AggregateSignatures(newSignatures) @@ -203,6 +273,8 @@ func (s *Service) SaveSignatures(args SaveSignatureArgs) { SetHash(args.Info.Hash[:]). SetTimestamp(args.Info.Timestamp). SetTopic(args.Info.Topic[:]). + SetConsensus(args.Consensus). + SetVoted(&helpers.BigInt{Int: *args.Voted}). AddSignerIDs(signerIDs...). OnConflictColumns("topic", "hash"). UpdateNewValues(). @@ -228,9 +300,10 @@ func (s *Service) init() { } } -func New(ethRPC *ethereum.Repository) *Service { +func New(ethRPC *ethereum.Repository, pos *pos.Repository) *Service { c := Service{ ethRPC: ethRPC, + pos: pos, } c.init() @@ -238,5 +311,13 @@ func New(ethRPC *ethereum.Repository) *Service { c.supportedTopics[[64]byte(shake.Shake([]byte(conf)))] = true } + var err error + c.consensus, err = lru.New[Key, xsync.MapOf[bls12381.G1Affine, big.Int]](evmlog.LruSize) + if err != nil { + log.Logger. + Error("Failed to create correctness consensus cache.") + os.Exit(1) + } + return &c } diff --git a/internal/service/correctness/types.go b/internal/service/correctness/types.go new file mode 100644 index 00000000..1170f6b6 --- /dev/null +++ b/internal/service/correctness/types.go @@ -0,0 +1,7 @@ +package correctness + +type Key struct { + Hash string + Topic string + Correct bool +} diff --git a/internal/service/evmlog/evmlog.go b/internal/service/evmlog/evmlog.go index 667db762..d5753300 100644 --- a/internal/service/evmlog/evmlog.go +++ b/internal/service/evmlog/evmlog.go @@ -2,7 +2,9 @@ package evmlog import ( "context" + "fmt" "math/big" + "slices" "sync" "time" @@ -15,6 +17,8 @@ import ( "github.com/KenshiTech/unchained/internal/datasets" "github.com/KenshiTech/unchained/internal/db" "github.com/KenshiTech/unchained/internal/ent" + "github.com/KenshiTech/unchained/internal/ent/eventlog" + "github.com/KenshiTech/unchained/internal/ent/helpers" "github.com/KenshiTech/unchained/internal/ent/signer" "github.com/KenshiTech/unchained/internal/log" "github.com/KenshiTech/unchained/internal/pos" @@ -31,8 +35,10 @@ const ( ) type SaveSignatureArgs struct { - Info datasets.EventLog - Hash bls12381.G1Affine + Info datasets.EventLog + Hash bls12381.G1Affine + Consensus bool + Voted *big.Int } type Service struct { @@ -41,7 +47,6 @@ type Service struct { consensus *lru.Cache[EventKey, map[bls12381.G1Affine]big.Int] signatureCache *lru.Cache[bls12381.G1Affine, []datasets.Signature] - aggregateCache *lru.Cache[bls12381.G1Affine, bls12381.G1Affine] DebouncedSaveSignatures func(key bls12381.G1Affine, arg SaveSignatureArgs) signatureMutex *sync.Mutex supportedEvents map[SupportKey]bool @@ -105,11 +110,7 @@ func (e *Service) RecordSignature( e.consensus.Add(key, make(map[bls12381.G1Affine]big.Int)) } - votingPower, err := e.pos.GetVotingPowerOfPublicKey( - signer.PublicKey, - big.NewInt(int64(*blockNumber)), - ) - + votingPower, err := e.pos.GetVotingPowerOfPublicKey(signer.PublicKey) if err != nil { log.Logger. With("Address", address.Calculate(signer.PublicKey[:])). @@ -135,7 +136,6 @@ func (e *Service) RecordSignature( packed := datasets.Signature{ Signature: signature, Signer: signer, - Processed: false, } for _, item := range cached { @@ -148,13 +148,37 @@ func (e *Service) RecordSignature( cached = append(cached, packed) e.signatureCache.Add(hash, cached) - if isMajority { - if debounce { - e.DebouncedSaveSignatures(hash, SaveSignatureArgs{Hash: hash, Info: info}) - } else { - e.SaveSignatures(SaveSignatureArgs{Hash: hash, Info: info}) + saveArgs := SaveSignatureArgs{ + Hash: hash, + Info: info, + Consensus: isMajority, + Voted: totalVoted, + } + + if debounce { + e.DebouncedSaveSignatures(hash, saveArgs) + } else { + e.SaveSignatures(saveArgs) + } +} + +func IsNewSigner(signature datasets.Signature, records []*ent.EventLog) bool { + for _, record := range records { + for _, signer := range record.Edges.Signers { + if signature.Signer.PublicKey == [96]byte(signer.Key) { + return false + } } } + + return true +} + +func sortEventArgs(lhs datasets.EventLogArg, rhs datasets.EventLogArg) int { + if lhs.Name < rhs.Name { + return -1 + } + return 1 } func (e *Service) SaveSignatures(args SaveSignatureArgs) { @@ -171,17 +195,34 @@ func (e *Service) SaveSignatures(args SaveSignatureArgs) { var newSignatures []bls12381.G1Affine var keys [][]byte + currentRecords, err := dbClient.EventLog. + Query(). + Where( + eventlog.Block(args.Info.Block), + eventlog.TransactionEQ(args.Info.TxHash[:]), + eventlog.IndexEQ(args.Info.LogIndex), + ). + WithSigners(). + All(ctx) + + if err != nil && !ent.IsNotFound(err) { + panic(err) + } + for i := range signatures { signature := signatures[i] keys = append(keys, signature.Signer.PublicKey[:]) - if !signature.Processed { - newSignatures = append(newSignatures, signature.Signature) - newSigners = append(newSigners, signature.Signer) + + if !IsNewSigner(signature, currentRecords) { + continue } + + newSignatures = append(newSignatures, signature.Signature) + newSigners = append(newSigners, signature.Signer) } // TODO: This part can be a shared library - err := dbClient.Signer.MapCreateBulk(newSigners, func(sc *ent.SignerCreate, i int) { + err = dbClient.Signer.MapCreateBulk(newSigners, func(sc *ent.SignerCreate, i int) { signer := newSigners[i] sc.SetName(signer.Name). SetEvm(signer.EvmAddress). @@ -212,10 +253,51 @@ func (e *Service) SaveSignatures(args SaveSignatureArgs) { } var aggregate bls12381.G1Affine - currentAggregate, ok := e.aggregateCache.Get(args.Hash) - if ok { + sortedCurrentArgs := make([]datasets.EventLogArg, len(args.Info.Args)) + copy(sortedCurrentArgs, args.Info.Args) + slices.SortFunc(sortedCurrentArgs, sortEventArgs) + + for _, record := range currentRecords { + sortedRecordArgs := make([]datasets.EventLogArg, len(args.Info.Args)) + copy(sortedRecordArgs, record.Args) + slices.SortFunc(sortedRecordArgs, sortEventArgs) + + // compare args + if len(sortedCurrentArgs) != len(sortedRecordArgs) { + continue + } + + for i := range sortedCurrentArgs { + if sortedCurrentArgs[i].Name != sortedRecordArgs[i].Name || + sortedCurrentArgs[i].Value != sortedRecordArgs[i].Value { + continue + } + } + + // Check if record mataches the passed event + if record.Chain != args.Info.Chain || + record.Address != args.Info.Address || + record.Event != args.Info.Event { + continue + } + + currentAggregate, err := bls.RecoverSignature([48]byte(record.Signature)) + + if err != nil { + log.Logger. + With("Block", args.Info.Block). + With("Transaction", fmt.Sprintf("%x", args.Info.TxHash)). + With("Index", args.Info.LogIndex). + With("Event", args.Info.Event). + With("Hash", fmt.Sprintf("%x", args.Hash.Bytes())[:8]). + With("Error", err). + Debug("Failed to recover signature") + return + } + newSignatures = append(newSignatures, currentAggregate) + break } aggregate, err = bls.AggregateSignatures(newSignatures) @@ -237,6 +319,8 @@ func (e *Service) SaveSignatures(args SaveSignatureArgs) { SetSignersCount(uint64(len(signatures))). SetSignature(signatureBytes[:]). SetArgs(args.Info.Args). + SetConsensus(args.Consensus). + SetVoted(&helpers.BigInt{Int: *args.Voted}). AddSignerIDs(signerIDs...). OnConflictColumns("block", "transaction", "index"). UpdateNewValues(). @@ -245,12 +329,6 @@ func (e *Service) SaveSignatures(args SaveSignatureArgs) { if err != nil { panic(err) } - - for inx := range signatures { - signatures[inx].Processed = true - } - - e.aggregateCache.Add(args.Hash, aggregate) } func (e *Service) SendPriceReport(signature bls12381.G1Affine, event datasets.EventLog) { @@ -292,10 +370,5 @@ func New( panic(err) } - s.aggregateCache, err = lru.New[bls12381.G1Affine, bls12381.G1Affine](LruSize) - if err != nil { - panic(err) - } - return &s } diff --git a/internal/service/uniswap/uniswap.go b/internal/service/uniswap/uniswap.go index 488817db..79210351 100644 --- a/internal/service/uniswap/uniswap.go +++ b/internal/service/uniswap/uniswap.go @@ -23,6 +23,7 @@ import ( "github.com/KenshiTech/unchained/internal/datasets" "github.com/KenshiTech/unchained/internal/db" "github.com/KenshiTech/unchained/internal/ent" + "github.com/KenshiTech/unchained/internal/ent/assetprice" "github.com/KenshiTech/unchained/internal/ent/helpers" "github.com/KenshiTech/unchained/internal/ent/signer" "github.com/KenshiTech/unchained/internal/log" @@ -50,7 +51,6 @@ type Service struct { consensus *lru.Cache[datasets.AssetKey, xsync.MapOf[bls12381.G1Affine, big.Int]] signatureCache *lru.Cache[bls12381.G1Affine, []datasets.Signature] - aggregateCache *lru.Cache[bls12381.G1Affine, bls12381.G1Affine] SupportedTokens map[datasets.TokenKey]bool signatureMutex sync.Mutex @@ -76,7 +76,6 @@ func (u *Service) CheckAndCacheSignature( packed := datasets.Signature{ Signature: signature, Signer: signer, - Processed: false, } for _, item := range cached { @@ -143,10 +142,7 @@ func (u *Service) RecordSignature( voted = *big.NewInt(0) } - votingPower, err := u.pos.GetVotingPowerOfPublicKey( - signer.PublicKey, - big.NewInt(int64(*blockNumber)), - ) + votingPower, err := u.pos.GetVotingPowerOfPublicKey(signer.PublicKey) if err != nil { log.Logger. With("Address", address.Calculate(signer.PublicKey[:])). @@ -169,13 +165,15 @@ func (u *Service) RecordSignature( return } - if !isMajority { - log.Logger.Debug("Not a majority") - return + saveArgs := SaveSignatureArgs{ + Hash: hash, + Info: info, + Voted: totalVoted, + Consensus: isMajority, } if !debounce { - u.saveSignatures(SaveSignatureArgs{Hash: hash, Info: info}) + u.saveSignatures(saveArgs) return } @@ -191,6 +189,7 @@ func (u *Service) RecordSignature( ) return true }) + reportedValues.Range(func(hash bls12381.G1Affine, value big.Int) bool { reportLog = reportLog.With( fmt.Sprintf("%x", hash.Bytes())[:8], @@ -203,15 +202,26 @@ func (u *Service) RecordSignature( With("Majority", fmt.Sprintf("%x", hash.Bytes())[:8]). Debug("Values") - DebouncedSaveSignatures( - info.Asset, - SaveSignatureArgs{Hash: hash, Info: info}, - ) + DebouncedSaveSignatures(info.Asset, saveArgs) } type SaveSignatureArgs struct { - Info datasets.PriceInfo - Hash bls12381.G1Affine + Info datasets.PriceInfo + Hash bls12381.G1Affine + Consensus bool + Voted *big.Int +} + +func IsNewSigner(signature datasets.Signature, records []*ent.AssetPrice) bool { + for _, record := range records { + for _, signer := range record.Edges.Signers { + if signature.Signer.PublicKey == [96]byte(signer.Key) { + return false + } + } + } + + return true } func (u *Service) saveSignatures(args SaveSignatureArgs) { @@ -236,16 +246,32 @@ func (u *Service) saveSignatures(args SaveSignatureArgs) { var newSignatures []bls12381.G1Affine var keys [][]byte + currentRecords, err := dbClient.AssetPrice. + Query(). + Where(assetprice.Block(args.Info.Asset.Block), + assetprice.Chain(args.Info.Asset.Token.Chain), + assetprice.Asset(args.Info.Asset.Token.Name), + assetprice.Pair(args.Info.Asset.Token.Pair)). + WithSigners(). + All(ctx) + + if err != nil && !ent.IsNotFound(err) { + panic(err) + } + for i := range signatures { signature := signatures[i] keys = append(keys, signature.Signer.PublicKey[:]) - if !signature.Processed { - newSignatures = append(newSignatures, signature.Signature) - newSigners = append(newSigners, signature.Signer) + + if !IsNewSigner(signature, currentRecords) { + continue } + + newSignatures = append(newSignatures, signature.Signature) + newSigners = append(newSigners, signature.Signer) } - err := dbClient.Signer.MapCreateBulk(newSigners, func(sc *ent.SignerCreate, i int) { + err = dbClient.Signer.MapCreateBulk(newSigners, func(sc *ent.SignerCreate, i int) { newSigner := newSigners[i] sc.SetName(newSigner.Name). SetEvm(newSigner.EvmAddress). @@ -284,10 +310,23 @@ func (u *Service) saveSignatures(args SaveSignatureArgs) { } var aggregate bls12381.G1Affine - currentAggregate, ok := u.aggregateCache.Get(args.Hash) - if ok { - newSignatures = append(newSignatures, currentAggregate) + for _, record := range currentRecords { + if record.Price.Cmp(&args.Info.Price) == 0 { + currentAggregate, err := bls.RecoverSignature([48]byte(record.Signature)) + + if err != nil { + log.Logger. + With("Block", args.Info.Asset.Block). + With("Hash", fmt.Sprintf("%x", args.Hash.Bytes())[:8]). + With("Error", err). + Debug("Failed to recover signature") + return + } + + newSignatures = append(newSignatures, currentAggregate) + break + } } aggregate, err = bls.AggregateSignatures(newSignatures) @@ -312,6 +351,8 @@ func (u *Service) saveSignatures(args SaveSignatureArgs) { SetPrice(&helpers.BigInt{Int: args.Info.Price}). SetSignersCount(uint64(len(signatures))). SetSignature(signatureBytes[:]). + SetConsensus(args.Consensus). + SetVoted(&helpers.BigInt{Int: *args.Voted}). AddSignerIDs(signerIDs...). OnConflictColumns("block", "chain", "asset", "pair"). UpdateNewValues(). @@ -324,21 +365,8 @@ func (u *Service) saveSignatures(args SaveSignatureArgs) { Debug("Failed to upsert asset price") panic(err) } - - // TODO: We probably need a context-aware mutex here - for inx := range signatures { - signatures[inx].Processed = true - } - - u.aggregateCache.Add(args.Hash, aggregate) } -// -// func (u *Service) setPriceFromCache(block uint64, pair string) (big.Int, bool) { -// lruCache := u.PriceCache[strings.ToLower(pair)] -// return lruCache.Get(block) -//} - func (u *Service) GetBlockNumber(network string) (*uint64, error) { blockNumber, err := u.ethRPC.GetBlockNumber(network) @@ -377,27 +405,6 @@ func (u *Service) GetPriceAtBlockFromPair( return &u.LastPrice, nil } -// -// func (u *Service) getPriceFromPair( -// network string, pairAddr string, decimalDif int64, inverse bool, -// ) (*uint64, *big.Int, error) { -// blockNumber, err := ethereum.GetBlockNumber(network) -// -// if err != nil { -// ethereum.RefreshRPC(network) -// return nil, nil, err -// } -// -// lastPrice, err := u.GetPriceAtBlockFromPair( -// network, -// blockNumber, -// pairAddr, -// decimalDif, -// inverse) -// -// return &blockNumber, lastPrice, err -//} - func (u *Service) priceFromSqrtX96(sqrtPriceX96 *big.Int, decimalDif int64, inverse bool) *big.Int { var decimalFix big.Int var powerUp big.Int @@ -561,7 +568,6 @@ func New(ethRPC *ethereum.Repository, pos *pos.Repository) *Service { consensus: nil, signatureCache: nil, - aggregateCache: nil, signatureMutex: sync.Mutex{}, LastBlock: *xsync.NewMapOf[datasets.TokenKey, uint64](), SupportedTokens: map[datasets.TokenKey]bool{}, @@ -597,11 +603,5 @@ func New(ethRPC *ethereum.Repository, pos *pos.Repository) *Service { os.Exit(1) } - u.aggregateCache, err = lru.New[bls12381.G1Affine, bls12381.G1Affine](evmlog.LruSize) - if err != nil { - log.Logger.Error("Failed to create token price aggregate cache.") - os.Exit(1) - } - return &u } diff --git a/internal/transport/server/gql/args.resolvers.go b/internal/transport/server/gql/args.resolvers.go index 3c3f08bf..385497d3 100644 --- a/internal/transport/server/gql/args.resolvers.go +++ b/internal/transport/server/gql/args.resolvers.go @@ -9,9 +9,8 @@ import ( "fmt" "strings" - "github.com/KenshiTech/unchained/internal/transport/server/gql/generated" - "github.com/KenshiTech/unchained/internal/datasets" + "github.com/KenshiTech/unchained/internal/transport/server/gql/generated" ) // Value is the resolver for the value field. diff --git a/internal/transport/server/gql/generated/args.generated.go b/internal/transport/server/gql/generated/args.generated.go index e724c26f..7dd44cd5 100644 --- a/internal/transport/server/gql/generated/args.generated.go +++ b/internal/transport/server/gql/generated/args.generated.go @@ -9,10 +9,9 @@ import ( "sync" "sync/atomic" - "github.com/KenshiTech/unchained/internal/transport/server/gql/types" - "github.com/99designs/gqlgen/graphql" "github.com/KenshiTech/unchained/internal/datasets" + "github.com/KenshiTech/unchained/internal/transport/server/gql/types" "github.com/vektah/gqlparser/v2/ast" ) @@ -213,13 +212,13 @@ func (ec *executionContext) _EventLogArg(ctx context.Context, sel ast.SelectionS // region ***************************** type.gotpl ***************************** -func (ec *executionContext) unmarshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋgqlᚋtypesᚐBytes(ctx context.Context, v interface{}) (types.Bytes, error) { +func (ec *executionContext) unmarshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋtransportᚋserverᚋgqlᚋtypesᚐBytes(ctx context.Context, v interface{}) (types.Bytes, error) { var res types.Bytes err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋgqlᚋtypesᚐBytes(ctx context.Context, sel ast.SelectionSet, v types.Bytes) graphql.Marshaler { +func (ec *executionContext) marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋtransportᚋserverᚋgqlᚋtypesᚐBytes(ctx context.Context, sel ast.SelectionSet, v types.Bytes) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -229,11 +228,11 @@ func (ec *executionContext) marshalNBytes2githubᚗcomᚋKenshiTechᚋunchained return v } -func (ec *executionContext) marshalNEventLogArg2githubᚗcomᚋKenshiTechᚋunchainedᚋdatasetsᚐEventLogArg(ctx context.Context, sel ast.SelectionSet, v datasets.EventLogArg) graphql.Marshaler { +func (ec *executionContext) marshalNEventLogArg2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋdatasetsᚐEventLogArg(ctx context.Context, sel ast.SelectionSet, v datasets.EventLogArg) graphql.Marshaler { return ec._EventLogArg(ctx, sel, &v) } -func (ec *executionContext) marshalNEventLogArg2ᚕgithub.comᚋKenshiTechᚋunchainedᚋdatasetsᚐEventLogArgᚄ(ctx context.Context, sel ast.SelectionSet, v []datasets.EventLogArg) graphql.Marshaler { +func (ec *executionContext) marshalNEventLogArg2ᚕgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋdatasetsᚐEventLogArgᚄ(ctx context.Context, sel ast.SelectionSet, v []datasets.EventLogArg) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 @@ -257,7 +256,7 @@ func (ec *executionContext) marshalNEventLogArg2ᚕgithub.comᚋKenshiTechᚋu if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalNEventLogArg2githubᚗcomᚋKenshiTechᚋunchainedᚋdatasetsᚐEventLogArg(ctx, sel, v[i]) + ret[i] = ec.marshalNEventLogArg2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋdatasetsᚐEventLogArg(ctx, sel, v[i]) } if isLen1 { f(i) diff --git a/internal/transport/server/gql/generated/root_.generated.go b/internal/transport/server/gql/generated/root_.generated.go index a3aa9192..95d571a5 100644 --- a/internal/transport/server/gql/generated/root_.generated.go +++ b/internal/transport/server/gql/generated/root_.generated.go @@ -42,6 +42,7 @@ type ResolverRoot interface { Signer() SignerResolver AssetPriceWhereInput() AssetPriceWhereInputResolver CorrectnessReportWhereInput() CorrectnessReportWhereInputResolver + EventLogWhereInput() EventLogWhereInputResolver SignerWhereInput() SignerWhereInputResolver } @@ -53,12 +54,14 @@ type ComplexityRoot struct { Asset func(childComplexity int) int Block func(childComplexity int) int Chain func(childComplexity int) int + Consensus func(childComplexity int) int ID func(childComplexity int) int Pair func(childComplexity int) int Price func(childComplexity int) int Signature func(childComplexity int) int Signers func(childComplexity int) int SignersCount func(childComplexity int) int + Voted func(childComplexity int) int } AssetPriceConnection struct { @@ -73,6 +76,7 @@ type ComplexityRoot struct { } CorrectnessReport struct { + Consensus func(childComplexity int) int Correct func(childComplexity int) int Hash func(childComplexity int) int ID func(childComplexity int) int @@ -81,6 +85,7 @@ type ComplexityRoot struct { SignersCount func(childComplexity int) int Timestamp func(childComplexity int) int Topic func(childComplexity int) int + Voted func(childComplexity int) int } CorrectnessReportConnection struct { @@ -99,6 +104,7 @@ type ComplexityRoot struct { Args func(childComplexity int) int Block func(childComplexity int) int Chain func(childComplexity int) int + Consensus func(childComplexity int) int Event func(childComplexity int) int ID func(childComplexity int) int Index func(childComplexity int) int @@ -106,6 +112,7 @@ type ComplexityRoot struct { Signers func(childComplexity int) int SignersCount func(childComplexity int) int Transaction func(childComplexity int) int + Voted func(childComplexity int) int } EventLogArg struct { @@ -204,6 +211,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.AssetPrice.Chain(childComplexity), true + case "AssetPrice.consensus": + if e.complexity.AssetPrice.Consensus == nil { + break + } + + return e.complexity.AssetPrice.Consensus(childComplexity), true + case "AssetPrice.id": if e.complexity.AssetPrice.ID == nil { break @@ -246,6 +260,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.AssetPrice.SignersCount(childComplexity), true + case "AssetPrice.voted": + if e.complexity.AssetPrice.Voted == nil { + break + } + + return e.complexity.AssetPrice.Voted(childComplexity), true + case "AssetPriceConnection.edges": if e.complexity.AssetPriceConnection.Edges == nil { break @@ -281,6 +302,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.AssetPriceEdge.Node(childComplexity), true + case "CorrectnessReport.consensus": + if e.complexity.CorrectnessReport.Consensus == nil { + break + } + + return e.complexity.CorrectnessReport.Consensus(childComplexity), true + case "CorrectnessReport.correct": if e.complexity.CorrectnessReport.Correct == nil { break @@ -337,6 +365,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.CorrectnessReport.Topic(childComplexity), true + case "CorrectnessReport.voted": + if e.complexity.CorrectnessReport.Voted == nil { + break + } + + return e.complexity.CorrectnessReport.Voted(childComplexity), true + case "CorrectnessReportConnection.edges": if e.complexity.CorrectnessReportConnection.Edges == nil { break @@ -400,6 +435,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.EventLog.Chain(childComplexity), true + case "EventLog.consensus": + if e.complexity.EventLog.Consensus == nil { + break + } + + return e.complexity.EventLog.Consensus(childComplexity), true + case "EventLog.event": if e.complexity.EventLog.Event == nil { break @@ -449,6 +491,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.EventLog.Transaction(childComplexity), true + case "EventLog.voted": + if e.complexity.EventLog.Voted == nil { + break + } + + return e.complexity.EventLog.Voted(childComplexity), true + case "EventLogArg.name": if e.complexity.EventLogArg.Name == nil { break @@ -822,6 +871,8 @@ type AssetPrice implements Node { asset: String chain: String pair: String + consensus: Boolean! + voted: Uint! signers: [Signer!]! } """ @@ -982,6 +1033,22 @@ input AssetPriceWhereInput { pairEqualFold: String pairContainsFold: String """ + consensus field predicates + """ + consensus: Boolean + consensusNEQ: Boolean + """ + voted field predicates + """ + voted: Uint + votedNEQ: Uint + votedIn: [Uint!] + votedNotIn: [Uint!] + votedGT: Uint + votedGTE: Uint + votedLT: Uint + votedLTE: Uint + """ signers edge predicates """ hasSigners: Boolean @@ -995,6 +1062,8 @@ type CorrectnessReport implements Node { hash: Bytes! topic: Bytes! correct: Boolean! + consensus: Boolean! + voted: Uint! signers: [Signer!]! } """ @@ -1093,6 +1162,22 @@ input CorrectnessReportWhereInput { correct: Boolean correctNEQ: Boolean """ + consensus field predicates + """ + consensus: Boolean + consensusNEQ: Boolean + """ + voted field predicates + """ + voted: Uint + votedNEQ: Uint + votedIn: [Uint!] + votedNotIn: [Uint!] + votedGT: Uint + votedGTE: Uint + votedLT: Uint + votedLTE: Uint + """ signers edge predicates """ hasSigners: Boolean @@ -1114,6 +1199,8 @@ type EventLog implements Node { event: String! transaction: Bytes! args: [EventLogArg!]! + consensus: Boolean! + voted: Uint! signers: [Signer!]! } """ @@ -1266,6 +1353,22 @@ input EventLogWhereInput { eventEqualFold: String eventContainsFold: String """ + consensus field predicates + """ + consensus: Boolean + consensusNEQ: Boolean + """ + voted field predicates + """ + voted: Uint + votedNEQ: Uint + votedIn: [Uint!] + votedNotIn: [Uint!] + votedGT: Uint + votedGTE: Uint + votedLT: Uint + votedLTE: Uint + """ signers edge predicates """ hasSigners: Boolean diff --git a/internal/transport/server/gql/generated/unchained.generated.go b/internal/transport/server/gql/generated/unchained.generated.go index e2c8ce2a..aeaa5651 100644 --- a/internal/transport/server/gql/generated/unchained.generated.go +++ b/internal/transport/server/gql/generated/unchained.generated.go @@ -10,13 +10,12 @@ import ( "sync" "sync/atomic" - "github.com/KenshiTech/unchained/internal/transport/server/gql/types" - "entgo.io/contrib/entgql" "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/introspection" "github.com/KenshiTech/unchained/internal/datasets" "github.com/KenshiTech/unchained/internal/ent" + "github.com/KenshiTech/unchained/internal/transport/server/gql/types" "github.com/vektah/gqlparser/v2/ast" ) @@ -25,16 +24,22 @@ import ( type AssetPriceResolver interface { Price(ctx context.Context, obj *ent.AssetPrice) (uint64, error) Signature(ctx context.Context, obj *ent.AssetPrice) (types.Bytes, error) + + Voted(ctx context.Context, obj *ent.AssetPrice) (uint64, error) } type CorrectnessReportResolver interface { Signature(ctx context.Context, obj *ent.CorrectnessReport) (types.Bytes, error) Hash(ctx context.Context, obj *ent.CorrectnessReport) (types.Bytes, error) Topic(ctx context.Context, obj *ent.CorrectnessReport) (types.Bytes, error) + + Voted(ctx context.Context, obj *ent.CorrectnessReport) (uint64, error) } type EventLogResolver interface { Signature(ctx context.Context, obj *ent.EventLog) (types.Bytes, error) Transaction(ctx context.Context, obj *ent.EventLog) (types.Bytes, error) + + Voted(ctx context.Context, obj *ent.EventLog) (uint64, error) } type QueryResolver interface { Node(ctx context.Context, id int) (ent.Noder, error) @@ -58,11 +63,39 @@ type AssetPriceWhereInputResolver interface { PriceGte(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error PriceLt(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error PriceLte(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error + + Voted(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error + VotedNeq(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error + VotedIn(ctx context.Context, obj *ent.AssetPriceWhereInput, data []uint64) error + VotedNotIn(ctx context.Context, obj *ent.AssetPriceWhereInput, data []uint64) error + VotedGt(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error + VotedGte(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error + VotedLt(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error + VotedLte(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error } type CorrectnessReportWhereInputResolver interface { + Voted(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *uint64) error + VotedNeq(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *uint64) error + VotedIn(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data []uint64) error + VotedNotIn(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data []uint64) error + VotedGt(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *uint64) error + VotedGte(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *uint64) error + VotedLt(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *uint64) error + VotedLte(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *uint64) error + Topic(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *string) error Hash(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *string) error } +type EventLogWhereInputResolver interface { + Voted(ctx context.Context, obj *ent.EventLogWhereInput, data *uint64) error + VotedNeq(ctx context.Context, obj *ent.EventLogWhereInput, data *uint64) error + VotedIn(ctx context.Context, obj *ent.EventLogWhereInput, data []uint64) error + VotedNotIn(ctx context.Context, obj *ent.EventLogWhereInput, data []uint64) error + VotedGt(ctx context.Context, obj *ent.EventLogWhereInput, data *uint64) error + VotedGte(ctx context.Context, obj *ent.EventLogWhereInput, data *uint64) error + VotedLt(ctx context.Context, obj *ent.EventLogWhereInput, data *uint64) error + VotedLte(ctx context.Context, obj *ent.EventLogWhereInput, data *uint64) error +} type SignerWhereInputResolver interface { Key(ctx context.Context, obj *ent.SignerWhereInput, data *string) error } @@ -128,7 +161,7 @@ func (ec *executionContext) field_Query_assetPrices_args(ctx context.Context, ra var arg4 *ent.AssetPriceOrder if tmp, ok := rawArgs["orderBy"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("orderBy")) - arg4, err = ec.unmarshalOAssetPriceOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceOrder(ctx, tmp) + arg4, err = ec.unmarshalOAssetPriceOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceOrder(ctx, tmp) if err != nil { return nil, err } @@ -137,7 +170,7 @@ func (ec *executionContext) field_Query_assetPrices_args(ctx context.Context, ra var arg5 *ent.AssetPriceWhereInput if tmp, ok := rawArgs["where"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("where")) - arg5, err = ec.unmarshalOAssetPriceWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceWhereInput(ctx, tmp) + arg5, err = ec.unmarshalOAssetPriceWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceWhereInput(ctx, tmp) if err != nil { return nil, err } @@ -188,7 +221,7 @@ func (ec *executionContext) field_Query_correctnessReports_args(ctx context.Cont var arg4 *ent.CorrectnessReportOrder if tmp, ok := rawArgs["orderBy"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("orderBy")) - arg4, err = ec.unmarshalOCorrectnessReportOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportOrder(ctx, tmp) + arg4, err = ec.unmarshalOCorrectnessReportOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportOrder(ctx, tmp) if err != nil { return nil, err } @@ -197,7 +230,7 @@ func (ec *executionContext) field_Query_correctnessReports_args(ctx context.Cont var arg5 *ent.CorrectnessReportWhereInput if tmp, ok := rawArgs["where"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("where")) - arg5, err = ec.unmarshalOCorrectnessReportWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportWhereInput(ctx, tmp) + arg5, err = ec.unmarshalOCorrectnessReportWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportWhereInput(ctx, tmp) if err != nil { return nil, err } @@ -248,7 +281,7 @@ func (ec *executionContext) field_Query_eventLogs_args(ctx context.Context, rawA var arg4 *ent.EventLogOrder if tmp, ok := rawArgs["orderBy"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("orderBy")) - arg4, err = ec.unmarshalOEventLogOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogOrder(ctx, tmp) + arg4, err = ec.unmarshalOEventLogOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogOrder(ctx, tmp) if err != nil { return nil, err } @@ -257,7 +290,7 @@ func (ec *executionContext) field_Query_eventLogs_args(ctx context.Context, rawA var arg5 *ent.EventLogWhereInput if tmp, ok := rawArgs["where"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("where")) - arg5, err = ec.unmarshalOEventLogWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogWhereInput(ctx, tmp) + arg5, err = ec.unmarshalOEventLogWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogWhereInput(ctx, tmp) if err != nil { return nil, err } @@ -338,7 +371,7 @@ func (ec *executionContext) field_Query_signers_args(ctx context.Context, rawArg var arg4 *ent.SignerOrder if tmp, ok := rawArgs["orderBy"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("orderBy")) - arg4, err = ec.unmarshalOSignerOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerOrder(ctx, tmp) + arg4, err = ec.unmarshalOSignerOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerOrder(ctx, tmp) if err != nil { return nil, err } @@ -347,7 +380,7 @@ func (ec *executionContext) field_Query_signers_args(ctx context.Context, rawArg var arg5 *ent.SignerWhereInput if tmp, ok := rawArgs["where"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("where")) - arg5, err = ec.unmarshalOSignerWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerWhereInput(ctx, tmp) + arg5, err = ec.unmarshalOSignerWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerWhereInput(ctx, tmp) if err != nil { return nil, err } @@ -565,7 +598,7 @@ func (ec *executionContext) _AssetPrice_signature(ctx context.Context, field gra } res := resTmp.(types.Bytes) fc.Result = res - return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) + return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋtransportᚋserverᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AssetPrice_signature(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -704,6 +737,94 @@ func (ec *executionContext) fieldContext_AssetPrice_pair(ctx context.Context, fi return fc, nil } +func (ec *executionContext) _AssetPrice_consensus(ctx context.Context, field graphql.CollectedField, obj *ent.AssetPrice) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_AssetPrice_consensus(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Consensus, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_AssetPrice_consensus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "AssetPrice", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _AssetPrice_voted(ctx context.Context, field graphql.CollectedField, obj *ent.AssetPrice) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_AssetPrice_voted(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.AssetPrice().Voted(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(uint64) + fc.Result = res + return ec.marshalNUint2uint64(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_AssetPrice_voted(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "AssetPrice", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Uint does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _AssetPrice_signers(ctx context.Context, field graphql.CollectedField, obj *ent.AssetPrice) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AssetPrice_signers(ctx, field) if err != nil { @@ -732,7 +853,7 @@ func (ec *executionContext) _AssetPrice_signers(ctx context.Context, field graph } res := resTmp.([]*ent.Signer) fc.Result = res - return ec.marshalNSigner2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerᚄ(ctx, field.Selections, res) + return ec.marshalNSigner2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AssetPrice_signers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -793,7 +914,7 @@ func (ec *executionContext) _AssetPriceConnection_edges(ctx context.Context, fie } res := resTmp.([]*ent.AssetPriceEdge) fc.Result = res - return ec.marshalOAssetPriceEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceEdge(ctx, field.Selections, res) + return ec.marshalOAssetPriceEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceEdge(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AssetPriceConnection_edges(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -938,7 +1059,7 @@ func (ec *executionContext) _AssetPriceEdge_node(ctx context.Context, field grap } res := resTmp.(*ent.AssetPrice) fc.Result = res - return ec.marshalOAssetPrice2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPrice(ctx, field.Selections, res) + return ec.marshalOAssetPrice2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPrice(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AssetPriceEdge_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -965,6 +1086,10 @@ func (ec *executionContext) fieldContext_AssetPriceEdge_node(ctx context.Context return ec.fieldContext_AssetPrice_chain(ctx, field) case "pair": return ec.fieldContext_AssetPrice_pair(ctx, field) + case "consensus": + return ec.fieldContext_AssetPrice_consensus(ctx, field) + case "voted": + return ec.fieldContext_AssetPrice_voted(ctx, field) case "signers": return ec.fieldContext_AssetPrice_signers(ctx, field) } @@ -1178,7 +1303,7 @@ func (ec *executionContext) _CorrectnessReport_signature(ctx context.Context, fi } res := resTmp.(types.Bytes) fc.Result = res - return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) + return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋtransportᚋserverᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_CorrectnessReport_signature(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -1222,7 +1347,7 @@ func (ec *executionContext) _CorrectnessReport_hash(ctx context.Context, field g } res := resTmp.(types.Bytes) fc.Result = res - return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) + return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋtransportᚋserverᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_CorrectnessReport_hash(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -1266,7 +1391,7 @@ func (ec *executionContext) _CorrectnessReport_topic(ctx context.Context, field } res := resTmp.(types.Bytes) fc.Result = res - return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) + return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋtransportᚋserverᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_CorrectnessReport_topic(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -1326,6 +1451,94 @@ func (ec *executionContext) fieldContext_CorrectnessReport_correct(ctx context.C return fc, nil } +func (ec *executionContext) _CorrectnessReport_consensus(ctx context.Context, field graphql.CollectedField, obj *ent.CorrectnessReport) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CorrectnessReport_consensus(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Consensus, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CorrectnessReport_consensus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CorrectnessReport", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CorrectnessReport_voted(ctx context.Context, field graphql.CollectedField, obj *ent.CorrectnessReport) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CorrectnessReport_voted(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.CorrectnessReport().Voted(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(uint64) + fc.Result = res + return ec.marshalNUint2uint64(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CorrectnessReport_voted(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CorrectnessReport", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Uint does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _CorrectnessReport_signers(ctx context.Context, field graphql.CollectedField, obj *ent.CorrectnessReport) (ret graphql.Marshaler) { fc, err := ec.fieldContext_CorrectnessReport_signers(ctx, field) if err != nil { @@ -1354,7 +1567,7 @@ func (ec *executionContext) _CorrectnessReport_signers(ctx context.Context, fiel } res := resTmp.([]*ent.Signer) fc.Result = res - return ec.marshalNSigner2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerᚄ(ctx, field.Selections, res) + return ec.marshalNSigner2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_CorrectnessReport_signers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -1415,7 +1628,7 @@ func (ec *executionContext) _CorrectnessReportConnection_edges(ctx context.Conte } res := resTmp.([]*ent.CorrectnessReportEdge) fc.Result = res - return ec.marshalOCorrectnessReportEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportEdge(ctx, field.Selections, res) + return ec.marshalOCorrectnessReportEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportEdge(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_CorrectnessReportConnection_edges(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -1560,7 +1773,7 @@ func (ec *executionContext) _CorrectnessReportEdge_node(ctx context.Context, fie } res := resTmp.(*ent.CorrectnessReport) fc.Result = res - return ec.marshalOCorrectnessReport2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReport(ctx, field.Selections, res) + return ec.marshalOCorrectnessReport2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReport(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_CorrectnessReportEdge_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -1585,6 +1798,10 @@ func (ec *executionContext) fieldContext_CorrectnessReportEdge_node(ctx context. return ec.fieldContext_CorrectnessReport_topic(ctx, field) case "correct": return ec.fieldContext_CorrectnessReport_correct(ctx, field) + case "consensus": + return ec.fieldContext_CorrectnessReport_consensus(ctx, field) + case "voted": + return ec.fieldContext_CorrectnessReport_voted(ctx, field) case "signers": return ec.fieldContext_CorrectnessReport_signers(ctx, field) } @@ -1798,7 +2015,7 @@ func (ec *executionContext) _EventLog_signature(ctx context.Context, field graph } res := resTmp.(types.Bytes) fc.Result = res - return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) + return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋtransportᚋserverᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_EventLog_signature(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -2018,7 +2235,7 @@ func (ec *executionContext) _EventLog_transaction(ctx context.Context, field gra } res := resTmp.(types.Bytes) fc.Result = res - return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) + return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋtransportᚋserverᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_EventLog_transaction(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -2062,7 +2279,7 @@ func (ec *executionContext) _EventLog_args(ctx context.Context, field graphql.Co } res := resTmp.([]datasets.EventLogArg) fc.Result = res - return ec.marshalNEventLogArg2ᚕgithub.comᚋKenshiTechᚋunchainedᚋdatasetsᚐEventLogArgᚄ(ctx, field.Selections, res) + return ec.marshalNEventLogArg2ᚕgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋdatasetsᚐEventLogArgᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_EventLog_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -2084,6 +2301,94 @@ func (ec *executionContext) fieldContext_EventLog_args(ctx context.Context, fiel return fc, nil } +func (ec *executionContext) _EventLog_consensus(ctx context.Context, field graphql.CollectedField, obj *ent.EventLog) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_EventLog_consensus(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Consensus, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_EventLog_consensus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EventLog", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _EventLog_voted(ctx context.Context, field graphql.CollectedField, obj *ent.EventLog) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_EventLog_voted(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.EventLog().Voted(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(uint64) + fc.Result = res + return ec.marshalNUint2uint64(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_EventLog_voted(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "EventLog", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Uint does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _EventLog_signers(ctx context.Context, field graphql.CollectedField, obj *ent.EventLog) (ret graphql.Marshaler) { fc, err := ec.fieldContext_EventLog_signers(ctx, field) if err != nil { @@ -2112,7 +2417,7 @@ func (ec *executionContext) _EventLog_signers(ctx context.Context, field graphql } res := resTmp.([]*ent.Signer) fc.Result = res - return ec.marshalNSigner2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerᚄ(ctx, field.Selections, res) + return ec.marshalNSigner2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_EventLog_signers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -2173,7 +2478,7 @@ func (ec *executionContext) _EventLogConnection_edges(ctx context.Context, field } res := resTmp.([]*ent.EventLogEdge) fc.Result = res - return ec.marshalOEventLogEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogEdge(ctx, field.Selections, res) + return ec.marshalOEventLogEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogEdge(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_EventLogConnection_edges(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -2318,7 +2623,7 @@ func (ec *executionContext) _EventLogEdge_node(ctx context.Context, field graphq } res := resTmp.(*ent.EventLog) fc.Result = res - return ec.marshalOEventLog2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLog(ctx, field.Selections, res) + return ec.marshalOEventLog2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLog(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_EventLogEdge_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -2349,6 +2654,10 @@ func (ec *executionContext) fieldContext_EventLogEdge_node(ctx context.Context, return ec.fieldContext_EventLog_transaction(ctx, field) case "args": return ec.fieldContext_EventLog_args(ctx, field) + case "consensus": + return ec.fieldContext_EventLog_consensus(ctx, field) + case "voted": + return ec.fieldContext_EventLog_voted(ctx, field) case "signers": return ec.fieldContext_EventLog_signers(ctx, field) } @@ -2597,7 +2906,7 @@ func (ec *executionContext) _Query_node(ctx context.Context, field graphql.Colle } res := resTmp.(ent.Noder) fc.Result = res - return ec.marshalONode2githubᚗcomᚋKenshiTechᚋunchainedᚋentᚐNoder(ctx, field.Selections, res) + return ec.marshalONode2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋentᚐNoder(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -2652,7 +2961,7 @@ func (ec *executionContext) _Query_nodes(ctx context.Context, field graphql.Coll } res := resTmp.([]ent.Noder) fc.Result = res - return ec.marshalNNode2ᚕgithub.comᚋKenshiTechᚋunchainedᚋentᚐNoder(ctx, field.Selections, res) + return ec.marshalNNode2ᚕgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐNoder(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query_nodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -2707,7 +3016,7 @@ func (ec *executionContext) _Query_assetPrices(ctx context.Context, field graphq } res := resTmp.(*ent.AssetPriceConnection) fc.Result = res - return ec.marshalNAssetPriceConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceConnection(ctx, field.Selections, res) + return ec.marshalNAssetPriceConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceConnection(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query_assetPrices(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -2770,7 +3079,7 @@ func (ec *executionContext) _Query_correctnessReports(ctx context.Context, field } res := resTmp.(*ent.CorrectnessReportConnection) fc.Result = res - return ec.marshalNCorrectnessReportConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportConnection(ctx, field.Selections, res) + return ec.marshalNCorrectnessReportConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportConnection(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query_correctnessReports(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -2833,7 +3142,7 @@ func (ec *executionContext) _Query_eventLogs(ctx context.Context, field graphql. } res := resTmp.(*ent.EventLogConnection) fc.Result = res - return ec.marshalNEventLogConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogConnection(ctx, field.Selections, res) + return ec.marshalNEventLogConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogConnection(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query_eventLogs(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -2896,7 +3205,7 @@ func (ec *executionContext) _Query_signers(ctx context.Context, field graphql.Co } res := resTmp.(*ent.SignerConnection) fc.Result = res - return ec.marshalNSignerConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerConnection(ctx, field.Selections, res) + return ec.marshalNSignerConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerConnection(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query_signers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3217,7 +3526,7 @@ func (ec *executionContext) _Signer_key(ctx context.Context, field graphql.Colle } res := resTmp.(types.Bytes) fc.Result = res - return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) + return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋtransportᚋserverᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Signer_key(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3261,7 +3570,7 @@ func (ec *executionContext) _Signer_shortkey(ctx context.Context, field graphql. } res := resTmp.(types.Bytes) fc.Result = res - return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) + return ec.marshalNBytes2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋtransportᚋserverᚋgqlᚋtypesᚐBytes(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Signer_shortkey(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3346,7 +3655,7 @@ func (ec *executionContext) _Signer_assetprice(ctx context.Context, field graphq } res := resTmp.([]*ent.AssetPrice) fc.Result = res - return ec.marshalOAssetPrice2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceᚄ(ctx, field.Selections, res) + return ec.marshalOAssetPrice2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Signer_assetprice(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3373,6 +3682,10 @@ func (ec *executionContext) fieldContext_Signer_assetprice(ctx context.Context, return ec.fieldContext_AssetPrice_chain(ctx, field) case "pair": return ec.fieldContext_AssetPrice_pair(ctx, field) + case "consensus": + return ec.fieldContext_AssetPrice_consensus(ctx, field) + case "voted": + return ec.fieldContext_AssetPrice_voted(ctx, field) case "signers": return ec.fieldContext_AssetPrice_signers(ctx, field) } @@ -3407,7 +3720,7 @@ func (ec *executionContext) _Signer_eventlogs(ctx context.Context, field graphql } res := resTmp.([]*ent.EventLog) fc.Result = res - return ec.marshalOEventLog2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogᚄ(ctx, field.Selections, res) + return ec.marshalOEventLog2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Signer_eventlogs(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3438,6 +3751,10 @@ func (ec *executionContext) fieldContext_Signer_eventlogs(ctx context.Context, f return ec.fieldContext_EventLog_transaction(ctx, field) case "args": return ec.fieldContext_EventLog_args(ctx, field) + case "consensus": + return ec.fieldContext_EventLog_consensus(ctx, field) + case "voted": + return ec.fieldContext_EventLog_voted(ctx, field) case "signers": return ec.fieldContext_EventLog_signers(ctx, field) } @@ -3472,7 +3789,7 @@ func (ec *executionContext) _Signer_correctnessreport(ctx context.Context, field } res := resTmp.([]*ent.CorrectnessReport) fc.Result = res - return ec.marshalOCorrectnessReport2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportᚄ(ctx, field.Selections, res) + return ec.marshalOCorrectnessReport2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Signer_correctnessreport(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3497,6 +3814,10 @@ func (ec *executionContext) fieldContext_Signer_correctnessreport(ctx context.Co return ec.fieldContext_CorrectnessReport_topic(ctx, field) case "correct": return ec.fieldContext_CorrectnessReport_correct(ctx, field) + case "consensus": + return ec.fieldContext_CorrectnessReport_consensus(ctx, field) + case "voted": + return ec.fieldContext_CorrectnessReport_voted(ctx, field) case "signers": return ec.fieldContext_CorrectnessReport_signers(ctx, field) } @@ -3531,7 +3852,7 @@ func (ec *executionContext) _SignerConnection_edges(ctx context.Context, field g } res := resTmp.([]*ent.SignerEdge) fc.Result = res - return ec.marshalOSignerEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerEdge(ctx, field.Selections, res) + return ec.marshalOSignerEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerEdge(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_SignerConnection_edges(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3676,7 +3997,7 @@ func (ec *executionContext) _SignerEdge_node(ctx context.Context, field graphql. } res := resTmp.(*ent.Signer) fc.Result = res - return ec.marshalOSigner2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSigner(ctx, field.Selections, res) + return ec.marshalOSigner2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSigner(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_SignerEdge_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3787,7 +4108,7 @@ func (ec *executionContext) unmarshalInputAssetPriceOrder(ctx context.Context, o it.Direction = data case "field": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNAssetPriceOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceOrderField(ctx, v) + data, err := ec.unmarshalNAssetPriceOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceOrderField(ctx, v) if err != nil { return it, err } @@ -3805,7 +4126,7 @@ func (ec *executionContext) unmarshalInputAssetPriceWhereInput(ctx context.Conte asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "block", "blockNEQ", "blockIn", "blockNotIn", "blockGT", "blockGTE", "blockLT", "blockLTE", "signerscount", "signerscountNEQ", "signerscountIn", "signerscountNotIn", "signerscountGT", "signerscountGTE", "signerscountLT", "signerscountLTE", "signerscountIsNil", "signerscountNotNil", "price", "priceNEQ", "priceIn", "priceNotIn", "priceGT", "priceGTE", "priceLT", "priceLTE", "asset", "assetNEQ", "assetIn", "assetNotIn", "assetGT", "assetGTE", "assetLT", "assetLTE", "assetContains", "assetHasPrefix", "assetHasSuffix", "assetIsNil", "assetNotNil", "assetEqualFold", "assetContainsFold", "chain", "chainNEQ", "chainIn", "chainNotIn", "chainGT", "chainGTE", "chainLT", "chainLTE", "chainContains", "chainHasPrefix", "chainHasSuffix", "chainIsNil", "chainNotNil", "chainEqualFold", "chainContainsFold", "pair", "pairNEQ", "pairIn", "pairNotIn", "pairGT", "pairGTE", "pairLT", "pairLTE", "pairContains", "pairHasPrefix", "pairHasSuffix", "pairIsNil", "pairNotNil", "pairEqualFold", "pairContainsFold", "hasSigners", "hasSignersWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "block", "blockNEQ", "blockIn", "blockNotIn", "blockGT", "blockGTE", "blockLT", "blockLTE", "signerscount", "signerscountNEQ", "signerscountIn", "signerscountNotIn", "signerscountGT", "signerscountGTE", "signerscountLT", "signerscountLTE", "signerscountIsNil", "signerscountNotNil", "price", "priceNEQ", "priceIn", "priceNotIn", "priceGT", "priceGTE", "priceLT", "priceLTE", "asset", "assetNEQ", "assetIn", "assetNotIn", "assetGT", "assetGTE", "assetLT", "assetLTE", "assetContains", "assetHasPrefix", "assetHasSuffix", "assetIsNil", "assetNotNil", "assetEqualFold", "assetContainsFold", "chain", "chainNEQ", "chainIn", "chainNotIn", "chainGT", "chainGTE", "chainLT", "chainLTE", "chainContains", "chainHasPrefix", "chainHasSuffix", "chainIsNil", "chainNotNil", "chainEqualFold", "chainContainsFold", "pair", "pairNEQ", "pairIn", "pairNotIn", "pairGT", "pairGTE", "pairLT", "pairLTE", "pairContains", "pairHasPrefix", "pairHasSuffix", "pairIsNil", "pairNotNil", "pairEqualFold", "pairContainsFold", "consensus", "consensusNEQ", "voted", "votedNEQ", "votedIn", "votedNotIn", "votedGT", "votedGTE", "votedLT", "votedLTE", "hasSigners", "hasSignersWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -3814,21 +4135,21 @@ func (ec *executionContext) unmarshalInputAssetPriceWhereInput(ctx context.Conte switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOAssetPriceWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceWhereInput(ctx, v) + data, err := ec.unmarshalOAssetPriceWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOAssetPriceWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOAssetPriceWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOAssetPriceWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOAssetPriceWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -4402,20 +4723,106 @@ func (ec *executionContext) unmarshalInputAssetPriceWhereInput(ctx context.Conte return it, err } it.PairContainsFold = data - case "hasSigners": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSigners")) + case "consensus": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("consensus")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasSigners = data - case "hasSignersWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSignersWith")) - data, err := ec.unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerWhereInputᚄ(ctx, v) + it.Consensus = data + case "consensusNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("consensusNEQ")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasSignersWith = data + it.ConsensusNEQ = data + case "voted": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("voted")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.AssetPriceWhereInput().Voted(ctx, &it, data); err != nil { + return it, err + } + case "votedNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedNEQ")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.AssetPriceWhereInput().VotedNeq(ctx, &it, data); err != nil { + return it, err + } + case "votedIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedIn")) + data, err := ec.unmarshalOUint2ᚕuint64ᚄ(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.AssetPriceWhereInput().VotedIn(ctx, &it, data); err != nil { + return it, err + } + case "votedNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedNotIn")) + data, err := ec.unmarshalOUint2ᚕuint64ᚄ(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.AssetPriceWhereInput().VotedNotIn(ctx, &it, data); err != nil { + return it, err + } + case "votedGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedGT")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.AssetPriceWhereInput().VotedGt(ctx, &it, data); err != nil { + return it, err + } + case "votedGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedGTE")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.AssetPriceWhereInput().VotedGte(ctx, &it, data); err != nil { + return it, err + } + case "votedLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedLT")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.AssetPriceWhereInput().VotedLt(ctx, &it, data); err != nil { + return it, err + } + case "votedLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedLTE")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.AssetPriceWhereInput().VotedLte(ctx, &it, data); err != nil { + return it, err + } + case "hasSigners": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSigners")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasSigners = data + case "hasSignersWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSignersWith")) + data, err := ec.unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasSignersWith = data } } @@ -4449,7 +4856,7 @@ func (ec *executionContext) unmarshalInputCorrectnessReportOrder(ctx context.Con it.Direction = data case "field": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNCorrectnessReportOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportOrderField(ctx, v) + data, err := ec.unmarshalNCorrectnessReportOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportOrderField(ctx, v) if err != nil { return it, err } @@ -4467,7 +4874,7 @@ func (ec *executionContext) unmarshalInputCorrectnessReportWhereInput(ctx contex asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "signerscount", "signerscountNEQ", "signerscountIn", "signerscountNotIn", "signerscountGT", "signerscountGTE", "signerscountLT", "signerscountLTE", "timestamp", "timestampNEQ", "timestampIn", "timestampNotIn", "timestampGT", "timestampGTE", "timestampLT", "timestampLTE", "correct", "correctNEQ", "hasSigners", "hasSignersWith", "topic", "hash"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "signerscount", "signerscountNEQ", "signerscountIn", "signerscountNotIn", "signerscountGT", "signerscountGTE", "signerscountLT", "signerscountLTE", "timestamp", "timestampNEQ", "timestampIn", "timestampNotIn", "timestampGT", "timestampGTE", "timestampLT", "timestampLTE", "correct", "correctNEQ", "consensus", "consensusNEQ", "voted", "votedNEQ", "votedIn", "votedNotIn", "votedGT", "votedGTE", "votedLT", "votedLTE", "hasSigners", "hasSignersWith", "topic", "hash"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -4476,21 +4883,21 @@ func (ec *executionContext) unmarshalInputCorrectnessReportWhereInput(ctx contex switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOCorrectnessReportWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportWhereInput(ctx, v) + data, err := ec.unmarshalOCorrectnessReportWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOCorrectnessReportWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOCorrectnessReportWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOCorrectnessReportWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOCorrectnessReportWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -4677,6 +5084,92 @@ func (ec *executionContext) unmarshalInputCorrectnessReportWhereInput(ctx contex return it, err } it.CorrectNEQ = data + case "consensus": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("consensus")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Consensus = data + case "consensusNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("consensusNEQ")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.ConsensusNEQ = data + case "voted": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("voted")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.CorrectnessReportWhereInput().Voted(ctx, &it, data); err != nil { + return it, err + } + case "votedNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedNEQ")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.CorrectnessReportWhereInput().VotedNeq(ctx, &it, data); err != nil { + return it, err + } + case "votedIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedIn")) + data, err := ec.unmarshalOUint2ᚕuint64ᚄ(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.CorrectnessReportWhereInput().VotedIn(ctx, &it, data); err != nil { + return it, err + } + case "votedNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedNotIn")) + data, err := ec.unmarshalOUint2ᚕuint64ᚄ(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.CorrectnessReportWhereInput().VotedNotIn(ctx, &it, data); err != nil { + return it, err + } + case "votedGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedGT")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.CorrectnessReportWhereInput().VotedGt(ctx, &it, data); err != nil { + return it, err + } + case "votedGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedGTE")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.CorrectnessReportWhereInput().VotedGte(ctx, &it, data); err != nil { + return it, err + } + case "votedLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedLT")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.CorrectnessReportWhereInput().VotedLt(ctx, &it, data); err != nil { + return it, err + } + case "votedLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedLTE")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.CorrectnessReportWhereInput().VotedLte(ctx, &it, data); err != nil { + return it, err + } case "hasSigners": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSigners")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) @@ -4686,7 +5179,7 @@ func (ec *executionContext) unmarshalInputCorrectnessReportWhereInput(ctx contex it.HasSigners = data case "hasSignersWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSignersWith")) - data, err := ec.unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -4742,7 +5235,7 @@ func (ec *executionContext) unmarshalInputEventLogOrder(ctx context.Context, obj it.Direction = data case "field": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNEventLogOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogOrderField(ctx, v) + data, err := ec.unmarshalNEventLogOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogOrderField(ctx, v) if err != nil { return it, err } @@ -4760,7 +5253,7 @@ func (ec *executionContext) unmarshalInputEventLogWhereInput(ctx context.Context asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "block", "blockNEQ", "blockIn", "blockNotIn", "blockGT", "blockGTE", "blockLT", "blockLTE", "signerscount", "signerscountNEQ", "signerscountIn", "signerscountNotIn", "signerscountGT", "signerscountGTE", "signerscountLT", "signerscountLTE", "address", "addressNEQ", "addressIn", "addressNotIn", "addressGT", "addressGTE", "addressLT", "addressLTE", "addressContains", "addressHasPrefix", "addressHasSuffix", "addressEqualFold", "addressContainsFold", "chain", "chainNEQ", "chainIn", "chainNotIn", "chainGT", "chainGTE", "chainLT", "chainLTE", "chainContains", "chainHasPrefix", "chainHasSuffix", "chainEqualFold", "chainContainsFold", "index", "indexNEQ", "indexIn", "indexNotIn", "indexGT", "indexGTE", "indexLT", "indexLTE", "event", "eventNEQ", "eventIn", "eventNotIn", "eventGT", "eventGTE", "eventLT", "eventLTE", "eventContains", "eventHasPrefix", "eventHasSuffix", "eventEqualFold", "eventContainsFold", "hasSigners", "hasSignersWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "block", "blockNEQ", "blockIn", "blockNotIn", "blockGT", "blockGTE", "blockLT", "blockLTE", "signerscount", "signerscountNEQ", "signerscountIn", "signerscountNotIn", "signerscountGT", "signerscountGTE", "signerscountLT", "signerscountLTE", "address", "addressNEQ", "addressIn", "addressNotIn", "addressGT", "addressGTE", "addressLT", "addressLTE", "addressContains", "addressHasPrefix", "addressHasSuffix", "addressEqualFold", "addressContainsFold", "chain", "chainNEQ", "chainIn", "chainNotIn", "chainGT", "chainGTE", "chainLT", "chainLTE", "chainContains", "chainHasPrefix", "chainHasSuffix", "chainEqualFold", "chainContainsFold", "index", "indexNEQ", "indexIn", "indexNotIn", "indexGT", "indexGTE", "indexLT", "indexLTE", "event", "eventNEQ", "eventIn", "eventNotIn", "eventGT", "eventGTE", "eventLT", "eventLTE", "eventContains", "eventHasPrefix", "eventHasSuffix", "eventEqualFold", "eventContainsFold", "consensus", "consensusNEQ", "voted", "votedNEQ", "votedIn", "votedNotIn", "votedGT", "votedGTE", "votedLT", "votedLTE", "hasSigners", "hasSignersWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -4769,21 +5262,21 @@ func (ec *executionContext) unmarshalInputEventLogWhereInput(ctx context.Context switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOEventLogWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogWhereInput(ctx, v) + data, err := ec.unmarshalOEventLogWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOEventLogWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOEventLogWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOEventLogWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOEventLogWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -5285,6 +5778,92 @@ func (ec *executionContext) unmarshalInputEventLogWhereInput(ctx context.Context return it, err } it.EventContainsFold = data + case "consensus": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("consensus")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Consensus = data + case "consensusNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("consensusNEQ")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.ConsensusNEQ = data + case "voted": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("voted")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.EventLogWhereInput().Voted(ctx, &it, data); err != nil { + return it, err + } + case "votedNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedNEQ")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.EventLogWhereInput().VotedNeq(ctx, &it, data); err != nil { + return it, err + } + case "votedIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedIn")) + data, err := ec.unmarshalOUint2ᚕuint64ᚄ(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.EventLogWhereInput().VotedIn(ctx, &it, data); err != nil { + return it, err + } + case "votedNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedNotIn")) + data, err := ec.unmarshalOUint2ᚕuint64ᚄ(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.EventLogWhereInput().VotedNotIn(ctx, &it, data); err != nil { + return it, err + } + case "votedGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedGT")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.EventLogWhereInput().VotedGt(ctx, &it, data); err != nil { + return it, err + } + case "votedGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedGTE")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.EventLogWhereInput().VotedGte(ctx, &it, data); err != nil { + return it, err + } + case "votedLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedLT")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.EventLogWhereInput().VotedLt(ctx, &it, data); err != nil { + return it, err + } + case "votedLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("votedLTE")) + data, err := ec.unmarshalOUint2ᚖuint64(ctx, v) + if err != nil { + return it, err + } + if err = ec.resolvers.EventLogWhereInput().VotedLte(ctx, &it, data); err != nil { + return it, err + } case "hasSigners": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSigners")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) @@ -5294,7 +5873,7 @@ func (ec *executionContext) unmarshalInputEventLogWhereInput(ctx context.Context it.HasSigners = data case "hasSignersWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSignersWith")) - data, err := ec.unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -5332,7 +5911,7 @@ func (ec *executionContext) unmarshalInputSignerOrder(ctx context.Context, obj i it.Direction = data case "field": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNSignerOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerOrderField(ctx, v) + data, err := ec.unmarshalNSignerOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerOrderField(ctx, v) if err != nil { return it, err } @@ -5359,21 +5938,21 @@ func (ec *executionContext) unmarshalInputSignerWhereInput(ctx context.Context, switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) - data, err := ec.unmarshalOSignerWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerWhereInput(ctx, v) + data, err := ec.unmarshalOSignerWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) - data, err := ec.unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) - data, err := ec.unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -5695,7 +6274,7 @@ func (ec *executionContext) unmarshalInputSignerWhereInput(ctx context.Context, it.HasAssetPrice = data case "hasAssetPriceWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAssetPriceWith")) - data, err := ec.unmarshalOAssetPriceWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOAssetPriceWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -5709,7 +6288,7 @@ func (ec *executionContext) unmarshalInputSignerWhereInput(ctx context.Context, it.HasEventLogs = data case "hasEventLogsWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasEventLogsWith")) - data, err := ec.unmarshalOEventLogWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOEventLogWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -5723,7 +6302,7 @@ func (ec *executionContext) unmarshalInputSignerWhereInput(ctx context.Context, it.HasCorrectnessReport = data case "hasCorrectnessReportWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCorrectnessReportWith")) - data, err := ec.unmarshalOCorrectnessReportWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportWhereInputᚄ(ctx, v) + data, err := ec.unmarshalOCorrectnessReportWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportWhereInputᚄ(ctx, v) if err != nil { return it, err } @@ -5881,6 +6460,47 @@ func (ec *executionContext) _AssetPrice(ctx context.Context, sel ast.SelectionSe out.Values[i] = ec._AssetPrice_chain(ctx, field, obj) case "pair": out.Values[i] = ec._AssetPrice_pair(ctx, field, obj) + case "consensus": + out.Values[i] = ec._AssetPrice_consensus(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "voted": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._AssetPrice_voted(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "signers": field := field @@ -6166,6 +6786,47 @@ func (ec *executionContext) _CorrectnessReport(ctx context.Context, sel ast.Sele if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } + case "consensus": + out.Values[i] = ec._CorrectnessReport_consensus(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "voted": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._CorrectnessReport_voted(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "signers": field := field @@ -6435,6 +7096,47 @@ func (ec *executionContext) _EventLog(ctx context.Context, sel ast.SelectionSet, if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } + case "consensus": + out.Values[i] = ec._EventLog_consensus(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "voted": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._EventLog_voted(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "signers": field := field @@ -7121,7 +7823,7 @@ func (ec *executionContext) _SignerEdge(ctx context.Context, sel ast.SelectionSe // region ***************************** type.gotpl ***************************** -func (ec *executionContext) marshalNAssetPrice2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPrice(ctx context.Context, sel ast.SelectionSet, v *ent.AssetPrice) graphql.Marshaler { +func (ec *executionContext) marshalNAssetPrice2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPrice(ctx context.Context, sel ast.SelectionSet, v *ent.AssetPrice) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -7131,11 +7833,11 @@ func (ec *executionContext) marshalNAssetPrice2ᚖgithub.comᚋKenshiTechᚋun return ec._AssetPrice(ctx, sel, v) } -func (ec *executionContext) marshalNAssetPriceConnection2githubᚗcomᚋKenshiTechᚋunchainedᚋentᚐAssetPriceConnection(ctx context.Context, sel ast.SelectionSet, v ent.AssetPriceConnection) graphql.Marshaler { +func (ec *executionContext) marshalNAssetPriceConnection2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceConnection(ctx context.Context, sel ast.SelectionSet, v ent.AssetPriceConnection) graphql.Marshaler { return ec._AssetPriceConnection(ctx, sel, &v) } -func (ec *executionContext) marshalNAssetPriceConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceConnection(ctx context.Context, sel ast.SelectionSet, v *ent.AssetPriceConnection) graphql.Marshaler { +func (ec *executionContext) marshalNAssetPriceConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceConnection(ctx context.Context, sel ast.SelectionSet, v *ent.AssetPriceConnection) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -7145,13 +7847,13 @@ func (ec *executionContext) marshalNAssetPriceConnection2ᚖgithub.comᚋKensh return ec._AssetPriceConnection(ctx, sel, v) } -func (ec *executionContext) unmarshalNAssetPriceOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceOrderField(ctx context.Context, v interface{}) (*ent.AssetPriceOrderField, error) { +func (ec *executionContext) unmarshalNAssetPriceOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceOrderField(ctx context.Context, v interface{}) (*ent.AssetPriceOrderField, error) { var res = new(ent.AssetPriceOrderField) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNAssetPriceOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.AssetPriceOrderField) graphql.Marshaler { +func (ec *executionContext) marshalNAssetPriceOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.AssetPriceOrderField) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -7161,12 +7863,12 @@ func (ec *executionContext) marshalNAssetPriceOrderField2ᚖgithub.comᚋKensh return v } -func (ec *executionContext) unmarshalNAssetPriceWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceWhereInput(ctx context.Context, v interface{}) (*ent.AssetPriceWhereInput, error) { +func (ec *executionContext) unmarshalNAssetPriceWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceWhereInput(ctx context.Context, v interface{}) (*ent.AssetPriceWhereInput, error) { res, err := ec.unmarshalInputAssetPriceWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNCorrectnessReport2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReport(ctx context.Context, sel ast.SelectionSet, v *ent.CorrectnessReport) graphql.Marshaler { +func (ec *executionContext) marshalNCorrectnessReport2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReport(ctx context.Context, sel ast.SelectionSet, v *ent.CorrectnessReport) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -7176,11 +7878,11 @@ func (ec *executionContext) marshalNCorrectnessReport2ᚖgithub.comᚋKenshiTe return ec._CorrectnessReport(ctx, sel, v) } -func (ec *executionContext) marshalNCorrectnessReportConnection2githubᚗcomᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportConnection(ctx context.Context, sel ast.SelectionSet, v ent.CorrectnessReportConnection) graphql.Marshaler { +func (ec *executionContext) marshalNCorrectnessReportConnection2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportConnection(ctx context.Context, sel ast.SelectionSet, v ent.CorrectnessReportConnection) graphql.Marshaler { return ec._CorrectnessReportConnection(ctx, sel, &v) } -func (ec *executionContext) marshalNCorrectnessReportConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportConnection(ctx context.Context, sel ast.SelectionSet, v *ent.CorrectnessReportConnection) graphql.Marshaler { +func (ec *executionContext) marshalNCorrectnessReportConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportConnection(ctx context.Context, sel ast.SelectionSet, v *ent.CorrectnessReportConnection) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -7190,13 +7892,13 @@ func (ec *executionContext) marshalNCorrectnessReportConnection2ᚖgithub.com return ec._CorrectnessReportConnection(ctx, sel, v) } -func (ec *executionContext) unmarshalNCorrectnessReportOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportOrderField(ctx context.Context, v interface{}) (*ent.CorrectnessReportOrderField, error) { +func (ec *executionContext) unmarshalNCorrectnessReportOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportOrderField(ctx context.Context, v interface{}) (*ent.CorrectnessReportOrderField, error) { var res = new(ent.CorrectnessReportOrderField) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNCorrectnessReportOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.CorrectnessReportOrderField) graphql.Marshaler { +func (ec *executionContext) marshalNCorrectnessReportOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.CorrectnessReportOrderField) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -7206,7 +7908,7 @@ func (ec *executionContext) marshalNCorrectnessReportOrderField2ᚖgithub.com return v } -func (ec *executionContext) unmarshalNCorrectnessReportWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportWhereInput(ctx context.Context, v interface{}) (*ent.CorrectnessReportWhereInput, error) { +func (ec *executionContext) unmarshalNCorrectnessReportWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportWhereInput(ctx context.Context, v interface{}) (*ent.CorrectnessReportWhereInput, error) { res, err := ec.unmarshalInputCorrectnessReportWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } @@ -7221,7 +7923,7 @@ func (ec *executionContext) marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCurso return v } -func (ec *executionContext) marshalNEventLog2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLog(ctx context.Context, sel ast.SelectionSet, v *ent.EventLog) graphql.Marshaler { +func (ec *executionContext) marshalNEventLog2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLog(ctx context.Context, sel ast.SelectionSet, v *ent.EventLog) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -7231,11 +7933,11 @@ func (ec *executionContext) marshalNEventLog2ᚖgithub.comᚋKenshiTechᚋunch return ec._EventLog(ctx, sel, v) } -func (ec *executionContext) marshalNEventLogConnection2githubᚗcomᚋKenshiTechᚋunchainedᚋentᚐEventLogConnection(ctx context.Context, sel ast.SelectionSet, v ent.EventLogConnection) graphql.Marshaler { +func (ec *executionContext) marshalNEventLogConnection2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogConnection(ctx context.Context, sel ast.SelectionSet, v ent.EventLogConnection) graphql.Marshaler { return ec._EventLogConnection(ctx, sel, &v) } -func (ec *executionContext) marshalNEventLogConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogConnection(ctx context.Context, sel ast.SelectionSet, v *ent.EventLogConnection) graphql.Marshaler { +func (ec *executionContext) marshalNEventLogConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogConnection(ctx context.Context, sel ast.SelectionSet, v *ent.EventLogConnection) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -7245,13 +7947,13 @@ func (ec *executionContext) marshalNEventLogConnection2ᚖgithub.comᚋKenshiT return ec._EventLogConnection(ctx, sel, v) } -func (ec *executionContext) unmarshalNEventLogOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogOrderField(ctx context.Context, v interface{}) (*ent.EventLogOrderField, error) { +func (ec *executionContext) unmarshalNEventLogOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogOrderField(ctx context.Context, v interface{}) (*ent.EventLogOrderField, error) { var res = new(ent.EventLogOrderField) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNEventLogOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.EventLogOrderField) graphql.Marshaler { +func (ec *executionContext) marshalNEventLogOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.EventLogOrderField) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -7261,12 +7963,12 @@ func (ec *executionContext) marshalNEventLogOrderField2ᚖgithub.comᚋKenshiT return v } -func (ec *executionContext) unmarshalNEventLogWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogWhereInput(ctx context.Context, v interface{}) (*ent.EventLogWhereInput, error) { +func (ec *executionContext) unmarshalNEventLogWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogWhereInput(ctx context.Context, v interface{}) (*ent.EventLogWhereInput, error) { res, err := ec.unmarshalInputEventLogWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNNode2ᚕgithub.comᚋKenshiTechᚋunchainedᚋentᚐNoder(ctx context.Context, sel ast.SelectionSet, v []ent.Noder) graphql.Marshaler { +func (ec *executionContext) marshalNNode2ᚕgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐNoder(ctx context.Context, sel ast.SelectionSet, v []ent.Noder) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 @@ -7290,7 +7992,7 @@ func (ec *executionContext) marshalNNode2ᚕgithub.comᚋKenshiTechᚋunchaine if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalONode2githubᚗcomᚋKenshiTechᚋunchainedᚋentᚐNoder(ctx, sel, v[i]) + ret[i] = ec.marshalONode2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋentᚐNoder(ctx, sel, v[i]) } if isLen1 { f(i) @@ -7318,7 +8020,7 @@ func (ec *executionContext) marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPag return ec._PageInfo(ctx, sel, &v) } -func (ec *executionContext) marshalNSigner2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Signer) graphql.Marshaler { +func (ec *executionContext) marshalNSigner2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Signer) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 @@ -7342,7 +8044,7 @@ func (ec *executionContext) marshalNSigner2ᚕᚖgithub.comᚋKenshiTechᚋunc if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalNSigner2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSigner(ctx, sel, v[i]) + ret[i] = ec.marshalNSigner2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSigner(ctx, sel, v[i]) } if isLen1 { f(i) @@ -7362,7 +8064,7 @@ func (ec *executionContext) marshalNSigner2ᚕᚖgithub.comᚋKenshiTechᚋunc return ret } -func (ec *executionContext) marshalNSigner2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSigner(ctx context.Context, sel ast.SelectionSet, v *ent.Signer) graphql.Marshaler { +func (ec *executionContext) marshalNSigner2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSigner(ctx context.Context, sel ast.SelectionSet, v *ent.Signer) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -7372,11 +8074,11 @@ func (ec *executionContext) marshalNSigner2ᚖgithub.comᚋKenshiTechᚋunchai return ec._Signer(ctx, sel, v) } -func (ec *executionContext) marshalNSignerConnection2githubᚗcomᚋKenshiTechᚋunchainedᚋentᚐSignerConnection(ctx context.Context, sel ast.SelectionSet, v ent.SignerConnection) graphql.Marshaler { +func (ec *executionContext) marshalNSignerConnection2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerConnection(ctx context.Context, sel ast.SelectionSet, v ent.SignerConnection) graphql.Marshaler { return ec._SignerConnection(ctx, sel, &v) } -func (ec *executionContext) marshalNSignerConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerConnection(ctx context.Context, sel ast.SelectionSet, v *ent.SignerConnection) graphql.Marshaler { +func (ec *executionContext) marshalNSignerConnection2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerConnection(ctx context.Context, sel ast.SelectionSet, v *ent.SignerConnection) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -7386,13 +8088,13 @@ func (ec *executionContext) marshalNSignerConnection2ᚖgithub.comᚋKenshiTec return ec._SignerConnection(ctx, sel, v) } -func (ec *executionContext) unmarshalNSignerOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerOrderField(ctx context.Context, v interface{}) (*ent.SignerOrderField, error) { +func (ec *executionContext) unmarshalNSignerOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerOrderField(ctx context.Context, v interface{}) (*ent.SignerOrderField, error) { var res = new(ent.SignerOrderField) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNSignerOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.SignerOrderField) graphql.Marshaler { +func (ec *executionContext) marshalNSignerOrderField2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.SignerOrderField) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") @@ -7402,7 +8104,7 @@ func (ec *executionContext) marshalNSignerOrderField2ᚖgithub.comᚋKenshiTec return v } -func (ec *executionContext) unmarshalNSignerWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerWhereInput(ctx context.Context, v interface{}) (*ent.SignerWhereInput, error) { +func (ec *executionContext) unmarshalNSignerWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerWhereInput(ctx context.Context, v interface{}) (*ent.SignerWhereInput, error) { res, err := ec.unmarshalInputSignerWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } @@ -7422,7 +8124,7 @@ func (ec *executionContext) marshalNUint2uint64(ctx context.Context, sel ast.Sel return res } -func (ec *executionContext) marshalOAssetPrice2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.AssetPrice) graphql.Marshaler { +func (ec *executionContext) marshalOAssetPrice2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.AssetPrice) graphql.Marshaler { if v == nil { return graphql.Null } @@ -7449,7 +8151,7 @@ func (ec *executionContext) marshalOAssetPrice2ᚕᚖgithub.comᚋKenshiTech if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalNAssetPrice2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPrice(ctx, sel, v[i]) + ret[i] = ec.marshalNAssetPrice2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPrice(ctx, sel, v[i]) } if isLen1 { f(i) @@ -7469,14 +8171,14 @@ func (ec *executionContext) marshalOAssetPrice2ᚕᚖgithub.comᚋKenshiTech return ret } -func (ec *executionContext) marshalOAssetPrice2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPrice(ctx context.Context, sel ast.SelectionSet, v *ent.AssetPrice) graphql.Marshaler { +func (ec *executionContext) marshalOAssetPrice2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPrice(ctx context.Context, sel ast.SelectionSet, v *ent.AssetPrice) graphql.Marshaler { if v == nil { return graphql.Null } return ec._AssetPrice(ctx, sel, v) } -func (ec *executionContext) marshalOAssetPriceEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.AssetPriceEdge) graphql.Marshaler { +func (ec *executionContext) marshalOAssetPriceEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.AssetPriceEdge) graphql.Marshaler { if v == nil { return graphql.Null } @@ -7503,7 +8205,7 @@ func (ec *executionContext) marshalOAssetPriceEdge2ᚕᚖgithub.comᚋKenshiTe if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalOAssetPriceEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceEdge(ctx, sel, v[i]) + ret[i] = ec.marshalOAssetPriceEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceEdge(ctx, sel, v[i]) } if isLen1 { f(i) @@ -7517,14 +8219,14 @@ func (ec *executionContext) marshalOAssetPriceEdge2ᚕᚖgithub.comᚋKenshiTe return ret } -func (ec *executionContext) marshalOAssetPriceEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceEdge(ctx context.Context, sel ast.SelectionSet, v *ent.AssetPriceEdge) graphql.Marshaler { +func (ec *executionContext) marshalOAssetPriceEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceEdge(ctx context.Context, sel ast.SelectionSet, v *ent.AssetPriceEdge) graphql.Marshaler { if v == nil { return graphql.Null } return ec._AssetPriceEdge(ctx, sel, v) } -func (ec *executionContext) unmarshalOAssetPriceOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceOrder(ctx context.Context, v interface{}) (*ent.AssetPriceOrder, error) { +func (ec *executionContext) unmarshalOAssetPriceOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceOrder(ctx context.Context, v interface{}) (*ent.AssetPriceOrder, error) { if v == nil { return nil, nil } @@ -7532,7 +8234,7 @@ func (ec *executionContext) unmarshalOAssetPriceOrder2ᚖgithub.comᚋKenshiTe return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalOAssetPriceWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceWhereInputᚄ(ctx context.Context, v interface{}) ([]*ent.AssetPriceWhereInput, error) { +func (ec *executionContext) unmarshalOAssetPriceWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceWhereInputᚄ(ctx context.Context, v interface{}) ([]*ent.AssetPriceWhereInput, error) { if v == nil { return nil, nil } @@ -7544,7 +8246,7 @@ func (ec *executionContext) unmarshalOAssetPriceWhereInput2ᚕᚖgithub.comᚋ res := make([]*ent.AssetPriceWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNAssetPriceWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceWhereInput(ctx, vSlice[i]) + res[i], err = ec.unmarshalNAssetPriceWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } @@ -7552,7 +8254,7 @@ func (ec *executionContext) unmarshalOAssetPriceWhereInput2ᚕᚖgithub.comᚋ return res, nil } -func (ec *executionContext) unmarshalOAssetPriceWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐAssetPriceWhereInput(ctx context.Context, v interface{}) (*ent.AssetPriceWhereInput, error) { +func (ec *executionContext) unmarshalOAssetPriceWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐAssetPriceWhereInput(ctx context.Context, v interface{}) (*ent.AssetPriceWhereInput, error) { if v == nil { return nil, nil } @@ -7560,7 +8262,7 @@ func (ec *executionContext) unmarshalOAssetPriceWhereInput2ᚖgithub.comᚋKen return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOCorrectnessReport2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.CorrectnessReport) graphql.Marshaler { +func (ec *executionContext) marshalOCorrectnessReport2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.CorrectnessReport) graphql.Marshaler { if v == nil { return graphql.Null } @@ -7587,7 +8289,7 @@ func (ec *executionContext) marshalOCorrectnessReport2ᚕᚖgithub.comᚋKensh if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalNCorrectnessReport2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReport(ctx, sel, v[i]) + ret[i] = ec.marshalNCorrectnessReport2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReport(ctx, sel, v[i]) } if isLen1 { f(i) @@ -7607,14 +8309,14 @@ func (ec *executionContext) marshalOCorrectnessReport2ᚕᚖgithub.comᚋKensh return ret } -func (ec *executionContext) marshalOCorrectnessReport2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReport(ctx context.Context, sel ast.SelectionSet, v *ent.CorrectnessReport) graphql.Marshaler { +func (ec *executionContext) marshalOCorrectnessReport2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReport(ctx context.Context, sel ast.SelectionSet, v *ent.CorrectnessReport) graphql.Marshaler { if v == nil { return graphql.Null } return ec._CorrectnessReport(ctx, sel, v) } -func (ec *executionContext) marshalOCorrectnessReportEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.CorrectnessReportEdge) graphql.Marshaler { +func (ec *executionContext) marshalOCorrectnessReportEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.CorrectnessReportEdge) graphql.Marshaler { if v == nil { return graphql.Null } @@ -7641,7 +8343,7 @@ func (ec *executionContext) marshalOCorrectnessReportEdge2ᚕᚖgithub.comᚋK if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalOCorrectnessReportEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportEdge(ctx, sel, v[i]) + ret[i] = ec.marshalOCorrectnessReportEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportEdge(ctx, sel, v[i]) } if isLen1 { f(i) @@ -7655,14 +8357,14 @@ func (ec *executionContext) marshalOCorrectnessReportEdge2ᚕᚖgithub.comᚋK return ret } -func (ec *executionContext) marshalOCorrectnessReportEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportEdge(ctx context.Context, sel ast.SelectionSet, v *ent.CorrectnessReportEdge) graphql.Marshaler { +func (ec *executionContext) marshalOCorrectnessReportEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportEdge(ctx context.Context, sel ast.SelectionSet, v *ent.CorrectnessReportEdge) graphql.Marshaler { if v == nil { return graphql.Null } return ec._CorrectnessReportEdge(ctx, sel, v) } -func (ec *executionContext) unmarshalOCorrectnessReportOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportOrder(ctx context.Context, v interface{}) (*ent.CorrectnessReportOrder, error) { +func (ec *executionContext) unmarshalOCorrectnessReportOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportOrder(ctx context.Context, v interface{}) (*ent.CorrectnessReportOrder, error) { if v == nil { return nil, nil } @@ -7670,7 +8372,7 @@ func (ec *executionContext) unmarshalOCorrectnessReportOrder2ᚖgithub.comᚋK return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalOCorrectnessReportWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportWhereInputᚄ(ctx context.Context, v interface{}) ([]*ent.CorrectnessReportWhereInput, error) { +func (ec *executionContext) unmarshalOCorrectnessReportWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportWhereInputᚄ(ctx context.Context, v interface{}) ([]*ent.CorrectnessReportWhereInput, error) { if v == nil { return nil, nil } @@ -7682,7 +8384,7 @@ func (ec *executionContext) unmarshalOCorrectnessReportWhereInput2ᚕᚖgithub res := make([]*ent.CorrectnessReportWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNCorrectnessReportWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportWhereInput(ctx, vSlice[i]) + res[i], err = ec.unmarshalNCorrectnessReportWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } @@ -7690,7 +8392,7 @@ func (ec *executionContext) unmarshalOCorrectnessReportWhereInput2ᚕᚖgithub return res, nil } -func (ec *executionContext) unmarshalOCorrectnessReportWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐCorrectnessReportWhereInput(ctx context.Context, v interface{}) (*ent.CorrectnessReportWhereInput, error) { +func (ec *executionContext) unmarshalOCorrectnessReportWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐCorrectnessReportWhereInput(ctx context.Context, v interface{}) (*ent.CorrectnessReportWhereInput, error) { if v == nil { return nil, nil } @@ -7714,7 +8416,7 @@ func (ec *executionContext) marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCu return v } -func (ec *executionContext) marshalOEventLog2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.EventLog) graphql.Marshaler { +func (ec *executionContext) marshalOEventLog2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.EventLog) graphql.Marshaler { if v == nil { return graphql.Null } @@ -7741,7 +8443,7 @@ func (ec *executionContext) marshalOEventLog2ᚕᚖgithub.comᚋKenshiTechᚋu if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalNEventLog2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLog(ctx, sel, v[i]) + ret[i] = ec.marshalNEventLog2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLog(ctx, sel, v[i]) } if isLen1 { f(i) @@ -7761,14 +8463,14 @@ func (ec *executionContext) marshalOEventLog2ᚕᚖgithub.comᚋKenshiTechᚋu return ret } -func (ec *executionContext) marshalOEventLog2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLog(ctx context.Context, sel ast.SelectionSet, v *ent.EventLog) graphql.Marshaler { +func (ec *executionContext) marshalOEventLog2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLog(ctx context.Context, sel ast.SelectionSet, v *ent.EventLog) graphql.Marshaler { if v == nil { return graphql.Null } return ec._EventLog(ctx, sel, v) } -func (ec *executionContext) marshalOEventLogEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.EventLogEdge) graphql.Marshaler { +func (ec *executionContext) marshalOEventLogEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.EventLogEdge) graphql.Marshaler { if v == nil { return graphql.Null } @@ -7795,7 +8497,7 @@ func (ec *executionContext) marshalOEventLogEdge2ᚕᚖgithub.comᚋKenshiTech if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalOEventLogEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogEdge(ctx, sel, v[i]) + ret[i] = ec.marshalOEventLogEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogEdge(ctx, sel, v[i]) } if isLen1 { f(i) @@ -7809,14 +8511,14 @@ func (ec *executionContext) marshalOEventLogEdge2ᚕᚖgithub.comᚋKenshiTech return ret } -func (ec *executionContext) marshalOEventLogEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogEdge(ctx context.Context, sel ast.SelectionSet, v *ent.EventLogEdge) graphql.Marshaler { +func (ec *executionContext) marshalOEventLogEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogEdge(ctx context.Context, sel ast.SelectionSet, v *ent.EventLogEdge) graphql.Marshaler { if v == nil { return graphql.Null } return ec._EventLogEdge(ctx, sel, v) } -func (ec *executionContext) unmarshalOEventLogOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogOrder(ctx context.Context, v interface{}) (*ent.EventLogOrder, error) { +func (ec *executionContext) unmarshalOEventLogOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogOrder(ctx context.Context, v interface{}) (*ent.EventLogOrder, error) { if v == nil { return nil, nil } @@ -7824,7 +8526,7 @@ func (ec *executionContext) unmarshalOEventLogOrder2ᚖgithub.comᚋKenshiTech return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalOEventLogWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogWhereInputᚄ(ctx context.Context, v interface{}) ([]*ent.EventLogWhereInput, error) { +func (ec *executionContext) unmarshalOEventLogWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogWhereInputᚄ(ctx context.Context, v interface{}) ([]*ent.EventLogWhereInput, error) { if v == nil { return nil, nil } @@ -7836,7 +8538,7 @@ func (ec *executionContext) unmarshalOEventLogWhereInput2ᚕᚖgithub.comᚋKe res := make([]*ent.EventLogWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNEventLogWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogWhereInput(ctx, vSlice[i]) + res[i], err = ec.unmarshalNEventLogWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } @@ -7844,7 +8546,7 @@ func (ec *executionContext) unmarshalOEventLogWhereInput2ᚕᚖgithub.comᚋKe return res, nil } -func (ec *executionContext) unmarshalOEventLogWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐEventLogWhereInput(ctx context.Context, v interface{}) (*ent.EventLogWhereInput, error) { +func (ec *executionContext) unmarshalOEventLogWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐEventLogWhereInput(ctx context.Context, v interface{}) (*ent.EventLogWhereInput, error) { if v == nil { return nil, nil } @@ -7852,21 +8554,21 @@ func (ec *executionContext) unmarshalOEventLogWhereInput2ᚖgithub.comᚋKensh return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalONode2githubᚗcomᚋKenshiTechᚋunchainedᚋentᚐNoder(ctx context.Context, sel ast.SelectionSet, v ent.Noder) graphql.Marshaler { +func (ec *executionContext) marshalONode2githubᚗcomᚋKenshiTechᚋunchainedᚋinternalᚋentᚐNoder(ctx context.Context, sel ast.SelectionSet, v ent.Noder) graphql.Marshaler { if v == nil { return graphql.Null } return ec._Node(ctx, sel, v) } -func (ec *executionContext) marshalOSigner2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSigner(ctx context.Context, sel ast.SelectionSet, v *ent.Signer) graphql.Marshaler { +func (ec *executionContext) marshalOSigner2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSigner(ctx context.Context, sel ast.SelectionSet, v *ent.Signer) graphql.Marshaler { if v == nil { return graphql.Null } return ec._Signer(ctx, sel, v) } -func (ec *executionContext) marshalOSignerEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.SignerEdge) graphql.Marshaler { +func (ec *executionContext) marshalOSignerEdge2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.SignerEdge) graphql.Marshaler { if v == nil { return graphql.Null } @@ -7893,7 +8595,7 @@ func (ec *executionContext) marshalOSignerEdge2ᚕᚖgithub.comᚋKenshiTech if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalOSignerEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerEdge(ctx, sel, v[i]) + ret[i] = ec.marshalOSignerEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerEdge(ctx, sel, v[i]) } if isLen1 { f(i) @@ -7907,14 +8609,14 @@ func (ec *executionContext) marshalOSignerEdge2ᚕᚖgithub.comᚋKenshiTech return ret } -func (ec *executionContext) marshalOSignerEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerEdge(ctx context.Context, sel ast.SelectionSet, v *ent.SignerEdge) graphql.Marshaler { +func (ec *executionContext) marshalOSignerEdge2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerEdge(ctx context.Context, sel ast.SelectionSet, v *ent.SignerEdge) graphql.Marshaler { if v == nil { return graphql.Null } return ec._SignerEdge(ctx, sel, v) } -func (ec *executionContext) unmarshalOSignerOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerOrder(ctx context.Context, v interface{}) (*ent.SignerOrder, error) { +func (ec *executionContext) unmarshalOSignerOrder2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerOrder(ctx context.Context, v interface{}) (*ent.SignerOrder, error) { if v == nil { return nil, nil } @@ -7922,7 +8624,7 @@ func (ec *executionContext) unmarshalOSignerOrder2ᚖgithub.comᚋKenshiTech return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerWhereInputᚄ(ctx context.Context, v interface{}) ([]*ent.SignerWhereInput, error) { +func (ec *executionContext) unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerWhereInputᚄ(ctx context.Context, v interface{}) ([]*ent.SignerWhereInput, error) { if v == nil { return nil, nil } @@ -7934,7 +8636,7 @@ func (ec *executionContext) unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKens res := make([]*ent.SignerWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNSignerWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerWhereInput(ctx, vSlice[i]) + res[i], err = ec.unmarshalNSignerWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } @@ -7942,7 +8644,7 @@ func (ec *executionContext) unmarshalOSignerWhereInput2ᚕᚖgithub.comᚋKens return res, nil } -func (ec *executionContext) unmarshalOSignerWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋentᚐSignerWhereInput(ctx context.Context, v interface{}) (*ent.SignerWhereInput, error) { +func (ec *executionContext) unmarshalOSignerWhereInput2ᚖgithub.comᚋKenshiTechᚋunchainedᚋinternalᚋentᚐSignerWhereInput(ctx context.Context, v interface{}) (*ent.SignerWhereInput, error) { if v == nil { return nil, nil } diff --git a/internal/transport/server/gql/unchained.graphql b/internal/transport/server/gql/unchained.graphql index ab97c99f..3daa77c4 100644 --- a/internal/transport/server/gql/unchained.graphql +++ b/internal/transport/server/gql/unchained.graphql @@ -9,6 +9,8 @@ type AssetPrice implements Node { asset: String chain: String pair: String + consensus: Boolean! + voted: Uint! signers: [Signer!]! } """ @@ -169,6 +171,22 @@ input AssetPriceWhereInput { pairEqualFold: String pairContainsFold: String """ + consensus field predicates + """ + consensus: Boolean + consensusNEQ: Boolean + """ + voted field predicates + """ + voted: Uint + votedNEQ: Uint + votedIn: [Uint!] + votedNotIn: [Uint!] + votedGT: Uint + votedGTE: Uint + votedLT: Uint + votedLTE: Uint + """ signers edge predicates """ hasSigners: Boolean @@ -182,6 +200,8 @@ type CorrectnessReport implements Node { hash: Bytes! topic: Bytes! correct: Boolean! + consensus: Boolean! + voted: Uint! signers: [Signer!]! } """ @@ -280,6 +300,22 @@ input CorrectnessReportWhereInput { correct: Boolean correctNEQ: Boolean """ + consensus field predicates + """ + consensus: Boolean + consensusNEQ: Boolean + """ + voted field predicates + """ + voted: Uint + votedNEQ: Uint + votedIn: [Uint!] + votedNotIn: [Uint!] + votedGT: Uint + votedGTE: Uint + votedLT: Uint + votedLTE: Uint + """ signers edge predicates """ hasSigners: Boolean @@ -301,6 +337,8 @@ type EventLog implements Node { event: String! transaction: Bytes! args: [EventLogArg!]! + consensus: Boolean! + voted: Uint! signers: [Signer!]! } """ @@ -453,6 +491,22 @@ input EventLogWhereInput { eventEqualFold: String eventContainsFold: String """ + consensus field predicates + """ + consensus: Boolean + consensusNEQ: Boolean + """ + voted field predicates + """ + voted: Uint + votedNEQ: Uint + votedIn: [Uint!] + votedNotIn: [Uint!] + votedGT: Uint + votedGTE: Uint + votedLT: Uint + votedLTE: Uint + """ signers edge predicates """ hasSigners: Boolean diff --git a/internal/transport/server/gql/unchained.resolvers.go b/internal/transport/server/gql/unchained.resolvers.go index eebf3caa..bd186316 100644 --- a/internal/transport/server/gql/unchained.resolvers.go +++ b/internal/transport/server/gql/unchained.resolvers.go @@ -6,14 +6,14 @@ package gql import ( "context" + "fmt" "math/big" - "github.com/KenshiTech/unchained/internal/transport/server/gql/generated" - "github.com/KenshiTech/unchained/internal/transport/server/gql/types" - "entgo.io/contrib/entgql" "github.com/KenshiTech/unchained/internal/ent" "github.com/KenshiTech/unchained/internal/ent/helpers" + "github.com/KenshiTech/unchained/internal/transport/server/gql/generated" + "github.com/KenshiTech/unchained/internal/transport/server/gql/types" ) // Price is the resolver for the price field. @@ -26,6 +26,11 @@ func (r *assetPriceResolver) Signature(ctx context.Context, obj *ent.AssetPrice) return obj.Signature, nil } +// Voted is the resolver for the voted field. +func (r *assetPriceResolver) Voted(ctx context.Context, obj *ent.AssetPrice) (uint64, error) { + panic(fmt.Errorf("not implemented: Voted - voted")) +} + // Signature is the resolver for the signature field. func (r *correctnessReportResolver) Signature(ctx context.Context, obj *ent.CorrectnessReport) (types.Bytes, error) { return obj.Signature, nil @@ -41,6 +46,11 @@ func (r *correctnessReportResolver) Topic(ctx context.Context, obj *ent.Correctn return obj.Topic, nil } +// Voted is the resolver for the voted field. +func (r *correctnessReportResolver) Voted(ctx context.Context, obj *ent.CorrectnessReport) (uint64, error) { + panic(fmt.Errorf("not implemented: Voted - voted")) +} + // Signature is the resolver for the signature field. func (r *eventLogResolver) Signature(ctx context.Context, obj *ent.EventLog) (types.Bytes, error) { return obj.Signature, nil @@ -51,6 +61,11 @@ func (r *eventLogResolver) Transaction(ctx context.Context, obj *ent.EventLog) ( return obj.Transaction, nil } +// Voted is the resolver for the voted field. +func (r *eventLogResolver) Voted(ctx context.Context, obj *ent.EventLog) (uint64, error) { + panic(fmt.Errorf("not implemented: Voted - voted")) +} + // Node is the resolver for the node field. func (r *queryResolver) Node(ctx context.Context, id int) (ent.Noder, error) { return r.client.Noder(ctx, id) @@ -159,6 +174,126 @@ func (r *assetPriceWhereInputResolver) PriceLte(ctx context.Context, obj *ent.As return nil } +// Voted is the resolver for the voted field. +func (r *assetPriceWhereInputResolver) Voted(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: Voted - voted")) +} + +// VotedNeq is the resolver for the votedNEQ field. +func (r *assetPriceWhereInputResolver) VotedNeq(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedNeq - votedNEQ")) +} + +// VotedIn is the resolver for the votedIn field. +func (r *assetPriceWhereInputResolver) VotedIn(ctx context.Context, obj *ent.AssetPriceWhereInput, data []uint64) error { + panic(fmt.Errorf("not implemented: VotedIn - votedIn")) +} + +// VotedNotIn is the resolver for the votedNotIn field. +func (r *assetPriceWhereInputResolver) VotedNotIn(ctx context.Context, obj *ent.AssetPriceWhereInput, data []uint64) error { + panic(fmt.Errorf("not implemented: VotedNotIn - votedNotIn")) +} + +// VotedGt is the resolver for the votedGT field. +func (r *assetPriceWhereInputResolver) VotedGt(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedGt - votedGT")) +} + +// VotedGte is the resolver for the votedGTE field. +func (r *assetPriceWhereInputResolver) VotedGte(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedGte - votedGTE")) +} + +// VotedLt is the resolver for the votedLT field. +func (r *assetPriceWhereInputResolver) VotedLt(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedLt - votedLT")) +} + +// VotedLte is the resolver for the votedLTE field. +func (r *assetPriceWhereInputResolver) VotedLte(ctx context.Context, obj *ent.AssetPriceWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedLte - votedLTE")) +} + +// Voted is the resolver for the voted field. +func (r *correctnessReportWhereInputResolver) Voted(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: Voted - voted")) +} + +// VotedNeq is the resolver for the votedNEQ field. +func (r *correctnessReportWhereInputResolver) VotedNeq(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedNeq - votedNEQ")) +} + +// VotedIn is the resolver for the votedIn field. +func (r *correctnessReportWhereInputResolver) VotedIn(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data []uint64) error { + panic(fmt.Errorf("not implemented: VotedIn - votedIn")) +} + +// VotedNotIn is the resolver for the votedNotIn field. +func (r *correctnessReportWhereInputResolver) VotedNotIn(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data []uint64) error { + panic(fmt.Errorf("not implemented: VotedNotIn - votedNotIn")) +} + +// VotedGt is the resolver for the votedGT field. +func (r *correctnessReportWhereInputResolver) VotedGt(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedGt - votedGT")) +} + +// VotedGte is the resolver for the votedGTE field. +func (r *correctnessReportWhereInputResolver) VotedGte(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedGte - votedGTE")) +} + +// VotedLt is the resolver for the votedLT field. +func (r *correctnessReportWhereInputResolver) VotedLt(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedLt - votedLT")) +} + +// VotedLte is the resolver for the votedLTE field. +func (r *correctnessReportWhereInputResolver) VotedLte(ctx context.Context, obj *ent.CorrectnessReportWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedLte - votedLTE")) +} + +// Voted is the resolver for the voted field. +func (r *eventLogWhereInputResolver) Voted(ctx context.Context, obj *ent.EventLogWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: Voted - voted")) +} + +// VotedNeq is the resolver for the votedNEQ field. +func (r *eventLogWhereInputResolver) VotedNeq(ctx context.Context, obj *ent.EventLogWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedNeq - votedNEQ")) +} + +// VotedIn is the resolver for the votedIn field. +func (r *eventLogWhereInputResolver) VotedIn(ctx context.Context, obj *ent.EventLogWhereInput, data []uint64) error { + panic(fmt.Errorf("not implemented: VotedIn - votedIn")) +} + +// VotedNotIn is the resolver for the votedNotIn field. +func (r *eventLogWhereInputResolver) VotedNotIn(ctx context.Context, obj *ent.EventLogWhereInput, data []uint64) error { + panic(fmt.Errorf("not implemented: VotedNotIn - votedNotIn")) +} + +// VotedGt is the resolver for the votedGT field. +func (r *eventLogWhereInputResolver) VotedGt(ctx context.Context, obj *ent.EventLogWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedGt - votedGT")) +} + +// VotedGte is the resolver for the votedGTE field. +func (r *eventLogWhereInputResolver) VotedGte(ctx context.Context, obj *ent.EventLogWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedGte - votedGTE")) +} + +// VotedLt is the resolver for the votedLT field. +func (r *eventLogWhereInputResolver) VotedLt(ctx context.Context, obj *ent.EventLogWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedLt - votedLT")) +} + +// VotedLte is the resolver for the votedLTE field. +func (r *eventLogWhereInputResolver) VotedLte(ctx context.Context, obj *ent.EventLogWhereInput, data *uint64) error { + panic(fmt.Errorf("not implemented: VotedLte - votedLTE")) +} + // AssetPrice returns generated.AssetPriceResolver implementation. func (r *Resolver) AssetPrice() generated.AssetPriceResolver { return &assetPriceResolver{r} } @@ -186,6 +321,11 @@ func (r *Resolver) CorrectnessReportWhereInput() generated.CorrectnessReportWher return &correctnessReportWhereInputResolver{r} } +// EventLogWhereInput returns generated.EventLogWhereInputResolver implementation. +func (r *Resolver) EventLogWhereInput() generated.EventLogWhereInputResolver { + return &eventLogWhereInputResolver{r} +} + // SignerWhereInput returns generated.SignerWhereInputResolver implementation. func (r *Resolver) SignerWhereInput() generated.SignerWhereInputResolver { return &signerWhereInputResolver{r} @@ -198,4 +338,5 @@ type queryResolver struct{ *Resolver } type signerResolver struct{ *Resolver } type assetPriceWhereInputResolver struct{ *Resolver } type correctnessReportWhereInputResolver struct{ *Resolver } +type eventLogWhereInputResolver struct{ *Resolver } type signerWhereInputResolver struct{ *Resolver }