Skip to content

Commit 6fdb52d

Browse files
authored
Merge pull request #98 from hyperledger-labs/hardhat-config
Update solidity compiler version; Remove local array sort() impl
2 parents edb7252 + 81aff0f commit 6fdb52d

File tree

7 files changed

+12
-92
lines changed

7 files changed

+12
-92
lines changed

.github/workflows/e2e.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ jobs:
6161
npm install
6262
npm run gen
6363
64+
- name: Set up Go
65+
uses: actions/setup-go@v5
66+
with:
67+
go-version: 1.23
68+
6469
- name: Run golang e2e tests
6570
env:
6671
PROVING_KEYS_ROOT: ${{ runner.temp }}/zeto-artifacts

.github/workflows/golang.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
fetch-depth: 0
1919

2020
- name: Set up Go
21-
uses: actions/setup-go@v4
21+
uses: actions/setup-go@v5
2222
with:
23-
go-version: 1.22
23+
go-version: 1.23
2424

2525
- name: Build and Test
2626
working-directory: go-sdk

go-sdk/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ coverage: test coverage.html
1818
lint: ${LINT}
1919
GOGC=20 $(LINT) run -v --timeout 5m
2020
${LINT}:
21-
$(VGO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.0
21+
$(VGO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0
2222
go-mod-tidy: .ALWAYS
2323
$(VGO) mod tidy
2424
e2e: test

go-sdk/go.sum

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
8888
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
8989
github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJzfthRT6usrui8uGmg=
9090
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
91-
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
92-
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
9391
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
9492
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
9593
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
@@ -99,16 +97,10 @@ golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
9997
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
10098
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
10199
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
102-
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
103-
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
104100
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
105101
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
106-
golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM=
107-
golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8=
108102
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
109103
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
110-
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
111-
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
112104
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
113105
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
114106
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

solidity/contracts/lib/common.sol

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -59,82 +59,4 @@ library Commonlib {
5959

6060
return keccak256(abi.encodePacked(inputs));
6161
}
62-
63-
// copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Arrays.sol
64-
// until it's available in a new release
65-
function sort(
66-
uint256[] memory array
67-
) internal pure returns (uint256[] memory) {
68-
bytes32[] memory bytes32Array = _castToBytes32Array(array);
69-
_quickSort(_begin(bytes32Array), _end(bytes32Array), _defaultComp);
70-
return array;
71-
}
72-
73-
function _castToBytes32Array(
74-
uint256[] memory input
75-
) private pure returns (bytes32[] memory output) {
76-
assembly {
77-
output := input
78-
}
79-
}
80-
81-
function _defaultComp(bytes32 a, bytes32 b) private pure returns (bool) {
82-
return a < b;
83-
}
84-
85-
function _begin(bytes32[] memory array) private pure returns (uint256 ptr) {
86-
/// @solidity memory-safe-assembly
87-
assembly {
88-
ptr := add(array, 0x20)
89-
}
90-
}
91-
92-
function _end(bytes32[] memory array) private pure returns (uint256 ptr) {
93-
unchecked {
94-
return _begin(array) + array.length * 0x20;
95-
}
96-
}
97-
98-
function _mload(uint256 ptr) private pure returns (bytes32 value) {
99-
assembly {
100-
value := mload(ptr)
101-
}
102-
}
103-
104-
function _swap(uint256 ptr1, uint256 ptr2) private pure {
105-
assembly {
106-
let value1 := mload(ptr1)
107-
let value2 := mload(ptr2)
108-
mstore(ptr1, value2)
109-
mstore(ptr2, value1)
110-
}
111-
}
112-
113-
function _quickSort(
114-
uint256 begin,
115-
uint256 end,
116-
function(bytes32, bytes32) pure returns (bool) comp
117-
) private pure {
118-
unchecked {
119-
if (end - begin < 0x40) return;
120-
121-
// Use first element as pivot
122-
bytes32 pivot = _mload(begin);
123-
// Position where the pivot should be at the end of the loop
124-
uint256 pos = begin;
125-
126-
for (uint256 it = begin + 0x20; it < end; it += 0x20) {
127-
if (comp(_mload(it), pivot)) {
128-
// If the value stored at the iterator's position comes before the pivot, we increment the
129-
// position of the pivot and move the value there.
130-
pos += 0x20;
131-
_swap(pos, it);
132-
}
133-
}
134-
135-
_swap(begin, pos); // Swap pivot into place
136-
_quickSort(begin, pos, comp); // Sort the left side of the pivot
137-
_quickSort(pos + 0x20, end, comp); // Sort the right side of the pivot
138-
}
139-
}
14062
}

solidity/contracts/lib/zeto_common.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pragma solidity ^0.8.20;
1717

1818
import {Commonlib} from "./common.sol";
1919
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
20+
import {Arrays} from "@openzeppelin/contracts/utils/Arrays.sol";
2021
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
2122

2223
/// @title A sample base implementation of a Zeto based token contract
@@ -101,8 +102,8 @@ abstract contract ZetoCommon is OwnableUpgradeable {
101102
for (uint256 i = 0; i < outputs.length; ++i) {
102103
sortedOutputs[i] = outputs[i];
103104
}
104-
sortedInputs = Commonlib.sort(sortedInputs);
105-
sortedOutputs = Commonlib.sort(sortedOutputs);
105+
sortedInputs = Arrays.sort(sortedInputs);
106+
sortedOutputs = Arrays.sort(sortedOutputs);
106107
return (sortedInputs, sortedOutputs);
107108
}
108109
}

solidity/hardhat.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const keys = [
2929

3030
const config: HardhatUserConfig = {
3131
solidity: {
32-
version: "0.8.20",
32+
version: "0.8.27",
3333
settings: {
3434
optimizer: {
3535
enabled: false,

0 commit comments

Comments
 (0)