-
Notifications
You must be signed in to change notification settings - Fork 197
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
Cleanup: moved the blockchain instantiation from the vm container factory #3825
Conversation
iulianpascalau
commented
Feb 21, 2022
•
edited
edited
- moved the blockchain hook instantiation from the vm container factory
- switched the usage of the accounts adapter API on the api-related operations
Codecov Report
@@ Coverage Diff @@
## development #3825 +/- ##
===============================================
- Coverage 74.62% 74.61% -0.01%
===============================================
Files 606 606
Lines 79672 79694 +22
===============================================
+ Hits 59457 59467 +10
- Misses 15640 15648 +8
- Partials 4575 4579 +4
Continue to review full report at Codecov.
|
@@ -59,6 +58,8 @@ type ArgsNewVMContainerFactory struct { | |||
EpochNotifier process.EpochNotifier | |||
EpochConfig *config.EpochConfig | |||
ShardCoordinator sharding.Coordinator | |||
PubkeyConv core.PubkeyConverter | |||
BlockChainHook process.BlockChainHookHandler |
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.
👍
@@ -230,8 +230,6 @@ func (m *Monitor) loadHeartbeatsFromStorer(pubKey string) (*heartbeatMessageInfo | |||
receivedHbmi := m.convertFromExportedStruct(*heartbeatDTO, m.maxDurationPeerUnresponsive) | |||
receivedHbmi.getTimeHandler = m.timer.Now | |||
crtTime := m.timer.Now() | |||
crtDuration := crtTime.Sub(receivedHbmi.lastUptimeDowntime) | |||
crtDuration = maxDuration(0, crtDuration) |
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.
Unused variable not spotted by the compiler? :)
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.
spotted by the linter, actually. :)
testscommon/blockChainHookStub.go
Outdated
// IsPayable - | ||
func (stub *BlockChainHookStub) IsPayable(_ []byte, recvAddress []byte) (bool, error) { | ||
if stub.IsPayableCalled != nil { | ||
return stub.IsPayableCalled(recvAddress) |
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.
don't ignore the first param as we might have some tests where we'd like to check it
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.
done
argsNewVmFactory := metachain.ArgsNewVMContainerFactory{ | ||
ArgBlockChainHook: argsHook, | ||
BlockChainHook: blockChainHookImpl, |
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.
CreateApiResolver
uses AccountsAdapter
and not AccountsAdapterAPI
. expected?
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.
good catch
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.
switched the usage of the AccountsAdapterApi but kept the read only accounts adapter wrapper in order to keep the consistency when executing (readonly accounts adapter won't call SaveAccount, for example, but won't return an error as the AccountsAdapterApi would)
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.
System test passed.