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

FIX: ProcessBuiltIn + SetBurnRole #6157

Merged
merged 12 commits into from
May 15, 2024

Conversation

mariusmihaic
Copy link
Contributor

@mariusmihaic mariusmihaic commented May 13, 2024

Reasoning behind the pull request

  • Fix merge conflict issue for ProcessBuiltInFunction and fix for SetBurnRole

Proposed changes

  • Mostly changes should be compared with this initial fix: 6561461
  • On top of that, added proper factories for vmContext

Testing procedure

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@mariusmihaic mariusmihaic self-assigned this May 13, 2024
}

// SendGlobalSettingToAll handles sending global settings information
func (sovHost *sovereignVMContext) SendGlobalSettingToAll(sender []byte, input []byte) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for this. Please revert. like really really no need.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the context handler.

}

// NewSovereignVMContext creates a new sovereign vm context
func NewSovereignVMContext(vmContext vm.ContextHandler) (*sovereignVMContext, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is NewSystemVMEEI - SovereignVMContext sounds bad.

It is ok that you pushed this context handler, but it needs a new name. It is the execution environmnent interface for the SystemVM.

BalanceDelta: big.NewInt(0),
}
host.outputAccounts[string(destAcc.Address)] = destAcc
}

destAcc.BalanceDelta = big.NewInt(0).Add(destAcc.BalanceDelta, value)
if host.isSovereignSCToSCCall(input) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isInShardSCToSCCall is a better name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, fixed it

Copy link

codecov bot commented May 14, 2024

Codecov Report

Attention: Patch coverage is 64.39024% with 73 lines in your changes are missing coverage. Please review.

Project coverage is 78.07%. Comparing base (0e40dd5) to head (d718d81).
Report is 233 commits behind head on feat/chain-go-sdk.

❗ Current head d718d81 differs from pull request most recent head 4a858b2. Consider uploading reports for the commit 4a858b2 to get more accurate results

Files Patch % Lines
vm/systemSmartContracts/esdt.go 36.47% 37 Missing and 17 partials ⚠️
vm/systemSmartContracts/eei.go 19.04% 16 Missing and 1 partial ⚠️
factory/runType/runTypeComponentsHandler.go 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                  Coverage Diff                  @@
##           feat/chain-go-sdk    #6157      +/-   ##
=====================================================
- Coverage              78.11%   78.07%   -0.04%     
=====================================================
  Files                    874      878       +4     
  Lines                 103470   103589     +119     
=====================================================
+ Hits                   80828    80880      +52     
- Misses                 17153    17197      +44     
- Partials                5489     5512      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

# Conflicts:
#	cmd/sovereignnode/go.mod
#	cmd/sovereignnode/go.sum
#	errors/errors.go
#	go.mod
#	go.sum
#	vm/systemSmartContracts/esdt.go
}

// NewSystemVMEEI creates a new system vm eei context, mainly used for now in sovereign chain
func NewSystemVMEEI(vmContext vm.ContextHandler) (*systemVMEEI, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be NewOneShardSystemVMEEI, the name is not good.

And should also have a rework on ProcessBuiltInFunction as well, without the sameShard IF in that case.

vmContext,
}, nil
}

// SendGlobalSettingToAll handles sending global settings information
func (sovHost *systemVMEEI) SendGlobalSettingToAll(sender []byte, input []byte) error {
func (sovHost *oneShardSystemVMEEI) SendGlobalSettingToAll(sender []byte, input []byte) error {
// TODO: MX-15470 remove sameShard check from ProcessBuiltInFunction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually have your own definition of ProcessBuiltInFunction - do not touch the ProcessBuiltInFunction from the original EEI.

@mariusmihaic mariusmihaic merged commit 539ff94 into feat/chain-go-sdk May 15, 2024
4 checks passed
@mariusmihaic mariusmihaic deleted the MX-15407-fix-process-builtin branch May 15, 2024 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants