Skip to content

Commit 54d1c20

Browse files
authored
Merge pull request #21 from wemixarchive/gwemix
2 parents 862a2ff + 029bab9 commit 54d1c20

189 files changed

Lines changed: 4970 additions & 13916 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/gwemix-ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: gwemix-ci
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- gwemix
7+
8+
jobs:
9+
build_test:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
ref: ${{ github.event.pull_request.head.sha }}
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v3
18+
with:
19+
go-version: 1.19
20+
21+
- name: Build Go-WEMIX
22+
run: make gwemix.tar.gz
23+
- name: Check Build
24+
run: ls -al build/gwemix.tar.gz
25+
26+
lint_test:
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
version: [1.17, 1.18, 1.19]
31+
runs-on: ubuntu-20.04
32+
steps:
33+
- uses: actions/checkout@v3
34+
with:
35+
ref: ${{ github.event.pull_request.head.sha }}
36+
37+
- name: Set up Go
38+
uses: actions/setup-go@v3
39+
with:
40+
go-version: ${{ matrix.version }}
41+
42+
- name: Check Lint
43+
run: make lint
44+
45+
unit_test:
46+
runs-on: ubuntu-20.04
47+
steps:
48+
- uses: actions/checkout@v3
49+
with:
50+
ref: ${{ github.event.pull_request.head.sha }}
51+
52+
- name: Set up Go
53+
uses: actions/setup-go@v3
54+
with:
55+
go-version: 1.19
56+
57+
- name: Check golang Test Cases
58+
run: |
59+
unset ANDROID_HOME
60+
make test-short

.github/workflows/gwemix-cron.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: gwemix-cron
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
7+
jobs:
8+
build_test:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
ref: gwemix
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v3
17+
with:
18+
go-version: 1.19
19+
20+
- name: Build Go-IMN
21+
run: make gwemix.tar.gz
22+
- name: Check Build
23+
run: ls -al build/gwemix.tar.gz
24+
25+
lint_test:
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
version: [1.17, 1.18, 1.19]
30+
runs-on: ubuntu-20.04
31+
steps:
32+
- uses: actions/checkout@v3
33+
with:
34+
ref: gwemix
35+
36+
- name: Set up Go
37+
uses: actions/setup-go@v3
38+
with:
39+
go-version: ${{ matrix.version }}
40+
41+
- name: Check Lint
42+
run: make lint
43+
44+
unit_test:
45+
runs-on: ubuntu-20.04
46+
steps:
47+
- uses: actions/checkout@v3
48+
with:
49+
ref: gwemix
50+
51+
- name: Set up Go
52+
uses: actions/setup-go@v3
53+
with:
54+
go-version: 1.19
55+
56+
- name: Check golang Test Cases
57+
run: |
58+
unset ANDROID_HOME
59+
make test

.github/workflows/master-ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: master-ci
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build_test:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
ref: ${{ github.event.pull_request.head.sha }}
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v3
18+
with:
19+
go-version: 1.19
20+
21+
- name: Build Go-WEMIX
22+
run: make gwemix.tar.gz
23+
- name: Check Build
24+
run: ls -al build/gwemix.tar.gz
25+
26+
lint_test:
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
version: [1.17, 1.18, 1.19]
31+
runs-on: ubuntu-20.04
32+
steps:
33+
- uses: actions/checkout@v3
34+
with:
35+
ref: ${{ github.event.pull_request.head.sha }}
36+
37+
- name: Set up Go
38+
uses: actions/setup-go@v3
39+
with:
40+
go-version: ${{ matrix.version }}
41+
42+
- name: Check Lint
43+
run: make lint
44+
45+
unit_test:
46+
runs-on: ubuntu-20.04
47+
steps:
48+
- uses: actions/checkout@v3
49+
with:
50+
ref: ${{ github.event.pull_request.head.sha }}
51+
52+
- name: Set up Go
53+
uses: actions/setup-go@v3
54+
with:
55+
go-version: 1.19
56+
57+
- name: Check golang Test Cases
58+
run: |
59+
unset ANDROID_HOME
60+
make test

.golangci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ run:
88
skip-dirs-use-default: true
99
skip-files:
1010
- core/genesis_alloc.go
11+
- wemix/contracts/WemixGovernance.js
12+
- wemix/governance_abi.go
1113

1214
linters:
1315
disable-all: true
1416
enable:
15-
- deadcode
17+
# - deadcode
1618
- goconst
1719
- goimports
1820
- gosimple
@@ -22,7 +24,7 @@ linters:
2224
# - staticcheck
2325
- unconvert
2426
# - unused
25-
- varcheck
27+
# - varcheck
2628

2729
linters-settings:
2830
gofmt:

Dockerfile.wemix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# builder image
22

3-
FROM ubuntu:bionic as base
3+
FROM ubuntu:focal as base
44

55
SHELL ["/bin/bash", "-c"]
66

@@ -19,4 +19,6 @@ RUN curl -sL -o /tmp/go.tar.gz https://dl.google.com/go/$(curl -sL https://golan
1919

2020
RUN apt autoremove && apt autoclean
2121

22+
ENTRYPOINT ["/bin/bash", "-c"]
23+
2224
# EOF

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ ios:
8686
test: all
8787
$(GORUN) build/ci.go test
8888

89+
test-short: all
90+
$(GORUN) build/ci.go test -short
91+
8992
lint: wemix/governance_abi.go ## Run linters.
9093
$(GORUN) build/ci.go lint
9194

@@ -119,7 +122,8 @@ gwemix-linux:
119122
-f Dockerfile.wemix . && \
120123
docker run -e HOME=/tmp --rm -v $(shell pwd):/data \
121124
-w /data wemix/builder:local \
122-
make USE_ROCKSDB=$(USE_ROCKSDB); \
125+
"git config --global --add safe.directory /data;\
126+
make USE_ROCKSDB=$(USE_ROCKSDB)"; \
123127
fi
124128

125129
ifneq ($(USE_ROCKSDB), YES)

accounts/abi/abi_test.go

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,9 @@ func TestInvalidABI(t *testing.T) {
165165

166166
// TestConstructor tests a constructor function.
167167
// The test is based on the following contract:
168-
// contract TestConstructor {
169-
// constructor(uint256 a, uint256 b) public{}
168+
//
169+
// contract TestConstructor {
170+
// constructor(uint256 a, uint256 b) public{}
170171
// }
171172
func TestConstructor(t *testing.T) {
172173
json := `[{ "inputs": [{"internalType": "uint256","name": "a","type": "uint256" },{ "internalType": "uint256","name": "b","type": "uint256"}],"stateMutability": "nonpayable","type": "constructor"}]`
@@ -724,16 +725,19 @@ func TestBareEvents(t *testing.T) {
724725
}
725726

726727
// TestUnpackEvent is based on this contract:
727-
// contract T {
728-
// event received(address sender, uint amount, bytes memo);
729-
// event receivedAddr(address sender);
730-
// function receive(bytes memo) external payable {
731-
// received(msg.sender, msg.value, memo);
732-
// receivedAddr(msg.sender);
733-
// }
734-
// }
728+
//
729+
// contract T {
730+
// event received(address sender, uint amount, bytes memo);
731+
// event receivedAddr(address sender);
732+
// function receive(bytes memo) external payable {
733+
// received(msg.sender, msg.value, memo);
734+
// receivedAddr(msg.sender);
735+
// }
736+
// }
737+
//
735738
// When receive("X") is called with sender 0x00... and value 1, it produces this tx receipt:
736-
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
739+
//
740+
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
737741
func TestUnpackEvent(t *testing.T) {
738742
const abiJSON = `[{"constant":false,"inputs":[{"name":"memo","type":"bytes"}],"name":"receive","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"memo","type":"bytes"}],"name":"received","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"}],"name":"receivedAddr","type":"event"}]`
739743
abi, err := JSON(strings.NewReader(abiJSON))
@@ -1080,8 +1084,9 @@ func TestDoubleDuplicateMethodNames(t *testing.T) {
10801084
// TestDoubleDuplicateEventNames checks that if send0 already exists, there won't be a name
10811085
// conflict and that the second send event will be renamed send1.
10821086
// The test runs the abi of the following contract.
1083-
// contract DuplicateEvent {
1084-
// event send(uint256 a);
1087+
//
1088+
// contract DuplicateEvent {
1089+
// event send(uint256 a);
10851090
// event send0();
10861091
// event send();
10871092
// }
@@ -1108,7 +1113,8 @@ func TestDoubleDuplicateEventNames(t *testing.T) {
11081113
// TestUnnamedEventParam checks that an event with unnamed parameters is
11091114
// correctly handled.
11101115
// The test runs the abi of the following contract.
1111-
// contract TestEvent {
1116+
//
1117+
// contract TestEvent {
11121118
// event send(uint256, uint256);
11131119
// }
11141120
func TestUnnamedEventParam(t *testing.T) {

accounts/abi/bind/backends/simulated_test.go

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,17 @@ func TestSimulatedBackend(t *testing.T) {
9393

9494
var testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
9595

96-
// the following is based on this contract:
97-
// contract T {
98-
// event received(address sender, uint amount, bytes memo);
99-
// event receivedAddr(address sender);
96+
// the following is based on this contract:
97+
// contract T {
98+
// event received(address sender, uint amount, bytes memo);
99+
// event receivedAddr(address sender);
100100
//
101-
// function receive(bytes calldata memo) external payable returns (string memory res) {
102-
// emit received(msg.sender, msg.value, memo);
103-
// emit receivedAddr(msg.sender);
104-
// return "hello world";
105-
// }
106-
// }
101+
// function receive(bytes calldata memo) external payable returns (string memory res) {
102+
// emit received(msg.sender, msg.value, memo);
103+
// emit receivedAddr(msg.sender);
104+
// return "hello world";
105+
// }
106+
// }
107107
const abiJSON = `[ { "constant": false, "inputs": [ { "name": "memo", "type": "bytes" } ], "name": "receive", "outputs": [ { "name": "res", "type": "string" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "sender", "type": "address" }, { "indexed": false, "name": "amount", "type": "uint256" }, { "indexed": false, "name": "memo", "type": "bytes" } ], "name": "received", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "sender", "type": "address" } ], "name": "receivedAddr", "type": "event" } ]`
108108
const abiBin = `0x608060405234801561001057600080fd5b506102a0806100206000396000f3fe60806040526004361061003b576000357c010000000000000000000000000000000000000000000000000000000090048063a69b6ed014610040575b600080fd5b6100b76004803603602081101561005657600080fd5b810190808035906020019064010000000081111561007357600080fd5b82018360208201111561008557600080fd5b803590602001918460018302840111640100000000831117156100a757600080fd5b9091929391929390505050610132565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f75780820151818401526020810190506100dc565b50505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60607f75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed33348585604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509550505050505060405180910390a17f46923992397eac56cf13058aced2a1871933622717e27b24eabc13bf9dd329c833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a16040805190810160405280600b81526020017f68656c6c6f20776f726c6400000000000000000000000000000000000000000081525090509291505056fea165627a7a72305820ff0c57dad254cfeda48c9cfb47f1353a558bccb4d1bc31da1dae69315772d29e0029`
109109
const deployedCode = `60806040526004361061003b576000357c010000000000000000000000000000000000000000000000000000000090048063a69b6ed014610040575b600080fd5b6100b76004803603602081101561005657600080fd5b810190808035906020019064010000000081111561007357600080fd5b82018360208201111561008557600080fd5b803590602001918460018302840111640100000000831117156100a757600080fd5b9091929391929390505050610132565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f75780820151818401526020810190506100dc565b50505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60607f75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed33348585604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509550505050505060405180910390a17f46923992397eac56cf13058aced2a1871933622717e27b24eabc13bf9dd329c833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a16040805190810160405280600b81526020017f68656c6c6f20776f726c6400000000000000000000000000000000000000000081525090509291505056fea165627a7a72305820ff0c57dad254cfeda48c9cfb47f1353a558bccb4d1bc31da1dae69315772d29e0029`
@@ -995,7 +995,8 @@ func TestCodeAt(t *testing.T) {
995995
}
996996

997997
// When receive("X") is called with sender 0x00... and value 1, it produces this tx receipt:
998-
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
998+
//
999+
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
9991000
func TestPendingAndCallContract(t *testing.T) {
10001001
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
10011002
sim := simTestBackend(testAddr)
@@ -1206,10 +1207,11 @@ func TestFork(t *testing.T) {
12061207
Example contract to test event emission:
12071208
12081209
pragma solidity >=0.7.0 <0.9.0;
1209-
contract Callable {
1210-
event Called();
1211-
function Call() public { emit Called(); }
1212-
}
1210+
1211+
contract Callable {
1212+
event Called();
1213+
function Call() public { emit Called(); }
1214+
}
12131215
*/
12141216
const callableAbi = "[{\"anonymous\":false,\"inputs\":[],\"name\":\"Called\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"Call\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
12151217

@@ -1227,6 +1229,7 @@ const callableBin = "6080604052348015600f57600080fd5b5060998061001e6000396000f3f
12271229
// 7. Mine two blocks to trigger a reorg.
12281230
// 8. Check that the event was removed.
12291231
// 9. Re-send the transaction and mine a block.
1232+
//
12301233
// 10. Check that the event was reborn.
12311234
func TestForkLogsReborn(t *testing.T) {
12321235
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)

accounts/abi/bind/bind_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,10 @@ var bindTests = []struct {
19601960
// Tests that packages generated by the binder can be successfully compiled and
19611961
// the requested tester run against it.
19621962
func TestGolangBindings(t *testing.T) {
1963+
if testing.Short() {
1964+
t.Skip("skipping test in short mode")
1965+
}
1966+
19631967
// Skip the test if no Go command can be found
19641968
gocmd := runtime.GOROOT() + "/bin/go"
19651969
if !common.FileExist(gocmd) {

0 commit comments

Comments
 (0)