The optimal error estimate for extension operators from boundaries to the whole domain

fes = H1(mesh, order=2, dirichlet=“left|right”)
g = sin(y)
gfu = GridFunction(fes)
gfu.Set(g, BND)
the codes are from the i-tutorial 1.3 Dirichlet boundary conditions (1.3 Dirichlet boundary conditions — NGS-Py 6.2.2303 documentation)

Do we have the optimal estimate( trace inequality):
|gfu| _ {H^1(Domain)}
\leq C |g| _ {H^{1/2(boundary)}}
\leq Ch^{-1/2}|g| _ {L^2(Boundary)}?

I think we just have
|gfu| _ {H^1(Domain)}
\leq Ch^{-1}|g| _ {L^2(Domain)}
\leq Ch^{-1}h^{1/2}|g|_ {L^infty(Boundary)}
\leq Ch^{-1}|g|_{L^2(Boundary)}
for the implementation in the Ngsolve codes