Skip to content

Commit

Permalink
Merge branch 'master' into ready_delay
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinxie authored Jan 7, 2025
2 parents 62ef777 + d6886f1 commit 59b8648
Show file tree
Hide file tree
Showing 63 changed files with 1,738 additions and 1,021 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ ioctl [command]

Refer to [CLI document](https://docs.iotex.io/developer/ioctl/install.html) for more details.

## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=iotexproject/iotex-core&type=Date)](https://star-history.com/#iotexproject/iotex-core&Date)

## Contact

- Mailing list: [iotex-dev]([email protected])
Expand Down
2 changes: 0 additions & 2 deletions action/protocol/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ type (
SufficentBalanceGuarantee bool
EnableCancunEVM bool
UnfoldContainerBeforeValidate bool
CorrectValidationOrder bool
UnstakedButNotClearSelfStakeAmount bool
EnableNewTxTypes bool
VerifyNotContainerBeforeRun bool
Expand Down Expand Up @@ -310,7 +309,6 @@ func WithFeatureCtx(ctx context.Context) context.Context {
SufficentBalanceGuarantee: g.IsVanuatu(height),
EnableCancunEVM: g.IsVanuatu(height),
UnfoldContainerBeforeValidate: g.IsVanuatu(height),
CorrectValidationOrder: g.IsVanuatu(height),
UnstakedButNotClearSelfStakeAmount: !g.IsVanuatu(height),
EnableNewTxTypes: g.IsVanuatu(height),
VerifyNotContainerBeforeRun: g.IsVanuatu(height),
Expand Down
15 changes: 8 additions & 7 deletions action/protocol/execution/evm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func ExecuteContract(
if err != nil {
return nil, nil, err
}
retval, depositGas, remainingGas, contractAddress, statusCode, err := executeInEVM(ps, stateDB)
retval, depositGas, remainingGas, contractAddress, statusCode, err := executeInEVM(ctx, ps, stateDB)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -380,6 +380,7 @@ func prepareStateDB(ctx context.Context, sm protocol.StateManager) (*StateDBAdap
}
if featureCtx.FixRevertSnapshot || actionCtx.ReadOnly {
opts = append(opts, FixRevertSnapshotOption())
opts = append(opts, WithContext(ctx))
}
return NewStateDBAdapter(
sm,
Expand Down Expand Up @@ -427,7 +428,7 @@ func getChainConfig(g genesis.Blockchain, height uint64, id uint32, getBlockTime
}

// Error in executeInEVM is a consensus issue
func executeInEVM(evmParams *Params, stateDB *StateDBAdapter) ([]byte, uint64, uint64, string, iotextypes.ReceiptStatus, error) {
func executeInEVM(ctx context.Context, evmParams *Params, stateDB *StateDBAdapter) ([]byte, uint64, uint64, string, iotextypes.ReceiptStatus, error) {
var (
gasLimit = evmParams.blkCtx.GasLimit
blockHeight = evmParams.blkCtx.BlockHeight
Expand All @@ -436,7 +437,7 @@ func executeInEVM(evmParams *Params, stateDB *StateDBAdapter) ([]byte, uint64, u
chainConfig = evmParams.chainConfig
)
if err := securityDeposit(evmParams, stateDB, gasLimit); err != nil {
log.L().Warn("unexpected error: not enough security deposit", zap.Error(err))
log.T(ctx).Warn("unexpected error: not enough security deposit", zap.Error(err))
return nil, 0, 0, action.EmptyAddress, iotextypes.ReceiptStatus_Failure, err
}
var (
Expand Down Expand Up @@ -472,7 +473,7 @@ func executeInEVM(evmParams *Params, stateDB *StateDBAdapter) ([]byte, uint64, u
// create contract
var evmContractAddress common.Address
_, evmContractAddress, remainingGas, evmErr = evm.Create(executor, evmParams.data, remainingGas, amount)
log.L().Debug("evm Create.", log.Hex("addrHash", evmContractAddress[:]))
log.T(ctx).Debug("evm Create.", log.Hex("addrHash", evmContractAddress[:]))
if evmErr == nil {
if contractAddress, err := address.FromBytes(evmContractAddress.Bytes()); err == nil {
contractRawAddress = contractAddress.String()
Expand All @@ -484,7 +485,7 @@ func executeInEVM(evmParams *Params, stateDB *StateDBAdapter) ([]byte, uint64, u
ret, remainingGas, evmErr = evm.Call(executor, *evmParams.contract, evmParams.data, remainingGas, amount)
}
if evmErr != nil {
log.L().Debug("evm error", zap.Error(evmErr))
log.T(ctx).Debug("evm error", zap.Error(evmErr))
// The only possible consensus-error would be if there wasn't
// sufficient balance to make the transfer happen.
// Should be a hard fork (Bering)
Expand All @@ -493,7 +494,7 @@ func executeInEVM(evmParams *Params, stateDB *StateDBAdapter) ([]byte, uint64, u
}
}
if stateDB.Error() != nil {
log.L().Debug("statedb error", zap.Error(stateDB.Error()))
log.T(ctx).Debug("statedb error", zap.Error(stateDB.Error()))
}
if !rules.IsLondon {
// Before EIP-3529: refunds were capped to gasUsed / 2
Expand Down Expand Up @@ -532,7 +533,7 @@ func executeInEVM(evmParams *Params, stateDB *StateDBAdapter) ([]byte, uint64, u
} else {
addr = "contract creation"
}
log.L().Warn("evm internal error", zap.Error(evmErr),
log.T(ctx).Warn("evm internal error", zap.Error(evmErr),
zap.String("address", addr),
log.Hex("calldata", evmParams.data))
}
Expand Down
Loading

0 comments on commit 59b8648

Please sign in to comment.