Commit ec3857eb authored by Conner Fromknecht's avatar Conner Fromknecht

feat: code move, move BatchType contants near type def

parent 99021e29
...@@ -83,26 +83,22 @@ func (c *BatchContext) Read(r io.Reader) error { ...@@ -83,26 +83,22 @@ func (c *BatchContext) Read(r io.Reader) error {
return readUint64(r, &c.BlockNumber, 5) return readUint64(r, &c.BlockNumber, 5)
} }
// BatchType represents the type of batch being // BatchType represents the type of batch being submitted. When the first
// submitted. When the first context in the batch // context in the batch has a timestamp of 0, the blocknumber is interpreted as
// has a timestamp of 0, the blocknumber is interpreted // an enum that represets the type.
// as an enum that represets the type
type BatchType int8 type BatchType int8
// Implements the Stringer interface for BatchType const (
func (b BatchType) String() string { // BatchTypeLegacy represets the legacy batch type.
switch b { BatchTypeLegacy BatchType = -1
case BatchTypeLegacy:
return "LEGACY" // BatchTypeZlib represents a batch type where the transaction data is
case BatchTypeZlib: // compressed using zlib.
return "ZLIB" BatchTypeZlib BatchType = 0
default: )
return ""
}
}
// BatchTypeFromString returns the BatchType // BatchTypeFromString returns the BatchType enum based on a human readable
// enum based on a human readable string // string.
func BatchTypeFromString(s string) BatchType { func BatchTypeFromString(s string) BatchType {
switch s { switch s {
case "zlib", "ZLIB": case "zlib", "ZLIB":
...@@ -114,13 +110,17 @@ func BatchTypeFromString(s string) BatchType { ...@@ -114,13 +110,17 @@ func BatchTypeFromString(s string) BatchType {
} }
} }
const ( // String implements the Stringer interface for BatchType.
// BatchTypeLegacy represets the legacy batch type func (b BatchType) String() string {
BatchTypeLegacy BatchType = -1 switch b {
// BatchTypeZlib represents a batch type where the case BatchTypeLegacy:
// transaction data is compressed using zlib return "LEGACY"
BatchTypeZlib BatchType = 0 case BatchTypeZlib:
) return "ZLIB"
default:
return ""
}
}
// AppendSequencerBatchParams holds the raw data required to submit a batch of // AppendSequencerBatchParams holds the raw data required to submit a batch of
// L2 txs to L1 CTC contract. Rather than encoding the objects using the // L2 txs to L1 CTC contract. Rather than encoding the objects using the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment