Skip to content

Commit

Permalink
fix int to string conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
tsahee committed Jan 3, 2025
1 parent d3de311 commit 468d689
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions arbos/programs/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package programs

import (
"strconv"

"github.com/holiman/uint256"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -265,7 +267,7 @@ func newApiClosures(
original := input

crash := func(reason string) {
panic("bad API call reason: " + reason + " request: " + string(req) + " len: " + string(len(original)) + " remaining: " + string(len(input)))
panic("bad API call reason: " + reason + " request: " + strconv.Itoa(int(req)) + " len: " + strconv.Itoa(len(original)) + " remaining: " + strconv.Itoa(len(input)))
}
takeInput := func(needed int, reason string) []byte {
if len(input) < needed {
Expand Down Expand Up @@ -413,7 +415,7 @@ func newApiClosures(
captureHostio(name, args, outs, startInk, endInk)
return []byte{}, nil, 0
default:
panic("unsupported call type: " + string(req))
panic("unsupported call type: " + strconv.Itoa(int(req)))
}
}
}
5 changes: 3 additions & 2 deletions arbos/programs/native_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import "C"

import (
"runtime"
"strconv"
"sync"
"sync/atomic"

Expand Down Expand Up @@ -68,11 +69,11 @@ func newApi(
func getApi(id usize) NativeApi {
any, ok := apiObjects.Load(uintptr(id))
if !ok {
panic("failed to load stylus Go API id: " + string(id))
panic("failed to load stylus Go API id: " + strconv.Itoa(int(id)))
}
api, ok := any.(NativeApi)
if !ok {
panic("wrong type for stylus Go API id: " + string(id))
panic("wrong type for stylus Go API id: " + strconv.Itoa(int(id)))
}
return api
}
Expand Down
2 changes: 1 addition & 1 deletion precompiles/precompile.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ func (p *Precompile) Call(
reflectArgs = append(reflectArgs, reflect.ValueOf(evm))
reflectArgs = append(reflectArgs, reflect.ValueOf(value))
default:
panic("Unknown state mutability " + string(method.purity))
panic("Unknown state mutability " + strconv.Itoa(int(method.purity)))
}

args, err := method.template.Inputs.Unpack(input[4:])
Expand Down

0 comments on commit 468d689

Please sign in to comment.