Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rc/v1.6.0 #248

Merged
merged 403 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
403 commits
Select commit Hold shift + click to select a range
70e05a6
FIX: After review
mariusmihaic Mar 3, 2023
ed891d8
Merge pull request #176 from multiversx/MX-13914-outport-driver-refac…
mariusmihaic Mar 6, 2023
1844782
Merge branch 'rc/v1.6.0' into merge-rc-1.6.0-in-outport
miiu96 Mar 6, 2023
9a6ee8f
Merge pull request #177 from multiversx/merge-rc-1.6.0-in-outport
miiu96 Mar 6, 2023
df72c4d
get header from bytes
miiu96 Mar 6, 2023
9272fda
comment
miiu96 Mar 6, 2023
b1e3f79
Merge pull request #129 from multiversx/multikey-integration
iulianpascalau Mar 6, 2023
3cedc44
Merge branch 'rc/v1.6.0' into pubkeyconverter_v2
schimih Mar 8, 2023
5262fb0
Merge pull request #179 from multiversx/merge_rc/v1.6.0_in_pubkey_con…
schimih Mar 8, 2023
40b4cde
remove unused ValueWithoutSuffix()
BeniaminDrasovean Mar 8, 2023
beb6eff
add string representation for trie node versions
BeniaminDrasovean Mar 8, 2023
222b64e
outport block with header
miiu96 Mar 9, 2023
e69a880
FIX: Add LogData back
mariusmihaic Mar 14, 2023
123c98a
Merge pull request #181 from multiversx/MX-13968-restore-logdata
mariusmihaic Mar 14, 2023
738e9d5
pointer
miiu96 Mar 14, 2023
fd8cede
Merge branch 'feat/outport-block' into get-header-from-bytes
miiu96 Mar 14, 2023
cdd3af9
fix structure
miiu96 Mar 14, 2023
bc95bbc
FEAT: Add SetExecutionOrder
mariusmihaic Mar 15, 2023
422b1c8
FEAT: Add GetTxHandler + refactor tx sorter
mariusmihaic Mar 15, 2023
c80db23
FEAT: Add TxWithExecutionOrderHandler
mariusmihaic Mar 16, 2023
a74906d
FIX: tx sorter
mariusmihaic Mar 16, 2023
f4a7382
FIX: maxMachineIDLen
mariusmihaic Mar 16, 2023
0e37ee2
Merge branch 'rc/v1.6.0' into merge-rc-into-feat-outport-16-mar-2023
mariusmihaic Mar 16, 2023
ea84e80
Merge pull request #183 from multiversx/merge-rc-into-feat-outport-16…
mariusmihaic Mar 16, 2023
94217bd
Merge branch 'feat/outport-block' into get-header-from-bytes
mariusmihaic Mar 16, 2023
50f695c
FEAT: Add GetMarshaller for drivers
mariusmihaic Mar 17, 2023
f33f5f1
FEAT: Add HeaderDataWithBody
mariusmihaic Mar 17, 2023
5821e95
FEAT: Add GetBody + GetHeaderBytesAndType
mariusmihaic Mar 17, 2023
4762661
FEAT: Add OutportBlockWithHeaderAndBody
mariusmihaic Mar 17, 2023
c89f543
FIX: Refactor HeaderDataWithBody
mariusmihaic Mar 17, 2023
dee5a51
FIX: Refactor OutportBlockWithHeaderAndBody
mariusmihaic Mar 17, 2023
03a7f3c
FIX: Import cycle
mariusmihaic Mar 17, 2023
b83f1fd
FEAT: Add ConvertPubKeys
mariusmihaic Mar 17, 2023
be2a279
CLN: Remove TransactionHandlerWithGasAndFee
mariusmihaic Mar 20, 2023
1ac37b3
FEAT: Unit tests
mariusmihaic Mar 20, 2023
26e5268
Merge pull request #136 from multiversx/pubkeyConverter-refactor-v2
schimih Mar 20, 2023
a7472d8
Merge branch 'rc/v1.6.0' into merge-rc-1.6-in-feat-outport
miiu96 Mar 21, 2023
f0e4cc8
Merge pull request #186 from multiversx/merge-rc-1.6-in-feat-outport
miiu96 Mar 21, 2023
19c4c93
Merge branch 'feat/outport-block' into get-header-from-bytes
miiu96 Mar 21, 2023
78c8e00
FIX: Refactor Logs to slice instead of map
mariusmihaic Mar 22, 2023
35195fa
Merge remote-tracking branch 'origin/get-header-from-bytes' into get-…
mariusmihaic Mar 22, 2023
196dc06
FIX: After review
mariusmihaic Mar 23, 2023
c05cab3
FEAT: Add outport ws client
mariusmihaic Mar 23, 2023
6d6a101
FIX: Url
mariusmihaic Mar 23, 2023
1ee28fb
FIX: waitForAckSignal + add PayloadParser
mariusmihaic Mar 23, 2023
0a9f071
FEAT: Add ws connection client
mariusmihaic Mar 23, 2023
466e7c1
FIX: Close connection
mariusmihaic Mar 23, 2023
bb637fa
Merge pull request #178 from multiversx/get-header-from-bytes
mariusmihaic Mar 24, 2023
a38e275
Merge branch 'feat/outport-block' into MX-13998-ws-connection
mariusmihaic Mar 24, 2023
f09a799
FEAT: Add RetryDuration as param
mariusmihaic Mar 24, 2023
d8fc142
FEAT: Add BlockingAckOnError
mariusmihaic Mar 24, 2023
129b647
FIX: Log
mariusmihaic Mar 24, 2023
08c11d7
FIX: Comments
mariusmihaic Mar 24, 2023
40af92e
- refactored switch in GetHeaderFromBytes function
iulianpascalau Mar 27, 2023
247801d
- removed un-needed parameter
iulianpascalau Mar 27, 2023
13c3df5
- re-used existing error
iulianpascalau Mar 27, 2023
080a954
Merge pull request #190 from multiversx/refactor-switch-in-unmarshall…
iulianpascalau Mar 27, 2023
574f7c2
Merge branch 'feat/outport-block' into MX-13998-ws-connection
mariusmihaic Mar 27, 2023
937ec46
FIX: After review 1
mariusmihaic Mar 27, 2023
32d7893
FIX: After review 2
mariusmihaic Mar 27, 2023
4cee13f
FIX: Import cycle
mariusmihaic Mar 28, 2023
4329e72
FEAT: Unit tests
mariusmihaic Mar 28, 2023
9af9adc
FIX: Unit test
mariusmihaic Mar 28, 2023
f2cf05b
FIX: Unit test
mariusmihaic Mar 28, 2023
34b385f
FIX: Unused err
mariusmihaic Mar 28, 2023
c9ebe2d
Merge pull request #189 from multiversx/MX-13998-ws-connection
mariusmihaic Mar 29, 2023
9d28d12
FEAT: Add IsInterfaceNil
mariusmihaic Mar 29, 2023
b78e96c
FEAT: Add ws factory
mariusmihaic Mar 29, 2023
9150ec3
add func that returns the trie node version for newly added data
BeniaminDrasovean Mar 29, 2023
3a1b49c
FIX: Add comms
mariusmihaic Mar 29, 2023
6d23193
FIX: Add log.Trace
mariusmihaic Mar 29, 2023
7219215
add unit tests
BeniaminDrasovean Mar 29, 2023
a0fe05b
- added unit tests for wsConnClient + refactored the code, so it is l…
iulianpascalau Mar 29, 2023
8b66467
- fix after review
iulianpascalau Mar 29, 2023
cf34f43
FIX: After review
mariusmihaic Mar 29, 2023
d8a6548
Merge pull request #192 from multiversx/MX-13998-ws-connection-2
mariusmihaic Mar 30, 2023
3f3d6bf
Merge branch 'feat/outport-block' into test-for-ws-conn-client
mariusmihaic Mar 30, 2023
932a718
Merge pull request #193 from multiversx/test-for-ws-conn-client
mariusmihaic Mar 30, 2023
916b16d
moved some errors and err checks to core
BeniaminDrasovean Apr 3, 2023
a0f2767
Merge branch 'rc/v1.6.0' into migrate-data-trie
BeniaminDrasovean Apr 4, 2023
a7839ec
Merge branch 'rc/v1.6.0' into extend-tx-cost-response
miiu96 Apr 4, 2023
6af7ad1
new web sockets component
miiu96 Apr 10, 2023
19fcb3a
integrate new ws client/server
miiu96 Apr 10, 2023
b561f0e
fix
miiu96 Apr 10, 2023
54c3b52
move interface
miiu96 Apr 10, 2023
93be4e0
logger
miiu96 Apr 10, 2023
8e9d4e7
refactor listeners part
miiu96 Apr 10, 2023
e61e6c3
small refactoring
miiu96 Apr 11, 2023
0083cf9
fixes and small refactoring
miiu96 Apr 11, 2023
6e48768
nil check for clientServer receiver
miiu96 Apr 11, 2023
bcfde6e
renaming and extra checks
miiu96 Apr 11, 2023
e1f2714
unit tests client sender
miiu96 Apr 11, 2023
f8d09b0
comments and rename interface
miiu96 Apr 11, 2023
4c329e5
fix race
miiu96 Apr 11, 2023
90d9a72
unit test server receiver
miiu96 Apr 11, 2023
ed395b4
change package name
miiu96 Apr 11, 2023
994f165
small fix
miiu96 Apr 12, 2023
b48b7b4
fixes
miiu96 Apr 12, 2023
ff30fe2
more fixes
miiu96 Apr 12, 2023
3d7236f
one more fix
miiu96 Apr 12, 2023
c9a2ae7
refactoring
miiu96 Apr 12, 2023
f77a5cf
fix unit test
miiu96 Apr 19, 2023
d5baba2
FEAT: Add error on ws closing
mariusmihaic Apr 20, 2023
983f8e8
FEAT: Test for double close
mariusmihaic Apr 20, 2023
9cb38ed
Merge pull request #200 from multiversx/MX-14107-error-on-closing-ws
mariusmihaic Apr 20, 2023
b0aa352
Merge branch 'rc/v1.5.0' into update-rc-v1.6.0-rc-v1.5.0-2023.04.21
iulianpascalau Apr 21, 2023
792f0ca
- fixes after merge
iulianpascalau Apr 21, 2023
43ef5c8
- fixed transaction struct definition + added unit test
iulianpascalau Apr 21, 2023
9c03b1f
Merge pull request #204 from multiversx/update-rc-v1.6.0-rc-v1.5.0-20…
iulianpascalau Apr 24, 2023
2e31996
Merge branch 'rc/v1.6.0' into migrate-data-trie
BeniaminDrasovean Apr 24, 2023
d7cca0a
Merge branch 'rc/v1.6.0' into save-toml-file
ssd04 Apr 25, 2023
af3f191
refactor 1
miiu96 Apr 26, 2023
2a61399
holder
miiu96 Apr 26, 2023
3765392
remove utils package
miiu96 Apr 26, 2023
34005f0
more unit tests
miiu96 Apr 26, 2023
479f49d
more unit tests
miiu96 Apr 27, 2023
a9684f5
Merge branch 'feat/outport-block' into refactor-ws-componnents
miiu96 Apr 27, 2023
dd1e3ed
remove
miiu96 Apr 27, 2023
ebddcb8
fix rare condition from tests
miiu96 Apr 27, 2023
e3e1025
unit tests and fixes
miiu96 Apr 27, 2023
1e09975
comments
miiu96 Apr 27, 2023
30177d5
added unit test for save and load toml file
ssd04 Apr 28, 2023
79fc6ec
Merge pull request #169 from multiversx/save-toml-file
ssd04 Apr 28, 2023
84859a5
integration tests ws host
miiu96 Apr 28, 2023
76e19ec
extend ESDTSUpply structure
bogdan-rosianu Apr 28, 2023
bf5f711
fixes after review
miiu96 May 2, 2023
8507aac
refactor listen method server
miiu96 May 2, 2023
12f47b3
Merge branch 'refactor-ws-componnents' into integration-tests-ws-sock…
miiu96 May 2, 2023
06ede90
fix integration tests
miiu96 May 3, 2023
5abf91c
remove unused func
miiu96 May 3, 2023
897c3bc
fixes after re review
miiu96 May 3, 2023
536a29a
Merge branch 'refactor-ws-componnents' into integration-tests-ws-sock…
miiu96 May 3, 2023
89dd8a8
fix tests
miiu96 May 3, 2023
f16d51f
fixes after second review
miiu96 May 3, 2023
e15018f
small fix
miiu96 May 3, 2023
f68f490
Merge branch 'refactor-ws-componnents' into integration-tests-ws-sock…
miiu96 May 3, 2023
e201db1
fixes after review
miiu96 May 3, 2023
11be87d
move getNodeFromDB error to core
BeniaminDrasovean May 4, 2023
70b8f74
more unit tests and remove unused component
miiu96 May 4, 2023
f67a208
add IsInterfaceNil() to GetNodeFromDbErrHandler
BeniaminDrasovean May 4, 2023
f3ac5cd
small fix
miiu96 May 4, 2023
e7c34e5
fixes after re re review
miiu96 May 4, 2023
5fb3f91
small fix
miiu96 May 4, 2023
0a0bd03
Merge pull request #207 from multiversx/refactor-ws-componnents
miiu96 May 4, 2023
45fb2fc
Merge branch 'feat/web-socket-host' into integration-tests-ws-sockets…
miiu96 May 4, 2023
a0a8a97
fixes after merge
miiu96 May 4, 2023
10427cf
integration tests and fixes
miiu96 May 4, 2023
454bb16
fix unit test
miiu96 May 4, 2023
9d3e55b
remove func
miiu96 May 4, 2023
b302ef7
fix test
miiu96 May 4, 2023
9408d86
integration tests and fixes
miiu96 May 5, 2023
ec39028
fixes after first review
miiu96 May 5, 2023
1e30ee6
fix interface
miiu96 May 5, 2023
2cb4975
small fix
miiu96 May 5, 2023
617de03
fix compile
miiu96 May 5, 2023
56ed532
fixes after second review
miiu96 May 5, 2023
52cd4fe
Merge pull request #208 from multiversx/integration-tests-ws-sockets-…
miiu96 May 5, 2023
c0abe69
refactor payload converter
miiu96 May 8, 2023
e06f808
empty line
miiu96 May 8, 2023
4919330
rename and unit tests
miiu96 May 8, 2023
66623a0
small fix
miiu96 May 8, 2023
781ef6c
fixes after second review
miiu96 May 9, 2023
f6740bd
fixes after re review
miiu96 May 9, 2023
e9c9024
fix interface
miiu96 May 9, 2023
181af62
refactor
miiu96 May 9, 2023
ce7dc56
small fix
miiu96 May 9, 2023
7a0e0a1
Merge pull request #211 from multiversx/refactor-payload-converter
miiu96 May 9, 2023
ab37792
remove web socket part
miiu96 May 10, 2023
b77309a
Merge pull request #227 from multiversx/remove-ws-part
miiu96 May 11, 2023
83cfe47
remove
miiu96 May 11, 2023
8af904d
Merge pull request #228 from multiversx/remove-unused-stub
miiu96 May 11, 2023
7481d65
Merge pull request #212 from multiversx/feat/web-socket-host
miiu96 May 11, 2023
7e8d9f2
Merge branch 'rc/v1.6.0' into merge-rc-in-feat-outport
miiu96 May 12, 2023
49f5cff
fixs after merge
miiu96 May 12, 2023
fbb3891
Merge pull request #229 from multiversx/merge-rc-in-feat-outport
miiu96 May 12, 2023
2a2e00c
Merge branch 'rc/v1.6.0' into move-getNodeFromDb-err-in-core
BeniaminDrasovean May 12, 2023
5d1b41f
Merge branch 'rc/v1.6.0' into extend-tx-cost-response
miiu96 May 16, 2023
a5d723a
fix after review
BeniaminDrasovean May 16, 2023
0160e1d
unexport getNodeFromDBErrWithKey struct
BeniaminDrasovean May 16, 2023
3ef52aa
Merge pull request #209 from multiversx/MX-14120-tokens-supplies-reco…
bogdan-rosianu May 17, 2023
1ac901f
Merge branch 'rc/v1.6.0' into extend-tx-cost-response
miiu96 May 17, 2023
78d898f
FIX: Proto to be integrated externally + remove ImportDB
mariusmihaic May 17, 2023
ef2ed05
Merge branch 'rc/v1.6.0' into merge-rc-1-6-into-outport
mariusmihaic May 17, 2023
1731907
Merge pull request #231 from multiversx/merge-rc-1-6-into-outport
mariusmihaic May 17, 2023
2e54a17
Merge pull request #230 from multiversx/MX-14179-outport-cleanup
mariusmihaic May 17, 2023
784e3a7
align comment with function name
BeniaminDrasovean May 18, 2023
bf27890
Merge branch 'rc/v1.6.0' into move-getNodeFromDb-err-in-core
BeniaminDrasovean May 18, 2023
ea72c61
Merge pull request #171 from multiversx/feat/outport-block
miiu96 May 19, 2023
c3dce2b
Merge branch 'rc/v1.6.0' into extend-tx-cost-response
miiu96 May 19, 2023
5fe96e7
Merge branch 'rc/v1.6.0' into migrate-data-trie
BeniaminDrasovean May 23, 2023
215d9ab
Merge branch 'rc/v1.6.0' into move-getNodeFromDb-err-in-core
BeniaminDrasovean May 23, 2023
510d597
Merge pull request #195 from multiversx/move-getNodeFromDb-err-in-core
BeniaminDrasovean May 24, 2023
e8d67ec
Merge branch 'rc/v1.6.0' into extend-tx-cost-response
miiu96 May 24, 2023
eca6003
Merge remote-tracking branch 'origin/rc/v1.6.0' into migrate-data-trie
BeniaminDrasovean May 24, 2023
b03d8ef
- added outport config definition
iulianpascalau May 26, 2023
780f9ac
log entry api changes
matei-p May 29, 2023
433a5a8
fix after review
BeniaminDrasovean May 29, 2023
aae535c
Update core/trie.go
BeniaminDrasovean May 29, 2023
79811ad
fix typo
BeniaminDrasovean May 29, 2023
223d482
extra topic
miiu96 May 29, 2023
6b256b0
added extra field
matei-p May 30, 2023
8ae64cc
Merge pull request #174 from multiversx/migrate-data-trie
BeniaminDrasovean May 30, 2023
a92bb58
Merge branch 'rc/v1.6.0' into extend-tx-cost-response
miiu96 May 30, 2023
b7bc17b
fixes after review
matei-p May 31, 2023
007c2c9
Merge pull request #235 from multiversx/log_events
matei-p Jun 6, 2023
8b420aa
Merge branch 'rc/v1.6.0' into handle-settings-in-outport-driver
miiu96 Jun 7, 2023
bdd97c2
empty line
miiu96 Jun 14, 2023
e2c6ce5
Merge remote-tracking branch 'origin/handle-settings-in-outport-drive…
miiu96 Jun 14, 2023
6e47b0d
fix comment
miiu96 Jun 14, 2023
62998ec
Merge pull request #234 from multiversx/handle-settings-in-outport-dr…
miiu96 Jun 14, 2023
3f73637
Merge branch 'rc/v1.6.0' into extend-tx-cost-response
miiu96 Jun 29, 2023
96880f1
fix comment
miiu96 Jun 30, 2023
fdbff99
fix comment
miiu96 Jul 3, 2023
063d4f7
Merge pull request #164 from multiversx/extend-tx-cost-response
miiu96 Jul 3, 2023
9bca4fc
Merge branch 'rc/v1.6.0' into rc16toLogEvents
matei-p Jul 3, 2023
b44c0e7
Merge pull request #239 from multiversx/rc16toLogEvents
matei-p Jul 4, 2023
70c7164
Merge branch 'rc/v1.6.0' into const-for-internal-vm-errors-identifier
miiu96 Jul 6, 2023
049df93
status info structure
miiu96 Jul 6, 2023
0859235
fix comment
miiu96 Jul 10, 2023
c57a59e
Merge pull request #238 from multiversx/const-for-internal-vm-errors-…
miiu96 Jul 11, 2023
1d9ec14
Merge branch 'rc/v1.6.0' into mergeFromLogEvents
matei-p Jul 11, 2023
8fbe8e7
update Events structure
matei-p Jul 11, 2023
9d7bbfa
Merge pull request #241 from multiversx/mergeFromLogEvents
matei-p Jul 12, 2023
dfcbcfa
extend structure
miiu96 Jul 12, 2023
e818eaa
extend HeaderDataWithBody
miiu96 Jul 12, 2023
151607a
extend HeaderDataWithBody
miiu96 Jul 19, 2023
30f63c3
Shard structure
miiu96 Jul 19, 2023
ba37de1
settings
miiu96 Jul 19, 2023
8ec78ab
Merge pull request #242 from multiversx/extend-block-data-proto-struc…
miiu96 Jul 25, 2023
beb80df
Merge branch 'rc/v1.6.0' into extend-ourport-structure-with-shard-id
miiu96 Jul 25, 2023
a34bd6d
fixes after merge
miiu96 Jul 25, 2023
a72af3e
Merge pull request #244 from multiversx/extend-ourport-structure-with…
miiu96 Aug 10, 2023
29ed857
- new go definition in go.mod
iulianpascalau Aug 16, 2023
01ecb8e
- added golang ci linter + updated go version
iulianpascalau Aug 16, 2023
133da66
- fixed workflow
iulianpascalau Aug 16, 2023
d5c45fd
Merge pull request #251 from multiversx/go-mod-update
iulianpascalau Aug 17, 2023
c721256
Merge branch 'rc/v1.6.0' into merge-rc-in-feat-logs
miiu96 Aug 17, 2023
6b5a05d
Merge pull request #253 from multiversx/merge-rc-in-feat-logs
miiu96 Aug 17, 2023
042db39
Merge pull request #252 from multiversx/feat/logEvents
miiu96 Aug 28, 2023
a3caa49
extend additional data structure
miiu96 Aug 30, 2023
028435c
remove code field
miiu96 Aug 30, 2023
9a1f804
extend api block structure
miiu96 Aug 31, 2023
30b2efe
remove
miiu96 Aug 31, 2023
5bdc450
Merge pull request #259 from multiversx/extend-additional-data
miiu96 Sep 6, 2023
b4a35a2
- fixed linter issues in tests
iulianpascalau Oct 23, 2023
83c55f3
- added empty line
iulianpascalau Oct 23, 2023
1a5c79a
- changed test
iulianpascalau Oct 23, 2023
e7c4fba
Merge pull request #268 from multiversx/fix-linter-in-tests
iulianpascalau Oct 24, 2023
1cb1d0d
remove 'omitempty' for the guarded api field
bogdan-rosianu Nov 6, 2023
28265ab
Merge pull request #271 from multiversx/remove-omitempty-guarded-api-…
raduchis Nov 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: golangci-lint
on:
push:
branches:
- main
pull_request:
branches: [ main, feat/*, rc/* ]

permissions:
contents: read

jobs:
golangci:
name: golangci linter
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.20.7
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.53.2

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
args: --timeout 10m0s --max-issues-per-linter 0 --max-same-issues 0 --print-issued-lines

# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true

# Optional: if set to true then the action will use pre-installed Go
# skip-go-installation: true
11 changes: 6 additions & 5 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: Tests

on:
push:
branches: [ main, development, feat/*, rc/* ]
pull_request:
branches: [ main, development, feat/*, rc/* ]
branches: [ main, rc/*, feat/* ]
types: [ opened, ready_for_review ]
push:
workflow_dispatch:

jobs:
test:
name: Unit
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.17.6
- name: Set up Go 1.20.7
uses: actions/setup-go@v3
with:
go-version: 1.17.6
go-version: 1.20.7
id: go

- name: Check out code
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@
# Dependency directories
/vendor

# IDE files
.idea/

# Go workspace file
go.work

.idea
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
test:
@echo " > Running unit tests"
go test -cover -race -coverprofile=coverage.txt -covermode=atomic -v ./...

lint-install:
ifeq (,$(wildcard test -f bin/golangci-lint))
@echo "Installing golint"
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s
endif

run-lint:
@echo "Running golint"
bin/golangci-lint run --max-issues-per-linter 0 --max-same-issues 0 --timeout=2m

lint: lint-install run-lint
15 changes: 15 additions & 0 deletions core/check/ifHrp.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package check

// IfHrp tests if the provided string is human readable - does contain only alphabetic characters
func IfHrp(s string) bool {
if s == "" {
return false
}

for _, r := range s {
if (r < 'a' || r > 'z') && (r < 'A' || r > 'Z') {
return false
}
}
return true
}
25 changes: 25 additions & 0 deletions core/check/ifHrp_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package check_test

import (
"testing"

"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/stretchr/testify/assert"
)

func TestCheckIfHRP_ShouldWork(t *testing.T) {
t.Parallel()

assert.True(t, check.IfHrp("abc"))
assert.True(t, check.IfHrp("Abc"))
assert.False(t, check.IfHrp("abc1"))
assert.False(t, check.IfHrp("abc/"))
assert.False(t, check.IfHrp("/t"))
assert.False(t, check.IfHrp("!t"))
assert.False(t, check.IfHrp(".t"))
assert.False(t, check.IfHrp("`t"))
assert.False(t, check.IfHrp(""))
assert.False(t, check.IfHrp("123()"))
assert.False(t, check.IfHrp(" "))
assert.False(t, check.IfHrp(" "))
}
15 changes: 15 additions & 0 deletions core/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ const AllShardId = uint32(0xFFFFFFF0)
// MegabyteSize represents the size in bytes of a megabyte
const MegabyteSize = 1024 * 1024

// MaxMachineIDLen is the maximum machine ID length
const MaxMachineIDLen = 10

// BuiltInFunctionClaimDeveloperRewards is the key for the claim developer rewards built-in function
const BuiltInFunctionClaimDeveloperRewards = "ClaimDeveloperRewards"

Expand Down Expand Up @@ -126,6 +129,9 @@ const BuiltInFunctionGuardAccount = "GuardAccount"
// BuiltInFunctionUnGuardAccount is the built-in function key for un-guarding an account
const BuiltInFunctionUnGuardAccount = "UnGuardAccount"

// BuiltInFunctionMigrateDataTrie is the built-in function key for migrating the data trie
const BuiltInFunctionMigrateDataTrie = "MigrateDataTrie"

// ESDTRoleLocalMint is the constant string for the local role of mint for ESDT tokens
const ESDTRoleLocalMint = "ESDTRoleLocalMint"

Expand Down Expand Up @@ -252,8 +258,17 @@ const SignalErrorOperation = "signalError"
// CompletedTxEventIdentifier is the identifier for the log that is generated when the execution of a smart contract call is done
const CompletedTxEventIdentifier = "completedTxEvent"

// InternalVMErrorsOperation is the identifier for the log that is generated when the execution of a smart contract generates an interval vm error
const InternalVMErrorsOperation = "internalVMErrors"

// GasRefundForRelayerMessage is the return message for to the smart contract result with refund for the relayer
const GasRefundForRelayerMessage = "gas refund for relayer"

// InitialVersionOfTransaction defines the initial version for a transaction
const InitialVersionOfTransaction = uint32(1)

// DefaultAddressPrefix is the default hrp of MultiversX/Elrond
const DefaultAddressPrefix = "erd"

// TopicRequestSuffix represents the topic name suffix for requests
const TopicRequestSuffix = "_REQUEST"
46 changes: 46 additions & 0 deletions core/errorHandling.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package core

import (
"errors"
"strings"
)

// IsGetNodeFromDBError returns true if the provided error is of type getNodeFromDB
func IsGetNodeFromDBError(err error) bool {
if err == nil {
return false
}

if IsClosingError(err) {
return false
}

return strings.Contains(err.Error(), GetNodeFromDBErrorString)
}

// IsClosingError returns true if the provided error is used whenever the node is in the closing process
func IsClosingError(err error) bool {
if err == nil {
return false
}

errString := err.Error()
return strings.Contains(errString, ErrDBIsClosed.Error()) ||
strings.Contains(errString, ErrContextClosing.Error())
}

// UnwrapGetNodeFromDBErr unwraps the provided error until it finds a GetNodeFromDbErrHandler
func UnwrapGetNodeFromDBErr(wrappedErr error) GetNodeFromDbErrHandler {
errWithKeyHandler, ok := wrappedErr.(GetNodeFromDbErrHandler)
for !ok {
if wrappedErr == nil {
return nil
}

err := errors.Unwrap(wrappedErr)
errWithKeyHandler, ok = err.(GetNodeFromDbErrHandler)
wrappedErr = err
}

return errWithKeyHandler
}
80 changes: 80 additions & 0 deletions core/errorHandling_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package core

import (
"fmt"
"testing"

"github.com/stretchr/testify/assert"
)

func TestIsGetNodeFromDBError(t *testing.T) {
t.Parallel()

t.Run("nil error", func(t *testing.T) {
t.Parallel()

assert.False(t, IsGetNodeFromDBError(nil))
})

t.Run("closing error", func(t *testing.T) {
t.Parallel()

assert.False(t, IsGetNodeFromDBError(ErrContextClosing))
assert.False(t, IsGetNodeFromDBError(ErrDBIsClosed))
})

t.Run("get node from db error", func(t *testing.T) {
t.Parallel()

assert.True(t, IsGetNodeFromDBError(fmt.Errorf("trie error: %s", GetNodeFromDBErrorString)))
})

t.Run("other error", func(t *testing.T) {
t.Parallel()

assert.False(t, IsGetNodeFromDBError(fmt.Errorf("trie error: %s", "other error")))
})
}

func TestIsClosingError(t *testing.T) {
t.Parallel()

t.Run("nil error", func(t *testing.T) {
t.Parallel()

assert.False(t, IsClosingError(nil))
})

t.Run("closing error", func(t *testing.T) {
t.Parallel()

assert.True(t, IsClosingError(ErrContextClosing))
assert.True(t, IsClosingError(ErrDBIsClosed))
})

t.Run("other error", func(t *testing.T) {
t.Parallel()

assert.False(t, IsClosingError(fmt.Errorf("trie error: %s", "other error")))
})
}

func TestUnwrapGetNodeFromDBErr(t *testing.T) {
t.Parallel()

key := []byte("key")
identifier := "identifier"
err := fmt.Errorf("key not found")

getNodeFromDbErr := NewGetNodeFromDBErrWithKey(key, err, identifier)
wrappedErr1 := fmt.Errorf("wrapped error 1: %w", getNodeFromDbErr)
wrappedErr2 := fmt.Errorf("wrapped error 2: %w", wrappedErr1)
wrappedErr3 := fmt.Errorf("wrapped error 3: %w", wrappedErr2)

assert.Nil(t, UnwrapGetNodeFromDBErr(nil))
assert.Nil(t, UnwrapGetNodeFromDBErr(err))
assert.Equal(t, getNodeFromDbErr, UnwrapGetNodeFromDBErr(getNodeFromDbErr))
assert.Equal(t, getNodeFromDbErr, UnwrapGetNodeFromDBErr(wrappedErr1))
assert.Equal(t, getNodeFromDbErr, UnwrapGetNodeFromDBErr(wrappedErr2))
assert.Equal(t, getNodeFromDbErr, UnwrapGetNodeFromDBErr(wrappedErr3))
}
9 changes: 9 additions & 0 deletions core/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,12 @@ var ErrNilGoRoutineProcessor = errors.New("nil go routine processor")

// ErrNilPubkeyConverter signals that a nil public key converter has been provided
var ErrNilPubkeyConverter = errors.New("nil pubkey converter")

// ErrContextClosing signals that the parent context requested the closing of its children
var ErrContextClosing = errors.New("context closing")

// ErrDBIsClosed is raised when the DB is closed
var ErrDBIsClosed = errors.New("DB is closed")

// ErrNilEnableEpochsHandler signals that a nil enable epochs handler has been provided
var ErrNilEnableEpochsHandler = errors.New("nil enable epochs handler")
Loading