-
Notifications
You must be signed in to change notification settings - Fork 112
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
chore(pkg/scale): return error if Result
already has an assigned value
#2143
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason to prevent a subsequent Set()
on a result?
@qdm12 there's a slack thread about this issue but basically, if the
|
lgtm! |
Codecov Report
@@ Coverage Diff @@
## development #2143 +/- ##
===============================================
- Coverage 61.56% 61.55% -0.02%
===============================================
Files 213 213
Lines 27448 27500 +52
===============================================
+ Hits 16898 16927 +29
- Misses 8683 8704 +21
- Partials 1867 1869 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
…lue (#2143) * fix: return error if result already has an assigned value * chore: include unit test * chore: fix typo `ErrResultAlreadySet` * chore: remove unneeded `require.Error` * chore: fix undeclared name * chore: remove packaged scope var to avoid problems with result type * chore: fix result.Set error at offchain test
* chore(pkg/scale): return error if `Result` already has an assigned value (#2143) * fix: return error if result already has an assigned value * chore: include unit test * chore: fix typo `ErrResultAlreadySet` * chore: remove unneeded `require.Error` * chore: fix undeclared name * chore: remove packaged scope var to avoid problems with result type * chore: fix result.Set error at offchain test * init * migrate current tests to integration tests * fix linting * test line endings * remove test comments * test getSecondarySlotAuthor * secondary unit tests * calculate threshold tests * remove logs * test checkPrimaryThreshold * test babe/crypto * getAuthorityIndex test * babe mocks with mockgen * test verifyPrimarySlotWinner * test verifyPreruntime Digest * WIP/Test cases for verify authorship right * finish hitting test cases for equivocation * clean up naming for verifyBlockAuthor test * create helper for making verifier * use helpers to clean up verifyAuthorship test * clean up mocks * getConfigData test * test getVerifierInfo * remove logs * test first block cases for block verification * test VerifyBlock * finish first half of babe unit tests * remove coverage files * remove accidental diff * remove accidental diff again * fix linting * remove testing aliases * make calculate threshold error global * add go generate comment for babe state TODO/make sure ok form * fix mock generation * add newline to end of build integration test * newlines * wip/newline * test line endings * wip * remove crypto integration test * change threshold err message * wip * test * remove test comments * clean up * fix build error * CR feedback * more CR feedback * change threshold error name * remove empty fields * change how mockgen used * remove test log * cr feedback * remove errors from helper funcs * final helper fix * rebase and lint * CR feedback * lint Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
…lue (#2143) * fix: return error if result already has an assigned value * chore: include unit test * chore: fix typo `ErrResultAlreadySet` * chore: remove unneeded `require.Error` * chore: fix undeclared name * chore: remove packaged scope var to avoid problems with result type * chore: fix result.Set error at offchain test
…lue (#2143) * fix: return error if result already has an assigned value * chore: include unit test * chore: fix typo `ErrResultAlreadySet` * chore: remove unneeded `require.Error` * chore: fix undeclared name * chore: remove packaged scope var to avoid problems with result type * chore: fix result.Set error at offchain test
* chore(pkg/scale): return error if `Result` already has an assigned value (#2143) * fix: return error if result already has an assigned value * chore: include unit test * chore: fix typo `ErrResultAlreadySet` * chore: remove unneeded `require.Error` * chore: fix undeclared name * chore: remove packaged scope var to avoid problems with result type * chore: fix result.Set error at offchain test * test txt count and generate mocks with mockgen * WIP/hanldeTxnMsgTest * WIP/core message tests * wip/finish core message tests * wip/message test * fix reporting issue * test core messages * remove comments and lint * remove unused file * wip/cr feedback * use dummy error for tests * wip/finish cr feedback * wip/move message validation to a separate function * move txn validity check to new func * lint * fix variable naming to make less confusing * remove pointer from validateTxn helper params * refactor tests to define mocks in subtest * CR feedback * finish feedback for core tests * define runtime mocks in subtest * remane validTxn var Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
…ssage.go` unit tests (#2224) * chore(pkg/scale): return error if `Result` already has an assigned value (#2143) * fix: return error if result already has an assigned value * chore: include unit test * chore: fix typo `ErrResultAlreadySet` * chore: remove unneeded `require.Error` * chore: fix undeclared name * chore: remove packaged scope var to avoid problems with result type * chore: fix result.Set error at offchain test * migrate core tests to integration tests * remove test.log * upgrade integration tests to match dev * testing (dot/core): rewrite message.go unit tests (#2197) * chore(pkg/scale): return error if `Result` already has an assigned value (#2143) * fix: return error if result already has an assigned value * chore: include unit test * chore: fix typo `ErrResultAlreadySet` * chore: remove unneeded `require.Error` * chore: fix undeclared name * chore: remove packaged scope var to avoid problems with result type * chore: fix result.Set error at offchain test * test txt count and generate mocks with mockgen * WIP/hanldeTxnMsgTest * WIP/core message tests * wip/finish core message tests * wip/message test * fix reporting issue * test core messages * remove comments and lint * remove unused file * wip/cr feedback * use dummy error for tests * wip/finish cr feedback * wip/move message validation to a separate function * move txn validity check to new func * lint * fix variable naming to make less confusing * remove pointer from validateTxn helper params * refactor tests to define mocks in subtest * CR feedback * finish feedback for core tests * define runtime mocks in subtest * remane validTxn var Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com> * CR feedback * finish feedback * CR feedback Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Changes
ErrResultAlreadySet
Set
function check ifresult.mode
is notUnset
then return the errorTests
Issues
scale.Result
cannot allow more then oneSet
call #1962Primary Reviewer