all: change format 0x%x to %#x (#25221)

This commit is contained in:
Seungbae.yu
2022-07-04 11:03:32 +03:00
committed by GitHub
parent 953a29f5fd
commit 2697e44d81
25 changed files with 39 additions and 39 deletions
+2 -2
View File
@@ -109,7 +109,7 @@ func PrintDisassembled(code string) error {
it := NewInstructionIterator(script)
for it.Next() {
if it.Arg() != nil && 0 < len(it.Arg()) {
fmt.Printf("%05x: %v 0x%x\n", it.PC(), it.Op(), it.Arg())
fmt.Printf("%05x: %v %#x\n", it.PC(), it.Op(), it.Arg())
} else {
fmt.Printf("%05x: %v\n", it.PC(), it.Op())
}
@@ -124,7 +124,7 @@ func Disassemble(script []byte) ([]string, error) {
it := NewInstructionIterator(script)
for it.Next() {
if it.Arg() != nil && 0 < len(it.Arg()) {
instrs = append(instrs, fmt.Sprintf("%05x: %v 0x%x\n", it.PC(), it.Op(), it.Arg()))
instrs = append(instrs, fmt.Sprintf("%05x: %v %#x\n", it.PC(), it.Op(), it.Arg()))
} else {
instrs = append(instrs, fmt.Sprintf("%05x: %v\n", it.PC(), it.Op()))
}
+1 -1
View File
@@ -2342,7 +2342,7 @@ func (bc *BlockChain) reportBlock(block *types.Block, receipts types.Receipts, e
Chain config: %v
Number: %v
Hash: 0x%x
Hash: %#x
%v
Error: %v
+1 -1
View File
@@ -197,7 +197,7 @@ func printList(l types.DerivableList) {
for i := 0; i < l.Len(); i++ {
var buf bytes.Buffer
l.EncodeIndex(i, &buf)
fmt.Printf("\"0x%x\",\n", buf.Bytes())
fmt.Printf("\"%#x\",\n", buf.Bytes())
}
fmt.Printf("},\n")
}
+1 -1
View File
@@ -63,7 +63,7 @@ type JumpTable [256]*operation
func validate(jt JumpTable) JumpTable {
for i, op := range jt {
if op == nil {
panic(fmt.Sprintf("op 0x%x is not set", i))
panic(fmt.Sprintf("op %#x is not set", i))
}
// The interpreter has an assumption that if the memorySize function is
// set, then the dynamicGas function is also set. This is a somewhat
+1 -1
View File
@@ -392,7 +392,7 @@ var opCodeToString = map[OpCode]string{
func (op OpCode) String() string {
str := opCodeToString[op]
if len(str) == 0 {
return fmt.Sprintf("opcode 0x%x not defined", int(op))
return fmt.Sprintf("opcode %#x not defined", int(op))
}
return str
+2 -2
View File
@@ -503,7 +503,7 @@ func TestEip2929Cases(t *testing.T) {
it := asm.NewInstructionIterator(code)
for it.Next() {
if it.Arg() != nil && 0 < len(it.Arg()) {
instrs = append(instrs, fmt.Sprintf("%v 0x%x", it.Op(), it.Arg()))
instrs = append(instrs, fmt.Sprintf("%v %#x", it.Op(), it.Arg()))
} else {
instrs = append(instrs, fmt.Sprintf("%v", it.Op()))
}
@@ -511,7 +511,7 @@ func TestEip2929Cases(t *testing.T) {
ops := strings.Join(instrs, ", ")
fmt.Printf("### Case %d\n\n", id)
id++
fmt.Printf("%v\n\nBytecode: \n```\n0x%x\n```\nOperations: \n```\n%v\n```\n\n",
fmt.Printf("%v\n\nBytecode: \n```\n%#x\n```\nOperations: \n```\n%v\n```\n\n",
comment,
code, ops)
Execute(code, nil, &Config{