Skip to content

Commit

Permalink
Merge pull request #357 from notional-labs/gofumpt
Browse files Browse the repository at this point in the history
gofumpt
  • Loading branch information
webmaster128 authored Nov 23, 2022
2 parents 3d79105 + a42dcce commit eca88ad
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
7 changes: 4 additions & 3 deletions internal/api/callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,10 @@ type DBState struct {
}

// use this to create C.Db in two steps, so the pointer lives as long as the calling stack
// state := buildDBState(kv, callID)
// db := buildDB(&state, &gasMeter)
// // then pass db into some FFI function
//
// state := buildDBState(kv, callID)
// db := buildDB(&state, &gasMeter)
// // then pass db into some FFI function
func buildDBState(kv KVStore, callID uint64) DBState {
return DBState{
Store: kv,
Expand Down
12 changes: 8 additions & 4 deletions internal/api/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ import (
type frame []dbm.Iterator

// iteratorFrames contains one frame for each contract call, indexed by contract call ID.
var iteratorFrames = make(map[uint64]frame)
var iteratorFramesMutex sync.Mutex
var (
iteratorFrames = make(map[uint64]frame)
iteratorFramesMutex sync.Mutex
)

// this is a global counter for creating call IDs
var latestCallID uint64
var latestCallIDMutex sync.Mutex
var (
latestCallID uint64
latestCallIDMutex sync.Mutex
)

// startCall is called at the beginning of a contract call to create a new frame in iteratorFrames.
// It updates latestCallID for generating a new call ID.
Expand Down
1 change: 1 addition & 0 deletions internal/api/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func TestCreateAndDestroyUnmanagedVector(t *testing.T) {

// Like the test above but without `newUnmanagedVector` calls.
// Since only Rust can actually create them, we only test edge cases here.
//
//go:nocheckptr
func TestCopyDestroyUnmanagedVector(t *testing.T) {
{
Expand Down
6 changes: 4 additions & 2 deletions lib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ const (
TESTING_CACHE_SIZE = 100 // MiB
)

const CYBERPUNK_TEST_CONTRACT = "./testdata/cyberpunk.wasm"
const HACKATOM_TEST_CONTRACT = "./testdata/hackatom.wasm"
const (
CYBERPUNK_TEST_CONTRACT = "./testdata/cyberpunk.wasm"
HACKATOM_TEST_CONTRACT = "./testdata/hackatom.wasm"
)

func withVM(t *testing.T) *VM {
tmpdir, err := ioutil.TempDir("", "wasmvm-testing")
Expand Down
6 changes: 4 additions & 2 deletions types/ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ type IBCPacketTimeoutMsg struct {
type IBCOrder = string

// These are the only two valid values for IbcOrder
const Unordered = "ORDER_UNORDERED"
const Ordered = "ORDER_ORDERED"
const (
Unordered = "ORDER_UNORDERED"
Ordered = "ORDER_ORDERED"
)

// IBCTimeoutBlock Height is a monotonically increasing data type
// that can be compared against another Height for the purposes of updating and
Expand Down

0 comments on commit eca88ad

Please sign in to comment.