Delete what the cut left behind

tail() read the id out of a subtree route and no route is a subtree any more;
lxrDecodeBytes32 and lxrPadBytes served the V4 router builders that went with
the precompile answering 0x. staticcheck is clean on pkg/gateway and
cmd/gateway.

Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
2026-09-09 01:19:30 -07:00
co-authored by Hanzo Dev
parent 5b9ac470d9
commit a0574347c9
2 changed files with 0 additions and 33 deletions
-24
View File
@@ -40,23 +40,6 @@ func lxrDecodeAddress(s string) ([20]byte, error) {
return addr, nil
}
// lxrDecodeBytes32 parses a 0x-prefixed hex string into a 32-byte array.
func lxrDecodeBytes32(s string) ([32]byte, error) {
var out [32]byte
s = strings.TrimPrefix(s, "0x")
if len(s) > 64 {
return out, fmt.Errorf("bytes32 too long: %d hex chars", len(s))
}
// Left-pad with zeros if shorter than 64 hex chars.
s = strings.Repeat("0", 64-len(s)) + s
b, err := hex.DecodeString(s)
if err != nil {
return out, fmt.Errorf("invalid hex: %w", err)
}
copy(out[:], b)
return out, nil
}
// lxrPadAddress left-pads a 20-byte address to 32 bytes (EVM ABI word).
func lxrPadAddress(addr [20]byte) []byte {
var word [32]byte
@@ -78,13 +61,6 @@ func lxrPadUint256(n *big.Int) []byte {
return word[:]
}
// lxrPadBytes pads arbitrary bytes to the next 32-byte boundary.
func lxrPadBytes(b []byte) []byte {
padded := make([]byte, ((len(b)+31)/32)*32)
copy(padded, b)
return padded
}
// lxrMustDecodeHex decodes a hex string, panicking on error (init-time only).
func lxrMustDecodeHex(s string) []byte {
b, err := hex.DecodeString(s)
-9
View File
@@ -9,7 +9,6 @@ import (
"net/http"
"sort"
"strconv"
"strings"
"time"
"github.com/google/uuid"
@@ -146,14 +145,6 @@ func (s *Server) Shutdown(ctx context.Context) error {
// One namespace, one owner, one document.
const tradePrefix = "/v1/trade"
// tail is what a subtree route was asked about — the pool id, the order id.
// It reads the same constant the route was mounted from, because a route
// registered from the prefix and parsed from a copy of it is one rename away
// from every id arriving with a path stuck to the front of it.
func tail(r *http.Request, route string) string {
return strings.TrimPrefix(r.URL.Path, tradePrefix+route)
}
// routes is the surface, once. api/openapi.yaml describes exactly this, and a
// test holds the two to each other — a route added here and not written down
// is a route no client can be told about, and a path written down and not