mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
feat: add RowConsumption & RowUsage types (#625)
This commit is contained in:
parent
14d8266fc2
commit
001a80226a
2 changed files with 56 additions and 0 deletions
41
core/types/gen_row_consumption_json.go
Normal file
41
core/types/gen_row_consumption_json.go
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
||||||
|
|
||||||
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MarshalJSON marshals as JSON.
|
||||||
|
func (s SubCircuitRowUsage) MarshalJSON() ([]byte, error) {
|
||||||
|
type SubCircuitRowUsage struct {
|
||||||
|
Name string `json:"name" gencodec:"required"`
|
||||||
|
RowNumber uint64 `json:"row_number" gencodec:"required"`
|
||||||
|
}
|
||||||
|
var enc SubCircuitRowUsage
|
||||||
|
enc.Name = s.Name
|
||||||
|
enc.RowNumber = s.RowNumber
|
||||||
|
return json.Marshal(&enc)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON unmarshals from JSON.
|
||||||
|
func (s *SubCircuitRowUsage) UnmarshalJSON(input []byte) error {
|
||||||
|
type SubCircuitRowUsage struct {
|
||||||
|
Name *string `json:"name" gencodec:"required"`
|
||||||
|
RowNumber *uint64 `json:"row_number" gencodec:"required"`
|
||||||
|
}
|
||||||
|
var dec SubCircuitRowUsage
|
||||||
|
if err := json.Unmarshal(input, &dec); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if dec.Name == nil {
|
||||||
|
return errors.New("missing required field 'name' for SubCircuitRowUsage")
|
||||||
|
}
|
||||||
|
s.Name = *dec.Name
|
||||||
|
if dec.RowNumber == nil {
|
||||||
|
return errors.New("missing required field 'row_number' for SubCircuitRowUsage")
|
||||||
|
}
|
||||||
|
s.RowNumber = *dec.RowNumber
|
||||||
|
return nil
|
||||||
|
}
|
||||||
15
core/types/row_consumption.go
Normal file
15
core/types/row_consumption.go
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
package types
|
||||||
|
|
||||||
|
type RowUsage struct {
|
||||||
|
IsOk bool `json:"is_ok"`
|
||||||
|
RowNumber uint64 `json:"row_number"`
|
||||||
|
RowUsageDetails []SubCircuitRowUsage `json:"row_usage_details"`
|
||||||
|
}
|
||||||
|
|
||||||
|
//go:generate gencodec -type SubCircuitRowUsage -out gen_row_consumption_json.go
|
||||||
|
type SubCircuitRowUsage struct {
|
||||||
|
Name string `json:"name" gencodec:"required"`
|
||||||
|
RowNumber uint64 `json:"row_number" gencodec:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RowConsumption []SubCircuitRowUsage
|
||||||
Loading…
Reference in a new issue