Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoximenes committed Nov 11, 2024
1 parent fea58f0 commit c28efbc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion system_tests/program_gas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func checkInkUsage(
toU256ByteSlice := func(i uint32) []byte {
arr := make([]byte, 32)
binary.BigEndian.PutUint32(arr[28:32], i)
return arr[:]
return arr
}

testName := fmt.Sprintf("%v_%v", signature, params)
Expand Down Expand Up @@ -88,18 +88,21 @@ func TestWriteResultGasUsage(t *testing.T) {
// writeResultEmpty doesn't return any value
signature := "writeResultEmpty()"
expectedInk := HOSTIO_INK + 16381*2
// #nosec G115
checkInkUsage(t, builder, stylusProgram, hostio, signature, nil, uint64(expectedInk))

// writeResult(uint256) returns an array of uint256
signature = "writeResult(uint256)"
numberOfElementsInReturnedArray := 10000
arrayOverhead := 32 + 32 // 32 bytes for the array length and 32 bytes for the array offset
expectedInk = HOSTIO_INK + (16381+55*(32*numberOfElementsInReturnedArray+arrayOverhead-32))*2
// #nosec G115
checkInkUsage(t, builder, stylusProgram, hostio, signature, []uint32{uint32(numberOfElementsInReturnedArray)}, uint64(expectedInk))

signature = "writeResult(uint256)"
numberOfElementsInReturnedArray = 0
expectedInk = HOSTIO_INK + (16381+55*(arrayOverhead-32))*2
// #nosec G115
checkInkUsage(t, builder, stylusProgram, hostio, signature, []uint32{uint32(numberOfElementsInReturnedArray)}, uint64(expectedInk))
}

Expand Down

0 comments on commit c28efbc

Please sign in to comment.