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

native: cache GASPerBlock values #1424

Merged
merged 1 commit into from
Sep 28, 2020
Merged

native: cache GASPerBlock values #1424

merged 1 commit into from
Sep 28, 2020

Conversation

fyrchik
Copy link
Contributor

@fyrchik fyrchik commented Sep 24, 2020

Close #1421.

@codecov
Copy link

codecov bot commented Sep 24, 2020

Codecov Report

Merging #1424 into master will increase coverage by 0.04%.
The diff coverage is 90.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1424      +/-   ##
==========================================
+ Coverage   77.10%   77.15%   +0.04%     
==========================================
  Files         222      222              
  Lines       17382    17392      +10     
==========================================
+ Hits        13403    13419      +16     
+ Misses       3086     3082       -4     
+ Partials      893      891       -2     
Impacted Files Coverage Δ
pkg/core/native/native_neo.go 68.88% <90.47%> (+2.30%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 75753af...e0e7fd5. Read the comment docs.

pubs := n.GetCommitteeMembers()
index := int(ic.Block.Index) % len(ic.Chain.GetConfig().StandbyCommittee)
gas.Mul(gas, big.NewInt(committeeRewardRatio))
n.GAS.mint(ic, pubs[index].GetScriptHash(), gas.Div(gas, big.NewInt(100)))
n.OnPersistEnd(ic.DAO)
Copy link
Member

@AnnaShaleva AnnaShaleva Sep 28, 2020

Choose a reason for hiding this comment

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

Both Policy and Oracle contracts have OnPersistEnd method too, but this method is called from (bc *Blockchain) storeBlock (see link). Don't we want to unify OnPersistEnd calls for all native contracts?

Copy link
Member

Choose a reason for hiding this comment

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

We do, but it's not that simple unfortunately because of neo-project/neo#1913. In general, explicit OnPersistEnd in storeBlock is a kludge, so if we can avoid it here, better avoid it.

@roman-khimov roman-khimov merged commit e550608 into master Sep 28, 2020
@roman-khimov roman-khimov deleted the native/gasperblock branch September 28, 2020 10:36
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.

Cache GASPerBlock in NEO contract
3 participants