mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
Clean up code: remove obsolete TODO and commented code, improve style
- Remove obsolete TODO comment in core/vm/opcodes.go (DIFFICULTY/PREVRANDAO) - Remove commented code in log/format.go - Use idiomatic variable declaration in crypto/signify/signify.go - Pre-allocate slices with estimated capacity to avoid reallocations No functional changes.
This commit is contained in:
parent
5dd0fe2f53
commit
1e84263a1f
3 changed files with 4 additions and 5 deletions
|
|
@ -313,7 +313,7 @@ var opCodeToString = [256]string{
|
||||||
COINBASE: "COINBASE",
|
COINBASE: "COINBASE",
|
||||||
TIMESTAMP: "TIMESTAMP",
|
TIMESTAMP: "TIMESTAMP",
|
||||||
NUMBER: "NUMBER",
|
NUMBER: "NUMBER",
|
||||||
DIFFICULTY: "DIFFICULTY", // TODO (MariusVanDerWijden) rename to PREVRANDAO post merge
|
DIFFICULTY: "DIFFICULTY",
|
||||||
GASLIMIT: "GASLIMIT",
|
GASLIMIT: "GASLIMIT",
|
||||||
CHAINID: "CHAINID",
|
CHAINID: "CHAINID",
|
||||||
SELFBALANCE: "SELFBALANCE",
|
SELFBALANCE: "SELFBALANCE",
|
||||||
|
|
|
||||||
|
|
@ -79,19 +79,19 @@ func SignFile(input string, output string, key string, untrustedComment string,
|
||||||
|
|
||||||
// Create the main data signature.
|
// Create the main data signature.
|
||||||
rawSig := ed25519.Sign(skey, filedata)
|
rawSig := ed25519.Sign(skey, filedata)
|
||||||
var dataSig []byte
|
dataSig := make([]byte, 0, len(header)+len(keyNum)+len(rawSig))
|
||||||
dataSig = append(dataSig, header...)
|
dataSig = append(dataSig, header...)
|
||||||
dataSig = append(dataSig, keyNum...)
|
dataSig = append(dataSig, keyNum...)
|
||||||
dataSig = append(dataSig, rawSig...)
|
dataSig = append(dataSig, rawSig...)
|
||||||
|
|
||||||
// Create the comment signature.
|
// Create the comment signature.
|
||||||
var commentSigInput []byte
|
commentSigInput := make([]byte, 0, len(rawSig)+len(trustedComment))
|
||||||
commentSigInput = append(commentSigInput, rawSig...)
|
commentSigInput = append(commentSigInput, rawSig...)
|
||||||
commentSigInput = append(commentSigInput, []byte(trustedComment)...)
|
commentSigInput = append(commentSigInput, []byte(trustedComment)...)
|
||||||
commentSig := ed25519.Sign(skey, commentSigInput)
|
commentSig := ed25519.Sign(skey, commentSigInput)
|
||||||
|
|
||||||
// Create the output file.
|
// Create the output file.
|
||||||
var out = new(bytes.Buffer)
|
out := new(bytes.Buffer)
|
||||||
fmt.Fprintln(out, "untrusted comment:", untrustedComment)
|
fmt.Fprintln(out, "untrusted comment:", untrustedComment)
|
||||||
fmt.Fprintln(out, base64.StdEncoding.EncodeToString(dataSig))
|
fmt.Fprintln(out, base64.StdEncoding.EncodeToString(dataSig))
|
||||||
fmt.Fprintln(out, "trusted comment:", trustedComment)
|
fmt.Fprintln(out, "trusted comment:", trustedComment)
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@ func (h *TerminalHandler) format(buf []byte, r slog.Record, usecolor bool) []byt
|
||||||
b.WriteString(msg)
|
b.WriteString(msg)
|
||||||
|
|
||||||
// try to justify the log output for short messages
|
// try to justify the log output for short messages
|
||||||
//length := utf8.RuneCountInString(msg)
|
|
||||||
length := len(msg)
|
length := len(msg)
|
||||||
if (r.NumAttrs()+len(h.attrs)) > 0 && length < termMsgJust {
|
if (r.NumAttrs()+len(h.attrs)) > 0 && length < termMsgJust {
|
||||||
b.Write(spaces[:termMsgJust-length])
|
b.Write(spaces[:termMsgJust-length])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue