-
Notifications
You must be signed in to change notification settings - Fork 328
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 SimulateExecution, add sgd contract check #3983
Conversation
GetBlockHash: getBlockHash, | ||
GetBlockHash: getBlockHash, | ||
DepositGasFunc: rewarding.DepositGasWithSGD, | ||
Sgd: core.sgdIndexer, |
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.
will panic without WithSGDIndexer()
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.
No panic, evm will check sgd != nil internally.
https://github.com/iotexproject/iotex-core/pull/3983/files#diff-8d0192f25f9daf6c1bfa70c3b75949444fe5d1d47193e6b7c1210c39a19ed52aR287
action/protocol/execution/evm/evm.go
Outdated
@@ -279,6 +280,10 @@ func ExecuteContract( | |||
sharedGas uint64 | |||
sharedGasFee, totalGasFee *big.Int | |||
) | |||
// if gas price is zero, set it to smallest unit |
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.
no hard fork?
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.
deleted it will fix gasprice in another pr.
// TODO: move the logic out of SimulateExecution | ||
helperCtx := mustGetHelperCtx(ctx) | ||
ctx = WithHelperCtx(ctx, HelperContext{ | ||
GetBlockHash: helperCtx.GetBlockHash, | ||
DepositGasFunc: func(context.Context, protocol.StateManager, address.Address, *big.Int, *big.Int) (*action.TransactionLog, error) { | ||
return nil, nil | ||
}, | ||
Sgd: nil, | ||
}) |
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.
After moving this logic out, need to update on all the calling places
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.
fixed: add default depositGasFunc when ps.helperCtx.DepositGasFunc not set
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #3983 +/- ##
==========================================
+ Coverage 75.38% 76.13% +0.75%
==========================================
Files 303 330 +27
Lines 25923 28146 +2223
==========================================
+ Hits 19541 21429 +1888
- Misses 5360 5614 +254
- Partials 1022 1103 +81 ☔ View full report in Codecov by Sentry. |
action/protocol/execution/evm/evm.go
Outdated
@@ -291,7 +292,14 @@ func ExecuteContract( | |||
sharedGasFee.Mul(sharedGasFee, ps.txCtx.GasPrice) | |||
} | |||
totalGasFee = new(big.Int).Mul(new(big.Int).SetUint64(consumedGas), ps.txCtx.GasPrice) | |||
depositLog, err = ps.helperCtx.DepositGasFunc(ctx, sm, receiver, totalGasFee, sharedGasFee) | |||
if ps.helperCtx.DepositGasFunc == nil { |
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.
var depositLog, err
if ps.helperCtx.DepositGasFunc != nil {
...
}
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This reverts commit 5df2c68.
This reverts commit 5df2c68.
Description
as title
Fixes #(issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: