Skip to content

Commit

Permalink
Fix go names Id -> ID
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Jan 18, 2021
1 parent a72cd87 commit faf0303
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 53 deletions.
44 changes: 22 additions & 22 deletions api/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ func Create(cache Cache, wasm []byte) ([]byte, error) {
return receiveVector(id), nil
}

func GetCode(cache Cache, code_id []byte) ([]byte, error) {
id := sendSlice(code_id)
func GetCode(cache Cache, codeID []byte) ([]byte, error) {
id := sendSlice(codeID)
defer freeAfterSend(id)
errmsg := C.Buffer{}
code, err := C.get_code(cache.ptr, id, &errmsg)
Expand All @@ -73,7 +73,7 @@ func GetCode(cache Cache, code_id []byte) ([]byte, error) {

func Instantiate(
cache Cache,
code_id []byte,
codeID []byte,
env []byte,
info []byte,
msg []byte,
Expand All @@ -84,7 +84,7 @@ func Instantiate(
gasLimit uint64,
printDebug bool,
) ([]byte, uint64, error) {
id := sendSlice(code_id)
id := sendSlice(codeID)
defer freeAfterSend(id)
e := sendSlice(env)
defer freeAfterSend(e)
Expand Down Expand Up @@ -114,7 +114,7 @@ func Instantiate(

func Handle(
cache Cache,
code_id []byte,
codeID []byte,
env []byte,
info []byte,
msg []byte,
Expand All @@ -125,7 +125,7 @@ func Handle(
gasLimit uint64,
printDebug bool,
) ([]byte, uint64, error) {
id := sendSlice(code_id)
id := sendSlice(codeID)
defer freeAfterSend(id)
e := sendSlice(env)
defer freeAfterSend(e)
Expand Down Expand Up @@ -155,7 +155,7 @@ func Handle(

func Migrate(
cache Cache,
code_id []byte,
codeID []byte,
env []byte,
info []byte,
msg []byte,
Expand All @@ -166,7 +166,7 @@ func Migrate(
gasLimit uint64,
printDebug bool,
) ([]byte, uint64, error) {
id := sendSlice(code_id)
id := sendSlice(codeID)
defer freeAfterSend(id)
e := sendSlice(env)
defer freeAfterSend(e)
Expand Down Expand Up @@ -196,7 +196,7 @@ func Migrate(

func Query(
cache Cache,
code_id []byte,
codeID []byte,
env []byte,
msg []byte,
gasMeter *GasMeter,
Expand All @@ -206,7 +206,7 @@ func Query(
gasLimit uint64,
printDebug bool,
) ([]byte, uint64, error) {
id := sendSlice(code_id)
id := sendSlice(codeID)
defer freeAfterSend(id)
e := sendSlice(env)
defer freeAfterSend(e)
Expand Down Expand Up @@ -234,7 +234,7 @@ func Query(

func IBCChannelOpen(
cache Cache,
code_id []byte,
codeID []byte,
env []byte,
channel []byte,
gasMeter *GasMeter,
Expand All @@ -244,7 +244,7 @@ func IBCChannelOpen(
gasLimit uint64,
printDebug bool,
) ([]byte, uint64, error) {
id := sendSlice(code_id)
id := sendSlice(codeID)
defer freeAfterSend(id)
e := sendSlice(env)
defer freeAfterSend(e)
Expand Down Expand Up @@ -272,7 +272,7 @@ func IBCChannelOpen(

func IBCChannelConnect(
cache Cache,
code_id []byte,
codeID []byte,
env []byte,
channel []byte,
gasMeter *GasMeter,
Expand All @@ -282,7 +282,7 @@ func IBCChannelConnect(
gasLimit uint64,
printDebug bool,
) ([]byte, uint64, error) {
id := sendSlice(code_id)
id := sendSlice(codeID)
defer freeAfterSend(id)
e := sendSlice(env)
defer freeAfterSend(e)
Expand Down Expand Up @@ -310,7 +310,7 @@ func IBCChannelConnect(

func IBCChannelClose(
cache Cache,
code_id []byte,
codeID []byte,
env []byte,
channel []byte,
gasMeter *GasMeter,
Expand All @@ -320,7 +320,7 @@ func IBCChannelClose(
gasLimit uint64,
printDebug bool,
) ([]byte, uint64, error) {
id := sendSlice(code_id)
id := sendSlice(codeID)
defer freeAfterSend(id)
e := sendSlice(env)
defer freeAfterSend(e)
Expand Down Expand Up @@ -348,7 +348,7 @@ func IBCChannelClose(

func IBCPacketReceive(
cache Cache,
code_id []byte,
codeID []byte,
env []byte,
packet []byte,
gasMeter *GasMeter,
Expand All @@ -358,7 +358,7 @@ func IBCPacketReceive(
gasLimit uint64,
printDebug bool,
) ([]byte, uint64, error) {
id := sendSlice(code_id)
id := sendSlice(codeID)
defer freeAfterSend(id)
e := sendSlice(env)
defer freeAfterSend(e)
Expand Down Expand Up @@ -386,7 +386,7 @@ func IBCPacketReceive(

func IBCPacketAck(
cache Cache,
code_id []byte,
codeID []byte,
env []byte,
ack []byte,
gasMeter *GasMeter,
Expand All @@ -396,7 +396,7 @@ func IBCPacketAck(
gasLimit uint64,
printDebug bool,
) ([]byte, uint64, error) {
id := sendSlice(code_id)
id := sendSlice(codeID)
defer freeAfterSend(id)
e := sendSlice(env)
defer freeAfterSend(e)
Expand Down Expand Up @@ -424,7 +424,7 @@ func IBCPacketAck(

func IBCPacketTimeout(
cache Cache,
code_id []byte,
codeID []byte,
env []byte,
packet []byte,
gasMeter *GasMeter,
Expand All @@ -434,7 +434,7 @@ func IBCPacketTimeout(
gasLimit uint64,
printDebug bool,
) ([]byte, uint64, error) {
id := sendSlice(code_id)
id := sendSlice(codeID)
defer freeAfterSend(id)
e := sendSlice(env)
defer freeAfterSend(e)
Expand Down
44 changes: 22 additions & 22 deletions lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ func (vm *VM) Create(code WasmCode) (CodeID, error) {
// This can be used so that the (short) code id (hash) is stored in the iavl tree
// and the larger binary blobs (wasm and pre-compiles) are all managed by the
// rust library
func (vm *VM) GetCode(code CodeID) (WasmCode, error) {
return api.GetCode(vm.cache, code)
func (vm *VM) GetCode(codeID CodeID) (WasmCode, error) {
return api.GetCode(vm.cache, codeID)
}

// Instantiate will create a new contract based on the given codeID.
Expand All @@ -88,7 +88,7 @@ func (vm *VM) GetCode(code CodeID) (WasmCode, error) {
// Under the hood, we may recompile the wasm, use a cached native compile, or even use a cached instance
// for performance.
func (vm *VM) Instantiate(
code CodeID,
codeID CodeID,
env types.Env,
info types.MessageInfo,
initMsg []byte,
Expand All @@ -106,7 +106,7 @@ func (vm *VM) Instantiate(
if err != nil {
return nil, 0, err
}
data, gasUsed, err := api.Instantiate(vm.cache, code, envBin, infoBin, initMsg, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
data, gasUsed, err := api.Instantiate(vm.cache, codeID, envBin, infoBin, initMsg, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
if err != nil {
return nil, gasUsed, err
}
Expand All @@ -129,7 +129,7 @@ func (vm *VM) Instantiate(
// The caller is responsible for passing the correct `store` (which must have been initialized exactly once),
// and setting the env with relevent info on this instance (address, balance, etc)
func (vm *VM) Execute(
code CodeID,
codeID CodeID,
env types.Env,
info types.MessageInfo,
executeMsg []byte,
Expand All @@ -147,7 +147,7 @@ func (vm *VM) Execute(
if err != nil {
return nil, 0, err
}
data, gasUsed, err := api.Handle(vm.cache, code, envBin, infoBin, executeMsg, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
data, gasUsed, err := api.Handle(vm.cache, codeID, envBin, infoBin, executeMsg, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
if err != nil {
return nil, gasUsed, err
}
Expand All @@ -167,7 +167,7 @@ func (vm *VM) Execute(
// valid json-encoded data to return to the client.
// The meaning of path and data can be determined by the code. Path is the suffix of the abci.QueryRequest.Path
func (vm *VM) Query(
code CodeID,
codeID CodeID,
env types.Env,
queryMsg []byte,
store KVStore,
Expand All @@ -180,7 +180,7 @@ func (vm *VM) Query(
if err != nil {
return nil, 0, err
}
data, gasUsed, err := api.Query(vm.cache, code, envBin, queryMsg, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
data, gasUsed, err := api.Query(vm.cache, codeID, envBin, queryMsg, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
if err != nil {
return nil, gasUsed, err
}
Expand All @@ -203,7 +203,7 @@ func (vm *VM) Query(
//
// MigrateMsg has some data on how to perform the migration.
func (vm *VM) Migrate(
code CodeID,
codeID CodeID,
env types.Env,
info types.MessageInfo,
migrateMsg []byte,
Expand All @@ -221,7 +221,7 @@ func (vm *VM) Migrate(
if err != nil {
return nil, 0, err
}
data, gasUsed, err := api.Migrate(vm.cache, code, envBin, infoBin, migrateMsg, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
data, gasUsed, err := api.Migrate(vm.cache, codeID, envBin, infoBin, migrateMsg, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
if err != nil {
return nil, gasUsed, err
}
Expand All @@ -240,7 +240,7 @@ func (vm *VM) Migrate(
// IBCChannelOpen is available on IBC-enabled contracts and is a hook to call into
// during the handshake pahse
func (vm *VM) IBCChannelOpen(
code CodeID,
codeID CodeID,
env types.Env,
channel types.IBCChannel,
store KVStore,
Expand All @@ -257,7 +257,7 @@ func (vm *VM) IBCChannelOpen(
if err != nil {
return 0, err
}
data, gasUsed, err := api.IBCChannelOpen(vm.cache, code, envBin, chanBin, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
data, gasUsed, err := api.IBCChannelOpen(vm.cache, codeID, envBin, chanBin, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
if err != nil {
return gasUsed, err
}
Expand All @@ -276,7 +276,7 @@ func (vm *VM) IBCChannelOpen(
// IBCChannelConnect is available on IBC-enabled contracts and is a hook to call into
// during the handshake pahse
func (vm *VM) IBCChannelConnect(
code CodeID,
codeID CodeID,
env types.Env,
channel types.IBCChannel,
store KVStore,
Expand All @@ -293,7 +293,7 @@ func (vm *VM) IBCChannelConnect(
if err != nil {
return nil, 0, err
}
data, gasUsed, err := api.IBCChannelConnect(vm.cache, code, envBin, chanBin, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
data, gasUsed, err := api.IBCChannelConnect(vm.cache, codeID, envBin, chanBin, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
if err != nil {
return nil, gasUsed, err
}
Expand All @@ -312,7 +312,7 @@ func (vm *VM) IBCChannelConnect(
// IBCChannelClose is available on IBC-enabled contracts and is a hook to call into
// at the end of the channel lifetime
func (vm *VM) IBCChannelClose(
code CodeID,
codeID CodeID,
env types.Env,
channel types.IBCChannel,
store KVStore,
Expand All @@ -329,7 +329,7 @@ func (vm *VM) IBCChannelClose(
if err != nil {
return nil, 0, err
}
data, gasUsed, err := api.IBCChannelClose(vm.cache, code, envBin, chanBin, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
data, gasUsed, err := api.IBCChannelClose(vm.cache, codeID, envBin, chanBin, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
if err != nil {
return nil, gasUsed, err
}
Expand All @@ -348,7 +348,7 @@ func (vm *VM) IBCChannelClose(
// IBCPacketReceive is available on IBC-enabled contracts and is called when an incoming
// packet is received on a channel belonging to this contract
func (vm *VM) IBCPacketReceive(
code CodeID,
codeID CodeID,
env types.Env,
packet types.IBCPacket,
store KVStore,
Expand All @@ -365,7 +365,7 @@ func (vm *VM) IBCPacketReceive(
if err != nil {
return nil, 0, err
}
data, gasUsed, err := api.IBCPacketReceive(vm.cache, code, envBin, packetBin, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
data, gasUsed, err := api.IBCPacketReceive(vm.cache, codeID, envBin, packetBin, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
if err != nil {
return nil, gasUsed, err
}
Expand All @@ -385,7 +385,7 @@ func (vm *VM) IBCPacketReceive(
// the response for an outgoing packet (previously sent by this contract)
// is received
func (vm *VM) IBCPacketAck(
code CodeID,
codeID CodeID,
env types.Env,
ack types.IBCAcknowledgement,
store KVStore,
Expand All @@ -402,7 +402,7 @@ func (vm *VM) IBCPacketAck(
if err != nil {
return nil, 0, err
}
data, gasUsed, err := api.IBCPacketAck(vm.cache, code, envBin, ackBin, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
data, gasUsed, err := api.IBCPacketAck(vm.cache, codeID, envBin, ackBin, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
if err != nil {
return nil, gasUsed, err
}
Expand All @@ -422,7 +422,7 @@ func (vm *VM) IBCPacketAck(
// outgoing packet (previously sent by this contract) will provably never be executed.
// Usually handled like ack returning an error
func (vm *VM) IBCPacketTimeout(
code CodeID,
codeID CodeID,
env types.Env,
packet types.IBCPacket,
store KVStore,
Expand All @@ -439,7 +439,7 @@ func (vm *VM) IBCPacketTimeout(
if err != nil {
return nil, 0, err
}
data, gasUsed, err := api.IBCPacketTimeout(vm.cache, code, envBin, packetBin, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
data, gasUsed, err := api.IBCPacketTimeout(vm.cache, codeID, envBin, packetBin, &gasMeter, store, &goapi, &querier, gasLimit, vm.printDebug)
if err != nil {
return nil, gasUsed, err
}
Expand Down
4 changes: 2 additions & 2 deletions types/ibc.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package types

type IBCEndpoint struct {
PortId string `json:"port_id"`
ChannelId string `json:"channel_id"`
PortID string `json:"port_id"`
ChannelID string `json:"channel_id"`
}

type IBCChannel struct {
Expand Down
Loading

0 comments on commit faf0303

Please sign in to comment.